fontdue-js 3.6.0 → 3.7.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 (71) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/__generated__/FontFamiliesQuery.graphql.d.ts +4 -1
  3. package/dist/__generated__/FontFamiliesQuery.graphql.js +46 -39
  4. package/dist/__generated__/PriceBar_node.graphql.d.ts +4 -1
  5. package/dist/__generated__/PriceBar_node.graphql.js +23 -16
  6. package/dist/__generated__/StoreModalFamily_collection.graphql.d.ts +3 -2
  7. package/dist/__generated__/StoreModalFamily_collection.graphql.js +3 -3
  8. package/dist/__generated__/StoreModalIndexPaginationQuery.graphql.d.ts +23 -0
  9. package/dist/__generated__/StoreModalIndexPaginationQuery.graphql.js +303 -0
  10. package/dist/__generated__/StoreModalIndexQuery.graphql.d.ts +4 -9
  11. package/dist/__generated__/StoreModalIndexQuery.graphql.js +90 -53
  12. package/dist/__generated__/StoreModalIndex_viewer.graphql.d.ts +24 -0
  13. package/dist/__generated__/StoreModalIndex_viewer.graphql.js +134 -0
  14. package/dist/__generated__/StoreModalProductContent_collection.graphql.d.ts +4 -1
  15. package/dist/__generated__/StoreModalProductContent_collection.graphql.js +12 -5
  16. package/dist/__generated__/StoreModalProductLicenseSelection_collection.graphql.d.ts +2 -1
  17. package/dist/__generated__/StoreModalProductLicenseSelection_collection.graphql.js +27 -24
  18. package/dist/__generated__/StoreModalProductQuery.graphql.d.ts +1 -1
  19. package/dist/__generated__/StoreModalProductQuery.graphql.js +78 -77
  20. package/dist/__generated__/StoreModalProductRefetchQuery.graphql.d.ts +1 -1
  21. package/dist/__generated__/StoreModalProductRefetchQuery.graphql.js +54 -53
  22. package/dist/__generated__/StoreModalProductSlugQuery.graphql.d.ts +1 -1
  23. package/dist/__generated__/StoreModalProductSlugQuery.graphql.js +78 -77
  24. package/dist/__generated__/TypeTestersIDQuery.graphql.d.ts +1 -1
  25. package/dist/__generated__/TypeTestersIDQuery.graphql.js +17 -10
  26. package/dist/__generated__/TypeTestersRefetchQuery.graphql.d.ts +1 -1
  27. package/dist/__generated__/TypeTestersRefetchQuery.graphql.js +17 -10
  28. package/dist/__generated__/TypeTestersSlugQuery.graphql.d.ts +1 -1
  29. package/dist/__generated__/TypeTestersSlugQuery.graphql.js +17 -10
  30. package/dist/__generated__/storefrontEventsTrackStorefrontEventMutation.graphql.d.ts +41 -0
  31. package/dist/__generated__/storefrontEventsTrackStorefrontEventMutation.graphql.js +65 -0
  32. package/dist/__tests__/bundleSelectionOrder.test.js +92 -0
  33. package/dist/__tests__/collectionBundleSelection.test.js +441 -1446
  34. package/dist/__tests__/infiniteScroll.test.js +180 -0
  35. package/dist/__tests__/licenseExclusions.test.js +2 -1
  36. package/dist/__tests__/storefrontEvents.test.js +167 -0
  37. package/dist/__tests__/typeTesterAutofitFeatures.test.js +138 -0
  38. package/dist/components/Cart/Checkout.js +11 -1
  39. package/dist/components/Cart/storefrontEvents.d.ts +34 -0
  40. package/dist/components/Cart/storefrontEvents.js +138 -0
  41. package/dist/components/FontFamilies/index.js +4 -3
  42. package/dist/components/Precart/index.js +6 -0
  43. package/dist/components/PriceBar/index.js +5 -3
  44. package/dist/components/Root/productState.d.ts +2 -8
  45. package/dist/components/Root/productState.js +46 -57
  46. package/dist/components/SKUPrice/index.js +7 -8
  47. package/dist/components/StoreModal/StoreModalFamily.js +4 -2
  48. package/dist/components/StoreModal/StoreModalIndex.js +48 -7
  49. package/dist/components/StoreModal/StoreModalProduct.js +16 -9
  50. package/dist/components/StoreModalProductLicenseSelection/StoreModalProductLicense.d.ts +2 -1
  51. package/dist/components/StoreModalProductLicenseSelection/StoreModalProductLicense.js +8 -3
  52. package/dist/components/StoreModalProductLicenseSelection/index.js +3 -2
  53. package/dist/components/TypeTester/useTypeTesterStyler.js +1 -0
  54. package/dist/components/elements/StoreModalContainer/StoreModalContainerContext.d.ts +1 -0
  55. package/dist/components/elements/StoreModalContainer/index.js +9 -4
  56. package/dist/components/elements/StoreModalIndexLoadMore/index.d.ts +8 -0
  57. package/dist/components/elements/StoreModalIndexLoadMore/index.js +21 -0
  58. package/dist/components/elements/StoreModalUnifiedCheckout.js +12 -0
  59. package/dist/components/useInfiniteScroll.d.ts +28 -0
  60. package/dist/components/useInfiniteScroll.js +50 -0
  61. package/dist/fontdue.css +33 -0
  62. package/dist/hooks/useAutofit.d.ts +2 -1
  63. package/dist/hooks/useAutofit.js +10 -4
  64. package/dist/reducer.d.ts +5 -5
  65. package/dist/reducer.js +9 -87
  66. package/dist/selection.d.ts +40 -0
  67. package/dist/selection.js +494 -0
  68. package/dist/utils.d.ts +1 -12
  69. package/dist/utils.js +1 -36
  70. package/dist/version.js +1 -1
  71. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @generated SignedSource<<84ad14b9fc86076734fd76876c2b45f3>>
