fontdue-js 2.16.1 → 2.17.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 (128) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/dist/__generated__/AddressFieldsRefetchQuery.graphql.d.ts +1 -1
  3. package/dist/__generated__/AddressFieldsRefetchQuery.graphql.js +25 -4
  4. package/dist/__generated__/AddressFields_viewer.graphql.d.ts +5 -1
  5. package/dist/__generated__/AddressFields_viewer.graphql.js +23 -2
  6. package/dist/__generated__/CartOrderCompleteOrderMutation.graphql.d.ts +1 -1
  7. package/dist/__generated__/CartOrderCompleteOrderMutation.graphql.js +10 -4
  8. package/dist/__generated__/CartOrderRemoveDiscountMutation.graphql.d.ts +1 -1
  9. package/dist/__generated__/CartOrderRemoveDiscountMutation.graphql.js +10 -4
  10. package/dist/__generated__/CartOrderUpdateMutation.graphql.d.ts +3 -2
  11. package/dist/__generated__/CartOrderUpdateMutation.graphql.js +10 -4
  12. package/dist/__generated__/CartQuery.graphql.d.ts +1 -1
  13. package/dist/__generated__/CartQuery.graphql.js +22 -4
  14. package/dist/__generated__/CartStateRemoveDiscountMutation.graphql.d.ts +1 -1
  15. package/dist/__generated__/CartStateRemoveDiscountMutation.graphql.js +43 -4
  16. package/dist/__generated__/CartStateUpdateMutation.graphql.d.ts +4 -3
  17. package/dist/__generated__/CartStateUpdateMutation.graphql.js +75 -54
  18. package/dist/__generated__/CartState_order.graphql.d.ts +2 -1
  19. package/dist/__generated__/CartState_order.graphql.js +8 -2
  20. package/dist/__generated__/CheckoutUpdateCustomerMutation.graphql.d.ts +1 -1
  21. package/dist/__generated__/CheckoutUpdateCustomerMutation.graphql.js +10 -4
  22. package/dist/__generated__/CheckoutUpdateOrderMutation.graphql.d.ts +5 -4
  23. package/dist/__generated__/CheckoutUpdateOrderMutation.graphql.js +10 -4
  24. package/dist/__generated__/Checkout_UpdateOrderErrors.graphql.d.ts +3 -3
  25. package/dist/__generated__/Checkout_UpdateOrderErrors.graphql.js +3 -3
  26. package/dist/__generated__/Checkout_identity.graphql.d.ts +2 -2
  27. package/dist/__generated__/Checkout_identity.graphql.js +3 -3
  28. package/dist/__generated__/Checkout_order.graphql.d.ts +3 -3
  29. package/dist/__generated__/Checkout_order.graphql.js +2 -2
  30. package/dist/__generated__/CouponCodeInputApplyCouponMutation.graphql.d.ts +1 -1
  31. package/dist/__generated__/CouponCodeInputApplyCouponMutation.graphql.js +43 -4
  32. package/dist/__generated__/CustomerLoginFormLoginMutation.graphql.d.ts +4 -1
  33. package/dist/__generated__/CustomerLoginFormLoginMutation.graphql.js +1 -1
  34. package/dist/__generated__/FontFamiliesQuery.graphql.d.ts +2 -1
  35. package/dist/__generated__/FontFamiliesQuery.graphql.js +1 -1
  36. package/dist/__generated__/OrderVariableSelectionReduxRefetchQuery.graphql.d.ts +26 -0
  37. package/dist/__generated__/OrderVariableSelectionReduxRefetchQuery.graphql.js +154 -0
  38. package/dist/__generated__/OrderVariableSelectionRedux_viewer.graphql.d.ts +6 -1
  39. package/dist/__generated__/OrderVariableSelectionRedux_viewer.graphql.js +48 -5
  40. package/dist/__generated__/OrderVariableSelection_variables.graphql.d.ts +5 -1
  41. package/dist/__generated__/OrderVariableSelection_variables.graphql.js +41 -17
  42. package/dist/__generated__/PrecartAddToCartMutation.graphql.d.ts +2 -1
  43. package/dist/__generated__/PrecartAddToCartMutation.graphql.js +10 -4
  44. package/dist/__generated__/PriceBarSectionRefetchQuery.graphql.d.ts +2 -1
  45. package/dist/__generated__/PriceBarSectionRefetchQuery.graphql.js +1 -1
  46. package/dist/__generated__/StoreModalCartQuery.graphql.d.ts +8 -2
  47. package/dist/__generated__/StoreModalCartQuery.graphql.js +171 -114
  48. package/dist/__generated__/StoreModalIndexItem_fontCollection.graphql.d.ts +2 -1
  49. package/dist/__generated__/StoreModalIndexItem_fontCollection.graphql.js +8 -2
  50. package/dist/__generated__/StoreModalIndexQuery.graphql.d.ts +1 -1
  51. package/dist/__generated__/StoreModalIndexQuery.graphql.js +9 -3
  52. package/dist/__generated__/StoreModalOrderVariableSelectionHookQuery.graphql.d.ts +26 -0
  53. package/dist/__generated__/StoreModalOrderVariableSelectionRefetchQuery.graphql.d.ts +26 -0
  54. package/dist/__generated__/StoreModalOrderVariableSelection_order.graphql.d.ts +30 -0
  55. package/dist/__generated__/StoreModalOrderVariableSelection_order.graphql.js +98 -0
  56. package/dist/__generated__/StoreModalOrderVariableSelection_viewer.graphql.d.ts +1 -16
  57. package/dist/__generated__/StoreModalOrderVariableSelection_viewer.graphql.js +40 -104
  58. package/dist/__generated__/StoreModalProductContent_viewer.graphql.d.ts +30 -0
  59. package/dist/__generated__/StoreModalProductQuery.graphql.d.ts +2 -1
  60. package/dist/__generated__/StoreModalProductQuery.graphql.js +90 -63
  61. package/dist/__generated__/StoreModalProductRefetchQuery.graphql.d.ts +2 -1
  62. package/dist/__generated__/StoreModalProductRefetchQuery.graphql.js +1 -1
  63. package/dist/__generated__/StoreModalProductSummaryAddToCartMutation.graphql.d.ts +2 -1
  64. package/dist/__generated__/StoreModalProductSummaryAddToCartMutation.graphql.js +1 -1
  65. package/dist/__generated__/StoreModalProductSummaryRefetchQuery.graphql.d.ts +2 -1
  66. package/dist/__generated__/StoreModalProductSummaryRefetchQuery.graphql.js +1 -1
  67. package/dist/__generated__/StoreModalProductViewerRefetchQuery.graphql.d.ts +31 -0
  68. package/dist/__generated__/StoreModalUnifiedCheckoutCompleteOrderMutation.graphql.d.ts +1 -1
  69. package/dist/__generated__/StoreModalUnifiedCheckoutCompleteOrderMutation.graphql.js +43 -4
  70. package/dist/__generated__/StoreModalUnifiedCheckoutUpdateCustomerMutation.graphql.d.ts +6 -1
  71. package/dist/__generated__/StoreModalUnifiedCheckoutUpdateCustomerMutation.graphql.js +74 -24
  72. package/dist/__generated__/StoreModalUnifiedCheckoutUpdateOrderMutation.graphql.d.ts +5 -4
  73. package/dist/__generated__/StoreModalUnifiedCheckoutUpdateOrderMutation.graphql.js +43 -4
  74. package/dist/__generated__/StoreModalUnifiedCheckout_order.graphql.d.ts +13 -3
  75. package/dist/__generated__/StoreModalUnifiedCheckout_order.graphql.js +50 -4
  76. package/dist/__generated__/StoreModalUnifiedCheckout_viewer.graphql.d.ts +2 -1
  77. package/dist/__generated__/StoreModalUnifiedCheckout_viewer.graphql.js +8 -2
  78. package/dist/__generated__/TestFontsFormUpdateCustomerMutation.graphql.d.ts +1 -1
  79. package/dist/__generated__/TestFontsFormUpdateCustomerMutation.graphql.js +10 -4
  80. package/dist/__generated__/TypeTesterStandaloneChangedStylesQuery.graphql.d.ts +2 -1
  81. package/dist/__generated__/TypeTesterStandaloneChangedStylesQuery.graphql.js +9 -3
  82. package/dist/__generated__/TypeTesterStandaloneQuery.graphql.d.ts +1 -1
  83. package/dist/__generated__/TypeTesterStandaloneQuery.graphql.js +30 -14
  84. package/dist/__generated__/TypeTesterStyleSelectData_fontStyle.graphql.d.ts +2 -1
  85. package/dist/__generated__/TypeTesterStyleSelectData_fontStyle.graphql.js +8 -2
  86. package/dist/__generated__/TypeTesterStyleSelectData_viewer.graphql.d.ts +4 -1
  87. package/dist/__generated__/TypeTesterStyleSelectData_viewer.graphql.js +17 -2
  88. package/dist/__generated__/TypeTesterStyleSelect_family.graphql.d.ts +33 -0
  89. package/dist/__generated__/TypeTesterStyleSelect_fontStyle.graphql.d.ts +27 -0
  90. package/dist/__generated__/TypeTestersChangedStylesQuery.graphql.d.ts +2 -1
  91. package/dist/__generated__/TypeTestersChangedStylesQuery.graphql.js +9 -3
  92. package/dist/__generated__/TypeTestersIDQuery.graphql.d.ts +1 -1
  93. package/dist/__generated__/TypeTestersIDQuery.graphql.js +53 -37
  94. package/dist/__generated__/TypeTestersRefetchQuery.graphql.d.ts +2 -1
  95. package/dist/__generated__/TypeTestersRefetchQuery.graphql.js +9 -3
  96. package/dist/__generated__/TypeTestersSlugQuery.graphql.d.ts +1 -1
  97. package/dist/__generated__/TypeTestersSlugQuery.graphql.js +53 -37
  98. package/dist/components/Cart/AddressFields.d.ts +3 -2
  99. package/dist/components/Cart/AddressFields.js +45 -47
  100. package/dist/components/Cart/CartState.js +2 -2
  101. package/dist/components/Cart/CartTotals.d.ts +5 -2
  102. package/dist/components/Cart/CartTotals.js +24 -10
  103. package/dist/components/Cart/Checkout.js +33 -6
  104. package/dist/components/Cart/CustomerFields.d.ts +5 -0
  105. package/dist/components/Cart/CustomerFields.js +11 -3
  106. package/dist/components/Cart/types.d.ts +1 -1
  107. package/dist/components/ConfigContext.d.ts +10 -0
  108. package/dist/components/ConfigContext.js +4 -1
  109. package/dist/components/OrderVariableSelection/OrderVariableSelectionRedux.js +30 -1
  110. package/dist/components/OrderVariableSelection/index.d.ts +3 -1
  111. package/dist/components/OrderVariableSelection/index.js +31 -11
  112. package/dist/components/StoreModal/StoreModalCart.js +9 -6
  113. package/dist/components/StoreModal/StoreModalIndexItem.js +3 -3
  114. package/dist/components/StoreModal/StoreModalOrderVariableSelection.d.ts +3 -1
  115. package/dist/components/StoreModal/StoreModalOrderVariableSelection.js +25 -6
  116. package/dist/components/StoreModal/StoreModalProduct.js +1 -1
  117. package/dist/components/StoreModal/StoreModalStyleButton.js +1 -8
  118. package/dist/components/StripeProvider/index.js +5 -3
  119. package/dist/components/TypeTester/TypeTesterStyleSelectData.js +12 -3
  120. package/dist/components/elements/StoreModalUnifiedCheckout.d.ts +60 -1
  121. package/dist/components/elements/StoreModalUnifiedCheckout.js +425 -208
  122. package/dist/fontdue.css +36 -10
  123. package/dist/reducer.d.ts +1 -0
  124. package/dist/utils/interpolateOrderVariableDescription.d.ts +36 -0
  125. package/dist/utils/interpolateOrderVariableDescription.test.d.ts +1 -0
  126. package/dist/utils.d.ts +1 -0
  127. package/dist/utils.js +11 -2
  128. package/package.json +2 -1
