@paydock/client-sdk 1.132.0-beta → 1.135.14-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 (160) hide show
  1. package/README.md +167 -0
  2. package/bundles/index.cjs +13297 -11586
  3. package/bundles/index.cjs.d.ts +1197 -870
  4. package/bundles/index.mjs +13296 -11586
  5. package/bundles/index.mjs.d.ts +1197 -870
  6. package/bundles/types/afterpay-on-site-messaging/afterpay-on-site-messaging.d.ts +40 -0
  7. package/bundles/types/afterpay-on-site-messaging/afterpay-on-site-messaging.d.ts.map +1 -0
  8. package/bundles/types/afterpay-on-site-messaging/afterpay-on-site-messaging.interfaces.d.ts +29 -0
  9. package/bundles/types/afterpay-on-site-messaging/afterpay-on-site-messaging.interfaces.d.ts.map +1 -0
  10. package/bundles/types/afterpay-on-site-messaging/afterpay-on-site-messaging.service.d.ts +14 -0
  11. package/bundles/types/afterpay-on-site-messaging/afterpay-on-site-messaging.service.d.ts.map +1 -0
  12. package/bundles/types/afterpay-on-site-messaging/index.d.ts +18 -0
  13. package/bundles/types/afterpay-on-site-messaging/index.d.ts.map +1 -0
  14. package/bundles/types/api/api-checkout-internal.d.ts +2 -2
  15. package/bundles/types/api/api-checkout-internal.d.ts.map +1 -1
  16. package/bundles/types/api/api-payment-source-internal.d.ts +2 -1
  17. package/bundles/types/api/api-payment-source-internal.d.ts.map +1 -1
  18. package/bundles/types/api/api-service-internal.d.ts +13 -6
  19. package/bundles/types/api/api-service-internal.d.ts.map +1 -1
  20. package/bundles/types/checkout/images/card-icons.d.ts +2 -1
  21. package/bundles/types/checkout/images/card-icons.d.ts.map +1 -1
  22. package/bundles/types/checkout/v1/instructions/index.d.ts.map +1 -1
  23. package/bundles/types/checkout/v1/instructions/instruction.apple_pay_form.show.d.ts.map +1 -1
  24. package/bundles/types/checkout/v1/instructions/instruction.google_pay_form.show.d.ts.map +1 -1
  25. package/bundles/types/checkout/v1/instructions/instruction.paypal_form.show.d.ts.map +1 -1
  26. package/bundles/types/checkout/v3/components/go-back-to-payments-button/go-back-to-payments.d.ts +1 -0
  27. package/bundles/types/checkout/v3/components/go-back-to-payments-button/go-back-to-payments.d.ts.map +1 -1
  28. package/bundles/types/checkout/v3/instructions/instruction.apple_pay_form.show.d.ts.map +1 -1
  29. package/bundles/types/checkout/v3/instructions/instruction.card_form.show.d.ts +1 -0
  30. package/bundles/types/checkout/v3/instructions/instruction.card_form.show.d.ts.map +1 -1
  31. package/bundles/types/checkout/v3/instructions/instruction.google_pay_form.show.d.ts.map +1 -1
  32. package/bundles/types/checkout/v3/instructions/instruction.payment_methods.show.d.ts.map +1 -1
  33. package/bundles/types/checkout/v3/instructions/instruction.paypal_form.show.d.ts.map +1 -1
  34. package/bundles/types/checkout/v3/instructions/instruction.saved_card_form.show.d.ts +14 -2
  35. package/bundles/types/checkout/v3/instructions/instruction.saved_card_form.show.d.ts.map +1 -1
  36. package/bundles/types/checkout/v3/models/card.model.d.ts +3 -1
  37. package/bundles/types/checkout/v3/models/card.model.d.ts.map +1 -1
  38. package/bundles/types/checkout/v3/models/payment-methods.model.d.ts.map +1 -1
  39. package/bundles/types/components/param.d.ts +4 -1
  40. package/bundles/types/components/param.d.ts.map +1 -1
  41. package/bundles/types/index-cba.d.ts +9 -6
  42. package/bundles/types/index-cba.d.ts.map +1 -1
  43. package/bundles/types/index.d.ts +9 -6
  44. package/bundles/types/index.d.ts.map +1 -1
  45. package/bundles/types/open-wallets/base/open-wallet-buttons.d.ts +198 -0
  46. package/bundles/types/open-wallets/base/open-wallet-buttons.d.ts.map +1 -0
  47. package/bundles/types/open-wallets/base/open-wallet.service.d.ts +27 -0
  48. package/bundles/types/open-wallets/base/open-wallet.service.d.ts.map +1 -0
  49. package/bundles/types/open-wallets/enum/event.enum.d.ts +8 -1
  50. package/bundles/types/open-wallets/enum/event.enum.d.ts.map +1 -1
  51. package/bundles/types/open-wallets/enum/payload-format.enum.d.ts +4 -0
  52. package/bundles/types/open-wallets/enum/payload-format.enum.d.ts.map +1 -0
  53. package/bundles/types/open-wallets/enum/service-group.enum.d.ts +5 -0
  54. package/bundles/types/open-wallets/enum/service-group.enum.d.ts.map +1 -0
  55. package/bundles/types/open-wallets/index.d.ts +2 -2
  56. package/bundles/types/open-wallets/index.d.ts.map +1 -1
  57. package/bundles/types/open-wallets/interfaces/apple-pay/apple-pay-payment-request.interface.d.ts +495 -0
  58. package/bundles/types/open-wallets/interfaces/apple-pay/apple-pay-payment-request.interface.d.ts.map +1 -0
  59. package/bundles/types/open-wallets/interfaces/apple-pay/index.d.ts +2 -0
  60. package/bundles/types/open-wallets/interfaces/apple-pay/index.d.ts.map +1 -0
  61. package/bundles/types/open-wallets/interfaces/events.interface.d.ts +5 -6
  62. package/bundles/types/open-wallets/interfaces/events.interface.d.ts.map +1 -1
  63. package/bundles/types/open-wallets/interfaces/google-pay/google-pay-meta.interface.d.ts +54 -0
  64. package/bundles/types/open-wallets/interfaces/google-pay/google-pay-meta.interface.d.ts.map +1 -0
  65. package/bundles/types/open-wallets/interfaces/google-pay/index.d.ts +2 -0
  66. package/bundles/types/open-wallets/interfaces/google-pay/index.d.ts.map +1 -0
  67. package/bundles/types/open-wallets/interfaces/index.d.ts +1 -3
  68. package/bundles/types/open-wallets/interfaces/index.d.ts.map +1 -1
  69. package/bundles/types/open-wallets/interfaces/open-wallet-meta.interface.d.ts +11 -0
  70. package/bundles/types/open-wallets/interfaces/open-wallet-meta.interface.d.ts.map +1 -0
  71. package/bundles/types/open-wallets/interfaces/payment-source.interface.d.ts +0 -1
  72. package/bundles/types/open-wallets/interfaces/payment-source.interface.d.ts.map +1 -1
  73. package/bundles/types/open-wallets/services/apple-pay/apple-pay.open-wallet.service.d.ts +64 -0
  74. package/bundles/types/open-wallets/services/apple-pay/apple-pay.open-wallet.service.d.ts.map +1 -0
  75. package/bundles/types/open-wallets/services/apple-pay/index.d.ts +2 -0
  76. package/bundles/types/open-wallets/services/apple-pay/index.d.ts.map +1 -0
  77. package/bundles/types/open-wallets/services/google-pay/constants/google-pay.constants.d.ts +11 -0
  78. package/bundles/types/open-wallets/services/google-pay/constants/google-pay.constants.d.ts.map +1 -0
  79. package/bundles/types/open-wallets/services/google-pay/constants/index.d.ts +2 -0
  80. package/bundles/types/open-wallets/services/google-pay/constants/index.d.ts.map +1 -0
  81. package/bundles/types/open-wallets/services/google-pay/google-pay.open-wallet.service.d.ts +55 -0
  82. package/bundles/types/open-wallets/services/google-pay/google-pay.open-wallet.service.d.ts.map +1 -0
  83. package/bundles/types/open-wallets/services/google-pay/index.d.ts +2 -0
  84. package/bundles/types/open-wallets/services/google-pay/index.d.ts.map +1 -0
  85. package/bundles/types/open-wallets/services/google-pay/utils/google-pay.utils.d.ts +20 -0
  86. package/bundles/types/open-wallets/services/google-pay/utils/google-pay.utils.d.ts.map +1 -0
  87. package/bundles/types/open-wallets/services/google-pay/utils/index.d.ts +2 -0
  88. package/bundles/types/open-wallets/services/google-pay/utils/index.d.ts.map +1 -0
  89. package/bundles/types/open-wallets/services/google-pay/validation/google-pay.validation.d.ts +3 -0
  90. package/bundles/types/open-wallets/services/google-pay/validation/google-pay.validation.d.ts.map +1 -0
  91. package/bundles/types/open-wallets/services/google-pay/validation/index.d.ts +2 -0
  92. package/bundles/types/open-wallets/services/google-pay/validation/index.d.ts.map +1 -0
  93. package/bundles/types/open-wallets/types/apple-pay/apple-pay-button-style.type.d.ts +2 -0
  94. package/bundles/types/open-wallets/types/apple-pay/apple-pay-button-style.type.d.ts.map +1 -0
  95. package/bundles/types/open-wallets/types/apple-pay/apple-pay-button-type.type.d.ts +2 -0
  96. package/bundles/types/open-wallets/types/apple-pay/apple-pay-button-type.type.d.ts.map +1 -0
  97. package/bundles/types/open-wallets/types/apple-pay/index.d.ts +3 -0
  98. package/bundles/types/open-wallets/types/apple-pay/index.d.ts.map +1 -0
  99. package/bundles/types/open-wallets/types/base-event-data.interface.d.ts +5 -0
  100. package/bundles/types/open-wallets/types/base-event-data.interface.d.ts.map +1 -0
  101. package/bundles/types/open-wallets/types/google-pay/google-pay-button-color.type.d.ts +2 -0
  102. package/bundles/types/open-wallets/types/google-pay/google-pay-button-color.type.d.ts.map +1 -0
  103. package/bundles/types/open-wallets/types/google-pay/google-pay-button-size-mode.type.d.ts +2 -0
  104. package/bundles/types/open-wallets/types/google-pay/google-pay-button-size-mode.type.d.ts.map +1 -0
  105. package/bundles/types/open-wallets/types/google-pay/google-pay-button-type.type.d.ts +2 -0
  106. package/bundles/types/open-wallets/types/google-pay/google-pay-button-type.type.d.ts.map +1 -0
  107. package/bundles/types/open-wallets/types/google-pay/index.d.ts +4 -0
  108. package/bundles/types/open-wallets/types/google-pay/index.d.ts.map +1 -0
  109. package/bundles/types/open-wallets/types/index.d.ts +1 -2
  110. package/bundles/types/open-wallets/types/index.d.ts.map +1 -1
  111. package/bundles/types/open-wallets/types/on-shipping-address-change-event-data.interface.d.ts +21 -0
  112. package/bundles/types/open-wallets/types/on-shipping-address-change-event-data.interface.d.ts.map +1 -0
  113. package/bundles/types/open-wallets/types/on-shipping-address-change-event-response.interface.d.ts +6 -0
  114. package/bundles/types/open-wallets/types/on-shipping-address-change-event-response.interface.d.ts.map +1 -0
  115. package/bundles/types/open-wallets/types/on-shipping-option-change-event-data.interface.d.ts +13 -0
  116. package/bundles/types/open-wallets/types/on-shipping-option-change-event-data.interface.d.ts.map +1 -0
  117. package/bundles/types/open-wallets/types/on-shipping-option-change-event-response.interface.d.ts +4 -0
  118. package/bundles/types/open-wallets/types/on-shipping-option-change-event-response.interface.d.ts.map +1 -0
  119. package/bundles/types/open-wallets/types/payment-source.type.d.ts +85 -0
  120. package/bundles/types/open-wallets/types/payment-source.type.d.ts.map +1 -0
  121. package/bundles/types/open-wallets/types/shipping-event-to-response.type.d.ts +6 -0
  122. package/bundles/types/open-wallets/types/shipping-event-to-response.type.d.ts.map +1 -0
  123. package/bundles/types/open-wallets/types/wallet-type.type.d.ts +2 -2
  124. package/bundles/types/open-wallets/types/wallet-type.type.d.ts.map +1 -1
  125. package/bundles/types/paypal-save-payment-source/paypal-save-payment-source.d.ts.map +1 -1
  126. package/bundles/types/paypal-save-payment-source/paypal-save-payment-source.service.d.ts.map +1 -1
  127. package/bundles/types/secure-remote-commerce/secure-remote-commerce.d.ts +16 -16
  128. package/bundles/types/secure-remote-commerce/secure-remote-commerce.d.ts.map +1 -1
  129. package/bundles/types/shared-ui/components/modal.d.ts +18 -0
  130. package/bundles/types/shared-ui/components/modal.d.ts.map +1 -0
  131. package/bundles/types/wallet-buttons/wallet-services/paypal.wallet-service.d.ts.map +1 -1
  132. package/bundles/types/wallet-buttons-express/base.wallet-button-express.d.ts +9 -9
  133. package/bundles/types/wallet-buttons-express/base.wallet-button-express.d.ts.map +1 -1
  134. package/bundles/types/widget/html-multi-widget.d.ts +13 -1
  135. package/bundles/types/widget/html-multi-widget.d.ts.map +1 -1
  136. package/bundles/types/widget/index.d.ts +4 -3
  137. package/bundles/types/widget/index.d.ts.map +1 -1
  138. package/bundles/types/widget/multi-widget.d.ts +7 -4
  139. package/bundles/types/widget/multi-widget.d.ts.map +1 -1
  140. package/bundles/widget.umd.js +13297 -11586
  141. package/bundles/widget.umd.js.d.ts +1197 -870
  142. package/bundles/widget.umd.js.min.d.ts +1197 -870
  143. package/bundles/widget.umd.min.js +1 -1
  144. package/docs/afterpay-on-site-messaging-examples.md +60 -0
  145. package/docs/afterpay-on-site-messaging.md +104 -0
  146. package/docs/api-widget.md +1 -0
  147. package/docs/open-wallet-buttons-examples.md +1188 -0
  148. package/package.json +11 -4
  149. package/bundles/types/open-wallets/base/base-open-wallet.d.ts +0 -33
  150. package/bundles/types/open-wallets/base/base-open-wallet.d.ts.map +0 -1
  151. package/bundles/types/open-wallets/interfaces/base-service-config.interface.d.ts +0 -30
  152. package/bundles/types/open-wallets/interfaces/base-service-config.interface.d.ts.map +0 -1
  153. package/bundles/types/open-wallets/interfaces/base-wallet-meta.interface.d.ts +0 -5
  154. package/bundles/types/open-wallets/interfaces/base-wallet-meta.interface.d.ts.map +0 -1
  155. package/bundles/types/open-wallets/services/index.d.ts +0 -9
  156. package/bundles/types/open-wallets/services/index.d.ts.map +0 -1
  157. package/bundles/types/open-wallets/types/ott-backend.type.d.ts +0 -26
  158. package/bundles/types/open-wallets/types/ott-backend.type.d.ts.map +0 -1
  159. package/bundles/types/open-wallets/types/ott-response.type.d.ts +0 -8
  160. package/bundles/types/open-wallets/types/ott-response.type.d.ts.map +0 -1
