@paydock/client-sdk 1.142.0 → 1.144.0-beta

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (92) hide show
  1. package/README.md +243 -0
  2. package/bundles/index.cjs +846 -504
  3. package/bundles/index.cjs.d.ts +1466 -778
  4. package/bundles/index.mjs +675 -338
  5. package/bundles/index.mjs.d.ts +1466 -778
  6. package/bundles/types/api/api-charge-internal.d.ts +3 -49
  7. package/bundles/types/api/api-charge-internal.d.ts.map +1 -1
  8. package/bundles/types/api/api-checkout-internal.d.ts +1 -47
  9. package/bundles/types/api/api-checkout-internal.d.ts.map +1 -1
  10. package/bundles/types/api/api-shared-types.d.ts +53 -0
  11. package/bundles/types/api/api-shared-types.d.ts.map +1 -0
  12. package/bundles/types/canvas-3ds/canvas-3ds-event-map.d.ts +95 -0
  13. package/bundles/types/canvas-3ds/canvas-3ds-event-map.d.ts.map +1 -0
  14. package/bundles/types/canvas-3ds/canvas-3ds.d.ts +10 -7
  15. package/bundles/types/canvas-3ds/canvas-3ds.d.ts.map +1 -1
  16. package/bundles/types/canvas-3ds/index.d.ts +4 -0
  17. package/bundles/types/canvas-3ds/index.d.ts.map +1 -1
  18. package/bundles/types/canvas-3ds/services/gpayments-service.d.ts +41 -12
  19. package/bundles/types/canvas-3ds/services/gpayments-service.d.ts.map +1 -1
  20. package/bundles/types/canvas-3ds/services/standalone3ds-service.d.ts +20 -2
  21. package/bundles/types/canvas-3ds/services/standalone3ds-service.d.ts.map +1 -1
  22. package/bundles/types/checkout/checkout-event-map.d.ts +43 -0
  23. package/bundles/types/checkout/checkout-event-map.d.ts.map +1 -0
  24. package/bundles/types/checkout/checkout.d.ts +25 -9
  25. package/bundles/types/checkout/checkout.d.ts.map +1 -1
  26. package/bundles/types/checkout/v1/instructions/instruction.canvas_3ds.show.d.ts.map +1 -1
  27. package/bundles/types/checkout/v3/instructions/instruction.canvas_3ds.show.d.ts.map +1 -1
  28. package/bundles/types/components/apple-pay-version.d.ts +29 -0
  29. package/bundles/types/components/apple-pay-version.d.ts.map +1 -0
  30. package/bundles/types/components/param.d.ts +29 -0
  31. package/bundles/types/components/param.d.ts.map +1 -1
  32. package/bundles/types/helper/event-error.d.ts +49 -1
  33. package/bundles/types/helper/event-error.d.ts.map +1 -1
  34. package/bundles/types/index-cba.d.ts +3 -1
  35. package/bundles/types/index-cba.d.ts.map +1 -1
  36. package/bundles/types/index.d.ts +14 -3
  37. package/bundles/types/index.d.ts.map +1 -1
  38. package/bundles/types/open-wallets/base/open-wallet-buttons.d.ts +37 -0
  39. package/bundles/types/open-wallets/base/open-wallet-buttons.d.ts.map +1 -1
  40. package/bundles/types/open-wallets/base/open-wallet.service.d.ts +12 -0
  41. package/bundles/types/open-wallets/base/open-wallet.service.d.ts.map +1 -1
  42. package/bundles/types/open-wallets/google-pay-open-wallet-button.d.ts.map +1 -1
  43. package/bundles/types/open-wallets/index.d.ts +26 -1
  44. package/bundles/types/open-wallets/index.d.ts.map +1 -1
  45. package/bundles/types/open-wallets/interfaces/apple-pay/apple-pay-payment-request.interface.d.ts +2 -2
  46. package/bundles/types/open-wallets/interfaces/apple-pay/apple-pay-payment-request.interface.d.ts.map +1 -1
  47. package/bundles/types/open-wallets/interfaces/apple-pay/index.d.ts +1 -1
  48. package/bundles/types/open-wallets/interfaces/apple-pay/index.d.ts.map +1 -1
  49. package/bundles/types/open-wallets/interfaces/events.interface.d.ts +1 -1
  50. package/bundles/types/open-wallets/interfaces/events.interface.d.ts.map +1 -1
  51. package/bundles/types/open-wallets/interfaces/google-pay/google-pay-meta.interface.d.ts +46 -0
  52. package/bundles/types/open-wallets/interfaces/google-pay/google-pay-meta.interface.d.ts.map +1 -1
  53. package/bundles/types/open-wallets/services/apple-pay/apple-pay.open-wallet.service.d.ts +48 -2
  54. package/bundles/types/open-wallets/services/apple-pay/apple-pay.open-wallet.service.d.ts.map +1 -1
  55. package/bundles/types/open-wallets/services/google-pay/google-pay.open-wallet.service.d.ts.map +1 -1
  56. package/bundles/types/open-wallets/types/index.d.ts +1 -1
  57. package/bundles/types/open-wallets/types/index.d.ts.map +1 -1
  58. package/bundles/types/open-wallets/types/payment-source.type.d.ts +104 -0
  59. package/bundles/types/open-wallets/types/payment-source.type.d.ts.map +1 -1
  60. package/bundles/types/payment-source-widget/index.d.ts +1 -1
  61. package/bundles/types/payment-source-widget/index.d.ts.map +1 -1
  62. package/bundles/types/vault-display-widget/vault-display-widget.d.ts.map +1 -1
  63. package/bundles/types/wallet-buttons/interfaces.d.ts +55 -1
  64. package/bundles/types/wallet-buttons/interfaces.d.ts.map +1 -1
  65. package/bundles/types/wallet-buttons/wallet-services/apple.wallet-service.d.ts.map +1 -1
  66. package/bundles/types/wallet-buttons-express/base.wallet-button-express.d.ts +16 -0
  67. package/bundles/types/wallet-buttons-express/base.wallet-button-express.d.ts.map +1 -1
  68. package/bundles/types/wallet-buttons-express/index.d.ts +36 -0
  69. package/bundles/types/wallet-buttons-express/index.d.ts.map +1 -1
  70. package/bundles/types/wallet-buttons-express/interfaces/base-wallet-meta.interface.d.ts +7 -0
  71. package/bundles/types/wallet-buttons-express/interfaces/base-wallet-meta.interface.d.ts.map +1 -1
  72. package/bundles/types/wallet-buttons-express/services/apple-pay/apple-pay.wallet-button-express.d.ts.map +1 -1
  73. package/bundles/types/wallet-buttons-express/services/apple-pay/interfaces/apple-pay-wallet-meta.interface.d.ts +23 -0
  74. package/bundles/types/wallet-buttons-express/services/apple-pay/interfaces/apple-pay-wallet-meta.interface.d.ts.map +1 -1
  75. package/bundles/types/wallet-buttons-express/services/paypal/interfaces/paypal-wallet-meta.interface.d.ts +31 -0
  76. package/bundles/types/wallet-buttons-express/services/paypal/interfaces/paypal-wallet-meta.interface.d.ts.map +1 -1
  77. package/bundles/types/wallet-buttons-express/services/paypal/paypal.wallet-button-express.d.ts +1 -1
  78. package/bundles/types/wallet-buttons-express/services/paypal/paypal.wallet-button-express.d.ts.map +1 -1
  79. package/bundles/types/widget/html-multi-widget.d.ts +4 -1
  80. package/bundles/types/widget/html-multi-widget.d.ts.map +1 -1
  81. package/bundles/types/widget/index.d.ts +2 -1
  82. package/bundles/types/widget/index.d.ts.map +1 -1
  83. package/bundles/types/widget/widget-event-map.d.ts +37 -0
  84. package/bundles/types/widget/widget-event-map.d.ts.map +1 -0
  85. package/bundles/widget.umd.js +846 -504
  86. package/bundles/widget.umd.js.d.ts +1466 -778
  87. package/bundles/widget.umd.js.min.d.ts +1466 -778
  88. package/bundles/widget.umd.min.js +1 -1
  89. package/docs/api-canvas3ds.md +19 -12
  90. package/docs/open-wallet-buttons.md +158 -0
  91. package/docs/wallet-buttons-express.md +85 -0
  92. package/package.json +6 -3
@@ -1198,7 +1198,7 @@
1198
1198
  version: 'x-sdk-version',
1199
1199
  type: 'x-sdk-type'
1200
1200
  });
1201
- SDK._version = 'v1.142.0';
1201
+ SDK._version = 'v1.144.0-beta';
1202
1202
 
1203
1203
  function isFunction(value) {
1204
1204
  return typeof value === 'function';
@@ -4808,127 +4808,162 @@
4808
4808
  }]);
4809
4809
  }(ApiBase);
4810
4810
 
