fontdue-js 2.22.4 → 2.23.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.
Files changed (71) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/__generated__/CartItemAdditionalLicenses_orderItem.graphql.d.ts +4 -1
  3. package/dist/__generated__/CartItemAdditionalLicenses_orderItem.graphql.js +34 -22
  4. package/dist/__generated__/CartOrderCompleteOrderMutation.graphql.d.ts +1 -1
  5. package/dist/__generated__/CartOrderCompleteOrderMutation.graphql.js +13 -4
  6. package/dist/__generated__/CartOrderRemoveDiscountMutation.graphql.d.ts +1 -1
  7. package/dist/__generated__/CartOrderRemoveDiscountMutation.graphql.js +13 -4
  8. package/dist/__generated__/CartOrderUpdateMutation.graphql.d.ts +1 -1
  9. package/dist/__generated__/CartOrderUpdateMutation.graphql.js +13 -4
  10. package/dist/__generated__/CartQuery.graphql.d.ts +1 -1
  11. package/dist/__generated__/CartQuery.graphql.js +13 -4
  12. package/dist/__generated__/CartStateUpdateMutation.graphql.d.ts +1 -1
  13. package/dist/__generated__/CartStateUpdateMutation.graphql.js +13 -4
  14. package/dist/__generated__/CheckoutUpdateCustomerMutation.graphql.d.ts +1 -1
  15. package/dist/__generated__/CheckoutUpdateCustomerMutation.graphql.js +13 -4
  16. package/dist/__generated__/CheckoutUpdateOrderMutation.graphql.d.ts +1 -1
  17. package/dist/__generated__/CheckoutUpdateOrderMutation.graphql.js +13 -4
  18. package/dist/__generated__/FontdueProviderQuery.graphql.d.ts +19 -0
  19. package/dist/__generated__/FontdueProviderQuery.graphql.js +140 -0
  20. package/dist/__generated__/PrecartAddToCartMutation.graphql.d.ts +1 -1
  21. package/dist/__generated__/PrecartAddToCartMutation.graphql.js +34 -25
  22. package/dist/__generated__/PrecartQuery.graphql.d.ts +1 -1
  23. package/dist/__generated__/PrecartQuery.graphql.js +17 -7
  24. package/dist/__generated__/Precart_collection.graphql.d.ts +4 -1
  25. package/dist/__generated__/Precart_collection.graphql.js +13 -3
  26. package/dist/__generated__/Precart_license.graphql.d.ts +4 -1
  27. package/dist/__generated__/Precart_license.graphql.js +19 -9
  28. package/dist/__generated__/ServerConfigProvider_viewer.graphql.d.ts +23 -0
  29. package/dist/__generated__/ServerConfigProvider_viewer.graphql.js +57 -0
  30. package/dist/__generated__/StoreModalCartQuery.graphql.d.ts +1 -1
  31. package/dist/__generated__/StoreModalCartQuery.graphql.js +13 -4
  32. package/dist/__generated__/StoreModalProductLicense_license.graphql.d.ts +4 -1
  33. package/dist/__generated__/StoreModalProductLicense_license.graphql.js +11 -2
  34. package/dist/__generated__/StoreModalProductQuery.graphql.d.ts +1 -1
  35. package/dist/__generated__/StoreModalProductQuery.graphql.js +12 -3
  36. package/dist/__generated__/StoreModalProductRefetchQuery.graphql.d.ts +1 -1
  37. package/dist/__generated__/StoreModalProductRefetchQuery.graphql.js +42 -32
  38. package/dist/__generated__/TestFontsFormUpdateCustomerMutation.graphql.d.ts +1 -1
  39. package/dist/__generated__/TestFontsFormUpdateCustomerMutation.graphql.js +13 -4
  40. package/dist/__generated__/TestModeBanner_viewer.graphql.d.ts +19 -0
  41. package/dist/__generated__/TestModeBanner_viewer.graphql.js +36 -0
  42. package/dist/__generated__/ThemeConfig_viewer.graphql.d.ts +19 -0
  43. package/dist/__generated__/ThemeConfig_viewer.graphql.js +36 -0
  44. package/dist/__tests__/licenseExclusions.test.js +161 -0
  45. package/dist/components/BuyingOptions/index.d.ts +9 -0
  46. package/dist/components/Cart/CartItem/CartItemAdditionalLicenses.js +11 -5
  47. package/dist/components/CookieNotification/index.d.ts +13 -0
  48. package/dist/components/FontdueContextProvider/index.d.ts +17 -0
  49. package/dist/components/FontdueContextProvider/index.js +108 -0
  50. package/dist/components/FontdueContextProvider/index.server.d.ts +4 -0
  51. package/dist/components/FontdueContextProvider/index.server.js +7 -0
  52. package/dist/components/Icons/Checkbox.js +1 -1
  53. package/dist/components/Icons/CheckboxChecked.js +1 -1
  54. package/dist/components/Precart/index.js +12 -7
  55. package/dist/components/StoreModalProductLicenseSelection/StoreModalProductLicense.js +10 -4
  56. package/dist/components/TypeTester/TypeTesterStandalone.preload.d.ts +3 -3
  57. package/dist/components/TypeTester/TypeTesterStandalone.preload.js +10 -9
  58. package/dist/config.d.ts +2 -1
  59. package/dist/config.js +17 -6
  60. package/dist/fontdue.css +22 -2
  61. package/dist/hooks/useResizeObserver.d.ts +11 -0
  62. package/dist/hooks/useResizeObserver.js +23 -0
  63. package/dist/index.d.ts +2 -2
  64. package/dist/index.js +1 -1
  65. package/dist/loadFontdueProviderQuery.d.ts +3 -0
  66. package/dist/loadFontdueProviderQuery.js +10 -0
  67. package/dist/reducer.d.ts +2 -0
  68. package/dist/reducer.js +3 -1
  69. package/dist/vite.d.ts +2 -0
  70. package/dist/vite.js +139 -0
  71. package/package.json +1 -1
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = void 0;
7
7
  /**
8
- * @generated SignedSource<<9d4a12c7bf6d420569f4db4da099ad9b>>
8
+ * @generated SignedSource<<c4b112fa13523ab555027709d146aa87>>
9
9
  * @lightSyntaxTransform
10
10
  * @nogrep
11
11
  */
