fontdue-js 2.4.0 → 2.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,16 @@
1
+ ## 2.4.1
2
+
3
+ - Fixes NewsletterSignup component not accepting props in some cases
4
+
5
+ ## 2.4.0
6
+
7
+ - Adds tax rate as a percentage in cart totals (making it more consistent with how totals are shown in receipts and invoices)
8
+ - Fixes default text alignment for right-to-left type testers (e.g. arabic)
9
+
10
+ ## 2.3.0
11
+
12
+ - Improves StoreModal user experience when selecting fonts: shows a checkmark icon for selected fonts, and shows product prices that result in package discounts with a plus (e.g. $40 -> +$20)
13
+
1
14
  ## 2.2.0
2
15
 
3
16
  - Support for updated stripe integration, for accounts that connected to Stripe after August 11 2023
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @generated SignedSource<<01242a8291632a5627223bd212a6c280>>
2
+ * @generated SignedSource<<60c35ca68860b23028f3cfc232778665>>
3
3
  * @lightSyntaxTransform
4
4
  * @nogrep
5
5
  */
@@ -10,6 +10,13 @@ export type FamilyList_node$data = {
10
10
  readonly name: string;
11
11
  readonly name_localized: string;
12
12
  readonly supportedLanguages: ReadonlyArray<string> | null;
13
+ readonly variableInstances: ReadonlyArray<{
14
+ readonly coordinates: ReadonlyArray<{
15
+ readonly axis: string;
16
+ readonly value: number;
17
+ }>;
18
+ readonly name: string;
19
+ }> | null;
13
20
  readonly " $fragmentSpreads": FragmentRefs<"FontStyle_fontStyle">;
14
21
  }> | null;
15
22
  readonly name: string;
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = void 0;
7
7
  /**
8
- * @generated SignedSource<<01242a8291632a5627223bd212a6c280>>
8
+ * @generated SignedSource<<60c35ca68860b23028f3cfc232778665>>
9
9
  * @lightSyntaxTransform
10
10
  * @nogrep
11
11
  */
@@ -54,6 +54,36 @@ const node = function () {
54
54
  "kind": "ScalarField",
55
55
  "name": "name",
56
56
  "storageKey": "name(format:\"LOCALIZED\")"
57
+ }, {
58
+ "alias": null,
59
+ "args": null,
60
+ "concreteType": "VariableInstance",
61
+ "kind": "LinkedField",
62
+ "name": "variableInstances",
63
+ "plural": true,
64
+ "selections": [v0 /*: any*/, {
65
+ "alias": null,
66
+ "args": null,
67
+ "concreteType": "VariableSetting",
68
+ "kind": "LinkedField",
69
+ "name": "coordinates",
70
+ "plural": true,
71
+ "selections": [{
72
+ "alias": null,
73
+ "args": null,
74
+ "kind": "ScalarField",
75
+ "name": "axis",
76
+ "storageKey": null
77
+ }, {
78
+ "alias": null,
79
+ "args": null,
80
+ "kind": "ScalarField",
81
+ "name": "value",
82
+ "storageKey": null
83
+ }],
84
+ "storageKey": null
85
+ }],
86
+ "storageKey": null
57
87
  }],
58
88
  "storageKey": null
59
89
  }],
@@ -61,6 +91,6 @@ const node = function () {
61
91
  "abstractKey": null
62
92
  };
63
93
  }();
64
- node.hash = "3e59cb2493f7c235fe19c70689ca2fc6";
94
+ node.hash = "d52770ab2e7aaa83f392a5d80340f3ad";
65
95
  var _default = node;
66
96
  exports.default = _default;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @generated SignedSource<<095cc0e1e4a993cebb6b5d78c90af71c>>
2
+ * @generated SignedSource<<1d4fb162956c6117095ff7fa866dff2b>>
3
3
  * @lightSyntaxTransform
4
4
  * @nogrep
5
5
  */
@@ -14,6 +14,15 @@ export type Family_node$data = {
14
14
  } | null;
15
15
  readonly " $fragmentSpreads": FragmentRefs<"FamilyList_node">;
16
16
  }> | null;
17
+ readonly fontStyles: ReadonlyArray<{
18
+ readonly variableAxes: ReadonlyArray<{
19
+ readonly name: string;
20
+ }> | null;
21
+ readonly variableInstances: ReadonlyArray<{
22
+ readonly name: string;
23
+ }> | null;
24
+ }> | null;
25
+ readonly isVariableFont: boolean;
17
26
  readonly name: string;
