fontdue-js 3.6.0 → 3.8.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 (167) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/README.md +5 -4
  3. package/dist/__generated__/AddToCartBannerQuery.graphql.d.ts +1 -1
  4. package/dist/__generated__/AddToCartBannerQuery.graphql.js +16 -10
  5. package/dist/__generated__/AddToCartBanner_item.graphql.d.ts +4 -1
  6. package/dist/__generated__/AddToCartBanner_item.graphql.js +7 -2
  7. package/dist/__generated__/AddToCartBanner_order.graphql.d.ts +4 -1
  8. package/dist/__generated__/AddToCartBanner_order.graphql.js +6 -1
  9. package/dist/__generated__/BuyButtonIDQuery.graphql.d.ts +3 -3
  10. package/dist/__generated__/BuyButtonIDQuery.graphql.js +31 -16
  11. package/dist/__generated__/BuyButtonPackIDQuery.graphql.d.ts +21 -0
  12. package/dist/__generated__/BuyButtonPackIDQuery.graphql.js +129 -0
  13. package/dist/__generated__/BuyButtonPackSlugQuery.graphql.d.ts +25 -0
  14. package/dist/__generated__/BuyButtonPackSlugQuery.graphql.js +167 -0
  15. package/dist/__generated__/BuyButtonSlugQuery.graphql.d.ts +3 -3
  16. package/dist/__generated__/BuyButtonSlugQuery.graphql.js +45 -17
  17. package/dist/__generated__/BuyButton_product.graphql.d.ts +27 -0
  18. package/dist/__generated__/BuyButton_product.graphql.js +72 -0
  19. package/dist/__generated__/CartItemProduct_product.graphql.d.ts +1 -1
  20. package/dist/__generated__/CartItemProduct_product.graphql.js +7 -2
  21. package/dist/__generated__/CartOrderCompleteOrderMutation.graphql.d.ts +1 -1
  22. package/dist/__generated__/CartOrderCompleteOrderMutation.graphql.js +26 -20
  23. package/dist/__generated__/CartOrderRemoveDiscountMutation.graphql.d.ts +1 -1
  24. package/dist/__generated__/CartOrderRemoveDiscountMutation.graphql.js +26 -20
  25. package/dist/__generated__/CartOrderUpdateMutation.graphql.d.ts +1 -1
  26. package/dist/__generated__/CartOrderUpdateMutation.graphql.js +26 -20
  27. package/dist/__generated__/CartQuery.graphql.d.ts +1 -1
  28. package/dist/__generated__/CartQuery.graphql.js +26 -20
  29. package/dist/__generated__/CartStateUpdateMutation.graphql.d.ts +1 -1
  30. package/dist/__generated__/CartStateUpdateMutation.graphql.js +26 -20
  31. package/dist/__generated__/CheckoutUpdateCustomerMutation.graphql.d.ts +1 -1
  32. package/dist/__generated__/CheckoutUpdateCustomerMutation.graphql.js +26 -20
  33. package/dist/__generated__/CheckoutUpdateOrderMutation.graphql.d.ts +1 -1
  34. package/dist/__generated__/CheckoutUpdateOrderMutation.graphql.js +26 -20
  35. package/dist/__generated__/CollectionAa_Query.graphql.d.ts +1 -1
  36. package/dist/__generated__/CollectionAa_Query.graphql.js +20 -14
  37. package/dist/__generated__/CollectionAa_product.graphql.d.ts +7 -1
  38. package/dist/__generated__/CollectionAa_product.graphql.js +22 -16
  39. package/dist/__generated__/FontFamiliesQuery.graphql.d.ts +4 -1
  40. package/dist/__generated__/FontFamiliesQuery.graphql.js +46 -39
  41. package/dist/__generated__/NodePasswordFormElementIDQuery.graphql.d.ts +3 -3
  42. package/dist/__generated__/NodePasswordFormElementIDQuery.graphql.js +9 -9
  43. package/dist/__generated__/NodePasswordFormElementPackSlugQuery.graphql.d.ts +25 -0
  44. package/dist/__generated__/NodePasswordFormElementPackSlugQuery.graphql.js +108 -0
  45. package/dist/__generated__/PrecartAddToCartMutation.graphql.d.ts +1 -1
  46. package/dist/__generated__/PrecartAddToCartMutation.graphql.js +32 -26
  47. package/dist/__generated__/PriceBar_node.graphql.d.ts +4 -1
  48. package/dist/__generated__/PriceBar_node.graphql.js +23 -16
  49. package/dist/__generated__/StoreModalCartQuery.graphql.d.ts +1 -1
  50. package/dist/__generated__/StoreModalCartQuery.graphql.js +37 -31
  51. package/dist/__generated__/StoreModalFamily_collection.graphql.d.ts +3 -2
  52. package/dist/__generated__/StoreModalFamily_collection.graphql.js +3 -3
  53. package/dist/__generated__/StoreModalIndexPackItem_fontPack.graphql.d.ts +23 -0
  54. package/dist/__generated__/StoreModalIndexPackItem_fontPack.graphql.js +58 -0
  55. package/dist/__generated__/StoreModalIndexPaginationQuery.graphql.d.ts +23 -0
  56. package/dist/__generated__/StoreModalIndexPaginationQuery.graphql.js +303 -0
  57. package/dist/__generated__/StoreModalIndexQuery.graphql.d.ts +6 -3
  58. package/dist/__generated__/StoreModalIndexQuery.graphql.js +218 -117
  59. package/dist/__generated__/StoreModalIndex_viewer.graphql.d.ts +24 -0
  60. package/dist/__generated__/StoreModalIndex_viewer.graphql.js +134 -0
  61. package/dist/__generated__/StoreModalPackButton_fontPack.graphql.d.ts +33 -0
  62. package/dist/__generated__/StoreModalPackButton_fontPack.graphql.js +119 -0
  63. package/dist/__generated__/StoreModalPack_fontPack.graphql.d.ts +45 -0
  64. package/dist/__generated__/StoreModalPack_fontPack.graphql.js +150 -0
  65. package/dist/__generated__/StoreModalProductContent_collection.graphql.d.ts +6 -2
  66. package/dist/__generated__/StoreModalProductContent_collection.graphql.js +43 -19
  67. package/dist/__generated__/{StoreModalProductLicenseSelection_collection.graphql.d.ts → StoreModalProductLicenseSelection_licenseable.graphql.d.ts} +7 -6
  68. package/dist/__generated__/StoreModalProductLicenseSelection_licenseable.graphql.js +43 -0
  69. package/dist/__generated__/StoreModalProductQuery.graphql.d.ts +1 -1
  70. package/dist/__generated__/StoreModalProductQuery.graphql.js +199 -142
  71. package/dist/__generated__/StoreModalProductRefetchQuery.graphql.d.ts +1 -1
  72. package/dist/__generated__/StoreModalProductRefetchQuery.graphql.js +190 -133
  73. package/dist/__generated__/StoreModalProductSlugQuery.graphql.d.ts +5 -1
  74. package/dist/__generated__/StoreModalProductSlugQuery.graphql.js +254 -176
  75. package/dist/__generated__/StoreModalProductSummaryRefetchQuery.graphql.d.ts +1 -1
  76. package/dist/__generated__/StoreModalProductSummaryRefetchQuery.graphql.js +9 -4
  77. package/dist/__generated__/StoreModalProductSummary_viewer.graphql.d.ts +7 -1
  78. package/dist/__generated__/StoreModalProductSummary_viewer.graphql.js +7 -2
  79. package/dist/__generated__/TestFontsFormUpdateCustomerMutation.graphql.d.ts +1 -1
  80. package/dist/__generated__/TestFontsFormUpdateCustomerMutation.graphql.js +26 -20
  81. package/dist/__generated__/TypeTestersIDQuery.graphql.d.ts +1 -1
  82. package/dist/__generated__/TypeTestersIDQuery.graphql.js +17 -10
  83. package/dist/__generated__/TypeTestersRefetchQuery.graphql.d.ts +1 -1
  84. package/dist/__generated__/TypeTestersRefetchQuery.graphql.js +17 -10
  85. package/dist/__generated__/TypeTestersSlugQuery.graphql.d.ts +1 -1
  86. package/dist/__generated__/TypeTestersSlugQuery.graphql.js +17 -10
  87. package/dist/__generated__/productState_Query.graphql.d.ts +99 -1
  88. package/dist/__generated__/productState_Query.graphql.js +43 -4
  89. package/dist/__generated__/productState_fontPack.graphql.d.ts +111 -0
  90. package/dist/__generated__/productState_fontPack.graphql.js +117 -0
  91. package/dist/__generated__/storefrontEventsTrackStorefrontEventMutation.graphql.d.ts +41 -0
  92. package/dist/__generated__/storefrontEventsTrackStorefrontEventMutation.graphql.js +65 -0
  93. package/dist/__tests__/bundleSelectionOrder.test.js +94 -0
  94. package/dist/__tests__/collectionBundleSelection.test.js +443 -1446
  95. package/dist/__tests__/fontPackSelection.test.js +435 -0
  96. package/dist/__tests__/infiniteScroll.test.js +180 -0
  97. package/dist/__tests__/licenseExclusions.test.js +4 -1
  98. package/dist/__tests__/storeModalPackButton.test.js +102 -0
  99. package/dist/__tests__/storeModalPackUnlisted.test.js +112 -0
  100. package/dist/__tests__/storeModalRoutes.test.js +9 -0
  101. package/dist/__tests__/storefrontEvents.test.js +167 -0
  102. package/dist/__tests__/typeTesterAutofitFeatures.test.js +138 -0
  103. package/dist/components/AddToCartBanner/index.js +1 -1
  104. package/dist/components/BuyButton/index.d.ts +29 -9
  105. package/dist/components/BuyButton/index.js +123 -26
  106. package/dist/components/BuyButton/index.server.d.ts +4 -2
  107. package/dist/components/BuyButton/index.server.js +24 -3
  108. package/dist/components/Cart/CartItem/CartItemProduct.js +3 -3
  109. package/dist/components/Cart/Checkout.js +11 -1
  110. package/dist/components/Cart/storefrontEvents.d.ts +34 -0
  111. package/dist/components/Cart/storefrontEvents.js +138 -0
  112. package/dist/components/CollectionAa/index.js +2 -2
  113. package/dist/components/FontFamilies/index.js +4 -3
  114. package/dist/components/NodePasswordForm/NodePasswordFormElement.d.ts +1 -1
  115. package/dist/components/NodePasswordForm/NodePasswordFormElement.js +45 -21
  116. package/dist/components/NodePasswordForm/index.d.ts +7 -4
  117. package/dist/components/NodePasswordForm/index.js +6 -6
  118. package/dist/components/Precart/index.js +6 -0
  119. package/dist/components/PriceBar/index.js +5 -3
  120. package/dist/components/Root/productState.d.ts +2 -8
  121. package/dist/components/Root/productState.js +100 -61
  122. package/dist/components/SKUPrice/index.js +7 -8
  123. package/dist/components/StoreModal/StoreModalFamily.d.ts +7 -0
  124. package/dist/components/StoreModal/StoreModalFamily.js +11 -7
  125. package/dist/components/StoreModal/StoreModalIndex.js +58 -7
  126. package/dist/components/StoreModal/StoreModalIndexEntry.d.ts +13 -0
  127. package/dist/components/StoreModal/StoreModalIndexEntry.js +43 -0
  128. package/dist/components/StoreModal/StoreModalIndexItem.js +7 -30
  129. package/dist/components/StoreModal/StoreModalIndexPackItem.d.ts +7 -0
  130. package/dist/components/StoreModal/StoreModalIndexPackItem.js +21 -0
  131. package/dist/components/StoreModal/StoreModalPack.d.ts +9 -0
  132. package/dist/components/StoreModal/StoreModalPack.js +79 -0
  133. package/dist/components/StoreModal/StoreModalPackButton.d.ts +8 -0
  134. package/dist/components/StoreModal/StoreModalPackButton.js +53 -0
  135. package/dist/components/StoreModal/StoreModalProduct.js +49 -19
  136. package/dist/components/StoreModalProductLicenseSelection/StoreModalProductLicense.d.ts +2 -1
  137. package/dist/components/StoreModalProductLicenseSelection/StoreModalProductLicense.js +8 -3
  138. package/dist/components/StoreModalProductLicenseSelection/index.d.ts +3 -3
  139. package/dist/components/StoreModalProductLicenseSelection/index.js +7 -6
  140. package/dist/components/StoreModalProductSummary/index.js +1 -1
  141. package/dist/components/TypeTester/useTypeTesterStyler.js +1 -0
  142. package/dist/components/elements/StoreModalContainer/StoreModalContainerContext.d.ts +1 -0
  143. package/dist/components/elements/StoreModalContainer/index.js +9 -4
  144. package/dist/components/elements/StoreModalFamily/index.d.ts +1 -1
  145. package/dist/components/elements/StoreModalFamily/index.js +1 -1
  146. package/dist/components/elements/StoreModalIndexLoadMore/index.d.ts +8 -0
  147. package/dist/components/elements/StoreModalIndexLoadMore/index.js +21 -0
  148. package/dist/components/elements/StoreModalUnifiedCheckout.js +12 -0
  149. package/dist/components/useInfiniteScroll.d.ts +28 -0
  150. package/dist/components/useInfiniteScroll.js +50 -0
  151. package/dist/fontdue.css +39 -0
  152. package/dist/hooks/useAutofit.d.ts +2 -1
  153. package/dist/hooks/useAutofit.js +10 -4
  154. package/dist/reducer.d.ts +12 -5
  155. package/dist/reducer.js +18 -87
  156. package/dist/selection.d.ts +44 -0
  157. package/dist/selection.js +539 -0
  158. package/dist/storeModalRoutes.js +5 -4
  159. package/dist/utils.d.ts +1 -12
  160. package/dist/utils.js +1 -36
  161. package/dist/version.js +1 -1
  162. package/package.json +1 -1
  163. package/dist/__generated__/BuyButton_collection.graphql.d.ts +0 -25
  164. package/dist/__generated__/BuyButton_collection.graphql.js +0 -49
  165. package/dist/__generated__/StoreModalProductLicenseSelection_collection.graphql.js +0 -40
  166. package/fontdue.css +0 -2733
  167. package/fontdue.css.map +0 -1
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @generated SignedSource<<b4e88c2638ba792951d57f4750391bdc>>
2
+ * @generated SignedSource<<925530e7d4ec77a773367f26953fcb94>>
3
3
  * @lightSyntaxTransform
