@paystack/inline-js 2.11.0-dev.5 → 2.11.0-dev.6

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.
Files changed (2) hide show
  1. package/dist/inline.js +20 -5
  2. package/package.json +1 -1
package/dist/inline.js CHANGED
@@ -228,7 +228,7 @@ var generateApplePayFallbackCSS = function generateApplePayFallbackCSS(_ref2) {
228
228
  return '\n @supports (-webkit-appearance: -apple-pay-button) { \n .apple-pay-button {\n display: inline-block;\n -webkit-appearance: -apple-pay-button;\n width: ' + width + ';\n height: ' + height + ';\n border-radius: ' + borderRadius + ';\n padding: ' + padding + ';\n -apple-pay-button-type: ' + type + ';\n -webkit-locale: ' + locale + '; \n }\n .apple-pay-button-black {\n -apple-pay-button-style: black;\n }\n .apple-pay-button-white {\n -apple-pay-button-style: white;\n }\n .apple-pay-button-white-with-line {\n -apple-pay-button-style: white-outline;\n }\n }\n\n @supports not (-webkit-appearance: -apple-pay-button) {\n .apple-pay-button {\n display: inline-block;\n background-size: 100% 60%;\n background-repeat: no-repeat;\n background-position: 50% 50%;\n border-radius: 5px;\n padding: 0px;\n box-sizing: border-box;\n min-width: 200px;\n min-height: 32px;\n max-height: 64px;\n }\n .apple-pay-button-black {\n background-image: -webkit-named-image(apple-pay-logo-white);\n background-color: black;\n }\n .apple-pay-button-white {\n background-image: -webkit-named-image(apple-pay-logo-black);\n background-color: white;\n }\n .apple-pay-button-white-with-line {\n background-image: -webkit-named-image(apple-pay-logo-black);\n background-color: white;\n border: .5px solid black;\n } \n }\n';
229
229
  };
230
230
 