18
27
  readonly sku: {
19
28
  readonly id: string;
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = void 0;
7
7
  /**
8
- * @generated SignedSource<<095cc0e1e4a993cebb6b5d78c90af71c>>
8
+ * @generated SignedSource<<1d4fb162956c6117095ff7fa866dff2b>>
9
9
  * @lightSyntaxTransform
10
10
  * @nogrep
11
11
  */
@@ -16,10 +16,19 @@ exports.default = void 0;
16
16
 
17
17
  const node = function () {
18
18
  var v0 = {
19
- "args": null,
20
- "kind": "FragmentSpread",
21
- "name": "FamilyList_node"
22
- };
19
+ "args": null,
20
+ "kind": "FragmentSpread",
21
+ "name": "FamilyList_node"
22
+ },
23
+ v1 = {
24
+ "alias": null,
25
+ "args": null,
26
+ "kind": "ScalarField",
27
+ "name": "name",
28
+ "storageKey": null
29
+ },
30
+ v2 = [v1 /*: any*/];
31
+
23
32
  return {
24
33
  "argumentDefinitions": [],
25
34
  "kind": "Fragment",
@@ -54,23 +63,50 @@ const node = function () {
54
63
  "kind": "ScalarField",
55
64
  "name": "cssUrl",
56
65
  "storageKey": null
57
- }, {
66
+ }, v1 /*: any*/, {
58
67
  "alias": null,
59
68
  "args": null,
60
69
  "kind": "ScalarField",
61
- "name": "name",
70
+ "name": "collectionType",
62
71
  "storageKey": null
63
72
  }, {
64
73
  "alias": null,
65
74
  "args": null,
66
75
  "kind": "ScalarField",
67
- "name": "collectionType",
76
+ "name": "totalStyles",
68
77
  "storageKey": null
69
78
  }, {
70
79
  "alias": null,
71
80
  "args": null,
72
81
  "kind": "ScalarField",
73
- "name": "totalStyles",
82
+ "name": "isVariableFont",
83
+ "storageKey": null
84
+ }, {
85
+ "alias": null,
86
+ "args": null,
87
+ "concreteType": "FontStyle",
88
+ "kind": "LinkedField",
89
+ "name": "fontStyles",
90
+ "plural": true,
91
+ "selections": [{
92
+ "alias": null,
93
+ "args": null,
94
+ "concreteType": "VariableAxis",
95
+ "kind": "LinkedField",
96
+ "name": "variableAxes",
97
+ "plural": true,
98
+ "selections": v2 /*: any*/,
99
+ "storageKey": null
100
+ }, {
101
+ "alias": null,
102
+ "args": null,
103
+ "concreteType": "VariableInstance",
104
+ "kind": "LinkedField",
105
+ "name": "variableInstances",
106
+ "plural": true,
107
+ "selections": v2 /*: any*/,
108
+ "storageKey": null
109
+ }],
74
110
  "storageKey": null
75
111
  }, {
76
112
  "alias": "families",
@@ -110,6 +146,6 @@ const node = function () {
110
146
  "abstractKey": null
111
147
  };
112
148
  }();
113
- node.hash = "b51af1e6bc979d5219f04c848dc3d76d";
149
+ node.hash = "2fecc4fd332a593d28387a3a87559fe4";
114
150
  var _default = node;
115
151
  exports.default = _default;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @generated SignedSource<<7b378eaec907edc50e7111f817d12cae>>
2
+ * @generated SignedSource<<3a7afd49b802244383f88fd3d1ea0bd3>>
3
3
  * @lightSyntaxTransform
4
4
  * @nogrep
5
5
  */
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = void 0;
7
7
  /**
8
- * @generated SignedSource<<7b378eaec907edc50e7111f817d12cae>>
8
+ * @generated SignedSource<<3a7afd49b802244383f88fd3d1ea0bd3>>
9
9
  * @lightSyntaxTransform
10
10
  * @nogrep
11
11
  */
@@ -42,55 +42,98 @@ const node = function () {
42
42
  "name": "name",
43
43
  "storageKey": null
44
44
  },
45
- v5 = [{
45
+ v5 = {
46
+ "alias": null,
47
+ "args": null,
48
+ "kind": "ScalarField",
49
+ "name": "cssFamily",
50
+ "storageKey": null
51
+ },
52
+ v6 = {
53
+ "alias": null,
54
+ "args": null,
55
+ "kind": "ScalarField",
56
+ "name": "supportedLanguages",
57
+ "storageKey": null
58
+ },
59
+ v7 = [{
46
60
  "kind": "Literal",
47
61
  "name": "format",
48
62
  "value": "LOCALIZED"
49
63
  }],
50
- v6 = {
64
+ v8 = {
65
+ "alias": "name_localized",
66
+ "args": v7 /*: any*/,
67
+ "kind": "ScalarField",
68
+ "name": "name",
69
+ "storageKey": "name(format:\"LOCALIZED\")"
70
+ },
71
+ v9 = {
72
+ "alias": null,
73
+ "args": null,
74
+ "concreteType": "VariableInstance",
75
+ "kind": "LinkedField",
76
+ "name": "variableInstances",
77
+ "plural": true,
78
+ "selections": [v4 /*: any*/, {
79
+ "alias": null,
80
+ "args": null,
81
+ "concreteType": "VariableSetting",
82
+ "kind": "LinkedField",
83
+ "name": "coordinates",
84
+ "plural": true,
85
+ "selections": [{
86
+ "alias": null,
87
+ "args": null,
88
+ "kind": "ScalarField",
89
+ "name": "axis",
90
+ "storageKey": null
91
+ }, {
92
+ "alias": null,
93
+ "args": null,
94
+ "kind": "ScalarField",
95
+ "name": "value",
96
+ "storageKey": null
97
+ }],
98
+ "storageKey": null
99
+ }],
100
+ "storageKey": null
101
+ },
102
+ v10 = {
51
103
  "alias": null,
52
104
  "args": null,
53
105
  "kind": "ScalarField",
54
106
  "name": "id",
55
107
  "storageKey": null
56
108
  },
57
- v7 = {
109
+ v11 = {
58
110
  "alias": null,
59
111
  "args": null,
60
112
  "concreteType": "FontStyle",
61
113
  "kind": "LinkedField",
62
114
  "name": "fontStyles",
63
115
  "plural": true,
64
- "selections": [{
65
- "alias": null,
66
- "args": null,
67
- "kind": "ScalarField",
68
- "name": "cssFamily",
69
- "storageKey": null
70
- }, v4 /*: any*/, {
116
+ "selections": [v5 /*: any*/, v4 /*: any*/, v6 /*: any*/, v8 /*: any*/, v9 /*: any*/, v10 /*: any*/, {
71
117
  "alias": null,
72
118
  "args": null,
73
- "kind": "ScalarField",
74
- "name": "supportedLanguages",
75
- "storageKey": null
76
- }, {
77
- "alias": "name_localized",
78
- "args": v5 /*: any*/,
79
- "kind": "ScalarField",
80
- "name": "name",
81
- "storageKey": "name(format:\"LOCALIZED\")"
82
- }, v6 /*: any*/],
119
+ "concreteType": "VariableAxis",
120
+ "kind": "LinkedField",
121
+ "name": "variableAxes",
122
+ "plural": true,
123
+ "selections": [v4 /*: any*/],
83
124
 
125
+ "storageKey": null
126
+ }],
84
127
  "storageKey": null
85
128
  },
86
- v8 = {
129
+ v12 = {
87
130
  "alias": null,
88
131
  "args": null,
89
132
  "concreteType": "Sku",
90
133
  "kind": "LinkedField",
91
134
  "name": "sku",
92
135
  "plural": false,
93
- "selections": [v6 /*: any*/, {
136
+ "selections": [v10 /*: any*/, {
94
137
  "alias": null,
95
138
  "args": [{
96
139
  "kind": "Literal",
@@ -119,28 +162,35 @@ const node = function () {
119
162
  }],
120
163
  "storageKey": null
121
164
  },
122
- v9 = {
165
+ v13 = {
123
166
  "alias": null,
124
167
  "args": null,
125
168
  "kind": "ScalarField",
126
169
  "name": "cssUrl",
127
170
  "storageKey": null
128
171
  },
129
- v10 = {
172
+ v14 = {
130
173
  "alias": null,
131
174
  "args": null,
132
175
  "kind": "ScalarField",
133
176
  "name": "collectionType",
134
177
  "storageKey": null
135
178
  },
136
- v11 = {
179
+ v15 = {
137
180
  "alias": null,
138
181
  "args": null,
139
182
  "kind": "ScalarField",
140
183
  "name": "totalStyles",
141
184
  "storageKey": null
142
185
  },
143
- v12 = {
186
+ v16 = {
187
+ "alias": null,
188
+ "args": null,
189
+ "kind": "ScalarField",
190
+ "name": "isVariableFont",
191
+ "storageKey": null
192
+ },
193
+ v17 = {
144
194
  "alias": null,
145
195
  "args": null,
146
196
  "concreteType": "FontStyle",
@@ -149,11 +199,11 @@ const node = function () {
149
199
  "plural": false,
150
200
  "selections": [{
151
201
  "alias": "keyCharacters_localized",
152
- "args": v5 /*: any*/,
202
+ "args": v7 /*: any*/,
153
203
  "kind": "ScalarField",
154
204
  "name": "keyCharacters",
155
205
  "storageKey": "keyCharacters(format:\"LOCALIZED\")"
156
- }, v6 /*: any*/],
206
+ }, v10 /*: any*/],
157
207
 
158
208
  "storageKey": null
159
209
  };
@@ -211,21 +261,31 @@ const node = function () {
211
261
  "storageKey": null
212
262
  }, {
213
263
  "kind": "InlineFragment",
214
- "selections": [v4 /*: any*/, v7 /*: any*/, v8 /*: any*/, v9 /*: any*/, v10 /*: any*/, v11 /*: any*/, {
264
+ "selections": [v4 /*: any*/, v11 /*: any*/, v12 /*: any*/, v13 /*: any*/, v14 /*: any*/, v15 /*: any*/, v16 /*: any*/, {
215
265
  "alias": "families",
216
266
  "args": v3 /*: any*/,
217
267
  "concreteType": "FontCollection",
218
268
  "kind": "LinkedField",
219
269
  "name": "children",
220
270
  "plural": true,
221
- "selections": [v12 /*: any*/, v4 /*: any*/, v7 /*: any*/, v6 /*: any*/, v8 /*: any*/, v9 /*: any*/, v10 /*: any*/, v11 /*: any*/, {
271
+ "selections": [v17 /*: any*/, v4 /*: any*/, v11 /*: any*/, v10 /*: any*/, v12 /*: any*/, v13 /*: any*/, v14 /*: any*/, v15 /*: any*/, v16 /*: any*/, {
222
272
  "alias": "families",
223
273
  "args": v3 /*: any*/,
224
274
  "concreteType": "FontCollection",
225
275
  "kind": "LinkedField",
226
276
  "name": "children",
227
277
  "plural": true,
228
- "selections": [v12 /*: any*/, v4 /*: any*/, v7 /*: any*/, v6 /*: any*/],
278
+ "selections": [v17 /*: any*/, v4 /*: any*/, {
279
+ "alias": null,
280
+ "args": null,
281
+ "concreteType": "FontStyle",
282
+ "kind": "LinkedField",
283
+ "name": "fontStyles",
284
+ "plural": true,
285
+ "selections": [v5 /*: any*/, v4 /*: any*/, v6 /*: any*/, v8 /*: any*/, v9 /*: any*/, v10 /*: any*/],
286
+
287
+ "storageKey": null
288
+ }, v10 /*: any*/],
229
289
 
230
290
  "storageKey": "children(collectionTypes:[\"FAMILY\"])"
231
291
  }],
@@ -233,18 +293,18 @@ const node = function () {
233
293
  }],
234
294
  "type": "FontCollection",
235
295
  "abstractKey": null
236
- }, v6 /*: any*/],
296
+ }, v10 /*: any*/],
237
297
 
238
298
  "storageKey": null
239
299
  }]
240
300
  },
241
301
  "params": {
242
- "cacheID": "62e46c66d93dcb7446f0e37a9a26ec7f",
302
+ "cacheID": "ac29ff13395d753a44c16d0c988b3e7a",
243
303
  "id": null,
244
304
  "metadata": {},
245
305
  "name": "FontFamiliesQuery",
246
306
  "operationKind": "query",
247
- "text": "query FontFamiliesQuery(\n $collectionId: ID!\n) {\n node(id: $collectionId) {\n __typename\n ...Family_node\n ... on FontCollection {\n families: children(collectionTypes: [FAMILY]) {\n ...Family_node\n id\n }\n }\n id\n }\n}\n\nfragment FamilyList_node on FontCollection {\n name\n fontStyles {\n ...FontStyle_fontStyle\n supportedLanguages\n name\n name_localized: name(format: LOCALIZED)\n id\n }\n}\n\nfragment Family_node on FontCollection {\n ...FamilyList_node\n sku {\n id\n ...SKUPrice_sku\n ...SelectButton_sku\n }\n cssUrl\n name\n collectionType\n totalStyles\n families: children(collectionTypes: [FAMILY]) {\n featureStyle {\n keyCharacters_localized: keyCharacters(format: LOCALIZED)\n id\n }\n ...FamilyList_node\n id\n }\n}\n\nfragment FontStyle_fontStyle on FontStyle {\n cssFamily\n name\n}\n\nfragment Price_price on Money {\n amount\n currency\n}\n\nfragment SKUPrice_sku on Sku {\n id\n price(licenseOptions: []) {\n amount\n ...Price_price\n }\n}\n\nfragment SKUPrice_sku_2AMk59 on Sku {\n id\n price(licenseOptions: []) {\n amount\n ...Price_price\n }\n}\n\nfragment SelectButton_sku on Sku {\n id\n ...SKUPrice_sku_2AMk59\n}\n"
307
+ "text": "query FontFamiliesQuery(\n $collectionId: ID!\n) {\n node(id: $collectionId) {\n __typename\n ...Family_node\n ... on FontCollection {\n families: children(collectionTypes: [FAMILY]) {\n ...Family_node\n id\n }\n }\n id\n }\n}\n\nfragment FamilyList_node on FontCollection {\n name\n fontStyles {\n ...FontStyle_fontStyle\n supportedLanguages\n name\n name_localized: name(format: LOCALIZED)\n variableInstances {\n name\n coordinates {\n axis\n value\n }\n }\n id\n }\n}\n\nfragment Family_node on FontCollection {\n ...FamilyList_node\n sku {\n id\n ...SKUPrice_sku\n ...SelectButton_sku\n }\n cssUrl\n name\n collectionType\n totalStyles\n isVariableFont\n fontStyles {\n variableAxes {\n name\n }\n variableInstances {\n name\n }\n id\n }\n families: children(collectionTypes: [FAMILY]) {\n featureStyle {\n keyCharacters_localized: keyCharacters(format: LOCALIZED)\n id\n }\n ...FamilyList_node\n id\n }\n}\n\nfragment FontStyle_fontStyle on FontStyle {\n cssFamily\n name\n}\n\nfragment Price_price on Money {\n amount\n currency\n}\n\nfragment SKUPrice_sku on Sku {\n id\n price(licenseOptions: []) {\n amount\n ...Price_price\n }\n}\n\nfragment SKUPrice_sku_2AMk59 on Sku {\n id\n price(licenseOptions: []) {\n amount\n ...Price_price\n }\n}\n\nfragment SelectButton_sku on Sku {\n id\n ...SKUPrice_sku_2AMk59\n}\n"
248
308
  }
249
309
  };
250
310
  }();
@@ -19,16 +19,36 @@ function FamilyList(_ref) {
19
19
  node: nodeKey,
20
20
  text
21
21
  } = _ref;
22
- const node = (0, _reactRelay.useFragment)(_FamilyList_node !== void 0 ? _FamilyList_node : (_FamilyList_node = require("../../__generated__/FamilyList_node.graphql"), _FamilyList_node.hash && _FamilyList_node.hash !== "3e59cb2493f7c235fe19c70689ca2fc6" && console.error("The definition of 'FamilyList_node' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data."), _FamilyList_node), nodeKey);
22
+ const node = (0, _reactRelay.useFragment)(_FamilyList_node !== void 0 ? _FamilyList_node : (_FamilyList_node = require("../../__generated__/FamilyList_node.graphql"), _FamilyList_node.hash && _FamilyList_node.hash !== "d52770ab2e7aaa83f392a5d80340f3ad" && console.error("The definition of 'FamilyList_node' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data."), _FamilyList_node), nodeKey);
23
23
  return /*#__PURE__*/_react.default.createElement("ul", {
24
24
  className: "font-family-block__list",
25
25
  style: {
26
26
  fontFamily: node.name
27
27
  }
28
- }, (_node$fontStyles = node.fontStyles) === null || _node$fontStyles === void 0 ? void 0 : _node$fontStyles.map((style, i) => /*#__PURE__*/_react.default.createElement(_FontStyle.default, {
29
- fontStyle: style,
30
- Component: "li",
31
- key: i,
32
- className: "font-family-block__list__item"
33
- }, /*#__PURE__*/_react.default.createElement("span", null, text || styleName(style.name, style.name_localized), " "))));
28
+ }, (_node$fontStyles = node.fontStyles) === null || _node$fontStyles === void 0 ? void 0 : _node$fontStyles.map((style, i) => {
29
+ var _style$variableInstan, _style$variableInstan2;
30
+ return /*#__PURE__*/_react.default.createElement(_FontStyle.default, {
31
+ fontStyle: style,
32
+ Component: "li",
33
+ key: i,
34
+ className: "font-family-block__list__item"
35
+ }, (((_style$variableInstan = style.variableInstances) === null || _style$variableInstan === void 0 ? void 0 : _style$variableInstan.length) ?? 0) > 0 ? (_style$variableInstan2 = style.variableInstances) === null || _style$variableInstan2 === void 0 ? void 0 : _style$variableInstan2.map(_ref2 => {
36
+ let {
37
+ name,
38
+ coordinates
39
+ } = _ref2;
40
+ return /*#__PURE__*/_react.default.createElement("span", {
41
+ key: name,
42
+ style: {
43
+ fontVariationSettings: coordinates.map(_ref3 => {
44
+ let {
45
+ axis,
46
+ value
47
+ } = _ref3;
48
+ return `'${axis}' ${value}`;
49
+ }).join(',')
50
+ }
51
+ }, name, ' ');
52
+ }) : /*#__PURE__*/_react.default.createElement("span", null, text || styleName(style.name, style.name_localized), " "));
53
+ }));
34
54
  }
@@ -13,17 +13,18 @@ var _Price = require("../Price");
13
13
  var _FamilyList = _interopRequireDefault(require("./FamilyList"));
14
14
  var _Stylesheet = _interopRequireDefault(require("../Stylesheet"));
15
15
  var _reducer = require("../../reducer");
16
+ var _utils = require("../../utils");
16
17
  var _Family_node;
17
18
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
18
19
  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); }
19
20
  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; }
20
21
  function Family(_ref) {
21
- var _node$families;
22
+ var _node$fontStyles, _node$fontStyles2, _node$families;
22
23
  let {
23
24
  node: nodeKey,
24
25
  size
25
26
  } = _ref;
26
- const node = (0, _reactRelay.useFragment)(_Family_node !== void 0 ? _Family_node : (_Family_node = require("../../__generated__/Family_node.graphql"), _Family_node.hash && _Family_node.hash !== "b51af1e6bc979d5219f04c848dc3d76d" && console.error("The definition of 'Family_node' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data."), _Family_node), nodeKey);
27
+ const node = (0, _reactRelay.useFragment)(_Family_node !== void 0 ? _Family_node : (_Family_node = require("../../__generated__/Family_node.graphql"), _Family_node.hash && _Family_node.hash !== "2fecc4fd332a593d28387a3a87559fe4" && console.error("The definition of 'Family_node' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data."), _Family_node), nodeKey);
27
28
  const precartOpen = (0, _reactRedux.useSelector)(state => state.precartOpen);
28
29
  const selector = node.sku ? (0, _reducer.isSelected)(node.sku.id) : () => false;
29
30
  const selected = (0, _reactRedux.useSelector)(selector);
@@ -61,7 +62,21 @@ function Family(_ref) {
61
62
  className: "font-family-block__separator"
62
63
  }), /*#__PURE__*/_react.default.createElement("p", {
63
64
  className: "font-family-block__count"
64
- }, node.totalStyles, " styles")), /*#__PURE__*/_react.default.createElement("div", {
65
+ }, (0, _utils.pluralize)(node.totalStyles ?? 0, node.isVariableFont ? 'font' : 'style')), node.isVariableFont ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("span", {
66
+ className: "font-family-block__separator"
67
+ }), /*#__PURE__*/_react.default.createElement("p", {
68
+ className: "font-family-block__count"
69
+ }, (0, _utils.pluralize)(((_node$fontStyles = node.fontStyles) === null || _node$fontStyles === void 0 ? void 0 : _node$fontStyles.reduce((total, style) => {
70
+ var _style$variableAxes;
71
+ return total + (((_style$variableAxes = style.variableAxes) === null || _style$variableAxes === void 0 ? void 0 : _style$variableAxes.length) ?? 0);
72
+ }, 0)) ?? 0, 'variable axis', 'variable axes')), /*#__PURE__*/_react.default.createElement("span", {
73
+ className: "font-family-block__separator"
74
+ }), /*#__PURE__*/_react.default.createElement("p", {
75
+ className: "font-family-block__count"
76
+ }, (0, _utils.pluralize)(((_node$fontStyles2 = node.fontStyles) === null || _node$fontStyles2 === void 0 ? void 0 : _node$fontStyles2.reduce((total, style) => {
77
+ var _style$variableInstan;
78
+ return total + (((_style$variableInstan = style.variableInstances) === null || _style$variableInstan === void 0 ? void 0 : _style$variableInstan.length) ?? 0);
79
+ }, 0)) ?? 0, 'named instance'))) : null), /*#__PURE__*/_react.default.createElement("div", {
65
80
  className: "font-family-block__lists"
66
81
  }, isSuperFamily ? (_node$families = node.families) === null || _node$families === void 0 ? void 0 : _node$families.map((family, index) => {
67
82
  var _family$featureStyle;
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { SerializablePreloadedQuery } from '../../relay/loadSerializableQuery';
3
- import { NewsletterSignupQuery, NewsletterSignupQuery$data } from '__generated__/NewsletterSignupQuery.graphql';
3
+ import { NewsletterSignupQuery } from '__generated__/NewsletterSignupQuery.graphql';
4
4
  type PreloadedQuery = SerializablePreloadedQuery<NewsletterSignupQuery>;
5
5
  export interface NewsletterSignup_props {
6
6
  optInLabel?: string;
@@ -9,11 +9,9 @@ export interface NewsletterSignup_props {
9
9
  optInCheckboxChecked?: boolean;
10
10
  title?: string;
11
11
  intro?: string;
12
- data: NewsletterSignupQuery$data;
13
- preloadedQuery?: PreloadedQuery;
14
12
  }
15
13
  export declare function NewsletterSignupPreloadedQueryRenderer({ preloadedQuery, }: {
16
14
  preloadedQuery: PreloadedQuery;
17
15
  }): React.JSX.Element;
18
- export default function NewsletterSignup(): React.JSX.Element;
16
+ export default function NewsletterSignup(props: NewsletterSignup_props): React.JSX.Element;
19
17
  export {};
@@ -15,6 +15,7 @@ var _NewsletterSignupUpdateCustomerMutation, _NewsletterSignupQuery;
15
15
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
16
16
  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); }
17
17
  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; }
18
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : 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); }
18
19
  const updateCustomerMutation = _NewsletterSignupUpdateCustomerMutation !== void 0 ? _NewsletterSignupUpdateCustomerMutation : (_NewsletterSignupUpdateCustomerMutation = require("../../__generated__/NewsletterSignupUpdateCustomerMutation.graphql"), _NewsletterSignupUpdateCustomerMutation.hash && _NewsletterSignupUpdateCustomerMutation.hash !== "769087891b6f263122bbb630b3f2ca6c" && console.error("The definition of 'NewsletterSignupUpdateCustomerMutation' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data."), _NewsletterSignupUpdateCustomerMutation);
19
20
  const query = _NewsletterSignupQuery !== void 0 ? _NewsletterSignupQuery : (_NewsletterSignupQuery = require("../../__generated__/NewsletterSignupQuery.graphql"), _NewsletterSignupQuery.hash && _NewsletterSignupQuery.hash !== "16f0b6d7ed420ec5857c972b77805e4c" && console.error("The definition of 'NewsletterSignupQuery' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data."), _NewsletterSignupQuery);
20
21
  function NewsletterSignupComponent(_ref) {
@@ -145,9 +146,9 @@ function NewsletterSignupPreloadedQueryRenderer(_ref3) {
145
146
  data: data
146
147
  });
147
148
  }
148
- function NewsletterSignup() {
149
+ function NewsletterSignup(props) {
149
150
  const data = (0, _reactRelay.useLazyLoadQuery)(query, {});
150
- return /*#__PURE__*/_react.default.createElement(NewsletterSignupComponent, {
151
+ return /*#__PURE__*/_react.default.createElement(NewsletterSignupComponent, _extends({}, props, {
151
152
  data: data
152
- });
153
+ }));
153
154
  }
@@ -12,7 +12,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
12
12
  function _extends() { _extends = Object.assign ? Object.assign.bind() : 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); }
13
13
  async function NewsletterSignup(props) {
14
14
  const preloadedQuery = await (0, _loadSerializableQuery.default)(_NewsletterSignupQuery.default, {});
15
- return /*#__PURE__*/_react.default.createElement(_index.NewsletterSignupPreloadedQueryRenderer, _extends({
15
+ return /*#__PURE__*/_react.default.createElement(_index.NewsletterSignupPreloadedQueryRenderer, _extends({}, props, {
16
16
  preloadedQuery: preloadedQuery
17
- }, props));
17
+ }));
18
18
  }
@@ -43,7 +43,7 @@ const countStylesPrice = _ref2 => {
43
43
  var _sku$product4, _sku$product5;
44
44
  if (((_sku$product4 = sku.product) === null || _sku$product4 === void 0 ? void 0 : _sku$product4.__typename) === 'FontCollection' || ((_sku$product5 = sku.product) === null || _sku$product5 === void 0 ? void 0 : _sku$product5.__typename) === 'Bundle') {
45
45
  var _sku$product6, _sku$product6$totalSt;
46
- return acc + (((_sku$product6 = sku.product) === null || _sku$product6 === void 0 ? void 0 : (_sku$product6$totalSt = _sku$product6.totalStylesPrice) === null || _sku$product6$totalSt === void 0 ? void 0 : _sku$product6$totalSt.amount) ?? 0);
46
+ return acc + (((_sku$product6 = sku.product) === null || _sku$product6 === void 0 ? void 0 : (_sku$product6$totalSt = _sku$product6.totalStylesPrice) === null || _sku$product6$totalSt === void 0 ? void 0 : _sku$product6$totalSt.amount) ?? sku.price.amount);
47
47
  }
48
48
  return acc + sku.price.amount;
49
49
  }, 0);