4
4
  * @nogrep
5
5
  */
@@ -112,6 +112,104 @@ export type productState_Query$data = {
112
112
  readonly amount: number;
113
113
  };
114
114
  } | null;
115
+ } | {
116
+ readonly __typename: "FontPack";
117
+ readonly fontStyles: ReadonlyArray<{
118
+ readonly id: string;
119
+ readonly sku: {
120
+ readonly id: string;
121
+ readonly price: {
122
+ readonly amount: number;
123
+ };
124
+ } | null;
125
+ }>;
126
+ readonly id: string;
127
+ readonly members: ReadonlyArray<{
128
+ readonly __typename: "FontCollection";
129
+ readonly bundles: ReadonlyArray<{
130
+ readonly fontStyles: ReadonlyArray<{
131
+ readonly id: string;
132
+ readonly sku: {
133
+ readonly id: string;
134
+ readonly price: {
135
+ readonly amount: number;
136
+ };
137
+ } | null;
138
+ }> | null;
139
+ readonly id: string;
140
+ readonly name: string;
141
+ readonly sku: {
142
+ readonly id: string;
143
+ readonly price: {
144
+ readonly amount: number;
145
+ };
146
+ } | null;
147
+ }> | null;
148
+ readonly children: ReadonlyArray<{
149
+ readonly bundles: ReadonlyArray<{
150
+ readonly fontStyles: ReadonlyArray<{
151
+ readonly id: string;
152
+ readonly sku: {
153
+ readonly id: string;
154
+ readonly price: {
155
+ readonly amount: number;
156
+ };
157
+ } | null;
158
+ }> | null;
159
+ readonly id: string;
160
+ readonly name: string;
161
+ readonly sku: {
162
+ readonly id: string;
163
+ readonly price: {
164
+ readonly amount: number;
165
+ };
166
+ } | null;
167
+ }> | null;
168
+ readonly fontStyles: ReadonlyArray<{
169
+ readonly id: string;
170
+ readonly sku: {
171
+ readonly id: string;
172
+ readonly price: {
173
+ readonly amount: number;
174
+ };
175
+ } | null;
176
+ }>;
177
+ readonly id: string;
178
+ readonly name: string;
179
+ readonly sku: {
180
+ readonly id: string;
181
+ readonly price: {
182
+ readonly amount: number;
183
+ };
184
+ } | null;
185
+ }> | null;
186
+ readonly fontStyles: ReadonlyArray<{
187
+ readonly id: string;
188
+ readonly sku: {
189
+ readonly id: string;
190
+ readonly price: {
191
+ readonly amount: number;
192
+ };
193
+ } | null;
194
+ }>;
195
+ readonly id: string;
196
+ readonly name: string;
197
+ readonly sku: {
198
+ readonly id: string;
199
+ readonly price: {
200
+ readonly amount: number;
201
+ };
202
+ } | null;
203
+ } | {
204
+ readonly __typename: "%other";
205
+ }>;
206
+ readonly name: string;
207
+ readonly sku: {
208
+ readonly id: string;
209
+ readonly price: {
210
+ readonly amount: number;
211
+ };
212
+ } | null;
115
213
  } | {
116
214
  readonly __typename: "%other";
117
215
  } | null;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @generated SignedSource<<b4e88c2638ba792951d57f4750391bdc>>