@@ -488,7 +488,16 @@ const node = function () {
488
488
  "kind": "LinkedField",
489
489
  "name": "license",
490
490
  "plural": false,
491
- "selections": [v4 /*: any*/, v2 /*: any*/, {
491
+ "selections": [v4 /*: any*/, {
492
+ "alias": null,
493
+ "args": null,
494
+ "concreteType": "License",
495
+ "kind": "LinkedField",
496
+ "name": "excludedLicenses",
497
+ "plural": true,
498
+ "selections": v8 /*: any*/,
499
+ "storageKey": null
500
+ }, v2 /*: any*/, {
492
501
  "alias": null,
493
502
  "args": null,
494
503
  "concreteType": "LicenseVariable",
@@ -756,12 +765,12 @@ const node = function () {
756
765
  }]
757
766
  },
758
767
  "params": {
759
- "cacheID": "813ff54043a7cf92b85b7692458c1c3a",
768
+ "cacheID": "9f6700459e60f36b1d027422008e4a94",
760
769
  "id": null,
761
770
  "metadata": {},
762
771
  "name": "TestFontsFormUpdateCustomerMutation",
763
772
  "operationKind": "mutation",
764
- "text": "mutation TestFontsFormUpdateCustomerMutation(\n $input: UpdateCustomerInput!\n) {\n updateCustomer(input: $input) {\n order {\n ...CartOrder_order\n id\n }\n }\n}\n\nfragment CartItemAdditionalLicenses_licenses on License {\n id\n name\n}\n\nfragment CartItemAdditionalLicenses_orderItem on OrderItem {\n licenseSelections {\n license {\n id\n }\n id\n }\n}\n\nfragment CartItemLicense_selection on LicenseSelection {\n id\n license {\n id\n name\n licenseVariables {\n id\n ...CartItemVariable_variable\n }\n }\n licenseVariable {\n id\n }\n ...CartItemVariable_selection\n}\n\nfragment CartItemProduct_product on SkuProduct {\n __isSkuProduct: __typename\n __typename\n ...CollectionAa_product\n ...FontStyle_fontStyle\n ... on FontStyle {\n family {\n name\n id\n }\n name\n variableInstances {\n name\n }\n }\n ... on Bundle {\n name\n fontCollection {\n name\n id\n }\n }\n ... on FontCollection {\n name\n isVariableFont\n totalStyles\n }\n ... on CollectionBundle {\n name\n totalStyles\n fontCollection {\n name\n id\n }\n }\n}\n\nfragment CartItemVariable_selection on LicenseSelection {\n id\n variableText\n license {\n id\n }\n licenseVariable {\n ...VariableTableAmounts_variable\n id\n name\n variableType\n licenseOptions {\n id\n }\n }\n licenseOption {\n ...VariableTableAmounts_option\n id\n name\n amount\n }\n}\n\nfragment CartItemVariable_variable on LicenseVariable {\n id\n licenseOptions {\n id\n name\n amount\n }\n}\n\nfragment CartItem_node on OrderItem {\n ...CartItemAdditionalLicenses_orderItem\n id\n price {\n ...Price_price\n }\n sku {\n price {\n ...Price_price\n }\n product {\n ...CartItemProduct_product\n __typename\n ... on Licenseable {\n __isLicenseable: __typename\n licenses {\n ...CartItemAdditionalLicenses_licenses\n id\n licenseVariables {\n id\n licenseOptions {\n id\n }\n }\n }\n }\n ... on Node {\n __isNode: __typename\n id\n }\n }\n id\n }\n licenseSelections {\n ...CartItemLicense_selection\n id\n license {\n id\n }\n licenseVariable {\n id\n }\n licenseOption {\n id\n }\n variableText\n }\n}\n\nfragment CartOrder_order on Order {\n ...Checkout_order\n ...Download_order\n ...CartTotals_order\n ...CartState_order\n id\n orderItems {\n ...CartItem_node\n id\n licenseSelections {\n license {\n id\n }\n licenseVariable {\n id\n variableType\n }\n licenseOption {\n id\n }\n variableText\n id\n }\n }\n orderVariableSelections {\n orderVariable {\n id\n }\n orderVariableOption {\n id\n }\n id\n }\n discount {\n id\n }\n customer {\n email\n name\n anonymous\n id\n }\n billingIdentity {\n ...IdentityBox_identity\n }\n licenseeIdentity {\n ...IdentityBox_identity\n }\n licenseeIsBillingIdentity\n stripePaymentMethod {\n card {\n last4\n brand\n }\n }\n stripePaymentIntent {\n status\n }\n canCompleteWithCoupon\n completedWithCoupon\n}\n\nfragment CartState_order on Order {\n id\n orderItems {\n id\n licenseSelections {\n license {\n id\n }\n licenseVariable {\n id\n }\n licenseOption {\n id\n }\n variableText\n id\n }\n }\n orderVariableSelections {\n orderVariable {\n id\n }\n orderVariableOption {\n id\n }\n countryCode\n id\n }\n}\n\nfragment CartTotals_order on Order {\n subtotal {\n ...Price_price\n }\n discount {\n amount {\n amount\n ...Price_price\n }\n coupon {\n ...CouponText_coupon\n id\n }\n id\n }\n discountedSubtotal {\n ...Price_price\n }\n total {\n amount\n ...Price_price\n }\n taxRate\n taxes {\n ...Price_price\n }\n taxName\n taxNotApplicable\n taxNotApplicableReason\n gstIncluded\n}\n\nfragment Checkout_order on Order {\n canCompleteWithCoupon\n customer {\n name\n email\n newsletterOptIn\n id\n }\n billingIdentity {\n name\n organization\n email\n phoneNullable\n street\n locality\n sublocality\n country\n administrativeArea\n zip\n vatNumber\n }\n licenseeIdentity {\n name\n organization\n email\n phoneNullable\n street\n locality\n sublocality\n country\n administrativeArea\n zip\n vatNumber\n }\n licenseeIsBillingIdentity\n}\n\nfragment CollectionAa_product on SkuProduct {\n __isSkuProduct: __typename\n __typename\n ... on FontCollection {\n featureStyle {\n ...FontStyle_fontStyle\n id\n }\n }\n ... on Bundle {\n fontStyles {\n ...FontStyle_fontStyle\n id\n }\n }\n}\n\nfragment CouponText_coupon on Coupon {\n type\n percentAmount\n creditAmount {\n amount\n currency\n }\n creditAmountRemaining {\n amount\n currency\n }\n}\n\nfragment Download_order on Order {\n id\n archiveUrl\n customer {\n email\n id\n }\n completedWithCoupon\n}\n\nfragment FontStyle_fontStyle on FontStyle {\n ...useFontStyle_fontStyle\n}\n\nfragment IdentityBox_identity on Identity {\n email\n phoneFormatted\n addressFormatted\n vatNumber\n}\n\nfragment Price_price on Money {\n amount\n currency\n}\n\nfragment VariableTableAmounts_option on LicenseOption {\n amounts\n}\n\nfragment VariableTableAmounts_variable on LicenseVariable {\n units\n}\n\nfragment useFontStyle_fontStyle on FontStyle {\n cssFamily\n name\n webfontSources {\n url\n format\n }\n verticalMetrics {\n unitsPerEm\n ascender\n descender\n lineGap\n }\n}\n"
773
+ "text": "mutation TestFontsFormUpdateCustomerMutation(\n $input: UpdateCustomerInput!\n) {\n updateCustomer(input: $input) {\n order {\n ...CartOrder_order\n id\n }\n }\n}\n\nfragment CartItemAdditionalLicenses_licenses on License {\n id\n name\n}\n\nfragment CartItemAdditionalLicenses_orderItem on OrderItem {\n licenseSelections {\n license {\n id\n excludedLicenses {\n id\n }\n }\n id\n }\n}\n\nfragment CartItemLicense_selection on LicenseSelection {\n id\n license {\n id\n name\n licenseVariables {\n id\n ...CartItemVariable_variable\n }\n }\n licenseVariable {\n id\n }\n ...CartItemVariable_selection\n}\n\nfragment CartItemProduct_product on SkuProduct {\n __isSkuProduct: __typename\n __typename\n ...CollectionAa_product\n ...FontStyle_fontStyle\n ... on FontStyle {\n family {\n name\n id\n }\n name\n variableInstances {\n name\n }\n }\n ... on Bundle {\n name\n fontCollection {\n name\n id\n }\n }\n ... on FontCollection {\n name\n isVariableFont\n totalStyles\n }\n ... on CollectionBundle {\n name\n totalStyles\n fontCollection {\n name\n id\n }\n }\n}\n\nfragment CartItemVariable_selection on LicenseSelection {\n id\n variableText\n license {\n id\n }\n licenseVariable {\n ...VariableTableAmounts_variable\n id\n name\n variableType\n licenseOptions {\n id\n }\n }\n licenseOption {\n ...VariableTableAmounts_option\n id\n name\n amount\n }\n}\n\nfragment CartItemVariable_variable on LicenseVariable {\n id\n licenseOptions {\n id\n name\n amount\n }\n}\n\nfragment CartItem_node on OrderItem {\n ...CartItemAdditionalLicenses_orderItem\n id\n price {\n ...Price_price\n }\n sku {\n price {\n ...Price_price\n }\n product {\n ...CartItemProduct_product\n __typename\n ... on Licenseable {\n __isLicenseable: __typename\n licenses {\n ...CartItemAdditionalLicenses_licenses\n id\n licenseVariables {\n id\n licenseOptions {\n id\n }\n }\n }\n }\n ... on Node {\n __isNode: __typename\n id\n }\n }\n id\n }\n licenseSelections {\n ...CartItemLicense_selection\n id\n license {\n id\n }\n licenseVariable {\n id\n }\n licenseOption {\n id\n }\n variableText\n }\n}\n\nfragment CartOrder_order on Order {\n ...Checkout_order\n ...Download_order\n ...CartTotals_order\n ...CartState_order\n id\n orderItems {\n ...CartItem_node\n id\n licenseSelections {\n license {\n id\n }\n licenseVariable {\n id\n variableType\n }\n licenseOption {\n id\n }\n variableText\n id\n }\n }\n orderVariableSelections {\n orderVariable {\n id\n }\n orderVariableOption {\n id\n }\n id\n }\n discount {\n id\n }\n customer {\n email\n name\n anonymous\n id\n }\n billingIdentity {\n ...IdentityBox_identity\n }\n licenseeIdentity {\n ...IdentityBox_identity\n }\n licenseeIsBillingIdentity\n stripePaymentMethod {\n card {\n last4\n brand\n }\n }\n stripePaymentIntent {\n status\n }\n canCompleteWithCoupon\n completedWithCoupon\n}\n\nfragment CartState_order on Order {\n id\n orderItems {\n id\n licenseSelections {\n license {\n id\n }\n licenseVariable {\n id\n }\n licenseOption {\n id\n }\n variableText\n id\n }\n }\n orderVariableSelections {\n orderVariable {\n id\n }\n orderVariableOption {\n id\n }\n countryCode\n id\n }\n}\n\nfragment CartTotals_order on Order {\n subtotal {\n ...Price_price\n }\n discount {\n amount {\n amount\n ...Price_price\n }\n coupon {\n ...CouponText_coupon\n id\n }\n id\n }\n discountedSubtotal {\n ...Price_price\n }\n total {\n amount\n ...Price_price\n }\n taxRate\n taxes {\n ...Price_price\n }\n taxName\n taxNotApplicable\n taxNotApplicableReason\n gstIncluded\n}\n\nfragment Checkout_order on Order {\n canCompleteWithCoupon\n customer {\n name\n email\n newsletterOptIn\n id\n }\n billingIdentity {\n name\n organization\n email\n phoneNullable\n street\n locality\n sublocality\n country\n administrativeArea\n zip\n vatNumber\n }\n licenseeIdentity {\n name\n organization\n email\n phoneNullable\n street\n locality\n sublocality\n country\n administrativeArea\n zip\n vatNumber\n }\n licenseeIsBillingIdentity\n}\n\nfragment CollectionAa_product on SkuProduct {\n __isSkuProduct: __typename\n __typename\n ... on FontCollection {\n featureStyle {\n ...FontStyle_fontStyle\n id\n }\n }\n ... on Bundle {\n fontStyles {\n ...FontStyle_fontStyle\n id\n }\n }\n}\n\nfragment CouponText_coupon on Coupon {\n type\n percentAmount\n creditAmount {\n amount\n currency\n }\n creditAmountRemaining {\n amount\n currency\n }\n}\n\nfragment Download_order on Order {\n id\n archiveUrl\n customer {\n email\n id\n }\n completedWithCoupon\n}\n\nfragment FontStyle_fontStyle on FontStyle {\n ...useFontStyle_fontStyle\n}\n\nfragment IdentityBox_identity on Identity {\n email\n phoneFormatted\n addressFormatted\n vatNumber\n}\n\nfragment Price_price on Money {\n amount\n currency\n}\n\nfragment VariableTableAmounts_option on LicenseOption {\n amounts\n}\n\nfragment VariableTableAmounts_variable on LicenseVariable {\n units\n}\n\nfragment useFontStyle_fontStyle on FontStyle {\n cssFamily\n name\n webfontSources {\n url\n format\n }\n verticalMetrics {\n unitsPerEm\n ascender\n descender\n lineGap\n }\n}\n"
765
774
  }
766
775
  };
767
776
  }();
@@ -0,0 +1,19 @@
1
+ /**
2
+ * @generated SignedSource<<e9ace1097ef31e2ed34190d2a31634be>>
3
+ * @lightSyntaxTransform
4
+ * @nogrep
5
+ */
6
+ import { ReaderFragment } from 'relay-runtime';
7
+ import { FragmentRefs } from "relay-runtime";
8
+ export type TestModeBanner_viewer$data = {
9
+ readonly testMode: {
10
+ readonly isActive: boolean;
11
+ };
12
+ readonly " $fragmentType": "TestModeBanner_viewer";
13
+ };
14
+ export type TestModeBanner_viewer$key = {
15
+ readonly " $data"?: TestModeBanner_viewer$data;
16
+ readonly " $fragmentSpreads": FragmentRefs<"TestModeBanner_viewer">;
17
+ };
18
+ declare const node: ReaderFragment;
19
+ export default node;
@@ -0,0 +1,36 @@
1
+ /**
2
+ * @generated SignedSource<<e9ace1097ef31e2ed34190d2a31634be>>
3
+ * @lightSyntaxTransform
4
+ * @nogrep
5
+ */
6
+
7
+ /* tslint:disable */
8
+ /* eslint-disable */
9
+ // @ts-nocheck
10
+
11
+ const node = {
12
+ "argumentDefinitions": [],
13
+ "kind": "Fragment",
14
+ "metadata": null,
15
+ "name": "TestModeBanner_viewer",
16
+ "selections": [{
17
+ "alias": null,
18
+ "args": null,
19
+ "concreteType": "TestMode",
20
+ "kind": "LinkedField",
21
+ "name": "testMode",
22
+ "plural": false,
23
+ "selections": [{
24
+ "alias": null,
25
+ "args": null,
26
+ "kind": "ScalarField",
27
+ "name": "isActive",
28
+ "storageKey": null
29
+ }],
30
+ "storageKey": null
31
+ }],
32
+ "type": "Viewer",
33
+ "abstractKey": null
34
+ };
35
+ node.hash = "f6b2f851466be9599d63ebf8f39e1a96";
36
+ export default node;
@@ -0,0 +1,19 @@
1
+ /**
2
+ * @generated SignedSource<<9eff3b1fe04abdb52e7380c1158bdb71>>
3
+ * @lightSyntaxTransform
4
+ * @nogrep
5
+ */
6
+ import { ReaderFragment } from 'relay-runtime';
7
+ import { FragmentRefs } from "relay-runtime";
8
+ export type ThemeConfig_viewer$data = {
9
+ readonly themeConfig: {
10
+ readonly customProperties: ReadonlyArray<string> | null;
11
+ } | null;
12
+ readonly " $fragmentType": "ThemeConfig_viewer";
13
+ };
14
+ export type ThemeConfig_viewer$key = {
15
+ readonly " $data"?: ThemeConfig_viewer$data;
16
+ readonly " $fragmentSpreads": FragmentRefs<"ThemeConfig_viewer">;
17
+ };
18
+ declare const node: ReaderFragment;
19
+ export default node;
@@ -0,0 +1,36 @@
1
+ /**
2
+ * @generated SignedSource<<9eff3b1fe04abdb52e7380c1158bdb71>>
3
+ * @lightSyntaxTransform
4
+ * @nogrep
5
+ */
6
+
7
+ /* tslint:disable */
8
+ /* eslint-disable */
9
+ // @ts-nocheck
10
+
11
+ const node = {
12
+ "argumentDefinitions": [],
13
+ "kind": "Fragment",
14
+ "metadata": null,
15
+ "name": "ThemeConfig_viewer",
16
+ "selections": [{
17
+ "alias": null,
18
+ "args": null,
19
+ "concreteType": "ThemeConfig",
20
+ "kind": "LinkedField",
21
+ "name": "themeConfig",
22
+ "plural": false,
23
+ "selections": [{
24
+ "alias": null,
25
+ "args": null,
26
+ "kind": "ScalarField",
27
+ "name": "customProperties",
28
+ "storageKey": null
29
+ }],
30
+ "storageKey": null
31
+ }],
32
+ "type": "Viewer",
33
+ "abstractKey": null
34
+ };
35
+ node.hash = "191db4fda0651cd596efa7f91699f895";
36
+ export default node;
@@ -0,0 +1,161 @@
1
+ "use strict";
2
+
3
+ var _vitest = require("vitest");
4
+ var _reducer = _interopRequireDefault(require("../reducer"));
5
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
6
+ _vitest.vi.mock('react-relay', () => ({
7
+ graphql: () => null,
8
+ fetchQuery: _vitest.vi.fn()
9
+ }));
10
+ function makeState() {
11
+ let overrides = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
12
+ return {
13
+ cartOpen: false,
14
+ precartOpen: false,
15
+ selectedSkuIds: {},
16
+ licenseOptions: [],
17
+ collectionStyleSkus: {},
18
+ collectionSkus: {},
19
+ skuPrices: {},
20
+ fetchedCollectionIds: [],
21
+ storeModalRoute: {
22
+ name: 'index'
23
+ },
24
+ storeModalHistory: [],
25
+ orderVariableSelections: [],
26
+ licenseeIsBillingIdentity: null,
27
+ ...overrides
28
+ };
29
+ }
30
+ (0, _vitest.describe)('PRECART_SELECT_LICENSE auto-deselect', () => {
31
+ (0, _vitest.it)('drops a currently-selected license when its excluder is selected', () => {
32
+ const state = makeState({
33
+ licenseOptions: [{
34
+ licenseId: 'A',
35
+ licenseOptions: {}
36
+ }]
37
+ });
38
+ const newState = (0, _reducer.default)(state, {
39
+ type: 'PRECART_SELECT_LICENSE',
40
+ licenseOptionSpec: {
41
+ licenseId: 'B',
42
+ licenseOptions: {}
43
+ },
44
+ excludedLicenseIds: ['A']
45
+ });
46
+ (0, _vitest.expect)(newState.licenseOptions.map(o => o.licenseId)).toEqual(['B']);
47
+ });
48
+ (0, _vitest.it)('leaves non-conflicting selections in place', () => {
49
+ const state = makeState({
50
+ licenseOptions: [{
51
+ licenseId: 'A',
52
+ licenseOptions: {}
53
+ }, {
54
+ licenseId: 'C',
55
+ licenseOptions: {}
56
+ }]
57
+ });
58
+ const newState = (0, _reducer.default)(state, {
59
+ type: 'PRECART_SELECT_LICENSE',
60
+ licenseOptionSpec: {
61
+ licenseId: 'B',
62
+ licenseOptions: {}
63
+ },
64
+ excludedLicenseIds: ['A']
65
+ });
66
+ (0, _vitest.expect)(newState.licenseOptions.map(o => o.licenseId).sort()).toEqual(['B', 'C']);
67
+ });
68
+ (0, _vitest.it)('is a no-op when the license is already selected', () => {
69
+ const state = makeState({
70
+ licenseOptions: [{
71
+ licenseId: 'B',
72
+ licenseOptions: {}
73
+ }]
74
+ });
75
+ const newState = (0, _reducer.default)(state, {
76
+ type: 'PRECART_SELECT_LICENSE',
77
+ licenseOptionSpec: {
78
+ licenseId: 'B',
79
+ licenseOptions: {}
80
+ },
81
+ excludedLicenseIds: ['A']
82
+ });
83
+ (0, _vitest.expect)(newState).toBe(state);
84
+ });
85
+ (0, _vitest.it)('handles empty excludedLicenseIds', () => {
86
+ const state = makeState({
87
+ licenseOptions: [{
88
+ licenseId: 'A',
89
+ licenseOptions: {}
90
+ }]
91
+ });
92
+ const newState = (0, _reducer.default)(state, {
93
+ type: 'PRECART_SELECT_LICENSE',
94
+ licenseOptionSpec: {
95
+ licenseId: 'B',
96
+ licenseOptions: {}
97
+ },
98
+ excludedLicenseIds: []
99
+ });
100
+ (0, _vitest.expect)(newState.licenseOptions.map(o => o.licenseId).sort()).toEqual(['A', 'B']);
101
+ });
102
+ (0, _vitest.it)('handles missing excludedLicenseIds (backwards compatibility)', () => {
103
+ const state = makeState({
104
+ licenseOptions: [{
105
+ licenseId: 'A',
106
+ licenseOptions: {}
107
+ }]
108
+ });
109
+ const newState = (0, _reducer.default)(state, {
110
+ type: 'PRECART_SELECT_LICENSE',
111
+ licenseOptionSpec: {
112
+ licenseId: 'B',
113
+ licenseOptions: {}
114
+ }
115
+ });
116
+ (0, _vitest.expect)(newState.licenseOptions.map(o => o.licenseId).sort()).toEqual(['A', 'B']);
117
+ });
118
+ });
119
+ (0, _vitest.describe)('PRECART_TOGGLE_LICENSE auto-deselect', () => {
120
+ (0, _vitest.it)('toggling on a conflicting license drops the conflict', () => {
121
+ const state = makeState({
122
+ licenseOptions: [{
123
+ licenseId: 'A',
124
+ licenseOptions: {}
125
+ }]
126
+ });
127
+ const newState = (0, _reducer.default)(state, {
128
+ type: 'PRECART_TOGGLE_LICENSE',
129
+ licenseId: 'B',
130
+ checked: true,
131
+ licenseOptionSpec: {
132
+ licenseId: 'B',
133
+ licenseOptions: {}
134
+ },
135
+ excludedLicenseIds: ['A']
136
+ });
137
+ (0, _vitest.expect)(newState.licenseOptions.map(o => o.licenseId)).toEqual(['B']);
138
+ });
139
+ (0, _vitest.it)('toggling off does not run auto-deselect', () => {
140
+ const state = makeState({
141
+ licenseOptions: [{
142
+ licenseId: 'A',
143
+ licenseOptions: {}
144
+ }, {
145
+ licenseId: 'B',
146
+ licenseOptions: {}
147
+ }]
148
+ });
149
+ const newState = (0, _reducer.default)(state, {
150
+ type: 'PRECART_TOGGLE_LICENSE',
151
+ licenseId: 'B',
152
+ checked: false,
153
+ licenseOptionSpec: {
154
+ licenseId: 'B',
155
+ licenseOptions: {}
156
+ },
157
+ excludedLicenseIds: ['A']
158
+ });
159
+ (0, _vitest.expect)(newState.licenseOptions.map(o => o.licenseId)).toEqual(['A']);
160
+ });
161
+ });
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ interface BuyingOptionsProps {
3
+ onPrecartOpen: () => void;
4
+ }
5
+ declare const _default: import("react-redux").ConnectedComponent<({ onPrecartOpen }: BuyingOptionsProps) => React.JSX.Element, {
6
+ context?: React.Context<import("react-redux").ReactReduxContextValue<any, import("redux").UnknownAction> | null> | undefined;
7
+ store?: import("redux").Store | undefined;
8
+ }>;
9
+ export default _default;
@@ -10,22 +10,28 @@ var _react = _interopRequireDefault(require("react"));
10
10
  var _reactRelay = require("react-relay");
11
11
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
12
12
  function CartItemAdditionalLicenses(_ref) {
13
- var _orderItem$licenseSel;
13
+ var _orderItem$licenseSel, _orderItem$licenseSel2;
14
14
  let {
15
15
  licenses: licensesKey,
16
16
  orderItem: orderItemKey,
17
17
  onAddLicense
18
18
  } = _ref;
19
19
  const licenses = (0, _reactRelay.useFragment)((_CartItemAdditionalLicenses_licenses2.default.hash && _CartItemAdditionalLicenses_licenses2.default.hash !== "a00d0c8ac3643f7c12911fad6f62ec4e" && console.error("The definition of 'CartItemAdditionalLicenses_licenses' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data."), _CartItemAdditionalLicenses_licenses2.default), licensesKey);
20
- const orderItem = (0, _reactRelay.useFragment)((_CartItemAdditionalLicenses_orderItem2.default.hash && _CartItemAdditionalLicenses_orderItem2.default.hash !== "3358a415bba3d69844b42bab6f71b551" && console.error("The definition of 'CartItemAdditionalLicenses_orderItem' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data."), _CartItemAdditionalLicenses_orderItem2.default), orderItemKey);
20
+ const orderItem = (0, _reactRelay.useFragment)((_CartItemAdditionalLicenses_orderItem2.default.hash && _CartItemAdditionalLicenses_orderItem2.default.hash !== "52f514c1954a1d93863d7dd4c4871e3a" && console.error("The definition of 'CartItemAdditionalLicenses_orderItem' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data."), _CartItemAdditionalLicenses_orderItem2.default), orderItemKey);
21
21
  if (!licenses) return null;
22
- const licenseIds = (_orderItem$licenseSel = orderItem.licenseSelections) === null || _orderItem$licenseSel === void 0 ? void 0 : _orderItem$licenseSel.map(_ref2 => {
22
+ const selectedLicenseIds = new Set(((_orderItem$licenseSel = orderItem.licenseSelections) === null || _orderItem$licenseSel === void 0 ? void 0 : _orderItem$licenseSel.map(_ref2 => {
23
23
  let {
24
24
  license
25
25
  } = _ref2;
26
26
  return license.id;
27
- });
28
- const additionalLicenses = licenses.filter(license => !(licenseIds !== null && licenseIds !== void 0 && licenseIds.some(id => id === license.id)));
27
+ })) ?? []);
28
+ const excludedLicenseIds = new Set(((_orderItem$licenseSel2 = orderItem.licenseSelections) === null || _orderItem$licenseSel2 === void 0 ? void 0 : _orderItem$licenseSel2.flatMap(_ref3 => {
29
+ let {
30
+ license
31
+ } = _ref3;
32
+ return license.excludedLicenses.map(l => l.id);
33
+ })) ?? []);
34
+ const additionalLicenses = licenses.filter(license => !selectedLicenseIds.has(license.id) && !excludedLicenseIds.has(license.id));
29
35
  if (additionalLicenses.length < 1) return null;
30
36
  return /*#__PURE__*/_react.default.createElement("div", {
31
37
  className: "cart-item__additional-licenses"
@@ -0,0 +1,13 @@
1
+ import React from 'react';
2
+ interface CookieNotificationProps {
3
+ siteTitle?: string;
4
+ }
5
+ interface CookieNotificationState {
6
+ dismissed: boolean;
7
+ }
8
+ export default class CookieNotification extends React.Component<CookieNotificationProps, CookieNotificationState> {
9
+ constructor(props: CookieNotificationProps);
10
+ dismiss: () => void;
11
+ render(): React.JSX.Element | null;
12
+ }
13
+ export {};
@@ -0,0 +1,17 @@
1
+ import React from 'react';
2
+ import { Store } from 'redux';
3
+ import { Config } from '../ConfigContext.js';
4
+ import { FontdueAction, FontdueState } from '../../reducer.js';
5
+ import { Components } from '../ComponentsContext.js';
6
+ export declare function EnsureFontdueContext({ children }: {
7
+ children: React.ReactNode;
8
+ }): React.JSX.Element;
9
+ export interface FontdueContextProvider_props {
10
+ children?: React.ReactNode;
11
+ url?: string;
12
+ stripeIntegration?: 'card-element' | 'dynamic';
13
+ config?: Config;
14
+ components?: Components;
15
+ store?: Store<FontdueState, FontdueAction>;
16
+ }
17
+ export default function FontdueContextProvider({ children, url, stripeIntegration, config, components, store, }: FontdueContextProvider_props): React.JSX.Element;
@@ -0,0 +1,108 @@
1
+ 'use client';
2
+
3
+ import React, { Suspense, createContext, useContext, useRef } from 'react';
4
+ import { Provider } from 'react-redux';
5
+ import { RelayEnvironmentProvider } from 'react-relay';
6
+ import { useCurrentEnvironment } from '../../relay/environment.js';
7
+ import ConfigContext, { makeConfig } from '../ConfigContext.js';
8
+ import { createDefaultStore } from '../../reducer.js';
9
+ import ComponentsContext from '../ComponentsContext.js';
10
+ import UrlContext from '../UrlContext.js';
11
+ import { setCorsModalEnabled } from '../../corsError.js';
12
+
13
+ // Marker context used by self-wrapping components to detect a parent
14
+ // FontdueContextProvider/FontdueProvider. When the marker is `true`, a
15
+ // self-wrapping component skips its inner FontdueContextProvider so the
16
+ // outer config/url/store/relay-env flow through. Internal — do not export
17
+ // from the package.
18
+ const FontdueContextMarker = /*#__PURE__*/createContext(false);
19
+
20
+ // Wraps `children` in `FontdueContextProvider` only when no parent
21
+ // FontdueContextProvider/FontdueProvider is present. Self-wrapping components
22
+ // (`<TypeTester>`, `<StoreModal>`, etc.) use this so they Just Work as
23
+ // standalone islands while staying lightweight inside an outer
24
+ // `<FontdueProvider>` tree.
25
+ export function EnsureFontdueContext(_ref) {
26
+ let {
27
+ children
28
+ } = _ref;
29
+ const isInsideContext = useContext(FontdueContextMarker);
30
+ if (isInsideContext) return /*#__PURE__*/React.createElement(React.Fragment, null, children);
31
+ return /*#__PURE__*/React.createElement(FontdueContextProvider, null, children);
32
+ }
33
+ const IS_SERVER = typeof window === typeof undefined;
34
+
35
+ // === Multi-island state-sharing contract ===
36
+ //
37
+ // Frameworks that hydrate per-island (Astro, Vike, Qwik) mount one
38
+ // `FontdueContextProvider` per fontdue-js component on the page. Each island
39
+ // runs its own React reconciler and gets its own copy of every context, so
40
+ // state that lives inside the component tree is duplicated — adding to the
41
+ // cart in one island wouldn't update the CartButton in a different island.
42
+ //
43
+ // Any stateful client to be shared *across islands* (a Redux store, a Relay
44
+ // Environment, or any future cache) must be a module-level singleton on the
45
+ // client and per-render on the server. SSR has the opposite constraint: a
46
+ // client-shared singleton would leak state between concurrent requests.
47
+ //
48
+ // The pattern (see also `relay/environment.ts → useCurrentEnvironment`):
49
+ //
50
+ // let clientThing: Thing | null = null;
51
+ // function useSharedThing() {
52
+ // if (IS_SERVER) return createThing(); // per-render, no leakage
53
+ // if (clientThing == null) clientThing = createThing();
54
+ // return clientThing; // shared across islands
55
+ // }
56
+ //
57
+ // If you add a new context provider here that holds mutable client state,
58
+ // follow this pattern. If it's purely deriving from props (no state), a
59
+ // vanilla `Context.Provider` is fine — each island will compute the same
60
+ // value.
61
+ let clientStore = null;
62
+ function useSharedStore(providedStore, config) {
63
+ const ref = useRef(null);
64
+ if (providedStore) return providedStore;
65
+ if (IS_SERVER) {
66
+ if (ref.current == null) ref.current = createDefaultStore(config);
67
+ return ref.current;
68
+ }
69
+ if (clientStore == null) clientStore = createDefaultStore(config);
70
+ return clientStore;
71
+ }
72
+ // Lightweight wrapper that sets up Fontdue's React contexts (Relay env,
73
+ // Redux store, config, url, components) without rendering any aux UI.
74
+ // `*Preloaded` self-wrapping components use this so they can stand alone
75
+ // without claiming the page-level aux UI slot. Pages that need aux UI
76
+ // (theme/test-mode/consent/tracking) wrap with `FontdueProvider` instead.
77
+ export default function FontdueContextProvider(_ref2) {
78
+ let {
79
+ children,
80
+ url,
81
+ stripeIntegration,
82
+ config,
83
+ components,
84
+ store
85
+ } = _ref2;
86
+ const environment = useCurrentEnvironment({
87
+ url,
88
+ stripeIntegration
89
+ });
90
+ const configValue = makeConfig(config);
91
+ setCorsModalEnabled(configValue.corsErrorModal);
92
+ const sharedStore = useSharedStore(store, config);
93
+ return /*#__PURE__*/React.createElement(FontdueContextMarker.Provider, {
94
+ value: true
95
+ }, /*#__PURE__*/React.createElement(RelayEnvironmentProvider, {
96
+ environment: environment
97
+ }, /*#__PURE__*/React.createElement(Provider, {
98
+ store: sharedStore
99
+ }, /*#__PURE__*/React.createElement(Suspense, {
100
+ fallback: null
101
+ }, /*#__PURE__*/React.createElement(ConfigContext.Provider, {
102
+ value: configValue
103
+ }, /*#__PURE__*/React.createElement(UrlContext.Provider, {
104
+ value: url ?? (typeof process !== 'undefined' ? process.env.NEXT_PUBLIC_FONTDUE_URL : undefined) ?? ''
105
+ }, /*#__PURE__*/React.createElement(ComponentsContext.Provider, {
106
+ value: components ?? {}
107
+ }, children)))))));
108
+ }
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import type { FontdueContextProvider_props } from './index.js';
3
+ export type { FontdueContextProvider_props } from './index.js';
4
+ export default function FontdueContextProviderServer(props: FontdueContextProvider_props): Promise<React.JSX.Element>;
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ import FontdueContextProvider from './index.js';
3
+ // RSC entry. The client component does the work; this exists so the
4
+ // `react-server` export condition resolves to a server-renderable file.
5
+ export default async function FontdueContextProviderServer(props) {
6
+ return /*#__PURE__*/React.createElement(FontdueContextProvider, props);
7
+ }
@@ -15,7 +15,7 @@ const Checkbox = () => /*#__PURE__*/_react.default.createElement("span", {
15
15
  y: "0",
16
16
  enableBackground: "new 0 0 16 16",
17
17
  version: "1.1",
18
- viewBox: "0 0 16 16",
18
+ viewBox: "2 2 12 12",
19
19
  xmlSpace: "preserve"
20
20
  }, /*#__PURE__*/_react.default.createElement("path", {
21
21
  d: "M2 2v12h12V2H2zm11 11H3V3h10v10z"
@@ -12,7 +12,7 @@ const CheckboxChecked = () => /*#__PURE__*/_react.default.createElement("span",
12
12
  }, /*#__PURE__*/_react.default.createElement("svg", {
13
13
  width: 16,
14
14
  height: 16,
15
- viewBox: "0 0 16 16",
15
+ viewBox: "2 2 12 12",
16
16
  fill: "none",
17
17
  xmlns: "http://www.w3.org/2000/svg"
18
18
  }, /*#__PURE__*/_react.default.createElement("path", {
@@ -81,7 +81,7 @@ const specFromLicense = license => {
81
81
  }
82
82
  return licenseOptionSpec;
83
83
  };
84
- _Precart_license2.default.hash && _Precart_license2.default.hash !== "0a642f10f28ca7d3857db23cf645895a" && console.error("The definition of 'Precart_license' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data."), _Precart_license2.default;
84
+ _Precart_license2.default.hash && _Precart_license2.default.hash !== "db49280bb01f8bbef6283c0d3fba99e1" && console.error("The definition of 'Precart_license' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data."), _Precart_license2.default;
85
85
  function Precart(_ref3) {
86
86
  var _viewer$precart2, _collection$licenses3;
87
87
  let {
@@ -120,7 +120,7 @@ function Precart(_ref3) {
120
120
  });
121
121
  }, [environment]);
122
122
  const onSelectLicense = (id, checked) => {
123
- var _collection$licenses;
123
+ var _collection$licenses, _license$excludedLice;
124
124
  const license = collection === null || collection === void 0 ? void 0 : (_collection$licenses = collection.licenses) === null || _collection$licenses === void 0 ? void 0 : _collection$licenses.find(node => node.id === id);
125
125
  if (!license) return;
126
126
  const licenseOptionSpec = specFromLicense(license);
@@ -128,7 +128,8 @@ function Precart(_ref3) {
128
128
  type: 'PRECART_TOGGLE_LICENSE',
129
129
  licenseId: id,
130
130
  checked,
131
- licenseOptionSpec
131
+ licenseOptionSpec,
132
+ excludedLicenseIds: (_license$excludedLice = license.excludedLicenses) === null || _license$excludedLice === void 0 ? void 0 : _license$excludedLice.map(l => l.id)
132
133
  });
133
134
  };
134
135
  const onSelectLicenseOption = (licenseId, variableId, optionId) => {
@@ -217,10 +218,14 @@ function Precart(_ref3) {
217
218
  }, [precartOpen]);
218
219
  (0, _react.useEffect)(() => {
219
220
  var _collection$licenses2;
220
- collection === null || collection === void 0 ? void 0 : (_collection$licenses2 = collection.licenses) === null || _collection$licenses2 === void 0 ? void 0 : _collection$licenses2.filter(license => license.defaultSelected).map(specFromLicense).forEach(spec => dispatch({
221
- type: 'PRECART_SELECT_LICENSE',
222
- licenseOptionSpec: spec
223
- }));
221
+ collection === null || collection === void 0 ? void 0 : (_collection$licenses2 = collection.licenses) === null || _collection$licenses2 === void 0 ? void 0 : _collection$licenses2.filter(license => license.defaultSelected).forEach(license => {
222
+ var _license$excludedLice2;
223
+ return dispatch({
224
+ type: 'PRECART_SELECT_LICENSE',
225
+ licenseOptionSpec: specFromLicense(license),
226
+ excludedLicenseIds: (_license$excludedLice2 = license.excludedLicenses) === null || _license$excludedLice2 === void 0 ? void 0 : _license$excludedLice2.map(l => l.id)
227
+ });
228
+ });
224
229
  }, []);
225
230
  function renderConfirmingModal(subtotal) {
226
231
  var _viewer$precart3, _viewer$precart3$skus;