4811
- var Url = /*#__PURE__*/function () {
4812
- function Url() {
4813
- _classCallCheck(this, Url);
4811
+ var WALLET_CAPTURE_LINK = '/v1/charges/wallet/capture';
4812
+ var WALLET_CALLBACK_LINK = '/v1/charges/wallet/callback';
4813
+ var STANDALONE_3DS_PROCESS_LINK = '/v1/charges/standalone-3ds/process';
4814
+ var STANDALONE_3DS_HANDLE_LINK = '/v1/charges/standalone-3ds/handle';
4815
+ var ApiChargeInternal = /*#__PURE__*/function () {
4816
+ function ApiChargeInternal(api) {
4817
+ _classCallCheck(this, ApiChargeInternal);
4818
+ this.api = api;
4814
4819
  }
4815
- return _createClass(Url, null, [{
4816
- key: "extendSearchParams",
4817
- value: function extendSearchParams(uri, key, val) {
4818
- return uri.replace(new RegExp("([?&]" + key + "(?=[=&#]|$)[^#&]*|(?=#|$))"), "&" + key + "=" + encodeURIComponent(val)).replace(/^([^?&]+)&/, "$1?");
4820
+ return _createClass(ApiChargeInternal, [{
4821
+ key: "walletCapture",
4822
+ value: function walletCapture(payload) {
4823
+ return this.api.getClientPromise('POST', WALLET_CAPTURE_LINK).send(payload);
4819
4824
  }
4820
4825
  }, {
4821
- key: "serialize",
4822
- value: function serialize(params) {
4823
- return Object.keys(params).map(function (key) {
4824
- return encodeURIComponent(key) + '=' + encodeURIComponent(params[key]);
4825
- }).join('&');
4826
+ key: "walletCallback",
4827
+ value: function walletCallback(payload) {
4828
+ return this.api.getClientPromise('POST', WALLET_CALLBACK_LINK).send(payload);
4829
+ }
4830
+ }, {
4831
+ key: "standalone3dsProcess",
4832
+ value: function standalone3dsProcess(payload) {
4833
+ return this.api.getClientPromise('POST', STANDALONE_3DS_PROCESS_LINK).send(payload);
4834
+ }
4835
+ }, {
4836
+ key: "standalone3dsHandle",
4837
+ value: function standalone3dsHandle() {
4838
+ return this.api.getClientPromise('GET', STANDALONE_3DS_HANDLE_LINK).send(undefined);
4826
4839
  }
4827
4840
  }]);
4828
4841
  }();
4829
4842
 
4830
- var Uuid = /*#__PURE__*/function () {
4831
- function Uuid() {
4832
- _classCallCheck(this, Uuid);
4843
+ var CALLBACK_LINK = '/v1/checkouts/callback';
4844
+ var INSTRUCTION_LINK = '/v1/checkouts/instruction';
4845
+ var STATUS_LINK = '/v1/checkouts';
4846
+ var ApiCheckoutInternal = /*#__PURE__*/function () {
4847
+ function ApiCheckoutInternal(api) {
4848
+ _classCallCheck(this, ApiCheckoutInternal);
4849
+ this.api = api;
4850
+ this.getInstructionLink = function () {
4851
+ return "".concat(INSTRUCTION_LINK, "?time=").concat(Date.now());
4852
+ };
4833
4853
  }
4834
- return _createClass(Uuid, null, [{
4835
- key: "generate",
4836
- value: function generate() {
4837
- if (typeof window !== "undefined" && typeof window.crypto !== "undefined" && typeof window.crypto.getRandomValues !== "undefined") {
4838
- var buf = new Uint16Array(8);
4839
- window.crypto.getRandomValues(buf);
4840
- return this.hash(buf[0]) + this.hash(buf[1]) + "-" + this.hash(buf[2]) + "-" + this.hash(buf[3]) + "-" + this.hash(buf[4]) + "-" + this.hash(buf[5]) + this.hash(buf[6]) + this.hash(buf[7]);
4841
- } else {
4842
- return this.random() + this.random() + "-" + this.random() + "-" + this.random() + "-" + this.random() + "-" + this.random() + this.random() + this.random();
4843
- }
4854
+ return _createClass(ApiCheckoutInternal, [{
4855
+ key: "instructions",
4856
+ value: function instructions() {
4857
+ return this.api.requestObservable('GET', this.getInstructionLink(), {});
4844
4858
  }
4845
4859
  }, {
4846
- key: "hash",
4847
- value: function hash(number) {
4848
- var hash = number.toString(16);
4849
- while (hash.length < 4) {
4850
- hash = "0" + hash;
4851
- }
4852
- return hash;
4860
+ key: "callback",
4861
+ value: function callback(payload) {
4862
+ return this.api.getClientPromise('POST', CALLBACK_LINK).send(payload);
4853
4863
  }
4854
4864
  }, {
4855
- key: "random",
4856
- value: function random() {
4857
- return Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1);
4865
+ key: "status",
4866
+ value: function status(id) {
4867
+ return this.api.getClientPromise('GET', "".concat(STATUS_LINK, "/").concat(id)).send('');
4858
4868
  }
4859
4869
  }]);
4860
4870
  }();
4861
4871
 
4862
- var WIDGET_LINK = '/remote-action';
4863
- var VAULT_DISPLAY_WIDGET_LINK = '/vault-display';
4864
- var PAYMENT_SOURCE_LINK = '/payment-sources';
4865
- var SECURE_3D = '/3ds/webhook';
4866
- var FLYPAY_LINK = '/wallet/flypay';
4867
- var FLYPAY_LOGO_LINK = '/images/coles-pay-logo.png';
4868
- var MESSAGE_WIDGET_LINK = '/message-widget';
4869
- var MASTERCARD_SRC = '/secure-remote-commerce/mastercard';
4870
- var Link = /*#__PURE__*/function () {
4871
- function Link(linkResource) {
4872
- _classCallCheck(this, Link);
4873
- this.params = {};
4874
- this.widgetId = Uuid.generate();
4875
- this.linkResource = linkResource;
4876
- this.env = new Env(WIDGET_URL);
4877
- this.setParams({
4878
- widget_id: this.widgetId
4879
- });
4872
+ var GET_WALLET_CONFIG = '/v1/gateways/:gateway_id/wallet-config';
4873
+ var ApiGatewayInternal = /*#__PURE__*/function () {
4874
+ function ApiGatewayInternal(api) {
4875
+ _classCallCheck(this, ApiGatewayInternal);
4876
+ this.api = api;
4880
4877
  }
4881
- return _createClass(Link, [{
4882
- key: "getNetUrl",
4883
- value: function getNetUrl() {
4884
- return this.env.getConf().url + this.linkResource;
4878
+ return _createClass(ApiGatewayInternal, [{
4879
+ key: "getWalletConfig",
4880
+ value: function getWalletConfig(gateway_id) {
4881
+ var url = GET_WALLET_CONFIG.replace(':gateway_id', gateway_id);
4882
+ return this.api.getClientPromise('GET', url).send(undefined);
4885
4883
  }
4886
- }, {
4887
- key: "getUrl",
4888
- value: function getUrl() {
4889
- var url = this.getNetUrl();
4890
- var params = this.getParams();
4891
- for (var key in params) {
4892
- if (params.hasOwnProperty(key)) url = Url.extendSearchParams(url, key, params[key]);
4893
- }
4894
- return url;
4884
+ }]);
4885
+ }();
4886
+
4887
+ var CREATE_OTT = '/v1/payment_sources/tokens';
4888
+ var CREATE_SESSION = '/v1/payment_sources/payment-session';
4889
+ var ApiPaymentSourceInternal = /*#__PURE__*/function () {
4890
+ function ApiPaymentSourceInternal(api) {
4891
+ _classCallCheck(this, ApiPaymentSourceInternal);
4892
+ this.api = api;
4893
+ }
4894
+ return _createClass(ApiPaymentSourceInternal, [{
4895
+ key: "createOTT",
4896
+ value: function createOTT(payload) {
4897
+ return this.api.getClientPromise('POST', CREATE_OTT).send(payload);
4895
4898
  }
4896
4899
  }, {
4897
- key: "setParams",
4898
- value: function setParams(params) {
4899
- this.params = _extends({}, this.params, params);
4900
+ key: "createSession",
4901
+ value: function createSession(payload) {
4902
+ return this.api.getClientPromise('POST', CREATE_SESSION).send(payload);
4900
4903
  }
4901
- }, {
4902
- key: "concatParams",
4903
- value: function concatParams(params) {
4904
- for (var key in params) {
4905
- if (!params.hasOwnProperty(key) || !params[key].length) continue;
4906
- if (typeof this.params[key] !== 'string') this.params[key] = '';
4907
- if (this.params[key].length) this.params[key] += ',' + params[key];else this.params[key] += params[key];
4908
- }
4904
+ }]);
4905
+ }();
4906
+
4907
+ var GET_CONFIG = '/v1/services/:service_id/config';
4908
+ var ApiServiceInternal = /*#__PURE__*/function () {
4909
+ function ApiServiceInternal(api) {
4910
+ _classCallCheck(this, ApiServiceInternal);
4911
+ this.api = api;
4912
+ }
4913
+ return _createClass(ApiServiceInternal, [{
4914
+ key: "getConfig",
4915
+ value: function getConfig(service_id) {
4916
+ var url = GET_CONFIG.replace(':service_id', service_id);
4917
+ return this.api.getClientPromise('GET', url).send(undefined);
4918
+ }
4919
+ }]);
4920
+ }();
4921
+ var SERVICE_TYPES;
4922
+ (function (SERVICE_TYPES) {
4923
+ SERVICE_TYPES["ACCERTIFY"] = "Accertify";
4924
+ SERVICE_TYPES["BOOKING"] = "Booking";
4925
+ SERVICE_TYPES["GPAYMENTS"] = "GPayments";
4926
+ SERVICE_TYPES["CLICK_TO_PAY"] = "ClickToPay";
4927
+ SERVICE_TYPES["MASTERCARD_NT"] = "MastercardSCOF";
4928
+ SERVICE_TYPES["VISA_NT"] = "VisaVTS";
4929
+ SERVICE_TYPES["FORTER"] = "Forter";
4930
+ SERVICE_TYPES["APPLE_PAY"] = "ApplePay";
4931
+ SERVICE_TYPES["GOOGLE_PAY"] = "GooglePay";
4932
+ })(SERVICE_TYPES || (SERVICE_TYPES = {}));
4933
+
4934
+ var ApiInternal = /*#__PURE__*/function (_ApiBase) {
4935
+ function ApiInternal() {
4936
+ _classCallCheck(this, ApiInternal);
4937
+ return _callSuper(this, ApiInternal, arguments);
4938
+ }
4939
+ _inherits(ApiInternal, _ApiBase);
4940
+ return _createClass(ApiInternal, [{
4941
+ key: "charge",
4942
+ value: function charge() {
4943
+ return new ApiChargeInternal(this);
4909
4944
  }
4910
4945
  }, {
4911
- key: "getParams",
4912
- value: function getParams() {
4913
- return this.params;
4946
+ key: "service",
4947
+ value: function service() {
4948
+ return new ApiServiceInternal(this);
4914
4949
  }
4915
4950
  }, {
4916
- key: "setEnv",
4917
- value: function setEnv(env, alias) {
4918
- this.env.setEnv(env, alias);
4951
+ key: "checkout",
4952
+ value: function checkout() {
4953
+ return new ApiCheckoutInternal(this);
4919
4954
  }
4920
4955
  }, {
4921
- key: "getEnv",
4922
- value: function getEnv() {
4923
- return this.env.getEnv();
4956
+ key: "gateway",
4957
+ value: function gateway() {
4958
+ return new ApiGatewayInternal(this);
4924
4959
  }
4925
4960
  }, {
4926
- key: "getBaseUrl",
4927
- value: function getBaseUrl() {
4928
- return this.env.getConf().url;
4961
+ key: "paymentSource",
4962
+ value: function paymentSource() {
4963
+ return new ApiPaymentSourceInternal(this);
4929
4964
  }
4930
4965
  }]);
4931
- }();
4966
+ }(ApiBase);
4932
4967
 
4933
4968
  var IFrame = /*#__PURE__*/function () {
4934
4969
  function IFrame(container) {
@@ -5039,7 +5074,7 @@
5039
5074
  }]);
5040
5075
  }();
5041
5076
 
5042
- var EVENT$5 = {
5077
+ var EVENT$4 = {
5043
5078
  AFTER_LOAD: 'afterLoad',
5044
5079
  SUBMIT: 'submit',
5045
5080
  FINISH: 'finish',
@@ -5096,9 +5131,9 @@
5096
5131
  }, {
5097
5132
  key: "on",
5098
5133
  value: function on(eventName, widgetId, cb) {
5099
- for (var event in EVENT$5) {
5100
- if (!EVENT$5.hasOwnProperty(event)) continue;
5101
- if (eventName === EVENT$5[event]) {
5134
+ for (var event in EVENT$4) {
5135
+ if (!EVENT$4.hasOwnProperty(event)) continue;
5136
+ if (eventName === EVENT$4[event]) {
5102
5137
  this.listeners.push({
5103
5138
  event: eventName,
5104
5139
  listener: cb,
@@ -5125,10 +5160,10 @@
5125
5160
  }();
5126
5161
 
5127
5162
  var hiddenStyle = {
5128
- visibility: "hidden",
5129
- border: "0",
5130
- width: "0",
5131
- height: "0"
5163
+ visibility: 'hidden',
5164
+ border: '0',
5165
+ width: '0',
5166
+ height: '0'
5132
5167
  };
5133
5168
  var PROCESS_STANDALONE_3DS_STATUS;
5134
5169
  (function (PROCESS_STANDALONE_3DS_STATUS) {
@@ -5150,14 +5185,30 @@
5150
5185
  IFRAME_STATUS["TIMEOUT"] = "AuthTimedOut";
5151
5186
  IFRAME_STATUS["INVALID"] = "invalid_event";
5152
5187
  })(IFRAME_STATUS || (IFRAME_STATUS = {}));
5188
+ /**
5189
+ * Event name constants emitted during the Standalone 3DS (GPayments) flow.
5190
+ * Used internally by `GPaymentsService` and re-exported publicly as `CANVAS_3DS_EVENT`.
5191
+ */
5153
5192
  var GPAYMENTS_EVENT = {
5193
+ /** Authentication succeeded. Payload: `Canvas3dsAuthPayload`. */
5154
5194
  AUTH_SUCCESS: 'chargeAuthSuccess',
5195
+ /** Authentication failed — covers issuer rejection, iframe timeout (`AuthTimedOut`), and invalid-event outcomes. Payload: `Canvas3dsAuthPayload`. */
5155
5196
  AUTH_ERROR: 'chargeAuthReject',
5197
+ /** Decoupled authentication — issuer will authenticate out-of-band. Payload: `Canvas3dsAuthPayload`. */
5156
5198
  DECOUPLED: 'chargeAuthDecoupled',
5199
+ /** Challenge required — issuer demands user interaction. Payload: `Canvas3dsAuthPayload`. */
5157
5200
  CHALLENGE: 'chargeAuthChallenge',
5201
+ /** Informational signal emitted by the GPayments flow. Internal — not part of the public typed surface. */
5158
5202
  INFO: 'chargeAuthInfo',
5203
+ /** Error during the flow (network, parsing, etc.). Payload: `Canvas3dsErrorPayload`. */
5159
5204
  ERROR: 'error'
5160
5205
  };
5206
+ /**
5207
+ * Public alias for GPAYMENTS_EVENT. Same object reference — no behavioral change.
5208
+ * Prefer `CANVAS_3DS_EVENT` in public-facing code; `GPAYMENTS_EVENT` remains for
5209
+ * backwards-compatible internal usage.
5210
+ */
5211
+ var CANVAS_3DS_EVENT = GPAYMENTS_EVENT;
5161
5212
  var GPaymentsService = /*#__PURE__*/function () {
5162
5213
  function GPaymentsService(container, api, eventEmitter) {
5163
5214
  _classCallCheck(this, GPaymentsService);
@@ -5185,20 +5236,22 @@
5185
5236
  value: function initializeIFrames(initializationUrl, secondaryUrl, title) {
5186
5237
  var hideAuthorization = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
5187
5238
  var container = this.container.getElement();
5188
- if (!container) return;
5189
- var divAuthorization = document.createElement("div");
5190
- divAuthorization.setAttribute("id", "paydock_authorization_iframe");
5239
+ if (!container) {
5240
+ return;
5241
+ }
5242
+ var divAuthorization = document.createElement('div');
5243
+ divAuthorization.setAttribute('id', 'paydock_authorization_iframe');
5191
5244
  container.appendChild(divAuthorization);
5192
- this.browserAndChallengeContainer = new Container("#paydock_authorization_iframe");
5245
+ this.browserAndChallengeContainer = new Container('#paydock_authorization_iframe');
5193
5246
  this.iFrameAuthorization = new IFrame(this.browserAndChallengeContainer);
5194
5247
  this.iFrameAuthorization.load(initializationUrl, {
5195
5248
  title: title
5196
5249
  });
5197
5250
  if (secondaryUrl) {
5198
- var divSecondaryURL = document.createElement("div");
5199
- divSecondaryURL.setAttribute("id", "paydock_secondary_iframe");
5251
+ var divSecondaryURL = document.createElement('div');
5252
+ divSecondaryURL.setAttribute('id', 'paydock_secondary_iframe');
5200
5253
  container.appendChild(divSecondaryURL);
5201
- this.monitoringContainer = new Container("#paydock_secondary_iframe");
5254
+ this.monitoringContainer = new Container('#paydock_secondary_iframe');
5202
5255
  this.iFrameSecondaryUrl = new IFrame(this.monitoringContainer);
5203
5256
  this.iFrameSecondaryUrl.load(secondaryUrl, {
5204
5257
  title: title
@@ -5214,8 +5267,12 @@
5214
5267
  var hideAuthorization = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
5215
5268
  var _a;
5216
5269
  for (var prop in hiddenStyle) {
5217
- if (!hiddenStyle.hasOwnProperty(prop)) continue;
5218
- if (hideAuthorization) this.iFrameAuthorization.setStyle(prop, hiddenStyle[prop]);
5270
+ if (!Object.hasOwn(hiddenStyle, prop)) {
5271
+ continue;
5272
+ }
5273
+ if (hideAuthorization) {
5274
+ this.iFrameAuthorization.setStyle(prop, hiddenStyle[prop]);
5275
+ }
5219
5276
  (_a = this.iFrameSecondaryUrl) === null || _a === void 0 ? void 0 : _a.setStyle(prop, hiddenStyle[prop]);
5220
5277
  }
5221
5278
  }
@@ -5223,17 +5280,21 @@
5223
5280
  key: "setupIFrameEvents",
5224
5281
  value: function setupIFrameEvents(widgetId) {
5225
5282
  var _this = this;
5226
- this.iFrameEvent.on(EVENT$5.CHARGE_AUTH, widgetId, function (data) {
5283
+ this.iFrameEvent.on(EVENT$4.CHARGE_AUTH, widgetId, function (data) {
5227
5284
  if (data.status === IFRAME_STATUS.SKIPPED || data.status === IFRAME_STATUS.FINISHED) {
5228
- if (data.info) _this.eventEmitter.emit(GPAYMENTS_EVENT.INFO, {
5229
- info: data.info
5230
- });
5285
+ if (data.info) {
5286
+ _this.eventEmitter.emit(GPAYMENTS_EVENT.INFO, {
5287
+ info: data.info
5288
+ });
5289
+ }
5231
5290
  _this.performAuthentication(data);
5232
- } else if (data.status === IFRAME_STATUS.TIMEOUT || data.status === IFRAME_STATUS.INVALID) _this.eventEmitter.emit(GPAYMENTS_EVENT.AUTH_ERROR, _this.parseHandleResponse({
5233
- status: data.status
5234
- }, data.charge_3ds_id));
5291
+ } else if (data.status === IFRAME_STATUS.TIMEOUT || data.status === IFRAME_STATUS.INVALID) {
5292
+ _this.eventEmitter.emit(GPAYMENTS_EVENT.AUTH_ERROR, _this.parseHandleResponse({
5293
+ status: data.status
5294
+ }, data.charge_3ds_id));
5295
+ }
5235
5296
  });
5236
- this.iFrameEvent.on(EVENT$5.CHARGE_AUTH_SUCCESS, widgetId, function (data) {
5297
+ this.iFrameEvent.on(EVENT$4.CHARGE_AUTH_SUCCESS, widgetId, function (data) {
5237
5298
  _this.processResult(data.charge_3ds_id);
5238
5299
  });
5239
5300
  }
@@ -5271,13 +5332,19 @@
5271
5332
  key: "processResult",
5272
5333
  value: function processResult(charge3dsId) {
5273
5334
  var _this2 = this;
5274
- if (this.resultRead) return;
5335
+ if (this.resultRead) {
5336
+ return;
5337
+ }
5275
5338
  this.resultRead = true;
5276
5339
  this.api.charge().standalone3dsHandle().then(function (result) {
5277
5340
  var _a;
5278
5341
  _this2.iFrameAuthorization.remove();
5279
5342
  (_a = _this2.iFrameSecondaryUrl) === null || _a === void 0 ? void 0 : _a.remove();
5280
- if (result.status === PROCESS_STANDALONE_3DS_STATUS.SUCCESS) _this2.eventEmitter.emit(GPAYMENTS_EVENT.AUTH_SUCCESS, _this2.parseResultData(result, charge3dsId));else _this2.eventEmitter.emit(GPAYMENTS_EVENT.AUTH_ERROR, _this2.parseResultData(result, charge3dsId));
5343
+ if (result.status === PROCESS_STANDALONE_3DS_STATUS.SUCCESS) {
5344
+ _this2.eventEmitter.emit(GPAYMENTS_EVENT.AUTH_SUCCESS, _this2.parseResultData(result, charge3dsId));
5345
+ } else {
5346
+ _this2.eventEmitter.emit(GPAYMENTS_EVENT.AUTH_ERROR, _this2.parseResultData(result, charge3dsId));
5347
+ }
5281
5348
  }, function (err) {
5282
5349
  _this2.eventEmitter.emit(GPAYMENTS_EVENT.ERROR, _this2.parseError(err, charge3dsId));
5283
5350
  });
@@ -5302,10 +5369,16 @@
5302
5369
  key: "doPolling",
5303
5370
  value: function doPolling(url, charge3dsId) {
5304
5371
  var _this3 = this;
5305
- this.externalAPI("GET", url).then(function (data) {
5306
- if (!data.event || data.event === "AuthResultNotReady") setTimeout(function () {
5307
- _this3.doPolling(url, charge3dsId);
5308
- }, 2000);else if (data.event === 'AuthResultReady') _this3.processResult(charge3dsId);else throw new Error("Event not supported");
5372
+ this.externalAPI('GET', url).then(function (data) {
5373
+ if (!data.event || data.event === 'AuthResultNotReady') {
5374
+ setTimeout(function () {
5375
+ _this3.doPolling(url, charge3dsId);
5376
+ }, 2000);
5377
+ } else if (data.event === 'AuthResultReady') {
5378
+ _this3.processResult(charge3dsId);
5379
+ } else {
5380
+ throw new Error('Event not supported');
5381
+ }
5309
5382
  })["catch"](function (err) {
5310
5383
  return _this3.eventEmitter.emit(GPAYMENTS_EVENT.ERROR, _this3.parseError(err, charge3dsId));
5311
5384
  });
@@ -5322,16 +5395,24 @@
5322
5395
  charge_3ds_id: charge_3ds_id
5323
5396
  }).then(function (authenticationResult) {
5324
5397
  var _a, _b;
5325
- if (authenticationResult.status === AUTHENTICATION_STATUS.SUCCESS) _this4.eventEmitter.emit(GPAYMENTS_EVENT.AUTH_SUCCESS, _this4.parseHandleResponse(authenticationResult, charge_3ds_id));else if (authenticationResult.status === AUTHENTICATION_STATUS.PENDING) {
5398
+ if (authenticationResult.status === AUTHENTICATION_STATUS.SUCCESS) {
5399
+ _this4.eventEmitter.emit(GPAYMENTS_EVENT.AUTH_SUCCESS, _this4.parseHandleResponse(authenticationResult, charge_3ds_id));
5400
+ } else if (authenticationResult.status === AUTHENTICATION_STATUS.PENDING) {
5326
5401
  if ((_a = authenticationResult === null || authenticationResult === void 0 ? void 0 : authenticationResult.result) === null || _a === void 0 ? void 0 : _a.challenge) {
5327
5402
  _this4.eventEmitter.emit(GPAYMENTS_EVENT.CHALLENGE, _this4.parseHandleResponse(authenticationResult, charge_3ds_id));
5328
5403
  _this4.initializeIFrames(authenticationResult.result.challenge_url, undefined, 'Authentication Challenge', false);
5329
- if (authenticationResult.result.secondary_url) _this4.doPolling(authenticationResult.result.secondary_url, charge_3ds_id);
5404
+ if (authenticationResult.result.secondary_url) {
5405
+ _this4.doPolling(authenticationResult.result.secondary_url, charge_3ds_id);
5406
+ }
5330
5407
  } else if ((_b = authenticationResult === null || authenticationResult === void 0 ? void 0 : authenticationResult.result) === null || _b === void 0 ? void 0 : _b.decoupled_challenge) {
5331
5408
  _this4.eventEmitter.emit(GPAYMENTS_EVENT.DECOUPLED, _this4.parseHandleResponse(authenticationResult, charge_3ds_id));
5332
- if (authenticationResult.result.secondary_url) _this4.doPolling(authenticationResult.result.secondary_url, charge_3ds_id);
5409
+ if (authenticationResult.result.secondary_url) {
5410
+ _this4.doPolling(authenticationResult.result.secondary_url, charge_3ds_id);
5411
+ }
5333
5412
  }
5334
- } else return _this4.eventEmitter.emit(GPAYMENTS_EVENT.AUTH_ERROR, _this4.parseHandleResponse(authenticationResult, charge_3ds_id));
5413
+ } else {
5414
+ return _this4.eventEmitter.emit(GPAYMENTS_EVENT.AUTH_ERROR, _this4.parseHandleResponse(authenticationResult, charge_3ds_id));
5415
+ }
5335
5416
  }, function (err) {
5336
5417
  _this4.eventEmitter.emit(GPAYMENTS_EVENT.ERROR, _this4.parseError(err, charge_3ds_id));
5337
5418
  });
@@ -5339,192 +5420,159 @@
5339
5420
  }]);
5340
5421
  }();
5341
5422
 
5342
- var WALLET_CAPTURE_LINK = '/v1/charges/wallet/capture';
5343
- var WALLET_CALLBACK_LINK = '/v1/charges/wallet/callback';
5344
- var STANDALONE_3DS_PROCESS_LINK = '/v1/charges/standalone-3ds/process';
5345
- var STANDALONE_3DS_HANDLE_LINK = '/v1/charges/standalone-3ds/handle';
5346
- var ApiChargeInternal = /*#__PURE__*/function () {
5347
- function ApiChargeInternal(api) {
5348
- _classCallCheck(this, ApiChargeInternal);
5349
- this.api = api;
5423
+ var STANDALONE_3DS_GATEWAYS = {
5424
+ GPAYMENTS: 'GPayments'
5425
+ };
5426
+ var Standalone3dsService = /*#__PURE__*/function () {
5427
+ function Standalone3dsService(container, eventEmitter) {
5428
+ _classCallCheck(this, Standalone3dsService);
5429
+ this.env = DEFAULT_ENV;
5430
+ this.container = container;
5431
+ this.eventEmitter = eventEmitter;
5350
5432
  }
5351
- return _createClass(ApiChargeInternal, [{
5352
- key: "walletCapture",
5353
- value: function walletCapture(payload) {
5354
- return this.api.getClientPromise('POST', WALLET_CAPTURE_LINK).send(payload);
5355
- }
5356
- }, {
5357
- key: "walletCallback",
5358
- value: function walletCallback(payload) {
5359
- return this.api.getClientPromise('POST', WALLET_CALLBACK_LINK).send(payload);
5360
- }
5361
- }, {
5362
- key: "standalone3dsProcess",
5363
- value: function standalone3dsProcess(payload) {
5364
- return this.api.getClientPromise('POST', STANDALONE_3DS_PROCESS_LINK).send(payload);
5433
+ return _createClass(Standalone3dsService, [{
5434
+ key: "load",
5435
+ value: function load(token, options) {
5436
+ var parsedToken = AccessToken.validateJWT(token);
5437
+ if (!parsedToken) {
5438
+ throw new Error('Invalid charge token');
5439
+ }
5440
+ var tokenData = AccessToken.extractData(parsedToken.body);
5441
+ var api = new ApiInternal(token, API_AUTH_TYPE.TOKEN);
5442
+ api.setEnv(this.env, this.alias);
5443
+ switch (tokenData.service_type) {
5444
+ case STANDALONE_3DS_GATEWAYS.GPAYMENTS:
5445
+ new GPaymentsService(this.container, api, this.eventEmitter).load(tokenData, options.title);
5446
+ break;
5447
+ }
5365
5448
  }
5366
5449
  }, {
5367
- key: "standalone3dsHandle",
5368
- value: function standalone3dsHandle() {
5369
- return this.api.getClientPromise('GET', STANDALONE_3DS_HANDLE_LINK).send(undefined);
5450
+ key: "setEnv",
5451
+ value: function setEnv(env, alias) {
5452
+ this.env = env;
5453
+ this.alias = alias;
5370
5454
  }
5371
5455
  }]);
5372
5456
  }();
5373
5457
 
5374
- var CALLBACK_LINK = '/v1/checkouts/callback';
5375
- var INSTRUCTION_LINK = '/v1/checkouts/instruction';
5376
- var STATUS_LINK = '/v1/checkouts';
5377
- var ApiCheckoutInternal = /*#__PURE__*/function () {
5378
- function ApiCheckoutInternal(api) {
5379
- _classCallCheck(this, ApiCheckoutInternal);
5380
- this.api = api;
5381
- this.getInstructionLink = function () {
5382
- return "".concat(INSTRUCTION_LINK, "?time=").concat(Date.now());
5383
- };
5458
+ var Url = /*#__PURE__*/function () {
5459
+ function Url() {
5460
+ _classCallCheck(this, Url);
5384
5461
  }
5385
- return _createClass(ApiCheckoutInternal, [{
5386
- key: "instructions",
5387
- value: function instructions() {
5388
- return this.api.requestObservable('GET', this.getInstructionLink(), {});
5389
- }
5390
- }, {
5391
- key: "callback",
5392
- value: function callback(payload) {
5393
- return this.api.getClientPromise('POST', CALLBACK_LINK).send(payload);
5462
+ return _createClass(Url, null, [{
5463
+ key: "extendSearchParams",
5464
+ value: function extendSearchParams(uri, key, val) {
5465
+ return uri.replace(new RegExp("([?&]" + key + "(?=[=&#]|$)[^#&]*|(?=#|$))"), "&" + key + "=" + encodeURIComponent(val)).replace(/^([^?&]+)&/, "$1?");
5394
5466
  }
5395
5467
  }, {
5396
- key: "status",
5397
- value: function status(id) {
5398
- return this.api.getClientPromise('GET', "".concat(STATUS_LINK, "/").concat(id)).send('');
5399
- }
5400
- }]);
5401
- }();
5402
-
5403
- var GET_WALLET_CONFIG = '/v1/gateways/:gateway_id/wallet-config';
5404
- var ApiGatewayInternal = /*#__PURE__*/function () {
5405
- function ApiGatewayInternal(api) {
5406
- _classCallCheck(this, ApiGatewayInternal);
5407
- this.api = api;
5408
- }
5409
- return _createClass(ApiGatewayInternal, [{
5410
- key: "getWalletConfig",
5411
- value: function getWalletConfig(gateway_id) {
5412
- var url = GET_WALLET_CONFIG.replace(':gateway_id', gateway_id);
5413
- return this.api.getClientPromise('GET', url).send(undefined);
5468
+ key: "serialize",
5469
+ value: function serialize(params) {
5470
+ return Object.keys(params).map(function (key) {
5471
+ return encodeURIComponent(key) + '=' + encodeURIComponent(params[key]);
5472
+ }).join('&');
5414
5473
  }
5415
5474
  }]);
5416
5475
  }();
5417
5476
 
5418
- var CREATE_OTT = '/v1/payment_sources/tokens';
5419
- var CREATE_SESSION = '/v1/payment_sources/payment-session';
5420
- var ApiPaymentSourceInternal = /*#__PURE__*/function () {
5421
- function ApiPaymentSourceInternal(api) {
5422
- _classCallCheck(this, ApiPaymentSourceInternal);
5423
- this.api = api;
5477
+ var Uuid = /*#__PURE__*/function () {
5478
+ function Uuid() {
5479
+ _classCallCheck(this, Uuid);
5424
5480
  }
5425
- return _createClass(ApiPaymentSourceInternal, [{
5426
- key: "createOTT",
5427
- value: function createOTT(payload) {
5428
- return this.api.getClientPromise('POST', CREATE_OTT).send(payload);
5481
+ return _createClass(Uuid, null, [{
5482
+ key: "generate",
5483
+ value: function generate() {
5484
+ if (typeof window !== "undefined" && typeof window.crypto !== "undefined" && typeof window.crypto.getRandomValues !== "undefined") {
5485
+ var buf = new Uint16Array(8);
5486
+ window.crypto.getRandomValues(buf);
5487
+ return this.hash(buf[0]) + this.hash(buf[1]) + "-" + this.hash(buf[2]) + "-" + this.hash(buf[3]) + "-" + this.hash(buf[4]) + "-" + this.hash(buf[5]) + this.hash(buf[6]) + this.hash(buf[7]);
5488
+ } else {
5489
+ return this.random() + this.random() + "-" + this.random() + "-" + this.random() + "-" + this.random() + "-" + this.random() + this.random() + this.random();
5490
+ }
5429
5491
  }
5430
5492
  }, {
5431
- key: "createSession",
5432
- value: function createSession(payload) {
5433
- return this.api.getClientPromise('POST', CREATE_SESSION).send(payload);
5493
+ key: "hash",
5494
+ value: function hash(number) {
5495
+ var hash = number.toString(16);
5496
+ while (hash.length < 4) {
5497
+ hash = "0" + hash;
5498
+ }
5499
+ return hash;
5434
5500
  }
5435
- }]);
5436
- }();
5437
-
5438
- var GET_CONFIG = '/v1/services/:service_id/config';
5439
- var ApiServiceInternal = /*#__PURE__*/function () {
5440
- function ApiServiceInternal(api) {
5441
- _classCallCheck(this, ApiServiceInternal);
5442
- this.api = api;
5443
- }
5444
- return _createClass(ApiServiceInternal, [{
5445
- key: "getConfig",
5446
- value: function getConfig(service_id) {
5447
- var url = GET_CONFIG.replace(':service_id', service_id);
5448
- return this.api.getClientPromise('GET', url).send(undefined);
5501
+ }, {
5502
+ key: "random",
5503
+ value: function random() {
5504
+ return Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1);
5449
5505
  }
5450
5506
  }]);
5451
5507
  }();
5452
- var SERVICE_TYPES;
5453
- (function (SERVICE_TYPES) {
5454
- SERVICE_TYPES["ACCERTIFY"] = "Accertify";
5455
- SERVICE_TYPES["BOOKING"] = "Booking";
5456
- SERVICE_TYPES["GPAYMENTS"] = "GPayments";
5457
- SERVICE_TYPES["CLICK_TO_PAY"] = "ClickToPay";
5458
- SERVICE_TYPES["MASTERCARD_NT"] = "MastercardSCOF";
5459
- SERVICE_TYPES["VISA_NT"] = "VisaVTS";
5460
- SERVICE_TYPES["FORTER"] = "Forter";
5461
- SERVICE_TYPES["APPLE_PAY"] = "ApplePay";
5462
- SERVICE_TYPES["GOOGLE_PAY"] = "GooglePay";
5463
- })(SERVICE_TYPES || (SERVICE_TYPES = {}));
5464
5508
 
5465
- var ApiInternal = /*#__PURE__*/function (_ApiBase) {
5466
- function ApiInternal() {
5467
- _classCallCheck(this, ApiInternal);
5468
- return _callSuper(this, ApiInternal, arguments);
5509
+ var WIDGET_LINK = '/remote-action';
5510
+ var VAULT_DISPLAY_WIDGET_LINK = '/vault-display';
5511
+ var PAYMENT_SOURCE_LINK = '/payment-sources';
5512
+ var SECURE_3D = '/3ds/webhook';
5513
+ var FLYPAY_LINK = '/wallet/flypay';
5514
+ var FLYPAY_LOGO_LINK = '/images/coles-pay-logo.png';
5515
+ var MESSAGE_WIDGET_LINK = '/message-widget';
5516
+ var MASTERCARD_SRC = '/secure-remote-commerce/mastercard';
5517
+ var Link = /*#__PURE__*/function () {
5518
+ function Link(linkResource) {
5519
+ _classCallCheck(this, Link);
5520
+ this.params = {};
5521
+ this.widgetId = Uuid.generate();
5522
+ this.linkResource = linkResource;
5523
+ this.env = new Env(WIDGET_URL);
5524
+ this.setParams({
5525
+ widget_id: this.widgetId
5526
+ });
5469
5527
  }
5470
- _inherits(ApiInternal, _ApiBase);
5471
- return _createClass(ApiInternal, [{
5472
- key: "charge",
5473
- value: function charge() {
5474
- return new ApiChargeInternal(this);
5528
+ return _createClass(Link, [{
5529
+ key: "getNetUrl",
5530
+ value: function getNetUrl() {
5531
+ return this.env.getConf().url + this.linkResource;
5475
5532
  }
5476
5533
  }, {
5477
- key: "service",
5478
- value: function service() {
5479
- return new ApiServiceInternal(this);
5534
+ key: "getUrl",
5535
+ value: function getUrl() {
5536
+ var url = this.getNetUrl();
5537
+ var params = this.getParams();
5538
+ for (var key in params) {
5539
+ if (params.hasOwnProperty(key)) url = Url.extendSearchParams(url, key, params[key]);
5540
+ }
5541
+ return url;
5480
5542
  }
5481
5543
  }, {
5482
- key: "checkout",
5483
- value: function checkout() {
5484
- return new ApiCheckoutInternal(this);
5544
+ key: "setParams",
5545
+ value: function setParams(params) {
5546
+ this.params = _extends({}, this.params, params);
5485
5547
  }
5486
5548
  }, {
5487
- key: "gateway",
5488
- value: function gateway() {
5489
- return new ApiGatewayInternal(this);
5549
+ key: "concatParams",
5550
+ value: function concatParams(params) {
5551
+ for (var key in params) {
5552
+ if (!params.hasOwnProperty(key) || !params[key].length) continue;
5553
+ if (typeof this.params[key] !== 'string') this.params[key] = '';
5554
+ if (this.params[key].length) this.params[key] += ',' + params[key];else this.params[key] += params[key];
5555
+ }
5490
5556
  }
5491
5557
  }, {
5492
- key: "paymentSource",
5493
- value: function paymentSource() {
5494
- return new ApiPaymentSourceInternal(this);
5495
- }
5496
- }]);
5497
- }(ApiBase);
5498
-
5499
- var STANDALONE_3DS_GATEWAYS = {
5500
- GPAYMENTS: "GPayments"
5501
- };
5502
- var Standalone3dsService = /*#__PURE__*/function () {
5503
- function Standalone3dsService(container, eventEmitter) {
5504
- _classCallCheck(this, Standalone3dsService);
5505
- this.env = DEFAULT_ENV;
5506
- this.container = container;
5507
- this.eventEmitter = eventEmitter;
5508
- }
5509
- return _createClass(Standalone3dsService, [{
5510
- key: "load",
5511
- value: function load(token, options) {
5512
- var parsedToken = AccessToken.validateJWT(token);
5513
- if (!parsedToken) throw new Error("Invalid charge token");
5514
- var tokenData = AccessToken.extractData(parsedToken.body);
5515
- var api = new ApiInternal(token, API_AUTH_TYPE.TOKEN);
5516
- api.setEnv(this.env, this.alias);
5517
- switch (tokenData.service_type) {
5518
- case STANDALONE_3DS_GATEWAYS.GPAYMENTS:
5519
- new GPaymentsService(this.container, api, this.eventEmitter).load(tokenData, options.title);
5520
- break;
5521
- }
5558
+ key: "getParams",
5559
+ value: function getParams() {
5560
+ return this.params;
5522
5561
  }
5523
5562
  }, {
5524
5563
  key: "setEnv",
5525
5564
  value: function setEnv(env, alias) {
5526
- this.env = env;
5527
- this.alias = alias;
5565
+ this.env.setEnv(env, alias);
5566
+ }
5567
+ }, {
5568
+ key: "getEnv",
5569
+ value: function getEnv() {
5570
+ return this.env.getEnv();
5571
+ }
5572
+ }, {
5573
+ key: "getBaseUrl",
5574
+ value: function getBaseUrl() {
5575
+ return this.env.getConf().url;
5528
5576
  }
5529
5577
  }]);
5530
5578
  }();
@@ -5564,7 +5612,7 @@
5564
5612
  * @param {string} CHARGE_AUTH_CHALLENGE=chargeAuthChallenge
5565
5613
  * @param {string} CHARGE_AUTH_INFO=chargeAuthInfo
5566
5614
  * @param {string} ERROR=error
5567
- */
5615
+ */
5568
5616
  /**
5569
5617
  * Class Canvas3ds include method for working on html
5570
5618
  * @constructor
@@ -5600,13 +5648,21 @@
5600
5648
  *
5601
5649
  */
5602
5650
  function load() {
5603
- if (this.token.format === TOKEN_FORMAT$2.HTML) this.iFrame.loadFromHtml(this.token.content, {
5604
- title: '3d secure authentication'
5605
- }, 'threeDSecure-iframe');else if (this.token.format === TOKEN_FORMAT$2.URL) this.iFrame.load(this.token.content, {
5606
- title: '3d secure authentication'
5607
- }, 'threeDSecure-iframe');else if (this.token.format === TOKEN_FORMAT$2.STANDALONE_3DS) this.standalone3dsService.load(this.token.content, {
5608
- title: '3d secure authentication'
5609
- });else console.error('Token contain unsupported payload');
5651
+ if (this.token.format === TOKEN_FORMAT$2.HTML) {
5652
+ this.iFrame.loadFromHtml(this.token.content, {
5653
+ title: '3d secure authentication'
5654
+ }, 'threeDSecure-iframe');
5655
+ } else if (this.token.format === TOKEN_FORMAT$2.URL) {
5656
+ this.iFrame.load(this.token.content, {
5657
+ title: '3d secure authentication'
5658
+ }, 'threeDSecure-iframe');
5659
+ } else if (this.token.format === TOKEN_FORMAT$2.STANDALONE_3DS) {
5660
+ this.standalone3dsService.load(this.token.content, {
5661
+ title: '3d secure authentication'
5662
+ });
5663
+ } else {
5664
+ console.error('Token contain unsupported payload');
5665
+ }
5610
5666
  }
5611
5667
  /**
5612
5668
  * Current method can change environment. By default environment = sandbox.
@@ -5623,7 +5679,9 @@
5623
5679
  this.link.setEnv(env, alias);
5624
5680
  this.standalone3dsService.setEnv(env, alias);
5625
5681
  for (var index in this.configs) {
5626
- if (!this.configs.hasOwnProperty(index)) continue;
5682
+ if (!Object.hasOwn(this.configs, index)) {
5683
+ continue;
5684
+ }
5627
5685
  this.configs[index].setEnv(env, alias);
5628
5686
  }
5629
5687
  }
@@ -5633,34 +5691,45 @@
5633
5691
  return this.link.getEnv();
5634
5692
  }
5635
5693
  /**
5636
- * Listen to events of widget
5694
+ * Listen to events of widget.
5637
5695
  *
5638
- * @example
5696
+ * Available event names are defined in {@link Canvas3dsEventMap} (typed) and
5697
+ * {@link CANVAS_3DS_EVENT} (string constants). Using a literal event name
5698
+ * narrows the callback payload via the typed overloads.
5639
5699
  *
5640
- * widget.on('chargeAuthReject', function (data) {
5641
- * console.log(data);
5700
+ * @example
5701
+ * // Callback form — payload is narrowed by the event name
5702
+ * widget.on('chargeAuthReject', (data) => {
5703
+ * console.log(data); // data is Canvas3dsAuthPayload | Canvas3dsChargeAuthEventPayload
5642
5704
  * });
5643
- * // or
5644
- * widget.on('chargeAuthReject').then(function (data) {
5645
- * console.log(data);
5705
+ *
5706
+ * // Promise form
5707
+ * widget.on('chargeAuthReject').then((data) => {
5708
+ * console.log(data);
5646
5709
  * });
5647
- * @param {string} eventName - Available event names [EVENT]{@link EVENT} [STANDALONE_3DS_EVENT]{@link STANDALONE_3DS_EVENT}
5648
- * @param {listener} [cb]
5649
- * @return {Promise<IEventData> | void}
5710
+ *
5711
+ * @param eventName - Event name from {@link Canvas3dsEventMap} or any string for dynamic events.
5712
+ * @param cb - Optional listener callback. If omitted, returns a Promise that resolves on the next emission.
5713
+ * @returns `void` when a callback is provided; otherwise a Promise that resolves with the event payload.
5650
5714
  */
5715
+ // biome-ignore lint/suspicious/noExplicitAny: implementation signature must accept any payload shape to satisfy all overloads above
5651
5716
  }, {
5652
5717
  key: "on",
5653
5718
  value: function on(eventName, cb) {
5654
5719
  var _this = this;
5655
5720
  if (this.token.format === TOKEN_FORMAT$2.STANDALONE_3DS) {
5656
- if (typeof cb === 'function') return this.eventEmitter.subscribe(eventName, cb);
5721
+ if (typeof cb === 'function') {
5722
+ return this.eventEmitter.subscribe(eventName, cb);
5723
+ }
5657
5724
  return new Promise(function (resolve) {
5658
5725
  return _this.eventEmitter.subscribe(eventName, function (res) {
5659
5726
  return resolve(res);
5660
5727
  });
5661
5728
  });
5662
5729
  } else {
5663
- if (typeof cb === 'function') return this.event.on(eventName, this.link.getParams().ref_id, cb);
5730
+ if (typeof cb === 'function') {
5731
+ return this.event.on(eventName, this.link.getParams().ref_id, cb);
5732
+ }
5664
5733
  return new Promise(function (resolve) {
5665
5734
  return _this.event.on(eventName, _this.link.getParams().ref_id, function (res) {
5666
5735
  return resolve(res);
@@ -5704,6 +5773,19 @@
5704
5773
  }]);
5705
5774
  }();
5706
5775
 
5776
+ /**
5777
+ * Public, tree-shakeable alias for the internal `TOKEN_FORMAT` enum in canvas-3ds.ts.
5778
+ * Mirrors the string values of that enum without exposing the private enum itself.
5779
+ */
5780
+ var Canvas3dsTokenFormat = {
5781
+ /** Token whose `content` is a complete HTML page. The SDK renders it inside an iframe. */
5782
+ HTML: 'html',
5783
+ /** Token whose `content` is a URL. The SDK loads it inside an iframe. */
5784
+ URL: 'url',
5785
+ /** Token whose `content` describes a standalone 3DS service (e.g. GPayments). The SDK delegates to that service's flow. */
5786
+ STANDALONE_3DS: 'standalone_3ds'
5787
+ };
5788
+
5707
5789
  var Spinner = /*#__PURE__*/function () {
5708
5790
  function Spinner() {
5709
5791
  _classCallCheck(this, Spinner);
@@ -6785,7 +6867,7 @@
6785
6867
  key: "setCompleteCheckoutListener",
6786
6868
  value: function setCompleteCheckoutListener() {
6787
6869
  var _this5 = this;
6788
- this.event.on(EVENT$5.FINISH, this.widgetId, function (event) {
6870
+ this.event.on(EVENT$4.FINISH, this.widgetId, function (event) {
6789
6871
  _this5.event.clear();
6790
6872
  clearInterval(_this5.checkInterval);
6791
6873
  if (_this5.checkoutTab && !_this5.checkoutTab.closed) {
@@ -6872,15 +6954,15 @@
6872
6954
  value: function setupIframeEventListeners() {
6873
6955
  var _this = this;
6874
6956
  if (!this.widgetId) return;
6875
- this.iframeEvent.on(EVENT$5.AFTER_LOAD, this.widgetId, function (_event) {
6957
+ this.iframeEvent.on(EVENT$4.AFTER_LOAD, this.widgetId, function (_event) {
6876
6958
  var _a;
6877
6959
  (_a = _this.onLoadCallback) === null || _a === void 0 ? void 0 : _a.call(_this);
6878
6960
  });
6879
- this.iframeEvent.on(EVENT$5.DISPATCH_SUCCESS, this.widgetId, function (_event) {
6961
+ this.iframeEvent.on(EVENT$4.DISPATCH_SUCCESS, this.widgetId, function (_event) {
6880
6962
  var _a, _b;
6881
6963
  (_b = (_a = _this.pushCallbacks) === null || _a === void 0 ? void 0 : _a.onSuccess) === null || _b === void 0 ? void 0 : _b.call(_a);
6882
6964
  });
6883
- this.iframeEvent.on(EVENT$5.DISPATCH_ERROR, this.widgetId, function (_event) {
6965
+ this.iframeEvent.on(EVENT$4.DISPATCH_ERROR, this.widgetId, function (_event) {
6884
6966
  var _a, _b;
6885
6967
  (_b = (_a = _this.pushCallbacks) === null || _a === void 0 ? void 0 : _a.onError) === null || _b === void 0 ? void 0 : _b.call(_a);
6886
6968
  });
@@ -8094,7 +8176,7 @@
8094
8176
  }]);
8095
8177
  }(WalletService);
8096
8178
 
8097
- /*! @license DOMPurify 3.3.3 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.3.3/LICENSE */
8179
+ /*! @license DOMPurify 3.4.0 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.4.0/LICENSE */
8098
8180
 
8099
8181
  var purify_cjs;
8100
8182
  var hasRequiredPurify_cjs;
@@ -8302,7 +8384,7 @@
8302
8384
 
8303
8385
  const html = freeze(['accept', 'action', 'align', 'alt', 'autocapitalize', 'autocomplete', 'autopictureinpicture', 'autoplay', 'background', 'bgcolor', 'border', 'capture', 'cellpadding', 'cellspacing', 'checked', 'cite', 'class', 'clear', 'color', 'cols', 'colspan', 'controls', 'controlslist', 'coords', 'crossorigin', 'datetime', 'decoding', 'default', 'dir', 'disabled', 'disablepictureinpicture', 'disableremoteplayback', 'download', 'draggable', 'enctype', 'enterkeyhint', 'exportparts', 'face', 'for', 'headers', 'height', 'hidden', 'high', 'href', 'hreflang', 'id', 'inert', 'inputmode', 'integrity', 'ismap', 'kind', 'label', 'lang', 'list', 'loading', 'loop', 'low', 'max', 'maxlength', 'media', 'method', 'min', 'minlength', 'multiple', 'muted', 'name', 'nonce', 'noshade', 'novalidate', 'nowrap', 'open', 'optimum', 'part', 'pattern', 'placeholder', 'playsinline', 'popover', 'popovertarget', 'popovertargetaction', 'poster', 'preload', 'pubdate', 'radiogroup', 'readonly', 'rel', 'required', 'rev', 'reversed', 'role', 'rows', 'rowspan', 'spellcheck', 'scope', 'selected', 'shape', 'size', 'sizes', 'slot', 'span', 'srclang', 'start', 'src', 'srcset', 'step', 'style', 'summary', 'tabindex', 'title', 'translate', 'type', 'usemap', 'valign', 'value', 'width', 'wrap', 'xmlns', 'slot']);
8304
8386
  const svg = freeze(['accent-height', 'accumulate', 'additive', 'alignment-baseline', 'amplitude', 'ascent', 'attributename', 'attributetype', 'azimuth', 'basefrequency', 'baseline-shift', 'begin', 'bias', 'by', 'class', 'clip', 'clippathunits', 'clip-path', 'clip-rule', 'color', 'color-interpolation', 'color-interpolation-filters', 'color-profile', 'color-rendering', 'cx', 'cy', 'd', 'dx', 'dy', 'diffuseconstant', 'direction', 'display', 'divisor', 'dur', 'edgemode', 'elevation', 'end', 'exponent', 'fill', 'fill-opacity', 'fill-rule', 'filter', 'filterunits', 'flood-color', 'flood-opacity', 'font-family', 'font-size', 'font-size-adjust', 'font-stretch', 'font-style', 'font-variant', 'font-weight', 'fx', 'fy', 'g1', 'g2', 'glyph-name', 'glyphref', 'gradientunits', 'gradienttransform', 'height', 'href', 'id', 'image-rendering', 'in', 'in2', 'intercept', 'k', 'k1', 'k2', 'k3', 'k4', 'kerning', 'keypoints', 'keysplines', 'keytimes', 'lang', 'lengthadjust', 'letter-spacing', 'kernelmatrix', 'kernelunitlength', 'lighting-color', 'local', 'marker-end', 'marker-mid', 'marker-start', 'markerheight', 'markerunits', 'markerwidth', 'maskcontentunits', 'maskunits', 'max', 'mask', 'mask-type', 'media', 'method', 'mode', 'min', 'name', 'numoctaves', 'offset', 'operator', 'opacity', 'order', 'orient', 'orientation', 'origin', 'overflow', 'paint-order', 'path', 'pathlength', 'patterncontentunits', 'patterntransform', 'patternunits', 'points', 'preservealpha', 'preserveaspectratio', 'primitiveunits', 'r', 'rx', 'ry', 'radius', 'refx', 'refy', 'repeatcount', 'repeatdur', 'restart', 'result', 'rotate', 'scale', 'seed', 'shape-rendering', 'slope', 'specularconstant', 'specularexponent', 'spreadmethod', 'startoffset', 'stddeviation', 'stitchtiles', 'stop-color', 'stop-opacity', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke', 'stroke-width', 'style', 'surfacescale', 'systemlanguage', 'tabindex', 'tablevalues', 'targetx', 'targety', 'transform', 'transform-origin', 'text-anchor', 'text-decoration', 'text-rendering', 'textlength', 'type', 'u1', 'u2', 'unicode', 'values', 'viewbox', 'visibility', 'version', 'vert-adv-y', 'vert-origin-x', 'vert-origin-y', 'width', 'word-spacing', 'wrap', 'writing-mode', 'xchannelselector', 'ychannelselector', 'x', 'x1', 'x2', 'xmlns', 'y', 'y1', 'y2', 'z', 'zoomandpan']);
8305
- const mathMl = freeze(['accent', 'accentunder', 'align', 'bevelled', 'close', 'columnsalign', 'columnlines', 'columnspan', 'denomalign', 'depth', 'dir', 'display', 'displaystyle', 'encoding', 'fence', 'frame', 'height', 'href', 'id', 'largeop', 'length', 'linethickness', 'lspace', 'lquote', 'mathbackground', 'mathcolor', 'mathsize', 'mathvariant', 'maxsize', 'minsize', 'movablelimits', 'notation', 'numalign', 'open', 'rowalign', 'rowlines', 'rowspacing', 'rowspan', 'rspace', 'rquote', 'scriptlevel', 'scriptminsize', 'scriptsizemultiplier', 'selection', 'separator', 'separators', 'stretchy', 'subscriptshift', 'supscriptshift', 'symmetric', 'voffset', 'width', 'xmlns']);
8387
+ const mathMl = freeze(['accent', 'accentunder', 'align', 'bevelled', 'close', 'columnalign', 'columnlines', 'columnspacing', 'columnspan', 'denomalign', 'depth', 'dir', 'display', 'displaystyle', 'encoding', 'fence', 'frame', 'height', 'href', 'id', 'largeop', 'length', 'linethickness', 'lquote', 'lspace', 'mathbackground', 'mathcolor', 'mathsize', 'mathvariant', 'maxsize', 'minsize', 'movablelimits', 'notation', 'numalign', 'open', 'rowalign', 'rowlines', 'rowspacing', 'rowspan', 'rspace', 'rquote', 'scriptlevel', 'scriptminsize', 'scriptsizemultiplier', 'selection', 'separator', 'separators', 'stretchy', 'subscriptshift', 'supscriptshift', 'symmetric', 'voffset', 'width', 'xmlns']);
8306
8388
  const xml = freeze(['xlink:href', 'xml:id', 'xlink:title', 'xml:space', 'xmlns:xlink']);
8307
8389
 
8308
8390
  // eslint-disable-next-line unicorn/better-regex
@@ -8399,7 +8481,7 @@
8399
8481
  function createDOMPurify() {
8400
8482
  let window = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getGlobal();
8401
8483
  const DOMPurify = root => createDOMPurify(root);
8402
- DOMPurify.version = '3.3.3';
8484
+ DOMPurify.version = '3.4.0';
8403
8485
  DOMPurify.removed = [];
8404
8486
  if (!window || !window.document || window.document.nodeType !== NODE_TYPE.document || !window.Element) {
8405
8487
  // Not running in a browser, provide a factory function
@@ -8675,7 +8757,7 @@
8675
8757
  NAMESPACE = cfg.NAMESPACE || HTML_NAMESPACE;
8676
8758
  MATHML_TEXT_INTEGRATION_POINTS = cfg.MATHML_TEXT_INTEGRATION_POINTS || MATHML_TEXT_INTEGRATION_POINTS;
8677
8759
  HTML_INTEGRATION_POINTS = cfg.HTML_INTEGRATION_POINTS || HTML_INTEGRATION_POINTS;
8678
- CUSTOM_ELEMENT_HANDLING = cfg.CUSTOM_ELEMENT_HANDLING || {};
8760
+ CUSTOM_ELEMENT_HANDLING = cfg.CUSTOM_ELEMENT_HANDLING || create(null);
8679
8761
  if (cfg.CUSTOM_ELEMENT_HANDLING && isRegexOrFunction(cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck)) {
8680
8762
  CUSTOM_ELEMENT_HANDLING.tagNameCheck = cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck;
8681
8763
  }
@@ -8715,13 +8797,10 @@
8715
8797
  addToSet(ALLOWED_ATTR, xml);
8716
8798
  }
8717
8799
  }
8718
- /* Prevent function-based ADD_ATTR / ADD_TAGS from leaking across calls */
8719
- if (!objectHasOwnProperty(cfg, 'ADD_TAGS')) {
8720
- EXTRA_ELEMENT_HANDLING.tagCheck = null;
8721
- }
8722
- if (!objectHasOwnProperty(cfg, 'ADD_ATTR')) {
8723
- EXTRA_ELEMENT_HANDLING.attributeCheck = null;
8724
- }
8800
+ /* Always reset function-based ADD_TAGS / ADD_ATTR checks to prevent
8801
+ * leaking across calls when switching from function to array config */
8802
+ EXTRA_ELEMENT_HANDLING.tagCheck = null;
8803
+ EXTRA_ELEMENT_HANDLING.attributeCheck = null;
8725
8804
  /* Merge configuration parameters */
8726
8805
  if (cfg.ADD_TAGS) {
8727
8806
  if (typeof cfg.ADD_TAGS === 'function') {
@@ -9044,6 +9123,11 @@
9044
9123
  _forceRemove(currentNode);
9045
9124
  return true;
9046
9125
  }
9126
+ /* Remove risky CSS construction leading to mXSS */
9127
+ if (SAFE_FOR_XML && currentNode.namespaceURI === HTML_NAMESPACE && tagName === 'style' && _isNode(currentNode.firstElementChild)) {
9128
+ _forceRemove(currentNode);
9129
+ return true;
9130
+ }
9047
9131
  /* Remove any occurrence of processing instructions */
9048
9132
  if (currentNode.nodeType === NODE_TYPE.progressingInstruction) {
9049
9133
  _forceRemove(currentNode);
@@ -9055,7 +9139,7 @@
9055
9139
  return true;
9056
9140
  }
9057
9141
  /* Remove element if anything forbids its presence */
9058
- if (!(EXTRA_ELEMENT_HANDLING.tagCheck instanceof Function && EXTRA_ELEMENT_HANDLING.tagCheck(tagName)) && (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName])) {
9142
+ if (FORBID_TAGS[tagName] || !(EXTRA_ELEMENT_HANDLING.tagCheck instanceof Function && EXTRA_ELEMENT_HANDLING.tagCheck(tagName)) && !ALLOWED_TAGS[tagName]) {
9059
9143
  /* Check if we have a custom element to handle */
9060
9144
  if (!FORBID_TAGS[tagName] && _isBasicCustomElement(tagName)) {
9061
9145
  if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, tagName)) {
@@ -9294,7 +9378,7 @@
9294
9378
  *
9295
9379
  * @param fragment to iterate over recursively
9296
9380
  */
9297
- const _sanitizeShadowDOM = function _sanitizeShadowDOM(fragment) {
9381
+ const _sanitizeShadowDOM2 = function _sanitizeShadowDOM(fragment) {
9298
9382
  let shadowNode = null;
9299
9383
  const shadowIterator = _createNodeIterator(fragment);
9300
9384
  /* Execute a hook if present */
@@ -9308,7 +9392,7 @@
9308
9392
  _sanitizeAttributes(shadowNode);
9309
9393
  /* Deep shadow DOM detected */
9310
9394
  if (shadowNode.content instanceof DocumentFragment) {
9311
- _sanitizeShadowDOM(shadowNode.content);
9395
+ _sanitizeShadowDOM2(shadowNode.content);
9312
9396
  }
9313
9397
  }
9314
9398
  /* Execute a hook if present */
@@ -9403,7 +9487,7 @@
9403
9487
  _sanitizeAttributes(currentNode);
9404
9488
  /* Shadow DOM detected, sanitize it */
9405
9489
  if (currentNode.content instanceof DocumentFragment) {
9406
- _sanitizeShadowDOM(currentNode.content);
9490
+ _sanitizeShadowDOM2(currentNode.content);
9407
9491
  }
9408
9492
  }
9409
9493
  /* If we sanitized `dirty` in-place, return it. */
@@ -9412,6 +9496,14 @@
9412
9496
  }
9413
9497
  /* Return sanitized string or DOM */
9414
9498
  if (RETURN_DOM) {
9499
+ if (SAFE_FOR_TEMPLATES) {
9500
+ body.normalize();
9501
+ let html = body.innerHTML;
9502
+ arrayForEach([MUSTACHE_EXPR, ERB_EXPR, TMPLIT_EXPR], expr => {
9503
+ html = stringReplace(html, expr, ' ');
9504
+ });
9505
+ body.innerHTML = html;
9506
+ }
9415
9507
  if (RETURN_DOM_FRAGMENT) {
9416
9508
  returnNode = createDocumentFragment.call(body.ownerDocument);
9417
9509
  while (body.firstChild) {
@@ -10244,6 +10336,44 @@
10244
10336
  }]);
10245
10337
  }(WalletService);
10246
10338
 
10339
+ /**
10340
+ * Maximum Apple Pay JS API version the SDK targets.
10341
+ * Bump this when adopting features from a newer version.
10342
+ */
10343
+ var APPLE_PAY_MAX_VERSION = 14;
10344
+ /**
10345
+ * Minimum Apple Pay JS API version the SDK can operate with.
10346
+ *
10347
+ * Version 3 (iOS 11 / macOS 10.13) is required because the SDK uses:
10348
+ * - `ApplePayError` constructor
10349
+ * - Object-form `completeShippingContactSelection(update)`
10350
+ * - Object-form `completeShippingMethodSelection(update)`
10351
+ * - `supportedCountries` in payment requests
10352
+ *
10353
+ * All of these were introduced in version 3.
10354
+ */
10355
+ var APPLE_PAY_MIN_VERSION = 3;
10356
+ /**
10357
+ * Detects the highest Apple Pay JS API version the current device supports,
10358
+ * starting from {@link APPLE_PAY_MAX_VERSION} down to {@link APPLE_PAY_MIN_VERSION}.
10359
+ *
10360
+ * Returns `0` if Apple Pay is not available or the device does not support
10361
+ * the minimum required version.
10362
+ *
10363
+ * @see https://developer.apple.com/documentation/apple_pay_on_the_web/applepaysession/supportsversion
10364
+ */
10365
+ function getSupportedApplePayVersion() {
10366
+ if (!window.ApplePaySession) {
10367
+ return 0;
10368
+ }
10369
+ for (var v = APPLE_PAY_MAX_VERSION; v >= APPLE_PAY_MIN_VERSION; v--) {
10370
+ if (ApplePaySession.supportsVersion(v)) {
10371
+ return v;
10372
+ }
10373
+ }
10374
+ return 0;
10375
+ }
10376
+
10247
10377
  var DEFAULT_APPLE_PAY_CAPABILITIES$2 = ['paymentCredentialsAvailable'];
10248
10378
  var AppleWalletService = /*#__PURE__*/function (_WalletService) {
10249
10379
  function AppleWalletService(publicKey, meta, gatewayName, eventEmitter) {
@@ -10573,7 +10703,14 @@
10573
10703
  key: "onApplePayButtonClicked",
10574
10704
  value: function onApplePayButtonClicked() {
10575
10705
  var _this5 = this;
10576
- this.paymentSession = new ApplePaySession(14, this.createRequest());
10706
+ var applePayApiVersion = getSupportedApplePayVersion();
10707
+ if (applePayApiVersion === 0) {
10708
+ this.eventEmitter.emit(WALLET_EVENT.UNAVAILABLE, {
10709
+ wallet: WALLET_TYPE.APPLE
10710
+ });
10711
+ return;
10712
+ }
10713
+ this.paymentSession = new ApplePaySession(applePayApiVersion, this.createRequest());
10577
10714
  this.paymentSession.onvalidatemerchant = this.onValidateMerchant;
10578
10715
  this.paymentSession.onpaymentauthorized = this.onPaymentAuthorized;
10579
10716
  this.paymentSession.oncancel = this.onCancelPayment;
@@ -11722,7 +11859,7 @@
11722
11859
  * @param {string} ON_CLICK=onClick
11723
11860
  * @param {string} LOADED=onWalletLoaded
11724
11861
  */
11725
- var EVENT$4 = {
11862
+ var EVENT$3 = {
11726
11863
  UNAVAILABLE: EventEnum.UNAVAILABLE,
11727
11864
  UPDATE: EventEnum.UPDATE,
11728
11865
  PAYMENT_SUCCESSFUL: EventEnum.PAYMENT_SUCCESSFUL,
@@ -11848,7 +11985,7 @@
11848
11985
  this.setupServiceCallbacks();
11849
11986
  this.service.load(this.container);
11850
11987
  } catch (err) {
11851
- this.eventEmitter.emit(EVENT$4.UNAVAILABLE, null);
11988
+ this.eventEmitter.emit(EVENT$3.UNAVAILABLE, null);
11852
11989
  throw err;
11853
11990
  }
11854
11991
  }
@@ -11985,7 +12122,7 @@
11985
12122
  key: "on",
11986
12123
  value: function on(eventName, cb) {
11987
12124
  var _this = this;
11988
- if (eventName === EVENT$4.UPDATE) {
12125
+ if (eventName === EVENT$3.UPDATE) {
11989
12126
  this.hasUpdateHandler = true;
11990
12127
  }
11991
12128
  if (typeof cb === 'function') {
@@ -12020,10 +12157,10 @@
12020
12157
  value: function onUnavailable(handler) {
12021
12158
  var _this2 = this;
12022
12159
  if (typeof handler === 'function') {
12023
- return this.eventEmitter.subscribe(EVENT$4.UNAVAILABLE, handler);
12160
+ return this.eventEmitter.subscribe(EVENT$3.UNAVAILABLE, handler);
12024
12161
  }
12025
12162
  return new Promise(function (resolve) {
12026
- return _this2.eventEmitter.subscribe(EVENT$4.UNAVAILABLE, function () {
12163
+ return _this2.eventEmitter.subscribe(EVENT$3.UNAVAILABLE, function () {
12027
12164
  return resolve();
12028
12165
  });
12029
12166
  });
@@ -12049,10 +12186,10 @@
12049
12186
  var _this3 = this;
12050
12187
  this.hasUpdateHandler = true;
12051
12188
  if (typeof handler === 'function') {
12052
- return this.eventEmitter.subscribe(EVENT$4.UPDATE, handler);
12189
+ return this.eventEmitter.subscribe(EVENT$3.UPDATE, handler);
12053
12190
  }
12054
12191
  return new Promise(function (resolve) {
12055
- return _this3.eventEmitter.subscribe(EVENT$4.UPDATE, function (data) {
12192
+ return _this3.eventEmitter.subscribe(EVENT$3.UPDATE, function (data) {
12056
12193
  return resolve(data);
12057
12194
  });
12058
12195
  });
@@ -12076,10 +12213,10 @@
12076
12213
  value: function onPaymentSuccessful(handler) {
12077
12214
  var _this4 = this;
12078
12215
  if (typeof handler === 'function') {
12079
- return this.eventEmitter.subscribe(EVENT$4.PAYMENT_SUCCESSFUL, handler);
12216
+ return this.eventEmitter.subscribe(EVENT$3.PAYMENT_SUCCESSFUL, handler);
12080
12217
  }
12081
12218
  return new Promise(function (resolve) {
12082
- return _this4.eventEmitter.subscribe(EVENT$4.PAYMENT_SUCCESSFUL, function (data) {
12219
+ return _this4.eventEmitter.subscribe(EVENT$3.PAYMENT_SUCCESSFUL, function (data) {
12083
12220
  return resolve(data);
12084
12221
  });
12085
12222
  });
@@ -12103,10 +12240,10 @@
12103
12240
  value: function onPaymentInReview(handler) {
12104
12241
  var _this5 = this;
12105
12242
  if (typeof handler === 'function') {
12106
- return this.eventEmitter.subscribe(EVENT$4.PAYMENT_IN_REVIEW, handler);
12243
+ return this.eventEmitter.subscribe(EVENT$3.PAYMENT_IN_REVIEW, handler);
12107
12244
  }
12108
12245
  return new Promise(function (resolve) {
12109
- return _this5.eventEmitter.subscribe(EVENT$4.PAYMENT_IN_REVIEW, function (data) {
12246
+ return _this5.eventEmitter.subscribe(EVENT$3.PAYMENT_IN_REVIEW, function (data) {
12110
12247
  return resolve(data);
12111
12248
  });
12112
12249
  });
@@ -12130,10 +12267,10 @@
12130
12267
  value: function onPaymentError(handler) {
12131
12268
  var _this6 = this;
12132
12269
  if (typeof handler === 'function') {
12133
- return this.eventEmitter.subscribe(EVENT$4.PAYMENT_ERROR, handler);
12270
+ return this.eventEmitter.subscribe(EVENT$3.PAYMENT_ERROR, handler);
12134
12271
  }
12135
12272
  return new Promise(function (resolve) {
12136
- return _this6.eventEmitter.subscribe(EVENT$4.PAYMENT_ERROR, function (err) {
12273
+ return _this6.eventEmitter.subscribe(EVENT$3.PAYMENT_ERROR, function (err) {
12137
12274
  return resolve(err);
12138
12275
  });
12139
12276
  });
@@ -12159,10 +12296,10 @@
12159
12296
  value: function onAuthTokensChanged(handler) {
12160
12297
  var _this7 = this;
12161
12298
  if (typeof handler === 'function') {
12162
- return this.eventEmitter.subscribe(EVENT$4.AUTH_TOKENS_CHANGED, handler);
12299
+ return this.eventEmitter.subscribe(EVENT$3.AUTH_TOKENS_CHANGED, handler);
12163
12300
  }
12164
12301
  return new Promise(function (resolve) {
12165
- return _this7.eventEmitter.subscribe(EVENT$4.AUTH_TOKENS_CHANGED, function (err) {
12302
+ return _this7.eventEmitter.subscribe(EVENT$3.AUTH_TOKENS_CHANGED, function (err) {
12166
12303
  return resolve(err);
12167
12304
  });
12168
12305
  });
@@ -12185,7 +12322,7 @@
12185
12322
  key: "onClick",
12186
12323
  value: function onClick(handler) {
12187
12324
  if (typeof handler === 'function') {
12188
- return this.eventEmitter.subscribe(EVENT$4.ON_CLICK, handler);
12325
+ return this.eventEmitter.subscribe(EVENT$3.ON_CLICK, handler);
12189
12326
  }
12190
12327
  }
12191
12328
  /**
@@ -12204,10 +12341,10 @@
12204
12341
  value: function onCheckoutOpen(handler) {
12205
12342
  var _this8 = this;
12206
12343
  if (typeof handler === 'function') {
12207
- return this.eventEmitter.subscribe(EVENT$4.ON_CHECKOUT_OPEN, handler);
12344
+ return this.eventEmitter.subscribe(EVENT$3.ON_CHECKOUT_OPEN, handler);
12208
12345
  }
12209
12346
  return new Promise(function (resolve) {
12210
- return _this8.eventEmitter.subscribe(EVENT$4.ON_CHECKOUT_OPEN, function (err) {
12347
+ return _this8.eventEmitter.subscribe(EVENT$3.ON_CHECKOUT_OPEN, function (err) {
12211
12348
  return resolve(err);
12212
12349
  });
12213
12350
  });
@@ -12228,10 +12365,10 @@
12228
12365
  value: function onCheckoutClose(handler) {
12229
12366
  var _this9 = this;
12230
12367
  if (typeof handler === 'function') {
12231
- return this.eventEmitter.subscribe(EVENT$4.ON_CHECKOUT_CLOSE, handler);
12368
+ return this.eventEmitter.subscribe(EVENT$3.ON_CHECKOUT_CLOSE, handler);
12232
12369
  }
12233
12370
  return new Promise(function (resolve) {
12234
- return _this9.eventEmitter.subscribe(EVENT$4.ON_CHECKOUT_CLOSE, function (err) {
12371
+ return _this9.eventEmitter.subscribe(EVENT$3.ON_CHECKOUT_CLOSE, function (err) {
12235
12372
  return resolve(err);
12236
12373
  });
12237
12374
  });
@@ -12257,8 +12394,8 @@
12257
12394
  value: function setupOnWalletLoadedCallback() {
12258
12395
  var _this0 = this;
12259
12396
  this.service.on(WALLET_EVENT.LOADED, function (eventData) {
12260
- _this0.eventEmitter.emit(EVENT$4.ON_WALLET_LOADED, {
12261
- event: EVENT$4.ON_WALLET_LOADED,
12397
+ _this0.eventEmitter.emit(EVENT$3.ON_WALLET_LOADED, {
12398
+ event: EVENT$3.ON_WALLET_LOADED,
12262
12399
  data: eventData
12263
12400
  });
12264
12401
  });
@@ -12268,8 +12405,8 @@
12268
12405
  value: function setupUnavailableCallback() {
12269
12406
  var _this1 = this;
12270
12407
  this.service.on(WALLET_EVENT.UNAVAILABLE, function (eventData) {
12271
- return _this1.eventEmitter.emit(EVENT$4.UNAVAILABLE, {
12272
- event: EVENT$4.UNAVAILABLE,
12408
+ return _this1.eventEmitter.emit(EVENT$3.UNAVAILABLE, {
12409
+ event: EVENT$3.UNAVAILABLE,
12273
12410
  data: eventData
12274
12411
  });
12275
12412
  });
@@ -12279,8 +12416,8 @@
12279
12416
  value: function setupUpdateCallback() {
12280
12417
  var _this10 = this;
12281
12418
  this.service.on(WALLET_EVENT.UPDATE, function (eventData) {
12282
- return _this10.hasUpdateHandler ? _this10.eventEmitter.emit(EVENT$4.UPDATE, {
12283
- event: EVENT$4.UPDATE,
12419
+ return _this10.hasUpdateHandler ? _this10.eventEmitter.emit(EVENT$3.UPDATE, {
12420
+ event: EVENT$3.UPDATE,
12284
12421
  data: eventData
12285
12422
  }) : _this10.update({
12286
12423
  success: true
@@ -12292,8 +12429,8 @@
12292
12429
  value: function setupOnClickCallback() {
12293
12430
  var _this11 = this;
12294
12431
  this.service.on(WALLET_EVENT.BUTTON_CLICK, function (data) {
12295
- return _this11.eventEmitter.emit(EVENT$4.ON_CLICK, {
12296
- event: EVENT$4.ON_CLICK,
12432
+ return _this11.eventEmitter.emit(EVENT$3.ON_CLICK, {
12433
+ event: EVENT$3.ON_CLICK,
12297
12434
  data: data
12298
12435
  });
12299
12436
  });
@@ -12303,8 +12440,8 @@
12303
12440
  value: function setupOnCheckoutOpenCallback() {
12304
12441
  var _this12 = this;
12305
12442
  this.service.on(WALLET_EVENT.CHECKOUT_OPEN, function (data) {
12306
- return _this12.eventEmitter.emit(EVENT$4.ON_CHECKOUT_OPEN, {
12307
- event: EVENT$4.ON_CHECKOUT_OPEN,
12443
+ return _this12.eventEmitter.emit(EVENT$3.ON_CHECKOUT_OPEN, {
12444
+ event: EVENT$3.ON_CHECKOUT_OPEN,
12308
12445
  data: data
12309
12446
  });
12310
12447
  });
@@ -12314,8 +12451,8 @@
12314
12451
  value: function setupOnCheckoutCloseCallback() {
12315
12452
  var _this13 = this;
12316
12453
  this.service.on(WALLET_EVENT.CHECKOUT_CLOSE, function (data) {
12317
- return _this13.eventEmitter.emit(EVENT$4.ON_CHECKOUT_CLOSE, {
12318
- event: EVENT$4.ON_CHECKOUT_CLOSE,
12454
+ return _this13.eventEmitter.emit(EVENT$3.ON_CHECKOUT_CLOSE, {
12455
+ event: EVENT$3.ON_CHECKOUT_CLOSE,
12319
12456
  data: data
12320
12457
  });
12321
12458
  });
@@ -12347,7 +12484,7 @@
12347
12484
  if (typeof onSuccess === 'function') {
12348
12485
  onSuccess();
12349
12486
  }
12350
- var event = captureResult.status === 'inreview' ? EVENT$4.PAYMENT_IN_REVIEW : EVENT$4.PAYMENT_SUCCESSFUL;
12487
+ var event = captureResult.status === 'inreview' ? EVENT$3.PAYMENT_IN_REVIEW : EVENT$3.PAYMENT_SUCCESSFUL;
12351
12488
  _this15.eventEmitter.emit(event, {
12352
12489
  event: event,
12353
12490
  data: _extends(_extends({}, captureResult), data.customer && {
@@ -12360,8 +12497,8 @@
12360
12497
  if (typeof onError === 'function') {
12361
12498
  onError(err);
12362
12499
  }
12363
- _this15.eventEmitter.emit(EVENT$4.PAYMENT_ERROR, {
12364
- event: EVENT$4.PAYMENT_ERROR,
12500
+ _this15.eventEmitter.emit(EVENT$3.PAYMENT_ERROR, {
12501
+ event: EVENT$3.PAYMENT_ERROR,
12365
12502
  data: err
12366
12503
  });
12367
12504
  });
@@ -12372,8 +12509,8 @@
12372
12509
  value: function setupPaymentSuccessCallback() {
12373
12510
  var _this16 = this;
12374
12511
  this.service.on(WALLET_EVENT.PAYMENT_SUCCESS, function (eventData) {
12375
- return _this16.eventEmitter.emit(EVENT$4.PAYMENT_SUCCESSFUL, {
12376
- event: EVENT$4.PAYMENT_SUCCESSFUL,
12512
+ return _this16.eventEmitter.emit(EVENT$3.PAYMENT_SUCCESSFUL, {
12513
+ event: EVENT$3.PAYMENT_SUCCESSFUL,
12377
12514
  data: eventData
12378
12515
  });
12379
12516
  });
@@ -12383,8 +12520,8 @@
12383
12520
  value: function setupPaymentInReviewCallback() {
12384
12521
  var _this17 = this;
12385
12522
  this.service.on(WALLET_EVENT.PAYMENT_IN_REVIEW, function (eventData) {
12386
- return _this17.eventEmitter.emit(EVENT$4.PAYMENT_IN_REVIEW, {
12387
- event: EVENT$4.PAYMENT_IN_REVIEW,
12523
+ return _this17.eventEmitter.emit(EVENT$3.PAYMENT_IN_REVIEW, {
12524
+ event: EVENT$3.PAYMENT_IN_REVIEW,
12388
12525
  data: eventData
12389
12526
  });
12390
12527
  });
@@ -12394,8 +12531,8 @@
12394
12531
  value: function setupPaymentErrorCallback() {
12395
12532
  var _this18 = this;
12396
12533
  this.service.on(WALLET_EVENT.PAYMENT_ERROR, function (eventData) {
12397
- return _this18.eventEmitter.emit(EVENT$4.PAYMENT_ERROR, {
12398
- event: EVENT$4.PAYMENT_ERROR,
12534
+ return _this18.eventEmitter.emit(EVENT$3.PAYMENT_ERROR, {
12535
+ event: EVENT$3.PAYMENT_ERROR,
12399
12536
  data: eventData
12400
12537
  });
12401
12538
  });
@@ -12405,8 +12542,8 @@
12405
12542
  value: function setupAuthTokensChangedCallback() {
12406
12543
  var _this19 = this;
12407
12544
  this.service.on(WALLET_EVENT.AUTH_TOKENS_CHANGED, function (eventData) {
12408
- return _this19.eventEmitter.emit(EVENT$4.AUTH_TOKENS_CHANGED, {
12409
- event: EVENT$4.AUTH_TOKENS_CHANGED,
12545
+ return _this19.eventEmitter.emit(EVENT$3.AUTH_TOKENS_CHANGED, {
12546
+ event: EVENT$3.AUTH_TOKENS_CHANGED,
12410
12547
  data: eventData
12411
12548
  });
12412
12549
  });
@@ -12734,28 +12871,59 @@
12734
12871
  }
12735
12872
  }
12736
12873
 
12874
+ /**
12875
+ * Top-level classification of an error. Used by the SDK to route errors to the
12876
+ * right category in instrumentation and to give consumers a coarse-grained
12877
+ * tag for grouping/filtering. See {@link getErrorCategory} for the mapping
12878
+ * between {@link ERROR_CAUSE} and {@link ERROR_CATEGORY}.
12879
+ */
12737
12880
  var ERROR_CATEGORY = {
12881
+ /** SDK was misconfigured (missing keys, invalid options, etc.). */
12738
12882
  CONFIGURATION: 'configuration',
12883
+ /** Authentication or authorization failure. */
12739
12884
  IDENTITY: 'identity_access_management',
12885
+ /** SDK internal failure or upstream service problem. */
12740
12886
  INTERNAL: 'internal',
12887
+ /** Flow lifecycle event (user cancelled, aborted, etc.) — not a real fault. */
12741
12888
  PROCESS: 'process',
12889
+ /** Resource lookup failed or was rate-limited. */
12742
12890
  RESOURCE: 'resource',
12891
+ /** Invalid input or business-rule validation failure. */
12743
12892
  VALIDATION: 'validation'
12744
12893
  };
12894
+ /**
12895
+ * Concrete cause of an error. More specific than {@link ERROR_CATEGORY} —
12896
+ * useful for deciding programmatic responses (e.g. show a retry button only
12897
+ * when `cause` is `'service_unreachable'` or `'server_busy'`).
12898
+ */
12745
12899
  var ERROR_CAUSE = {
12900
+ /** Operation was aborted programmatically. */
12746
12901
  ABORTED: 'aborted',
12902
+ /** Caller has insufficient permissions for the operation. */
12747
12903
  ACCESS_FORBIDDEN: 'access_forbidden',
12904
+ /** Resource already exists when create was expected. */
12748
12905
  ALREADY_EXISTS: 'already_exists',
12906
+ /** User cancelled the flow (e.g. closed the wallet sheet). */
12749
12907
  CANCELED: 'canceled',
12908
+ /** SDK was instantiated or invoked with invalid configuration. */
12750
12909
  INVALID_CONFIGURATION: 'invalid_configuration',
12910
+ /** Input failed structural or business-rule validation. */
12751
12911
  INVALID_INPUT: 'invalid_input',
12912
+ /** Resource was not found by the backend. */
12752
12913
  NOT_FOUND: 'not_found',
12914
+ /** Operation is not supported in the current context or version. */
12753
12915
  NOT_IMPLEMENTED: 'not_implemented',
12916
+ /** Caller exceeded the allowed request rate. */
12754
12917
  RATE_LIMITED: 'rate_limited',
12918
+ /** Backend is healthy but currently overloaded — typically retryable. */
12755
12919
  SERVER_BUSY: 'server_busy',
12920
+ /** Backend or third-party service could not be reached — typically retryable. */
12756
12921
  SERVICE_UNREACHABLE: 'service_unreachable',
12922
+ /** Caller is not authenticated. */
12757
12923
  UNAUTHORIZED: 'unauthorized',
12924
+ /** Catch-all when no other cause applies. */
12758
12925
  UNKNOWN: 'unknown_error',
12926
+ /** Request was syntactically valid but semantically rejected. */
12759
12927
  UNPROCESSABLE_ENTITY: 'unprocessable_entity'
12760
12928
  };
12761
12929
  var EventError = /*#__PURE__*/function (_Error) {
@@ -13921,7 +14089,7 @@
13921
14089
  }, {
13922
14090
  key: "handleErrorEvent",
13923
14091
  value: function handleErrorEvent(event, error, purpose) {
13924
- if (Object.values(EVENT$5).includes(event)) {
14092
+ if (Object.values(EVENT$4).includes(event)) {
13925
14093
  this.event.emit({
13926
14094
  error: error,
13927
14095
  event: event,
@@ -14107,7 +14275,7 @@
14107
14275
  }, function (error) {
14108
14276
  if (error instanceof EventError) {
14109
14277
  error.setContextId(_this2.link.getParams().widget_id);
14110
- _this2.handleErrorEvent(EVENT$5.ERROR, error.toJSON().error, error.purpose);
14278
+ _this2.handleErrorEvent(EVENT$4.ERROR, error.toJSON().error, error.purpose);
14111
14279
  }
14112
14280
  console.error('Error when creating a token, widget will not be loaded');
14113
14281
  });
@@ -14119,7 +14287,7 @@
14119
14287
  key: "afterLoad",
14120
14288
  value: function afterLoad() {
14121
14289
  var _this3 = this;
14122
- this.on(EVENT$5.VALIDATION, function (data) {
14290
+ this.on(EVENT$4.VALIDATION, function (data) {
14123
14291
  _this3.validationData = data;
14124
14292
  });
14125
14293
  }
@@ -14378,7 +14546,7 @@
14378
14546
  }, {
14379
14547
  key: "onFinishInsert",
14380
14548
  value: function onFinishInsert(selector, dataType) {
14381
- this.on(EVENT$5.FINISH, function (event) {
14549
+ this.on(EVENT$4.FINISH, function (event) {
14382
14550
  Event$1.insertToInput(selector, dataType, event);
14383
14551
  });
14384
14552
  }
@@ -14416,7 +14584,7 @@
14416
14584
  var formInterceptor = new FormInterceptor(selector);
14417
14585
  formInterceptor.beforeSubmit(function () {
14418
14586
  _this5.triggerElement.push(TRIGGER$1.SUBMIT_FORM, {});
14419
- _this5.event.on(EVENT$5.FINISH, _this5.link.getParams().widget_id, function () {
14587
+ _this5.event.on(EVENT$4.FINISH, _this5.link.getParams().widget_id, function () {
14420
14588
  formInterceptor.continueSubmit();
14421
14589
  });
14422
14590
  });
@@ -14429,13 +14597,13 @@
14429
14597
  value: function useCheckoutAutoSubmit() {
14430
14598
  var _this6 = this;
14431
14599
  this.setHiddenElements([ELEMENT.SUBMIT_BUTTON]);
14432
- this.on(EVENT$5.CHECKOUT_SUCCESS, function () {
14600
+ this.on(EVENT$4.CHECKOUT_SUCCESS, function () {
14433
14601
  _this6.trigger(TRIGGER$1.SUBMIT_FORM);
14434
14602
  });
14435
- this.on(EVENT$5.VALIDATION_ERROR, function () {
14603
+ this.on(EVENT$4.VALIDATION_ERROR, function () {
14436
14604
  _this6.trigger(TRIGGER$1.REFRESH_CHECKOUT);
14437
14605
  });
14438
- this.on(EVENT$5.SYSTEM_ERROR, function () {
14606
+ this.on(EVENT$4.SYSTEM_ERROR, function () {
14439
14607
  _this6.trigger(TRIGGER$1.REFRESH_CHECKOUT);
14440
14608
  });
14441
14609
  }
@@ -14452,7 +14620,7 @@
14452
14620
  key: "useAutoResize",
14453
14621
  value: function useAutoResize() {
14454
14622
  var _this7 = this;
14455
- this.on(EVENT$5.RESIZE, function (data) {
14623
+ this.on(EVENT$4.RESIZE, function (data) {
14456
14624
  if (_this7.iFrame.getElement()) {
14457
14625
  _this7.iFrame.getElement().scrolling = 'no';
14458
14626
  if (data.height) {
@@ -14815,7 +14983,6 @@
14815
14983
  });
14816
14984
  canvas.on('chargeAuthReject', function () {
14817
14985
  var _a;
14818
- // **TODO add interface for chargeAuthReject event **//
14819
14986
  (_a = _this.checkoutWidget) === null || _a === void 0 ? void 0 : _a.fetchInstruction();
14820
14987
  _this.api.checkout().callback({
14821
14988
  event: 'callback.child_widget.status',
@@ -14832,13 +14999,13 @@
14832
14999
  });
14833
15000
  canvas.on('error', function (event) {
14834
15001
  var _a;
14835
- // **TODO add interface for error event **//
14836
15002
  (_a = _this.checkoutWidget) === null || _a === void 0 ? void 0 : _a.fetchInstruction();
15003
+ var message = (event && _typeof$1(event) === 'object' && 'event' in event ? event.event : null) || 'error in 3ds widget';
14837
15004
  _this.api.checkout().callback({
14838
15005
  event: 'callback.child_widget.status',
14839
15006
  payload: {
14840
15007
  status: 'error',
14841
- message: (event === null || event === void 0 ? void 0 : event.event) || 'error in 3ds widget'
15008
+ message: message
14842
15009
  }
14843
15010
  }).then(function () {
14844
15011
  return console.info('callback.child_widget.status: - errorEvent');
@@ -16189,7 +16356,7 @@
16189
16356
  key: "useAutoResize",
16190
16357
  value: function useAutoResize() {
16191
16358
  var _this = this;
16192
- this.event.on(EVENT$5.RESIZE, this.link.getParams().widget_id, function (data) {
16359
+ this.event.on(EVENT$4.RESIZE, this.link.getParams().widget_id, function (data) {
16193
16360
  if (_this.iFrame.getElement()) {
16194
16361
  _this.iFrame.getElement().scrolling = 'no';
16195
16362
  if (data.height) {
@@ -17030,7 +17197,7 @@
17030
17197
  var _this = this;
17031
17198
  this.widget = new WalletButtons(this.selector, context.payload.charge_token, context.payload.meta);
17032
17199
  this.widget.setEnv(this.getEnv(context.instruction_token));
17033
- this.widget.on(EVENT$4.ON_WALLET_LOADED, function () {
17200
+ this.widget.on(EVENT$3.ON_WALLET_LOADED, function () {
17034
17201
  addGoBackToPaymentsButton(_this.selector, _this.checkoutWidget, _this.api);
17035
17202
  });
17036
17203
  this.widget.load();
@@ -17051,7 +17218,7 @@
17051
17218
  var _this = this;
17052
17219
  this.widget = new WalletButtons(this.selector, context === null || context === void 0 ? void 0 : context.payload.charge_token, context === null || context === void 0 ? void 0 : context.payload.meta);
17053
17220
  this.widget.setEnv(this.getEnv(context.instruction_token));
17054
- this.widget.on(EVENT$4.ON_WALLET_LOADED, function () {
17221
+ this.widget.on(EVENT$3.ON_WALLET_LOADED, function () {
17055
17222
  addGoBackToPaymentsButton(_this.selector, _this.checkoutWidget, _this.api);
17056
17223
  hideLoadingSpinner();
17057
17224
  });
@@ -17206,7 +17373,6 @@
17206
17373
  });
17207
17374
  canvas.on('chargeAuthReject', function () {
17208
17375
  var _a;
17209
- // **TODO add interface for chargeAuthReject event **//
17210
17376
  (_a = _this.checkoutWidget) === null || _a === void 0 ? void 0 : _a.fetchInstruction();
17211
17377
  _this.api.checkout().callback({
17212
17378
  event: 'callback.child_widget.status',
@@ -17223,13 +17389,13 @@
17223
17389
  });
17224
17390
  canvas.on('error', function (event) {
17225
17391
  var _a;
17226
- // **TODO add interface for error event **//
17227
17392
  (_a = _this.checkoutWidget) === null || _a === void 0 ? void 0 : _a.fetchInstruction();
17393
+ var message = (event && _typeof$1(event) === 'object' && 'event' in event ? event.event : null) || 'error in 3ds widget';
17228
17394
  _this.api.checkout().callback({
17229
17395
  event: 'callback.child_widget.status',
17230
17396
  payload: {
17231
17397
  status: 'error',
17232
- message: (event === null || event === void 0 ? void 0 : event.event) || 'error in 3ds widget'
17398
+ message: message
17233
17399
  }
17234
17400
  }).then(function () {
17235
17401
  return console.info('callback.child_widget.status: - errorEvent');
@@ -17384,7 +17550,7 @@
17384
17550
  this.widget.load();
17385
17551
  this.widget.useAutoResize();
17386
17552
  this.widget.setHiddenElements(['submit_button']);
17387
- this.widget.on(EVENT$5.AFTER_LOAD, function () {
17553
+ this.widget.on(EVENT$4.AFTER_LOAD, function () {
17388
17554
  _this.timeoutId = setTimeout(function () {
17389
17555
  _this.addSubmitButton();
17390
17556
  addGoBackToPaymentsButton(_this.selector, _this.checkoutWidget, _this.api);
@@ -17394,7 +17560,7 @@
17394
17560
  this.widget.on('submit', function () {
17395
17561
  return showLoadingSpinner();
17396
17562
  });
17397
- this.widget.on(EVENT$5.FINISH, function (event) {
17563
+ this.widget.on(EVENT$4.FINISH, function (event) {
17398
17564
  var _a;
17399
17565
  var get = new Api(context.instruction_token);
17400
17566
  (_a = _this.checkoutWidget) === null || _a === void 0 ? void 0 : _a.fetchInstruction();
@@ -17430,7 +17596,7 @@
17430
17596
  return console.error('callback.card_form.ott_created: error', error);
17431
17597
  });
17432
17598
  });
17433
- this.widget.on(EVENT$5.VALIDATION_ERROR, function (event) {
17599
+ this.widget.on(EVENT$4.VALIDATION_ERROR, function (event) {
17434
17600
  var _a;
17435
17601
  (_a = _this.checkoutWidget) === null || _a === void 0 ? void 0 : _a.fetchInstruction();
17436
17602
  _this.api.checkout().callback({
@@ -17715,7 +17881,7 @@
17715
17881
  var _this = this;
17716
17882
  this.widget = new WalletButtons(this.selector, context === null || context === void 0 ? void 0 : context.payload.charge_token, context === null || context === void 0 ? void 0 : context.payload.meta);
17717
17883
  this.widget.setEnv(this.getEnv(context.instruction_token));
17718
- this.widget.on(EVENT$4.ON_WALLET_LOADED, function () {
17884
+ this.widget.on(EVENT$3.ON_WALLET_LOADED, function () {
17719
17885
  addGoBackToPaymentsButton(_this.selector, _this.checkoutWidget, _this.api);
17720
17886
  hideLoadingSpinner();
17721
17887
  });
@@ -18030,7 +18196,7 @@
18030
18196
  standalone: true
18031
18197
  }));
18032
18198
  this.widget.setEnv(this.getEnv(context.instruction_token));
18033
- this.widget.on(EVENT$4.ON_WALLET_LOADED, function () {
18199
+ this.widget.on(EVENT$3.ON_WALLET_LOADED, function () {
18034
18200
  addGoBackToPaymentsButton(_this.selector, _this.checkoutWidget, _this.api);
18035
18201
  hideLoadingSpinner();
18036
18202
  });
@@ -18596,10 +18762,16 @@
18596
18762
  }
18597
18763
  }
18598
18764
 
18599
- var EVENT$3 = {
18600
- PAYMENT_SUCCESSFUL: 'paymentSuccessful',
18601
- PAYMENT_FAILURE: 'paymentFailure',
18602
- PAYMENT_EXPIRED: 'paymentExpired'
18765
+ /** Event name emitted when a checkout payment completes successfully. */
18766
+ var PAYMENT_SUCCESSFUL = 'paymentSuccessful';
18767
+ /** Event name emitted when a checkout payment fails. */
18768
+ var PAYMENT_FAILURE = 'paymentFailure';
18769
+ /** Event name emitted when a checkout session expires. */
18770
+ var PAYMENT_EXPIRED = 'paymentExpired';
18771
+ var EVENT$2 = {
18772
+ PAYMENT_SUCCESSFUL: PAYMENT_SUCCESSFUL,
18773
+ PAYMENT_FAILURE: PAYMENT_FAILURE,
18774
+ PAYMENT_EXPIRED: PAYMENT_EXPIRED
18603
18775
  };
18604
18776
  /**
18605
18777
  * Class CheckoutButton transform usual button into checkout
@@ -18624,7 +18796,7 @@
18624
18796
  this.checkoutFinished = false;
18625
18797
  try {
18626
18798
  this.eventEmitter = new EventEmitter();
18627
- this.intentTokenPayload = this.extractIntentTokenPayload(intentToken);
18799
+ this.intentTokenPayload = this.extractCheckoutIntentTokenPayload(intentToken);
18628
18800
  this.checkoutVersionHandler = getCheckoutVersionHandler(this.intentTokenPayload.version);
18629
18801
  this.instructions = this.initContractVersion();
18630
18802
  this.api = new ApiInternal(this.intentToken, API_AUTH_TYPE.TOKEN);
@@ -18685,8 +18857,8 @@
18685
18857
  }, 14 * 60 * 1000 + 45 * 1000);
18686
18858
  }
18687
18859
  }, {
18688
- key: "extractIntentTokenPayload",
18689
- value: function extractIntentTokenPayload(intentToken) {
18860
+ key: "extractCheckoutIntentTokenPayload",
18861
+ value: function extractCheckoutIntentTokenPayload(intentToken) {
18690
18862
  var tokenContent = AccessToken.validateJWT(intentToken);
18691
18863
  if (!tokenContent) {
18692
18864
  throw new Error('Intent token is broken or expired. Please, issue new one.');
@@ -18714,7 +18886,7 @@
18714
18886
  value: function ready() {
18715
18887
  var _this3 = this;
18716
18888
  this.changeLoadingSpinnerVisibility(true);
18717
- // biome-ignore lint/suspicious/noExplicitAny: <explanation>
18889
+ // biome-ignore lint/suspicious/noExplicitAny: checkoutApi.status returns a dynamic shape whose fields are narrowed at the call-sites below
18718
18890
  this.checkoutApi.status(this.intentTokenPayload.intent_id).then(function (response) {
18719
18891
  if (!(response === null || response === void 0 ? void 0 : response.status)) {
18720
18892
  throw new Error('Checkout Intent Status structure inconsistent');
@@ -18802,7 +18974,7 @@
18802
18974
  }, {
18803
18975
  key: "onPaymentSuccessful",
18804
18976
  value: function onPaymentSuccessful(handler) {
18805
- return this.eventEmitter.subscribe(EVENT$3.PAYMENT_SUCCESSFUL, handler);
18977
+ return this.eventEmitter.subscribe(EVENT$2.PAYMENT_SUCCESSFUL, handler);
18806
18978
  }
18807
18979
  /**
18808
18980
  * If the payment was not successful, the function passed as parameter will be called.
@@ -18816,21 +18988,21 @@
18816
18988
  }, {
18817
18989
  key: "onPaymentFailure",
18818
18990
  value: function onPaymentFailure(handler) {
18819
- return this.eventEmitter.subscribe(EVENT$3.PAYMENT_FAILURE, handler);
18991
+ return this.eventEmitter.subscribe(EVENT$2.PAYMENT_FAILURE, handler);
18820
18992
  }
18821
18993
  /**
18822
18994
  * If the payment was expired, the function passed as parameter will be called.
18823
18995
  * Important: Do not perform thread blocking operations in callback such as window.alert() calls.
18824
18996
  *
18825
18997
  * @example
18826
- * widget.onPaymentInReview((data) => {
18827
- * console.log('Payment in fraud review');
18998
+ * widget.onPaymentExpired((data) => {
18999
+ * console.log('Payment session expired');
18828
19000
  * });
18829
19001
  */
18830
19002
  }, {
18831
19003
  key: "onPaymentExpired",
18832
19004
  value: function onPaymentExpired(handler) {
18833
- return this.eventEmitter.subscribe(EVENT$3.PAYMENT_EXPIRED, handler);
19005
+ return this.eventEmitter.subscribe(EVENT$2.PAYMENT_EXPIRED, handler);
18834
19006
  }
18835
19007
  }, {
18836
19008
  key: "createWidgetStructure",
@@ -18906,7 +19078,7 @@
18906
19078
  /**
18907
19079
  * Events emitted during the OpenWallet payment lifecycle.
18908
19080
  */
18909
- var EVENT$2;
19081
+ var EVENT$1;
18910
19082
  (function (EVENT) {
18911
19083
  /** Emitted when the wallet button is clicked by the user. */
18912
19084
  EVENT["ON_CLICK"] = "onClick";
@@ -18924,7 +19096,7 @@
18924
19096
  EVENT["ON_SHIPPING_ADDRESS_CHANGE"] = "onShippingAddressChange";
18925
19097
  /** Emitted when the customer selects a shipping option. */
18926
19098
  EVENT["ON_SHIPPING_OPTIONS_CHANGE"] = "onShippingOptionsChange";
18927
- })(EVENT$2 || (EVENT$2 = {}));
19099
+ })(EVENT$1 || (EVENT$1 = {}));
18928
19100
 
18929
19101
  /**
18930
19102
  * @classdesc Abstract base class for Open Wallet buttons. **Do not instantiate directly.**
@@ -18945,7 +19117,15 @@
18945
19117
  function OpenWalletButtons(selector, publicKeyOrAccessToken, serviceId, meta) {
18946
19118
  _classCallCheck(this, OpenWalletButtons);
18947
19119
  this.env = DEFAULT_ENV;
19120
+ this.isDisabled = false;
18948
19121
  this.onShippingOptionsChangeHandlerRegistered = false;
19122
+ // Runtime guard: TypeScript's `abstract` keyword exists only at compile time.
19123
+ // Without this check, instantiating the base class directly silently fails
19124
+ // later when `this.validateWalletMeta()` resolves to `undefined`, producing
19125
+ // a confusing "is not a function" error far from the actual mistake.
19126
+ if ((this instanceof OpenWalletButtons ? this.constructor : void 0) === OpenWalletButtons) {
19127
+ throw new Error('OpenWalletButtons is an abstract base class and cannot be instantiated directly. ' + 'Use ApplePayOpenWalletButton or GooglePayOpenWalletButton instead.');
19128
+ }
18949
19129
  this.eventEmitter = new EventEmitter();
18950
19130
  this.container = new Container(selector);
18951
19131
  this.api = new ApiInternal(publicKeyOrAccessToken, this.getApiAuthType(publicKeyOrAccessToken));
@@ -19048,7 +19228,7 @@
19048
19228
  console.error('Wallet operation error:', error);
19049
19229
  }
19050
19230
  var errorData = {
19051
- event: EVENT$2.ERROR,
19231
+ event: EVENT$1.ERROR,
19052
19232
  data: {
19053
19233
  error: error,
19054
19234
  context: {
@@ -19056,7 +19236,7 @@
19056
19236
  }
19057
19237
  }
19058
19238
  };
19059
- this.eventEmitter.emit(EVENT$2.ERROR, errorData);
19239
+ this.eventEmitter.emit(EVENT$1.ERROR, errorData);
19060
19240
  }
19061
19241
  /**
19062
19242
  * Loads and initializes the wallet button based on the service configuration.
@@ -19082,6 +19262,68 @@
19082
19262
  _this.handleOnError(error instanceof Error ? error : new Error(String(error)), exports.ERROR_OPERATION.CONFIGURATION);
19083
19263
  });
19084
19264
  }
19265
+ /**
19266
+ * Enables the wallet button, restoring interactivity and visual appearance.
19267
+ * If the button was previously disabled via `disable()`, calling this method
19268
+ * re-enables clicks and removes the disabled visual state.
19269
+ *
19270
+ * Idempotent — calling on an already-enabled button has no effect.
19271
+ *
19272
+ * @example
19273
+ * button.enable();
19274
+ */
19275
+ }, {
19276
+ key: "enable",
19277
+ value: function enable() {
19278
+ this.isDisabled = false;
19279
+ this.applyDisabledStyles();
19280
+ }
19281
+ /**
19282
+ * Disables the wallet button, preventing clicks and applying a visual disabled state.
19283
+ * When disabled, the button appears grayed out (`opacity: 0.5`) and does not
19284
+ * respond to user interaction (`pointer-events: none`). For accessibility, the
19285
+ * `aria-disabled="true"` attribute is also set on the container.
19286
+ *
19287
+ * Programmatic clicks (e.g. invoked by the wallet provider's SDK) are blocked
19288
+ * by an explicit guard inside the click handler — the button's wallet service
19289
+ * checks the disabled state before processing.
19290
+ *
19291
+ * Idempotent — calling on an already-disabled button has no effect.
19292
+ * Safe to call before `load()` (no-throw); the styles are applied once the
19293
+ * container element exists.
19294
+ *
19295
+ * @example
19296
+ * button.disable();
19297
+ */
19298
+ }, {
19299
+ key: "disable",
19300
+ value: function disable() {
19301
+ this.isDisabled = true;
19302
+ this.applyDisabledStyles();
19303
+ }
19304
+ /**
19305
+ * Applies the disabled / enabled visual state to the container element.
19306
+ * Reads `this.isDisabled` and toggles the corresponding CSS + ARIA attributes.
19307
+ *
19308
+ * @private
19309
+ */
19310
+ }, {
19311
+ key: "applyDisabledStyles",
19312
+ value: function applyDisabledStyles() {
19313
+ var element = this.container.getElement();
19314
+ if (!element) {
19315
+ return;
19316
+ }
19317
+ if (this.isDisabled) {
19318
+ element.style.pointerEvents = 'none';
19319
+ element.style.opacity = '0.5';
19320
+ element.setAttribute('aria-disabled', 'true');
19321
+ } else {
19322
+ element.style.pointerEvents = '';
19323
+ element.style.opacity = '';
19324
+ element.removeAttribute('aria-disabled');
19325
+ }
19326
+ }
19085
19327
  /**
19086
19328
  * Current method can change environment. By default environment = sandbox.
19087
19329
  * Also we can change domain alias for this environment. By default domain_alias = paydock.com
@@ -19178,7 +19420,7 @@
19178
19420
  key: "onClick",
19179
19421
  value: function onClick(handler) {
19180
19422
  if (typeof handler === 'function') {
19181
- this.eventEmitter.subscribe(EVENT$2.ON_CLICK, handler);
19423
+ this.eventEmitter.subscribe(EVENT$1.ON_CLICK, handler);
19182
19424
  return;
19183
19425
  }
19184
19426
  this.handleOnError(new Error('onClick event handler is required.'), exports.ERROR_OPERATION.HANDLER_REGISTRATION);
@@ -19217,7 +19459,7 @@
19217
19459
  value: function onSuccess(handler) {
19218
19460
  var _this2 = this;
19219
19461
  if (typeof handler === 'function') {
19220
- this.eventEmitter.subscribe(EVENT$2.SUCCESS, function (data) {
19462
+ this.eventEmitter.subscribe(EVENT$1.SUCCESS, function (data) {
19221
19463
  return __awaiter(_this2, void 0, void 0, /*#__PURE__*/_regenerator().m(function _callee2() {
19222
19464
  var _t3;
19223
19465
  return _regenerator().w(function (_context2) {
@@ -19269,7 +19511,7 @@
19269
19511
  value: function onUnavailable(handler) {
19270
19512
  var _this3 = this;
19271
19513
  if (typeof handler === 'function') {
19272
- this.eventEmitter.subscribe(EVENT$2.UNAVAILABLE, function (data) {
19514
+ this.eventEmitter.subscribe(EVENT$1.UNAVAILABLE, function (data) {
19273
19515
  return __awaiter(_this3, void 0, void 0, /*#__PURE__*/_regenerator().m(function _callee3() {
19274
19516
  var _t4;
19275
19517
  return _regenerator().w(function (_context3) {
@@ -19322,7 +19564,7 @@
19322
19564
  value: function onError(handler) {
19323
19565
  var _this4 = this;
19324
19566
  if (typeof handler === 'function') {
19325
- this.eventEmitter.subscribe(EVENT$2.ERROR, function (data) {
19567
+ this.eventEmitter.subscribe(EVENT$1.ERROR, function (data) {
19326
19568
  return __awaiter(_this4, void 0, void 0, /*#__PURE__*/_regenerator().m(function _callee4() {
19327
19569
  var _t5;
19328
19570
  return _regenerator().w(function (_context4) {
@@ -19374,7 +19616,7 @@
19374
19616
  value: function onCancel(handler) {
19375
19617
  var _this5 = this;
19376
19618
  if (typeof handler === 'function') {
19377
- this.eventEmitter.subscribe(EVENT$2.CHECKOUT_CLOSE, function (data) {
19619
+ this.eventEmitter.subscribe(EVENT$1.CHECKOUT_CLOSE, function (data) {
19378
19620
  return __awaiter(_this5, void 0, void 0, /*#__PURE__*/_regenerator().m(function _callee5() {
19379
19621
  var _t6;
19380
19622
  return _regenerator().w(function (_context5) {
@@ -19419,7 +19661,7 @@
19419
19661
  value: function onLoaded(handler) {
19420
19662
  var _this6 = this;
19421
19663
  if (typeof handler === 'function') {
19422
- this.eventEmitter.subscribe(EVENT$2.LOADED, function (data) {
19664
+ this.eventEmitter.subscribe(EVENT$1.LOADED, function (data) {
19423
19665
  return __awaiter(_this6, void 0, void 0, /*#__PURE__*/_regenerator().m(function _callee6() {
19424
19666
  var _t7;
19425
19667
  return _regenerator().w(function (_context6) {
@@ -19491,7 +19733,7 @@
19491
19733
  key: "onShippingAddressChange",
19492
19734
  value: function onShippingAddressChange(handler) {
19493
19735
  if (typeof handler === 'function') {
19494
- return this.eventEmitter.subscribe(EVENT$2.ON_SHIPPING_ADDRESS_CHANGE, handler);
19736
+ return this.eventEmitter.subscribe(EVENT$1.ON_SHIPPING_ADDRESS_CHANGE, handler);
19495
19737
  }
19496
19738
  this.handleOnError(new Error('onShippingAddressChange event handler is required.'), exports.ERROR_OPERATION.HANDLER_REGISTRATION);
19497
19739
  }
@@ -19536,7 +19778,7 @@
19536
19778
  value: function onShippingOptionsChange(handler) {
19537
19779
  if (typeof handler === 'function') {
19538
19780
  this.onShippingOptionsChangeHandlerRegistered = true;
19539
- return this.eventEmitter.subscribe(EVENT$2.ON_SHIPPING_OPTIONS_CHANGE, handler);
19781
+ return this.eventEmitter.subscribe(EVENT$1.ON_SHIPPING_OPTIONS_CHANGE, handler);
19540
19782
  }
19541
19783
  this.handleOnError(new Error('onShippingOptionsChange event handler is required.'), exports.ERROR_OPERATION.HANDLER_REGISTRATION);
19542
19784
  }
@@ -19571,7 +19813,9 @@
19571
19813
  * Returns `undefined` if the resulting object has no remaining properties.
19572
19814
  */
19573
19815
  function stripEmpty(obj) {
19574
- if (!obj || _typeof$1(obj) !== 'object') return undefined;
19816
+ if (!obj || _typeof$1(obj) !== 'object') {
19817
+ return undefined;
19818
+ }
19575
19819
  var result = {};
19576
19820
  for (var _i = 0, _Object$entries = Object.entries(obj); _i < _Object$entries.length; _i++) {
19577
19821
  var _Object$entries$_i = _slicedToArray(_Object$entries[_i], 2),
@@ -19620,13 +19864,30 @@
19620
19864
  this.serviceGroup = SERVICE_GROUP.WALLET;
19621
19865
  }
19622
19866
  /**
19623
- * Creates a One-Time Token (OTT) by sending the payment data to the API.
19624
- * Emits {@link EVENT.SUCCESS} on success or {@link EVENT.ERROR} on failure.
19867
+ * Returns whether the wallet button is currently disabled.
19868
+ * Reads the `aria-disabled` attribute from the container element — set by the
19869
+ * button class via {@link OpenWalletButtons.disable} / {@link OpenWalletButtons.enable}.
19870
+ *
19871
+ * Used to short-circuit click handlers in concrete wallet services for clicks
19872
+ * that bypass the DOM `pointer-events: none` guard (e.g. invoked by the wallet
19873
+ * provider's SDK callback).
19625
19874
  *
19626
- * @param data - The payment data including amount, shipping, billing, card info, and ref token.
19627
- * @returns A promise resolving to the OTT response.
19875
+ * @returns `true` if the container is marked as disabled, `false` otherwise.
19628
19876
  */
19629
19877
  return _createClass(OpenWalletService, [{
19878
+ key: "isButtonDisabled",
19879
+ value: function isButtonDisabled() {
19880
+ var element = this.container.getElement();
19881
+ return (element === null || element === void 0 ? void 0 : element.getAttribute('aria-disabled')) === 'true';
19882
+ }
19883
+ /**
19884
+ * Creates a One-Time Token (OTT) by sending the payment data to the API.
19885
+ * Emits {@link EVENT.SUCCESS} on success or {@link EVENT.ERROR} on failure.
19886
+ *
19887
+ * @param data - The payment data including amount, shipping, billing, card info, and ref token.
19888
+ * @returns A promise resolving to the OTT response.
19889
+ */
19890
+ }, {
19630
19891
  key: "createOTT",
19631
19892
  value: function createOTT(data) {
19632
19893
  var _this = this;
@@ -19650,8 +19911,8 @@
19650
19911
  return this.api.paymentSource().createOTT(requestData).then(function (response) {
19651
19912
  var cleanShipping = stripEmpty(shipping);
19652
19913
  var cleanBilling = stripEmpty(billing);
19653
- _this.eventEmitter.emit(EVENT$2.SUCCESS, {
19654
- event: EVENT$2.SUCCESS,
19914
+ _this.eventEmitter.emit(EVENT$1.SUCCESS, {
19915
+ event: EVENT$1.SUCCESS,
19655
19916
  data: _extends(_extends({
19656
19917
  token: response,
19657
19918
  amount: amount
@@ -19664,8 +19925,8 @@
19664
19925
  return response;
19665
19926
  })["catch"](function (err) {
19666
19927
  var _a, _b, _c, _d;
19667
- _this.eventEmitter.emit(EVENT$2.ERROR, {
19668
- event: EVENT$2.ERROR,
19928
+ _this.eventEmitter.emit(EVENT$1.ERROR, {
19929
+ event: EVENT$1.ERROR,
19669
19930
  data: {
19670
19931
  message: ((_a = err === null || err === void 0 ? void 0 : err.error) === null || _a === void 0 ? void 0 : _a.message) || (err === null || err === void 0 ? void 0 : err.message) || ((_b = err === null || err === void 0 ? void 0 : err.error_summary) === null || _b === void 0 ? void 0 : _b.message),
19671
19932
  code: ((_c = err === null || err === void 0 ? void 0 : err.error) === null || _c === void 0 ? void 0 : _c.code) || (err === null || err === void 0 ? void 0 : err.code) || ((_d = err === null || err === void 0 ? void 0 : err.error_summary) === null || _d === void 0 ? void 0 : _d.code)
@@ -19712,7 +19973,7 @@
19712
19973
  value: function handleOnUnavailable() {
19713
19974
  var reason = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'Wallet not available';
19714
19975
  var unavailableData = {
19715
- event: EVENT$2.UNAVAILABLE,
19976
+ event: EVENT$1.UNAVAILABLE,
19716
19977
  data: {
19717
19978
  reason: reason,
19718
19979
  details: {
@@ -19720,7 +19981,7 @@
19720
19981
  }
19721
19982
  }
19722
19983
  };
19723
- this.eventEmitter.emit(EVENT$2.UNAVAILABLE, unavailableData);
19984
+ this.eventEmitter.emit(EVENT$1.UNAVAILABLE, unavailableData);
19724
19985
  }
19725
19986
  /**
19726
19987
  * Emits the {@link EVENT.ERROR} event and logs the error to the console.
@@ -19736,7 +19997,7 @@
19736
19997
  console.error('Wallet operation error:', error);
19737
19998
  }
19738
19999
  var errorData = {
19739
- event: EVENT$2.ERROR,
20000
+ event: EVENT$1.ERROR,
19740
20001
  data: {
19741
20002
  error: error,
19742
20003
  context: {
@@ -19744,7 +20005,7 @@
19744
20005
  }
19745
20006
  }
19746
20007
  };
19747
- this.eventEmitter.emit(EVENT$2.ERROR, errorData);
20008
+ this.eventEmitter.emit(EVENT$1.ERROR, errorData);
19748
20009
  }
19749
20010
  /**
19750
20011
  * Removes the wallet button element from the DOM.
@@ -19794,8 +20055,8 @@
19794
20055
  _this.serviceConfig = serviceConfig;
19795
20056
  _this.latestShippingData = {};
19796
20057
  _this.onCancelPayment = function () {
19797
- return _this.eventEmitter.emit(EVENT$2.CHECKOUT_CLOSE, {
19798
- event: EVENT$2.CHECKOUT_CLOSE
20058
+ return _this.eventEmitter.emit(EVENT$1.CHECKOUT_CLOSE, {
20059
+ event: EVENT$1.CHECKOUT_CLOSE
19799
20060
  });
19800
20061
  };
19801
20062
  _this.onValidateMerchant = function () {
@@ -19875,7 +20136,7 @@
19875
20136
  while (1) switch (_context.n) {
19876
20137
  case 0:
19877
20138
  return _context.a(2, this.handleMerchantOnShippingChangedEvent({
19878
- event: EVENT$2.ON_SHIPPING_ADDRESS_CHANGE,
20139
+ event: EVENT$1.ON_SHIPPING_ADDRESS_CHANGE,
19879
20140
  data: this.parseShippingContactUpdateEvent(data)
19880
20141
  }).then(function (response) {
19881
20142
  var _a, _b;
@@ -19924,7 +20185,7 @@
19924
20185
  while (1) switch (_context2.n) {
19925
20186
  case 0:
19926
20187
  return _context2.a(2, this.handleMerchantOnShippingChangedEvent({
19927
- event: EVENT$2.ON_SHIPPING_OPTIONS_CHANGE,
20188
+ event: EVENT$1.ON_SHIPPING_OPTIONS_CHANGE,
19928
20189
  data: this.parseShippingMethodUpdateEvent(data)
19929
20190
  }).then(function (response) {
19930
20191
  var _a;
@@ -20139,15 +20400,23 @@
20139
20400
  return;
20140
20401
  }
20141
20402
  applePayButton.addEventListener('click', this.onApplePayButtonClicked.bind(this));
20142
- this.eventEmitter.emit(EVENT$2.LOADED, {
20143
- event: EVENT$2.LOADED
20403
+ this.eventEmitter.emit(EVENT$1.LOADED, {
20404
+ event: EVENT$1.LOADED
20144
20405
  });
20145
20406
  }
20146
20407
  }, {
20147
20408
  key: "onApplePayButtonClicked",
20148
20409
  value: function onApplePayButtonClicked() {
20149
20410
  var _this7 = this;
20150
- this.paymentSession = new ApplePaySession(14, this.mapMetaToApplePayPaymentRequest());
20411
+ if (this.isButtonDisabled()) {
20412
+ return;
20413
+ }
20414
+ var applePayApiVersion = getSupportedApplePayVersion();
20415
+ if (applePayApiVersion === 0) {
20416
+ this.handleOnUnavailable('Apple Pay version not supported');
20417
+ return;
20418
+ }
20419
+ this.paymentSession = new ApplePaySession(applePayApiVersion, this.mapMetaToApplePayPaymentRequest());
20151
20420
  this.paymentSession.onvalidatemerchant = this.onValidateMerchant;
20152
20421
  this.paymentSession.onpaymentauthorized = this.onPaymentAuthorized;
20153
20422
  this.paymentSession.oncancel = this.onCancelPayment;
@@ -20193,8 +20462,8 @@
20193
20462
  while (1) switch (_context4.n) {
20194
20463
  case 0:
20195
20464
  _context4.n = 1;
20196
- return this.eventEmitter.emitWithResult(EVENT$2.ON_CLICK, {
20197
- event: EVENT$2.ON_CLICK
20465
+ return this.eventEmitter.emitWithResult(EVENT$1.ON_CLICK, {
20466
+ event: EVENT$1.ON_CLICK
20198
20467
  });
20199
20468
  case 1:
20200
20469
  results = _context4.v;
@@ -20518,8 +20787,8 @@
20518
20787
  * Used to translate shipping-related Google Pay events to the unified event system.
20519
20788
  */
20520
20789
  ({
20521
- SHIPPING_ADDRESS: EVENT$2.ON_SHIPPING_ADDRESS_CHANGE,
20522
- SHIPPING_OPTION: EVENT$2.ON_SHIPPING_OPTIONS_CHANGE
20790
+ SHIPPING_ADDRESS: EVENT$1.ON_SHIPPING_ADDRESS_CHANGE,
20791
+ SHIPPING_OPTION: EVENT$1.ON_SHIPPING_OPTIONS_CHANGE
20523
20792
  });
20524
20793
 
20525
20794
  /**
@@ -20884,14 +21153,17 @@
20884
21153
  buttonColor: ((_c = this.getMetaStyles()) === null || _c === void 0 ? void 0 : _c.button_color) || 'default'
20885
21154
  });
20886
21155
  button.appendChild(googlePayButton);
20887
- this.eventEmitter.emit(EVENT$2.LOADED, {
20888
- event: EVENT$2.LOADED
21156
+ this.eventEmitter.emit(EVENT$1.LOADED, {
21157
+ event: EVENT$1.LOADED
20889
21158
  });
20890
21159
  }
20891
21160
  }, {
20892
21161
  key: "onGooglePayButtonClicked",
20893
21162
  value: function onGooglePayButtonClicked() {
20894
21163
  var _this5 = this;
21164
+ if (this.isButtonDisabled()) {
21165
+ return;
21166
+ }
20895
21167
  if (this.processingButtonClick) {
20896
21168
  console.warn('Google Pay button clicked while processing.');
20897
21169
  return;
@@ -20914,8 +21186,8 @@
20914
21186
  while (1) switch (_context3.n) {
20915
21187
  case 0:
20916
21188
  _context3.n = 1;
20917
- return this.eventEmitter.emitWithResult(EVENT$2.ON_CLICK, {
20918
- event: EVENT$2.ON_CLICK
21189
+ return this.eventEmitter.emitWithResult(EVENT$1.ON_CLICK, {
21190
+ event: EVENT$1.ON_CLICK
20919
21191
  });
20920
21192
  case 1:
20921
21193
  results = _context3.v;
@@ -20941,8 +21213,8 @@
20941
21213
  while (1) switch (_context4.n) {
20942
21214
  case 0:
20943
21215
  return _context4.a(2, this.paymentsClient.loadPaymentData(this.createPaymentDataRequest())["catch"](function (err) {
20944
- _this6.eventEmitter.emit(EVENT$2.CHECKOUT_CLOSE, {
20945
- event: EVENT$2.CHECKOUT_CLOSE
21216
+ _this6.eventEmitter.emit(EVENT$1.CHECKOUT_CLOSE, {
21217
+ event: EVENT$1.CHECKOUT_CLOSE
20946
21218
  });
20947
21219
  _this6.processingButtonClick = false;
20948
21220
  throw err;
@@ -21006,13 +21278,13 @@
21006
21278
  if (intermediatePaymentData.callbackTrigger === 'INITIALIZE' || intermediatePaymentData.callbackTrigger === 'SHIPPING_ADDRESS') {
21007
21279
  callbackIntent = 'SHIPPING_ADDRESS';
21008
21280
  eventData = {
21009
- event: EVENT$2.ON_SHIPPING_ADDRESS_CHANGE,
21281
+ event: EVENT$1.ON_SHIPPING_ADDRESS_CHANGE,
21010
21282
  data: parsedUpdateData.shipping
21011
21283
  };
21012
21284
  } else if (intermediatePaymentData.callbackTrigger === 'SHIPPING_OPTION') {
21013
21285
  callbackIntent = 'SHIPPING_OPTION';
21014
21286
  eventData = {
21015
- event: EVENT$2.ON_SHIPPING_OPTIONS_CHANGE,
21287
+ event: EVENT$1.ON_SHIPPING_OPTIONS_CHANGE,
21016
21288
  data: {
21017
21289
  shipping_option_id: (_a = parsedUpdateData.selected_shipping_option) === null || _a === void 0 ? void 0 : _a.id,
21018
21290
  label: (_b = parsedUpdateData.selected_shipping_option) === null || _b === void 0 ? void 0 : _b.label,
@@ -21712,7 +21984,7 @@
21712
21984
  }, {
21713
21985
  key: "onSelectInsert",
21714
21986
  value: function onSelectInsert(selector, dataType) {
21715
- this.on(EVENT$5.SELECT, function (event) {
21987
+ this.on(EVENT$4.SELECT, function (event) {
21716
21988
  Event$1.insertToInput(selector, dataType, event);
21717
21989
  });
21718
21990
  }
@@ -22282,7 +22554,7 @@
22282
22554
  * @param {string} CHECKOUT_COMPLETED=checkoutCompleted Event sent on successful checkout by customer. Check [data](#EventDataCheckoutCompletedData) for more information.
22283
22555
  * @param {string} CHECKOUT_ERROR=checkoutError Event sent on error checkout by customer. Check [data](#EventData) for more information.
22284
22556
  */
22285
- var EVENT$1;
22557
+ var EVENT;
22286
22558
  (function (EVENT) {
22287
22559
  EVENT["IFRAME_LOADED"] = "iframeLoaded";
22288
22560
  EVENT["CHECKOUT_READY"] = "checkoutReady";
@@ -22290,7 +22562,7 @@
22290
22562
  EVENT["CHECKOUT_ERROR"] = "checkoutError";
22291
22563
  EVENT["CHECKOUT_POPUP_OPEN"] = "checkoutPopupOpen";
22292
22564
  EVENT["CHECKOUT_POPUP_CLOSE"] = "checkoutPopupClose";
22293
- })(EVENT$1 || (EVENT$1 = {}));
22565
+ })(EVENT || (EVENT = {}));
22294
22566
  /**
22295
22567
  * List of available event data types
22296
22568
  * @enum EVENT_DATA_TYPE
@@ -22460,25 +22732,25 @@
22460
22732
  var _this = this;
22461
22733
  var widgetId = this.link.getParams().widget_id;
22462
22734
  if (!widgetId) return;
22463
- this.iFrameEvent.on(EVENT$1.CHECKOUT_READY, widgetId, function (_ref) {
22735
+ this.iFrameEvent.on(EVENT.CHECKOUT_READY, widgetId, function (_ref) {
22464
22736
  var data = _ref.data;
22465
- _this.eventEmitter.emit(EVENT$1.CHECKOUT_READY, data);
22737
+ _this.eventEmitter.emit(EVENT.CHECKOUT_READY, data);
22466
22738
  });
22467
- this.iFrameEvent.on(EVENT$1.CHECKOUT_COMPLETED, widgetId, function (_ref2) {
22739
+ this.iFrameEvent.on(EVENT.CHECKOUT_COMPLETED, widgetId, function (_ref2) {
22468
22740
  var data = _ref2.data;
22469
- _this.eventEmitter.emit(EVENT$1.CHECKOUT_COMPLETED, data);
22741
+ _this.eventEmitter.emit(EVENT.CHECKOUT_COMPLETED, data);
22470
22742
  });
22471
- this.iFrameEvent.on(EVENT$1.CHECKOUT_POPUP_OPEN, widgetId, function (_ref3) {
22743
+ this.iFrameEvent.on(EVENT.CHECKOUT_POPUP_OPEN, widgetId, function (_ref3) {
22472
22744
  var data = _ref3.data;
22473
- _this.eventEmitter.emit(EVENT$1.CHECKOUT_POPUP_OPEN, data);
22745
+ _this.eventEmitter.emit(EVENT.CHECKOUT_POPUP_OPEN, data);
22474
22746
  });
22475
- this.iFrameEvent.on(EVENT$1.CHECKOUT_POPUP_CLOSE, widgetId, function (_ref4) {
22747
+ this.iFrameEvent.on(EVENT.CHECKOUT_POPUP_CLOSE, widgetId, function (_ref4) {
22476
22748
  var data = _ref4.data;
22477
- _this.eventEmitter.emit(EVENT$1.CHECKOUT_POPUP_CLOSE, data);
22749
+ _this.eventEmitter.emit(EVENT.CHECKOUT_POPUP_CLOSE, data);
22478
22750
  });
22479
- this.iFrameEvent.on(EVENT$1.CHECKOUT_ERROR, widgetId, function (_ref5) {
22751
+ this.iFrameEvent.on(EVENT.CHECKOUT_ERROR, widgetId, function (_ref5) {
22480
22752
  var data = _ref5.data;
22481
- _this.eventEmitter.emit(EVENT$1.CHECKOUT_ERROR, data);
22753
+ _this.eventEmitter.emit(EVENT.CHECKOUT_ERROR, data);
22482
22754
  });
22483
22755
  if (this.autoResize) this.useAutoResize(true);
22484
22756
  }
@@ -22501,7 +22773,7 @@
22501
22773
  if (iframeElement) {
22502
22774
  iframeElement.onload = function () {
22503
22775
  _this2.isIframeLoaded = true;
22504
- _this2.eventEmitter.emit(EVENT$1.IFRAME_LOADED, {});
22776
+ _this2.eventEmitter.emit(EVENT.IFRAME_LOADED, {});
22505
22777
  if (_this2.injectedCustomerData) {
22506
22778
  _this2.injectCustomerData(_this2.injectedCustomerData);
22507
22779
  _this2.injectedCustomerData = null;
@@ -22988,7 +23260,7 @@
22988
23260
  }]);
22989
23261
  }();
22990
23262
 
22991
- var EVENT;
23263
+ exports.WALLET_BUTTONS_EXPRESS_EVENT = void 0;
22992
23264
  (function (EVENT) {
22993
23265
  EVENT["UNAVAILABLE"] = "unavailable";
22994
23266
  EVENT["ERROR"] = "error";
@@ -22999,12 +23271,13 @@
22999
23271
  EVENT["ON_CHECKOUT_CLOSE"] = "onCheckoutClose";
23000
23272
  EVENT["ON_SHIPPING_ADDRESS_CHANGE"] = "onShippingAddressChange";
23001
23273
  EVENT["ON_SHIPPING_OPTIONS_CHANGE"] = "onShippingOptionsChange";
23002
- })(EVENT || (EVENT = {}));
23274
+ })(exports.WALLET_BUTTONS_EXPRESS_EVENT || (exports.WALLET_BUTTONS_EXPRESS_EVENT = {}));
23003
23275
 
23004
23276
  var BaseWalletButton = /*#__PURE__*/function () {
23005
23277
  function BaseWalletButton(selector, publicKeyOrAccessToken, gatewayId, meta, requiredMetaFields) {
23006
23278
  _classCallCheck(this, BaseWalletButton);
23007
23279
  this.env = DEFAULT_ENV;
23280
+ this.isDisabled = false;
23008
23281
  this.onShippingOptionsChangeHandlerRegistered = false;
23009
23282
  this.eventEmitter = new EventEmitter();
23010
23283
  this.container = new Container(selector);
@@ -23037,6 +23310,30 @@
23037
23310
  this.env = env;
23038
23311
  this.api.setEnv(env, alias);
23039
23312
  }
23313
+ /**
23314
+ * Enables the wallet button, restoring interactivity and visual appearance.
23315
+ *
23316
+ * @example
23317
+ * button.enable();
23318
+ */
23319
+ }, {
23320
+ key: "enable",
23321
+ value: function enable() {
23322
+ this.isDisabled = false;
23323
+ this.applyDisabledStyles();
23324
+ }
23325
+ /**
23326
+ * Disables the wallet button, preventing clicks and applying a visual disabled state.
23327
+ *
23328
+ * @example
23329
+ * button.disable();
23330
+ */
23331
+ }, {
23332
+ key: "disable",
23333
+ value: function disable() {
23334
+ this.isDisabled = true;
23335
+ this.applyDisabledStyles();
23336
+ }
23040
23337
  /**
23041
23338
  * Callback for onClick method.
23042
23339
  *
@@ -23064,7 +23361,7 @@
23064
23361
  key: "onClick",
23065
23362
  value: function onClick(handler) {
23066
23363
  if (typeof handler === 'function') {
23067
- return this.eventEmitter.subscribe(EVENT.ON_CLICK, handler);
23364
+ return this.eventEmitter.subscribe(exports.WALLET_BUTTONS_EXPRESS_EVENT.ON_CLICK, handler);
23068
23365
  }
23069
23366
  this.handleOnError(new Error('onClick event handler is required to return the wallet token string.'));
23070
23367
  }
@@ -23093,10 +23390,10 @@
23093
23390
  value: function onPaymentSuccessful(handler) {
23094
23391
  var _this = this;
23095
23392
  if (typeof handler === 'function') {
23096
- return this.eventEmitter.subscribe(EVENT.PAYMENT_SUCCESSFUL, handler);
23393
+ return this.eventEmitter.subscribe(exports.WALLET_BUTTONS_EXPRESS_EVENT.PAYMENT_SUCCESSFUL, handler);
23097
23394
  }
23098
23395
  return new Promise(function (resolve) {
23099
- return _this.eventEmitter.subscribe(EVENT.PAYMENT_SUCCESSFUL, function (data) {
23396
+ return _this.eventEmitter.subscribe(exports.WALLET_BUTTONS_EXPRESS_EVENT.PAYMENT_SUCCESSFUL, function (data) {
23100
23397
  return resolve(data);
23101
23398
  });
23102
23399
  });
@@ -23126,10 +23423,10 @@
23126
23423
  value: function onPaymentInReview(handler) {
23127
23424
  var _this2 = this;
23128
23425
  if (typeof handler === 'function') {
23129
- return this.eventEmitter.subscribe(EVENT.PAYMENT_IN_REVIEW, handler);
23426
+ return this.eventEmitter.subscribe(exports.WALLET_BUTTONS_EXPRESS_EVENT.PAYMENT_IN_REVIEW, handler);
23130
23427
  }
23131
23428
  return new Promise(function (resolve) {
23132
- return _this2.eventEmitter.subscribe(EVENT.PAYMENT_IN_REVIEW, function (data) {
23429
+ return _this2.eventEmitter.subscribe(exports.WALLET_BUTTONS_EXPRESS_EVENT.PAYMENT_IN_REVIEW, function (data) {
23133
23430
  return resolve(data);
23134
23431
  });
23135
23432
  });
@@ -23159,10 +23456,10 @@
23159
23456
  value: function onPaymentError(handler) {
23160
23457
  var _this3 = this;
23161
23458
  if (typeof handler === 'function') {
23162
- return this.eventEmitter.subscribe(EVENT.PAYMENT_ERROR, handler);
23459
+ return this.eventEmitter.subscribe(exports.WALLET_BUTTONS_EXPRESS_EVENT.PAYMENT_ERROR, handler);
23163
23460
  }
23164
23461
  return new Promise(function (resolve) {
23165
- return _this3.eventEmitter.subscribe(EVENT.PAYMENT_ERROR, function (err) {
23462
+ return _this3.eventEmitter.subscribe(exports.WALLET_BUTTONS_EXPRESS_EVENT.PAYMENT_ERROR, function (err) {
23166
23463
  return resolve(err);
23167
23464
  });
23168
23465
  });
@@ -23188,10 +23485,10 @@
23188
23485
  value: function onCheckoutClose(handler) {
23189
23486
  var _this4 = this;
23190
23487
  if (typeof handler === 'function') {
23191
- return this.eventEmitter.subscribe(EVENT.ON_CHECKOUT_CLOSE, handler);
23488
+ return this.eventEmitter.subscribe(exports.WALLET_BUTTONS_EXPRESS_EVENT.ON_CHECKOUT_CLOSE, handler);
23192
23489
  }
23193
23490
  return new Promise(function (resolve) {
23194
- return _this4.eventEmitter.subscribe(EVENT.ON_CHECKOUT_CLOSE, function (err) {
23491
+ return _this4.eventEmitter.subscribe(exports.WALLET_BUTTONS_EXPRESS_EVENT.ON_CHECKOUT_CLOSE, function (err) {
23195
23492
  return resolve(err);
23196
23493
  });
23197
23494
  });
@@ -23222,7 +23519,7 @@
23222
23519
  key: "onShippingAddressChange",
23223
23520
  value: function onShippingAddressChange(handler) {
23224
23521
  if (typeof handler === 'function') {
23225
- return this.eventEmitter.subscribe(EVENT.ON_SHIPPING_ADDRESS_CHANGE, handler);
23522
+ return this.eventEmitter.subscribe(exports.WALLET_BUTTONS_EXPRESS_EVENT.ON_SHIPPING_ADDRESS_CHANGE, handler);
23226
23523
  }
23227
23524
  this.handleOnError(new Error('onShippingAddressChange event handler is required to return the wallet token string or reject.'));
23228
23525
  }
@@ -23253,7 +23550,7 @@
23253
23550
  value: function onShippingOptionsChange(handler) {
23254
23551
  if (typeof handler === 'function') {
23255
23552
  this.onShippingOptionsChangeHandlerRegistered = true;
23256
- return this.eventEmitter.subscribe(EVENT.ON_SHIPPING_OPTIONS_CHANGE, handler);
23553
+ return this.eventEmitter.subscribe(exports.WALLET_BUTTONS_EXPRESS_EVENT.ON_SHIPPING_OPTIONS_CHANGE, handler);
23257
23554
  }
23258
23555
  this.handleOnError(new Error('onShippingOptionsChange event handler is required to return the wallet token string or reject.'));
23259
23556
  }
@@ -23278,10 +23575,10 @@
23278
23575
  value: function onUnavailable(handler) {
23279
23576
  var _this5 = this;
23280
23577
  if (typeof handler === 'function') {
23281
- return this.eventEmitter.subscribe(EVENT.UNAVAILABLE, handler);
23578
+ return this.eventEmitter.subscribe(exports.WALLET_BUTTONS_EXPRESS_EVENT.UNAVAILABLE, handler);
23282
23579
  }
23283
23580
  return new Promise(function (resolve) {
23284
- return _this5.eventEmitter.subscribe(EVENT.UNAVAILABLE, function (err) {
23581
+ return _this5.eventEmitter.subscribe(exports.WALLET_BUTTONS_EXPRESS_EVENT.UNAVAILABLE, function (err) {
23285
23582
  return resolve(err);
23286
23583
  });
23287
23584
  });
@@ -23308,10 +23605,10 @@
23308
23605
  value: function onError(handler) {
23309
23606
  var _this6 = this;
23310
23607
  if (typeof handler === 'function') {
23311
- return this.eventEmitter.subscribe(EVENT.ERROR, handler);
23608
+ return this.eventEmitter.subscribe(exports.WALLET_BUTTONS_EXPRESS_EVENT.ERROR, handler);
23312
23609
  }
23313
23610
  return new Promise(function (resolve) {
23314
- return _this6.eventEmitter.subscribe(EVENT.ERROR, function (err) {
23611
+ return _this6.eventEmitter.subscribe(exports.WALLET_BUTTONS_EXPRESS_EVENT.ERROR, function (err) {
23315
23612
  return resolve(err);
23316
23613
  });
23317
23614
  });
@@ -23348,8 +23645,8 @@
23348
23645
  var _this8 = this;
23349
23646
  return this.api.charge().walletCallback(data)["catch"](function (err) {
23350
23647
  var _a;
23351
- _this8.eventEmitter.emit(EVENT.PAYMENT_ERROR, {
23352
- event: EVENT.PAYMENT_ERROR,
23648
+ _this8.eventEmitter.emit(exports.WALLET_BUTTONS_EXPRESS_EVENT.PAYMENT_ERROR, {
23649
+ event: exports.WALLET_BUTTONS_EXPRESS_EVENT.PAYMENT_ERROR,
23353
23650
  chargeId: (_a = _this8.chargeWalletTokenMeta) === null || _a === void 0 ? void 0 : _a.charge.id,
23354
23651
  data: _this8.eventDataFromApiError(err)
23355
23652
  });
@@ -23363,7 +23660,7 @@
23363
23660
  var _this9 = this;
23364
23661
  return this.api.charge().walletCapture(data).then(function (captureResult) {
23365
23662
  var _a;
23366
- var event = captureResult.status === 'inreview' ? EVENT.PAYMENT_IN_REVIEW : EVENT.PAYMENT_SUCCESSFUL;
23663
+ var event = captureResult.status === 'inreview' ? exports.WALLET_BUTTONS_EXPRESS_EVENT.PAYMENT_IN_REVIEW : exports.WALLET_BUTTONS_EXPRESS_EVENT.PAYMENT_SUCCESSFUL;
23367
23664
  _this9.eventEmitter.emit(event, {
23368
23665
  event: event,
23369
23666
  chargeId: (_a = _this9.chargeWalletTokenMeta) === null || _a === void 0 ? void 0 : _a.charge.id,
@@ -23372,8 +23669,8 @@
23372
23669
  return captureResult;
23373
23670
  })["catch"](function (err) {
23374
23671
  var _a;
23375
- _this9.eventEmitter.emit(EVENT.PAYMENT_ERROR, {
23376
- event: EVENT.PAYMENT_ERROR,
23672
+ _this9.eventEmitter.emit(exports.WALLET_BUTTONS_EXPRESS_EVENT.PAYMENT_ERROR, {
23673
+ event: exports.WALLET_BUTTONS_EXPRESS_EVENT.PAYMENT_ERROR,
23377
23674
  chargeId: (_a = _this9.chargeWalletTokenMeta) === null || _a === void 0 ? void 0 : _a.charge.id,
23378
23675
  data: _this9.eventDataFromApiError(err)
23379
23676
  });
@@ -23384,8 +23681,8 @@
23384
23681
  key: "handleMerchantOnExpressButtonClickEvent",
23385
23682
  value: function handleMerchantOnExpressButtonClickEvent() {
23386
23683
  var _this0 = this;
23387
- return this.eventEmitter.emitWithResult(EVENT.ON_CLICK, {
23388
- event: EVENT.ON_CLICK
23684
+ return this.eventEmitter.emitWithResult(exports.WALLET_BUTTONS_EXPRESS_EVENT.ON_CLICK, {
23685
+ event: exports.WALLET_BUTTONS_EXPRESS_EVENT.ON_CLICK
23389
23686
  }).then(function (result) {
23390
23687
  var _a;
23391
23688
  if (!result || result.length === 0) {
@@ -23462,8 +23759,8 @@
23462
23759
  value: function handleCheckoutClose() {
23463
23760
  var _a;
23464
23761
  var chargeId = (_a = this.chargeWalletTokenMeta) === null || _a === void 0 ? void 0 : _a.charge.id;
23465
- this.eventEmitter.emit(EVENT.ON_CHECKOUT_CLOSE, _extends({
23466
- event: EVENT.ON_CHECKOUT_CLOSE
23762
+ this.eventEmitter.emit(exports.WALLET_BUTTONS_EXPRESS_EVENT.ON_CHECKOUT_CLOSE, _extends({
23763
+ event: exports.WALLET_BUTTONS_EXPRESS_EVENT.ON_CHECKOUT_CLOSE
23467
23764
  }, chargeId && {
23468
23765
  chargeId: chargeId
23469
23766
  }));
@@ -23471,8 +23768,8 @@
23471
23768
  }, {
23472
23769
  key: "handleOnUnavailable",
23473
23770
  value: function handleOnUnavailable() {
23474
- this.eventEmitter.emit(EVENT.UNAVAILABLE, {
23475
- event: EVENT.UNAVAILABLE
23771
+ this.eventEmitter.emit(exports.WALLET_BUTTONS_EXPRESS_EVENT.UNAVAILABLE, {
23772
+ event: exports.WALLET_BUTTONS_EXPRESS_EVENT.UNAVAILABLE
23476
23773
  });
23477
23774
  }
23478
23775
  }, {
@@ -23483,8 +23780,8 @@
23483
23780
  console.error(error);
23484
23781
  }
23485
23782
  var chargeId = (_a = this.chargeWalletTokenMeta) === null || _a === void 0 ? void 0 : _a.charge.id;
23486
- this.eventEmitter.emit(EVENT.ERROR, _extends(_extends({
23487
- event: EVENT.ERROR
23783
+ this.eventEmitter.emit(exports.WALLET_BUTTONS_EXPRESS_EVENT.ERROR, _extends(_extends({
23784
+ event: exports.WALLET_BUTTONS_EXPRESS_EVENT.ERROR
23488
23785
  }, chargeId && {
23489
23786
  chargeId: chargeId
23490
23787
  }), {
@@ -23501,6 +23798,23 @@
23501
23798
  code: ((_c = err === null || err === void 0 ? void 0 : err.error) === null || _c === void 0 ? void 0 : _c.code) || (err === null || err === void 0 ? void 0 : err.code) || ((_d = err === null || err === void 0 ? void 0 : err.error_summary) === null || _d === void 0 ? void 0 : _d.code)
23502
23799
  };
23503
23800
  }
23801
+ }, {
23802
+ key: "applyDisabledStyles",
23803
+ value: function applyDisabledStyles() {
23804
+ var element = this.container.getElement();
23805
+ if (!element) {
23806
+ return;
23807
+ }
23808
+ if (this.isDisabled) {
23809
+ element.style.pointerEvents = 'none';
23810
+ element.style.opacity = '0.5';
23811
+ element.setAttribute('aria-disabled', 'true');
23812
+ } else {
23813
+ element.style.pointerEvents = '';
23814
+ element.style.opacity = '';
23815
+ element.removeAttribute('aria-disabled');
23816
+ }
23817
+ }
23504
23818
  }, {
23505
23819
  key: "validateRequiredMetaFields",
23506
23820
  value: function validateRequiredMetaFields(requiredMetaFields) {
@@ -23543,11 +23857,11 @@
23543
23857
  return "\n apple-pay-button {\n display: inline-block;\n --apple-pay-button-width: 100%;\n --apple-pay-button-height: 40px;\n --apple-pay-button-border-radius: 5px;\n --apple-pay-button-padding: 5px 0px;\n }\n ";
23544
23858
  };
23545
23859
 
23546
- var ContactShippingEditingMode;
23860
+ exports.ContactShippingEditingMode = void 0;
23547
23861
  (function (ContactShippingEditingMode) {
23548
23862
  ContactShippingEditingMode["AVAILABLE"] = "available";
23549
23863
  ContactShippingEditingMode["STORE_PICKUP"] = "store_pickup";
23550
- })(ContactShippingEditingMode || (ContactShippingEditingMode = {}));
23864
+ })(exports.ContactShippingEditingMode || (exports.ContactShippingEditingMode = {}));
23551
23865
 
23552
23866
  var DEFAULT_APPLE_PAY_CAPABILITIES = ['paymentCredentialsAvailable'];
23553
23867
  /**
@@ -23572,7 +23886,14 @@
23572
23886
  _classCallCheck(this, ApplePayWalletButtonExpress);
23573
23887
  _this = _callSuper(this, ApplePayWalletButtonExpress, [selector, publicKeyOrAccessToken, gatewayId, meta, ['amount_label', 'country']]);
23574
23888
  _this.onApplePayButtonClicked = function () {
23575
- var applePayApiVersion = 14;
23889
+ if (_this.isDisabled) {
23890
+ return;
23891
+ }
23892
+ var applePayApiVersion = getSupportedApplePayVersion();
23893
+ if (applePayApiVersion === 0) {
23894
+ _this.handleOnUnavailable();
23895
+ return;
23896
+ }
23576
23897
  _this.paymentSession = new ApplePaySession(applePayApiVersion, _this.createRequest());
23577
23898
  _this.paymentSession.onvalidatemerchant = _this.onValidateMerchant;
23578
23899
  _this.paymentSession.onpaymentauthorized = _this.onPaymentAuthorized;
@@ -23666,8 +23987,8 @@
23666
23987
  } catch (error) {
23667
23988
  // this ensures thatwe always call completePayment and emit error callback even if there's an uncaught exception
23668
23989
  _this.paymentSession.completePayment(ApplePaySession.STATUS_FAILURE);
23669
- _this.eventEmitter.emit(EVENT.PAYMENT_ERROR, {
23670
- event: EVENT.PAYMENT_ERROR,
23990
+ _this.eventEmitter.emit(exports.WALLET_BUTTONS_EXPRESS_EVENT.PAYMENT_ERROR, {
23991
+ event: exports.WALLET_BUTTONS_EXPRESS_EVENT.PAYMENT_ERROR,
23671
23992
  chargeId: (_k = _this.chargeWalletTokenMeta) === null || _k === void 0 ? void 0 : _k.charge.id,
23672
23993
  data: {
23673
23994
  message: error instanceof Error ? error.message : 'Payment processing failed',
@@ -23687,7 +24008,7 @@
23687
24008
  while (1) switch (_context.n) {
23688
24009
  case 0:
23689
24010
  return _context.a(2, this.handleMerchantOnShippingChangedEvent({
23690
- event: EVENT.ON_SHIPPING_ADDRESS_CHANGE,
24011
+ event: exports.WALLET_BUTTONS_EXPRESS_EVENT.ON_SHIPPING_ADDRESS_CHANGE,
23691
24012
  chargeId: (_a = this.chargeWalletTokenMeta) === null || _a === void 0 ? void 0 : _a.charge.id,
23692
24013
  data: this.parseShippingContactUpdateEvent(data)
23693
24014
  }).then(function (response) {
@@ -23722,7 +24043,7 @@
23722
24043
  while (1) switch (_context2.n) {
23723
24044
  case 0:
23724
24045
  return _context2.a(2, this.handleMerchantOnShippingChangedEvent({
23725
- event: EVENT.ON_SHIPPING_OPTIONS_CHANGE,
24046
+ event: exports.WALLET_BUTTONS_EXPRESS_EVENT.ON_SHIPPING_OPTIONS_CHANGE,
23726
24047
  chargeId: (_b = this.chargeWalletTokenMeta) === null || _b === void 0 ? void 0 : _b.charge.id,
23727
24048
  data: this.parseShippingMethodUpdateEvent(data)
23728
24049
  }).then(function (_response) {
@@ -23850,6 +24171,7 @@
23850
24171
  return;
23851
24172
  }
23852
24173
  applePayButton.addEventListener('click', this.onApplePayButtonClicked.bind(this));
24174
+ this.applyDisabledStyles();
23853
24175
  }
23854
24176
  }, {
23855
24177
  key: "createRequest",
@@ -23858,7 +24180,7 @@
23858
24180
  // https://developer.apple.com/documentation/apple_pay_on_the_web/applepaypaymentrequest
23859
24181
  var shippingContactEditingMode;
23860
24182
  if (this.meta.shipping_editing_mode) {
23861
- shippingContactEditingMode = this.meta.shipping_editing_mode === ContactShippingEditingMode.AVAILABLE ? 'available' : 'storePickup';
24183
+ shippingContactEditingMode = this.meta.shipping_editing_mode === exports.ContactShippingEditingMode.AVAILABLE ? 'available' : 'storePickup';
23862
24184
  }
23863
24185
  return _extends(_extends({
23864
24186
  countryCode: this.meta.country,
@@ -24042,13 +24364,20 @@
24042
24364
  key: "load",
24043
24365
  value: function load() {
24044
24366
  var _this2 = this;
24045
- if (!window.Promise) return this.handleOnUnavailable();
24367
+ if (!window.Promise) {
24368
+ return this.handleOnUnavailable();
24369
+ }
24046
24370
  this.getGatewayWalletConfig().then(function (config) {
24047
- if (!config || config.type !== 'Paypal' || !config.credentials || !config.credentials.client_auth) throw new Error('Invalid configuration');
24371
+ if (!config || config.type !== 'Paypal' || !config.credentials || !config.credentials.client_auth) {
24372
+ throw new Error('Invalid configuration');
24373
+ }
24048
24374
  _this2.config = config;
24049
24375
  _this2.renderPaypalButton();
24376
+ _this2.applyDisabledStyles();
24050
24377
  })["catch"](function (err) {
24051
- if (err) _this2.handleOnError(err);
24378
+ if (err) {
24379
+ _this2.handleOnError(err);
24380
+ }
24052
24381
  _this2.handleOnUnavailable();
24053
24382
  });
24054
24383
  }
@@ -24065,6 +24394,7 @@
24065
24394
  value: function setMeta(meta) {
24066
24395
  this.meta = meta;
24067
24396
  this.renderPaypalButton();
24397
+ this.applyDisabledStyles();
24068
24398
  }
24069
24399
  }, {
24070
24400
  key: "renderPaypalButton",
@@ -24081,7 +24411,7 @@
24081
24411
  var _this3 = this;
24082
24412
  var _a, _b;
24083
24413
  var buttonId = ((_a = this.container.getElement()) === null || _a === void 0 ? void 0 : _a.id) || '';
24084
- var paypalScript = document.createElement("script");
24414
+ var paypalScript = document.createElement('script');
24085
24415
  paypalScript.src = "https://www.paypal.com/sdk/js?client-id=".concat((_b = this.config.credentials) === null || _b === void 0 ? void 0 : _b.client_auth, "&currency=").concat(this.meta.currency).concat(this.meta.pay_later === true ? '&enable-funding=paylater&disable-funding=card' : '&disable-funding=credit,card').concat(!this.meta.capture ? '&intent=authorize' : '');
24086
24416
  paypalScript.async = true;
24087
24417
  paypalScript.onload = function () {
@@ -24100,7 +24430,7 @@
24100
24430
  var _this4 = this;
24101
24431
  var _a, _b, _c;
24102
24432
  var buttonId = ((_a = this.container.getElement()) === null || _a === void 0 ? void 0 : _a.id) || '';
24103
- var paypalScript = document.createElement("script");
24433
+ var paypalScript = document.createElement('script');
24104
24434
  // buyer-country is only used in Sandbox. It shouldn't be used in production. Based on buyer's geolocation this parameter determine which funding sources are eligible for a given buyer. Refer the link https://developer.paypal.com/sdk/js/configuration/#link-buyercountry
24105
24435
  paypalScript.src = "https://www.paypal.com/sdk/js?client-id=".concat((_b = this.config.credentials) === null || _b === void 0 ? void 0 : _b.client_auth, "&currency=").concat(this.meta.currency, "&components=buttons,funding-eligibility,messages&enable-funding=paylater").concat(!this.meta.capture ? '&intent=authorize' : '').concat(((_c = this.config) === null || _c === void 0 ? void 0 : _c.mode) === 'live' ? '' : '&buyer-country=AU');
24106
24436
  paypalScript.async = true;
@@ -24141,6 +24471,9 @@
24141
24471
  style: this.meta.style
24142
24472
  }), {
24143
24473
  onClick: function onClick(_data, actions) {
24474
+ if (_this5.isDisabled) {
24475
+ return actions.reject();
24476
+ }
24144
24477
  return _this5.handleMerchantOnExpressButtonClickEvent().then(function () {
24145
24478
  return actions.resolve();
24146
24479
  })["catch"](function () {
@@ -24151,7 +24484,9 @@
24151
24484
  createOrder: function createOrder() {
24152
24485
  return new Promise(function (resolve, reject) {
24153
24486
  var _a, _b;
24154
- if (!_this5.api.auth) return reject(new Error('Wallet Token not injected. Please handle onClick correctly.'));
24487
+ if (!_this5.api.auth) {
24488
+ return reject(new Error('Wallet Token not injected. Please handle onClick correctly.'));
24489
+ }
24155
24490
  var shipping = (_b = (_a = _this5.chargeWalletTokenMeta) === null || _a === void 0 ? void 0 : _a.charge) === null || _b === void 0 ? void 0 : _b.shipping;
24156
24491
  if (shipping) {
24157
24492
  var hasCompleteShippingAddress = ['address_line1', 'address_city', 'address_country', 'address_state', 'address_postcode'].every(function (key) {
@@ -24170,7 +24505,9 @@
24170
24505
  });
24171
24506
  },
24172
24507
  onApprove: function onApprove(data) {
24173
- if (_this5.pendingApprovalPromise) return _this5.pendingApprovalPromise;
24508
+ if (_this5.pendingApprovalPromise) {
24509
+ return _this5.pendingApprovalPromise;
24510
+ }
24174
24511
  _this5.pendingApprovalPromise = _this5.executeWalletCapture({
24175
24512
  payment_method_id: data.orderID,
24176
24513
  customer: {
@@ -24214,7 +24551,7 @@
24214
24551
  return _context.a(2);
24215
24552
  case 1:
24216
24553
  return _context.a(2, this.handleMerchantOnShippingChangedEvent({
24217
- event: EVENT.ON_SHIPPING_ADDRESS_CHANGE,
24554
+ event: exports.WALLET_BUTTONS_EXPRESS_EVENT.ON_SHIPPING_ADDRESS_CHANGE,
24218
24555
  chargeId: (_a = this.chargeWalletTokenMeta) === null || _a === void 0 ? void 0 : _a.charge.id,
24219
24556
  data: {
24220
24557
  address_city: data.shippingAddress.city,
@@ -24249,7 +24586,7 @@
24249
24586
  while (1) switch (_context2.n) {
24250
24587
  case 0:
24251
24588
  return _context2.a(2, this.handleMerchantOnShippingChangedEvent({
24252
- event: EVENT.ON_SHIPPING_OPTIONS_CHANGE,
24589
+ event: exports.WALLET_BUTTONS_EXPRESS_EVENT.ON_SHIPPING_OPTIONS_CHANGE,
24253
24590
  chargeId: (_a = this.chargeWalletTokenMeta) === null || _a === void 0 ? void 0 : _a.charge.id,
24254
24591
  data: {
24255
24592
  shipping_option_id: data.selectedShippingOption.id,
@@ -44353,13 +44690,16 @@
44353
44690
  exports.Api = Api;
44354
44691
  exports.ApplePayOpenWalletButton = ApplePayOpenWalletButton;
44355
44692
  exports.ApplePayWalletButtonExpress = ApplePayWalletButtonExpress;
44693
+ exports.CANVAS_3DS_EVENT = CANVAS_3DS_EVENT;
44356
44694
  exports.CHECKOUT_BUTTON_EVENT = CHECKOUT_BUTTON_EVENT;
44695
+ exports.CHECKOUT_EVENT = EVENT$2;
44357
44696
  exports.Canvas3ds = Canvas3ds;
44697
+ exports.Canvas3dsTokenFormat = Canvas3dsTokenFormat;
44358
44698
  exports.Checkout = Checkout;
44359
44699
  exports.ClickToPay = ClickToPay;
44360
44700
  exports.Configuration = Configuration;
44361
44701
  exports.ELEMENT = ELEMENT;
44362
- exports.EVENT = EVENT$5;
44702
+ exports.EVENT = EVENT$4;
44363
44703
  exports.ExternalCheckoutBuilder = Builder$1;
44364
44704
  exports.ExternalCheckoutChecker = Checker;
44365
44705
  exports.FORM_FIELD = FORM_FIELD$1;
@@ -44371,7 +44711,9 @@
44371
44711
  exports.HtmlWidget = HtmlWidget;
44372
44712
  exports.InstructionDebugger = InstructionDebugger;
44373
44713
  exports.MultiWidget = MultiWidget;
44374
- exports.OpenWalletButtons = OpenWalletButtons;
44714
+ exports.PAYMENT_EXPIRED = PAYMENT_EXPIRED;
44715
+ exports.PAYMENT_FAILURE = PAYMENT_FAILURE;
44716
+ exports.PAYMENT_SUCCESSFUL = PAYMENT_SUCCESSFUL;
44375
44717
  exports.PAYMENT_TYPE = PAYMENT_TYPE;
44376
44718
  exports.PayPalDataCollector = PayPalDataCollector;
44377
44719
  exports.PayPalSavePaymentSourceWidget = PayPalSavePaymentSourceWidget;