@paystack/inline-js 2.22.6-dev.1 → 2.22.7-dev.1

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
@@ -887,11 +887,14 @@ var PaystackPop = (function () {
887
887
  container.appendChild(paymentRequestContainer);
888
888
  }
889
889
 
890
- var openPaystackPopButton = createOpenPaystackPopButton('Use other payment methods');
891
- container.appendChild(openPaystackPopButton);
890
+ if (options.hasOtherPaymentMethods) {
891
+ var openPaystackPopButton = createOpenPaystackPopButton('Use other payment methods');
892
+ container.appendChild(openPaystackPopButton);
893
+ }
892
894
  }
893
895
 
894
- function defaultPreCheckoutModalView(container) {
896
+ function defaultPreCheckoutModalView(container, _ref5) {
897
+ var hasOtherPaymentMethods = _ref5.hasOtherPaymentMethods;
895
898
  var applePayIcon = document.createElement('div');
896
899
  applePayIcon.innerHTML = applePayMarkLight;
897
900
  container.appendChild(applePayIcon);
@@ -901,8 +904,17 @@ var PaystackPop = (function () {
901
904
  container.appendChild(instruction);
902
905
  var paymentRequestContainer = createPaymentRequestContainer();
903
906
  container.appendChild(paymentRequestContainer);
904
- var openPaystackPopButton = createOpenPaystackPopButton('More payment options');
905
- container.appendChild(openPaystackPopButton);
907
+
908
+ if (hasOtherPaymentMethods) {
909
+ var openPaystackPopButton = createOpenPaystackPopButton('More payment options');
910
+ container.appendChild(openPaystackPopButton);
911
+ }
912
+ }
913
+
914
+ function hasNonPrecheckoutPaymentMethods(channels) {
915
+ return channels.some(function (channel) {
916
+ return channel !== 'apple_pay';
917
+ });
906
918
  }
907
919
 
908
920
  function mountPreCheckoutModal(id, transaction) {
@@ -925,13 +937,14 @@ var PaystackPop = (function () {
925
937
  content.classList.add('pre-checkout-modal__content');
926
938
  modal.appendChild(content);
927
939
 
928
- var _ref5 = transaction || {},
929
- merchantLogo = _ref5.merchant_logo,
930
- merchantName = _ref5.merchant_name,
931
- email = _ref5.email,
932
- amount = _ref5.amount,
933
- currency = _ref5.currency,
934
- label = _ref5.label;
940
+ var _ref6 = transaction || {},
941
+ merchantLogo = _ref6.merchant_logo,
942
+ merchantName = _ref6.merchant_name,
943
+ email = _ref6.email,
944
+ amount = _ref6.amount,
945
+ currency = _ref6.currency,
946
+ label = _ref6.label,
947
+ channels = _ref6.channels;
935
948
 
936
949
  var formattedAmount = new Intl.NumberFormat('en', {
937
950
  style: 'currency',
@@ -950,10 +963,13 @@ var PaystackPop = (function () {
950
963
 
951
964
  if (options.canPayWithVault) {
952
965
  vaultPreCheckoutModalView(wrapper, {
953
- canPayWithApplePay: options.canPayWithApplePay
966
+ canPayWithApplePay: options.canPayWithApplePay,
967
+ hasOtherPaymentMethods: hasNonPrecheckoutPaymentMethods(channels)
954
968
  });
955
969
  } else {
956
- defaultPreCheckoutModalView(wrapper);
970
+ defaultPreCheckoutModalView(wrapper, {
971
+ hasOtherPaymentMethods: hasNonPrecheckoutPaymentMethods(channels)
972
+ });
957
973
  }
958
974
 
959
975
  wrapper.innerHTML = wrapper.innerHTML + secureByPaystackWhite + secureByPaystackGrey;
@@ -1986,13 +2002,16 @@ var PaystackPop = (function () {
1986
2002
  document.addEventListener('touchstart', handleTouchStart, true);
1987
2003
  document.addEventListener('touchend', handleClosePreCheckoutModal, true);
1988
2004
  var openPaystackPopButton = getPreCheckoutModalOpenPaystackPopButton(this.preCheckoutModal);
1989
- var payWithVaultButton = getPreCheckoutModalPayWithVaultButton(this.preCheckoutModal);
1990
2005
 
1991
- openPaystackPopButton.onclick = function () {
1992
- _this2.closePreCheckoutModal();
2006
+ if (openPaystackPopButton) {
2007
+ openPaystackPopButton.onclick = function () {
2008
+ _this2.closePreCheckoutModal();
1993
2009
 
1994
- _this2.animateCheckoutIn();
1995
- };
2010
+ _this2.animateCheckoutIn();
2011
+ };
2012
+ }
2013
+
2014
+ var payWithVaultButton = getPreCheckoutModalPayWithVaultButton(this.preCheckoutModal);
1996
2015
 
1997
2016
  if (payWithVaultButton) {
1998
2017
  payWithVaultButton.onclick = function () {
package/es/inline.js CHANGED
@@ -884,11 +884,14 @@ function vaultPreCheckoutModalView(container) {
884
884
  container.appendChild(paymentRequestContainer);
885
885
  }
886
886
 
887
- var openPaystackPopButton = createOpenPaystackPopButton('Use other payment methods');
888
- container.appendChild(openPaystackPopButton);
887
+ if (options.hasOtherPaymentMethods) {
888
+ var openPaystackPopButton = createOpenPaystackPopButton('Use other payment methods');
889
+ container.appendChild(openPaystackPopButton);
890
+ }
889
891
  }
890
892
 
891
- function defaultPreCheckoutModalView(container) {
893
+ function defaultPreCheckoutModalView(container, _ref5) {
894
+ var hasOtherPaymentMethods = _ref5.hasOtherPaymentMethods;
892
895
  var applePayIcon = document.createElement('div');
893
896
  applePayIcon.innerHTML = applePayMarkLight;
894
897
  container.appendChild(applePayIcon);
@@ -898,8 +901,17 @@ function defaultPreCheckoutModalView(container) {
898
901
  container.appendChild(instruction);
899
902
  var paymentRequestContainer = createPaymentRequestContainer();
900
903
  container.appendChild(paymentRequestContainer);
901
- var openPaystackPopButton = createOpenPaystackPopButton('More payment options');
902
- container.appendChild(openPaystackPopButton);
904
+
905
+ if (hasOtherPaymentMethods) {
906
+ var openPaystackPopButton = createOpenPaystackPopButton('More payment options');
907
+ container.appendChild(openPaystackPopButton);
908
+ }
909
+ }
910
+
911
+ function hasNonPrecheckoutPaymentMethods(channels) {
912
+ return channels.some(function (channel) {
913
+ return channel !== 'apple_pay';
914
+ });
903
915
  }
904
916
 
905
917
  function mountPreCheckoutModal(id, transaction) {
@@ -922,13 +934,14 @@ function mountPreCheckoutModal(id, transaction) {
922
934
  content.classList.add('pre-checkout-modal__content');
923
935
  modal.appendChild(content);
924
936
 
925
- var _ref5 = transaction || {},
926
- merchantLogo = _ref5.merchant_logo,
927
- merchantName = _ref5.merchant_name,
928
- email = _ref5.email,
929
- amount = _ref5.amount,
930
- currency = _ref5.currency,
931
- label = _ref5.label;
937
+ var _ref6 = transaction || {},
938
+ merchantLogo = _ref6.merchant_logo,
939
+ merchantName = _ref6.merchant_name,
940
+ email = _ref6.email,
941
+ amount = _ref6.amount,
942
+ currency = _ref6.currency,
943
+ label = _ref6.label,
944
+ channels = _ref6.channels;
932
945
 
933
946
  var formattedAmount = new Intl.NumberFormat('en', {
934
947
  style: 'currency',
@@ -947,10 +960,13 @@ function mountPreCheckoutModal(id, transaction) {
947
960
 
948
961
  if (options.canPayWithVault) {
949
962
  vaultPreCheckoutModalView(wrapper, {
950
- canPayWithApplePay: options.canPayWithApplePay
963
+ canPayWithApplePay: options.canPayWithApplePay,
964
+ hasOtherPaymentMethods: hasNonPrecheckoutPaymentMethods(channels)
951
965
  });
952
966
  } else {
953
- defaultPreCheckoutModalView(wrapper);
967
+ defaultPreCheckoutModalView(wrapper, {
968
+ hasOtherPaymentMethods: hasNonPrecheckoutPaymentMethods(channels)
969
+ });
954
970
  }
955
971
 
956
972
  wrapper.innerHTML = wrapper.innerHTML + secureByPaystackWhite + secureByPaystackGrey;
@@ -1983,13 +1999,16 @@ var Inline = /*#__PURE__*/function () {
1983
1999
  document.addEventListener('touchstart', handleTouchStart, true);
1984
2000
  document.addEventListener('touchend', handleClosePreCheckoutModal, true);
1985
2001
  var openPaystackPopButton = getPreCheckoutModalOpenPaystackPopButton(this.preCheckoutModal);
1986
- var payWithVaultButton = getPreCheckoutModalPayWithVaultButton(this.preCheckoutModal);
1987
2002
 
1988
- openPaystackPopButton.onclick = function () {
1989
- _this2.closePreCheckoutModal();
2003
+ if (openPaystackPopButton) {
2004
+ openPaystackPopButton.onclick = function () {
2005
+ _this2.closePreCheckoutModal();
1990
2006
 
1991
- _this2.animateCheckoutIn();
1992
- };
2007
+ _this2.animateCheckoutIn();
2008
+ };
2009
+ }
2010
+
2011
+ var payWithVaultButton = getPreCheckoutModalPayWithVaultButton(this.preCheckoutModal);
1993
2012
 
1994
2013
  if (payWithVaultButton) {
1995
2014
  payWithVaultButton.onclick = function () {
package/lib/inline.js CHANGED
@@ -886,11 +886,14 @@ function vaultPreCheckoutModalView(container) {
886
886
  container.appendChild(paymentRequestContainer);
887
887
  }
888
888
 
889
- var openPaystackPopButton = createOpenPaystackPopButton('Use other payment methods');
890
- container.appendChild(openPaystackPopButton);
889
+ if (options.hasOtherPaymentMethods) {
890
+ var openPaystackPopButton = createOpenPaystackPopButton('Use other payment methods');
891
+ container.appendChild(openPaystackPopButton);
892
+ }
891
893
  }
892
894
 
893
- function defaultPreCheckoutModalView(container) {
895
+ function defaultPreCheckoutModalView(container, _ref5) {
896
+ var hasOtherPaymentMethods = _ref5.hasOtherPaymentMethods;
894
897
  var applePayIcon = document.createElement('div');
895
898
  applePayIcon.innerHTML = applePayMarkLight;
896
899
  container.appendChild(applePayIcon);
@@ -900,8 +903,17 @@ function defaultPreCheckoutModalView(container) {
900
903
  container.appendChild(instruction);
901
904
  var paymentRequestContainer = createPaymentRequestContainer();
902
905
  container.appendChild(paymentRequestContainer);
903
- var openPaystackPopButton = createOpenPaystackPopButton('More payment options');
904
- container.appendChild(openPaystackPopButton);
906
+
907
+ if (hasOtherPaymentMethods) {
908
+ var openPaystackPopButton = createOpenPaystackPopButton('More payment options');
909
+ container.appendChild(openPaystackPopButton);
910
+ }
911
+ }
912
+
913
+ function hasNonPrecheckoutPaymentMethods(channels) {
914
+ return channels.some(function (channel) {
915
+ return channel !== 'apple_pay';
916
+ });
905
917
  }
906
918
 
907
919
  function mountPreCheckoutModal(id, transaction) {
@@ -924,13 +936,14 @@ function mountPreCheckoutModal(id, transaction) {
924
936
  content.classList.add('pre-checkout-modal__content');
925
937
  modal.appendChild(content);
926
938
 
927
- var _ref5 = transaction || {},
928
- merchantLogo = _ref5.merchant_logo,
929
- merchantName = _ref5.merchant_name,
930
- email = _ref5.email,
931
- amount = _ref5.amount,
932
- currency = _ref5.currency,
933
- label = _ref5.label;
939
+ var _ref6 = transaction || {},
940
+ merchantLogo = _ref6.merchant_logo,
941
+ merchantName = _ref6.merchant_name,
942
+ email = _ref6.email,
943
+ amount = _ref6.amount,
944
+ currency = _ref6.currency,
945
+ label = _ref6.label,
946
+ channels = _ref6.channels;
934
947
 
935
948
  var formattedAmount = new Intl.NumberFormat('en', {
936
949
  style: 'currency',
@@ -949,10 +962,13 @@ function mountPreCheckoutModal(id, transaction) {
949
962
 
950
963
  if (options.canPayWithVault) {
951
964
  vaultPreCheckoutModalView(wrapper, {
952
- canPayWithApplePay: options.canPayWithApplePay
965
+ canPayWithApplePay: options.canPayWithApplePay,
966
+ hasOtherPaymentMethods: hasNonPrecheckoutPaymentMethods(channels)
953
967
  });
954
968
  } else {
955
- defaultPreCheckoutModalView(wrapper);
969
+ defaultPreCheckoutModalView(wrapper, {
970
+ hasOtherPaymentMethods: hasNonPrecheckoutPaymentMethods(channels)
971
+ });
956
972
  }
957
973
 
958
974
  wrapper.innerHTML = wrapper.innerHTML + secureByPaystackWhite + secureByPaystackGrey;
@@ -1985,13 +2001,16 @@ var Inline = /*#__PURE__*/function () {
1985
2001
  document.addEventListener('touchstart', handleTouchStart, true);
1986
2002
  document.addEventListener('touchend', handleClosePreCheckoutModal, true);
1987
2003
  var openPaystackPopButton = getPreCheckoutModalOpenPaystackPopButton(this.preCheckoutModal);
1988
- var payWithVaultButton = getPreCheckoutModalPayWithVaultButton(this.preCheckoutModal);
1989
2004
 
1990
- openPaystackPopButton.onclick = function () {
1991
- _this2.closePreCheckoutModal();
2005
+ if (openPaystackPopButton) {
2006
+ openPaystackPopButton.onclick = function () {
2007
+ _this2.closePreCheckoutModal();
1992
2008
 
1993
- _this2.animateCheckoutIn();
1994
- };
2009
+ _this2.animateCheckoutIn();
2010
+ };
2011
+ }
2012
+
2013
+ var payWithVaultButton = getPreCheckoutModalPayWithVaultButton(this.preCheckoutModal);
1995
2014
 
1996
2015
  if (payWithVaultButton) {
1997
2016
  payWithVaultButton.onclick = function () {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paystack/inline-js",
3
- "version": "2.22.6-dev.1",
3
+ "version": "2.22.7-dev.1",
4
4
  "description": "Client-side library to load the Paystack checkout form",
5
5
  "main": "lib/inline.js",
6
6
  "module": "es/inline.js",