fontdue-js 0.1.0 → 0.1.3

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 (116) hide show
  1. package/dist/__generated__/TypeTesterStandalone_StyleQuery.graphql.d.ts +6 -0
  2. package/dist/__generated__/TypeTesterStandalone_StyleQuery.graphql.js +32 -4
  3. package/dist/__generated__/TypeTestersIDQuery.graphql.js +103 -57
  4. package/dist/__generated__/TypeTestersSlugQuery.graphql.js +103 -57
  5. package/dist/__generated__/TypeTesters_collection.graphql.d.ts +3 -0
  6. package/dist/__generated__/TypeTesters_collection.graphql.js +20 -6
  7. package/dist/components/AddToCartBanner/index.js +6 -4
  8. package/dist/components/BuyButton/index.js +21 -17
  9. package/dist/components/BuyingOptions/index.js +10 -7
  10. package/dist/components/Cart/AddressFields.js +10 -7
  11. package/dist/components/Cart/CartItem/index.js +71 -53
  12. package/dist/components/Cart/CartOrder.js +18 -14
  13. package/dist/components/Cart/CartState.js +16 -13
  14. package/dist/components/Cart/CartTotals.js +65 -59
  15. package/dist/components/Cart/Checkout.js +30 -23
  16. package/dist/components/Cart/CustomerFields.d.ts +14 -0
  17. package/dist/components/Cart/CustomerFields.js +11 -11
  18. package/dist/components/Cart/Download.js +11 -9
  19. package/dist/components/Cart/EmptyCart.js +5 -4
  20. package/dist/components/Cart/IdentityBox.js +27 -24
  21. package/dist/components/Cart/index.js +23 -17
  22. package/dist/components/CartButton/index.js +12 -9
  23. package/dist/components/CharacterViewer/index.js +65 -54
  24. package/dist/components/Checkbox/index.js +4 -5
  25. package/dist/components/CollectionAa/index.js +15 -11
  26. package/dist/components/ConfigContext.d.ts +78 -1
  27. package/dist/components/ConfigContext.js +52 -2
  28. package/dist/components/CookieNotification/index.js +46 -38
  29. package/dist/components/CouponText/index.js +6 -4
  30. package/dist/components/Family/FamilyList.js +23 -20
  31. package/dist/components/Family/index.js +11 -8
  32. package/dist/components/FontFamilies/index.js +15 -12
  33. package/dist/components/FontStyle/index.js +10 -9
  34. package/dist/components/FontdueProvider/index.js +9 -8
  35. package/dist/components/NewsletterSignup/index.js +12 -10
  36. package/dist/components/Precart/License.js +8 -7
  37. package/dist/components/Precart/index.js +16 -11
  38. package/dist/components/Price/index.js +34 -27
  39. package/dist/components/PriceBar/PriceBarSection.js +14 -11
  40. package/dist/components/PriceBar/index.js +2 -2
  41. package/dist/components/Root/index.js +4 -1
  42. package/dist/components/Root/productState.js +3 -2
  43. package/dist/components/SKUPrice/index.js +7 -6
  44. package/dist/components/Select/index.js +22 -15
  45. package/dist/components/SelectButton/index.js +16 -16
  46. package/dist/components/SelectField/index.js +27 -24
  47. package/dist/components/SpecimenLink/index.js +14 -11
  48. package/dist/components/StickyNav/index.js +16 -13
  49. package/dist/components/StoreModal/StoreModalBundleButton.js +7 -6
  50. package/dist/components/StoreModal/StoreModalCart.js +10 -8
  51. package/dist/components/StoreModal/StoreModalCheckout.js +5 -4
  52. package/dist/components/StoreModal/StoreModalContainer.js +4 -3
  53. package/dist/components/StoreModal/StoreModalDownload.js +5 -4
  54. package/dist/components/StoreModal/StoreModalFamily.js +5 -4
  55. package/dist/components/StoreModal/StoreModalFamilyButton.js +7 -6
  56. package/dist/components/StoreModal/StoreModalIndex.js +11 -9
  57. package/dist/components/StoreModal/StoreModalLoader.js +4 -3
  58. package/dist/components/StoreModal/StoreModalProduct.js +4 -3
  59. package/dist/components/StoreModal/StoreModalReview.js +11 -9
  60. package/dist/components/StoreModal/StoreModalReviewIdentity.js +6 -3
  61. package/dist/components/StoreModal/StoreModalStyleButton.js +7 -6
  62. package/dist/components/StoreModalProductLicenseSelection/ContainerElement.js +15 -12
  63. package/dist/components/StoreModalProductLicenseSelection/LicenseElement.js +13 -13
  64. package/dist/components/StoreModalProductLicenseSelection/LicenseVariableElement.js +31 -25
  65. package/dist/components/StoreModalProductLicenseSelection/LicenseVariableRadioElement.js +13 -10
  66. package/dist/components/StoreModalProductLicenseSelection/StoreModalProductLicense.js +22 -13
  67. package/dist/components/StoreModalProductLicenseSelection/index.js +12 -9
  68. package/dist/components/StoreModalProductSummary/index.js +10 -8
  69. package/dist/components/StripeProvider/index.js +5 -4
  70. package/dist/components/Stylesheet/index.js +4 -3
  71. package/dist/components/TestFontsForm/index.js +32 -25
  72. package/dist/components/TestModeBanner/index.js +9 -7
  73. package/dist/components/TextField/index.js +32 -29
  74. package/dist/components/ThemeConfig/index.js +9 -7
  75. package/dist/components/TypeTester/TypeTesterAlignButtons.js +5 -4
  76. package/dist/components/TypeTester/TypeTesterBullet.js +5 -4
  77. package/dist/components/TypeTester/TypeTesterContent.js +9 -8
  78. package/dist/components/TypeTester/TypeTesterContext.js +6 -5
  79. package/dist/components/TypeTester/TypeTesterEditAll.d.ts +0 -2
  80. package/dist/components/TypeTester/TypeTesterEditAll.js +6 -3
  81. package/dist/components/TypeTester/TypeTesterFeatures.d.ts +0 -2
  82. package/dist/components/TypeTester/TypeTesterFeatures.js +25 -14
  83. package/dist/components/TypeTester/TypeTesterFeaturesButton.js +18 -15
  84. package/dist/components/TypeTester/TypeTesterFitter.js +5 -4
  85. package/dist/components/TypeTester/TypeTesterFloatingToolbar.js +10 -11
  86. package/dist/components/TypeTester/TypeTesterInput.js +7 -6
  87. package/dist/components/TypeTester/TypeTesterSlider.js +15 -11
  88. package/dist/components/TypeTester/TypeTesterStandalone.js +21 -19
  89. package/dist/components/TypeTester/TypeTesterState.js +5 -6
  90. package/dist/components/TypeTester/TypeTesterStyleSelect.js +39 -28
  91. package/dist/components/TypeTester/TypeTesterStyleSelectData.js +7 -6
  92. package/dist/components/TypeTester/TypeTesterToolbar.d.ts +0 -2
  93. package/dist/components/TypeTester/TypeTesterToolbar.js +18 -15
  94. package/dist/components/TypeTester/index.d.ts +2 -1
  95. package/dist/components/TypeTester/index.js +48 -55
  96. package/dist/components/TypeTester/useTypeTesterStyler.js +21 -19
  97. package/dist/components/TypeTesters/index.js +48 -45
  98. package/dist/components/VariableTableAmounts/index.js +5 -4
  99. package/dist/components/elements/Button/index.js +11 -8
  100. package/dist/components/elements/StoreModalCartLayout/index.js +29 -26
  101. package/dist/components/elements/StoreModalContainer/index.js +14 -13
  102. package/dist/components/elements/StoreModalDownloadLayout/index.js +17 -14
  103. package/dist/components/elements/StoreModalFamily/index.js +22 -19
  104. package/dist/components/elements/StoreModalFamilyButton/index.js +12 -11
  105. package/dist/components/elements/StoreModalIndexItem/index.js +9 -8
  106. package/dist/components/elements/StoreModalPageContainer/index.js +18 -15
  107. package/dist/components/elements/StoreModalReviewConfirm/index.js +13 -13
  108. package/dist/components/elements/StoreModalReviewItem/index.js +11 -8
  109. package/dist/components/elements/StoreModalReviewLayout/index.js +50 -47
  110. package/dist/components/elements/StoreModalStyleButton/index.js +10 -9
  111. package/dist/components/useFontStyle.js +6 -5
  112. package/dist/utils.js +3 -2
  113. package/dist/vanilla/FontStyle.js +10 -8
  114. package/fontdue.css +10 -0
  115. package/fontdue.css.map +1 -1
  116. package/package.json +1 -1
