@paydock/client-sdk 1.127.0 → 1.128.2

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 (78) hide show
  1. package/README.md +1136 -3960
  2. package/bundles/index.cjs +292 -85
  3. package/bundles/index.cjs.d.ts +48 -3
  4. package/bundles/index.mjs +292 -85
  5. package/bundles/index.mjs.d.ts +48 -3
  6. package/bundles/types/checkout/checkout.d.ts +4 -4
  7. package/bundles/types/checkout/checkout.d.ts.map +1 -1
  8. package/bundles/types/checkout/layout-widgets/additionals.d.ts.map +1 -1
  9. package/bundles/types/checkout/layout-widgets/payment-template.d.ts.map +1 -1
  10. package/bundles/types/components/param.d.ts +2 -0
  11. package/bundles/types/components/param.d.ts.map +1 -1
  12. package/bundles/types/components/trigger.d.ts +2 -0
  13. package/bundles/types/components/trigger.d.ts.map +1 -1
  14. package/bundles/types/index-cba.d.ts +11 -11
  15. package/bundles/types/index-cba.d.ts.map +1 -1
  16. package/bundles/types/index.d.ts +11 -11
  17. package/bundles/types/index.d.ts.map +1 -1
  18. package/bundles/types/secure-remote-commerce/click-to-pay-secure-remote-commerce.d.ts +24 -2
  19. package/bundles/types/secure-remote-commerce/click-to-pay-secure-remote-commerce.d.ts.map +1 -1
  20. package/bundles/types/secure-remote-commerce/index.d.ts +7 -1
  21. package/bundles/types/secure-remote-commerce/index.d.ts.map +1 -1
  22. package/bundles/types/secure-remote-commerce/interfaces.d.ts +10 -2
  23. package/bundles/types/secure-remote-commerce/interfaces.d.ts.map +1 -1
  24. package/bundles/types/secure-remote-commerce/providers/mastercard-src/mastercard-src.d.ts +15 -4
  25. package/bundles/types/secure-remote-commerce/providers/mastercard-src/mastercard-src.d.ts.map +1 -1
  26. package/bundles/types/secure-remote-commerce/providers/src-provider.d.ts +2 -0
  27. package/bundles/types/secure-remote-commerce/providers/src-provider.d.ts.map +1 -1
  28. package/bundles/types/secure-remote-commerce/services/performance.service.d.ts +32 -0
  29. package/bundles/types/secure-remote-commerce/services/performance.service.d.ts.map +1 -0
  30. package/bundles/types/wallet-buttons/index.d.ts +6 -6
  31. package/bundles/types/wallet-buttons/wallet-buttons.d.ts +2 -2
  32. package/bundles/types/wallet-buttons-express/enum/event.enum.d.ts.map +1 -1
  33. package/bundles/types/wallet-buttons-express/index.d.ts +3 -3
  34. package/bundles/types/wallet-buttons-express/index.d.ts.map +1 -1
  35. package/bundles/types/wallet-buttons-express/interfaces/charge-wallet-token-meta.interface.d.ts.map +1 -1
  36. package/bundles/types/wallet-buttons-express/interfaces/on-click-event-data.interface.d.ts +2 -2
  37. package/bundles/types/wallet-buttons-express/interfaces/on-click-event-data.interface.d.ts.map +1 -1
  38. package/bundles/types/wallet-buttons-express/interfaces/on-close-event-data.interface.d.ts +2 -2
  39. package/bundles/types/wallet-buttons-express/interfaces/on-close-event-data.interface.d.ts.map +1 -1
  40. package/bundles/types/wallet-buttons-express/interfaces/on-error-event-data.interface.d.ts +2 -2
  41. package/bundles/types/wallet-buttons-express/interfaces/on-error-event-data.interface.d.ts.map +1 -1
  42. package/bundles/types/wallet-buttons-express/interfaces/on-payment-error-event-data.interface.d.ts +2 -2
  43. package/bundles/types/wallet-buttons-express/interfaces/on-payment-error-event-data.interface.d.ts.map +1 -1
  44. package/bundles/types/wallet-buttons-express/interfaces/on-payment-in-review-event-data.interface.d.ts +2 -2
  45. package/bundles/types/wallet-buttons-express/interfaces/on-payment-in-review-event-data.interface.d.ts.map +1 -1
  46. package/bundles/types/wallet-buttons-express/interfaces/on-payment-successful-event-data.interface.d.ts +2 -2
  47. package/bundles/types/wallet-buttons-express/interfaces/on-payment-successful-event-data.interface.d.ts.map +1 -1
  48. package/bundles/types/wallet-buttons-express/interfaces/on-shipping-address-change-event-data.interface.d.ts.map +1 -1
  49. package/bundles/types/wallet-buttons-express/interfaces/on-shipping-address-change-event-response.interface.d.ts.map +1 -1
  50. package/bundles/types/wallet-buttons-express/interfaces/on-shipping-option-change-event-data.interface.d.ts.map +1 -1
  51. package/bundles/types/wallet-buttons-express/interfaces/on-unavailable-event-data.interface.d.ts +2 -2
  52. package/bundles/types/wallet-buttons-express/interfaces/on-unavailable-event-data.interface.d.ts.map +1 -1
  53. package/bundles/types/wallet-buttons-express/services/apple-pay/interfaces/apple-pay-wallet-meta.interface.d.ts +5 -5
  54. package/bundles/types/wallet-buttons-express/services/apple-pay/interfaces/apple-pay-wallet-meta.interface.d.ts.map +1 -1
  55. package/bundles/types/wallet-buttons-express/services/apple-pay/types/apple-pay-shipping-data.d.ts.map +1 -1
  56. package/bundles/types/wallet-buttons-express/services/apple-pay/types/apple-pay-shipping-method.type.d.ts.map +1 -1
  57. package/bundles/types/wallet-buttons-express/services/paypal/interfaces/paypal-wallet-meta.interface.d.ts +1 -1
  58. package/bundles/types/wallet-buttons-express/services/paypal/interfaces/paypal-wallet-meta.interface.d.ts.map +1 -1
  59. package/bundles/types/wallet-buttons-express/types/shipping-event-to-response.type.d.ts +4 -4
  60. package/bundles/types/wallet-buttons-express/types/shipping-event-to-response.type.d.ts.map +1 -1
  61. package/bundles/types/widget/multi-widget.d.ts +8 -0
  62. package/bundles/types/widget/multi-widget.d.ts.map +1 -1
  63. package/bundles/widget.umd.js +292 -85
  64. package/bundles/widget.umd.js.d.ts +48 -3
  65. package/bundles/widget.umd.js.min.d.ts +48 -3
  66. package/bundles/widget.umd.min.js +1 -1
  67. package/docs/api-checkout-button.md +0 -370
  68. package/docs/api-widget.md +1 -2110
  69. package/docs/checkout-examples.md +2 -127
  70. package/docs/click-to-pay-examples.md +109 -0
  71. package/docs/click-to-pay.md +31 -1
  72. package/docs/license.md +1 -1
  73. package/docs/wallet-buttons-examples.md +3 -134
  74. package/docs/wallet-buttons.md +10 -10
  75. package/docs/wallet-cba-buttons-examples.md +1 -1
  76. package/package.json +1 -1
  77. package/slate.md +114 -524
  78. package/docs/api-vault-display.md +0 -94
