@paydock/client-sdk 1.108.2 → 1.110.3-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 (102) hide show
  1. package/README.md +990 -1
  2. package/bundles/index.cjs +3859 -3036
  3. package/bundles/index.cjs.d.ts +465 -47
  4. package/bundles/index.mjs +3857 -3036
  5. package/bundles/index.mjs.d.ts +465 -47
  6. package/bundles/types/api/api-gateway-internal.d.ts +12 -0
  7. package/bundles/types/api/api-gateway-internal.d.ts.map +1 -0
  8. package/bundles/types/api/api-internal.d.ts +2 -0
  9. package/bundles/types/api/api-internal.d.ts.map +1 -1
  10. package/bundles/types/helper/event-emitter.d.ts +1 -0
  11. package/bundles/types/helper/event-emitter.d.ts.map +1 -1
  12. package/bundles/types/index.d.ts +1 -0
  13. package/bundles/types/index.d.ts.map +1 -1
  14. package/bundles/types/secure-remote-commerce/index.d.ts +1 -1
  15. package/bundles/types/wallet-buttons/wallet-buttons.d.ts +4 -4
  16. package/bundles/types/wallet-buttons/wallet-buttons.d.ts.map +1 -1
  17. package/bundles/types/wallet-buttons/wallet-cba-buttons.d.ts +4 -4
  18. package/bundles/types/wallet-buttons/wallet-cba-buttons.d.ts.map +1 -1
  19. package/bundles/types/wallet-buttons/{afterpay.wallet-service.d.ts → wallet-services/afterpay.wallet-service.d.ts} +1 -1
  20. package/bundles/types/wallet-buttons/wallet-services/afterpay.wallet-service.d.ts.map +1 -0
  21. package/bundles/types/wallet-buttons/{apple.wallet-service.d.ts → wallet-services/apple.wallet-service.d.ts} +3 -3
  22. package/bundles/types/wallet-buttons/wallet-services/apple.wallet-service.d.ts.map +1 -0
  23. package/bundles/types/wallet-buttons/{flypay-v2.wallet-service.d.ts → wallet-services/flypay-v2.wallet-service.d.ts} +3 -3
  24. package/bundles/types/wallet-buttons/wallet-services/flypay-v2.wallet-service.d.ts.map +1 -0
  25. package/bundles/types/wallet-buttons/{flypay.wallet-service.d.ts → wallet-services/flypay.wallet-service.d.ts} +6 -6
  26. package/bundles/types/wallet-buttons/wallet-services/flypay.wallet-service.d.ts.map +1 -0
  27. package/bundles/types/wallet-buttons/{google.wallet-service.d.ts → wallet-services/google.wallet-service.d.ts} +4 -4
  28. package/bundles/types/wallet-buttons/wallet-services/google.wallet-service.d.ts.map +1 -0
  29. package/bundles/types/wallet-buttons/wallet-services/mastercard.wallet-service.d.ts.map +1 -0
  30. package/bundles/types/wallet-buttons/{paypal.wallet-service.d.ts → wallet-services/paypal.wallet-service.d.ts} +1 -1
  31. package/bundles/types/wallet-buttons/wallet-services/paypal.wallet-service.d.ts.map +1 -0
  32. package/bundles/types/wallet-buttons/{stripe.wallet-service.d.ts → wallet-services/stripe.wallet-service.d.ts} +1 -1
  33. package/bundles/types/wallet-buttons/wallet-services/stripe.wallet-service.d.ts.map +1 -0
  34. package/bundles/types/wallet-buttons/{wallet-service.d.ts → wallet-services/wallet-service.d.ts} +3 -3
  35. package/bundles/types/wallet-buttons/wallet-services/wallet-service.d.ts.map +1 -0
  36. package/bundles/types/wallet-buttons-express/base.wallet-button-express.d.ts +195 -0
  37. package/bundles/types/wallet-buttons-express/base.wallet-button-express.d.ts.map +1 -0
  38. package/bundles/types/wallet-buttons-express/enum/event.enum.d.ts +10 -0
  39. package/bundles/types/wallet-buttons-express/enum/event.enum.d.ts.map +1 -0
  40. package/bundles/types/wallet-buttons-express/index.d.ts +131 -0
  41. package/bundles/types/wallet-buttons-express/index.d.ts.map +1 -0
  42. package/bundles/types/wallet-buttons-express/interfaces/base-event-data.interface.d.ts +6 -0
  43. package/bundles/types/wallet-buttons-express/interfaces/base-event-data.interface.d.ts.map +1 -0
  44. package/bundles/types/wallet-buttons-express/interfaces/base-gateway-config.interface.d.ts +6 -0
  45. package/bundles/types/wallet-buttons-express/interfaces/base-gateway-config.interface.d.ts.map +1 -0
  46. package/bundles/types/wallet-buttons-express/interfaces/base-wallet-meta.interface.d.ts +5 -0
  47. package/bundles/types/wallet-buttons-express/interfaces/base-wallet-meta.interface.d.ts.map +1 -0
  48. package/bundles/types/wallet-buttons-express/interfaces/charge-wallet-token-meta.interface.d.ts +14 -0
  49. package/bundles/types/wallet-buttons-express/interfaces/charge-wallet-token-meta.interface.d.ts.map +1 -0
  50. package/bundles/types/wallet-buttons-express/interfaces/on-click-event-data.interface.d.ts +6 -0
  51. package/bundles/types/wallet-buttons-express/interfaces/on-click-event-data.interface.d.ts.map +1 -0
  52. package/bundles/types/wallet-buttons-express/interfaces/on-close-event-data.interface.d.ts +6 -0
  53. package/bundles/types/wallet-buttons-express/interfaces/on-close-event-data.interface.d.ts.map +1 -0
  54. package/bundles/types/wallet-buttons-express/interfaces/on-error-event-data.interface.d.ts +6 -0
  55. package/bundles/types/wallet-buttons-express/interfaces/on-error-event-data.interface.d.ts.map +1 -0
  56. package/bundles/types/wallet-buttons-express/interfaces/on-payment-error-event-data.interface.d.ts +9 -0
  57. package/bundles/types/wallet-buttons-express/interfaces/on-payment-error-event-data.interface.d.ts.map +1 -0
  58. package/bundles/types/wallet-buttons-express/interfaces/on-payment-in-review-event-data.interface.d.ts +6 -0
  59. package/bundles/types/wallet-buttons-express/interfaces/on-payment-in-review-event-data.interface.d.ts.map +1 -0
  60. package/bundles/types/wallet-buttons-express/interfaces/on-payment-successful-event-data.interface.d.ts +11 -0
  61. package/bundles/types/wallet-buttons-express/interfaces/on-payment-successful-event-data.interface.d.ts.map +1 -0
  62. package/bundles/types/wallet-buttons-express/interfaces/on-unavailable-event-data.interface.d.ts +6 -0
  63. package/bundles/types/wallet-buttons-express/interfaces/on-unavailable-event-data.interface.d.ts.map +1 -0
  64. package/bundles/types/wallet-buttons-express/interfaces/wallet-capture-request.interface.d.ts +21 -0
  65. package/bundles/types/wallet-buttons-express/interfaces/wallet-capture-request.interface.d.ts.map +1 -0
  66. package/bundles/types/wallet-buttons-express/services/apple-pay/apple-pay.wallet-button-express.d.ts +50 -0
  67. package/bundles/types/wallet-buttons-express/services/apple-pay/apple-pay.wallet-button-express.d.ts.map +1 -0
  68. package/bundles/types/wallet-buttons-express/services/apple-pay/constants/apple-pay-button-style.constant.d.ts +3 -0
  69. package/bundles/types/wallet-buttons-express/services/apple-pay/constants/apple-pay-button-style.constant.d.ts.map +1 -0
  70. package/bundles/types/wallet-buttons-express/services/apple-pay/interfaces/apple-pay-gateway-config.interface.d.ts +6 -0
  71. package/bundles/types/wallet-buttons-express/services/apple-pay/interfaces/apple-pay-gateway-config.interface.d.ts.map +1 -0
  72. package/bundles/types/wallet-buttons-express/services/apple-pay/interfaces/apple-pay-wallet-meta.interface.d.ts +17 -0
  73. package/bundles/types/wallet-buttons-express/services/apple-pay/interfaces/apple-pay-wallet-meta.interface.d.ts.map +1 -0
  74. package/bundles/types/wallet-buttons-express/services/apple-pay/types/apple-pay-button-style.type.d.ts +2 -0
  75. package/bundles/types/wallet-buttons-express/services/apple-pay/types/apple-pay-button-style.type.d.ts.map +1 -0
  76. package/bundles/types/wallet-buttons-express/services/apple-pay/types/apple-pay-button-type.type.d.ts +2 -0
  77. package/bundles/types/wallet-buttons-express/services/apple-pay/types/apple-pay-button-type.type.d.ts.map +1 -0
  78. package/bundles/types/wallet-buttons-express/services/paypal/interfaces/paypal-gateway-config.interface.d.ts +4 -0
  79. package/bundles/types/wallet-buttons-express/services/paypal/interfaces/paypal-gateway-config.interface.d.ts.map +1 -0
  80. package/bundles/types/wallet-buttons-express/services/paypal/interfaces/paypal-wallet-meta.interface.d.ts +31 -0
  81. package/bundles/types/wallet-buttons-express/services/paypal/interfaces/paypal-wallet-meta.interface.d.ts.map +1 -0
  82. package/bundles/types/wallet-buttons-express/services/paypal/paypal.wallet-button-express.d.ts +47 -0
  83. package/bundles/types/wallet-buttons-express/services/paypal/paypal.wallet-button-express.d.ts.map +1 -0
  84. package/bundles/widget.umd.js +3859 -3036
  85. package/bundles/widget.umd.js.d.ts +465 -47
  86. package/bundles/widget.umd.js.min.d.ts +465 -47
  87. package/bundles/widget.umd.min.js +6 -6
  88. package/docs/click-to-pay.md +1 -1
  89. package/docs/html/layout.html +1 -0
  90. package/docs/wallet-buttons-express-examples.md +201 -0
  91. package/docs/wallet-buttons-express.md +786 -0
  92. package/package.json +4 -3
  93. package/bundles/types/wallet-buttons/afterpay.wallet-service.d.ts.map +0 -1
  94. package/bundles/types/wallet-buttons/apple.wallet-service.d.ts.map +0 -1
  95. package/bundles/types/wallet-buttons/flypay-v2.wallet-service.d.ts.map +0 -1
  96. package/bundles/types/wallet-buttons/flypay.wallet-service.d.ts.map +0 -1
  97. package/bundles/types/wallet-buttons/google.wallet-service.d.ts.map +0 -1
  98. package/bundles/types/wallet-buttons/mastercard.wallet-service.d.ts.map +0 -1
  99. package/bundles/types/wallet-buttons/paypal.wallet-service.d.ts.map +0 -1
  100. package/bundles/types/wallet-buttons/stripe.wallet-service.d.ts.map +0 -1
  101. package/bundles/types/wallet-buttons/wallet-service.d.ts.map +0 -1
  102. /package/bundles/types/wallet-buttons/{mastercard.wallet-service.d.ts → wallet-services/mastercard.wallet-service.d.ts} +0 -0
