fontdue-js 2.18.3 → 2.18.4
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 +4 -0
- package/dist/__generated__/CartQuery.graphql.d.ts +1 -1
- package/dist/__generated__/CartQuery.graphql.js +49 -48
- package/dist/__generated__/CustomerLoginFormQuery.graphql.d.ts +20 -0
- package/dist/__generated__/CustomerLoginFormQuery.graphql.js +91 -0
- 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 +45 -44
- package/dist/__generated__/StoreModalCheckoutQuery.graphql.d.ts +1 -1
- package/dist/__generated__/StoreModalCheckoutQuery.graphql.js +18 -17
- package/dist/__generated__/StoreModalProductSummaryClearCartMutation.graphql.d.ts +61 -0
- package/dist/__generated__/StoreModalProductSummaryClearCartMutation.graphql.js +81 -0
- package/dist/__generated__/StripeProvider_viewer.graphql.d.ts +2 -1
- package/dist/__generated__/StripeProvider_viewer.graphql.js +78 -75
- package/dist/components/ConfigContext.d.ts +10 -0
- package/dist/components/ConfigContext.js +7 -2
- package/dist/components/CustomerLoginForm/index.js +12 -4
- package/dist/components/Precart/index.js +30 -4
- 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/fontdue.css +56 -2
- package/fontdue.css +197 -121
- package/package.json +1 -1
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
/**
|
|
8
|
-
* @generated SignedSource<<
|
|
8
|
+
* @generated SignedSource<<d02753657fe659c784b166d1c4a2b27a>>
|
|
9
9
|
* @lightSyntaxTransform
|
|
10
10
|
* @nogrep
|
|
11
11
|
*/
|
|
@@ -14,123 +14,126 @@ exports.default = void 0;
|
|
|
14
14
|
/* eslint-disable */
|
|
15
15
|
// @ts-nocheck
|
|
16
16
|
|
|
17
|
-
const node = {
|
|
18
|
-
|
|
19
|
-
"kind": "Fragment",
|
|
20
|
-
"metadata": null,
|
|
21
|
-
"name": "StripeProvider_viewer",
|
|
22
|
-
"selections": [{
|
|
17
|
+
const node = function () {
|
|
18
|
+
var v0 = {
|
|
23
19
|
"alias": null,
|
|
24
20
|
"args": null,
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
|
|
21
|
+
"kind": "ScalarField",
|
|
22
|
+
"name": "stripeAccountId",
|
|
23
|
+
"storageKey": null
|
|
24
|
+
};
|
|
25
|
+
return {
|
|
26
|
+
"argumentDefinitions": [],
|
|
27
|
+
"kind": "Fragment",
|
|
28
|
+
"metadata": null,
|
|
29
|
+
"name": "StripeProvider_viewer",
|
|
29
30
|
"selections": [{
|
|
30
31
|
"alias": null,
|
|
31
32
|
"args": null,
|
|
32
|
-
"
|
|
33
|
-
"name": "taxSystem",
|
|
34
|
-
"storageKey": null
|
|
35
|
-
}, {
|
|
36
|
-
"alias": null,
|
|
37
|
-
"args": null,
|
|
38
|
-
"concreteType": "FontStyle",
|
|
33
|
+
"concreteType": "Settings",
|
|
39
34
|
"kind": "LinkedField",
|
|
40
|
-
"name": "
|
|
35
|
+
"name": "settings",
|
|
41
36
|
"plural": false,
|
|
42
37
|
"selections": [{
|
|
43
38
|
"alias": null,
|
|
44
39
|
"args": null,
|
|
45
40
|
"kind": "ScalarField",
|
|
46
|
-
"name": "
|
|
41
|
+
"name": "taxSystem",
|
|
47
42
|
"storageKey": null
|
|
48
43
|
}, {
|
|
49
44
|
"alias": null,
|
|
50
45
|
"args": null,
|
|
51
|
-
"
|
|
52
|
-
"name": "cssFamily",
|
|
53
|
-
"storageKey": null
|
|
54
|
-
}, {
|
|
55
|
-
"alias": null,
|
|
56
|
-
"args": null,
|
|
57
|
-
"concreteType": "WebfontSource",
|
|
46
|
+
"concreteType": "FontStyle",
|
|
58
47
|
"kind": "LinkedField",
|
|
59
|
-
"name": "
|
|
60
|
-
"plural":
|
|
48
|
+
"name": "uiFontStyle",
|
|
49
|
+
"plural": false,
|
|
61
50
|
"selections": [{
|
|
62
51
|
"alias": null,
|
|
63
52
|
"args": null,
|
|
64
53
|
"kind": "ScalarField",
|
|
65
|
-
"name": "
|
|
54
|
+
"name": "name",
|
|
66
55
|
"storageKey": null
|
|
67
56
|
}, {
|
|
68
57
|
"alias": null,
|
|
69
58
|
"args": null,
|
|
70
59
|
"kind": "ScalarField",
|
|
71
|
-
"name": "
|
|
60
|
+
"name": "cssFamily",
|
|
61
|
+
"storageKey": null
|
|
62
|
+
}, {
|
|
63
|
+
"alias": null,
|
|
64
|
+
"args": null,
|
|
65
|
+
"concreteType": "WebfontSource",
|
|
66
|
+
"kind": "LinkedField",
|
|
67
|
+
"name": "webfontSources",
|
|
68
|
+
"plural": true,
|
|
69
|
+
"selections": [{
|
|
70
|
+
"alias": null,
|
|
71
|
+
"args": null,
|
|
72
|
+
"kind": "ScalarField",
|
|
73
|
+
"name": "format",
|
|
74
|
+
"storageKey": null
|
|
75
|
+
}, {
|
|
76
|
+
"alias": null,
|
|
77
|
+
"args": null,
|
|
78
|
+
"kind": "ScalarField",
|
|
79
|
+
"name": "url",
|
|
80
|
+
"storageKey": null
|
|
81
|
+
}],
|
|
72
82
|
"storageKey": null
|
|
73
83
|
}],
|
|
74
84
|
"storageKey": null
|
|
75
85
|
}],
|
|
76
86
|
"storageKey": null
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
+
}, {
|
|
88
|
+
"alias": null,
|
|
89
|
+
"args": null,
|
|
90
|
+
"concreteType": "ThemeConfig",
|
|
91
|
+
"kind": "LinkedField",
|
|
92
|
+
"name": "themeConfig",
|
|
93
|
+
"plural": false,
|
|
94
|
+
"selections": [{
|
|
95
|
+
"alias": null,
|
|
96
|
+
"args": null,
|
|
97
|
+
"kind": "ScalarField",
|
|
98
|
+
"name": "customProperties",
|
|
99
|
+
"storageKey": null
|
|
100
|
+
}],
|
|
101
|
+
"storageKey": null
|
|
102
|
+
}, v0 /*: any*/, {
|
|
87
103
|
"alias": null,
|
|
88
104
|
"args": null,
|
|
89
105
|
"kind": "ScalarField",
|
|
90
|
-
"name": "
|
|
106
|
+
"name": "stripePublishableKey",
|
|
91
107
|
"storageKey": null
|
|
92
|
-
}
|
|
93
|
-
"storageKey": null
|
|
94
|
-
}, {
|
|
95
|
-
"alias": null,
|
|
96
|
-
"args": null,
|
|
97
|
-
"kind": "ScalarField",
|
|
98
|
-
"name": "stripeAccountId",
|
|
99
|
-
"storageKey": null
|
|
100
|
-
}, {
|
|
101
|
-
"alias": null,
|
|
102
|
-
"args": null,
|
|
103
|
-
"kind": "ScalarField",
|
|
104
|
-
"name": "stripePublishableKey",
|
|
105
|
-
"storageKey": null
|
|
106
|
-
}, {
|
|
107
|
-
"alias": null,
|
|
108
|
-
"args": null,
|
|
109
|
-
"concreteType": "Order",
|
|
110
|
-
"kind": "LinkedField",
|
|
111
|
-
"name": "currentOrder",
|
|
112
|
-
"plural": false,
|
|
113
|
-
"selections": [{
|
|
108
|
+
}, {
|
|
114
109
|
"alias": null,
|
|
115
110
|
"args": null,
|
|
116
|
-
"concreteType": "
|
|
111
|
+
"concreteType": "Order",
|
|
117
112
|
"kind": "LinkedField",
|
|
118
|
-
"name": "
|
|
113
|
+
"name": "currentOrder",
|
|
119
114
|
"plural": false,
|
|
120
|
-
"selections": [{
|
|
115
|
+
"selections": [v0 /*: any*/, {
|
|
121
116
|
"alias": null,
|
|
122
117
|
"args": null,
|
|
123
|
-
"
|
|
124
|
-
"
|
|
118
|
+
"concreteType": "StripePaymentIntent",
|
|
119
|
+
"kind": "LinkedField",
|
|
120
|
+
"name": "stripePaymentIntent",
|
|
121
|
+
"plural": false,
|
|
122
|
+
"selections": [{
|
|
123
|
+
"alias": null,
|
|
124
|
+
"args": null,
|
|
125
|
+
"kind": "ScalarField",
|
|
126
|
+
"name": "clientSecret",
|
|
127
|
+
"storageKey": null
|
|
128
|
+
}],
|
|
125
129
|
"storageKey": null
|
|
126
130
|
}],
|
|
127
131
|
"storageKey": null
|
|
128
132
|
}],
|
|
129
|
-
"
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
node.hash = "dd5fd4cdd75d727050b8d1d6f4269fa8";
|
|
133
|
+
"type": "Viewer",
|
|
134
|
+
"abstractKey": null
|
|
135
|
+
};
|
|
136
|
+
}();
|
|
137
|
+
node.hash = "96a569166948f6d2956bdf12dbd2820f";
|
|
135
138
|
var _default = node;
|
|
136
139
|
exports.default = _default;
|
|
@@ -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 => {
|
|
@@ -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", {
|
|
@@ -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 {
|
|
@@ -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) => {
|
|
@@ -159,7 +159,8 @@ const TypeTester = _ref => {
|
|
|
159
159
|
direction: props.direction,
|
|
160
160
|
min: config.size.min,
|
|
161
161
|
max: config.size.max,
|
|
162
|
-
autofitOnChange: config.autofitOnChange
|
|
162
|
+
autofitOnChange: config.autofitOnChange,
|
|
163
|
+
columns: config.columns
|
|
163
164
|
}));
|
|
164
165
|
}
|
|
165
166
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { EditorState } from 'draft-js';
|
|
2
2
|
import { Alignment } from './types';
|
|
3
3
|
import { VariableSettings } from '../../utils';
|
|
4
|
+
export type ColumnsConfig = false | {
|
|
5
|
+
count: 'auto' | number;
|
|
6
|
+
width: string;
|
|
7
|
+
gap: string;
|
|
8
|
+
};
|
|
4
9
|
export interface UseTypeTesterStylerProps {
|
|
5
10
|
autofit: boolean;
|
|
6
11
|
autofitOnChange: boolean;
|
|
@@ -20,8 +25,9 @@ export interface UseTypeTesterStylerProps {
|
|
|
20
25
|
contentEdited: boolean;
|
|
21
26
|
alignment: Alignment;
|
|
22
27
|
variableSettings: VariableSettings | null;
|
|
28
|
+
columns: ColumnsConfig;
|
|
23
29
|
}
|
|
24
|
-
declare const useTypeTesterStyler: ({ size, autofit, autofitOnChange, features, setSize, min, max, truncate, focused, lineHeight, letterSpacing, fontStyles, content, contentEdited, alignment, variableSettings, }: UseTypeTesterStylerProps) => {
|
|
30
|
+
declare const useTypeTesterStyler: ({ size, autofit, autofitOnChange, features, setSize, min, max, truncate, focused, lineHeight, letterSpacing, fontStyles, content, contentEdited, alignment, variableSettings, columns, }: UseTypeTesterStylerProps) => {
|
|
25
31
|
ref: import("react").RefObject<HTMLDivElement | null>;
|
|
26
32
|
style: import("react").CSSProperties;
|
|
27
33
|
};
|
|
@@ -42,7 +42,8 @@ const useTypeTesterStyler = _ref => {
|
|
|
42
42
|
content,
|
|
43
43
|
contentEdited,
|
|
44
44
|
alignment,
|
|
45
|
-
variableSettings
|
|
45
|
+
variableSettings,
|
|
46
|
+
columns
|
|
46
47
|
} = _ref;
|
|
47
48
|
const ref = (0, _react.useRef)(null);
|
|
48
49
|
const fontVariationSettings = variableSettings ? Object.keys(variableSettings).map(axis => `'${axis}' ${variableSettings[axis]}`).join(',') : undefined;
|
|
@@ -125,7 +126,12 @@ const useTypeTesterStyler = _ref => {
|
|
|
125
126
|
marginLeft: alignment === 'right' ? -sideBuffer : 0,
|
|
126
127
|
letterSpacing: `${letterSpacing}em`,
|
|
127
128
|
fontVariationSettings,
|
|
128
|
-
textAlign: alignment
|
|
129
|
+
textAlign: alignment,
|
|
130
|
+
...(columns && {
|
|
131
|
+
columnCount: columns.count,
|
|
132
|
+
columnWidth: columns.width,
|
|
133
|
+
columnGap: columns.gap
|
|
134
|
+
})
|
|
129
135
|
};
|
|
130
136
|
return {
|
|
131
137
|
ref,
|