2
+ * @generated SignedSource<<925530e7d4ec77a773367f26953fcb94>>
3
3
  * @lightSyntaxTransform
4
4
  * @nogrep
5
5
  */
@@ -117,6 +117,12 @@ const node = function () {
117
117
  "plural": true,
118
118
  "selections": [v3 /*: any*/, v4 /*: any*/, v5 /*: any*/, v6 /*: any*/, v7 /*: any*/],
119
119
  "storageKey": "children(collectionTypes:[\"FAMILY\"])"
120
+ },
121
+ v10 = {
122
+ "kind": "InlineFragment",
123
+ "selections": [v3 /*: any*/, v4 /*: any*/, v5 /*: any*/, v6 /*: any*/, v7 /*: any*/, v9 /*: any*/],
124
+ "type": "FontCollection",
125
+ "abstractKey": null
120
126
  };
121
127
  return {
122
128
  "fragment": {
@@ -136,6 +142,20 @@ const node = function () {
136
142
  "selections": [v2 /*: any*/, v3 /*: any*/, v4 /*: any*/, v5 /*: any*/, v6 /*: any*/, v7 /*: any*/, v8 /*: any*/, v9 /*: any*/],
137
143
  "type": "FontCollection",
138
144
  "abstractKey": null
145
+ }, {
146
+ "kind": "InlineFragment",
147
+ "selections": [v2 /*: any*/, v3 /*: any*/, v4 /*: any*/, v5 /*: any*/, v6 /*: any*/, {
148
+ "alias": null,
149
+ "args": null,
150
+ "concreteType": null,
151
+ "kind": "LinkedField",
152
+ "name": "members",
153
+ "plural": true,
154
+ "selections": [v2 /*: any*/, v10 /*: any*/],
155
+ "storageKey": null
156
+ }],
157
+ "type": "FontPack",
158
+ "abstractKey": null
139
159
  }],
140
160
  "storageKey": null
141
161
  }],
