@funnelsgrove/payments 0.11.10 → 0.11.12
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.
|
@@ -11,6 +11,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
11
11
|
return t;
|
|
12
12
|
};
|
|
13
13
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
|
+
import { useMemo } from 'react';
|
|
14
15
|
import { ApplePaySubscribeButton } from './ApplePaySubscribeButton.js';
|
|
15
16
|
import { WalletSubscriptionCheckoutLoadingPlaceholder, WalletSubscriptionCheckoutSlot, } from './WalletSubscriptionCheckoutSlot.js';
|
|
16
17
|
const applePayExpressCheckoutOptions = {
|
|
@@ -42,7 +43,10 @@ const applePayExpressCheckoutOptions = {
|
|
|
42
43
|
* primitive; its checkout session must never be shared across placements.
|
|
43
44
|
*/
|
|
44
45
|
export function ApplePaySubscriptionCheckoutSlot(_a) {
|
|
45
|
-
var _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
46
46
|
var { options, placeholderLabel = 'Subscribe with Apple Pay' } = _a, slotProps = __rest(_a, ["options", "placeholderLabel"]);
|
|
47
|
-
|
|
47
|
+
const expressCheckoutOptions = useMemo(() => {
|
|
48
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
49
|
+
return (Object.assign(Object.assign(Object.assign({}, applePayExpressCheckoutOptions), (options !== null && options !== void 0 ? options : {})), { buttonTheme: Object.assign(Object.assign({}, ((_a = applePayExpressCheckoutOptions.buttonTheme) !== null && _a !== void 0 ? _a : {})), ((_b = options === null || options === void 0 ? void 0 : options.buttonTheme) !== null && _b !== void 0 ? _b : {})), buttonType: Object.assign(Object.assign({}, ((_c = applePayExpressCheckoutOptions.buttonType) !== null && _c !== void 0 ? _c : {})), ((_d = options === null || options === void 0 ? void 0 : options.buttonType) !== null && _d !== void 0 ? _d : {})), layout: Object.assign(Object.assign({}, ((_e = applePayExpressCheckoutOptions.layout) !== null && _e !== void 0 ? _e : {})), ((_f = options === null || options === void 0 ? void 0 : options.layout) !== null && _f !== void 0 ? _f : {})), paymentMethods: Object.assign(Object.assign({}, ((_g = applePayExpressCheckoutOptions.paymentMethods) !== null && _g !== void 0 ? _g : {})), ((_h = options === null || options === void 0 ? void 0 : options.paymentMethods) !== null && _h !== void 0 ? _h : {})), paymentMethodOrder: (_j = options === null || options === void 0 ? void 0 : options.paymentMethodOrder) !== null && _j !== void 0 ? _j : applePayExpressCheckoutOptions.paymentMethodOrder }));
|
|
50
|
+
}, [options]);
|
|
51
|
+
return (_jsx(WalletSubscriptionCheckoutSlot, Object.assign({}, slotProps, { availabilityPaymentMethod: 'applePay', options: expressCheckoutOptions, placeholderLabel: placeholderLabel, renderPreparingPlaceholder: (placeholderProps) => (_jsx(WalletSubscriptionCheckoutLoadingPlaceholder, Object.assign({}, placeholderProps, { label: 'Loading Apple Pay' }))), renderPlaceholder: (placeholderProps) => (_jsx(ApplePaySubscribeButton, Object.assign({}, placeholderProps))) })));
|
|
48
52
|
}
|
|
@@ -11,6 +11,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
11
11
|
return t;
|
|
12
12
|
};
|
|
13
13
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
|
+
import { useMemo } from 'react';
|
|
14
15
|
import { GooglePaySubscribeButton } from './GooglePaySubscribeButton.js';
|
|
15
16
|
import { WalletSubscriptionCheckoutLoadingPlaceholder, WalletSubscriptionCheckoutSlot, } from './WalletSubscriptionCheckoutSlot.js';
|
|
16
17
|
const googlePayExpressCheckoutOptions = {
|
|
@@ -42,7 +43,10 @@ const googlePayExpressCheckoutOptions = {
|
|
|
42
43
|
* primitive; its checkout session must never be shared across placements.
|
|
43
44
|
*/
|
|
44
45
|
export function GooglePaySubscriptionCheckoutSlot(_a) {
|
|
45
|
-
var _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
46
46
|
var { options, placeholderLabel = 'Subscribe with Google Pay' } = _a, slotProps = __rest(_a, ["options", "placeholderLabel"]);
|
|
47
|
-
|
|
47
|
+
const expressCheckoutOptions = useMemo(() => {
|
|
48
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
49
|
+
return (Object.assign(Object.assign(Object.assign({}, googlePayExpressCheckoutOptions), (options !== null && options !== void 0 ? options : {})), { buttonTheme: Object.assign(Object.assign({}, ((_a = googlePayExpressCheckoutOptions.buttonTheme) !== null && _a !== void 0 ? _a : {})), ((_b = options === null || options === void 0 ? void 0 : options.buttonTheme) !== null && _b !== void 0 ? _b : {})), buttonType: Object.assign(Object.assign({}, ((_c = googlePayExpressCheckoutOptions.buttonType) !== null && _c !== void 0 ? _c : {})), ((_d = options === null || options === void 0 ? void 0 : options.buttonType) !== null && _d !== void 0 ? _d : {})), layout: Object.assign(Object.assign({}, ((_e = googlePayExpressCheckoutOptions.layout) !== null && _e !== void 0 ? _e : {})), ((_f = options === null || options === void 0 ? void 0 : options.layout) !== null && _f !== void 0 ? _f : {})), paymentMethods: Object.assign(Object.assign({}, ((_g = googlePayExpressCheckoutOptions.paymentMethods) !== null && _g !== void 0 ? _g : {})), ((_h = options === null || options === void 0 ? void 0 : options.paymentMethods) !== null && _h !== void 0 ? _h : {})), paymentMethodOrder: (_j = options === null || options === void 0 ? void 0 : options.paymentMethodOrder) !== null && _j !== void 0 ? _j : googlePayExpressCheckoutOptions.paymentMethodOrder }));
|
|
50
|
+
}, [options]);
|
|
51
|
+
return (_jsx(WalletSubscriptionCheckoutSlot, Object.assign({}, slotProps, { availabilityPaymentMethod: 'googlePay', options: expressCheckoutOptions, placeholderLabel: placeholderLabel, renderPreparingPlaceholder: (placeholderProps) => (_jsx(WalletSubscriptionCheckoutLoadingPlaceholder, Object.assign({}, placeholderProps, { label: 'Loading Google Pay' }))), renderPlaceholder: (placeholderProps) => (_jsx(GooglePaySubscribeButton, Object.assign({}, placeholderProps))) })));
|
|
48
52
|
}
|
|
@@ -215,8 +215,13 @@ export function StripeCheckoutExpressCheckoutButton({ beforeConfirm, checkoutAna
|
|
|
215
215
|
window.location.assign(returnUrl);
|
|
216
216
|
}
|
|
217
217
|
};
|
|
218
|
-
const handleClick = (event) => {
|
|
218
|
+
const handleClick = async (event) => {
|
|
219
219
|
queueCheckoutStarted(event.expressPaymentType);
|
|
220
|
+
const updated = await ensureServerUpdated(event.expressPaymentType);
|
|
221
|
+
if (!updated) {
|
|
222
|
+
event.reject();
|
|
223
|
+
return;
|
|
224
|
+
}
|
|
220
225
|
event.resolve();
|
|
221
226
|
};
|
|
222
227
|
const handleCancel = () => {
|