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