@@ -159,19 +179,38 @@ const node = function () {
159
179
  "selections": [v4 /*: any*/, v5 /*: any*/, v6 /*: any*/, v7 /*: any*/, v8 /*: any*/, v9 /*: any*/],
160
180
  "type": "FontCollection",
161
181
  "abstractKey": null
182
+ }, {
183
+ "kind": "InlineFragment",
184
+ "selections": [v4 /*: any*/, v5 /*: any*/, v6 /*: any*/, {
185
+ "alias": null,
186
+ "args": null,
187
+ "concreteType": null,
188
+ "kind": "LinkedField",
189
+ "name": "members",
190
+ "plural": true,
191
+ "selections": [v2 /*: any*/, v10 /*: any*/, {
192
+ "kind": "InlineFragment",
193
+ "selections": [v3 /*: any*/],
194
+ "type": "Node",
195
+ "abstractKey": "__isNode"
196
+ }],
197
+ "storageKey": null
198
+ }],
199
+ "type": "FontPack",
200
+ "abstractKey": null
162
201
  }],
163
202
  "storageKey": null
164
203
  }]
165
204
  },
166
205
  "params": {
167
- "cacheID": "46b69511613049f8b0186da9dd74c579",
206
+ "cacheID": "47288a3b11085a6e8771d765f203f545",
168
207
  "id": null,
169
208
  "metadata": {},
170
209
  "name": "productState_Query",
171
210
  "operationKind": "query",
172
- "text": "query productState_Query(\n $id: ID!\n) {\n node(id: $id) {\n __typename\n ... on FontCollection {\n __typename\n id\n name\n sku {\n id\n price {\n amount\n }\n }\n fontStyles {\n id\n sku {\n id\n price {\n amount\n }\n }\n }\n bundles {\n id\n name\n sku {\n id\n price {\n amount\n }\n }\n fontStyles {\n id\n sku {\n id\n price {\n amount\n }\n }\n }\n }\n collectionBundles {\n id\n name\n sku {\n id\n price {\n amount\n }\n }\n memberCollections {\n id\n sku {\n id\n price {\n amount\n }\n }\n fontStyles {\n id\n sku {\n id\n price {\n amount\n }\n }\n }\n }\n }\n children(collectionTypes: [FAMILY]) {\n id\n name\n sku {\n id\n price {\n amount\n }\n }\n fontStyles {\n id\n sku {\n id\n price {\n amount\n }\n }\n }\n bundles {\n id\n name\n sku {\n id\n price {\n amount\n }\n }\n fontStyles {\n id\n sku {\n id\n price {\n amount\n }\n }\n }\n }\n }\n }\n id\n }\n}\n"
211
+ "text": "query productState_Query(\n $id: ID!\n) {\n node(id: $id) {\n __typename\n ... on FontCollection {\n __typename\n id\n name\n sku {\n id\n price {\n amount\n }\n }\n fontStyles {\n id\n sku {\n id\n price {\n amount\n }\n }\n }\n bundles {\n id\n name\n sku {\n id\n price {\n amount\n }\n }\n fontStyles {\n id\n sku {\n id\n price {\n amount\n }\n }\n }\n }\n collectionBundles {\n id\n name\n sku {\n id\n price {\n amount\n }\n }\n memberCollections {\n id\n sku {\n id\n price {\n amount\n }\n }\n fontStyles {\n id\n sku {\n id\n price {\n amount\n }\n }\n }\n }\n }\n children(collectionTypes: [FAMILY]) {\n id\n name\n sku {\n id\n price {\n amount\n }\n }\n fontStyles {\n id\n sku {\n id\n price {\n amount\n }\n }\n }\n bundles {\n id\n name\n sku {\n id\n price {\n amount\n }\n }\n fontStyles {\n id\n sku {\n id\n price {\n amount\n }\n }\n }\n }\n }\n }\n ... on FontPack {\n __typename\n id\n name\n sku {\n id\n price {\n amount\n }\n }\n fontStyles {\n id\n sku {\n id\n price {\n amount\n }\n }\n }\n members {\n __typename\n ... on FontCollection {\n id\n name\n sku {\n id\n price {\n amount\n }\n }\n fontStyles {\n id\n sku {\n id\n price {\n amount\n }\n }\n }\n bundles {\n id\n name\n sku {\n id\n price {\n amount\n }\n }\n fontStyles {\n id\n sku {\n id\n price {\n amount\n }\n }\n }\n }\n children(collectionTypes: [FAMILY]) {\n id\n name\n sku {\n id\n price {\n amount\n }\n }\n fontStyles {\n id\n sku {\n id\n price {\n amount\n }\n }\n }\n bundles {\n id\n name\n sku {\n id\n price {\n amount\n }\n }\n fontStyles {\n id\n sku {\n id\n price {\n amount\n }\n }\n }\n }\n }\n }\n ... on Node {\n __isNode: __typename\n id\n }\n }\n }\n id\n }\n}\n"
173
212
  }