@@ -241,7 +241,7 @@ function Precart(_ref3) {
241
241
  className: "pre-cart__your-selection__items"
242
242
  }, /*#__PURE__*/_react.default.createElement("div", {
243
243
  className: "pre-cart__your-selection__item"
244
- }, /*#__PURE__*/_react.default.createElement("div", null, collection === null || collection === void 0 ? void 0 : collection.name, /*#__PURE__*/_react.default.createElement("br", null), (0, _utils.pluralize)(countStyles(viewer), 'style')), /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_Price.Price, {
244
+ }, /*#__PURE__*/_react.default.createElement("div", null, collection === null || collection === void 0 ? void 0 : collection.name, /*#__PURE__*/_react.default.createElement("br", null), (0, _utils.pluralize)(countStyles(viewer), 'font')), /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_Price.Price, {
245
245
  price: {
246
246
  amount: countStylesPrice(viewer),
247
247
  currency: subtotal.currency
@@ -46,7 +46,10 @@ function SKUPrice(_ref) {
46
46
  licenseId: spec.licenseId,
47
47
  licenseOptionIds: Object.values(spec.licenseOptions).filter(Boolean)
48
48
  }));
49
- const prevLicenseOptionsSpecs = (0, _react.useRef)(licenseOptionsSpecs);
49
+
50
+ // this must be null to start because we always want to fetch the price for
51
+ // the current license selection on mount
52
+ const prevLicenseOptionsSpecs = (0, _react.useRef)(null);
50
53
  (0, _react.useEffect)(() => {
51
54
  if (!sku) return;
52
55
  if (!(0, _fastDeepEqual.default)(prevLicenseOptionsSpecs.current, licenseOptionsSpecs)) {
@@ -36,7 +36,7 @@ const computeSimilarity = (left, right) => {
36
36
  return weightSimilarity * styleSimilarity * stretchSimilarity;
37
37
  };
38
38
  function TypeTesterStyleSelectData(_ref) {
39
- var _viewer$families, _viewer$families$edge;
39
+ var _viewer$families, _viewer$families$edge, _fontStyle$variableIn;
40
40
  let {
41
41
  fontStyle: fontStyleKey,
42
42
  viewer: viewerKey,
@@ -83,6 +83,7 @@ function TypeTesterStyleSelectData(_ref) {
83
83
  variableSettings
84
84
  });
85
85
  }, [familyData, fontStyle]);
86
+ const instance = variableSettings ? (_fontStyle$variableIn = fontStyle.variableInstances) === null || _fontStyle$variableIn === void 0 ? void 0 : _fontStyle$variableIn.find(instance => (0, _utils.compareVariableSettings)(instance, variableSettings)) : null;
86
87
  return config.selectable && familyData ? /*#__PURE__*/_react.default.createElement(_TypeTesterStyleSelect.default, {
87
88
  families: familyData,
88
89
  selectedFontStyleId: fontStyle.id,
@@ -97,5 +98,5 @@ function TypeTesterStyleSelectData(_ref) {
97
98
  className: "type-tester__name__family"
98
99
  }, fontStyle.family.name), ' ', /*#__PURE__*/_react.default.createElement("span", {
99
100
  className: "type-tester__name__style"
100
- }, fontStyle.name.replace(/ /g, '\xa0')));
101
+ }, variableSettings ? (instance === null || instance === void 0 ? void 0 : instance.name) ?? 'Custom' : fontStyle.name.replace(/ /g, '\xa0')));
101
102
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fontdue-js",
3
- "version": "2.4.0",
3
+ "version": "2.4.1",
4
4
  "scripts": {
5
5
  "build": "npm run relay && run-p build-js build-css build-ts-declarations",
6
6
  "build-js": "babel src --out-dir dist --extensions .ts,.tsx,.js,.jsx",