fontdue-js 1.11.0 → 1.12.0

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 (46) hide show
  1. package/dist/__generated__/StoreModalIndexQuery.graphql.d.ts +3 -1
  2. package/dist/__generated__/StoreModalIndexQuery.graphql.js +33 -22
  3. package/dist/components/BuyButton/index.js +3 -3
  4. package/dist/components/Cart/AddressFields.js +9 -9
  5. package/dist/components/Cart/CartItem/index.js +15 -16
  6. package/dist/components/Cart/CartOrder.js +5 -5
  7. package/dist/components/Cart/Checkout.js +9 -11
  8. package/dist/components/Cart/CustomerFields.js +1 -2
  9. package/dist/components/Cart/utils.js +3 -3
  10. package/dist/components/CartButton/index.js +2 -2
  11. package/dist/components/CharacterViewer/index.js +24 -24
  12. package/dist/components/ConfigContext.d.ts +2 -0
  13. package/dist/components/ConfigContext.js +31 -30
  14. package/dist/components/FontdueProvider/index.js +25 -4
  15. package/dist/components/NewsletterSignup/index.js +5 -5
  16. package/dist/components/Price/index.js +1 -2
  17. package/dist/components/Root/index.js +1 -2
  18. package/dist/components/Root/productState.js +13 -13
  19. package/dist/components/Select/index.js +1 -1
  20. package/dist/components/StoreModal/StoreModalCart.js +2 -2
  21. package/dist/components/StoreModal/StoreModalContainer.js +8 -3
  22. package/dist/components/StoreModal/StoreModalIndex.js +3 -3
  23. package/dist/components/StoreModal/StoreModalProduct.js +2 -2
  24. package/dist/components/StoreModal/StoreModalReview.js +8 -9
  25. package/dist/components/StoreModal/types.d.ts +1 -0
  26. package/dist/components/StripeProvider/index.js +2 -2
  27. package/dist/components/TestFontsForm/index.js +5 -5
  28. package/dist/components/ThemeConfig/index.js +2 -2
  29. package/dist/components/TypeTester/TypeTesterContext.js +3 -4
  30. package/dist/components/TypeTester/TypeTesterFeaturesButton.js +1 -1
  31. package/dist/components/TypeTester/TypeTesterInput.js +1 -2
  32. package/dist/components/TypeTester/TypeTesterStandalone.js +7 -7
  33. package/dist/components/TypeTester/TypeTesterStandaloneElement.js +1 -2
  34. package/dist/components/TypeTester/TypeTesterState.js +1 -1
  35. package/dist/components/TypeTester/TypeTesterToolbar.js +1 -1
  36. package/dist/components/TypeTester/index.js +4 -5
  37. package/dist/components/TypeTester/useFeaturesData.js +3 -3
  38. package/dist/components/TypeTester/useTypeTesterStyler.js +4 -4
  39. package/dist/components/TypeTesters/index.js +14 -14
  40. package/dist/components/elements/EmptyCart/index.js +9 -2
  41. package/dist/components/elements/StoreModalContainer/index.js +1 -1
  42. package/dist/components/useTotalStyles.js +1 -2
  43. package/dist/reducer.d.ts +3 -1
  44. package/dist/reducer.js +4 -21
  45. package/fontdue.css.map +1 -1
  46. package/package.json +1 -1
@@ -1,6 +1,8 @@
1
1
  import { ConcreteRequest } from "relay-runtime";
2
2
  import { FragmentRefs } from "relay-runtime";
