fontdue-js 2.17.0 → 2.17.2

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 (42) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/__generated__/CartStateUpdateMutation.graphql.d.ts +2 -2
  3. package/dist/__generated__/CartStateUpdateMutation.graphql.js +21 -7
  4. package/dist/__generated__/OrderVariableSelectionReduxRefetchQuery.graphql.d.ts +26 -0
  5. package/dist/__generated__/OrderVariableSelectionReduxRefetchQuery.graphql.js +154 -0
  6. package/dist/__generated__/OrderVariableSelectionRedux_viewer.graphql.d.ts +1 -1
  7. package/dist/__generated__/OrderVariableSelectionRedux_viewer.graphql.js +21 -5
  8. package/dist/__generated__/OrderVariableSelection_variables.graphql.d.ts +1 -1
  9. package/dist/__generated__/OrderVariableSelection_variables.graphql.js +12 -4
  10. package/dist/__generated__/StoreModalCartQuery.graphql.d.ts +1 -1
  11. package/dist/__generated__/StoreModalCartQuery.graphql.js +49 -39
  12. package/dist/__generated__/StoreModalOrderVariableSelectionHookQuery.graphql.d.ts +26 -0
  13. package/dist/__generated__/StoreModalOrderVariableSelectionRefetchQuery.graphql.d.ts +26 -0
  14. package/dist/__generated__/StoreModalOrderVariableSelection_order.graphql.d.ts +2 -2
  15. package/dist/__generated__/StoreModalOrderVariableSelection_order.graphql.js +12 -12
  16. package/dist/__generated__/StoreModalProductContent_viewer.graphql.d.ts +30 -0
  17. package/dist/__generated__/StoreModalProductQuery.graphql.d.ts +1 -1
  18. package/dist/__generated__/StoreModalProductQuery.graphql.js +69 -63
  19. package/dist/__generated__/StoreModalProductViewerRefetchQuery.graphql.d.ts +31 -0
  20. package/dist/__generated__/StoreModalUnifiedCheckoutUpdateCustomerMutation.graphql.d.ts +6 -1
  21. package/dist/__generated__/StoreModalUnifiedCheckoutUpdateCustomerMutation.graphql.js +37 -26
  22. package/dist/__generated__/TypeTesterStyleSelect_family.graphql.d.ts +33 -0
  23. package/dist/__generated__/TypeTesterStyleSelect_fontStyle.graphql.d.ts +27 -0
  24. package/dist/components/Cart/CartState.js +1 -1
  25. package/dist/components/Cart/CustomerFields.d.ts +5 -0
  26. package/dist/components/Cart/CustomerFields.js +11 -3
  27. package/dist/components/ConfigContext.d.ts +19 -4
  28. package/dist/components/ConfigContext.js +4 -1
  29. package/dist/components/OrderVariableSelection/OrderVariableSelectionRedux.js +10 -1
  30. package/dist/components/OrderVariableSelection/index.d.ts +2 -1
  31. package/dist/components/OrderVariableSelection/index.js +9 -2
  32. package/dist/components/Select/index.d.ts +1 -1
  33. package/dist/components/StoreModal/StoreModalOrderVariableSelection.js +19 -4
  34. package/dist/components/StoreModal/StoreModalProduct.js +1 -1
  35. package/dist/components/TypeTester/useFeaturesData.d.ts +3 -3
  36. package/dist/components/TypeTester/useTypeTesterStyler.d.ts +0 -1
  37. package/dist/components/elements/StoreModalUnifiedCheckout.js +16 -7
  38. package/dist/fontdue.css +1 -1
  39. package/dist/hooks.d.ts +0 -1
  40. package/dist/utils/interpolateOrderVariableDescription.d.ts +36 -0
  41. package/dist/utils/interpolateOrderVariableDescription.test.d.ts +1 -0
  42. package/package.json +2 -2