@@ -689,7 +689,7 @@ interface IEventData$1 {
689
689
  data?: any;
690
690
  ref_id?: string;
691
691
  }
692
- declare const EVENT: {
692
+ declare const EVENT$1: {
693
693
  AFTER_LOAD: string;
694
694
  SUBMIT: string;
695
695
  FINISH: string;
@@ -895,6 +895,7 @@ declare class Configuration {
895
895
  declare class EventEmitter {
896
896
  private events;
897
897
  emit<T>(eventName: string, data?: T): void;
898
+ emitWithResult<T, R>(eventName: string, data?: T): Promise<R[]>;
898
899
  subscribe<T>(eventName: string, handler: (data: T) => void): () => void;
899
900
  }
900
901
 
@@ -1877,6 +1878,17 @@ interface ProcessAuthenticationResponse {
1877
1878
  };
1878
1879
  }
1879
1880
 
1881
+ declare class ApiGatewayInternal {
1882
+ protected api: ApiInternal;
1883
+ constructor(api: ApiInternal);
1884
+ getWalletConfig(gateway_id: string): Promise<GetWalletConfigResponse>;
1885
+ }
1886
+ interface GetWalletConfigResponse {
1887
+ type: string;
1888
+ mode: string;
1889
+ credentials?: object;
1890
+ }
1891
+
1880
1892
  declare class ApiServiceInternal {
1881
1893
  protected api: ApiInternal;
1882
1894
  constructor(api: ApiInternal);
@@ -1894,6 +1906,7 @@ interface GetConfigResponse {
1894
1906
  declare class ApiInternal extends ApiBase {
1895
1907
  charge(): ApiChargeInternal;
1896
1908
  service(): ApiServiceInternal;
1909
+ gateway(): ApiGatewayInternal;
1897
1910
  }
1898
1911
 
1899
1912
  interface SRCProvider {
@@ -2123,51 +2136,6 @@ declare class VaultDisplayWidget {
2123
2136
  load(): void;
2124
2137
  }
2125
2138
 
2126
- interface IWalletPaymentSuccessful {
2127
- id: string;
2128
- amount: number;
2129
- currency: string;
2130
- status: string;
2131
- payer_name?: string;
2132
- payer_email?: string;
2133
- payer_phone?: string;
2134
- }
2135
- interface IWalletUnavailable {
2136
- wallet?: WALLET_TYPE;
2137
- }
2138
- interface IWalletOnClick {
2139
- attachResult: (result: Promise<void> | boolean) => void;
2140
- }
2141
- interface IWalletUpdate {
2142
- wallet_response_code?: string;
2143
- wallet_order_id?: string;
2144
- wallet_session_id?: string;
2145
- payment_source?: {
2146
- wallet_payment_method_id?: string;
2147
- card_number_last4?: string;
2148
- card_scheme?: string;
2149
- };
2150
- wallet_loyalty_account?: {
2151
- id?: string;
2152
- barcode?: string;
2153
- };
2154
- shipping?: {
2155
- address_line1?: string;
2156
- address_line2?: string;
2157
- address_postcode?: string;
2158
- address_city?: string;
2159
- address_state?: string;
2160
- address_country?: string;
2161
- address_company?: string;
2162
- post_office_box_number?: string;
2163
- wallet_address_id?: string;
2164
- wallet_address_name?: string;
2165
- wallet_address_created_timestamp?: string;
2166
- wallet_address_updated_timestamp?: string;
2167
- };
2168
- selected_shipping_option?: IShippingOption;
2169
- }
2170
-
2171
2139
  interface IWalletServiceUpdateData {
2172
2140
  amount: number;
2173
2141
  shipping_options?: IShippingOption[];
@@ -2237,6 +2205,51 @@ interface IWalletService {
2237
2205
  on(eventName: string, cb?: (data: IUnavailableWalletEventBody | IPaymentMethodSelectedWalletEventBody | any) => void): any;
2238
2206
  }
2239
2207
 
2208
+ interface IWalletPaymentSuccessful {
2209
+ id: string;
2210
+ amount: number;
2211
+ currency: string;
2212
+ status: string;
2213
+ payer_name?: string;
2214
+ payer_email?: string;
2215
+ payer_phone?: string;
2216
+ }
2217
+ interface IWalletUnavailable {
2218
+ wallet?: WALLET_TYPE;
2219
+ }
2220
+ interface IWalletOnClick {
2221
+ attachResult: (result: Promise<void> | boolean) => void;
2222
+ }
2223
+ interface IWalletUpdate {
2224
+ wallet_response_code?: string;
2225
+ wallet_order_id?: string;
2226
+ wallet_session_id?: string;
2227
+ payment_source?: {
2228
+ wallet_payment_method_id?: string;
2229
+ card_number_last4?: string;
2230
+ card_scheme?: string;
2231
+ };
2232
+ wallet_loyalty_account?: {
2233
+ id?: string;
2234
+ barcode?: string;
2235
+ };
2236
+ shipping?: {
2237
+ address_line1?: string;
2238
+ address_line2?: string;
2239
+ address_postcode?: string;
2240
+ address_city?: string;
2241
+ address_state?: string;
2242
+ address_country?: string;
2243
+ address_company?: string;
2244
+ post_office_box_number?: string;
2245
+ wallet_address_id?: string;
2246
+ wallet_address_name?: string;
2247
+ wallet_address_created_timestamp?: string;
2248
+ wallet_address_updated_timestamp?: string;
2249
+ };
2250
+ selected_shipping_option?: IShippingOption;
2251
+ }
2252
+
2240
2253
  interface IEventData {
2241
2254
  event: string;
2242
2255
  data: void | IWalletPaymentSuccessful | IWalletUpdate | IWalletUnavailable | IWalletOnClick | any;
@@ -3269,4 +3282,409 @@ declare class HtmlWidget extends HtmlMultiWidget {
3269
3282
  setGiftCardScheme(giftCardScheme: any, processingNetwork: any): void;
3270
3283
  }
3271
3284
 
3272
- export { AfterpayCheckoutButton, Api, CHECKOUT_BUTTON_EVENT, Canvas3ds, ClickToPay, Configuration, ELEMENT, EVENT, Builder$1 as ExternalCheckoutBuilder, Checker as ExternalCheckoutChecker, FORM_FIELD, HtmlMultiWidget, HtmlPaymentSourceWidget, HtmlWidget, type ICheckout, type IDetails, type IElementStyleInput, type IEventCheckoutFinishData, type IPayPalMeta, type IStyles$1 as IStyles, type ITexts, MultiWidget, PAYMENT_TYPE, PURPOSE, Builder as PaymentSourceBuilder, PaymentSourceWidget, PaypalCheckoutButton, STYLABLE_ELEMENT, STYLABLE_ELEMENT_STATE, STYLE, SUPPORTED_CARD_TYPES, TEXT, TRIGGER, TYPE, VAULT_DISPLAY_STYLE, type VaultDisplayStyle, VaultDisplayWidget, WalletButtons, ZipmoneyCheckoutButton };
3285
+ declare enum EVENT {
3286
+ UNAVAILABLE = "unavailable",
3287
+ ERROR = "error",
3288
+ PAYMENT_SUCCESSFUL = "paymentSuccessful",
3289
+ PAYMENT_ERROR = "paymentError",
3290
+ PAYMENT_IN_REVIEW = "paymentInReview",
3291
+ ON_CLICK = "onClick",
3292
+ ON_CHECKOUT_CLOSE = "onCheckoutClose"
3293
+ }
3294
+
3295
+ interface BaseEventData<T> {
3296
+ event: string;
3297
+ chargeId?: string;
3298
+ data?: T | undefined;
3299
+ }
3300
+
3301
+ interface OnClickEventData extends BaseEventData<undefined> {
3302
+ event: EVENT.ON_CLICK;
3303
+ }
3304
+
3305
+ interface OnPaymentSuccessfulEventData extends BaseEventData<{
3306
+ id: string;
3307
+ amount: number;
3308
+ currency: string;
3309
+ status: string;
3310
+ }> {
3311
+ event: EVENT.PAYMENT_SUCCESSFUL;
3312
+ }
3313
+
3314
+ interface OnCloseEventData extends BaseEventData<undefined> {
3315
+ event: EVENT.ON_CHECKOUT_CLOSE;
3316
+ }
3317
+
3318
+ interface OnPaymentInReviewEventData extends Omit<OnPaymentSuccessfulEventData, 'event'> {
3319
+ event: EVENT.PAYMENT_IN_REVIEW;
3320
+ }
3321
+
3322
+ interface OnPaymentErrorEventData extends BaseEventData<{
3323
+ message?: string;
3324
+ code?: string;
3325
+ }> {
3326
+ event: EVENT.PAYMENT_ERROR;
3327
+ }
3328
+
3329
+ interface WalletCaptureRequest {
3330
+ payment_method_id?: string;
3331
+ customer: {
3332
+ email?: string;
3333
+ phone?: string;
3334
+ first_name?: string;
3335
+ last_name?: string;
3336
+ payment_source?: {
3337
+ wallet_type?: string;
3338
+ address_line1?: string;
3339
+ address_line2?: string;
3340
+ address_country?: string;
3341
+ address_city?: string;
3342
+ address_postcode?: string;
3343
+ address_state?: string;
3344
+ ref_token?: string;
3345
+ external_payer_id?: string;
3346
+ };
3347
+ };
3348
+ }
3349
+
3350
+ interface OnUnavailableEventData extends BaseEventData<undefined> {
3351
+ event: EVENT.UNAVAILABLE;
3352
+ }
3353
+
3354
+ interface BaseGatewayConfig<T> {
3355
+ type: string;
3356
+ mode: string;
3357
+ credentials?: T;
3358
+ }
3359
+
3360
+ interface BaseWalletMeta {
3361
+ amount: number;
3362
+ currency: string;
3363
+ }
3364
+
3365
+ interface OnErrorEventData extends BaseEventData<Error> {
3366
+ event: EVENT.ERROR;
3367
+ }
3368
+
3369
+ declare abstract class BaseWalletButton<T extends BaseWalletMeta> {
3370
+ protected container: Container;
3371
+ protected api: ApiInternal;
3372
+ protected env: string;
3373
+ protected gatewayId: string;
3374
+ protected meta: T;
3375
+ private eventEmitter;
3376
+ private chargeWalletTokenMeta?;
3377
+ constructor(selector: string, publicKeyOrAccessToken: string, gatewayId: string, meta: T, requiredMetaFields: string[]);
3378
+ private getApiAuthType;
3379
+ /**
3380
+ * Current method can change environment. By default environment = sandbox.
3381
+ * Also we can change domain alias for this environment. By default domain_alias = paydock.com
3382
+ * Bear in mind that you must set an environment before calling `button.load()`.
3383
+ *
3384
+ * @example
3385
+ * button.setEnv('production', 'paydock.com');
3386
+ * @param {string} env - sandbox, production
3387
+ * @param {string} [alias] - Own domain alias
3388
+ */
3389
+ setEnv(env: string, alias?: string): void;
3390
+ /**
3391
+ * Callback for onClick method.
3392
+ *
3393
+ * @callback OnClickCallback
3394
+ * @param {OnClickEventData} data
3395
+ * @return {Promise<string>} walletToken string result
3396
+ */
3397
+ /**
3398
+ * Registers a callback function to be invoked when the wallet button gets clicked.
3399
+ * **Note:** is mandatory to handle this event to perform the wallet initialization (and optionally any validation logic).
3400
+ * The event handler needs to return the wallet token string in order for the Wallet charge processing to proceed, or throw an error in case of failure or validation errors.
3401
+ * **Note:** this callback may be called multiple times as the customer closes the payment checkout and re-clicks the button.
3402
+ * It's the merchant's responsibility to handle this situation and evaluate in each case if generating a new WalletCharge Token is required or the previous one can be used in each case, depending on order data and updates.
3403
+ * In case a new one needs to be generated, remember it will need to be preceded by a `setMeta` call.
3404
+ *
3405
+ * @example
3406
+ * button.onClick(async (data) => {
3407
+ * const responseData = await fetch('https://your-server.com/init-wallet-charge');
3408
+ * return responseData.walletToken;
3409
+ * });
3410
+ *
3411
+ * @param {OnClickCallback} handler - Function to be called when the wallet button is clicked.
3412
+ */
3413
+ onClick(handler: (data: OnClickEventData) => Promise<string>): () => void;
3414
+ /**
3415
+ * Callback for onPaymentSuccessful method.
3416
+ *
3417
+ * @callback OnPaymentSuccessfulCallback
3418
+ * @param {OnPaymentSuccessfulEventData} data
3419
+ */
3420
+ /**
3421
+ * If the payment was successful, the function passed as parameter will be called.
3422
+ * Important: Do not perform thread blocking operations in callback such as window.alert() calls.
3423
+ *
3424
+ * @example
3425
+ * button.onPaymentSuccessful((data) => {
3426
+ * console.log('Payment successful!');
3427
+ * });
3428
+ *
3429
+ * @example
3430
+ * button.onPaymentSuccessful().then((data) => console.log('Payment successful!'));
3431
+ *
3432
+ * @param {OnPaymentSuccessfulCallback} [handler] - Function to be called when the payment was successful.
3433
+ */
3434
+ onPaymentSuccessful(handler?: (data: OnPaymentSuccessfulEventData) => void): Promise<unknown> | (() => void);
3435
+ /**
3436
+ * Callback for onPaymentInReview method.
3437
+ *
3438
+ * @callback OnPaymentInReviewCallback
3439
+ * @param {OnPaymentInReviewEventData} data
3440
+ */
3441
+ /**
3442
+ * If the payment was left in fraud review, the function passed as parameter will be called.
3443
+ * Important: Do not perform thread blocking operations in callback such as window.alert() calls.
3444
+ *
3445
+ * @example
3446
+ * button.onPaymentInReview((data) => {
3447
+ * console.log('Payment in fraud review');
3448
+ * });
3449
+ *
3450
+ * @example
3451
+ * button.onPaymentInReview().then((data) => console.log('Payment in fraud review'));
3452
+ *
3453
+ * @param {OnPaymentInReviewCallback} [handler] - Function to be called when the payment was left in fraud review status.
3454
+ */
3455
+ onPaymentInReview(handler?: (err: OnPaymentInReviewEventData) => void): Promise<unknown> | (() => void);
3456
+ /**
3457
+ * Callback for onPaymentError method.
3458
+ *
3459
+ * @callback OnPaymentErrorCallback
3460
+ * @param {OnPaymentErrorEventData} data
3461
+ */
3462
+ /**
3463
+ * If the payment was not successful, the function passed as parameter will be called.
3464
+ * Important: Do not perform thread blocking operations in callback such as window.alert() calls.
3465
+ *
3466
+ * @example
3467
+ * button.onPaymentError((err) => {
3468
+ * console.log('Payment not successful');
3469
+ * });
3470
+ *
3471
+ * @example
3472
+ * button.onPaymentError().then((err) => console.log('Payment not successful'));
3473
+ *
3474
+ * @param {OnPaymentErrorCallback} [handler] - Function to be called when the payment was not successful.
3475
+ */
3476
+ onPaymentError(handler?: (err: OnPaymentErrorEventData) => void): Promise<unknown> | (() => void);
3477
+ /**
3478
+ * Callback for onCheckoutClose method.
3479
+ *
3480
+ * @callback OnCheckoutCloseCallback
3481
+ * @param {OnCloseEventData} data
3482
+ */
3483
+ /**
3484
+ * Registers a callback function to be invoked when the wallet checkout closes.
3485
+ *
3486
+ * @example
3487
+ * button.onCheckoutClose(() => {
3488
+ * console.log('Wallet checkout closes');
3489
+ * });
3490
+ *
3491
+ * @param {OnCheckoutCloseCallback} handler - Function to be called when the wallet checkout closes.
3492
+ */
3493
+ onCheckoutClose(handler?: (err: OnCloseEventData) => void): Promise<unknown> | (() => void);
3494
+ /**
3495
+ * Callback for onUnavailable method.
3496
+ *
3497
+ * @callback OnUnavailableCallback
3498
+ * @param {OnUnavailableEventData} data
3499
+ */
3500
+ /**
3501
+ * Registers a callback function to be invoked when the wallet is not available in the current context.
3502
+ *
3503
+ * @example
3504
+ * button.onUnavailable(() => {
3505
+ * console.log('Wallet not available');
3506
+ * });
3507
+ *
3508
+ * @param {OnUnavailableCallback} handler - Function to be called when the wallet is not available in the current context.
3509
+ */
3510
+ onUnavailable(handler?: (err: OnUnavailableEventData) => void): Promise<unknown> | (() => void);
3511
+ /**
3512
+ * Callback for onError method.
3513
+ *
3514
+ * @callback OnErrorCallback
3515
+ * @param {OnErrorEventData} data
3516
+ */
3517
+ /**
3518
+ * Registers a callback function to be invoked when an error that is not related to payment execution occurs.
3519
+ * For example, if the amount of the wallet token injected via the `onClick` event handler does not match the amount provided via the initial `meta` or `setMeta` method.
3520
+ *
3521
+ * @example
3522
+ * button.onError((error) => {
3523
+ * console.log('WalletButtonExpress error', error);
3524
+ * });
3525
+ *
3526
+ * @param {OnErrorCallback} handler - Function to be called when the WalletButton has an error.
3527
+ */
3528
+ onError(handler?: (err: OnErrorEventData) => void): Promise<unknown> | (() => void);
3529
+ /**
3530
+ * Add docs on each child class
3531
+ */
3532
+ abstract load(): void;
3533
+ /**
3534
+ * Add docs on each child class
3535
+ */
3536
+ abstract setMeta(meta: object): void;
3537
+ protected getGatewayWalletConfig<T>(): Promise<BaseGatewayConfig<T>>;
3538
+ protected executeWalletCallback<T, U extends {
3539
+ request_type: string;
3540
+ }>(data: U): Promise<T>;
3541
+ protected executeWalletCapture<T>(data: WalletCaptureRequest): Promise<T>;
3542
+ protected handleMerchantOnExpressButtonClickEvent(): Promise<void>;
3543
+ private setWalletToken;
3544
+ protected handleCheckoutClose(): void;
3545
+ protected handleOnUnavailable(): void;
3546
+ protected handleOnError(error?: Error): void;
3547
+ protected eventDataFromApiError(err: any): OnPaymentErrorEventData['data'];
3548
+ protected validateRequiredMetaFields(requiredMetaFields: string[]): void;
3549
+ }
3550
+
3551
+ type ApplePayButtonStyle = 'black' | 'white' | 'white-outline';
3552
+
3553
+ type ApplePayButtonType = 'add-money' | 'book' | 'buy' | 'check-out' | 'continue' | 'contribute' | 'donate' | 'order' | 'pay' | 'plain' | 'reload' | 'rent' | 'set-up' | 'subscribe' | 'support' | 'tip' | 'top-up';
3554
+
3555
+ interface ApplePayWalletMeta extends BaseWalletMeta {
3556
+ amount_label: string;
3557
+ country: string;
3558
+ merchant_capabilities?: Array<'supports3DS' | 'supportsEMV' | 'supportsCredit' | 'supportsDebit'>;
3559
+ supported_networks?: Array<'visa' | 'masterCard' | 'amex' | 'chinaUnionPay' | 'discover' | 'interac' | 'jcb' | 'privateLabel'>;
3560
+ required_billing_contact_fields?: Array<'email' | 'name' | 'phone' | 'postalAddress'>;
3561
+ required_shipping_contact_fields?: Array<'email' | 'phone'>;
3562
+ supported_countries?: string[];
3563
+ style?: {
3564
+ button_type?: ApplePayButtonType;
3565
+ button_style?: ApplePayButtonStyle;
3566
+ };
3567
+ }
3568
+
3569
+ /**
3570
+ * Class ApplePayWalletButtonExpress to work with Apple Pay Wallet.
3571
+ *
3572
+ * @extends BaseWalletButton
3573
+ *
3574
+ * @constructor
3575
+ *
3576
+ * @example
3577
+ * var button = new ApplePayWalletButtonExpress('#wallet-buttons', 'publicKeyOrAccessToken', 'gatewayId', meta);
3578
+ *
3579
+ * @param {string} selector - Selector of html element. Container for the ApplePayWalletButtonExpress.
3580
+ * @param {string} publicKeyOrAccessToken - Public key or Access token for the ApplePayWalletButtonExpress.
3581
+ * @param {string} gatewayId - Gateway ID for the ApplePayWalletButtonExpress.
3582
+ * @param {ApplePayWalletMeta} meta - data that configures the Apple Pay Wallet.
3583
+ */
3584
+ declare class ApplePayWalletButtonExpress extends BaseWalletButton<ApplePayWalletMeta> {
3585
+ private paymentSession;
3586
+ /** @constructs */ constructor(selector: string, publicKeyOrAccessToken: string, gatewayId: string, meta: ApplePayWalletMeta);
3587
+ /**
3588
+ * Initializes the availability checks and inserts the button if possible.
3589
+ * Otherwise function onUnavailable(handler: VoidFunction) will be called.
3590
+ * **Important**: Is required to invoke this method to render the wallet button.
3591
+ *
3592
+ * @example
3593
+ * button.load();
3594
+ */
3595
+ load(): void;
3596
+ /**
3597
+ * Call this method if updating the originally-provided meta object after order information changed.
3598
+ * For example, if the order amount has changed from the time where the button was originally rendered.
3599
+ *
3600
+ * @example
3601
+ * button.setMeta(meta);
3602
+ *
3603
+ * @param {ApplePayWalletMeta} meta - // data that configures the Apple Pay Wallet.
3604
+ */
3605
+ setMeta(meta: ApplePayWalletMeta): void;
3606
+ private checkAvailability;
3607
+ private mount;
3608
+ private onApplePayButtonClicked;
3609
+ private createRequest;
3610
+ private onValidateMerchant;
3611
+ private getMerchantSession;
3612
+ private onPaymentAuthorized;
3613
+ private onCancelPayment;
3614
+ }
3615
+
3616
+ interface PaypalWalletMeta extends BaseWalletMeta {
3617
+ pay_later?: boolean;
3618
+ standalone?: boolean;
3619
+ capture?: boolean;
3620
+ style?: {
3621
+ layout?: 'vertical' | 'horizontal';
3622
+ color?: 'gold' | 'blue' | 'silver' | 'black' | 'white';
3623
+ shape?: 'rect' | 'pill' | 'sharp';
3624
+ borderRadius?: number;
3625
+ height?: number;
3626
+ disableMaxWidth?: boolean;
3627
+ label?: 'paypal' | 'checkout' | 'buynow' | 'pay' | 'installment';
3628
+ tagline?: boolean;
3629
+ messages?: {
3630
+ layout?: 'text' | 'flex';
3631
+ logo?: {
3632
+ type?: 'primary' | 'alternative' | 'inline' | 'none';
3633
+ position?: 'left' | 'right' | 'top';
3634
+ };
3635
+ text?: {
3636
+ color?: 'black' | 'white' | 'monochrome' | 'grayscale';
3637
+ size?: 10 | 11 | 12 | 13 | 14 | 15 | 16;
3638
+ align?: 'left' | 'center' | 'right';
3639
+ };
3640
+ color?: 'blue' | 'black' | 'white' | 'white-no-border' | 'gray' | 'monochrome' | 'grayscale';
3641
+ ratio?: '1x1' | '1x4' | '8x1' | '20x1';
3642
+ };
3643
+ };
3644
+ }
3645
+
3646
+ /**
3647
+ * Class PaypalWalletButtonExpress to work with Paypal Wallet.
3648
+ *
3649
+ * @extends BaseWalletButton
3650
+ *
3651
+ * @constructor
3652
+ *
3653
+ * @example
3654
+ * var button = new PaypalWalletButtonExpress('#wallet-buttons', 'publicKeyOrAccessToken', 'gatewayId', meta);
3655
+ *
3656
+ * @param {string} selector - Selector of html element. Container for the PaypalWalletButtonExpress.
3657
+ * @param {string} publicKeyOrAccessToken - Public key or Access token for the PaypalWalletButtonExpress.
3658
+ * @param {string} gatewayId - Gateway ID for the PaypalWalletButtonExpress.
3659
+ * @param {PaypalWalletMeta} meta - data that configures the Paypal Wallet.
3660
+ */
3661
+ declare class PaypalWalletButtonExpress extends BaseWalletButton<PaypalWalletMeta> {
3662
+ private config;
3663
+ protected paypal: any;
3664
+ protected pendingApprovalPromise?: Promise<any>;
3665
+ /** @constructs */ constructor(selector: string, publicKeyOrAccessToken: string, gatewayId: string, meta: PaypalWalletMeta);
3666
+ /**
3667
+ * Initializes the availability checks and inserts the button if possible.
3668
+ * Otherwise function onUnavailable(handler: VoidFunction) will be called.
3669
+ * **Important**: Is required to invoke this method to render the wallet button.
3670
+ *
3671
+ * @example
3672
+ * button.load();
3673
+ */
3674
+ load(): void;
3675
+ /**
3676
+ * Call this method if updating the originally-provided meta object after order information changed.
3677
+ * For example, if the order amount has changed from the time where the button was originally rendered.
3678
+ *
3679
+ * @example
3680
+ * button.setMeta(meta);
3681
+ * @param {PaypalWalletMeta} meta - // data that configures the Paypal Wallet.
3682
+ */
3683
+ setMeta(meta: PaypalWalletMeta): void;
3684
+ private renderPaypalButton;
3685
+ private renderPaypalCommonComponent;
3686
+ private renderPaypalStandaloneComponent;
3687
+ private paypalSharedProps;
3688
+ }
3689
+
3690
+ export { AfterpayCheckoutButton, Api, ApplePayWalletButtonExpress, CHECKOUT_BUTTON_EVENT, Canvas3ds, ClickToPay, Configuration, ELEMENT, EVENT$1 as EVENT, Builder$1 as ExternalCheckoutBuilder, Checker as ExternalCheckoutChecker, FORM_FIELD, HtmlMultiWidget, HtmlPaymentSourceWidget, HtmlWidget, type ICheckout, type IDetails, type IElementStyleInput, type IEventCheckoutFinishData, type IPayPalMeta, type IStyles$1 as IStyles, type ITexts, MultiWidget, PAYMENT_TYPE, PURPOSE, Builder as PaymentSourceBuilder, PaymentSourceWidget, PaypalCheckoutButton, PaypalWalletButtonExpress, STYLABLE_ELEMENT, STYLABLE_ELEMENT_STATE, STYLE, SUPPORTED_CARD_TYPES, TEXT, TRIGGER, TYPE, VAULT_DISPLAY_STYLE, type VaultDisplayStyle, VaultDisplayWidget, WalletButtons, ZipmoneyCheckoutButton };