@@ -958,7 +958,7 @@
958
958
  version: 'x-sdk-version',
959
959
  type: 'x-sdk-type'
960
960
  });
961
- SDK._version = 'v1.127.0';
961
+ SDK._version = 'v1.128.2';
962
962
 
963
963
  /******************************************************************************
964
964
  Copyright (c) Microsoft Corporation.
@@ -5761,7 +5761,8 @@
5761
5761
  ADDRESS_COUNTRY: 'address_country',
5762
5762
  ADDRESS_CITY: 'address_city',
5763
5763
  ADDRESS_POSTCODE: 'address_postcode',
5764
- ADDRESS_COMPANY: 'address_company'
5764
+ ADDRESS_COMPANY: 'address_company',
5765
+ SAVE_CARD_CONSENT_ACCEPTED: 'save_card_consent_accepted'
5765
5766
  };
5766
5767
  var STYLE$2 = {
5767
5768
  BACKGROUND_COLOR: 'background_color',
@@ -8662,6 +8663,59 @@
8662
8663
  }]);
8663
8664
  }(PaymentSourceWidget);
8664
8665
 
8666
+ /**
8667
+ * Interface for classes that represent a trigger data.
8668
+ * @interface ITriggerData
8669
+ *
8670
+ * @param {string} [configuration_token]
8671
+ * @param {string} [tab_number]
8672
+ * @param {string} [elements]
8673
+ * @param {string} [form_values]
8674
+ * */
8675
+ /**
8676
+ * List of available triggers
8677
+ *
8678
+ * @type {object}
8679
+ * @param {string} SUBMIT_FORM=submit_form
8680
+ * @param {string} CHANGE_TAB=tab
8681
+ * @param {string} HIDE_ELEMENTS=hide_elements
8682
+ * @param {string} SHOW_ELEMENTS=show_elements
8683
+ * @param {string} REFRESH_CHECKOUT=refresh_checkout
8684
+ * @param {string} UPDATE_FORM_VALUES=update_form_values
8685
+ * @param {string} INIT_CHECKOUT=init_checkout
8686
+ * @param {string} INJECT_CUSTOMER_DATA=inject_customer_data
8687
+ */
8688
+ var TRIGGER$1 = {
8689
+ SUBMIT_FORM: 'submit_form',
8690
+ CHANGE_TAB: 'tab',
8691
+ HIDE_ELEMENTS: 'hide_elements',
8692
+ SHOW_ELEMENTS: 'show_elements',
8693
+ REFRESH_CHECKOUT: 'refresh_checkout',
8694
+ UPDATE_FORM_VALUES: 'update_form_values',
8695
+ INIT_CHECKOUT: 'init_checkout',
8696
+ INJECT_CUSTOMER_DATA: 'inject_customer_data'
8697
+ };
8698
+ var Trigger = /*#__PURE__*/function () {
8699
+ function Trigger(iFrame) {
8700
+ _classCallCheck(this, Trigger);
8701
+ this.iFrame = iFrame;
8702
+ }
8703
+ return _createClass(Trigger, [{
8704
+ key: "push",
8705
+ value: function push(triggerName) {
8706
+ var data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
8707
+ if (!this.iFrame.isExist()) return;
8708
+ if (ObjectHelper.values(TRIGGER$1).indexOf(triggerName) === -1) console.warn('unsupported trigger type');
8709
+ var body = {
8710
+ trigger: triggerName,
8711
+ destination: 'widget.paydock',
8712
+ data: data
8713
+ };
8714
+ this.iFrame.getElement().contentWindow.postMessage(JSON.stringify(body), '*');
8715
+ }
8716
+ }]);
8717
+ }();
8718
+
8665
8719
  /**
8666
8720
  * List of available event's name in the Click To Pay checkout lifecycle
8667
8721
  * @enum EVENT
@@ -8707,12 +8761,125 @@
8707
8761
  ENABLE_SRC_POPUP: 'enable_src_popup'
8708
8762
  };
8709
8763
 
8764
+ var PerformanceService = /*#__PURE__*/function () {
8765
+ function PerformanceService() {
8766
+ _classCallCheck(this, PerformanceService);
8767
+ }
8768
+ return _createClass(PerformanceService, null, [{
8769
+ key: "initialize",
8770
+ value: function initialize(env) {
8771
+ var _this = this;
8772
+ performance.now();
8773
+ // Set environment configuration
8774
+ var envInstance = new Env(API_URL, env);
8775
+ var finalUrl = envInstance.getConf().url;
8776
+ // Add performance optimizations in parallel
8777
+ Promise.all([
8778
+ // Add preconnect
8779
+ new Promise(function (resolve) {
8780
+ _this.addLinkTag('preconnect', finalUrl, true);
8781
+ resolve();
8782
+ }),
8783
+ // Add DNS prefetch
8784
+ new Promise(function (resolve) {
8785
+ _this.addLinkTag('dns-prefetch', finalUrl);
8786
+ resolve();
8787
+ }),
8788
+ // Send warmup request
8789
+ new Promise(function (resolve) {
8790
+ if (window.fetch) {
8791
+ fetch("".concat(finalUrl, "/v1/echo"), {
8792
+ mode: 'no-cors',
8793
+ keepalive: true
8794
+ })["catch"](function () {})["finally"](resolve);
8795
+ } else {
8796
+ resolve();
8797
+ }
8798
+ })]);
8799
+ }
8800
+ /**
8801
+ * Dynamically adds or updates a `<link>` tag in the document's `<head>`.
8802
+ * This utility is designed for performance optimizations like `dns-prefetch` and `preconnect`.
8803
+ *
8804
+ * @param rel - The relationship type of the link (e.g., 'dns-prefetch', 'preconnect').
8805
+ * @param href - The URL for the resource.
8806
+ * @param crossorigin - Specifies if the resource should be fetched with a CORS request. Defaults to false.
8807
+ */
8808
+ }, {
8809
+ key: "addLinkTag",
8810
+ value: function addLinkTag(rel, href) {
8811
+ var crossorigin = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
8812
+ try {
8813
+ var existingTag = document.head.querySelector("link[rel=\"".concat(rel, "\"][href*=\"").concat(new URL(href).host, "\"]"));
8814
+ if (existingTag) {
8815
+ return;
8816
+ }
8817
+ var linkElement = this.createLinkElement(rel, href, crossorigin);
8818
+ document.head.prepend(linkElement);
8819
+ } catch (error) {
8820
+ console.error("\u274C [Performance] Failed to add ".concat(rel, " tag for ").concat(href, "."), error);
8821
+ }
8822
+ }
8823
+ /**
8824
+ * Creates and configures a new HTMLLinkElement.
8825
+ *
8826
+ * @param rel - The relationship type.
8827
+ * @param href - The resource URL.
8828
+ * @param crossorigin - The CORS setting.
8829
+ * @returns A configured HTMLLinkElement.
8830
+ * @private
8831
+ */
8832
+ }, {
8833
+ key: "createLinkElement",
8834
+ value: function createLinkElement(rel, href, crossorigin) {
8835
+ var linkElement = document.createElement('link');
8836
+ linkElement.rel = rel;
8837
+ linkElement.href = this.determineHref(rel, href);
8838
+ if (crossorigin) {
8839
+ linkElement.crossOrigin = 'anonymous';
8840
+ }
8841
+ return linkElement;
8842
+ }
8843
+ /**
8844
+ * Determines the appropriate href value based on the link relationship.
8845
+ *
8846
+ * @param rel - The relationship type.
8847
+ * @param originalHref - The original URL.
8848
+ * @returns The processed href string.
8849
+ * @private
8850
+ */
8851
+ }, {
8852
+ key: "determineHref",
8853
+ value: function determineHref(rel, originalHref) {
8854
+ if (rel === 'dns-prefetch') {
8855
+ // For dns-prefetch, a protocol-relative URL to the host is sufficient.
8856
+ var _URL = new URL(originalHref),
8857
+ host = _URL.host;
8858
+ return "//".concat(host);
8859
+ }
8860
+ // For others, like preconnect, the full original URL is required.
8861
+ return originalHref;
8862
+ }
8863
+ }]);
8864
+ }();
8865
+
8710
8866
  var ClickToPaySRC = /*#__PURE__*/function () {
8711
8867
  function ClickToPaySRC(iframe_selector, service_id, public_key, meta, eventEmitter, autoResize, env, alias) {
8712
8868
  _classCallCheck(this, ClickToPaySRC);
8869
+ var _a, _b, _c;
8713
8870
  this.meta = meta;
8714
8871
  this.eventEmitter = eventEmitter;
8715
8872
  this.autoResize = autoResize;
8873
+ this.isIframeLoaded = false;
8874
+ this.injectedCustomerData = null;
8875
+ if (meta.dpa_config) {
8876
+ var hasAllRawDpaConfig = !!(((_a = this.meta.dpa_config) === null || _a === void 0 ? void 0 : _a.dpa_id) && ((_b = this.meta.dpa_config) === null || _b === void 0 ? void 0 : _b.dpa_name) && ((_c = this.meta.dpa_config) === null || _c === void 0 ? void 0 : _c.dpa_supported_card_schemes));
8877
+ // if doesnt have all fields remove dpa_config from meta
8878
+ if (!hasAllRawDpaConfig) {
8879
+ console.warn('DPA config is missing some required fields, removing it from meta');
8880
+ delete meta.dpa_config;
8881
+ }
8882
+ }
8716
8883
  this.link = new Link(MASTERCARD_SRC);
8717
8884
  this.link.setParams(_extends({
8718
8885
  service_id: service_id,
@@ -8729,6 +8896,7 @@
8729
8896
  if (env) this.link.setEnv(env, alias);
8730
8897
  this.iFrameContainer = new Container(iframe_selector);
8731
8898
  this.iFrame = new IFrame(this.iFrameContainer);
8899
+ this.trigger = new Trigger(this.iFrame);
8732
8900
  this.iFrameEvent = new IFrameEvent(window);
8733
8901
  this.setupIFrameEvents();
8734
8902
  }
@@ -8764,6 +8932,8 @@
8764
8932
  key: "load",
8765
8933
  value: function load() {
8766
8934
  var _this2 = this;
8935
+ // Initialize performance optimizations when environment is guaranteed to be final
8936
+ PerformanceService.initialize(this.link.getEnv());
8767
8937
  this.iFrame.load(this.link.getUrl(), {
8768
8938
  title: 'Click To Pay checkout'
8769
8939
  });
@@ -8772,7 +8942,12 @@
8772
8942
  if (iframeElement) {
8773
8943
  iframeElement.setAttribute('allow', 'payment; accelerometer;');
8774
8944
  iframeElement.onload = function () {
8775
- return _this2.eventEmitter.emit(EVENT$3.IFRAME_LOADED, {});
8945
+ _this2.isIframeLoaded = true;
8946
+ _this2.eventEmitter.emit(EVENT$3.IFRAME_LOADED, {});
8947
+ if (_this2.injectedCustomerData) {
8948
+ _this2.injectCustomerData(_this2.injectedCustomerData);
8949
+ _this2.injectedCustomerData = null;
8950
+ }
8776
8951
  };
8777
8952
  }
8778
8953
  }
@@ -8815,6 +8990,22 @@
8815
8990
  }
8816
8991
  });
8817
8992
  }