@@ -13,16 +13,22 @@ var _ConfigContext = _interopRequireDefault(require("../ConfigContext"));
13
13
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
14
14
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
15
15
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
16
+ const notEmpty = value => value != null;
16
17
  const CustomerFields = _ref => {
17
18
  let {
18
19
  title,
19
20
  value,
20
21
  onChange,
21
- optInLabel
22
+ optInLabel,
23
+ errors
22
24
  } = _ref;
23
25
  const {
24
26
  form: config
25
27
  } = (0, _react.useContext)(_ConfigContext.default);
28
+ const getErrors = field => {
29
+ var _errors$field;
30
+ return errors === null || errors === void 0 ? void 0 : (_errors$field = errors[field]) === null || _errors$field === void 0 ? void 0 : _errors$field.filter(notEmpty);
31
+ };
26
32
  return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, title ? /*#__PURE__*/_react.default.createElement("div", {
27
33
  className: "checkout-modal__section"
28
34
  }, /*#__PURE__*/_react.default.createElement("div", {
@@ -38,7 +44,8 @@ const CustomerFields = _ref => {
38
44
  value: value.name || '',
39
45
  onChange: v => onChange({
40
46
  name: v
41
- })
47
+ }),
48
+ errors: getErrors('name')
42
49
  })), /*#__PURE__*/_react.default.createElement("div", {
43
50
  className: "checkout-modal__section"
44
51
  }, /*#__PURE__*/_react.default.createElement(_TextField.default, {
@@ -49,7 +56,8 @@ const CustomerFields = _ref => {
49
56
  value: value.email || '',
50
57
  onChange: v => onChange({
51
58
  email: v
52
- })
59
+ }),
60
+ errors: getErrors('email')
53
61
  })), optInLabel && /*#__PURE__*/_react.default.createElement("div", {
54
62
  className: "checkout-modal__section"
55
63
  }, /*#__PURE__*/_react.default.createElement("div", {
@@ -8,7 +8,7 @@ export interface Identity {
8
8
  name: string;
9
9
  organization: string | null;
10
10
  email: string;
11
- phone: string;
11
+ phone: string | null;
12
12
  country: string;
13
13
  administrativeArea: string | null;
14
14
  street: string | null;
@@ -8,11 +8,15 @@ interface FormConfig {
8
8
  interface StripeConfig {
9
9
  appearance?: Appearance;
10
10
  }
11
+ interface TrackingConfig {
12
+ enabled?: boolean;
13
+ }
11
14
  export interface Config {
12
15
  form?: FormConfig;
13
16
  storeModal?: StoreModalConfig;
14
17
  typeTester?: TypeTesterConfig;
15
18
  stripe?: StripeConfig;
19
+ tracking?: TrackingConfig;
16
20
  }
17
21
  export declare const makeConfig: (config?: Config) => {
18
22
  typeTester: {
@@ -72,6 +76,9 @@ export declare const makeConfig: (config?: Config) => {
72
76
  stripe: {
73
77
  appearance: Appearance | null;
74
78
  };
79
+ tracking: {
80
+ enabled: boolean;
81
+ };
75
82
  };
76
83
  declare const _default: React.Context<{
77
84
  typeTester: {
@@ -131,5 +138,8 @@ declare const _default: React.Context<{
131
138
  stripe: {
132
139
  appearance: Appearance | null;
133
140
  };
141
+ tracking: {
142
+ enabled: boolean;
143
+ };
134
144
  }>;
135
145
  export default _default;
@@ -54,7 +54,7 @@ const makeTypeTesterConfig = config => {
54
54
  };
55
55
  };
56
56
  const makeConfig = config => {
57
- var _config$form, _config$storeModal, _config$storeModal2, _config$storeModal3, _config$stripe;
57
+ var _config$form, _config$storeModal, _config$storeModal2, _config$storeModal3, _config$stripe, _config$tracking;
58
58
  return {
59
59
  typeTester: makeTypeTesterConfig(config === null || config === void 0 ? void 0 : config.typeTester),
60
60
  form: {
@@ -67,6 +67,9 @@ const makeConfig = config => {
67
67
  },
68
68
  stripe: {
69
69
  appearance: (config === null || config === void 0 ? void 0 : (_config$stripe = config.stripe) === null || _config$stripe === void 0 ? void 0 : _config$stripe.appearance) ?? null
70
+ },
71
+ tracking: {
72
+ enabled: (config === null || config === void 0 ? void 0 : (_config$tracking = config.tracking) === null || _config$tracking === void 0 ? void 0 : _config$tracking.enabled) ?? false // Explicit opt-in required
70
73
  }
71
74
  };
72
75
  };
@@ -9,6 +9,8 @@ var _react = _interopRequireWildcard(require("react"));
9
9
  var _reactRelay = require("react-relay");
10
10
  var _reactRedux = require("react-redux");
11
11
  var _index = _interopRequireDefault(require("./index"));
12
+ var _OrderVariableSelectionReduxRefetchQuery = _interopRequireDefault(require("../../__generated__/OrderVariableSelectionReduxRefetchQuery.graphql"));
13
+ var _useRefetchOnLicenseChanges = require("../../hooks/useRefetchOnLicenseChanges");
12
14
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
13
15
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
14
16
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
@@ -18,7 +20,14 @@ function OrderVariableSelectionRedux(_ref) {
18
20
  disabled,
19
21
  children
20
22
  } = _ref;
21
- const viewer = (0, _reactRelay.useFragment)((_OrderVariableSelectionRedux_viewer2.default.hash && _OrderVariableSelectionRedux_viewer2.default.hash !== "7d07b06f69f3c216f916b8da7c604cd5" && console.error("The definition of 'OrderVariableSelectionRedux_viewer' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data."), _OrderVariableSelectionRedux_viewer2.default), viewerKey);
23
+ const environment = (0, _reactRelay.useRelayEnvironment)();
24
+ const [viewer, refetch] = (0, _reactRelay.useRefetchableFragment)((_OrderVariableSelectionRedux_viewer2.default.hash && _OrderVariableSelectionRedux_viewer2.default.hash !== "eaa5e1fdf47cb582dd3c7bdea0a5e6b2" && console.error("The definition of 'OrderVariableSelectionRedux_viewer' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data."), _OrderVariableSelectionRedux_viewer2.default), viewerKey);
25
+ (0, _useRefetchOnLicenseChanges.useRefetchOnLicenseChanges)({
26
+ environment,
27
+ refetch,
28
+ query: _OrderVariableSelectionReduxRefetchQuery.default,
29
+ variables: {}
30
+ });
22
31
  const dispatch = (0, _reactRedux.useDispatch)();
23
32
  const selections = (0, _reactRedux.useSelector)(state => state.orderVariableSelections);
24
33
  const handleSelectionChange = (0, _react.useCallback)(newSelections => {
@@ -27,6 +36,26 @@ function OrderVariableSelectionRedux(_ref) {
27
36
  selections: newSelections
28
37
  });
29
38
  }, [dispatch]);
39
+
40
+ // Auto-populate Redux state with detected country for country-type variables
41
+ (0, _react.useEffect)(() => {
42
+ if (!viewer.detectedCountry || !viewer.orderVariables) return;
43
+
44
+ // Find country-type variables that don't have a selection yet
45
+ const countryVariablesNeedingSelection = viewer.orderVariables.filter(v => v.variableType === 'country').filter(v => !selections.find(s => s.orderVariableId === v.id));
46
+ if (countryVariablesNeedingSelection.length === 0) return;
47
+
48
+ // Pre-populate with detected country
49
+ const newSelections = [...selections, ...countryVariablesNeedingSelection.map(v => ({
50
+ orderVariableId: v.id,
51
+ orderVariableOptionId: null,
52
+ countryCode: viewer.detectedCountry
53
+ }))];
54
+ dispatch({
55
+ type: 'UPDATE_ORDER_VARIABLE_SELECTIONS',
56
+ selections: newSelections
57
+ });
58
+ }, [viewer.detectedCountry, viewer.orderVariables, selections, dispatch]);
30
59
  return /*#__PURE__*/_react.default.createElement(_index.default, {
31
60
  variables: viewer,
32
61
  selections: selections,
@@ -3,6 +3,7 @@ import { OrderVariableSelection_variables$key } from '__generated__/OrderVariabl
3
3
  export interface OrderVariableSelectionInput {
4
4
  orderVariableId: string;
5
5
  orderVariableOptionId: string | null;
6
+ countryCode?: string | null;
6
7
  }
7
8
  export type GhostVariable = {
8
9
  orderVariable: {
@@ -25,9 +26,10 @@ interface OrderVariableSelectionProps {
25
26
  disabled: boolean;
26
27
  ghostVariables?: GhostVariable[];
27
28
  onRemoveGhostVariable?: (orderVariableId: string) => void;
29
+ descriptionOverrides?: Record<string, string | null>;
28
30
  children: {
29
31
  label: React.ReactNode;
30
32
  };
31
33
  }
32
- export default function OrderVariableSelection({ variables: variablesKey, selections, onSelectionChange, disabled, ghostVariables, onRemoveGhostVariable, children: { label }, }: OrderVariableSelectionProps): React.JSX.Element | null;
34
+ export default function OrderVariableSelection({ variables: variablesKey, selections, onSelectionChange, disabled, ghostVariables, onRemoveGhostVariable, descriptionOverrides, children: { label }, }: OrderVariableSelectionProps): React.JSX.Element | null;
33
35
  export {};
@@ -24,7 +24,8 @@ function Variable(_ref) {
24
24
  selection,
25
25
  onToggle,
26
26
  ghost = false,
27
- onRemoveGhost
27
+ onRemoveGhost,
28
+ countries
28
29
  } = _ref;
29
30
  const {
30
31
  form: config
@@ -39,7 +40,7 @@ function Variable(_ref) {
39
40
  // For unselected select variables, select the first option by default
40
41
  onToggle(variable.id, variable.orderVariableOptions[0].id);
41
42
  }
42
- // Do nothing when clicking an already selected select variable
43
+ // Country variables are now static (non-editable)
43
44
  }, [variable, isSelected, onToggle]);
44
45
  const handleChangeVariableOption = (0, _react.useCallback)(e => {
45
46
  onToggle(variable.id, e.target.value);
@@ -61,6 +62,7 @@ function Variable(_ref) {
61
62
  });
62
63
  }
63
64
  const selectedOption = (_options = options) === null || _options === void 0 ? void 0 : _options.find(o => o.id === (selection === null || selection === void 0 ? void 0 : selection.orderVariableOptionId));
65
+ const selectedCountry = countries === null || countries === void 0 ? void 0 : countries.find(c => c.code === (selection === null || selection === void 0 ? void 0 : selection.countryCode));
64
66
  return /*#__PURE__*/_react.default.createElement("div", {
65
67
  className: "store-modal__order-variable-selection__item",
66
68
  "data-variable-type": variable.variableType,
@@ -94,7 +96,9 @@ function Variable(_ref) {
94
96
  value: id,
95
97
  disabled: disabled
96
98
  }, amount, " ", disabled ? '(Deprecated)' : null);
97
- }))) : null), variable.description ? /*#__PURE__*/_react.default.createElement("div", {
99
+ }))) : null, variable.variableType === 'country' && selectedCountry ? /*#__PURE__*/_react.default.createElement("span", {
100
+ className: "store-modal__order-variable-selection__country-value"
101
+ }, selectedCountry.name) : null), variable.description ? /*#__PURE__*/_react.default.createElement("div", {
98
102
  className: "store-modal__order-variable-selection__description",
99
103
  dangerouslySetInnerHTML: {
100
104
  __html: variable.description
@@ -114,17 +118,19 @@ function OrderVariableSelection(_ref3) {
114
118
  disabled,
115
119
  ghostVariables = [],
116
120
  onRemoveGhostVariable,
121
+ descriptionOverrides,
117
122
  children: {
118
123
  label
119
124
  }
120
125
  } = _ref3;
121
- const variables = (0, _reactRelay.useFragment)((_OrderVariableSelection_variables2.default.hash && _OrderVariableSelection_variables2.default.hash !== "791f9f19a96e680b9fa2b1ad81e8aa2f" && console.error("The definition of 'OrderVariableSelection_variables' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data."), _OrderVariableSelection_variables2.default), variablesKey);
122
- const handleSelectionChange = (0, _react.useCallback)((variableId, optionId) => {
126
+ const variables = (0, _reactRelay.useFragment)((_OrderVariableSelection_variables2.default.hash && _OrderVariableSelection_variables2.default.hash !== "b73b43b61cd5edd5face7d4a5615b2f5" && console.error("The definition of 'OrderVariableSelection_variables' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data."), _OrderVariableSelection_variables2.default), variablesKey);
127
+ const handleSelectionChange = (0, _react.useCallback)((variableId, optionId, countryCode) => {
123
128
  var _variables$orderVaria;
124
129
  // Update the selections with the new value
125
130
  const newSelections = selections.map(selection => ({
126
131
  orderVariableId: selection.orderVariableId,
127
- orderVariableOptionId: selection.orderVariableOptionId
132
+ orderVariableOptionId: selection.orderVariableOptionId,
133
+ countryCode: selection.countryCode
128
134
  }));
129
135
  const existingIndex = newSelections.findIndex(s => s.orderVariableId === variableId);
130
136
 
@@ -137,16 +143,21 @@ function OrderVariableSelection(_ref3) {
137
143
  newSelections.splice(existingIndex, 1);
138
144
  } else {
139
145
  // Update existing selection
146
+ // For country variables: clear orderVariableOptionId when setting countryCode
147
+ // For select/boolean variables: clear countryCode when setting orderVariableOptionId
148
+ const isCountryVariable = (variable === null || variable === void 0 ? void 0 : variable.variableType) === 'country';
140
149
  newSelections[existingIndex] = {
141
150
  ...newSelections[existingIndex],
142
- orderVariableOptionId: optionId
151
+ orderVariableOptionId: isCountryVariable ? null : optionId,
152
+ countryCode: isCountryVariable ? countryCode ?? newSelections[existingIndex].countryCode : null
143
153
  };
144
154
  }
145
155
  } else {
146
156
  // Add new selection
147
157
  newSelections.push({
148
158
  orderVariableId: variableId,
149
- orderVariableOptionId: optionId
159
+ orderVariableOptionId: optionId,
160
+ countryCode: countryCode
150
161
  });
151
162
  }
152
163
  onSelectionChange(newSelections);
@@ -160,15 +171,23 @@ function OrderVariableSelection(_ref3) {
160
171
  }, /*#__PURE__*/_react.default.createElement("h3", {
161
172
  className: "store-modal__order-variable-selection__title"
162
173
  }, label), variables.orderVariables.map(variable => {
174
+ var _variables$countries;
163
175
  const currentSelection = selections.find(s => s.orderVariableId === variable.id);
176
+
177
+ // Use description override if provided, otherwise use the variable's description
178
+ const effectiveVariable = (descriptionOverrides === null || descriptionOverrides === void 0 ? void 0 : descriptionOverrides[variable.id]) !== undefined ? {
179
+ ...variable,
180
+ description: descriptionOverrides[variable.id]
181
+ } : variable;
164
182
  return /*#__PURE__*/_react.default.createElement(Variable, {
165
183
  key: variable.id,
166
- variable: variable,
184
+ variable: effectiveVariable,
167
185
  selection: currentSelection,
168
- onToggle: (orderVariableId, orderVariableOptionId) => handleSelectionChange(orderVariableId, orderVariableOptionId !== undefined ? orderVariableOptionId : null)
186
+ countries: ((_variables$countries = variables.countries) === null || _variables$countries === void 0 ? void 0 : _variables$countries.filter(c => c !== null)) ?? null,
187
+ onToggle: (orderVariableId, orderVariableOptionId, countryCode) => handleSelectionChange(orderVariableId, orderVariableOptionId !== undefined ? orderVariableOptionId : null, countryCode)
169
188
  });
170
189
  }), ghostVariables.map(ghost => {
171
- var _ghost$orderVariableO, _ghost$orderVariableO2;
190
+ var _ghost$orderVariableO, _ghost$orderVariableO2, _variables$countries2;
172
191
  return /*#__PURE__*/_react.default.createElement(Variable, {
173
192
  key: ghost.orderVariable.id,
174
193
  variable: {
@@ -180,6 +199,7 @@ function OrderVariableSelection(_ref3) {
180
199
  orderVariableOptionId: ((_ghost$orderVariableO = ghost.orderVariableOption) === null || _ghost$orderVariableO === void 0 ? void 0 : _ghost$orderVariableO.id) ?? null,
181
200
  orderVariableOptionAmount: ((_ghost$orderVariableO2 = ghost.orderVariableOption) === null || _ghost$orderVariableO2 === void 0 ? void 0 : _ghost$orderVariableO2.amount) ?? null
182
201
  },
202
+ countries: ((_variables$countries2 = variables.countries) === null || _variables$countries2 === void 0 ? void 0 : _variables$countries2.filter(c => c !== null)) ?? null,
183
203
  ghost: true,
184
204
  onToggle: () => {} // Ghost variables don't toggle
185
205
  ,
@@ -27,7 +27,7 @@ const StoreModalCart = _ref => {
27
27
  let {
28
28
  prepared
29
29
  } = _ref;
30
- const data = (0, _reactRelay.usePreloadedQuery)((_StoreModalCartQuery2.default.hash && _StoreModalCartQuery2.default.hash !== "01df757f83a8740dcfa4ed706347ab35" && console.error("The definition of 'StoreModalCartQuery' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data."), _StoreModalCartQuery2.default), prepared.cartQuery);
30
+ const data = (0, _reactRelay.usePreloadedQuery)((_StoreModalCartQuery2.default.hash && _StoreModalCartQuery2.default.hash !== "cfbbbef5d65b35eacebf30617fe2538e" && console.error("The definition of 'StoreModalCartQuery' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data."), _StoreModalCartQuery2.default), prepared.cartQuery);
31
31
  const order = data.viewer.currentOrder;
32
32
  const orderHasItems = ((order === null || order === void 0 ? void 0 : (_order$orderItems = order.orderItems) === null || _order$orderItems === void 0 ? void 0 : _order$orderItems.length) ?? 0) > 0;
33
33
  const checkoutEnabled = (0, _utils.textVariablesAllHaveText)(order);
@@ -35,7 +35,7 @@ const StoreModalCart = _ref => {
35
35
  body: order && orderHasItems ? /*#__PURE__*/_react.default.createElement(_CartState.default, {
36
36
  order: order
37
37
  }, _ref2 => {
38
- var _order$orderItems2, _order$total;
38
+ var _data$viewer, _data$viewer$currentO, _data$viewer$currentO2, _order$orderItems2, _order$total, _data$viewer2, _data$viewer2$setting;
39
39
  let {
40
40
  onUpdateOrderVariableSelections,
41
41
  onRemoveDiscount,
@@ -45,10 +45,11 @@ const StoreModalCart = _ref => {
45
45
  return /*#__PURE__*/_react.default.createElement(_StoreModalCartLayout.default, {
46
46
  checkoutEnabled: checkoutEnabled
47
47
  }, {
48
- orderVariables: Boolean((order === null || order === void 0 ? void 0 : order.orderItems) && order.orderItems.length > 0) && /*#__PURE__*/_react.default.createElement(_StoreModalOrderVariableSelection.default, {
48
+ orderVariables: (_data$viewer = data.viewer) !== null && _data$viewer !== void 0 && (_data$viewer$currentO = _data$viewer.currentOrder) !== null && _data$viewer$currentO !== void 0 && (_data$viewer$currentO2 = _data$viewer$currentO.orderVariableSelections) !== null && _data$viewer$currentO2 !== void 0 && _data$viewer$currentO2.length ? /*#__PURE__*/_react.default.createElement(_StoreModalOrderVariableSelection.default, {
49
49
  viewer: data.viewer,
50
+ order: order,
50
51
  onSelectionChange: onUpdateOrderVariableSelections
51
- }),
52
+ }) : null,
52
53
  items: order === null || order === void 0 ? void 0 : (_order$orderItems2 = order.orderItems) === null || _order$orderItems2 === void 0 ? void 0 : _order$orderItems2.map((item, i) => {
53
54
  var _errors$orderItems;
54
55
  return /*#__PURE__*/_react.default.createElement(_CartItem.default, {
@@ -65,7 +66,8 @@ const StoreModalCart = _ref => {
65
66
  totals: /*#__PURE__*/_react.default.createElement(_CartTotals.default, {
66
67
  order: order,
67
68
  onRemoveDiscount: onRemoveDiscount,
68
- hideTotal: !order.billingIdentity
69
+ billingIdentity: order.billingIdentity,
70
+ taxSystem: (_data$viewer2 = data.viewer) === null || _data$viewer2 === void 0 ? void 0 : (_data$viewer2$setting = _data$viewer2.settings) === null || _data$viewer2$setting === void 0 ? void 0 : _data$viewer2$setting.taxSystem
69
71
  }),
70
72
  checkout: /*#__PURE__*/_react.default.createElement(_StripeProvider.default, {
71
73
  viewer: data.viewer,
@@ -73,7 +75,8 @@ const StoreModalCart = _ref => {
73
75
  }, /*#__PURE__*/_react.default.createElement(_StoreModalUnifiedCheckout.default, {
74
76
  viewer: data.viewer,
75
77
  order: order,
76
- onScrollToTop: () => {}
78
+ onScrollToTop: () => {},
79
+ onUpdateOrderVariableSelections: onUpdateOrderVariableSelections
77
80
  }))
78
81
  });
79
82
  }) : /*#__PURE__*/_react.default.createElement(_EmptyCart.default, null)
@@ -18,14 +18,14 @@ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return
18
18
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
19
19
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
20
20
  const StoreModalIndexItem = _ref => {
21
- var _data$featureStyle$fa, _data$featureStyle$fa2;
21
+ var _data$featureStyle$fa, _data$featureStyle, _data$featureStyle$fa2;
22
22
  let {
23
23
  collection
24
24
  } = _ref;
25
25
  const {
26
26
  storeModal: config
27
27
  } = (0, _react.useContext)(_ConfigContext.default);
28
- const data = (0, _reactRelay.useFragment)((_StoreModalIndexItem_fontCollection2.default.hash && _StoreModalIndexItem_fontCollection2.default.hash !== "3a41c729cade11bb541bc59a6b513d29" && console.error("The definition of 'StoreModalIndexItem_fontCollection' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data."), _StoreModalIndexItem_fontCollection2.default), collection);
28
+ const data = (0, _reactRelay.useFragment)((_StoreModalIndexItem_fontCollection2.default.hash && _StoreModalIndexItem_fontCollection2.default.hash !== "c066b135c6b830ef95bfc0d307e46791" && console.error("The definition of 'StoreModalIndexItem_fontCollection' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data."), _StoreModalIndexItem_fontCollection2.default), collection);
29
29
  const dispatch = (0, _reactRedux.useDispatch)();
30
30
  const handleClickProduct = productId => {
31
31
  dispatch({
@@ -57,7 +57,7 @@ const StoreModalIndexItem = _ref => {
57
57
  href: data.featureStyle.family.cssUrl
58
58
  }), /*#__PURE__*/_react.default.createElement(_FontStyle.default, {
59
59
  fontStyle: data.featureStyle
60
- }, "Aa")) : null),
60
+ }, (0, _utils.getFeatureGlyphs)((_data$featureStyle = data.featureStyle) === null || _data$featureStyle === void 0 ? void 0 : _data$featureStyle.supportedLanguages))) : null),
61
61
  name: config.indexLayout === 'styled-font-names' ? data.featureStyle && /*#__PURE__*/_react.default.createElement(_react.Fragment, null, ((_data$featureStyle$fa2 = data.featureStyle.family) === null || _data$featureStyle$fa2 === void 0 ? void 0 : _data$featureStyle$fa2.cssUrl) && /*#__PURE__*/_react.default.createElement(_Stylesheet.default, {
62
62
  href: data.featureStyle.family.cssUrl
63
63
  }), /*#__PURE__*/_react.default.createElement(_FontStyle.default, {
@@ -1,9 +1,11 @@
1
1
  import React from 'react';
2
2
  import { StoreModalOrderVariableSelection_viewer$key } from '__generated__/StoreModalOrderVariableSelection_viewer.graphql';
3
+ import { StoreModalOrderVariableSelection_order$key } from '__generated__/StoreModalOrderVariableSelection_order.graphql';
3
4
  import { OrderVariableSelectionInput } from '../OrderVariableSelection';
4
5
  interface StoreModalOrderVariableSelectionProps {
5
6
  viewer: StoreModalOrderVariableSelection_viewer$key;
7
+ order: StoreModalOrderVariableSelection_order$key;
6
8
  onSelectionChange: (selections: OrderVariableSelectionInput[]) => void;
7
9
  }
8
- export default function StoreModalOrderVariableSelection({ viewer: viewerKey, onSelectionChange, }: StoreModalOrderVariableSelectionProps): React.JSX.Element;
10
+ export default function StoreModalOrderVariableSelection({ viewer: viewerKey, order: orderKey, onSelectionChange, }: StoreModalOrderVariableSelectionProps): React.JSX.Element;
9
11
  export {};
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = StoreModalOrderVariableSelection;
7
+ var _StoreModalOrderVariableSelection_order2 = _interopRequireDefault(require("../../__generated__/StoreModalOrderVariableSelection_order.graphql"));
7
8
  var _StoreModalOrderVariableSelection_viewer2 = _interopRequireDefault(require("../../__generated__/StoreModalOrderVariableSelection_viewer.graphql"));
8
9
  var _react = _interopRequireWildcard(require("react"));
9
10
  var _reactRelay = require("react-relay");
@@ -12,26 +13,43 @@ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return
12
13
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
13
14
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
14
15
  function StoreModalOrderVariableSelection(_ref) {
15
- var _viewer$currentOrder, _viewer$currentOrder$, _viewer$orderVariable, _viewer$currentOrder2, _viewer$currentOrder3, _viewer$settings;
16
+ var _order$orderVariableS, _viewer$orderVariable, _order$orderVariableS2, _order$orderVariableS3, _viewer$settings;
16
17
  let {
17
18
  viewer: viewerKey,
19
+ order: orderKey,
18
20
  onSelectionChange
19
21
  } = _ref;
20
- const viewer = (0, _reactRelay.useFragment)((_StoreModalOrderVariableSelection_viewer2.default.hash && _StoreModalOrderVariableSelection_viewer2.default.hash !== "bdc0a78f68144b3270e1b8bf38f5d13f" && console.error("The definition of 'StoreModalOrderVariableSelection_viewer' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data."), _StoreModalOrderVariableSelection_viewer2.default), viewerKey);
22
+ const viewer = (0, _reactRelay.useFragment)((_StoreModalOrderVariableSelection_viewer2.default.hash && _StoreModalOrderVariableSelection_viewer2.default.hash !== "b959e46df4274deb8a53ef227787c34a" && console.error("The definition of 'StoreModalOrderVariableSelection_viewer' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data."), _StoreModalOrderVariableSelection_viewer2.default), viewerKey);
23
+ const order = (0, _reactRelay.useFragment)((_StoreModalOrderVariableSelection_order2.default.hash && _StoreModalOrderVariableSelection_order2.default.hash !== "85bc6b91bb3e9b7ee708f776acf670fd" && console.error("The definition of 'StoreModalOrderVariableSelection_order' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data."), _StoreModalOrderVariableSelection_order2.default), orderKey);
21
24
 
22
25
  // Transform order variable selections for the OrderVariableSelection component
23
- const selections = (_viewer$currentOrder = viewer.currentOrder) === null || _viewer$currentOrder === void 0 ? void 0 : (_viewer$currentOrder$ = _viewer$currentOrder.orderVariableSelections) === null || _viewer$currentOrder$ === void 0 ? void 0 : _viewer$currentOrder$.map(selection => {
26
+ const selections = (_order$orderVariableS = order.orderVariableSelections) === null || _order$orderVariableS === void 0 ? void 0 : _order$orderVariableS.map(selection => {
24
27
  var _selection$orderVaria, _selection$orderVaria2;
25
28
  return {
26
29
  orderVariableId: selection.orderVariable.id,
27
30
  orderVariableOptionId: ((_selection$orderVaria = selection.orderVariableOption) === null || _selection$orderVaria === void 0 ? void 0 : _selection$orderVaria.id) || null,
28
- orderVariableOptionAmount: ((_selection$orderVaria2 = selection.orderVariableOption) === null || _selection$orderVaria2 === void 0 ? void 0 : _selection$orderVaria2.amount) || null
31
+ orderVariableOptionAmount: ((_selection$orderVaria2 = selection.orderVariableOption) === null || _selection$orderVaria2 === void 0 ? void 0 : _selection$orderVaria2.amount) || null,
32
+ countryCode: selection.countryCode || null
29
33
  };
30
34
  });
31
35
  const orderVariableIds = new Set(((_viewer$orderVariable = viewer.orderVariables) === null || _viewer$orderVariable === void 0 ? void 0 : _viewer$orderVariable.map(variable => variable.id)) || []);
32
36
 
37
+ // Create a map of order variable ID to orderVariableDescription for active variables
38
+ const descriptionOverrides = ((_order$orderVariableS2 = order.orderVariableSelections) === null || _order$orderVariableS2 === void 0 ? void 0 : _order$orderVariableS2.reduce((acc, selection) => {
39
+ if (orderVariableIds.has(selection.orderVariable.id)) {
40
+ acc[selection.orderVariable.id] = selection.orderVariableDescription;
41
+ }
42
+ return acc;
43
+ }, {})) ?? {};
44
+
33
45
  // Find ghost variables (variables that exist in the order but not in the available list)
34
- const ghostVariables = ((_viewer$currentOrder2 = viewer.currentOrder) === null || _viewer$currentOrder2 === void 0 ? void 0 : (_viewer$currentOrder3 = _viewer$currentOrder2.orderVariableSelections) === null || _viewer$currentOrder3 === void 0 ? void 0 : _viewer$currentOrder3.filter(selection => !orderVariableIds.has(selection.orderVariable.id))) ?? [];
46
+ const ghostVariables = ((_order$orderVariableS3 = order.orderVariableSelections) === null || _order$orderVariableS3 === void 0 ? void 0 : _order$orderVariableS3.filter(selection => !orderVariableIds.has(selection.orderVariable.id)).map(selection => ({
47
+ orderVariable: {
48
+ ...selection.orderVariable,
49
+ description: selection.orderVariableDescription
50
+ },
51
+ orderVariableOption: selection.orderVariableOption
52
+ }))) ?? [];
35
53
 
36
54
  // Handle updating the order when selections change
37
55
  const handleSelectionChange = (0, _react.useCallback)(newSelections => {
@@ -67,7 +85,8 @@ function StoreModalOrderVariableSelection(_ref) {
67
85
  selections: selections ?? [],
68
86
  onSelectionChange: handleSelectionChange,
69
87
  ghostVariables: ghostVariables,
70
- onRemoveGhostVariable: handleRemoveGhostVariable
88
+ onRemoveGhostVariable: handleRemoveGhostVariable,
89
+ descriptionOverrides: descriptionOverrides
71
90
  }, {
72
91
  label: /*#__PURE__*/_react.default.createElement("div", {
73
92
  dangerouslySetInnerHTML: {
@@ -30,7 +30,7 @@ const StoreModalProduct = _ref => {
30
30
  } = _ref;
31
31
  const config = (0, _react.useContext)(_ConfigContext.default);
32
32
  const environment = (0, _reactRelay.useRelayEnvironment)();
33
- const initialData = (0, _reactRelay.usePreloadedQuery)((_StoreModalProductQuery2.default.hash && _StoreModalProductQuery2.default.hash !== "82a6352ac1eeaab3d25c315793f97a9c" && console.error("The definition of 'StoreModalProductQuery' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data."), _StoreModalProductQuery2.default), prepared.productQuery);
33
+ const initialData = (0, _reactRelay.usePreloadedQuery)((_StoreModalProductQuery2.default.hash && _StoreModalProductQuery2.default.hash !== "b2803257576691f16a283d10e53439e3" && console.error("The definition of 'StoreModalProductQuery' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data."), _StoreModalProductQuery2.default), prepared.productQuery);
34
34
  const [data, refetch] = (0, _reactRelay.useRefetchableFragment)((_StoreModalProductContent_collection2.default.hash && _StoreModalProductContent_collection2.default.hash !== "0684ec2633ccc5d4d0866e7780df28cc" && console.error("The definition of 'StoreModalProductContent_collection' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data."), _StoreModalProductContent_collection2.default), initialData.collection);
35
35
  const collection = data;
36
36
  const {
@@ -17,13 +17,6 @@ var _utils = require("../../utils");
17
17
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
18
18
  function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
19
19
  const THIN_SPACE = '\u2009';
20
- function getFeatureGlyphs(supportedLanguages) {
21
- if (supportedLanguages !== null && supportedLanguages !== void 0 && supportedLanguages.includes('en')) return 'Aa';
22
- if (supportedLanguages !== null && supportedLanguages !== void 0 && supportedLanguages.includes('ar')) return 'ت';
23
- if (supportedLanguages !== null && supportedLanguages !== void 0 && supportedLanguages.includes('gr')) return 'Αα';
24
- if (supportedLanguages !== null && supportedLanguages !== void 0 && supportedLanguages.includes('ru')) return 'Аа';
25
- return null;
26
- }
27
20
  function StoreModalStyleButton(_ref) {
28
21
  var _fontStyle$variableIn;
29
22
  let {
@@ -48,7 +41,7 @@ function StoreModalStyleButton(_ref) {
48
41
  }, isVariableFont ? (_fontStyle$variableIn = fontStyle.variableInstances) === null || _fontStyle$variableIn === void 0 ? void 0 : _fontStyle$variableIn.map((instance, i) => /*#__PURE__*/_react.default.createElement("span", {
49
42
  key: instance.name,
50
43
  style: (0, _utils.variableInstanceCSS)(instance)
51
- }, i !== 0 && THIN_SPACE, getFeatureGlyphs(fontStyle.supportedLanguages))) : getFeatureGlyphs(fontStyle.supportedLanguages)),
44
+ }, i !== 0 && THIN_SPACE, (0, _utils.getFeatureGlyphs)(fontStyle.supportedLanguages))) : (0, _utils.getFeatureGlyphs)(fontStyle.supportedLanguages)),
52
45
  // for variable fonts, only show the name of the style if there are
53
46
  // multiple styles
54
47
  name: isVariableFont ? fontStyle.sku ? fontStyle.name : undefined : fontStyle.name,
@@ -88,15 +88,16 @@ const StripeProvider = _ref => {
88
88
  fontWeightBold: '400',
89
89
  colorBackground: customProperties['--secondary_background_color'],
90
90
  colorText: customProperties['--primary_text_color'],
91
+ colorDanger: customProperties['--error_color'],
91
92
  colorBackgroundText: customProperties['--primary_text_color'],
92
93
  colorSuccessText: customProperties['--success_color'],
93
94
  colorDangerText: customProperties['--error_color'],
94
95
  colorTextPlaceholder: customProperties['--secondary_text_color'],
95
96
  focusBoxShadow: `0 0 0 1px ${customProperties['--primary_text_color']}`,
96
97
  fontSizeBase: '16px',
97
- fontSmooth: 'always',
98
+ fontSmooth: 'auto',
98
99
  gridRowSpacing: '30px',
99
- spacingUnit: '5px',
100
+ spacingUnit: '3px',
100
101
  accordionItemSpacing: '20px'
101
102
  },
102
103
  rules: {
@@ -153,7 +154,8 @@ const StripeProvider = _ref => {
153
154
  }
154
155
  },
155
156
  fonts: customFontSource ? [customFontSource] : undefined,
156
- clientSecret
157
+ clientSecret,
158
+ syncAddressCheckbox: 'none'
157
159
  };
158
160
  if (providerType === 'checkout') {
159
161
  return /*#__PURE__*/_react.default.createElement(_reactStripeJs.EmbeddedCheckoutProvider, {
@@ -48,9 +48,18 @@ function TypeTesterStyleSelectData(_ref) {
48
48
  variableSettings,
49
49
  includeVariableAxesOption
50
50
  } = _ref;
51
- const fontStyle = (0, _reactRelay.useFragment)((_TypeTesterStyleSelectData_fontStyle2.default.hash && _TypeTesterStyleSelectData_fontStyle2.default.hash !== "6d485f52ae538b13da3f1f924512299c" && console.error("The definition of 'TypeTesterStyleSelectData_fontStyle' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data."), _TypeTesterStyleSelectData_fontStyle2.default), fontStyleKey);
52
- const viewer = (0, _reactRelay.useFragment)((_TypeTesterStyleSelectData_viewer2.default.hash && _TypeTesterStyleSelectData_viewer2.default.hash !== "1358148ad95a34299279a025b991e467" && console.error("The definition of 'TypeTesterStyleSelectData_viewer' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data."), _TypeTesterStyleSelectData_viewer2.default), viewerKey);
53
- const familyData = viewer === null || viewer === void 0 ? void 0 : (_viewer$families = viewer.families) === null || _viewer$families === void 0 ? void 0 : (_viewer$families$edge = _viewer$families.edges) === null || _viewer$families$edge === void 0 ? void 0 : _viewer$families$edge.map(edge => edge.node).filter(_utils.notEmpty);
51
+ const fontStyle = (0, _reactRelay.useFragment)((_TypeTesterStyleSelectData_fontStyle2.default.hash && _TypeTesterStyleSelectData_fontStyle2.default.hash !== "187778816a910be9ab709431d1d818b3" && console.error("The definition of 'TypeTesterStyleSelectData_fontStyle' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data."), _TypeTesterStyleSelectData_fontStyle2.default), fontStyleKey);
52
+ const viewer = (0, _reactRelay.useFragment)((_TypeTesterStyleSelectData_viewer2.default.hash && _TypeTesterStyleSelectData_viewer2.default.hash !== "5e5834d9202f90bdde5a0a7db49e8639" && console.error("The definition of 'TypeTesterStyleSelectData_viewer' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data."), _TypeTesterStyleSelectData_viewer2.default), viewerKey);
53
+ const familyData = viewer === null || viewer === void 0 ? void 0 : (_viewer$families = viewer.families) === null || _viewer$families === void 0 ? void 0 : (_viewer$families$edge = _viewer$families.edges) === null || _viewer$families$edge === void 0 ? void 0 : _viewer$families$edge.map(edge => edge.node).filter(_utils.notEmpty).filter(family => {
54
+ var _family$featureStyle, _family$featureStyle$;
55
+ return (// make sure the family options' supportedLanguages intersect with the current selection's supportedLanuages.
56
+ // e.g. if the current font style only supports 'ar', only show families that include 'ar'
57
+ (_family$featureStyle = family.featureStyle) === null || _family$featureStyle === void 0 ? void 0 : (_family$featureStyle$ = _family$featureStyle.supportedLanguages) === null || _family$featureStyle$ === void 0 ? void 0 : _family$featureStyle$.some(lang => {
58
+ var _fontStyle$supportedL;
59
+ return (_fontStyle$supportedL = fontStyle.supportedLanguages) === null || _fontStyle$supportedL === void 0 ? void 0 : _fontStyle$supportedL.includes(lang);
60
+ })
61
+ );
62
+ });
54
63
  const handleSelectFamilyId = (0, _react.useCallback)(id => {
55
64
  const family = familyData && familyData.find(family => family.id === id);
56
65
  if (!family) return;
@@ -1,3 +1,61 @@
1
+ /**
2
+ * StoreModalUnifiedCheckout
3
+ *
4
+ * This component handles the checkout flow for orders, collecting customer information,
5
+ * billing/licensee details, and processing payment through Stripe.
6
+ *
7
+ * Key implementation details:
8
+ *
9
+ * 1. Auto-save billing identity (fontdue tax system only):
10
+ * - When using fontdue's tax system (not Stripe Tax), we need the billing address
11
+ * to calculate taxes before showing the final amount
12
+ * - The billing identity is auto-saved (with 500ms debounce) once the Stripe Address
13
+ * Element reports complete (name + address fields)
14
+ * - Email is a separate field (not part of Address Element), so auto-save may trigger
15
+ * before email is filled, which will cause backend validation errors to display
16
+ * - This ensures taxes are calculated and displayed before the user clicks Pay
17
+ * - On page reload, if billing identity already exists, billingAddressComplete starts
18
+ * as true to prevent re-triggering auto-save
19
+ *
20
+ * 2. Billing identity diff tracking:
21
+ * - We track differences between local state and saved backend data (billingIdentityDiff)
22
+ * - This determines isBillingIdentitySaved, which controls when payment can proceed
23
+ * - If the user edits any field after auto-save, it triggers another save cycle
24
+ * - All fields are normalized (null/undefined/empty string treated as equivalent)
25
+ *
26
+ * 3. Pay button validation:
27
+ * - The Pay button is always enabled (as long as EULA is checked) even if billing
28
+ * info isn't fully saved yet
29
+ * - This is intentional: we need to allow the user to click Pay so we can call
30
+ * elements.submit(), which triggers Stripe's validation and shows any validation
31
+ * errors inline in the Stripe UI elements
32
+ * - After Stripe validation passes, we check if billing identity is saved
33
+ * - If not saved, we show an error message above the Pay button asking them to
34
+ * complete billing information (validation errors should now be visible above)
35
+ *
36
+ * 4. Customer info pre-fill:
37
+ * - When customer submits their contact info, if billing name/email are empty,
38
+ * we pre-fill them from customer data as a convenience
39
+ *
40
+ * 5. Country mismatch handling (order snapshots):
41
+ * - When loading a hydrated order (e.g., from quote/snapshot), the order may have
42
+ * a country variable that differs from the user's detected country
43
+ * - In this case, we force licenseeIsBillingIdentity to false and always collect
44
+ * separate licensee information to ensure the licensee country matches the quote
45
+ * - This preserves pricing/availability from the original quote
46
+ *
47
+ * 6. Licensee country syncing:
48
+ * - When licensee country changes, it automatically updates any country-type order
49
+ * variables to maintain consistent pricing based on the selected country
50
+ *
51
+ * 7. Zero-order/coupon flow:
52
+ * - Orders with $0 total (due to coupons) bypass Stripe payment entirely
53
+ * - These use the completeOrder mutation instead of confirmPayment
54
+ *
55
+ * 8. Tax system variations:
56
+ * - Stripe Tax system: Uses embedded checkout, billing handled by Stripe
57
+ * - Fontdue tax system: Collects billing info directly, auto-saves for tax calculation
58
+ */
1
59
  import React from 'react';
2
60
  import { StoreModalUnifiedCheckout_viewer$key } from '__generated__/StoreModalUnifiedCheckout_viewer.graphql';
3
61
  import { StoreModalUnifiedCheckout_order$key } from '__generated__/StoreModalUnifiedCheckout_order.graphql';
@@ -5,6 +63,7 @@ interface Props {
5
63
  order: StoreModalUnifiedCheckout_order$key;
6
64
  viewer: StoreModalUnifiedCheckout_viewer$key;
7
65
  onScrollToTop: () => void;
66
+ onUpdateOrderVariableSelections: (selections: any[]) => void;
8
67
  }
9
- export default function StoreModalUnifiedCheckout({ order: orderKey, viewer: viewerKey, onScrollToTop, }: Props): React.JSX.Element;
68
+ export default function StoreModalUnifiedCheckout({ order: orderKey, viewer: viewerKey, onScrollToTop, onUpdateOrderVariableSelections, }: Props): React.JSX.Element;
10
69
  export {};