231
- var preCheckoutModalCSS = '\n\n .pre-checkout-modal {\n display: none;\n position: fixed;\n z-index: 1;\n left: 0;\n top: 0;\n width: 100vw;\n height: 100%;\n overflow: auto;\n background-color: rgba(0, 0, 0, 0.75);\n transition: all 0.2s ease;\n }\n\n .pre-checkout-modal.show {\n display: block;\n }\n\n .pre-checkout-modal__content {\n position: absolute;\n bottom: 0;\n left: 0;\n right: 0;\n margin-left: auto;\n margin-right: auto;\n background-color: #fefefe;\n padding: 30px 20px;\n padding-bottom: max(30px, env(safe-area-inset-bottom));\n width: 100%;\n border-radius: 6px 6px 0 0;\n display: flex;\n flex-direction: column;\n align-items: center;\n max-width: 500px;\n\n box-sizing: border-box;\n transform: translateY(238px);\n transition: transform 0.3s cubic-bezier(.16,.81,.32,1);\n }\n\n @media only screen and (min-width: 500px) {\n .pre-checkout-modal__content {\n bottom: 0;\n top: 0;\n margin: auto;\n border-radius: 6px;\n height: fit-content;\n }\n }\n\n .pre-checkout-modal__content.show {\n transform: translateY(0);\n }\n\n .pre-checkout-modal__content > * {\n margin-top: 0;\n margin-bottom: 20px;\n }\n .pre-checkout-modal__content > *:last-child {\n margin-bottom: 0;\n }\n\n .pre-checkout-modal__content svg {\n margin: auto;\n width: 100%;\n }\n\n .pre-checkout-modal__content #apple-pay-mark--light {\n margin-bottom: 20px;\n }\n\n .pre-checkout-modal p {\n -webkit-text-size-adjust: 100%;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n text-rendering: optimizeLegibility;\n font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu",\n "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;\n color: #4E4E4E;\n line-height: 28px;\n font-size: 18px;\n font-weight: 500;\n text-align: center;\n letter-spacing: -0.3px;\n }\n\n .pre-checkout-modal button {\n height: 64px;\n width: 100%;\n background: linear-gradient(180deg, #40ad57 21.43%, #44b669 88.1%), #44b669;\n border: 1px solid #49a861;\n box-sizing: border-box;\n box-shadow: 0px 1px 4px rgba(0, 0, 0, 0.1);\n border-radius: 5px;\n text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.1);\n color: #ffffff;\n font-weight: 600;\n font-size: 18px;\n\n -webkit-text-size-adjust: 100%;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n text-rendering: optimizeLegibility;\n font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu",\n "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;\n }\n\n #payment-request-button {\n width: 100%;\n height: fit-content;\n }\n';
231
+ var preCheckoutModalCSS = '\n\n .pre-checkout-modal {\n display: none;\n position: fixed;\n z-index: 1;\n left: 0;\n top: 0;\n width: 100vw;\n height: 100%;\n overflow: auto;\n background-color: rgba(0, 0, 0, 0.75);\n transition: all 0.2s ease;\n }\n\n .pre-checkout-modal.show {\n display: block;\n }\n\n .pre-checkout-modal__content {\n position: absolute;\n bottom: 0;\n left: 0;\n right: 0;\n margin-left: auto;\n margin-right: auto;\n background-color: #fefefe;\n padding: 30px 20px;\n padding-bottom: max(30px, env(safe-area-inset-bottom));\n width: 100%;\n border-radius: 6px 6px 0 0;\n display: flex;\n flex-direction: column;\n align-items: center;\n max-width: 358px;\n\n box-sizing: border-box;\n transform: translateY(238px);\n transition: transform 0.3s cubic-bezier(.16,.81,.32,1);\n }\n\n .payment-info {\n position: relative;\n padding-bottom: 15px;\n border-bottom: solid 1px whitesmoke;\n display: flex;\n align-items: flex-start;\n justify-content: space-between;\n width: 100%;\n }\n\n .customer-email {\n color: #737373;\n font-size: 13px;\n line-height: 16px;\n }\n\n .customer-info {\n flex: 1;\n text-align: right;\n }\n\n .merchant-logo {\n display: flex;\n align-items: center;\n height: 22px;\n width: 22px;\n }\n .transaction-amount {\n margin-top: 5px;\n font-size: 13px;\n line-height: 16px;\n color: #737373;\n }\n\n .amount {\n color: #29b263;\n font-weight: bold;\n }\n\n @media only screen and (min-width: 500px) {\n .pre-checkout-modal__content {\n bottom: 0;\n top: 0;\n margin: auto;\n border-radius: 6px;\n height: fit-content;\n }\n }\n\n .pre-checkout-modal__content.show {\n transform: translateY(0);\n }\n\n .pre-checkout-modal__content > * {\n margin-top: 0;\n margin-bottom: 20px;\n }\n .pre-checkout-modal__content > *:last-child {\n margin-bottom: 0;\n }\n\n .pre-checkout-modal__content svg {\n margin: auto;\n width: 100%;\n }\n\n .pre-checkout-modal__content #apple-pay-mark--light {\n margin-bottom: 20px;\n }\n\n .pre-checkout-modal p {\n -webkit-text-size-adjust: 100%;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n text-rendering: optimizeLegibility;\n font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu",\n "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;\n color: #4E4E4E;\n line-height: 28px;\n font-size: 18px;\n font-weight: 500;\n text-align: center;\n letter-spacing: -0.3px;\n }\n\n .pre-checkout-modal button {\n height: 42px;\n width: 100%;\n background: linear-gradient(180deg, #40ad57 21.43%, #44b669 88.1%), #44b669;\n border: 1px solid #49a861;\n box-sizing: border-box;\n box-shadow: 0px 1px 4px rgba(0, 0, 0, 0.1);\n border-radius: 5px;\n text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.1);\n color: #ffffff;\n font-weight: 600;\n font-size: 18px;\n\n -webkit-text-size-adjust: 100%;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n text-rendering: optimizeLegibility;\n font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu",\n "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;\n }\n\n #payment-request-button {\n width: 100%;\n height: fit-content;\n }\n';
232
232
 