3
- export declare type StoreModalIndexQueryVariables = {};
3
+ export declare type StoreModalIndexQueryVariables = {
4
+ excludeTags?: Array<string> | null;
5
+ };
4
6
  export declare type StoreModalIndexQueryResponse = {
5
7
  readonly viewer: {
6
8
  readonly rootCollections: {
@@ -9,9 +9,11 @@ exports.default = void 0;
9
9
  // @ts-nocheck
10
10
 
11
11
  /*
12
- query StoreModalIndexQuery {
12
+ query StoreModalIndexQuery(
13
+ $excludeTags: [String!]
14
+ ) {
13
15
  viewer {
14
- rootCollections: fontCollections(onlyRoots: true, first: 99) {
16
+ rootCollections: fontCollections(onlyRoots: true, first: 99, excludeTags: $excludeTags) {
15
17
  edges {
16
18
  node {
17
19
  ...StoreModalIndexItem_fontCollection
@@ -62,6 +64,15 @@ fragment useTotalStyles_fontCollection on FontCollection {
62
64
 
63
65
  const node = function () {
64
66
  var v0 = [{
67
+ "defaultValue": null,
68
+ "kind": "LocalArgument",
69
+ "name": "excludeTags"
70
+ }],
71
+ v1 = [{
72
+ "kind": "Variable",
73
+ "name": "excludeTags",
74
+ "variableName": "excludeTags"
75
+ }, {
65
76
  "kind": "Literal",
66
77
  "name": "first",
67
78
  "value": 99
@@ -70,28 +81,28 @@ const node = function () {
70
81
  "name": "onlyRoots",
71
82
  "value": true
72
83
  }],
73
- v1 = {
84
+ v2 = {
74
85
  "alias": null,
75
86
  "args": null,
76
87
  "kind": "ScalarField",
77
88
  "name": "totalStyles",
78
89
  "storageKey": null
79
90
  },
80
- v2 = {
91
+ v3 = {
81
92
  "alias": null,
82
93
  "args": null,
83
94
  "kind": "ScalarField",
84
95
  "name": "isVariableFont",
85
96
  "storageKey": null
86
97
  },
87
- v3 = {
98
+ v4 = {
88
99
  "alias": null,
89
100
  "args": null,
90
101
  "kind": "ScalarField",
91
102
  "name": "id",
92
103
  "storageKey": null
93
104
  },
94
- v4 = {
105
+ v5 = {
95
106
  "alias": null,
96
107
  "args": null,
97
108
  "kind": "ScalarField",
@@ -100,7 +111,7 @@ const node = function () {
100
111
  };
101
112
  return {
102
113
  "fragment": {
103
- "argumentDefinitions": [],
114
+ "argumentDefinitions": v0 /*: any*/,
104
115
  "kind": "Fragment",
105
116
  "metadata": null,
106
117
  "name": "StoreModalIndexQuery",
@@ -113,7 +124,7 @@ const node = function () {
113
124
  "plural": false,
114
125
  "selections": [{
115
126
  "alias": "rootCollections",
116
- "args": v0 /*: any*/,
127
+ "args": v1 /*: any*/,
117
128
  "concreteType": "FontCollectionConnection",
118
129
  "kind": "LinkedField",
119
130
  "name": "fontCollections",
@@ -141,7 +152,7 @@ const node = function () {
141
152
  }],
142
153
  "storageKey": null
143
154
  }],
144
- "storageKey": "fontCollections(first:99,onlyRoots:true)"
155
+ "storageKey": null
145
156
  }],
146
157
  "storageKey": null
147
158
  }],
@@ -150,7 +161,7 @@ const node = function () {
150
161
  },
151
162
  "kind": "Request",
152
163
  "operation": {
153
- "argumentDefinitions": [],
164
+ "argumentDefinitions": v0 /*: any*/,
154
165
  "kind": "Operation",
155
166
  "name": "StoreModalIndexQuery",
156
167
  "selections": [{
@@ -162,7 +173,7 @@ const node = function () {
162
173
  "plural": false,
163
174
  "selections": [{
164
175
  "alias": "rootCollections",
165
- "args": v0 /*: any*/,
176
+ "args": v1 /*: any*/,
166
177
  "concreteType": "FontCollectionConnection",
167
178
  "kind": "LinkedField",
168
179
  "name": "fontCollections",
@@ -181,7 +192,7 @@ const node = function () {
181
192
  "kind": "LinkedField",
182
193
  "name": "node",
183
194
  "plural": false,
184
- "selections": [v1 /*: any*/, {
195
+ "selections": [v2 /*: any*/, {
185
196
  "alias": null,
186
197
  "args": [{
187
198
  "kind": "Literal",
@@ -192,10 +203,10 @@ const node = function () {
192
203
  "kind": "LinkedField",
193
204
  "name": "children",
194
205
  "plural": true,
195
- "selections": [v2 /*: any*/, v1 /*: any*/, v3 /*: any*/],
206
+ "selections": [v3 /*: any*/, v2 /*: any*/, v4 /*: any*/],
196
207
 
197
208
  "storageKey": "children(collectionTypes:[\"FAMILY\"])"
198
- }, v3 /*: any*/, v4 /*: any*/, v2 /*: any*/, {
209
+ }, v4 /*: any*/, v5 /*: any*/, v3 /*: any*/, {
199
210
  "alias": null,
200
211
  "args": null,
201
212
  "kind": "ScalarField",
@@ -214,7 +225,7 @@ const node = function () {
214
225
  "kind": "ScalarField",
215
226
  "name": "cssFamily",
216
227
  "storageKey": null
217
- }, v4 /*: any*/, {
228
+ }, v5 /*: any*/, {
218
229
  "alias": null,
219
230
  "args": null,
220
231
  "concreteType": "FontCollection",
@@ -227,10 +238,10 @@ const node = function () {
227
238
  "kind": "ScalarField",
228
239
  "name": "cssUrl",
229
240
  "storageKey": null
230
- }, v3 /*: any*/],
241
+ }, v4 /*: any*/],
231
242
 
232
243
  "storageKey": null
233
- }, v3 /*: any*/],
244
+ }, v4 /*: any*/],
234
245
 
235
246
  "storageKey": null
236
247
  }],
@@ -238,22 +249,22 @@ const node = function () {
238
249
  }],
239
250
  "storageKey": null
240
251
  }],
241
- "storageKey": "fontCollections(first:99,onlyRoots:true)"
242
- }, v3 /*: any*/],
252
+ "storageKey": null
253
+ }, v4 /*: any*/],
243
254
 
244
255
  "storageKey": null
245
256
  }]
246
257
  },
