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.
Files changed (106) hide show
  1. package/dist/__generated__/TypeTestersIDQuery.graphql.js +103 -57
  2. package/dist/__generated__/TypeTestersSlugQuery.graphql.js +103 -57
  3. package/dist/__generated__/TypeTesters_collection.graphql.d.ts +3 -0
  4. package/dist/__generated__/TypeTesters_collection.graphql.js +20 -6
  5. package/dist/components/AddToCartBanner/index.js +6 -4
  6. package/dist/components/BuyButton/index.js +21 -17
  7. package/dist/components/BuyingOptions/index.js +10 -7
  8. package/dist/components/Cart/AddressFields.js +10 -7
  9. package/dist/components/Cart/CartItem/index.js +71 -53
  10. package/dist/components/Cart/CartOrder.js +18 -14
  11. package/dist/components/Cart/CartState.js +16 -13
  12. package/dist/components/Cart/CartTotals.js +65 -59
  13. package/dist/components/Cart/Checkout.js +30 -23
  14. package/dist/components/Cart/CustomerFields.js +7 -6
  15. package/dist/components/Cart/Download.js +11 -9
  16. package/dist/components/Cart/EmptyCart.js +5 -4
  17. package/dist/components/Cart/IdentityBox.js +27 -24
  18. package/dist/components/Cart/index.js +23 -17
  19. package/dist/components/CartButton/index.js +12 -9
  20. package/dist/components/CharacterViewer/index.js +65 -54
  21. package/dist/components/CollectionAa/index.js +15 -11
  22. package/dist/components/CookieNotification/index.js +46 -38
  23. package/dist/components/CouponText/index.js +6 -4
  24. package/dist/components/Family/FamilyList.js +23 -20
  25. package/dist/components/Family/index.js +11 -8
  26. package/dist/components/FontFamilies/index.js +15 -12
  27. package/dist/components/FontStyle/index.js +10 -9
  28. package/dist/components/FontdueProvider/index.js +7 -6
  29. package/dist/components/NewsletterSignup/index.js +12 -10
  30. package/dist/components/Precart/License.js +8 -7
  31. package/dist/components/Precart/index.js +16 -11
  32. package/dist/components/Price/index.js +34 -27
  33. package/dist/components/PriceBar/PriceBarSection.js +14 -11
  34. package/dist/components/PriceBar/index.js +2 -2
  35. package/dist/components/Root/index.js +4 -1
  36. package/dist/components/Root/productState.js +3 -2
  37. package/dist/components/SKUPrice/index.js +7 -6
  38. package/dist/components/Select/index.js +22 -15
  39. package/dist/components/SelectButton/index.js +15 -13
  40. package/dist/components/SelectField/index.js +27 -24
  41. package/dist/components/SpecimenLink/index.js +14 -11
  42. package/dist/components/StickyNav/index.js +16 -13
  43. package/dist/components/StoreModal/StoreModalBundleButton.js +7 -6
  44. package/dist/components/StoreModal/StoreModalCart.js +10 -8
  45. package/dist/components/StoreModal/StoreModalCheckout.js +5 -4
  46. package/dist/components/StoreModal/StoreModalContainer.js +4 -3
  47. package/dist/components/StoreModal/StoreModalDownload.js +5 -4
  48. package/dist/components/StoreModal/StoreModalFamily.js +5 -4
  49. package/dist/components/StoreModal/StoreModalFamilyButton.js +7 -6
  50. package/dist/components/StoreModal/StoreModalIndex.js +4 -3
  51. package/dist/components/StoreModal/StoreModalLoader.js +4 -3
  52. package/dist/components/StoreModal/StoreModalProduct.js +4 -3
  53. package/dist/components/StoreModal/StoreModalReview.js +11 -9
  54. package/dist/components/StoreModal/StoreModalReviewIdentity.js +6 -3
  55. package/dist/components/StoreModal/StoreModalStyleButton.js +7 -6
  56. package/dist/components/StoreModalProductLicenseSelection/ContainerElement.js +15 -12
  57. package/dist/components/StoreModalProductLicenseSelection/LicenseElement.js +9 -8
  58. package/dist/components/StoreModalProductLicenseSelection/LicenseVariableElement.js +31 -25
  59. package/dist/components/StoreModalProductLicenseSelection/LicenseVariableRadioElement.js +13 -10
  60. package/dist/components/StoreModalProductLicenseSelection/StoreModalProductLicense.js +22 -13
  61. package/dist/components/StoreModalProductLicenseSelection/index.js +12 -9
  62. package/dist/components/StoreModalProductSummary/index.js +10 -8
  63. package/dist/components/StripeProvider/index.js +5 -4
  64. package/dist/components/Stylesheet/index.js +4 -3
  65. package/dist/components/TestFontsForm/index.js +32 -25
  66. package/dist/components/TestModeBanner/index.js +9 -7
  67. package/dist/components/TextField/index.js +32 -29
  68. package/dist/components/ThemeConfig/index.js +9 -7
  69. package/dist/components/TypeTester/TypeTesterAlignButtons.js +5 -4
  70. package/dist/components/TypeTester/TypeTesterBullet.js +5 -4
  71. package/dist/components/TypeTester/TypeTesterContent.js +9 -8
  72. package/dist/components/TypeTester/TypeTesterContext.js +6 -5
  73. package/dist/components/TypeTester/TypeTesterEditAll.js +4 -3
  74. package/dist/components/TypeTester/TypeTesterFeatures.js +16 -10
  75. package/dist/components/TypeTester/TypeTesterFeaturesButton.js +18 -15
  76. package/dist/components/TypeTester/TypeTesterFitter.js +5 -4
  77. package/dist/components/TypeTester/TypeTesterFloatingToolbar.js +6 -5
  78. package/dist/components/TypeTester/TypeTesterInput.js +7 -6
  79. package/dist/components/TypeTester/TypeTesterSlider.js +15 -11
  80. package/dist/components/TypeTester/TypeTesterStandalone.js +18 -16
  81. package/dist/components/TypeTester/TypeTesterState.js +4 -3
  82. package/dist/components/TypeTester/TypeTesterStyleSelect.js +39 -26
  83. package/dist/components/TypeTester/TypeTesterStyleSelectData.js +7 -6
  84. package/dist/components/TypeTester/TypeTesterToolbar.js +6 -5
  85. package/dist/components/TypeTester/index.js +36 -29
  86. package/dist/components/TypeTester/useTypeTesterStyler.js +21 -19
  87. package/dist/components/TypeTesters/index.js +40 -34
  88. package/dist/components/VariableTableAmounts/index.js +5 -4
  89. package/dist/components/elements/Button/index.js +11 -8
  90. package/dist/components/elements/StoreModalCartLayout/index.js +29 -26
  91. package/dist/components/elements/StoreModalContainer/index.js +14 -13
  92. package/dist/components/elements/StoreModalDownloadLayout/index.js +17 -14
  93. package/dist/components/elements/StoreModalFamily/index.js +22 -19
  94. package/dist/components/elements/StoreModalFamilyButton/index.js +12 -11
  95. package/dist/components/elements/StoreModalIndexItem/index.js +9 -8
  96. package/dist/components/elements/StoreModalPageContainer/index.js +18 -15
  97. package/dist/components/elements/StoreModalReviewConfirm/index.js +9 -8
  98. package/dist/components/elements/StoreModalReviewItem/index.js +11 -8
  99. package/dist/components/elements/StoreModalReviewLayout/index.js +50 -47
  100. package/dist/components/elements/StoreModalStyleButton/index.js +10 -9
  101. package/dist/components/useFontStyle.js +6 -5
  102. package/dist/utils.js +3 -2
  103. package/dist/vanilla/FontStyle.js +10 -8
  104. package/fontdue.css +6 -0
  105. package/fontdue.css.map +1 -1
  106. 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
