fontdue-js 2.18.2 → 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 +8 -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 +57 -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__/StoreModalUnifiedCheckout_viewer.graphql.d.ts +3 -1
- package/dist/__generated__/StoreModalUnifiedCheckout_viewer.graphql.js +14 -2
- 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/components/elements/StoreModalUnifiedCheckout.js +61 -13
- package/dist/fontdue.css +56 -2
- package/fontdue.css +197 -121
- package/package.json +1 -1
|
@@ -10,6 +10,7 @@ var _StoreModalUnifiedCheckoutUpdateCustomerMutation2 = _interopRequireDefault(r
|
|
|
10
10
|
var _StoreModalUnifiedCheckout_order2 = _interopRequireDefault(require("../../__generated__/StoreModalUnifiedCheckout_order.graphql"));
|
|
11
11
|
var _StoreModalUnifiedCheckout_viewer2 = _interopRequireDefault(require("../../__generated__/StoreModalUnifiedCheckout_viewer.graphql"));
|
|
12
12
|
var _react = _interopRequireWildcard(require("react"));
|
|
13
|
+
var _reactGoogleRecaptcha = _interopRequireDefault(require("react-google-recaptcha"));
|
|
13
14
|
var Sentry = _interopRequireWildcard(require("@sentry/react"));
|
|
14
15
|
var _reactRelay = require("react-relay");
|
|
15
16
|
var _AddressFields = _interopRequireDefault(require("../Cart/AddressFields"));
|
|
@@ -168,14 +169,14 @@ function EditableSection(_ref) {
|
|
|
168
169
|
}, "Change")));
|
|
169
170
|
}
|
|
170
171
|
function StoreModalUnifiedCheckout(_ref2) {
|
|
171
|
-
var _order$orderVariableS, _viewer$settings, _viewer$settings2, _order$stripePaymentI, _viewer$
|
|
172
|
+
var _order$orderVariableS, _viewer$settings, _viewer$settings2, _viewer$settings3, _viewer$settings4, _order$stripePaymentI, _viewer$settings5, _order$stripePaymentI2, _order$stripePaymentI3;
|
|
172
173
|
let {
|
|
173
174
|
order: orderKey,
|
|
174
175
|
viewer: viewerKey,
|
|
175
176
|
onScrollToTop,
|
|
176
177
|
onUpdateOrderVariableSelections
|
|
177
178
|
} = _ref2;
|
|
178
|
-
const viewer = (0, _reactRelay.useFragment)((_StoreModalUnifiedCheckout_viewer2.default.hash && _StoreModalUnifiedCheckout_viewer2.default.hash !== "
|
|
179
|
+
const viewer = (0, _reactRelay.useFragment)((_StoreModalUnifiedCheckout_viewer2.default.hash && _StoreModalUnifiedCheckout_viewer2.default.hash !== "048ce405742611f6684cb5306d28478b" && console.error("The definition of 'StoreModalUnifiedCheckout_viewer' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data."), _StoreModalUnifiedCheckout_viewer2.default), viewerKey);
|
|
179
180
|
const order = (0, _reactRelay.useFragment)((_StoreModalUnifiedCheckout_order2.default.hash && _StoreModalUnifiedCheckout_order2.default.hash !== "7c5503876a562732ebaead9b2ae97180" && console.error("The definition of 'StoreModalUnifiedCheckout_order' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data."), _StoreModalUnifiedCheckout_order2.default), orderKey);
|
|
180
181
|
|
|
181
182
|
// Check if order has a country-type order variable with a different country than detected
|
|
@@ -292,6 +293,13 @@ function StoreModalUnifiedCheckout(_ref2) {
|
|
|
292
293
|
const {
|
|
293
294
|
form: config
|
|
294
295
|
} = (0, _react.useContext)(_ConfigContext.default);
|
|
296
|
+
|
|
297
|
+
// reCAPTCHA state
|
|
298
|
+
const [recaptchaToken, setRecaptchaToken] = (0, _react.useState)(null);
|
|
299
|
+
const [pendingCustomerSubmit, setPendingCustomerSubmit] = (0, _react.useState)(null);
|
|
300
|
+
const recaptchaRef = (0, _react.useRef)(null);
|
|
301
|
+
const recaptchaEnabled = ((_viewer$settings = viewer.settings) === null || _viewer$settings === void 0 ? void 0 : _viewer$settings.recaptchaEnabled) ?? false;
|
|
302
|
+
const recaptchaSiteKey = (_viewer$settings2 = viewer.settings) === null || _viewer$settings2 === void 0 ? void 0 : _viewer$settings2.recaptchaSiteKey;
|
|
295
303
|
const onCompleted = (res, errors, onSuccess, onError) => {
|
|
296
304
|
var _res$updateCustomer, _res$updateOrder;
|
|
297
305
|
if (errors && errors.length > 0) {
|
|
@@ -402,11 +410,10 @@ function StoreModalUnifiedCheckout(_ref2) {
|
|
|
402
410
|
// set initial state depending on if checkout is already in progress
|
|
403
411
|
if (!order.customer) initialEditingState = 'customer';
|
|
404
412
|
const [editing, setEditing] = (0, _react.useState)(initialEditingState);
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
} = _ref3;
|
|
413
|
+
|
|
414
|
+
// Submit customer data with optional reCAPTCHA token
|
|
415
|
+
const submitCustomer = (0, _react.useCallback)((token, callbacks) => {
|
|
416
|
+
setPendingCustomerSubmit(null);
|
|
410
417
|
if (!billingIdentity.name && !billingIdentity.email) {
|
|
411
418
|
setBillingIdentity({
|
|
412
419
|
...billingIdentity,
|
|
@@ -415,11 +422,46 @@ function StoreModalUnifiedCheckout(_ref2) {
|
|
|
415
422
|
});
|
|
416
423
|
}
|
|
417
424
|
updateCustomer({
|
|
418
|
-
input:
|
|
425
|
+
input: {
|
|
426
|
+
...customer,
|
|
427
|
+
recaptchaToken: token ?? undefined
|
|
428
|
+
}
|
|
419
429
|
}, () => {
|
|
420
|
-
|
|
430
|
+
var _recaptchaRef$current;
|
|
431
|
+
callbacks.onSuccess();
|
|
421
432
|
setEditing(null);
|
|
422
|
-
|
|
433
|
+
// Reset reCAPTCHA after successful submission
|
|
434
|
+
(_recaptchaRef$current = recaptchaRef.current) === null || _recaptchaRef$current === void 0 ? void 0 : _recaptchaRef$current.reset();
|
|
435
|
+
setRecaptchaToken(null);
|
|
436
|
+
}, () => {
|
|
437
|
+
var _recaptchaRef$current2;
|
|
438
|
+
callbacks.onError();
|
|
439
|
+
// Reset reCAPTCHA on error so user can retry
|
|
440
|
+
(_recaptchaRef$current2 = recaptchaRef.current) === null || _recaptchaRef$current2 === void 0 ? void 0 : _recaptchaRef$current2.reset();
|
|
441
|
+
setRecaptchaToken(null);
|
|
442
|
+
});
|
|
443
|
+
}, [customer, billingIdentity, updateCustomer]);
|
|
444
|
+
const handleRecaptchaChange = (0, _react.useCallback)(token => {
|
|
445
|
+
setRecaptchaToken(token);
|
|
446
|
+
// If we were waiting for a token to submit, do it now
|
|
447
|
+
if (token && pendingCustomerSubmit) {
|
|
448
|
+
submitCustomer(token, pendingCustomerSubmit.callbacks);
|
|
449
|
+
}
|
|
450
|
+
}, [pendingCustomerSubmit, submitCustomer]);
|
|
451
|
+
const handleRecaptchaExpired = (0, _react.useCallback)(() => {
|
|
452
|
+
setRecaptchaToken(null);
|
|
453
|
+
}, []);
|
|
454
|
+
const handleCustomerSubmit = callbacks => {
|
|
455
|
+
// If reCAPTCHA is enabled but no token, execute it and wait for callback
|
|
456
|
+
if (recaptchaEnabled && recaptchaSiteKey && !recaptchaToken) {
|
|
457
|
+
var _recaptchaRef$current3;
|
|
458
|
+
setPendingCustomerSubmit({
|
|
459
|
+
callbacks
|
|
460
|
+
});
|
|
461
|
+
(_recaptchaRef$current3 = recaptchaRef.current) === null || _recaptchaRef$current3 === void 0 ? void 0 : _recaptchaRef$current3.execute();
|
|
462
|
+
return;
|
|
463
|
+
}
|
|
464
|
+
submitCustomer(recaptchaToken, callbacks);
|
|
423
465
|
};
|
|
424
466
|
const handleLicenseeIsBillingIdentityChange = (0, _react.useCallback)(value => {
|
|
425
467
|
updateOrder({
|
|
@@ -613,8 +655,14 @@ function StoreModalUnifiedCheckout(_ref2) {
|
|
|
613
655
|
}, "Contact information"), /*#__PURE__*/_react.default.createElement(_CustomerFields.default, {
|
|
614
656
|
value: customer,
|
|
615
657
|
onChange: handleCustomerChange,
|
|
616
|
-
optInLabel: (_viewer$
|
|
658
|
+
optInLabel: (_viewer$settings3 = viewer.settings) === null || _viewer$settings3 === void 0 ? void 0 : _viewer$settings3.newsletterOptInLabel,
|
|
617
659
|
errors: customerErrorsObject
|
|
660
|
+
}), recaptchaEnabled && recaptchaSiteKey && /*#__PURE__*/_react.default.createElement(_reactGoogleRecaptcha.default, {
|
|
661
|
+
ref: recaptchaRef,
|
|
662
|
+
sitekey: recaptchaSiteKey,
|
|
663
|
+
size: "invisible",
|
|
664
|
+
onChange: handleRecaptchaChange,
|
|
665
|
+
onExpired: handleRecaptchaExpired
|
|
618
666
|
}))
|
|
619
667
|
}), order.customer && !hasCountryMismatch ? /*#__PURE__*/_react.default.createElement(_StoreModalLicenseeIsBillingIdentityElement.default, {
|
|
620
668
|
disabled: false,
|
|
@@ -623,7 +671,7 @@ function StoreModalUnifiedCheckout(_ref2) {
|
|
|
623
671
|
}, {
|
|
624
672
|
label: /*#__PURE__*/_react.default.createElement("div", {
|
|
625
673
|
dangerouslySetInnerHTML: {
|
|
626
|
-
__html: ((_viewer$
|
|
674
|
+
__html: ((_viewer$settings4 = viewer.settings) === null || _viewer$settings4 === void 0 ? void 0 : _viewer$settings4.storeModalSelectLicenseeLabel) ?? ''
|
|
627
675
|
}
|
|
628
676
|
})
|
|
629
677
|
}) : null, showLicenseeSection ? /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -702,7 +750,7 @@ function StoreModalUnifiedCheckout(_ref2) {
|
|
|
702
750
|
htmlFor: "eula-agreement"
|
|
703
751
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
704
752
|
dangerouslySetInnerHTML: {
|
|
705
|
-
__html: ((_viewer$
|
|
753
|
+
__html: ((_viewer$settings5 = viewer.settings) === null || _viewer$settings5 === void 0 ? void 0 : _viewer$settings5.eulaAgreementLabel) ?? ''
|
|
706
754
|
}
|
|
707
755
|
}))), /*#__PURE__*/_react.default.createElement("button", {
|
|
708
756
|
type: "submit",
|
package/dist/fontdue.css
CHANGED
|
@@ -448,6 +448,14 @@ div[data-component=TypeTesters] {
|
|
|
448
448
|
flex: 0 1 250px;
|
|
449
449
|
margin-right: 20px;
|
|
450
450
|
}
|
|
451
|
+
@media (max-width: 899px) {
|
|
452
|
+
.type-tester__toolbar .type-tester__variable-axes {
|
|
453
|
+
display: grid;
|
|
454
|
+
grid-template-columns: 1fr;
|
|
455
|
+
grid-gap: 5px;
|
|
456
|
+
width: 100%;
|
|
457
|
+
}
|
|
458
|
+
}
|
|
451
459
|
.type-tester__toolbar {
|
|
452
460
|
display: flex;
|
|
453
461
|
align-items: center;
|
|
@@ -457,6 +465,14 @@ div[data-component=TypeTesters] {
|
|
|
457
465
|
z-index: 2;
|
|
458
466
|
margin-top: 10px;
|
|
459
467
|
}
|
|
468
|
+
@media (max-width: 899px) {
|
|
469
|
+
.type-tester__toolbar {
|
|
470
|
+
flex-wrap: wrap;
|
|
471
|
+
}
|
|
472
|
+
.type-tester__toolbar .type-tester__select-button-wrapper {
|
|
473
|
+
margin-left: auto;
|
|
474
|
+
}
|
|
475
|
+
}
|
|
460
476
|
.type-tester__toolbar__price-text {
|
|
461
477
|
margin: 0 20px;
|
|
462
478
|
opacity: 0.5;
|
|
@@ -470,6 +486,13 @@ div[data-component=TypeTesters] {
|
|
|
470
486
|
.type-tester__toolbar__tools:not(:last-child) {
|
|
471
487
|
margin-right: 20px;
|
|
472
488
|
}
|
|
489
|
+
@media (max-width: 899px) {
|
|
490
|
+
.type-tester__toolbar__tools {
|
|
491
|
+
order: 1;
|
|
492
|
+
flex: 1 0 100%;
|
|
493
|
+
margin-top: 5px;
|
|
494
|
+
}
|
|
495
|
+
}
|
|
473
496
|
.type-tester[data-shy=hover] .type-tester__toolbar__tools, .type-tester[data-shy=focus] .type-tester__toolbar__tools {
|
|
474
497
|
opacity: 0;
|
|
475
498
|
pointer-events: none;
|
|
@@ -674,9 +697,7 @@ div[data-component=TypeTesters] {
|
|
|
674
697
|
.type-tester__variable-axes__value {
|
|
675
698
|
margin-left: 10px;
|
|
676
699
|
margin-right: 16px;
|
|
677
|
-
width: 3em;
|
|
678
700
|
text-align: right;
|
|
679
|
-
font-feature-settings: "tnum" 1;
|
|
680
701
|
}
|
|
681
702
|
.type-tester__variable-axes__name {
|
|
682
703
|
white-space: nowrap;
|
|
@@ -2068,11 +2089,44 @@ body[data-fontdue-store-modal=open] {
|
|
|
2068
2089
|
}
|
|
2069
2090
|
|
|
2070
2091
|
.store-modal__product-summary__container {
|
|
2092
|
+
display: flex;
|
|
2093
|
+
flex-direction: column;
|
|
2094
|
+
gap: 12px;
|
|
2095
|
+
}
|
|
2096
|
+
|
|
2097
|
+
.store-modal__product-summary__row {
|
|
2071
2098
|
display: flex;
|
|
2072
2099
|
justify-content: space-between;
|
|
2073
2100
|
align-items: center;
|
|
2074
2101
|
}
|
|
2075
2102
|
|
|
2103
|
+
.store-modal__product-summary__error {
|
|
2104
|
+
font-size: 14px;
|
|
2105
|
+
color: var(--error_text_color, #c00);
|
|
2106
|
+
line-height: 1.4;
|
|
2107
|
+
}
|
|
2108
|
+
|
|
2109
|
+
.store-modal__product-summary__error-button {
|
|
2110
|
+
background: none;
|
|
2111
|
+
color: inherit;
|
|
2112
|
+
font: inherit;
|
|
2113
|
+
text-decoration: inherit;
|
|
2114
|
+
text-align: inherit;
|
|
2115
|
+
border: 0;
|
|
2116
|
+
border-radius: 0;
|
|
2117
|
+
padding: 0;
|
|
2118
|
+
margin: 0;
|
|
2119
|
+
appearance: none;
|
|
2120
|
+
text-transform: inherit;
|
|
2121
|
+
text-decoration: underline;
|
|
2122
|
+
}
|
|
2123
|
+
.store-modal__product-summary__error-button:active, .store-modal__product-summary__error-button:focus {
|
|
2124
|
+
outline: none;
|
|
2125
|
+
}
|
|
2126
|
+
.store-modal__product-summary__error-button:not(:disabled) {
|
|
2127
|
+
cursor: pointer;
|
|
2128
|
+
}
|
|
2129
|
+
|
|
2076
2130
|
.store-modal__product-summary__add-to-cart-button {
|
|
2077
2131
|
background: none;
|
|
2078
2132
|
color: inherit;
|