@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
package/bundles/index.cjs CHANGED
@@ -1194,7 +1194,7 @@ SDK.headerKeys = Object.freeze({
1194
1194
  version: 'x-sdk-version',
1195
1195
  type: 'x-sdk-type'
1196
1196
  });
1197
- SDK._version = 'v1.142.0';
1197
+ SDK._version = 'v1.144.0-beta';
1198
1198
 
1199
1199
  function isFunction(value) {
1200
1200
  return typeof value === 'function';
@@ -4804,127 +4804,162 @@ var Api = /*#__PURE__*/function (_ApiBase) {
4804
4804
  }]);
4805
4805
  }(ApiBase);
4806
4806
 
4807
- var Url = /*#__PURE__*/function () {
4808
- function Url() {
4809
- _classCallCheck(this, Url);
4807
+ var WALLET_CAPTURE_LINK = '/v1/charges/wallet/capture';
4808
+ var WALLET_CALLBACK_LINK = '/v1/charges/wallet/callback';
4809
+ var STANDALONE_3DS_PROCESS_LINK = '/v1/charges/standalone-3ds/process';
4810
+ var STANDALONE_3DS_HANDLE_LINK = '/v1/charges/standalone-3ds/handle';
4811
+ var ApiChargeInternal = /*#__PURE__*/function () {
4812
+ function ApiChargeInternal(api) {
4813
+ _classCallCheck(this, ApiChargeInternal);
4814
+ this.api = api;
4810
4815
  }
4811
- return _createClass(Url, null, [{
4812
- key: "extendSearchParams",
4813
- value: function extendSearchParams(uri, key, val) {
4814
- return uri.replace(new RegExp("([?&]" + key + "(?=[=&#]|$)[^#&]*|(?=#|$))"), "&" + key + "=" + encodeURIComponent(val)).replace(/^([^?&]+)&/, "$1?");
4816
+ return _createClass(ApiChargeInternal, [{
4817
+ key: "walletCapture",
4818
+ value: function walletCapture(payload) {
4819
+ return this.api.getClientPromise('POST', WALLET_CAPTURE_LINK).send(payload);
4815
4820
  }
4816
4821
  }, {
4817
- key: "serialize",
4818
- value: function serialize(params) {
4819
- return Object.keys(params).map(function (key) {
4820
- return encodeURIComponent(key) + '=' + encodeURIComponent(params[key]);
4821
- }).join('&');
4822
+ key: "walletCallback",
4823
+ value: function walletCallback(payload) {
4824
+ return this.api.getClientPromise('POST', WALLET_CALLBACK_LINK).send(payload);
4825
+ }
4826
+ }, {
4827
+ key: "standalone3dsProcess",
4828
+ value: function standalone3dsProcess(payload) {
4829
+ return this.api.getClientPromise('POST', STANDALONE_3DS_PROCESS_LINK).send(payload);
4830
+ }
4831
+ }, {
4832
+ key: "standalone3dsHandle",
4833
+ value: function standalone3dsHandle() {
4834
+ return this.api.getClientPromise('GET', STANDALONE_3DS_HANDLE_LINK).send(undefined);
4822
4835
  }
4823
4836
  }]);
4824
4837
  }();
4825
4838
 
4826
- var Uuid = /*#__PURE__*/function () {
4827
- function Uuid() {
4828
- _classCallCheck(this, Uuid);
4839
+ var CALLBACK_LINK = '/v1/checkouts/callback';
4840
+ var INSTRUCTION_LINK = '/v1/checkouts/instruction';
4841
+ var STATUS_LINK = '/v1/checkouts';
4842
+ var ApiCheckoutInternal = /*#__PURE__*/function () {
4843
+ function ApiCheckoutInternal(api) {
4844
+ _classCallCheck(this, ApiCheckoutInternal);
4845
+ this.api = api;
4846
+ this.getInstructionLink = function () {
4847
+ return "".concat(INSTRUCTION_LINK, "?time=").concat(Date.now());
4848
+ };
4829
4849
  }
4830
- return _createClass(Uuid, null, [{
4831
- key: "generate",
4832
- value: function generate() {
4833
- if (typeof window !== "undefined" && typeof window.crypto !== "undefined" && typeof window.crypto.getRandomValues !== "undefined") {
4834
- var buf = new Uint16Array(8);
4835
- window.crypto.getRandomValues(buf);
4836
- 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]);
4837
- } else {
4838
- return this.random() + this.random() + "-" + this.random() + "-" + this.random() + "-" + this.random() + "-" + this.random() + this.random() + this.random();
4839
- }
4850
+ return _createClass(ApiCheckoutInternal, [{
4851
+ key: "instructions",
4852
+ value: function instructions() {
4853
+ return this.api.requestObservable('GET', this.getInstructionLink(), {});
4840
4854
  }
4841
4855
  }, {
4842
- key: "hash",
4843
- value: function hash(number) {
4844
- var hash = number.toString(16);
4845
- while (hash.length < 4) {
4846
- hash = "0" + hash;
4847
- }
4848
- return hash;
4856
+ key: "callback",
4857
+ value: function callback(payload) {
4858
+ return this.api.getClientPromise('POST', CALLBACK_LINK).send(payload);
4849
4859
  }
4850
4860
  }, {
4851
- key: "random",
4852
- value: function random() {
4853
- return Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1);
4861
+ key: "status",
4862
+ value: function status(id) {
4863
+ return this.api.getClientPromise('GET', "".concat(STATUS_LINK, "/").concat(id)).send('');
4854
4864
  }
4855
4865
  }]);
4856
4866
  }();
4857
4867
 
4858
- var WIDGET_LINK = '/remote-action';
4859
- var VAULT_DISPLAY_WIDGET_LINK = '/vault-display';
4860
- var PAYMENT_SOURCE_LINK = '/payment-sources';
4861
- var SECURE_3D = '/3ds/webhook';
4862
- var FLYPAY_LINK = '/wallet/flypay';
4863
- var FLYPAY_LOGO_LINK = '/images/coles-pay-logo.png';
4864
- var MESSAGE_WIDGET_LINK = '/message-widget';
4865
- var MASTERCARD_SRC = '/secure-remote-commerce/mastercard';
4866
- var Link = /*#__PURE__*/function () {
4867
- function Link(linkResource) {
4868
- _classCallCheck(this, Link);
4869
- this.params = {};
4870
- this.widgetId = Uuid.generate();
4871
- this.linkResource = linkResource;
4872
- this.env = new Env(WIDGET_URL);
4873
- this.setParams({
4874
- widget_id: this.widgetId
4875
- });
4868
+ var GET_WALLET_CONFIG = '/v1/gateways/:gateway_id/wallet-config';
4869
+ var ApiGatewayInternal = /*#__PURE__*/function () {
4870
+ function ApiGatewayInternal(api) {
4871
+ _classCallCheck(this, ApiGatewayInternal);
4872
+ this.api = api;
4876
4873
  }
4877
- return _createClass(Link, [{
4878
- key: "getNetUrl",
4879
- value: function getNetUrl() {
4880
- return this.env.getConf().url + this.linkResource;
4874
+ return _createClass(ApiGatewayInternal, [{
4875
+ key: "getWalletConfig",
4876
+ value: function getWalletConfig(gateway_id) {
4877
+ var url = GET_WALLET_CONFIG.replace(':gateway_id', gateway_id);
4878
+ return this.api.getClientPromise('GET', url).send(undefined);
4881
4879
  }
4882
- }, {
4883
- key: "getUrl",
4884
- value: function getUrl() {
4885
- var url = this.getNetUrl();
4886
- var params = this.getParams();
4887
- for (var key in params) {
4888
- if (params.hasOwnProperty(key)) url = Url.extendSearchParams(url, key, params[key]);
4889
- }
4890
- return url;
4880
+ }]);
4881
+ }();
4882
+
4883
+ var CREATE_OTT = '/v1/payment_sources/tokens';
4884
+ var CREATE_SESSION = '/v1/payment_sources/payment-session';
4885
+ var ApiPaymentSourceInternal = /*#__PURE__*/function () {
4886
+ function ApiPaymentSourceInternal(api) {
4887
+ _classCallCheck(this, ApiPaymentSourceInternal);
4888
+ this.api = api;
4889
+ }
4890
+ return _createClass(ApiPaymentSourceInternal, [{
4891
+ key: "createOTT",
4892
+ value: function createOTT(payload) {
4893
+ return this.api.getClientPromise('POST', CREATE_OTT).send(payload);
4891
4894
  }
4892
4895
  }, {
4893
- key: "setParams",
4894
- value: function setParams(params) {
4895
- this.params = _extends({}, this.params, params);
4896
+ key: "createSession",
4897
+ value: function createSession(payload) {
4898
+ return this.api.getClientPromise('POST', CREATE_SESSION).send(payload);
4896
4899
  }
4897
- }, {
4898
- key: "concatParams",
4899
- value: function concatParams(params) {
4900
- for (var key in params) {
4901
- if (!params.hasOwnProperty(key) || !params[key].length) continue;
4902
- if (typeof this.params[key] !== 'string') this.params[key] = '';
4903
- if (this.params[key].length) this.params[key] += ',' + params[key];else this.params[key] += params[key];
4904
- }
4900
+ }]);
4901
+ }();
4902
+
4903
+ var GET_CONFIG = '/v1/services/:service_id/config';
4904
+ var ApiServiceInternal = /*#__PURE__*/function () {
4905
+ function ApiServiceInternal(api) {
4906
+ _classCallCheck(this, ApiServiceInternal);
4907
+ this.api = api;
4908
+ }
4909
+ return _createClass(ApiServiceInternal, [{
4910
+ key: "getConfig",
4911
+ value: function getConfig(service_id) {
4912
+ var url = GET_CONFIG.replace(':service_id', service_id);
4913
+ return this.api.getClientPromise('GET', url).send(undefined);
4914
+ }
4915
+ }]);
4916
+ }();
4917
+ var SERVICE_TYPES;
4918
+ (function (SERVICE_TYPES) {
4919
+ SERVICE_TYPES["ACCERTIFY"] = "Accertify";
4920
+ SERVICE_TYPES["BOOKING"] = "Booking";
4921
+ SERVICE_TYPES["GPAYMENTS"] = "GPayments";
4922
+ SERVICE_TYPES["CLICK_TO_PAY"] = "ClickToPay";
4923
+ SERVICE_TYPES["MASTERCARD_NT"] = "MastercardSCOF";
4924
+ SERVICE_TYPES["VISA_NT"] = "VisaVTS";
4925
+ SERVICE_TYPES["FORTER"] = "Forter";
4926
+ SERVICE_TYPES["APPLE_PAY"] = "ApplePay";
4927
+ SERVICE_TYPES["GOOGLE_PAY"] = "GooglePay";
4928
+ })(SERVICE_TYPES || (SERVICE_TYPES = {}));
4929
+
4930
+ var ApiInternal = /*#__PURE__*/function (_ApiBase) {
4931
+ function ApiInternal() {
4932
+ _classCallCheck(this, ApiInternal);
4933
+ return _callSuper(this, ApiInternal, arguments);
4934
+ }
4935
+ _inherits(ApiInternal, _ApiBase);
4936
+ return _createClass(ApiInternal, [{
4937
+ key: "charge",
4938
+ value: function charge() {
4939
+ return new ApiChargeInternal(this);
4905
4940
  }
4906
4941
  }, {
4907
- key: "getParams",
4908
- value: function getParams() {
4909
- return this.params;
4942
+ key: "service",
4943
+ value: function service() {
4944
+ return new ApiServiceInternal(this);
4910
4945
  }
4911
4946
  }, {
4912
- key: "setEnv",
4913
- value: function setEnv(env, alias) {
4914
- this.env.setEnv(env, alias);
4947
+ key: "checkout",
4948
+ value: function checkout() {
4949
+ return new ApiCheckoutInternal(this);
4915
4950
  }
4916
4951
  }, {
4917
- key: "getEnv",
4918
- value: function getEnv() {
4919
- return this.env.getEnv();
4952
+ key: "gateway",
4953
+ value: function gateway() {
4954
+ return new ApiGatewayInternal(this);
4920
4955
  }
4921
4956
  }, {
4922
- key: "getBaseUrl",
4923
- value: function getBaseUrl() {
4924
- return this.env.getConf().url;
4957
+ key: "paymentSource",
4958
+ value: function paymentSource() {
4959
+ return new ApiPaymentSourceInternal(this);
4925
4960
  }
4926
4961
  }]);
4927
- }();
4962
+ }(ApiBase);
4928
4963
 
4929
4964
  var IFrame = /*#__PURE__*/function () {
4930
4965
  function IFrame(container) {
@@ -5035,7 +5070,7 @@ var IFrame = /*#__PURE__*/function () {
5035
5070
  }]);
5036
5071
  }();
5037
5072
 
5038
- var EVENT$5 = {
5073
+ var EVENT$4 = {
5039
5074
  AFTER_LOAD: 'afterLoad',
5040
5075
  SUBMIT: 'submit',
5041
5076
  FINISH: 'finish',
@@ -5092,9 +5127,9 @@ var IFrameEvent = /*#__PURE__*/function () {
5092
5127
  }, {
5093
5128
  key: "on",
5094
5129
  value: function on(eventName, widgetId, cb) {
5095
- for (var event in EVENT$5) {
5096
- if (!EVENT$5.hasOwnProperty(event)) continue;
5097
- if (eventName === EVENT$5[event]) {
5130
+ for (var event in EVENT$4) {
5131
+ if (!EVENT$4.hasOwnProperty(event)) continue;
5132
+ if (eventName === EVENT$4[event]) {
5098
5133
  this.listeners.push({
5099
5134
  event: eventName,
5100
5135
  listener: cb,
@@ -5121,10 +5156,10 @@ var IFrameEvent = /*#__PURE__*/function () {
5121
5156
  }();
5122
5157
 
5123
5158
  var hiddenStyle = {
5124
- visibility: "hidden",
5125
- border: "0",
5126
- width: "0",
5127
- height: "0"
5159
+ visibility: 'hidden',
5160
+ border: '0',
5161
+ width: '0',
5162
+ height: '0'
5128
5163
  };
5129
5164
  var PROCESS_STANDALONE_3DS_STATUS;
5130
5165
  (function (PROCESS_STANDALONE_3DS_STATUS) {
@@ -5146,14 +5181,30 @@ var IFRAME_STATUS;
5146
5181
  IFRAME_STATUS["TIMEOUT"] = "AuthTimedOut";
5147
5182
  IFRAME_STATUS["INVALID"] = "invalid_event";
5148
5183
  })(IFRAME_STATUS || (IFRAME_STATUS = {}));
5184
+ /**
5185
+ * Event name constants emitted during the Standalone 3DS (GPayments) flow.
5186
+ * Used internally by `GPaymentsService` and re-exported publicly as `CANVAS_3DS_EVENT`.
5187
+ */
5149
5188
  var GPAYMENTS_EVENT = {
5189
+ /** Authentication succeeded. Payload: `Canvas3dsAuthPayload`. */
5150
5190
  AUTH_SUCCESS: 'chargeAuthSuccess',
5191
+ /** Authentication failed — covers issuer rejection, iframe timeout (`AuthTimedOut`), and invalid-event outcomes. Payload: `Canvas3dsAuthPayload`. */
5151
5192
  AUTH_ERROR: 'chargeAuthReject',
5193
+ /** Decoupled authentication — issuer will authenticate out-of-band. Payload: `Canvas3dsAuthPayload`. */
5152
5194
  DECOUPLED: 'chargeAuthDecoupled',
5195
+ /** Challenge required — issuer demands user interaction. Payload: `Canvas3dsAuthPayload`. */
5153
5196
  CHALLENGE: 'chargeAuthChallenge',
5197
+ /** Informational signal emitted by the GPayments flow. Internal — not part of the public typed surface. */
5154
5198
  INFO: 'chargeAuthInfo',
5199
+ /** Error during the flow (network, parsing, etc.). Payload: `Canvas3dsErrorPayload`. */
5155
5200
  ERROR: 'error'
5156
5201
  };
5202
+ /**
5203
+ * Public alias for GPAYMENTS_EVENT. Same object reference — no behavioral change.
5204
+ * Prefer `CANVAS_3DS_EVENT` in public-facing code; `GPAYMENTS_EVENT` remains for
5205
+ * backwards-compatible internal usage.
5206
+ */
5207
+ var CANVAS_3DS_EVENT = GPAYMENTS_EVENT;
5157
5208
  var GPaymentsService = /*#__PURE__*/function () {
5158
5209
  function GPaymentsService(container, api, eventEmitter) {
5159
5210
  _classCallCheck(this, GPaymentsService);
@@ -5181,20 +5232,22 @@ var GPaymentsService = /*#__PURE__*/function () {
5181
5232
  value: function initializeIFrames(initializationUrl, secondaryUrl, title) {
5182
5233
  var hideAuthorization = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
5183
5234
  var container = this.container.getElement();
5184
- if (!container) return;
5185
- var divAuthorization = document.createElement("div");
5186
- divAuthorization.setAttribute("id", "paydock_authorization_iframe");
5235
+ if (!container) {
5236
+ return;
5237
+ }
5238
+ var divAuthorization = document.createElement('div');
5239
+ divAuthorization.setAttribute('id', 'paydock_authorization_iframe');
5187
5240
  container.appendChild(divAuthorization);
5188
- this.browserAndChallengeContainer = new Container("#paydock_authorization_iframe");
5241
+ this.browserAndChallengeContainer = new Container('#paydock_authorization_iframe');
5189
5242
  this.iFrameAuthorization = new IFrame(this.browserAndChallengeContainer);
5190
5243
  this.iFrameAuthorization.load(initializationUrl, {
5191
5244
  title: title
5192
5245
  });
5193
5246
  if (secondaryUrl) {
5194
- var divSecondaryURL = document.createElement("div");
5195
- divSecondaryURL.setAttribute("id", "paydock_secondary_iframe");
5247
+ var divSecondaryURL = document.createElement('div');
5248
+ divSecondaryURL.setAttribute('id', 'paydock_secondary_iframe');
5196
5249
  container.appendChild(divSecondaryURL);
5197
- this.monitoringContainer = new Container("#paydock_secondary_iframe");
5250
+ this.monitoringContainer = new Container('#paydock_secondary_iframe');
5198
5251
  this.iFrameSecondaryUrl = new IFrame(this.monitoringContainer);
5199
5252
  this.iFrameSecondaryUrl.load(secondaryUrl, {
5200
5253
  title: title
@@ -5210,8 +5263,12 @@ var GPaymentsService = /*#__PURE__*/function () {
5210
5263
  var hideAuthorization = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
5211
5264
  var _a;
5212
5265
  for (var prop in hiddenStyle) {
5213
- if (!hiddenStyle.hasOwnProperty(prop)) continue;
5214
- if (hideAuthorization) this.iFrameAuthorization.setStyle(prop, hiddenStyle[prop]);
5266
+ if (!Object.hasOwn(hiddenStyle, prop)) {
5267
+ continue;
5268
+ }
5269
+ if (hideAuthorization) {
5270
+ this.iFrameAuthorization.setStyle(prop, hiddenStyle[prop]);
5271
+ }
5215
5272
  (_a = this.iFrameSecondaryUrl) === null || _a === void 0 ? void 0 : _a.setStyle(prop, hiddenStyle[prop]);
5216
5273
  }
5217
5274
  }
@@ -5219,17 +5276,21 @@ var GPaymentsService = /*#__PURE__*/function () {
5219
5276
  key: "setupIFrameEvents",
5220
5277
  value: function setupIFrameEvents(widgetId) {
5221
5278
  var _this = this;
5222
- this.iFrameEvent.on(EVENT$5.CHARGE_AUTH, widgetId, function (data) {
5279
+ this.iFrameEvent.on(EVENT$4.CHARGE_AUTH, widgetId, function (data) {
5223
5280
  if (data.status === IFRAME_STATUS.SKIPPED || data.status === IFRAME_STATUS.FINISHED) {
5224
- if (data.info) _this.eventEmitter.emit(GPAYMENTS_EVENT.INFO, {
5225
- info: data.info
5226
- });
5281
+ if (data.info) {
5282
+ _this.eventEmitter.emit(GPAYMENTS_EVENT.INFO, {
5283
+ info: data.info
5284
+ });
5285
+ }
5227
5286
  _this.performAuthentication(data);
5228
- } else if (data.status === IFRAME_STATUS.TIMEOUT || data.status === IFRAME_STATUS.INVALID) _this.eventEmitter.emit(GPAYMENTS_EVENT.AUTH_ERROR, _this.parseHandleResponse({
5229
- status: data.status
5230
- }, data.charge_3ds_id));
5287
+ } else if (data.status === IFRAME_STATUS.TIMEOUT || data.status === IFRAME_STATUS.INVALID) {
5288
+ _this.eventEmitter.emit(GPAYMENTS_EVENT.AUTH_ERROR, _this.parseHandleResponse({
5289
+ status: data.status
5290
+ }, data.charge_3ds_id));
5291
+ }
5231
5292
  });
5232
- this.iFrameEvent.on(EVENT$5.CHARGE_AUTH_SUCCESS, widgetId, function (data) {
5293
+ this.iFrameEvent.on(EVENT$4.CHARGE_AUTH_SUCCESS, widgetId, function (data) {
5233
5294
  _this.processResult(data.charge_3ds_id);
5234
5295
  });
5235
5296
  }
@@ -5267,13 +5328,19 @@ var GPaymentsService = /*#__PURE__*/function () {
5267
5328
  key: "processResult",
5268
5329
  value: function processResult(charge3dsId) {
5269
5330
  var _this2 = this;
5270
- if (this.resultRead) return;
5331
+ if (this.resultRead) {
5332
+ return;
5333
+ }
5271
5334
  this.resultRead = true;
5272
5335
  this.api.charge().standalone3dsHandle().then(function (result) {
5273
5336
  var _a;
5274
5337
  _this2.iFrameAuthorization.remove();
5275
5338
  (_a = _this2.iFrameSecondaryUrl) === null || _a === void 0 ? void 0 : _a.remove();
5276
- 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));
5339
+ if (result.status === PROCESS_STANDALONE_3DS_STATUS.SUCCESS) {
5340
+ _this2.eventEmitter.emit(GPAYMENTS_EVENT.AUTH_SUCCESS, _this2.parseResultData(result, charge3dsId));
5341
+ } else {
5342
+ _this2.eventEmitter.emit(GPAYMENTS_EVENT.AUTH_ERROR, _this2.parseResultData(result, charge3dsId));
5343
+ }
5277
5344
  }, function (err) {
5278
5345
  _this2.eventEmitter.emit(GPAYMENTS_EVENT.ERROR, _this2.parseError(err, charge3dsId));
5279
5346
  });
@@ -5298,10 +5365,16 @@ var GPaymentsService = /*#__PURE__*/function () {
5298
5365
  key: "doPolling",
5299
5366
  value: function doPolling(url, charge3dsId) {
5300
5367
  var _this3 = this;
5301
- this.externalAPI("GET", url).then(function (data) {
5302
- if (!data.event || data.event === "AuthResultNotReady") setTimeout(function () {
5303
- _this3.doPolling(url, charge3dsId);
5304
- }, 2000);else if (data.event === 'AuthResultReady') _this3.processResult(charge3dsId);else throw new Error("Event not supported");
5368
+ this.externalAPI('GET', url).then(function (data) {
5369
+ if (!data.event || data.event === 'AuthResultNotReady') {
5370
+ setTimeout(function () {
5371
+ _this3.doPolling(url, charge3dsId);
5372
+ }, 2000);
5373
+ } else if (data.event === 'AuthResultReady') {
5374
+ _this3.processResult(charge3dsId);
5375
+ } else {
5376
+ throw new Error('Event not supported');
5377
+ }
5305
5378
  })["catch"](function (err) {
5306
5379
  return _this3.eventEmitter.emit(GPAYMENTS_EVENT.ERROR, _this3.parseError(err, charge3dsId));
5307
5380
  });
@@ -5318,16 +5391,24 @@ var GPaymentsService = /*#__PURE__*/function () {
5318
5391
  charge_3ds_id: charge_3ds_id
5319
5392
  }).then(function (authenticationResult) {
5320
5393
  var _a, _b;
5321
- 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) {
5394
+ if (authenticationResult.status === AUTHENTICATION_STATUS.SUCCESS) {
5395
+ _this4.eventEmitter.emit(GPAYMENTS_EVENT.AUTH_SUCCESS, _this4.parseHandleResponse(authenticationResult, charge_3ds_id));
5396
+ } else if (authenticationResult.status === AUTHENTICATION_STATUS.PENDING) {
5322
5397
  if ((_a = authenticationResult === null || authenticationResult === void 0 ? void 0 : authenticationResult.result) === null || _a === void 0 ? void 0 : _a.challenge) {
5323
5398
  _this4.eventEmitter.emit(GPAYMENTS_EVENT.CHALLENGE, _this4.parseHandleResponse(authenticationResult, charge_3ds_id));
5324
5399
  _this4.initializeIFrames(authenticationResult.result.challenge_url, undefined, 'Authentication Challenge', false);
5325
- if (authenticationResult.result.secondary_url) _this4.doPolling(authenticationResult.result.secondary_url, charge_3ds_id);
5400
+ if (authenticationResult.result.secondary_url) {
5401
+ _this4.doPolling(authenticationResult.result.secondary_url, charge_3ds_id);
5402
+ }
5326
5403
  } else if ((_b = authenticationResult === null || authenticationResult === void 0 ? void 0 : authenticationResult.result) === null || _b === void 0 ? void 0 : _b.decoupled_challenge) {
5327
5404
  _this4.eventEmitter.emit(GPAYMENTS_EVENT.DECOUPLED, _this4.parseHandleResponse(authenticationResult, charge_3ds_id));
5328
- if (authenticationResult.result.secondary_url) _this4.doPolling(authenticationResult.result.secondary_url, charge_3ds_id);
5405
+ if (authenticationResult.result.secondary_url) {
5406
+ _this4.doPolling(authenticationResult.result.secondary_url, charge_3ds_id);
5407
+ }
5329
5408
  }
5330
- } else return _this4.eventEmitter.emit(GPAYMENTS_EVENT.AUTH_ERROR, _this4.parseHandleResponse(authenticationResult, charge_3ds_id));
5409
+ } else {
5410
+ return _this4.eventEmitter.emit(GPAYMENTS_EVENT.AUTH_ERROR, _this4.parseHandleResponse(authenticationResult, charge_3ds_id));
5411
+ }
5331
5412
  }, function (err) {
5332
5413
  _this4.eventEmitter.emit(GPAYMENTS_EVENT.ERROR, _this4.parseError(err, charge_3ds_id));
5333
5414
  });
@@ -5335,192 +5416,159 @@ var GPaymentsService = /*#__PURE__*/function () {
5335
5416
  }]);
5336
5417
  }();
5337
5418
 
5338
- var WALLET_CAPTURE_LINK = '/v1/charges/wallet/capture';
5339
- var WALLET_CALLBACK_LINK = '/v1/charges/wallet/callback';
5340
- var STANDALONE_3DS_PROCESS_LINK = '/v1/charges/standalone-3ds/process';
5341
- var STANDALONE_3DS_HANDLE_LINK = '/v1/charges/standalone-3ds/handle';
5342
- var ApiChargeInternal = /*#__PURE__*/function () {
5343
- function ApiChargeInternal(api) {
5344
- _classCallCheck(this, ApiChargeInternal);
5345
- this.api = api;
5419
+ var STANDALONE_3DS_GATEWAYS = {
5420
+ GPAYMENTS: 'GPayments'
5421
+ };
5422
+ var Standalone3dsService = /*#__PURE__*/function () {
5423
+ function Standalone3dsService(container, eventEmitter) {
5424
+ _classCallCheck(this, Standalone3dsService);
5425
+ this.env = DEFAULT_ENV;
5426
+ this.container = container;
5427
+ this.eventEmitter = eventEmitter;
5346
5428
  }
5347
- return _createClass(ApiChargeInternal, [{
5348
- key: "walletCapture",
5349
- value: function walletCapture(payload) {
5350
- return this.api.getClientPromise('POST', WALLET_CAPTURE_LINK).send(payload);
5351
- }
5352
- }, {
5353
- key: "walletCallback",
5354
- value: function walletCallback(payload) {
5355
- return this.api.getClientPromise('POST', WALLET_CALLBACK_LINK).send(payload);
5356
- }
5357
- }, {
5358
- key: "standalone3dsProcess",
5359
- value: function standalone3dsProcess(payload) {
5360
- return this.api.getClientPromise('POST', STANDALONE_3DS_PROCESS_LINK).send(payload);
5429
+ return _createClass(Standalone3dsService, [{
5430
+ key: "load",
5431
+ value: function load(token, options) {
5432
+ var parsedToken = AccessToken.validateJWT(token);
5433
+ if (!parsedToken) {
5434
+ throw new Error('Invalid charge token');
5435
+ }
5436
+ var tokenData = AccessToken.extractData(parsedToken.body);
5437
+ var api = new ApiInternal(token, API_AUTH_TYPE.TOKEN);
5438
+ api.setEnv(this.env, this.alias);
5439
+ switch (tokenData.service_type) {
5440
+ case STANDALONE_3DS_GATEWAYS.GPAYMENTS:
5441
+ new GPaymentsService(this.container, api, this.eventEmitter).load(tokenData, options.title);
5442
+ break;
5443
+ }
5361
5444
  }
5362
5445
  }, {
5363
- key: "standalone3dsHandle",
5364
- value: function standalone3dsHandle() {
5365
- return this.api.getClientPromise('GET', STANDALONE_3DS_HANDLE_LINK).send(undefined);
5446
+ key: "setEnv",
5447
+ value: function setEnv(env, alias) {
5448
+ this.env = env;
5449
+ this.alias = alias;
5366
5450
  }
5367
5451
  }]);
5368
5452
  }();
5369
5453
 
5370
- var CALLBACK_LINK = '/v1/checkouts/callback';
5371
- var INSTRUCTION_LINK = '/v1/checkouts/instruction';
5372
- var STATUS_LINK = '/v1/checkouts';
5373
- var ApiCheckoutInternal = /*#__PURE__*/function () {
5374
- function ApiCheckoutInternal(api) {
5375
- _classCallCheck(this, ApiCheckoutInternal);
5376
- this.api = api;
5377
- this.getInstructionLink = function () {
5378
- return "".concat(INSTRUCTION_LINK, "?time=").concat(Date.now());
5379
- };
5454
+ var Url = /*#__PURE__*/function () {
5455
+ function Url() {
5456
+ _classCallCheck(this, Url);
5380
5457
  }
5381
- return _createClass(ApiCheckoutInternal, [{
5382
- key: "instructions",
5383
- value: function instructions() {
5384
- return this.api.requestObservable('GET', this.getInstructionLink(), {});
5385
- }
5386
- }, {
5387
- key: "callback",
5388
- value: function callback(payload) {
5389
- return this.api.getClientPromise('POST', CALLBACK_LINK).send(payload);
5458
+ return _createClass(Url, null, [{
5459
+ key: "extendSearchParams",
5460
+ value: function extendSearchParams(uri, key, val) {
5461
+ return uri.replace(new RegExp("([?&]" + key + "(?=[=&#]|$)[^#&]*|(?=#|$))"), "&" + key + "=" + encodeURIComponent(val)).replace(/^([^?&]+)&/, "$1?");
5390
5462
  }
5391
5463
  }, {
5392
- key: "status",
5393
- value: function status(id) {
5394
- return this.api.getClientPromise('GET', "".concat(STATUS_LINK, "/").concat(id)).send('');
5395
- }
5396
- }]);
5397
- }();
5398
-
5399
- var GET_WALLET_CONFIG = '/v1/gateways/:gateway_id/wallet-config';
5400
- var ApiGatewayInternal = /*#__PURE__*/function () {
5401
- function ApiGatewayInternal(api) {
5402
- _classCallCheck(this, ApiGatewayInternal);
5403
- this.api = api;
5404
- }
5405
- return _createClass(ApiGatewayInternal, [{
5406
- key: "getWalletConfig",
5407
- value: function getWalletConfig(gateway_id) {
5408
- var url = GET_WALLET_CONFIG.replace(':gateway_id', gateway_id);
5409
- return this.api.getClientPromise('GET', url).send(undefined);
5464
+ key: "serialize",
5465
+ value: function serialize(params) {
5466
+ return Object.keys(params).map(function (key) {
5467
+ return encodeURIComponent(key) + '=' + encodeURIComponent(params[key]);
5468
+ }).join('&');
5410
5469
  }
5411
5470
  }]);
5412
5471
  }();
5413
5472
 
5414
- var CREATE_OTT = '/v1/payment_sources/tokens';
5415
- var CREATE_SESSION = '/v1/payment_sources/payment-session';
5416
- var ApiPaymentSourceInternal = /*#__PURE__*/function () {
5417
- function ApiPaymentSourceInternal(api) {
5418
- _classCallCheck(this, ApiPaymentSourceInternal);
5419
- this.api = api;
5473
+ var Uuid = /*#__PURE__*/function () {
5474
+ function Uuid() {
5475
+ _classCallCheck(this, Uuid);
5420
5476
  }
5421
- return _createClass(ApiPaymentSourceInternal, [{
5422
- key: "createOTT",
5423
- value: function createOTT(payload) {
5424
- return this.api.getClientPromise('POST', CREATE_OTT).send(payload);
5477
+ return _createClass(Uuid, null, [{
5478
+ key: "generate",
5479
+ value: function generate() {
5480
+ if (typeof window !== "undefined" && typeof window.crypto !== "undefined" && typeof window.crypto.getRandomValues !== "undefined") {
5481
+ var buf = new Uint16Array(8);
5482
+ window.crypto.getRandomValues(buf);
5483
+ 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]);
5484
+ } else {
5485
+ return this.random() + this.random() + "-" + this.random() + "-" + this.random() + "-" + this.random() + "-" + this.random() + this.random() + this.random();
5486
+ }
5425
5487
  }
5426
5488
  }, {
5427
- key: "createSession",
5428
- value: function createSession(payload) {
5429
- return this.api.getClientPromise('POST', CREATE_SESSION).send(payload);
5489
+ key: "hash",
5490
+ value: function hash(number) {
5491
+ var hash = number.toString(16);
5492
+ while (hash.length < 4) {
5493
+ hash = "0" + hash;
5494
+ }
5495
+ return hash;
5430
5496
  }
5431
- }]);
5432
- }();
5433
-
5434
- var GET_CONFIG = '/v1/services/:service_id/config';
5435
- var ApiServiceInternal = /*#__PURE__*/function () {
5436
- function ApiServiceInternal(api) {
5437
- _classCallCheck(this, ApiServiceInternal);
5438
- this.api = api;
5439
- }
5440
- return _createClass(ApiServiceInternal, [{
5441
- key: "getConfig",
5442
- value: function getConfig(service_id) {
5443
- var url = GET_CONFIG.replace(':service_id', service_id);
5444
- return this.api.getClientPromise('GET', url).send(undefined);
5497
+ }, {
5498
+ key: "random",
5499
+ value: function random() {
5500
+ return Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1);
5445
5501
  }
5446
5502
  }]);
5447
5503
  }();
5448
- var SERVICE_TYPES;
5449
- (function (SERVICE_TYPES) {
5450
- SERVICE_TYPES["ACCERTIFY"] = "Accertify";
5451
- SERVICE_TYPES["BOOKING"] = "Booking";
5452
- SERVICE_TYPES["GPAYMENTS"] = "GPayments";
5453
- SERVICE_TYPES["CLICK_TO_PAY"] = "ClickToPay";
5454
- SERVICE_TYPES["MASTERCARD_NT"] = "MastercardSCOF";
5455
- SERVICE_TYPES["VISA_NT"] = "VisaVTS";
5456
- SERVICE_TYPES["FORTER"] = "Forter";
5457
- SERVICE_TYPES["APPLE_PAY"] = "ApplePay";
5458
- SERVICE_TYPES["GOOGLE_PAY"] = "GooglePay";
5459
- })(SERVICE_TYPES || (SERVICE_TYPES = {}));
5460
5504
 
5461
- var ApiInternal = /*#__PURE__*/function (_ApiBase) {
5462
- function ApiInternal() {
5463
- _classCallCheck(this, ApiInternal);
5464
- return _callSuper(this, ApiInternal, arguments);
5505
+ var WIDGET_LINK = '/remote-action';
5506
+ var VAULT_DISPLAY_WIDGET_LINK = '/vault-display';
5507
+ var PAYMENT_SOURCE_LINK = '/payment-sources';
5508
+ var SECURE_3D = '/3ds/webhook';
5509
+ var FLYPAY_LINK = '/wallet/flypay';
5510
+ var FLYPAY_LOGO_LINK = '/images/coles-pay-logo.png';
5511
+ var MESSAGE_WIDGET_LINK = '/message-widget';
5512
+ var MASTERCARD_SRC = '/secure-remote-commerce/mastercard';
5513
+ var Link = /*#__PURE__*/function () {
5514
+ function Link(linkResource) {
5515
+ _classCallCheck(this, Link);
5516
+ this.params = {};
5517
+ this.widgetId = Uuid.generate();
5518
+ this.linkResource = linkResource;
5519
+ this.env = new Env(WIDGET_URL);
5520
+ this.setParams({
5521
+ widget_id: this.widgetId
5522
+ });
5465
5523
  }
5466
- _inherits(ApiInternal, _ApiBase);
5467
- return _createClass(ApiInternal, [{
5468
- key: "charge",
5469
- value: function charge() {
5470
- return new ApiChargeInternal(this);
5524
+ return _createClass(Link, [{
5525
+ key: "getNetUrl",
5526
+ value: function getNetUrl() {
5527
+ return this.env.getConf().url + this.linkResource;
5471
5528
  }
5472
5529
  }, {
5473
- key: "service",
5474
- value: function service() {
5475
- return new ApiServiceInternal(this);
5530
+ key: "getUrl",
5531
+ value: function getUrl() {
5532
+ var url = this.getNetUrl();
5533
+ var params = this.getParams();
5534
+ for (var key in params) {
5535
+ if (params.hasOwnProperty(key)) url = Url.extendSearchParams(url, key, params[key]);
5536
+ }
5537
+ return url;
5476
5538
  }
5477
5539
  }, {
5478
- key: "checkout",
5479
- value: function checkout() {
5480
- return new ApiCheckoutInternal(this);
5540
+ key: "setParams",
5541
+ value: function setParams(params) {
5542
+ this.params = _extends({}, this.params, params);
5481
5543
  }
5482
5544
  }, {
5483
- key: "gateway",
5484
- value: function gateway() {
5485
- return new ApiGatewayInternal(this);
5545
+ key: "concatParams",
5546
+ value: function concatParams(params) {
5547
+ for (var key in params) {
5548
+ if (!params.hasOwnProperty(key) || !params[key].length) continue;
5549
+ if (typeof this.params[key] !== 'string') this.params[key] = '';
5550
+ if (this.params[key].length) this.params[key] += ',' + params[key];else this.params[key] += params[key];
5551
+ }
5486
5552
  }
5487
5553
  }, {
5488
- key: "paymentSource",
5489
- value: function paymentSource() {
5490
- return new ApiPaymentSourceInternal(this);
5491
- }
5492
- }]);
5493
- }(ApiBase);
5494
-
5495
- var STANDALONE_3DS_GATEWAYS = {
5496
- GPAYMENTS: "GPayments"
5497
- };
5498
- var Standalone3dsService = /*#__PURE__*/function () {
5499
- function Standalone3dsService(container, eventEmitter) {
5500
- _classCallCheck(this, Standalone3dsService);
5501
- this.env = DEFAULT_ENV;
5502
- this.container = container;
5503
- this.eventEmitter = eventEmitter;
5504
- }
5505
- return _createClass(Standalone3dsService, [{
5506
- key: "load",
5507
- value: function load(token, options) {
5508
- var parsedToken = AccessToken.validateJWT(token);
5509
- if (!parsedToken) throw new Error("Invalid charge token");
5510
- var tokenData = AccessToken.extractData(parsedToken.body);
5511
- var api = new ApiInternal(token, API_AUTH_TYPE.TOKEN);
5512
- api.setEnv(this.env, this.alias);
5513
- switch (tokenData.service_type) {
5514
- case STANDALONE_3DS_GATEWAYS.GPAYMENTS:
5515
- new GPaymentsService(this.container, api, this.eventEmitter).load(tokenData, options.title);
5516
- break;
5517
- }
5554
+ key: "getParams",
5555
+ value: function getParams() {
5556
+ return this.params;
5518
5557
  }
5519
5558
  }, {
5520
5559
  key: "setEnv",
5521
5560
  value: function setEnv(env, alias) {
5522
- this.env = env;
5523
- this.alias = alias;
5561
+ this.env.setEnv(env, alias);
5562
+ }
5563
+ }, {
5564
+ key: "getEnv",
5565
+ value: function getEnv() {
5566
+ return this.env.getEnv();
5567
+ }
5568
+ }, {
5569
+ key: "getBaseUrl",
5570
+ value: function getBaseUrl() {
5571
+ return this.env.getConf().url;
5524
5572
  }
5525
5573
  }]);
5526
5574
  }();
@@ -5560,7 +5608,7 @@ var TOKEN_FORMAT$2;
5560
5608
  * @param {string} CHARGE_AUTH_CHALLENGE=chargeAuthChallenge
5561
5609
  * @param {string} CHARGE_AUTH_INFO=chargeAuthInfo
5562
5610
  * @param {string} ERROR=error
5563
- */
5611
+ */
5564
5612
  /**
5565
5613
  * Class Canvas3ds include method for working on html
5566
5614
  * @constructor
@@ -5596,13 +5644,21 @@ var Canvas3ds = /*#__PURE__*/function () {
5596
5644
  *
5597
5645
  */
5598
5646
  function load() {
5599
- if (this.token.format === TOKEN_FORMAT$2.HTML) this.iFrame.loadFromHtml(this.token.content, {
5600
- title: '3d secure authentication'
5601
- }, 'threeDSecure-iframe');else if (this.token.format === TOKEN_FORMAT$2.URL) this.iFrame.load(this.token.content, {
5602
- title: '3d secure authentication'
5603
- }, 'threeDSecure-iframe');else if (this.token.format === TOKEN_FORMAT$2.STANDALONE_3DS) this.standalone3dsService.load(this.token.content, {
5604
- title: '3d secure authentication'
5605
- });else console.error('Token contain unsupported payload');
5647
+ if (this.token.format === TOKEN_FORMAT$2.HTML) {
5648
+ this.iFrame.loadFromHtml(this.token.content, {
5649
+ title: '3d secure authentication'
5650
+ }, 'threeDSecure-iframe');
5651
+ } else if (this.token.format === TOKEN_FORMAT$2.URL) {
5652
+ this.iFrame.load(this.token.content, {
5653
+ title: '3d secure authentication'
5654
+ }, 'threeDSecure-iframe');
5655
+ } else if (this.token.format === TOKEN_FORMAT$2.STANDALONE_3DS) {
5656
+ this.standalone3dsService.load(this.token.content, {
5657
+ title: '3d secure authentication'
5658
+ });
5659
+ } else {
5660
+ console.error('Token contain unsupported payload');
5661
+ }
5606
5662
  }
5607
5663
  /**
5608
5664
  * Current method can change environment. By default environment = sandbox.
@@ -5619,7 +5675,9 @@ var Canvas3ds = /*#__PURE__*/function () {
5619
5675
  this.link.setEnv(env, alias);
5620
5676
  this.standalone3dsService.setEnv(env, alias);
5621
5677
  for (var index in this.configs) {
5622
- if (!this.configs.hasOwnProperty(index)) continue;
5678
+ if (!Object.hasOwn(this.configs, index)) {
5679
+ continue;
5680
+ }
5623
5681
  this.configs[index].setEnv(env, alias);
5624
5682
  }
5625
5683
  }
@@ -5629,34 +5687,45 @@ var Canvas3ds = /*#__PURE__*/function () {
5629
5687
  return this.link.getEnv();
5630
5688
  }
5631
5689
  /**
5632
- * Listen to events of widget
5690
+ * Listen to events of widget.
5633
5691
  *
5634
- * @example
5692
+ * Available event names are defined in {@link Canvas3dsEventMap} (typed) and
5693
+ * {@link CANVAS_3DS_EVENT} (string constants). Using a literal event name
5694
+ * narrows the callback payload via the typed overloads.
5635
5695
  *
5636
- * widget.on('chargeAuthReject', function (data) {
5637
- * console.log(data);
5696
+ * @example
5697
+ * // Callback form — payload is narrowed by the event name
5698
+ * widget.on('chargeAuthReject', (data) => {
5699
+ * console.log(data); // data is Canvas3dsAuthPayload | Canvas3dsChargeAuthEventPayload
5638
5700
  * });
5639
- * // or
5640
- * widget.on('chargeAuthReject').then(function (data) {
5641
- * console.log(data);
5701
+ *
5702
+ * // Promise form
5703
+ * widget.on('chargeAuthReject').then((data) => {
5704
+ * console.log(data);
5642
5705
  * });
5643
- * @param {string} eventName - Available event names [EVENT]{@link EVENT} [STANDALONE_3DS_EVENT]{@link STANDALONE_3DS_EVENT}
5644
- * @param {listener} [cb]
5645
- * @return {Promise<IEventData> | void}
5706
+ *
5707
+ * @param eventName - Event name from {@link Canvas3dsEventMap} or any string for dynamic events.
5708
+ * @param cb - Optional listener callback. If omitted, returns a Promise that resolves on the next emission.
5709
+ * @returns `void` when a callback is provided; otherwise a Promise that resolves with the event payload.
5646
5710
  */
5711
+ // biome-ignore lint/suspicious/noExplicitAny: implementation signature must accept any payload shape to satisfy all overloads above
5647
5712
  }, {
5648
5713
  key: "on",
5649
5714
  value: function on(eventName, cb) {
5650
5715
  var _this = this;
5651
5716
  if (this.token.format === TOKEN_FORMAT$2.STANDALONE_3DS) {
5652
- if (typeof cb === 'function') return this.eventEmitter.subscribe(eventName, cb);
5717
+ if (typeof cb === 'function') {
5718
+ return this.eventEmitter.subscribe(eventName, cb);
5719
+ }
5653
5720
  return new Promise(function (resolve) {
5654
5721
  return _this.eventEmitter.subscribe(eventName, function (res) {
5655
5722
  return resolve(res);
5656
5723
  });
5657
5724
  });
5658
5725
  } else {
5659
- if (typeof cb === 'function') return this.event.on(eventName, this.link.getParams().ref_id, cb);
5726
+ if (typeof cb === 'function') {
5727
+ return this.event.on(eventName, this.link.getParams().ref_id, cb);
5728
+ }
5660
5729
  return new Promise(function (resolve) {
5661
5730
  return _this.event.on(eventName, _this.link.getParams().ref_id, function (res) {
5662
5731
  return resolve(res);
@@ -5700,6 +5769,19 @@ var Canvas3ds = /*#__PURE__*/function () {
5700
5769
  }]);
5701
5770
  }();
5702
5771
 
5772
+ /**
5773
+ * Public, tree-shakeable alias for the internal `TOKEN_FORMAT` enum in canvas-3ds.ts.
5774
+ * Mirrors the string values of that enum without exposing the private enum itself.
5775
+ */
5776
+ var Canvas3dsTokenFormat = {
5777
+ /** Token whose `content` is a complete HTML page. The SDK renders it inside an iframe. */
5778
+ HTML: 'html',
5779
+ /** Token whose `content` is a URL. The SDK loads it inside an iframe. */
5780
+ URL: 'url',
5781
+ /** Token whose `content` describes a standalone 3DS service (e.g. GPayments). The SDK delegates to that service's flow. */
5782
+ STANDALONE_3DS: 'standalone_3ds'
5783
+ };
5784
+
5703
5785
  var Spinner = /*#__PURE__*/function () {
5704
5786
  function Spinner() {
5705
5787
  _classCallCheck(this, Spinner);
@@ -6781,7 +6863,7 @@ var ZipmoneyContextualRunner = /*#__PURE__*/function (_ContextualRunner) {
6781
6863
  key: "setCompleteCheckoutListener",
6782
6864
  value: function setCompleteCheckoutListener() {
6783
6865
  var _this5 = this;
6784
- this.event.on(EVENT$5.FINISH, this.widgetId, function (event) {
6866
+ this.event.on(EVENT$4.FINISH, this.widgetId, function (event) {
6785
6867
  _this5.event.clear();
6786
6868
  clearInterval(_this5.checkInterval);
6787
6869
  if (_this5.checkoutTab && !_this5.checkoutTab.closed) {
@@ -6868,15 +6950,15 @@ var StorageDispatcher = /*#__PURE__*/function () {
6868
6950
  value: function setupIframeEventListeners() {
6869
6951
  var _this = this;
6870
6952
  if (!this.widgetId) return;
6871
- this.iframeEvent.on(EVENT$5.AFTER_LOAD, this.widgetId, function (_event) {
6953
+ this.iframeEvent.on(EVENT$4.AFTER_LOAD, this.widgetId, function (_event) {
6872
6954
  var _a;
6873
6955
  (_a = _this.onLoadCallback) === null || _a === void 0 ? void 0 : _a.call(_this);
6874
6956
  });
6875
- this.iframeEvent.on(EVENT$5.DISPATCH_SUCCESS, this.widgetId, function (_event) {
6957
+ this.iframeEvent.on(EVENT$4.DISPATCH_SUCCESS, this.widgetId, function (_event) {
6876
6958
  var _a, _b;
6877
6959
  (_b = (_a = _this.pushCallbacks) === null || _a === void 0 ? void 0 : _a.onSuccess) === null || _b === void 0 ? void 0 : _b.call(_a);
6878
6960
  });
6879
- this.iframeEvent.on(EVENT$5.DISPATCH_ERROR, this.widgetId, function (_event) {
6961
+ this.iframeEvent.on(EVENT$4.DISPATCH_ERROR, this.widgetId, function (_event) {
6880
6962
  var _a, _b;
6881
6963
  (_b = (_a = _this.pushCallbacks) === null || _a === void 0 ? void 0 : _a.onError) === null || _b === void 0 ? void 0 : _b.call(_a);
6882
6964
  });
@@ -8090,7 +8172,7 @@ var AfterPayWalletService = /*#__PURE__*/function (_WalletService) {
8090
8172
  }]);
8091
8173
  }(WalletService);
8092
8174
 
8093
- /*! @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 */
8175
+ /*! @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 */
8094
8176
 
8095
8177
  var purify_cjs;
8096
8178
  var hasRequiredPurify_cjs;
@@ -8298,7 +8380,7 @@ function requirePurify_cjs () {
8298
8380
 
8299
8381
  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']);
8300
8382
  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']);
8301
- 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']);
8383
+ 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']);
8302
8384
  const xml = freeze(['xlink:href', 'xml:id', 'xlink:title', 'xml:space', 'xmlns:xlink']);
8303
8385
 
8304
8386
  // eslint-disable-next-line unicorn/better-regex
@@ -8395,7 +8477,7 @@ function requirePurify_cjs () {
8395
8477
  function createDOMPurify() {
8396
8478
  let window = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getGlobal();
8397
8479
  const DOMPurify = root => createDOMPurify(root);
8398
- DOMPurify.version = '3.3.3';
8480
+ DOMPurify.version = '3.4.0';
8399
8481
  DOMPurify.removed = [];
8400
8482
  if (!window || !window.document || window.document.nodeType !== NODE_TYPE.document || !window.Element) {
8401
8483
  // Not running in a browser, provide a factory function
@@ -8671,7 +8753,7 @@ function requirePurify_cjs () {
8671
8753
  NAMESPACE = cfg.NAMESPACE || HTML_NAMESPACE;
8672
8754
  MATHML_TEXT_INTEGRATION_POINTS = cfg.MATHML_TEXT_INTEGRATION_POINTS || MATHML_TEXT_INTEGRATION_POINTS;
8673
8755
  HTML_INTEGRATION_POINTS = cfg.HTML_INTEGRATION_POINTS || HTML_INTEGRATION_POINTS;
8674
- CUSTOM_ELEMENT_HANDLING = cfg.CUSTOM_ELEMENT_HANDLING || {};
8756
+ CUSTOM_ELEMENT_HANDLING = cfg.CUSTOM_ELEMENT_HANDLING || create(null);
8675
8757
  if (cfg.CUSTOM_ELEMENT_HANDLING && isRegexOrFunction(cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck)) {
8676
8758
  CUSTOM_ELEMENT_HANDLING.tagNameCheck = cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck;
8677
8759
  }
@@ -8711,13 +8793,10 @@ function requirePurify_cjs () {
8711
8793
  addToSet(ALLOWED_ATTR, xml);
8712
8794
  }
8713
8795
  }
8714
- /* Prevent function-based ADD_ATTR / ADD_TAGS from leaking across calls */
8715
- if (!objectHasOwnProperty(cfg, 'ADD_TAGS')) {
8716
- EXTRA_ELEMENT_HANDLING.tagCheck = null;
8717
- }
8718
- if (!objectHasOwnProperty(cfg, 'ADD_ATTR')) {
8719
- EXTRA_ELEMENT_HANDLING.attributeCheck = null;
8720
- }
8796
+ /* Always reset function-based ADD_TAGS / ADD_ATTR checks to prevent
8797
+ * leaking across calls when switching from function to array config */
8798
+ EXTRA_ELEMENT_HANDLING.tagCheck = null;
8799
+ EXTRA_ELEMENT_HANDLING.attributeCheck = null;
8721
8800
  /* Merge configuration parameters */
8722
8801
  if (cfg.ADD_TAGS) {
8723
8802
  if (typeof cfg.ADD_TAGS === 'function') {
@@ -9040,6 +9119,11 @@ function requirePurify_cjs () {
9040
9119
  _forceRemove(currentNode);
9041
9120
  return true;
9042
9121
  }
9122
+ /* Remove risky CSS construction leading to mXSS */
9123
+ if (SAFE_FOR_XML && currentNode.namespaceURI === HTML_NAMESPACE && tagName === 'style' && _isNode(currentNode.firstElementChild)) {
9124
+ _forceRemove(currentNode);
9125
+ return true;
9126
+ }
9043
9127
  /* Remove any occurrence of processing instructions */
9044
9128
  if (currentNode.nodeType === NODE_TYPE.progressingInstruction) {
9045
9129
  _forceRemove(currentNode);
@@ -9051,7 +9135,7 @@ function requirePurify_cjs () {
9051
9135
  return true;
9052
9136
  }
9053
9137
  /* Remove element if anything forbids its presence */
9054
- if (!(EXTRA_ELEMENT_HANDLING.tagCheck instanceof Function && EXTRA_ELEMENT_HANDLING.tagCheck(tagName)) && (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName])) {
9138
+ if (FORBID_TAGS[tagName] || !(EXTRA_ELEMENT_HANDLING.tagCheck instanceof Function && EXTRA_ELEMENT_HANDLING.tagCheck(tagName)) && !ALLOWED_TAGS[tagName]) {
9055
9139
  /* Check if we have a custom element to handle */
9056
9140
  if (!FORBID_TAGS[tagName] && _isBasicCustomElement(tagName)) {
9057
9141
  if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, tagName)) {
@@ -9290,7 +9374,7 @@ function requirePurify_cjs () {
9290
9374
  *
9291
9375
  * @param fragment to iterate over recursively
9292
9376
  */
9293
- const _sanitizeShadowDOM = function _sanitizeShadowDOM(fragment) {
9377
+ const _sanitizeShadowDOM2 = function _sanitizeShadowDOM(fragment) {
9294
9378
  let shadowNode = null;
9295
9379
  const shadowIterator = _createNodeIterator(fragment);
9296
9380
  /* Execute a hook if present */
@@ -9304,7 +9388,7 @@ function requirePurify_cjs () {
9304
9388
  _sanitizeAttributes(shadowNode);
9305
9389
  /* Deep shadow DOM detected */
9306
9390
  if (shadowNode.content instanceof DocumentFragment) {
9307
- _sanitizeShadowDOM(shadowNode.content);
9391
+ _sanitizeShadowDOM2(shadowNode.content);
9308
9392
  }
9309
9393
  }
9310
9394
  /* Execute a hook if present */
@@ -9399,7 +9483,7 @@ function requirePurify_cjs () {
9399
9483
  _sanitizeAttributes(currentNode);
9400
9484
  /* Shadow DOM detected, sanitize it */
9401
9485
  if (currentNode.content instanceof DocumentFragment) {
9402
- _sanitizeShadowDOM(currentNode.content);
9486
+ _sanitizeShadowDOM2(currentNode.content);
9403
9487
  }
9404
9488
  }
9405
9489
  /* If we sanitized `dirty` in-place, return it. */
@@ -9408,6 +9492,14 @@ function requirePurify_cjs () {
9408
9492
  }
9409
9493
  /* Return sanitized string or DOM */
9410
9494
  if (RETURN_DOM) {
9495
+ if (SAFE_FOR_TEMPLATES) {
9496
+ body.normalize();
9497
+ let html = body.innerHTML;
9498
+ arrayForEach([MUSTACHE_EXPR, ERB_EXPR, TMPLIT_EXPR], expr => {
9499
+ html = stringReplace(html, expr, ' ');
9500
+ });
9501
+ body.innerHTML = html;
9502
+ }
9411
9503
  if (RETURN_DOM_FRAGMENT) {
9412
9504
  returnNode = createDocumentFragment.call(body.ownerDocument);
9413
9505
  while (body.firstChild) {
@@ -10240,6 +10332,44 @@ var FlypayWalletService = /*#__PURE__*/function (_WalletService) {
10240
10332
  }]);
10241
10333
  }(WalletService);
10242
10334
 
10335
+ /**
10336
+ * Maximum Apple Pay JS API version the SDK targets.
10337
+ * Bump this when adopting features from a newer version.
10338
+ */
10339
+ var APPLE_PAY_MAX_VERSION = 14;
10340
+ /**
10341
+ * Minimum Apple Pay JS API version the SDK can operate with.
10342
+ *
10343
+ * Version 3 (iOS 11 / macOS 10.13) is required because the SDK uses:
10344
+ * - `ApplePayError` constructor
10345
+ * - Object-form `completeShippingContactSelection(update)`
10346
+ * - Object-form `completeShippingMethodSelection(update)`
10347
+ * - `supportedCountries` in payment requests
10348
+ *
10349
+ * All of these were introduced in version 3.
10350
+ */
10351
+ var APPLE_PAY_MIN_VERSION = 3;
10352
+ /**
10353
+ * Detects the highest Apple Pay JS API version the current device supports,
10354
+ * starting from {@link APPLE_PAY_MAX_VERSION} down to {@link APPLE_PAY_MIN_VERSION}.
10355
+ *
10356
+ * Returns `0` if Apple Pay is not available or the device does not support
10357
+ * the minimum required version.
10358
+ *
10359
+ * @see https://developer.apple.com/documentation/apple_pay_on_the_web/applepaysession/supportsversion
10360
+ */
10361
+ function getSupportedApplePayVersion() {
10362
+ if (!window.ApplePaySession) {
10363
+ return 0;
10364
+ }
10365
+ for (var v = APPLE_PAY_MAX_VERSION; v >= APPLE_PAY_MIN_VERSION; v--) {
10366
+ if (ApplePaySession.supportsVersion(v)) {
10367
+ return v;
10368
+ }
10369
+ }
10370
+ return 0;
10371
+ }
10372
+
10243
10373
  var DEFAULT_APPLE_PAY_CAPABILITIES$2 = ['paymentCredentialsAvailable'];
10244
10374
  var AppleWalletService = /*#__PURE__*/function (_WalletService) {
10245
10375
  function AppleWalletService(publicKey, meta, gatewayName, eventEmitter) {
@@ -10569,7 +10699,14 @@ var AppleWalletService = /*#__PURE__*/function (_WalletService) {
10569
10699
  key: "onApplePayButtonClicked",
10570
10700
  value: function onApplePayButtonClicked() {
10571
10701
  var _this5 = this;
10572
- this.paymentSession = new ApplePaySession(14, this.createRequest());
10702
+ var applePayApiVersion = getSupportedApplePayVersion();
10703
+ if (applePayApiVersion === 0) {
10704
+ this.eventEmitter.emit(WALLET_EVENT.UNAVAILABLE, {
10705
+ wallet: WALLET_TYPE.APPLE
10706
+ });
10707
+ return;
10708
+ }
10709
+ this.paymentSession = new ApplePaySession(applePayApiVersion, this.createRequest());
10573
10710
  this.paymentSession.onvalidatemerchant = this.onValidateMerchant;
10574
10711
  this.paymentSession.onpaymentauthorized = this.onPaymentAuthorized;
10575
10712
  this.paymentSession.oncancel = this.onCancelPayment;
@@ -11718,7 +11855,7 @@ var StripeWalletService = /*#__PURE__*/function (_WalletService) {
11718
11855
  * @param {string} ON_CLICK=onClick
11719
11856
  * @param {string} LOADED=onWalletLoaded
11720
11857
  */
11721
- var EVENT$4 = {
11858
+ var EVENT$3 = {
11722
11859
  UNAVAILABLE: EventEnum.UNAVAILABLE,
11723
11860
  UPDATE: EventEnum.UPDATE,
11724
11861
  PAYMENT_SUCCESSFUL: EventEnum.PAYMENT_SUCCESSFUL,
@@ -11844,7 +11981,7 @@ var WalletButtons = /*#__PURE__*/function () {
11844
11981
  this.setupServiceCallbacks();
11845
11982
  this.service.load(this.container);
11846
11983
  } catch (err) {
11847
- this.eventEmitter.emit(EVENT$4.UNAVAILABLE, null);
11984
+ this.eventEmitter.emit(EVENT$3.UNAVAILABLE, null);
11848
11985
  throw err;
11849
11986
  }
11850
11987
  }
@@ -11981,7 +12118,7 @@ var WalletButtons = /*#__PURE__*/function () {
11981
12118
  key: "on",
11982
12119
  value: function on(eventName, cb) {
11983
12120
  var _this = this;
11984
- if (eventName === EVENT$4.UPDATE) {
12121
+ if (eventName === EVENT$3.UPDATE) {
11985
12122
  this.hasUpdateHandler = true;
11986
12123
  }
11987
12124
  if (typeof cb === 'function') {
@@ -12016,10 +12153,10 @@ var WalletButtons = /*#__PURE__*/function () {
12016
12153
  value: function onUnavailable(handler) {
12017
12154
  var _this2 = this;
12018
12155
  if (typeof handler === 'function') {
12019
- return this.eventEmitter.subscribe(EVENT$4.UNAVAILABLE, handler);
12156
+ return this.eventEmitter.subscribe(EVENT$3.UNAVAILABLE, handler);
12020
12157
  }
12021
12158
  return new Promise(function (resolve) {
12022
- return _this2.eventEmitter.subscribe(EVENT$4.UNAVAILABLE, function () {
12159
+ return _this2.eventEmitter.subscribe(EVENT$3.UNAVAILABLE, function () {
12023
12160
  return resolve();
12024
12161
  });
12025
12162
  });
@@ -12045,10 +12182,10 @@ var WalletButtons = /*#__PURE__*/function () {
12045
12182
  var _this3 = this;
12046
12183
  this.hasUpdateHandler = true;
12047
12184
  if (typeof handler === 'function') {
12048
- return this.eventEmitter.subscribe(EVENT$4.UPDATE, handler);
12185
+ return this.eventEmitter.subscribe(EVENT$3.UPDATE, handler);
12049
12186
  }
12050
12187
  return new Promise(function (resolve) {
12051
- return _this3.eventEmitter.subscribe(EVENT$4.UPDATE, function (data) {
12188
+ return _this3.eventEmitter.subscribe(EVENT$3.UPDATE, function (data) {
12052
12189
  return resolve(data);
12053
12190
  });
12054
12191
  });
@@ -12072,10 +12209,10 @@ var WalletButtons = /*#__PURE__*/function () {
12072
12209
  value: function onPaymentSuccessful(handler) {
12073
12210
  var _this4 = this;
12074
12211
  if (typeof handler === 'function') {
12075
- return this.eventEmitter.subscribe(EVENT$4.PAYMENT_SUCCESSFUL, handler);
12212
+ return this.eventEmitter.subscribe(EVENT$3.PAYMENT_SUCCESSFUL, handler);
12076
12213
  }
12077
12214
  return new Promise(function (resolve) {
12078
- return _this4.eventEmitter.subscribe(EVENT$4.PAYMENT_SUCCESSFUL, function (data) {
12215
+ return _this4.eventEmitter.subscribe(EVENT$3.PAYMENT_SUCCESSFUL, function (data) {
12079
12216
  return resolve(data);
12080
12217
  });
12081
12218
  });
@@ -12099,10 +12236,10 @@ var WalletButtons = /*#__PURE__*/function () {
12099
12236
  value: function onPaymentInReview(handler) {
12100
12237
  var _this5 = this;
12101
12238
  if (typeof handler === 'function') {
12102
- return this.eventEmitter.subscribe(EVENT$4.PAYMENT_IN_REVIEW, handler);
12239
+ return this.eventEmitter.subscribe(EVENT$3.PAYMENT_IN_REVIEW, handler);
12103
12240
  }
12104
12241
  return new Promise(function (resolve) {
12105
- return _this5.eventEmitter.subscribe(EVENT$4.PAYMENT_IN_REVIEW, function (data) {
12242
+ return _this5.eventEmitter.subscribe(EVENT$3.PAYMENT_IN_REVIEW, function (data) {
12106
12243
  return resolve(data);
12107
12244
  });
12108
12245
  });
@@ -12126,10 +12263,10 @@ var WalletButtons = /*#__PURE__*/function () {
12126
12263
  value: function onPaymentError(handler) {
12127
12264
  var _this6 = this;
12128
12265
  if (typeof handler === 'function') {
12129
- return this.eventEmitter.subscribe(EVENT$4.PAYMENT_ERROR, handler);
12266
+ return this.eventEmitter.subscribe(EVENT$3.PAYMENT_ERROR, handler);
12130
12267
  }
12131
12268
  return new Promise(function (resolve) {
12132
- return _this6.eventEmitter.subscribe(EVENT$4.PAYMENT_ERROR, function (err) {
12269
+ return _this6.eventEmitter.subscribe(EVENT$3.PAYMENT_ERROR, function (err) {
12133
12270
  return resolve(err);
12134
12271
  });
12135
12272
  });
@@ -12155,10 +12292,10 @@ var WalletButtons = /*#__PURE__*/function () {
12155
12292
  value: function onAuthTokensChanged(handler) {
12156
12293
  var _this7 = this;
12157
12294
  if (typeof handler === 'function') {
12158
- return this.eventEmitter.subscribe(EVENT$4.AUTH_TOKENS_CHANGED, handler);
12295
+ return this.eventEmitter.subscribe(EVENT$3.AUTH_TOKENS_CHANGED, handler);
12159
12296
  }
12160
12297
  return new Promise(function (resolve) {
12161
- return _this7.eventEmitter.subscribe(EVENT$4.AUTH_TOKENS_CHANGED, function (err) {
12298
+ return _this7.eventEmitter.subscribe(EVENT$3.AUTH_TOKENS_CHANGED, function (err) {
12162
12299
  return resolve(err);
12163
12300
  });
12164
12301
  });
@@ -12181,7 +12318,7 @@ var WalletButtons = /*#__PURE__*/function () {
12181
12318
  key: "onClick",
12182
12319
  value: function onClick(handler) {
12183
12320
  if (typeof handler === 'function') {
12184
- return this.eventEmitter.subscribe(EVENT$4.ON_CLICK, handler);
12321
+ return this.eventEmitter.subscribe(EVENT$3.ON_CLICK, handler);
12185
12322
  }
12186
12323
  }
12187
12324
  /**
@@ -12200,10 +12337,10 @@ var WalletButtons = /*#__PURE__*/function () {
12200
12337
  value: function onCheckoutOpen(handler) {
12201
12338
  var _this8 = this;
12202
12339
  if (typeof handler === 'function') {
12203
- return this.eventEmitter.subscribe(EVENT$4.ON_CHECKOUT_OPEN, handler);
12340
+ return this.eventEmitter.subscribe(EVENT$3.ON_CHECKOUT_OPEN, handler);
12204
12341
  }
12205
12342
  return new Promise(function (resolve) {
12206
- return _this8.eventEmitter.subscribe(EVENT$4.ON_CHECKOUT_OPEN, function (err) {
12343
+ return _this8.eventEmitter.subscribe(EVENT$3.ON_CHECKOUT_OPEN, function (err) {
12207
12344
  return resolve(err);
12208
12345
  });
12209
12346
  });
@@ -12224,10 +12361,10 @@ var WalletButtons = /*#__PURE__*/function () {
12224
12361
  value: function onCheckoutClose(handler) {
12225
12362
  var _this9 = this;
12226
12363
  if (typeof handler === 'function') {
12227
- return this.eventEmitter.subscribe(EVENT$4.ON_CHECKOUT_CLOSE, handler);
12364
+ return this.eventEmitter.subscribe(EVENT$3.ON_CHECKOUT_CLOSE, handler);
12228
12365
  }
12229
12366
  return new Promise(function (resolve) {
12230
- return _this9.eventEmitter.subscribe(EVENT$4.ON_CHECKOUT_CLOSE, function (err) {
12367
+ return _this9.eventEmitter.subscribe(EVENT$3.ON_CHECKOUT_CLOSE, function (err) {
12231
12368
  return resolve(err);
12232
12369
  });
12233
12370
  });
@@ -12253,8 +12390,8 @@ var WalletButtons = /*#__PURE__*/function () {
12253
12390
  value: function setupOnWalletLoadedCallback() {
12254
12391
  var _this0 = this;
12255
12392
  this.service.on(WALLET_EVENT.LOADED, function (eventData) {
12256
- _this0.eventEmitter.emit(EVENT$4.ON_WALLET_LOADED, {
12257
- event: EVENT$4.ON_WALLET_LOADED,
12393
+ _this0.eventEmitter.emit(EVENT$3.ON_WALLET_LOADED, {
12394
+ event: EVENT$3.ON_WALLET_LOADED,
12258
12395
  data: eventData
12259
12396
  });
12260
12397
  });
@@ -12264,8 +12401,8 @@ var WalletButtons = /*#__PURE__*/function () {
12264
12401
  value: function setupUnavailableCallback() {
12265
12402
  var _this1 = this;
12266
12403
  this.service.on(WALLET_EVENT.UNAVAILABLE, function (eventData) {
12267
- return _this1.eventEmitter.emit(EVENT$4.UNAVAILABLE, {
12268
- event: EVENT$4.UNAVAILABLE,
12404
+ return _this1.eventEmitter.emit(EVENT$3.UNAVAILABLE, {
12405
+ event: EVENT$3.UNAVAILABLE,
12269
12406
  data: eventData
12270
12407
  });
12271
12408
  });
@@ -12275,8 +12412,8 @@ var WalletButtons = /*#__PURE__*/function () {
12275
12412
  value: function setupUpdateCallback() {
12276
12413
  var _this10 = this;
12277
12414
  this.service.on(WALLET_EVENT.UPDATE, function (eventData) {
12278
- return _this10.hasUpdateHandler ? _this10.eventEmitter.emit(EVENT$4.UPDATE, {
12279
- event: EVENT$4.UPDATE,
12415
+ return _this10.hasUpdateHandler ? _this10.eventEmitter.emit(EVENT$3.UPDATE, {
12416
+ event: EVENT$3.UPDATE,
12280
12417
  data: eventData
12281
12418
  }) : _this10.update({
12282
12419
  success: true
@@ -12288,8 +12425,8 @@ var WalletButtons = /*#__PURE__*/function () {
12288
12425
  value: function setupOnClickCallback() {
12289
12426
  var _this11 = this;
12290
12427
  this.service.on(WALLET_EVENT.BUTTON_CLICK, function (data) {
12291
- return _this11.eventEmitter.emit(EVENT$4.ON_CLICK, {
12292
- event: EVENT$4.ON_CLICK,
12428
+ return _this11.eventEmitter.emit(EVENT$3.ON_CLICK, {
12429
+ event: EVENT$3.ON_CLICK,
12293
12430
  data: data
12294
12431
  });
12295
12432
  });
@@ -12299,8 +12436,8 @@ var WalletButtons = /*#__PURE__*/function () {
12299
12436
  value: function setupOnCheckoutOpenCallback() {
12300
12437
  var _this12 = this;
12301
12438
  this.service.on(WALLET_EVENT.CHECKOUT_OPEN, function (data) {
12302
- return _this12.eventEmitter.emit(EVENT$4.ON_CHECKOUT_OPEN, {
12303
- event: EVENT$4.ON_CHECKOUT_OPEN,
12439
+ return _this12.eventEmitter.emit(EVENT$3.ON_CHECKOUT_OPEN, {
12440
+ event: EVENT$3.ON_CHECKOUT_OPEN,
12304
12441
  data: data
12305
12442
  });
12306
12443
  });
@@ -12310,8 +12447,8 @@ var WalletButtons = /*#__PURE__*/function () {
12310
12447
  value: function setupOnCheckoutCloseCallback() {
12311
12448
  var _this13 = this;
12312
12449
  this.service.on(WALLET_EVENT.CHECKOUT_CLOSE, function (data) {
12313
- return _this13.eventEmitter.emit(EVENT$4.ON_CHECKOUT_CLOSE, {
12314
- event: EVENT$4.ON_CHECKOUT_CLOSE,
12450
+ return _this13.eventEmitter.emit(EVENT$3.ON_CHECKOUT_CLOSE, {
12451
+ event: EVENT$3.ON_CHECKOUT_CLOSE,
12315
12452
  data: data
12316
12453
  });
12317
12454
  });
@@ -12343,7 +12480,7 @@ var WalletButtons = /*#__PURE__*/function () {
12343
12480
  if (typeof onSuccess === 'function') {
12344
12481
  onSuccess();
12345
12482
  }
12346
- var event = captureResult.status === 'inreview' ? EVENT$4.PAYMENT_IN_REVIEW : EVENT$4.PAYMENT_SUCCESSFUL;
12483
+ var event = captureResult.status === 'inreview' ? EVENT$3.PAYMENT_IN_REVIEW : EVENT$3.PAYMENT_SUCCESSFUL;
12347
12484
  _this15.eventEmitter.emit(event, {
12348
12485
  event: event,
12349
12486
  data: _extends(_extends({}, captureResult), data.customer && {
@@ -12356,8 +12493,8 @@ var WalletButtons = /*#__PURE__*/function () {
12356
12493
  if (typeof onError === 'function') {
12357
12494
  onError(err);
12358
12495
  }
12359
- _this15.eventEmitter.emit(EVENT$4.PAYMENT_ERROR, {
12360
- event: EVENT$4.PAYMENT_ERROR,
12496
+ _this15.eventEmitter.emit(EVENT$3.PAYMENT_ERROR, {
12497
+ event: EVENT$3.PAYMENT_ERROR,
12361
12498
  data: err
12362
12499
  });
12363
12500
  });
@@ -12368,8 +12505,8 @@ var WalletButtons = /*#__PURE__*/function () {
12368
12505
  value: function setupPaymentSuccessCallback() {
12369
12506
  var _this16 = this;
12370
12507
  this.service.on(WALLET_EVENT.PAYMENT_SUCCESS, function (eventData) {
12371
- return _this16.eventEmitter.emit(EVENT$4.PAYMENT_SUCCESSFUL, {
12372
- event: EVENT$4.PAYMENT_SUCCESSFUL,
12508
+ return _this16.eventEmitter.emit(EVENT$3.PAYMENT_SUCCESSFUL, {
12509
+ event: EVENT$3.PAYMENT_SUCCESSFUL,
12373
12510
  data: eventData
12374
12511
  });
12375
12512
  });
@@ -12379,8 +12516,8 @@ var WalletButtons = /*#__PURE__*/function () {
12379
12516
  value: function setupPaymentInReviewCallback() {
12380
12517
  var _this17 = this;
12381
12518
  this.service.on(WALLET_EVENT.PAYMENT_IN_REVIEW, function (eventData) {
12382
- return _this17.eventEmitter.emit(EVENT$4.PAYMENT_IN_REVIEW, {
12383
- event: EVENT$4.PAYMENT_IN_REVIEW,
12519
+ return _this17.eventEmitter.emit(EVENT$3.PAYMENT_IN_REVIEW, {
12520
+ event: EVENT$3.PAYMENT_IN_REVIEW,
12384
12521
  data: eventData
12385
12522
  });
12386
12523
  });
@@ -12390,8 +12527,8 @@ var WalletButtons = /*#__PURE__*/function () {
12390
12527
  value: function setupPaymentErrorCallback() {
12391
12528
  var _this18 = this;
12392
12529
  this.service.on(WALLET_EVENT.PAYMENT_ERROR, function (eventData) {
12393
- return _this18.eventEmitter.emit(EVENT$4.PAYMENT_ERROR, {
12394
- event: EVENT$4.PAYMENT_ERROR,
12530
+ return _this18.eventEmitter.emit(EVENT$3.PAYMENT_ERROR, {
12531
+ event: EVENT$3.PAYMENT_ERROR,
12395
12532
  data: eventData
12396
12533
  });
12397
12534
  });
@@ -12401,8 +12538,8 @@ var WalletButtons = /*#__PURE__*/function () {
12401
12538
  value: function setupAuthTokensChangedCallback() {
12402
12539
  var _this19 = this;
12403
12540
  this.service.on(WALLET_EVENT.AUTH_TOKENS_CHANGED, function (eventData) {
12404
- return _this19.eventEmitter.emit(EVENT$4.AUTH_TOKENS_CHANGED, {
12405
- event: EVENT$4.AUTH_TOKENS_CHANGED,
12541
+ return _this19.eventEmitter.emit(EVENT$3.AUTH_TOKENS_CHANGED, {
12542
+ event: EVENT$3.AUTH_TOKENS_CHANGED,
12406
12543
  data: eventData
12407
12544
  });
12408
12545
  });
@@ -12730,28 +12867,59 @@ function getHandleCvv(configuration) {
12730
12867
  }
12731
12868
  }
12732
12869
 
12870
+ /**
12871
+ * Top-level classification of an error. Used by the SDK to route errors to the
12872
+ * right category in instrumentation and to give consumers a coarse-grained
12873
+ * tag for grouping/filtering. See {@link getErrorCategory} for the mapping
12874
+ * between {@link ERROR_CAUSE} and {@link ERROR_CATEGORY}.
12875
+ */
12733
12876
  var ERROR_CATEGORY = {
12877
+ /** SDK was misconfigured (missing keys, invalid options, etc.). */
12734
12878
  CONFIGURATION: 'configuration',
12879
+ /** Authentication or authorization failure. */
12735
12880
  IDENTITY: 'identity_access_management',
12881
+ /** SDK internal failure or upstream service problem. */
12736
12882
  INTERNAL: 'internal',
12883
+ /** Flow lifecycle event (user cancelled, aborted, etc.) — not a real fault. */
12737
12884
  PROCESS: 'process',
12885
+ /** Resource lookup failed or was rate-limited. */
12738
12886
  RESOURCE: 'resource',
12887
+ /** Invalid input or business-rule validation failure. */
12739
12888
  VALIDATION: 'validation'
12740
12889
  };
12890
+ /**
12891
+ * Concrete cause of an error. More specific than {@link ERROR_CATEGORY} —
12892
+ * useful for deciding programmatic responses (e.g. show a retry button only
12893
+ * when `cause` is `'service_unreachable'` or `'server_busy'`).
12894
+ */
12741
12895
  var ERROR_CAUSE = {
12896
+ /** Operation was aborted programmatically. */
12742
12897
  ABORTED: 'aborted',
12898
+ /** Caller has insufficient permissions for the operation. */
12743
12899
  ACCESS_FORBIDDEN: 'access_forbidden',
12900
+ /** Resource already exists when create was expected. */
12744
12901
  ALREADY_EXISTS: 'already_exists',
12902
+ /** User cancelled the flow (e.g. closed the wallet sheet). */
12745
12903
  CANCELED: 'canceled',
12904
+ /** SDK was instantiated or invoked with invalid configuration. */
12746
12905
  INVALID_CONFIGURATION: 'invalid_configuration',
12906
+ /** Input failed structural or business-rule validation. */
12747
12907
  INVALID_INPUT: 'invalid_input',
12908
+ /** Resource was not found by the backend. */
12748
12909
  NOT_FOUND: 'not_found',
12910
+ /** Operation is not supported in the current context or version. */
12749
12911
  NOT_IMPLEMENTED: 'not_implemented',
12912
+ /** Caller exceeded the allowed request rate. */
12750
12913
  RATE_LIMITED: 'rate_limited',
12914
+ /** Backend is healthy but currently overloaded — typically retryable. */
12751
12915
  SERVER_BUSY: 'server_busy',
12916
+ /** Backend or third-party service could not be reached — typically retryable. */
12752
12917
  SERVICE_UNREACHABLE: 'service_unreachable',
12918
+ /** Caller is not authenticated. */
12753
12919
  UNAUTHORIZED: 'unauthorized',
12920
+ /** Catch-all when no other cause applies. */
12754
12921
  UNKNOWN: 'unknown_error',
12922
+ /** Request was syntactically valid but semantically rejected. */
12755
12923
  UNPROCESSABLE_ENTITY: 'unprocessable_entity'
12756
12924
  };
12757
12925
  var EventError = /*#__PURE__*/function (_Error) {
@@ -13917,7 +14085,7 @@ var MultiWidget = /*#__PURE__*/function () {
13917
14085
  }, {
13918
14086
  key: "handleErrorEvent",
13919
14087
  value: function handleErrorEvent(event, error, purpose) {
13920
- if (Object.values(EVENT$5).includes(event)) {
14088
+ if (Object.values(EVENT$4).includes(event)) {
13921
14089
  this.event.emit({
13922
14090
  error: error,
13923
14091
  event: event,
@@ -14103,7 +14271,7 @@ var HtmlMultiWidget = /*#__PURE__*/function (_MultiWidget) {
14103
14271
  }, function (error) {
14104
14272
  if (error instanceof EventError) {
14105
14273
  error.setContextId(_this2.link.getParams().widget_id);
14106
- _this2.handleErrorEvent(EVENT$5.ERROR, error.toJSON().error, error.purpose);
14274
+ _this2.handleErrorEvent(EVENT$4.ERROR, error.toJSON().error, error.purpose);
14107
14275
  }
14108
14276
  console.error('Error when creating a token, widget will not be loaded');
14109
14277
  });
@@ -14115,7 +14283,7 @@ var HtmlMultiWidget = /*#__PURE__*/function (_MultiWidget) {
14115
14283
  key: "afterLoad",
14116
14284
  value: function afterLoad() {
14117
14285
  var _this3 = this;
14118
- this.on(EVENT$5.VALIDATION, function (data) {
14286
+ this.on(EVENT$4.VALIDATION, function (data) {
14119
14287
  _this3.validationData = data;
14120
14288
  });
14121
14289
  }
@@ -14374,7 +14542,7 @@ var HtmlMultiWidget = /*#__PURE__*/function (_MultiWidget) {
14374
14542
  }, {
14375
14543
  key: "onFinishInsert",
14376
14544
  value: function onFinishInsert(selector, dataType) {
14377
- this.on(EVENT$5.FINISH, function (event) {
14545
+ this.on(EVENT$4.FINISH, function (event) {
14378
14546
  Event$1.insertToInput(selector, dataType, event);
14379
14547
  });
14380
14548
  }
@@ -14412,7 +14580,7 @@ var HtmlMultiWidget = /*#__PURE__*/function (_MultiWidget) {
14412
14580
  var formInterceptor = new FormInterceptor(selector);
14413
14581
  formInterceptor.beforeSubmit(function () {
14414
14582
  _this5.triggerElement.push(TRIGGER$1.SUBMIT_FORM, {});
14415
- _this5.event.on(EVENT$5.FINISH, _this5.link.getParams().widget_id, function () {
14583
+ _this5.event.on(EVENT$4.FINISH, _this5.link.getParams().widget_id, function () {
14416
14584
  formInterceptor.continueSubmit();
14417
14585
  });
14418
14586
  });
@@ -14425,13 +14593,13 @@ var HtmlMultiWidget = /*#__PURE__*/function (_MultiWidget) {
14425
14593
  value: function useCheckoutAutoSubmit() {
14426
14594
  var _this6 = this;
14427
14595
  this.setHiddenElements([ELEMENT.SUBMIT_BUTTON]);
14428
- this.on(EVENT$5.CHECKOUT_SUCCESS, function () {
14596
+ this.on(EVENT$4.CHECKOUT_SUCCESS, function () {
14429
14597
  _this6.trigger(TRIGGER$1.SUBMIT_FORM);
14430
14598
  });
14431
- this.on(EVENT$5.VALIDATION_ERROR, function () {
14599
+ this.on(EVENT$4.VALIDATION_ERROR, function () {
14432
14600
  _this6.trigger(TRIGGER$1.REFRESH_CHECKOUT);
14433
14601
  });
14434
- this.on(EVENT$5.SYSTEM_ERROR, function () {
14602
+ this.on(EVENT$4.SYSTEM_ERROR, function () {
14435
14603
  _this6.trigger(TRIGGER$1.REFRESH_CHECKOUT);
14436
14604
  });
14437
14605
  }
@@ -14448,7 +14616,7 @@ var HtmlMultiWidget = /*#__PURE__*/function (_MultiWidget) {
14448
14616
  key: "useAutoResize",
14449
14617
  value: function useAutoResize() {
14450
14618
  var _this7 = this;
14451
- this.on(EVENT$5.RESIZE, function (data) {
14619
+ this.on(EVENT$4.RESIZE, function (data) {
14452
14620
  if (_this7.iFrame.getElement()) {
14453
14621
  _this7.iFrame.getElement().scrolling = 'no';
14454
14622
  if (data.height) {
@@ -14811,7 +14979,6 @@ var InstructionCanvas3dsShow$1 = /*#__PURE__*/function (_InstructionHandler) {
14811
14979
  });
14812
14980
  canvas.on('chargeAuthReject', function () {
14813
14981
  var _a;
14814
- // **TODO add interface for chargeAuthReject event **//
14815
14982
  (_a = _this.checkoutWidget) === null || _a === void 0 ? void 0 : _a.fetchInstruction();
14816
14983
  _this.api.checkout().callback({
14817
14984
  event: 'callback.child_widget.status',
@@ -14828,13 +14995,13 @@ var InstructionCanvas3dsShow$1 = /*#__PURE__*/function (_InstructionHandler) {
14828
14995
  });
14829
14996
  canvas.on('error', function (event) {
14830
14997
  var _a;
14831
- // **TODO add interface for error event **//
14832
14998
  (_a = _this.checkoutWidget) === null || _a === void 0 ? void 0 : _a.fetchInstruction();
14999
+ var message = (event && _typeof$1(event) === 'object' && 'event' in event ? event.event : null) || 'error in 3ds widget';
14833
15000
  _this.api.checkout().callback({
14834
15001
  event: 'callback.child_widget.status',
14835
15002
  payload: {
14836
15003
  status: 'error',
14837
- message: (event === null || event === void 0 ? void 0 : event.event) || 'error in 3ds widget'
15004
+ message: message
14838
15005
  }
14839
15006
  }).then(function () {
14840
15007
  return console.info('callback.child_widget.status: - errorEvent');
@@ -16185,7 +16352,7 @@ var Message = /*#__PURE__*/function () {
16185
16352
  key: "useAutoResize",
16186
16353
  value: function useAutoResize() {
16187
16354
  var _this = this;
16188
- this.event.on(EVENT$5.RESIZE, this.link.getParams().widget_id, function (data) {
16355
+ this.event.on(EVENT$4.RESIZE, this.link.getParams().widget_id, function (data) {
16189
16356
  if (_this.iFrame.getElement()) {
16190
16357
  _this.iFrame.getElement().scrolling = 'no';
16191
16358
  if (data.height) {
@@ -17026,7 +17193,7 @@ var InstructionAfterpayWalletFormShow = /*#__PURE__*/function (_InstructionHandl
17026
17193
  var _this = this;
17027
17194
  this.widget = new WalletButtons(this.selector, context.payload.charge_token, context.payload.meta);
17028
17195
  this.widget.setEnv(this.getEnv(context.instruction_token));
17029
- this.widget.on(EVENT$4.ON_WALLET_LOADED, function () {
17196
+ this.widget.on(EVENT$3.ON_WALLET_LOADED, function () {
17030
17197
  addGoBackToPaymentsButton(_this.selector, _this.checkoutWidget, _this.api);
17031
17198
  });
17032
17199
  this.widget.load();
@@ -17047,7 +17214,7 @@ var InstructionApplePayFormShow = /*#__PURE__*/function (_InstructionHandler) {
17047
17214
  var _this = this;
17048
17215
  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);
17049
17216
  this.widget.setEnv(this.getEnv(context.instruction_token));
17050
- this.widget.on(EVENT$4.ON_WALLET_LOADED, function () {
17217
+ this.widget.on(EVENT$3.ON_WALLET_LOADED, function () {
17051
17218
  addGoBackToPaymentsButton(_this.selector, _this.checkoutWidget, _this.api);
17052
17219
  hideLoadingSpinner();
17053
17220
  });
@@ -17202,7 +17369,6 @@ var InstructionCanvas3dsShow = /*#__PURE__*/function (_InstructionHandler) {
17202
17369
  });
17203
17370
  canvas.on('chargeAuthReject', function () {
17204
17371
  var _a;
17205
- // **TODO add interface for chargeAuthReject event **//
17206
17372
  (_a = _this.checkoutWidget) === null || _a === void 0 ? void 0 : _a.fetchInstruction();
17207
17373
  _this.api.checkout().callback({
17208
17374
  event: 'callback.child_widget.status',
@@ -17219,13 +17385,13 @@ var InstructionCanvas3dsShow = /*#__PURE__*/function (_InstructionHandler) {
17219
17385
  });
17220
17386
  canvas.on('error', function (event) {
17221
17387
  var _a;
17222
- // **TODO add interface for error event **//
17223
17388
  (_a = _this.checkoutWidget) === null || _a === void 0 ? void 0 : _a.fetchInstruction();
17389
+ var message = (event && _typeof$1(event) === 'object' && 'event' in event ? event.event : null) || 'error in 3ds widget';
17224
17390
  _this.api.checkout().callback({
17225
17391
  event: 'callback.child_widget.status',
17226
17392
  payload: {
17227
17393
  status: 'error',
17228
- message: (event === null || event === void 0 ? void 0 : event.event) || 'error in 3ds widget'
17394
+ message: message
17229
17395
  }
17230
17396
  }).then(function () {
17231
17397
  return console.info('callback.child_widget.status: - errorEvent');
@@ -17380,7 +17546,7 @@ var InstructionCardFormShow = /*#__PURE__*/function (_InstructionHandler) {
17380
17546
  this.widget.load();
17381
17547
  this.widget.useAutoResize();
17382
17548
  this.widget.setHiddenElements(['submit_button']);
17383
- this.widget.on(EVENT$5.AFTER_LOAD, function () {
17549
+ this.widget.on(EVENT$4.AFTER_LOAD, function () {
17384
17550
  _this.timeoutId = setTimeout(function () {
17385
17551
  _this.addSubmitButton();
17386
17552
  addGoBackToPaymentsButton(_this.selector, _this.checkoutWidget, _this.api);
@@ -17390,7 +17556,7 @@ var InstructionCardFormShow = /*#__PURE__*/function (_InstructionHandler) {
17390
17556
  this.widget.on('submit', function () {
17391
17557
  return showLoadingSpinner();
17392
17558
  });
17393
- this.widget.on(EVENT$5.FINISH, function (event) {
17559
+ this.widget.on(EVENT$4.FINISH, function (event) {
17394
17560
  var _a;
17395
17561
  var get = new Api(context.instruction_token);
17396
17562
  (_a = _this.checkoutWidget) === null || _a === void 0 ? void 0 : _a.fetchInstruction();
@@ -17426,7 +17592,7 @@ var InstructionCardFormShow = /*#__PURE__*/function (_InstructionHandler) {
17426
17592
  return console.error('callback.card_form.ott_created: error', error);
17427
17593
  });
17428
17594
  });
17429
- this.widget.on(EVENT$5.VALIDATION_ERROR, function (event) {
17595
+ this.widget.on(EVENT$4.VALIDATION_ERROR, function (event) {
17430
17596
  var _a;
17431
17597
  (_a = _this.checkoutWidget) === null || _a === void 0 ? void 0 : _a.fetchInstruction();
17432
17598
  _this.api.checkout().callback({
@@ -17711,7 +17877,7 @@ var InstructionGooglePayFormShow = /*#__PURE__*/function (_InstructionHandler) {
17711
17877
  var _this = this;
17712
17878
  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);
17713
17879
  this.widget.setEnv(this.getEnv(context.instruction_token));
17714
- this.widget.on(EVENT$4.ON_WALLET_LOADED, function () {
17880
+ this.widget.on(EVENT$3.ON_WALLET_LOADED, function () {
17715
17881
  addGoBackToPaymentsButton(_this.selector, _this.checkoutWidget, _this.api);
17716
17882
  hideLoadingSpinner();
17717
17883
  });
@@ -18026,7 +18192,7 @@ var InstructionPaypalFormShow = /*#__PURE__*/function (_InstructionHandler) {
18026
18192
  standalone: true
18027
18193
  }));
18028
18194
  this.widget.setEnv(this.getEnv(context.instruction_token));
18029
- this.widget.on(EVENT$4.ON_WALLET_LOADED, function () {
18195
+ this.widget.on(EVENT$3.ON_WALLET_LOADED, function () {
18030
18196
  addGoBackToPaymentsButton(_this.selector, _this.checkoutWidget, _this.api);
18031
18197
  hideLoadingSpinner();
18032
18198
  });
@@ -18592,10 +18758,16 @@ function getCheckoutVersionHandler(version) {
18592
18758
  }
18593
18759
  }
18594
18760
 
18595
- var EVENT$3 = {
18596
- PAYMENT_SUCCESSFUL: 'paymentSuccessful',
18597
- PAYMENT_FAILURE: 'paymentFailure',
18598
- PAYMENT_EXPIRED: 'paymentExpired'
18761
+ /** Event name emitted when a checkout payment completes successfully. */
18762
+ var PAYMENT_SUCCESSFUL = 'paymentSuccessful';
18763
+ /** Event name emitted when a checkout payment fails. */
18764
+ var PAYMENT_FAILURE = 'paymentFailure';
18765
+ /** Event name emitted when a checkout session expires. */
18766
+ var PAYMENT_EXPIRED = 'paymentExpired';
18767
+ var EVENT$2 = {
18768
+ PAYMENT_SUCCESSFUL: PAYMENT_SUCCESSFUL,
18769
+ PAYMENT_FAILURE: PAYMENT_FAILURE,
18770
+ PAYMENT_EXPIRED: PAYMENT_EXPIRED
18599
18771
  };
18600
18772
  /**
18601
18773
  * Class CheckoutButton transform usual button into checkout
@@ -18620,7 +18792,7 @@ var Checkout = /*#__PURE__*/function () {
18620
18792
  this.checkoutFinished = false;
18621
18793
  try {
18622
18794
  this.eventEmitter = new EventEmitter();
18623
- this.intentTokenPayload = this.extractIntentTokenPayload(intentToken);
18795
+ this.intentTokenPayload = this.extractCheckoutIntentTokenPayload(intentToken);
18624
18796
  this.checkoutVersionHandler = getCheckoutVersionHandler(this.intentTokenPayload.version);
18625
18797
  this.instructions = this.initContractVersion();
18626
18798
  this.api = new ApiInternal(this.intentToken, API_AUTH_TYPE.TOKEN);
@@ -18681,8 +18853,8 @@ var Checkout = /*#__PURE__*/function () {
18681
18853
  }, 14 * 60 * 1000 + 45 * 1000);
18682
18854
  }
18683
18855
  }, {
18684
- key: "extractIntentTokenPayload",
18685
- value: function extractIntentTokenPayload(intentToken) {
18856
+ key: "extractCheckoutIntentTokenPayload",
18857
+ value: function extractCheckoutIntentTokenPayload(intentToken) {
18686
18858
  var tokenContent = AccessToken.validateJWT(intentToken);
18687
18859
  if (!tokenContent) {
18688
18860
  throw new Error('Intent token is broken or expired. Please, issue new one.');
@@ -18710,7 +18882,7 @@ var Checkout = /*#__PURE__*/function () {
18710
18882
  value: function ready() {
18711
18883
  var _this3 = this;
18712
18884
  this.changeLoadingSpinnerVisibility(true);
18713
- // biome-ignore lint/suspicious/noExplicitAny: <explanation>
18885
+ // biome-ignore lint/suspicious/noExplicitAny: checkoutApi.status returns a dynamic shape whose fields are narrowed at the call-sites below
18714
18886
  this.checkoutApi.status(this.intentTokenPayload.intent_id).then(function (response) {
18715
18887
  if (!(response === null || response === void 0 ? void 0 : response.status)) {
18716
18888
  throw new Error('Checkout Intent Status structure inconsistent');
@@ -18798,7 +18970,7 @@ var Checkout = /*#__PURE__*/function () {
18798
18970
  }, {
18799
18971
  key: "onPaymentSuccessful",
18800
18972
  value: function onPaymentSuccessful(handler) {
18801
- return this.eventEmitter.subscribe(EVENT$3.PAYMENT_SUCCESSFUL, handler);
18973
+ return this.eventEmitter.subscribe(EVENT$2.PAYMENT_SUCCESSFUL, handler);
18802
18974
  }
18803
18975
  /**
18804
18976
  * If the payment was not successful, the function passed as parameter will be called.
@@ -18812,21 +18984,21 @@ var Checkout = /*#__PURE__*/function () {
18812
18984
  }, {
18813
18985
  key: "onPaymentFailure",
18814
18986
  value: function onPaymentFailure(handler) {
18815
- return this.eventEmitter.subscribe(EVENT$3.PAYMENT_FAILURE, handler);
18987
+ return this.eventEmitter.subscribe(EVENT$2.PAYMENT_FAILURE, handler);
18816
18988
  }
18817
18989
  /**
18818
18990
  * If the payment was expired, the function passed as parameter will be called.
18819
18991
  * Important: Do not perform thread blocking operations in callback such as window.alert() calls.
18820
18992
  *
18821
18993
  * @example
18822
- * widget.onPaymentInReview((data) => {
18823
- * console.log('Payment in fraud review');
18994
+ * widget.onPaymentExpired((data) => {
18995
+ * console.log('Payment session expired');
18824
18996
  * });
18825
18997
  */
18826
18998
  }, {
18827
18999
  key: "onPaymentExpired",
18828
19000
  value: function onPaymentExpired(handler) {
18829
- return this.eventEmitter.subscribe(EVENT$3.PAYMENT_EXPIRED, handler);
19001
+ return this.eventEmitter.subscribe(EVENT$2.PAYMENT_EXPIRED, handler);
18830
19002
  }
18831
19003
  }, {
18832
19004
  key: "createWidgetStructure",
@@ -18902,7 +19074,7 @@ exports.ERROR_OPERATION = void 0;
18902
19074
  /**
18903
19075
  * Events emitted during the OpenWallet payment lifecycle.
18904
19076
  */
18905
- var EVENT$2;
19077
+ var EVENT$1;
18906
19078
  (function (EVENT) {
18907
19079
  /** Emitted when the wallet button is clicked by the user. */
18908
19080
  EVENT["ON_CLICK"] = "onClick";
@@ -18920,7 +19092,7 @@ var EVENT$2;
18920
19092
  EVENT["ON_SHIPPING_ADDRESS_CHANGE"] = "onShippingAddressChange";
18921
19093
  /** Emitted when the customer selects a shipping option. */
18922
19094
  EVENT["ON_SHIPPING_OPTIONS_CHANGE"] = "onShippingOptionsChange";
18923
- })(EVENT$2 || (EVENT$2 = {}));
19095
+ })(EVENT$1 || (EVENT$1 = {}));
18924
19096
 
18925
19097
  /**
18926
19098
  * @classdesc Abstract base class for Open Wallet buttons. **Do not instantiate directly.**
@@ -18941,7 +19113,15 @@ var OpenWalletButtons = /*#__PURE__*/function () {
18941
19113
  function OpenWalletButtons(selector, publicKeyOrAccessToken, serviceId, meta) {
18942
19114
  _classCallCheck(this, OpenWalletButtons);
18943
19115
  this.env = DEFAULT_ENV;
19116
+ this.isDisabled = false;
18944
19117
  this.onShippingOptionsChangeHandlerRegistered = false;
19118
+ // Runtime guard: TypeScript's `abstract` keyword exists only at compile time.
19119
+ // Without this check, instantiating the base class directly silently fails
19120
+ // later when `this.validateWalletMeta()` resolves to `undefined`, producing
19121
+ // a confusing "is not a function" error far from the actual mistake.
19122
+ if ((this instanceof OpenWalletButtons ? this.constructor : void 0) === OpenWalletButtons) {
19123
+ throw new Error('OpenWalletButtons is an abstract base class and cannot be instantiated directly. ' + 'Use ApplePayOpenWalletButton or GooglePayOpenWalletButton instead.');
19124
+ }
18945
19125
  this.eventEmitter = new EventEmitter();
18946
19126
  this.container = new Container(selector);
18947
19127
  this.api = new ApiInternal(publicKeyOrAccessToken, this.getApiAuthType(publicKeyOrAccessToken));
@@ -19044,7 +19224,7 @@ var OpenWalletButtons = /*#__PURE__*/function () {
19044
19224
  console.error('Wallet operation error:', error);
19045
19225
  }
19046
19226
  var errorData = {
19047
- event: EVENT$2.ERROR,
19227
+ event: EVENT$1.ERROR,
19048
19228
  data: {
19049
19229
  error: error,
19050
19230
  context: {
@@ -19052,7 +19232,7 @@ var OpenWalletButtons = /*#__PURE__*/function () {
19052
19232
  }
19053
19233
  }
19054
19234
  };
19055
- this.eventEmitter.emit(EVENT$2.ERROR, errorData);
19235
+ this.eventEmitter.emit(EVENT$1.ERROR, errorData);
19056
19236
  }
19057
19237
  /**
19058
19238
  * Loads and initializes the wallet button based on the service configuration.
@@ -19078,6 +19258,68 @@ var OpenWalletButtons = /*#__PURE__*/function () {
19078
19258
  _this.handleOnError(error instanceof Error ? error : new Error(String(error)), exports.ERROR_OPERATION.CONFIGURATION);
19079
19259
  });
19080
19260
  }
19261
+ /**
19262
+ * Enables the wallet button, restoring interactivity and visual appearance.
19263
+ * If the button was previously disabled via `disable()`, calling this method
19264
+ * re-enables clicks and removes the disabled visual state.
19265
+ *
19266
+ * Idempotent — calling on an already-enabled button has no effect.
19267
+ *
19268
+ * @example
19269
+ * button.enable();
19270
+ */
19271
+ }, {
19272
+ key: "enable",
19273
+ value: function enable() {
19274
+ this.isDisabled = false;
19275
+ this.applyDisabledStyles();
19276
+ }
19277
+ /**
19278
+ * Disables the wallet button, preventing clicks and applying a visual disabled state.
19279
+ * When disabled, the button appears grayed out (`opacity: 0.5`) and does not
19280
+ * respond to user interaction (`pointer-events: none`). For accessibility, the
19281
+ * `aria-disabled="true"` attribute is also set on the container.
19282
+ *
19283
+ * Programmatic clicks (e.g. invoked by the wallet provider's SDK) are blocked
19284
+ * by an explicit guard inside the click handler — the button's wallet service
19285
+ * checks the disabled state before processing.
19286
+ *
19287
+ * Idempotent — calling on an already-disabled button has no effect.
19288
+ * Safe to call before `load()` (no-throw); the styles are applied once the
19289
+ * container element exists.
19290
+ *
19291
+ * @example
19292
+ * button.disable();
19293
+ */
19294
+ }, {
19295
+ key: "disable",
19296
+ value: function disable() {
19297
+ this.isDisabled = true;
19298
+ this.applyDisabledStyles();
19299
+ }
19300
+ /**
19301
+ * Applies the disabled / enabled visual state to the container element.
19302
+ * Reads `this.isDisabled` and toggles the corresponding CSS + ARIA attributes.
19303
+ *
19304
+ * @private
19305
+ */
19306
+ }, {
19307
+ key: "applyDisabledStyles",
19308
+ value: function applyDisabledStyles() {
19309
+ var element = this.container.getElement();
19310
+ if (!element) {
19311
+ return;
19312
+ }
19313
+ if (this.isDisabled) {
19314
+ element.style.pointerEvents = 'none';
19315
+ element.style.opacity = '0.5';
19316
+ element.setAttribute('aria-disabled', 'true');
19317
+ } else {
19318
+ element.style.pointerEvents = '';
19319
+ element.style.opacity = '';
19320
+ element.removeAttribute('aria-disabled');
19321
+ }
19322
+ }
19081
19323
  /**
19082
19324
  * Current method can change environment. By default environment = sandbox.
19083
19325
  * Also we can change domain alias for this environment. By default domain_alias = paydock.com
@@ -19174,7 +19416,7 @@ var OpenWalletButtons = /*#__PURE__*/function () {
19174
19416
  key: "onClick",
19175
19417
  value: function onClick(handler) {
19176
19418
  if (typeof handler === 'function') {
19177
- this.eventEmitter.subscribe(EVENT$2.ON_CLICK, handler);
19419
+ this.eventEmitter.subscribe(EVENT$1.ON_CLICK, handler);
19178
19420
  return;
19179
19421
  }
19180
19422
  this.handleOnError(new Error('onClick event handler is required.'), exports.ERROR_OPERATION.HANDLER_REGISTRATION);
@@ -19213,7 +19455,7 @@ var OpenWalletButtons = /*#__PURE__*/function () {
19213
19455
  value: function onSuccess(handler) {
19214
19456
  var _this2 = this;
19215
19457
  if (typeof handler === 'function') {
19216
- this.eventEmitter.subscribe(EVENT$2.SUCCESS, function (data) {
19458
+ this.eventEmitter.subscribe(EVENT$1.SUCCESS, function (data) {
19217
19459
  return __awaiter(_this2, void 0, void 0, /*#__PURE__*/_regenerator().m(function _callee2() {
19218
19460
  var _t3;
19219
19461
  return _regenerator().w(function (_context2) {
@@ -19265,7 +19507,7 @@ var OpenWalletButtons = /*#__PURE__*/function () {
19265
19507
  value: function onUnavailable(handler) {
19266
19508
  var _this3 = this;
19267
19509
  if (typeof handler === 'function') {
19268
- this.eventEmitter.subscribe(EVENT$2.UNAVAILABLE, function (data) {
19510
+ this.eventEmitter.subscribe(EVENT$1.UNAVAILABLE, function (data) {
19269
19511
  return __awaiter(_this3, void 0, void 0, /*#__PURE__*/_regenerator().m(function _callee3() {
19270
19512
  var _t4;
19271
19513
  return _regenerator().w(function (_context3) {
@@ -19318,7 +19560,7 @@ var OpenWalletButtons = /*#__PURE__*/function () {
19318
19560
  value: function onError(handler) {
19319
19561
  var _this4 = this;
19320
19562
  if (typeof handler === 'function') {
19321
- this.eventEmitter.subscribe(EVENT$2.ERROR, function (data) {
19563
+ this.eventEmitter.subscribe(EVENT$1.ERROR, function (data) {
19322
19564
  return __awaiter(_this4, void 0, void 0, /*#__PURE__*/_regenerator().m(function _callee4() {
19323
19565
  var _t5;
19324
19566
  return _regenerator().w(function (_context4) {
@@ -19370,7 +19612,7 @@ var OpenWalletButtons = /*#__PURE__*/function () {
19370
19612
  value: function onCancel(handler) {
19371
19613
  var _this5 = this;
19372
19614
  if (typeof handler === 'function') {
19373
- this.eventEmitter.subscribe(EVENT$2.CHECKOUT_CLOSE, function (data) {
19615
+ this.eventEmitter.subscribe(EVENT$1.CHECKOUT_CLOSE, function (data) {
19374
19616
  return __awaiter(_this5, void 0, void 0, /*#__PURE__*/_regenerator().m(function _callee5() {
19375
19617
  var _t6;
19376
19618
  return _regenerator().w(function (_context5) {
@@ -19415,7 +19657,7 @@ var OpenWalletButtons = /*#__PURE__*/function () {
19415
19657
  value: function onLoaded(handler) {
19416
19658
  var _this6 = this;
19417
19659
  if (typeof handler === 'function') {
19418
- this.eventEmitter.subscribe(EVENT$2.LOADED, function (data) {
19660
+ this.eventEmitter.subscribe(EVENT$1.LOADED, function (data) {
19419
19661
  return __awaiter(_this6, void 0, void 0, /*#__PURE__*/_regenerator().m(function _callee6() {
19420
19662
  var _t7;
19421
19663
  return _regenerator().w(function (_context6) {
@@ -19487,7 +19729,7 @@ var OpenWalletButtons = /*#__PURE__*/function () {
19487
19729
  key: "onShippingAddressChange",
19488
19730
  value: function onShippingAddressChange(handler) {
19489
19731
  if (typeof handler === 'function') {
19490
- return this.eventEmitter.subscribe(EVENT$2.ON_SHIPPING_ADDRESS_CHANGE, handler);
19732
+ return this.eventEmitter.subscribe(EVENT$1.ON_SHIPPING_ADDRESS_CHANGE, handler);
19491
19733
  }
19492
19734
  this.handleOnError(new Error('onShippingAddressChange event handler is required.'), exports.ERROR_OPERATION.HANDLER_REGISTRATION);
19493
19735
  }
@@ -19532,7 +19774,7 @@ var OpenWalletButtons = /*#__PURE__*/function () {
19532
19774
  value: function onShippingOptionsChange(handler) {
19533
19775
  if (typeof handler === 'function') {
19534
19776
  this.onShippingOptionsChangeHandlerRegistered = true;
19535
- return this.eventEmitter.subscribe(EVENT$2.ON_SHIPPING_OPTIONS_CHANGE, handler);
19777
+ return this.eventEmitter.subscribe(EVENT$1.ON_SHIPPING_OPTIONS_CHANGE, handler);
19536
19778
  }
19537
19779
  this.handleOnError(new Error('onShippingOptionsChange event handler is required.'), exports.ERROR_OPERATION.HANDLER_REGISTRATION);
19538
19780
  }
@@ -19567,7 +19809,9 @@ var SERVICE_GROUP;
19567
19809
  * Returns `undefined` if the resulting object has no remaining properties.
19568
19810
  */
19569
19811
  function stripEmpty(obj) {
19570
- if (!obj || _typeof$1(obj) !== 'object') return undefined;
19812
+ if (!obj || _typeof$1(obj) !== 'object') {
19813
+ return undefined;
19814
+ }
19571
19815
  var result = {};
19572
19816
  for (var _i = 0, _Object$entries = Object.entries(obj); _i < _Object$entries.length; _i++) {
19573
19817
  var _Object$entries$_i = _slicedToArray(_Object$entries[_i], 2),
@@ -19616,13 +19860,30 @@ var OpenWalletService = /*#__PURE__*/function () {
19616
19860
  this.serviceGroup = SERVICE_GROUP.WALLET;
19617
19861
  }
19618
19862
  /**
19619
- * Creates a One-Time Token (OTT) by sending the payment data to the API.
19620
- * Emits {@link EVENT.SUCCESS} on success or {@link EVENT.ERROR} on failure.
19863
+ * Returns whether the wallet button is currently disabled.
19864
+ * Reads the `aria-disabled` attribute from the container element — set by the
19865
+ * button class via {@link OpenWalletButtons.disable} / {@link OpenWalletButtons.enable}.
19866
+ *
19867
+ * Used to short-circuit click handlers in concrete wallet services for clicks
19868
+ * that bypass the DOM `pointer-events: none` guard (e.g. invoked by the wallet
19869
+ * provider's SDK callback).
19621
19870
  *
19622
- * @param data - The payment data including amount, shipping, billing, card info, and ref token.
19623
- * @returns A promise resolving to the OTT response.
19871
+ * @returns `true` if the container is marked as disabled, `false` otherwise.
19624
19872
  */
19625
19873
  return _createClass(OpenWalletService, [{
19874
+ key: "isButtonDisabled",
19875
+ value: function isButtonDisabled() {
19876
+ var element = this.container.getElement();
19877
+ return (element === null || element === void 0 ? void 0 : element.getAttribute('aria-disabled')) === 'true';
19878
+ }
19879
+ /**
19880
+ * Creates a One-Time Token (OTT) by sending the payment data to the API.
19881
+ * Emits {@link EVENT.SUCCESS} on success or {@link EVENT.ERROR} on failure.
19882
+ *
19883
+ * @param data - The payment data including amount, shipping, billing, card info, and ref token.
19884
+ * @returns A promise resolving to the OTT response.
19885
+ */
19886
+ }, {
19626
19887
  key: "createOTT",
19627
19888
  value: function createOTT(data) {
19628
19889
  var _this = this;
@@ -19646,8 +19907,8 @@ var OpenWalletService = /*#__PURE__*/function () {
19646
19907
  return this.api.paymentSource().createOTT(requestData).then(function (response) {
19647
19908
  var cleanShipping = stripEmpty(shipping);
19648
19909
  var cleanBilling = stripEmpty(billing);
19649
- _this.eventEmitter.emit(EVENT$2.SUCCESS, {
19650
- event: EVENT$2.SUCCESS,
19910
+ _this.eventEmitter.emit(EVENT$1.SUCCESS, {
19911
+ event: EVENT$1.SUCCESS,
19651
19912
  data: _extends(_extends({
19652
19913
  token: response,
19653
19914
  amount: amount
@@ -19660,8 +19921,8 @@ var OpenWalletService = /*#__PURE__*/function () {
19660
19921
  return response;
19661
19922
  })["catch"](function (err) {
19662
19923
  var _a, _b, _c, _d;
19663
- _this.eventEmitter.emit(EVENT$2.ERROR, {
19664
- event: EVENT$2.ERROR,
19924
+ _this.eventEmitter.emit(EVENT$1.ERROR, {
19925
+ event: EVENT$1.ERROR,
19665
19926
  data: {
19666
19927
  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),
19667
19928
  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)
@@ -19708,7 +19969,7 @@ var OpenWalletService = /*#__PURE__*/function () {
19708
19969
  value: function handleOnUnavailable() {
19709
19970
  var reason = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'Wallet not available';
19710
19971
  var unavailableData = {
19711
- event: EVENT$2.UNAVAILABLE,
19972
+ event: EVENT$1.UNAVAILABLE,
19712
19973
  data: {
19713
19974
  reason: reason,
19714
19975
  details: {
@@ -19716,7 +19977,7 @@ var OpenWalletService = /*#__PURE__*/function () {
19716
19977
  }
19717
19978
  }
19718
19979
  };
19719
- this.eventEmitter.emit(EVENT$2.UNAVAILABLE, unavailableData);
19980
+ this.eventEmitter.emit(EVENT$1.UNAVAILABLE, unavailableData);
19720
19981
  }
19721
19982
  /**
19722
19983
  * Emits the {@link EVENT.ERROR} event and logs the error to the console.
@@ -19732,7 +19993,7 @@ var OpenWalletService = /*#__PURE__*/function () {
19732
19993
  console.error('Wallet operation error:', error);
19733
19994
  }
19734
19995
  var errorData = {
19735
- event: EVENT$2.ERROR,
19996
+ event: EVENT$1.ERROR,
19736
19997
  data: {
19737
19998
  error: error,
19738
19999
  context: {
@@ -19740,7 +20001,7 @@ var OpenWalletService = /*#__PURE__*/function () {
19740
20001
  }
19741
20002
  }
19742
20003
  };
19743
- this.eventEmitter.emit(EVENT$2.ERROR, errorData);
20004
+ this.eventEmitter.emit(EVENT$1.ERROR, errorData);
19744
20005
  }
19745
20006
  /**
19746
20007
  * Removes the wallet button element from the DOM.
@@ -19790,8 +20051,8 @@ var ApplePayOpenWalletService = /*#__PURE__*/function (_OpenWalletService) {
19790
20051
  _this.serviceConfig = serviceConfig;
19791
20052
  _this.latestShippingData = {};
19792
20053
  _this.onCancelPayment = function () {
19793
- return _this.eventEmitter.emit(EVENT$2.CHECKOUT_CLOSE, {
19794
- event: EVENT$2.CHECKOUT_CLOSE
20054
+ return _this.eventEmitter.emit(EVENT$1.CHECKOUT_CLOSE, {
20055
+ event: EVENT$1.CHECKOUT_CLOSE
19795
20056
  });
19796
20057
  };
19797
20058
  _this.onValidateMerchant = function () {
@@ -19871,7 +20132,7 @@ var ApplePayOpenWalletService = /*#__PURE__*/function (_OpenWalletService) {
19871
20132
  while (1) switch (_context.n) {
19872
20133
  case 0:
19873
20134
  return _context.a(2, this.handleMerchantOnShippingChangedEvent({
19874
- event: EVENT$2.ON_SHIPPING_ADDRESS_CHANGE,
20135
+ event: EVENT$1.ON_SHIPPING_ADDRESS_CHANGE,
19875
20136
  data: this.parseShippingContactUpdateEvent(data)
19876
20137
  }).then(function (response) {
19877
20138
  var _a, _b;
@@ -19920,7 +20181,7 @@ var ApplePayOpenWalletService = /*#__PURE__*/function (_OpenWalletService) {
19920
20181
  while (1) switch (_context2.n) {
19921
20182
  case 0:
19922
20183
  return _context2.a(2, this.handleMerchantOnShippingChangedEvent({
19923
- event: EVENT$2.ON_SHIPPING_OPTIONS_CHANGE,
20184
+ event: EVENT$1.ON_SHIPPING_OPTIONS_CHANGE,
19924
20185
  data: this.parseShippingMethodUpdateEvent(data)
19925
20186
  }).then(function (response) {
19926
20187
  var _a;
@@ -20135,15 +20396,23 @@ var ApplePayOpenWalletService = /*#__PURE__*/function (_OpenWalletService) {
20135
20396
  return;
20136
20397
  }
20137
20398
  applePayButton.addEventListener('click', this.onApplePayButtonClicked.bind(this));
20138
- this.eventEmitter.emit(EVENT$2.LOADED, {
20139
- event: EVENT$2.LOADED
20399
+ this.eventEmitter.emit(EVENT$1.LOADED, {
20400
+ event: EVENT$1.LOADED
20140
20401
  });
20141
20402
  }
20142
20403
  }, {
20143
20404
  key: "onApplePayButtonClicked",
20144
20405
  value: function onApplePayButtonClicked() {
20145
20406
  var _this7 = this;
20146
- this.paymentSession = new ApplePaySession(14, this.mapMetaToApplePayPaymentRequest());
20407
+ if (this.isButtonDisabled()) {
20408
+ return;
20409
+ }
20410
+ var applePayApiVersion = getSupportedApplePayVersion();
20411
+ if (applePayApiVersion === 0) {
20412
+ this.handleOnUnavailable('Apple Pay version not supported');
20413
+ return;
20414
+ }
20415
+ this.paymentSession = new ApplePaySession(applePayApiVersion, this.mapMetaToApplePayPaymentRequest());
20147
20416
  this.paymentSession.onvalidatemerchant = this.onValidateMerchant;
20148
20417
  this.paymentSession.onpaymentauthorized = this.onPaymentAuthorized;
20149
20418
  this.paymentSession.oncancel = this.onCancelPayment;
@@ -20189,8 +20458,8 @@ var ApplePayOpenWalletService = /*#__PURE__*/function (_OpenWalletService) {
20189
20458
  while (1) switch (_context4.n) {
20190
20459
  case 0:
20191
20460
  _context4.n = 1;
20192
- return this.eventEmitter.emitWithResult(EVENT$2.ON_CLICK, {
20193
- event: EVENT$2.ON_CLICK
20461
+ return this.eventEmitter.emitWithResult(EVENT$1.ON_CLICK, {
20462
+ event: EVENT$1.ON_CLICK
20194
20463
  });
20195
20464
  case 1:
20196
20465
  results = _context4.v;
@@ -20514,8 +20783,8 @@ var GOOGLE_PAY_CARD_NETWORKS = ['AMEX', 'DISCOVER', 'INTERAC', 'JCB', 'MASTERCAR
20514
20783
  * Used to translate shipping-related Google Pay events to the unified event system.
20515
20784
  */
20516
20785
  ({
20517
- SHIPPING_ADDRESS: EVENT$2.ON_SHIPPING_ADDRESS_CHANGE,
20518
- SHIPPING_OPTION: EVENT$2.ON_SHIPPING_OPTIONS_CHANGE
20786
+ SHIPPING_ADDRESS: EVENT$1.ON_SHIPPING_ADDRESS_CHANGE,
20787
+ SHIPPING_OPTION: EVENT$1.ON_SHIPPING_OPTIONS_CHANGE
20519
20788
  });
20520
20789
 
20521
20790
  /**
@@ -20880,14 +21149,17 @@ var GooglePayOpenWalletService = /*#__PURE__*/function (_OpenWalletService) {
20880
21149
  buttonColor: ((_c = this.getMetaStyles()) === null || _c === void 0 ? void 0 : _c.button_color) || 'default'
20881
21150
  });
20882
21151
  button.appendChild(googlePayButton);
20883
- this.eventEmitter.emit(EVENT$2.LOADED, {
20884
- event: EVENT$2.LOADED
21152
+ this.eventEmitter.emit(EVENT$1.LOADED, {
21153
+ event: EVENT$1.LOADED
20885
21154
  });
20886
21155
  }
20887
21156
  }, {
20888
21157
  key: "onGooglePayButtonClicked",
20889
21158
  value: function onGooglePayButtonClicked() {
20890
21159
  var _this5 = this;
21160
+ if (this.isButtonDisabled()) {
21161
+ return;
21162
+ }
20891
21163
  if (this.processingButtonClick) {
20892
21164
  console.warn('Google Pay button clicked while processing.');
20893
21165
  return;
@@ -20910,8 +21182,8 @@ var GooglePayOpenWalletService = /*#__PURE__*/function (_OpenWalletService) {
20910
21182
  while (1) switch (_context3.n) {
20911
21183
  case 0:
20912
21184
  _context3.n = 1;
20913
- return this.eventEmitter.emitWithResult(EVENT$2.ON_CLICK, {
20914
- event: EVENT$2.ON_CLICK
21185
+ return this.eventEmitter.emitWithResult(EVENT$1.ON_CLICK, {
21186
+ event: EVENT$1.ON_CLICK
20915
21187
  });
20916
21188
  case 1:
20917
21189
  results = _context3.v;
@@ -20937,8 +21209,8 @@ var GooglePayOpenWalletService = /*#__PURE__*/function (_OpenWalletService) {
20937
21209
  while (1) switch (_context4.n) {
20938
21210
  case 0:
20939
21211
  return _context4.a(2, this.paymentsClient.loadPaymentData(this.createPaymentDataRequest())["catch"](function (err) {
20940
- _this6.eventEmitter.emit(EVENT$2.CHECKOUT_CLOSE, {
20941
- event: EVENT$2.CHECKOUT_CLOSE
21212
+ _this6.eventEmitter.emit(EVENT$1.CHECKOUT_CLOSE, {
21213
+ event: EVENT$1.CHECKOUT_CLOSE
20942
21214
  });
20943
21215
  _this6.processingButtonClick = false;
20944
21216
  throw err;
@@ -21002,13 +21274,13 @@ var GooglePayOpenWalletService = /*#__PURE__*/function (_OpenWalletService) {
21002
21274
  if (intermediatePaymentData.callbackTrigger === 'INITIALIZE' || intermediatePaymentData.callbackTrigger === 'SHIPPING_ADDRESS') {
21003
21275
  callbackIntent = 'SHIPPING_ADDRESS';
21004
21276
  eventData = {
21005
- event: EVENT$2.ON_SHIPPING_ADDRESS_CHANGE,
21277
+ event: EVENT$1.ON_SHIPPING_ADDRESS_CHANGE,
21006
21278
  data: parsedUpdateData.shipping
21007
21279
  };
21008
21280
  } else if (intermediatePaymentData.callbackTrigger === 'SHIPPING_OPTION') {
21009
21281
  callbackIntent = 'SHIPPING_OPTION';
21010
21282
  eventData = {
21011
- event: EVENT$2.ON_SHIPPING_OPTIONS_CHANGE,
21283
+ event: EVENT$1.ON_SHIPPING_OPTIONS_CHANGE,
21012
21284
  data: {
21013
21285
  shipping_option_id: (_a = parsedUpdateData.selected_shipping_option) === null || _a === void 0 ? void 0 : _a.id,
21014
21286
  label: (_b = parsedUpdateData.selected_shipping_option) === null || _b === void 0 ? void 0 : _b.label,
@@ -21708,7 +21980,7 @@ var HtmlPaymentSourceWidget = /*#__PURE__*/function (_PaymentSourceWidget) {
21708
21980
  }, {
21709
21981
  key: "onSelectInsert",
21710
21982
  value: function onSelectInsert(selector, dataType) {
21711
- this.on(EVENT$5.SELECT, function (event) {
21983
+ this.on(EVENT$4.SELECT, function (event) {
21712
21984
  Event$1.insertToInput(selector, dataType, event);
21713
21985
  });
21714
21986
  }
@@ -22278,7 +22550,7 @@ var PayPalSavePaymentSourceWidget = /*#__PURE__*/function () {
22278
22550
  * @param {string} CHECKOUT_COMPLETED=checkoutCompleted Event sent on successful checkout by customer. Check [data](#EventDataCheckoutCompletedData) for more information.
22279
22551
  * @param {string} CHECKOUT_ERROR=checkoutError Event sent on error checkout by customer. Check [data](#EventData) for more information.
22280
22552
  */
22281
- var EVENT$1;
22553
+ var EVENT;
22282
22554
  (function (EVENT) {
22283
22555
  EVENT["IFRAME_LOADED"] = "iframeLoaded";
22284
22556
  EVENT["CHECKOUT_READY"] = "checkoutReady";
@@ -22286,7 +22558,7 @@ var EVENT$1;
22286
22558
  EVENT["CHECKOUT_ERROR"] = "checkoutError";
22287
22559
  EVENT["CHECKOUT_POPUP_OPEN"] = "checkoutPopupOpen";
22288
22560
  EVENT["CHECKOUT_POPUP_CLOSE"] = "checkoutPopupClose";
22289
- })(EVENT$1 || (EVENT$1 = {}));
22561
+ })(EVENT || (EVENT = {}));
22290
22562
  /**
22291
22563
  * List of available event data types
22292
22564
  * @enum EVENT_DATA_TYPE
@@ -22456,25 +22728,25 @@ var ClickToPaySRC = /*#__PURE__*/function () {
22456
22728
  var _this = this;
22457
22729
  var widgetId = this.link.getParams().widget_id;
22458
22730
  if (!widgetId) return;
22459
- this.iFrameEvent.on(EVENT$1.CHECKOUT_READY, widgetId, function (_ref) {
22731
+ this.iFrameEvent.on(EVENT.CHECKOUT_READY, widgetId, function (_ref) {
22460
22732
  var data = _ref.data;
22461
- _this.eventEmitter.emit(EVENT$1.CHECKOUT_READY, data);
22733
+ _this.eventEmitter.emit(EVENT.CHECKOUT_READY, data);
22462
22734
  });
22463
- this.iFrameEvent.on(EVENT$1.CHECKOUT_COMPLETED, widgetId, function (_ref2) {
22735
+ this.iFrameEvent.on(EVENT.CHECKOUT_COMPLETED, widgetId, function (_ref2) {
22464
22736
  var data = _ref2.data;
22465
- _this.eventEmitter.emit(EVENT$1.CHECKOUT_COMPLETED, data);
22737
+ _this.eventEmitter.emit(EVENT.CHECKOUT_COMPLETED, data);
22466
22738
  });
22467
- this.iFrameEvent.on(EVENT$1.CHECKOUT_POPUP_OPEN, widgetId, function (_ref3) {
22739
+ this.iFrameEvent.on(EVENT.CHECKOUT_POPUP_OPEN, widgetId, function (_ref3) {
22468
22740
  var data = _ref3.data;
22469
- _this.eventEmitter.emit(EVENT$1.CHECKOUT_POPUP_OPEN, data);
22741
+ _this.eventEmitter.emit(EVENT.CHECKOUT_POPUP_OPEN, data);
22470
22742
  });
22471
- this.iFrameEvent.on(EVENT$1.CHECKOUT_POPUP_CLOSE, widgetId, function (_ref4) {
22743
+ this.iFrameEvent.on(EVENT.CHECKOUT_POPUP_CLOSE, widgetId, function (_ref4) {
22472
22744
  var data = _ref4.data;
22473
- _this.eventEmitter.emit(EVENT$1.CHECKOUT_POPUP_CLOSE, data);
22745
+ _this.eventEmitter.emit(EVENT.CHECKOUT_POPUP_CLOSE, data);
22474
22746
  });
22475
- this.iFrameEvent.on(EVENT$1.CHECKOUT_ERROR, widgetId, function (_ref5) {
22747
+ this.iFrameEvent.on(EVENT.CHECKOUT_ERROR, widgetId, function (_ref5) {
22476
22748
  var data = _ref5.data;
22477
- _this.eventEmitter.emit(EVENT$1.CHECKOUT_ERROR, data);
22749
+ _this.eventEmitter.emit(EVENT.CHECKOUT_ERROR, data);
22478
22750
  });
22479
22751
  if (this.autoResize) this.useAutoResize(true);
22480
22752
  }
@@ -22497,7 +22769,7 @@ var ClickToPaySRC = /*#__PURE__*/function () {
22497
22769
  if (iframeElement) {
22498
22770
  iframeElement.onload = function () {
22499
22771
  _this2.isIframeLoaded = true;
22500
- _this2.eventEmitter.emit(EVENT$1.IFRAME_LOADED, {});
22772
+ _this2.eventEmitter.emit(EVENT.IFRAME_LOADED, {});
22501
22773
  if (_this2.injectedCustomerData) {
22502
22774
  _this2.injectCustomerData(_this2.injectedCustomerData);
22503
22775
  _this2.injectedCustomerData = null;
@@ -22984,7 +23256,7 @@ var VaultDisplayWidget = /*#__PURE__*/function () {
22984
23256
  }]);
22985
23257
  }();
22986
23258
 
22987
- var EVENT;
23259
+ exports.WALLET_BUTTONS_EXPRESS_EVENT = void 0;
22988
23260
  (function (EVENT) {
22989
23261
  EVENT["UNAVAILABLE"] = "unavailable";
22990
23262
  EVENT["ERROR"] = "error";
@@ -22995,12 +23267,13 @@ var EVENT;
22995
23267
  EVENT["ON_CHECKOUT_CLOSE"] = "onCheckoutClose";
22996
23268
  EVENT["ON_SHIPPING_ADDRESS_CHANGE"] = "onShippingAddressChange";
22997
23269
  EVENT["ON_SHIPPING_OPTIONS_CHANGE"] = "onShippingOptionsChange";
22998
- })(EVENT || (EVENT = {}));
23270
+ })(exports.WALLET_BUTTONS_EXPRESS_EVENT || (exports.WALLET_BUTTONS_EXPRESS_EVENT = {}));
22999
23271
 
23000
23272
  var BaseWalletButton = /*#__PURE__*/function () {
23001
23273
  function BaseWalletButton(selector, publicKeyOrAccessToken, gatewayId, meta, requiredMetaFields) {
23002
23274
  _classCallCheck(this, BaseWalletButton);
23003
23275
  this.env = DEFAULT_ENV;
23276
+ this.isDisabled = false;
23004
23277
  this.onShippingOptionsChangeHandlerRegistered = false;
23005
23278
  this.eventEmitter = new EventEmitter();
23006
23279
  this.container = new Container(selector);
@@ -23033,6 +23306,30 @@ var BaseWalletButton = /*#__PURE__*/function () {
23033
23306
  this.env = env;
23034
23307
  this.api.setEnv(env, alias);
23035
23308
  }
23309
+ /**
23310
+ * Enables the wallet button, restoring interactivity and visual appearance.
23311
+ *
23312
+ * @example
23313
+ * button.enable();
23314
+ */
23315
+ }, {
23316
+ key: "enable",
23317
+ value: function enable() {
23318
+ this.isDisabled = false;
23319
+ this.applyDisabledStyles();
23320
+ }
23321
+ /**
23322
+ * Disables the wallet button, preventing clicks and applying a visual disabled state.
23323
+ *
23324
+ * @example
23325
+ * button.disable();
23326
+ */
23327
+ }, {
23328
+ key: "disable",
23329
+ value: function disable() {
23330
+ this.isDisabled = true;
23331
+ this.applyDisabledStyles();
23332
+ }
23036
23333
  /**
23037
23334
  * Callback for onClick method.
23038
23335
  *
@@ -23060,7 +23357,7 @@ var BaseWalletButton = /*#__PURE__*/function () {
23060
23357
  key: "onClick",
23061
23358
  value: function onClick(handler) {
23062
23359
  if (typeof handler === 'function') {
23063
- return this.eventEmitter.subscribe(EVENT.ON_CLICK, handler);
23360
+ return this.eventEmitter.subscribe(exports.WALLET_BUTTONS_EXPRESS_EVENT.ON_CLICK, handler);
23064
23361
  }
23065
23362
  this.handleOnError(new Error('onClick event handler is required to return the wallet token string.'));
23066
23363
  }
@@ -23089,10 +23386,10 @@ var BaseWalletButton = /*#__PURE__*/function () {
23089
23386
  value: function onPaymentSuccessful(handler) {
23090
23387
  var _this = this;
23091
23388
  if (typeof handler === 'function') {
23092
- return this.eventEmitter.subscribe(EVENT.PAYMENT_SUCCESSFUL, handler);
23389
+ return this.eventEmitter.subscribe(exports.WALLET_BUTTONS_EXPRESS_EVENT.PAYMENT_SUCCESSFUL, handler);
23093
23390
  }
23094
23391
  return new Promise(function (resolve) {
23095
- return _this.eventEmitter.subscribe(EVENT.PAYMENT_SUCCESSFUL, function (data) {
23392
+ return _this.eventEmitter.subscribe(exports.WALLET_BUTTONS_EXPRESS_EVENT.PAYMENT_SUCCESSFUL, function (data) {
23096
23393
  return resolve(data);
23097
23394
  });
23098
23395
  });
@@ -23122,10 +23419,10 @@ var BaseWalletButton = /*#__PURE__*/function () {
23122
23419
  value: function onPaymentInReview(handler) {
23123
23420
  var _this2 = this;
23124
23421
  if (typeof handler === 'function') {
23125
- return this.eventEmitter.subscribe(EVENT.PAYMENT_IN_REVIEW, handler);
23422
+ return this.eventEmitter.subscribe(exports.WALLET_BUTTONS_EXPRESS_EVENT.PAYMENT_IN_REVIEW, handler);
23126
23423
  }
23127
23424
  return new Promise(function (resolve) {
23128
- return _this2.eventEmitter.subscribe(EVENT.PAYMENT_IN_REVIEW, function (data) {
23425
+ return _this2.eventEmitter.subscribe(exports.WALLET_BUTTONS_EXPRESS_EVENT.PAYMENT_IN_REVIEW, function (data) {
23129
23426
  return resolve(data);
23130
23427
  });
23131
23428
  });
@@ -23155,10 +23452,10 @@ var BaseWalletButton = /*#__PURE__*/function () {
23155
23452
  value: function onPaymentError(handler) {
23156
23453
  var _this3 = this;
23157
23454
  if (typeof handler === 'function') {
23158
- return this.eventEmitter.subscribe(EVENT.PAYMENT_ERROR, handler);
23455
+ return this.eventEmitter.subscribe(exports.WALLET_BUTTONS_EXPRESS_EVENT.PAYMENT_ERROR, handler);
23159
23456
  }
23160
23457
  return new Promise(function (resolve) {
23161
- return _this3.eventEmitter.subscribe(EVENT.PAYMENT_ERROR, function (err) {
23458
+ return _this3.eventEmitter.subscribe(exports.WALLET_BUTTONS_EXPRESS_EVENT.PAYMENT_ERROR, function (err) {
23162
23459
  return resolve(err);
23163
23460
  });
23164
23461
  });
@@ -23184,10 +23481,10 @@ var BaseWalletButton = /*#__PURE__*/function () {
23184
23481
  value: function onCheckoutClose(handler) {
23185
23482
  var _this4 = this;
23186
23483
  if (typeof handler === 'function') {
23187
- return this.eventEmitter.subscribe(EVENT.ON_CHECKOUT_CLOSE, handler);
23484
+ return this.eventEmitter.subscribe(exports.WALLET_BUTTONS_EXPRESS_EVENT.ON_CHECKOUT_CLOSE, handler);
23188
23485
  }
23189
23486
  return new Promise(function (resolve) {
23190
- return _this4.eventEmitter.subscribe(EVENT.ON_CHECKOUT_CLOSE, function (err) {
23487
+ return _this4.eventEmitter.subscribe(exports.WALLET_BUTTONS_EXPRESS_EVENT.ON_CHECKOUT_CLOSE, function (err) {
23191
23488
  return resolve(err);
23192
23489
  });
23193
23490
  });
@@ -23218,7 +23515,7 @@ var BaseWalletButton = /*#__PURE__*/function () {
23218
23515
  key: "onShippingAddressChange",
23219
23516
  value: function onShippingAddressChange(handler) {
23220
23517
  if (typeof handler === 'function') {
23221
- return this.eventEmitter.subscribe(EVENT.ON_SHIPPING_ADDRESS_CHANGE, handler);
23518
+ return this.eventEmitter.subscribe(exports.WALLET_BUTTONS_EXPRESS_EVENT.ON_SHIPPING_ADDRESS_CHANGE, handler);
23222
23519
  }
23223
23520
  this.handleOnError(new Error('onShippingAddressChange event handler is required to return the wallet token string or reject.'));
23224
23521
  }
@@ -23249,7 +23546,7 @@ var BaseWalletButton = /*#__PURE__*/function () {
23249
23546
  value: function onShippingOptionsChange(handler) {
23250
23547
  if (typeof handler === 'function') {
23251
23548
  this.onShippingOptionsChangeHandlerRegistered = true;
23252
- return this.eventEmitter.subscribe(EVENT.ON_SHIPPING_OPTIONS_CHANGE, handler);
23549
+ return this.eventEmitter.subscribe(exports.WALLET_BUTTONS_EXPRESS_EVENT.ON_SHIPPING_OPTIONS_CHANGE, handler);
23253
23550
  }
23254
23551
  this.handleOnError(new Error('onShippingOptionsChange event handler is required to return the wallet token string or reject.'));
23255
23552
  }
@@ -23274,10 +23571,10 @@ var BaseWalletButton = /*#__PURE__*/function () {
23274
23571
  value: function onUnavailable(handler) {
23275
23572
  var _this5 = this;
23276
23573
  if (typeof handler === 'function') {
23277
- return this.eventEmitter.subscribe(EVENT.UNAVAILABLE, handler);
23574
+ return this.eventEmitter.subscribe(exports.WALLET_BUTTONS_EXPRESS_EVENT.UNAVAILABLE, handler);
23278
23575
  }
23279
23576
  return new Promise(function (resolve) {
23280
- return _this5.eventEmitter.subscribe(EVENT.UNAVAILABLE, function (err) {
23577
+ return _this5.eventEmitter.subscribe(exports.WALLET_BUTTONS_EXPRESS_EVENT.UNAVAILABLE, function (err) {
23281
23578
  return resolve(err);
23282
23579
  });
23283
23580
  });
@@ -23304,10 +23601,10 @@ var BaseWalletButton = /*#__PURE__*/function () {
23304
23601
  value: function onError(handler) {
23305
23602
  var _this6 = this;
23306
23603
  if (typeof handler === 'function') {
23307
- return this.eventEmitter.subscribe(EVENT.ERROR, handler);
23604
+ return this.eventEmitter.subscribe(exports.WALLET_BUTTONS_EXPRESS_EVENT.ERROR, handler);
23308
23605
  }
23309
23606
  return new Promise(function (resolve) {
23310
- return _this6.eventEmitter.subscribe(EVENT.ERROR, function (err) {
23607
+ return _this6.eventEmitter.subscribe(exports.WALLET_BUTTONS_EXPRESS_EVENT.ERROR, function (err) {
23311
23608
  return resolve(err);
23312
23609
  });
23313
23610
  });
@@ -23344,8 +23641,8 @@ var BaseWalletButton = /*#__PURE__*/function () {
23344
23641
  var _this8 = this;
23345
23642
  return this.api.charge().walletCallback(data)["catch"](function (err) {
23346
23643
  var _a;
23347
- _this8.eventEmitter.emit(EVENT.PAYMENT_ERROR, {
23348
- event: EVENT.PAYMENT_ERROR,
23644
+ _this8.eventEmitter.emit(exports.WALLET_BUTTONS_EXPRESS_EVENT.PAYMENT_ERROR, {
23645
+ event: exports.WALLET_BUTTONS_EXPRESS_EVENT.PAYMENT_ERROR,
23349
23646
  chargeId: (_a = _this8.chargeWalletTokenMeta) === null || _a === void 0 ? void 0 : _a.charge.id,
23350
23647
  data: _this8.eventDataFromApiError(err)
23351
23648
  });
@@ -23359,7 +23656,7 @@ var BaseWalletButton = /*#__PURE__*/function () {
23359
23656
  var _this9 = this;
23360
23657
  return this.api.charge().walletCapture(data).then(function (captureResult) {
23361
23658
  var _a;
23362
- var event = captureResult.status === 'inreview' ? EVENT.PAYMENT_IN_REVIEW : EVENT.PAYMENT_SUCCESSFUL;
23659
+ var event = captureResult.status === 'inreview' ? exports.WALLET_BUTTONS_EXPRESS_EVENT.PAYMENT_IN_REVIEW : exports.WALLET_BUTTONS_EXPRESS_EVENT.PAYMENT_SUCCESSFUL;
23363
23660
  _this9.eventEmitter.emit(event, {
23364
23661
  event: event,
23365
23662
  chargeId: (_a = _this9.chargeWalletTokenMeta) === null || _a === void 0 ? void 0 : _a.charge.id,
@@ -23368,8 +23665,8 @@ var BaseWalletButton = /*#__PURE__*/function () {
23368
23665
  return captureResult;
23369
23666
  })["catch"](function (err) {
23370
23667
  var _a;
23371
- _this9.eventEmitter.emit(EVENT.PAYMENT_ERROR, {
23372
- event: EVENT.PAYMENT_ERROR,
23668
+ _this9.eventEmitter.emit(exports.WALLET_BUTTONS_EXPRESS_EVENT.PAYMENT_ERROR, {
23669
+ event: exports.WALLET_BUTTONS_EXPRESS_EVENT.PAYMENT_ERROR,
23373
23670
  chargeId: (_a = _this9.chargeWalletTokenMeta) === null || _a === void 0 ? void 0 : _a.charge.id,
23374
23671
  data: _this9.eventDataFromApiError(err)
23375
23672
  });
@@ -23380,8 +23677,8 @@ var BaseWalletButton = /*#__PURE__*/function () {
23380
23677
  key: "handleMerchantOnExpressButtonClickEvent",
23381
23678
  value: function handleMerchantOnExpressButtonClickEvent() {
23382
23679
  var _this0 = this;
23383
- return this.eventEmitter.emitWithResult(EVENT.ON_CLICK, {
23384
- event: EVENT.ON_CLICK
23680
+ return this.eventEmitter.emitWithResult(exports.WALLET_BUTTONS_EXPRESS_EVENT.ON_CLICK, {
23681
+ event: exports.WALLET_BUTTONS_EXPRESS_EVENT.ON_CLICK
23385
23682
  }).then(function (result) {
23386
23683
  var _a;
23387
23684
  if (!result || result.length === 0) {
@@ -23458,8 +23755,8 @@ var BaseWalletButton = /*#__PURE__*/function () {
23458
23755
  value: function handleCheckoutClose() {
23459
23756
  var _a;
23460
23757
  var chargeId = (_a = this.chargeWalletTokenMeta) === null || _a === void 0 ? void 0 : _a.charge.id;
23461
- this.eventEmitter.emit(EVENT.ON_CHECKOUT_CLOSE, _extends({
23462
- event: EVENT.ON_CHECKOUT_CLOSE
23758
+ this.eventEmitter.emit(exports.WALLET_BUTTONS_EXPRESS_EVENT.ON_CHECKOUT_CLOSE, _extends({
23759
+ event: exports.WALLET_BUTTONS_EXPRESS_EVENT.ON_CHECKOUT_CLOSE
23463
23760
  }, chargeId && {
23464
23761
  chargeId: chargeId
23465
23762
  }));
@@ -23467,8 +23764,8 @@ var BaseWalletButton = /*#__PURE__*/function () {
23467
23764
  }, {
23468
23765
  key: "handleOnUnavailable",
23469
23766
  value: function handleOnUnavailable() {
23470
- this.eventEmitter.emit(EVENT.UNAVAILABLE, {
23471
- event: EVENT.UNAVAILABLE
23767
+ this.eventEmitter.emit(exports.WALLET_BUTTONS_EXPRESS_EVENT.UNAVAILABLE, {
23768
+ event: exports.WALLET_BUTTONS_EXPRESS_EVENT.UNAVAILABLE
23472
23769
  });
23473
23770
  }
23474
23771
  }, {
@@ -23479,8 +23776,8 @@ var BaseWalletButton = /*#__PURE__*/function () {
23479
23776
  console.error(error);
23480
23777
  }
23481
23778
  var chargeId = (_a = this.chargeWalletTokenMeta) === null || _a === void 0 ? void 0 : _a.charge.id;
23482
- this.eventEmitter.emit(EVENT.ERROR, _extends(_extends({
23483
- event: EVENT.ERROR
23779
+ this.eventEmitter.emit(exports.WALLET_BUTTONS_EXPRESS_EVENT.ERROR, _extends(_extends({
23780
+ event: exports.WALLET_BUTTONS_EXPRESS_EVENT.ERROR
23484
23781
  }, chargeId && {
23485
23782
  chargeId: chargeId
23486
23783
  }), {
@@ -23497,6 +23794,23 @@ var BaseWalletButton = /*#__PURE__*/function () {
23497
23794
  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)
23498
23795
  };
23499
23796
  }
23797
+ }, {
23798
+ key: "applyDisabledStyles",
23799
+ value: function applyDisabledStyles() {
23800
+ var element = this.container.getElement();
23801
+ if (!element) {
23802
+ return;
23803
+ }
23804
+ if (this.isDisabled) {
23805
+ element.style.pointerEvents = 'none';
23806
+ element.style.opacity = '0.5';
23807
+ element.setAttribute('aria-disabled', 'true');
23808
+ } else {
23809
+ element.style.pointerEvents = '';
23810
+ element.style.opacity = '';
23811
+ element.removeAttribute('aria-disabled');
23812
+ }
23813
+ }
23500
23814
  }, {
23501
23815
  key: "validateRequiredMetaFields",
23502
23816
  value: function validateRequiredMetaFields(requiredMetaFields) {
@@ -23539,11 +23853,11 @@ var generateApplePayButtonStyles = function generateApplePayButtonStyles() {
23539
23853
  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 ";
23540
23854
  };
23541
23855
 
23542
- var ContactShippingEditingMode;
23856
+ exports.ContactShippingEditingMode = void 0;
23543
23857
  (function (ContactShippingEditingMode) {
23544
23858
  ContactShippingEditingMode["AVAILABLE"] = "available";
23545
23859
  ContactShippingEditingMode["STORE_PICKUP"] = "store_pickup";
23546
- })(ContactShippingEditingMode || (ContactShippingEditingMode = {}));
23860
+ })(exports.ContactShippingEditingMode || (exports.ContactShippingEditingMode = {}));
23547
23861
 
23548
23862
  var DEFAULT_APPLE_PAY_CAPABILITIES = ['paymentCredentialsAvailable'];
23549
23863
  /**
@@ -23568,7 +23882,14 @@ var ApplePayWalletButtonExpress = /*#__PURE__*/function (_BaseWalletButton) {
23568
23882
  _classCallCheck(this, ApplePayWalletButtonExpress);
23569
23883
  _this = _callSuper(this, ApplePayWalletButtonExpress, [selector, publicKeyOrAccessToken, gatewayId, meta, ['amount_label', 'country']]);
23570
23884
  _this.onApplePayButtonClicked = function () {
23571
- var applePayApiVersion = 14;
23885
+ if (_this.isDisabled) {
23886
+ return;
23887
+ }
23888
+ var applePayApiVersion = getSupportedApplePayVersion();
23889
+ if (applePayApiVersion === 0) {
23890
+ _this.handleOnUnavailable();
23891
+ return;
23892
+ }
23572
23893
  _this.paymentSession = new ApplePaySession(applePayApiVersion, _this.createRequest());
23573
23894
  _this.paymentSession.onvalidatemerchant = _this.onValidateMerchant;
23574
23895
  _this.paymentSession.onpaymentauthorized = _this.onPaymentAuthorized;
@@ -23662,8 +23983,8 @@ var ApplePayWalletButtonExpress = /*#__PURE__*/function (_BaseWalletButton) {
23662
23983
  } catch (error) {
23663
23984
  // this ensures thatwe always call completePayment and emit error callback even if there's an uncaught exception
23664
23985
  _this.paymentSession.completePayment(ApplePaySession.STATUS_FAILURE);
23665
- _this.eventEmitter.emit(EVENT.PAYMENT_ERROR, {
23666
- event: EVENT.PAYMENT_ERROR,
23986
+ _this.eventEmitter.emit(exports.WALLET_BUTTONS_EXPRESS_EVENT.PAYMENT_ERROR, {
23987
+ event: exports.WALLET_BUTTONS_EXPRESS_EVENT.PAYMENT_ERROR,
23667
23988
  chargeId: (_k = _this.chargeWalletTokenMeta) === null || _k === void 0 ? void 0 : _k.charge.id,
23668
23989
  data: {
23669
23990
  message: error instanceof Error ? error.message : 'Payment processing failed',
@@ -23683,7 +24004,7 @@ var ApplePayWalletButtonExpress = /*#__PURE__*/function (_BaseWalletButton) {
23683
24004
  while (1) switch (_context.n) {
23684
24005
  case 0:
23685
24006
  return _context.a(2, this.handleMerchantOnShippingChangedEvent({
23686
- event: EVENT.ON_SHIPPING_ADDRESS_CHANGE,
24007
+ event: exports.WALLET_BUTTONS_EXPRESS_EVENT.ON_SHIPPING_ADDRESS_CHANGE,
23687
24008
  chargeId: (_a = this.chargeWalletTokenMeta) === null || _a === void 0 ? void 0 : _a.charge.id,
23688
24009
  data: this.parseShippingContactUpdateEvent(data)
23689
24010
  }).then(function (response) {
@@ -23718,7 +24039,7 @@ var ApplePayWalletButtonExpress = /*#__PURE__*/function (_BaseWalletButton) {
23718
24039
  while (1) switch (_context2.n) {
23719
24040
  case 0:
23720
24041
  return _context2.a(2, this.handleMerchantOnShippingChangedEvent({
23721
- event: EVENT.ON_SHIPPING_OPTIONS_CHANGE,
24042
+ event: exports.WALLET_BUTTONS_EXPRESS_EVENT.ON_SHIPPING_OPTIONS_CHANGE,
23722
24043
  chargeId: (_b = this.chargeWalletTokenMeta) === null || _b === void 0 ? void 0 : _b.charge.id,
23723
24044
  data: this.parseShippingMethodUpdateEvent(data)
23724
24045
  }).then(function (_response) {
@@ -23846,6 +24167,7 @@ var ApplePayWalletButtonExpress = /*#__PURE__*/function (_BaseWalletButton) {
23846
24167
  return;
23847
24168
  }
23848
24169
  applePayButton.addEventListener('click', this.onApplePayButtonClicked.bind(this));
24170
+ this.applyDisabledStyles();
23849
24171
  }
23850
24172
  }, {
23851
24173
  key: "createRequest",
@@ -23854,7 +24176,7 @@ var ApplePayWalletButtonExpress = /*#__PURE__*/function (_BaseWalletButton) {
23854
24176
  // https://developer.apple.com/documentation/apple_pay_on_the_web/applepaypaymentrequest
23855
24177
  var shippingContactEditingMode;
23856
24178
  if (this.meta.shipping_editing_mode) {
23857
- shippingContactEditingMode = this.meta.shipping_editing_mode === ContactShippingEditingMode.AVAILABLE ? 'available' : 'storePickup';
24179
+ shippingContactEditingMode = this.meta.shipping_editing_mode === exports.ContactShippingEditingMode.AVAILABLE ? 'available' : 'storePickup';
23858
24180
  }
23859
24181
  return _extends(_extends({
23860
24182
  countryCode: this.meta.country,
@@ -24038,13 +24360,20 @@ var PaypalWalletButtonExpress = /*#__PURE__*/function (_BaseWalletButton) {
24038
24360
  key: "load",
24039
24361
  value: function load() {
24040
24362
  var _this2 = this;
24041
- if (!window.Promise) return this.handleOnUnavailable();
24363
+ if (!window.Promise) {
24364
+ return this.handleOnUnavailable();
24365
+ }
24042
24366
  this.getGatewayWalletConfig().then(function (config) {
24043
- if (!config || config.type !== 'Paypal' || !config.credentials || !config.credentials.client_auth) throw new Error('Invalid configuration');
24367
+ if (!config || config.type !== 'Paypal' || !config.credentials || !config.credentials.client_auth) {
24368
+ throw new Error('Invalid configuration');
24369
+ }
24044
24370
  _this2.config = config;
24045
24371
  _this2.renderPaypalButton();
24372
+ _this2.applyDisabledStyles();
24046
24373
  })["catch"](function (err) {
24047
- if (err) _this2.handleOnError(err);
24374
+ if (err) {
24375
+ _this2.handleOnError(err);
24376
+ }
24048
24377
  _this2.handleOnUnavailable();
24049
24378
  });
24050
24379
  }
@@ -24061,6 +24390,7 @@ var PaypalWalletButtonExpress = /*#__PURE__*/function (_BaseWalletButton) {
24061
24390
  value: function setMeta(meta) {
24062
24391
  this.meta = meta;
24063
24392
  this.renderPaypalButton();
24393
+ this.applyDisabledStyles();
24064
24394
  }
24065
24395
  }, {
24066
24396
  key: "renderPaypalButton",
@@ -24077,7 +24407,7 @@ var PaypalWalletButtonExpress = /*#__PURE__*/function (_BaseWalletButton) {
24077
24407
  var _this3 = this;
24078
24408
  var _a, _b;
24079
24409
  var buttonId = ((_a = this.container.getElement()) === null || _a === void 0 ? void 0 : _a.id) || '';
24080
- var paypalScript = document.createElement("script");
24410
+ var paypalScript = document.createElement('script');
24081
24411
  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' : '');
24082
24412
  paypalScript.async = true;
24083
24413
  paypalScript.onload = function () {
@@ -24096,7 +24426,7 @@ var PaypalWalletButtonExpress = /*#__PURE__*/function (_BaseWalletButton) {
24096
24426
  var _this4 = this;
24097
24427
  var _a, _b, _c;
24098
24428
  var buttonId = ((_a = this.container.getElement()) === null || _a === void 0 ? void 0 : _a.id) || '';
24099
- var paypalScript = document.createElement("script");
24429
+ var paypalScript = document.createElement('script');
24100
24430
  // 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
24101
24431
  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');
24102
24432
  paypalScript.async = true;
@@ -24137,6 +24467,9 @@ var PaypalWalletButtonExpress = /*#__PURE__*/function (_BaseWalletButton) {
24137
24467
  style: this.meta.style
24138
24468
  }), {
24139
24469
  onClick: function onClick(_data, actions) {
24470
+ if (_this5.isDisabled) {
24471
+ return actions.reject();
24472
+ }
24140
24473
  return _this5.handleMerchantOnExpressButtonClickEvent().then(function () {
24141
24474
  return actions.resolve();
24142
24475
  })["catch"](function () {
@@ -24147,7 +24480,9 @@ var PaypalWalletButtonExpress = /*#__PURE__*/function (_BaseWalletButton) {
24147
24480
  createOrder: function createOrder() {
24148
24481
  return new Promise(function (resolve, reject) {
24149
24482
  var _a, _b;
24150
- if (!_this5.api.auth) return reject(new Error('Wallet Token not injected. Please handle onClick correctly.'));
24483
+ if (!_this5.api.auth) {
24484
+ return reject(new Error('Wallet Token not injected. Please handle onClick correctly.'));
24485
+ }
24151
24486
  var shipping = (_b = (_a = _this5.chargeWalletTokenMeta) === null || _a === void 0 ? void 0 : _a.charge) === null || _b === void 0 ? void 0 : _b.shipping;
24152
24487
  if (shipping) {
24153
24488
  var hasCompleteShippingAddress = ['address_line1', 'address_city', 'address_country', 'address_state', 'address_postcode'].every(function (key) {
@@ -24166,7 +24501,9 @@ var PaypalWalletButtonExpress = /*#__PURE__*/function (_BaseWalletButton) {
24166
24501
  });
24167
24502
  },
24168
24503
  onApprove: function onApprove(data) {
24169
- if (_this5.pendingApprovalPromise) return _this5.pendingApprovalPromise;
24504
+ if (_this5.pendingApprovalPromise) {
24505
+ return _this5.pendingApprovalPromise;
24506
+ }
24170
24507
  _this5.pendingApprovalPromise = _this5.executeWalletCapture({
24171
24508
  payment_method_id: data.orderID,
24172
24509
  customer: {
@@ -24210,7 +24547,7 @@ var PaypalWalletButtonExpress = /*#__PURE__*/function (_BaseWalletButton) {
24210
24547
  return _context.a(2);
24211
24548
  case 1:
24212
24549
  return _context.a(2, this.handleMerchantOnShippingChangedEvent({
24213
- event: EVENT.ON_SHIPPING_ADDRESS_CHANGE,
24550
+ event: exports.WALLET_BUTTONS_EXPRESS_EVENT.ON_SHIPPING_ADDRESS_CHANGE,
24214
24551
  chargeId: (_a = this.chargeWalletTokenMeta) === null || _a === void 0 ? void 0 : _a.charge.id,
24215
24552
  data: {
24216
24553
  address_city: data.shippingAddress.city,
@@ -24245,7 +24582,7 @@ var PaypalWalletButtonExpress = /*#__PURE__*/function (_BaseWalletButton) {
24245
24582
  while (1) switch (_context2.n) {
24246
24583
  case 0:
24247
24584
  return _context2.a(2, this.handleMerchantOnShippingChangedEvent({
24248
- event: EVENT.ON_SHIPPING_OPTIONS_CHANGE,
24585
+ event: exports.WALLET_BUTTONS_EXPRESS_EVENT.ON_SHIPPING_OPTIONS_CHANGE,
24249
24586
  chargeId: (_a = this.chargeWalletTokenMeta) === null || _a === void 0 ? void 0 : _a.charge.id,
24250
24587
  data: {
24251
24588
  shipping_option_id: data.selectedShippingOption.id,
@@ -44349,13 +44686,16 @@ exports.AfterpayOnSiteMessaging = AfterpayOnSiteMessaging;
44349
44686
  exports.Api = Api;
44350
44687
  exports.ApplePayOpenWalletButton = ApplePayOpenWalletButton;
44351
44688
  exports.ApplePayWalletButtonExpress = ApplePayWalletButtonExpress;
44689
+ exports.CANVAS_3DS_EVENT = CANVAS_3DS_EVENT;
44352
44690
  exports.CHECKOUT_BUTTON_EVENT = CHECKOUT_BUTTON_EVENT;
44691
+ exports.CHECKOUT_EVENT = EVENT$2;
44353
44692
  exports.Canvas3ds = Canvas3ds;
44693
+ exports.Canvas3dsTokenFormat = Canvas3dsTokenFormat;
44354
44694
  exports.Checkout = Checkout;
44355
44695
  exports.ClickToPay = ClickToPay;
44356
44696
  exports.Configuration = Configuration;
44357
44697
  exports.ELEMENT = ELEMENT;
44358
- exports.EVENT = EVENT$5;
44698
+ exports.EVENT = EVENT$4;
44359
44699
  exports.ExternalCheckoutBuilder = Builder$1;
44360
44700
  exports.ExternalCheckoutChecker = Checker;
44361
44701
  exports.FORM_FIELD = FORM_FIELD$1;
@@ -44367,7 +44707,9 @@ exports.HtmlPaymentSourceWidget = HtmlPaymentSourceWidget;
44367
44707
  exports.HtmlWidget = HtmlWidget;
44368
44708
  exports.InstructionDebugger = InstructionDebugger;
44369
44709
  exports.MultiWidget = MultiWidget;
44370
- exports.OpenWalletButtons = OpenWalletButtons;
44710
+ exports.PAYMENT_EXPIRED = PAYMENT_EXPIRED;
44711
+ exports.PAYMENT_FAILURE = PAYMENT_FAILURE;
44712
+ exports.PAYMENT_SUCCESSFUL = PAYMENT_SUCCESSFUL;
44371
44713
  exports.PAYMENT_TYPE = PAYMENT_TYPE;
44372
44714
  exports.PayPalDataCollector = PayPalDataCollector;
44373
44715
  exports.PayPalSavePaymentSourceWidget = PayPalSavePaymentSourceWidget;