@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.
- package/README.md +243 -0
- package/bundles/index.cjs +846 -504
- package/bundles/index.cjs.d.ts +1466 -778
- package/bundles/index.mjs +675 -338
- package/bundles/index.mjs.d.ts +1466 -778
- package/bundles/types/api/api-charge-internal.d.ts +3 -49
- package/bundles/types/api/api-charge-internal.d.ts.map +1 -1
- package/bundles/types/api/api-checkout-internal.d.ts +1 -47
- package/bundles/types/api/api-checkout-internal.d.ts.map +1 -1
- package/bundles/types/api/api-shared-types.d.ts +53 -0
- package/bundles/types/api/api-shared-types.d.ts.map +1 -0
- package/bundles/types/canvas-3ds/canvas-3ds-event-map.d.ts +95 -0
- package/bundles/types/canvas-3ds/canvas-3ds-event-map.d.ts.map +1 -0
- package/bundles/types/canvas-3ds/canvas-3ds.d.ts +10 -7
- package/bundles/types/canvas-3ds/canvas-3ds.d.ts.map +1 -1
- package/bundles/types/canvas-3ds/index.d.ts +4 -0
- package/bundles/types/canvas-3ds/index.d.ts.map +1 -1
- package/bundles/types/canvas-3ds/services/gpayments-service.d.ts +41 -12
- package/bundles/types/canvas-3ds/services/gpayments-service.d.ts.map +1 -1
- package/bundles/types/canvas-3ds/services/standalone3ds-service.d.ts +20 -2
- package/bundles/types/canvas-3ds/services/standalone3ds-service.d.ts.map +1 -1
- package/bundles/types/checkout/checkout-event-map.d.ts +43 -0
- package/bundles/types/checkout/checkout-event-map.d.ts.map +1 -0
- package/bundles/types/checkout/checkout.d.ts +25 -9
- package/bundles/types/checkout/checkout.d.ts.map +1 -1
- package/bundles/types/checkout/v1/instructions/instruction.canvas_3ds.show.d.ts.map +1 -1
- package/bundles/types/checkout/v3/instructions/instruction.canvas_3ds.show.d.ts.map +1 -1
- package/bundles/types/components/apple-pay-version.d.ts +29 -0
- package/bundles/types/components/apple-pay-version.d.ts.map +1 -0
- package/bundles/types/components/param.d.ts +29 -0
- package/bundles/types/components/param.d.ts.map +1 -1
- package/bundles/types/helper/event-error.d.ts +49 -1
- package/bundles/types/helper/event-error.d.ts.map +1 -1
- package/bundles/types/index-cba.d.ts +3 -1
- package/bundles/types/index-cba.d.ts.map +1 -1
- package/bundles/types/index.d.ts +14 -3
- package/bundles/types/index.d.ts.map +1 -1
- package/bundles/types/open-wallets/base/open-wallet-buttons.d.ts +37 -0
- package/bundles/types/open-wallets/base/open-wallet-buttons.d.ts.map +1 -1
- package/bundles/types/open-wallets/base/open-wallet.service.d.ts +12 -0
- package/bundles/types/open-wallets/base/open-wallet.service.d.ts.map +1 -1
- package/bundles/types/open-wallets/google-pay-open-wallet-button.d.ts.map +1 -1
- package/bundles/types/open-wallets/index.d.ts +26 -1
- package/bundles/types/open-wallets/index.d.ts.map +1 -1
- package/bundles/types/open-wallets/interfaces/apple-pay/apple-pay-payment-request.interface.d.ts +2 -2
- package/bundles/types/open-wallets/interfaces/apple-pay/apple-pay-payment-request.interface.d.ts.map +1 -1
- package/bundles/types/open-wallets/interfaces/apple-pay/index.d.ts +1 -1
- package/bundles/types/open-wallets/interfaces/apple-pay/index.d.ts.map +1 -1
- package/bundles/types/open-wallets/interfaces/events.interface.d.ts +1 -1
- package/bundles/types/open-wallets/interfaces/events.interface.d.ts.map +1 -1
- package/bundles/types/open-wallets/interfaces/google-pay/google-pay-meta.interface.d.ts +46 -0
- package/bundles/types/open-wallets/interfaces/google-pay/google-pay-meta.interface.d.ts.map +1 -1
- package/bundles/types/open-wallets/services/apple-pay/apple-pay.open-wallet.service.d.ts +48 -2
- package/bundles/types/open-wallets/services/apple-pay/apple-pay.open-wallet.service.d.ts.map +1 -1
- package/bundles/types/open-wallets/services/google-pay/google-pay.open-wallet.service.d.ts.map +1 -1
- package/bundles/types/open-wallets/types/index.d.ts +1 -1
- package/bundles/types/open-wallets/types/index.d.ts.map +1 -1
- package/bundles/types/open-wallets/types/payment-source.type.d.ts +104 -0
- package/bundles/types/open-wallets/types/payment-source.type.d.ts.map +1 -1
- package/bundles/types/payment-source-widget/index.d.ts +1 -1
- package/bundles/types/payment-source-widget/index.d.ts.map +1 -1
- package/bundles/types/vault-display-widget/vault-display-widget.d.ts.map +1 -1
- package/bundles/types/wallet-buttons/interfaces.d.ts +55 -1
- package/bundles/types/wallet-buttons/interfaces.d.ts.map +1 -1
- package/bundles/types/wallet-buttons/wallet-services/apple.wallet-service.d.ts.map +1 -1
- package/bundles/types/wallet-buttons-express/base.wallet-button-express.d.ts +16 -0
- package/bundles/types/wallet-buttons-express/base.wallet-button-express.d.ts.map +1 -1
- package/bundles/types/wallet-buttons-express/index.d.ts +36 -0
- package/bundles/types/wallet-buttons-express/index.d.ts.map +1 -1
- package/bundles/types/wallet-buttons-express/interfaces/base-wallet-meta.interface.d.ts +7 -0
- package/bundles/types/wallet-buttons-express/interfaces/base-wallet-meta.interface.d.ts.map +1 -1
- package/bundles/types/wallet-buttons-express/services/apple-pay/apple-pay.wallet-button-express.d.ts.map +1 -1
- package/bundles/types/wallet-buttons-express/services/apple-pay/interfaces/apple-pay-wallet-meta.interface.d.ts +23 -0
- package/bundles/types/wallet-buttons-express/services/apple-pay/interfaces/apple-pay-wallet-meta.interface.d.ts.map +1 -1
- package/bundles/types/wallet-buttons-express/services/paypal/interfaces/paypal-wallet-meta.interface.d.ts +31 -0
- package/bundles/types/wallet-buttons-express/services/paypal/interfaces/paypal-wallet-meta.interface.d.ts.map +1 -1
- package/bundles/types/wallet-buttons-express/services/paypal/paypal.wallet-button-express.d.ts +1 -1
- package/bundles/types/wallet-buttons-express/services/paypal/paypal.wallet-button-express.d.ts.map +1 -1
- package/bundles/types/widget/html-multi-widget.d.ts +4 -1
- package/bundles/types/widget/html-multi-widget.d.ts.map +1 -1
- package/bundles/types/widget/index.d.ts +2 -1
- package/bundles/types/widget/index.d.ts.map +1 -1
- package/bundles/types/widget/widget-event-map.d.ts +37 -0
- package/bundles/types/widget/widget-event-map.d.ts.map +1 -0
- package/bundles/widget.umd.js +846 -504
- package/bundles/widget.umd.js.d.ts +1466 -778
- package/bundles/widget.umd.js.min.d.ts +1466 -778
- package/bundles/widget.umd.min.js +1 -1
- package/docs/api-canvas3ds.md +19 -12
- package/docs/open-wallet-buttons.md +158 -0
- package/docs/wallet-buttons-express.md +85 -0
- package/package.json +6 -3
package/bundles/index.mjs
CHANGED
|
@@ -1192,7 +1192,7 @@ SDK.headerKeys = Object.freeze({
|
|
|
1192
1192
|
version: 'x-sdk-version',
|
|
1193
1193
|
type: 'x-sdk-type'
|
|
1194
1194
|
});
|
|
1195
|
-
SDK._version = 'v1.
|
|
1195
|
+
SDK._version = 'v1.144.0-beta';
|
|
1196
1196
|
|
|
1197
1197
|
function isFunction(value) {
|
|
1198
1198
|
return typeof value === 'function';
|
|
@@ -4802,127 +4802,162 @@ var Api = /*#__PURE__*/function (_ApiBase) {
|
|
|
4802
4802
|
}]);
|
|
4803
4803
|
}(ApiBase);
|
|
4804
4804
|
|
|
4805
|
-
var
|
|
4806
|
-
|
|
4807
|
-
|
|
4805
|
+
var WALLET_CAPTURE_LINK = '/v1/charges/wallet/capture';
|
|
4806
|
+
var WALLET_CALLBACK_LINK = '/v1/charges/wallet/callback';
|
|
4807
|
+
var STANDALONE_3DS_PROCESS_LINK = '/v1/charges/standalone-3ds/process';
|
|
4808
|
+
var STANDALONE_3DS_HANDLE_LINK = '/v1/charges/standalone-3ds/handle';
|
|
4809
|
+
var ApiChargeInternal = /*#__PURE__*/function () {
|
|
4810
|
+
function ApiChargeInternal(api) {
|
|
4811
|
+
_classCallCheck(this, ApiChargeInternal);
|
|
4812
|
+
this.api = api;
|
|
4808
4813
|
}
|
|
4809
|
-
return _createClass(
|
|
4810
|
-
key: "
|
|
4811
|
-
value: function
|
|
4812
|
-
return
|
|
4814
|
+
return _createClass(ApiChargeInternal, [{
|
|
4815
|
+
key: "walletCapture",
|
|
4816
|
+
value: function walletCapture(payload) {
|
|
4817
|
+
return this.api.getClientPromise('POST', WALLET_CAPTURE_LINK).send(payload);
|
|
4813
4818
|
}
|
|
4814
4819
|
}, {
|
|
4815
|
-
key: "
|
|
4816
|
-
value: function
|
|
4817
|
-
return
|
|
4818
|
-
|
|
4819
|
-
|
|
4820
|
+
key: "walletCallback",
|
|
4821
|
+
value: function walletCallback(payload) {
|
|
4822
|
+
return this.api.getClientPromise('POST', WALLET_CALLBACK_LINK).send(payload);
|
|
4823
|
+
}
|
|
4824
|
+
}, {
|
|
4825
|
+
key: "standalone3dsProcess",
|
|
4826
|
+
value: function standalone3dsProcess(payload) {
|
|
4827
|
+
return this.api.getClientPromise('POST', STANDALONE_3DS_PROCESS_LINK).send(payload);
|
|
4828
|
+
}
|
|
4829
|
+
}, {
|
|
4830
|
+
key: "standalone3dsHandle",
|
|
4831
|
+
value: function standalone3dsHandle() {
|
|
4832
|
+
return this.api.getClientPromise('GET', STANDALONE_3DS_HANDLE_LINK).send(undefined);
|
|
4820
4833
|
}
|
|
4821
4834
|
}]);
|
|
4822
4835
|
}();
|
|
4823
4836
|
|
|
4824
|
-
var
|
|
4825
|
-
|
|
4826
|
-
|
|
4837
|
+
var CALLBACK_LINK = '/v1/checkouts/callback';
|
|
4838
|
+
var INSTRUCTION_LINK = '/v1/checkouts/instruction';
|
|
4839
|
+
var STATUS_LINK = '/v1/checkouts';
|
|
4840
|
+
var ApiCheckoutInternal = /*#__PURE__*/function () {
|
|
4841
|
+
function ApiCheckoutInternal(api) {
|
|
4842
|
+
_classCallCheck(this, ApiCheckoutInternal);
|
|
4843
|
+
this.api = api;
|
|
4844
|
+
this.getInstructionLink = function () {
|
|
4845
|
+
return "".concat(INSTRUCTION_LINK, "?time=").concat(Date.now());
|
|
4846
|
+
};
|
|
4827
4847
|
}
|
|
4828
|
-
return _createClass(
|
|
4829
|
-
key: "
|
|
4830
|
-
value: function
|
|
4831
|
-
|
|
4832
|
-
var buf = new Uint16Array(8);
|
|
4833
|
-
window.crypto.getRandomValues(buf);
|
|
4834
|
-
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]);
|
|
4835
|
-
} else {
|
|
4836
|
-
return this.random() + this.random() + "-" + this.random() + "-" + this.random() + "-" + this.random() + "-" + this.random() + this.random() + this.random();
|
|
4837
|
-
}
|
|
4848
|
+
return _createClass(ApiCheckoutInternal, [{
|
|
4849
|
+
key: "instructions",
|
|
4850
|
+
value: function instructions() {
|
|
4851
|
+
return this.api.requestObservable('GET', this.getInstructionLink(), {});
|
|
4838
4852
|
}
|
|
4839
4853
|
}, {
|
|
4840
|
-
key: "
|
|
4841
|
-
value: function
|
|
4842
|
-
|
|
4843
|
-
while (hash.length < 4) {
|
|
4844
|
-
hash = "0" + hash;
|
|
4845
|
-
}
|
|
4846
|
-
return hash;
|
|
4854
|
+
key: "callback",
|
|
4855
|
+
value: function callback(payload) {
|
|
4856
|
+
return this.api.getClientPromise('POST', CALLBACK_LINK).send(payload);
|
|
4847
4857
|
}
|
|
4848
4858
|
}, {
|
|
4849
|
-
key: "
|
|
4850
|
-
value: function
|
|
4851
|
-
return
|
|
4859
|
+
key: "status",
|
|
4860
|
+
value: function status(id) {
|
|
4861
|
+
return this.api.getClientPromise('GET', "".concat(STATUS_LINK, "/").concat(id)).send('');
|
|
4852
4862
|
}
|
|
4853
4863
|
}]);
|
|
4854
4864
|
}();
|
|
4855
4865
|
|
|
4856
|
-
var
|
|
4857
|
-
var
|
|
4858
|
-
|
|
4859
|
-
|
|
4860
|
-
|
|
4861
|
-
var FLYPAY_LOGO_LINK = '/images/coles-pay-logo.png';
|
|
4862
|
-
var MESSAGE_WIDGET_LINK = '/message-widget';
|
|
4863
|
-
var MASTERCARD_SRC = '/secure-remote-commerce/mastercard';
|
|
4864
|
-
var Link = /*#__PURE__*/function () {
|
|
4865
|
-
function Link(linkResource) {
|
|
4866
|
-
_classCallCheck(this, Link);
|
|
4867
|
-
this.params = {};
|
|
4868
|
-
this.widgetId = Uuid.generate();
|
|
4869
|
-
this.linkResource = linkResource;
|
|
4870
|
-
this.env = new Env(WIDGET_URL);
|
|
4871
|
-
this.setParams({
|
|
4872
|
-
widget_id: this.widgetId
|
|
4873
|
-
});
|
|
4866
|
+
var GET_WALLET_CONFIG = '/v1/gateways/:gateway_id/wallet-config';
|
|
4867
|
+
var ApiGatewayInternal = /*#__PURE__*/function () {
|
|
4868
|
+
function ApiGatewayInternal(api) {
|
|
4869
|
+
_classCallCheck(this, ApiGatewayInternal);
|
|
4870
|
+
this.api = api;
|
|
4874
4871
|
}
|
|
4875
|
-
return _createClass(
|
|
4876
|
-
key: "
|
|
4877
|
-
value: function
|
|
4878
|
-
|
|
4872
|
+
return _createClass(ApiGatewayInternal, [{
|
|
4873
|
+
key: "getWalletConfig",
|
|
4874
|
+
value: function getWalletConfig(gateway_id) {
|
|
4875
|
+
var url = GET_WALLET_CONFIG.replace(':gateway_id', gateway_id);
|
|
4876
|
+
return this.api.getClientPromise('GET', url).send(undefined);
|
|
4879
4877
|
}
|
|
4880
|
-
}
|
|
4881
|
-
|
|
4882
|
-
|
|
4883
|
-
|
|
4884
|
-
|
|
4885
|
-
|
|
4886
|
-
|
|
4887
|
-
|
|
4888
|
-
|
|
4878
|
+
}]);
|
|
4879
|
+
}();
|
|
4880
|
+
|
|
4881
|
+
var CREATE_OTT = '/v1/payment_sources/tokens';
|
|
4882
|
+
var CREATE_SESSION = '/v1/payment_sources/payment-session';
|
|
4883
|
+
var ApiPaymentSourceInternal = /*#__PURE__*/function () {
|
|
4884
|
+
function ApiPaymentSourceInternal(api) {
|
|
4885
|
+
_classCallCheck(this, ApiPaymentSourceInternal);
|
|
4886
|
+
this.api = api;
|
|
4887
|
+
}
|
|
4888
|
+
return _createClass(ApiPaymentSourceInternal, [{
|
|
4889
|
+
key: "createOTT",
|
|
4890
|
+
value: function createOTT(payload) {
|
|
4891
|
+
return this.api.getClientPromise('POST', CREATE_OTT).send(payload);
|
|
4889
4892
|
}
|
|
4890
4893
|
}, {
|
|
4891
|
-
key: "
|
|
4892
|
-
value: function
|
|
4893
|
-
this.
|
|
4894
|
+
key: "createSession",
|
|
4895
|
+
value: function createSession(payload) {
|
|
4896
|
+
return this.api.getClientPromise('POST', CREATE_SESSION).send(payload);
|
|
4894
4897
|
}
|
|
4895
|
-
}
|
|
4896
|
-
|
|
4897
|
-
|
|
4898
|
-
|
|
4899
|
-
|
|
4900
|
-
|
|
4901
|
-
|
|
4902
|
-
|
|
4898
|
+
}]);
|
|
4899
|
+
}();
|
|
4900
|
+
|
|
4901
|
+
var GET_CONFIG = '/v1/services/:service_id/config';
|
|
4902
|
+
var ApiServiceInternal = /*#__PURE__*/function () {
|
|
4903
|
+
function ApiServiceInternal(api) {
|
|
4904
|
+
_classCallCheck(this, ApiServiceInternal);
|
|
4905
|
+
this.api = api;
|
|
4906
|
+
}
|
|
4907
|
+
return _createClass(ApiServiceInternal, [{
|
|
4908
|
+
key: "getConfig",
|
|
4909
|
+
value: function getConfig(service_id) {
|
|
4910
|
+
var url = GET_CONFIG.replace(':service_id', service_id);
|
|
4911
|
+
return this.api.getClientPromise('GET', url).send(undefined);
|
|
4912
|
+
}
|
|
4913
|
+
}]);
|
|
4914
|
+
}();
|
|
4915
|
+
var SERVICE_TYPES;
|
|
4916
|
+
(function (SERVICE_TYPES) {
|
|
4917
|
+
SERVICE_TYPES["ACCERTIFY"] = "Accertify";
|
|
4918
|
+
SERVICE_TYPES["BOOKING"] = "Booking";
|
|
4919
|
+
SERVICE_TYPES["GPAYMENTS"] = "GPayments";
|
|
4920
|
+
SERVICE_TYPES["CLICK_TO_PAY"] = "ClickToPay";
|
|
4921
|
+
SERVICE_TYPES["MASTERCARD_NT"] = "MastercardSCOF";
|
|
4922
|
+
SERVICE_TYPES["VISA_NT"] = "VisaVTS";
|
|
4923
|
+
SERVICE_TYPES["FORTER"] = "Forter";
|
|
4924
|
+
SERVICE_TYPES["APPLE_PAY"] = "ApplePay";
|
|
4925
|
+
SERVICE_TYPES["GOOGLE_PAY"] = "GooglePay";
|
|
4926
|
+
})(SERVICE_TYPES || (SERVICE_TYPES = {}));
|
|
4927
|
+
|
|
4928
|
+
var ApiInternal = /*#__PURE__*/function (_ApiBase) {
|
|
4929
|
+
function ApiInternal() {
|
|
4930
|
+
_classCallCheck(this, ApiInternal);
|
|
4931
|
+
return _callSuper(this, ApiInternal, arguments);
|
|
4932
|
+
}
|
|
4933
|
+
_inherits(ApiInternal, _ApiBase);
|
|
4934
|
+
return _createClass(ApiInternal, [{
|
|
4935
|
+
key: "charge",
|
|
4936
|
+
value: function charge() {
|
|
4937
|
+
return new ApiChargeInternal(this);
|
|
4903
4938
|
}
|
|
4904
4939
|
}, {
|
|
4905
|
-
key: "
|
|
4906
|
-
value: function
|
|
4907
|
-
return this
|
|
4940
|
+
key: "service",
|
|
4941
|
+
value: function service() {
|
|
4942
|
+
return new ApiServiceInternal(this);
|
|
4908
4943
|
}
|
|
4909
4944
|
}, {
|
|
4910
|
-
key: "
|
|
4911
|
-
value: function
|
|
4912
|
-
this
|
|
4945
|
+
key: "checkout",
|
|
4946
|
+
value: function checkout() {
|
|
4947
|
+
return new ApiCheckoutInternal(this);
|
|
4913
4948
|
}
|
|
4914
4949
|
}, {
|
|
4915
|
-
key: "
|
|
4916
|
-
value: function
|
|
4917
|
-
return this
|
|
4950
|
+
key: "gateway",
|
|
4951
|
+
value: function gateway() {
|
|
4952
|
+
return new ApiGatewayInternal(this);
|
|
4918
4953
|
}
|
|
4919
4954
|
}, {
|
|
4920
|
-
key: "
|
|
4921
|
-
value: function
|
|
4922
|
-
return this
|
|
4955
|
+
key: "paymentSource",
|
|
4956
|
+
value: function paymentSource() {
|
|
4957
|
+
return new ApiPaymentSourceInternal(this);
|
|
4923
4958
|
}
|
|
4924
4959
|
}]);
|
|
4925
|
-
}();
|
|
4960
|
+
}(ApiBase);
|
|
4926
4961
|
|
|
4927
4962
|
var IFrame = /*#__PURE__*/function () {
|
|
4928
4963
|
function IFrame(container) {
|
|
@@ -5119,10 +5154,10 @@ var IFrameEvent = /*#__PURE__*/function () {
|
|
|
5119
5154
|
}();
|
|
5120
5155
|
|
|
5121
5156
|
var hiddenStyle = {
|
|
5122
|
-
visibility:
|
|
5123
|
-
border:
|
|
5124
|
-
width:
|
|
5125
|
-
height:
|
|
5157
|
+
visibility: 'hidden',
|
|
5158
|
+
border: '0',
|
|
5159
|
+
width: '0',
|
|
5160
|
+
height: '0'
|
|
5126
5161
|
};
|
|
5127
5162
|
var PROCESS_STANDALONE_3DS_STATUS;
|
|
5128
5163
|
(function (PROCESS_STANDALONE_3DS_STATUS) {
|
|
@@ -5144,14 +5179,30 @@ var IFRAME_STATUS;
|
|
|
5144
5179
|
IFRAME_STATUS["TIMEOUT"] = "AuthTimedOut";
|
|
5145
5180
|
IFRAME_STATUS["INVALID"] = "invalid_event";
|
|
5146
5181
|
})(IFRAME_STATUS || (IFRAME_STATUS = {}));
|
|
5182
|
+
/**
|
|
5183
|
+
* Event name constants emitted during the Standalone 3DS (GPayments) flow.
|
|
5184
|
+
* Used internally by `GPaymentsService` and re-exported publicly as `CANVAS_3DS_EVENT`.
|
|
5185
|
+
*/
|
|
5147
5186
|
var GPAYMENTS_EVENT = {
|
|
5187
|
+
/** Authentication succeeded. Payload: `Canvas3dsAuthPayload`. */
|
|
5148
5188
|
AUTH_SUCCESS: 'chargeAuthSuccess',
|
|
5189
|
+
/** Authentication failed — covers issuer rejection, iframe timeout (`AuthTimedOut`), and invalid-event outcomes. Payload: `Canvas3dsAuthPayload`. */
|
|
5149
5190
|
AUTH_ERROR: 'chargeAuthReject',
|
|
5191
|
+
/** Decoupled authentication — issuer will authenticate out-of-band. Payload: `Canvas3dsAuthPayload`. */
|
|
5150
5192
|
DECOUPLED: 'chargeAuthDecoupled',
|
|
5193
|
+
/** Challenge required — issuer demands user interaction. Payload: `Canvas3dsAuthPayload`. */
|
|
5151
5194
|
CHALLENGE: 'chargeAuthChallenge',
|
|
5195
|
+
/** Informational signal emitted by the GPayments flow. Internal — not part of the public typed surface. */
|
|
5152
5196
|
INFO: 'chargeAuthInfo',
|
|
5197
|
+
/** Error during the flow (network, parsing, etc.). Payload: `Canvas3dsErrorPayload`. */
|
|
5153
5198
|
ERROR: 'error'
|
|
5154
5199
|
};
|
|
5200
|
+
/**
|
|
5201
|
+
* Public alias for GPAYMENTS_EVENT. Same object reference — no behavioral change.
|
|
5202
|
+
* Prefer `CANVAS_3DS_EVENT` in public-facing code; `GPAYMENTS_EVENT` remains for
|
|
5203
|
+
* backwards-compatible internal usage.
|
|
5204
|
+
*/
|
|
5205
|
+
var CANVAS_3DS_EVENT = GPAYMENTS_EVENT;
|
|
5155
5206
|
var GPaymentsService = /*#__PURE__*/function () {
|
|
5156
5207
|
function GPaymentsService(container, api, eventEmitter) {
|
|
5157
5208
|
_classCallCheck(this, GPaymentsService);
|
|
@@ -5179,20 +5230,22 @@ var GPaymentsService = /*#__PURE__*/function () {
|
|
|
5179
5230
|
value: function initializeIFrames(initializationUrl, secondaryUrl, title) {
|
|
5180
5231
|
var hideAuthorization = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
|
|
5181
5232
|
var container = this.container.getElement();
|
|
5182
|
-
if (!container)
|
|
5183
|
-
|
|
5184
|
-
|
|
5233
|
+
if (!container) {
|
|
5234
|
+
return;
|
|
5235
|
+
}
|
|
5236
|
+
var divAuthorization = document.createElement('div');
|
|
5237
|
+
divAuthorization.setAttribute('id', 'paydock_authorization_iframe');
|
|
5185
5238
|
container.appendChild(divAuthorization);
|
|
5186
|
-
this.browserAndChallengeContainer = new Container(
|
|
5239
|
+
this.browserAndChallengeContainer = new Container('#paydock_authorization_iframe');
|
|
5187
5240
|
this.iFrameAuthorization = new IFrame(this.browserAndChallengeContainer);
|
|
5188
5241
|
this.iFrameAuthorization.load(initializationUrl, {
|
|
5189
5242
|
title: title
|
|
5190
5243
|
});
|
|
5191
5244
|
if (secondaryUrl) {
|
|
5192
|
-
var divSecondaryURL = document.createElement(
|
|
5193
|
-
divSecondaryURL.setAttribute(
|
|
5245
|
+
var divSecondaryURL = document.createElement('div');
|
|
5246
|
+
divSecondaryURL.setAttribute('id', 'paydock_secondary_iframe');
|
|
5194
5247
|
container.appendChild(divSecondaryURL);
|
|
5195
|
-
this.monitoringContainer = new Container(
|
|
5248
|
+
this.monitoringContainer = new Container('#paydock_secondary_iframe');
|
|
5196
5249
|
this.iFrameSecondaryUrl = new IFrame(this.monitoringContainer);
|
|
5197
5250
|
this.iFrameSecondaryUrl.load(secondaryUrl, {
|
|
5198
5251
|
title: title
|
|
@@ -5208,8 +5261,12 @@ var GPaymentsService = /*#__PURE__*/function () {
|
|
|
5208
5261
|
var hideAuthorization = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
5209
5262
|
var _a;
|
|
5210
5263
|
for (var prop in hiddenStyle) {
|
|
5211
|
-
if (!
|
|
5212
|
-
|
|
5264
|
+
if (!Object.hasOwn(hiddenStyle, prop)) {
|
|
5265
|
+
continue;
|
|
5266
|
+
}
|
|
5267
|
+
if (hideAuthorization) {
|
|
5268
|
+
this.iFrameAuthorization.setStyle(prop, hiddenStyle[prop]);
|
|
5269
|
+
}
|
|
5213
5270
|
(_a = this.iFrameSecondaryUrl) === null || _a === void 0 ? void 0 : _a.setStyle(prop, hiddenStyle[prop]);
|
|
5214
5271
|
}
|
|
5215
5272
|
}
|
|
@@ -5219,13 +5276,17 @@ var GPaymentsService = /*#__PURE__*/function () {
|
|
|
5219
5276
|
var _this = this;
|
|
5220
5277
|
this.iFrameEvent.on(EVENT$5.CHARGE_AUTH, widgetId, function (data) {
|
|
5221
5278
|
if (data.status === IFRAME_STATUS.SKIPPED || data.status === IFRAME_STATUS.FINISHED) {
|
|
5222
|
-
if (data.info)
|
|
5223
|
-
|
|
5224
|
-
|
|
5279
|
+
if (data.info) {
|
|
5280
|
+
_this.eventEmitter.emit(GPAYMENTS_EVENT.INFO, {
|
|
5281
|
+
info: data.info
|
|
5282
|
+
});
|
|
5283
|
+
}
|
|
5225
5284
|
_this.performAuthentication(data);
|
|
5226
|
-
} else if (data.status === IFRAME_STATUS.TIMEOUT || data.status === IFRAME_STATUS.INVALID)
|
|
5227
|
-
|
|
5228
|
-
|
|
5285
|
+
} else if (data.status === IFRAME_STATUS.TIMEOUT || data.status === IFRAME_STATUS.INVALID) {
|
|
5286
|
+
_this.eventEmitter.emit(GPAYMENTS_EVENT.AUTH_ERROR, _this.parseHandleResponse({
|
|
5287
|
+
status: data.status
|
|
5288
|
+
}, data.charge_3ds_id));
|
|
5289
|
+
}
|
|
5229
5290
|
});
|
|
5230
5291
|
this.iFrameEvent.on(EVENT$5.CHARGE_AUTH_SUCCESS, widgetId, function (data) {
|
|
5231
5292
|
_this.processResult(data.charge_3ds_id);
|
|
@@ -5265,13 +5326,19 @@ var GPaymentsService = /*#__PURE__*/function () {
|
|
|
5265
5326
|
key: "processResult",
|
|
5266
5327
|
value: function processResult(charge3dsId) {
|
|
5267
5328
|
var _this2 = this;
|
|
5268
|
-
if (this.resultRead)
|
|
5329
|
+
if (this.resultRead) {
|
|
5330
|
+
return;
|
|
5331
|
+
}
|
|
5269
5332
|
this.resultRead = true;
|
|
5270
5333
|
this.api.charge().standalone3dsHandle().then(function (result) {
|
|
5271
5334
|
var _a;
|
|
5272
5335
|
_this2.iFrameAuthorization.remove();
|
|
5273
5336
|
(_a = _this2.iFrameSecondaryUrl) === null || _a === void 0 ? void 0 : _a.remove();
|
|
5274
|
-
if (result.status === PROCESS_STANDALONE_3DS_STATUS.SUCCESS)
|
|
5337
|
+
if (result.status === PROCESS_STANDALONE_3DS_STATUS.SUCCESS) {
|
|
5338
|
+
_this2.eventEmitter.emit(GPAYMENTS_EVENT.AUTH_SUCCESS, _this2.parseResultData(result, charge3dsId));
|
|
5339
|
+
} else {
|
|
5340
|
+
_this2.eventEmitter.emit(GPAYMENTS_EVENT.AUTH_ERROR, _this2.parseResultData(result, charge3dsId));
|
|
5341
|
+
}
|
|
5275
5342
|
}, function (err) {
|
|
5276
5343
|
_this2.eventEmitter.emit(GPAYMENTS_EVENT.ERROR, _this2.parseError(err, charge3dsId));
|
|
5277
5344
|
});
|
|
@@ -5296,10 +5363,16 @@ var GPaymentsService = /*#__PURE__*/function () {
|
|
|
5296
5363
|
key: "doPolling",
|
|
5297
5364
|
value: function doPolling(url, charge3dsId) {
|
|
5298
5365
|
var _this3 = this;
|
|
5299
|
-
this.externalAPI(
|
|
5300
|
-
if (!data.event || data.event ===
|
|
5301
|
-
|
|
5302
|
-
|
|
5366
|
+
this.externalAPI('GET', url).then(function (data) {
|
|
5367
|
+
if (!data.event || data.event === 'AuthResultNotReady') {
|
|
5368
|
+
setTimeout(function () {
|
|
5369
|
+
_this3.doPolling(url, charge3dsId);
|
|
5370
|
+
}, 2000);
|
|
5371
|
+
} else if (data.event === 'AuthResultReady') {
|
|
5372
|
+
_this3.processResult(charge3dsId);
|
|
5373
|
+
} else {
|
|
5374
|
+
throw new Error('Event not supported');
|
|
5375
|
+
}
|
|
5303
5376
|
})["catch"](function (err) {
|
|
5304
5377
|
return _this3.eventEmitter.emit(GPAYMENTS_EVENT.ERROR, _this3.parseError(err, charge3dsId));
|
|
5305
5378
|
});
|
|
@@ -5316,16 +5389,24 @@ var GPaymentsService = /*#__PURE__*/function () {
|
|
|
5316
5389
|
charge_3ds_id: charge_3ds_id
|
|
5317
5390
|
}).then(function (authenticationResult) {
|
|
5318
5391
|
var _a, _b;
|
|
5319
|
-
if (authenticationResult.status === AUTHENTICATION_STATUS.SUCCESS)
|
|
5392
|
+
if (authenticationResult.status === AUTHENTICATION_STATUS.SUCCESS) {
|
|
5393
|
+
_this4.eventEmitter.emit(GPAYMENTS_EVENT.AUTH_SUCCESS, _this4.parseHandleResponse(authenticationResult, charge_3ds_id));
|
|
5394
|
+
} else if (authenticationResult.status === AUTHENTICATION_STATUS.PENDING) {
|
|
5320
5395
|
if ((_a = authenticationResult === null || authenticationResult === void 0 ? void 0 : authenticationResult.result) === null || _a === void 0 ? void 0 : _a.challenge) {
|
|
5321
5396
|
_this4.eventEmitter.emit(GPAYMENTS_EVENT.CHALLENGE, _this4.parseHandleResponse(authenticationResult, charge_3ds_id));
|
|
5322
5397
|
_this4.initializeIFrames(authenticationResult.result.challenge_url, undefined, 'Authentication Challenge', false);
|
|
5323
|
-
if (authenticationResult.result.secondary_url)
|
|
5398
|
+
if (authenticationResult.result.secondary_url) {
|
|
5399
|
+
_this4.doPolling(authenticationResult.result.secondary_url, charge_3ds_id);
|
|
5400
|
+
}
|
|
5324
5401
|
} else if ((_b = authenticationResult === null || authenticationResult === void 0 ? void 0 : authenticationResult.result) === null || _b === void 0 ? void 0 : _b.decoupled_challenge) {
|
|
5325
5402
|
_this4.eventEmitter.emit(GPAYMENTS_EVENT.DECOUPLED, _this4.parseHandleResponse(authenticationResult, charge_3ds_id));
|
|
5326
|
-
if (authenticationResult.result.secondary_url)
|
|
5403
|
+
if (authenticationResult.result.secondary_url) {
|
|
5404
|
+
_this4.doPolling(authenticationResult.result.secondary_url, charge_3ds_id);
|
|
5405
|
+
}
|
|
5327
5406
|
}
|
|
5328
|
-
} else
|
|
5407
|
+
} else {
|
|
5408
|
+
return _this4.eventEmitter.emit(GPAYMENTS_EVENT.AUTH_ERROR, _this4.parseHandleResponse(authenticationResult, charge_3ds_id));
|
|
5409
|
+
}
|
|
5329
5410
|
}, function (err) {
|
|
5330
5411
|
_this4.eventEmitter.emit(GPAYMENTS_EVENT.ERROR, _this4.parseError(err, charge_3ds_id));
|
|
5331
5412
|
});
|
|
@@ -5333,192 +5414,159 @@ var GPaymentsService = /*#__PURE__*/function () {
|
|
|
5333
5414
|
}]);
|
|
5334
5415
|
}();
|
|
5335
5416
|
|
|
5336
|
-
var
|
|
5337
|
-
|
|
5338
|
-
|
|
5339
|
-
var
|
|
5340
|
-
|
|
5341
|
-
|
|
5342
|
-
|
|
5343
|
-
this.
|
|
5417
|
+
var STANDALONE_3DS_GATEWAYS = {
|
|
5418
|
+
GPAYMENTS: 'GPayments'
|
|
5419
|
+
};
|
|
5420
|
+
var Standalone3dsService = /*#__PURE__*/function () {
|
|
5421
|
+
function Standalone3dsService(container, eventEmitter) {
|
|
5422
|
+
_classCallCheck(this, Standalone3dsService);
|
|
5423
|
+
this.env = DEFAULT_ENV;
|
|
5424
|
+
this.container = container;
|
|
5425
|
+
this.eventEmitter = eventEmitter;
|
|
5344
5426
|
}
|
|
5345
|
-
return _createClass(
|
|
5346
|
-
key: "
|
|
5347
|
-
value: function
|
|
5348
|
-
|
|
5349
|
-
|
|
5350
|
-
|
|
5351
|
-
|
|
5352
|
-
|
|
5353
|
-
|
|
5354
|
-
|
|
5355
|
-
|
|
5356
|
-
|
|
5357
|
-
|
|
5358
|
-
|
|
5427
|
+
return _createClass(Standalone3dsService, [{
|
|
5428
|
+
key: "load",
|
|
5429
|
+
value: function load(token, options) {
|
|
5430
|
+
var parsedToken = AccessToken.validateJWT(token);
|
|
5431
|
+
if (!parsedToken) {
|
|
5432
|
+
throw new Error('Invalid charge token');
|
|
5433
|
+
}
|
|
5434
|
+
var tokenData = AccessToken.extractData(parsedToken.body);
|
|
5435
|
+
var api = new ApiInternal(token, API_AUTH_TYPE.TOKEN);
|
|
5436
|
+
api.setEnv(this.env, this.alias);
|
|
5437
|
+
switch (tokenData.service_type) {
|
|
5438
|
+
case STANDALONE_3DS_GATEWAYS.GPAYMENTS:
|
|
5439
|
+
new GPaymentsService(this.container, api, this.eventEmitter).load(tokenData, options.title);
|
|
5440
|
+
break;
|
|
5441
|
+
}
|
|
5359
5442
|
}
|
|
5360
5443
|
}, {
|
|
5361
|
-
key: "
|
|
5362
|
-
value: function
|
|
5363
|
-
|
|
5444
|
+
key: "setEnv",
|
|
5445
|
+
value: function setEnv(env, alias) {
|
|
5446
|
+
this.env = env;
|
|
5447
|
+
this.alias = alias;
|
|
5364
5448
|
}
|
|
5365
5449
|
}]);
|
|
5366
5450
|
}();
|
|
5367
5451
|
|
|
5368
|
-
var
|
|
5369
|
-
|
|
5370
|
-
|
|
5371
|
-
var ApiCheckoutInternal = /*#__PURE__*/function () {
|
|
5372
|
-
function ApiCheckoutInternal(api) {
|
|
5373
|
-
_classCallCheck(this, ApiCheckoutInternal);
|
|
5374
|
-
this.api = api;
|
|
5375
|
-
this.getInstructionLink = function () {
|
|
5376
|
-
return "".concat(INSTRUCTION_LINK, "?time=").concat(Date.now());
|
|
5377
|
-
};
|
|
5452
|
+
var Url = /*#__PURE__*/function () {
|
|
5453
|
+
function Url() {
|
|
5454
|
+
_classCallCheck(this, Url);
|
|
5378
5455
|
}
|
|
5379
|
-
return _createClass(
|
|
5380
|
-
key: "
|
|
5381
|
-
value: function
|
|
5382
|
-
return
|
|
5383
|
-
}
|
|
5384
|
-
}, {
|
|
5385
|
-
key: "callback",
|
|
5386
|
-
value: function callback(payload) {
|
|
5387
|
-
return this.api.getClientPromise('POST', CALLBACK_LINK).send(payload);
|
|
5456
|
+
return _createClass(Url, null, [{
|
|
5457
|
+
key: "extendSearchParams",
|
|
5458
|
+
value: function extendSearchParams(uri, key, val) {
|
|
5459
|
+
return uri.replace(new RegExp("([?&]" + key + "(?=[=&#]|$)[^#&]*|(?=#|$))"), "&" + key + "=" + encodeURIComponent(val)).replace(/^([^?&]+)&/, "$1?");
|
|
5388
5460
|
}
|
|
5389
5461
|
}, {
|
|
5390
|
-
key: "
|
|
5391
|
-
value: function
|
|
5392
|
-
return
|
|
5393
|
-
|
|
5394
|
-
|
|
5395
|
-
}();
|
|
5396
|
-
|
|
5397
|
-
var GET_WALLET_CONFIG = '/v1/gateways/:gateway_id/wallet-config';
|
|
5398
|
-
var ApiGatewayInternal = /*#__PURE__*/function () {
|
|
5399
|
-
function ApiGatewayInternal(api) {
|
|
5400
|
-
_classCallCheck(this, ApiGatewayInternal);
|
|
5401
|
-
this.api = api;
|
|
5402
|
-
}
|
|
5403
|
-
return _createClass(ApiGatewayInternal, [{
|
|
5404
|
-
key: "getWalletConfig",
|
|
5405
|
-
value: function getWalletConfig(gateway_id) {
|
|
5406
|
-
var url = GET_WALLET_CONFIG.replace(':gateway_id', gateway_id);
|
|
5407
|
-
return this.api.getClientPromise('GET', url).send(undefined);
|
|
5462
|
+
key: "serialize",
|
|
5463
|
+
value: function serialize(params) {
|
|
5464
|
+
return Object.keys(params).map(function (key) {
|
|
5465
|
+
return encodeURIComponent(key) + '=' + encodeURIComponent(params[key]);
|
|
5466
|
+
}).join('&');
|
|
5408
5467
|
}
|
|
5409
5468
|
}]);
|
|
5410
5469
|
}();
|
|
5411
5470
|
|
|
5412
|
-
var
|
|
5413
|
-
|
|
5414
|
-
|
|
5415
|
-
function ApiPaymentSourceInternal(api) {
|
|
5416
|
-
_classCallCheck(this, ApiPaymentSourceInternal);
|
|
5417
|
-
this.api = api;
|
|
5471
|
+
var Uuid = /*#__PURE__*/function () {
|
|
5472
|
+
function Uuid() {
|
|
5473
|
+
_classCallCheck(this, Uuid);
|
|
5418
5474
|
}
|
|
5419
|
-
return _createClass(
|
|
5420
|
-
key: "
|
|
5421
|
-
value: function
|
|
5422
|
-
|
|
5475
|
+
return _createClass(Uuid, null, [{
|
|
5476
|
+
key: "generate",
|
|
5477
|
+
value: function generate() {
|
|
5478
|
+
if (typeof window !== "undefined" && typeof window.crypto !== "undefined" && typeof window.crypto.getRandomValues !== "undefined") {
|
|
5479
|
+
var buf = new Uint16Array(8);
|
|
5480
|
+
window.crypto.getRandomValues(buf);
|
|
5481
|
+
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]);
|
|
5482
|
+
} else {
|
|
5483
|
+
return this.random() + this.random() + "-" + this.random() + "-" + this.random() + "-" + this.random() + "-" + this.random() + this.random() + this.random();
|
|
5484
|
+
}
|
|
5423
5485
|
}
|
|
5424
5486
|
}, {
|
|
5425
|
-
key: "
|
|
5426
|
-
value: function
|
|
5427
|
-
|
|
5487
|
+
key: "hash",
|
|
5488
|
+
value: function hash(number) {
|
|
5489
|
+
var hash = number.toString(16);
|
|
5490
|
+
while (hash.length < 4) {
|
|
5491
|
+
hash = "0" + hash;
|
|
5492
|
+
}
|
|
5493
|
+
return hash;
|
|
5428
5494
|
}
|
|
5429
|
-
}
|
|
5430
|
-
|
|
5431
|
-
|
|
5432
|
-
|
|
5433
|
-
var ApiServiceInternal = /*#__PURE__*/function () {
|
|
5434
|
-
function ApiServiceInternal(api) {
|
|
5435
|
-
_classCallCheck(this, ApiServiceInternal);
|
|
5436
|
-
this.api = api;
|
|
5437
|
-
}
|
|
5438
|
-
return _createClass(ApiServiceInternal, [{
|
|
5439
|
-
key: "getConfig",
|
|
5440
|
-
value: function getConfig(service_id) {
|
|
5441
|
-
var url = GET_CONFIG.replace(':service_id', service_id);
|
|
5442
|
-
return this.api.getClientPromise('GET', url).send(undefined);
|
|
5495
|
+
}, {
|
|
5496
|
+
key: "random",
|
|
5497
|
+
value: function random() {
|
|
5498
|
+
return Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1);
|
|
5443
5499
|
}
|
|
5444
5500
|
}]);
|
|
5445
5501
|
}();
|
|
5446
|
-
var SERVICE_TYPES;
|
|
5447
|
-
(function (SERVICE_TYPES) {
|
|
5448
|
-
SERVICE_TYPES["ACCERTIFY"] = "Accertify";
|
|
5449
|
-
SERVICE_TYPES["BOOKING"] = "Booking";
|
|
5450
|
-
SERVICE_TYPES["GPAYMENTS"] = "GPayments";
|
|
5451
|
-
SERVICE_TYPES["CLICK_TO_PAY"] = "ClickToPay";
|
|
5452
|
-
SERVICE_TYPES["MASTERCARD_NT"] = "MastercardSCOF";
|
|
5453
|
-
SERVICE_TYPES["VISA_NT"] = "VisaVTS";
|
|
5454
|
-
SERVICE_TYPES["FORTER"] = "Forter";
|
|
5455
|
-
SERVICE_TYPES["APPLE_PAY"] = "ApplePay";
|
|
5456
|
-
SERVICE_TYPES["GOOGLE_PAY"] = "GooglePay";
|
|
5457
|
-
})(SERVICE_TYPES || (SERVICE_TYPES = {}));
|
|
5458
5502
|
|
|
5459
|
-
var
|
|
5460
|
-
|
|
5461
|
-
|
|
5462
|
-
|
|
5503
|
+
var WIDGET_LINK = '/remote-action';
|
|
5504
|
+
var VAULT_DISPLAY_WIDGET_LINK = '/vault-display';
|
|
5505
|
+
var PAYMENT_SOURCE_LINK = '/payment-sources';
|
|
5506
|
+
var SECURE_3D = '/3ds/webhook';
|
|
5507
|
+
var FLYPAY_LINK = '/wallet/flypay';
|
|
5508
|
+
var FLYPAY_LOGO_LINK = '/images/coles-pay-logo.png';
|
|
5509
|
+
var MESSAGE_WIDGET_LINK = '/message-widget';
|
|
5510
|
+
var MASTERCARD_SRC = '/secure-remote-commerce/mastercard';
|
|
5511
|
+
var Link = /*#__PURE__*/function () {
|
|
5512
|
+
function Link(linkResource) {
|
|
5513
|
+
_classCallCheck(this, Link);
|
|
5514
|
+
this.params = {};
|
|
5515
|
+
this.widgetId = Uuid.generate();
|
|
5516
|
+
this.linkResource = linkResource;
|
|
5517
|
+
this.env = new Env(WIDGET_URL);
|
|
5518
|
+
this.setParams({
|
|
5519
|
+
widget_id: this.widgetId
|
|
5520
|
+
});
|
|
5463
5521
|
}
|
|
5464
|
-
|
|
5465
|
-
|
|
5466
|
-
|
|
5467
|
-
|
|
5468
|
-
return new ApiChargeInternal(this);
|
|
5522
|
+
return _createClass(Link, [{
|
|
5523
|
+
key: "getNetUrl",
|
|
5524
|
+
value: function getNetUrl() {
|
|
5525
|
+
return this.env.getConf().url + this.linkResource;
|
|
5469
5526
|
}
|
|
5470
5527
|
}, {
|
|
5471
|
-
key: "
|
|
5472
|
-
value: function
|
|
5473
|
-
|
|
5528
|
+
key: "getUrl",
|
|
5529
|
+
value: function getUrl() {
|
|
5530
|
+
var url = this.getNetUrl();
|
|
5531
|
+
var params = this.getParams();
|
|
5532
|
+
for (var key in params) {
|
|
5533
|
+
if (params.hasOwnProperty(key)) url = Url.extendSearchParams(url, key, params[key]);
|
|
5534
|
+
}
|
|
5535
|
+
return url;
|
|
5474
5536
|
}
|
|
5475
5537
|
}, {
|
|
5476
|
-
key: "
|
|
5477
|
-
value: function
|
|
5478
|
-
|
|
5538
|
+
key: "setParams",
|
|
5539
|
+
value: function setParams(params) {
|
|
5540
|
+
this.params = _extends({}, this.params, params);
|
|
5479
5541
|
}
|
|
5480
5542
|
}, {
|
|
5481
|
-
key: "
|
|
5482
|
-
value: function
|
|
5483
|
-
|
|
5543
|
+
key: "concatParams",
|
|
5544
|
+
value: function concatParams(params) {
|
|
5545
|
+
for (var key in params) {
|
|
5546
|
+
if (!params.hasOwnProperty(key) || !params[key].length) continue;
|
|
5547
|
+
if (typeof this.params[key] !== 'string') this.params[key] = '';
|
|
5548
|
+
if (this.params[key].length) this.params[key] += ',' + params[key];else this.params[key] += params[key];
|
|
5549
|
+
}
|
|
5484
5550
|
}
|
|
5485
5551
|
}, {
|
|
5486
|
-
key: "
|
|
5487
|
-
value: function
|
|
5488
|
-
return
|
|
5489
|
-
}
|
|
5490
|
-
}]);
|
|
5491
|
-
}(ApiBase);
|
|
5492
|
-
|
|
5493
|
-
var STANDALONE_3DS_GATEWAYS = {
|
|
5494
|
-
GPAYMENTS: "GPayments"
|
|
5495
|
-
};
|
|
5496
|
-
var Standalone3dsService = /*#__PURE__*/function () {
|
|
5497
|
-
function Standalone3dsService(container, eventEmitter) {
|
|
5498
|
-
_classCallCheck(this, Standalone3dsService);
|
|
5499
|
-
this.env = DEFAULT_ENV;
|
|
5500
|
-
this.container = container;
|
|
5501
|
-
this.eventEmitter = eventEmitter;
|
|
5502
|
-
}
|
|
5503
|
-
return _createClass(Standalone3dsService, [{
|
|
5504
|
-
key: "load",
|
|
5505
|
-
value: function load(token, options) {
|
|
5506
|
-
var parsedToken = AccessToken.validateJWT(token);
|
|
5507
|
-
if (!parsedToken) throw new Error("Invalid charge token");
|
|
5508
|
-
var tokenData = AccessToken.extractData(parsedToken.body);
|
|
5509
|
-
var api = new ApiInternal(token, API_AUTH_TYPE.TOKEN);
|
|
5510
|
-
api.setEnv(this.env, this.alias);
|
|
5511
|
-
switch (tokenData.service_type) {
|
|
5512
|
-
case STANDALONE_3DS_GATEWAYS.GPAYMENTS:
|
|
5513
|
-
new GPaymentsService(this.container, api, this.eventEmitter).load(tokenData, options.title);
|
|
5514
|
-
break;
|
|
5515
|
-
}
|
|
5552
|
+
key: "getParams",
|
|
5553
|
+
value: function getParams() {
|
|
5554
|
+
return this.params;
|
|
5516
5555
|
}
|
|
5517
5556
|
}, {
|
|
5518
5557
|
key: "setEnv",
|
|
5519
5558
|
value: function setEnv(env, alias) {
|
|
5520
|
-
this.env
|
|
5521
|
-
|
|
5559
|
+
this.env.setEnv(env, alias);
|
|
5560
|
+
}
|
|
5561
|
+
}, {
|
|
5562
|
+
key: "getEnv",
|
|
5563
|
+
value: function getEnv() {
|
|
5564
|
+
return this.env.getEnv();
|
|
5565
|
+
}
|
|
5566
|
+
}, {
|
|
5567
|
+
key: "getBaseUrl",
|
|
5568
|
+
value: function getBaseUrl() {
|
|
5569
|
+
return this.env.getConf().url;
|
|
5522
5570
|
}
|
|
5523
5571
|
}]);
|
|
5524
5572
|
}();
|
|
@@ -5558,7 +5606,7 @@ var TOKEN_FORMAT$2;
|
|
|
5558
5606
|
* @param {string} CHARGE_AUTH_CHALLENGE=chargeAuthChallenge
|
|
5559
5607
|
* @param {string} CHARGE_AUTH_INFO=chargeAuthInfo
|
|
5560
5608
|
* @param {string} ERROR=error
|
|
5561
|
-
*/
|
|
5609
|
+
*/
|
|
5562
5610
|
/**
|
|
5563
5611
|
* Class Canvas3ds include method for working on html
|
|
5564
5612
|
* @constructor
|
|
@@ -5594,13 +5642,21 @@ var Canvas3ds = /*#__PURE__*/function () {
|
|
|
5594
5642
|
*
|
|
5595
5643
|
*/
|
|
5596
5644
|
function load() {
|
|
5597
|
-
if (this.token.format === TOKEN_FORMAT$2.HTML)
|
|
5598
|
-
|
|
5599
|
-
|
|
5600
|
-
|
|
5601
|
-
}
|
|
5602
|
-
|
|
5603
|
-
|
|
5645
|
+
if (this.token.format === TOKEN_FORMAT$2.HTML) {
|
|
5646
|
+
this.iFrame.loadFromHtml(this.token.content, {
|
|
5647
|
+
title: '3d secure authentication'
|
|
5648
|
+
}, 'threeDSecure-iframe');
|
|
5649
|
+
} else if (this.token.format === TOKEN_FORMAT$2.URL) {
|
|
5650
|
+
this.iFrame.load(this.token.content, {
|
|
5651
|
+
title: '3d secure authentication'
|
|
5652
|
+
}, 'threeDSecure-iframe');
|
|
5653
|
+
} else if (this.token.format === TOKEN_FORMAT$2.STANDALONE_3DS) {
|
|
5654
|
+
this.standalone3dsService.load(this.token.content, {
|
|
5655
|
+
title: '3d secure authentication'
|
|
5656
|
+
});
|
|
5657
|
+
} else {
|
|
5658
|
+
console.error('Token contain unsupported payload');
|
|
5659
|
+
}
|
|
5604
5660
|
}
|
|
5605
5661
|
/**
|
|
5606
5662
|
* Current method can change environment. By default environment = sandbox.
|
|
@@ -5617,7 +5673,9 @@ var Canvas3ds = /*#__PURE__*/function () {
|
|
|
5617
5673
|
this.link.setEnv(env, alias);
|
|
5618
5674
|
this.standalone3dsService.setEnv(env, alias);
|
|
5619
5675
|
for (var index in this.configs) {
|
|
5620
|
-
if (!this.configs
|
|
5676
|
+
if (!Object.hasOwn(this.configs, index)) {
|
|
5677
|
+
continue;
|
|
5678
|
+
}
|
|
5621
5679
|
this.configs[index].setEnv(env, alias);
|
|
5622
5680
|
}
|
|
5623
5681
|
}
|
|
@@ -5627,34 +5685,45 @@ var Canvas3ds = /*#__PURE__*/function () {
|
|
|
5627
5685
|
return this.link.getEnv();
|
|
5628
5686
|
}
|
|
5629
5687
|
/**
|
|
5630
|
-
* Listen to events of widget
|
|
5688
|
+
* Listen to events of widget.
|
|
5631
5689
|
*
|
|
5632
|
-
* @
|
|
5690
|
+
* Available event names are defined in {@link Canvas3dsEventMap} (typed) and
|
|
5691
|
+
* {@link CANVAS_3DS_EVENT} (string constants). Using a literal event name
|
|
5692
|
+
* narrows the callback payload via the typed overloads.
|
|
5633
5693
|
*
|
|
5634
|
-
*
|
|
5635
|
-
*
|
|
5694
|
+
* @example
|
|
5695
|
+
* // Callback form — payload is narrowed by the event name
|
|
5696
|
+
* widget.on('chargeAuthReject', (data) => {
|
|
5697
|
+
* console.log(data); // data is Canvas3dsAuthPayload | Canvas3dsChargeAuthEventPayload
|
|
5636
5698
|
* });
|
|
5637
|
-
*
|
|
5638
|
-
*
|
|
5639
|
-
*
|
|
5699
|
+
*
|
|
5700
|
+
* // Promise form
|
|
5701
|
+
* widget.on('chargeAuthReject').then((data) => {
|
|
5702
|
+
* console.log(data);
|
|
5640
5703
|
* });
|
|
5641
|
-
*
|
|
5642
|
-
* @param {
|
|
5643
|
-
* @
|
|
5704
|
+
*
|
|
5705
|
+
* @param eventName - Event name from {@link Canvas3dsEventMap} or any string for dynamic events.
|
|
5706
|
+
* @param cb - Optional listener callback. If omitted, returns a Promise that resolves on the next emission.
|
|
5707
|
+
* @returns `void` when a callback is provided; otherwise a Promise that resolves with the event payload.
|
|
5644
5708
|
*/
|
|
5709
|
+
// biome-ignore lint/suspicious/noExplicitAny: implementation signature must accept any payload shape to satisfy all overloads above
|
|
5645
5710
|
}, {
|
|
5646
5711
|
key: "on",
|
|
5647
5712
|
value: function on(eventName, cb) {
|
|
5648
5713
|
var _this = this;
|
|
5649
5714
|
if (this.token.format === TOKEN_FORMAT$2.STANDALONE_3DS) {
|
|
5650
|
-
if (typeof cb === 'function')
|
|
5715
|
+
if (typeof cb === 'function') {
|
|
5716
|
+
return this.eventEmitter.subscribe(eventName, cb);
|
|
5717
|
+
}
|
|
5651
5718
|
return new Promise(function (resolve) {
|
|
5652
5719
|
return _this.eventEmitter.subscribe(eventName, function (res) {
|
|
5653
5720
|
return resolve(res);
|
|
5654
5721
|
});
|
|
5655
5722
|
});
|
|
5656
5723
|
} else {
|
|
5657
|
-
if (typeof cb === 'function')
|
|
5724
|
+
if (typeof cb === 'function') {
|
|
5725
|
+
return this.event.on(eventName, this.link.getParams().ref_id, cb);
|
|
5726
|
+
}
|
|
5658
5727
|
return new Promise(function (resolve) {
|
|
5659
5728
|
return _this.event.on(eventName, _this.link.getParams().ref_id, function (res) {
|
|
5660
5729
|
return resolve(res);
|
|
@@ -5698,6 +5767,19 @@ var Canvas3ds = /*#__PURE__*/function () {
|
|
|
5698
5767
|
}]);
|
|
5699
5768
|
}();
|
|
5700
5769
|
|
|
5770
|
+
/**
|
|
5771
|
+
* Public, tree-shakeable alias for the internal `TOKEN_FORMAT` enum in canvas-3ds.ts.
|
|
5772
|
+
* Mirrors the string values of that enum without exposing the private enum itself.
|
|
5773
|
+
*/
|
|
5774
|
+
var Canvas3dsTokenFormat = {
|
|
5775
|
+
/** Token whose `content` is a complete HTML page. The SDK renders it inside an iframe. */
|
|
5776
|
+
HTML: 'html',
|
|
5777
|
+
/** Token whose `content` is a URL. The SDK loads it inside an iframe. */
|
|
5778
|
+
URL: 'url',
|
|
5779
|
+
/** Token whose `content` describes a standalone 3DS service (e.g. GPayments). The SDK delegates to that service's flow. */
|
|
5780
|
+
STANDALONE_3DS: 'standalone_3ds'
|
|
5781
|
+
};
|
|
5782
|
+
|
|
5701
5783
|
var Spinner = /*#__PURE__*/function () {
|
|
5702
5784
|
function Spinner() {
|
|
5703
5785
|
_classCallCheck(this, Spinner);
|
|
@@ -8088,7 +8170,7 @@ var AfterPayWalletService = /*#__PURE__*/function (_WalletService) {
|
|
|
8088
8170
|
}]);
|
|
8089
8171
|
}(WalletService);
|
|
8090
8172
|
|
|
8091
|
-
/*! @license DOMPurify 3.
|
|
8173
|
+
/*! @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 */
|
|
8092
8174
|
|
|
8093
8175
|
var purify_cjs;
|
|
8094
8176
|
var hasRequiredPurify_cjs;
|
|
@@ -8296,7 +8378,7 @@ function requirePurify_cjs () {
|
|
|
8296
8378
|
|
|
8297
8379
|
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']);
|
|
8298
8380
|
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']);
|
|
8299
|
-
const mathMl = freeze(['accent', 'accentunder', 'align', 'bevelled', 'close', '
|
|
8381
|
+
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']);
|
|
8300
8382
|
const xml = freeze(['xlink:href', 'xml:id', 'xlink:title', 'xml:space', 'xmlns:xlink']);
|
|
8301
8383
|
|
|
8302
8384
|
// eslint-disable-next-line unicorn/better-regex
|
|
@@ -8393,7 +8475,7 @@ function requirePurify_cjs () {
|
|
|
8393
8475
|
function createDOMPurify() {
|
|
8394
8476
|
let window = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getGlobal();
|
|
8395
8477
|
const DOMPurify = root => createDOMPurify(root);
|
|
8396
|
-
DOMPurify.version = '3.
|
|
8478
|
+
DOMPurify.version = '3.4.0';
|
|
8397
8479
|
DOMPurify.removed = [];
|
|
8398
8480
|
if (!window || !window.document || window.document.nodeType !== NODE_TYPE.document || !window.Element) {
|
|
8399
8481
|
// Not running in a browser, provide a factory function
|
|
@@ -8669,7 +8751,7 @@ function requirePurify_cjs () {
|
|
|
8669
8751
|
NAMESPACE = cfg.NAMESPACE || HTML_NAMESPACE;
|
|
8670
8752
|
MATHML_TEXT_INTEGRATION_POINTS = cfg.MATHML_TEXT_INTEGRATION_POINTS || MATHML_TEXT_INTEGRATION_POINTS;
|
|
8671
8753
|
HTML_INTEGRATION_POINTS = cfg.HTML_INTEGRATION_POINTS || HTML_INTEGRATION_POINTS;
|
|
8672
|
-
CUSTOM_ELEMENT_HANDLING = cfg.CUSTOM_ELEMENT_HANDLING ||
|
|
8754
|
+
CUSTOM_ELEMENT_HANDLING = cfg.CUSTOM_ELEMENT_HANDLING || create(null);
|
|
8673
8755
|
if (cfg.CUSTOM_ELEMENT_HANDLING && isRegexOrFunction(cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck)) {
|
|
8674
8756
|
CUSTOM_ELEMENT_HANDLING.tagNameCheck = cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck;
|
|
8675
8757
|
}
|
|
@@ -8709,13 +8791,10 @@ function requirePurify_cjs () {
|
|
|
8709
8791
|
addToSet(ALLOWED_ATTR, xml);
|
|
8710
8792
|
}
|
|
8711
8793
|
}
|
|
8712
|
-
/*
|
|
8713
|
-
|
|
8714
|
-
|
|
8715
|
-
|
|
8716
|
-
if (!objectHasOwnProperty(cfg, 'ADD_ATTR')) {
|
|
8717
|
-
EXTRA_ELEMENT_HANDLING.attributeCheck = null;
|
|
8718
|
-
}
|
|
8794
|
+
/* Always reset function-based ADD_TAGS / ADD_ATTR checks to prevent
|
|
8795
|
+
* leaking across calls when switching from function to array config */
|
|
8796
|
+
EXTRA_ELEMENT_HANDLING.tagCheck = null;
|
|
8797
|
+
EXTRA_ELEMENT_HANDLING.attributeCheck = null;
|
|
8719
8798
|
/* Merge configuration parameters */
|
|
8720
8799
|
if (cfg.ADD_TAGS) {
|
|
8721
8800
|
if (typeof cfg.ADD_TAGS === 'function') {
|
|
@@ -9038,6 +9117,11 @@ function requirePurify_cjs () {
|
|
|
9038
9117
|
_forceRemove(currentNode);
|
|
9039
9118
|
return true;
|
|
9040
9119
|
}
|
|
9120
|
+
/* Remove risky CSS construction leading to mXSS */
|
|
9121
|
+
if (SAFE_FOR_XML && currentNode.namespaceURI === HTML_NAMESPACE && tagName === 'style' && _isNode(currentNode.firstElementChild)) {
|
|
9122
|
+
_forceRemove(currentNode);
|
|
9123
|
+
return true;
|
|
9124
|
+
}
|
|
9041
9125
|
/* Remove any occurrence of processing instructions */
|
|
9042
9126
|
if (currentNode.nodeType === NODE_TYPE.progressingInstruction) {
|
|
9043
9127
|
_forceRemove(currentNode);
|
|
@@ -9049,7 +9133,7 @@ function requirePurify_cjs () {
|
|
|
9049
9133
|
return true;
|
|
9050
9134
|
}
|
|
9051
9135
|
/* Remove element if anything forbids its presence */
|
|
9052
|
-
if (!(EXTRA_ELEMENT_HANDLING.tagCheck instanceof Function && EXTRA_ELEMENT_HANDLING.tagCheck(tagName)) &&
|
|
9136
|
+
if (FORBID_TAGS[tagName] || !(EXTRA_ELEMENT_HANDLING.tagCheck instanceof Function && EXTRA_ELEMENT_HANDLING.tagCheck(tagName)) && !ALLOWED_TAGS[tagName]) {
|
|
9053
9137
|
/* Check if we have a custom element to handle */
|
|
9054
9138
|
if (!FORBID_TAGS[tagName] && _isBasicCustomElement(tagName)) {
|
|
9055
9139
|
if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, tagName)) {
|
|
@@ -9288,7 +9372,7 @@ function requirePurify_cjs () {
|
|
|
9288
9372
|
*
|
|
9289
9373
|
* @param fragment to iterate over recursively
|
|
9290
9374
|
*/
|
|
9291
|
-
const
|
|
9375
|
+
const _sanitizeShadowDOM2 = function _sanitizeShadowDOM(fragment) {
|
|
9292
9376
|
let shadowNode = null;
|
|
9293
9377
|
const shadowIterator = _createNodeIterator(fragment);
|
|
9294
9378
|
/* Execute a hook if present */
|
|
@@ -9302,7 +9386,7 @@ function requirePurify_cjs () {
|
|
|
9302
9386
|
_sanitizeAttributes(shadowNode);
|
|
9303
9387
|
/* Deep shadow DOM detected */
|
|
9304
9388
|
if (shadowNode.content instanceof DocumentFragment) {
|
|
9305
|
-
|
|
9389
|
+
_sanitizeShadowDOM2(shadowNode.content);
|
|
9306
9390
|
}
|
|
9307
9391
|
}
|
|
9308
9392
|
/* Execute a hook if present */
|
|
@@ -9397,7 +9481,7 @@ function requirePurify_cjs () {
|
|
|
9397
9481
|
_sanitizeAttributes(currentNode);
|
|
9398
9482
|
/* Shadow DOM detected, sanitize it */
|
|
9399
9483
|
if (currentNode.content instanceof DocumentFragment) {
|
|
9400
|
-
|
|
9484
|
+
_sanitizeShadowDOM2(currentNode.content);
|
|
9401
9485
|
}
|
|
9402
9486
|
}
|
|
9403
9487
|
/* If we sanitized `dirty` in-place, return it. */
|
|
@@ -9406,6 +9490,14 @@ function requirePurify_cjs () {
|
|
|
9406
9490
|
}
|
|
9407
9491
|
/* Return sanitized string or DOM */
|
|
9408
9492
|
if (RETURN_DOM) {
|
|
9493
|
+
if (SAFE_FOR_TEMPLATES) {
|
|
9494
|
+
body.normalize();
|
|
9495
|
+
let html = body.innerHTML;
|
|
9496
|
+
arrayForEach([MUSTACHE_EXPR, ERB_EXPR, TMPLIT_EXPR], expr => {
|
|
9497
|
+
html = stringReplace(html, expr, ' ');
|
|
9498
|
+
});
|
|
9499
|
+
body.innerHTML = html;
|
|
9500
|
+
}
|
|
9409
9501
|
if (RETURN_DOM_FRAGMENT) {
|
|
9410
9502
|
returnNode = createDocumentFragment.call(body.ownerDocument);
|
|
9411
9503
|
while (body.firstChild) {
|
|
@@ -10238,6 +10330,44 @@ var FlypayWalletService = /*#__PURE__*/function (_WalletService) {
|
|
|
10238
10330
|
}]);
|
|
10239
10331
|
}(WalletService);
|
|
10240
10332
|
|
|
10333
|
+
/**
|
|
10334
|
+
* Maximum Apple Pay JS API version the SDK targets.
|
|
10335
|
+
* Bump this when adopting features from a newer version.
|
|
10336
|
+
*/
|
|
10337
|
+
var APPLE_PAY_MAX_VERSION = 14;
|
|
10338
|
+
/**
|
|
10339
|
+
* Minimum Apple Pay JS API version the SDK can operate with.
|
|
10340
|
+
*
|
|
10341
|
+
* Version 3 (iOS 11 / macOS 10.13) is required because the SDK uses:
|
|
10342
|
+
* - `ApplePayError` constructor
|
|
10343
|
+
* - Object-form `completeShippingContactSelection(update)`
|
|
10344
|
+
* - Object-form `completeShippingMethodSelection(update)`
|
|
10345
|
+
* - `supportedCountries` in payment requests
|
|
10346
|
+
*
|
|
10347
|
+
* All of these were introduced in version 3.
|
|
10348
|
+
*/
|
|
10349
|
+
var APPLE_PAY_MIN_VERSION = 3;
|
|
10350
|
+
/**
|
|
10351
|
+
* Detects the highest Apple Pay JS API version the current device supports,
|
|
10352
|
+
* starting from {@link APPLE_PAY_MAX_VERSION} down to {@link APPLE_PAY_MIN_VERSION}.
|
|
10353
|
+
*
|
|
10354
|
+
* Returns `0` if Apple Pay is not available or the device does not support
|
|
10355
|
+
* the minimum required version.
|
|
10356
|
+
*
|
|
10357
|
+
* @see https://developer.apple.com/documentation/apple_pay_on_the_web/applepaysession/supportsversion
|
|
10358
|
+
*/
|
|
10359
|
+
function getSupportedApplePayVersion() {
|
|
10360
|
+
if (!window.ApplePaySession) {
|
|
10361
|
+
return 0;
|
|
10362
|
+
}
|
|
10363
|
+
for (var v = APPLE_PAY_MAX_VERSION; v >= APPLE_PAY_MIN_VERSION; v--) {
|
|
10364
|
+
if (ApplePaySession.supportsVersion(v)) {
|
|
10365
|
+
return v;
|
|
10366
|
+
}
|
|
10367
|
+
}
|
|
10368
|
+
return 0;
|
|
10369
|
+
}
|
|
10370
|
+
|
|
10241
10371
|
var DEFAULT_APPLE_PAY_CAPABILITIES$2 = ['paymentCredentialsAvailable'];
|
|
10242
10372
|
var AppleWalletService = /*#__PURE__*/function (_WalletService) {
|
|
10243
10373
|
function AppleWalletService(publicKey, meta, gatewayName, eventEmitter) {
|
|
@@ -10567,7 +10697,14 @@ var AppleWalletService = /*#__PURE__*/function (_WalletService) {
|
|
|
10567
10697
|
key: "onApplePayButtonClicked",
|
|
10568
10698
|
value: function onApplePayButtonClicked() {
|
|
10569
10699
|
var _this5 = this;
|
|
10570
|
-
|
|
10700
|
+
var applePayApiVersion = getSupportedApplePayVersion();
|
|
10701
|
+
if (applePayApiVersion === 0) {
|
|
10702
|
+
this.eventEmitter.emit(WALLET_EVENT.UNAVAILABLE, {
|
|
10703
|
+
wallet: WALLET_TYPE.APPLE
|
|
10704
|
+
});
|
|
10705
|
+
return;
|
|
10706
|
+
}
|
|
10707
|
+
this.paymentSession = new ApplePaySession(applePayApiVersion, this.createRequest());
|
|
10571
10708
|
this.paymentSession.onvalidatemerchant = this.onValidateMerchant;
|
|
10572
10709
|
this.paymentSession.onpaymentauthorized = this.onPaymentAuthorized;
|
|
10573
10710
|
this.paymentSession.oncancel = this.onCancelPayment;
|
|
@@ -12728,28 +12865,59 @@ function getHandleCvv(configuration) {
|
|
|
12728
12865
|
}
|
|
12729
12866
|
}
|
|
12730
12867
|
|
|
12868
|
+
/**
|
|
12869
|
+
* Top-level classification of an error. Used by the SDK to route errors to the
|
|
12870
|
+
* right category in instrumentation and to give consumers a coarse-grained
|
|
12871
|
+
* tag for grouping/filtering. See {@link getErrorCategory} for the mapping
|
|
12872
|
+
* between {@link ERROR_CAUSE} and {@link ERROR_CATEGORY}.
|
|
12873
|
+
*/
|
|
12731
12874
|
var ERROR_CATEGORY = {
|
|
12875
|
+
/** SDK was misconfigured (missing keys, invalid options, etc.). */
|
|
12732
12876
|
CONFIGURATION: 'configuration',
|
|
12877
|
+
/** Authentication or authorization failure. */
|
|
12733
12878
|
IDENTITY: 'identity_access_management',
|
|
12879
|
+
/** SDK internal failure or upstream service problem. */
|
|
12734
12880
|
INTERNAL: 'internal',
|
|
12881
|
+
/** Flow lifecycle event (user cancelled, aborted, etc.) — not a real fault. */
|
|
12735
12882
|
PROCESS: 'process',
|
|
12883
|
+
/** Resource lookup failed or was rate-limited. */
|
|
12736
12884
|
RESOURCE: 'resource',
|
|
12885
|
+
/** Invalid input or business-rule validation failure. */
|
|
12737
12886
|
VALIDATION: 'validation'
|
|
12738
12887
|
};
|
|
12888
|
+
/**
|
|
12889
|
+
* Concrete cause of an error. More specific than {@link ERROR_CATEGORY} —
|
|
12890
|
+
* useful for deciding programmatic responses (e.g. show a retry button only
|
|
12891
|
+
* when `cause` is `'service_unreachable'` or `'server_busy'`).
|
|
12892
|
+
*/
|
|
12739
12893
|
var ERROR_CAUSE = {
|
|
12894
|
+
/** Operation was aborted programmatically. */
|
|
12740
12895
|
ABORTED: 'aborted',
|
|
12896
|
+
/** Caller has insufficient permissions for the operation. */
|
|
12741
12897
|
ACCESS_FORBIDDEN: 'access_forbidden',
|
|
12898
|
+
/** Resource already exists when create was expected. */
|
|
12742
12899
|
ALREADY_EXISTS: 'already_exists',
|
|
12900
|
+
/** User cancelled the flow (e.g. closed the wallet sheet). */
|
|
12743
12901
|
CANCELED: 'canceled',
|
|
12902
|
+
/** SDK was instantiated or invoked with invalid configuration. */
|
|
12744
12903
|
INVALID_CONFIGURATION: 'invalid_configuration',
|
|
12904
|
+
/** Input failed structural or business-rule validation. */
|
|
12745
12905
|
INVALID_INPUT: 'invalid_input',
|
|
12906
|
+
/** Resource was not found by the backend. */
|
|
12746
12907
|
NOT_FOUND: 'not_found',
|
|
12908
|
+
/** Operation is not supported in the current context or version. */
|
|
12747
12909
|
NOT_IMPLEMENTED: 'not_implemented',
|
|
12910
|
+
/** Caller exceeded the allowed request rate. */
|
|
12748
12911
|
RATE_LIMITED: 'rate_limited',
|
|
12912
|
+
/** Backend is healthy but currently overloaded — typically retryable. */
|
|
12749
12913
|
SERVER_BUSY: 'server_busy',
|
|
12914
|
+
/** Backend or third-party service could not be reached — typically retryable. */
|
|
12750
12915
|
SERVICE_UNREACHABLE: 'service_unreachable',
|
|
12916
|
+
/** Caller is not authenticated. */
|
|
12751
12917
|
UNAUTHORIZED: 'unauthorized',
|
|
12918
|
+
/** Catch-all when no other cause applies. */
|
|
12752
12919
|
UNKNOWN: 'unknown_error',
|
|
12920
|
+
/** Request was syntactically valid but semantically rejected. */
|
|
12753
12921
|
UNPROCESSABLE_ENTITY: 'unprocessable_entity'
|
|
12754
12922
|
};
|
|
12755
12923
|
var EventError = /*#__PURE__*/function (_Error) {
|
|
@@ -14809,7 +14977,6 @@ var InstructionCanvas3dsShow$1 = /*#__PURE__*/function (_InstructionHandler) {
|
|
|
14809
14977
|
});
|
|
14810
14978
|
canvas.on('chargeAuthReject', function () {
|
|
14811
14979
|
var _a;
|
|
14812
|
-
// **TODO add interface for chargeAuthReject event **//
|
|
14813
14980
|
(_a = _this.checkoutWidget) === null || _a === void 0 ? void 0 : _a.fetchInstruction();
|
|
14814
14981
|
_this.api.checkout().callback({
|
|
14815
14982
|
event: 'callback.child_widget.status',
|
|
@@ -14826,13 +14993,13 @@ var InstructionCanvas3dsShow$1 = /*#__PURE__*/function (_InstructionHandler) {
|
|
|
14826
14993
|
});
|
|
14827
14994
|
canvas.on('error', function (event) {
|
|
14828
14995
|
var _a;
|
|
14829
|
-
// **TODO add interface for error event **//
|
|
14830
14996
|
(_a = _this.checkoutWidget) === null || _a === void 0 ? void 0 : _a.fetchInstruction();
|
|
14997
|
+
var message = (event && _typeof$1(event) === 'object' && 'event' in event ? event.event : null) || 'error in 3ds widget';
|
|
14831
14998
|
_this.api.checkout().callback({
|
|
14832
14999
|
event: 'callback.child_widget.status',
|
|
14833
15000
|
payload: {
|
|
14834
15001
|
status: 'error',
|
|
14835
|
-
message:
|
|
15002
|
+
message: message
|
|
14836
15003
|
}
|
|
14837
15004
|
}).then(function () {
|
|
14838
15005
|
return console.info('callback.child_widget.status: - errorEvent');
|
|
@@ -17200,7 +17367,6 @@ var InstructionCanvas3dsShow = /*#__PURE__*/function (_InstructionHandler) {
|
|
|
17200
17367
|
});
|
|
17201
17368
|
canvas.on('chargeAuthReject', function () {
|
|
17202
17369
|
var _a;
|
|
17203
|
-
// **TODO add interface for chargeAuthReject event **//
|
|
17204
17370
|
(_a = _this.checkoutWidget) === null || _a === void 0 ? void 0 : _a.fetchInstruction();
|
|
17205
17371
|
_this.api.checkout().callback({
|
|
17206
17372
|
event: 'callback.child_widget.status',
|
|
@@ -17217,13 +17383,13 @@ var InstructionCanvas3dsShow = /*#__PURE__*/function (_InstructionHandler) {
|
|
|
17217
17383
|
});
|
|
17218
17384
|
canvas.on('error', function (event) {
|
|
17219
17385
|
var _a;
|
|
17220
|
-
// **TODO add interface for error event **//
|
|
17221
17386
|
(_a = _this.checkoutWidget) === null || _a === void 0 ? void 0 : _a.fetchInstruction();
|
|
17387
|
+
var message = (event && _typeof$1(event) === 'object' && 'event' in event ? event.event : null) || 'error in 3ds widget';
|
|
17222
17388
|
_this.api.checkout().callback({
|
|
17223
17389
|
event: 'callback.child_widget.status',
|
|
17224
17390
|
payload: {
|
|
17225
17391
|
status: 'error',
|
|
17226
|
-
message:
|
|
17392
|
+
message: message
|
|
17227
17393
|
}
|
|
17228
17394
|
}).then(function () {
|
|
17229
17395
|
return console.info('callback.child_widget.status: - errorEvent');
|
|
@@ -18590,10 +18756,16 @@ function getCheckoutVersionHandler(version) {
|
|
|
18590
18756
|
}
|
|
18591
18757
|
}
|
|
18592
18758
|
|
|
18759
|
+
/** Event name emitted when a checkout payment completes successfully. */
|
|
18760
|
+
var PAYMENT_SUCCESSFUL = 'paymentSuccessful';
|
|
18761
|
+
/** Event name emitted when a checkout payment fails. */
|
|
18762
|
+
var PAYMENT_FAILURE = 'paymentFailure';
|
|
18763
|
+
/** Event name emitted when a checkout session expires. */
|
|
18764
|
+
var PAYMENT_EXPIRED = 'paymentExpired';
|
|
18593
18765
|
var EVENT$3 = {
|
|
18594
|
-
PAYMENT_SUCCESSFUL:
|
|
18595
|
-
PAYMENT_FAILURE:
|
|
18596
|
-
PAYMENT_EXPIRED:
|
|
18766
|
+
PAYMENT_SUCCESSFUL: PAYMENT_SUCCESSFUL,
|
|
18767
|
+
PAYMENT_FAILURE: PAYMENT_FAILURE,
|
|
18768
|
+
PAYMENT_EXPIRED: PAYMENT_EXPIRED
|
|
18597
18769
|
};
|
|
18598
18770
|
/**
|
|
18599
18771
|
* Class CheckoutButton transform usual button into checkout
|
|
@@ -18618,7 +18790,7 @@ var Checkout = /*#__PURE__*/function () {
|
|
|
18618
18790
|
this.checkoutFinished = false;
|
|
18619
18791
|
try {
|
|
18620
18792
|
this.eventEmitter = new EventEmitter();
|
|
18621
|
-
this.intentTokenPayload = this.
|
|
18793
|
+
this.intentTokenPayload = this.extractCheckoutIntentTokenPayload(intentToken);
|
|
18622
18794
|
this.checkoutVersionHandler = getCheckoutVersionHandler(this.intentTokenPayload.version);
|
|
18623
18795
|
this.instructions = this.initContractVersion();
|
|
18624
18796
|
this.api = new ApiInternal(this.intentToken, API_AUTH_TYPE.TOKEN);
|
|
@@ -18679,8 +18851,8 @@ var Checkout = /*#__PURE__*/function () {
|
|
|
18679
18851
|
}, 14 * 60 * 1000 + 45 * 1000);
|
|
18680
18852
|
}
|
|
18681
18853
|
}, {
|
|
18682
|
-
key: "
|
|
18683
|
-
value: function
|
|
18854
|
+
key: "extractCheckoutIntentTokenPayload",
|
|
18855
|
+
value: function extractCheckoutIntentTokenPayload(intentToken) {
|
|
18684
18856
|
var tokenContent = AccessToken.validateJWT(intentToken);
|
|
18685
18857
|
if (!tokenContent) {
|
|
18686
18858
|
throw new Error('Intent token is broken or expired. Please, issue new one.');
|
|
@@ -18708,7 +18880,7 @@ var Checkout = /*#__PURE__*/function () {
|
|
|
18708
18880
|
value: function ready() {
|
|
18709
18881
|
var _this3 = this;
|
|
18710
18882
|
this.changeLoadingSpinnerVisibility(true);
|
|
18711
|
-
// biome-ignore lint/suspicious/noExplicitAny:
|
|
18883
|
+
// biome-ignore lint/suspicious/noExplicitAny: checkoutApi.status returns a dynamic shape whose fields are narrowed at the call-sites below
|
|
18712
18884
|
this.checkoutApi.status(this.intentTokenPayload.intent_id).then(function (response) {
|
|
18713
18885
|
if (!(response === null || response === void 0 ? void 0 : response.status)) {
|
|
18714
18886
|
throw new Error('Checkout Intent Status structure inconsistent');
|
|
@@ -18817,8 +18989,8 @@ var Checkout = /*#__PURE__*/function () {
|
|
|
18817
18989
|
* Important: Do not perform thread blocking operations in callback such as window.alert() calls.
|
|
18818
18990
|
*
|
|
18819
18991
|
* @example
|
|
18820
|
-
* widget.
|
|
18821
|
-
* console.log('Payment
|
|
18992
|
+
* widget.onPaymentExpired((data) => {
|
|
18993
|
+
* console.log('Payment session expired');
|
|
18822
18994
|
* });
|
|
18823
18995
|
*/
|
|
18824
18996
|
}, {
|
|
@@ -18939,7 +19111,15 @@ var OpenWalletButtons = /*#__PURE__*/function () {
|
|
|
18939
19111
|
function OpenWalletButtons(selector, publicKeyOrAccessToken, serviceId, meta) {
|
|
18940
19112
|
_classCallCheck(this, OpenWalletButtons);
|
|
18941
19113
|
this.env = DEFAULT_ENV;
|
|
19114
|
+
this.isDisabled = false;
|
|
18942
19115
|
this.onShippingOptionsChangeHandlerRegistered = false;
|
|
19116
|
+
// Runtime guard: TypeScript's `abstract` keyword exists only at compile time.
|
|
19117
|
+
// Without this check, instantiating the base class directly silently fails
|
|
19118
|
+
// later when `this.validateWalletMeta()` resolves to `undefined`, producing
|
|
19119
|
+
// a confusing "is not a function" error far from the actual mistake.
|
|
19120
|
+
if ((this instanceof OpenWalletButtons ? this.constructor : void 0) === OpenWalletButtons) {
|
|
19121
|
+
throw new Error('OpenWalletButtons is an abstract base class and cannot be instantiated directly. ' + 'Use ApplePayOpenWalletButton or GooglePayOpenWalletButton instead.');
|
|
19122
|
+
}
|
|
18943
19123
|
this.eventEmitter = new EventEmitter();
|
|
18944
19124
|
this.container = new Container(selector);
|
|
18945
19125
|
this.api = new ApiInternal(publicKeyOrAccessToken, this.getApiAuthType(publicKeyOrAccessToken));
|
|
@@ -19076,6 +19256,68 @@ var OpenWalletButtons = /*#__PURE__*/function () {
|
|
|
19076
19256
|
_this.handleOnError(error instanceof Error ? error : new Error(String(error)), ERROR_OPERATION.CONFIGURATION);
|
|
19077
19257
|
});
|
|
19078
19258
|
}
|
|
19259
|
+
/**
|
|
19260
|
+
* Enables the wallet button, restoring interactivity and visual appearance.
|
|
19261
|
+
* If the button was previously disabled via `disable()`, calling this method
|
|
19262
|
+
* re-enables clicks and removes the disabled visual state.
|
|
19263
|
+
*
|
|
19264
|
+
* Idempotent — calling on an already-enabled button has no effect.
|
|
19265
|
+
*
|
|
19266
|
+
* @example
|
|
19267
|
+
* button.enable();
|
|
19268
|
+
*/
|
|
19269
|
+
}, {
|
|
19270
|
+
key: "enable",
|
|
19271
|
+
value: function enable() {
|
|
19272
|
+
this.isDisabled = false;
|
|
19273
|
+
this.applyDisabledStyles();
|
|
19274
|
+
}
|
|
19275
|
+
/**
|
|
19276
|
+
* Disables the wallet button, preventing clicks and applying a visual disabled state.
|
|
19277
|
+
* When disabled, the button appears grayed out (`opacity: 0.5`) and does not
|
|
19278
|
+
* respond to user interaction (`pointer-events: none`). For accessibility, the
|
|
19279
|
+
* `aria-disabled="true"` attribute is also set on the container.
|
|
19280
|
+
*
|
|
19281
|
+
* Programmatic clicks (e.g. invoked by the wallet provider's SDK) are blocked
|
|
19282
|
+
* by an explicit guard inside the click handler — the button's wallet service
|
|
19283
|
+
* checks the disabled state before processing.
|
|
19284
|
+
*
|
|
19285
|
+
* Idempotent — calling on an already-disabled button has no effect.
|
|
19286
|
+
* Safe to call before `load()` (no-throw); the styles are applied once the
|
|
19287
|
+
* container element exists.
|
|
19288
|
+
*
|
|
19289
|
+
* @example
|
|
19290
|
+
* button.disable();
|
|
19291
|
+
*/
|
|
19292
|
+
}, {
|
|
19293
|
+
key: "disable",
|
|
19294
|
+
value: function disable() {
|
|
19295
|
+
this.isDisabled = true;
|
|
19296
|
+
this.applyDisabledStyles();
|
|
19297
|
+
}
|
|
19298
|
+
/**
|
|
19299
|
+
* Applies the disabled / enabled visual state to the container element.
|
|
19300
|
+
* Reads `this.isDisabled` and toggles the corresponding CSS + ARIA attributes.
|
|
19301
|
+
*
|
|
19302
|
+
* @private
|
|
19303
|
+
*/
|
|
19304
|
+
}, {
|
|
19305
|
+
key: "applyDisabledStyles",
|
|
19306
|
+
value: function applyDisabledStyles() {
|
|
19307
|
+
var element = this.container.getElement();
|
|
19308
|
+
if (!element) {
|
|
19309
|
+
return;
|
|
19310
|
+
}
|
|
19311
|
+
if (this.isDisabled) {
|
|
19312
|
+
element.style.pointerEvents = 'none';
|
|
19313
|
+
element.style.opacity = '0.5';
|
|
19314
|
+
element.setAttribute('aria-disabled', 'true');
|
|
19315
|
+
} else {
|
|
19316
|
+
element.style.pointerEvents = '';
|
|
19317
|
+
element.style.opacity = '';
|
|
19318
|
+
element.removeAttribute('aria-disabled');
|
|
19319
|
+
}
|
|
19320
|
+
}
|
|
19079
19321
|
/**
|
|
19080
19322
|
* Current method can change environment. By default environment = sandbox.
|
|
19081
19323
|
* Also we can change domain alias for this environment. By default domain_alias = paydock.com
|
|
@@ -19565,7 +19807,9 @@ var SERVICE_GROUP;
|
|
|
19565
19807
|
* Returns `undefined` if the resulting object has no remaining properties.
|
|
19566
19808
|
*/
|
|
19567
19809
|
function stripEmpty(obj) {
|
|
19568
|
-
if (!obj || _typeof$1(obj) !== 'object')
|
|
19810
|
+
if (!obj || _typeof$1(obj) !== 'object') {
|
|
19811
|
+
return undefined;
|
|
19812
|
+
}
|
|
19569
19813
|
var result = {};
|
|
19570
19814
|
for (var _i = 0, _Object$entries = Object.entries(obj); _i < _Object$entries.length; _i++) {
|
|
19571
19815
|
var _Object$entries$_i = _slicedToArray(_Object$entries[_i], 2),
|
|
@@ -19614,13 +19858,30 @@ var OpenWalletService = /*#__PURE__*/function () {
|
|
|
19614
19858
|
this.serviceGroup = SERVICE_GROUP.WALLET;
|
|
19615
19859
|
}
|
|
19616
19860
|
/**
|
|
19617
|
-
*
|
|
19618
|
-
*
|
|
19861
|
+
* Returns whether the wallet button is currently disabled.
|
|
19862
|
+
* Reads the `aria-disabled` attribute from the container element — set by the
|
|
19863
|
+
* button class via {@link OpenWalletButtons.disable} / {@link OpenWalletButtons.enable}.
|
|
19864
|
+
*
|
|
19865
|
+
* Used to short-circuit click handlers in concrete wallet services for clicks
|
|
19866
|
+
* that bypass the DOM `pointer-events: none` guard (e.g. invoked by the wallet
|
|
19867
|
+
* provider's SDK callback).
|
|
19619
19868
|
*
|
|
19620
|
-
* @
|
|
19621
|
-
* @returns A promise resolving to the OTT response.
|
|
19869
|
+
* @returns `true` if the container is marked as disabled, `false` otherwise.
|
|
19622
19870
|
*/
|
|
19623
19871
|
return _createClass(OpenWalletService, [{
|
|
19872
|
+
key: "isButtonDisabled",
|
|
19873
|
+
value: function isButtonDisabled() {
|
|
19874
|
+
var element = this.container.getElement();
|
|
19875
|
+
return (element === null || element === void 0 ? void 0 : element.getAttribute('aria-disabled')) === 'true';
|
|
19876
|
+
}
|
|
19877
|
+
/**
|
|
19878
|
+
* Creates a One-Time Token (OTT) by sending the payment data to the API.
|
|
19879
|
+
* Emits {@link EVENT.SUCCESS} on success or {@link EVENT.ERROR} on failure.
|
|
19880
|
+
*
|
|
19881
|
+
* @param data - The payment data including amount, shipping, billing, card info, and ref token.
|
|
19882
|
+
* @returns A promise resolving to the OTT response.
|
|
19883
|
+
*/
|
|
19884
|
+
}, {
|
|
19624
19885
|
key: "createOTT",
|
|
19625
19886
|
value: function createOTT(data) {
|
|
19626
19887
|
var _this = this;
|
|
@@ -20141,7 +20402,15 @@ var ApplePayOpenWalletService = /*#__PURE__*/function (_OpenWalletService) {
|
|
|
20141
20402
|
key: "onApplePayButtonClicked",
|
|
20142
20403
|
value: function onApplePayButtonClicked() {
|
|
20143
20404
|
var _this7 = this;
|
|
20144
|
-
|
|
20405
|
+
if (this.isButtonDisabled()) {
|
|
20406
|
+
return;
|
|
20407
|
+
}
|
|
20408
|
+
var applePayApiVersion = getSupportedApplePayVersion();
|
|
20409
|
+
if (applePayApiVersion === 0) {
|
|
20410
|
+
this.handleOnUnavailable('Apple Pay version not supported');
|
|
20411
|
+
return;
|
|
20412
|
+
}
|
|
20413
|
+
this.paymentSession = new ApplePaySession(applePayApiVersion, this.mapMetaToApplePayPaymentRequest());
|
|
20145
20414
|
this.paymentSession.onvalidatemerchant = this.onValidateMerchant;
|
|
20146
20415
|
this.paymentSession.onpaymentauthorized = this.onPaymentAuthorized;
|
|
20147
20416
|
this.paymentSession.oncancel = this.onCancelPayment;
|
|
@@ -20886,6 +21155,9 @@ var GooglePayOpenWalletService = /*#__PURE__*/function (_OpenWalletService) {
|
|
|
20886
21155
|
key: "onGooglePayButtonClicked",
|
|
20887
21156
|
value: function onGooglePayButtonClicked() {
|
|
20888
21157
|
var _this5 = this;
|
|
21158
|
+
if (this.isButtonDisabled()) {
|
|
21159
|
+
return;
|
|
21160
|
+
}
|
|
20889
21161
|
if (this.processingButtonClick) {
|
|
20890
21162
|
console.warn('Google Pay button clicked while processing.');
|
|
20891
21163
|
return;
|
|
@@ -22999,6 +23271,7 @@ var BaseWalletButton = /*#__PURE__*/function () {
|
|
|
22999
23271
|
function BaseWalletButton(selector, publicKeyOrAccessToken, gatewayId, meta, requiredMetaFields) {
|
|
23000
23272
|
_classCallCheck(this, BaseWalletButton);
|
|
23001
23273
|
this.env = DEFAULT_ENV;
|
|
23274
|
+
this.isDisabled = false;
|
|
23002
23275
|
this.onShippingOptionsChangeHandlerRegistered = false;
|
|
23003
23276
|
this.eventEmitter = new EventEmitter();
|
|
23004
23277
|
this.container = new Container(selector);
|
|
@@ -23031,6 +23304,30 @@ var BaseWalletButton = /*#__PURE__*/function () {
|
|
|
23031
23304
|
this.env = env;
|
|
23032
23305
|
this.api.setEnv(env, alias);
|
|
23033
23306
|
}
|
|
23307
|
+
/**
|
|
23308
|
+
* Enables the wallet button, restoring interactivity and visual appearance.
|
|
23309
|
+
*
|
|
23310
|
+
* @example
|
|
23311
|
+
* button.enable();
|
|
23312
|
+
*/
|
|
23313
|
+
}, {
|
|
23314
|
+
key: "enable",
|
|
23315
|
+
value: function enable() {
|
|
23316
|
+
this.isDisabled = false;
|
|
23317
|
+
this.applyDisabledStyles();
|
|
23318
|
+
}
|
|
23319
|
+
/**
|
|
23320
|
+
* Disables the wallet button, preventing clicks and applying a visual disabled state.
|
|
23321
|
+
*
|
|
23322
|
+
* @example
|
|
23323
|
+
* button.disable();
|
|
23324
|
+
*/
|
|
23325
|
+
}, {
|
|
23326
|
+
key: "disable",
|
|
23327
|
+
value: function disable() {
|
|
23328
|
+
this.isDisabled = true;
|
|
23329
|
+
this.applyDisabledStyles();
|
|
23330
|
+
}
|
|
23034
23331
|
/**
|
|
23035
23332
|
* Callback for onClick method.
|
|
23036
23333
|
*
|
|
@@ -23495,6 +23792,23 @@ var BaseWalletButton = /*#__PURE__*/function () {
|
|
|
23495
23792
|
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)
|
|
23496
23793
|
};
|
|
23497
23794
|
}
|
|
23795
|
+
}, {
|
|
23796
|
+
key: "applyDisabledStyles",
|
|
23797
|
+
value: function applyDisabledStyles() {
|
|
23798
|
+
var element = this.container.getElement();
|
|
23799
|
+
if (!element) {
|
|
23800
|
+
return;
|
|
23801
|
+
}
|
|
23802
|
+
if (this.isDisabled) {
|
|
23803
|
+
element.style.pointerEvents = 'none';
|
|
23804
|
+
element.style.opacity = '0.5';
|
|
23805
|
+
element.setAttribute('aria-disabled', 'true');
|
|
23806
|
+
} else {
|
|
23807
|
+
element.style.pointerEvents = '';
|
|
23808
|
+
element.style.opacity = '';
|
|
23809
|
+
element.removeAttribute('aria-disabled');
|
|
23810
|
+
}
|
|
23811
|
+
}
|
|
23498
23812
|
}, {
|
|
23499
23813
|
key: "validateRequiredMetaFields",
|
|
23500
23814
|
value: function validateRequiredMetaFields(requiredMetaFields) {
|
|
@@ -23566,7 +23880,14 @@ var ApplePayWalletButtonExpress = /*#__PURE__*/function (_BaseWalletButton) {
|
|
|
23566
23880
|
_classCallCheck(this, ApplePayWalletButtonExpress);
|
|
23567
23881
|
_this = _callSuper(this, ApplePayWalletButtonExpress, [selector, publicKeyOrAccessToken, gatewayId, meta, ['amount_label', 'country']]);
|
|
23568
23882
|
_this.onApplePayButtonClicked = function () {
|
|
23569
|
-
|
|
23883
|
+
if (_this.isDisabled) {
|
|
23884
|
+
return;
|
|
23885
|
+
}
|
|
23886
|
+
var applePayApiVersion = getSupportedApplePayVersion();
|
|
23887
|
+
if (applePayApiVersion === 0) {
|
|
23888
|
+
_this.handleOnUnavailable();
|
|
23889
|
+
return;
|
|
23890
|
+
}
|
|
23570
23891
|
_this.paymentSession = new ApplePaySession(applePayApiVersion, _this.createRequest());
|
|
23571
23892
|
_this.paymentSession.onvalidatemerchant = _this.onValidateMerchant;
|
|
23572
23893
|
_this.paymentSession.onpaymentauthorized = _this.onPaymentAuthorized;
|
|
@@ -23844,6 +24165,7 @@ var ApplePayWalletButtonExpress = /*#__PURE__*/function (_BaseWalletButton) {
|
|
|
23844
24165
|
return;
|
|
23845
24166
|
}
|
|
23846
24167
|
applePayButton.addEventListener('click', this.onApplePayButtonClicked.bind(this));
|
|
24168
|
+
this.applyDisabledStyles();
|
|
23847
24169
|
}
|
|
23848
24170
|
}, {
|
|
23849
24171
|
key: "createRequest",
|
|
@@ -24036,13 +24358,20 @@ var PaypalWalletButtonExpress = /*#__PURE__*/function (_BaseWalletButton) {
|
|
|
24036
24358
|
key: "load",
|
|
24037
24359
|
value: function load() {
|
|
24038
24360
|
var _this2 = this;
|
|
24039
|
-
if (!window.Promise)
|
|
24361
|
+
if (!window.Promise) {
|
|
24362
|
+
return this.handleOnUnavailable();
|
|
24363
|
+
}
|
|
24040
24364
|
this.getGatewayWalletConfig().then(function (config) {
|
|
24041
|
-
if (!config || config.type !== 'Paypal' || !config.credentials || !config.credentials.client_auth)
|
|
24365
|
+
if (!config || config.type !== 'Paypal' || !config.credentials || !config.credentials.client_auth) {
|
|
24366
|
+
throw new Error('Invalid configuration');
|
|
24367
|
+
}
|
|
24042
24368
|
_this2.config = config;
|
|
24043
24369
|
_this2.renderPaypalButton();
|
|
24370
|
+
_this2.applyDisabledStyles();
|
|
24044
24371
|
})["catch"](function (err) {
|
|
24045
|
-
if (err)
|
|
24372
|
+
if (err) {
|
|
24373
|
+
_this2.handleOnError(err);
|
|
24374
|
+
}
|
|
24046
24375
|
_this2.handleOnUnavailable();
|
|
24047
24376
|
});
|
|
24048
24377
|
}
|
|
@@ -24059,6 +24388,7 @@ var PaypalWalletButtonExpress = /*#__PURE__*/function (_BaseWalletButton) {
|
|
|
24059
24388
|
value: function setMeta(meta) {
|
|
24060
24389
|
this.meta = meta;
|
|
24061
24390
|
this.renderPaypalButton();
|
|
24391
|
+
this.applyDisabledStyles();
|
|
24062
24392
|
}
|
|
24063
24393
|
}, {
|
|
24064
24394
|
key: "renderPaypalButton",
|
|
@@ -24075,7 +24405,7 @@ var PaypalWalletButtonExpress = /*#__PURE__*/function (_BaseWalletButton) {
|
|
|
24075
24405
|
var _this3 = this;
|
|
24076
24406
|
var _a, _b;
|
|
24077
24407
|
var buttonId = ((_a = this.container.getElement()) === null || _a === void 0 ? void 0 : _a.id) || '';
|
|
24078
|
-
var paypalScript = document.createElement(
|
|
24408
|
+
var paypalScript = document.createElement('script');
|
|
24079
24409
|
paypalScript.src = "https://www.paypal.com/sdk/js?client-id=".concat((_b = this.config.credentials) === null || _b === void 0 ? void 0 : _b.client_auth, "¤cy=").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' : '');
|
|
24080
24410
|
paypalScript.async = true;
|
|
24081
24411
|
paypalScript.onload = function () {
|
|
@@ -24094,7 +24424,7 @@ var PaypalWalletButtonExpress = /*#__PURE__*/function (_BaseWalletButton) {
|
|
|
24094
24424
|
var _this4 = this;
|
|
24095
24425
|
var _a, _b, _c;
|
|
24096
24426
|
var buttonId = ((_a = this.container.getElement()) === null || _a === void 0 ? void 0 : _a.id) || '';
|
|
24097
|
-
var paypalScript = document.createElement(
|
|
24427
|
+
var paypalScript = document.createElement('script');
|
|
24098
24428
|
// 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
|
|
24099
24429
|
paypalScript.src = "https://www.paypal.com/sdk/js?client-id=".concat((_b = this.config.credentials) === null || _b === void 0 ? void 0 : _b.client_auth, "¤cy=").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');
|
|
24100
24430
|
paypalScript.async = true;
|
|
@@ -24135,6 +24465,9 @@ var PaypalWalletButtonExpress = /*#__PURE__*/function (_BaseWalletButton) {
|
|
|
24135
24465
|
style: this.meta.style
|
|
24136
24466
|
}), {
|
|
24137
24467
|
onClick: function onClick(_data, actions) {
|
|
24468
|
+
if (_this5.isDisabled) {
|
|
24469
|
+
return actions.reject();
|
|
24470
|
+
}
|
|
24138
24471
|
return _this5.handleMerchantOnExpressButtonClickEvent().then(function () {
|
|
24139
24472
|
return actions.resolve();
|
|
24140
24473
|
})["catch"](function () {
|
|
@@ -24145,7 +24478,9 @@ var PaypalWalletButtonExpress = /*#__PURE__*/function (_BaseWalletButton) {
|
|
|
24145
24478
|
createOrder: function createOrder() {
|
|
24146
24479
|
return new Promise(function (resolve, reject) {
|
|
24147
24480
|
var _a, _b;
|
|
24148
|
-
if (!_this5.api.auth)
|
|
24481
|
+
if (!_this5.api.auth) {
|
|
24482
|
+
return reject(new Error('Wallet Token not injected. Please handle onClick correctly.'));
|
|
24483
|
+
}
|
|
24149
24484
|
var shipping = (_b = (_a = _this5.chargeWalletTokenMeta) === null || _a === void 0 ? void 0 : _a.charge) === null || _b === void 0 ? void 0 : _b.shipping;
|
|
24150
24485
|
if (shipping) {
|
|
24151
24486
|
var hasCompleteShippingAddress = ['address_line1', 'address_city', 'address_country', 'address_state', 'address_postcode'].every(function (key) {
|
|
@@ -24164,7 +24499,9 @@ var PaypalWalletButtonExpress = /*#__PURE__*/function (_BaseWalletButton) {
|
|
|
24164
24499
|
});
|
|
24165
24500
|
},
|
|
24166
24501
|
onApprove: function onApprove(data) {
|
|
24167
|
-
if (_this5.pendingApprovalPromise)
|
|
24502
|
+
if (_this5.pendingApprovalPromise) {
|
|
24503
|
+
return _this5.pendingApprovalPromise;
|
|
24504
|
+
}
|
|
24168
24505
|
_this5.pendingApprovalPromise = _this5.executeWalletCapture({
|
|
24169
24506
|
payment_method_id: data.orderID,
|
|
24170
24507
|
customer: {
|
|
@@ -44342,4 +44679,4 @@ var browser = /*#__PURE__*/Object.freeze({
|
|
|
44342
44679
|
zlibSync: zlibSync
|
|
44343
44680
|
});
|
|
44344
44681
|
|
|
44345
|
-
export { AfterpayCheckoutButton, AfterpayOnSiteMessaging, Api, ApplePayOpenWalletButton, ApplePayWalletButtonExpress, CHECKOUT_BUTTON_EVENT, Canvas3ds, Checkout, ClickToPay, Configuration, ELEMENT, ERROR_OPERATION, EVENT$5 as EVENT, Builder$1 as ExternalCheckoutBuilder, Checker as ExternalCheckoutChecker, FORM_FIELD$1 as FORM_FIELD, FRAUD_PREVENTION_EVENTS, FraudPreventionService, GooglePayOpenWalletButton, HtmlMultiWidget, HtmlPaymentSourceWidget, HtmlWidget, InstructionDebugger, MultiWidget,
|
|
44682
|
+
export { AfterpayCheckoutButton, AfterpayOnSiteMessaging, Api, ApplePayOpenWalletButton, ApplePayWalletButtonExpress, CANVAS_3DS_EVENT, CHECKOUT_BUTTON_EVENT, EVENT$3 as CHECKOUT_EVENT, Canvas3ds, Canvas3dsTokenFormat, Checkout, ClickToPay, Configuration, ContactShippingEditingMode, ELEMENT, ERROR_OPERATION, EVENT$5 as EVENT, Builder$1 as ExternalCheckoutBuilder, Checker as ExternalCheckoutChecker, FORM_FIELD$1 as FORM_FIELD, FRAUD_PREVENTION_EVENTS, FraudPreventionService, GooglePayOpenWalletButton, HtmlMultiWidget, HtmlPaymentSourceWidget, HtmlWidget, InstructionDebugger, MultiWidget, PAYMENT_EXPIRED, PAYMENT_FAILURE, PAYMENT_SUCCESSFUL, PAYMENT_TYPE, PURPOSE, PayPalDataCollector, PayPalSavePaymentSourceWidget, Builder as PaymentSourceBuilder, PaymentSourceWidget, PaypalCheckoutButton, PaypalWalletButtonExpress, STYLABLE_ELEMENT, STYLABLE_ELEMENT_STATE, STYLE$2 as STYLE, SUPPORTED_CARD_TYPES, TEXT, TOKEN_TYPE, TRIGGER$1 as TRIGGER, TYPE, VAULT_DISPLAY_STYLE, VaultDisplayWidget, EVENT as WALLET_BUTTONS_EXPRESS_EVENT, WALLET_TYPES, WalletButtons, ZipmoneyCheckoutButton };
|