@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.
Files changed (73) hide show
  1. package/README.md +2573 -0
  2. package/bundles/index.cjs +1296 -508
  3. package/bundles/index.cjs.d.ts +1377 -200
  4. package/bundles/index.mjs +1295 -509
  5. package/bundles/index.mjs.d.ts +1377 -200
  6. package/bundles/types/checkout/checkout.d.ts.map +1 -1
  7. package/bundles/types/checkout/v1/instructions/instruction.card_form.show.d.ts.map +1 -1
  8. package/bundles/types/checkout/v3/instructions/instruction.card_form.show.d.ts.map +1 -1
  9. package/bundles/types/checkout/v3/instructions/instruction.payment_methods.show.d.ts.map +1 -1
  10. package/bundles/types/checkout-button/zipmoney/zipmoney-contextual.runner.d.ts +1 -2
  11. package/bundles/types/checkout-button/zipmoney/zipmoney-contextual.runner.d.ts.map +1 -1
  12. package/bundles/types/open-wallets/apple-pay-open-wallet-button.d.ts +70 -0
  13. package/bundles/types/open-wallets/apple-pay-open-wallet-button.d.ts.map +1 -0
  14. package/bundles/types/open-wallets/base/open-wallet-buttons.d.ts +242 -74
  15. package/bundles/types/open-wallets/base/open-wallet-buttons.d.ts.map +1 -1
  16. package/bundles/types/open-wallets/base/open-wallet.service.d.ts +62 -4
  17. package/bundles/types/open-wallets/base/open-wallet.service.d.ts.map +1 -1
  18. package/bundles/types/open-wallets/enum/error-operation.enum.d.ts +15 -0
  19. package/bundles/types/open-wallets/enum/error-operation.enum.d.ts.map +1 -0
  20. package/bundles/types/open-wallets/enum/event.enum.d.ts +11 -3
  21. package/bundles/types/open-wallets/enum/event.enum.d.ts.map +1 -1
  22. package/bundles/types/open-wallets/enum/token-type.enum.d.ts +10 -0
  23. package/bundles/types/open-wallets/enum/token-type.enum.d.ts.map +1 -0
  24. package/bundles/types/open-wallets/google-pay-open-wallet-button.d.ts +65 -0
  25. package/bundles/types/open-wallets/google-pay-open-wallet-button.d.ts.map +1 -0
  26. package/bundles/types/open-wallets/index.d.ts +293 -0
  27. package/bundles/types/open-wallets/index.d.ts.map +1 -1
  28. package/bundles/types/open-wallets/interfaces/events.interface.d.ts +87 -14
  29. package/bundles/types/open-wallets/interfaces/events.interface.d.ts.map +1 -1
  30. package/bundles/types/open-wallets/interfaces/google-pay/google-pay-meta.interface.d.ts +6 -0
  31. package/bundles/types/open-wallets/interfaces/google-pay/google-pay-meta.interface.d.ts.map +1 -1
  32. package/bundles/types/open-wallets/interfaces/index.d.ts +2 -2
  33. package/bundles/types/open-wallets/interfaces/index.d.ts.map +1 -1
  34. package/bundles/types/open-wallets/interfaces/open-wallet-meta.interface.d.ts +12 -0
  35. package/bundles/types/open-wallets/interfaces/open-wallet-meta.interface.d.ts.map +1 -1
  36. package/bundles/types/open-wallets/interfaces/payment-source.interface.d.ts +28 -2
  37. package/bundles/types/open-wallets/interfaces/payment-source.interface.d.ts.map +1 -1
  38. package/bundles/types/open-wallets/services/apple-pay/apple-pay.open-wallet.service.d.ts +27 -2
  39. package/bundles/types/open-wallets/services/apple-pay/apple-pay.open-wallet.service.d.ts.map +1 -1
  40. package/bundles/types/open-wallets/services/google-pay/constants/google-pay.constants.d.ts +9 -0
  41. package/bundles/types/open-wallets/services/google-pay/constants/google-pay.constants.d.ts.map +1 -1
  42. package/bundles/types/open-wallets/services/google-pay/google-pay.open-wallet.service.d.ts +20 -9
  43. package/bundles/types/open-wallets/services/google-pay/google-pay.open-wallet.service.d.ts.map +1 -1
  44. package/bundles/types/open-wallets/services/google-pay/utils/google-pay.utils.d.ts +45 -0
  45. package/bundles/types/open-wallets/services/google-pay/utils/google-pay.utils.d.ts.map +1 -1
  46. package/bundles/types/open-wallets/services/google-pay/utils/index.d.ts +1 -1
  47. package/bundles/types/open-wallets/services/google-pay/utils/index.d.ts.map +1 -1
  48. package/bundles/types/open-wallets/services/google-pay/validation/google-pay.validation.d.ts +13 -0
  49. package/bundles/types/open-wallets/services/google-pay/validation/google-pay.validation.d.ts.map +1 -1
  50. package/bundles/types/open-wallets/types/base-event-data.interface.d.ts +24 -2
  51. package/bundles/types/open-wallets/types/base-event-data.interface.d.ts.map +1 -1
  52. package/bundles/types/open-wallets/types/index.d.ts +2 -1
  53. package/bundles/types/open-wallets/types/index.d.ts.map +1 -1
  54. package/bundles/types/open-wallets/types/on-shipping-address-change-event-data.interface.d.ts +16 -2
  55. package/bundles/types/open-wallets/types/on-shipping-address-change-event-data.interface.d.ts.map +1 -1
  56. package/bundles/types/open-wallets/types/on-shipping-address-change-event-response.interface.d.ts +20 -2
  57. package/bundles/types/open-wallets/types/on-shipping-address-change-event-response.interface.d.ts.map +1 -1
  58. package/bundles/types/open-wallets/types/on-shipping-option-change-event-data.interface.d.ts +13 -2
  59. package/bundles/types/open-wallets/types/on-shipping-option-change-event-data.interface.d.ts.map +1 -1
  60. package/bundles/types/open-wallets/types/on-shipping-option-change-event-response.interface.d.ts +12 -0
  61. package/bundles/types/open-wallets/types/on-shipping-option-change-event-response.interface.d.ts.map +1 -1
  62. package/bundles/types/open-wallets/types/payment-source.type.d.ts +3 -2
  63. package/bundles/types/open-wallets/types/payment-source.type.d.ts.map +1 -1
  64. package/bundles/types/open-wallets/types/shipping-event-to-response.type.d.ts +8 -0
  65. package/bundles/types/open-wallets/types/shipping-event-to-response.type.d.ts.map +1 -1
  66. package/bundles/widget.umd.js +1296 -508
  67. package/bundles/widget.umd.js.d.ts +1377 -200
  68. package/bundles/widget.umd.js.min.d.ts +1377 -200
  69. package/bundles/widget.umd.min.js +1 -1
  70. package/docs/open-wallet-buttons-examples.md +561 -830
  71. package/docs/open-wallet-buttons.md +1652 -0
  72. package/package.json +1 -1
  73. 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,C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/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;AAEtD,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AAIvE,qBACa,uBAAwB,SAAQ,kBAAkB;IAC7D,SAAS,CAAC,MAAM,EAAE,UAAU,CAAC;IAC7B,OAAO,CAAC,SAAS,CAAiB;IAE3B,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