8993
+ /**
8994
+ * Send customer data to iframe using the established trigger pattern
8995
+ *
8996
+ * @param {CustomerData} customerData - Customer data to inject
8997
+ */
8998
+ }, {
8999
+ key: "injectCustomerData",
9000
+ value: function injectCustomerData(customerData) {
9001
+ if (!this.isIframeLoaded) {
9002
+ this.injectedCustomerData = customerData;
9003
+ return;
9004
+ }
9005
+ this.trigger.push(TRIGGER$1.INJECT_CUSTOMER_DATA, {
9006
+ customer: customerData
9007
+ });
9008
+ }
8818
9009
  }]);
8819
9010
  }();
8820
9011
 
@@ -9003,74 +9194,75 @@
9003
9194
  _this.service_id = service_id;
9004
9195
  _this.public_key_or_access_token = public_key_or_access_token;
9005
9196
  _this.meta = meta;
9197
+ _this.holdingForCustomerData = false;
9198
+ _this.pendingCustomerData = null;
9199
+ // Dequeue customer data only when the iframe has loaded
9200
+ _this.on('iframeLoaded', function () {
9201
+ if (_this.pendingCustomerData && _this.provider) {
9202
+ _this.provider.injectCustomerData(_this.pendingCustomerData);
9203
+ _this.pendingCustomerData = null;
9204
+ }
9205
+ });
9006
9206
  return _this;