@@ -111,10 +111,12 @@ const AddToCartBannerQueryRenderer = params => {
111
111
  return /*#__PURE__*/_react.default.createElement(_reactRelay.QueryRenderer, {
112
112
  environment: environment,
113
113
  query: _AddToCartBannerQuery !== void 0 ? _AddToCartBannerQuery : (_AddToCartBannerQuery = require("../../__generated__/AddToCartBannerQuery.graphql"), _AddToCartBannerQuery.hash && _AddToCartBannerQuery.hash !== "0ece6678652384f7938caf18b2a40be9" && console.error("The definition of 'AddToCartBannerQuery' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data."), _AddToCartBannerQuery),
114
- render: ({
115
- error,
116
- props
117
- }) => {
114
+ render: _ref => {
115
+ let {
116
+ error,
117
+ props
118
+ } = _ref;
119
+
118
120
  if (error) {
119
121
  console.error(error);
120
122
  return null;
@@ -25,10 +25,11 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
25
25
 
26
26
  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); }
27
27
 
28
- const BuyButtonBase = ({
29
- collection,
30
- collectionName
31
- }) => {
28
+ const BuyButtonBase = _ref => {
29
+ let {
30
+ collection,
31
+ collectionName
32
+ } = _ref;
32
33
  const store = (0, _reactRedux.useStore)();
33
34
  const components = (0, _react.useContext)(_ComponentsContext.default);
34
35
  const dispatch = (0, _reactRedux.useDispatch)();
@@ -73,11 +74,12 @@ const BuyButton = (0, _reactRelay.createFragmentContainer)(BuyButtonBase, {
73
74
  collection: _BuyButton_collection !== void 0 ? _BuyButton_collection : (_BuyButton_collection = require("../../__generated__/BuyButton_collection.graphql"), _BuyButton_collection.hash && _BuyButton_collection.hash !== "9c47030d7450494449d4aa5bda16e27e" && console.error("The definition of 'BuyButton_collection' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data."), _BuyButton_collection)
74
75
  });
75
76
 
76
- const BuyButtonQueryRenderer = ({
77
- collectionId,
78
- collectionSlug,
79
- ...rest
80
- }) => {
77
+ const BuyButtonQueryRenderer = _ref2 => {
78
+ let {
79
+ collectionId,
80
+ collectionSlug,
81
+ ...rest
82
+ } = _ref2;
81
83
  const environment = (0, _reactRelay.useRelayEnvironment)();
82
84
 
83
85
  if (collectionId) {
@@ -87,10 +89,11 @@ const BuyButtonQueryRenderer = ({
87
89
  variables: {
88
90
  collectionId
89
91
  },
90
- render: ({
91
- error,
92
- props
93
- }) => {
92
+ render: _ref3 => {
93
+ let {
94
+ error,
95
+ props
96
+ } = _ref3;
94
97
  if (error || !props) return null;
95
98
  return /*#__PURE__*/_react.default.createElement(BuyButton, _extends({}, rest, props));
96
99
  }
@@ -104,12 +107,13 @@ const BuyButtonQueryRenderer = ({
104
107
  variables: {
105
108
  collectionSlug
106
109
  },
107
- render: ({
108
- error,
109
- props
110
- }) => {
110
+ render: _ref4 => {
111
111
  var _props$viewer$slug$co, _props$viewer, _props$viewer$slug;
112
112
 
113
+ let {
114
+ error,
115
+ props
116
+ } = _ref4;
113
117
  if (error || !props) return null;
114
118
  return /*#__PURE__*/_react.default.createElement(BuyButton, _extends({}, rest, {
115
119
  collection: (_props$viewer$slug$co = (_props$viewer = props.viewer) === null || _props$viewer === void 0 ? void 0 : (_props$viewer$slug = _props$viewer.slug) === null || _props$viewer$slug === void 0 ? void 0 : _props$viewer$slug.collection) !== null && _props$viewer$slug$co !== void 0 ? _props$viewer$slug$co : null
@@ -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
@@ -0,0 +1,14 @@
1
+ import React from 'react';
2
+ interface Customer {
3
+ name?: string;
4
+ email?: string;
5
+ newsletterOptIn?: boolean;
6
+ }
7
+ interface CustomerFields_props {
8
+ title: string;
9
+ value: Customer;
10
+ onChange: (value: Customer) => void;
11
+ optInLabel?: string;
12
+ }
13
+ declare const CustomerFields: React.FC<CustomerFields_props>;
14
+ export default CustomerFields;