fontdue-js 2.18.2 → 2.18.3
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__/StoreModalCartQuery.graphql.d.ts +1 -1
- package/dist/__generated__/StoreModalCartQuery.graphql.js +15 -3
- package/dist/__generated__/StoreModalUnifiedCheckout_viewer.graphql.d.ts +3 -1
- package/dist/__generated__/StoreModalUnifiedCheckout_viewer.graphql.js +14 -2
- package/dist/components/elements/StoreModalUnifiedCheckout.js +61 -13
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
/**
|
|
8
|
-
* @generated SignedSource<<
|
|
8
|
+
* @generated SignedSource<<fcbe77c4d0e8c794f4153db4cb46abec>>
|
|
9
9
|
* @lightSyntaxTransform
|
|
10
10
|
* @nogrep
|
|
11
11
|
*/
|
|
@@ -427,6 +427,18 @@ const node = function () {
|
|
|
427
427
|
"kind": "ScalarField",
|
|
428
428
|
"name": "newsletterOptInLabel",
|
|
429
429
|
"storageKey": "newsletterOptInLabel(format:\"HTML\")"
|
|
430
|
+
}, {
|
|
431
|
+
"alias": null,
|
|
432
|
+
"args": null,
|
|
433
|
+
"kind": "ScalarField",
|
|
434
|
+
"name": "recaptchaEnabled",
|
|
435
|
+
"storageKey": null
|
|
436
|
+
}, {
|
|
437
|
+
"alias": null,
|
|
438
|
+
"args": null,
|
|
439
|
+
"kind": "ScalarField",
|
|
440
|
+
"name": "recaptchaSiteKey",
|
|
441
|
+
"storageKey": null
|
|
430
442
|
}],
|
|
431
443
|
"storageKey": null
|
|
432
444
|
}, {
|
|
@@ -936,12 +948,12 @@ const node = function () {
|
|
|
936
948
|
}]
|
|
937
949
|
},
|
|
938
950
|
"params": {
|
|
939
|
-
"cacheID": "
|
|
951
|
+
"cacheID": "7b0e7fae5f931cd4a2baaca7dc445f11",
|
|
940
952
|
"id": null,
|
|
941
953
|
"metadata": {},
|
|
942
954
|
"name": "StoreModalCartQuery",
|
|
943
955
|
"operationKind": "query",
|
|
944
|
-
"text": "query StoreModalCartQuery {\n viewer {\n ...StripeProvider_viewer\n ...OrderVariableSelection_variables\n ...StoreModalOrderVariableSelection_viewer\n ...StoreModalUnifiedCheckout_viewer\n settings {\n taxSystem\n }\n currentOrder {\n ...CartState_order\n ...CartTotals_order\n ...StoreModalUnifiedCheckout_order\n ...StoreModalOrderVariableSelection_order\n id\n total {\n amount\n }\n orderVariableSelections {\n id\n }\n orderItems {\n id\n ...CartItem_node\n licenseSelections {\n licenseVariable {\n variableType\n id\n }\n variableText\n id\n }\n }\n discount {\n id\n }\n stripePaymentMethod {\n id\n }\n billingIdentity {\n name\n }\n }\n id\n }\n}\n\nfragment AddressFields_viewer on Viewer {\n countries {\n code\n name\n }\n settings {\n checkoutAddressCollection\n checkoutPhoneNumberCollection\n }\n}\n\nfragment CartItemAdditionalLicenses_licenses on License {\n id\n name\n}\n\nfragment CartItemAdditionalLicenses_orderItem on OrderItem {\n licenseSelections {\n license {\n id\n }\n id\n }\n}\n\nfragment CartItemLicense_selection on LicenseSelection {\n id\n license {\n id\n name\n licenseVariables {\n id\n ...CartItemVariable_variable\n }\n }\n licenseVariable {\n id\n }\n ...CartItemVariable_selection\n}\n\nfragment CartItemProduct_product on SkuProduct {\n __isSkuProduct: __typename\n __typename\n ...CollectionAa_product\n ...FontStyle_fontStyle\n ... on FontStyle {\n family {\n name\n cssUrl\n id\n }\n name\n variableInstances {\n name\n }\n }\n ... on Bundle {\n name\n }\n ... on FontCollection {\n name\n isVariableFont\n totalStyles\n featureStyle {\n family {\n cssUrl\n id\n }\n id\n }\n }\n ... on CollectionBundle {\n name\n totalStyles\n }\n}\n\nfragment CartItemVariable_selection on LicenseSelection {\n id\n variableText\n license {\n id\n }\n licenseVariable {\n ...VariableTableAmounts_variable\n id\n name\n variableType\n licenseOptions {\n id\n }\n }\n licenseOption {\n ...VariableTableAmounts_option\n id\n name\n amount\n }\n}\n\nfragment CartItemVariable_variable on LicenseVariable {\n id\n licenseOptions {\n id\n name\n amount\n }\n}\n\nfragment CartItem_node on OrderItem {\n ...CartItemAdditionalLicenses_orderItem\n id\n price {\n ...Price_price\n }\n sku {\n price {\n ...Price_price\n }\n product {\n ...CartItemProduct_product\n __typename\n ... on Licenseable {\n __isLicenseable: __typename\n licenses {\n ...CartItemAdditionalLicenses_licenses\n id\n licenseVariables {\n id\n licenseOptions {\n id\n }\n }\n }\n }\n ... on Node {\n __isNode: __typename\n id\n }\n }\n id\n }\n licenseSelections {\n ...CartItemLicense_selection\n id\n license {\n id\n }\n licenseVariable {\n id\n }\n licenseOption {\n id\n }\n variableText\n }\n}\n\nfragment CartState_order on Order {\n id\n orderItems {\n id\n licenseSelections {\n license {\n id\n }\n licenseVariable {\n id\n }\n licenseOption {\n id\n }\n variableText\n id\n }\n }\n orderVariableSelections {\n orderVariable {\n id\n }\n orderVariableOption {\n id\n }\n countryCode\n id\n }\n}\n\nfragment CartTotals_order on Order {\n subtotal {\n ...Price_price\n }\n discount {\n amount {\n amount\n ...Price_price\n }\n coupon {\n ...CouponText_coupon\n id\n }\n id\n }\n discountedSubtotal {\n ...Price_price\n }\n total {\n amount\n ...Price_price\n }\n taxRate\n taxes {\n ...Price_price\n }\n taxName\n gstIncluded\n}\n\nfragment CollectionAa_product on SkuProduct {\n __isSkuProduct: __typename\n __typename\n ... on FontCollection {\n featureStyle {\n ...FontStyle_fontStyle\n id\n }\n }\n ... on Bundle {\n fontStyles {\n ...FontStyle_fontStyle\n id\n }\n }\n}\n\nfragment CouponText_coupon on Coupon {\n type\n percentAmount\n creditAmount {\n amount\n currency\n }\n creditAmountRemaining {\n amount\n currency\n }\n}\n\nfragment FontStyle_fontStyle on FontStyle {\n cssFamily\n name\n}\n\nfragment OrderVariableSelection_variables on Viewer {\n orderVariables {\n id\n name\n variableType\n description(format: HTML, orderVariables: [])\n orderVariableOptions {\n id\n amount\n }\n }\n countries {\n code\n name\n }\n}\n\nfragment Price_price on Money {\n amount\n currency\n}\n\nfragment StoreModalOrderVariableSelection_order on Order {\n id\n orderVariableSelections {\n orderVariable {\n id\n name\n variableType\n }\n orderVariableDescription(format: HTML)\n orderVariableOption {\n id\n amount\n }\n countryCode\n id\n }\n}\n\nfragment StoreModalOrderVariableSelection_viewer on Viewer {\n ...OrderVariableSelection_variables\n orderVariables {\n id\n }\n settings {\n storeModalSelectOrderVariablesLabel(format: HTML)\n }\n}\n\nfragment StoreModalReviewIdentity_identity on Identity {\n email\n phoneFormatted\n addressFormatted\n vatNumber\n}\n\nfragment StoreModalUnifiedCheckout_order on Order {\n completeUrl\n canCompleteWithCoupon\n total {\n amount\n }\n customer {\n name\n email\n newsletterOptIn\n id\n }\n licenseeIsBillingIdentity\n licenseeIdentity {\n ...StoreModalReviewIdentity_identity\n name\n organization\n email\n phoneNullable\n street\n locality\n sublocality\n country\n administrativeArea\n zip\n vatNumber\n }\n billingIdentity {\n ...StoreModalReviewIdentity_identity\n name\n organization\n email\n phoneNullable\n street\n locality\n sublocality\n country\n administrativeArea\n zip\n vatNumber\n }\n stripePaymentIntent {\n clientSecret\n amount\n currency\n }\n orderVariableSelections {\n orderVariable {\n id\n variableType\n }\n orderVariableOption {\n id\n }\n countryCode\n id\n }\n}\n\nfragment StoreModalUnifiedCheckout_viewer on Viewer {\n ...AddressFields_viewer\n country\n detectedCountry\n settings {\n uiFontName\n eulaAgreementLabel(format: HTML)\n storeModalSelectLicenseeLabel(format: HTML)\n newsletterOptInLabel(format: HTML)\n taxSystem\n }\n themeConfig {\n customProperties\n }\n}\n\nfragment StripeProvider_viewer on Viewer {\n settings {\n taxSystem\n uiFontStyle {\n name\n cssFamily\n webfontSources {\n format\n url\n }\n id\n }\n }\n themeConfig {\n customProperties\n }\n stripeAccountId\n stripePublishableKey\n currentOrder {\n stripePaymentIntent {\n clientSecret\n }\n id\n }\n}\n\nfragment VariableTableAmounts_option on LicenseOption {\n amounts\n}\n\nfragment VariableTableAmounts_variable on LicenseVariable {\n units\n}\n"
|
|
956
|
+
"text": "query StoreModalCartQuery {\n viewer {\n ...StripeProvider_viewer\n ...OrderVariableSelection_variables\n ...StoreModalOrderVariableSelection_viewer\n ...StoreModalUnifiedCheckout_viewer\n settings {\n taxSystem\n }\n currentOrder {\n ...CartState_order\n ...CartTotals_order\n ...StoreModalUnifiedCheckout_order\n ...StoreModalOrderVariableSelection_order\n id\n total {\n amount\n }\n orderVariableSelections {\n id\n }\n orderItems {\n id\n ...CartItem_node\n licenseSelections {\n licenseVariable {\n variableType\n id\n }\n variableText\n id\n }\n }\n discount {\n id\n }\n stripePaymentMethod {\n id\n }\n billingIdentity {\n name\n }\n }\n id\n }\n}\n\nfragment AddressFields_viewer on Viewer {\n countries {\n code\n name\n }\n settings {\n checkoutAddressCollection\n checkoutPhoneNumberCollection\n }\n}\n\nfragment CartItemAdditionalLicenses_licenses on License {\n id\n name\n}\n\nfragment CartItemAdditionalLicenses_orderItem on OrderItem {\n licenseSelections {\n license {\n id\n }\n id\n }\n}\n\nfragment CartItemLicense_selection on LicenseSelection {\n id\n license {\n id\n name\n licenseVariables {\n id\n ...CartItemVariable_variable\n }\n }\n licenseVariable {\n id\n }\n ...CartItemVariable_selection\n}\n\nfragment CartItemProduct_product on SkuProduct {\n __isSkuProduct: __typename\n __typename\n ...CollectionAa_product\n ...FontStyle_fontStyle\n ... on FontStyle {\n family {\n name\n cssUrl\n id\n }\n name\n variableInstances {\n name\n }\n }\n ... on Bundle {\n name\n }\n ... on FontCollection {\n name\n isVariableFont\n totalStyles\n featureStyle {\n family {\n cssUrl\n id\n }\n id\n }\n }\n ... on CollectionBundle {\n name\n totalStyles\n }\n}\n\nfragment CartItemVariable_selection on LicenseSelection {\n id\n variableText\n license {\n id\n }\n licenseVariable {\n ...VariableTableAmounts_variable\n id\n name\n variableType\n licenseOptions {\n id\n }\n }\n licenseOption {\n ...VariableTableAmounts_option\n id\n name\n amount\n }\n}\n\nfragment CartItemVariable_variable on LicenseVariable {\n id\n licenseOptions {\n id\n name\n amount\n }\n}\n\nfragment CartItem_node on OrderItem {\n ...CartItemAdditionalLicenses_orderItem\n id\n price {\n ...Price_price\n }\n sku {\n price {\n ...Price_price\n }\n product {\n ...CartItemProduct_product\n __typename\n ... on Licenseable {\n __isLicenseable: __typename\n licenses {\n ...CartItemAdditionalLicenses_licenses\n id\n licenseVariables {\n id\n licenseOptions {\n id\n }\n }\n }\n }\n ... on Node {\n __isNode: __typename\n id\n }\n }\n id\n }\n licenseSelections {\n ...CartItemLicense_selection\n id\n license {\n id\n }\n licenseVariable {\n id\n }\n licenseOption {\n id\n }\n variableText\n }\n}\n\nfragment CartState_order on Order {\n id\n orderItems {\n id\n licenseSelections {\n license {\n id\n }\n licenseVariable {\n id\n }\n licenseOption {\n id\n }\n variableText\n id\n }\n }\n orderVariableSelections {\n orderVariable {\n id\n }\n orderVariableOption {\n id\n }\n countryCode\n id\n }\n}\n\nfragment CartTotals_order on Order {\n subtotal {\n ...Price_price\n }\n discount {\n amount {\n amount\n ...Price_price\n }\n coupon {\n ...CouponText_coupon\n id\n }\n id\n }\n discountedSubtotal {\n ...Price_price\n }\n total {\n amount\n ...Price_price\n }\n taxRate\n taxes {\n ...Price_price\n }\n taxName\n gstIncluded\n}\n\nfragment CollectionAa_product on SkuProduct {\n __isSkuProduct: __typename\n __typename\n ... on FontCollection {\n featureStyle {\n ...FontStyle_fontStyle\n id\n }\n }\n ... on Bundle {\n fontStyles {\n ...FontStyle_fontStyle\n id\n }\n }\n}\n\nfragment CouponText_coupon on Coupon {\n type\n percentAmount\n creditAmount {\n amount\n currency\n }\n creditAmountRemaining {\n amount\n currency\n }\n}\n\nfragment FontStyle_fontStyle on FontStyle {\n cssFamily\n name\n}\n\nfragment OrderVariableSelection_variables on Viewer {\n orderVariables {\n id\n name\n variableType\n description(format: HTML, orderVariables: [])\n orderVariableOptions {\n id\n amount\n }\n }\n countries {\n code\n name\n }\n}\n\nfragment Price_price on Money {\n amount\n currency\n}\n\nfragment StoreModalOrderVariableSelection_order on Order {\n id\n orderVariableSelections {\n orderVariable {\n id\n name\n variableType\n }\n orderVariableDescription(format: HTML)\n orderVariableOption {\n id\n amount\n }\n countryCode\n id\n }\n}\n\nfragment StoreModalOrderVariableSelection_viewer on Viewer {\n ...OrderVariableSelection_variables\n orderVariables {\n id\n }\n settings {\n storeModalSelectOrderVariablesLabel(format: HTML)\n }\n}\n\nfragment StoreModalReviewIdentity_identity on Identity {\n email\n phoneFormatted\n addressFormatted\n vatNumber\n}\n\nfragment StoreModalUnifiedCheckout_order on Order {\n completeUrl\n canCompleteWithCoupon\n total {\n amount\n }\n customer {\n name\n email\n newsletterOptIn\n id\n }\n licenseeIsBillingIdentity\n licenseeIdentity {\n ...StoreModalReviewIdentity_identity\n name\n organization\n email\n phoneNullable\n street\n locality\n sublocality\n country\n administrativeArea\n zip\n vatNumber\n }\n billingIdentity {\n ...StoreModalReviewIdentity_identity\n name\n organization\n email\n phoneNullable\n street\n locality\n sublocality\n country\n administrativeArea\n zip\n vatNumber\n }\n stripePaymentIntent {\n clientSecret\n amount\n currency\n }\n orderVariableSelections {\n orderVariable {\n id\n variableType\n }\n orderVariableOption {\n id\n }\n countryCode\n id\n }\n}\n\nfragment StoreModalUnifiedCheckout_viewer on Viewer {\n ...AddressFields_viewer\n country\n detectedCountry\n settings {\n uiFontName\n eulaAgreementLabel(format: HTML)\n storeModalSelectLicenseeLabel(format: HTML)\n newsletterOptInLabel(format: HTML)\n taxSystem\n recaptchaEnabled\n recaptchaSiteKey\n }\n themeConfig {\n customProperties\n }\n}\n\nfragment StripeProvider_viewer on Viewer {\n settings {\n taxSystem\n uiFontStyle {\n name\n cssFamily\n webfontSources {\n format\n url\n }\n id\n }\n }\n themeConfig {\n customProperties\n }\n stripeAccountId\n stripePublishableKey\n currentOrder {\n stripePaymentIntent {\n clientSecret\n }\n id\n }\n}\n\nfragment VariableTableAmounts_option on LicenseOption {\n amounts\n}\n\nfragment VariableTableAmounts_variable on LicenseVariable {\n units\n}\n"
|
|
945
957
|
}
|
|
946
958
|
};
|
|
947
959
|
}();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @generated SignedSource<<
|
|
2
|
+
* @generated SignedSource<<ca5c7d5a8678cb68a0990463a7bb9c53>>
|
|
3
3
|
* @lightSyntaxTransform
|
|
4
4
|
* @nogrep
|
|
5
5
|
*/
|
|
@@ -11,6 +11,8 @@ export type StoreModalUnifiedCheckout_viewer$data = {
|
|
|
11
11
|
readonly settings: {
|
|
12
12
|
readonly eulaAgreementLabel: string | null;
|
|
13
13
|
readonly newsletterOptInLabel: string | null;
|
|
14
|
+
readonly recaptchaEnabled: boolean;
|
|
15
|
+
readonly recaptchaSiteKey: string | null;
|
|
14
16
|
readonly storeModalSelectLicenseeLabel: string | null;
|
|
15
17
|
readonly taxSystem: string;
|
|
16
18
|
readonly uiFontName: string | null;
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
/**
|
|
8
|
-
* @generated SignedSource<<
|
|
8
|
+
* @generated SignedSource<<ca5c7d5a8678cb68a0990463a7bb9c53>>
|
|
9
9
|
* @lightSyntaxTransform
|
|
10
10
|
* @nogrep
|
|
11
11
|
*/
|
|
@@ -78,6 +78,18 @@ const node = function () {
|
|
|
78
78
|
"kind": "ScalarField",
|
|
79
79
|
"name": "taxSystem",
|
|
80
80
|
"storageKey": null
|
|
81
|
+
}, {
|
|
82
|
+
"alias": null,
|
|
83
|
+
"args": null,
|
|
84
|
+
"kind": "ScalarField",
|
|
85
|
+
"name": "recaptchaEnabled",
|
|
86
|
+
"storageKey": null
|
|
87
|
+
}, {
|
|
88
|
+
"alias": null,
|
|
89
|
+
"args": null,
|
|
90
|
+
"kind": "ScalarField",
|
|
91
|
+
"name": "recaptchaSiteKey",
|
|
92
|
+
"storageKey": null
|
|
81
93
|
}],
|
|
82
94
|
"storageKey": null
|
|
83
95
|
}, {
|
|
@@ -100,6 +112,6 @@ const node = function () {
|
|
|
100
112
|
"abstractKey": null
|
|
101
113
|
};
|
|
102
114
|
}();
|
|
103
|
-
node.hash = "
|
|
115
|
+
node.hash = "048ce405742611f6684cb5306d28478b";
|
|
104
116
|
var _default = node;
|
|
105
117
|
exports.default = _default;
|
|
@@ -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",
|