@@ -1,6 +1,81 @@
1
1
  import { Observable } from 'rxjs';
2
2
  import { MicroAgent } from '@newrelic/browser-agent/loaders/micro-agent';
3
3
 
4
+ declare class Container {
5
+ protected selector: string;
6
+ constructor(selector: string);
7
+ isExist(): boolean;
8
+ getStyles<T>(allowValue: string[]): T | {};
9
+ on(name: any, cb: (event: MouseEvent) => void): void;
10
+ getAttr<T>(allowValue: string[]): T | {};
11
+ getElement(): Element;
12
+ getSelector(): string;
13
+ private convertConfigs;
14
+ }
15
+
16
+ declare class EventEmitter {
17
+ private events;
18
+ emit<T>(eventName: string, data?: T): void;
19
+ emitWithResult<T, R>(eventName: string, data?: T): Promise<R[]>;
20
+ subscribe<T>(eventName: string, handler: (data: T) => void): () => void;
21
+ }
22
+
23
+ declare enum PageType {
24
+ CART = "cart",
25
+ PRODUCT = "product"
26
+ }
27
+ interface IAfterpayOnSiteMessagingConfig {
28
+ mpid: string;
29
+ placement_id: string;
30
+ page_type: PageType;
31
+ amount?: string;
32
+ currency: string;
33
+ consumer_locale?: string;
34
+ item_skus?: string;
35
+ item_categories?: string;
36
+ is_eligible?: boolean;
37
+ }
38
+ interface IAfterpayOnSiteMessagingService {
39
+ load(container: Container): void;
40
+ }
41
+
42
+ /**
43
+ * Afterpay On Site Messaging constructor
44
+ *
45
+ * @param {string} selector - Selector of html element. Container for Afterpay On Site Messaging.
46
+ * @param {IAfterpayOnSiteMessagingConfig} config - Required configuration for the Afterpay On Site Messaging.
47
+ *
48
+ * @example
49
+ * var afterpayOnSiteMessaging = new AfterpayOnSiteMessaging('#afterpayButton', config);
50
+ */
51
+ declare class AfterpayOnSiteMessaging {
52
+ protected container: Container;
53
+ protected eventEmitter: EventEmitter;
54
+ protected service: IAfterpayOnSiteMessagingService;
55
+ /** @constructs */ constructor(selector: string, config?: IAfterpayOnSiteMessagingConfig);
56
+ /**
57
+ * The final method after configuring the AfterpayOnSiteMessaging to
58
+ * start the load process.
59
+ */
60
+ load(): void;
61
+ /**
62
+ * Callback for onError method.
63
+ *
64
+ * @callback OnErrorCallback
65
+ * @param {unknown|null} data
66
+ */
67
+ /**
68
+ * If the process fails, the function passed as parameter will be called.
69
+ * Important: Do not perform thread blocking operations in callback such as window.alert() calls.
70
+ *
71
+ * @example
72
+ * AfterpayOnSiteMessaging.onError((eventData) => console.log('Some error occur'));
73
+ *
74
+ * @param {OnErrorCallback} [callback] - Function to be called when there is an error in the flow.
75
+ */
76
+ onError(callback?: (data?: unknown) => void): () => void;
77
+ }
78
+
4
79
  declare class ApiCharge {
5
80
  protected api: Api;
6
81
  constructor(api: Api);
@@ -284,6 +359,7 @@ declare const FORM_FIELD: {
284
359
  SAVE_CARD_CONSENT_ACCEPTED: string;
285
360
  ENABLE_CVV_TOKENIZATION_MODE: string;
286
361
  CARD_NUMBER_LAST4: string;
362
+ ENABLE_CVV_VALIDATION: string;
287
363
  };
288
364
  declare const STYLE: {
289
365
  BACKGROUND_COLOR: string;
@@ -335,6 +411,7 @@ declare const SUPPORTED_CARD_TYPES: {
335
411
  VISA_WHITE: string;
336
412
  EFTPOS: string;
337
413
  EFTPOS_WHITE: string;
414
+ UNIONPAY: string;
338
415
  };
339
416
  interface IIcons {
340
417
  paypal_checkout_button?: string;
@@ -367,6 +444,7 @@ interface IFormPropertyOption {
367
444
  address_postcode?: string;
368
445
  address_company?: string;
369
446
  card_number_last4?: string;
447
+ enable_cvv_validation?: string;
370
448
  }
371
449
  interface IFormValues extends IFormPropertyOption {
372
450
  }
@@ -660,18 +738,6 @@ declare class Link {
660
738
  getBaseUrl(): string;
661
739
  }
662
740
 
663
- declare class Container {
664
- protected selector: string;
665
- constructor(selector: string);
666
- isExist(): boolean;
667
- getStyles<T>(allowValue: string[]): T | {};
668
- on(name: any, cb: (event: MouseEvent) => void): void;
669
- getAttr<T>(allowValue: string[]): T | {};
670
- getElement(): Element;
671
- getSelector(): string;
672
- private convertConfigs;
673
- }
674
-
675
741
  declare class IFrame {
676
742
  protected container: Container;
677
743
  constructor(container: Container);
@@ -855,6 +921,50 @@ declare class Configuration {
855
921
  disableResultMessage(): void;
856
922
  }
857
923
 
924
+ interface ITriggerData {
925
+ configuration_token?: string;
926
+ tab_number?: number;
927
+ elements?: string;
928
+ form_values?: string;
929
+ }
930
+ /**
931
+ * Interface for classes that represent a trigger data.
932
+ * @interface ITriggerData
933
+ *
934
+ * @param {string} [configuration_token]
935
+ * @param {string} [tab_number]
936
+ * @param {string} [elements]
937
+ * @param {string} [form_values]
938
+ * */
939
+ /**
940
+ * List of available triggers
941
+ *
942
+ * @type {object}
943
+ * @param {string} SUBMIT_FORM=submit_form
944
+ * @param {string} CHANGE_TAB=tab
945
+ * @param {string} HIDE_ELEMENTS=hide_elements
946
+ * @param {string} SHOW_ELEMENTS=show_elements
947
+ * @param {string} REFRESH_CHECKOUT=refresh_checkout
948
+ * @param {string} UPDATE_FORM_VALUES=update_form_values
949
+ * @param {string} INIT_CHECKOUT=init_checkout
950
+ * @param {string} INJECT_CUSTOMER_DATA=inject_customer_data
951
+ */
952
+ declare const TRIGGER: {
953
+ SUBMIT_FORM: string;
954
+ CHANGE_TAB: string;
955
+ HIDE_ELEMENTS: string;
956
+ SHOW_ELEMENTS: string;
957
+ REFRESH_CHECKOUT: string;
958
+ UPDATE_FORM_VALUES: string;
959
+ INIT_CHECKOUT: string;
960
+ INJECT_CUSTOMER_DATA: string;
961
+ };
962
+ declare class Trigger {
963
+ protected iFrame: IFrame;
964
+ constructor(iFrame: IFrame);
965
+ push(triggerName: string, data?: ITriggerData): void;
966
+ }
967
+
858
968
  /**
859
969
  * Current constant include available type of element for styling
860
970
  * @const STYLABLE_ELEMENT
@@ -1233,57 +1343,16 @@ declare class MultiWidget {
1233
1343
  */
1234
1344
  enableSaveCardConsentCheckbox(): void;
1235
1345
  /**
1236
- * The Current method enable the cvv mode for card form
1346
+ * This method enables the CVV mode for card forms.
1347
+ * CVV validation can be enabled using the `enable_cvv_validation` option.
1237
1348
  *
1238
1349
  * @example
1239
- * widget.enableCvvTokenizationMode();
1350
+ * widget.enableCvvTokenizationMode({ enable_cvv_validation : true });
1240
1351
  *
1241
- */
1242
- enableCvvTokenizationMode(): void;
1243
- }
1244
-
1245
- interface ITriggerData {
1246
- configuration_token?: string;
1247
- tab_number?: number;
1248
- elements?: string;
1249
- form_values?: string;
1250
- }
1251
- /**
1252
- * Interface for classes that represent a trigger data.
1253
- * @interface ITriggerData
1254
- *
1255
- * @param {string} [configuration_token]
1256
- * @param {string} [tab_number]
1257
- * @param {string} [elements]
1258
- * @param {string} [form_values]
1259
- * */
1260
- /**
1261
- * List of available triggers
1262
- *
1263
- * @type {object}
1264
- * @param {string} SUBMIT_FORM=submit_form
1265
- * @param {string} CHANGE_TAB=tab
1266
- * @param {string} HIDE_ELEMENTS=hide_elements
1267
- * @param {string} SHOW_ELEMENTS=show_elements
1268
- * @param {string} REFRESH_CHECKOUT=refresh_checkout
1269
- * @param {string} UPDATE_FORM_VALUES=update_form_values
1270
- * @param {string} INIT_CHECKOUT=init_checkout
1271
- * @param {string} INJECT_CUSTOMER_DATA=inject_customer_data
1272
- */
1273
- declare const TRIGGER: {
1274
- SUBMIT_FORM: string;
1275
- CHANGE_TAB: string;
1276
- HIDE_ELEMENTS: string;
1277
- SHOW_ELEMENTS: string;
1278
- REFRESH_CHECKOUT: string;
1279
- UPDATE_FORM_VALUES: string;
1280
- INIT_CHECKOUT: string;
1281
- INJECT_CUSTOMER_DATA: string;
1282
- };
1283
- declare class Trigger {
1284
- protected iFrame: IFrame;
1285
- constructor(iFrame: IFrame);
1286
- push(triggerName: string, data?: ITriggerData): void;
1352
+ */
1353
+ enableCvvTokenizationMode(options?: {
1354
+ enable_cvv_validation?: boolean;
1355
+ }): void;
1287
1356
  }
1288
1357
 
1289
1358
  interface IEventMetaData extends IEventData$1 {
@@ -1297,9 +1366,21 @@ interface IEventMetaData extends IEventData$1 {
1297
1366
  gateway_type?: string;
1298
1367
  }
1299
1368
  interface IEventFinishData extends IEventData$1 {
1369
+ address_city?: string;
1370
+ address_country?: string;
1371
+ address_line1?: string;
1372
+ address_line2?: string;
1373
+ address_postcode?: string;
1374
+ address_state?: string;
1375
+ card_scheme?: string;
1376
+ email?: string;
1377
+ expire_month?: string;
1378
+ expire_year?: string;
1379
+ first_name?: string;
1380
+ last_name?: string;
1300
1381
  payment_source: string;
1301
1382
  payment_source_token?: string;
1302
- card_scheme?: string;
1383
+ phone?: string;
1303
1384
  save_card_consent_accepted?: boolean;
1304
1385
  }
1305
1386
  /**
@@ -1790,13 +1871,6 @@ declare class IFrameEvent {
1790
1871
  private subscribe;
1791
1872
  }
1792
1873
 
1793
- declare class EventEmitter {
1794
- private events;
1795
- emit<T>(eventName: string, data?: T): void;
1796
- emitWithResult<T, R>(eventName: string, data?: T): Promise<R[]>;
1797
- subscribe<T>(eventName: string, handler: (data: T) => void): () => void;
1798
- }
1799
-
1800
1874
  declare class Standalone3dsService {
1801
1875
  protected container: Container;
1802
1876
  protected eventEmitter: EventEmitter;
@@ -1910,57 +1984,420 @@ declare class Canvas3ds {
1910
1984
  reload(): void;
1911
1985
  }
1912
1986
 
1913
- /**
1914
- * @type {object}
1915
- * @param {string} CLICK=click
1916
- * @param {string} POPUP_REDIRECT=popup_redirect
1917
- * @param {string} ERROR=error
1918
- * @param {string} ACCEPTED=accepted
1919
- * @param {string} FINISH=finish
1920
- * @param {string} CLOSE=close
1921
- */
1922
- declare const CHECKOUT_BUTTON_EVENT: {
1923
- CLICK: string;
1924
- POPUP_REDIRECT: string;
1925
- REDIRECT: string;
1926
- ERROR: string;
1927
- REFERRED: string;
1928
- DECLINED: string;
1929
- CANCELLED: string;
1930
- ACCEPTED: string;
1931
- FINISH: string;
1932
- CLOSE: string;
1933
- };
1934
- /**
1935
- * @type {object}
1936
- * @param {string} CONTEXTUAL=contextual
1937
- * @param {string} REDIRECT=redirect
1938
- */
1939
- declare enum CHECKOUT_MODE {
1940
- CONTEXTUAL = "contextual",
1941
- REDIRECT = "redirect"
1987
+ declare class ApiChargeInternal {
1988
+ protected api: ApiInternal;
1989
+ constructor(api: ApiInternal);
1990
+ walletCapture(payload: WalletCaptureBody): Promise<WalletCaptureResponse>;
1991
+ walletCallback(payload: WalletCallbackBody): Promise<WalletCallbackResponse>;
1992
+ standalone3dsProcess(payload: Standalone3dsProcessBody): Promise<ProcessAuthenticationResponse>;
1993
+ standalone3dsHandle(): Promise<HandleResponseInterface>;
1942
1994
  }
1943
- /**
1944
- * @type {object}
1945
- * @param {string} ZIPMONEY=Zipmoney
1946
- * @param {string} PAYPAL=PaypalClassic
1947
- * @param {string} AFTERPAY=Afterpay
1948
- */
1949
- declare enum GATEWAY_TYPE {
1950
- ZIPMONEY = "Zipmoney",
1951
- PAYPAL = "PaypalClassic",
1952
- AFTERPAY = "Afterpay"
1995
+ interface WalletCaptureResponse {
1996
+ id: string;
1997
+ amount: number;
1998
+ currency: string;
1999
+ status: string;
1953
2000
  }
1954
- interface IEventCheckoutFinishData {
1955
- payment_source_token: string;
1956
- checkout_email: string;
1957
- checkout_holder: string;
1958
- gateway_type: string;
2001
+ interface WalletCaptureBody {
2002
+ payment_method_id?: string;
2003
+ customer?: {
2004
+ payment_source?: {
2005
+ type?: string;
2006
+ card_name?: string;
2007
+ card_scheme?: string;
2008
+ card_number_last4?: string;
2009
+ expire_month?: number;
2010
+ expire_year?: number;
2011
+ address_line1?: string;
2012
+ address_line2?: string;
2013
+ address_city?: string;
2014
+ address_postcode?: string;
2015
+ address_state?: string;
2016
+ address_country?: string;
2017
+ external_payer_id?: string;
2018
+ ref_token?: string;
2019
+ wallet_express?: boolean;
2020
+ };
2021
+ };
1959
2022
  }
1960
-
1961
- /**
1962
- * Class Background create overlay for checkout
1963
- *
2023
+ interface WalletCallbackBody {
2024
+ request_type: string;
2025
+ }
2026
+ interface WalletCallbackResponse {
2027
+ id: string;
2028
+ status: string;
2029
+ callback_method: string;
2030
+ callback_rel: string;
2031
+ callback_url: string;
2032
+ }
2033
+ interface Standalone3dsProcessBody {
2034
+ charge_3ds_id: string;
2035
+ }
2036
+ interface HandleResponseInterface {
2037
+ status: string;
2038
+ error: string;
2039
+ result: {
2040
+ reference: string;
2041
+ reference_2: string;
2042
+ identifier: string;
2043
+ identifier_2: string;
2044
+ identifier_3: string;
2045
+ identifier_4: string;
2046
+ identifier_5: string;
2047
+ type: string;
2048
+ status: string;
2049
+ status_2: string;
2050
+ status_code: string;
2051
+ ref_token: string;
2052
+ cancellation: string;
2053
+ count: string;
2054
+ version: string;
2055
+ whitelist: {
2056
+ status: string;
2057
+ source: string;
2058
+ };
2059
+ result: string;
2060
+ };
2061
+ }
2062
+ interface ProcessAuthenticationResponse {
2063
+ status: string;
2064
+ error?: string;
2065
+ result?: {
2066
+ challenge: string;
2067
+ challenge_url: string;
2068
+ decoupled_challenge: boolean;
2069
+ frictionless: boolean;
2070
+ identifier: string;
2071
+ identifier_3: string;
2072
+ identifier_4: string;
2073
+ reference: string;
2074
+ reference_2: string;
2075
+ secondary_url: string;
2076
+ skipped: boolean;
2077
+ status: string;
2078
+ type: string;
2079
+ version: string;
2080
+ description?: string;
2081
+ };
2082
+ }
2083
+
2084
+ declare class ApiGatewayInternal {
2085
+ protected api: ApiInternal;
2086
+ constructor(api: ApiInternal);
2087
+ getWalletConfig(gateway_id: string): Promise<GetWalletConfigResponse>;
2088
+ }
2089
+ interface GetWalletConfigResponse {
2090
+ type: string;
2091
+ mode: string;
2092
+ credentials?: object;
2093
+ }
2094
+
2095
+ declare class ApiServiceInternal {
2096
+ protected api: ApiInternal;
2097
+ constructor(api: ApiInternal);
2098
+ getConfig(service_id: string): Promise<GetConfigResponse>;
2099
+ }
2100
+ interface GetConfigResponse {
2101
+ type: SERVICE_TYPES;
2102
+ merchant: string;
2103
+ username: string;
2104
+ password: string;
2105
+ certificate: string;
2106
+ certificate_passphrase: string;
2107
+ }
2108
+ declare enum SERVICE_TYPES {
2109
+ ACCERTIFY = "Accertify",
2110
+ BOOKING = "Booking",
2111
+ GPAYMENTS = "GPayments",
2112
+ CLICK_TO_PAY = "ClickToPay",
2113
+ MASTERCARD_NT = "MastercardSCOF",
2114
+ VISA_NT = "VisaVTS",
2115
+ FORTER = "Forter",
2116
+ APPLE_PAY = "ApplePay",
2117
+ GOOGLE_PAY = "GooglePay"
2118
+ }
2119
+
2120
+ declare enum PAYLOAD_FORMAT {
2121
+ ENCRYPTED_STRING = "encrypted_string"
2122
+ }
2123
+
2124
+ declare enum SERVICE_GROUP {
2125
+ CLICK_TO_PAY = "click_to_pay",
2126
+ WALLET = "wallet"
2127
+ }
2128
+
2129
+ type WalletType = WALLET_TYPES;
2130
+ declare enum WALLET_TYPES {
2131
+ APPLE_PAY = "apple",
2132
+ GOOGLE_PAY = "google"
2133
+ }
2134
+
2135
+ interface CreateOTTResponse {
2136
+ temp_token: string;
2137
+ token_type: string;
2138
+ }
2139
+ interface Billing {
2140
+ address_line1: string;
2141
+ address_line2: string;
2142
+ address_country: string;
2143
+ address_city: string;
2144
+ address_postcode: string;
2145
+ address_state: string;
2146
+ }
2147
+ interface CardInfo {
2148
+ card_scheme: string;
2149
+ card_number_last4?: string;
2150
+ }
2151
+ interface CreateOTTData {
2152
+ amount: number;
2153
+ shipping: Shipping;
2154
+ billing: Billing;
2155
+ card_info: CardInfo;
2156
+ ref_token: string;
2157
+ }
2158
+ interface CreateOTTRequest {
2159
+ service_id: string;
2160
+ service_type: SERVICE_TYPES;
2161
+ service_group: SERVICE_GROUP;
2162
+ payload: string;
2163
+ payload_format: PAYLOAD_FORMAT;
2164
+ }
2165
+ interface CreateSessionRequest {
2166
+ service_id: string;
2167
+ session_id: string;
2168
+ request_shipping?: boolean;
2169
+ store_name?: string;
2170
+ }
2171
+ interface CreateSessionResponse {
2172
+ id: string;
2173
+ status: string;
2174
+ callback_method: string;
2175
+ callback_rel: string;
2176
+ callback_url: string;
2177
+ }
2178
+ type CheckoutResponse = ApplePayJS.ApplePayPaymentAuthorizedEvent | google.payments.api.PaymentAuthorizationResult | google.payments.api.PaymentData;
2179
+ declare enum CheckoutActionCode {
2180
+ COMPLETE = "COMPLETE",
2181
+ CANCEL = "CANCEL",
2182
+ ERROR = "ERROR",
2183
+ CHANGE_CARD = "CHANGE_CARD",
2184
+ ADD_CARD = "ADD_CARD",
2185
+ SWITCH_CONSUMER = "SWITCH_CONSUMER"
2186
+ }
2187
+ interface OTTResponse {
2188
+ token: string;
2189
+ token_type: string;
2190
+ three_ds_required?: boolean;
2191
+ wallet_type: WalletType;
2192
+ }
2193
+ interface Shipping {
2194
+ method?: string;
2195
+ options?: IShippingOption[];
2196
+ address_line1?: string;
2197
+ address_line2?: string;
2198
+ address_city?: string;
2199
+ address_postcode?: string;
2200
+ address_state?: string;
2201
+ address_country?: string;
2202
+ address_company?: string;
2203
+ address_origin_postcode?: string;
2204
+ contact?: {
2205
+ first_name?: string;
2206
+ last_name?: string;
2207
+ email?: string;
2208
+ phone?: string;
2209
+ phone2?: string;
2210
+ };
2211
+ }
2212
+
2213
+ declare class ApiPaymentSourceInternal {
2214
+ protected api: ApiInternal;
2215
+ constructor(api: ApiInternal);
2216
+ createOTT(payload: CreateOTTRequest): Promise<CreateOTTResponse>;
2217
+ createSession(payload: CreateSessionRequest): Promise<CreateSessionResponse>;
2218
+ }
2219
+
2220
+ declare class ApiInternal extends ApiBase {
2221
+ charge(): ApiChargeInternal;
2222
+ service(): ApiServiceInternal;
2223
+ checkout(): ApiCheckoutInternal;
2224
+ gateway(): ApiGatewayInternal;
2225
+ paymentSource(): ApiPaymentSourceInternal;
2226
+ }
2227
+
2228
+ declare class ApiCheckoutInternal {
2229
+ protected api: ApiInternal;
2230
+ constructor(api: ApiInternal);
2231
+ instructions(): Observable<object>;
2232
+ private getInstructionLink;
2233
+ callback(payload: Object): Promise<Object>;
2234
+ status(id: string): Promise<Object>;
2235
+ }
2236
+
2237
+ type Instruction = new (selector: string, api: ApiInternal, checkoutWidget: Checkout, formSelector?: string) => InstructionHandler & InstructionDestroyable & InstructionDecorated;
2238
+ interface InstructionHandleable {
2239
+ handle(payload: object, eventEmitter: EventEmitter): void;
2240
+ }
2241
+ interface InstructionDecorated {
2242
+ instruction: string;
2243
+ }
2244
+ interface InstructionDestroyable {
2245
+ destroy(): void;
2246
+ }
2247
+ declare abstract class InstructionHandler implements InstructionHandleable, InstructionDestroyable, InstructionDecorated {
2248
+ selector: string;
2249
+ api: ApiInternal;
2250
+ protected checkoutWidget?: Checkout;
2251
+ formSelector?: string;
2252
+ constructor(selector: string, api: ApiInternal, checkoutWidget?: Checkout, formSelector?: string);
2253
+ instruction: string;
2254
+ abstract handle(context: object, eventEmitter?: any): void;
2255
+ destroy(): void;
2256
+ getEnv(instruction_token: string): string;
2257
+ }
2258
+
2259
+ declare class InstructionModule {
2260
+ instructions: any[];
2261
+ getInstruction(id: string): Instruction | null;
2262
+ }
2263
+
2264
+ interface IntentTokenPayload {
2265
+ env: string;
2266
+ intent_id: string;
2267
+ version: number;
2268
+ env_alias: string;
2269
+ whitelist_domains: string[];
2270
+ }
2271
+ /**
2272
+ * Class CheckoutButton transform usual button into checkout
2273
+ *
2274
+ * @constructor
2275
+ *
2276
+ * @param {string} selector - Selector of html element.
2277
+ * @param {string} intentToken - PayDock intent token
2278
+ * @example
2279
+ * var widget = new Checkout('#widget', 'intent_token');
2280
+ **/
2281
+ declare class Checkout {
2282
+ protected selector: string;
2283
+ protected intentToken: string;
2284
+ protected debug: boolean;
2285
+ protected window: Window;
2286
+ protected eventEmitter: EventEmitter;
2287
+ protected container: Container;
2288
+ protected intentTokenPayload: IntentTokenPayload;
2289
+ protected api: ApiInternal;
2290
+ protected checkoutApi: ApiCheckoutInternal;
2291
+ protected instructions: InstructionModule;
2292
+ protected currentInstruction: InstructionDestroyable & InstructionHandleable;
2293
+ private checkoutVersionHandler;
2294
+ private timeoutTimer;
2295
+ private requestInFlight;
2296
+ private inTimeoutRange;
2297
+ private checkoutFinished;
2298
+ constructor(selector: string, intentToken: string, debug?: boolean);
2299
+ fetchInstruction(): void;
2300
+ finaliseCheckout(): void;
2301
+ private setupTimeoutTimer;
2302
+ private extractIntentTokenPayload;
2303
+ validateJWTWhitelistedDomains(whitelist_domains: string[]): boolean;
2304
+ private ready;
2305
+ private initContractVersion;
2306
+ private isTimeoutInstruction;
2307
+ private handleInstruction;
2308
+ private handleTimeoutInstructions;
2309
+ private getInstructionFromResponse;
2310
+ private extractInstructionPayloadFromResponse;
2311
+ private setEnv;
2312
+ /**
2313
+ * If the payment was successful, the function passed as parameter will be called.
2314
+ * Important: Do not perform thread blocking operations in callback such as window.alert() calls.
2315
+ *
2316
+ * @example
2317
+ * widget.onPaymentSuccessful((data) => {
2318
+ * console.log('Payment successful!');
2319
+ * });
2320
+ */
2321
+ onPaymentSuccessful(handler: (data: IEventData$1) => void): () => void;
2322
+ /**
2323
+ * If the payment was not successful, the function passed as parameter will be called.
2324
+ * Important: Do not perform thread blocking operations in callback such as window.alert() calls.
2325
+ *
2326
+ * @example
2327
+ * widget.onPaymentError((err) => {
2328
+ * console.log('Payment not successful');
2329
+ * });
2330
+ */
2331
+ onPaymentFailure(handler: (data: IEventData$1) => void): () => void;
2332
+ /**
2333
+ * If the payment was expired, the function passed as parameter will be called.
2334
+ * Important: Do not perform thread blocking operations in callback such as window.alert() calls.
2335
+ *
2336
+ * @example
2337
+ * widget.onPaymentInReview((data) => {
2338
+ * console.log('Payment in fraud review');
2339
+ * });
2340
+ */
2341
+ onPaymentExpired(handler: (data: IEventData$1) => void): () => void;
2342
+ createWidgetStructure(): void;
2343
+ private changeLoadingSpinnerVisibility;
2344
+ }
2345
+
2346
+ declare class InstructionDebugger {
2347
+ constructor(selector: string, version: number, instructionName: string, context: object, token?: string);
2348
+ }
2349
+
2350
+ /**
2351
+ * @type {object}
2352
+ * @param {string} CLICK=click
2353
+ * @param {string} POPUP_REDIRECT=popup_redirect
2354
+ * @param {string} ERROR=error
2355
+ * @param {string} ACCEPTED=accepted
2356
+ * @param {string} FINISH=finish
2357
+ * @param {string} CLOSE=close
2358
+ */
2359
+ declare const CHECKOUT_BUTTON_EVENT: {
2360
+ CLICK: string;
2361
+ POPUP_REDIRECT: string;
2362
+ REDIRECT: string;
2363
+ ERROR: string;
2364
+ REFERRED: string;
2365
+ DECLINED: string;
2366
+ CANCELLED: string;
2367
+ ACCEPTED: string;
2368
+ FINISH: string;
2369
+ CLOSE: string;
2370
+ };
2371
+ /**
2372
+ * @type {object}
2373
+ * @param {string} CONTEXTUAL=contextual
2374
+ * @param {string} REDIRECT=redirect
2375
+ */
2376
+ declare enum CHECKOUT_MODE {
2377
+ CONTEXTUAL = "contextual",
2378
+ REDIRECT = "redirect"
2379
+ }
2380
+ /**
2381
+ * @type {object}
2382
+ * @param {string} ZIPMONEY=Zipmoney
2383
+ * @param {string} PAYPAL=PaypalClassic
2384
+ * @param {string} AFTERPAY=Afterpay
2385
+ */
2386
+ declare enum GATEWAY_TYPE {
2387
+ ZIPMONEY = "Zipmoney",
2388
+ PAYPAL = "PaypalClassic",
2389
+ AFTERPAY = "Afterpay"
2390
+ }
2391
+ interface IEventCheckoutFinishData {
2392
+ payment_source_token: string;
2393
+ checkout_email: string;
2394
+ checkout_holder: string;
2395
+ gateway_type: string;
2396
+ }
2397
+
2398
+ /**
2399
+ * Class Background create overlay for checkout
2400
+ *
1964
2401
  * @example
1965
2402
  * var overlay = new Background();
1966
2403
  */
@@ -2574,40 +3011,359 @@ declare class FraudPreventionService {
2574
3011
  *
2575
3012
  * Make sure to call withForter() before accessing this getter.
2576
3013
  *
2577
- * @returns {ForterDeviceAgent | null} The Forter device agent instance or null if not initialized
3014
+ * @returns {ForterDeviceAgent | null} The Forter device agent instance or null if not initialized
3015
+ *
3016
+ * @example
3017
+ *
3018
+ * ```js
3019
+ * const fps = new FraudPreventionService();
3020
+ *
3021
+ * fps.withForter({
3022
+ * siteId: 'your-site-id',
3023
+ * mode: 'test'
3024
+ * });
3025
+ *
3026
+ * const token = fps.forter?.token;
3027
+ * ```
3028
+ */
3029
+ get forter(): ForterDeviceAgent | null;
3030
+ /**
3031
+ * Gets the credentials for a specific fraud prevention provider.
3032
+ *
3033
+ * Returns different credential types based on the selected provider.
3034
+ *
3035
+ * @param provider - The fraud prevention provider
3036
+ * @param providerId - The ID of the provider instance
3037
+ *
3038
+ * @returns a tuple with shape [providerSpecificCredentials, error]
3039
+ */
3040
+ getProviderCredentials<P extends FraudPreventionProvider>(provider: P, providerId: string): Promise<Result<P extends "forter" ? {
3041
+ provider: "forter";
3042
+ siteId: string;
3043
+ subsiteId: string;
3044
+ } : never, unknown>>;
3045
+ private validateEnvironmentId;
3046
+ private validateEnvironmentAlias;
3047
+ private validateMode;
3048
+ }
3049
+
3050
+ interface BaseEventData$1<T> {
3051
+ event: string;
3052
+ chargeId?: string;
3053
+ data?: T | undefined;
3054
+ }
3055
+
3056
+ declare enum EVENT$1 {
3057
+ ON_UPDATE = "onUpdate",
3058
+ ON_CLICK = "onClick",
3059
+ ON_CHECKOUT_CLOSE = "onCheckoutClose",
3060
+ SUCCESS = "success",
3061
+ UNAVAILABLE = "unavailable",
3062
+ ERROR = "error",
3063
+ UPDATE = "update",
3064
+ LOADED = "loaded",
3065
+ CHECKOUT_CLOSE = "checkoutClose",
3066
+ ON_SHIPPING_ADDRESS_CHANGE = "onShippingAddressChange",
3067
+ ON_SHIPPING_OPTIONS_CHANGE = "onShippingOptionsChange"
3068
+ }
3069
+ type OpenWalletEventType = EVENT$1;
3070
+
3071
+ interface OnClickEventData$1 {
3072
+ request_type: string;
3073
+ wallet_type?: string;
3074
+ meta?: Record<string, unknown>;
3075
+ }
3076
+ interface OnCrateOTTSuccessfulEventData {
3077
+ token: CreateOTTResponse;
3078
+ amount: number;
3079
+ shipping?: Shipping;
3080
+ billing?: Billing;
3081
+ }
3082
+ interface OnCreateOTTErrorEventData extends BaseEventData$1<{
3083
+ message?: string;
3084
+ code?: string;
3085
+ }> {
3086
+ event: EVENT$1.ERROR;
3087
+ }
3088
+ interface OnUnavailableEventData$1 {
3089
+ wallet_type: string;
3090
+ reason: string;
3091
+ details?: Record<string, unknown>;
3092
+ }
3093
+ interface OnErrorEventData$1 {
3094
+ error: Error;
3095
+ context?: {
3096
+ operation?: string;
3097
+ wallet_type?: string;
3098
+ };
3099
+ }
3100
+
3101
+ interface OpenWalletMeta {
3102
+ amount: number;
3103
+ currency: string;
3104
+ country: string;
3105
+ style?: OpenWalletMetaStyles;
3106
+ }
3107
+ interface OpenWalletMetaStyles {
3108
+ button_type?: string;
3109
+ button_style?: string;
3110
+ }
3111
+
3112
+ interface WalletPaymentSource {
3113
+ load(): void;
3114
+ }
3115
+
3116
+ interface BaseEventData<T> {
3117
+ event: string;
3118
+ data?: T | undefined;
3119
+ }
3120
+
3121
+ interface OnShippingAddressChangeEventData$1 extends BaseEventData<AddressChangeEventData$1> {
3122
+ event: EVENT$1.ON_SHIPPING_ADDRESS_CHANGE;
3123
+ }
3124
+ interface AddressChangeEventData$1 {
3125
+ address_postcode?: string;
3126
+ address_city?: string;
3127
+ address_state?: string;
3128
+ address_country?: string;
3129
+ address_line1?: string;
3130
+ address_line2?: string;
3131
+ contact?: {
3132
+ phone?: string;
3133
+ email?: string;
3134
+ first_name?: string;
3135
+ last_name?: string;
3136
+ };
3137
+ }
3138
+
3139
+ interface OnShippingAddressChangeEventResponse$1 {
3140
+ amount?: number;
3141
+ shipping_options?: IApplePayShippingOption$1[];
3142
+ }
3143
+
3144
+ interface OnShippingOptionChangeEventData$1 extends BaseEventData<ShippingOptionChangeEventData$1> {
3145
+ event: EVENT$1.ON_SHIPPING_OPTIONS_CHANGE;
3146
+ }
3147
+ interface ShippingOptionChangeEventData$1 {
3148
+ shipping_option_id?: string;
3149
+ amount?: string;
3150
+ label?: string;
3151
+ detail?: string;
3152
+ }
3153
+
3154
+ interface OnShippingOptionChangeEventResponse$1 {
3155
+ amount?: number;
3156
+ }
3157
+
3158
+ declare class OpenWalletButtons implements WalletPaymentSource {
3159
+ protected container: Container;
3160
+ protected api: ApiInternal;
3161
+ protected env: string;
3162
+ protected serviceId: string;
3163
+ protected meta: OpenWalletMeta;
3164
+ protected eventEmitter: EventEmitter;
3165
+ readonly walletType: WalletType;
3166
+ constructor(selector: string, publicKeyOrAccessToken: string, serviceId: string, meta: OpenWalletMeta, requiredMetaFields: string[]);
3167
+ private getApiAuthType;
3168
+ private validateRequiredMetaFields;
3169
+ private getOpenWalletServiceConfig;
3170
+ private handleOnError;
3171
+ /**
3172
+ * Loads and initializes the wallet button based on the service configuration.
3173
+ * This method fetches the wallet service configuration and creates the appropriate wallet service instance.
3174
+ * Bear in mind that you must call this method after setting up all event handlers.
3175
+ *
3176
+ * @example
3177
+ * button.load();
3178
+ */
3179
+ load(): void;
3180
+ /**
3181
+ * Current method can change environment. By default environment = sandbox.
3182
+ * Also we can change domain alias for this environment. By default domain_alias = paydock.com
3183
+ * Bear in mind that you must set an environment before calling `button.load()`.
3184
+ *
3185
+ * @example
3186
+ * button.setEnv('production', 'paydock.com');
3187
+ * @param {string} env - sandbox, production
3188
+ * @param {string} [alias] - Own domain alias
3189
+ */
3190
+ setEnv(env: string, alias?: string): void;
3191
+ /**
3192
+ * Callback for onClick method.
3193
+ *
3194
+ * @callback OnClickCallback
3195
+ * @param {OnClickEventData} data
3196
+ */
3197
+ /**
3198
+ /**
3199
+ * Registers a callback function to be invoked when the wallet button gets clicked.
3200
+ * There are two operational modes supported, Synchronous and Asynchronous.
3201
+ * 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.
3202
+ * When synchronous operations occur on the callback handler, attaching a boolean result via `attachResult` is optional to control the execution flow.
3203
+ * Note this is supported for Paypal, GooglePay and ApplePay wallet buttons at the moment.
3204
+ *
3205
+ * @example
3206
+ * button.onClick((data) => {
3207
+ * performValidationLogic();
3208
+ * });
3209
+ *
3210
+ * @param {listener} handler - Function to be called when the wallet button is clicked.
3211
+ */
3212
+ onClick(handler: (data: OnClickEventData$1) => void): () => void;
3213
+ /**
3214
+ * Callback for onSuccess method.
3215
+ *
3216
+ * @callback OnSuccessCallback
3217
+ * @param {OnCrateOTTSuccessfulEventData} data
3218
+ * @return {Promise<string>} OTT (One Time Token) string result
3219
+ */
3220
+ /**
3221
+ * If the OTT creation was successful, the function passed as parameter will be called.
3222
+ * Important: Do not perform thread blocking operations in callback such as window.alert() calls.
3223
+ *
3224
+ * @example
3225
+ * button.onSuccess((data) => {
3226
+ * console.log('OTT creation successful!', data);
3227
+ * });
3228
+ *
3229
+ * @example
3230
+ * button.onSuccess().then((data) => console.log('OTT creation successful!', data));
3231
+ *
3232
+ * @param {OnSuccessCallback} [handler] - Function to be called when the OTT creation was successful.
3233
+ */
3234
+ onSuccess(handler?: (data: OnCrateOTTSuccessfulEventData) => void): () => void;
3235
+ /**
3236
+ * Callback for onUnavailable method.
3237
+ *
3238
+ * @callback OnUnavailableCallback
3239
+ * @param {OnUnavailableEventData} data
3240
+ */
3241
+ /**
3242
+ * Registers a callback function to be invoked when the wallet is not available in the current context.
3243
+ * This can happen when the wallet service is not supported on the current device or browser.
3244
+ *
3245
+ * @example
3246
+ * button.onUnavailable((data) => {
3247
+ * console.log('Wallet not available', data);
3248
+ * });
3249
+ *
3250
+ * @example
3251
+ * button.onUnavailable().then((data) => console.log('Wallet not available', data));
3252
+ *
3253
+ * @param {OnUnavailableCallback} [handler] - Function to be called when the wallet is not available in the current context.
3254
+ */
3255
+ onUnavailable(handler?: (data: OnUnavailableEventData$1) => void): Promise<unknown> | (() => void);
3256
+ /**
3257
+ * Callback for onError method.
3258
+ *
3259
+ * @callback OnErrorCallback
3260
+ * @param {OnErrorEventData} data
3261
+ */
3262
+ /**
3263
+ * Registers a callback function to be invoked when an error that is not related to payment execution occurs.
3264
+ * For example, if there are configuration issues or validation errors during wallet initialization.
3265
+ *
3266
+ * @example
3267
+ * button.onError((error) => {
3268
+ * console.log('OpenWallet error', error);
3269
+ * });
3270
+ *
3271
+ * @example
3272
+ * button.onError().then((error) => console.log('OpenWallet error', error));
3273
+ *
3274
+ * @param {OnErrorCallback} [handler] - Function to be called when the OpenWallet has an error.
3275
+ */
3276
+ onError(handler?: (data: OnErrorEventData$1) => void): Promise<unknown> | (() => void);
3277
+ /**
3278
+ * Callback for onCancel method.
3279
+ *
3280
+ * @callback OnCancelCallback
3281
+ * @param {any} data
3282
+ */
3283
+ /**
3284
+ * Registers a callback function to be invoked when the wallet checkout is cancelled or closed by the user.
3285
+ * This event is triggered when the user dismisses the wallet payment interface without completing the transaction.
3286
+ *
3287
+ * @example
3288
+ * button.onCancel((data) => {
3289
+ * console.log('Wallet checkout cancelled', data);
3290
+ * });
2578
3291
  *
2579
3292
  * @example
3293
+ * button.onCancel().then((data) => console.log('Wallet checkout cancelled', data));
2580
3294
  *
2581
- * ```js
2582
- * const fps = new FraudPreventionService();
3295
+ * @param {OnCancelCallback} [handler] - Function to be called when the wallet checkout is cancelled.
3296
+ */
3297
+ onCancel(handler?: (data: any) => void): Promise<unknown> | (() => void);
3298
+ /**
3299
+ * Callback for onShippingAddressChange method.
2583
3300
  *
2584
- * fps.withForter({
2585
- * siteId: 'your-site-id',
2586
- * mode: 'test'
3301
+ * @callback OnShippingAddressChangeCallback
3302
+ * @param {OnShippingAddressChangeEventData} data
3303
+ * @return {Promise<OnShippingAddressChangeEventResponse>} Address update result containing updated amount and/or shipping options
3304
+ */
3305
+ /**
3306
+ * If shipping address data is updated, the function passed as parameter will be called.
3307
+ * Use this method to listen for shipping address selection or input from customer when shipping is enabled.
3308
+ * The event handler should return updated payment information including the new amount and available shipping options based on the selected address.
3309
+ *
3310
+ * @example
3311
+ * button.onShippingAddressChange(async (data) => {
3312
+ * const responseData = await fetch('https://your-server.com/update-shipping-address');
3313
+ * return {
3314
+ * amount: responseData.newAmount,
3315
+ * shipping_options: responseData.availableShippingOptions
3316
+ * };
2587
3317
  * });
2588
3318
  *
2589
- * const token = fps.forter?.token;
2590
- * ```
3319
+ * @param {OnShippingAddressChangeCallback} [handler] - Function to be called when the shipping address data is updated.
2591
3320
  */
2592
- get forter(): ForterDeviceAgent | null;
3321
+ onShippingAddressChange(handler?: (data: OnShippingAddressChangeEventData$1) => Promise<OnShippingAddressChangeEventResponse$1>): () => void;
2593
3322
  /**
2594
- * Gets the credentials for a specific fraud prevention provider.
3323
+ * Callback for onShippingOptionsChange method.
2595
3324
  *
2596
- * Returns different credential types based on the selected provider.
3325
+ * @callback OnShippingOptionsChangeCallback
3326
+ * @param {OnShippingOptionChangeEventData} data
3327
+ * @return {Promise<OnShippingOptionChangeEventResponse>} Shipping options update result containing updated amount
3328
+ */
3329
+ /**
3330
+ * If shipping options data is updated, the function passed as parameter will be called.
3331
+ * Use this method to listen for shipping option selection from customer when shipping is enabled.
3332
+ * The event handler should return the updated payment amount based on the selected shipping option.
2597
3333
  *
2598
- * @param provider - The fraud prevention provider
2599
- * @param providerId - The ID of the provider instance
3334
+ * @example
3335
+ * button.onShippingOptionsChange(async (data) => {
3336
+ * const responseData = await fetch('https://your-server.com/update-shipping-option');
3337
+ * return {
3338
+ * amount: responseData.newTotalAmount
3339
+ * };
3340
+ * });
2600
3341
  *
2601
- * @returns a tuple with shape [providerSpecificCredentials, error]
3342
+ * @param {OnShippingOptionsChangeCallback} [handler] - Function to be called when the shipping options data is updated.
2602
3343
  */
2603
- getProviderCredentials<P extends FraudPreventionProvider>(provider: P, providerId: string): Promise<Result<P extends "forter" ? {
2604
- provider: "forter";
2605
- siteId: string;
2606
- subsiteId: string;
2607
- } : never, unknown>>;
2608
- private validateEnvironmentId;
2609
- private validateEnvironmentAlias;
2610
- private validateMode;
3344
+ onShippingOptionsChange(handler?: (data: OnShippingOptionChangeEventData$1) => Promise<OnShippingOptionChangeEventResponse$1>): () => void;
3345
+ }
3346
+
3347
+ declare const TYPE: {
3348
+ EXTERNAL_CHECKOUT_TOKEN: string;
3349
+ CHECKOUT_TOKEN: string;
3350
+ BANK_ACCOUNT: string;
3351
+ CARD: string;
3352
+ };
3353
+ interface IBody {
3354
+ gateway_id: string;
3355
+ type: string;
3356
+ checkout_token?: string;
3357
+ }
3358
+ declare class Builder extends HttpCore {
3359
+ private body;
3360
+ constructor(gatewayID: string, checkoutToken: string, type: string);
3361
+ constructor(gatewayID: string, externalCheckoutToken: string, type: string);
3362
+ constructor(gatewayID: string, card: any, type: string);
3363
+ constructor(gatewayID: string, bankAccount: any, type: string);
3364
+ protected getLink(): string;
3365
+ send(accessToken: string, cb: (token: string) => void, errorCb?: (error: any) => void): void;
3366
+ getConfigs(): IBody;
2611
3367
  }
2612
3368
 
2613
3369
  /**
@@ -2873,321 +3629,215 @@ declare class HtmlPaymentSourceWidget extends PaymentSourceWidget {
2873
3629
  onSelectInsert(selector: string, dataType: string): void;
2874
3630
  }
2875
3631
 
2876
- declare class ApiChargeInternal {
2877
- protected api: ApiInternal;
2878
- constructor(api: ApiInternal);
2879
- walletCapture(payload: WalletCaptureBody): Promise<WalletCaptureResponse>;
2880
- walletCallback(payload: WalletCallbackBody): Promise<WalletCallbackResponse>;
2881
- standalone3dsProcess(payload: Standalone3dsProcessBody): Promise<ProcessAuthenticationResponse>;
2882
- standalone3dsHandle(): Promise<HandleResponseInterface>;
2883
- }
2884
- interface WalletCaptureResponse {
2885
- id: string;
2886
- amount: number;
2887
- currency: string;
2888
- status: string;
2889
- }
2890
- interface WalletCaptureBody {
2891
- payment_method_id?: string;
2892
- customer?: {
2893
- payment_source?: {
2894
- type?: string;
2895
- card_name?: string;
2896
- card_scheme?: string;
2897
- card_number_last4?: string;
2898
- expire_month?: number;
2899
- expire_year?: number;
2900
- address_line1?: string;
2901
- address_line2?: string;
2902
- address_city?: string;
2903
- address_postcode?: string;
2904
- address_state?: string;
2905
- address_country?: string;
2906
- external_payer_id?: string;
2907
- ref_token?: string;
2908
- wallet_express?: boolean;
2909
- };
2910
- };
2911
- }
2912
- interface WalletCallbackBody {
2913
- request_type: string;
2914
- }
2915
- interface WalletCallbackResponse {
2916
- id: string;
2917
- status: string;
2918
- callback_method: string;
2919
- callback_rel: string;
2920
- callback_url: string;
2921
- }
2922
- interface Standalone3dsProcessBody {
2923
- charge_3ds_id: string;
2924
- }
2925
- interface HandleResponseInterface {
2926
- status: string;
2927
- error: string;
2928
- result: {
2929
- reference: string;
2930
- reference_2: string;
2931
- identifier: string;
2932
- identifier_2: string;
2933
- identifier_3: string;
2934
- identifier_4: string;
2935
- identifier_5: string;
2936
- type: string;
2937
- status: string;
2938
- status_2: string;
2939
- status_code: string;
2940
- ref_token: string;
2941
- cancellation: string;
2942
- count: string;
2943
- version: string;
2944
- whitelist: {
2945
- status: string;
2946
- source: string;
2947
- };
2948
- result: string;
2949
- };
2950
- }
2951
- interface ProcessAuthenticationResponse {
2952
- status: string;
2953
- error?: string;
2954
- result?: {
2955
- challenge: string;
2956
- challenge_url: string;
2957
- decoupled_challenge: boolean;
2958
- frictionless: boolean;
2959
- identifier: string;
2960
- identifier_3: string;
2961
- identifier_4: string;
2962
- reference: string;
2963
- reference_2: string;
2964
- secondary_url: string;
2965
- skipped: boolean;
2966
- status: string;
2967
- type: string;
2968
- version: string;
2969
- description?: string;
2970
- };
2971
- }
2972
-
2973
- declare class ApiCheckoutInternal {
2974
- protected api: ApiInternal;
2975
- constructor(api: ApiInternal);
2976
- instructions(): Observable<object>;
2977
- private getInstructionLink;
2978
- callback(payload: Object): Promise<Object>;
2979
- status(id: string): Promise<Object>;
2980
- }
2981
-
2982
- declare class ApiGatewayInternal {
2983
- protected api: ApiInternal;
2984
- constructor(api: ApiInternal);
2985
- getWalletConfig(gateway_id: string): Promise<GetWalletConfigResponse>;
2986
- }
2987
- interface GetWalletConfigResponse {
2988
- type: string;
2989
- mode: string;
2990
- credentials?: object;
2991
- }
2992
-
2993
- interface CreateOTTResponse {
2994
- status: number;
2995
- error: string | null;
2996
- resource: {
2997
- type: string;
2998
- data: {
2999
- token: string;
3000
- '3ds_required': boolean;
3001
- };
3002
- };
3003
- }
3004
- interface CreateOTTRequest {
3005
- checkoutData: CheckoutResponse;
3006
- }
3007
- type CheckoutResponse = ApplePayJS.ApplePayPaymentAuthorizedEvent | google.payments.api.PaymentAuthorizationResult;
3008
- declare enum CheckoutActionCode {
3009
- COMPLETE = "COMPLETE",
3010
- CANCEL = "CANCEL",
3011
- ERROR = "ERROR",
3012
- CHANGE_CARD = "CHANGE_CARD",
3013
- ADD_CARD = "ADD_CARD",
3014
- SWITCH_CONSUMER = "SWITCH_CONSUMER"
3015
- }
3016
-
3017
- declare class ApiPaymentSourceInternal {
3018
- protected api: ApiInternal;
3019
- constructor(api: ApiInternal);
3020
- createOTT(payload: CreateOTTRequest): Promise<CreateOTTResponse>;
3021
- }
3022
-
3023
- declare class ApiServiceInternal {
3024
- protected api: ApiInternal;
3025
- constructor(api: ApiInternal);
3026
- getConfig(service_id: string): Promise<GetConfigResponse>;
3027
- }
3028
- interface GetConfigResponse {
3029
- type: string;
3030
- merchant: string;
3031
- username: string;
3032
- password: string;
3033
- certificate: string;
3034
- certificate_passphrase: string;
3035
- }
3036
-
3037
- declare class ApiInternal extends ApiBase {
3038
- charge(): ApiChargeInternal;
3039
- service(): ApiServiceInternal;
3040
- checkout(): ApiCheckoutInternal;
3041
- gateway(): ApiGatewayInternal;
3042
- paymentSource(): ApiPaymentSourceInternal;
3043
- }
3044
-
3045
- type WalletType = WALLET_TYPES;
3046
- declare enum WALLET_TYPES {
3047
- APPLE_PAY = "ApplePay",
3048
- GOOGLE_PAY = "GooglePay"
3049
- }
3050
-
3051
- interface OTTResponse {
3052
- token: string;
3053
- token_type: string;
3054
- three_ds_required?: boolean;
3055
- wallet_type: WalletType;
3632
+ declare enum ErrorCodes$1 {
3633
+ PROMISE_NOT_ENABLED = "promise_not_enabled",
3634
+ SCRIPT_ERROR = "script_error"
3056
3635
  }
3057
-
3058
- interface BaseServiceConfig<T = Record<string, unknown>> {
3059
- type: string;
3060
- credentials?: T;
3061
- meta?: Record<string, unknown>;
3636
+ interface PayPalDataCollectorConfig {
3637
+ mouse_movement?: boolean;
3062
3638
  }
3063
- interface ApplePayServiceConfig {
3064
- apple: {
3065
- merchant: {
3066
- merchant_id: string;
3067
- domain_name: string;
3068
- display_name: string;
3069
- };
3070
- certificate: {
3071
- certificate_id: string;
3072
- private_key: string;
3073
- };
3074
- };
3639
+ interface IPayPalDataCollector {
3640
+ collectDeviceData(): Promise<CollectedDeviceData>;
3641
+ setEnv(env: string): void;
3075
3642
  }
3076
- interface GooglePayServiceConfig {
3077
- google_pay: {
3078
- merchant: {
3079
- merchant_id: string;
3080
- merchant_name: string;
3081
- };
3082
- gateway_merchant_id: string;
3083
- allowed_auth_methods: string[];
3084
- allowed_card_networks: string[];
3085
- };
3643
+ interface CollectedDeviceData {
3644
+ correlation_id: string;
3086
3645
  }
3087
-
3088
- interface BaseWalletMeta$1 {
3089
- amount: number;
3090
- currency: string;
3646
+ interface IOnErrorEventData$1 {
3647
+ error_code: ErrorCodes$1;
3091
3648
  }
3092
3649
 
3093
- interface BaseEventData<T> {
3094
- event: string;
3095
- chargeId?: string;
3096
- data?: T | undefined;
3650
+ /**
3651
+ * PayPal Data Collector Widget constructor
3652
+ *
3653
+ * @param {string} [flowId] - This string identifies the source website of the FraudNet request.
3654
+ * @param {PayPalDataCollectorConfig} [config] - Extra configuration for the widget.
3655
+ *
3656
+ * @example
3657
+ * var payPalDataCollector = new PayPalDataCollector('FLOW_ID', {});
3658
+ */
3659
+ declare class PayPalDataCollector {
3660
+ protected service: IPayPalDataCollector;
3661
+ protected eventEmitter: EventEmitter;
3662
+ /** @constructs */ constructor(flowId?: string, config?: PayPalDataCollectorConfig);
3663
+ /**
3664
+ * After configuring the PayPalDataCollector Widget, starts the process and returns
3665
+ * the correlation id used among the requests asynchronously.
3666
+ *
3667
+ * @returns {Promise<CollectedDeviceData>} Promise when resolved, returns an object
3668
+ * that contains the `correlation_id` key.
3669
+ *
3670
+ * @example
3671
+ * const collectedDeviceData = await payPalDataCollectorWidget.collectDeviceData();
3672
+ * console.log(collectedDeviceData.correlation_id)
3673
+ */
3674
+ collectDeviceData(): Promise<CollectedDeviceData>;
3675
+ /**
3676
+ * Callback for onError method.
3677
+ *
3678
+ * @callback OnErrorCallback
3679
+ * @param {IOnErrorEventData|null} data
3680
+ */
3681
+ /**
3682
+ * If the process fails, the function passed as parameter will be called.
3683
+ * Important: Do not perform thread blocking operations in callback such as window.alert() calls.
3684
+ *
3685
+ * @example
3686
+ * PayPalDataCollector.onError((eventData) => console.log('Some error occur'));
3687
+ *
3688
+ * @param {OnErrorCallback} [callback] - Function to be called when there is an error in the flow.
3689
+ */
3690
+ onError(callback?: (data?: IOnErrorEventData$1) => void): () => void;
3691
+ /**
3692
+ * Current method can change environment. By default environment = test.
3693
+ * This method does not affect Paydock's API calls or environments, is only for PayPal Data Collector
3694
+ * script, in order to know if the script is injected on a live server or is a testing
3695
+ * environment. The available values are `test` and `live`. This should match with the used
3696
+ * `gateway.mode` in Paydock to process the transaction.
3697
+ *
3698
+ * @example
3699
+ * PayPalDataCollector.setEnv('live');
3700
+ * @param {string} env - test, live
3701
+ */
3702
+ setEnv(env: string): void;
3097
3703
  }
3098
3704
 
3099
- declare enum EVENT$1 {
3100
- ON_CLICK = "onClick",
3101
- SUCCESS = "success",
3102
- UNAVAILABLE = "unavailable",
3103
- ERROR = "error"
3705
+ interface PayPalStyleConfig {
3706
+ layout?: 'vertical' | 'horizontal';
3707
+ color?: 'blue' | 'gold' | 'silver' | 'black' | 'white';
3708
+ shape?: 'rect' | 'sharp' | 'pill';
3709
+ label?: 'paypal' | 'checkout' | 'buynow' | 'pay';
3710
+ disableMaxWidth?: boolean;
3711
+ disableMaxHeight?: boolean;
3712
+ height?: number;
3713
+ borderRadius?: number;
3714
+ tagline?: boolean;
3104
3715
  }
3105
- type OpenWalletEventType = EVENT$1;
3106
-
3107
- interface OnClickEventData$1 {
3108
- request_type: string;
3109
- wallet_type?: string;
3110
- meta?: Record<string, unknown>;
3716
+ interface PayPalMessageConfig {
3717
+ amount?: number;
3718
+ align?: 'center' | 'left' | 'right';
3719
+ color?: 'black' | 'white';
3720
+ position?: 'top' | 'bottom';
3111
3721
  }
3112
- interface OnCrateOTTSuccessfulEventData {
3113
- token: string;
3114
- token_type: string;
3115
- checkoutData?: CheckoutResponse | unknown;
3116
- three_ds_required?: boolean;
3117
- wallet_type: string;
3722
+ interface PayPalSavePaymentSourceWidgetConfig {
3723
+ style?: PayPalStyleConfig;
3724
+ message?: PayPalMessageConfig;
3118
3725
  }
3119
- interface OnCreateOTTErrorEventData extends BaseEventData<{
3120
- message?: string;
3121
- code?: string;
3122
- }> {
3123
- event: EVENT$1.ERROR;
3726
+ interface IPayPalSavePaymentSourceWidget {
3727
+ load(container: Container): void;
3728
+ setEnv(env: string, alias?: string): void;
3124
3729
  }
3125
- interface OnUnavailableEventData$1 {
3126
- wallet_type: string;
3127
- reason: string;
3128
- details?: Record<string, unknown>;
3730
+ declare enum ErrorCodes {
3731
+ UNAVAILABLE = "unavailable",
3732
+ ON_PAYPAL_VAULT_SETUP_TOKEN_ERROR = "onPaypalVaultSetupTokenError",
3733
+ ON_GET_ID_TOKEN_ERROR = "onGetIdTokenError",
3734
+ ON_GET_WALLET_CONFIG_ERROR = "onGetWalletConfigError",
3735
+ ON_GET_SETUP_TOKEN_ERROR = "onGetSetupTokenError",
3736
+ ON_ONE_TIME_TOKEN_ERROR = "onOneTimeTokenError"
3129
3737
  }
3130
- interface OnErrorEventData$1 {
3131
- error: Error;
3132
- context?: {
3133
- operation?: string;
3134
- wallet_type?: string;
3738
+ declare enum EVENTS {
3739
+ ON_SUCCESS = "ON_SUCCESS",
3740
+ ON_ERROR = "ON_ERROR",
3741
+ ON_CANCEL = "ON_CANCEL"
3742
+ }
3743
+ interface IOnSuccessEventData {
3744
+ event: EVENTS.ON_SUCCESS;
3745
+ data: {
3746
+ token: string;
3747
+ email: string;
3135
3748
  };
3136
3749
  }
3137
-
3138
- interface WalletPaymentSource {
3139
- load(): void;
3140
- setMeta(meta: object): void;
3750
+ interface IOnErrorEventData {
3751
+ event: EVENTS.ON_ERROR;
3752
+ data: {
3753
+ error_code: ErrorCodes;
3754
+ details?: string;
3755
+ message?: string;
3756
+ };
3757
+ }
3758
+ interface IOnCancelEventData {
3759
+ event: EVENTS.ON_CANCEL;
3141
3760
  }
3142
3761
 
3143
- declare abstract class BaseOpenWallet<T extends BaseWalletMeta$1> implements WalletPaymentSource {
3762
+ /**
3763
+ * PayPal Save Payment Source Widget constructor
3764
+ *
3765
+ * @param {string} selector - Selector of html element. Container for PayPal Save Payment Source Widget.
3766
+ * @param {string} publicKey - PayDock users public key.
3767
+ * @param {string} gatewayId - PayDock's PayPal gatewayId.
3768
+ * @param {PayPalSavePaymentSourceWidgetConfig} config - Extra configuration for the widget, like styles.
3769
+ *
3770
+ * @example
3771
+ * var payPalSavePaymentSourceWidget = new PayPalSavePaymentSourceWidget('#paypalButton', 'public_key', 'gateway_id');
3772
+ */
3773
+ declare class PayPalSavePaymentSourceWidget {
3144
3774
  protected container: Container;
3145
- protected api: ApiInternal;
3146
- protected env: string;
3147
- protected serviceId: string;
3148
- protected meta: T;
3775
+ protected service: IPayPalSavePaymentSourceWidget;
3149
3776
  protected eventEmitter: EventEmitter;
3150
- abstract readonly walletType: WalletType;
3151
- constructor(selector: string, publicKeyOrAccessToken: string, serviceId: string, meta: T, requiredMetaFields: string[]);
3152
- private getApiAuthType;
3777
+ /** @constructs */ constructor(selector: string, publicKey: string, gatewayId: string, config?: PayPalSavePaymentSourceWidgetConfig);
3778
+ /**
3779
+ * The final method after configuring the PayPalSavePaymentSource Widget to
3780
+ * start the load process.
3781
+ */
3782
+ load(): void;
3783
+ /**
3784
+ * Current method can change environment. By default environment = sandbox.
3785
+ * Also we can change domain alias for this environment. By default domain_alias = paydock.com
3786
+ *
3787
+ * @example
3788
+ * payPalSavePaymentSourceWidget.setEnv('production');
3789
+ * @param {string} env - sandbox, production
3790
+ * @param {string} [alias] - Own domain alias
3791
+ */
3153
3792
  setEnv(env: string, alias?: string): void;
3154
- private validateRequiredMetaFields;
3155
- abstract load(): void;
3156
- abstract setMeta(meta: object): void;
3157
- onClick(handler: (data: OnClickEventData$1) => Promise<string>): () => void;
3158
- onSuccess(handler?: (data: OnCrateOTTSuccessfulEventData) => void): Promise<unknown> | (() => void);
3159
- onUnavailable(handler?: (data: OnUnavailableEventData$1) => void): Promise<unknown> | (() => void);
3160
- onError(handler?: (data: OnErrorEventData$1) => void): Promise<unknown> | (() => void);
3161
- protected getServiceWalletConfig<K>(): Promise<BaseServiceConfig<K>>;
3162
- protected executeOpenWalletCallback<K, U extends {
3163
- request_type: string;
3164
- }>(data: U): Promise<K>;
3165
- protected createOTT(data: CreateOTTRequest): Promise<CreateOTTResponse>;
3166
- protected handleOnError(error: Error): void;
3167
- protected handleOnUnavailable(reason?: string): void;
3168
- destroy(): void;
3169
- }
3170
-
3171
- declare const TYPE: {
3172
- EXTERNAL_CHECKOUT_TOKEN: string;
3173
- CHECKOUT_TOKEN: string;
3174
- BANK_ACCOUNT: string;
3175
- CARD: string;
3176
- };
3177
- interface IBody {
3178
- gateway_id: string;
3179
- type: string;
3180
- checkout_token?: string;
3181
- }
3182
- declare class Builder extends HttpCore {
3183
- private body;
3184
- constructor(gatewayID: string, checkoutToken: string, type: string);
3185
- constructor(gatewayID: string, externalCheckoutToken: string, type: string);
3186
- constructor(gatewayID: string, card: any, type: string);
3187
- constructor(gatewayID: string, bankAccount: any, type: string);
3188
- protected getLink(): string;
3189
- send(accessToken: string, cb: (token: string) => void, errorCb?: (error: any) => void): void;
3190
- getConfigs(): IBody;
3793
+ /**
3794
+ * Callback for onSuccess method.
3795
+ *
3796
+ * @callback OnSuccessCallback
3797
+ * @param {IOnSuccessEventData} data
3798
+ */
3799
+ /**
3800
+ * If the setup token was successfully approved and a OTT was generated, the function passed as parameter will be called.
3801
+ * Important: Do not perform thread blocking operations in callback such as window.alert() calls.
3802
+ *
3803
+ * @example
3804
+ * payPalSavePaymentSourceWidget.onSuccess((eventData) => console.log('One time token and email obtained successfully'));
3805
+ *
3806
+ * @param {OnSuccessCallback} [callback] - Function to be called when the result is successful.
3807
+ */
3808
+ onSuccess(callback?: (data: IOnSuccessEventData) => void): () => void;
3809
+ /**
3810
+ * Callback for onError method.
3811
+ *
3812
+ * @callback OnErrorCallback
3813
+ * @param {IOnErrorEventData} data
3814
+ */
3815
+ /**
3816
+ * If in the process for obtaining the setup token fails, the function passed as parameter will be called.
3817
+ * Important: Do not perform thread blocking operations in callback such as window.alert() calls.
3818
+ *
3819
+ * @example
3820
+ * payPalSavePaymentSourceWidget.onError((eventData) => console.log('Some error occurred'));
3821
+ *
3822
+ * @param {OnErrorCallback} [callback] - Function to be called when there is an error in the flow.
3823
+ */
3824
+ onError(callback?: (data: IOnErrorEventData) => void): () => void;
3825
+ /**
3826
+ * Callback for onCancel method.
3827
+ *
3828
+ * @callback OnCancelCallback
3829
+ * @param {IOnCancelEventData} data
3830
+ */
3831
+ /**
3832
+ * If in the process for obtaining the setup token was cancelled, the function passed as parameter will be called.
3833
+ * Important: Do not perform thread blocking operations in callback such as window.alert() calls.
3834
+ *
3835
+ * @example
3836
+ * payPalSavePaymentSourceWidget.onCancel(() => console.log('Operation cancelled'));
3837
+ *
3838
+ * @param {OnCancelCallback} [callback] - Function to be called when the operation is cancelled.
3839
+ */
3840
+ onCancel(callback?: (data?: IOnCancelEventData) => void): () => void;
3191
3841
  }
3192
3842
 
3193
3843
  interface IBaseSRCMeta {
@@ -3300,19 +3950,19 @@ declare abstract class SRC {
3300
3950
  protected style: IStyles;
3301
3951
  constructor(iframe_selector: string, service_id: string, public_key_or_access_token: string, meta: IClickToPayMeta);
3302
3952
  /**
3303
- * Object contain styles for widget - call before `.load()`.
3304
- *
3305
- * @example
3306
- * widget.setStyles({
3307
- * enable_src_popup: true
3308
- * primary_button_color: 'red',
3309
- * secondary_button_color: 'blue',
3310
- * primary_button_text_color: 'white',
3311
- * secondary_button_text_color: 'white',
3312
- * font_family: 'Arial',
3313
- * });
3314
- * @param {IStyles} fields - name of styles which can be shown in widget [STYLE]{@link STYLE}
3315
- */
3953
+ * Object contain styles for widget - call before `.load()`.
3954
+ *
3955
+ * @example
3956
+ * widget.setStyles({
3957
+ * enable_src_popup: true
3958
+ * primary_button_color: 'red',
3959
+ * secondary_button_color: 'blue',
3960
+ * primary_button_text_color: 'white',
3961
+ * secondary_button_text_color: 'white',
3962
+ * font_family: 'Arial',
3963
+ * });
3964
+ * @param {IStyles} fields - name of styles which can be shown in widget [STYLE]{@link STYLE}
3965
+ */
3316
3966
  setStyles(styles: IStyles): void;
3317
3967
  private setStyle;
3318
3968
  load(): void;
@@ -3900,210 +4550,17 @@ declare class WalletButtons {
3900
4550
  private setupAuthTokensChangedCallback;
3901
4551
  }
3902
4552
 
3903
- type Instruction = new (selector: string, api: ApiInternal, checkoutWidget: Checkout, formSelector?: string) => InstructionHandler & InstructionDestroyable & InstructionDecorated;
3904
- interface InstructionHandleable {
3905
- handle(payload: object, eventEmitter: EventEmitter): void;
3906
- }
3907
- interface InstructionDecorated {
3908
- instruction: string;
3909
- }
3910
- interface InstructionDestroyable {
3911
- destroy(): void;
3912
- }
3913
- declare abstract class InstructionHandler implements InstructionHandleable, InstructionDestroyable, InstructionDecorated {
3914
- selector: string;
3915
- api: ApiInternal;
3916
- protected checkoutWidget?: Checkout;
3917
- formSelector?: string;
3918
- constructor(selector: string, api: ApiInternal, checkoutWidget?: Checkout, formSelector?: string);
3919
- instruction: string;
3920
- abstract handle(context: object, eventEmitter?: any): void;
3921
- destroy(): void;
3922
- getEnv(instruction_token: string): string;
3923
- }
3924
-
3925
- declare class InstructionModule {
3926
- instructions: any[];
3927
- getInstruction(id: string): Instruction | null;
3928
- }
3929
-
3930
- interface IntentTokenPayload {
3931
- env: string;
3932
- intent_id: string;
3933
- version: number;
3934
- env_alias: string;
3935
- whitelist_domains: string[];
3936
- }
3937
- /**
3938
- * Class CheckoutButton transform usual button into checkout
3939
- *
3940
- * @constructor
3941
- *
3942
- * @param {string} selector - Selector of html element.
3943
- * @param {string} intentToken - PayDock intent token
3944
- * @example
3945
- * var widget = new Checkout('#widget', 'intent_token');
3946
- **/
3947
- declare class Checkout {
3948
- protected selector: string;
3949
- protected intentToken: string;
3950
- protected debug: boolean;
3951
- protected window: Window;
3952
- protected eventEmitter: EventEmitter;
3953
- protected container: Container;
3954
- protected intentTokenPayload: IntentTokenPayload;
3955
- protected api: ApiInternal;
3956
- protected checkoutApi: ApiCheckoutInternal;
3957
- protected instructions: InstructionModule;
3958
- protected currentInstruction: InstructionDestroyable & InstructionHandleable;
3959
- private checkoutVersionHandler;
3960
- private timeoutTimer;
3961
- private requestInFlight;
3962
- private inTimeoutRange;
3963
- private checkoutFinished;
3964
- constructor(selector: string, intentToken: string, debug?: boolean);
3965
- fetchInstruction(): void;
3966
- finaliseCheckout(): void;
3967
- private setupTimeoutTimer;
3968
- private extractIntentTokenPayload;
3969
- validateJWTWhitelistedDomains(whitelist_domains: string[]): boolean;
3970
- private ready;
3971
- private initContractVersion;
3972
- private isTimeoutInstruction;
3973
- private handleInstruction;
3974
- private handleTimeoutInstructions;
3975
- private getInstructionFromResponse;
3976
- private extractInstructionPayloadFromResponse;
3977
- private setEnv;
3978
- /**
3979
- * If the payment was successful, the function passed as parameter will be called.
3980
- * Important: Do not perform thread blocking operations in callback such as window.alert() calls.
3981
- *
3982
- * @example
3983
- * widget.onPaymentSuccessful((data) => {
3984
- * console.log('Payment successful!');
3985
- * });
3986
- */
3987
- onPaymentSuccessful(handler: (data: IEventData$1) => void): () => void;
3988
- /**
3989
- * If the payment was not successful, the function passed as parameter will be called.
3990
- * Important: Do not perform thread blocking operations in callback such as window.alert() calls.
3991
- *
3992
- * @example
3993
- * widget.onPaymentError((err) => {
3994
- * console.log('Payment not successful');
3995
- * });
3996
- */
3997
- onPaymentFailure(handler: (data: IEventData$1) => void): () => void;
3998
- /**
3999
- * If the payment was expired, the function passed as parameter will be called.
4000
- * Important: Do not perform thread blocking operations in callback such as window.alert() calls.
4001
- *
4002
- * @example
4003
- * widget.onPaymentInReview((data) => {
4004
- * console.log('Payment in fraud review');
4005
- * });
4006
- */
4007
- onPaymentExpired(handler: (data: IEventData$1) => void): () => void;
4008
- createWidgetStructure(): void;
4009
- private changeLoadingSpinnerVisibility;
4010
- }
4011
-
4012
- declare class InstructionDebugger {
4013
- constructor(selector: string, version: number, instructionName: string, context: object, token?: string);
4014
- }
4015
-
4016
- declare enum EVENT {
4017
- UNAVAILABLE = "unavailable",
4018
- ERROR = "error",
4019
- PAYMENT_SUCCESSFUL = "paymentSuccessful",
4020
- PAYMENT_ERROR = "paymentError",
4021
- PAYMENT_IN_REVIEW = "paymentInReview",
4022
- ON_CLICK = "onClick",
4023
- ON_CHECKOUT_CLOSE = "onCheckoutClose",
4024
- ON_SHIPPING_ADDRESS_CHANGE = "onShippingAddressChange",
4025
- ON_SHIPPING_OPTIONS_CHANGE = "onShippingOptionsChange"
4026
- }
4027
-
4028
- interface OnClickEventData extends BaseEventData<undefined> {
4029
- event: EVENT.ON_CLICK;
4030
- }
4031
-
4032
- interface OnPaymentSuccessfulEventData extends BaseEventData<{
4033
- id: string;
4034
- amount: number;
4035
- currency: string;
4036
- status: string;
4037
- }> {
4038
- event: EVENT.PAYMENT_SUCCESSFUL;
4039
- }
4040
-
4041
- interface OnCloseEventData extends BaseEventData<undefined> {
4042
- event: EVENT.ON_CHECKOUT_CLOSE;
4043
- }
4044
-
4045
- interface OnPaymentInReviewEventData extends Omit<OnPaymentSuccessfulEventData, 'event'> {
4046
- event: EVENT.PAYMENT_IN_REVIEW;
4047
- }
4048
-
4049
- interface OnPaymentErrorEventData extends BaseEventData<{
4050
- message?: string;
4051
- code?: string;
4052
- }> {
4053
- event: EVENT.PAYMENT_ERROR;
4054
- }
4055
-
4056
- interface Contact {
4057
- first_name?: string;
4058
- last_name?: string;
4059
- email?: string;
4060
- phone?: string;
4061
- phone2?: string;
4062
- }
4063
- interface WalletCaptureRequest {
4064
- payment_method_id?: string;
4065
- customer: {
4066
- email?: string;
4067
- phone?: string;
4068
- first_name?: string;
4069
- last_name?: string;
4070
- payment_source?: {
4071
- wallet_type?: string;
4072
- address_line1?: string;
4073
- address_line2?: string;
4074
- address_country?: string;
4075
- address_city?: string;
4076
- address_postcode?: string;
4077
- address_state?: string;
4078
- ref_token?: string;
4079
- external_payer_id?: string;
4080
- wallet_express?: boolean;
4081
- };
4082
- };
4083
- shipping?: {
4084
- address_line1?: string;
4085
- address_line2?: string;
4086
- address_line3?: string;
4087
- address_country?: string;
4088
- address_city?: string;
4089
- address_postcode?: string;
4090
- address_state?: string;
4091
- options?: IShippingOption[];
4092
- method?: string;
4093
- contact?: Contact;
4094
- };
4095
- }
4096
-
4097
- interface OnUnavailableEventData extends BaseEventData<undefined> {
4098
- event: EVENT.UNAVAILABLE;
4099
- }
4100
-
4101
4553
  interface BaseGatewayConfig<T> {
4102
4554
  type: string;
4103
4555
  mode: string;
4104
4556
  credentials?: T;
4105
4557
  }
4106
4558
 
4559
+ interface BaseWalletMeta {
4560
+ amount: number;
4561
+ currency: string;
4562
+ }
4563
+
4107
4564
  interface ChargeWalletTokenMeta {
4108
4565
  charge: {
4109
4566
  id: string;
@@ -4149,16 +4606,51 @@ interface ChargeWalletTokenMeta {
4149
4606
  };
4150
4607
  }
4151
4608
 
4152
- interface BaseWalletMeta {
4609
+ declare enum EVENT {
4610
+ UNAVAILABLE = "unavailable",
4611
+ ERROR = "error",
4612
+ PAYMENT_SUCCESSFUL = "paymentSuccessful",
4613
+ PAYMENT_ERROR = "paymentError",
4614
+ PAYMENT_IN_REVIEW = "paymentInReview",
4615
+ ON_CLICK = "onClick",
4616
+ ON_CHECKOUT_CLOSE = "onCheckoutClose",
4617
+ ON_SHIPPING_ADDRESS_CHANGE = "onShippingAddressChange",
4618
+ ON_SHIPPING_OPTIONS_CHANGE = "onShippingOptionsChange"
4619
+ }
4620
+
4621
+ interface OnClickEventData extends BaseEventData$1<undefined> {
4622
+ event: EVENT.ON_CLICK;
4623
+ }
4624
+
4625
+ interface OnCloseEventData extends BaseEventData$1<undefined> {
4626
+ event: EVENT.ON_CHECKOUT_CLOSE;
4627
+ }
4628
+
4629
+ interface OnErrorEventData extends BaseEventData$1<Error> {
4630
+ event: EVENT.ERROR;
4631
+ }
4632
+
4633
+ interface OnPaymentErrorEventData extends BaseEventData$1<{
4634
+ message?: string;
4635
+ code?: string;
4636
+ }> {
4637
+ event: EVENT.PAYMENT_ERROR;
4638
+ }
4639
+
4640
+ interface OnPaymentSuccessfulEventData extends BaseEventData$1<{
4641
+ id: string;
4153
4642
  amount: number;
4154
4643
  currency: string;
4644
+ status: string;
4645
+ }> {
4646
+ event: EVENT.PAYMENT_SUCCESSFUL;
4155
4647
  }
4156
4648
 
4157
- interface OnErrorEventData extends BaseEventData<Error> {
4158
- event: EVENT.ERROR;
4649
+ interface OnPaymentInReviewEventData extends Omit<OnPaymentSuccessfulEventData, 'event'> {
4650
+ event: EVENT.PAYMENT_IN_REVIEW;
4159
4651
  }
4160
4652
 
4161
- interface OnShippingAddressChangeEventData extends BaseEventData<AddressChangeEventData> {
4653
+ interface OnShippingAddressChangeEventData extends BaseEventData$1<AddressChangeEventData> {
4162
4654
  event: EVENT.ON_SHIPPING_ADDRESS_CHANGE;
4163
4655
  }
4164
4656
  interface AddressChangeEventData {
@@ -4176,16 +4668,6 @@ interface AddressChangeEventData {
4176
4668
  };
4177
4669
  }
4178
4670
 
4179
- interface OnShippingOptionChangeEventData extends BaseEventData<ShippingOptionChangeEventData> {
4180
- event: EVENT.ON_SHIPPING_OPTIONS_CHANGE;
4181
- }
4182
- interface ShippingOptionChangeEventData {
4183
- shipping_option_id?: string;
4184
- amount?: string;
4185
- label?: string;
4186
- detail?: string;
4187
- }
4188
-
4189
4671
  interface OnShippingAddressChangeEventResponse {
4190
4672
  token?: string;
4191
4673
  error?: {
@@ -4195,6 +4677,16 @@ interface OnShippingAddressChangeEventResponse {
4195
4677
  };
4196
4678
  }
4197
4679
 
4680
+ interface OnShippingOptionChangeEventData extends BaseEventData$1<ShippingOptionChangeEventData> {
4681
+ event: EVENT.ON_SHIPPING_OPTIONS_CHANGE;
4682
+ }
4683
+ interface ShippingOptionChangeEventData {
4684
+ shipping_option_id?: string;
4685
+ amount?: string;
4686
+ label?: string;
4687
+ detail?: string;
4688
+ }
4689
+
4198
4690
  interface OnShippingOptionChangeEventResponse {
4199
4691
  token?: string;
4200
4692
  label?: string;
@@ -4204,6 +4696,51 @@ interface OnShippingOptionChangeEventResponse {
4204
4696
  };
4205
4697
  }
4206
4698
 
4699
+ interface OnUnavailableEventData extends BaseEventData$1<undefined> {
4700
+ event: EVENT.UNAVAILABLE;
4701
+ }
4702
+
4703
+ interface Contact {
4704
+ first_name?: string;
4705
+ last_name?: string;
4706
+ email?: string;
4707
+ phone?: string;
4708
+ phone2?: string;
4709
+ }
4710
+ interface WalletCaptureRequest {
4711
+ payment_method_id?: string;
4712
+ customer: {
4713
+ email?: string;
4714
+ phone?: string;
4715
+ first_name?: string;
4716
+ last_name?: string;
4717
+ payment_source?: {
4718
+ wallet_type?: string;
4719
+ address_line1?: string;
4720
+ address_line2?: string;
4721
+ address_country?: string;
4722
+ address_city?: string;
4723
+ address_postcode?: string;
4724
+ address_state?: string;
4725
+ ref_token?: string;
4726
+ external_payer_id?: string;
4727
+ wallet_express?: boolean;
4728
+ };
4729
+ };
4730
+ shipping?: {
4731
+ address_line1?: string;
4732
+ address_line2?: string;
4733
+ address_line3?: string;
4734
+ address_country?: string;
4735
+ address_city?: string;
4736
+ address_postcode?: string;
4737
+ address_state?: string;
4738
+ options?: IShippingOption[];
4739
+ method?: string;
4740
+ contact?: Contact;
4741
+ };
4742
+ }
4743
+
4207
4744
  type ShippingEventToResponse<T> = T extends OnShippingAddressChangeEventData ? OnShippingAddressChangeEventResponse : T extends OnShippingOptionChangeEventData ? OnShippingOptionChangeEventResponse : never;
4208
4745
 
4209
4746
  declare abstract class BaseWalletButton<T extends BaseWalletMeta> {
@@ -4787,217 +5324,6 @@ declare class PaypalWalletButtonExpress extends BaseWalletButton<PaypalWalletMet
4787
5324
  private handleShippingOptionsUpdate;
4788
5325
  }
4789
5326
 
4790
- declare enum ErrorCodes$1 {
4791
- PROMISE_NOT_ENABLED = "promise_not_enabled",
4792
- SCRIPT_ERROR = "script_error"
4793
- }
4794
- interface PayPalDataCollectorConfig {
4795
- mouse_movement?: boolean;
4796
- }
4797
- interface IPayPalDataCollector {
4798
- collectDeviceData(): Promise<CollectedDeviceData>;
4799
- setEnv(env: string): void;
4800
- }
4801
- interface CollectedDeviceData {
4802
- correlation_id: string;
4803
- }
4804
- interface IOnErrorEventData$1 {
4805
- error_code: ErrorCodes$1;
4806
- }
4807
-
4808
- /**
4809
- * PayPal Data Collector Widget constructor
4810
- *
4811
- * @param {string} [flowId] - This string identifies the source website of the FraudNet request.
4812
- * @param {PayPalDataCollectorConfig} [config] - Extra configuration for the widget.
4813
- *
4814
- * @example
4815
- * var payPalDataCollector = new PayPalDataCollector('FLOW_ID', {});
4816
- */
4817
- declare class PayPalDataCollector {
4818
- protected service: IPayPalDataCollector;
4819
- protected eventEmitter: EventEmitter;
4820
- /** @constructs */ constructor(flowId?: string, config?: PayPalDataCollectorConfig);
4821
- /**
4822
- * After configuring the PayPalDataCollector Widget, starts the process and returns
4823
- * the correlation id used among the requests asynchronously.
4824
- *
4825
- * @returns {Promise<CollectedDeviceData>} Promise when resolved, returns an object
4826
- * that contains the `correlation_id` key.
4827
- *
4828
- * @example
4829
- * const collectedDeviceData = await payPalDataCollectorWidget.collectDeviceData();
4830
- * console.log(collectedDeviceData.correlation_id)
4831
- */
4832
- collectDeviceData(): Promise<CollectedDeviceData>;
4833
- /**
4834
- * Callback for onError method.
4835
- *
4836
- * @callback OnErrorCallback
4837
- * @param {IOnErrorEventData|null} data
4838
- */
4839
- /**
4840
- * If the process fails, the function passed as parameter will be called.
4841
- * Important: Do not perform thread blocking operations in callback such as window.alert() calls.
4842
- *
4843
- * @example
4844
- * PayPalDataCollector.onError((eventData) => console.log('Some error occur'));
4845
- *
4846
- * @param {OnErrorCallback} [callback] - Function to be called when there is an error in the flow.
4847
- */
4848
- onError(callback?: (data?: IOnErrorEventData$1) => void): () => void;
4849
- /**
4850
- * Current method can change environment. By default environment = test.
4851
- * This method does not affect Paydock's API calls or environments, is only for PayPal Data Collector
4852
- * script, in order to know if the script is injected on a live server or is a testing
4853
- * environment. The available values are `test` and `live`. This should match with the used
4854
- * `gateway.mode` in Paydock to process the transaction.
4855
- *
4856
- * @example
4857
- * PayPalDataCollector.setEnv('live');
4858
- * @param {string} env - test, live
4859
- */
4860
- setEnv(env: string): void;
4861
- }
4862
-
4863
- interface PayPalStyleConfig {
4864
- layout?: 'vertical' | 'horizontal';
4865
- color?: 'blue' | 'gold' | 'silver' | 'black' | 'white';
4866
- shape?: 'rect' | 'sharp' | 'pill';
4867
- label?: 'paypal' | 'checkout' | 'buynow' | 'pay';
4868
- disableMaxWidth?: boolean;
4869
- disableMaxHeight?: boolean;
4870
- height?: number;
4871
- borderRadius?: number;
4872
- tagline?: boolean;
4873
- }
4874
- interface PayPalMessageConfig {
4875
- amount?: number;
4876
- align?: 'center' | 'left' | 'right';
4877
- color?: 'black' | 'white';
4878
- position?: 'top' | 'bottom';
4879
- }
4880
- interface PayPalSavePaymentSourceWidgetConfig {
4881
- style?: PayPalStyleConfig;
4882
- message?: PayPalMessageConfig;
4883
- }
4884
- interface IPayPalSavePaymentSourceWidget {
4885
- load(container: Container): void;
4886
- setEnv(env: string, alias?: string): void;
4887
- }
4888
- declare enum ErrorCodes {
4889
- UNAVAILABLE = "unavailable",
4890
- ON_PAYPAL_VAULT_SETUP_TOKEN_ERROR = "onPaypalVaultSetupTokenError",
4891
- ON_GET_ID_TOKEN_ERROR = "onGetIdTokenError",
4892
- ON_GET_WALLET_CONFIG_ERROR = "onGetWalletConfigError",
4893
- ON_GET_SETUP_TOKEN_ERROR = "onGetSetupTokenError",
4894
- ON_ONE_TIME_TOKEN_ERROR = "onOneTimeTokenError"
4895
- }
4896
- declare enum EVENTS {
4897
- ON_SUCCESS = "ON_SUCCESS",
4898
- ON_ERROR = "ON_ERROR",
4899
- ON_CANCEL = "ON_CANCEL"
4900
- }
4901
- interface IOnSuccessEventData {
4902
- event: EVENTS.ON_SUCCESS;
4903
- data: {
4904
- token: string;
4905
- email: string;
4906
- };
4907
- }
4908
- interface IOnErrorEventData {
4909
- event: EVENTS.ON_ERROR;
4910
- data: {
4911
- error_code: ErrorCodes;
4912
- details?: string;
4913
- message?: string;
4914
- };
4915
- }
4916
- interface IOnCancelEventData {
4917
- event: EVENTS.ON_CANCEL;
4918
- }
4919
-
4920
- /**
4921
- * PayPal Save Payment Source Widget constructor
4922
- *
4923
- * @param {string} selector - Selector of html element. Container for PayPal Save Payment Source Widget.
4924
- * @param {string} publicKey - PayDock users public key.
4925
- * @param {string} gatewayId - PayDock's PayPal gatewayId.
4926
- * @param {PayPalSavePaymentSourceWidgetConfig} config - Extra configuration for the widget, like styles.
4927
- *
4928
- * @example
4929
- * var payPalSavePaymentSourceWidget = new PayPalSavePaymentSourceWidget('#paypalButton', 'public_key', 'gateway_id');
4930
- */
4931
- declare class PayPalSavePaymentSourceWidget {
4932
- protected container: Container;
4933
- protected service: IPayPalSavePaymentSourceWidget;
4934
- protected eventEmitter: EventEmitter;
4935
- /** @constructs */ constructor(selector: string, publicKey: string, gatewayId: string, config?: PayPalSavePaymentSourceWidgetConfig);
4936
- /**
4937
- * The final method after configuring the PayPalSavePaymentSource Widget to
4938
- * start the load process.
4939
- */
4940
- load(): void;
4941
- /**
4942
- * Current method can change environment. By default environment = sandbox.
4943
- * Also we can change domain alias for this environment. By default domain_alias = paydock.com
4944
- *
4945
- * @example
4946
- * payPalSavePaymentSourceWidget.setEnv('production');
4947
- * @param {string} env - sandbox, production
4948
- * @param {string} [alias] - Own domain alias
4949
- */
4950
- setEnv(env: string, alias?: string): void;
4951
- /**
4952
- * Callback for onSuccess method.
4953
- *
4954
- * @callback OnSuccessCallback
4955
- * @param {IOnSuccessEventData} data
4956
- */
4957
- /**
4958
- * If the setup token was successfully approved and a OTT was generated, the function passed as parameter will be called.
4959
- * Important: Do not perform thread blocking operations in callback such as window.alert() calls.
4960
- *
4961
- * @example
4962
- * payPalSavePaymentSourceWidget.onSuccess((eventData) => console.log('One time token and email obtained successfully'));
4963
- *
4964
- * @param {OnSuccessCallback} [callback] - Function to be called when the result is successful.
4965
- */
4966
- onSuccess(callback?: (data: IOnSuccessEventData) => void): () => void;
4967
- /**
4968
- * Callback for onError method.
4969
- *
4970
- * @callback OnErrorCallback
4971
- * @param {IOnErrorEventData} data
4972
- */
4973
- /**
4974
- * If in the process for obtaining the setup token fails, the function passed as parameter will be called.
4975
- * Important: Do not perform thread blocking operations in callback such as window.alert() calls.
4976
- *
4977
- * @example
4978
- * payPalSavePaymentSourceWidget.onError((eventData) => console.log('Some error occurred'));
4979
- *
4980
- * @param {OnErrorCallback} [callback] - Function to be called when there is an error in the flow.
4981
- */
4982
- onError(callback?: (data: IOnErrorEventData) => void): () => void;
4983
- /**
4984
- * Callback for onCancel method.
4985
- *
4986
- * @callback OnCancelCallback
4987
- * @param {IOnCancelEventData} data
4988
- */
4989
- /**
4990
- * If in the process for obtaining the setup token was cancelled, the function passed as parameter will be called.
4991
- * Important: Do not perform thread blocking operations in callback such as window.alert() calls.
4992
- *
4993
- * @example
4994
- * payPalSavePaymentSourceWidget.onCancel(() => console.log('Operation cancelled'));
4995
- *
4996
- * @param {OnCancelCallback} [callback] - Function to be called when the operation is cancelled.
4997
- */
4998
- onCancel(callback?: (data?: IOnCancelEventData) => void): () => void;
4999
- }
5000
-
5001
5327
  declare global {
5002
5328
  interface Window {
5003
5329
  paydock: {
@@ -5017,8 +5343,9 @@ declare global {
5017
5343
  HtmlWidget: typeof HtmlWidget;
5018
5344
  PayPalDataCollector: typeof PayPalDataCollector;
5019
5345
  PayPalSavePaymentSource: typeof PayPalSavePaymentSourceWidget;
5346
+ AfterpayOnSiteMessaging: typeof AfterpayOnSiteMessaging;
5020
5347
  };
5021
5348
  }
5022
5349
  }
5023
5350
 
5024
- export { AfterpayCheckoutButton, Api, type ApplePayServiceConfig, ApplePayWalletButtonExpress, BaseOpenWallet, type BaseServiceConfig, type BaseWalletMeta$1 as BaseWalletMeta, CHECKOUT_BUTTON_EVENT, Canvas3ds, Checkout, CheckoutActionCode, type CheckoutResponse, ClickToPay, Configuration, type CreateOTTRequest, type CreateOTTResponse, ELEMENT, EVENT$2 as EVENT, Builder$1 as ExternalCheckoutBuilder, Checker as ExternalCheckoutChecker, FORM_FIELD, FRAUD_PREVENTION_EVENTS, type FraudPreventionEvent, type FraudPreventionEventType, type FraudPreventionProvider, FraudPreventionService, type GooglePayServiceConfig, HtmlMultiWidget, HtmlPaymentSourceWidget, HtmlWidget, type ICheckout, type IClickToPayMeta, type IDetails, type IElementStyleInput, type IEventCheckoutFinishData, type IEventData, type IPayPalMeta, type IStyles$1 as IStyles, type ITexts, type IWalletMeta, type IWalletOnClickEvent, type IWalletPaymentSuccessfulEvent, type IWalletUnavailableEvent, type IWalletUpdateData, type IWalletUpdateEvent, InstructionDebugger, MultiWidget, type OTTResponse, type OnClickEventData$1 as OnClickEventData, type OnCrateOTTSuccessfulEventData, type OnCreateOTTErrorEventData, type OnErrorEventData$1 as OnErrorEventData, type OnUnavailableEventData$1 as OnUnavailableEventData, type OpenWalletEventType, PAYMENT_TYPE, PURPOSE, PayPalDataCollector, PayPalSavePaymentSourceWidget, Builder as PaymentSourceBuilder, PaymentSourceWidget, PaypalCheckoutButton, PaypalWalletButtonExpress, STYLABLE_ELEMENT, STYLABLE_ELEMENT_STATE, STYLE, SUPPORTED_CARD_TYPES, TEXT, TRIGGER, TYPE, VAULT_DISPLAY_STYLE, type VaultDisplayStyle, VaultDisplayWidget, WALLET_TYPES, WalletButtons, type WalletPaymentSource, type WalletType, ZipmoneyCheckoutButton };
5351
+ export { AfterpayCheckoutButton, AfterpayOnSiteMessaging, Api, ApplePayWalletButtonExpress, CHECKOUT_BUTTON_EVENT, Canvas3ds, Checkout, CheckoutActionCode, type CheckoutResponse, ClickToPay, Configuration, type CreateOTTData, type CreateOTTRequest, type CreateOTTResponse, type CreateSessionRequest, type CreateSessionResponse, ELEMENT, EVENT$2 as EVENT, Builder$1 as ExternalCheckoutBuilder, Checker as ExternalCheckoutChecker, FORM_FIELD, FRAUD_PREVENTION_EVENTS, type FraudPreventionEvent, type FraudPreventionEventType, type FraudPreventionProvider, FraudPreventionService, HtmlMultiWidget, HtmlPaymentSourceWidget, HtmlWidget, type ICheckout, type IClickToPayMeta, type IDetails, type IElementStyleInput, type IEventCheckoutFinishData, type IEventData, type IPayPalMeta, type IStyles$1 as IStyles, type ITexts, type IWalletMeta, type IWalletOnClickEvent, type IWalletPaymentSuccessfulEvent, type IWalletUnavailableEvent, type IWalletUpdateData, type IWalletUpdateEvent, InstructionDebugger, MultiWidget, type OTTResponse, type OnClickEventData$1 as OnClickEventData, type OnCrateOTTSuccessfulEventData, type OnCreateOTTErrorEventData, type OnErrorEventData$1 as OnErrorEventData, type OnUnavailableEventData$1 as OnUnavailableEventData, OpenWalletButtons, type OpenWalletEventType, type OpenWalletMeta, PAYMENT_TYPE, PURPOSE, PayPalDataCollector, PayPalSavePaymentSourceWidget, Builder as PaymentSourceBuilder, PaymentSourceWidget, PaypalCheckoutButton, PaypalWalletButtonExpress, STYLABLE_ELEMENT, STYLABLE_ELEMENT_STATE, STYLE, SUPPORTED_CARD_TYPES, TEXT, TRIGGER, TYPE, VAULT_DISPLAY_STYLE, type VaultDisplayStyle, VaultDisplayWidget, WALLET_TYPES, WalletButtons, type WalletPaymentSource, type WalletType, ZipmoneyCheckoutButton };