@paystack/inline-js 2.16.0-dev.4 → 2.16.0-dev.5
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/dist/inline.js +21 -18
- package/es/inline.js +21 -18
- package/lib/inline.js +21 -18
- package/package.json +1 -1
package/dist/inline.js
CHANGED
|
@@ -205,8 +205,7 @@ var PaystackPop = (function () {
|
|
|
205
205
|
pusherUrl: 'http://localhost:8081/static/vendor/pusher.min.js'
|
|
206
206
|
});
|
|
207
207
|
var stagingConfig = _objectSpread2(_objectSpread2({}, baseConfig), {}, {
|
|
208
|
-
|
|
209
|
-
checkoutUrl: 'https://deploy-preview-120--checkout-ui-vue3.netlify.app',
|
|
208
|
+
checkoutUrl: 'https://checkout-studio.paystack.com/',
|
|
210
209
|
paymentBaseUrl: 'https://legacy-staging.paystack.co/',
|
|
211
210
|
paystackApiUrl: 'https://studio-api.paystack.co/',
|
|
212
211
|
siteUrl: 'https://beta.paystack.com',
|
|
@@ -744,7 +743,7 @@ var PaystackPop = (function () {
|
|
|
744
743
|
function getPaymentRequestContainer(container) {
|
|
745
744
|
return document.querySelector("#".concat(container));
|
|
746
745
|
}
|
|
747
|
-
function mountPaymentRequestButtons(container, _ref3) {
|
|
746
|
+
function mountPaymentRequestButtons(container, _ref3, merchantId) {
|
|
748
747
|
var _ref3$channels = _ref3.channels,
|
|
749
748
|
channels = _ref3$channels === void 0 ? [] : _ref3$channels,
|
|
750
749
|
_ref3$styles = _ref3.styles,
|
|
@@ -762,16 +761,24 @@ var PaystackPop = (function () {
|
|
|
762
761
|
}
|
|
763
762
|
|
|
764
763
|
loadScript('https://applepay.cdn-apple.com/jsapi/v1.1.0/apple-pay-sdk.js', container).then(function () {
|
|
765
|
-
|
|
766
|
-
*
|
|
767
|
-
*
|
|
768
|
-
*
|
|
764
|
+
/*
|
|
765
|
+
* We are currently attempting to deprecate the below code to check webpackjsonp is an array.
|
|
766
|
+
* To do this safely, we are limiting this change to single test integration before rolling
|
|
767
|
+
* out more widely
|
|
769
768
|
*/
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
769
|
+
var TEST_INTEGRATION = 1077497;
|
|
770
|
+
/**
|
|
771
|
+
* The Apple Pay SDK expects `window.webpackJsonp` to be array-like
|
|
772
|
+
* but we have seen instances where that is not the case, causing the SDK to throw errors
|
|
773
|
+
* so in this scenario, we opt out of using the SDK
|
|
774
|
+
*/
|
|
775
|
+
|
|
776
|
+
if (merchantId && merchantId !== TEST_INTEGRATION) {
|
|
777
|
+
if (window && !Array.isArray(window.webpackJsonp)) {
|
|
778
|
+
throw new Error("Incorrect data type for 'webpackJsonp', expected array, got ".concat(_typeof(window.webpackJsonp), ". Switching to fallback apple pay button"));
|
|
779
|
+
}
|
|
780
|
+
}
|
|
781
|
+
|
|
775
782
|
mountApplePayButton(container, {
|
|
776
783
|
styles: parseApplePayCustomStyles(styles.applePay),
|
|
777
784
|
theme: styles.theme
|
|
@@ -1770,10 +1777,6 @@ var PaystackPop = (function () {
|
|
|
1770
1777
|
return new Promise(function (resolve, reject) {
|
|
1771
1778
|
transaction.requestInline().then(function (response) {
|
|
1772
1779
|
var shouldLoadPreCheckoutModal = response.channels.includes('apple_pay');
|
|
1773
|
-
inlineInstance.newTransaction({
|
|
1774
|
-
inlineTransaction: transaction
|
|
1775
|
-
});
|
|
1776
|
-
resolve(transaction);
|
|
1777
1780
|
|
|
1778
1781
|
if (!shouldLoadPreCheckoutModal) {
|
|
1779
1782
|
inlineInstance.newTransaction({
|
|
@@ -1797,7 +1800,7 @@ var PaystackPop = (function () {
|
|
|
1797
1800
|
borderRadius: '5px'
|
|
1798
1801
|
}
|
|
1799
1802
|
}
|
|
1800
|
-
}).then(function () {
|
|
1803
|
+
}, response.merchant_id).then(function () {
|
|
1801
1804
|
inlineInstance.registerPreCheckoutModalEventListeners();
|
|
1802
1805
|
inlineInstance.registerPaymentRequestEventListeners();
|
|
1803
1806
|
animatePreCheckoutModalIn(inlineInstance.preCheckoutModal);
|
|
@@ -1998,7 +2001,7 @@ var PaystackPop = (function () {
|
|
|
1998
2001
|
mountPaymentRequestButtons(inlineInstance.paymentRequestContainer, {
|
|
1999
2002
|
channels: response.channels,
|
|
2000
2003
|
styles: styles
|
|
2001
|
-
}).then(function (mountedElements) {
|
|
2004
|
+
}, response.merchant_id).then(function (mountedElements) {
|
|
2002
2005
|
if (onElementsMount) {
|
|
2003
2006
|
onElementsMount(mountedElements);
|
|
2004
2007
|
}
|
package/es/inline.js
CHANGED
|
@@ -202,8 +202,7 @@ var devConfig = _objectSpread2(_objectSpread2({}, baseConfig), {}, {
|
|
|
202
202
|
pusherUrl: 'http://localhost:8081/static/vendor/pusher.min.js'
|
|
203
203
|
});
|
|
204
204
|
var stagingConfig = _objectSpread2(_objectSpread2({}, baseConfig), {}, {
|
|
205
|
-
|
|
206
|
-
checkoutUrl: 'https://deploy-preview-120--checkout-ui-vue3.netlify.app',
|
|
205
|
+
checkoutUrl: 'https://checkout-studio.paystack.com/',
|
|
207
206
|
paymentBaseUrl: 'https://legacy-staging.paystack.co/',
|
|
208
207
|
paystackApiUrl: 'https://studio-api.paystack.co/',
|
|
209
208
|
siteUrl: 'https://beta.paystack.com',
|
|
@@ -741,7 +740,7 @@ function mountApplePayFallbackButton(container, _ref2) {
|
|
|
741
740
|
function getPaymentRequestContainer(container) {
|
|
742
741
|
return document.querySelector("#".concat(container));
|
|
743
742
|
}
|
|
744
|
-
function mountPaymentRequestButtons(container, _ref3) {
|
|
743
|
+
function mountPaymentRequestButtons(container, _ref3, merchantId) {
|
|
745
744
|
var _ref3$channels = _ref3.channels,
|
|
746
745
|
channels = _ref3$channels === void 0 ? [] : _ref3$channels,
|
|
747
746
|
_ref3$styles = _ref3.styles,
|
|
@@ -759,16 +758,24 @@ function mountPaymentRequestButtons(container, _ref3) {
|
|
|
759
758
|
}
|
|
760
759
|
|
|
761
760
|
loadScript('https://applepay.cdn-apple.com/jsapi/v1.1.0/apple-pay-sdk.js', container).then(function () {
|
|
762
|
-
|
|
763
|
-
*
|
|
764
|
-
*
|
|
765
|
-
*
|
|
761
|
+
/*
|
|
762
|
+
* We are currently attempting to deprecate the below code to check webpackjsonp is an array.
|
|
763
|
+
* To do this safely, we are limiting this change to single test integration before rolling
|
|
764
|
+
* out more widely
|
|
766
765
|
*/
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
766
|
+
var TEST_INTEGRATION = 1077497;
|
|
767
|
+
/**
|
|
768
|
+
* The Apple Pay SDK expects `window.webpackJsonp` to be array-like
|
|
769
|
+
* but we have seen instances where that is not the case, causing the SDK to throw errors
|
|
770
|
+
* so in this scenario, we opt out of using the SDK
|
|
771
|
+
*/
|
|
772
|
+
|
|
773
|
+
if (merchantId && merchantId !== TEST_INTEGRATION) {
|
|
774
|
+
if (window && !Array.isArray(window.webpackJsonp)) {
|
|
775
|
+
throw new Error("Incorrect data type for 'webpackJsonp', expected array, got ".concat(_typeof(window.webpackJsonp), ". Switching to fallback apple pay button"));
|
|
776
|
+
}
|
|
777
|
+
}
|
|
778
|
+
|
|
772
779
|
mountApplePayButton(container, {
|
|
773
780
|
styles: parseApplePayCustomStyles(styles.applePay),
|
|
774
781
|
theme: styles.theme
|
|
@@ -1767,10 +1774,6 @@ var Inline = /*#__PURE__*/function () {
|
|
|
1767
1774
|
return new Promise(function (resolve, reject) {
|
|
1768
1775
|
transaction.requestInline().then(function (response) {
|
|
1769
1776
|
var shouldLoadPreCheckoutModal = response.channels.includes('apple_pay');
|
|
1770
|
-
inlineInstance.newTransaction({
|
|
1771
|
-
inlineTransaction: transaction
|
|
1772
|
-
});
|
|
1773
|
-
resolve(transaction);
|
|
1774
1777
|
|
|
1775
1778
|
if (!shouldLoadPreCheckoutModal) {
|
|
1776
1779
|
inlineInstance.newTransaction({
|
|
@@ -1794,7 +1797,7 @@ var Inline = /*#__PURE__*/function () {
|
|
|
1794
1797
|
borderRadius: '5px'
|
|
1795
1798
|
}
|
|
1796
1799
|
}
|
|
1797
|
-
}).then(function () {
|
|
1800
|
+
}, response.merchant_id).then(function () {
|
|
1798
1801
|
inlineInstance.registerPreCheckoutModalEventListeners();
|
|
1799
1802
|
inlineInstance.registerPaymentRequestEventListeners();
|
|
1800
1803
|
animatePreCheckoutModalIn(inlineInstance.preCheckoutModal);
|
|
@@ -1995,7 +1998,7 @@ var Inline = /*#__PURE__*/function () {
|
|
|
1995
1998
|
mountPaymentRequestButtons(inlineInstance.paymentRequestContainer, {
|
|
1996
1999
|
channels: response.channels,
|
|
1997
2000
|
styles: styles
|
|
1998
|
-
}).then(function (mountedElements) {
|
|
2001
|
+
}, response.merchant_id).then(function (mountedElements) {
|
|
1999
2002
|
if (onElementsMount) {
|
|
2000
2003
|
onElementsMount(mountedElements);
|
|
2001
2004
|
}
|
package/lib/inline.js
CHANGED
|
@@ -204,8 +204,7 @@ var devConfig = _objectSpread2(_objectSpread2({}, baseConfig), {}, {
|
|
|
204
204
|
pusherUrl: 'http://localhost:8081/static/vendor/pusher.min.js'
|
|
205
205
|
});
|
|
206
206
|
var stagingConfig = _objectSpread2(_objectSpread2({}, baseConfig), {}, {
|
|
207
|
-
|
|
208
|
-
checkoutUrl: 'https://deploy-preview-120--checkout-ui-vue3.netlify.app',
|
|
207
|
+
checkoutUrl: 'https://checkout-studio.paystack.com/',
|
|
209
208
|
paymentBaseUrl: 'https://legacy-staging.paystack.co/',
|
|
210
209
|
paystackApiUrl: 'https://studio-api.paystack.co/',
|
|
211
210
|
siteUrl: 'https://beta.paystack.com',
|
|
@@ -743,7 +742,7 @@ function mountApplePayFallbackButton(container, _ref2) {
|
|
|
743
742
|
function getPaymentRequestContainer(container) {
|
|
744
743
|
return document.querySelector("#".concat(container));
|
|
745
744
|
}
|
|
746
|
-
function mountPaymentRequestButtons(container, _ref3) {
|
|
745
|
+
function mountPaymentRequestButtons(container, _ref3, merchantId) {
|
|
747
746
|
var _ref3$channels = _ref3.channels,
|
|
748
747
|
channels = _ref3$channels === void 0 ? [] : _ref3$channels,
|
|
749
748
|
_ref3$styles = _ref3.styles,
|
|
@@ -761,16 +760,24 @@ function mountPaymentRequestButtons(container, _ref3) {
|
|
|
761
760
|
}
|
|
762
761
|
|
|
763
762
|
loadScript('https://applepay.cdn-apple.com/jsapi/v1.1.0/apple-pay-sdk.js', container).then(function () {
|
|
764
|
-
|
|
765
|
-
*
|
|
766
|
-
*
|
|
767
|
-
*
|
|
763
|
+
/*
|
|
764
|
+
* We are currently attempting to deprecate the below code to check webpackjsonp is an array.
|
|
765
|
+
* To do this safely, we are limiting this change to single test integration before rolling
|
|
766
|
+
* out more widely
|
|
768
767
|
*/
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
768
|
+
var TEST_INTEGRATION = 1077497;
|
|
769
|
+
/**
|
|
770
|
+
* The Apple Pay SDK expects `window.webpackJsonp` to be array-like
|
|
771
|
+
* but we have seen instances where that is not the case, causing the SDK to throw errors
|
|
772
|
+
* so in this scenario, we opt out of using the SDK
|
|
773
|
+
*/
|
|
774
|
+
|
|
775
|
+
if (merchantId && merchantId !== TEST_INTEGRATION) {
|
|
776
|
+
if (window && !Array.isArray(window.webpackJsonp)) {
|
|
777
|
+
throw new Error("Incorrect data type for 'webpackJsonp', expected array, got ".concat(_typeof(window.webpackJsonp), ". Switching to fallback apple pay button"));
|
|
778
|
+
}
|
|
779
|
+
}
|
|
780
|
+
|
|
774
781
|
mountApplePayButton(container, {
|
|
775
782
|
styles: parseApplePayCustomStyles(styles.applePay),
|
|
776
783
|
theme: styles.theme
|
|
@@ -1769,10 +1776,6 @@ var Inline = /*#__PURE__*/function () {
|
|
|
1769
1776
|
return new Promise(function (resolve, reject) {
|
|
1770
1777
|
transaction.requestInline().then(function (response) {
|
|
1771
1778
|
var shouldLoadPreCheckoutModal = response.channels.includes('apple_pay');
|
|
1772
|
-
inlineInstance.newTransaction({
|
|
1773
|
-
inlineTransaction: transaction
|
|
1774
|
-
});
|
|
1775
|
-
resolve(transaction);
|
|
1776
1779
|
|
|
1777
1780
|
if (!shouldLoadPreCheckoutModal) {
|
|
1778
1781
|
inlineInstance.newTransaction({
|
|
@@ -1796,7 +1799,7 @@ var Inline = /*#__PURE__*/function () {
|
|
|
1796
1799
|
borderRadius: '5px'
|
|
1797
1800
|
}
|
|
1798
1801
|
}
|
|
1799
|
-
}).then(function () {
|
|
1802
|
+
}, response.merchant_id).then(function () {
|
|
1800
1803
|
inlineInstance.registerPreCheckoutModalEventListeners();
|
|
1801
1804
|
inlineInstance.registerPaymentRequestEventListeners();
|
|
1802
1805
|
animatePreCheckoutModalIn(inlineInstance.preCheckoutModal);
|
|
@@ -1997,7 +2000,7 @@ var Inline = /*#__PURE__*/function () {
|
|
|
1997
2000
|
mountPaymentRequestButtons(inlineInstance.paymentRequestContainer, {
|
|
1998
2001
|
channels: response.channels,
|
|
1999
2002
|
styles: styles
|
|
2000
|
-
}).then(function (mountedElements) {
|
|
2003
|
+
}, response.merchant_id).then(function (mountedElements) {
|
|
2001
2004
|
if (onElementsMount) {
|
|
2002
2005
|
onElementsMount(mountedElements);
|
|
2003
2006
|
}
|