fontdue-js 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/__generated__/TypeTestersIDQuery.graphql.js +103 -57
- package/dist/__generated__/TypeTestersSlugQuery.graphql.js +103 -57
- package/dist/__generated__/TypeTesters_collection.graphql.d.ts +3 -0
- package/dist/__generated__/TypeTesters_collection.graphql.js +20 -6
- package/dist/components/AddToCartBanner/index.js +6 -4
- package/dist/components/BuyButton/index.js +21 -17
- package/dist/components/BuyingOptions/index.js +10 -7
- package/dist/components/Cart/AddressFields.js +10 -7
- package/dist/components/Cart/CartItem/index.js +71 -53
- package/dist/components/Cart/CartOrder.js +18 -14
- package/dist/components/Cart/CartState.js +16 -13
- package/dist/components/Cart/CartTotals.js +65 -59
- package/dist/components/Cart/Checkout.js +30 -23
- package/dist/components/Cart/CustomerFields.js +7 -6
- package/dist/components/Cart/Download.js +11 -9
- package/dist/components/Cart/EmptyCart.js +5 -4
- package/dist/components/Cart/IdentityBox.js +27 -24
- package/dist/components/Cart/index.js +23 -17
- package/dist/components/CartButton/index.js +12 -9
- package/dist/components/CharacterViewer/index.js +65 -54
- package/dist/components/CollectionAa/index.js +15 -11
- package/dist/components/CookieNotification/index.js +46 -38
- package/dist/components/CouponText/index.js +6 -4
- package/dist/components/Family/FamilyList.js +23 -20
- package/dist/components/Family/index.js +11 -8
- package/dist/components/FontFamilies/index.js +15 -12
- package/dist/components/FontStyle/index.js +10 -9
- package/dist/components/FontdueProvider/index.js +7 -6
- package/dist/components/NewsletterSignup/index.js +12 -10
- package/dist/components/Precart/License.js +8 -7
- package/dist/components/Precart/index.js +16 -11
- package/dist/components/Price/index.js +34 -27
- package/dist/components/PriceBar/PriceBarSection.js +14 -11
- package/dist/components/PriceBar/index.js +2 -2
- package/dist/components/Root/index.js +4 -1
- package/dist/components/Root/productState.js +3 -2
- package/dist/components/SKUPrice/index.js +7 -6
- package/dist/components/Select/index.js +22 -15
- package/dist/components/SelectButton/index.js +15 -13
- package/dist/components/SelectField/index.js +27 -24
- package/dist/components/SpecimenLink/index.js +14 -11
- package/dist/components/StickyNav/index.js +16 -13
- package/dist/components/StoreModal/StoreModalBundleButton.js +7 -6
- package/dist/components/StoreModal/StoreModalCart.js +10 -8
- package/dist/components/StoreModal/StoreModalCheckout.js +5 -4
- package/dist/components/StoreModal/StoreModalContainer.js +4 -3
- package/dist/components/StoreModal/StoreModalDownload.js +5 -4
- package/dist/components/StoreModal/StoreModalFamily.js +5 -4
- package/dist/components/StoreModal/StoreModalFamilyButton.js +7 -6
- package/dist/components/StoreModal/StoreModalIndex.js +4 -3
- package/dist/components/StoreModal/StoreModalLoader.js +4 -3
- package/dist/components/StoreModal/StoreModalProduct.js +4 -3
- package/dist/components/StoreModal/StoreModalReview.js +11 -9
- package/dist/components/StoreModal/StoreModalReviewIdentity.js +6 -3
- package/dist/components/StoreModal/StoreModalStyleButton.js +7 -6
- package/dist/components/StoreModalProductLicenseSelection/ContainerElement.js +15 -12
- package/dist/components/StoreModalProductLicenseSelection/LicenseElement.js +9 -8
- package/dist/components/StoreModalProductLicenseSelection/LicenseVariableElement.js +31 -25
- package/dist/components/StoreModalProductLicenseSelection/LicenseVariableRadioElement.js +13 -10
- package/dist/components/StoreModalProductLicenseSelection/StoreModalProductLicense.js +22 -13
- package/dist/components/StoreModalProductLicenseSelection/index.js +12 -9
- package/dist/components/StoreModalProductSummary/index.js +10 -8
- package/dist/components/StripeProvider/index.js +5 -4
- package/dist/components/Stylesheet/index.js +4 -3
- package/dist/components/TestFontsForm/index.js +32 -25
- package/dist/components/TestModeBanner/index.js +9 -7
- package/dist/components/TextField/index.js +32 -29
- package/dist/components/ThemeConfig/index.js +9 -7
- package/dist/components/TypeTester/TypeTesterAlignButtons.js +5 -4
- package/dist/components/TypeTester/TypeTesterBullet.js +5 -4
- package/dist/components/TypeTester/TypeTesterContent.js +9 -8
- package/dist/components/TypeTester/TypeTesterContext.js +6 -5
- package/dist/components/TypeTester/TypeTesterEditAll.js +4 -3
- package/dist/components/TypeTester/TypeTesterFeatures.js +16 -10
- package/dist/components/TypeTester/TypeTesterFeaturesButton.js +18 -15
- package/dist/components/TypeTester/TypeTesterFitter.js +5 -4
- package/dist/components/TypeTester/TypeTesterFloatingToolbar.js +6 -5
- package/dist/components/TypeTester/TypeTesterInput.js +7 -6
- package/dist/components/TypeTester/TypeTesterSlider.js +15 -11
- package/dist/components/TypeTester/TypeTesterStandalone.js +18 -16
- package/dist/components/TypeTester/TypeTesterState.js +4 -3
- package/dist/components/TypeTester/TypeTesterStyleSelect.js +39 -26
- package/dist/components/TypeTester/TypeTesterStyleSelectData.js +7 -6
- package/dist/components/TypeTester/TypeTesterToolbar.js +6 -5
- package/dist/components/TypeTester/index.js +36 -29
- package/dist/components/TypeTester/useTypeTesterStyler.js +21 -19
- package/dist/components/TypeTesters/index.js +40 -34
- package/dist/components/VariableTableAmounts/index.js +5 -4
- package/dist/components/elements/Button/index.js +11 -8
- package/dist/components/elements/StoreModalCartLayout/index.js +29 -26
- package/dist/components/elements/StoreModalContainer/index.js +14 -13
- package/dist/components/elements/StoreModalDownloadLayout/index.js +17 -14
- package/dist/components/elements/StoreModalFamily/index.js +22 -19
- package/dist/components/elements/StoreModalFamilyButton/index.js +12 -11
- package/dist/components/elements/StoreModalIndexItem/index.js +9 -8
- package/dist/components/elements/StoreModalPageContainer/index.js +18 -15
- package/dist/components/elements/StoreModalReviewConfirm/index.js +9 -8
- package/dist/components/elements/StoreModalReviewItem/index.js +11 -8
- package/dist/components/elements/StoreModalReviewLayout/index.js +50 -47
- package/dist/components/elements/StoreModalStyleButton/index.js +10 -9
- package/dist/components/useFontStyle.js +6 -5
- package/dist/utils.js +3 -2
- package/dist/vanilla/FontStyle.js +10 -8
- package/fontdue.css +6 -0
- package/fontdue.css.map +1 -1
- package/package.json +1 -1
|
@@ -11,13 +11,16 @@ var _reactRedux = require("react-redux");
|
|
|
11
11
|
|
|
12
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
13
|
|
|
14
|
-
const BuyingOptions =
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
14
|
+
const BuyingOptions = _ref => {
|
|
15
|
+
let {
|
|
16
|
+
onPrecartOpen
|
|
17
|
+
} = _ref;
|
|
18
|
+
return /*#__PURE__*/_react.default.createElement("button", {
|
|
19
|
+
type: "button",
|
|
20
|
+
className: "buying-options buy-family__options__button",
|
|
21
|
+
onClick: onPrecartOpen
|
|
22
|
+
}, "Buying options");
|
|
23
|
+
};
|
|
21
24
|
|
|
22
25
|
const mapDispatchToProps = dispatch => ({
|
|
23
26
|
onPrecartOpen: () => dispatch({
|
|
@@ -52,13 +52,16 @@ class AddressFields extends _react.default.Component {
|
|
|
52
52
|
return `${text}${suffix}`;
|
|
53
53
|
};
|
|
54
54
|
|
|
55
|
-
const countries = viewer.countries.map(
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
55
|
+
const countries = viewer.countries.map(_ref => {
|
|
56
|
+
let {
|
|
57
|
+
code,
|
|
58
|
+
name
|
|
59
|
+
} = _ref;
|
|
60
|
+
return {
|
|
61
|
+
value: code,
|
|
62
|
+
label: name
|
|
63
|
+
};
|
|
64
|
+
});
|
|
62
65
|
const administrativeAreas = countryData && countryData.subRegions && countryData.subRegions.map(region => ({
|
|
63
66
|
value: region.key,
|
|
64
67
|
label: region.name
|
|
@@ -40,12 +40,13 @@ const plural = (count, singularString, pluralString) => {
|
|
|
40
40
|
const groupSelectionsByLicense = node => {
|
|
41
41
|
var _node$licenseSelectio;
|
|
42
42
|
|
|
43
|
-
return (_node$licenseSelectio = node.licenseSelections) === null || _node$licenseSelectio === void 0 ? void 0 : _node$licenseSelectio.reduce((res, {
|
|
44
|
-
license,
|
|
45
|
-
...selection
|
|
46
|
-
}) => {
|
|
43
|
+
return (_node$licenseSelectio = node.licenseSelections) === null || _node$licenseSelectio === void 0 ? void 0 : _node$licenseSelectio.reduce((res, _ref) => {
|
|
47
44
|
var _res$license$id$selec, _res$license$id;
|
|
48
45
|
|
|
46
|
+
let {
|
|
47
|
+
license,
|
|
48
|
+
...selection
|
|
49
|
+
} = _ref;
|
|
49
50
|
return { ...res,
|
|
50
51
|
[license.id]: {
|
|
51
52
|
license,
|
|
@@ -61,19 +62,23 @@ const productName = product => {
|
|
|
61
62
|
return product.name;
|
|
62
63
|
};
|
|
63
64
|
|
|
64
|
-
const ProductName =
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
}) => {
|
|
65
|
+
const ProductName = _ref2 => {
|
|
66
|
+
let {
|
|
67
|
+
product
|
|
68
|
+
} = _ref2;
|
|
69
|
+
return /*#__PURE__*/_react.default.createElement("h3", {
|
|
70
|
+
className: "cart-item__name"
|
|
71
|
+
}, productName(product));
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
const Variable = _ref3 => {
|
|
75
75
|
var _selection$option, _selection$option2, _selection$option3, _variable$options;
|
|
76
76
|
|
|
77
|
+
let {
|
|
78
|
+
selection,
|
|
79
|
+
variable,
|
|
80
|
+
onChange
|
|
81
|
+
} = _ref3;
|
|
77
82
|
if (!variable) return null;
|
|
78
83
|
if (!selection.variable) return null;
|
|
79
84
|
return /*#__PURE__*/_react.default.createElement("label", {
|
|
@@ -103,17 +108,20 @@ const Variable = ({
|
|
|
103
108
|
}));
|
|
104
109
|
};
|
|
105
110
|
|
|
106
|
-
const getSelectionIds =
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
111
|
+
const getSelectionIds = _ref4 => {
|
|
112
|
+
let {
|
|
113
|
+
license,
|
|
114
|
+
variable,
|
|
115
|
+
option,
|
|
116
|
+
variableText
|
|
117
|
+
} = _ref4;
|
|
118
|
+
return {
|
|
119
|
+
licenseId: license.id,
|
|
120
|
+
licenseVariableId: variable ? variable.id : null,
|
|
121
|
+
licenseOptionId: option ? option.id : null,
|
|
122
|
+
variableText
|
|
123
|
+
};
|
|
124
|
+
};
|
|
117
125
|
|
|
118
126
|
const inputFromOptionChange = (node, variableId, value) => {
|
|
119
127
|
var _node$licenseSelectio2, _node$licenseSelectio3;
|
|
@@ -141,9 +149,12 @@ const inputFromOptionChange = (node, variableId, value) => {
|
|
|
141
149
|
const inputFromLicenseRemoval = (node, licenseToRemove) => {
|
|
142
150
|
var _node$licenseSelectio4, _node$licenseSelectio5;
|
|
143
151
|
|
|
144
|
-
const licenseSelections = (_node$licenseSelectio4 = (_node$licenseSelectio5 = node.licenseSelections) === null || _node$licenseSelectio5 === void 0 ? void 0 : _node$licenseSelectio5.filter(
|
|
145
|
-
|
|
146
|
-
|
|
152
|
+
const licenseSelections = (_node$licenseSelectio4 = (_node$licenseSelectio5 = node.licenseSelections) === null || _node$licenseSelectio5 === void 0 ? void 0 : _node$licenseSelectio5.filter(_ref5 => {
|
|
153
|
+
let {
|
|
154
|
+
license
|
|
155
|
+
} = _ref5;
|
|
156
|
+
return license.id !== licenseToRemove.id;
|
|
157
|
+
}).map(getSelectionIds)) !== null && _node$licenseSelectio4 !== void 0 ? _node$licenseSelectio4 : [];
|
|
147
158
|
return {
|
|
148
159
|
id: node.id,
|
|
149
160
|
licenseSelections
|
|
@@ -180,17 +191,21 @@ const inputFromLicenseAddition = (node, licenseToAdd) => {
|
|
|
180
191
|
};
|
|
181
192
|
};
|
|
182
193
|
|
|
183
|
-
const AdditionalLicenses =
|
|
184
|
-
licenses,
|
|
185
|
-
orderItem,
|
|
186
|
-
onAddLicense
|
|
187
|
-
}) => {
|
|
194
|
+
const AdditionalLicenses = _ref6 => {
|
|
188
195
|
var _orderItem$licenseSel;
|
|
189
196
|
|
|
197
|
+
let {
|
|
198
|
+
licenses,
|
|
199
|
+
orderItem,
|
|
200
|
+
onAddLicense
|
|
201
|
+
} = _ref6;
|
|
190
202
|
if (!licenses) return null;
|
|
191
|
-
const licenseIds = (_orderItem$licenseSel = orderItem.licenseSelections) === null || _orderItem$licenseSel === void 0 ? void 0 : _orderItem$licenseSel.map(
|
|
192
|
-
|
|
193
|
-
|
|
203
|
+
const licenseIds = (_orderItem$licenseSel = orderItem.licenseSelections) === null || _orderItem$licenseSel === void 0 ? void 0 : _orderItem$licenseSel.map(_ref7 => {
|
|
204
|
+
let {
|
|
205
|
+
license
|
|
206
|
+
} = _ref7;
|
|
207
|
+
return license.id;
|
|
208
|
+
});
|
|
194
209
|
const additionalLicenses = licenses.filter(license => !(licenseIds !== null && licenseIds !== void 0 && licenseIds.some(id => id === license.id)));
|
|
195
210
|
if (additionalLicenses.length < 1) return null;
|
|
196
211
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -203,14 +218,15 @@ const AdditionalLicenses = ({
|
|
|
203
218
|
}, license.name)));
|
|
204
219
|
};
|
|
205
220
|
|
|
206
|
-
const CartItemLicense =
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
221
|
+
const CartItemLicense = _ref8 => {
|
|
222
|
+
let {
|
|
223
|
+
node,
|
|
224
|
+
onChange,
|
|
225
|
+
license,
|
|
226
|
+
closeButtonMouseEnter: parentCloseButtonMouseEnter,
|
|
227
|
+
closeButtonMouseLeave: parentCloseButtonMouseLeave,
|
|
228
|
+
selections
|
|
229
|
+
} = _ref8;
|
|
214
230
|
if (!license) return null;
|
|
215
231
|
const [closeButtonIsHovered, setCloseButtonIsHovered] = (0, _react.useState)(false);
|
|
216
232
|
|
|
@@ -248,11 +264,12 @@ const CartItemLicense = ({
|
|
|
248
264
|
}, /*#__PURE__*/_react.default.createElement(Variable, {
|
|
249
265
|
selection: selection,
|
|
250
266
|
onChange: value => onChange(inputFromOptionChange(node, selection.variable.id, value)),
|
|
251
|
-
variable: (_license$variables = license.variables) === null || _license$variables === void 0 ? void 0 : _license$variables.find(
|
|
252
|
-
id
|
|
253
|
-
}) => {
|
|
267
|
+
variable: (_license$variables = license.variables) === null || _license$variables === void 0 ? void 0 : _license$variables.find(_ref9 => {
|
|
254
268
|
var _selection$variable2;
|
|
255
269
|
|
|
270
|
+
let {
|
|
271
|
+
id
|
|
272
|
+
} = _ref9;
|
|
256
273
|
return id === ((_selection$variable2 = selection.variable) === null || _selection$variable2 === void 0 ? void 0 : _selection$variable2.id);
|
|
257
274
|
})
|
|
258
275
|
}));
|
|
@@ -274,13 +291,14 @@ const productCss = product => {
|
|
|
274
291
|
if (product.__typename === 'FontCollection') return (_product$featureStyle = product.featureStyle) === null || _product$featureStyle === void 0 ? void 0 : (_product$featureStyle2 = _product$featureStyle.family) === null || _product$featureStyle2 === void 0 ? void 0 : _product$featureStyle2.cssUrl;
|
|
275
292
|
};
|
|
276
293
|
|
|
277
|
-
const CartItemBase =
|
|
278
|
-
node,
|
|
279
|
-
viewer,
|
|
280
|
-
onChange
|
|
281
|
-
}) => {
|
|
294
|
+
const CartItemBase = _ref10 => {
|
|
282
295
|
var _node$sku$product$tot;
|
|
283
296
|
|
|
297
|
+
let {
|
|
298
|
+
node,
|
|
299
|
+
viewer,
|
|
300
|
+
onChange
|
|
301
|
+
} = _ref10;
|
|
284
302
|
const [closeButtonIsHovered, setCloseButtonIsHovered] = (0, _react.useState)(false);
|
|
285
303
|
|
|
286
304
|
const closeButtonMouseEnter = () => {
|
|
@@ -55,17 +55,20 @@ const orderChangeInput = (order, orderItem) => order.orderItems.reduce((res, ite
|
|
|
55
55
|
if (item.id === orderItem.id) return res.concat(orderItem);
|
|
56
56
|
return res.concat({
|
|
57
57
|
id: item.id,
|
|
58
|
-
licenseSelections: item.licenseSelections.map(
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
58
|
+
licenseSelections: item.licenseSelections.map(_ref => {
|
|
59
|
+
let {
|
|
60
|
+
license,
|
|
61
|
+
licenseVariable,
|
|
62
|
+
licenseOption,
|
|
63
|
+
variableText
|
|
64
|
+
} = _ref;
|
|
65
|
+
return {
|
|
66
|
+
licenseId: license.id,
|
|
67
|
+
licenseVariableId: licenseVariable && licenseVariable.id,
|
|
68
|
+
licenseOptionId: licenseOption && licenseOption.id,
|
|
69
|
+
variableText
|
|
70
|
+
};
|
|
71
|
+
})
|
|
69
72
|
});
|
|
70
73
|
}, [])
|
|
71
74
|
/* remove order items if there are no licenses */
|
|
@@ -210,9 +213,10 @@ class CartOrderBase extends _react.default.Component {
|
|
|
210
213
|
});
|
|
211
214
|
};
|
|
212
215
|
|
|
213
|
-
this.applyCoupon =
|
|
214
|
-
|
|
215
|
-
|
|
216
|
+
this.applyCoupon = _ref2 => {
|
|
217
|
+
let {
|
|
218
|
+
code
|
|
219
|
+
} = _ref2;
|
|
216
220
|
(0, _reactRelay.commitMutation)(this.props.environment, {
|
|
217
221
|
mutation: applyCouponMutation,
|
|
218
222
|
variables: {
|
|
@@ -15,10 +15,11 @@ const orderChangeMutation = _CartStateUpdateMutation !== void 0 ? _CartStateUpda
|
|
|
15
15
|
const applyCouponMutation = _CartStateApplyCouponMutation !== void 0 ? _CartStateApplyCouponMutation : (_CartStateApplyCouponMutation = require("../../__generated__/CartStateApplyCouponMutation.graphql"), _CartStateApplyCouponMutation.hash && _CartStateApplyCouponMutation.hash !== "e6fc6e27365198e294823fe13d0aee27" && console.error("The definition of 'CartStateApplyCouponMutation' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data."), _CartStateApplyCouponMutation);
|
|
16
16
|
const removeDiscountMutation = _CartStateRemoveDiscountMutation !== void 0 ? _CartStateRemoveDiscountMutation : (_CartStateRemoveDiscountMutation = require("../../__generated__/CartStateRemoveDiscountMutation.graphql"), _CartStateRemoveDiscountMutation.hash && _CartStateRemoveDiscountMutation.hash !== "808c5ea872ec3b3d78a88528112fb658" && console.error("The definition of 'CartStateRemoveDiscountMutation' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data."), _CartStateRemoveDiscountMutation);
|
|
17
17
|
|
|
18
|
-
const CartState =
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
const CartState = _ref => {
|
|
19
|
+
let {
|
|
20
|
+
order,
|
|
21
|
+
children
|
|
22
|
+
} = _ref;
|
|
22
23
|
const [error, setError] = (0, _react.useState)(null);
|
|
23
24
|
const [errors, setErrors] = (0, _react.useState)(null);
|
|
24
25
|
const environment = (0, _reactRelay.useRelayEnvironment)();
|
|
@@ -47,12 +48,13 @@ const CartState = ({
|
|
|
47
48
|
if (!item.licenseSelections) return res;
|
|
48
49
|
return res.concat({
|
|
49
50
|
id: item.id,
|
|
50
|
-
licenseSelections: item.licenseSelections.map(
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
51
|
+
licenseSelections: item.licenseSelections.map(_ref2 => {
|
|
52
|
+
let {
|
|
53
|
+
license,
|
|
54
|
+
licenseVariable,
|
|
55
|
+
licenseOption,
|
|
56
|
+
variableText
|
|
57
|
+
} = _ref2;
|
|
56
58
|
if (!license) return null;
|
|
57
59
|
return {
|
|
58
60
|
licenseId: license.id,
|
|
@@ -67,9 +69,10 @@ const CartState = ({
|
|
|
67
69
|
.filter(item => item.licenseSelections.length > 0);
|
|
68
70
|
handleSubmitOrderChange(newItems);
|
|
69
71
|
}, [order, handleSubmitOrderChange]);
|
|
70
|
-
const handleSubmitCoupon = (0, _react.useCallback)(
|
|
71
|
-
|
|
72
|
-
|
|
72
|
+
const handleSubmitCoupon = (0, _react.useCallback)(_ref3 => {
|
|
73
|
+
let {
|
|
74
|
+
code
|
|
75
|
+
} = _ref3;
|
|
73
76
|
(0, _reactRelay.commitMutation)(environment, {
|
|
74
77
|
mutation: applyCouponMutation,
|
|
75
78
|
variables: {
|
|
@@ -23,66 +23,72 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
23
23
|
|
|
24
24
|
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
25
25
|
|
|
26
|
-
const PriceBlock =
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
"
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
},
|
|
38
|
-
|
|
39
|
-
}, /*#__PURE__*/_react.default.createElement(
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
26
|
+
const PriceBlock = _ref => {
|
|
27
|
+
let {
|
|
28
|
+
label,
|
|
29
|
+
belowPrice,
|
|
30
|
+
price,
|
|
31
|
+
invert,
|
|
32
|
+
...rest
|
|
33
|
+
} = _ref;
|
|
34
|
+
return /*#__PURE__*/_react.default.createElement("div", _extends({
|
|
35
|
+
className: "cart__price-block",
|
|
36
|
+
"data-label": label
|
|
37
|
+
}, rest), /*#__PURE__*/_react.default.createElement("div", {
|
|
38
|
+
className: "cart__price-block__label"
|
|
39
|
+
}, label), /*#__PURE__*/_react.default.createElement("div", {
|
|
40
|
+
className: "cart__price-block__price"
|
|
41
|
+
}, /*#__PURE__*/_react.default.createElement(_Price.default, {
|
|
42
|
+
price: price,
|
|
43
|
+
invert: invert
|
|
44
|
+
}), belowPrice));
|
|
45
|
+
};
|
|
43
46
|
|
|
44
|
-
const CartTotals =
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
"
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
},
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
47
|
+
const CartTotals = _ref2 => {
|
|
48
|
+
let {
|
|
49
|
+
order,
|
|
50
|
+
onRemoveDiscount,
|
|
51
|
+
allowDiscountRemoval = true,
|
|
52
|
+
hideTotal = false
|
|
53
|
+
} = _ref2;
|
|
54
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
55
|
+
className: "cart__price-blocks",
|
|
56
|
+
"data-has-discount": Boolean(order.discount),
|
|
57
|
+
"data-hide-total": hideTotal
|
|
58
|
+
}, /*#__PURE__*/_react.default.createElement(PriceBlock, {
|
|
59
|
+
label: "Subtotal:",
|
|
60
|
+
price: order.subtotal,
|
|
61
|
+
"data-line": "subtotal"
|
|
62
|
+
}), order.discount && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(PriceBlock, {
|
|
63
|
+
label: "Discount applied:",
|
|
64
|
+
price: order.discount.amount,
|
|
65
|
+
invert: true,
|
|
66
|
+
belowPrice: allowDiscountRemoval && /*#__PURE__*/_react.default.createElement("button", {
|
|
67
|
+
title: "Remove discount",
|
|
68
|
+
type: "button",
|
|
69
|
+
onClick: onRemoveDiscount,
|
|
70
|
+
className: "cart__remove-discount-button"
|
|
71
|
+
}, /*#__PURE__*/_react.default.createElement(_Icons.X, null)),
|
|
72
|
+
"data-line": "discount"
|
|
73
|
+
}), order.discount.coupon && /*#__PURE__*/_react.default.createElement("p", {
|
|
74
|
+
className: "cart__coupon-text"
|
|
75
|
+
}, '(', /*#__PURE__*/_react.default.createElement(_CouponText.default, {
|
|
76
|
+
coupon: order.discount.coupon,
|
|
77
|
+
subtract: order.discount.amount ? order.discount.amount.amount : 0
|
|
78
|
+
}), ')'), /*#__PURE__*/_react.default.createElement(PriceBlock, {
|
|
79
|
+
label: "Discounted subtotal:",
|
|
80
|
+
price: order.discountedSubtotal,
|
|
81
|
+
"data-line": "discounted-subtotal"
|
|
82
|
+
})), order.taxes && /*#__PURE__*/_react.default.createElement(PriceBlock, {
|
|
83
|
+
label: order.taxName ? `${order.taxName}:` : 'Taxes:',
|
|
84
|
+
price: order.taxes,
|
|
85
|
+
"data-line": "taxes"
|
|
86
|
+
}), /*#__PURE__*/_react.default.createElement(PriceBlock, {
|
|
87
|
+
label: `Total${order.gstIncluded ? ' including GST' : ''}:`,
|
|
88
|
+
price: order.total,
|
|
89
|
+
"data-line": "total"
|
|
90
|
+
}));
|
|
91
|
+
};
|
|
86
92
|
|
|
87
93
|
var _default = (0, _reactRelay.createFragmentContainer)(CartTotals, {
|
|
88
94
|
order: _CartTotals_order !== void 0 ? _CartTotals_order : (_CartTotals_order = require("../../__generated__/CartTotals_order.graphql"), _CartTotals_order.hash && _CartTotals_order.hash !== "698ea8bf4dd91473e057e19df6dc51b1" && console.error("The definition of 'CartTotals_order' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data."), _CartTotals_order)
|
|
@@ -73,11 +73,12 @@ class CheckoutFormBase extends _react.default.Component {
|
|
|
73
73
|
});
|
|
74
74
|
});
|
|
75
75
|
|
|
76
|
-
_defineProperty(this, "submitMutation",
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
76
|
+
_defineProperty(this, "submitMutation", _ref => {
|
|
77
|
+
let {
|
|
78
|
+
mutation,
|
|
79
|
+
input,
|
|
80
|
+
onSuccess
|
|
81
|
+
} = _ref;
|
|
81
82
|
(0, _reactRelay.commitMutation)(this.props.environment, {
|
|
82
83
|
mutation,
|
|
83
84
|
variables: {
|
|
@@ -104,9 +105,10 @@ class CheckoutFormBase extends _react.default.Component {
|
|
|
104
105
|
});
|
|
105
106
|
}
|
|
106
107
|
},
|
|
107
|
-
onError:
|
|
108
|
-
|
|
109
|
-
|
|
108
|
+
onError: _ref2 => {
|
|
109
|
+
let {
|
|
110
|
+
message
|
|
111
|
+
} = _ref2;
|
|
110
112
|
this.setState({
|
|
111
113
|
error: message,
|
|
112
114
|
submitting: false
|
|
@@ -197,10 +199,12 @@ class CheckoutFormBase extends _react.default.Component {
|
|
|
197
199
|
postal_code: billingIdentity.zip
|
|
198
200
|
}
|
|
199
201
|
}
|
|
200
|
-
}).then(
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
202
|
+
}).then(_ref3 => {
|
|
203
|
+
let {
|
|
204
|
+
paymentMethod,
|
|
205
|
+
error
|
|
206
|
+
} = _ref3;
|
|
207
|
+
|
|
204
208
|
if (error) {
|
|
205
209
|
this.setState({
|
|
206
210
|
error: error.message,
|
|
@@ -218,15 +222,18 @@ class CheckoutFormBase extends _react.default.Component {
|
|
|
218
222
|
}
|
|
219
223
|
});
|
|
220
224
|
|
|
221
|
-
_defineProperty(this, "removeErrorsFromFields", (key, fields) => Object.keys(fields).forEach(field => this.setState(
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
225
|
+
_defineProperty(this, "removeErrorsFromFields", (key, fields) => Object.keys(fields).forEach(field => this.setState(_ref4 => {
|
|
226
|
+
let {
|
|
227
|
+
errorsObject
|
|
228
|
+
} = _ref4;
|
|
229
|
+
return {
|
|
230
|
+
errorsObject: errorsObject ? {
|
|
231
|
+
[key]: { ...errorsObject[key],
|
|
232
|
+
[field]: null
|
|
233
|
+
}
|
|
234
|
+
} : null
|
|
235
|
+
};
|
|
236
|
+
})));
|
|
230
237
|
|
|
231
238
|
_defineProperty(this, "makeFieldHandler", field => fields => {
|
|
232
239
|
this.removeErrorsFromFields(field, fields);
|
|
@@ -552,8 +559,8 @@ class CheckoutFormBase extends _react.default.Component {
|
|
|
552
559
|
const CheckoutForm = (0, _injectRelayEnvironment.default)(CheckoutFormBase);
|
|
553
560
|
|
|
554
561
|
class CheckoutComponent extends _react.default.Component {
|
|
555
|
-
constructor(
|
|
556
|
-
super(...
|
|
562
|
+
constructor() {
|
|
563
|
+
super(...arguments);
|
|
557
564
|
|
|
558
565
|
_defineProperty(this, "state", {
|
|
559
566
|
refetching: false
|
|
@@ -23,14 +23,15 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
23
23
|
|
|
24
24
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
25
25
|
|
|
26
|
-
const CustomerFields =
|
|
27
|
-
title,
|
|
28
|
-
value,
|
|
29
|
-
onChange,
|
|
30
|
-
optInLabel
|
|
31
|
-
}) => {
|
|
26
|
+
const CustomerFields = _ref => {
|
|
32
27
|
var _config$form$checkbox, _config$form;
|
|
33
28
|
|
|
29
|
+
let {
|
|
30
|
+
title,
|
|
31
|
+
value,
|
|
32
|
+
onChange,
|
|
33
|
+
optInLabel
|
|
34
|
+
} = _ref;
|
|
34
35
|
const config = (0, _react.useContext)(_ConfigContext.default);
|
|
35
36
|
const checkboxStyle = (_config$form$checkbox = (_config$form = config.form) === null || _config$form === void 0 ? void 0 : _config$form.checkboxStyle) !== null && _config$form$checkbox !== void 0 ? _config$form$checkbox : 'check';
|
|
36
37
|
return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -23,11 +23,12 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
23
23
|
|
|
24
24
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
25
25
|
|
|
26
|
-
const DownloadBase =
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
26
|
+
const DownloadBase = _ref => {
|
|
27
|
+
let {
|
|
28
|
+
order,
|
|
29
|
+
dismiss,
|
|
30
|
+
status
|
|
31
|
+
} = _ref;
|
|
31
32
|
const autoDownloaded = (0, _react.useRef)(false);
|
|
32
33
|
const downloadForm = (0, _react.useRef)(null);
|
|
33
34
|
(0, _react.useEffect)(() => {
|
|
@@ -55,10 +56,11 @@ const DownloadBase = ({
|
|
|
55
56
|
});
|
|
56
57
|
};
|
|
57
58
|
|
|
58
|
-
const Download =
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
59
|
+
const Download = _ref2 => {
|
|
60
|
+
let {
|
|
61
|
+
order,
|
|
62
|
+
relay
|
|
63
|
+
} = _ref2;
|
|
62
64
|
const [dismissed, setDismissed] = (0, _react.useState)(false);
|
|
63
65
|
(0, _useInterval.default)(() => {
|
|
64
66
|
if (order.archiveUrl) return;
|
|
@@ -17,10 +17,11 @@ const closeCart = () => ({
|
|
|
17
17
|
type: 'CLOSE_CART'
|
|
18
18
|
});
|
|
19
19
|
|
|
20
|
-
const EmptyCart =
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
const EmptyCart = _ref => {
|
|
21
|
+
let {
|
|
22
|
+
status,
|
|
23
|
+
dispatch
|
|
24
|
+
} = _ref;
|
|
24
25
|
const open = status === 'entering' || status === 'entered';
|
|
25
26
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
26
27
|
className: "cart",
|