247
258
  "params": {
248
- "cacheID": "002fad05ecf07d9286e0dd17bad5e77d",
259
+ "cacheID": "6ffce75f636184d17f6e4b3e02d02482",
249
260
  "id": null,
250
261
  "metadata": {},
251
262
  "name": "StoreModalIndexQuery",
252
263
  "operationKind": "query",
253
- "text": "query StoreModalIndexQuery {\n viewer {\n rootCollections: fontCollections(onlyRoots: true, first: 99) {\n edges {\n node {\n ...StoreModalIndexItem_fontCollection\n id\n }\n }\n }\n id\n }\n}\n\nfragment FontStyle_fontStyle on FontStyle {\n cssFamily\n name\n}\n\nfragment StoreModalIndexItem_fontCollection on FontCollection {\n ...useTotalStyles_fontCollection\n id\n name\n totalStyles\n isVariableFont\n children(collectionTypes: [FAMILY]) {\n isVariableFont\n totalStyles\n id\n }\n collectionType\n featureStyle {\n ...FontStyle_fontStyle\n family {\n cssUrl\n id\n }\n id\n }\n}\n\nfragment useTotalStyles_fontCollection on FontCollection {\n totalStyles\n children(collectionTypes: [FAMILY]) {\n isVariableFont\n totalStyles\n id\n }\n}\n"
264
+ "text": "query StoreModalIndexQuery(\n $excludeTags: [String!]\n) {\n viewer {\n rootCollections: fontCollections(onlyRoots: true, first: 99, excludeTags: $excludeTags) {\n edges {\n node {\n ...StoreModalIndexItem_fontCollection\n id\n }\n }\n }\n id\n }\n}\n\nfragment FontStyle_fontStyle on FontStyle {\n cssFamily\n name\n}\n\nfragment StoreModalIndexItem_fontCollection on FontCollection {\n ...useTotalStyles_fontCollection\n id\n name\n totalStyles\n isVariableFont\n children(collectionTypes: [FAMILY]) {\n isVariableFont\n totalStyles\n id\n }\n collectionType\n featureStyle {\n ...FontStyle_fontStyle\n family {\n cssUrl\n id\n }\n id\n }\n}\n\nfragment useTotalStyles_fontCollection on FontCollection {\n totalStyles\n children(collectionTypes: [FAMILY]) {\n isVariableFont\n totalStyles\n id\n }\n}\n"
254
265
  }
255
266
  };
256
267
  }();
257
- node.hash = 'a36eb25fa97de6d986b72bbaf538c3db';
268
+ node.hash = 'd1a037f0551211a8f93528d5bb6e39fa';
258
269
  var _default = node;
259
270
  exports.default = _default;
@@ -55,7 +55,7 @@ const BuyButtonBase = _ref => {
55
55
  className: "buy-button",
56
56
  onClick: handleClick,
57
57
  type: "button"
58
- }, label ? label : `Buy ${collectionName !== null && collectionName !== void 0 ? collectionName : ''}`);
58
+ }, label ? label : `Buy ${collectionName ?? ''}`);
59
59
  };
60
60
  const BuyButton = (0, _reactRelay.createFragmentContainer)(BuyButtonBase, {
61
61
  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)
@@ -92,14 +92,14 @@ const BuyButtonQueryRenderer = _ref2 => {
92
92
  collectionSlug
93
93
  },
94
94
  render: _ref4 => {
95
- var _props$viewer$slug$co, _props$viewer, _props$viewer$slug;
95
+ var _props$viewer, _props$viewer$slug;
96
96
  let {
97
97
  error,
98
98
  props
99
99
  } = _ref4;
100
100
  if (error || !props) return null;
101
101
  return /*#__PURE__*/_react.default.createElement(BuyButton, _extends({}, rest, {
102
- 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
102
+ collection: ((_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
103
103
  }));
104
104
  }
105
105
  });
@@ -21,7 +21,7 @@ const humanizeNameType = nameType => {
21
21
  };
22
22
  const limitToTwoLines = value => value.split(/[\r\n]/g).slice(0, 2).join('\n');
23
23
  const AddressFields = _ref => {
24
- var _viewer$countryData, _countryData$subRegio, _ref3, _countryData$locality, _countryData$sublocal, _countryData$stateNam, _countryData$stateNam2, _countryData$zipNameT;
24
+ var _viewer$countryData, _countryData$subRegio;
25
25
  let {
26
26
  viewer: viewerKey,
27
27
  value,
@@ -58,8 +58,8 @@ const AddressFields = _ref => {
58
58
  return () => subscription.unsubscribe();
59
59
  }, [value.country]);
60
60
  const isValidField = field => {
61
- var _countryData$valid$in, _countryData$valid;
62
- return ((_countryData$valid$in = countryData === null || countryData === void 0 ? void 0 : (_countryData$valid = countryData.valid) === null || _countryData$valid === void 0 ? void 0 : _countryData$valid.indexOf(field)) !== null && _countryData$valid$in !== void 0 ? _countryData$valid$in : -1) >= 0;
61
+ var _countryData$valid;
62
+ return ((countryData === null || countryData === void 0 ? void 0 : (_countryData$valid = countryData.valid) === null || _countryData$valid === void 0 ? void 0 : _countryData$valid.indexOf(field)) ?? -1) >= 0;
63
63
  };
64
64
  const getErrors = field => {
65
65
  var _errorsObject$field;
@@ -84,7 +84,7 @@ const AddressFields = _ref => {
84
84
  value: region.key,
85
85
  label: region.name
86
86
  }))) || [];