2
+ * @generated SignedSource<<551f97bb5081048350ef9a1cf9c4dad2>>
3
3
  * @lightSyntaxTransform
4
4
  * @nogrep
5
5
  */
@@ -117,10 +117,17 @@ const node = function () {
117
117
  "alias": null,
118
118
  "args": null,
119
119
  "kind": "ScalarField",
120
- "name": "collectionType",
120
+ "name": "visibility",
121
121
  "storageKey": null
122
122
  },
123
123
  v20 = {
124
+ "alias": null,
125
+ "args": null,
126
+ "kind": "ScalarField",
127
+ "name": "collectionType",
128
+ "storageKey": null
129
+ },
130
+ v21 = {
124
131
  "alias": null,
125
132
  "args": null,
126
133
  "concreteType": "Sku",
@@ -139,14 +146,14 @@ const node = function () {
139
146
  }],
140
147
  "storageKey": null
141
148
  },
142
- v21 = {
149
+ v22 = {
143
150
  "alias": null,
144
151
  "args": null,
145
152
  "kind": "ScalarField",
146
153
  "name": "totalStyles",
147
154
  "storageKey": null
148
155
  },
149
- v22 = {
156
+ v23 = {
150
157
  "alias": null,
151
158
  "args": [v7 /*: any*/],
152
159
  "concreteType": "Money",
@@ -156,14 +163,14 @@ const node = function () {
156
163
  "selections": v17 /*: any*/,
157
164
  "storageKey": null
158
165
  },
159
- v23 = {
166
+ v24 = {
160
167
  "alias": null,
161
168
  "args": null,
162
169
  "concreteType": "FontCollection",
163
170
  "kind": "LinkedField",
164
171
  "name": "parent",
165
172
  "plural": false,
166
- "selections": [v10 /*: any*/, v11 /*: any*/, v19 /*: any*/, v20 /*: any*/, v21 /*: any*/, v22 /*: any*/],
173
+ "selections": [v19 /*: any*/, v10 /*: any*/, v11 /*: any*/, v20 /*: any*/, v21 /*: any*/, v22 /*: any*/, v23 /*: any*/],
167
174
  "storageKey": null
168
175
  };
169
176
  return {
@@ -525,7 +532,7 @@ const node = function () {
525
532
  "kind": "ScalarField",
526
533
  "name": "typeTesterAxes",
527
534
  "storageKey": null
528
- }, v11 /*: any*/, v19 /*: any*/, v20 /*: any*/, v21 /*: any*/, v22 /*: any*/, v23 /*: any*/, {
535
+ }, v19 /*: any*/, v11 /*: any*/, v20 /*: any*/, v21 /*: any*/, v22 /*: any*/, v23 /*: any*/, v24 /*: any*/, {
529
536
  "alias": "families",
530
537
  "args": [{
531
538
  "kind": "Literal",
@@ -536,7 +543,7 @@ const node = function () {
536
543
  "kind": "LinkedField",
537
544
  "name": "children",
538
545
  "plural": true,
539
- "selections": [v10 /*: any*/, v11 /*: any*/, v19 /*: any*/, v20 /*: any*/, v21 /*: any*/, v22 /*: any*/, v23 /*: any*/],
546
+ "selections": [v10 /*: any*/, v19 /*: any*/, v11 /*: any*/, v20 /*: any*/, v21 /*: any*/, v22 /*: any*/, v23 /*: any*/, v24 /*: any*/],
540
547
  "storageKey": "children(collectionTypes:[\"FAMILY\"])"
541
548
  }],
542
549
  "type": "FontCollection",
@@ -546,12 +553,12 @@ const node = function () {
546
553
  }]
547
554
  },
548
555
  "params": {
549
- "cacheID": "975c51be87603cacc9ead6c58ca4944f",
556
+ "cacheID": "22e26258e779ba680a78b474f7514a87",
550
557
  "id": null,
551
558
  "metadata": {},
552
559
  "name": "TypeTestersRefetchQuery",
553
560
  "operationKind": "query",
554
- "text": "query TypeTestersRefetchQuery(\n $excludeTags: [String!] = null\n $licenseOptions: [LicenseOptionsSpec] = []\n $orderVariables: [OrderVariableSelectionInput!] = []\n $tags: [String!] = null\n $id: ID!\n) {\n node(id: $id) {\n __typename\n ...TypeTesters_collection_32it0Z\n id\n }\n}\n\nfragment FontStyle_fontStyle on FontStyle {\n ...useFontStyle_fontStyle\n}\n\nfragment PriceBarSection_node_4sncub on FontCollection {\n id\n name\n collectionType\n sku {\n ...SelectButton_sku_4sncub\n id\n priceWithLicenseOptions: price(licenseOptions: $licenseOptions, orderVariables: $orderVariables) {\n ...Price_price\n }\n }\n totalStyles\n totalStylesPrice(licenseOptions: $licenseOptions) {\n ...Price_price\n }\n}\n\nfragment PriceBar_node_4sncub on FontCollection {\n ...PriceBarSection_node_4sncub\n parent {\n ...PriceBarSection_node_4sncub\n id\n }\n}\n\nfragment Price_price on Money {\n amount\n currency\n}\n\nfragment SKUPrice_sku_4sncub on Sku {\n id\n price(licenseOptions: $licenseOptions, orderVariables: $orderVariables) {\n amount\n ...Price_price\n }\n}\n\nfragment SelectButton_sku_4sncub on Sku {\n id\n ...SKUPrice_sku_4sncub\n}\n\nfragment TypeTesterFeaturesButton_fontStyle on FontStyle {\n ...useFeaturesData_fontStyle\n}\n\nfragment TypeTesterFeatures_fontStyle on FontStyle {\n ...useFeaturesData_fontStyle\n ...TypeTesterVariableAxes_fontStyle\n}\n\nfragment TypeTesterFloatingToolbar_testers on TypeTester {\n id\n fontStyle {\n ...TypeTesterToolbar_fontStyle\n ...TypeTesterFeatures_fontStyle\n id\n }\n}\n\nfragment TypeTesterStyleSelectData_fontStyle on FontStyle {\n id\n name\n supportedLanguages\n cssWeight\n cssStyle\n cssStretch\n variableInstances {\n name\n coordinates {\n axis\n value\n }\n }\n family {\n id\n name\n }\n}\n\nfragment TypeTesterToolbar_fontStyle on FontStyle {\n ...TypeTesterVariableAxes_fontStyle\n ...TypeTesterFeaturesButton_fontStyle\n}\n\nfragment TypeTesterVariableAxes_fontStyle on FontStyle {\n variableAxes {\n axis\n name\n minValue\n maxValue\n }\n}\n\nfragment TypeTester_fontStyle_4sncub on FontStyle {\n id\n ...TypeTesterFeatures_fontStyle\n ...TypeTesterStyleSelectData_fontStyle\n ...FontStyle_fontStyle\n ...TypeTesterVariableAxes_fontStyle\n ...TypeTesterToolbar_fontStyle\n sku {\n ...SelectButton_sku_4sncub\n ...SKUPrice_sku_4sncub\n id\n basePrice: price {\n amount\n }\n }\n}\n\nfragment TypeTesters_collection_32it0Z on FontCollection {\n typeTesters(first: 999, tags: $tags, excludeTags: $excludeTags) {\n edges {\n node {\n id\n content\n size\n lineHeight\n letterSpacing\n autofit\n direction\n alignment\n fontStyle {\n ...TypeTester_fontStyle_4sncub\n id\n family {\n id\n }\n }\n variableSettings {\n axis\n value\n }\n featureSettings {\n feature\n value\n }\n tags\n ...TypeTesterFloatingToolbar_testers\n }\n }\n }\n typeTesterFeatures\n typeTesterAxes\n id\n ...PriceBar_node_4sncub\n families: children(collectionTypes: [FAMILY]) {\n id\n ...PriceBar_node_4sncub\n }\n parent {\n id\n }\n}\n\nfragment useFeaturesData_fontStyle on FontStyle {\n fontFeatures {\n supportedFeatures\n featureNames {\n tag\n name\n }\n }\n}\n\nfragment useFontStyle_fontStyle on FontStyle {\n cssFamily\n name\n webfontSources {\n url\n format\n tech\n }\n verticalMetrics {\n unitsPerEm\n ascender\n descender\n lineGap\n avgCharWidth\n }\n}\n"
561
+ "text": "query TypeTestersRefetchQuery(\n $excludeTags: [String!] = null\n $licenseOptions: [LicenseOptionsSpec] = []\n $orderVariables: [OrderVariableSelectionInput!] = []\n $tags: [String!] = null\n $id: ID!\n) {\n node(id: $id) {\n __typename\n ...TypeTesters_collection_32it0Z\n id\n }\n}\n\nfragment FontStyle_fontStyle on FontStyle {\n ...useFontStyle_fontStyle\n}\n\nfragment PriceBarSection_node_4sncub on FontCollection {\n id\n name\n collectionType\n sku {\n ...SelectButton_sku_4sncub\n id\n priceWithLicenseOptions: price(licenseOptions: $licenseOptions, orderVariables: $orderVariables) {\n ...Price_price\n }\n }\n totalStyles\n totalStylesPrice(licenseOptions: $licenseOptions) {\n ...Price_price\n }\n}\n\nfragment PriceBar_node_4sncub on FontCollection {\n visibility\n ...PriceBarSection_node_4sncub\n parent {\n visibility\n ...PriceBarSection_node_4sncub\n id\n }\n}\n\nfragment Price_price on Money {\n amount\n currency\n}\n\nfragment SKUPrice_sku_4sncub on Sku {\n id\n price(licenseOptions: $licenseOptions, orderVariables: $orderVariables) {\n amount\n ...Price_price\n }\n}\n\nfragment SelectButton_sku_4sncub on Sku {\n id\n ...SKUPrice_sku_4sncub\n}\n\nfragment TypeTesterFeaturesButton_fontStyle on FontStyle {\n ...useFeaturesData_fontStyle\n}\n\nfragment TypeTesterFeatures_fontStyle on FontStyle {\n ...useFeaturesData_fontStyle\n ...TypeTesterVariableAxes_fontStyle\n}\n\nfragment TypeTesterFloatingToolbar_testers on TypeTester {\n id\n fontStyle {\n ...TypeTesterToolbar_fontStyle\n ...TypeTesterFeatures_fontStyle\n id\n }\n}\n\nfragment TypeTesterStyleSelectData_fontStyle on FontStyle {\n id\n name\n supportedLanguages\n cssWeight\n cssStyle\n cssStretch\n variableInstances {\n name\n coordinates {\n axis\n value\n }\n }\n family {\n id\n name\n }\n}\n\nfragment TypeTesterToolbar_fontStyle on FontStyle {\n ...TypeTesterVariableAxes_fontStyle\n ...TypeTesterFeaturesButton_fontStyle\n}\n\nfragment TypeTesterVariableAxes_fontStyle on FontStyle {\n variableAxes {\n axis\n name\n minValue\n maxValue\n }\n}\n\nfragment TypeTester_fontStyle_4sncub on FontStyle {\n id\n ...TypeTesterFeatures_fontStyle\n ...TypeTesterStyleSelectData_fontStyle\n ...FontStyle_fontStyle\n ...TypeTesterVariableAxes_fontStyle\n ...TypeTesterToolbar_fontStyle\n sku {\n ...SelectButton_sku_4sncub\n ...SKUPrice_sku_4sncub\n id\n basePrice: price {\n amount\n }\n }\n}\n\nfragment TypeTesters_collection_32it0Z on FontCollection {\n typeTesters(first: 999, tags: $tags, excludeTags: $excludeTags) {\n edges {\n node {\n id\n content\n size\n lineHeight\n letterSpacing\n autofit\n direction\n alignment\n fontStyle {\n ...TypeTester_fontStyle_4sncub\n id\n family {\n id\n }\n }\n variableSettings {\n axis\n value\n }\n featureSettings {\n feature\n value\n }\n tags\n ...TypeTesterFloatingToolbar_testers\n }\n }\n }\n typeTesterFeatures\n typeTesterAxes\n id\n ...PriceBar_node_4sncub\n families: children(collectionTypes: [FAMILY]) {\n id\n ...PriceBar_node_4sncub\n }\n parent {\n id\n }\n}\n\nfragment useFeaturesData_fontStyle on FontStyle {\n fontFeatures {\n supportedFeatures\n featureNames {\n tag\n name\n }\n }\n}\n\nfragment useFontStyle_fontStyle on FontStyle {\n cssFamily\n name\n webfontSources {\n url\n format\n tech\n }\n verticalMetrics {\n unitsPerEm\n ascender\n descender\n lineGap\n avgCharWidth\n }\n}\n"
555
562
  }
556
563
  };
557
564
  }();
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @generated SignedSource<<79778f811ed6f48a4c87a07cedd6da90>>
2
+ * @generated SignedSource<<74bc65deb2919fbc5b30f5c4cc2d0352>>
3
3
  * @lightSyntaxTransform
4
4
  * @nogrep
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @generated SignedSource<<79778f811ed6f48a4c87a07cedd6da90>>
2
+ * @generated SignedSource<<74bc65deb2919fbc5b30f5c4cc2d0352>>
3
3
  * @lightSyntaxTransform
4
4
  * @nogrep
5
5
  */
@@ -106,10 +106,17 @@ const node = function () {
106
106
  "alias": null,
107
107
  "args": null,
108
108
  "kind": "ScalarField",
109
- "name": "collectionType",
109
+ "name": "visibility",
110
110
  "storageKey": null
111
111
  },
112
112
  v17 = {
113
+ "alias": null,
114
+ "args": null,
115
+ "kind": "ScalarField",
116
+ "name": "collectionType",
117
+ "storageKey": null
118
+ },
119
+ v18 = {
113
120
  "alias": null,
114
121
  "args": null,
115
122
  "concreteType": "Sku",
@@ -128,14 +135,14 @@ const node = function () {
128
135
  }],
129
136
  "storageKey": null
130
137
  },
131
- v18 = {
138
+ v19 = {
132
139
  "alias": null,
133
140
  "args": null,
134
141
  "kind": "ScalarField",
135
142
  "name": "totalStyles",
136
143
  "storageKey": null
137
144
  },
138
- v19 = {
145
+ v20 = {
139
146
  "alias": null,
140
147
  "args": [v11 /*: any*/],
141
148
  "concreteType": "Money",
@@ -145,14 +152,14 @@ const node = function () {
145
152
  "selections": v14 /*: any*/,
146
153
  "storageKey": "totalStylesPrice(licenseOptions:[])"
147
154
  },
148
- v20 = {
155
+ v21 = {
149
156
  "alias": null,
150
157
  "args": null,
151
158
  "concreteType": "FontCollection",
152
159
  "kind": "LinkedField",
153
160
  "name": "parent",
154
161
  "plural": false,
155
- "selections": [v6 /*: any*/, v7 /*: any*/, v16 /*: any*/, v17 /*: any*/, v18 /*: any*/, v19 /*: any*/],
162
+ "selections": [v16 /*: any*/, v6 /*: any*/, v7 /*: any*/, v17 /*: any*/, v18 /*: any*/, v19 /*: any*/, v20 /*: any*/],
156
163
  "storageKey": null
157
164
  };
158
165
  return {
@@ -538,7 +545,7 @@ const node = function () {
538
545
  "kind": "ScalarField",
539
546
  "name": "typeTesterAxes",
540
547
  "storageKey": null
541
- }, v6 /*: any*/, v7 /*: any*/, v16 /*: any*/, v17 /*: any*/, v18 /*: any*/, v19 /*: any*/, v20 /*: any*/, {
548
+ }, v6 /*: any*/, v16 /*: any*/, v7 /*: any*/, v17 /*: any*/, v18 /*: any*/, v19 /*: any*/, v20 /*: any*/, v21 /*: any*/, {
542
549
  "alias": "families",
543
550
  "args": [{
544
551
  "kind": "Literal",
@@ -549,7 +556,7 @@ const node = function () {
549
556
  "kind": "LinkedField",
550
557
  "name": "children",
551
558
  "plural": true,
552
- "selections": [v6 /*: any*/, v7 /*: any*/, v16 /*: any*/, v17 /*: any*/, v18 /*: any*/, v19 /*: any*/, v20 /*: any*/],
559
+ "selections": [v6 /*: any*/, v16 /*: any*/, v7 /*: any*/, v17 /*: any*/, v18 /*: any*/, v19 /*: any*/, v20 /*: any*/, v21 /*: any*/],
553
560
  "storageKey": "children(collectionTypes:[\"FAMILY\"])"
554
561
  }],
555
562
  "storageKey": null
@@ -560,12 +567,12 @@ const node = function () {
560
567
  }]
561
568
  },
562
569
  "params": {
563
- "cacheID": "311b4870ba11a1df38cf98b202138e2f",
570
+ "cacheID": "ecdebd386c7e92ffc4f1be6c9fca2502",
564
571
  "id": null,
565
572
  "metadata": {},
566
573
  "name": "TypeTestersSlugQuery",
567
574
  "operationKind": "query",
568
- "text": "query TypeTestersSlugQuery(\n $collectionSlug: String!\n $tags: [String!]\n $excludeTags: [String!]\n) {\n viewer {\n slug(name: $collectionSlug) {\n collection: fontCollection {\n ...TypeTesters_collection_4Goyz5\n id\n }\n id\n }\n id\n }\n}\n\nfragment FontStyle_fontStyle on FontStyle {\n ...useFontStyle_fontStyle\n}\n\nfragment PriceBarSection_node_3BtHDv on FontCollection {\n id\n name\n collectionType\n sku {\n ...SelectButton_sku_3BtHDv\n id\n priceWithLicenseOptions: price(licenseOptions: [], orderVariables: []) {\n ...Price_price\n }\n }\n totalStyles\n totalStylesPrice(licenseOptions: []) {\n ...Price_price\n }\n}\n\nfragment PriceBar_node_3BtHDv on FontCollection {\n ...PriceBarSection_node_3BtHDv\n parent {\n ...PriceBarSection_node_3BtHDv\n id\n }\n}\n\nfragment Price_price on Money {\n amount\n currency\n}\n\nfragment SKUPrice_sku_3BtHDv on Sku {\n id\n price(licenseOptions: [], orderVariables: []) {\n amount\n ...Price_price\n }\n}\n\nfragment SelectButton_sku_3BtHDv on Sku {\n id\n ...SKUPrice_sku_3BtHDv\n}\n\nfragment TypeTesterFeaturesButton_fontStyle on FontStyle {\n ...useFeaturesData_fontStyle\n}\n\nfragment TypeTesterFeatures_fontStyle on FontStyle {\n ...useFeaturesData_fontStyle\n ...TypeTesterVariableAxes_fontStyle\n}\n\nfragment TypeTesterFloatingToolbar_testers on TypeTester {\n id\n fontStyle {\n ...TypeTesterToolbar_fontStyle\n ...TypeTesterFeatures_fontStyle\n id\n }\n}\n\nfragment TypeTesterStyleSelectData_fontStyle on FontStyle {\n id\n name\n supportedLanguages\n cssWeight\n cssStyle\n cssStretch\n variableInstances {\n name\n coordinates {\n axis\n value\n }\n }\n family {\n id\n name\n }\n}\n\nfragment TypeTesterToolbar_fontStyle on FontStyle {\n ...TypeTesterVariableAxes_fontStyle\n ...TypeTesterFeaturesButton_fontStyle\n}\n\nfragment TypeTesterVariableAxes_fontStyle on FontStyle {\n variableAxes {\n axis\n name\n minValue\n maxValue\n }\n}\n\nfragment TypeTester_fontStyle_3BtHDv on FontStyle {\n id\n ...TypeTesterFeatures_fontStyle\n ...TypeTesterStyleSelectData_fontStyle\n ...FontStyle_fontStyle\n ...TypeTesterVariableAxes_fontStyle\n ...TypeTesterToolbar_fontStyle\n sku {\n ...SelectButton_sku_3BtHDv\n ...SKUPrice_sku_3BtHDv\n id\n basePrice: price {\n amount\n }\n }\n}\n\nfragment TypeTesters_collection_4Goyz5 on FontCollection {\n typeTesters(first: 999, tags: $tags, excludeTags: $excludeTags) {\n edges {\n node {\n id\n content\n size\n lineHeight\n letterSpacing\n autofit\n direction\n alignment\n fontStyle {\n ...TypeTester_fontStyle_3BtHDv\n id\n family {\n id\n }\n }\n variableSettings {\n axis\n value\n }\n featureSettings {\n feature\n value\n }\n tags\n ...TypeTesterFloatingToolbar_testers\n }\n }\n }\n typeTesterFeatures\n typeTesterAxes\n id\n ...PriceBar_node_3BtHDv\n families: children(collectionTypes: [FAMILY]) {\n id\n ...PriceBar_node_3BtHDv\n }\n parent {\n id\n }\n}\n\nfragment useFeaturesData_fontStyle on FontStyle {\n fontFeatures {\n supportedFeatures\n featureNames {\n tag\n name\n }\n }\n}\n\nfragment useFontStyle_fontStyle on FontStyle {\n cssFamily\n name\n webfontSources {\n url\n format\n tech\n }\n verticalMetrics {\n unitsPerEm\n ascender\n descender\n lineGap\n avgCharWidth\n }\n}\n"
575
+ "text": "query TypeTestersSlugQuery(\n $collectionSlug: String!\n $tags: [String!]\n $excludeTags: [String!]\n) {\n viewer {\n slug(name: $collectionSlug) {\n collection: fontCollection {\n ...TypeTesters_collection_4Goyz5\n id\n }\n id\n }\n id\n }\n}\n\nfragment FontStyle_fontStyle on FontStyle {\n ...useFontStyle_fontStyle\n}\n\nfragment PriceBarSection_node_3BtHDv on FontCollection {\n id\n name\n collectionType\n sku {\n ...SelectButton_sku_3BtHDv\n id\n priceWithLicenseOptions: price(licenseOptions: [], orderVariables: []) {\n ...Price_price\n }\n }\n totalStyles\n totalStylesPrice(licenseOptions: []) {\n ...Price_price\n }\n}\n\nfragment PriceBar_node_3BtHDv on FontCollection {\n visibility\n ...PriceBarSection_node_3BtHDv\n parent {\n visibility\n ...PriceBarSection_node_3BtHDv\n id\n }\n}\n\nfragment Price_price on Money {\n amount\n currency\n}\n\nfragment SKUPrice_sku_3BtHDv on Sku {\n id\n price(licenseOptions: [], orderVariables: []) {\n amount\n ...Price_price\n }\n}\n\nfragment SelectButton_sku_3BtHDv on Sku {\n id\n ...SKUPrice_sku_3BtHDv\n}\n\nfragment TypeTesterFeaturesButton_fontStyle on FontStyle {\n ...useFeaturesData_fontStyle\n}\n\nfragment TypeTesterFeatures_fontStyle on FontStyle {\n ...useFeaturesData_fontStyle\n ...TypeTesterVariableAxes_fontStyle\n}\n\nfragment TypeTesterFloatingToolbar_testers on TypeTester {\n id\n fontStyle {\n ...TypeTesterToolbar_fontStyle\n ...TypeTesterFeatures_fontStyle\n id\n }\n}\n\nfragment TypeTesterStyleSelectData_fontStyle on FontStyle {\n id\n name\n supportedLanguages\n cssWeight\n cssStyle\n cssStretch\n variableInstances {\n name\n coordinates {\n axis\n value\n }\n }\n family {\n id\n name\n }\n}\n\nfragment TypeTesterToolbar_fontStyle on FontStyle {\n ...TypeTesterVariableAxes_fontStyle\n ...TypeTesterFeaturesButton_fontStyle\n}\n\nfragment TypeTesterVariableAxes_fontStyle on FontStyle {\n variableAxes {\n axis\n name\n minValue\n maxValue\n }\n}\n\nfragment TypeTester_fontStyle_3BtHDv on FontStyle {\n id\n ...TypeTesterFeatures_fontStyle\n ...TypeTesterStyleSelectData_fontStyle\n ...FontStyle_fontStyle\n ...TypeTesterVariableAxes_fontStyle\n ...TypeTesterToolbar_fontStyle\n sku {\n ...SelectButton_sku_3BtHDv\n ...SKUPrice_sku_3BtHDv\n id\n basePrice: price {\n amount\n }\n }\n}\n\nfragment TypeTesters_collection_4Goyz5 on FontCollection {\n typeTesters(first: 999, tags: $tags, excludeTags: $excludeTags) {\n edges {\n node {\n id\n content\n size\n lineHeight\n letterSpacing\n autofit\n direction\n alignment\n fontStyle {\n ...TypeTester_fontStyle_3BtHDv\n id\n family {\n id\n }\n }\n variableSettings {\n axis\n value\n }\n featureSettings {\n feature\n value\n }\n tags\n ...TypeTesterFloatingToolbar_testers\n }\n }\n }\n typeTesterFeatures\n typeTesterAxes\n id\n ...PriceBar_node_3BtHDv\n families: children(collectionTypes: [FAMILY]) {\n id\n ...PriceBar_node_3BtHDv\n }\n parent {\n id\n }\n}\n\nfragment useFeaturesData_fontStyle on FontStyle {\n fontFeatures {\n supportedFeatures\n featureNames {\n tag\n name\n }\n }\n}\n\nfragment useFontStyle_fontStyle on FontStyle {\n cssFamily\n name\n webfontSources {\n url\n format\n tech\n }\n verticalMetrics {\n unitsPerEm\n ascender\n descender\n lineGap\n avgCharWidth\n }\n}\n"
569
576
  }
570
577
  };
571
578
  }();
@@ -0,0 +1,41 @@
1
+ /**
2
+ * @generated SignedSource<<9ae3ba7e6860093c0576aa023d6951d2>>
3
+ * @lightSyntaxTransform
4
+ * @nogrep
5
+ */
6
+ import { ConcreteRequest } from 'relay-runtime';
7
+ export type StorefrontEvent = "PAYMENT_INFO_ENTERED" | "PRODUCT_CUSTOMIZED" | "PRODUCT_VIEWED" | "%future added value";
8
+ export type TrackStorefrontEventInput = {
9
+ collectionId?: string | null;
10
+ event: StorefrontEvent;
11
+ licenseSelections?: ReadonlyArray<LicenseSelectionInput> | null;
12
+ tracking?: OrderTrackingInput | null;
13
+ };
14
+ export type LicenseSelectionInput = {
15
+ id?: string | null;
16
+ licenseId: string;
17
+ licenseOptionId?: string | null;
18
+ licenseVariableId?: string | null;
19
+ variableText?: string | null;
20
+ };
21
+ export type OrderTrackingInput = {
22
+ analyticsConsent?: boolean | null;
23
+ anonymousId?: string | null;
24
+ fbc?: string | null;
25
+ fbp?: string | null;
26
+ url?: string | null;
27
+ };
28
+ export type storefrontEventsTrackStorefrontEventMutation$variables = {
29
+ input: TrackStorefrontEventInput;
30
+ };
31
+ export type storefrontEventsTrackStorefrontEventMutation$data = {
32
+ readonly trackStorefrontEvent: {
33
+ readonly success: boolean;
34
+ } | null;
35
+ };
36
+ export type storefrontEventsTrackStorefrontEventMutation = {
37
+ response: storefrontEventsTrackStorefrontEventMutation$data;
38
+ variables: storefrontEventsTrackStorefrontEventMutation$variables;
39
+ };
40
+ declare const node: ConcreteRequest;
41
+ export default node;
@@ -0,0 +1,65 @@
1
+ /**
2
+ * @generated SignedSource<<9ae3ba7e6860093c0576aa023d6951d2>>
3
+ * @lightSyntaxTransform
4
+ * @nogrep
5
+ */
6
+
7
+ /* tslint:disable */
8
+ /* eslint-disable */
9
+ // @ts-nocheck
10
+
11
+ const node = function () {
12
+ var v0 = [{
13
+ "defaultValue": null,
14
+ "kind": "LocalArgument",
15
+ "name": "input"
16
+ }],
17
+ v1 = [{
18
+ "alias": null,
19
+ "args": [{
20
+ "kind": "Variable",
21
+ "name": "input",
22
+ "variableName": "input"
23
+ }],
24
+ "concreteType": "TrackStorefrontEventPayload",
25
+ "kind": "LinkedField",
26
+ "name": "trackStorefrontEvent",
27
+ "plural": false,
28
+ "selections": [{
29
+ "alias": null,
30
+ "args": null,
31
+ "kind": "ScalarField",
32
+ "name": "success",
33
+ "storageKey": null
34
+ }],
35
+ "storageKey": null
36
+ }];
37
+ return {
38
+ "fragment": {
39
+ "argumentDefinitions": v0 /*: any*/,
40
+ "kind": "Fragment",
41
+ "metadata": null,
42
+ "name": "storefrontEventsTrackStorefrontEventMutation",
43
+ "selections": v1 /*: any*/,
44
+ "type": "RootMutationType",
45
+ "abstractKey": null
46
+ },
47
+ "kind": "Request",
48
+ "operation": {
49
+ "argumentDefinitions": v0 /*: any*/,
50
+ "kind": "Operation",
51
+ "name": "storefrontEventsTrackStorefrontEventMutation",
52
+ "selections": v1 /*: any*/
53
+ },
54
+ "params": {
55
+ "cacheID": "12055553008f9ecb33d23e0a70e7760b",
56
+ "id": null,
57
+ "metadata": {},
58
+ "name": "storefrontEventsTrackStorefrontEventMutation",
59
+ "operationKind": "mutation",
60
+ "text": "mutation storefrontEventsTrackStorefrontEventMutation(\n $input: TrackStorefrontEventInput!\n) {\n trackStorefrontEvent(input: $input) {\n success\n }\n}\n"
61
+ }
62
+ };
63
+ }();
64
+ node.hash = "340cc13477a15b926e2307d36c644053";
65
+ export default node;
@@ -0,0 +1,92 @@
1
+ import { describe, it, expect, vi } from 'vitest';
2
+
3
+ // Mock react-relay's graphql tag since productState.ts uses it at import time
4
+ vi.mock('react-relay', () => ({
5
+ graphql: () => null,
6
+ fetchQuery: vi.fn()
7
+ }));
8
+ import reducer from '../reducer.js';
9
+ // A family shaped like a real foundry catalog: 7 uprights + 7 italics at
10
+ // 9000 each, with overlapping style bundles – every pair of uprights (15%
11
+ // off), each upright with its italic (20% off), a handful of upright
12
+ // triples (25% off), and the upright / italic halves.
13
+ const UPRIGHTS = ['Thin', 'Light', 'Book', 'Regular', 'Medium', 'Semibold', 'Bold'];
14
+ const ITALICS = UPRIGHTS.map(name => name === 'Regular' ? 'Italic' : `${name} Italic`);
15
+ const STYLE_PRICE = 9000;
16
+ const pairs = items => items.flatMap((a, i) => items.slice(i + 1).map(b => [a, b]));
17
+ const BUNDLES = [[UPRIGHTS, 45000], [ITALICS, 45000], ...UPRIGHTS.map((name, i) => [[name, ITALICS[i]], 14400]), ...pairs(UPRIGHTS).map(styles => [styles, 15300]), ...[['Light', 'Regular', 'Bold'], ['Book', 'Regular', 'Bold'], ['Light', 'Semibold', 'Italic'], ['Book', 'Semibold', 'Italic'], ['Regular', 'Bold', 'Italic'], ['Thin', 'Regular', 'Bold'], ['Light', 'Book', 'Semibold'], ['Book', 'Semibold', 'Bold']].map(styles => [styles, 20250])];
18
+ const sku = (id, amount) => ({
19
+ id,
20
+ price: {
21
+ amount
22
+ }
23
+ });
24
+ const styleSku = name => `sku:${name}`;
25
+ const style = name => ({
26
+ id: `style:${name}`,
27
+ sku: sku(styleSku(name), STYLE_PRICE)
28
+ });
29
+ const catalog = {
30
+ node: {
31
+ __typename: 'FontCollection',
32
+ id: 'family',
33
+ name: 'Family',
34
+ sku: sku('sku:family', 90000),
35
+ fontStyles: [...UPRIGHTS, ...ITALICS].map(style),
36
+ bundles: BUNDLES.map(_ref => {
37
+ let [styles, price] = _ref;
38
+ return {
39
+ id: `bundle:${styles.join('+')}`,
40
+ name: styles.join(' + '),
41
+ sku: sku(`sku:bundle:${styles.join('+')}`, price),
42
+ fontStyles: styles.map(style)
43
+ };
44
+ }),
45
+ collectionBundles: [],
46
+ children: []
47
+ }
48
+ };
49
+ function loadedState() {
50
+ const empty = {
51
+ cartOpen: false,
52
+ precartOpen: false,
53
+ selectedSkuIds: {},
54
+ requestedSkuIds: [],
55
+ licenseOptions: [],
56
+ skuStyleIds: {},
57
+ collectionSkus: {},
58
+ skuPrices: {},
59
+ fetchedCollectionIds: [],
60
+ storeModalRoute: {
61
+ name: 'index'
62
+ },
63
+ storeModalHistory: [],
64
+ orderVariableSelections: [],
65
+ licenseeIsBillingIdentity: null
66
+ };
67
+ return reducer(empty, {
68
+ type: 'POPULATE_PRODUCT_STATE',
69
+ data: catalog
70
+ });
71
+ }
72
+ const clickStyles = names => names.reduce((state, name) => reducer(state, {
73
+ type: 'SELECT_SKU_ID',
74
+ skuId: styleSku(name),
75
+ selected: true
76
+ }), loadedState());
77
+ const selectionTotal = state => Object.keys(state.selectedSkuIds).filter(id => state.selectedSkuIds[id] === true).reduce((sum, id) => sum + state.skuPrices[id], 0);
78
+ const permutations = items => items.length <= 1 ? [items] : items.flatMap((item, i) => permutations([...items.slice(0, i), ...items.slice(i + 1)]).map(rest => [item, ...rest]));
79
+ describe('style bundle discounts do not depend on click order', () => {
80
+ it.each(permutations(['Bold', 'Regular', 'Light']))('Light + Regular + Bold bundle price when clicked %s, %s, %s', function () {
81
+ for (var _len = arguments.length, order = new Array(_len), _key = 0; _key < _len; _key++) {
82
+ order[_key] = arguments[_key];
83
+ }
84
+ expect(selectionTotal(clickStyles(order))).toBe(20250);
85
+ });
86
+ it.each(permutations(['Bold', 'Bold Italic', 'Regular', 'Italic']))('two upright + italic pairs when clicked %s, %s, %s, %s', function () {
87
+ for (var _len2 = arguments.length, order = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
88
+ order[_key2] = arguments[_key2];
89
+ }
90
+ expect(selectionTotal(clickStyles(order))).toBe(28800);
91
+ });
92
+ });