@paydock/client-sdk 1.81.1 → 1.84.8-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/bundles/widget.umd.js +31 -8
- package/bundles/widget.umd.min.js +1 -1
- package/lib/checkout-button/zipmoney/zipmoney-redirect.runner.js +1 -0
- package/lib/checkout-button/zipmoney/zipmoney-redirect.runner.js.map +1 -1
- package/lib/components/storage-dispatcher.d.ts +1 -1
- package/lib/components/storage-dispatcher.js +5 -2
- package/lib/components/storage-dispatcher.js.map +1 -1
- package/lib/wallet-buttons/afterpay.wallet-service.d.ts +3 -10
- package/lib/wallet-buttons/afterpay.wallet-service.js +10 -0
- package/lib/wallet-buttons/afterpay.wallet-service.js.map +1 -1
- package/lib/wallet-buttons/paypal.wallet-service.d.ts +2 -1
- package/lib/wallet-buttons/paypal.wallet-service.js +18 -8
- package/lib/wallet-buttons/paypal.wallet-service.js.map +1 -1
- package/package.json +1 -1
package/bundles/widget.umd.js
CHANGED
|
@@ -4490,12 +4490,16 @@
|
|
|
4490
4490
|
createClass(StorageDispatcher, [{
|
|
4491
4491
|
key: 'create',
|
|
4492
4492
|
value: function create() {
|
|
4493
|
+
var reset = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
4494
|
+
|
|
4495
|
+
if (this.dispatcherFrame && !reset) return this.dispatcherFrame;
|
|
4493
4496
|
if (this.dispatcherFrame) this.destroy();
|
|
4494
4497
|
var iFrame = document.createElement('iframe');
|
|
4495
4498
|
iFrame.setAttribute('src', this.env.getConf().url + STORAGE_DISPATCHER_URI);
|
|
4496
4499
|
iFrame.setAttribute('id', STORAGE_DISPATCHER_ID);
|
|
4497
4500
|
iFrame.style.display = 'none';
|
|
4498
4501
|
document.body.appendChild(iFrame);
|
|
4502
|
+
this.dispatcherFrame = iFrame;
|
|
4499
4503
|
console.info(LOG_PREFIX$1 + ' initialized.');
|
|
4500
4504
|
return iFrame;
|
|
4501
4505
|
}
|
|
@@ -4522,7 +4526,7 @@
|
|
|
4522
4526
|
key: 'setEnv',
|
|
4523
4527
|
value: function setEnv(env, alias) {
|
|
4524
4528
|
this.env.setEnv(env, alias);
|
|
4525
|
-
this.
|
|
4529
|
+
this.create(true);
|
|
4526
4530
|
}
|
|
4527
4531
|
}]);
|
|
4528
4532
|
return StorageDispatcher;
|
|
@@ -4548,6 +4552,7 @@
|
|
|
4548
4552
|
}, {
|
|
4549
4553
|
key: 'next',
|
|
4550
4554
|
value: function next(checkout, params) {
|
|
4555
|
+
this.storageDispatcher.create();
|
|
4551
4556
|
var widgetSessionData = {
|
|
4552
4557
|
merchant_redirect_url: this.getRedirectUrl(),
|
|
4553
4558
|
checkout_token: checkout.token,
|
|
@@ -5622,12 +5627,13 @@
|
|
|
5622
5627
|
value: function load(container) {
|
|
5623
5628
|
var _this2 = this;
|
|
5624
5629
|
|
|
5630
|
+
var _a;
|
|
5625
5631
|
if (!window.Promise) {
|
|
5626
5632
|
// Given that this library does not rely in any polyfill for promises, and this integration depends on them, we early return if Promises are not supported for the browser (like I.E. 11).
|
|
5627
5633
|
this.eventEmitter.emit(WALLET_EVENT.UNAVAILABLE, null);
|
|
5628
|
-
return;
|
|
5634
|
+
return Promise.resolve();
|
|
5629
5635
|
}
|
|
5630
|
-
var buttonId = container.getElement().id || '';
|
|
5636
|
+
var buttonId = ((_a = container.getElement()) === null || _a === void 0 ? void 0 : _a.id) || '';
|
|
5631
5637
|
var paypalScript = document.createElement("script");
|
|
5632
5638
|
paypalScript.src = "https://www.paypal.com/sdk/js?client-id=" + this.publicKey + "¤cy=" + this.meta.currency + (this.meta.pay_later === true ? '&enable-funding=paylater&disable-funding=card' : "&disable-funding=credit,card") + (!this.meta.capture ? "&intent=authorize" : '');
|
|
5633
5639
|
paypalScript.async = true;
|
|
@@ -5655,17 +5661,20 @@
|
|
|
5655
5661
|
_this2.eventEmitter.emit(WALLET_EVENT.UPDATE, parsedCallbackData);
|
|
5656
5662
|
});
|
|
5657
5663
|
}, onApprove: function onApprove(data) {
|
|
5658
|
-
|
|
5664
|
+
_this2.pendingApprovalPromise = _this2.pendingApprovalPromise || new Promise(function (resolve, reject) {
|
|
5659
5665
|
return _this2.eventEmitter.emit(WALLET_EVENT.PAYMENT_METHOD_SELECTED, {
|
|
5660
5666
|
data: { payment_method_id: data.orderID, customer: { payment_source: { external_payer_id: data.payerID } } },
|
|
5661
5667
|
onSuccess: function onSuccess() {
|
|
5662
|
-
|
|
5668
|
+
_this2.pendingApprovalPromise = undefined;
|
|
5669
|
+
resolve(true);
|
|
5663
5670
|
},
|
|
5664
5671
|
onError: function onError(err) {
|
|
5665
|
-
|
|
5672
|
+
_this2.pendingApprovalPromise = undefined;
|
|
5673
|
+
reject(err);
|
|
5666
5674
|
}
|
|
5667
5675
|
});
|
|
5668
5676
|
});
|
|
5677
|
+
return _this2.pendingApprovalPromise;
|
|
5669
5678
|
}, onError: function onError(err) {
|
|
5670
5679
|
// Error handling so that paypal does not throw an uncaught error
|
|
5671
5680
|
// We're already handling errors and notifying Merchants at "wallet-buttons.ts"
|
|
@@ -5675,7 +5684,7 @@
|
|
|
5675
5684
|
}
|
|
5676
5685
|
};
|
|
5677
5686
|
document.head.appendChild(paypalScript);
|
|
5678
|
-
return;
|
|
5687
|
+
return Promise.resolve();
|
|
5679
5688
|
}
|
|
5680
5689
|
}, {
|
|
5681
5690
|
key: "update",
|
|
@@ -6848,14 +6857,27 @@
|
|
|
6848
6857
|
|
|
6849
6858
|
function AfterPayWalletService(token, meta) {
|
|
6850
6859
|
classCallCheck(this, AfterPayWalletService);
|
|
6851
|
-
|
|
6860
|
+
|
|
6861
|
+
var _this = possibleConstructorReturn(this, (AfterPayWalletService.__proto__ || Object.getPrototypeOf(AfterPayWalletService)).call(this, token, meta));
|
|
6862
|
+
|
|
6863
|
+
_this.token = token;
|
|
6864
|
+
_this.storageDispatcher = new StorageDispatcher('afterpay.wallet.paydock');
|
|
6865
|
+
return _this;
|
|
6852
6866
|
}
|
|
6853
6867
|
|
|
6854
6868
|
createClass(AfterPayWalletService, [{
|
|
6855
6869
|
key: 'load',
|
|
6856
6870
|
value: function load(container) {
|
|
6871
|
+
this.storageDispatcher.create();
|
|
6857
6872
|
this.mount(container);
|
|
6858
6873
|
}
|
|
6874
|
+
}, {
|
|
6875
|
+
key: 'setEnv',
|
|
6876
|
+
value: function setEnv(env) {
|
|
6877
|
+
get(AfterPayWalletService.prototype.__proto__ || Object.getPrototypeOf(AfterPayWalletService.prototype), 'setEnv', this).call(this, env);
|
|
6878
|
+
this.storageDispatcher.setEnv(env);
|
|
6879
|
+
return this;
|
|
6880
|
+
}
|
|
6859
6881
|
}, {
|
|
6860
6882
|
key: 'mount',
|
|
6861
6883
|
value: function mount(container) {
|
|
@@ -6877,6 +6899,7 @@
|
|
|
6877
6899
|
value: function onAfterPayButtonClicked() {
|
|
6878
6900
|
var _this3 = this;
|
|
6879
6901
|
|
|
6902
|
+
this.storageDispatcher.push({ intent: StorageDataIntent.WIDGET_SESSION, data: { token: this.token } });
|
|
6880
6903
|
return new Promise(function () {
|
|
6881
6904
|
var _a, _b;
|
|
6882
6905
|
var afterpayJS = document.createElement('script');
|