233
233
  var amountSubunitToBase = function amountSubunitToBase() {
234
234
  var amount = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
@@ -595,7 +595,7 @@ function removeAllChildNodes(parent) {
595
595
  }
596
596
  }
597
597
 
598
- function mountPreCheckoutModal(id) {
598
+ function mountPreCheckoutModal(id, transaction) {
599
599
 
600
600
  var mountedModal = document.querySelector('#pre-checkout-modal-' + id);
601
601
  if (mountedModal) {
@@ -615,7 +615,19 @@ function mountPreCheckoutModal(id) {
615
615
  content.classList.add("pre-checkout-modal__content");
616
616
  modal.appendChild(content);
617
617
 
618
- content.innerHTML = applePayMarkLight;
618
+ var _ref4 = transaction || {},
619
+ merchant_logo = _ref4.merchant_logo,
620
+ merchant_name = _ref4.merchant_name,
621
+ email = _ref4.email,
622
+ amount = _ref4.amount,
623
+ currency = _ref4.currency;
624
+
625
+ var applePayPaymentInfo = document.createElement('div');
626
+ applePayPaymentInfo.classList.add("payment-info");
627
+ applePayPaymentInfo.innerHTML = '<img class="merchant-logo" src="' + merchant_logo + '" alt="' + merchant_name + ' Logo">\n <div class="customer-info">\n <div class="customer-email">' + email + '</div>\n <div class="transaction-amount">Pay <span class="amount">' + amount / 100 + ' ' + currency + '</span></div>\n </div>';
628
+ content.appendChild(applePayPaymentInfo);
629
+
630
+ content.innerHTML += applePayMarkLight;
619
631
 
620
632
  var applePayDescription = document.createElement("p");
621
633
  applePayDescription.innerHTML = 'Pay with Apple Pay to complete your purchase without filling a form';
@@ -864,9 +876,12 @@ var isIOS = function isIOS() {
864
876
  _ref$userAgent = _ref.userAgent,
865
877
  userAgent = _ref$userAgent === undefined ? window && window.navigator && window.navigator.userAgent : _ref$userAgent;
866
878
 
879
+ var isSafari = window.navigator && !!window.navigator.userAgent.match(/Version\/[\d\.]+.*Safari/);
880
+ var isMAC = window.navigator && /(Mac)/i.test(window.navigator.platform);
881
+
867
882
  return iOSDevices.includes(platform) ||
868
883
  // iPAD os safari detection. iPad OS uses the same version of safari as Mac OS
869
- userAgent.includes("Mac") && "ontouchend" in document;
884
+ userAgent.includes("Mac") && "ontouchend" in document || isMAC && isSafari;
870
885
  };
871
886
 
872
887
  var AnalyticsAPI = {
@@ -1215,7 +1230,7 @@ var Inline = function () {
1215
1230
  } else {
1216
1231
  inlineInstance.preloadTransaction({ inlineTransaction: transaction });
1217
1232
 
1218
- inlineInstance.preCheckoutModal = mountPreCheckoutModal(inlineInstance.id);
1233
+ inlineInstance.preCheckoutModal = mountPreCheckoutModal(inlineInstance.id, response);
1219
1234
  inlineInstance.paymentRequestContainer = getPreCheckoutModalPaymentRequestContainer(inlineInstance.preCheckoutModal);
1220
1235
 
1221
1236
  mountPaymentRequestButtons(inlineInstance.paymentRequestContainer, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paystack/inline-js",
3
- "version": "2.11.0-dev.5",
3
+ "version": "2.11.0-dev.6",
4
4
  "description": "Client-side library to load the Paystack checkout form",
5
5
  "main": "lib/inline.js",
6
6
  "module": "es/inline.js",