Skip to content

Commit 44ccc84

Browse files
Merge pull request #13 from FoxComm/feature/order-summary
Feature/order summary
2 parents ddf7516 + 58931ec commit 44ccc84

84 files changed

Lines changed: 1513 additions & 696 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.flowconfig

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,11 @@ src
1616
esproposal.decorators=ignore
1717
esproposal.class_static_fields=enable
1818
esproposal.class_instance_fields=enable
19-
strip_root=true
2019
unsafe.enable_getters_and_setters=true
2120
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe
2221
module.system.node.resolve_dirname=node_modules
2322
module.system.node.resolve_dirname=src
2423

2524

2625
[version]
27-
>=0.45.0
26+
>=0.48.0

Makefile

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
.DEFAULT_GOAL := build
2+
3+
JS_FILES = $(shell find ./src -name "*.js" -o -name "*.jsx")
4+
PRETTIER_OPTIONS = --single-quote --trailing-comma es5 --print-width 120 # also prettier opts exists in package.json
5+
6+
setup: clean
7+
yarn --pure-lockfile
8+
9+
build:
10+
yarn build
11+
12+
clean:
13+
rm -rf ./node_modules
14+
rm -rf ./lib/*
15+
16+
test:
17+
yarn flow
18+
19+
fmt:
20+
./node_modules/.bin/prettier $(PRETTIER_OPTIONS) --write $(JS_FILES)
21+
22+
.PHONY: setup build clean test fmt

fixtures/order-placed.json

Lines changed: 162 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,162 @@
1+
{
2+
"referenceNumber": "BR14238",
3+
"paymentState": "cart",
4+
"lineItems": {
5+
"skus": [
6+
{
7+
"imagePath": "http://demandware.edgesuite.net/sits_pod20-adidas/dw/image/v2/aaqx_prd/on/demandware.static/-/Sites-adidas-products/en_US/dw1979e76a/zoom/BK6828_21_model.jpg",
8+
"referenceNumbers": [
9+
"b1979761-5359-2b3e-2293-93d725e03776"
10+
],
11+
"name": "3-Stripes Track Jacket",
12+
"sku": "BK6828_330",
13+
"price": 5000,
14+
"quantity": 1,
15+
"totalPrice": 5000,
16+
"productFormId": 71069,
17+
"trackInventory": true,
18+
"state": "pending",
19+
"attributes": {}
20+
},
21+
{
22+
"imagePath": "http://demandware.edgesuite.net/sits_pod20-adidas/dw/image/v2/aaqx_prd/on/demandware.static/-/Sites-adidas-products/en_US/dw1979e76a/zoom/BK6828_21_model.jpg",
23+
"referenceNumbers": [
24+
"b1979761-5359-2b3e-2293-93d725e03777"
25+
],
26+
"name": "2-Stripes Track Jacket",
27+
"sku": "BK6828_331",
28+
"price": 5000,
29+
"quantity": 1,
30+
"totalPrice": 5000,
31+
"productFormId": 71069,
32+
"trackInventory": true,
33+
"state": "pending",
34+
"attributes": {}
35+
}
36+
]
37+
},
38+
"lineItemAdjustments": [],
39+
"totals": {
40+
"subTotal": 10000,
41+
"taxes": 0,
42+
"shipping": 1500,
43+
"adjustments": 0,
44+
"total": 11500
45+
},
46+
"customer": {
47+
"id": 2087,
48+
"email": "version.ru+p1@gmail.com",
49+
"name": "A R",
50+
"createdAt": "2017-06-13T18:36:51.898Z",
51+
"disabled": false,
52+
"isGuest": false,
53+
"isBlacklisted": false,
54+
"totalSales": 0,
55+
"storeCreditTotals": {
56+
"availableBalance": 0,
57+
"currentBalance": 0
58+
},
59+
"groups": []
60+
},
61+
"shippingMethod": {
62+
"id": 3,
63+
"name": "2-3 day express (FedEx)",
64+
"code": "EXPRESS",
65+
"price": 1500,
66+
"isEnabled": true
67+
},
68+
"shippingAddress": {
69+
"id": 3565,
70+
"region": {
71+
"id": 4161,
72+
"countryId": 234,
73+
"name": "New York"
74+
},
75+
"name": "AR",
76+
"address1": "1st aben",
77+
"address2": "",
78+
"city": "Schenectady",
79+
"zip": "12345",
80+
"isDefault": false,
81+
"phoneNumber": "2342342134"
82+
},
83+
"billingAddress": {
84+
"id": 0,
85+
"region": {
86+
"id": 4161,
87+
"countryId": 234,
88+
"name": "New York"
89+
},
90+
"name": "AR",
91+
"address1": "1st aben",
92+
"address2": "",
93+
"city": "Schenectady",
94+
"zip": "12345",
95+
"phoneNumber": "2342342134"
96+
},
97+
"billingCreditCardInfo": {
98+
"id": 3504,
99+
"customerId": 2087,
100+
"holderName": "def",
101+
"lastFour": "4242",
102+
"expMonth": 1,
103+
"expYear": 2018,
104+
"brand": "Visa",
105+
"address": {
106+
"id": 0,
107+
"region": {
108+
"id": 4161,
109+
"countryId": 234,
110+
"name": "New York"
111+
},
112+
"name": "AR",
113+
"address1": "1st aben",
114+
"address2": "",
115+
"city": "Schenectady",
116+
"zip": "12345",
117+
"phoneNumber": "2342342134"
118+
},
119+
"type": "creditCard",
120+
"createdAt": "2017-06-13T18:38:25.180Z"
121+
},
122+
"paymentMethods": [
123+
{
124+
"id": 3504,
125+
"customerId": 2087,
126+
"holderName": "def",
127+
"lastFour": "4242",
128+
"expMonth": 1,
129+
"expYear": 2018,
130+
"brand": "Visa",
131+
"address": {
132+
"id": 0,
133+
"region": {
134+
"id": 4161,
135+
"countryId": 234,
136+
"name": "New York"
137+
},
138+
"name": "AR",
139+
"address1": "1st aben",
140+
"address2": "",
141+
"city": "Schenectady",
142+
"zip": "12345",
143+
"phoneNumber": "2342342134"
144+
},
145+
"type": "creditCard",
146+
"createdAt": "2017-06-13T18:38:25.180Z"
147+
},
148+
{
149+
"code": "B59F6582943910EB",
150+
"amount": 10000,
151+
"currentBalance": 10000,
152+
"availableBalance": 3500,
153+
"createdAt": "2017-06-15T16:26:51.781Z",
154+
"type": "giftCard"
155+
}
156+
],
157+
"orderState": "remorseHold",
158+
"shippingState": "remorseHold",
159+
"fraudScore": 0,
160+
"remorsePeriodEnd": "2017-06-15T16:57:39.520Z",
161+
"placedAt": "2017-06-15T16:27:39.520Z"
162+
}

package.json

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,14 @@
99
"build": "npm run build-css && npm run build-js",
1010
"prepublish": "npm run build",
1111
"styleguidist": "NODE_PATH=./src styleguidist server --config styleguide.config.js",
12-
"flow": "flow check"
12+
"flow": "flow check",
13+
"precommit": "lint-staged"
14+
},
15+
"lint-staged": {
16+
"*.{js,jsx}": [
17+
"prettier --single-quote --trailing-comma es5 --print-width 120 --write",
18+
"git add"
19+
]
1320
},
1421
"publishConfig": {
1522
"registry": "https://npm.foxcommerce.com:4873"
@@ -50,16 +57,21 @@
5057
"eslint-plugin-jsx-a11y": "^5.0.1",
5158
"eslint-plugin-react": "^7.0.1",
5259
"file-loader": "^0.11.1",
53-
"flow-bin": "^0.46.0",
60+
"flow-bin": "^0.48.0",
5461
"fs-extra": "^3.0.1",
5562
"gulp": "^3.9.1",
5663
"gulp-add-src": "^0.2.0",
5764
"gulp-concat": "^2.6.1",
5865
"gulp-postcss": "^7.0.0",
5966
"gulp-sourcemaps": "^2.6.0",
67+
"husky": "^0.13.4",
68+
"lint-staged": "^4.0.0",
6069
"postcss": "5.x.x",
6170
"postcss-cssnext": "^2.10.0",
6271
"postcss-loader": "^2.0.5",
72+
"postcss-modules-local-by-default": "^1.2.0",
73+
"postcss-modules-scope": "^1.1.0",
74+
"prettier": "^1.4.4",
6375
"react-docgen": "^2.15.0",
6476
"react-styleguidist": "^5.2.1",
6577
"style-loader": "^0.17.0",
@@ -70,7 +82,7 @@
7082
"react-dom": "^15.5.4"
7183
},
7284
"dependencies": {
73-
"@foxcomm/api-js": "^1.2.0",
85+
"@foxcomm/api-js": "^1.3.0",
7486
"@foxcomm/wings": "^1.9.12",
7587
"classnames": "^2.2.5",
7688
"core-decorators": "^0.19.0",

postcss.config.js

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,28 @@
22
const path = require('path');
33
const fs = require('fs-extra');
44

5+
const seenPaths = Object.create(null);
6+
57
// '../../src/components/select/select' + 'option' -> 'fc/select__option'
68
function generateScopedName(exportedName, filepath) {
7-
const sanitisedPath = path.relative(process.cwd(), filepath)
9+
const filepathRelative = path.relative(process.cwd(), filepath);
10+
const sanitisedPath = filepathRelative
811
.replace('src/components', '')
912
.replace('src/css', '')
1013
.replace(/\.[^\.\/\\]+$/, '')
11-
.replace(/^[\.\/\\]+/, '')
12-
.replace(/\//g, '⁄');
14+
.replace(/^[\.\/\\]+/, '');
1315

16+
const finalPath = path.basename(sanitisedPath).replace(/\//g, '⁄');
17+
if (finalPath in seenPaths) {
18+
if (seenPaths[finalPath] != filepathRelative) {
19+
throw new Error(`Couldn't use ${filepathRelative} in order to there is already file with same basename: ${seenPaths[finalPath]}`);
20+
}
21+
} else {
22+
seenPaths[finalPath] = filepathRelative;
23+
}
1424
const sanitisedName = exportedName.replace(/^_+|_+$/g, '');
1525

16-
return `fc_${sanitisedPath}__${sanitisedName}`;
26+
return `fc_${finalPath}__${sanitisedName}`;
1727
}
1828

1929
const plugins = [
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
21
export default from './action-link';

src/components/core/alerts/error-alerts.jsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ import classnames from 'classnames';
55
import s from './error-alerts.css';
66
import WingsErrorAlerts from '@foxcomm/wings/lib/ui/alerts/error-alerts';
77

8-
9-
const ErrorAlerts = (props) => {
8+
const ErrorAlerts = props => {
109
const className = classnames(s.block, props.className);
1110
return <WingsErrorAlerts {...props} className={className} />;
1211
};

0 commit comments

Comments
 (0)