9007
9207
  }
9008
9208
  /**
9009
9209
  * The final method after configuring the SRC to start the load process of Click To Pay checkout
9010
- *
9011
9210
  */
9012
9211
  _inherits(ClickToPay, _SRC);
9013
9212
  return _createClass(ClickToPay, [{
9014
9213
  key: "load",
9015
9214
  value: function load() {
9016
- if (this.provider) return;
9215
+ if (this.provider) {
9216
+ return;
9217
+ }
9017
9218
  this.meta.customizations = this.style;
9219
+ this.holdingForCustomerData = !!this.meta.hold_for_customer_data;
9018
9220
  this.provider = new ClickToPaySRC(this.iframe_selector, this.service_id, this.public_key_or_access_token, this.meta, this.eventEmitter, this.autoResize, this.env, this.alias);
9019
9221
  this.provider.load();
9020
9222
  }
9021
- }]);
9022
- }(SRC);
9023
-
9024
- /**
9025
- * Interface for classes that represent a trigger data.
9026
- * @interface ITriggerData
9027
- *
9028
- * @param {string} [configuration_token]
9029
- * @param {string} [tab_number]
9030
- * @param {string} [elements]
9031
- * @param {string} [form_values]
9032
- * */
9033
- /**
9034
- * List of available triggers
9035
- *
9036
- * @type {object}
9037
- * @param {string} SUBMIT_FORM=submit_form
9038
- * @param {string} CHANGE_TAB=tab
9039
- * @param {string} HIDE_ELEMENTS=hide_elements
9040
- * @param {string} SHOW_ELEMENTS=show_elements
9041
- * @param {string} REFRESH_CHECKOUT=refresh_checkout
9042
- * @param {string} UPDATE_FORM_VALUES=update_form_values
9043
- * @param {string} INIT_CHECKOUT=init_checkout
9044
- */
9045
- var TRIGGER$1 = {
9046
- SUBMIT_FORM: 'submit_form',
9047
- CHANGE_TAB: 'tab',
9048
- HIDE_ELEMENTS: 'hide_elements',
9049
- SHOW_ELEMENTS: 'show_elements',
9050
- REFRESH_CHECKOUT: 'refresh_checkout',
9051
- UPDATE_FORM_VALUES: 'update_form_values',
9052
- INIT_CHECKOUT: 'init_checkout'
9053
- };
9054
- var Trigger = /*#__PURE__*/function () {
9055
- function Trigger(iFrame) {
9056
- _classCallCheck(this, Trigger);
9057
- this.iFrame = iFrame;
9058
- }
9059
- return _createClass(Trigger, [{
9060
- key: "push",
9061
- value: function push(triggerName) {
9062
- var data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
9063
- if (!this.iFrame.isExist()) return;
9064
- if (ObjectHelper.values(TRIGGER$1).indexOf(triggerName) === -1) console.warn('unsupported trigger type');
9065
- var body = {
9066
- trigger: triggerName,
9067
- destination: 'widget.paydock',
9068
- data: data
9069
- };
9070
- this.iFrame.getElement().contentWindow.postMessage(JSON.stringify(body), '*');
9223
+ /**
9224
+ * Inject customer data after widget initialization via postMessage
9225
+ *
9226
+ * @param {Customer} customerData - Customer data to inject
9227
+ * @throws {Error} When customer data is invalid or widget is not ready
9228
+ * @example
9229
+ * widget.injectCustomerData({
9230
+ * email: 'user@example.com',
9231
+ * first_name: 'John',
9232
+ * last_name: 'Doe'
9233
+ * });
9234
+ */
9235
+ }, {
9236
+ key: "injectCustomerData",
9237
+ value: function injectCustomerData(customerData) {
9238
+ if (!this.validateCustomerData(customerData)) {
9239
+ throw new Error('Invalid customer data format. Must include at least email or phone.');
9240
+ }
9241
+ if (!this.provider) {
9242
+ throw new Error('ClickToPay is not ready. Please call `load` method first.');
9243
+ }
9244
+ this.provider.injectCustomerData(customerData);
9245
+ }
9246
+ /**
9247
+ * Validate customer data format
9248
+ *
9249
+ * @private
9250
+ * @param {Customer} customerData - Customer data to validate
9251
+ * @returns {boolean} True if valid
9252
+ */
9253
+ }, {
9254
+ key: "validateCustomerData",
9255
+ value: function validateCustomerData(customerData) {
9256
+ if (!customerData || _typeof$1(customerData) !== 'object') {
9257
+ return false;
9258
+ }
9259
+ // Check if at least email or phone is provided
9260
+ var hasEmail = customerData.email && typeof customerData.email === 'string';
9261
+ var hasPhone = customerData.phone && _typeof$1(customerData.phone) === 'object' && customerData.phone.phone && typeof customerData.phone.phone === 'string';
9262
+ return hasEmail || hasPhone;
9071
9263
  }
9072
9264
  }]);
9073
- }();
9265
+ }(SRC);
9074
9266
 