87
- const required = (_ref3 = countryData === null || countryData === void 0 ? void 0 : countryData.require) !== null && _ref3 !== void 0 ? _ref3 : null;
87
+ const required = (countryData === null || countryData === void 0 ? void 0 : countryData.require) ?? null;
88
88
  (0, _react.useEffect)(() => {
89
89
  onRequiredFieldsChange(required);
90
90
  }, [required, onRequiredFieldsChange]);
@@ -156,7 +156,7 @@ const AddressFields = _ref => {
156
156
  })), /*#__PURE__*/_react.default.createElement("div", {
157
157
  className: "checkout-modal__section"
158
158
  }, /*#__PURE__*/_react.default.createElement(_TextField.default, {
159
- label: label(humanizeNameType((_countryData$locality = countryData.localityNameType) !== null && _countryData$locality !== void 0 ? _countryData$locality : 'city'), 'locality'),
159
+ label: label(humanizeNameType(countryData.localityNameType ?? 'city'), 'locality'),
160
160
  placeholder: "Type here",
161
161
  value: value.locality || '',
162
162
  onChange: v => onChange({
@@ -166,7 +166,7 @@ const AddressFields = _ref => {
166
166
  })), isValidField('sublocality') && /*#__PURE__*/_react.default.createElement("div", {
167
167
  className: "checkout-modal__section"
168
168
  }, /*#__PURE__*/_react.default.createElement(_TextField.default, {
169
- label: label(humanizeNameType((_countryData$sublocal = countryData.sublocalityNameType) !== null && _countryData$sublocal !== void 0 ? _countryData$sublocal : 'suburb'), 'sublocality'),
169
+ label: label(humanizeNameType(countryData.sublocalityNameType ?? 'suburb'), 'sublocality'),
170
170
  placeholder: "Type here",
171
171
  value: value.sublocality || '',
172
172
  onChange: v => onChange({
@@ -176,7 +176,7 @@ const AddressFields = _ref => {
176
176
  })), isValidField('administrativeArea') && /*#__PURE__*/_react.default.createElement("div", {
177
177
  className: "checkout-modal__section"
178
178
  }, countryData.subRegions ? /*#__PURE__*/_react.default.createElement(_SelectField.default, {
179
- label: label(humanizeNameType((_countryData$stateNam = countryData.stateNameType) !== null && _countryData$stateNam !== void 0 ? _countryData$stateNam : 'state'), 'administrativeArea'),
179
+ label: label(humanizeNameType(countryData.stateNameType ?? 'state'), 'administrativeArea'),
180
180
  value: value.administrativeArea,
181
181
  onChange: v => onChange({
182
182
  administrativeArea: v
@@ -184,7 +184,7 @@ const AddressFields = _ref => {
184
184
  options: administrativeAreas,
185
185
  errors: getErrors('administrativeArea')
186
186
  }) : /*#__PURE__*/_react.default.createElement(_TextField.default, {
187
- label: label(humanizeNameType((_countryData$stateNam2 = countryData.stateNameType) !== null && _countryData$stateNam2 !== void 0 ? _countryData$stateNam2 : 'state'), 'administrativeArea'),
187
+ label: label(humanizeNameType(countryData.stateNameType ?? 'state'), 'administrativeArea'),
188
188
  autocomplete: "region",
189
189
  placeholder: "Type here",
190
190
  value: value.administrativeArea || '',
@@ -195,7 +195,7 @@ const AddressFields = _ref => {
195
195
  })), isValidField('zip') && /*#__PURE__*/_react.default.createElement("div", {
196
196
  className: "checkout-modal__section"
197
197
  }, /*#__PURE__*/_react.default.createElement(_TextField.default, {
198
- label: label(humanizeNameType((_countryData$zipNameT = countryData.zipNameType) !== null && _countryData$zipNameT !== void 0 ? _countryData$zipNameT : 'postal'), 'zip'),
198
+ label: label(humanizeNameType(countryData.zipNameType ?? 'postal'), 'zip'),
199
199
  autocomplete: "postal-code",
200
200
  placeholder: "Type here",
201
201
  value: value.zip || '',
@@ -25,7 +25,7 @@ const plural = (count, singularString, pluralString) => {
25
25
  const groupSelectionsByLicense = node => {
26
26
  var _node$licenseSelectio;
27
27
  return (_node$licenseSelectio = node.licenseSelections) === null || _node$licenseSelectio === void 0 ? void 0 : _node$licenseSelectio.reduce((res, _ref) => {
28
- var _res$license$id$selec, _res$license$id;
28
+ var _res$license$id;
29
29
  let {
30
30
  license,
31
31
  ...selection
@@ -34,7 +34,7 @@ const groupSelectionsByLicense = node => {
34
34
  ...res,
35
35
  [license.id]: {
36
36
  license,
37
- selections: ((_res$license$id$selec = (_res$license$id = res[license.id]) === null || _res$license$id === void 0 ? void 0 : _res$license$id.selections) !== null && _res$license$id$selec !== void 0 ? _res$license$id$selec : []).concat(selection)
37
+ selections: (((_res$license$id = res[license.id]) === null || _res$license$id === void 0 ? void 0 : _res$license$id.selections) ?? []).concat(selection)
38
38
  }
39
39
  };
40
40
  }, {});
@@ -101,33 +101,32 @@ const getSelectionIds = _ref4 => {
101
101
  };
102
102
  };
103
103
  const inputFromOptionChange = (node, variableId, value) => {
104
- var _node$licenseSelectio2, _node$licenseSelectio3;
104
+ var _node$licenseSelectio2;
105
105
  return {
106
106
  id: node.id,
107
- licenseSelections: (_node$licenseSelectio2 = (_node$licenseSelectio3 = node.licenseSelections) === null || _node$licenseSelectio3 === void 0 ? void 0 : _node$licenseSelectio3.map(selection => {
107
+ licenseSelections: ((_node$licenseSelectio2 = node.licenseSelections) === null || _node$licenseSelectio2 === void 0 ? void 0 : _node$licenseSelectio2.map(selection => {
108
108
  if (selection.variable && selection.variable.id === variableId) {
109
- var _value$licenseOptionI;
110
109
  return {
111
110
  licenseId: selection.license.id,
112
111
  licenseVariableId: selection.variable.id,
113
- licenseOptionId: (_value$licenseOptionI = value.licenseOptionId) !== null && _value$licenseOptionI !== void 0 ? _value$licenseOptionI : null,
112
+ licenseOptionId: value.licenseOptionId ?? null,
114
113
  variableText: value.variableText || null
115
114
  };
116
115
  }
117
116
 
118
117
  // map gql output to input
119
118
  return getSelectionIds(selection);
120
- })) !== null && _node$licenseSelectio2 !== void 0 ? _node$licenseSelectio2 : []
119
+ })) ?? []
121
120
  };
122
121
  };
123
122
  const inputFromLicenseRemoval = (node, licenseToRemove) => {
124
- var _node$licenseSelectio4, _node$licenseSelectio5;
125
- const licenseSelections = (_node$licenseSelectio4 = (_node$licenseSelectio5 = node.licenseSelections) === null || _node$licenseSelectio5 === void 0 ? void 0 : _node$licenseSelectio5.filter(_ref5 => {
123
+ var _node$licenseSelectio3;
124
+ const licenseSelections = ((_node$licenseSelectio3 = node.licenseSelections) === null || _node$licenseSelectio3 === void 0 ? void 0 : _node$licenseSelectio3.filter(_ref5 => {
126
125
  let {
127
126
  license
128
127
  } = _ref5;
129
128
  return license.id !== licenseToRemove.id;
130
- }).map(getSelectionIds)) !== null && _node$licenseSelectio4 !== void 0 ? _node$licenseSelectio4 : [];
129
+ }).map(getSelectionIds)) ?? [];
131
130
  return {
132
131
  id: node.id,
133
132
  licenseSelections
@@ -136,11 +135,11 @@ const inputFromLicenseRemoval = (node, licenseToRemove) => {
136
135
  const additionalLicenseInput = license => {
137
136
  if (license.variables && license.variables.length > 0) {
138
137
  return license.variables.map(variable => {
139
- var _variable$options$0$i, _variable$options2, _variable$options2$;
138
+ var _variable$options2, _variable$options2$;
140
139
  return {
141
140
  licenseId: license.id,
142
141
  licenseVariableId: variable.id,
143
- licenseOptionId: (_variable$options$0$i = (_variable$options2 = variable.options) === null || _variable$options2 === void 0 ? void 0 : (_variable$options2$ = _variable$options2[0]) === null || _variable$options2$ === void 0 ? void 0 : _variable$options2$.id) !== null && _variable$options$0$i !== void 0 ? _variable$options$0$i : null
142
+ licenseOptionId: ((_variable$options2 = variable.options) === null || _variable$options2 === void 0 ? void 0 : (_variable$options2$ = _variable$options2[0]) === null || _variable$options2$ === void 0 ? void 0 : _variable$options2$.id) ?? null
144
143
  };
145
144
  });
146
145
  }
@@ -151,8 +150,8 @@ const additionalLicenseInput = license => {
151
150
  }];
152
151
  };
153
152
  const inputFromLicenseAddition = (node, licenseToAdd) => {
154
- var _node$licenseSelectio6, _node$licenseSelectio7;
155
- const licenseSelections = (_node$licenseSelectio6 = (_node$licenseSelectio7 = node.licenseSelections) === null || _node$licenseSelectio7 === void 0 ? void 0 : _node$licenseSelectio7.map(getSelectionIds).concat(additionalLicenseInput(licenseToAdd))) !== null && _node$licenseSelectio6 !== void 0 ? _node$licenseSelectio6 : [];
153
+ var _node$licenseSelectio4;
154
+ const licenseSelections = ((_node$licenseSelectio4 = node.licenseSelections) === null || _node$licenseSelectio4 === void 0 ? void 0 : _node$licenseSelectio4.map(getSelectionIds).concat(additionalLicenseInput(licenseToAdd))) ?? [];
156
155
  return {
157
156
  id: node.id,
158
157
  licenseSelections
@@ -248,7 +247,7 @@ const productCss = product => {
248
247
  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;
249
248
  };
250
249
  const CartItemBase = _ref10 => {
251
- var _node$sku$product, _node$sku$product2, _node$sku$product2$va, _node$sku$product3, _node$sku$product$tot;
250
+ var _node$sku$product, _node$sku$product2, _node$sku$product2$va, _node$sku$product3;
252
251
  let {
253
252
  node,
254
253
  viewer,
@@ -283,7 +282,7 @@ const CartItemBase = _ref10 => {
283
282
  className: "cart-item__label"
284
283
  }, "Variable font") : ((_node$sku$product3 = node.sku.product) === null || _node$sku$product3 === void 0 ? void 0 : _node$sku$product3.__typename) === 'FontCollection' && /*#__PURE__*/_react.default.createElement("div", {
285
284
  className: "cart-item__label"
286
- }, "(", plural((_node$sku$product$tot = node.sku.product.totalStyles) !== null && _node$sku$product$tot !== void 0 ? _node$sku$product$tot : 0, 'style'), ")")), /*#__PURE__*/_react.default.createElement("ul", {
285
+ }, "(", plural(node.sku.product.totalStyles ?? 0, 'style'), ")")), /*#__PURE__*/_react.default.createElement("ul", {
287
286
  className: "cart-item__licenses"
288
287
  }, Object.keys(groupedLicenses).map(licenseId => {
289
288
  var _groupedLicenses$lice, _viewer$licenses;
@@ -26,11 +26,11 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
26
26
  const orderChangeInput = (order, orderItem) => {
27
27
  var _order$orderItems;
28
28
  return (_order$orderItems = order.orderItems) === null || _order$orderItems === void 0 ? void 0 : _order$orderItems.reduce((res, item) => {
29
- var _item$licenseSelectio, _item$licenseSelectio2;
29
+ var _item$licenseSelectio;
30
30
  if (item.id === orderItem.id) return res.concat(orderItem);
31
31
  return res.concat({
32
32
  id: item.id,
33
- licenseSelections: (_item$licenseSelectio = (_item$licenseSelectio2 = item.licenseSelections) === null || _item$licenseSelectio2 === void 0 ? void 0 : _item$licenseSelectio2.map(_ref => {
33
+ licenseSelections: ((_item$licenseSelectio = item.licenseSelections) === null || _item$licenseSelectio === void 0 ? void 0 : _item$licenseSelectio.map(_ref => {
34
34
  let {
35
35
  license,
36
36
  licenseVariable,
@@ -43,7 +43,7 @@ const orderChangeInput = (order, orderItem) => {
43
43
  licenseOptionId: licenseOption && licenseOption.id,
44
44
  variableText
45
45
  };
46
- }).filter(_utils2.notEmpty)) !== null && _item$licenseSelectio !== void 0 ? _item$licenseSelectio : []
46
+ }).filter(_utils2.notEmpty)) ?? []
47
47
  });
48
48
  }, [])
49
49
 
@@ -64,7 +64,7 @@ const orderChangeMutation = _CartOrderUpdateMutation !== void 0 ? _CartOrderUpda
64
64
  const applyCouponMutation = _CartOrderApplyCouponMutation !== void 0 ? _CartOrderApplyCouponMutation : (_CartOrderApplyCouponMutation = require("../../__generated__/CartOrderApplyCouponMutation.graphql"), _CartOrderApplyCouponMutation.hash && _CartOrderApplyCouponMutation.hash !== "32699616cc0aee87d659a1de4c238374" && console.error("The definition of 'CartOrderApplyCouponMutation' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data."), _CartOrderApplyCouponMutation);
65
65
  const removeDiscountMutation = _CartOrderRemoveDiscountMutation !== void 0 ? _CartOrderRemoveDiscountMutation : (_CartOrderRemoveDiscountMutation = require("../../__generated__/CartOrderRemoveDiscountMutation.graphql"), _CartOrderRemoveDiscountMutation.hash && _CartOrderRemoveDiscountMutation.hash !== "8a84a9135f1406fa9c4cc16dc2e11d30" && console.error("The definition of 'CartOrderRemoveDiscountMutation' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data."), _CartOrderRemoveDiscountMutation);
66
66
  const CartOrder = _ref2 => {
67
- var _order$stripePaymentM, _viewer$settings$eula, _viewer$settings;
67
+ var _order$stripePaymentM, _viewer$settings;
68
68
  let {
69
69
  order: orderKey,
70
70
  viewer: viewerKey,
@@ -300,7 +300,7 @@ const CartOrder = _ref2 => {
300
300
  }, /*#__PURE__*/_react.default.createElement(_Icons.Check, null))), /*#__PURE__*/_react.default.createElement("label", {
301
301
  htmlFor: "eula-agreement",
302
302
  dangerouslySetInnerHTML: {
303
- __html: (_viewer$settings$eula = (_viewer$settings = viewer.settings) === null || _viewer$settings === void 0 ? void 0 : _viewer$settings.eulaAgreementLabel) !== null && _viewer$settings$eula !== void 0 ? _viewer$settings$eula : ''
303
+ __html: ((_viewer$settings = viewer.settings) === null || _viewer$settings === void 0 ? void 0 : _viewer$settings.eulaAgreementLabel) ?? ''
304
304
  }
305
305
  }))), /*#__PURE__*/_react.default.createElement("div", {
306
306
  className: "cart__additions"
@@ -28,7 +28,6 @@ const updateCustomerMutation = _CheckoutUpdateCustomerMutation !== void 0 ? _Che
28
28
  _Checkout_UpdateOrderErrors !== void 0 ? _Checkout_UpdateOrderErrors : (_Checkout_UpdateOrderErrors = require("../../__generated__/Checkout_UpdateOrderErrors.graphql"), _Checkout_UpdateOrderErrors.hash && _Checkout_UpdateOrderErrors.hash !== "d76073037a16138de572dbb22d72da8f" && console.error("The definition of 'Checkout_UpdateOrderErrors' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data."), _Checkout_UpdateOrderErrors);
29
29
  const updateOrderMutation = _CheckoutUpdateOrderMutation !== void 0 ? _CheckoutUpdateOrderMutation : (_CheckoutUpdateOrderMutation = require("../../__generated__/CheckoutUpdateOrderMutation.graphql"), _CheckoutUpdateOrderMutation.hash && _CheckoutUpdateOrderMutation.hash !== "089745e2478edf385a09357905e4173c" && console.error("The definition of 'CheckoutUpdateOrderMutation' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data."), _CheckoutUpdateOrderMutation);
30
30
  const Checkout = _ref => {
31
- var _orderData$customer, _orderData$billingIde, _orderData$licenseeId, _orderData$licenseeIs;
32
31
  let {
33
32
  order,
34
33
  viewer,
@@ -56,16 +55,16 @@ const Checkout = _ref => {
56
55
  zip: '',
57
56
  vatNumber: ''
58
57
  };
59
- const [customer, setCustomer] = (0, _react.useState)((_orderData$customer = orderData === null || orderData === void 0 ? void 0 : orderData.customer) !== null && _orderData$customer !== void 0 ? _orderData$customer : {
58
+ const [customer, setCustomer] = (0, _react.useState)((orderData === null || orderData === void 0 ? void 0 : orderData.customer) ?? {
60
59
  name: null,
61
60
  email: null,
62
61
  newsletterOptIn: false
63
62
  });
64
- const [billingIdentity, setBillingIdentity] = (0, _react.useState)((_orderData$billingIde = orderData === null || orderData === void 0 ? void 0 : orderData.billingIdentity) !== null && _orderData$billingIde !== void 0 ? _orderData$billingIde : identity);
65
- const [licenseeIdentity, setLicenseeIdentity] = (0, _react.useState)((_orderData$licenseeId = orderData === null || orderData === void 0 ? void 0 : orderData.licenseeIdentity) !== null && _orderData$licenseeId !== void 0 ? _orderData$licenseeId : identity);
63
+ const [billingIdentity, setBillingIdentity] = (0, _react.useState)((orderData === null || orderData === void 0 ? void 0 : orderData.billingIdentity) ?? identity);
64
+ const [licenseeIdentity, setLicenseeIdentity] = (0, _react.useState)((orderData === null || orderData === void 0 ? void 0 : orderData.licenseeIdentity) ?? identity);
66
65
  const [billingRequired, setBillingRequired] = (0, _react.useState)();
67
66
  const [licenseeRequired, setLicenseeRequired] = (0, _react.useState)(null);
68
- const [licenseeIsBillingIdentity, setLicenseeIsBillingIdentity] = (0, _react.useState)((_orderData$licenseeIs = orderData === null || orderData === void 0 ? void 0 : orderData.licenseeIsBillingIdentity) !== null && _orderData$licenseeIs !== void 0 ? _orderData$licenseeIs : true);
67
+ const [licenseeIsBillingIdentity, setLicenseeIsBillingIdentity] = (0, _react.useState)((orderData === null || orderData === void 0 ? void 0 : orderData.licenseeIsBillingIdentity) ?? true);
69
68
  const [error, setError] = (0, _react.useState)(null);
70
69
  const [submitting, setSubmitting] = (0, _react.useState)(false);
71
70
  const [mediaQuery, setMediaQuery] = (0, _react.useState)(DESKTOP);
@@ -157,7 +156,7 @@ const Checkout = _ref => {
157
156
  });
158
157
  }
159
158
  if (checkoutStep === _CheckoutSteps.default.Payment) {
160
- var _billingIdentity$stre, _billingIdentity$zip;
159
+ var _billingIdentity$stre;
161
160
  if (!stripe || !elements) {
162
161
  console.error('Stripe failed to load');
163
162
  return;
@@ -178,7 +177,7 @@ const Checkout = _ref => {
178
177
  city: billingIdentity.locality || '',
179
178
  state: billingIdentity.administrativeArea || '',
180
179
  country: billingIdentity.country,
181
- postal_code: (_billingIdentity$zip = billingIdentity.zip) !== null && _billingIdentity$zip !== void 0 ? _billingIdentity$zip : undefined
180
+ postal_code: billingIdentity.zip ?? undefined
182
181
  }
183
182
  }
184
183
  }).then(_ref2 => {
@@ -187,8 +186,7 @@ const Checkout = _ref => {
187
186
  error
188
187
  } = _ref2;
189
188
  if (error) {
190
- var _error$message;
191
- setError((_error$message = error === null || error === void 0 ? void 0 : error.message) !== null && _error$message !== void 0 ? _error$message : 'Unknown Stripe error');
189
+ setError((error === null || error === void 0 ? void 0 : error.message) ?? 'Unknown Stripe error');
192
190
  setSubmitting(false);
193
191
  } else {
194
192
  if (paymentMethod) {
@@ -255,12 +253,12 @@ const Checkout = _ref => {
255
253
  return Boolean(customer.name && customer.email);
256
254
  }
257
255
  if (checkoutStep === _CheckoutSteps.default.Billing) {
258
- const requiredFields = IDENTITY_REQUIRED_FIELDS.concat(billingRequired !== null && billingRequired !== void 0 ? billingRequired : []);
256
+ const requiredFields = IDENTITY_REQUIRED_FIELDS.concat(billingRequired ?? []);
259
257
  return requiredFields.every(field => billingIdentity[field]);
260
258
  }
261
259
  if (checkoutStep === _CheckoutSteps.default.Licensee) {
262
260
  if (licenseeIsBillingIdentity) return true;
263
- const requiredFields = IDENTITY_REQUIRED_FIELDS.concat(licenseeRequired !== null && licenseeRequired !== void 0 ? licenseeRequired : []);
261
+ const requiredFields = IDENTITY_REQUIRED_FIELDS.concat(licenseeRequired ?? []);
264
262
  return requiredFields.every(field => licenseeIdentity[field]);
265
263
  }
266
264
  return true;
@@ -14,7 +14,6 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
14
14
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
15
15
  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; }
16
16
  const CustomerFields = _ref => {
17
- var _value$newsletterOptI;
18
17
  let {
19
18
  title,
20
19
  value,
@@ -60,7 +59,7 @@ const CustomerFields = _ref => {
60
59
  }, /*#__PURE__*/_react.default.createElement("input", {
61
60
  type: "checkbox",
62
61
  id: "customer-newsletter-opt-in",
63
- checked: (_value$newsletterOptI = value.newsletterOptIn) !== null && _value$newsletterOptI !== void 0 ? _value$newsletterOptI : false,
62
+ checked: value.newsletterOptIn ?? false,
64
63
  onChange: e => onChange({
65
64
  newsletterOptIn: e.target.checked
66
65
  })
@@ -5,13 +5,13 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.textVariablesAllHaveText = void 0;
7
7
  const textVariablesAllHaveText = order => {
8
- var _order$orderItems$eve, _order$orderItems;
9
- return (_order$orderItems$eve = order === null || order === void 0 ? void 0 : (_order$orderItems = order.orderItems) === null || _order$orderItems === void 0 ? void 0 : _order$orderItems.every(item => {
8
+ var _order$orderItems;
9
+ return (order === null || order === void 0 ? void 0 : (_order$orderItems = order.orderItems) === null || _order$orderItems === void 0 ? void 0 : _order$orderItems.every(item => {
10
10
  var _item$licenseSelectio;
11
11
  return item === null || item === void 0 ? void 0 : (_item$licenseSelectio = item.licenseSelections) === null || _item$licenseSelectio === void 0 ? void 0 : _item$licenseSelectio.every(selection => {
12
12
  var _selection$licenseVar;
13
13
  return (selection === null || selection === void 0 ? void 0 : (_selection$licenseVar = selection.licenseVariable) === null || _selection$licenseVar === void 0 ? void 0 : _selection$licenseVar.variableType) === 'text' ? Boolean(selection === null || selection === void 0 ? void 0 : selection.variableText) : true;
14
14
  });
15
- })) !== null && _order$orderItems$eve !== void 0 ? _order$orderItems$eve : true;
15
+ })) ?? true;
16
16
  };
17
17
  exports.textVariablesAllHaveText = textVariablesAllHaveText;
@@ -79,9 +79,9 @@ const CartButtonQueryRenderer = params => {
79
79
  return null;
80
80
  }
81
81
  if (props) {
82
- var _props$viewer$current, _props$viewer;
82
+ var _props$viewer;
83
83
  return /*#__PURE__*/_react.default.createElement(CartButton, _extends({}, params, {
84
- order: (_props$viewer$current = (_props$viewer = props.viewer) === null || _props$viewer === void 0 ? void 0 : _props$viewer.currentOrder) !== null && _props$viewer$current !== void 0 ? _props$viewer$current : null
84
+ order: ((_props$viewer = props.viewer) === null || _props$viewer === void 0 ? void 0 : _props$viewer.currentOrder) ?? null
85
85
  }));
86
86
  }
87
87
  return null;