@paydock/client-sdk 1.11.12-beta → 1.11.13-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 +767 -756
- package/bundles/widget.umd.js +96 -24
- package/bundles/widget.umd.min.js +1 -1
- package/lib/checkout-button/afterpay-checkout-button.d.ts +15 -0
- package/lib/checkout-button/afterpay-checkout-button.js +26 -1
- package/lib/checkout-button/afterpay-checkout-button.js.map +1 -1
- package/lib/checkout-button/afterpay.runner.d.ts +4 -4
- package/lib/checkout-button/afterpay.runner.js +4 -5
- package/lib/checkout-button/afterpay.runner.js.map +1 -1
- package/lib/checkout-button/checkout-button.d.ts +2 -1
- package/lib/checkout-button/checkout-button.js +4 -1
- package/lib/checkout-button/checkout-button.js.map +1 -1
- package/lib/checkout-button/index.d.ts +1 -3
- package/lib/checkout-button/index.js +1 -3
- package/lib/checkout-button/index.js.map +1 -1
- package/lib/checkout-button/runner.d.ts +4 -3
- package/lib/checkout-button/runner.js +1 -1
- package/lib/checkout-button/runner.js.map +1 -1
- package/lib/components/param.d.ts +1 -3
- package/lib/components/param.js +0 -4
- package/lib/components/param.js.map +1 -1
- package/lib/helper/browser.d.ts +4 -0
- package/lib/helper/browser.js +24 -0
- package/lib/helper/browser.js.map +1 -1
- package/lib/helper/url.d.ts +1 -0
- package/lib/helper/url.js +3 -0
- package/lib/helper/url.js.map +1 -1
- package/lib/wallet-buttons/apple.wallet-service.js +13 -2
- package/lib/wallet-buttons/apple.wallet-service.js.map +1 -1
- package/lib/wallet-buttons/google.wallet-service.js +5 -7
- package/lib/wallet-buttons/google.wallet-service.js.map +1 -1
- package/lib/widget/configuration.d.ts +1 -3
- package/lib/widget/configuration.js +1 -3
- package/lib/widget/configuration.js.map +1 -1
- package/lib/widget/html-multi-widget.d.ts +1 -2
- package/lib/widget/html-multi-widget.js +1 -2
- package/lib/widget/html-multi-widget.js.map +1 -1
- package/lib/widget/html-widget.d.ts +1 -3
- package/lib/widget/html-widget.js +1 -3
- package/lib/widget/html-widget.js.map +1 -1
- package/package.json +4 -1
- package/slate.md +17 -17
package/bundles/widget.umd.js
CHANGED
|
@@ -310,6 +310,13 @@
|
|
|
310
310
|
value: function extendSearchParams(uri, key, val) {
|
|
311
311
|
return uri.replace(new RegExp("([?&]" + key + "(?=[=&#]|$)[^#&]*|(?=#|$))"), "&" + key + "=" + encodeURIComponent(val)).replace(/^([^?&]+)&/, "$1?");
|
|
312
312
|
}
|
|
313
|
+
}, {
|
|
314
|
+
key: "serialize",
|
|
315
|
+
value: function serialize(params) {
|
|
316
|
+
return Object.keys(params).map(function (key) {
|
|
317
|
+
return encodeURIComponent(key) + '=' + encodeURIComponent(params[key]);
|
|
318
|
+
}).join('&');
|
|
319
|
+
}
|
|
313
320
|
}]);
|
|
314
321
|
return Url;
|
|
315
322
|
}();
|
|
@@ -566,9 +573,7 @@
|
|
|
566
573
|
*
|
|
567
574
|
* var config = new Configuration('gatewayId', 'bank_account', 'paymentSource'); // extend
|
|
568
575
|
*
|
|
569
|
-
*
|
|
570
|
-
*
|
|
571
|
-
* @param {string} [gatewayID=default] - gateway ID. By default or if put 'default', it will use the selected default gateway. If put 'not_configured', it won’t use gateway to create downstream token.
|
|
576
|
+
* @param {string} [gatewayID=default] - gateway ID. By default or if put 'default', it will use the selected default gateway
|
|
572
577
|
* @param {string} paymentType - Type of payment source which shows in widget form. Available parameters [PAYMENT_TYPE]{@link PAYMENT_TYPE}
|
|
573
578
|
* @param {string} purpose - Param which describes payment purpose. By default uses Available parameters [PURPOSE]{@link PURPOSE}
|
|
574
579
|
**/
|
|
@@ -1876,8 +1881,7 @@
|
|
|
1876
1881
|
* var widget = new MultiWidget('#widget', 'publicKey', new Configuration('gatewayId')); With Configuration
|
|
1877
1882
|
*
|
|
1878
1883
|
* var widget = new MultiWidget('#widget', 'publicKey',[ With Configurations
|
|
1879
|
-
* Configuration()
|
|
1880
|
-
* Configuration('not_configured'), // without gateway,
|
|
1884
|
+
* Configuration() // default gateway_id,
|
|
1881
1885
|
* Configuration('gatewayId'),
|
|
1882
1886
|
* Configuration('gatewayId', 'bank_account')
|
|
1883
1887
|
* ]);
|
|
@@ -2237,11 +2241,9 @@
|
|
|
2237
2241
|
*
|
|
2238
2242
|
* var widget = new HtmlWidget('#widget', 'publicKey', 'gatewayID', 'bank_account', 'payment_source'); // extend
|
|
2239
2243
|
*
|
|
2240
|
-
* var widget = new HtmlWidget('#widget', 'publicKey', 'not_configured'); // without gateway
|
|
2241
|
-
*
|
|
2242
2244
|
* @param {string} selector - Selector of html element. Container for widget
|
|
2243
2245
|
* @param {string} publicKey - PayDock users public key
|
|
2244
|
-
* @param {string} [gatewayID=default] - ID of a gateway connected to PayDock. By default or if put 'default', it will use the selected default gateway
|
|
2246
|
+
* @param {string} [gatewayID=default] - ID of a gateway connected to PayDock. By default or if put 'default', it will use the selected default gateway
|
|
2245
2247
|
* @param {string} [paymentType=card] - Type of payment source which shows in widget form. Available parameters : “card”, “bank_account”.
|
|
2246
2248
|
* @param {string} [purpose=payment_source] - Purpose of widget form. Available parameters: ‘payment_source’, ‘card_payment_source_with_cvv’, ‘card_payment_source_without_cvv’
|
|
2247
2249
|
**/
|
|
@@ -2641,6 +2643,32 @@
|
|
|
2641
2643
|
value: function getScreenWidth() {
|
|
2642
2644
|
return screen.width;
|
|
2643
2645
|
}
|
|
2646
|
+
}, {
|
|
2647
|
+
key: 'getBrowserInfo',
|
|
2648
|
+
value: function getBrowserInfo() {
|
|
2649
|
+
var ua = navigator.userAgent;
|
|
2650
|
+
var M = ua.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i) || [];
|
|
2651
|
+
var tem = void 0;
|
|
2652
|
+
if (/trident/i.test(M[1])) {
|
|
2653
|
+
tem = /\brv[ :]+(\d+)/g.exec(ua) || [];
|
|
2654
|
+
return { name: 'IE', version: tem[1] || '' };
|
|
2655
|
+
}
|
|
2656
|
+
if (M[1] === 'Chrome') {
|
|
2657
|
+
tem = ua.match(/\bOPR|Edge\/(\d+)/);
|
|
2658
|
+
if (tem != null) {
|
|
2659
|
+
return { name: 'Opera', version: tem[1] };
|
|
2660
|
+
}
|
|
2661
|
+
}
|
|
2662
|
+
M = M[2] ? [M[1], M[2]] : [navigator.appName, navigator.appVersion, '-?'];
|
|
2663
|
+
// tslint:disable-next-line:no-conditional-assignment
|
|
2664
|
+
if ((tem = ua.match(/version\/(\d+)/i)) != null) {
|
|
2665
|
+
M.splice(1, 1, tem[1]);
|
|
2666
|
+
}
|
|
2667
|
+
return {
|
|
2668
|
+
name: M[0],
|
|
2669
|
+
version: M[1]
|
|
2670
|
+
};
|
|
2671
|
+
}
|
|
2644
2672
|
}]);
|
|
2645
2673
|
return Browser;
|
|
2646
2674
|
}();
|
|
@@ -2893,7 +2921,7 @@
|
|
|
2893
2921
|
value: function _continue() {}
|
|
2894
2922
|
}, {
|
|
2895
2923
|
key: 'next',
|
|
2896
|
-
value: function next(checkoutData) {}
|
|
2924
|
+
value: function next(checkoutData, params) {}
|
|
2897
2925
|
}, {
|
|
2898
2926
|
key: 'stop',
|
|
2899
2927
|
value: function stop() {}
|
|
@@ -4443,10 +4471,10 @@
|
|
|
4443
4471
|
}
|
|
4444
4472
|
}, {
|
|
4445
4473
|
key: "next",
|
|
4446
|
-
value: function next(checkoutData) {
|
|
4474
|
+
value: function next(checkoutData, params) {
|
|
4447
4475
|
this.checkout = checkoutData;
|
|
4448
4476
|
if (!Browser.isSupportPopUp()) window.localStorage.setItem('paydock_checkout_token', JSON.stringify(this.checkout));
|
|
4449
|
-
this.popup.redirect(this.getRedirectUrl());
|
|
4477
|
+
this.popup.redirect(this.getRedirectUrl(params));
|
|
4450
4478
|
}
|
|
4451
4479
|
}, {
|
|
4452
4480
|
key: "error",
|
|
@@ -4468,9 +4496,8 @@
|
|
|
4468
4496
|
}
|
|
4469
4497
|
}, {
|
|
4470
4498
|
key: "getRedirectUrl",
|
|
4471
|
-
value: function getRedirectUrl() {
|
|
4472
|
-
|
|
4473
|
-
return this.widgetEnv.getConf().url + Url.extendSearchParams(CHECKOUT_URL, 'token', encodeURIComponent(this.checkout.reference_id)) + '&env=' + encodeURIComponent(env);
|
|
4499
|
+
value: function getRedirectUrl(params) {
|
|
4500
|
+
return this.widgetEnv.getConf().url + CHECKOUT_URL + '?' + Url.serialize(_extends(_extends({}, params), { token: this.checkout.reference_id, env: this.checkout.mode === 'live' ? 'live' : 'test' }));
|
|
4474
4501
|
}
|
|
4475
4502
|
}]);
|
|
4476
4503
|
return AfterpayRunner;
|
|
@@ -4545,6 +4572,11 @@
|
|
|
4545
4572
|
}
|
|
4546
4573
|
|
|
4547
4574
|
createClass(CheckoutButton, [{
|
|
4575
|
+
key: "buildAdditionalParams",
|
|
4576
|
+
value: function buildAdditionalParams() {
|
|
4577
|
+
return {};
|
|
4578
|
+
}
|
|
4579
|
+
}, {
|
|
4548
4580
|
key: "initCheckout",
|
|
4549
4581
|
value: function initCheckout() {
|
|
4550
4582
|
var _this2 = this;
|
|
@@ -4558,7 +4590,7 @@
|
|
|
4558
4590
|
externalCheckout.setEnv(_this2.env);
|
|
4559
4591
|
externalCheckout.send(_this2.aceessToken, function (checkout) {
|
|
4560
4592
|
_this2.eventEmitter.emit(CHECKOUT_BUTTON_EVENT.POPUP_REDIRECT, {});
|
|
4561
|
-
_this2.runner.next(checkout);
|
|
4593
|
+
_this2.runner.next(checkout, _this2.buildAdditionalParams());
|
|
4562
4594
|
}, function (error, code) {
|
|
4563
4595
|
_this2.eventEmitter.emit(CHECKOUT_BUTTON_EVENT.ERROR, {});
|
|
4564
4596
|
_this2.runner.error(error, code, function (close) {
|
|
@@ -4846,9 +4878,40 @@
|
|
|
4846
4878
|
|
|
4847
4879
|
_this.accessToken = accessToken;
|
|
4848
4880
|
_this.gatewayId = gatewayId;
|
|
4881
|
+
_this.showETP = false;
|
|
4849
4882
|
return _this;
|
|
4850
4883
|
}
|
|
4884
|
+
/**
|
|
4885
|
+
* Method which toggles the "Enhanced Tracking Protection" warning popup to 'on' mode.
|
|
4886
|
+
*
|
|
4887
|
+
* This popup with a warning about "Enhanced Tracking Protection" limitations
|
|
4888
|
+
* would be shown in the Mozilla Firefox browser version 100+
|
|
4889
|
+
*
|
|
4890
|
+
* By default, the popup would not be shown, until
|
|
4891
|
+
* the flag would be set to `true`
|
|
4892
|
+
* @param {doShow} boolean - flag which toggle the popup visibility
|
|
4893
|
+
*/
|
|
4894
|
+
|
|
4895
|
+
|
|
4896
|
+
createClass(AfterpayCheckoutButton, [{
|
|
4897
|
+
key: "showEnhancedTrackingProtectionPopup",
|
|
4898
|
+
value: function showEnhancedTrackingProtectionPopup(doShow) {
|
|
4899
|
+
var _Browser$getBrowserIn = Browser.getBrowserInfo(),
|
|
4900
|
+
name = _Browser$getBrowserIn.name,
|
|
4901
|
+
version = _Browser$getBrowserIn.version;
|
|
4851
4902
|
|
|
4903
|
+
if (doShow && name === 'Firefox' && +version >= 100) this.showETP = true;
|
|
4904
|
+
}
|
|
4905
|
+
}, {
|
|
4906
|
+
key: "buildAdditionalParams",
|
|
4907
|
+
value: function buildAdditionalParams() {
|
|
4908
|
+
var params = get(AfterpayCheckoutButton.prototype.__proto__ || Object.getPrototypeOf(AfterpayCheckoutButton.prototype), "buildAdditionalParams", this).call(this);
|
|
4909
|
+
if (this.showETP) {
|
|
4910
|
+
params.show_etp = true;
|
|
4911
|
+
}
|
|
4912
|
+
return params;
|
|
4913
|
+
}
|
|
4914
|
+
}]);
|
|
4852
4915
|
return AfterpayCheckoutButton;
|
|
4853
4916
|
}(CheckoutButton);
|
|
4854
4917
|
|
|
@@ -5666,10 +5729,21 @@
|
|
|
5666
5729
|
|
|
5667
5730
|
_this.latestShippingData.shippingContact = shippingContact;
|
|
5668
5731
|
var shippingOptionMethod = (_a = _this.selectedShippingOption) === null || _a === void 0 ? void 0 : _a.type;
|
|
5669
|
-
var cardNameFromShippingContact = [shippingContact === null || shippingContact === void 0 ? void 0 : shippingContact.givenName, shippingContact === null || shippingContact === void 0 ? void 0 : shippingContact.familyName].join(' ').trim();
|
|
5670
5732
|
_this.eventEmitter.emit(WALLET_EVENT.PAYMENT_METHOD_SELECTED, {
|
|
5671
5733
|
data: _extends({ customer: {
|
|
5672
|
-
payment_source:
|
|
5734
|
+
payment_source: {
|
|
5735
|
+
wallet_type: WALLET_TYPE.APPLE,
|
|
5736
|
+
card_name: token.paymentMethod.displayName,
|
|
5737
|
+
type: token.paymentMethod.type,
|
|
5738
|
+
card_scheme: token.paymentMethod.network,
|
|
5739
|
+
address_line1: billingContact === null || billingContact === void 0 ? void 0 : billingContact.addressLines[0],
|
|
5740
|
+
address_line2: billingContact === null || billingContact === void 0 ? void 0 : billingContact.addressLines[1],
|
|
5741
|
+
address_country: billingContact === null || billingContact === void 0 ? void 0 : billingContact.countryCode,
|
|
5742
|
+
address_city: billingContact === null || billingContact === void 0 ? void 0 : billingContact.locality,
|
|
5743
|
+
address_postcode: billingContact === null || billingContact === void 0 ? void 0 : billingContact.postalCode,
|
|
5744
|
+
address_state: billingContact === null || billingContact === void 0 ? void 0 : billingContact.administrativeArea,
|
|
5745
|
+
ref_token: token.paymentData ? JSON.stringify(token.paymentData) : ''
|
|
5746
|
+
}
|
|
5673
5747
|
} }, _this.meta.request_shipping && shippingContact && {
|
|
5674
5748
|
shipping: _extends(_extends(_extends({}, shippingOptionMethod && { method: shippingOptionMethod }), _this.hasShippingOptions() && { options: _this.meta.shipping_options }), { address_line1: shippingContact.addressLines[0], address_line2: shippingContact.addressLines[1], address_country: shippingContact.countryCode, address_city: shippingContact.locality, address_postcode: shippingContact.postalCode, address_state: shippingContact.administrativeArea, contact: {
|
|
5675
5749
|
first_name: shippingContact.givenName,
|
|
@@ -6119,17 +6193,15 @@
|
|
|
6119
6193
|
var shippingAddressLine2 = (_h = paymentData === null || paymentData === void 0 ? void 0 : paymentData.shippingAddress) === null || _h === void 0 ? void 0 : _h.address2;
|
|
6120
6194
|
var shippingOptionMethod = (_j = this.selectedShippingOption) === null || _j === void 0 ? void 0 : _j.type;
|
|
6121
6195
|
return new Promise(function (resolve) {
|
|
6122
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
|
|
6196
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w;
|
|
6123
6197
|
return _this4.eventEmitter.emit(WALLET_EVENT.PAYMENT_METHOD_SELECTED, {
|
|
6124
6198
|
data: _extends({ customer: {
|
|
6125
|
-
payment_source: _extends(_extends(_extends(_extends({ wallet_type: WALLET_TYPE.GOOGLE,
|
|
6126
|
-
// card_name: paymentData.shippingAddress?.name, // TODO: Do we want to use this value? Point 2 at https://paydock.atlassian.net/browse/P2-7209?focusedCommentId=60202
|
|
6127
|
-
type: paymentData.paymentMethodData.type, card_scheme: (_b = (_a = paymentData.paymentMethodData) === null || _a === void 0 ? void 0 : _a.info) === null || _b === void 0 ? void 0 : _b.cardNetwork }, billingAddressLine1 && { address_line1: billingAddressLine1 }), billingAddressLine2 && { address_line2: billingAddressLine2 }), billingAddressLine2 && { address_line2: billingAddressLine2 }), { address_country: (_e = (_d = (_c = paymentData.paymentMethodData) === null || _c === void 0 ? void 0 : _c.info) === null || _d === void 0 ? void 0 : _d.billingAddress) === null || _e === void 0 ? void 0 : _e.countryCode, address_city: (_h = (_g = (_f = paymentData.paymentMethodData) === null || _f === void 0 ? void 0 : _f.info) === null || _g === void 0 ? void 0 : _g.billingAddress) === null || _h === void 0 ? void 0 : _h.locality, address_postcode: (_l = (_k = (_j = paymentData.paymentMethodData) === null || _j === void 0 ? void 0 : _j.info) === null || _k === void 0 ? void 0 : _k.billingAddress) === null || _l === void 0 ? void 0 : _l.postalCode, address_state: (_p = (_o = (_m = paymentData.paymentMethodData) === null || _m === void 0 ? void 0 : _m.info) === null || _o === void 0 ? void 0 : _o.billingAddress) === null || _p === void 0 ? void 0 : _p.administrativeArea, ref_token: paymentData.paymentMethodData.tokenizationData.token })
|
|
6199
|
+
payment_source: _extends(_extends(_extends(_extends({ wallet_type: WALLET_TYPE.GOOGLE, card_name: (_a = paymentData.paymentMethodData) === null || _a === void 0 ? void 0 : _a.description, type: paymentData.paymentMethodData.type, card_scheme: (_c = (_b = paymentData.paymentMethodData) === null || _b === void 0 ? void 0 : _b.info) === null || _c === void 0 ? void 0 : _c.cardNetwork }, billingAddressLine1 && { address_line1: billingAddressLine1 }), billingAddressLine2 && { address_line2: billingAddressLine2 }), billingAddressLine2 && { address_line2: billingAddressLine2 }), { address_country: (_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.countryCode, address_city: (_j = (_h = (_g = paymentData.paymentMethodData) === null || _g === void 0 ? void 0 : _g.info) === null || _h === void 0 ? void 0 : _h.billingAddress) === null || _j === void 0 ? void 0 : _j.locality, address_postcode: (_m = (_l = (_k = paymentData.paymentMethodData) === null || _k === void 0 ? void 0 : _k.info) === null || _l === void 0 ? void 0 : _l.billingAddress) === null || _m === void 0 ? void 0 : _m.postalCode, address_state: (_q = (_p = (_o = paymentData.paymentMethodData) === null || _o === void 0 ? void 0 : _o.info) === null || _p === void 0 ? void 0 : _p.billingAddress) === null || _q === void 0 ? void 0 : _q.administrativeArea, ref_token: paymentData.paymentMethodData.tokenizationData.token })
|
|
6128
6200
|
} }, _this4.isShippingRequired() && {
|
|
6129
|
-
shipping: _extends(_extends(_extends(_extends(_extends({}, shippingOptionMethod && { method: shippingOptionMethod }), _this4.hasShippingOptions() && { options: _this4.meta.shipping_options }), shippingAddressLine1 && { address_line1: shippingAddressLine1 }), shippingAddressLine2 && { address_line2: shippingAddressLine2 }), { address_country: (
|
|
6130
|
-
first_name: (
|
|
6201
|
+
shipping: _extends(_extends(_extends(_extends(_extends({}, shippingOptionMethod && { method: shippingOptionMethod }), _this4.hasShippingOptions() && { options: _this4.meta.shipping_options }), shippingAddressLine1 && { address_line1: shippingAddressLine1 }), shippingAddressLine2 && { address_line2: shippingAddressLine2 }), { address_country: (_r = paymentData === null || paymentData === void 0 ? void 0 : paymentData.shippingAddress) === null || _r === void 0 ? void 0 : _r.countryCode, address_city: (_s = paymentData === null || paymentData === void 0 ? void 0 : paymentData.shippingAddress) === null || _s === void 0 ? void 0 : _s.locality, address_postcode: (_t = paymentData === null || paymentData === void 0 ? void 0 : paymentData.shippingAddress) === null || _t === void 0 ? void 0 : _t.postalCode, address_state: (_u = paymentData === null || paymentData === void 0 ? void 0 : paymentData.shippingAddress) === null || _u === void 0 ? void 0 : _u.administrativeArea, contact: {
|
|
6202
|
+
first_name: (_v = paymentData === null || paymentData === void 0 ? void 0 : paymentData.shippingAddress) === null || _v === void 0 ? void 0 : _v.name,
|
|
6131
6203
|
email: paymentData === null || paymentData === void 0 ? void 0 : paymentData.email,
|
|
6132
|
-
phone: (
|
|
6204
|
+
phone: (_w = paymentData === null || paymentData === void 0 ? void 0 : paymentData.shippingAddress) === null || _w === void 0 ? void 0 : _w.phoneNumber
|
|
6133
6205
|
} })
|
|
6134
6206
|
}),
|
|
6135
6207
|
onSuccess: function onSuccess() {
|