9075
9267
  var VAULT_DISPLAY_EVENT;
9076
9268
  (function (VAULT_DISPLAY_EVENT) {
@@ -13025,7 +13217,7 @@
13025
13217
  ON_CHECKOUT_CLOSE: EventEnum.ON_CHECKOUT_CLOSE
13026
13218
  };
13027
13219
  /**
13028
- * Class WalletButtons to work with different E-Wallets within html (currently supports Apple Pay, Google Pay, Google Pay™ and Apple Pay via Stripe, Flypay, Flypay V2, Paypal, Afterpay)
13220
+ * Class WalletButtons to work with different E-Wallets within html (currently supports Apple Pay, Google Pay, Google Pay™ and Apple Pay via Stripe, Flypay V2, Paypal, Afterpay)
13029
13221
  * @constructor
13030
13222
  *
13031
13223
  * @example
@@ -13142,7 +13334,7 @@
13142
13334
  }
13143
13335
  /**
13144
13336
  * Triggers the update process of the wallet, if available.
13145
- * Currently supported by Flypay, Paypal and ApplePay/GooglePay via MPGS Wallets.
13337
+ * Currently supported by Paypal and ApplePay/GooglePay via MPGS Wallets.
13146
13338
  *
13147
13339
  * @example
13148
13340
  * var button = new WalletButtons(
@@ -13262,7 +13454,7 @@
13262
13454
  * });
13263
13455
  * // or
13264
13456
  * button.on('unavailable').then(function () {
13265
- * console.log('No button is available);
13457
+ * console.log('No button is available');
13266
13458
  * });
13267
13459
  *
13268
13460
  * @param {string} eventName - Available event names [EVENT]{@link EVENT}
@@ -15016,6 +15208,21 @@
15016
15208
  error: error
15017
15209
  });
15018
15210
  }
15211
+ /**
15212
+ * The Current method can set a consent checkbox to save card
15213
+ *
15214
+ * @example
15215
+ * widget.enableSaveCardConsentCheckbox();
15216
+ *
15217
+ */
15218
+ }, {
15219
+ key: "enableSaveCardConsentCheckbox",
15220
+ value: function enableSaveCardConsentCheckbox() {
15221
+ var _a, _b, _c;
15222
+ if (((_c = (_b = (_a = this.configs[0]) === null || _a === void 0 ? void 0 : _a.getConfigs()) === null || _b === void 0 ? void 0 : _b.predefined_fields) === null || _c === void 0 ? void 0 : _c.type) === 'card') {
15223
+ this.setFormValue('save_card_consent_accepted', 'false');
15224
+ }
15225
+ }
15019
15226
  }]);
