fontdue-js 2.18.3 → 2.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +15 -0
- package/dist/__generated__/AddToCartBannerQuery.graphql.d.ts +1 -1
- package/dist/__generated__/AddToCartBannerQuery.graphql.js +22 -7
- package/dist/__generated__/AddToCartBanner_item.graphql.d.ts +10 -1
- package/dist/__generated__/AddToCartBanner_item.graphql.js +19 -4
- package/dist/__generated__/AddToCartBanner_order.graphql.d.ts +10 -1
- package/dist/__generated__/AddToCartBanner_order.graphql.js +18 -3
- package/dist/__generated__/CartItemProduct_product.graphql.d.ts +4 -1
- package/dist/__generated__/CartItemProduct_product.graphql.js +15 -5
- package/dist/__generated__/CartOrderCompleteOrderMutation.graphql.d.ts +1 -1
- package/dist/__generated__/CartOrderCompleteOrderMutation.graphql.js +27 -5
- package/dist/__generated__/CartOrderRemoveDiscountMutation.graphql.d.ts +1 -1
- package/dist/__generated__/CartOrderRemoveDiscountMutation.graphql.js +27 -5
- package/dist/__generated__/CartOrderUpdateMutation.graphql.d.ts +1 -1
- package/dist/__generated__/CartOrderUpdateMutation.graphql.js +27 -5
- package/dist/__generated__/CartQuery.graphql.d.ts +1 -1
- package/dist/__generated__/CartQuery.graphql.js +72 -49
- package/dist/__generated__/CartStateRemoveDiscountMutation.graphql.d.ts +1 -1
- package/dist/__generated__/CartStateRemoveDiscountMutation.graphql.js +15 -3
- package/dist/__generated__/CartStateUpdateMutation.graphql.d.ts +1 -1
- package/dist/__generated__/CartStateUpdateMutation.graphql.js +27 -5
- package/dist/__generated__/CartTotals_order.graphql.d.ts +3 -1
- package/dist/__generated__/CartTotals_order.graphql.js +14 -2
- package/dist/__generated__/CheckoutUpdateCustomerMutation.graphql.d.ts +1 -1
- package/dist/__generated__/CheckoutUpdateCustomerMutation.graphql.js +27 -5
- package/dist/__generated__/CheckoutUpdateOrderMutation.graphql.d.ts +1 -1
- package/dist/__generated__/CheckoutUpdateOrderMutation.graphql.js +27 -5
- package/dist/__generated__/CouponCodeInputApplyCouponMutation.graphql.d.ts +1 -1
- package/dist/__generated__/CouponCodeInputApplyCouponMutation.graphql.js +15 -3
- package/dist/__generated__/CustomerLoginFormQuery.graphql.d.ts +20 -0
- package/dist/__generated__/CustomerLoginFormQuery.graphql.js +91 -0
- package/dist/__generated__/PrecartAddToCartMutation.graphql.d.ts +1 -1
- package/dist/__generated__/PrecartAddToCartMutation.graphql.js +32 -10
- package/dist/__generated__/PrecartClearCartMutation.graphql.d.ts +61 -0
- package/dist/__generated__/PrecartClearCartMutation.graphql.js +81 -0
- package/dist/__generated__/StoreModalCartQuery.graphql.d.ts +1 -1
- package/dist/__generated__/StoreModalCartQuery.graphql.js +67 -44
- package/dist/__generated__/StoreModalCheckoutQuery.graphql.d.ts +1 -1
- package/dist/__generated__/StoreModalCheckoutQuery.graphql.js +18 -17
- package/dist/__generated__/StoreModalFamily_collection.graphql.d.ts +2 -1
- package/dist/__generated__/StoreModalFamily_collection.graphql.js +9 -3
- package/dist/__generated__/StoreModalProductQuery.graphql.d.ts +1 -1
- package/dist/__generated__/StoreModalProductQuery.graphql.js +10 -4
- package/dist/__generated__/StoreModalProductRefetchQuery.graphql.d.ts +1 -1
- package/dist/__generated__/StoreModalProductRefetchQuery.graphql.js +10 -4
- package/dist/__generated__/StoreModalProductSummaryClearCartMutation.graphql.d.ts +61 -0
- package/dist/__generated__/StoreModalProductSummaryClearCartMutation.graphql.js +81 -0
- package/dist/__generated__/StoreModalUnifiedCheckoutUpdateOrderMutation.graphql.d.ts +1 -1
- package/dist/__generated__/StoreModalUnifiedCheckoutUpdateOrderMutation.graphql.js +15 -3
- package/dist/__generated__/StripeProvider_viewer.graphql.d.ts +2 -1
- package/dist/__generated__/StripeProvider_viewer.graphql.js +78 -75
- package/dist/__generated__/TestFontsFormUpdateCustomerMutation.graphql.d.ts +1 -1
- package/dist/__generated__/TestFontsFormUpdateCustomerMutation.graphql.js +27 -5
- package/dist/components/AddToCartBanner/index.js +7 -1
- package/dist/components/Cart/CartItem/CartItemProduct.js +3 -2
- package/dist/components/Cart/CartTotals.js +7 -7
- package/dist/components/CharacterViewer/index.js +53 -37
- package/dist/components/ConfigContext.d.ts +10 -0
- package/dist/components/ConfigContext.js +7 -2
- package/dist/components/CorsErrorModal.d.ts +1 -0
- package/dist/components/CorsErrorModal.js +99 -0
- package/dist/components/CustomerLoginForm/index.js +12 -4
- package/dist/components/OrderVariableSelection/OrderVariableSelectionRedux.js +2 -1
- package/dist/components/Precart/index.js +30 -4
- package/dist/components/StoreModal/StoreModalFamily.js +2 -2
- package/dist/components/StoreModalProductSummary/index.js +35 -4
- package/dist/components/StripeProvider/index.js +5 -4
- package/dist/components/TypeTester/index.d.ts +5 -0
- package/dist/components/TypeTester/index.js +2 -1
- package/dist/components/TypeTester/useTypeTesterStyler.d.ts +7 -1
- package/dist/components/TypeTester/useTypeTesterStyler.js +8 -2
- package/dist/corsError.d.ts +5 -0
- package/dist/corsError.js +55 -0
- package/dist/fontdue.css +61 -3
- package/dist/relay/environment.js +33 -19
- package/fontdue.css +197 -121
- package/package.json +1 -1
|
@@ -21,10 +21,16 @@ const getOrderItemName = item => {
|
|
|
21
21
|
var _product$family;
|
|
22
22
|
return `${(_product$family = product.family) === null || _product$family === void 0 ? void 0 : _product$family.name} ${product.name}`;
|
|
23
23
|
}
|
|
24
|
+
if (product.__typename === 'Bundle' || product.__typename === 'CollectionBundle') {
|
|
25
|
+
var _product$fontCollecti;
|
|
26
|
+
const familyName = (_product$fontCollecti = product.fontCollection) === null || _product$fontCollecti === void 0 ? void 0 : _product$fontCollecti.name;
|
|
27
|
+
if (familyName && !product.name.startsWith(familyName)) return `${familyName} ${product.name}`;
|
|
28
|
+
return product.name;
|
|
29
|
+
}
|
|
24
30
|
if ('name' in product) return product.name;
|
|
25
31
|
return null;
|
|
26
32
|
};
|
|
27
|
-
_AddToCartBanner_item2.default.hash && _AddToCartBanner_item2.default.hash !== "
|
|
33
|
+
_AddToCartBanner_item2.default.hash && _AddToCartBanner_item2.default.hash !== "93905c08206c30255368dbb06f59ccec" && console.error("The definition of 'AddToCartBanner_item' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data."), _AddToCartBanner_item2.default;
|
|
28
34
|
function AddToCartBanner(_ref) {
|
|
29
35
|
var _order$orderItems, _order$orderItems2;
|
|
30
36
|
let {
|
|
@@ -13,16 +13,17 @@ var _reactRelay = require("react-relay");
|
|
|
13
13
|
var _utils = require("../../../utils");
|
|
14
14
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
15
15
|
function CartItemProduct(_ref) {
|
|
16
|
-
var _product$family, _product$featureStyle, _product$featureStyle2, _product$variableInst;
|
|
16
|
+
var _product$family, _product$featureStyle, _product$featureStyle2, _product$name, _product$variableInst;
|
|
17
17
|
let {
|
|
18
18
|
product: productKey
|
|
19
19
|
} = _ref;
|
|
20
|
-
const product = (0, _reactRelay.useFragment)((_CartItemProduct_product2.default.hash && _CartItemProduct_product2.default.hash !== "
|
|
20
|
+
const product = (0, _reactRelay.useFragment)((_CartItemProduct_product2.default.hash && _CartItemProduct_product2.default.hash !== "b28cd421e634ecb1162252d953233456" && console.error("The definition of 'CartItemProduct_product' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data."), _CartItemProduct_product2.default), productKey);
|
|
21
21
|
let productCss;
|
|
22
22
|
if ((product === null || product === void 0 ? void 0 : product.__typename) === 'FontStyle') productCss = (_product$family = product.family) === null || _product$family === void 0 ? void 0 : _product$family.cssUrl;
|
|
23
23
|
if ((product === null || product === void 0 ? void 0 : product.__typename) === 'FontCollection') productCss = (_product$featureStyle = product.featureStyle) === null || _product$featureStyle === void 0 ? void 0 : (_product$featureStyle2 = _product$featureStyle.family) === null || _product$featureStyle2 === void 0 ? void 0 : _product$featureStyle2.cssUrl;
|
|
24
24
|
let productName = (product === null || product === void 0 ? void 0 : product.name) ?? '??';
|
|
25
25
|
if ((product === null || product === void 0 ? void 0 : product.__typename) === 'FontStyle' && product.family) productName = `${product.family.name} ${product.name}`;
|
|
26
|
+
if (((product === null || product === void 0 ? void 0 : product.__typename) === 'Bundle' || (product === null || product === void 0 ? void 0 : product.__typename) === 'CollectionBundle') && product.fontCollection && !((_product$name = product.name) !== null && _product$name !== void 0 && _product$name.startsWith(product.fontCollection.name))) productName = `${product.fontCollection.name} ${product.name}`;
|
|
26
27
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
27
28
|
className: "cart-item__aa"
|
|
28
29
|
}, product ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_Stylesheet.default, {
|
|
@@ -45,7 +45,7 @@ function CartTotals(_ref2) {
|
|
|
45
45
|
billingIdentity,
|
|
46
46
|
taxSystem
|
|
47
47
|
} = _ref2;
|
|
48
|
-
const order = (0, _reactRelay.useFragment)((_CartTotals_order2.default.hash && _CartTotals_order2.default.hash !== "
|
|
48
|
+
const order = (0, _reactRelay.useFragment)((_CartTotals_order2.default.hash && _CartTotals_order2.default.hash !== "aee2e882d4d0d063fd4eaf6cb43485db" && console.error("The definition of 'CartTotals_order' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data."), _CartTotals_order2.default), orderKey);
|
|
49
49
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
50
50
|
className: "cart__price-blocks",
|
|
51
51
|
"data-has-discount": Boolean(order.discount)
|
|
@@ -73,20 +73,20 @@ function CartTotals(_ref2) {
|
|
|
73
73
|
label: "Discounted subtotal",
|
|
74
74
|
price: order.discountedSubtotal,
|
|
75
75
|
"data-line": "discounted-subtotal"
|
|
76
|
-
})), /*#__PURE__*/_react.default.createElement("div", {
|
|
76
|
+
})), taxSystem !== 'none' && /*#__PURE__*/_react.default.createElement("div", {
|
|
77
77
|
className: "cart__price-block",
|
|
78
78
|
"data-line": "taxes"
|
|
79
79
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
80
80
|
className: "cart__price-block__label"
|
|
81
|
-
}, order.
|
|
81
|
+
}, order.taxNotApplicable ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, order.taxName ?? 'VAT', " not applicable", order.taxNotApplicableReason && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("br", null), /*#__PURE__*/_react.default.createElement("span", {
|
|
82
|
+
className: "cart__price-block__placeholder"
|
|
83
|
+
}, order.taxNotApplicableReason))) : order.taxes && order.taxName ? `${order.taxName} (${percentage(order.taxRate)})` : 'Tax'), /*#__PURE__*/_react.default.createElement("div", {
|
|
82
84
|
className: "cart__price-block__price"
|
|
83
85
|
}, order.taxes ? /*#__PURE__*/_react.default.createElement(_Price.default, {
|
|
84
86
|
price: order.taxes
|
|
85
|
-
}) : taxSystem === 'stripe' ? /*#__PURE__*/_react.default.createElement("span", {
|
|
86
|
-
className: "cart__price-block__placeholder"
|
|
87
|
-
}, "Calculated at checkout") : taxSystem === 'fontdue' && !billingIdentity ? /*#__PURE__*/_react.default.createElement("span", {
|
|
87
|
+
}) : taxSystem === 'stripe' || taxSystem === 'fontdue' && !billingIdentity ? /*#__PURE__*/_react.default.createElement("span", {
|
|
88
88
|
className: "cart__price-block__placeholder"
|
|
89
|
-
}, "
|
|
89
|
+
}, "Calculated at checkout") : '-')), /*#__PURE__*/_react.default.createElement("div", {
|
|
90
90
|
className: "cart__price-block",
|
|
91
91
|
"data-line": "total"
|
|
92
92
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -246,42 +246,50 @@ function CharacterViewerComponent(_ref3) {
|
|
|
246
246
|
width: monitorWidth
|
|
247
247
|
} = useSize();
|
|
248
248
|
if (!fontStyle) return null;
|
|
249
|
-
const
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
},
|
|
249
|
+
const {
|
|
250
|
+
ascender,
|
|
251
|
+
descender,
|
|
252
|
+
capHeight,
|
|
253
|
+
xHeight,
|
|
254
|
+
lineGap,
|
|
255
|
+
unitsPerEm
|
|
256
|
+
} = fontStyle.verticalMetrics;
|
|
257
|
+
const halfGap = (lineGap ?? 0) / 2;
|
|
258
|
+
const pos = offset => ascender + halfGap - offset;
|
|
259
|
+
|
|
260
|
+
// Lines in priority order — lower-priority lines hidden when overlapping higher ones.
|
|
261
|
+
// Threshold: ~18px (label height) converted to font units via current scale.
|
|
262
|
+
const scale = monitorWidth ? monitorWidth / 2 / unitsPerEm : 0;
|
|
263
|
+
const threshold = scale > 0 ? 18 / scale : 0;
|
|
264
|
+
const lines = [{
|
|
265
|
+
name: 'baseline',
|
|
266
|
+
position: pos(0),
|
|
267
|
+
label: 'Baseline',
|
|
268
|
+
value: 0
|
|
269
|
+
}, capHeight != null && {
|
|
270
|
+
name: 'cap-height',
|
|
271
|
+
position: pos(capHeight),
|
|
272
|
+
label: 'Cap height',
|
|
273
|
+
value: capHeight
|
|
274
|
+
}, xHeight != null && {
|
|
275
|
+
name: 'x-height',
|
|
276
|
+
position: pos(xHeight),
|
|
277
|
+
label: 'x-Height',
|
|
278
|
+
value: xHeight
|
|
279
|
+
}, {
|
|
280
|
+
name: 'ascender',
|
|
281
|
+
position: pos(ascender),
|
|
282
|
+
label: 'Ascender',
|
|
283
|
+
value: ascender
|
|
284
|
+
}, {
|
|
285
|
+
name: 'descender',
|
|
286
|
+
position: pos(descender),
|
|
287
|
+
label: 'Descender',
|
|
288
|
+
value: descender
|
|
289
|
+
}].filter(line => Boolean(line)).reduce((visible, line) =>
|
|
290
|
+
// Skip this line if it's within the threshold of any already-accepted
|
|
291
|
+
// higher-priority line — otherwise accept it
|
|
292
|
+
threshold > 0 && visible.some(v => Math.abs(v.position - line.position) < threshold) ? visible : [...visible, line], []);
|
|
285
293
|
const groups = (0, _react.useMemo)(() => {
|
|
286
294
|
var _collection$glyphGrou;
|
|
287
295
|
return (_collection$glyphGrou = collection.glyphGroups) === null || _collection$glyphGrou === void 0 ? void 0 : _collection$glyphGrou.map(_ref5 => {
|
|
@@ -336,7 +344,15 @@ function CharacterViewerComponent(_ref3) {
|
|
|
336
344
|
fontFeatureSettings: visibleGlyph.features && featuresChecked ? `${visibleGlyph.features.map(feature => `'${feature}' 1`).join(', ')}` : `'calt' off, 'liga' off`
|
|
337
345
|
},
|
|
338
346
|
ref: monitorRef
|
|
339
|
-
}, /*#__PURE__*/_react.default.createElement("span", null, visibleGlyph.string)), lines
|
|
347
|
+
}, /*#__PURE__*/_react.default.createElement("span", null, visibleGlyph.string)), lines.map(line => /*#__PURE__*/_react.default.createElement("div", {
|
|
348
|
+
className: "character-viewer__monitor__line",
|
|
349
|
+
"data-name": line.name,
|
|
350
|
+
key: line.name
|
|
351
|
+
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
352
|
+
className: "character-viewer__monitor__line__label"
|
|
353
|
+
}, line.label), /*#__PURE__*/_react.default.createElement("span", {
|
|
354
|
+
className: "character-viewer__monitor__line__value"
|
|
355
|
+
}, line.value)))), /*#__PURE__*/_react.default.createElement("div", {
|
|
340
356
|
className: "character-viewer__monitor__details"
|
|
341
357
|
}, /*#__PURE__*/_react.default.createElement("span", null, "Font style"), /*#__PURE__*/_react.default.createElement("span", null, /*#__PURE__*/_react.default.createElement(_StyleSelect.default, {
|
|
342
358
|
collections: families,
|
|
@@ -69,6 +69,11 @@ export declare const makeConfig: (config?: Config) => {
|
|
|
69
69
|
min: number;
|
|
70
70
|
max: number;
|
|
71
71
|
} | undefined;
|
|
72
|
+
columns: false | {
|
|
73
|
+
count: number | "auto";
|
|
74
|
+
width: string;
|
|
75
|
+
gap: string;
|
|
76
|
+
};
|
|
72
77
|
};
|
|
73
78
|
form: {
|
|
74
79
|
checkboxStyle: "check" | "cross";
|
|
@@ -131,6 +136,11 @@ declare const _default: React.Context<{
|
|
|
131
136
|
min: number;
|
|
132
137
|
max: number;
|
|
133
138
|
} | undefined;
|
|
139
|
+
columns: false | {
|
|
140
|
+
count: number | "auto";
|
|
141
|
+
width: string;
|
|
142
|
+
gap: string;
|
|
143
|
+
};
|
|
134
144
|
};
|
|
135
145
|
form: {
|
|
136
146
|
checkboxStyle: "check" | "cross";
|
|
@@ -7,7 +7,7 @@ exports.makeConfig = exports.default = void 0;
|
|
|
7
7
|
var _react = _interopRequireDefault(require("react"));
|
|
8
8
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
9
|
const makeTypeTesterConfig = config => {
|
|
10
|
-
var _config$openTypeFeatu, _config$openTypeFeatu2, _config$openTypeFeatu3, _config$openTypeFeatu4, _config$size, _config$size2, _config$size3, _config$lineHeight, _config$lineHeight2, _config$lineHeight3, _config$letterSpacing, _config$letterSpacing2, _config$letterSpacing3;
|
|
10
|
+
var _config$openTypeFeatu, _config$openTypeFeatu2, _config$openTypeFeatu3, _config$openTypeFeatu4, _config$size, _config$size2, _config$size3, _config$lineHeight, _config$lineHeight2, _config$lineHeight3, _config$letterSpacing, _config$letterSpacing2, _config$letterSpacing3, _config$columns, _config$columns2, _config$columns3;
|
|
11
11
|
let shy = (config === null || config === void 0 ? void 0 : config.shy) ?? false;
|
|
12
12
|
if (shy === true) shy = 'hover';
|
|
13
13
|
let toolsPosition = (config === null || config === void 0 ? void 0 : config.toolsPosition) ?? 'inline';
|
|
@@ -50,7 +50,12 @@ const makeTypeTesterConfig = config => {
|
|
|
50
50
|
label: (config === null || config === void 0 ? void 0 : (_config$letterSpacing = config.letterSpacing) === null || _config$letterSpacing === void 0 ? void 0 : _config$letterSpacing.label) ?? 'Letter spacing',
|
|
51
51
|
min: (config === null || config === void 0 ? void 0 : (_config$letterSpacing2 = config.letterSpacing) === null || _config$letterSpacing2 === void 0 ? void 0 : _config$letterSpacing2.min) ?? -0.05,
|
|
52
52
|
max: (config === null || config === void 0 ? void 0 : (_config$letterSpacing3 = config.letterSpacing) === null || _config$letterSpacing3 === void 0 ? void 0 : _config$letterSpacing3.max) ?? 0.2
|
|
53
|
-
} : undefined
|
|
53
|
+
} : undefined,
|
|
54
|
+
columns: (config === null || config === void 0 ? void 0 : config.columns) === false ? false : {
|
|
55
|
+
count: (config === null || config === void 0 ? void 0 : (_config$columns = config.columns) === null || _config$columns === void 0 ? void 0 : _config$columns.count) ?? 'auto',
|
|
56
|
+
width: (config === null || config === void 0 ? void 0 : (_config$columns2 = config.columns) === null || _config$columns2 === void 0 ? void 0 : _config$columns2.width) ?? '40ch',
|
|
57
|
+
gap: (config === null || config === void 0 ? void 0 : (_config$columns3 = config.columns) === null || _config$columns3 === void 0 ? void 0 : _config$columns3.gap) ?? '1em'
|
|
58
|
+
}
|
|
54
59
|
};
|
|
55
60
|
};
|
|
56
61
|
const makeConfig = config => {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function renderCorsErrorModal(origin: string, fontdueUrl: string): void;
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.renderCorsErrorModal = renderCorsErrorModal;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _client = require("react-dom/client");
|
|
9
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
|
+
const code = {
|
|
11
|
+
background: '#fef2f2',
|
|
12
|
+
padding: '2px 6px',
|
|
13
|
+
borderRadius: 3,
|
|
14
|
+
fontSize: 13
|
|
15
|
+
};
|
|
16
|
+
function CorsErrorModal(_ref) {
|
|
17
|
+
let {
|
|
18
|
+
origin,
|
|
19
|
+
fontdueUrl
|
|
20
|
+
} = _ref;
|
|
21
|
+
let settingsOrigin = fontdueUrl;
|
|
22
|
+
try {
|
|
23
|
+
settingsOrigin = new URL(fontdueUrl).origin;
|
|
24
|
+
} catch {
|
|
25
|
+
// keep as-is
|
|
26
|
+
}
|
|
27
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
28
|
+
style: {
|
|
29
|
+
position: 'fixed',
|
|
30
|
+
inset: 0,
|
|
31
|
+
zIndex: 99999,
|
|
32
|
+
display: 'flex',
|
|
33
|
+
alignItems: 'center',
|
|
34
|
+
justifyContent: 'center',
|
|
35
|
+
background: 'rgba(0,0,0,0.4)',
|
|
36
|
+
fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',
|
|
37
|
+
fontSize: 14,
|
|
38
|
+
lineHeight: 1.6
|
|
39
|
+
}
|
|
40
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
41
|
+
style: {
|
|
42
|
+
background: 'white',
|
|
43
|
+
color: '#1f2937',
|
|
44
|
+
borderRadius: 12,
|
|
45
|
+
border: '2px solid #fca5a5',
|
|
46
|
+
padding: '28px 32px',
|
|
47
|
+
maxWidth: 520,
|
|
48
|
+
width: '90%',
|
|
49
|
+
boxShadow: '0 8px 30px rgba(0,0,0,0.12)',
|
|
50
|
+
textAlign: 'left'
|
|
51
|
+
}
|
|
52
|
+
}, /*#__PURE__*/_react.default.createElement("strong", {
|
|
53
|
+
style: {
|
|
54
|
+
fontSize: 16,
|
|
55
|
+
color: '#dc2626'
|
|
56
|
+
}
|
|
57
|
+
}, "Cross-origin request blocked"), /*#__PURE__*/_react.default.createElement("p", {
|
|
58
|
+
style: {
|
|
59
|
+
margin: '12px 0 0'
|
|
60
|
+
}
|
|
61
|
+
}, "Your website (", /*#__PURE__*/_react.default.createElement("code", {
|
|
62
|
+
style: code
|
|
63
|
+
}, origin), ") is not allowed to connect to your Fontdue store."), /*#__PURE__*/_react.default.createElement("p", {
|
|
64
|
+
style: {
|
|
65
|
+
margin: '12px 0 0'
|
|
66
|
+
}
|
|
67
|
+
}, "To fix this, go to", ' ', /*#__PURE__*/_react.default.createElement("a", {
|
|
68
|
+
href: `${settingsOrigin}/admin/settings/security`,
|
|
69
|
+
target: "_blank",
|
|
70
|
+
rel: "noreferrer",
|
|
71
|
+
style: {
|
|
72
|
+
color: '#dc2626',
|
|
73
|
+
fontWeight: 500
|
|
74
|
+
}
|
|
75
|
+
}, "Settings \u2192 Security"), ' ', "in your Fontdue dashboard, and add ", /*#__PURE__*/_react.default.createElement("code", {
|
|
76
|
+
style: code
|
|
77
|
+
}, origin), " to the", ' ', /*#__PURE__*/_react.default.createElement("strong", null, "Cross-origin API access"), " field."), /*#__PURE__*/_react.default.createElement("p", {
|
|
78
|
+
style: {
|
|
79
|
+
margin: '16px 0 0',
|
|
80
|
+
color: '#6b7280',
|
|
81
|
+
fontSize: 13
|
|
82
|
+
}
|
|
83
|
+
}, "This page will reload automatically once the origin is added.")));
|
|
84
|
+
}
|
|
85
|
+
function mount(origin, fontdueUrl) {
|
|
86
|
+
const container = document.createElement('div');
|
|
87
|
+
document.body.appendChild(container);
|
|
88
|
+
(0, _client.createRoot)(container).render( /*#__PURE__*/_react.default.createElement(CorsErrorModal, {
|
|
89
|
+
origin: origin,
|
|
90
|
+
fontdueUrl: fontdueUrl
|
|
91
|
+
}));
|
|
92
|
+
}
|
|
93
|
+
function renderCorsErrorModal(origin, fontdueUrl) {
|
|
94
|
+
if (document.body) {
|
|
95
|
+
mount(origin, fontdueUrl);
|
|
96
|
+
} else {
|
|
97
|
+
document.addEventListener('DOMContentLoaded', () => mount(origin, fontdueUrl));
|
|
98
|
+
}
|
|
99
|
+
}
|
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
|
+
var _CustomerLoginFormQuery2 = _interopRequireDefault(require("../../__generated__/CustomerLoginFormQuery.graphql"));
|
|
8
9
|
var _CustomerLoginFormLoginMutation2 = _interopRequireDefault(require("../../__generated__/CustomerLoginFormLoginMutation.graphql"));
|
|
9
10
|
var _react = _interopRequireWildcard(require("react"));
|
|
10
11
|
var _reactRelay = require("react-relay");
|
|
@@ -13,10 +14,10 @@ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return
|
|
|
13
14
|
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
15
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
15
16
|
const loginMutation = (_CustomerLoginFormLoginMutation2.default.hash && _CustomerLoginFormLoginMutation2.default.hash !== "975b639fac1e0d88e0f0c9c55acd8b9c" && console.error("The definition of 'CustomerLoginFormLoginMutation' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data."), _CustomerLoginFormLoginMutation2.default);
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
}, /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("p", null, "Submitted!"), /*#__PURE__*/_react.default.createElement("p", null, "Please check your email inbox for a link to log in."), /*#__PURE__*/_react.default.createElement("p", null, "If you don't receive an email, please contact us to retrieve your order information.")));
|
|
17
|
+
const query = (_CustomerLoginFormQuery2.default.hash && _CustomerLoginFormQuery2.default.hash !== "f32c7b0b485a2b2a02ddf2cbc5b87a3c" && console.error("The definition of 'CustomerLoginFormQuery' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data."), _CustomerLoginFormQuery2.default);
|
|
18
|
+
const DEFAULT_SUBMITTED_LABEL = '<p>Submitted!</p><p>Please check your email inbox for a link to log in.</p><p>If you don\u2019t receive an email, please contact us to retrieve your order information.</p>';
|
|
19
19
|
const CustomerLoginForm = _ref => {
|
|
20
|
+
var _data$viewer, _data$viewer$settings;
|
|
20
21
|
let {
|
|
21
22
|
submitLabel = 'Submit'
|
|
22
23
|
} = _ref;
|
|
@@ -25,6 +26,8 @@ const CustomerLoginForm = _ref => {
|
|
|
25
26
|
const [submitting, setSubmitting] = (0, _react.useState)(false);
|
|
26
27
|
const [submitted, setSubmitted] = (0, _react.useState)(false);
|
|
27
28
|
const environment = (0, _reactRelay.useRelayEnvironment)();
|
|
29
|
+
const data = (0, _reactRelay.useLazyLoadQuery)(query, {});
|
|
30
|
+
const submittedLabel = ((_data$viewer = data.viewer) === null || _data$viewer === void 0 ? void 0 : (_data$viewer$settings = _data$viewer.settings) === null || _data$viewer$settings === void 0 ? void 0 : _data$viewer$settings.customerLoginSubmittedLabel) || DEFAULT_SUBMITTED_LABEL;
|
|
28
31
|
const handleSubmit = e => {
|
|
29
32
|
e.preventDefault();
|
|
30
33
|
setSubmitting(true);
|
|
@@ -59,7 +62,12 @@ const CustomerLoginForm = _ref => {
|
|
|
59
62
|
className: "login-form"
|
|
60
63
|
}, error && /*#__PURE__*/_react.default.createElement("div", {
|
|
61
64
|
className: "login-form__errors"
|
|
62
|
-
}, error), submitted ? /*#__PURE__*/_react.default.createElement(
|
|
65
|
+
}, error), submitted ? /*#__PURE__*/_react.default.createElement("div", {
|
|
66
|
+
className: "login-form__submitted",
|
|
67
|
+
dangerouslySetInnerHTML: {
|
|
68
|
+
__html: submittedLabel
|
|
69
|
+
}
|
|
70
|
+
}) : /*#__PURE__*/_react.default.createElement("form", {
|
|
63
71
|
className: "login-form__form",
|
|
64
72
|
onSubmit: handleSubmit
|
|
65
73
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -22,11 +22,12 @@ function OrderVariableSelectionRedux(_ref) {
|
|
|
22
22
|
} = _ref;
|
|
23
23
|
const environment = (0, _reactRelay.useRelayEnvironment)();
|
|
24
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
|
+
const refetchVariables = (0, _react.useMemo)(() => ({}), []);
|
|
25
26
|
(0, _useRefetchOnLicenseChanges.useRefetchOnLicenseChanges)({
|
|
26
27
|
environment,
|
|
27
28
|
refetch,
|
|
28
29
|
query: _OrderVariableSelectionReduxRefetchQuery.default,
|
|
29
|
-
variables:
|
|
30
|
+
variables: refetchVariables
|
|
30
31
|
});
|
|
31
32
|
const dispatch = (0, _reactRedux.useDispatch)();
|
|
32
33
|
const selections = (0, _reactRedux.useSelector)(state => state.orderVariableSelections);
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _PrecartQuery2 = _interopRequireDefault(require("../../__generated__/PrecartQuery.graphql"));
|
|
8
8
|
var _PrecartAddToCartMutation2 = _interopRequireDefault(require("../../__generated__/PrecartAddToCartMutation.graphql"));
|
|
9
|
+
var _PrecartClearCartMutation2 = _interopRequireDefault(require("../../__generated__/PrecartClearCartMutation.graphql"));
|
|
9
10
|
var _Precart_collection2 = _interopRequireDefault(require("../../__generated__/Precart_collection.graphql"));
|
|
10
11
|
var _Precart_viewer2 = _interopRequireDefault(require("../../__generated__/Precart_viewer.graphql"));
|
|
11
12
|
var _Precart_license2 = _interopRequireDefault(require("../../__generated__/Precart_license.graphql"));
|
|
@@ -103,6 +104,21 @@ function Precart(_ref3) {
|
|
|
103
104
|
type: 'UNSELECT_SKUS'
|
|
104
105
|
});
|
|
105
106
|
const [isConfirming, setIsConfirming] = (0, _react.useState)(false);
|
|
107
|
+
const [error, setError] = (0, _react.useState)(null);
|
|
108
|
+
const clearCart = (0, _react.useCallback)(() => {
|
|
109
|
+
const mutation = (_PrecartClearCartMutation2.default.hash && _PrecartClearCartMutation2.default.hash !== "af8f953028924bdc7866e645c2d0a903" && console.error("The definition of 'PrecartClearCartMutation' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data."), _PrecartClearCartMutation2.default);
|
|
110
|
+
(0, _reactRelay.commitMutation)(environment, {
|
|
111
|
+
mutation,
|
|
112
|
+
variables: {
|
|
113
|
+
input: {
|
|
114
|
+
orderItems: []
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
onCompleted: () => {
|
|
118
|
+
setError(null);
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
}, [environment]);
|
|
106
122
|
const onSelectLicense = (id, checked) => {
|
|
107
123
|
var _collection$licenses;
|
|
108
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);
|
|
@@ -152,13 +168,17 @@ function Precart(_ref3) {
|
|
|
152
168
|
(0, _reactRelay.commitMutation)(environment, {
|
|
153
169
|
mutation,
|
|
154
170
|
variables,
|
|
155
|
-
onError:
|
|
156
|
-
console.error('Failed:',
|
|
171
|
+
onError: err => {
|
|
172
|
+
console.error('Failed:', err);
|
|
173
|
+
setError(err.message || 'An error occurred');
|
|
157
174
|
},
|
|
158
175
|
onCompleted: (res, errors) => {
|
|
159
176
|
if (errors) {
|
|
160
|
-
|
|
177
|
+
var _errors$;
|
|
178
|
+
console.error('Failed:', errors);
|
|
179
|
+
setError(((_errors$ = errors[0]) === null || _errors$ === void 0 ? void 0 : _errors$.message) || 'An error occurred');
|
|
161
180
|
} else {
|
|
181
|
+
setError(null);
|
|
162
182
|
onUnselectSkuIds();
|
|
163
183
|
}
|
|
164
184
|
}
|
|
@@ -291,7 +311,13 @@ function Precart(_ref3) {
|
|
|
291
311
|
className: "pre-cart__section pre-cart__selection-empty"
|
|
292
312
|
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
293
313
|
className: "pre-cart__selection-empty__arrow"
|
|
294
|
-
}, '\u25c0 '), "Start selecting fonts to add to your cart")), renderPreCartBottom(subtotal),
|
|
314
|
+
}, '\u25c0 '), "Start selecting fonts to add to your cart")), renderPreCartBottom(subtotal), error && /*#__PURE__*/_react.default.createElement("div", {
|
|
315
|
+
className: "pre-cart__error"
|
|
316
|
+
}, error, ' ', /*#__PURE__*/_react.default.createElement("button", {
|
|
317
|
+
type: "button",
|
|
318
|
+
onClick: clearCart,
|
|
319
|
+
className: "pre-cart__error-button"
|
|
320
|
+
}, "Empty cart and try again")), renderConfirmingModal(subtotal)));
|
|
295
321
|
}
|
|
296
322
|
function PrecartQueryRenderer(_ref6) {
|
|
297
323
|
let {
|
|
@@ -37,7 +37,7 @@ function StoreModalFamily(_ref) {
|
|
|
37
37
|
onSelect,
|
|
38
38
|
title
|
|
39
39
|
} = _ref;
|
|
40
|
-
const collection = (0, _reactRelay.useFragment)((_StoreModalFamily_collection2.default.hash && _StoreModalFamily_collection2.default.hash !== "
|
|
40
|
+
const collection = (0, _reactRelay.useFragment)((_StoreModalFamily_collection2.default.hash && _StoreModalFamily_collection2.default.hash !== "9c85d32d917e909af575bdda90949c0b" && console.error("The definition of 'StoreModalFamily_collection' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data."), _StoreModalFamily_collection2.default), collectionKey);
|
|
41
41
|
const fontStyles = (0, _react.useMemo)(() => stylesGrouped(collection), [collection]);
|
|
42
42
|
if ((fontStyles === null || fontStyles === void 0 ? void 0 : fontStyles.length) === 0 && collection.collectionType === 'superfamily' && !collection.sku) return null;
|
|
43
43
|
return /*#__PURE__*/_react.default.createElement(_StoreModalFamily.default, null, {
|
|
@@ -49,7 +49,7 @@ function StoreModalFamily(_ref) {
|
|
|
49
49
|
collection: collection,
|
|
50
50
|
onSelectSku: onSelect
|
|
51
51
|
}),
|
|
52
|
-
bundles: collection === null || collection === void 0 ? void 0 : (_collection$bundles = collection.bundles) === null || _collection$bundles === void 0 ? void 0 : _collection$bundles.map(bundle => /*#__PURE__*/_react.default.createElement(_StoreModalBundleButton.default, {
|
|
52
|
+
bundles: collection === null || collection === void 0 ? void 0 : (_collection$bundles = collection.bundles) === null || _collection$bundles === void 0 ? void 0 : _collection$bundles.filter(bundle => !bundle.hidden).map(bundle => /*#__PURE__*/_react.default.createElement(_StoreModalBundleButton.default, {
|
|
53
53
|
key: bundle.id,
|
|
54
54
|
bundle: bundle,
|
|
55
55
|
onSelectSku: onSelect
|
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _StoreModalProductSummary_viewer2 = _interopRequireDefault(require("../../__generated__/StoreModalProductSummary_viewer.graphql"));
|
|
8
|
+
var _StoreModalProductSummaryClearCartMutation2 = _interopRequireDefault(require("../../__generated__/StoreModalProductSummaryClearCartMutation.graphql"));
|
|
8
9
|
var _StoreModalProductSummaryAddToCartMutation2 = _interopRequireDefault(require("../../__generated__/StoreModalProductSummaryAddToCartMutation.graphql"));
|
|
9
10
|
var _react = _interopRequireWildcard(require("react"));
|
|
10
11
|
var _reactRelay = require("react-relay");
|
|
@@ -20,6 +21,7 @@ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return
|
|
|
20
21
|
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; }
|
|
21
22
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
22
23
|
const addToCartMutation = (_StoreModalProductSummaryAddToCartMutation2.default.hash && _StoreModalProductSummaryAddToCartMutation2.default.hash !== "91ea762e3842af2919da3a4c710a48cc" && console.error("The definition of 'StoreModalProductSummaryAddToCartMutation' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data."), _StoreModalProductSummaryAddToCartMutation2.default);
|
|
24
|
+
const clearCartMutation = (_StoreModalProductSummaryClearCartMutation2.default.hash && _StoreModalProductSummaryClearCartMutation2.default.hash !== "b5c37f74432030a297c1bcf2be63b6f7" && console.error("The definition of 'StoreModalProductSummaryClearCartMutation' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data."), _StoreModalProductSummaryClearCartMutation2.default);
|
|
23
25
|
const countStyles = viewer => {
|
|
24
26
|
const {
|
|
25
27
|
precart
|
|
@@ -71,7 +73,24 @@ const StoreModalProductSummary = _ref => {
|
|
|
71
73
|
variables: refetchVariables
|
|
72
74
|
});
|
|
73
75
|
const [submitting, setSubmitting] = (0, _react.useState)(false);
|
|
76
|
+
const [error, setError] = (0, _react.useState)(null);
|
|
74
77
|
const [commitAddToCart] = (0, _reactRelay.useMutation)(addToCartMutation);
|
|
78
|
+
const clearCart = (0, _react.useCallback)(() => {
|
|
79
|
+
(0, _reactRelay.commitMutation)(environment, {
|
|
80
|
+
mutation: clearCartMutation,
|
|
81
|
+
variables: {
|
|
82
|
+
input: {
|
|
83
|
+
orderItems: []
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
onCompleted: () => {
|
|
87
|
+
setError(null);
|
|
88
|
+
},
|
|
89
|
+
updater: store => {
|
|
90
|
+
store.invalidateStore();
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
}, [environment]);
|
|
75
94
|
const handleAddToCart = (0, _react.useCallback)(() => {
|
|
76
95
|
setSubmitting(true);
|
|
77
96
|
const variables = {
|
|
@@ -100,16 +119,20 @@ const StoreModalProductSummary = _ref => {
|
|
|
100
119
|
};
|
|
101
120
|
commitAddToCart({
|
|
102
121
|
variables,
|
|
103
|
-
onError:
|
|
104
|
-
console.error('Failed:',
|
|
122
|
+
onError: err => {
|
|
123
|
+
console.error('Failed:', err);
|
|
124
|
+
setError(err.message || 'An error occurred');
|
|
105
125
|
setSubmitting(false);
|
|
106
126
|
},
|
|
107
127
|
onCompleted: (_res, errors) => {
|
|
108
128
|
if (errors) {
|
|
129
|
+
var _errors$;
|
|
109
130
|
console.error('Failed:', errors);
|
|
131
|
+
setError(((_errors$ = errors[0]) === null || _errors$ === void 0 ? void 0 : _errors$.message) || 'An error occurred');
|
|
110
132
|
setSubmitting(false);
|
|
111
133
|
return;
|
|
112
134
|
}
|
|
135
|
+
setError(null);
|
|
113
136
|
dispatch({
|
|
114
137
|
type: 'STORE_MODAL_NAVIGATE',
|
|
115
138
|
route: 'cart'
|
|
@@ -119,7 +142,7 @@ const StoreModalProductSummary = _ref => {
|
|
|
119
142
|
store.invalidateStore();
|
|
120
143
|
}
|
|
121
144
|
});
|
|
122
|
-
}, [selectedSkuIds, licenseOptions, orderVariableSelections, licenseeIsBillingIdentity, dispatch, commitAddToCart]);
|
|
145
|
+
}, [selectedSkuIds, licenseOptions, orderVariableSelections, licenseeIsBillingIdentity, dispatch, commitAddToCart, setError]);
|
|
123
146
|
if (!viewer.precart) return null;
|
|
124
147
|
const anySkusSelected = Object.keys(selectedSkuIds).filter(skuId => selectedSkuIds[skuId]).length > 0;
|
|
125
148
|
const stylesPrice = countStylesPrice(viewer);
|
|
@@ -185,11 +208,19 @@ const StoreModalProductSummary = _ref => {
|
|
|
185
208
|
}
|
|
186
209
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
187
210
|
className: "store-modal__product-summary__container"
|
|
211
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
212
|
+
className: "store-modal__product-summary__row"
|
|
188
213
|
}, message, /*#__PURE__*/_react.default.createElement(_Button.default, {
|
|
189
214
|
className: "store-modal__product-summary__add-to-cart-button",
|
|
190
215
|
onClick: handleAddToCart,
|
|
191
216
|
disabled: submitting || !validSelections
|
|
192
|
-
}, submitting ? 'Adding...' : 'Add to cart'))
|
|
217
|
+
}, submitting ? 'Adding...' : 'Add to cart')), error && /*#__PURE__*/_react.default.createElement("div", {
|
|
218
|
+
className: "store-modal__product-summary__error"
|
|
219
|
+
}, error, ' ', /*#__PURE__*/_react.default.createElement("button", {
|
|
220
|
+
type: "button",
|
|
221
|
+
onClick: clearCart,
|
|
222
|
+
className: "store-modal__product-summary__error-button"
|
|
223
|
+
}, "Empty cart and try again")));
|
|
193
224
|
};
|
|
194
225
|
var _default = StoreModalProductSummary;
|
|
195
226
|
exports.default = _default;
|
|
@@ -16,15 +16,16 @@ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return
|
|
|
16
16
|
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; }
|
|
17
17
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
18
18
|
const StripeProvider = _ref => {
|
|
19
|
-
var _data$settings, _data$settings$uiFont, _data$settings$uiFont2, _data$settings$uiFont3, _data$settings2, _data$
|
|
19
|
+
var _data$currentOrder, _data$settings, _data$settings$uiFont, _data$settings$uiFont2, _data$settings$uiFont3, _data$settings2, _data$currentOrder2, _data$currentOrder2$s, _data$themeConfig;
|
|
20
20
|
let {
|
|
21
21
|
viewer,
|
|
22
22
|
providerType,
|
|
23
23
|
children
|
|
24
24
|
} = _ref;
|
|
25
|
-
const data = (0, _reactRelay.useFragment)((_StripeProvider_viewer2.default.hash && _StripeProvider_viewer2.default.hash !== "
|
|
25
|
+
const data = (0, _reactRelay.useFragment)((_StripeProvider_viewer2.default.hash && _StripeProvider_viewer2.default.hash !== "96a569166948f6d2956bdf12dbd2820f" && console.error("The definition of 'StripeProvider_viewer' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data."), _StripeProvider_viewer2.default), viewer);
|
|
26
26
|
const stripeKey = data.stripePublishableKey;
|
|
27
|
-
|
|
27
|
+
// Use order's stripeAccountId if available (handles case where tenant changed accounts mid-checkout)
|
|
28
|
+
const stripeAccount = ((_data$currentOrder = data.currentOrder) === null || _data$currentOrder === void 0 ? void 0 : _data$currentOrder.stripeAccountId) || data.stripeAccountId;
|
|
28
29
|
const stripePromiseRef = (0, _react.useRef)(stripeKey && stripeAccount ? (0, _stripeJs.loadStripe)(stripeKey, {
|
|
29
30
|
stripeAccount
|
|
30
31
|
}) : null);
|
|
@@ -51,7 +52,7 @@ const StripeProvider = _ref => {
|
|
|
51
52
|
weight: '400'
|
|
52
53
|
};
|
|
53
54
|
}
|
|
54
|
-
const clientSecret = ((_data$
|
|
55
|
+
const clientSecret = ((_data$currentOrder2 = data.currentOrder) === null || _data$currentOrder2 === void 0 ? void 0 : (_data$currentOrder2$s = _data$currentOrder2.stripePaymentIntent) === null || _data$currentOrder2$s === void 0 ? void 0 : _data$currentOrder2$s.clientSecret) ?? undefined;
|
|
55
56
|
const customProperties = (0, _utils.parseCustomProperties)((_data$themeConfig = data.themeConfig) === null || _data$themeConfig === void 0 ? void 0 : _data$themeConfig.customProperties);
|
|
56
57
|
const fetchClientSecret = (0, _react.useCallback)(() => {
|
|
57
58
|
return new Promise((resolve, reject) => {
|