+ {"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,CAAiB;IAE3B,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
+ {"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,CAAiB;IAElC,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
+ {"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: NodeJS.Timeout | undefined;
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":";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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C;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 type { OnClickEventData, OnCrateOTTSuccessfulEventData, OnErrorEventData, OnUnavailableEventData, OpenWalletMeta, WalletPaymentSource } from '../interfaces';
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
- export declare class OpenWalletButtons implements WalletPaymentSource {
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: OpenWalletMeta;
32
+ protected meta: TMeta;
16
33
  protected eventEmitter: EventEmitter;
17
- readonly walletType: WalletType;
18
- constructor(selector: string, publicKeyOrAccessToken: string, serviceId: string, meta: OpenWalletMeta, requiredMetaFields: string[]);
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
- private validateRequiredMetaFields;
21
- private getOpenWalletServiceConfig;
22
- private handleOnError;
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 and creates the appropriate wallet service instance.
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
- * @param {string} env - sandbox, production
40
- * @param {string} [alias] - Own domain alias
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
- * There are two operational modes supported, Synchronous and Asynchronous.
53
- * When asynchronous operations need to occur on the callback handler, attaching the Promise via `attachResult` is required to have the wallet wait for a result.
54
- * When synchronous operations occur on the callback handler, attaching a boolean result via `attachResult` is optional to control the execution flow.
55
- * Note this is supported for Paypal, GooglePay and ApplePay wallet buttons at the moment.
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
- * button.onClick((data) => {
59
- * performValidationLogic();
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 {listener} handler - Function to be called when the wallet button is clicked.
162
+ * @param {OnClickCallback} handler - Function to be called when the wallet button is clicked.
63
163
  */
64
- onClick(handler: (data: OnClickEventData) => void): () => void;
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 {OnCrateOTTSuccessfulEventData} data
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
- * If the OTT creation was successful, the function passed as parameter will be called.
74
- * Important: Do not perform thread blocking operations in callback such as window.alert() calls.
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((data) => {
78
- * console.log('OTT creation successful!', data);
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
- * button.onSuccess().then((data) => console.log('OTT creation successful!', data));
187
+ * // Async handler
188
+ * button.onSuccess(async (event) => {
189
+ * await submitTokenToServer(event.data.token.temp_token);
190
+ * });
83
191
  *
84
- * @param {OnSuccessCallback} [handler] - Function to be called when the OTT creation was successful.
192
+ * @param {OnSuccessCallback} handler - Function to be called when the OTT creation was successful.
85
193
  */
86
- onSuccess(handler?: (data: OnCrateOTTSuccessfulEventData) => void): () => void;
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
- * @example
98
- * button.onUnavailable((data) => {
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().then((data) => console.log('Wallet not available', data));
210
+ * button.onUnavailable((event) => {
211
+ * console.log('Wallet not available:', event.data.reason);
212
+ * });
104
213
  *
105
- * @param {OnUnavailableCallback} [handler] - Function to be called when the wallet is not available in the current context.
214
+ * @param {OnUnavailableCallback} handler - Function to be called when the wallet is not available in the current context.
106
215
  */
107
- onUnavailable(handler?: (data: OnUnavailableEventData) => void): Promise<unknown> | (() => void);
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 that is not related to payment execution occurs.
116
- * For example, if there are configuration issues or validation errors during wallet initialization.
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
- * @example
119
- * button.onError((error) => {
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().then((error) => console.log('OpenWallet error', error));
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} [handler] - Function to be called when the OpenWallet has an error.
237
+ * @param {OnErrorCallback} handler - Function to be called when the wallet has an error.
127
238
  */
128
- onError(handler?: (data: OnErrorEventData) => void): Promise<unknown> | (() => void);
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 {any} data
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((data) => {
141
- * console.log('Wallet checkout cancelled', data);
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.onCancel().then((data) => console.log('Wallet checkout cancelled', data));
270
+ * button.onLoaded((event) => {
271
+ * console.log('Wallet button loaded');
272
+ * });
146
273
  *
147
- * @param {OnCancelCallback} [handler] - Function to be called when the wallet checkout is cancelled.
274
+ * @param {Function} handler - Function to be called when the wallet button is loaded.
148
275
  */
149
- onCancel(handler?: (data: any) => void): Promise<unknown> | (() => void);
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
- * @return {Promise<OnShippingAddressChangeEventResponse>} Address update result containing updated amount and/or shipping options
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
- * If shipping address data is updated, the function passed as parameter will be called.
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 available shipping options based on the selected address.
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
- * const responseData = await fetch('https://your-server.com/update-shipping-address');
165
- * return {
166
- * amount: responseData.newAmount,
167
- * shipping_options: responseData.availableShippingOptions
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} [handler] - Function to be called when the shipping address data is updated.
317
+ * @param {OnShippingAddressChangeCallback} handler - Function to be called when the shipping address data is updated.
172
318
  */
173
- onShippingAddressChange(handler?: (data: OnShippingAddressChangeEventData) => Promise<OnShippingAddressChangeEventResponse>): () => void;
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
- * @return {Promise<OnShippingOptionChangeEventResponse>} Shipping options update result containing updated amount
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
- * If shipping options data is updated, the function passed as parameter will be called.
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
- * const responseData = await fetch('https://your-server.com/update-shipping-option');
189
- * return {
190
- * amount: responseData.newTotalAmount
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} [handler] - Function to be called when the shipping options data is updated.
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
- onShippingOptionsChange(handler?: (data: OnShippingOptionChangeEventData) => Promise<OnShippingOptionChangeEventResponse>): () => void;
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;AAEpE,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAGvD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE1D,OAAO,KAAK,EACV,gBAAgB,EAChB,6BAA6B,EAC7B,gBAAgB,EAChB,sBAAsB,EACtB,cAAc,EACd,mBAAmB,EACpB,MAAM,eAAe,CAAC;AAKvB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAC3C,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,0DAA0D,CAAC;AACjH,OAAO,KA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