15020
15227
  }();
15021
15228
 
@@ -15689,6 +15896,30 @@
15689
15896
  }]);
15690
15897
  }(HtmlMultiWidget);
15691
15898
 
15899
+ var Spinner = /*#__PURE__*/function () {
15900
+ function Spinner() {
15901
+ _classCallCheck(this, Spinner);
15902
+ }
15903
+ return _createClass(Spinner, null, [{
15904
+ key: "getSpinnerElement",
15905
+ value: function getSpinnerElement() {
15906
+ return document.getElementById('spinner');
15907
+ }
15908
+ }, {
15909
+ key: "show",
15910
+ value: function show() {
15911
+ var spinner = this.getSpinnerElement();
15912
+ spinner === null || spinner === void 0 ? void 0 : spinner.classList.remove('spinner-wrapper--hidden');
15913
+ }
15914
+ }, {
15915
+ key: "hide",
15916
+ value: function hide() {
15917
+ var spinner = this.getSpinnerElement();
15918
+ spinner === null || spinner === void 0 ? void 0 : spinner.classList.add('spinner-wrapper--hidden');
15919
+ }
15920
+ }]);
15921
+ }();
15922
+
15692
15923
  var InstructionModule$1 = /*#__PURE__*/function () {
15693
15924
  function InstructionModule() {
15694
15925
  _classCallCheck(this, InstructionModule);
@@ -15754,30 +15985,6 @@
15754
15985
  };
15755
15986
  }