- onPrecartOpen
16
- }) => /*#__PURE__*/_react.default.createElement("button", {
17
- type: "button",
18
- className: "buying-options buy-family__options__button",
19
- onClick: onPrecartOpen
20
- }, "Buying options");
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
- code,
57
- name
58
- }) => ({
59
- value: code,
60
- label: name
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
- product
66
- }) => /*#__PURE__*/_react.default.createElement("h3", {
67
- className: "cart-item__name"
68
- }, productName(product));
69
-
70
- const Variable = ({
71
- selection,
72
- variable,
73
- onChange
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
- license,
108
- variable,
109
- option,
110
- variableText
111
- }) => ({
112
- licenseId: license.id,
113
- licenseVariableId: variable ? variable.id : null,
114
- licenseOptionId: option ? option.id : null,
115
- variableText
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
- license
146
- }) => license.id !== licenseToRemove.id).map(getSelectionIds)) !== null && _node$licenseSelectio4 !== void 0 ? _node$licenseSelectio4 : [];
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
- license
193
- }) => license.id);
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
- node,
208
- onChange,
209
- license,
210
- closeButtonMouseEnter: parentCloseButtonMouseEnter,
211
- closeButtonMouseLeave: parentCloseButtonMouseLeave,
212
- selections
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
- license,
60
- licenseVariable,
61
- licenseOption,
62
- variableText
63
- }) => ({
64
- licenseId: license.id,
65
- licenseVariableId: licenseVariable && licenseVariable.id,
66
- licenseOptionId: licenseOption && licenseOption.id,
67
- variableText
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
- code
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
- order,
20
- children
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
- license,
52
- licenseVariable,
53
- licenseOption,
54
- variableText
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
- code
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
- label,
28
- belowPrice,
29
- price,
30
- invert,
31
- ...rest
32
- }) => /*#__PURE__*/_react.default.createElement("div", _extends({
33
- className: "cart__price-block",
34
- "data-label": label
35
- }, rest), /*#__PURE__*/_react.default.createElement("div", {
36
- className: "cart__price-block__label"
37
- }, label), /*#__PURE__*/_react.default.createElement("div", {
38
- className: "cart__price-block__price"
39
- }, /*#__PURE__*/_react.default.createElement(_Price.default, {
40
- price: price,
41
- invert: invert
42
- }), belowPrice));
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
- order,
46
- onRemoveDiscount,
47
- allowDiscountRemoval = true,
48
- hideTotal = false
49
- }) => /*#__PURE__*/_react.default.createElement("div", {
50
- className: "cart__price-blocks",
51
- "data-has-discount": Boolean(order.discount),
52
- "data-hide-total": hideTotal
53
- }, /*#__PURE__*/_react.default.createElement(PriceBlock, {
54
- label: "Subtotal:",
55
- price: order.subtotal,
56
- "data-line": "subtotal"
57
- }), order.discount && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(PriceBlock, {
58
- label: "Discount applied:",
59
- price: order.discount.amount,
60
- invert: true,
61
- belowPrice: allowDiscountRemoval && /*#__PURE__*/_react.default.createElement("button", {
62
- title: "Remove discount",
63
- type: "button",
64
- onClick: onRemoveDiscount,
65
- className: "cart__remove-discount-button"
66
- }, /*#__PURE__*/_react.default.createElement(_Icons.X, null)),
67
- "data-line": "discount"
68
- }), order.discount.coupon && /*#__PURE__*/_react.default.createElement("p", {
69
- className: "cart__coupon-text"
70
- }, '(', /*#__PURE__*/_react.default.createElement(_CouponText.default, {
71
- coupon: order.discount.coupon,
72
- subtract: order.discount.amount ? order.discount.amount.amount : 0
73
- }), ')'), /*#__PURE__*/_react.default.createElement(PriceBlock, {
74
- label: "Discounted subtotal:",
75
- price: order.discountedSubtotal,
76
- "data-line": "discounted-subtotal"
77
- })), order.taxes && /*#__PURE__*/_react.default.createElement(PriceBlock, {
78
- label: order.taxName ? `${order.taxName}:` : 'Taxes:',
79
- price: order.taxes,
80
- "data-line": "taxes"
81
- }), /*#__PURE__*/_react.default.createElement(PriceBlock, {
82
- label: `Total${order.gstIncluded ? ' including GST' : ''}:`,
83
- price: order.total,
84
- "data-line": "total"
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
- mutation,
78
- input,
79
- onSuccess
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
- message
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
- paymentMethod,
202
- error
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
- errorsObject
223
- }) => ({
224
- errorsObject: errorsObject ? {
225
- [key]: { ...errorsObject[key],
226
- [field]: null
227
- }
228
- } : null
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(...args) {
556
- super(...args);
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
- order,
28
- dismiss,
29
- status
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
- order,
60
- relay
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
- status,
22
- dispatch
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",