@paydock/client-sdk 1.139.0 → 1.140.0-beta
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/README.md +2573 -0
- package/bundles/index.cjs +1296 -508
- package/bundles/index.cjs.d.ts +1377 -200
- package/bundles/index.mjs +1295 -509
- package/bundles/index.mjs.d.ts +1377 -200
- package/bundles/types/checkout/checkout.d.ts.map +1 -1
- package/bundles/types/checkout/v1/instructions/instruction.card_form.show.d.ts.map +1 -1
- package/bundles/types/checkout/v3/instructions/instruction.card_form.show.d.ts.map +1 -1
- package/bundles/types/checkout/v3/instructions/instruction.payment_methods.show.d.ts.map +1 -1
- package/bundles/types/checkout-button/zipmoney/zipmoney-contextual.runner.d.ts +1 -2
- package/bundles/types/checkout-button/zipmoney/zipmoney-contextual.runner.d.ts.map +1 -1
- package/bundles/types/open-wallets/apple-pay-open-wallet-button.d.ts +70 -0
- package/bundles/types/open-wallets/apple-pay-open-wallet-button.d.ts.map +1 -0
- package/bundles/types/open-wallets/base/open-wallet-buttons.d.ts +242 -74
- package/bundles/types/open-wallets/base/open-wallet-buttons.d.ts.map +1 -1
- package/bundles/types/open-wallets/base/open-wallet.service.d.ts +62 -4
- package/bundles/types/open-wallets/base/open-wallet.service.d.ts.map +1 -1
- package/bundles/types/open-wallets/enum/error-operation.enum.d.ts +15 -0
- package/bundles/types/open-wallets/enum/error-operation.enum.d.ts.map +1 -0
- package/bundles/types/open-wallets/enum/event.enum.d.ts +11 -3
- package/bundles/types/open-wallets/enum/event.enum.d.ts.map +1 -1
- package/bundles/types/open-wallets/enum/token-type.enum.d.ts +10 -0
- package/bundles/types/open-wallets/enum/token-type.enum.d.ts.map +1 -0
- package/bundles/types/open-wallets/google-pay-open-wallet-button.d.ts +65 -0
- package/bundles/types/open-wallets/google-pay-open-wallet-button.d.ts.map +1 -0
- package/bundles/types/open-wallets/index.d.ts +293 -0
- package/bundles/types/open-wallets/index.d.ts.map +1 -1
- package/bundles/types/open-wallets/interfaces/events.interface.d.ts +87 -14
- package/bundles/types/open-wallets/interfaces/events.interface.d.ts.map +1 -1
- package/bundles/types/open-wallets/interfaces/google-pay/google-pay-meta.interface.d.ts +6 -0
- package/bundles/types/open-wallets/interfaces/google-pay/google-pay-meta.interface.d.ts.map +1 -1
- package/bundles/types/open-wallets/interfaces/index.d.ts +2 -2
- package/bundles/types/open-wallets/interfaces/index.d.ts.map +1 -1
- package/bundles/types/open-wallets/interfaces/open-wallet-meta.interface.d.ts +12 -0
- package/bundles/types/open-wallets/interfaces/open-wallet-meta.interface.d.ts.map +1 -1
- package/bundles/types/open-wallets/interfaces/payment-source.interface.d.ts +28 -2
- package/bundles/types/open-wallets/interfaces/payment-source.interface.d.ts.map +1 -1
- package/bundles/types/open-wallets/services/apple-pay/apple-pay.open-wallet.service.d.ts +27 -2
- package/bundles/types/open-wallets/services/apple-pay/apple-pay.open-wallet.service.d.ts.map +1 -1
- package/bundles/types/open-wallets/services/google-pay/constants/google-pay.constants.d.ts +9 -0
- package/bundles/types/open-wallets/services/google-pay/constants/google-pay.constants.d.ts.map +1 -1
- package/bundles/types/open-wallets/services/google-pay/google-pay.open-wallet.service.d.ts +20 -9
- package/bundles/types/open-wallets/services/google-pay/google-pay.open-wallet.service.d.ts.map +1 -1
- package/bundles/types/open-wallets/services/google-pay/utils/google-pay.utils.d.ts +45 -0
- package/bundles/types/open-wallets/services/google-pay/utils/google-pay.utils.d.ts.map +1 -1
- package/bundles/types/open-wallets/services/google-pay/utils/index.d.ts +1 -1
- package/bundles/types/open-wallets/services/google-pay/utils/index.d.ts.map +1 -1
- package/bundles/types/open-wallets/services/google-pay/validation/google-pay.validation.d.ts +13 -0
- package/bundles/types/open-wallets/services/google-pay/validation/google-pay.validation.d.ts.map +1 -1
- package/bundles/types/open-wallets/types/base-event-data.interface.d.ts +24 -2
- package/bundles/types/open-wallets/types/base-event-data.interface.d.ts.map +1 -1
- package/bundles/types/open-wallets/types/index.d.ts +2 -1
- package/bundles/types/open-wallets/types/index.d.ts.map +1 -1
- package/bundles/types/open-wallets/types/on-shipping-address-change-event-data.interface.d.ts +16 -2
- package/bundles/types/open-wallets/types/on-shipping-address-change-event-data.interface.d.ts.map +1 -1
- package/bundles/types/open-wallets/types/on-shipping-address-change-event-response.interface.d.ts +20 -2
- package/bundles/types/open-wallets/types/on-shipping-address-change-event-response.interface.d.ts.map +1 -1
- package/bundles/types/open-wallets/types/on-shipping-option-change-event-data.interface.d.ts +13 -2
- package/bundles/types/open-wallets/types/on-shipping-option-change-event-data.interface.d.ts.map +1 -1
- package/bundles/types/open-wallets/types/on-shipping-option-change-event-response.interface.d.ts +12 -0
- package/bundles/types/open-wallets/types/on-shipping-option-change-event-response.interface.d.ts.map +1 -1
- package/bundles/types/open-wallets/types/payment-source.type.d.ts +3 -2
- package/bundles/types/open-wallets/types/payment-source.type.d.ts.map +1 -1
- package/bundles/types/open-wallets/types/shipping-event-to-response.type.d.ts +8 -0
- package/bundles/types/open-wallets/types/shipping-event-to-response.type.d.ts.map +1 -1
- package/bundles/widget.umd.js +1296 -508
- package/bundles/widget.umd.js.d.ts +1377 -200
- package/bundles/widget.umd.js.min.d.ts +1377 -200
- package/bundles/widget.umd.min.js +1 -1
- package/docs/open-wallet-buttons-examples.md +561 -830
- package/docs/open-wallet-buttons.md +1652 -0
- package/package.json +1 -1
- package/slate.md +1673 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkout.d.ts","sourceRoot":"","sources":["../../src/checkout/checkout.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAE7D,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,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iBAAiB,CAAC;IAC1C,SAAS,CAAC,kBAAkB,EAAE,sBAAsB,GAAG,qBAAqB,CAAC;IAC7E,OAAO,CAAC,sBAAsB,CAAyB;IACvD,OAAO,CAAC,YAAY,CAAgC;IACpD,OAAO,CAAC,eAAe,CAAS;IAChC,OAAO,CAAC,cAAc,CAAS;IAC/B,OAAO,CAAC,gBAAgB,CAAS;gBAGrB,QAAQ,EAAE,MAAM,EAChB,WAAW,EAAE,MAAM,EACnB,KAAK,UAAQ;IA8BlB,gBAAgB;IA4BhB,gBAAgB;IAOvB,OAAO,CAAC,iBAAiB;IAUzB,OAAO,CAAC,yBAAyB;IA6B1B,6BAA6B,CAAC,iBAAiB,EAAE,MAAM,EAAE,GAAG,OAAO;IAQ1E,OAAO,CAAC,KAAK;IAwBb,OAAO,CAAC,mBAAmB;IAW3B,OAAO,CAAC,oBAAoB;IAO5B,OAAO,CAAC,iBAAiB;IASzB,OAAO,CAAC,yBAAyB;IASjC,OAAO,CAAC,0BAA0B;IAiBlC,OAAO,CAAC,qCAAqC;IAQ7C,OAAO,CAAC,MAAM;IAId;;;;;;;;OAQG;IACI,mBAAmB,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,UAAU,KAAK,IAAI;IAI9D;;;;;;;;OAQG;IACI,gBAAgB,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,UAAU,KAAK,IAAI;IAI3D;;;;;;;;OAQG;IACI,gBAAgB,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,UAAU,KAAK,IAAI;IAIpD,qBAAqB;IAI5B,OAAO,CAAC,8BAA8B;CAGvC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instruction.card_form.show.d.ts","sourceRoot":"","sources":["../../../../src/checkout/v1/instructions/instruction.card_form.show.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAW,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"instruction.card_form.show.d.ts","sourceRoot":"","sources":["../../../../src/checkout/v1/instructions/instruction.card_form.show.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAW,MAAM,iBAAiB,CAAC;AAGtD,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AAGvE,qBACa,uBAAwB,SAAQ,kBAAkB;IAC7D,SAAS,CAAC,MAAM,EAAE,UAAU,CAAC;IAC7B,OAAO,CAAC,SAAS,CAAgC;IAE1C,MAAM,CAAC,OAAO,EAAE;QACrB,iBAAiB,EAAE,MAAM,CAAC;QAC1B,OAAO,EAAE;YACP,aAAa,CAAC,EAAE;gBAAE,IAAI,CAAC,EAAE,MAAM,CAAA;aAAE,CAAC;YAClC,WAAW,EAAE;gBAAE,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,QAAQ,GAAG,UAAU,CAAA;aAAE,CAAC;SACnE,CAAC;KACH,GAAG,IAAI;IA4FD,OAAO;CAIf"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instruction.card_form.show.d.ts","sourceRoot":"","sources":["../../../../src/checkout/v3/instructions/instruction.card_form.show.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,UAAU,EAAW,MAAM,iBAAiB,CAAC;AAGtD,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AAGvE,qBACa,uBAAwB,SAAQ,kBAAkB;IAC7D,SAAS,CAAC,MAAM,EAAE,UAAU,CAAC;IAC7B,OAAO,CAAC,SAAS,
|
|
1
|
+
{"version":3,"file":"instruction.card_form.show.d.ts","sourceRoot":"","sources":["../../../../src/checkout/v3/instructions/instruction.card_form.show.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,UAAU,EAAW,MAAM,iBAAiB,CAAC;AAGtD,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AAGvE,qBACa,uBAAwB,SAAQ,kBAAkB;IAC7D,SAAS,CAAC,MAAM,EAAE,UAAU,CAAC;IAC7B,OAAO,CAAC,SAAS,CAAgC;IAE1C,MAAM,CAAC,OAAO,EAAE;QACrB,iBAAiB,EAAE,MAAM,CAAC;QAC1B,OAAO,EAAE;YACP,aAAa,CAAC,EAAE;gBAAE,IAAI,CAAC,EAAE,MAAM,CAAA;aAAE,CAAC;YAClC,WAAW,EAAE;gBAAE,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,QAAQ,GAAG,UAAU,CAAA;aAAE,CAAC;YAClE,WAAW,EAAE;gBAAE,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAAA;aAAE,CAAC;YACnD,kCAAkC,EAAE,OAAO,CAAC;YAC5C,YAAY,EAAE,OAAO,CAAC;SACvB,CAAC;KACH,GAAG,IAAI;IA8JR,OAAO;IAKP,OAAO,CAAC,eAAe;CAexB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instruction.payment_methods.show.d.ts","sourceRoot":"","sources":["../../../../src/checkout/v3/instructions/instruction.payment_methods.show.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AASvE,qBACa,4BAA6B,SAAQ,kBAAkB;IAClE,OAAO,CAAC,SAAS,
|
|
1
|
+
{"version":3,"file":"instruction.payment_methods.show.d.ts","sourceRoot":"","sources":["../../../../src/checkout/v3/instructions/instruction.payment_methods.show.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AASvE,qBACa,4BAA6B,SAAQ,kBAAkB;IAClE,OAAO,CAAC,SAAS,CAAgC;IAEjD,MAAM,CAAC,OAAO,EAAE;QACd,iBAAiB,EAAE,MAAM,CAAC;QAC1B,OAAO,EAAE;YACP,4BAA4B,EAAE,MAAM,EAAE,CAAC;YACvC,aAAa,CAAC,EAAE;gBACd,IAAI,CAAC,EAAE;oBACL,YAAY,CAAC,EAAE,MAAM,CAAC;oBACtB,YAAY,CAAC,EAAE,MAAM,CAAC;oBACtB,gBAAgB,CAAC,EAAE,MAAM,CAAC;iBAC3B,CAAC;aACH,CAAC;SACH,CAAC;KACH,GAAG,IAAI;IAoBR,OAAO;IAKP,OAAO,CAAC,sBAAsB;YAYhB,mBAAmB;IAoBjC,OAAO,CAAC,uBAAuB;IAiB/B,OAAO,CAAC,mBAAmB;CAG5B"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
1
|
import { IFrameEvent } from '../../components/iframe-event';
|
|
3
2
|
import type { ICheckout } from '../../external-checkout/builder';
|
|
4
3
|
import { EventEmitter } from '../../helper/event-emitter';
|
|
@@ -32,7 +31,7 @@ export declare class ZipmoneyContextualRunner extends ZipmoneyContextualRunner_b
|
|
|
32
31
|
protected event: IFrameEvent;
|
|
33
32
|
protected widgetId: string;
|
|
34
33
|
protected checkoutTab: Window | null;
|
|
35
|
-
protected checkInterval:
|
|
34
|
+
protected checkInterval: ReturnType<typeof setInterval> | undefined;
|
|
36
35
|
constructor();
|
|
37
36
|
run(): void;
|
|
38
37
|
isRunning(): boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zipmoney-contextual.runner.d.ts","sourceRoot":"","sources":["../../../src/checkout-button/zipmoney/zipmoney-contextual.runner.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"zipmoney-contextual.runner.d.ts","sourceRoot":"","sources":["../../../src/checkout-button/zipmoney/zipmoney-contextual.runner.ts"],"names":[],"mappings":"AACA,OAAO,EAAS,WAAW,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAEL,KAAK,iBAAiB,EAEvB,MAAM,6BAA6B,CAAC;AAKrC,OAAO,EAAc,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAE/D,aAAK,cAAc;IACjB,QAAQ,aAAa;IACrB,QAAQ,aAAa;IACrB,SAAS,cAAc;IACvB,QAAQ,aAAa;CACtB;;;;;;;;;;;;;;;;AAED,qBAAa,wBACX,SAAQ,6BACR,YAAW,iBAAiB;IAE5B,SAAS,CAAC,QAAQ,EAAE,SAAS,CAAC;IAC9B,SAAS,CAAC,IAAI,UAAS;IACvB,SAAS,CAAC,YAAY,EAAE,YAAY,CAAC;IACrC,SAAS,CAAC,KAAK,EAAE,WAAW,CAAC;IAC7B,SAAS,CAAC,QAAQ,EAAE,MAAM,CAAmB;IAC7C,SAAS,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAQ;IAC5C,SAAS,CAAC,aAAa,EAAE,UAAU,CAAC,OAAO,WAAW,CAAC,GAAG,SAAS,CAAC;;IAQ7D,GAAG,IAAI,IAAI;IAQX,SAAS,IAAI,OAAO;IAIpB,IAAI,CAAC,YAAY,EAAE,SAAS;IAM5B,qBAAqB,IAAI,MAAM;IAS/B,mBAAmB,IAAI,MAAM;IAI7B,IAAI;IAeJ,MAAM,CAAC,EAAE,EAAE,MAAM,IAAI,GAAG,IAAI;IAO5B,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,QAAQ,EAAE,SAAS,KAAK,IAAI;IAMlE,SAAS,CAAC,YAAY,CAAC,IAAI,EAAE;QAAE,KAAK,EAAE,cAAc,CAAA;KAAE;IA8BtD,OAAO,CAAC,mBAAmB;IAY3B,OAAO,CAAC,2BAA2B;IAWnC,OAAO,CAAC,aAAa;CAMtB"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { type GetConfigResponse } from '../api/api-service-internal';
|
|
2
|
+
import type { OpenWalletService } from './base/open-wallet.service';
|
|
3
|
+
import { OpenWalletButtons } from './base/open-wallet-buttons';
|
|
4
|
+
import type { ApplePayOpenWalletMeta } from './services/apple-pay';
|
|
5
|
+
import type { WalletType } from './types';
|
|
6
|
+
/**
|
|
7
|
+
* @classdesc Apple Pay wallet button that creates One-Time Tokens (OTT) via Apple Pay.
|
|
8
|
+
*
|
|
9
|
+
* Provides a fully typed Apple Pay integration with Apple Pay-specific metadata
|
|
10
|
+
* and validates that the service configuration corresponds to an Apple Pay service.
|
|
11
|
+
* On `load()`, the button fetches the service configuration and raises an error via `onError`
|
|
12
|
+
* if the service type does not match Apple Pay.
|
|
13
|
+
*
|
|
14
|
+
* @class ApplePayOpenWalletButton
|
|
15
|
+
* @extends OpenWalletButtons
|
|
16
|
+
*
|
|
17
|
+
* @param {string} selector - CSS selector of the HTML element that will contain the Apple Pay button.
|
|
18
|
+
* @param {string} publicKeyOrAccessToken - Public key or access token for API authentication.
|
|
19
|
+
* @param {string} serviceId - The Apple Pay service ID configured in PayDock dashboard.
|
|
20
|
+
* @param {ApplePayOpenWalletMeta} meta - Apple Pay-specific metadata (amount, currency, country, amount_label, store_name, style, apple_pay_capabilities, etc.).
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* const button = new ApplePayOpenWalletButton(
|
|
24
|
+
* '#wallet-container',
|
|
25
|
+
* publicKeyOrAccessToken,
|
|
26
|
+
* serviceId,
|
|
27
|
+
* {
|
|
28
|
+
* amount: 100,
|
|
29
|
+
* currency: 'AUD',
|
|
30
|
+
* country: 'AU',
|
|
31
|
+
* amount_label: 'TOTAL',
|
|
32
|
+
* store_name: 'My Store',
|
|
33
|
+
* apple_pay_capabilities: ['credentials_available'],
|
|
34
|
+
* },
|
|
35
|
+
* );
|
|
36
|
+
* button.setEnv('sandbox');
|
|
37
|
+
* button.onSuccess((data) => console.log('OTT:', data.token));
|
|
38
|
+
* button.onError((error) => console.error('Error:', error));
|
|
39
|
+
* button.load();
|
|
40
|
+
*/
|
|
41
|
+
export declare class ApplePayOpenWalletButton extends OpenWalletButtons<ApplePayOpenWalletMeta> {
|
|
42
|
+
/** @private */
|
|
43
|
+
readonly walletType: WalletType;
|
|
44
|
+
/**
|
|
45
|
+
* Validates Apple Pay-specific required metadata fields.
|
|
46
|
+
* Apple Pay requires `amount_label` and `store_name` to be present and strings.
|
|
47
|
+
*
|
|
48
|
+
* @private
|
|
49
|
+
* @throws {Error} If `amount_label` is missing or not a string.
|
|
50
|
+
* @throws {Error} If `store_name` is missing or not a string.
|
|
51
|
+
*/
|
|
52
|
+
protected validateWalletMeta(): void;
|
|
53
|
+
/**
|
|
54
|
+
* Validates that the service configuration type is Apple Pay.
|
|
55
|
+
*
|
|
56
|
+
* @private
|
|
57
|
+
* @param serviceConfig - The service configuration response from the API.
|
|
58
|
+
* @throws {Error} If the service type is not Apple Pay.
|
|
59
|
+
*/
|
|
60
|
+
protected validateServiceType(serviceConfig: GetConfigResponse): void;
|
|
61
|
+
/**
|
|
62
|
+
* Creates an Apple Pay wallet service instance.
|
|
63
|
+
*
|
|
64
|
+
* @private
|
|
65
|
+
* @param serviceConfig - The service configuration response from the API.
|
|
66
|
+
* @returns The Apple Pay wallet service instance.
|
|
67
|
+
*/
|
|
68
|
+
protected createWalletService(serviceConfig: GetConfigResponse): OpenWalletService;
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=apple-pay-open-wallet-button.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apple-pay-open-wallet-button.d.ts","sourceRoot":"","sources":["../../src/open-wallets/apple-pay-open-wallet-button.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,iBAAiB,EAAiB,MAAM,6BAA6B,CAAC;AACpF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAEnE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAG1C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,qBAAa,wBAAyB,SAAQ,iBAAiB,CAAC,sBAAsB,CAAC;IACrF,eAAe;IACf,SAAgB,UAAU,EAAE,UAAU,CAA0B;IAEhE;;;;;;;OAOG;IACH,SAAS,CAAC,kBAAkB,IAAI,IAAI;IAmBpC;;;;;;OAMG;IACH,SAAS,CAAC,mBAAmB,CAAC,aAAa,EAAE,iBAAiB,GAAG,IAAI;IASrE;;;;;;OAMG;IACH,SAAS,CAAC,mBAAmB,CAAC,aAAa,EAAE,iBAAiB,GAAG,iBAAiB;CAUnF"}
|
|
@@ -1,31 +1,90 @@
|
|
|
1
1
|
import { ApiInternal } from '../../api/api-internal';
|
|
2
|
+
import type { GetConfigResponse } from '../../api/api-service-internal';
|
|
2
3
|
import { Container } from '../../components/container';
|
|
3
4
|
import { EventEmitter } from '../../helper/event-emitter';
|
|
4
|
-
import
|
|
5
|
+
import { ERROR_OPERATION } from '../enum/error-operation.enum';
|
|
6
|
+
import type { OnCancelEventData, OnClickEventData, OnCreateOTTSuccessfulEventData, OnErrorEventData, OnLoadedEventData, OnUnavailableEventData, OpenWalletMeta } from '../interfaces';
|
|
5
7
|
import type { WalletType } from '../types';
|
|
6
8
|
import type { OnShippingAddressChangeEventData } from '../types/on-shipping-address-change-event-data.interface';
|
|
7
9
|
import type { OnShippingAddressChangeEventResponse } from '../types/on-shipping-address-change-event-response.interface';
|
|
8
10
|
import type { OnShippingOptionChangeEventData } from '../types/on-shipping-option-change-event-data.interface';
|
|
9
11
|
import type { OnShippingOptionChangeEventResponse } from '../types/on-shipping-option-change-event-response.interface';
|
|
10
|
-
|
|
12
|
+
import type { OpenWalletService } from './open-wallet.service';
|
|
13
|
+
/**
|
|
14
|
+
* @classdesc Abstract base class for Open Wallet buttons. **Do not instantiate directly.**
|
|
15
|
+
* Use {@link ApplePayOpenWalletButton} or {@link GooglePayOpenWalletButton} instead.
|
|
16
|
+
*
|
|
17
|
+
* Use one of the concrete implementations instead:
|
|
18
|
+
* - {@link ApplePayOpenWalletButton} for Apple Pay integration
|
|
19
|
+
* - {@link GooglePayOpenWalletButton} for Google Pay integration
|
|
20
|
+
*
|
|
21
|
+
* These subclasses inherit all event handlers and lifecycle methods documented below.
|
|
22
|
+
*
|
|
23
|
+
* @class OpenWalletButtons
|
|
24
|
+
* @abstract
|
|
25
|
+
* @hideconstructor
|
|
26
|
+
*/
|
|
27
|
+
export declare abstract class OpenWalletButtons<TMeta extends OpenWalletMeta = OpenWalletMeta> {
|
|
11
28
|
protected container: Container;
|
|
12
29
|
protected api: ApiInternal;
|
|
13
30
|
protected env: string;
|
|
14
31
|
protected serviceId: string;
|
|
15
|
-
protected meta:
|
|
32
|
+
protected meta: TMeta;
|
|
16
33
|
protected eventEmitter: EventEmitter;
|
|
17
|
-
|
|
18
|
-
|
|
34
|
+
protected walletService: OpenWalletService | undefined;
|
|
35
|
+
private onShippingOptionsChangeHandlerRegistered;
|
|
36
|
+
/** @private */
|
|
37
|
+
abstract readonly walletType: WalletType;
|
|
38
|
+
/** @private */
|
|
39
|
+
constructor(selector: string, publicKeyOrAccessToken: string, serviceId: string, meta: TMeta);
|
|
40
|
+
/**
|
|
41
|
+
* Creates the wallet-specific service instance for this button.
|
|
42
|
+
* Each concrete subclass implements this to instantiate its specific wallet service.
|
|
43
|
+
*
|
|
44
|
+
* @param serviceConfig - The service configuration response from the API.
|
|
45
|
+
* @returns The wallet service instance.
|
|
46
|
+
*/
|
|
47
|
+
protected abstract createWalletService(serviceConfig: GetConfigResponse): OpenWalletService;
|
|
48
|
+
/**
|
|
49
|
+
* Validates that the service configuration type matches the expected wallet type.
|
|
50
|
+
* Each concrete subclass implements this to ensure the service ID corresponds
|
|
51
|
+
* to the correct wallet type.
|
|
52
|
+
*
|
|
53
|
+
* @param serviceConfig - The service configuration response from the API.
|
|
54
|
+
* @throws {Error} If the service type does not match the expected wallet type.
|
|
55
|
+
*/
|
|
56
|
+
protected abstract validateServiceType(serviceConfig: GetConfigResponse): void;
|
|
57
|
+
/**
|
|
58
|
+
* Validates wallet-specific metadata requirements.
|
|
59
|
+
* Each concrete subclass implements this to enforce its own required fields
|
|
60
|
+
* (e.g. Apple Pay requires `amount_label`).
|
|
61
|
+
*
|
|
62
|
+
* Called automatically during construction after base meta validation.
|
|
63
|
+
*
|
|
64
|
+
* @throws {Error} If any wallet-specific required field is missing or invalid.
|
|
65
|
+
*/
|
|
66
|
+
protected abstract validateWalletMeta(): void;
|
|
19
67
|
private getApiAuthType;
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
68
|
+
/**
|
|
69
|
+
* Validates the base metadata fields common to all wallet types:
|
|
70
|
+
* `meta` must exist, `amount` must be a number, `currency` and `country` must be strings.
|
|
71
|
+
*
|
|
72
|
+
* @private
|
|
73
|
+
* @throws {Error} If any base required field is missing or has an invalid type.
|
|
74
|
+
*/
|
|
75
|
+
private validateBaseMeta;
|
|
76
|
+
protected getOpenWalletServiceConfig(): Promise<GetConfigResponse>;
|
|
77
|
+
protected handleOnError(error: Error, operation?: ERROR_OPERATION): void;
|
|
23
78
|
/**
|
|
24
79
|
* Loads and initializes the wallet button based on the service configuration.
|
|
25
|
-
* This method fetches the wallet service configuration
|
|
80
|
+
* This method fetches the wallet service configuration, validates that the service
|
|
81
|
+
* type matches the expected wallet, and creates the appropriate wallet service instance.
|
|
26
82
|
* Bear in mind that you must call this method after setting up all event handlers.
|
|
27
83
|
*
|
|
28
84
|
* @example
|
|
85
|
+
* button.onClick((data) => { ... });
|
|
86
|
+
* button.onSuccess((data) => { ... });
|
|
87
|
+
* button.onError((error) => { ... });
|
|
29
88
|
* button.load();
|
|
30
89
|
*/
|
|
31
90
|
load(): void;
|
|
@@ -36,163 +95,272 @@ export declare class OpenWalletButtons implements WalletPaymentSource {
|
|
|
36
95
|
*
|
|
37
96
|
* @example
|
|
38
97
|
* button.setEnv('production', 'paydock.com');
|
|
39
|
-
*
|
|
40
|
-
* @param {string}
|
|
98
|
+
*
|
|
99
|
+
* @param {string} env - The target environment: `'sandbox'` or `'production'`.
|
|
100
|
+
* @param {string} [alias] - Own domain alias.
|
|
41
101
|
*/
|
|
42
102
|
setEnv(env: string, alias?: string): void;
|
|
103
|
+
/**
|
|
104
|
+
* Updates the wallet metadata after initialization.
|
|
105
|
+
* Use this when order information changes (e.g. amount, currency) after the button has been rendered.
|
|
106
|
+
* Bear in mind that this must be called before the next payment attempt takes effect.
|
|
107
|
+
*
|
|
108
|
+
* @example
|
|
109
|
+
* button.setMeta({ ...meta, amount: 29.99 });
|
|
110
|
+
*
|
|
111
|
+
* @param {ApplePayOpenWalletMeta | GooglePayOpenWalletMeta} meta - The updated metadata object. The concrete type depends on the button class.
|
|
112
|
+
*/
|
|
113
|
+
setMeta(meta: TMeta): void;
|
|
114
|
+
/**
|
|
115
|
+
* Removes the wallet button from the DOM and cleans up resources.
|
|
116
|
+
* Call this method when the wallet button is no longer needed (e.g. navigating away from the payment page).
|
|
117
|
+
*
|
|
118
|
+
* @example
|
|
119
|
+
* button.destroy();
|
|
120
|
+
*/
|
|
121
|
+
destroy(): void;
|
|
43
122
|
/**
|
|
44
123
|
* Callback for onClick method.
|
|
45
124
|
*
|
|
46
125
|
* @callback OnClickCallback
|
|
47
|
-
* @param {OnClickEventData} data
|
|
126
|
+
* @param {OnClickEventData} data - The click event data.
|
|
127
|
+
* @returns {boolean | void | Promise<boolean | void>} Return `false` to abort, or a Promise to defer.
|
|
48
128
|
*/
|
|
49
|
-
/**
|
|
50
129
|
/**
|
|
51
130
|
* Registers a callback function to be invoked when the wallet button gets clicked.
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
131
|
+
* The handler controls the wallet payment flow via its return value:
|
|
132
|
+
*
|
|
133
|
+
* - Return `void` (or nothing) to continue the payment flow normally.
|
|
134
|
+
* - Return `false` to abort the payment flow.
|
|
135
|
+
* - Return a `Promise<void>` to defer the wallet sheet until the promise resolves.
|
|
136
|
+
* - Return a `Promise<boolean>` — if it resolves to `false`, the flow is aborted.
|
|
137
|
+
* - Throwing an error (sync or async) also aborts the flow.
|
|
138
|
+
*
|
|
139
|
+
* Both synchronous and asynchronous (async) handlers are supported.
|
|
140
|
+
*
|
|
141
|
+
* **Note:** this callback may be called multiple times as the customer closes the payment
|
|
142
|
+
* checkout and re-clicks the button.
|
|
143
|
+
*
|
|
144
|
+
* @example
|
|
145
|
+
* // Synchronous usage — continue normally
|
|
146
|
+
* button.onClick((event) => {
|
|
147
|
+
* performValidationLogic();
|
|
148
|
+
* });
|
|
149
|
+
*
|
|
150
|
+
* @example
|
|
151
|
+
* // Synchronous abort — return false to cancel the payment
|
|
152
|
+
* button.onClick((event) => {
|
|
153
|
+
* if (!isOrderValid()) return false;
|
|
154
|
+
* });
|
|
56
155
|
*
|
|
57
156
|
* @example
|
|
58
|
-
*
|
|
59
|
-
*
|
|
157
|
+
* // Asynchronous usage — defer wallet sheet until the promise resolves
|
|
158
|
+
* button.onClick(async (event) => {
|
|
159
|
+
* await fetch('/validate-order').then(res => res.json());
|
|
60
160
|
* });
|
|
61
161
|
*
|
|
62
|
-
* @param {
|
|
162
|
+
* @param {OnClickCallback} handler - Function to be called when the wallet button is clicked.
|
|
63
163
|
*/
|
|
64
|
-
onClick(handler: (data: OnClickEventData) =>
|
|
164
|
+
onClick(handler: (data: OnClickEventData) => boolean | undefined | Promise<boolean | undefined>): void;
|
|
65
165
|
/**
|
|
66
166
|
* Callback for onSuccess method.
|
|
67
167
|
*
|
|
68
168
|
* @callback OnSuccessCallback
|
|
69
|
-
* @param {
|
|
70
|
-
* @return {Promise<string>} OTT (One Time Token) string result
|
|
169
|
+
* @param {OnCreateOTTSuccessfulEventData} data - The OTT creation result including the token, amount, and address data.
|
|
71
170
|
*/
|
|
72
171
|
/**
|
|
73
|
-
*
|
|
74
|
-
*
|
|
172
|
+
* Registers a callback function to be invoked when the OTT (One-Time Token) creation was successful.
|
|
173
|
+
* Both synchronous and asynchronous (async) handlers are supported.
|
|
174
|
+
*
|
|
175
|
+
* **Important:** A handler is required. Do not perform thread blocking operations in callback such as `window.alert()` calls.
|
|
176
|
+
*
|
|
177
|
+
* **Error handling:** If the handler throws (sync or async), the error is logged and swallowed
|
|
178
|
+
* so that internal processing continues uninterrupted.
|
|
75
179
|
*
|
|
76
180
|
* @example
|
|
77
|
-
* button.onSuccess((
|
|
78
|
-
*
|
|
181
|
+
* button.onSuccess((event) => {
|
|
182
|
+
* console.log('OTT created:', event.data.token.temp_token);
|
|
183
|
+
* console.log('Amount:', event.data.amount);
|
|
79
184
|
* });
|
|
80
185
|
*
|
|
81
186
|
* @example
|
|
82
|
-
*
|
|
187
|
+
* // Async handler
|
|
188
|
+
* button.onSuccess(async (event) => {
|
|
189
|
+
* await submitTokenToServer(event.data.token.temp_token);
|
|
190
|
+
* });
|
|
83
191
|
*
|
|
84
|
-
* @param {OnSuccessCallback}
|
|
192
|
+
* @param {OnSuccessCallback} handler - Function to be called when the OTT creation was successful.
|
|
85
193
|
*/
|
|
86
|
-
onSuccess(handler
|
|
194
|
+
onSuccess(handler: (data: OnCreateOTTSuccessfulEventData) => void | Promise<void>): void;
|
|
87
195
|
/**
|
|
88
196
|
* Callback for onUnavailable method.
|
|
89
197
|
*
|
|
90
198
|
* @callback OnUnavailableCallback
|
|
91
|
-
* @param {OnUnavailableEventData} data
|
|
199
|
+
* @param {OnUnavailableEventData} data - Data describing why the wallet is unavailable.
|
|
92
200
|
*/
|
|
93
201
|
/**
|
|
94
202
|
* Registers a callback function to be invoked when the wallet is not available in the current context.
|
|
95
203
|
* This can happen when the wallet service is not supported on the current device or browser.
|
|
204
|
+
* Both synchronous and asynchronous (async) handlers are supported.
|
|
96
205
|
*
|
|
97
|
-
*
|
|
98
|
-
*
|
|
99
|
-
* console.log('Wallet not available', data);
|
|
100
|
-
* });
|
|
206
|
+
* **Error handling:** If the handler throws (sync or async), the error is logged and swallowed
|
|
207
|
+
* so that internal processing continues uninterrupted.
|
|
101
208
|
*
|
|
102
209
|
* @example
|
|
103
|
-
* button.onUnavailable(
|
|
210
|
+
* button.onUnavailable((event) => {
|
|
211
|
+
* console.log('Wallet not available:', event.data.reason);
|
|
212
|
+
* });
|
|
104
213
|
*
|
|
105
|
-
* @param {OnUnavailableCallback}
|
|
214
|
+
* @param {OnUnavailableCallback} handler - Function to be called when the wallet is not available in the current context.
|
|
106
215
|
*/
|
|
107
|
-
onUnavailable(handler
|
|
216
|
+
onUnavailable(handler: (data: OnUnavailableEventData) => void | Promise<void>): void;
|
|
108
217
|
/**
|
|
109
218
|
* Callback for onError method.
|
|
110
219
|
*
|
|
111
220
|
* @callback OnErrorCallback
|
|
112
|
-
* @param {OnErrorEventData} data
|
|
221
|
+
* @param {OnErrorEventData} data - The error event data including the Error object and context.
|
|
113
222
|
*/
|
|
114
223
|
/**
|
|
115
|
-
* Registers a callback function to be invoked when an error
|
|
116
|
-
*
|
|
224
|
+
* Registers a callback function to be invoked when an error occurs during wallet operation.
|
|
225
|
+
* This includes configuration issues, validation errors, and OTT creation failures.
|
|
226
|
+
* Both synchronous and asynchronous (async) handlers are supported.
|
|
117
227
|
*
|
|
118
|
-
*
|
|
119
|
-
*
|
|
120
|
-
* console.log('OpenWallet error', error);
|
|
121
|
-
* });
|
|
228
|
+
* **Error handling:** If the handler throws (sync or async), the error is logged and swallowed
|
|
229
|
+
* so that internal processing continues uninterrupted.
|
|
122
230
|
*
|
|
123
231
|
* @example
|
|
124
|
-
* button.onError(
|
|
232
|
+
* button.onError((event) => {
|
|
233
|
+
* console.error('Wallet error:', event.data.error.message);
|
|
234
|
+
* console.log('Context:', event.data.context);
|
|
235
|
+
* });
|
|
125
236
|
*
|
|
126
|
-
* @param {OnErrorCallback}
|
|
237
|
+
* @param {OnErrorCallback} handler - Function to be called when the wallet has an error.
|
|
127
238
|
*/
|
|
128
|
-
onError(handler
|
|
239
|
+
onError(handler: (data: OnErrorEventData) => void | Promise<void>): void;
|
|
129
240
|
/**
|
|
130
241
|
* Callback for onCancel method.
|
|
131
242
|
*
|
|
132
243
|
* @callback OnCancelCallback
|
|
133
|
-
* @param {
|
|
244
|
+
* @param {OnCancelEventData} data - Data associated with the cancellation event.
|
|
134
245
|
*/
|
|
135
246
|
/**
|
|
136
247
|
* Registers a callback function to be invoked when the wallet checkout is cancelled or closed by the user.
|
|
137
248
|
* This event is triggered when the user dismisses the wallet payment interface without completing the transaction.
|
|
249
|
+
* Both synchronous and asynchronous (async) handlers are supported.
|
|
250
|
+
*
|
|
251
|
+
* **Error handling:** If the handler throws (sync or async), the error is logged and swallowed
|
|
252
|
+
* so that internal processing continues uninterrupted.
|
|
138
253
|
*
|
|
139
254
|
* @example
|
|
140
|
-
* button.onCancel((
|
|
141
|
-
*
|
|
255
|
+
* button.onCancel((event) => {
|
|
256
|
+
* console.log('Wallet checkout cancelled', event);
|
|
142
257
|
* });
|
|
143
258
|
*
|
|
259
|
+
* @param {OnCancelCallback} handler - Function to be called when the wallet checkout is cancelled.
|
|
260
|
+
*/
|
|
261
|
+
onCancel(handler: (data: OnCancelEventData) => void | Promise<void>): void;
|
|
262
|
+
/**
|
|
263
|
+
* Registers a callback function to be invoked when the wallet button has been loaded and rendered in the DOM.
|
|
264
|
+
* Both synchronous and asynchronous (async) handlers are supported.
|
|
265
|
+
*
|
|
266
|
+
* **Error handling:** If the handler throws (sync or async), the error is logged and swallowed
|
|
267
|
+
* so that internal processing continues uninterrupted.
|
|
268
|
+
*
|
|
144
269
|
* @example
|
|
145
|
-
* button.
|
|
270
|
+
* button.onLoaded((event) => {
|
|
271
|
+
* console.log('Wallet button loaded');
|
|
272
|
+
* });
|
|
146
273
|
*
|
|
147
|
-
* @param {
|
|
274
|
+
* @param {Function} handler - Function to be called when the wallet button is loaded.
|
|
148
275
|
*/
|
|
149
|
-
|
|
276
|
+
onLoaded(handler: (data: OnLoadedEventData) => void | Promise<void>): void;
|
|
150
277
|
/**
|
|
151
278
|
* Callback for onShippingAddressChange method.
|
|
152
279
|
*
|
|
153
280
|
* @callback OnShippingAddressChangeCallback
|
|
154
|
-
* @param {OnShippingAddressChangeEventData} data
|
|
155
|
-
* @
|
|
281
|
+
* @param {OnShippingAddressChangeEventData} data - The shipping address data from the wallet.
|
|
282
|
+
* @returns {OnShippingAddressChangeEventResponse | Promise<OnShippingAddressChangeEventResponse>} Address update result containing updated amount, shipping options, and optional error.
|
|
156
283
|
*/
|
|
157
284
|
/**
|
|
158
|
-
*
|
|
285
|
+
* Registers a callback for when the customer selects or updates their shipping address.
|
|
159
286
|
* Use this method to listen for shipping address selection or input from customer when shipping is enabled.
|
|
160
|
-
* The event handler should return updated payment information including the new amount and
|
|
287
|
+
* The event handler should return updated payment information including the new amount and
|
|
288
|
+
* available shipping options based on the selected address.
|
|
289
|
+
* Both synchronous and asynchronous (async) handlers are supported.
|
|
290
|
+
*
|
|
291
|
+
* In case of an address validation error, include the `error` field in the response
|
|
292
|
+
* to display an appropriate error in the wallet payment sheet.
|
|
161
293
|
*
|
|
162
294
|
* @example
|
|
295
|
+
* // Async handler
|
|
163
296
|
* button.onShippingAddressChange(async (data) => {
|
|
164
|
-
*
|
|
165
|
-
*
|
|
166
|
-
*
|
|
167
|
-
*
|
|
168
|
-
*
|
|
297
|
+
* const response = await fetch('https://your-server.com/update-shipping-address', {
|
|
298
|
+
* method: 'POST',
|
|
299
|
+
* body: JSON.stringify(data),
|
|
300
|
+
* });
|
|
301
|
+
* const result = await response.json();
|
|
302
|
+
* return {
|
|
303
|
+
* amount: result.newAmount,
|
|
304
|
+
* shipping_options: result.availableShippingOptions,
|
|
305
|
+
* };
|
|
306
|
+
* });
|
|
307
|
+
*
|
|
308
|
+
* @example
|
|
309
|
+
* // Sync handler
|
|
310
|
+
* button.onShippingAddressChange((data) => {
|
|
311
|
+
* return {
|
|
312
|
+
* amount: calculateShipping(data.data.address_country),
|
|
313
|
+
* shipping_options: getOptionsForCountry(data.data.address_country),
|
|
314
|
+
* };
|
|
169
315
|
* });
|
|
170
316
|
*
|
|
171
|
-
* @param {OnShippingAddressChangeCallback}
|
|
317
|
+
* @param {OnShippingAddressChangeCallback} handler - Function to be called when the shipping address data is updated.
|
|
172
318
|
*/
|
|
173
|
-
onShippingAddressChange(handler
|
|
319
|
+
onShippingAddressChange(handler: (data: OnShippingAddressChangeEventData) => OnShippingAddressChangeEventResponse | Promise<OnShippingAddressChangeEventResponse>): () => void;
|
|
174
320
|
/**
|
|
175
321
|
* Callback for onShippingOptionsChange method.
|
|
176
322
|
*
|
|
177
323
|
* @callback OnShippingOptionsChangeCallback
|
|
178
|
-
* @param {OnShippingOptionChangeEventData} data
|
|
179
|
-
* @
|
|
324
|
+
* @param {OnShippingOptionChangeEventData} data - The selected shipping option data.
|
|
325
|
+
* @returns {OnShippingOptionChangeEventResponse | Promise<OnShippingOptionChangeEventResponse>} Shipping options update result containing the updated amount.
|
|
180
326
|
*/
|
|
181
327
|
/**
|
|
182
|
-
*
|
|
328
|
+
* Registers a callback for when the customer selects a shipping option.
|
|
183
329
|
* Use this method to listen for shipping option selection from customer when shipping is enabled.
|
|
184
330
|
* The event handler should return the updated payment amount based on the selected shipping option.
|
|
331
|
+
* Both synchronous and asynchronous (async) handlers are supported.
|
|
185
332
|
*
|
|
186
333
|
* @example
|
|
334
|
+
* // Async handler
|
|
187
335
|
* button.onShippingOptionsChange(async (data) => {
|
|
188
|
-
*
|
|
189
|
-
*
|
|
190
|
-
*
|
|
191
|
-
*
|
|
336
|
+
* const response = await fetch('https://your-server.com/update-shipping-option', {
|
|
337
|
+
* method: 'POST',
|
|
338
|
+
* body: JSON.stringify({ shipping_option_id: data.data.shipping_option_id }),
|
|
339
|
+
* });
|
|
340
|
+
* const result = await response.json();
|
|
341
|
+
* return {
|
|
342
|
+
* amount: result.newTotalAmount,
|
|
343
|
+
* };
|
|
344
|
+
* });
|
|
345
|
+
*
|
|
346
|
+
* @example
|
|
347
|
+
* // Sync handler
|
|
348
|
+
* button.onShippingOptionsChange((data) => {
|
|
349
|
+
* return {
|
|
350
|
+
* amount: lookupShippingCost(data.data.shipping_option_id),
|
|
351
|
+
* };
|
|
192
352
|
* });
|
|
193
353
|
*
|
|
194
|
-
* @param {OnShippingOptionsChangeCallback}
|
|
354
|
+
* @param {OnShippingOptionsChangeCallback} handler - Function to be called when the shipping options data is updated.
|
|
355
|
+
*/
|
|
356
|
+
onShippingOptionsChange(handler: (data: OnShippingOptionChangeEventData) => OnShippingOptionChangeEventResponse | Promise<OnShippingOptionChangeEventResponse>): () => void;
|
|
357
|
+
/**
|
|
358
|
+
* Whether a shipping options change handler has been registered.
|
|
359
|
+
* Used internally by wallet services to validate shipping configuration.
|
|
360
|
+
*
|
|
361
|
+
* @private
|
|
362
|
+
* @returns {boolean} `true` if an `onShippingOptionsChange` handler has been registered.
|
|
195
363
|
*/
|
|
196
|
-
|
|
364
|
+
get isShippingOptionsChangeHandlerRegistered(): boolean;
|
|
197
365
|
}
|
|
198
366
|
//# sourceMappingURL=open-wallet-buttons.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"open-wallet-buttons.d.ts","sourceRoot":"","sources":["../../../src/open-wallets/base/open-wallet-buttons.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,WAAW,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"open-wallet-buttons.d.ts","sourceRoot":"","sources":["../../../src/open-wallets/base/open-wallet-buttons.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACpE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACxE,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAGvD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAE/D,OAAO,KAAK,EACV,iBAAiB,EACjB,gBAAgB,EAChB,8BAA8B,EAC9B,gBAAgB,EAChB,iBAAiB,EACjB,sBAAsB,EACtB,cAAc,EACf,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAC3C,OAAO,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