15756
15987
 
15757
- var Spinner = /*#__PURE__*/function () {
15758
- function Spinner() {
15759
- _classCallCheck(this, Spinner);
15760
- }
15761
- return _createClass(Spinner, null, [{
15762
- key: "getSpinnerElement",
15763
- value: function getSpinnerElement() {
15764
- return document.getElementById('spinner');
15765
- }
15766
- }, {
15767
- key: "show",
15768
- value: function show() {
15769
- var spinner = this.getSpinnerElement();
15770
- spinner === null || spinner === void 0 ? void 0 : spinner.classList.remove('spinner-wrapper--hidden');
15771
- }
15772
- }, {
15773
- key: "hide",
15774
- value: function hide() {
15775
- var spinner = this.getSpinnerElement();
15776
- spinner === null || spinner === void 0 ? void 0 : spinner.classList.add('spinner-wrapper--hidden');
15777
- }
15778
- }]);
15779
- }();
15780
-
15781
15988
  var SessionHelper = /*#__PURE__*/function () {
15782
15989
  function SessionHelper() {
15783
15990
  _classCallCheck(this, SessionHelper);
@@ -17313,7 +17520,7 @@
17313
17520
  key: "isTimeoutInstruction",
17314
17521
  value: function isTimeoutInstruction(response) {
17315
17522
  var _a, _b;
17316
- return ((_a = response.payload) === null || _a === void 0 ? void 0 : _a.status) === 'expired' || ((_b = response.paload) === null || _b === void 0 ? void 0 : _b.title) === 'Session expired';
17523
+ return ((_a = response.payload) === null || _a === void 0 ? void 0 : _a.status) === 'expired' || ((_b = response.payload) === null || _b === void 0 ? void 0 : _b.title) === 'Session expired';
17317
17524
  }
17318
17525
  }, {
17319
17526
  key: "handleInstruction",
@@ -19113,7 +19320,7 @@
19113
19320
  }]);
19114
19321
  }();
19115
19322
 
19116
- window.postMessage("PAYDOCK_PAYMENTS_WIDGET_LOADED");
19323
+ window.postMessage('PAYDOCK_PAYMENTS_WIDGET_LOADED');
19117
19324
 