174
213
  };
175
214
  }();
176
- node.hash = "ac3292bae9a274139d5a525fd0162711";
215
+ node.hash = "65de750413d1564c4f3e1ec44ec7e2a2";
177
216
  export default node;
@@ -0,0 +1,111 @@
1
+ /**
2
+ * @generated SignedSource<<c00a5a25369b3afa2e42b1f47d1fa26a>>
3
+ * @lightSyntaxTransform
4
+ * @nogrep
5
+ */
6
+ import { ReaderFragment } from 'relay-runtime';
7
+ import { FragmentRefs } from "relay-runtime";
8
+ export type productState_fontPack$data = {
9
+ readonly fontStyles: ReadonlyArray<{
10
+ readonly id: string;
11
+ readonly sku: {
12
+ readonly id: string;
13
+ readonly price: {
14
+ readonly amount: number;
15
+ };
16
+ } | null;
17
+ }>;
18
+ readonly id: string;
19
+ readonly members: ReadonlyArray<{
20
+ readonly __typename: "FontCollection";
21
+ readonly bundles: ReadonlyArray<{
22
+ readonly fontStyles: ReadonlyArray<{
23
+ readonly id: string;
24
+ readonly sku: {
25
+ readonly id: string;
26
+ readonly price: {
27
+ readonly amount: number;
28
+ };
29
+ } | null;
30
+ }> | null;
31
+ readonly id: string;
32
+ readonly name: string;
33
+ readonly sku: {
34
+ readonly id: string;
35
+ readonly price: {
36
+ readonly amount: number;
37
+ };
38
+ } | null;
39
+ }> | null;
40
+ readonly children: ReadonlyArray<{
41
+ readonly bundles: ReadonlyArray<{
42
+ readonly fontStyles: ReadonlyArray<{
43
+ readonly id: string;
44
+ readonly sku: {
45
+ readonly id: string;
46
+ readonly price: {
47
+ readonly amount: number;
48
+ };
49
+ } | null;
50
+ }> | null;
51
+ readonly id: string;
52
+ readonly name: string;
53
+ readonly sku: {
54
+ readonly id: string;
55
+ readonly price: {
56
+ readonly amount: number;
57
+ };
58
+ } | null;
59
+ }> | null;
60
+ readonly fontStyles: ReadonlyArray<{
61
+ readonly id: string;
62
+ readonly sku: {
63
+ readonly id: string;
64
+ readonly price: {
65
+ readonly amount: number;
66
+ };
67
+ } | null;
68
+ }>;
69
+ readonly id: string;
70
+ readonly name: string;
71
+ readonly sku: {
72
+ readonly id: string;
73
+ readonly price: {
74
+ readonly amount: number;
75
+ };
76
+ } | null;
77
+ }> | null;
78
+ readonly fontStyles: ReadonlyArray<{
79
+ readonly id: string;
80
+ readonly sku: {
81
+ readonly id: string;
82
+ readonly price: {
83
+ readonly amount: number;
84
+ };
85
+ } | null;
86
+ }>;
87
+ readonly id: string;
88
+ readonly name: string;
89
+ readonly sku: {
90
+ readonly id: string;
91
+ readonly price: {
92
+ readonly amount: number;
93
+ };
94
+ } | null;
95
+ } | {
96
+ readonly __typename: "%other";
97
+ }>;
98
+ readonly name: string;
99
+ readonly sku: {
100
+ readonly id: string;
101
+ readonly price: {
102
+ readonly amount: number;
103
+ };
104
+ } | null;
105
+ };
106
+ export type productState_fontPack$key = {
107
+ readonly " $data"?: productState_fontPack$data;
108
+ readonly " $fragmentSpreads": FragmentRefs<"productState_fontPack">;
109
+ };
110
+ declare const node: ReaderFragment;
111
+ export default node;
@@ -0,0 +1,117 @@
1
+ /**
2
+ * @generated SignedSource<<c00a5a25369b3afa2e42b1f47d1fa26a>>
3
+ * @lightSyntaxTransform
4
+ * @nogrep
5
+ */
6
+
7
+ /* tslint:disable */
8
+ /* eslint-disable */
9
+ // @ts-nocheck
10
+
11
+ const node = function () {
12
+ var v0 = {
13
+ "alias": null,
14
+ "args": null,
15
+ "kind": "ScalarField",
16
+ "name": "id",
17
+ "storageKey": null
18
+ },
19
+ v1 = {
20
+ "alias": null,
21
+ "args": null,
22
+ "kind": "ScalarField",
23
+ "name": "name",
24
+ "storageKey": null
25
+ },
26
+ v2 = {
27
+ "alias": null,
28
+ "args": null,
29
+ "concreteType": "Sku",
30
+ "kind": "LinkedField",
31
+ "name": "sku",
32
+ "plural": false,
33
+ "selections": [v0 /*: any*/, {
34
+ "alias": null,
35
+ "args": null,
36
+ "concreteType": "Money",
37
+ "kind": "LinkedField",
38
+ "name": "price",
39
+ "plural": false,
40
+ "selections": [{
41
+ "alias": null,
42
+ "args": null,
43
+ "kind": "ScalarField",
44
+ "name": "amount",
45
+ "storageKey": null
46
+ }],
47
+ "storageKey": null
48
+ }],
49
+ "storageKey": null
50
+ },
51
+ v3 = {
52
+ "alias": null,
53
+ "args": null,
54
+ "concreteType": "FontStyle",
55
+ "kind": "LinkedField",
56
+ "name": "fontStyles",
57
+ "plural": true,
58
+ "selections": [v0 /*: any*/, v2 /*: any*/],
59
+ "storageKey": null
60
+ },
61
+ v4 = {
62
+ "alias": null,
63
+ "args": null,
64
+ "concreteType": "Bundle",
65
+ "kind": "LinkedField",
66
+ "name": "bundles",
67
+ "plural": true,
68
+ "selections": [v0 /*: any*/, v1 /*: any*/, v2 /*: any*/, v3 /*: any*/],
69
+ "storageKey": null
70
+ };
71
+ return {
72
+ "argumentDefinitions": [],
73
+ "kind": "Fragment",
74
+ "metadata": {
75
+ "mask": false
76
+ },
77
+ "name": "productState_fontPack",
78
+ "selections": [v0 /*: any*/, v1 /*: any*/, v2 /*: any*/, v3 /*: any*/, {
79
+ "alias": null,
80
+ "args": null,
81
+ "concreteType": null,
82
+ "kind": "LinkedField",
83
+ "name": "members",
84
+ "plural": true,
85
+ "selections": [{
86
+ "alias": null,
87
+ "args": null,
88
+ "kind": "ScalarField",
89
+ "name": "__typename",
90
+ "storageKey": null
91
+ }, {
92
+ "kind": "InlineFragment",
93
+ "selections": [v0 /*: any*/, v1 /*: any*/, v2 /*: any*/, v3 /*: any*/, v4 /*: any*/, {
94
+ "alias": null,
95
+ "args": [{
96
+ "kind": "Literal",
97
+ "name": "collectionTypes",
98
+ "value": ["FAMILY"]
99
+ }],
100
+ "concreteType": "FontCollection",
101
+ "kind": "LinkedField",
102
+ "name": "children",
103
+ "plural": true,
104
+ "selections": [v0 /*: any*/, v1 /*: any*/, v2 /*: any*/, v3 /*: any*/, v4 /*: any*/],
105
+ "storageKey": "children(collectionTypes:[\"FAMILY\"])"
106
+ }],
107
+ "type": "FontCollection",
108
+ "abstractKey": null
109
+ }],
110
+ "storageKey": null
111
+ }],
112
+ "type": "FontPack",
113
+ "abstractKey": null
114
+ };
115
+ }();
116
+ node.hash = "43a236a4ddb4436a51d765a07e2b0eac";
117
+ export default node;
@@ -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,94 @@
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
+ productSkuIds: {},
59
+ viewedProductId: null,
60
+ skuPrices: {},
61
+ fetchedCollectionIds: [],
62
+ storeModalRoute: {
63
+ name: 'index'
64
+ },
65
+ storeModalHistory: [],
66
+ orderVariableSelections: [],
67
+ licenseeIsBillingIdentity: null
68
+ };
69
+ return reducer(empty, {
70
+ type: 'POPULATE_PRODUCT_STATE',
71
+ data: catalog
72
+ });
73
+ }
74
+ const clickStyles = names => names.reduce((state, name) => reducer(state, {
75
+ type: 'SELECT_SKU_ID',
76
+ skuId: styleSku(name),
77
+ selected: true
78
+ }), loadedState());
79
+ const selectionTotal = state => Object.keys(state.selectedSkuIds).filter(id => state.selectedSkuIds[id] === true).reduce((sum, id) => sum + state.skuPrices[id], 0);
80
+ const permutations = items => items.length <= 1 ? [items] : items.flatMap((item, i) => permutations([...items.slice(0, i), ...items.slice(i + 1)]).map(rest => [item, ...rest]));
81
+ describe('style bundle discounts do not depend on click order', () => {
82
+ it.each(permutations(['Bold', 'Regular', 'Light']))('Light + Regular + Bold bundle price when clicked %s, %s, %s', function () {
83
+ for (var _len = arguments.length, order = new Array(_len), _key = 0; _key < _len; _key++) {
84
+ order[_key] = arguments[_key];
85
+ }
86
+ expect(selectionTotal(clickStyles(order))).toBe(20250);
87
+ });
88
+ it.each(permutations(['Bold', 'Bold Italic', 'Regular', 'Italic']))('two upright + italic pairs when clicked %s, %s, %s, %s', function () {
89
+ for (var _len2 = arguments.length, order = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
90
+ order[_key2] = arguments[_key2];
91
+ }
92
+ expect(selectionTotal(clickStyles(order))).toBe(28800);
93
+ });
94
+ });