@@ -0,0 +1,33 @@
1
+ /**
2
+ * @generated SignedSource<<c403f125303de728d43378d9b51b1371>>
3
+ * @lightSyntaxTransform
4
+ * @nogrep
5
+ */
6
+ import { ReaderFragment } from 'relay-runtime';
7
+ import { FragmentRefs } from "relay-runtime";
8
+ export type TypeTesterStyleSelect_family$data = {
9
+ readonly fontStyles: ReadonlyArray<{
10
+ readonly cssStretch: string | null;
11
+ readonly cssStyle: string | null;
12
+ readonly cssWeight: string | null;
13
+ readonly id: string;
14
+ readonly name: string;
15
+ readonly variableInstances: ReadonlyArray<{
16
+ readonly coordinates: ReadonlyArray<{
17
+ readonly axis: string;
18
+ readonly value: number;
19
+ }>;
20
+ readonly name: string;
21
+ }> | null;
22
+ }>;
23
+ readonly id: string;
24
+ readonly isVariableFont: boolean;
25
+ readonly name: string;
26
+ readonly " $fragmentType": "TypeTesterStyleSelect_family";
27
+ };
28
+ export type TypeTesterStyleSelect_family$key = {
29
+ readonly " $data"?: TypeTesterStyleSelect_family$data;
30
+ readonly " $fragmentSpreads": FragmentRefs<"TypeTesterStyleSelect_family">;
31
+ };
32
+ declare const node: ReaderFragment;
33
+ export default node;
@@ -0,0 +1,27 @@
1
+ /**
2
+ * @generated SignedSource<<4ffbad962f1f9a595fef130ea7ed55f6>>
3
+ * @lightSyntaxTransform
4
+ * @nogrep
5
+ */
6
+ import { ReaderFragment } from 'relay-runtime';
7
+ import { FragmentRefs } from "relay-runtime";
8
+ export type TypeTesterStyleSelect_fontStyle$data = {
9
+ readonly cssStretch: string | null;
10
+ readonly cssStyle: string | null;
11
+ readonly cssWeight: string | null;
12
+ readonly id: string;
13
+ readonly variableInstances: ReadonlyArray<{
14
+ readonly coordinates: ReadonlyArray<{
15
+ readonly axis: string;
16
+ readonly value: number;
17
+ }>;
18
+ readonly name: string;
19
+ }> | null;
20
+ readonly " $fragmentType": "TypeTesterStyleSelect_fontStyle";
21
+ };
22
+ export type TypeTesterStyleSelect_fontStyle$key = {
23
+ readonly " $data"?: TypeTesterStyleSelect_fontStyle$data;
24
+ readonly " $fragmentSpreads": FragmentRefs<"TypeTesterStyleSelect_fontStyle">;
25
+ };
26
+ declare const node: ReaderFragment;
27
+ export default node;
@@ -10,7 +10,7 @@ var _CartStateUpdateMutation2 = _interopRequireDefault(require("../../__generate
10
10
  var _react = require("react");
11
11
  var _reactRelay = require("react-relay");
12
12
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
13
- const orderChangeMutation = (_CartStateUpdateMutation2.default.hash && _CartStateUpdateMutation2.default.hash !== "eaef5edfd81a204aa6b0c9bd579509ec" && console.error("The definition of 'CartStateUpdateMutation' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data."), _CartStateUpdateMutation2.default);
13
+ const orderChangeMutation = (_CartStateUpdateMutation2.default.hash && _CartStateUpdateMutation2.default.hash !== "07a639cd3bfbfa0d797f6b8380603859" && console.error("The definition of 'CartStateUpdateMutation' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data."), _CartStateUpdateMutation2.default);
14
14
  const removeDiscountMutation = (_CartStateRemoveDiscountMutation2.default.hash && _CartStateRemoveDiscountMutation2.default.hash !== "bdcfcd6638660e83a61555dcd1786886" && console.error("The definition of 'CartStateRemoveDiscountMutation' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data."), _CartStateRemoveDiscountMutation2.default);
15
15
  function CartState(_ref) {
16
16
  let {
@@ -5,6 +5,11 @@ interface CustomerFields_props {
5
5
  value: Customer;
6
6
  onChange: (value: Partial<Customer>) => void;
7
7
  optInLabel: string | null | undefined;
8
+ errors?: {
9
+ name?: ReadonlyArray<string | null> | null;
10
+ email?: ReadonlyArray<string | null> | null;
11
+ newsletterOptIn?: ReadonlyArray<string | null> | null;
12
+ } | null;
8
13
  }
9
14
  declare const CustomerFields: React.FC<CustomerFields_props>;
10
15
  export default CustomerFields;
@@ -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,11 +8,20 @@ interface FormConfig {
8
8
  interface StripeConfig {
9
9
  appearance?: Appearance;
10
10
  }
11
+ interface SegmentConfig {
12
+ writeKey?: string;
13
+ integrations?: Record<string, boolean>;
14
+ }
15
+ interface TrackingConfig {
16
+ enabled?: boolean;
17
+ segment?: SegmentConfig;
18
+ }
11
19
  export interface Config {
12
20
  form?: FormConfig;
13
21
  storeModal?: StoreModalConfig;
14
22
  typeTester?: TypeTesterConfig;
15
23
  stripe?: StripeConfig;
24
+ tracking?: TrackingConfig;
16
25
  }
17
26
  export declare const makeConfig: (config?: Config) => {
18
27
  typeTester: {
@@ -34,10 +43,10 @@ export declare const makeConfig: (config?: Config) => {
34
43
  buttonLabel: string;
35
44
  interactionStyle: "select" | "panel";
36
45
  columns: {
37
- features: (string | {
46
+ features: ({
38
47
  code: string;
39
48
  name: string;
40
- })[];
49
+ } | string)[];
41
50
  range: number;
42
51
  }[] | undefined;
43
52
  selectionStyle: "checkbox" | "bullet";
@@ -72,6 +81,9 @@ export declare const makeConfig: (config?: Config) => {
72
81
  stripe: {
73
82
  appearance: Appearance | null;
74
83
  };
84
+ tracking: {
85
+ enabled: boolean;
86
+ };
75
87
  };
76
88
  declare const _default: React.Context<{
77
89
  typeTester: {
@@ -93,10 +105,10 @@ declare const _default: React.Context<{
93
105
  buttonLabel: string;
94
106
  interactionStyle: "select" | "panel";
95
107
  columns: {
96
- features: (string | {
108
+ features: ({
97
109
  code: string;
98
110
  name: string;
99
- })[];
111
+ } | string)[];
100
112
  range: number;
101
113
  }[] | undefined;
102
114
  selectionStyle: "checkbox" | "bullet";
@@ -131,5 +143,8 @@ declare const _default: React.Context<{
131
143
  stripe: {
132
144
  appearance: Appearance | null;
133
145
  };
146
+ tracking: {
147
+ enabled: boolean;
148
+ };
134
149
  }>;
135
150
  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 !== "2856c16fbbcd6be41aaf1bd8a0f79409" && 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 => {
@@ -26,9 +26,10 @@ interface OrderVariableSelectionProps {
26
26
  disabled: boolean;
27
27
  ghostVariables?: GhostVariable[];
28
28
  onRemoveGhostVariable?: (orderVariableId: string) => void;
29
+ descriptionOverrides?: Record<string, string | null>;
29
30
  children: {
30
31
  label: React.ReactNode;
31
32
  };
32
33
  }
33
- 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;
34
35
  export {};
@@ -118,11 +118,12 @@ function OrderVariableSelection(_ref3) {
118
118
  disabled,
119
119
  ghostVariables = [],
120
120
  onRemoveGhostVariable,
121
+ descriptionOverrides,
121
122
  children: {
122
123
  label
123
124
  }
124
125
  } = _ref3;
125
- const variables = (0, _reactRelay.useFragment)((_OrderVariableSelection_variables2.default.hash && _OrderVariableSelection_variables2.default.hash !== "0bf7cc073cfd6f730927e57ddce09413" && 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);
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);
126
127
  const handleSelectionChange = (0, _react.useCallback)((variableId, optionId, countryCode) => {
127
128
  var _variables$orderVaria;
128
129
  // Update the selections with the new value
@@ -172,9 +173,15 @@ function OrderVariableSelection(_ref3) {
172
173
  }, label), variables.orderVariables.map(variable => {
173
174
  var _variables$countries;
174
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;
175
182
  return /*#__PURE__*/_react.default.createElement(Variable, {
176
183
  key: variable.id,
177
- variable: variable,
184
+ variable: effectiveVariable,
178
185
  selection: currentSelection,
179
186
  countries: ((_variables$countries = variables.countries) === null || _variables$countries === void 0 ? void 0 : _variables$countries.filter(c => c !== null)) ?? null,
180
187
  onToggle: (orderVariableId, orderVariableOptionId, countryCode) => handleSelectionChange(orderVariableId, orderVariableOptionId !== undefined ? orderVariableOptionId : null, countryCode)
@@ -8,5 +8,5 @@ interface Select_props {
8
8
  }[];
9
9
  }
10
10
  type SelectHTMLProps = React.DetailedHTMLProps<React.SelectHTMLAttributes<HTMLSelectElement>, HTMLSelectElement>;
11
- declare const Select: ({ options, value, nullText, ...rest }: Select_props & Omit<SelectHTMLProps, 'value'>) => React.JSX.Element;
11
+ declare const Select: ({ options, value, nullText, ...rest }: Select_props & Omit<SelectHTMLProps, "value">) => React.JSX.Element;
12
12
  export default Select;
@@ -13,14 +13,14 @@ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return
13
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; }
14
14
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
15
15
  function StoreModalOrderVariableSelection(_ref) {
16
- var _order$orderVariableS, _viewer$orderVariable, _order$orderVariableS2, _viewer$settings;
16
+ var _order$orderVariableS, _viewer$orderVariable, _order$orderVariableS2, _order$orderVariableS3, _viewer$settings;
17
17
  let {
18
18
  viewer: viewerKey,
19
19
  order: orderKey,
20
20
  onSelectionChange
21
21
  } = _ref;
22
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 !== "262ac9d359f03f24ea222258e17945a8" && 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);
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);
24
24
 
25
25
  // Transform order variable selections for the OrderVariableSelection component
26
26
  const selections = (_order$orderVariableS = order.orderVariableSelections) === null || _order$orderVariableS === void 0 ? void 0 : _order$orderVariableS.map(selection => {
@@ -34,8 +34,22 @@ function StoreModalOrderVariableSelection(_ref) {
34
34
  });
35
35
  const orderVariableIds = new Set(((_viewer$orderVariable = viewer.orderVariables) === null || _viewer$orderVariable === void 0 ? void 0 : _viewer$orderVariable.map(variable => variable.id)) || []);
36
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
+
37
45
  // Find ghost variables (variables that exist in the order but not in the available list)
38
- const ghostVariables = ((_order$orderVariableS2 = order.orderVariableSelections) === null || _order$orderVariableS2 === void 0 ? void 0 : _order$orderVariableS2.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
+ }))) ?? [];
39
53
 
40
54
  // Handle updating the order when selections change
41
55
  const handleSelectionChange = (0, _react.useCallback)(newSelections => {
@@ -71,7 +85,8 @@ function StoreModalOrderVariableSelection(_ref) {
71
85
  selections: selections ?? [],
72
86
  onSelectionChange: handleSelectionChange,
73
87
  ghostVariables: ghostVariables,
74
- onRemoveGhostVariable: handleRemoveGhostVariable
88
+ onRemoveGhostVariable: handleRemoveGhostVariable,
89
+ descriptionOverrides: descriptionOverrides
75
90
  }, {
76
91
  label: /*#__PURE__*/_react.default.createElement("div", {
77
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 {
@@ -7,11 +7,11 @@ declare const useFeaturesData: ({ fontStyle }: useFeatures_props) => {
7
7
  [feature: string]: string;
8
8
  };
9
9
  fontFeatures: {
10
- readonly stylisticSetNames: readonly {
10
+ readonly stylisticSetNames: ReadonlyArray<{
11
11
  readonly featureName: string;
12
12
  readonly humanName: string;
13
- }[];
14
- readonly supportedFeatures: readonly string[];
13
+ }>;
14
+ readonly supportedFeatures: ReadonlyArray<string>;
15
15
  };
16
16
  " $fragmentType": "useFeaturesData_fontStyle";
17
17
  };
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { EditorState } from 'draft-js';
3
2
  import { Alignment } from './types';
4
3
  import { VariableSettings } from '../../utils';
@@ -283,6 +283,7 @@ function StoreModalUnifiedCheckout(_ref2) {
283
283
  const environment = (0, _reactRelay.useRelayEnvironment)();
284
284
  const [error, setError] = (0, _react.useState)(null);
285
285
  const [errorsObject, setErrorsObject] = (0, _react.useState)(null);
286
+ const [customerErrorsObject, setCustomerErrorsObject] = (0, _react.useState)(null);
286
287
  const [_submitting, setSubmitting] = (0, _react.useState)(false);
287
288
  /* const [licenseeRequiredFields, setLicenseeRequiredFields] = useState<
288
289
  * (keyof Identity)[]
@@ -292,11 +293,15 @@ function StoreModalUnifiedCheckout(_ref2) {
292
293
  form: config
293
294
  } = (0, _react.useContext)(_ConfigContext.default);
294
295
  const onCompleted = (res, errors, onSuccess, onError) => {
295
- var _res$updateOrder;
296
+ var _res$updateCustomer, _res$updateOrder;
296
297
  if (errors && errors.length > 0) {
297
298
  setError(errors[0].message);
298
299
  setSubmitting(false);
299
300
  onError === null || onError === void 0 ? void 0 : onError();
301
+ } else if ('updateCustomer' in res && (_res$updateCustomer = res.updateCustomer) !== null && _res$updateCustomer !== void 0 && _res$updateCustomer.errors && (res.updateCustomer.errors.name || res.updateCustomer.errors.email || res.updateCustomer.errors.newsletterOptIn)) {
302
+ setSubmitting(false);
303
+ setCustomerErrorsObject(res.updateCustomer.errors);
304
+ onError === null || onError === void 0 ? void 0 : onError();
300
305
  } else if ('updateOrder' in res && (_res$updateOrder = res.updateOrder) !== null && _res$updateOrder !== void 0 && _res$updateOrder.errors) {
301
306
  setSubmitting(false);
302
307
  setErrorsObject(res.updateOrder.errors);
@@ -305,17 +310,19 @@ function StoreModalUnifiedCheckout(_ref2) {
305
310
  onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess();
306
311
  setSubmitting(false);
307
312
  setError(null);
313
+ setCustomerErrorsObject(null);
314
+ setErrorsObject(null);
308
315
  }
309
316
  };
310
317
  const onError = error => {
311
318
  setError(error.message);
312
319
  setSubmitting(false);
313
320
  };
314
- const updateCustomer = (0, _react.useCallback)((variables, onSuccess) => {
321
+ const updateCustomer = (0, _react.useCallback)((variables, onSuccess, onErrorCallback) => {
315
322
  (0, _reactRelay.commitMutation)(environment, {
316
- mutation: (_StoreModalUnifiedCheckoutUpdateCustomerMutation2.default.hash && _StoreModalUnifiedCheckoutUpdateCustomerMutation2.default.hash !== "1927e9fb21dbae898062200a560b1277" && console.error("The definition of 'StoreModalUnifiedCheckoutUpdateCustomerMutation' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data."), _StoreModalUnifiedCheckoutUpdateCustomerMutation2.default),
323
+ mutation: (_StoreModalUnifiedCheckoutUpdateCustomerMutation2.default.hash && _StoreModalUnifiedCheckoutUpdateCustomerMutation2.default.hash !== "a41e423a93ba20f15ebbe826dd802514" && console.error("The definition of 'StoreModalUnifiedCheckoutUpdateCustomerMutation' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data."), _StoreModalUnifiedCheckoutUpdateCustomerMutation2.default),
317
324
  variables,
318
- onCompleted: (res, errors) => onCompleted(res, errors, onSuccess),
325
+ onCompleted: (res, errors) => onCompleted(res, errors, onSuccess, onErrorCallback),
319
326
  onError
320
327
  });
321
328
  }, [environment]);
@@ -397,7 +404,8 @@ function StoreModalUnifiedCheckout(_ref2) {
397
404
  const [editing, setEditing] = (0, _react.useState)(initialEditingState);
398
405
  const handleCustomerSubmit = _ref3 => {
399
406
  let {
400
- onSuccess
407
+ onSuccess,
408
+ onError
401
409
  } = _ref3;
402
410
  if (!billingIdentity.name && !billingIdentity.email) {
403
411
  setBillingIdentity({
@@ -411,7 +419,7 @@ function StoreModalUnifiedCheckout(_ref2) {
411
419
  }, () => {
412
420
  onSuccess();
413
421
  setEditing(null);
414
- });
422
+ }, onError);
415
423
  };
416
424
  const handleLicenseeIsBillingIdentityChange = (0, _react.useCallback)(value => {
417
425
  updateOrder({
@@ -605,7 +613,8 @@ function StoreModalUnifiedCheckout(_ref2) {
605
613
  }, "Contact information"), /*#__PURE__*/_react.default.createElement(_CustomerFields.default, {
606
614
  value: customer,
607
615
  onChange: handleCustomerChange,
608
- optInLabel: (_viewer$settings = viewer.settings) === null || _viewer$settings === void 0 ? void 0 : _viewer$settings.newsletterOptInLabel
616
+ optInLabel: (_viewer$settings = viewer.settings) === null || _viewer$settings === void 0 ? void 0 : _viewer$settings.newsletterOptInLabel,
617
+ errors: customerErrorsObject
609
618
  }))
610
619
  }), order.customer && !hasCountryMismatch ? /*#__PURE__*/_react.default.createElement(_StoreModalLicenseeIsBillingIdentityElement.default, {
611
620
  disabled: false,
package/dist/fontdue.css CHANGED
@@ -1344,7 +1344,7 @@ body[data-fontdue-store-modal=open] {
1344
1344
  max-width: 1600px;
1345
1345
  }
1346
1346
  [data-route=checkout] .store-modal__container__container {
1347
- max-width: 1200px;
1347
+ max-width: 992px;
1348
1348
  }
1349
1349
  }
1350
1350
  .store-modal__container__container * {
package/dist/hooks.d.ts CHANGED
@@ -1,2 +1 @@
1
- /// <reference types="react" />
2
1
  export declare const useNewPortalElement: () => import("react").RefObject<HTMLDivElement>;
@@ -0,0 +1,36 @@
1
+ interface OrderVariable {
2
+ variableType: string;
3
+ multiplier: string;
4
+ orderVariableOptions?: ReadonlyArray<{
5
+ readonly id: string;
6
+ readonly amount: string | null;
7
+ readonly multiplier: string | null;
8
+ }> | null;
9
+ }
10
+ interface Selection {
11
+ orderVariableOptionId?: string | null;
12
+ countryCode?: string | null;
13
+ }
14
+ interface Country {
15
+ readonly code: string;
16
+ readonly name: string;
17
+ }
18
+ interface InterpolateOptions {
19
+ variable: OrderVariable;
20
+ selection?: Selection;
21
+ countries?: ReadonlyArray<Country> | null;
22
+ }
23
+ /**
24
+ * Interpolates placeholders in an order variable description template.
25
+ *
26
+ * Supported placeholders:
27
+ * - {selection} - the selected option amount (for select) or country name (for country)
28
+ * - {percentage} - formatted multiplier as percentage (e.g., "+15.4%", "-25%")
29
+ * - {multiplier} - raw multiplier value (e.g., "1.154", "0.75")
30
+ *
31
+ * @param template - The description template with placeholders
32
+ * @param options - Variable, selection, and countries data
33
+ * @returns Interpolated description string, or null if selection data is incomplete
34
+ */
35
+ export declare function interpolateOrderVariableDescription(template: string, options: InterpolateOptions): string | null;
36
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fontdue-js",
3
- "version": "2.17.0",
3
+ "version": "2.17.2",
4
4
  "scripts": {
5
5
  "build": "npm run relay && run-p build-js build-css build-ts",
6
6
  "build-js": "babel src --out-dir dist --extensions .ts,.tsx,.js,.jsx",
@@ -58,7 +58,7 @@
58
58
  "react-dom": "^19.0.0",
59
59
  "relay-compiler": "^18.0.0",
60
60
  "sass": "^1.62",
61
- "typescript": "5.1.3"
61
+ "typescript": "^5.9"
62
62
  },
63
63
  "relay": {
64
64
  "src": "./src",