19118
19325
  class Timer {
19119
19326
  constructor(opts, ms) {
@@ -281,6 +281,7 @@ declare const FORM_FIELD: {
281
281
  ADDRESS_CITY: string;
282
282
  ADDRESS_POSTCODE: string;
283
283
  ADDRESS_COMPANY: string;
284
+ SAVE_CARD_CONSENT_ACCEPTED: string;
284
285
  };
285
286
  declare const STYLE: {
286
287
  BACKGROUND_COLOR: string;
@@ -455,6 +456,7 @@ interface IParams extends IStyles$1, ITexts, ICommonParams {
455
456
  vault_display_token?: string;
456
457
  sdk_origin?: boolean;
457
458
  hide_ui_errors?: boolean;
459
+ save_card_consent_accepted?: string;
458
460
  }
459
461
  interface ICountryPhoneMask {
460
462
  preferred_countries?: string[];
@@ -1215,6 +1217,14 @@ declare class MultiWidget {
1215
1217
  setLanguage(code: any): void;
1216
1218
  getLink(): Link;
1217
1219
  protected handleErrorEvent(event: EventTypes, error: IEventError, purpose: PURPOSE): void;
1220
+ /**
1221
+ * The Current method can set a consent checkbox to save card
1222
+ *
1223
+ * @example
1224
+ * widget.enableSaveCardConsentCheckbox();
1225
+ *
1226
+ */
1227
+ enableSaveCardConsentCheckbox(): void;
1218
1228
  }
1219
1229
 
1220
1230
  interface ITriggerData {
@@ -1243,6 +1253,7 @@ interface ITriggerData {
1243
1253
  * @param {string} REFRESH_CHECKOUT=refresh_checkout
1244
1254
  * @param {string} UPDATE_FORM_VALUES=update_form_values
1245
1255
  * @param {string} INIT_CHECKOUT=init_checkout
1256
+ * @param {string} INJECT_CUSTOMER_DATA=inject_customer_data
1246
1257
  */
1247
1258
  declare const TRIGGER: {
1248
1259
  SUBMIT_FORM: string;
@@ -1252,6 +1263,7 @@ declare const TRIGGER: {
1252
1263
  REFRESH_CHECKOUT: string;
1253
1264
  UPDATE_FORM_VALUES: string;
1254
1265
  INIT_CHECKOUT: string;
1266
+ INJECT_CUSTOMER_DATA: string;
1255
1267
  };
1256
1268
  declare class Trigger {
1257
1269
  protected iFrame: IFrame;
@@ -2899,6 +2911,12 @@ interface Customer {
2899
2911
  first_name?: string;
2900
2912
  last_name?: string;
2901
2913
  }
2914
+ interface DpaConfig {
2915
+ dpa_id: string;
2916
+ dpa_name: string;
2917
+ dpa_supported_card_schemes: ('MASTERCARD' | 'VISA' | 'AMEX' | 'DISCOVER')[];
2918
+ mode: 'sandbox' | 'live';
2919
+ }
2902
2920
  interface IClickToPayMeta extends IBaseSRCMeta {
2903
2921
  dpa_data?: IBaseSRCMeta['dpa_data'] & {
2904
2922
  dpa_address?: string;
@@ -2927,6 +2945,8 @@ interface IClickToPayMeta extends IBaseSRCMeta {
2927
2945
  customer?: Customer;
2928
2946
  unaccepted_card_type?: 'CREDIT' | 'DEBIT';
2929
2947
  recognition_token?: string;
2948
+ dpa_config?: DpaConfig;
2949
+ hold_for_customer_data?: boolean;
2930
2950
  }
2931
2951
  type MASTERCARD_DPA_SHIPPING_BILLING_PREFERENCE = 'FULL' | 'POSTAL_COUNTRY' | 'NONE';
2932
2952
  type MASTERCARD_ORDER_TYPE = 'SPLIT_SHIPMENT' | 'PREFERRED_CARD';
@@ -3077,6 +3097,8 @@ declare class ApiInternal extends ApiBase {
3077
3097
  gateway(): ApiGatewayInternal;
3078
3098
  }
3079
3099
 
3100
+ type CustomerData = Customer;
3101
+
3080
3102
  interface SRCProvider {
3081
3103
  load(): void;
3082
3104
  getEnv(): string;
@@ -3086,6 +3108,7 @@ interface SRCProvider {
3086
3108
  showCheckout?(): void;
3087
3109
  reload(): void;
3088
3110
  useAutoResize?(): void;
3111
+ injectCustomerData(customerData: CustomerData): void;
3089
3112
  }
3090
3113
 
3091
3114
  declare abstract class SRC {
@@ -3189,12 +3212,34 @@ declare class ClickToPay extends SRC {
3189
3212
  protected service_id: string;
3190
3213
  protected public_key_or_access_token: string;
3191
3214
  protected meta: IClickToPayMeta;
3215
+ protected holdingForCustomerData: boolean;
3216
+ private pendingCustomerData;
3192
3217
  /** @constructs */ constructor(iframe_selector: string, service_id: string, public_key_or_access_token: string, meta: IClickToPayMeta);
3193
3218
  /**
3194
3219
  * The final method after configuring the SRC to start the load process of Click To Pay checkout
3195
- *
3196
3220
  */
3197
3221
  load(): void;
3222
+ /**
3223
+ * Inject customer data after widget initialization via postMessage
3224
+ *
3225
+ * @param {Customer} customerData - Customer data to inject
3226
+ * @throws {Error} When customer data is invalid or widget is not ready
3227
+ * @example
3228
+ * widget.injectCustomerData({
3229
+ * email: 'user@example.com',
3230
+ * first_name: 'John',
3231
+ * last_name: 'Doe'
3232
+ * });
3233
+ */
3234
+ injectCustomerData(customerData: Customer): void;
3235
+ /**
3236
+ * Validate customer data format
3237
+ *
3238
+ * @private
3239
+ * @param {Customer} customerData - Customer data to validate
3240
+ * @returns {boolean} True if valid
3241
+ */
3242
+ private validateCustomerData;
3198
3243
  }
3199
3244
 
3200
3245
  declare class VaultDisplayIframeEvent extends IFrameEvent {
@@ -3408,7 +3453,7 @@ interface IWalletUpdateData {
3408
3453
  success: boolean;
3409
3454
  }
3410
3455
  /**
3411
- * Class WalletButtons to work with different E-Wallets within html (currently supports Apple Pay, Google Pay, Google Pay™ and Apple Pay via Stripe, Flypay, Flypay V2, Paypal, Afterpay)
3456
+ * Class WalletButtons to work with different E-Wallets within html (currently supports Apple Pay, Google Pay, Google Pay™ and Apple Pay via Stripe, Flypay V2, Paypal, Afterpay)
3412
3457
  * @constructor
3413
3458
  *
3414
3459
  * @example
@@ -3443,7 +3488,7 @@ declare class WalletButtons {
3443
3488
  load(): void;
3444
3489
  /**
3445
3490
  * Triggers the update process of the wallet, if available.
3446
- * Currently supported by Flypay, Paypal and ApplePay/GooglePay via MPGS Wallets.
3491
+ * Currently supported by Paypal and ApplePay/GooglePay via MPGS Wallets.
3447
3492
  *
3448
3493
  * @example
3449
3494
  * var button = new WalletButtons(