@paystack/inline-js 2.16.0-dev.3 → 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 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
- // checkoutUrl: 'https://checkout-studio.paystack.com/',
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,13 +761,22 @@ 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
- * The Apple Pay SDK expects `window.webpackJsonp` to be array-like
767
- * but we have seen instances where that is not the case, causing the SDK to throw errors
768
- * so in this scenario, we opt out of using the SDK
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
- if (window && !Array.isArray(window.webpackJsonp)) {
771
- throw new Error("Incorrect data type for 'webpackJsonp', expected array, got ".concat(_typeof(window.webpackJsonp), ". Switching to fallback apple pay button"));
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
+ }
772
780
  }
773
781
 
774
782
  mountApplePayButton(container, {
@@ -1769,10 +1777,6 @@ var PaystackPop = (function () {
1769
1777
  return new Promise(function (resolve, reject) {
1770
1778
  transaction.requestInline().then(function (response) {
1771
1779
  var shouldLoadPreCheckoutModal = response.channels.includes('apple_pay');
1772
- inlineInstance.newTransaction({
1773
- inlineTransaction: transaction
1774
- });
1775
- resolve(transaction);
1776
1780
 
1777
1781
  if (!shouldLoadPreCheckoutModal) {
1778
1782
  inlineInstance.newTransaction({
@@ -1796,7 +1800,7 @@ var PaystackPop = (function () {
1796
1800
  borderRadius: '5px'
1797
1801
  }
1798
1802
  }
1799
- }).then(function () {
1803
+ }, response.merchant_id).then(function () {
1800
1804
  inlineInstance.registerPreCheckoutModalEventListeners();
1801
1805
  inlineInstance.registerPaymentRequestEventListeners();
1802
1806
  animatePreCheckoutModalIn(inlineInstance.preCheckoutModal);
@@ -1997,7 +2001,7 @@ var PaystackPop = (function () {
1997
2001
  mountPaymentRequestButtons(inlineInstance.paymentRequestContainer, {
1998
2002
  channels: response.channels,
1999
2003
  styles: styles
2000
- }).then(function (mountedElements) {
2004
+ }, response.merchant_id).then(function (mountedElements) {
2001
2005
  if (onElementsMount) {
2002
2006
  onElementsMount(mountedElements);
2003
2007
  }
@@ -2039,7 +2043,6 @@ var PaystackPop = (function () {
2039
2043
  var _this4 = this;
2040
2044
 
2041
2045
  var applePayButton = getApplePayButton(this.paymentRequestContainer);
2042
- console.log('apple pay button', JSON.stringify(applePayButton));
2043
2046
 
2044
2047
  applePayButton.onclick = function () {
2045
2048
  return _this4.startApplePay();
@@ -2049,18 +2052,14 @@ var PaystackPop = (function () {
2049
2052
  key: "registerPaymentRequestEventListeners",
2050
2053
  value: function registerPaymentRequestEventListeners() {
2051
2054
  var transaction = this.activeTransaction();
2052
- console.log('transaction', transaction);
2053
2055
 
2054
2056
  if (transaction) {
2055
2057
  if (canUseApplePay(transaction.response.channels)) {
2056
2058
  this.registerApplePayEventListener();
2057
- console.log('registered payment request event listeners');
2058
2059
  } else {
2059
2060
  removeAllChildNodes(this.paymentRequestContainer);
2060
- console.log('removed cn');
2061
2061
  }
2062
2062
  } else {
2063
- console.log('removed cn');
2064
2063
  removeAllChildNodes(this.paymentRequestContainer);
2065
2064
  }
2066
2065
  }
@@ -2071,7 +2070,6 @@ var PaystackPop = (function () {
2071
2070
 
2072
2071
  var paymentMethod = 'apple pay';
2073
2072
  var transaction = this.activeTransaction();
2074
- console.log('starting apple pay with transaction', transaction);
2075
2073
 
2076
2074
  if (transaction) {
2077
2075
  var paymentAttemptAnalyticsPayload = {
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
- // checkoutUrl: 'https://checkout-studio.paystack.com/',
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,13 +758,22 @@ 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
- * The Apple Pay SDK expects `window.webpackJsonp` to be array-like
764
- * but we have seen instances where that is not the case, causing the SDK to throw errors
765
- * so in this scenario, we opt out of using the SDK
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
- if (window && !Array.isArray(window.webpackJsonp)) {
768
- throw new Error("Incorrect data type for 'webpackJsonp', expected array, got ".concat(_typeof(window.webpackJsonp), ". Switching to fallback apple pay button"));
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
+ }
769
777
  }
770
778
 
771
779
  mountApplePayButton(container, {
@@ -1766,10 +1774,6 @@ var Inline = /*#__PURE__*/function () {
1766
1774
  return new Promise(function (resolve, reject) {
1767
1775
  transaction.requestInline().then(function (response) {
1768
1776
  var shouldLoadPreCheckoutModal = response.channels.includes('apple_pay');
1769
- inlineInstance.newTransaction({
1770
- inlineTransaction: transaction
1771
- });
1772
- resolve(transaction);
1773
1777
 
1774
1778
  if (!shouldLoadPreCheckoutModal) {
1775
1779
  inlineInstance.newTransaction({
@@ -1793,7 +1797,7 @@ var Inline = /*#__PURE__*/function () {
1793
1797
  borderRadius: '5px'
1794
1798
  }
1795
1799
  }
1796
- }).then(function () {
1800
+ }, response.merchant_id).then(function () {
1797
1801
  inlineInstance.registerPreCheckoutModalEventListeners();
1798
1802
  inlineInstance.registerPaymentRequestEventListeners();
1799
1803
  animatePreCheckoutModalIn(inlineInstance.preCheckoutModal);
@@ -1994,7 +1998,7 @@ var Inline = /*#__PURE__*/function () {
1994
1998
  mountPaymentRequestButtons(inlineInstance.paymentRequestContainer, {
1995
1999
  channels: response.channels,
1996
2000
  styles: styles
1997
- }).then(function (mountedElements) {
2001
+ }, response.merchant_id).then(function (mountedElements) {
1998
2002
  if (onElementsMount) {
1999
2003
  onElementsMount(mountedElements);
2000
2004
  }
@@ -2036,7 +2040,6 @@ var Inline = /*#__PURE__*/function () {
2036
2040
  var _this4 = this;
2037
2041
 
2038
2042
  var applePayButton = getApplePayButton(this.paymentRequestContainer);
2039
- console.log('apple pay button', JSON.stringify(applePayButton));
2040
2043
 
2041
2044
  applePayButton.onclick = function () {
2042
2045
  return _this4.startApplePay();
@@ -2046,18 +2049,14 @@ var Inline = /*#__PURE__*/function () {
2046
2049
  key: "registerPaymentRequestEventListeners",
2047
2050
  value: function registerPaymentRequestEventListeners() {
2048
2051
  var transaction = this.activeTransaction();
2049
- console.log('transaction', transaction);
2050
2052
 
2051
2053
  if (transaction) {
2052
2054
  if (canUseApplePay(transaction.response.channels)) {
2053
2055
  this.registerApplePayEventListener();
2054
- console.log('registered payment request event listeners');
2055
2056
  } else {
2056
2057
  removeAllChildNodes(this.paymentRequestContainer);
2057
- console.log('removed cn');
2058
2058
  }
2059
2059
  } else {
2060
- console.log('removed cn');
2061
2060
  removeAllChildNodes(this.paymentRequestContainer);
2062
2061
  }
2063
2062
  }
@@ -2068,7 +2067,6 @@ var Inline = /*#__PURE__*/function () {
2068
2067
 
2069
2068
  var paymentMethod = 'apple pay';
2070
2069
  var transaction = this.activeTransaction();
2071
- console.log('starting apple pay with transaction', transaction);
2072
2070
 
2073
2071
  if (transaction) {
2074
2072
  var paymentAttemptAnalyticsPayload = {
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
- // checkoutUrl: 'https://checkout-studio.paystack.com/',
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,13 +760,22 @@ 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
- * The Apple Pay SDK expects `window.webpackJsonp` to be array-like
766
- * but we have seen instances where that is not the case, causing the SDK to throw errors
767
- * so in this scenario, we opt out of using the SDK
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
- if (window && !Array.isArray(window.webpackJsonp)) {
770
- throw new Error("Incorrect data type for 'webpackJsonp', expected array, got ".concat(_typeof(window.webpackJsonp), ". Switching to fallback apple pay button"));
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
+ }
771
779
  }
772
780
 
773
781
  mountApplePayButton(container, {
@@ -1768,10 +1776,6 @@ var Inline = /*#__PURE__*/function () {
1768
1776
  return new Promise(function (resolve, reject) {
1769
1777
  transaction.requestInline().then(function (response) {
1770
1778
  var shouldLoadPreCheckoutModal = response.channels.includes('apple_pay');
1771
- inlineInstance.newTransaction({
1772
- inlineTransaction: transaction
1773
- });
1774
- resolve(transaction);
1775
1779
 
1776
1780
  if (!shouldLoadPreCheckoutModal) {
1777
1781
  inlineInstance.newTransaction({
@@ -1795,7 +1799,7 @@ var Inline = /*#__PURE__*/function () {
1795
1799
  borderRadius: '5px'
1796
1800
  }
1797
1801
  }
1798
- }).then(function () {
1802
+ }, response.merchant_id).then(function () {
1799
1803
  inlineInstance.registerPreCheckoutModalEventListeners();
1800
1804
  inlineInstance.registerPaymentRequestEventListeners();
1801
1805
  animatePreCheckoutModalIn(inlineInstance.preCheckoutModal);
@@ -1996,7 +2000,7 @@ var Inline = /*#__PURE__*/function () {
1996
2000
  mountPaymentRequestButtons(inlineInstance.paymentRequestContainer, {
1997
2001
  channels: response.channels,
1998
2002
  styles: styles
1999
- }).then(function (mountedElements) {
2003
+ }, response.merchant_id).then(function (mountedElements) {
2000
2004
  if (onElementsMount) {
2001
2005
  onElementsMount(mountedElements);
2002
2006
  }
@@ -2038,7 +2042,6 @@ var Inline = /*#__PURE__*/function () {
2038
2042
  var _this4 = this;
2039
2043
 
2040
2044
  var applePayButton = getApplePayButton(this.paymentRequestContainer);
2041
- console.log('apple pay button', JSON.stringify(applePayButton));
2042
2045
 
2043
2046
  applePayButton.onclick = function () {
2044
2047
  return _this4.startApplePay();
@@ -2048,18 +2051,14 @@ var Inline = /*#__PURE__*/function () {
2048
2051
  key: "registerPaymentRequestEventListeners",
2049
2052
  value: function registerPaymentRequestEventListeners() {
2050
2053
  var transaction = this.activeTransaction();
2051
- console.log('transaction', transaction);
2052
2054
 
2053
2055
  if (transaction) {
2054
2056
  if (canUseApplePay(transaction.response.channels)) {
2055
2057
  this.registerApplePayEventListener();
2056
- console.log('registered payment request event listeners');
2057
2058
  } else {
2058
2059
  removeAllChildNodes(this.paymentRequestContainer);
2059
- console.log('removed cn');
2060
2060
  }
2061
2061
  } else {
2062
- console.log('removed cn');
2063
2062
  removeAllChildNodes(this.paymentRequestContainer);
2064
2063
  }
2065
2064
  }
@@ -2070,7 +2069,6 @@ var Inline = /*#__PURE__*/function () {
2070
2069
 
2071
2070
  var paymentMethod = 'apple pay';
2072
2071
  var transaction = this.activeTransaction();
2073
- console.log('starting apple pay with transaction', transaction);
2074
2072
 
2075
2073
  if (transaction) {
2076
2074
  var paymentAttemptAnalyticsPayload = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paystack/inline-js",
3
- "version": "2.16.0-dev.3",
3
+ "version": "2.16.0-dev.5",
4
4
  "description": "Client-side library to load the Paystack checkout form",
5
5
  "main": "lib/inline.js",
6
6
  "module": "es/inline.js",