@paydock/client-sdk 1.138.1 → 1.139.0
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 +24 -9
- package/bundles/index.cjs +194 -164
- package/bundles/index.cjs.d.ts +13 -2
- package/bundles/index.mjs +194 -164
- package/bundles/index.mjs.d.ts +13 -2
- package/bundles/types/checkout/v3/instructions/instruction.card_form.show.d.ts.map +1 -1
- package/bundles/types/checkout/v3/utils/checkout-customisation-styles.util.d.ts.map +1 -1
- package/bundles/types/components/iframe.d.ts +2 -0
- package/bundles/types/components/iframe.d.ts.map +1 -1
- package/bundles/types/helper/browser.d.ts +1 -0
- package/bundles/types/helper/browser.d.ts.map +1 -1
- package/bundles/types/paypal-data-collector/paypal-data-collector.d.ts +12 -3
- package/bundles/types/paypal-data-collector/paypal-data-collector.d.ts.map +1 -1
- package/bundles/types/paypal-data-collector/paypal-data-collector.service.d.ts +6 -5
- package/bundles/types/paypal-data-collector/paypal-data-collector.service.d.ts.map +1 -1
- package/bundles/types/secure-remote-commerce/providers/mastercard-src/mastercard-src.d.ts.map +1 -1
- package/bundles/types/wallet-buttons/index-cba.d.ts +132 -1
- package/bundles/types/wallet-buttons/index-cba.d.ts.map +1 -1
- package/bundles/types/wallet-buttons/wallet-buttons.d.ts +1 -1
- package/bundles/types/wallet-buttons/wallet-cba-buttons.d.ts +81 -126
- package/bundles/types/wallet-buttons/wallet-cba-buttons.d.ts.map +1 -1
- package/bundles/types/wallet-buttons/wallet-services/afterpay.wallet-service.d.ts +1 -0
- package/bundles/types/wallet-buttons/wallet-services/afterpay.wallet-service.d.ts.map +1 -1
- package/bundles/types/wallet-buttons/wallet-services/apple.wallet-service.d.ts +0 -1
- package/bundles/types/wallet-buttons/wallet-services/apple.wallet-service.d.ts.map +1 -1
- package/bundles/types/wallet-buttons/wallet-services/flypay-v2.wallet-service.d.ts +0 -1
- package/bundles/types/wallet-buttons/wallet-services/flypay-v2.wallet-service.d.ts.map +1 -1
- package/bundles/types/wallet-buttons/wallet-services/google.wallet-service.d.ts +0 -1
- package/bundles/types/wallet-buttons/wallet-services/google.wallet-service.d.ts.map +1 -1
- package/bundles/types/wallet-buttons/wallet-services/paypal.wallet-service.d.ts.map +1 -1
- package/bundles/types/wallet-buttons/wallet-services/wallet-service.d.ts +6 -0
- package/bundles/types/wallet-buttons/wallet-services/wallet-service.d.ts.map +1 -1
- package/bundles/widget.umd.js +194 -164
- package/bundles/widget.umd.js.d.ts +13 -2
- package/bundles/widget.umd.js.min.d.ts +13 -2
- package/bundles/widget.umd.min.js +1 -1
- package/docs/paypal-data-collector-examples.md +12 -7
- package/docs/paypal-data-collector.md +11 -1
- package/docs/wallet-buttons.md +1 -1
- package/package.json +1 -1
package/bundles/index.cjs
CHANGED
|
@@ -847,6 +847,11 @@ var Browser = /*#__PURE__*/function () {
|
|
|
847
847
|
value: function isJavaEnabled() {
|
|
848
848
|
return navigator.javaEnabled();
|
|
849
849
|
}
|
|
850
|
+
}, {
|
|
851
|
+
key: "getAgentUser",
|
|
852
|
+
value: function getAgentUser() {
|
|
853
|
+
return navigator.userAgent;
|
|
854
|
+
}
|
|
850
855
|
}, {
|
|
851
856
|
key: "getColorDepth",
|
|
852
857
|
value: function getColorDepth() {
|
|
@@ -1189,7 +1194,7 @@ SDK.headerKeys = Object.freeze({
|
|
|
1189
1194
|
version: 'x-sdk-version',
|
|
1190
1195
|
type: 'x-sdk-type'
|
|
1191
1196
|
});
|
|
1192
|
-
SDK._version = 'v1.
|
|
1197
|
+
SDK._version = 'v1.139.0';
|
|
1193
1198
|
|
|
1194
1199
|
function isFunction(value) {
|
|
1195
1200
|
return typeof value === 'function';
|
|
@@ -4933,9 +4938,28 @@ var IFrame = /*#__PURE__*/function () {
|
|
|
4933
4938
|
var iframeClass = arguments.length > 2 ? arguments[2] : undefined;
|
|
4934
4939
|
if (!this.container.isExist() || this.isExist()) return;
|
|
4935
4940
|
var iFrame = document.createElement('iframe');
|
|
4936
|
-
iFrame.setAttribute('src', link);
|
|
4937
4941
|
if (options.title) iFrame.title = options.title;
|
|
4938
4942
|
if (iframeClass) iFrame.classList.add(iframeClass);
|
|
4943
|
+
// Set additional attributes before src and DOM insertion so that
|
|
4944
|
+
// Permissions-Policy (e.g. allow="payment") is in place when the
|
|
4945
|
+
// browser starts navigating the iframe.
|
|
4946
|
+
if (options.attributes) {
|
|
4947
|
+
for (var _i = 0, _Object$entries = Object.entries(options.attributes); _i < _Object$entries.length; _i++) {
|
|
4948
|
+
var _Object$entries$_i = _slicedToArray(_Object$entries[_i], 2),
|
|
4949
|
+
key = _Object$entries$_i[0],
|
|
4950
|
+
value = _Object$entries$_i[1];
|
|
4951
|
+
iFrame.setAttribute(key, value);
|
|
4952
|
+
}
|
|
4953
|
+
}
|
|
4954
|
+
if (options.styles) {
|
|
4955
|
+
for (var _i2 = 0, _Object$entries2 = Object.entries(options.styles); _i2 < _Object$entries2.length; _i2++) {
|
|
4956
|
+
var _Object$entries2$_i = _slicedToArray(_Object$entries2[_i2], 2),
|
|
4957
|
+
prop = _Object$entries2$_i[0],
|
|
4958
|
+
_value = _Object$entries2$_i[1];
|
|
4959
|
+
iFrame.style[prop] = _value;
|
|
4960
|
+
}
|
|
4961
|
+
}
|
|
4962
|
+
iFrame.setAttribute('src', link);
|
|
4939
4963
|
this.container.getElement().appendChild(iFrame);
|
|
4940
4964
|
}
|
|
4941
4965
|
}, {
|
|
@@ -7777,6 +7801,33 @@ var WalletService = /*#__PURE__*/function () {
|
|
|
7777
7801
|
});
|
|
7778
7802
|
});
|
|
7779
7803
|
}
|
|
7804
|
+
/**
|
|
7805
|
+
* Handles the merchant's onClick callback event.
|
|
7806
|
+
* Supports both synchronous (boolean) and asynchronous (Promise) handlers.
|
|
7807
|
+
* @protected
|
|
7808
|
+
*/
|
|
7809
|
+
}, {
|
|
7810
|
+
key: "handleMerchantOnButtonClickEvent",
|
|
7811
|
+
value: function handleMerchantOnButtonClickEvent() {
|
|
7812
|
+
var _this2 = this;
|
|
7813
|
+
return new Promise(function (resolve, reject) {
|
|
7814
|
+
var merchantResult;
|
|
7815
|
+
_this2.eventEmitter.emit(WALLET_EVENT.BUTTON_CLICK, {
|
|
7816
|
+
attachResult: function attachResult(value) {
|
|
7817
|
+
merchantResult = value;
|
|
7818
|
+
}
|
|
7819
|
+
});
|
|
7820
|
+
if (merchantResult instanceof Promise) {
|
|
7821
|
+
merchantResult.then(resolve)["catch"](reject);
|
|
7822
|
+
} else {
|
|
7823
|
+
if (merchantResult === false) {
|
|
7824
|
+
reject();
|
|
7825
|
+
} else {
|
|
7826
|
+
resolve();
|
|
7827
|
+
}
|
|
7828
|
+
}
|
|
7829
|
+
});
|
|
7830
|
+
}
|
|
7780
7831
|
}]);
|
|
7781
7832
|
}();
|
|
7782
7833
|
|
|
@@ -7836,6 +7887,16 @@ var AfterPayWalletService = /*#__PURE__*/function (_WalletService) {
|
|
|
7836
7887
|
key: "onAfterPayButtonClicked",
|
|
7837
7888
|
value: function onAfterPayButtonClicked() {
|
|
7838
7889
|
var _this4 = this;
|
|
7890
|
+
this.handleMerchantOnButtonClickEvent().then(function () {
|
|
7891
|
+
_this4.initializeAfterpay();
|
|
7892
|
+
})["catch"](function (err) {
|
|
7893
|
+
console.error('Error while processing merchant callback', err);
|
|
7894
|
+
});
|
|
7895
|
+
}
|
|
7896
|
+
}, {
|
|
7897
|
+
key: "initializeAfterpay",
|
|
7898
|
+
value: function initializeAfterpay() {
|
|
7899
|
+
var _this5 = this;
|
|
7839
7900
|
var _a, _b;
|
|
7840
7901
|
var afterpayJS = document.createElement('script');
|
|
7841
7902
|
var countryCode = (_a = this.meta) === null || _a === void 0 ? void 0 : _a.country;
|
|
@@ -7847,15 +7908,15 @@ var AfterPayWalletService = /*#__PURE__*/function (_WalletService) {
|
|
|
7847
7908
|
window.AfterPay.initialize({
|
|
7848
7909
|
countryCode: countryCode
|
|
7849
7910
|
});
|
|
7850
|
-
if (
|
|
7851
|
-
|
|
7911
|
+
if (_this5.isRedirectMode) {
|
|
7912
|
+
_this5.storageDispatcher.push({
|
|
7852
7913
|
intent: StorageDataIntent.WIDGET_SESSION,
|
|
7853
7914
|
data: {
|
|
7854
|
-
token:
|
|
7915
|
+
token: _this5.token
|
|
7855
7916
|
}
|
|
7856
7917
|
}, {
|
|
7857
7918
|
onSuccess: function onSuccess() {
|
|
7858
|
-
|
|
7919
|
+
_this5.getCheckoutSession()
|
|
7859
7920
|
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
|
|
7860
7921
|
.then(function (response) {
|
|
7861
7922
|
window.AfterPay.redirect({
|
|
@@ -7863,7 +7924,7 @@ var AfterPayWalletService = /*#__PURE__*/function (_WalletService) {
|
|
|
7863
7924
|
});
|
|
7864
7925
|
})["catch"](function (err) {
|
|
7865
7926
|
window.AfterPay.close();
|
|
7866
|
-
|
|
7927
|
+
_this5.eventEmitter.emit(WALLET_EVENT.UNAVAILABLE, {
|
|
7867
7928
|
err: err
|
|
7868
7929
|
});
|
|
7869
7930
|
});
|
|
@@ -7871,30 +7932,30 @@ var AfterPayWalletService = /*#__PURE__*/function (_WalletService) {
|
|
|
7871
7932
|
onError: function onError() {
|
|
7872
7933
|
console.error('Error initializing Afterpay wallet');
|
|
7873
7934
|
window.AfterPay.close();
|
|
7874
|
-
|
|
7935
|
+
_this5.eventEmitter.emit(WALLET_EVENT.UNAVAILABLE, {});
|
|
7875
7936
|
}
|
|
7876
7937
|
});
|
|
7877
7938
|
} else {
|
|
7878
7939
|
window.AfterPay.open();
|
|
7879
|
-
|
|
7940
|
+
_this5.getCheckoutSession()
|
|
7880
7941
|
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
|
|
7881
7942
|
.then(function (response) {
|
|
7882
7943
|
window.AfterPay.onComplete = function (event) {
|
|
7883
7944
|
if (event.data.status === 'SUCCESS') {
|
|
7884
|
-
|
|
7945
|
+
_this5.eventEmitter.emit(WALLET_EVENT.PAYMENT_METHOD_SELECTED, {
|
|
7885
7946
|
data: {
|
|
7886
7947
|
token: response.ref_token,
|
|
7887
7948
|
merchantReference: event.data.orderToken
|
|
7888
7949
|
},
|
|
7889
7950
|
onSuccess: function onSuccess() {
|
|
7890
|
-
return
|
|
7951
|
+
return _this5.eventEmitter.emit(WALLET_EVENT.PAYMENT_SUCCESS);
|
|
7891
7952
|
},
|
|
7892
7953
|
onError: function onError() {
|
|
7893
|
-
return
|
|
7954
|
+
return _this5.eventEmitter.emit(WALLET_EVENT.PAYMENT_ERROR);
|
|
7894
7955
|
}
|
|
7895
7956
|
});
|
|
7896
7957
|
} else {
|
|
7897
|
-
|
|
7958
|
+
_this5.eventEmitter.emit(WALLET_EVENT.CHECKOUT_CLOSE, {
|
|
7898
7959
|
data: event.data
|
|
7899
7960
|
});
|
|
7900
7961
|
}
|
|
@@ -7904,7 +7965,7 @@ var AfterPayWalletService = /*#__PURE__*/function (_WalletService) {
|
|
|
7904
7965
|
});
|
|
7905
7966
|
})["catch"](function (err) {
|
|
7906
7967
|
window.AfterPay.close();
|
|
7907
|
-
|
|
7968
|
+
_this5.eventEmitter.emit(WALLET_EVENT.UNAVAILABLE, {
|
|
7908
7969
|
err: err
|
|
7909
7970
|
});
|
|
7910
7971
|
});
|
|
@@ -7915,20 +7976,20 @@ var AfterPayWalletService = /*#__PURE__*/function (_WalletService) {
|
|
|
7915
7976
|
}, {
|
|
7916
7977
|
key: "getCheckoutSession",
|
|
7917
7978
|
value: function getCheckoutSession() {
|
|
7918
|
-
var
|
|
7979
|
+
var _this6 = this;
|
|
7919
7980
|
return new Promise(function (resolve, reject) {
|
|
7920
|
-
return
|
|
7981
|
+
return _this6.eventEmitter.emit(WALLET_EVENT.CALLBACK, {
|
|
7921
7982
|
data: {
|
|
7922
7983
|
request_type: 'CREATE_SESSION',
|
|
7923
7984
|
wallet_type: WALLET_TYPE.AFTERPAY,
|
|
7924
|
-
checkout_url: !
|
|
7985
|
+
checkout_url: !_this6.isRedirectMode ? _this6.CHECKOUT_URL : undefined
|
|
7925
7986
|
},
|
|
7926
7987
|
onSuccess: function onSuccess(res) {
|
|
7927
7988
|
resolve(res);
|
|
7928
7989
|
},
|
|
7929
7990
|
onError: function onError(message) {
|
|
7930
7991
|
console.error('Error generating order id', message);
|
|
7931
|
-
|
|
7992
|
+
_this6.eventEmitter.emit(WALLET_EVENT.PAYMENT_ERROR, {
|
|
7932
7993
|
message: message
|
|
7933
7994
|
});
|
|
7934
7995
|
reject(message);
|
|
@@ -9746,34 +9807,12 @@ var FlypayV2WalletService = /*#__PURE__*/function (_WalletService) {
|
|
|
9746
9807
|
this.flypayV2Button.innerHTML = getFlypayV2Button(this.widgetId);
|
|
9747
9808
|
return this.flypayV2Button;
|
|
9748
9809
|
}
|
|
9749
|
-
}, {
|
|
9750
|
-
key: "handleMerchantOnButtonClickEvent",
|
|
9751
|
-
value: function handleMerchantOnButtonClickEvent() {
|
|
9752
|
-
var _this3 = this;
|
|
9753
|
-
return new Promise(function (resolve, reject) {
|
|
9754
|
-
var merchantResult;
|
|
9755
|
-
_this3.eventEmitter.emit(WALLET_EVENT.BUTTON_CLICK, {
|
|
9756
|
-
attachResult: function attachResult(value) {
|
|
9757
|
-
merchantResult = value;
|
|
9758
|
-
}
|
|
9759
|
-
});
|
|
9760
|
-
if (merchantResult instanceof Promise) {
|
|
9761
|
-
merchantResult.then(resolve)["catch"](reject);
|
|
9762
|
-
} else {
|
|
9763
|
-
if (merchantResult === false) {
|
|
9764
|
-
reject();
|
|
9765
|
-
} else {
|
|
9766
|
-
resolve();
|
|
9767
|
-
}
|
|
9768
|
-
}
|
|
9769
|
-
});
|
|
9770
|
-
}
|
|
9771
9810
|
}, {
|
|
9772
9811
|
key: "getOrderId",
|
|
9773
9812
|
value: function getOrderId() {
|
|
9774
|
-
var
|
|
9813
|
+
var _this3 = this;
|
|
9775
9814
|
return new Promise(function (resolve, reject) {
|
|
9776
|
-
return
|
|
9815
|
+
return _this3.eventEmitter.emit(WALLET_EVENT.CALLBACK, {
|
|
9777
9816
|
data: {
|
|
9778
9817
|
request_type: 'CREATE_SESSION'
|
|
9779
9818
|
},
|
|
@@ -9782,7 +9821,7 @@ var FlypayV2WalletService = /*#__PURE__*/function (_WalletService) {
|
|
|
9782
9821
|
},
|
|
9783
9822
|
onError: function onError(message, code) {
|
|
9784
9823
|
console.error('Error generating order id', message);
|
|
9785
|
-
|
|
9824
|
+
_this3.eventEmitter.emit(WALLET_EVENT.PAYMENT_ERROR, {
|
|
9786
9825
|
message: message
|
|
9787
9826
|
});
|
|
9788
9827
|
reject({
|
|
@@ -9796,7 +9835,7 @@ var FlypayV2WalletService = /*#__PURE__*/function (_WalletService) {
|
|
|
9796
9835
|
}, {
|
|
9797
9836
|
key: "flypayV2Checkout",
|
|
9798
9837
|
value: function flypayV2Checkout(orderId) {
|
|
9799
|
-
var
|
|
9838
|
+
var _this4 = this;
|
|
9800
9839
|
var _a;
|
|
9801
9840
|
this.checkout = new Checkout$1(_extends(_extends({
|
|
9802
9841
|
orderId: orderId
|
|
@@ -9811,29 +9850,29 @@ var FlypayV2WalletService = /*#__PURE__*/function (_WalletService) {
|
|
|
9811
9850
|
url: ((_a = this.meta) === null || _a === void 0 ? void 0 : _a.gateway_mode) === 'live' ? 'https://checkout.colespay.com.au' : 'https://checkout.sandbox.cxbflypay.com.au',
|
|
9812
9851
|
onCheckoutClosed: function onCheckoutClosed() {
|
|
9813
9852
|
var _a;
|
|
9814
|
-
|
|
9815
|
-
(_a =
|
|
9816
|
-
|
|
9853
|
+
_this4.eventEmitter.emit(WALLET_EVENT.CHECKOUT_CLOSE);
|
|
9854
|
+
(_a = _this4.background) === null || _a === void 0 ? void 0 : _a.clear();
|
|
9855
|
+
_this4.enable();
|
|
9817
9856
|
},
|
|
9818
9857
|
onError: function onError(err) {
|
|
9819
|
-
return
|
|
9858
|
+
return _this4.eventEmitter.emit(WALLET_EVENT.PAYMENT_ERROR, {
|
|
9820
9859
|
error: err
|
|
9821
9860
|
});
|
|
9822
9861
|
},
|
|
9823
9862
|
onPaymentSuccess: function onPaymentSuccess(data) {
|
|
9824
|
-
return
|
|
9863
|
+
return _this4.eventEmitter.emit(WALLET_EVENT.PAYMENT_SUCCESS, data);
|
|
9825
9864
|
},
|
|
9826
9865
|
onPaymentError: function onPaymentError(err) {
|
|
9827
|
-
return
|
|
9866
|
+
return _this4.eventEmitter.emit(WALLET_EVENT.PAYMENT_ERROR, {
|
|
9828
9867
|
error: err
|
|
9829
9868
|
});
|
|
9830
9869
|
},
|
|
9831
9870
|
onTokensChanged: function onTokensChanged(_ref) {
|
|
9832
9871
|
var accessToken = _ref.accessToken,
|
|
9833
9872
|
refreshToken = _ref.refreshToken;
|
|
9834
|
-
|
|
9835
|
-
|
|
9836
|
-
|
|
9873
|
+
_this4.accessToken = accessToken;
|
|
9874
|
+
_this4.refreshToken = refreshToken;
|
|
9875
|
+
_this4.eventEmitter.emit(WALLET_EVENT.AUTH_TOKENS_CHANGED, {
|
|
9837
9876
|
accessToken: accessToken,
|
|
9838
9877
|
refreshToken: refreshToken
|
|
9839
9878
|
});
|
|
@@ -9848,18 +9887,18 @@ var FlypayV2WalletService = /*#__PURE__*/function (_WalletService) {
|
|
|
9848
9887
|
}, {
|
|
9849
9888
|
key: "initBackground",
|
|
9850
9889
|
value: function initBackground() {
|
|
9851
|
-
var
|
|
9890
|
+
var _this5 = this;
|
|
9852
9891
|
var bg = new WalletBackground(this.link.getNetUrl() + FLYPAY_LOGO_LINK, false, false);
|
|
9853
9892
|
bg.setBackdropTitle('');
|
|
9854
9893
|
bg.setBackdropDescription('');
|
|
9855
9894
|
bg.onTrigger(TRIGGER$2.CLOSE, function () {
|
|
9856
9895
|
var _a;
|
|
9857
|
-
|
|
9858
|
-
(_a =
|
|
9859
|
-
|
|
9896
|
+
_this5.checkout.close();
|
|
9897
|
+
(_a = _this5.background) === null || _a === void 0 ? void 0 : _a.clear();
|
|
9898
|
+
_this5.enable();
|
|
9860
9899
|
});
|
|
9861
9900
|
bg.onTrigger(TRIGGER$2.FOCUS, function () {
|
|
9862
|
-
return
|
|
9901
|
+
return _this5.checkout.open();
|
|
9863
9902
|
});
|
|
9864
9903
|
return bg;
|
|
9865
9904
|
}
|
|
@@ -10541,28 +10580,6 @@ var AppleWalletService = /*#__PURE__*/function (_WalletService) {
|
|
|
10541
10580
|
});
|
|
10542
10581
|
});
|
|
10543
10582
|
}
|
|
10544
|
-
}, {
|
|
10545
|
-
key: "handleMerchantOnButtonClickEvent",
|
|
10546
|
-
value: function handleMerchantOnButtonClickEvent() {
|
|
10547
|
-
var _this6 = this;
|
|
10548
|
-
return new Promise(function (resolve, reject) {
|
|
10549
|
-
var merchantResult;
|
|
10550
|
-
_this6.eventEmitter.emit(WALLET_EVENT.BUTTON_CLICK, {
|
|
10551
|
-
attachResult: function attachResult(value) {
|
|
10552
|
-
merchantResult = value;
|
|
10553
|
-
}
|
|
10554
|
-
});
|
|
10555
|
-
if (merchantResult instanceof Promise) {
|
|
10556
|
-
merchantResult.then(resolve)["catch"](reject);
|
|
10557
|
-
} else {
|
|
10558
|
-
if (merchantResult === false) {
|
|
10559
|
-
reject();
|
|
10560
|
-
} else {
|
|
10561
|
-
resolve();
|
|
10562
|
-
}
|
|
10563
|
-
}
|
|
10564
|
-
});
|
|
10565
|
-
}
|
|
10566
10583
|
}, {
|
|
10567
10584
|
key: "formatCapabilities",
|
|
10568
10585
|
value: function formatCapabilities(capabilities) {
|
|
@@ -10818,39 +10835,17 @@ var GoogleWalletService = /*#__PURE__*/function (_WalletService) {
|
|
|
10818
10835
|
console.error('Error while processing merchant callback', err);
|
|
10819
10836
|
});
|
|
10820
10837
|
}
|
|
10821
|
-
}, {
|
|
10822
|
-
key: "handleMerchantOnButtonClickEvent",
|
|
10823
|
-
value: function handleMerchantOnButtonClickEvent() {
|
|
10824
|
-
var _this5 = this;
|
|
10825
|
-
return new Promise(function (resolve, reject) {
|
|
10826
|
-
var merchantResult;
|
|
10827
|
-
_this5.eventEmitter.emit(WALLET_EVENT.BUTTON_CLICK, {
|
|
10828
|
-
attachResult: function attachResult(value) {
|
|
10829
|
-
merchantResult = value;
|
|
10830
|
-
}
|
|
10831
|
-
});
|
|
10832
|
-
if (merchantResult instanceof Promise) {
|
|
10833
|
-
merchantResult.then(resolve)["catch"](reject);
|
|
10834
|
-
} else {
|
|
10835
|
-
if (merchantResult === false) {
|
|
10836
|
-
reject();
|
|
10837
|
-
} else {
|
|
10838
|
-
resolve();
|
|
10839
|
-
}
|
|
10840
|
-
}
|
|
10841
|
-
});
|
|
10842
|
-
}
|
|
10843
10838
|
}, {
|
|
10844
10839
|
key: "loadPaymentData",
|
|
10845
10840
|
value: function loadPaymentData() {
|
|
10846
10841
|
return __awaiter(this, void 0, void 0, /*#__PURE__*/_regenerator().m(function _callee2() {
|
|
10847
|
-
var
|
|
10842
|
+
var _this5 = this;
|
|
10848
10843
|
return _regenerator().w(function (_context2) {
|
|
10849
10844
|
while (1) switch (_context2.n) {
|
|
10850
10845
|
case 0:
|
|
10851
10846
|
return _context2.a(2, this.paymentsClient.loadPaymentData(this.createPaymentDataRequest())["catch"](function (err) {
|
|
10852
|
-
|
|
10853
|
-
|
|
10847
|
+
_this5.eventEmitter.emit(WALLET_EVENT.CHECKOUT_CLOSE);
|
|
10848
|
+
_this5.processingButtonClick = false;
|
|
10854
10849
|
console.error('Error while loading payment data', err);
|
|
10855
10850
|
throw err;
|
|
10856
10851
|
}));
|
|
@@ -10861,7 +10856,7 @@ var GoogleWalletService = /*#__PURE__*/function (_WalletService) {
|
|
|
10861
10856
|
}, {
|
|
10862
10857
|
key: "onPaymentAuthorized",
|
|
10863
10858
|
value: function onPaymentAuthorized(paymentData) {
|
|
10864
|
-
var
|
|
10859
|
+
var _this6 = this;
|
|
10865
10860
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
10866
10861
|
var billingAddressLine1 = (_c = (_b = (_a = paymentData.paymentMethodData) === null || _a === void 0 ? void 0 : _a.info) === null || _b === void 0 ? void 0 : _b.billingAddress) === null || _c === void 0 ? void 0 : _c.address1;
|
|
10867
10862
|
var billingAddressLine2 = (_f = (_e = (_d = paymentData.paymentMethodData) === null || _d === void 0 ? void 0 : _d.info) === null || _e === void 0 ? void 0 : _e.billingAddress) === null || _f === void 0 ? void 0 : _f.address2;
|
|
@@ -10878,7 +10873,7 @@ var GoogleWalletService = /*#__PURE__*/function (_WalletService) {
|
|
|
10878
10873
|
var onPaymentAuthorizedResponse = new Promise(function (resolve) {
|
|
10879
10874
|
var emitPaymentEvent = function emitPaymentEvent() {
|
|
10880
10875
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
10881
|
-
|
|
10876
|
+
_this6.eventEmitter.emit(WALLET_EVENT.PAYMENT_METHOD_SELECTED, {
|
|
10882
10877
|
data: _extends({
|
|
10883
10878
|
customer: {
|
|
10884
10879
|
payment_source: _extends(_extends(_extends({
|
|
@@ -10897,11 +10892,11 @@ var GoogleWalletService = /*#__PURE__*/function (_WalletService) {
|
|
|
10897
10892
|
ref_token: paymentData.paymentMethodData.tokenizationData.token
|
|
10898
10893
|
})
|
|
10899
10894
|
}
|
|
10900
|
-
},
|
|
10895
|
+
}, _this6.isShippingRequired() && {
|
|
10901
10896
|
shipping: _extends(_extends(_extends(_extends(_extends(_extends(_extends(_extends(_extends({}, shippingOptionMethod && {
|
|
10902
10897
|
method: shippingOptionMethod
|
|
10903
|
-
}),
|
|
10904
|
-
options:
|
|
10898
|
+
}), _this6.hasShippingOptions() && {
|
|
10899
|
+
options: _this6.meta.shipping_options
|
|
10905
10900
|
}), shippingAddressLine1 && {
|
|
10906
10901
|
address_line1: shippingAddressLine1
|
|
10907
10902
|
}), shippingAddressLine2 && {
|
|
@@ -10925,15 +10920,15 @@ var GoogleWalletService = /*#__PURE__*/function (_WalletService) {
|
|
|
10925
10920
|
})
|
|
10926
10921
|
}),
|
|
10927
10922
|
onSuccess: function onSuccess() {
|
|
10928
|
-
|
|
10929
|
-
|
|
10923
|
+
_this6.processingButtonClick = false;
|
|
10924
|
+
_this6.isProcessingAuthorization = false;
|
|
10930
10925
|
resolve({
|
|
10931
10926
|
transactionState: 'SUCCESS'
|
|
10932
10927
|
});
|
|
10933
10928
|
},
|
|
10934
10929
|
onError: function onError(error) {
|
|
10935
|
-
|
|
10936
|
-
|
|
10930
|
+
_this6.processingButtonClick = false;
|
|
10931
|
+
_this6.isProcessingAuthorization = false;
|
|
10937
10932
|
resolve({
|
|
10938
10933
|
transactionState: 'ERROR',
|
|
10939
10934
|
error: {
|
|
@@ -10945,7 +10940,7 @@ var GoogleWalletService = /*#__PURE__*/function (_WalletService) {
|
|
|
10945
10940
|
}
|
|
10946
10941
|
});
|
|
10947
10942
|
};
|
|
10948
|
-
if (
|
|
10943
|
+
if (_this6.isProcessingAuthorization) {
|
|
10949
10944
|
console.warn('Duplicate payment authorization detected. Ignoring.');
|
|
10950
10945
|
resolve({
|
|
10951
10946
|
transactionState: 'ERROR',
|
|
@@ -10956,7 +10951,7 @@ var GoogleWalletService = /*#__PURE__*/function (_WalletService) {
|
|
|
10956
10951
|
}
|
|
10957
10952
|
});
|
|
10958
10953
|
} else {
|
|
10959
|
-
|
|
10954
|
+
_this6.isProcessingAuthorization = true;
|
|
10960
10955
|
emitPaymentEvent();
|
|
10961
10956
|
}
|
|
10962
10957
|
});
|
|
@@ -10965,14 +10960,14 @@ var GoogleWalletService = /*#__PURE__*/function (_WalletService) {
|
|
|
10965
10960
|
}, {
|
|
10966
10961
|
key: "onPaymentDataChanged",
|
|
10967
10962
|
value: function onPaymentDataChanged(intermediatePaymentData) {
|
|
10968
|
-
var
|
|
10963
|
+
var _this7 = this;
|
|
10969
10964
|
if (!this.isShippingRequired()) {
|
|
10970
10965
|
return;
|
|
10971
10966
|
}
|
|
10972
10967
|
var parsedUpdateData = this.parseUpdateData(intermediatePaymentData);
|
|
10973
10968
|
var returnPromise = new Promise(function (res, rej) {
|
|
10974
|
-
|
|
10975
|
-
|
|
10969
|
+
_this7.latestShippingChangePromiseResolve = res;
|
|
10970
|
+
_this7.latestShippingChangePromiseReject = rej;
|
|
10976
10971
|
});
|
|
10977
10972
|
this.eventEmitter.emit(WALLET_EVENT.UPDATE, parsedUpdateData);
|
|
10978
10973
|
return returnPromise;
|
|
@@ -11219,6 +11214,11 @@ var PaypalWalletService = /*#__PURE__*/function (_WalletService) {
|
|
|
11219
11214
|
});
|
|
11220
11215
|
} else {
|
|
11221
11216
|
responseValue = value;
|
|
11217
|
+
if (responseValue === false) {
|
|
11218
|
+
actions.reject();
|
|
11219
|
+
} else {
|
|
11220
|
+
actions.resolve();
|
|
11221
|
+
}
|
|
11222
11222
|
}
|
|
11223
11223
|
}
|
|
11224
11224
|
});
|
|
@@ -12090,7 +12090,7 @@ var WalletButtons = /*#__PURE__*/function () {
|
|
|
12090
12090
|
* There are two operational modes supported, Synchronous and Asynchronous.
|
|
12091
12091
|
* When asynchronous operations need to occur on the callback handler, attaching the Promise via `attachResult` is required to have the wallet wait for a result.
|
|
12092
12092
|
* When synchronous operations occur on the callback handler, attaching a boolean result via `attachResult` is optional to control the execution flow.
|
|
12093
|
-
* Note this is supported for Paypal, GooglePay and
|
|
12093
|
+
* Note this is supported for Paypal, GooglePay, ApplePay, Afterpay and FlypayV2 wallet buttons at the moment.
|
|
12094
12094
|
*
|
|
12095
12095
|
* @example
|
|
12096
12096
|
* button.onClick((data) => {
|
|
@@ -17303,7 +17303,9 @@ var InstructionCardFormShow = /*#__PURE__*/function (_InstructionHandler) {
|
|
|
17303
17303
|
payload: _extends(_extends({
|
|
17304
17304
|
status: 'success',
|
|
17305
17305
|
ott_token: event.payment_source,
|
|
17306
|
-
browser_details: get.getBrowserDetails()
|
|
17306
|
+
browser_details: _extends(_extends({}, get.getBrowserDetails()), {
|
|
17307
|
+
user_agent: Browser.getAgentUser()
|
|
17308
|
+
})
|
|
17307
17309
|
}, event.card_scheme && {
|
|
17308
17310
|
card_schema: event.card_scheme
|
|
17309
17311
|
}), {
|
|
@@ -17530,7 +17532,7 @@ function setCheckoutCustomisation(checkoutSelector, customStyles) {
|
|
|
17530
17532
|
parentEl.style.setProperty('--pd-text-color', customStyles.text_color);
|
|
17531
17533
|
}
|
|
17532
17534
|
if (customStyles.font_family) {
|
|
17533
|
-
parentEl.style.setProperty('--pd-font-family', customStyles.font_family);
|
|
17535
|
+
parentEl.style.setProperty('--pd-font-family', "".concat(customStyles.font_family, ", \"Inter\", sans-serif"));
|
|
17534
17536
|
}
|
|
17535
17537
|
if (customStyles.font_size) {
|
|
17536
17538
|
parentEl.style.setProperty('--pd-font-size', customStyles.font_size);
|
|
@@ -20832,47 +20834,28 @@ var PayPalDataCollectorService = /*#__PURE__*/function () {
|
|
|
20832
20834
|
key: "collectDeviceData",
|
|
20833
20835
|
value: function collectDeviceData() {
|
|
20834
20836
|
if (!window.Promise) {
|
|
20835
|
-
|
|
20837
|
+
var errorData = {
|
|
20836
20838
|
error_code: ErrorCodes$1.PROMISE_NOT_ENABLED
|
|
20837
|
-
}
|
|
20839
|
+
};
|
|
20840
|
+
this.eventEmitter.emit(PAYPAL_DATA_COLLECTOR_EVENTS.ON_ERROR, errorData);
|
|
20841
|
+
throw errorData;
|
|
20838
20842
|
}
|
|
20839
20843
|
this.correlationId = Uuid.generate().replace(/-/g, '');
|
|
20840
|
-
return this.
|
|
20844
|
+
return this.appendPaypalDataCollectorComponent();
|
|
20841
20845
|
}
|
|
20842
20846
|
}, {
|
|
20843
|
-
key: "
|
|
20844
|
-
value: function
|
|
20847
|
+
key: "appendPaypalDataCollectorComponent",
|
|
20848
|
+
value: function appendPaypalDataCollectorComponent() {
|
|
20845
20849
|
var _this = this;
|
|
20846
|
-
var _a;
|
|
20847
|
-
var paypalScript = document.createElement("script");
|
|
20848
|
-
paypalScript.type = "application/json";
|
|
20849
|
-
paypalScript.setAttribute("fncls", "fnparams-dede7cc5-15fd-4c75-a9f4-36c430ee3a99");
|
|
20850
|
-
var scriptContent = _extends(_extends({
|
|
20851
|
-
f: this.correlationId,
|
|
20852
|
-
s: this.flowId ? this.flowId : Uuid.generate(),
|
|
20853
|
-
cb1: 'paydockPayPalDataCollectorServiceCallbackPostOne',
|
|
20854
|
-
cb2: 'paydockPayPalDataCollectorServiceCallbackPostTwo'
|
|
20855
|
-
}, this.isSandbox && {
|
|
20856
|
-
sandbox: this.isSandbox
|
|
20857
|
-
}), ((_a = this.config) === null || _a === void 0 ? void 0 : _a.mouse_movement) && {
|
|
20858
|
-
mm: this.config.mouse_movement
|
|
20859
|
-
});
|
|
20860
|
-
paypalScript.textContent = JSON.stringify(scriptContent, null, 4);
|
|
20861
|
-
var fraudnetScript = document.createElement("script");
|
|
20862
|
-
fraudnetScript.type = "text/javascript";
|
|
20863
|
-
fraudnetScript.src = "https://c.paypal.com/da/r/fb.js";
|
|
20864
|
-
fraudnetScript.onerror = function () {
|
|
20865
|
-
return _this.onError();
|
|
20866
|
-
};
|
|
20867
|
-
document.body.appendChild(paypalScript);
|
|
20868
|
-
document.body.appendChild(fraudnetScript);
|
|
20869
|
-
return this.setupCallbacks();
|
|
20870
|
-
}
|
|
20871
|
-
}, {
|
|
20872
|
-
key: "setupCallbacks",
|
|
20873
|
-
value: function setupCallbacks() {
|
|
20874
|
-
var _this2 = this;
|
|
20875
20850
|
return new Promise(function (resolve, reject) {
|
|
20851
|
+
var paypalScript = _this.createPaypalScript();
|
|
20852
|
+
paypalScript.onerror = function () {
|
|
20853
|
+
_this.onError(reject);
|
|
20854
|
+
};
|
|
20855
|
+
var fraudnetScript = _this.createFraudnetScript();
|
|
20856
|
+
fraudnetScript.onerror = function () {
|
|
20857
|
+
_this.onError(reject);
|
|
20858
|
+
};
|
|
20876
20859
|
var callbackOnePromise = new Promise(function (resolve) {
|
|
20877
20860
|
window.paydockPayPalDataCollectorServiceCallbackPostOne = function () {
|
|
20878
20861
|
resolve();
|
|
@@ -20883,19 +20866,53 @@ var PayPalDataCollectorService = /*#__PURE__*/function () {
|
|
|
20883
20866
|
resolve();
|
|
20884
20867
|
};
|
|
20885
20868
|
});
|
|
20869
|
+
document.body.appendChild(paypalScript);
|
|
20870
|
+
document.body.appendChild(fraudnetScript);
|
|
20886
20871
|
Promise.all([callbackOnePromise, callbackTwoPromise]).then(function () {
|
|
20887
20872
|
resolve({
|
|
20888
|
-
correlation_id:
|
|
20873
|
+
correlation_id: _this.correlationId
|
|
20889
20874
|
});
|
|
20890
20875
|
})["catch"](reject);
|
|
20891
20876
|
});
|
|
20892
20877
|
}
|
|
20878
|
+
}, {
|
|
20879
|
+
key: "createPaypalScript",
|
|
20880
|
+
value: function createPaypalScript() {
|
|
20881
|
+
var _a;
|
|
20882
|
+
var paypalScript = document.createElement('script');
|
|
20883
|
+
paypalScript.type = 'application/json';
|
|
20884
|
+
paypalScript.setAttribute('fncls', 'fnparams-dede7cc5-15fd-4c75-a9f4-36c430ee3a99');
|
|
20885
|
+
var scriptContent = _extends(_extends({
|
|
20886
|
+
f: this.correlationId,
|
|
20887
|
+
s: this.flowId ? this.flowId : Uuid.generate(),
|
|
20888
|
+
cb1: 'paydockPayPalDataCollectorServiceCallbackPostOne',
|
|
20889
|
+
cb2: 'paydockPayPalDataCollectorServiceCallbackPostTwo'
|
|
20890
|
+
}, this.isSandbox && {
|
|
20891
|
+
sandbox: this.isSandbox
|
|
20892
|
+
}), ((_a = this.config) === null || _a === void 0 ? void 0 : _a.mouse_movement) && {
|
|
20893
|
+
mm: this.config.mouse_movement
|
|
20894
|
+
});
|
|
20895
|
+
paypalScript.textContent = JSON.stringify(scriptContent, null, 4);
|
|
20896
|
+
return paypalScript;
|
|
20897
|
+
}
|
|
20898
|
+
}, {
|
|
20899
|
+
key: "createFraudnetScript",
|
|
20900
|
+
value: function createFraudnetScript() {
|
|
20901
|
+
var fraudnetScript = document.createElement('script');
|
|
20902
|
+
fraudnetScript.type = 'text/javascript';
|
|
20903
|
+
fraudnetScript.src = 'https://c.paypal.com/da/r/fb.js';
|
|
20904
|
+
return fraudnetScript;
|
|
20905
|
+
}
|
|
20893
20906
|
}, {
|
|
20894
20907
|
key: "onError",
|
|
20895
|
-
value: function onError() {
|
|
20896
|
-
|
|
20908
|
+
value: function onError(rejectPromise) {
|
|
20909
|
+
var errorData = {
|
|
20897
20910
|
error_code: ErrorCodes$1.SCRIPT_ERROR
|
|
20898
|
-
}
|
|
20911
|
+
};
|
|
20912
|
+
this.eventEmitter.emit(PAYPAL_DATA_COLLECTOR_EVENTS.ON_ERROR, errorData);
|
|
20913
|
+
if (rejectPromise) {
|
|
20914
|
+
rejectPromise(errorData);
|
|
20915
|
+
}
|
|
20899
20916
|
}
|
|
20900
20917
|
}, {
|
|
20901
20918
|
key: "setEnv",
|
|
@@ -20931,11 +20948,20 @@ var PayPalDataCollector = /*#__PURE__*/function () {
|
|
|
20931
20948
|
* the correlation id used among the requests asynchronously.
|
|
20932
20949
|
*
|
|
20933
20950
|
* @returns {Promise<CollectedDeviceData>} Promise when resolved, returns an object
|
|
20934
|
-
* that contains the `correlation_id` key.
|
|
20951
|
+
* that contains the `correlation_id` key. The promise may be rejected if script loading fails.
|
|
20935
20952
|
*
|
|
20936
20953
|
* @example
|
|
20937
20954
|
* const collectedDeviceData = await payPalDataCollectorWidget.collectDeviceData();
|
|
20938
20955
|
* console.log(collectedDeviceData.correlation_id)
|
|
20956
|
+
*
|
|
20957
|
+
* @example
|
|
20958
|
+
* payPalDataCollectorWidget.collectDeviceData()
|
|
20959
|
+
* .then((collectedDeviceData) => {
|
|
20960
|
+
* console.log(collectedDeviceData.correlation_id);
|
|
20961
|
+
* })
|
|
20962
|
+
* .catch((error) => {
|
|
20963
|
+
* console.error('Failed to collect device data', error);
|
|
20964
|
+
* });
|
|
20939
20965
|
*/
|
|
20940
20966
|
return _createClass(PayPalDataCollector, [{
|
|
20941
20967
|
key: "collectDeviceData",
|
|
@@ -21557,12 +21583,16 @@ var ClickToPaySRC = /*#__PURE__*/function () {
|
|
|
21557
21583
|
// Initialize performance optimizations when environment is guaranteed to be final
|
|
21558
21584
|
PerformanceService.initialize(this.link.getEnv());
|
|
21559
21585
|
this.iFrame.load(this.link.getUrl(), {
|
|
21560
|
-
title: 'Click To Pay checkout'
|
|
21586
|
+
title: 'Click To Pay checkout',
|
|
21587
|
+
attributes: {
|
|
21588
|
+
allow: 'payment; accelerometer;'
|
|
21589
|
+
},
|
|
21590
|
+
styles: {
|
|
21591
|
+
width: '100%'
|
|
21592
|
+
}
|
|
21561
21593
|
});
|
|
21562
21594
|
var iframeElement = this.iFrame.getElement();
|
|
21563
|
-
this.iFrame.setStyle('width', '100%');
|
|
21564
21595
|
if (iframeElement) {
|
|
21565
|
-
iframeElement.setAttribute('allow', 'payment; accelerometer;');
|
|
21566
21596
|
iframeElement.onload = function () {
|
|
21567
21597
|
_this2.isIframeLoaded = true;
|
|
21568
21598
|
_this2.eventEmitter.emit(EVENT$1.IFRAME_LOADED, {});
|