@paystack/inline-js 2.19.0-dev.2 → 2.19.0-dev.4
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 +27 -34
- package/es/inline.js +27 -34
- package/lib/inline.js +27 -34
- package/package.json +1 -1
package/dist/inline.js
CHANGED
|
@@ -405,10 +405,10 @@ var PaystackPop = (function () {
|
|
|
405
405
|
locale = _ref2.locale;
|
|
406
406
|
return "\n @supports (-webkit-appearance: -apple-pay-button) { \n .apple-pay-button {\n display: inline-block;\n -webkit-appearance: -apple-pay-button;\n width: ".concat(width, ";\n height: ").concat(height, ";\n border-radius: ").concat(borderRadius, ";\n padding: ").concat(padding, ";\n -apple-pay-button-type: ").concat(type, ";\n -webkit-locale: ").concat(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");
|
|
407
407
|
};
|
|
408
|
-
var preCheckoutModalCSS = "\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: 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: 350px;\n\n box-sizing: border-box;\n transform: translateY(238px);\n transition: transform 0.3s cubic-bezier(.16,.81,.32,1);\n }\n\n .modal-wrapper {\n padding: 0 16px;\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 font-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", \"Roboto\", \"Oxygen\", \"Ubuntu\",\n \"Cantarell\", \"Fira Sans\", \"Droid Sans\", \"Helvetica Neue\", sans-serif;\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: 30px;\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 margin: 0 auto;\n margin-top: 100px;\n }\n\n .pre-checkout-modal__content > * {\n margin-top: 0;\n margin-bottom: 40px;\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 #inline-button-wordmark--white {\n position: absolute;\n bottom: -50px;\n margin: auto;\n left: 0;\n right: 0;\n width: fit-content;\n }\n\n #inline-button-wordmark--grey {\n display: none;\n }\n\n .pre-checkout-modal__content #apple-pay-mark--light {\n margin-bottom: 16px;\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:
|
|
408
|
+
var preCheckoutModalCSS = "\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: 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: 350px;\n\n box-sizing: border-box;\n transform: translateY(238px);\n transition: transform 0.3s cubic-bezier(.16,.81,.32,1);\n }\n\n .modal-wrapper {\n padding: 0 16px;\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 font-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", \"Roboto\", \"Oxygen\", \"Ubuntu\",\n \"Cantarell\", \"Fira Sans\", \"Droid Sans\", \"Helvetica Neue\", sans-serif;\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: 30px;\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 margin: 0 auto;\n margin-top: 100px;\n }\n\n .pre-checkout-modal__content > * {\n margin-top: 0;\n margin-bottom: 40px;\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 #inline-button-wordmark--white {\n position: absolute;\n bottom: -50px;\n margin: auto;\n left: 0;\n right: 0;\n width: fit-content;\n }\n\n #inline-button-wordmark--grey {\n display: none;\n }\n\n .pre-checkout-modal__content #apple-pay-mark--light {\n margin-bottom: 16px;\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: 140%;\n font-size: 14px;\n font-weight: 500;\n margin: 0;\n padding: 0 20px;\n text-align: center;\n letter-spacing: -0.3px;\n }\n\n .pre-checkout-modal button {\n height: 42px;\n width: 100%;\n background: #FAFAFA;\n border: 1px solid #F2F3F3;\n box-sizing: border-box;\n border-radius: 3px;\n color: #4E4E4E;\n font-weight: 500;\n font-size: 14px;\n line-height: 24px;\n cursor: pointer;\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 .pre-checkout-modal button:hover, \n .pre-checkout-modal button:active, \n .pre-checkout-modal button:focus {\n background: #F2F3F3;\n }\n\n .pre-checkout-modal .link-description {\n color: #2f3d4d;\n font-size: 14px;\n letter-spacing: normal;\n line-height: 1.4;\n margin: 0 auto 24px;\n max-width: 260px;\n padding: 0;\n }\n\n .link-logo {\n margin-bottom: 24px;\n }\n\n .pre-checkout-modal .link-error {\n color: #d44141;\n margin-top: 24px;\n }\n\n .link-divider {\n margin-bottom: 16px;\n margin-top: 24px;\n position: relative;\n }\n\n .link-divider__container {\n align-items: center;\n bottom: 0;\n display: flex;\n left: 0;\n position: absolute;\n right: 0;\n top: 0;\n }\n\n .link-divider__line {\n border: 1px dashed #ccced0;\n width: 100%;\n }\n\n .link-divider__text-container {\n display: flex;\n justify-content: center;\n position: relative;\n }\n\n .link-divider__text {\n background-color: #fff;\n color: #999da1;\n font-size: 14px;\n font-weight: 500;\n letter-spacing: -.3px;\n line-height: 19.6px;\n margin-bottom: 2px;\n padding-left: 8px;\n padding-right: 8px;\n }\n\n .link-otp-not-received {\n background-color: #f5f6f7;\n padding: 20px;\n margin-bottom: 16px;\n border-radius: 4px;\n text-align: center;\n\n .description,\n .title {\n font-weight: 400;\n font-size: 14px;\n line-height: 21px;\n color: #323d4b;\n\n @media all and (min-width: 529px) {\n width: 270px;\n padding: 0 4px;\n margin: 0 auto;\n }\n }\n .title {\n font-weight: 500;\n margin-bottom: 12px;\n }\n .description {\n margin-bottom: 24px;\n }\n }\n\n\n #payment-request-button {\n width: 100%;\n height: fit-content;\n margin: 24px 0 16px 0;\n }\n\n #paystackpop-button {\n padding: 0 16px;\n }\n\n #apple-pay-close-button {\n position: absolute;\n text-align: center;\n top: 0;\n right: -26px;\n height: 16px;\n width: 16px;\n padding: 0;\n display: inline-block;\n z-index: 3;\n border-radius: 50%;\n background: transparent;\n transition: all 300ms;\n outline: none;\n cursor: pointer;\n border: none;\n }\n\n #apple-pay-close-button svg {\n width: initial;\n }\n \n #apple-pay-close-button:hover {\n background-color: #e22b28;\n }\n\n @media only screen and (max-width: 500px) {\n .pre-checkout-modal__content {\n max-width: 500px;\n border-radius: 0;\n padding-bottom: 0;\n }\n\n .modal-wrapper {\n padding: 0;\n }\n\n #inline-button-wordmark--white {\n display: none\n }\n \n #inline-button-wordmark--grey {\n display: block;\n width: 100%;\n margin: 16px 0;\n height: 13px;\n }\n\n #apple-pay-close-button {\n display: none;\n }\n }\n";
|
|
409
409
|
var PinInputCSS = "\n.pin-input-container {\n display: flex;\n justify-content: center;\n gap: 8px;\n .pin-input {\n border-radius: 3px;\n border: 1px solid #e4e4e4;\n color: #011b33;\n font-size: 14px;\n font-weight: 500;\n height: 40px;\n letter-spacing: -0.1px;\n line-height: 19.6px;\n margin: 0;\n outline: none;\n text-align: center;\n width: 40px;\n }\n .pin-input:hover,\n .pin-input--focused {\n border: 1px solid #77ade4;\n }\n}\n";
|
|
410
410
|
var CountdownTimerCSS = "\n.countdown-timer-container {\n display: flex;\n justify-content: center;\n gap: 4px;\n .countdown-message,\n .countdown-time {\n font-size: 12px;\n font-weight: 500;\n letter-spacing: 0em;\n line-height: 14px;\n text-align: center;\n }\n .countdown-time {\n color: #3bb75e;\n }\n .countdown-time--completing {\n color: #f05050;\n }\n}\n";
|
|
411
|
-
var OptRetryCSS = "\n.pre-checkout-modal .link-retry-text {\n color: #3bb75e;\n cursor: pointer;\n margin-top: 24px;\n}\n
|
|
411
|
+
var OptRetryCSS = "\n.pre-checkout-modal .link-retry-text {\n color: #3bb75e;\n cursor: pointer;\n margin-top: 24px;\n}\n";
|
|
412
412
|
var LoaderCSS = "\n.loader {\n margin: 24px auto 8px;\n text-align: center;\n color: white;\n}\n@keyframes loader__spinner {\n 0% {\n opacity: 1;\n }\n 100% {\n opacity: 0;\n }\n}\n@-webkit-keyframes loader__spinner {\n 0% {\n opacity: 1;\n }\n 100% {\n opacity: 0;\n }\n}\n.loader__spinner {\n position: relative;\n display: inline-block;\n}\n.loader__spinner div {\n left: 95px;\n top: 35px;\n position: absolute;\n -webkit-animation: loader__spinner linear 1s infinite;\n animation: loader__spinner linear 1s infinite;\n background: #393939;\n width: 10px;\n height: 30px;\n border-radius: 40%;\n -webkit-transform-origin: 5px 65px;\n transform-origin: 5px 65px;\n}\n.loader__spinner div:nth-child(1) {\n -webkit-transform: rotate(0deg);\n transform: rotate(0deg);\n -webkit-animation-delay: -0.916666666666667s;\n animation-delay: -0.916666666666667s;\n}\n.loader__spinner div:nth-child(2) {\n -webkit-transform: rotate(30deg);\n transform: rotate(30deg);\n -webkit-animation-delay: -0.833333333333333s;\n animation-delay: -0.833333333333333s;\n}\n.loader__spinner div:nth-child(3) {\n -webkit-transform: rotate(60deg);\n transform: rotate(60deg);\n -webkit-animation-delay: -0.75s;\n animation-delay: -0.75s;\n}\n.loader__spinner div:nth-child(4) {\n -webkit-transform: rotate(90deg);\n transform: rotate(90deg);\n -webkit-animation-delay: -0.666666666666667s;\n animation-delay: -0.666666666666667s;\n}\n.loader__spinner div:nth-child(5) {\n -webkit-transform: rotate(120deg);\n transform: rotate(120deg);\n -webkit-animation-delay: -0.583333333333333s;\n animation-delay: -0.583333333333333s;\n}\n.loader__spinner div:nth-child(6) {\n -webkit-transform: rotate(150deg);\n transform: rotate(150deg);\n -webkit-animation-delay: -0.5s;\n animation-delay: -0.5s;\n}\n.loader__spinner div:nth-child(7) {\n -webkit-transform: rotate(180deg);\n transform: rotate(180deg);\n -webkit-animation-delay: -0.416666666666667s;\n animation-delay: -0.416666666666667s;\n}\n.loader__spinner div:nth-child(8) {\n -webkit-transform: rotate(210deg);\n transform: rotate(210deg);\n -webkit-animation-delay: -0.333333333333333s;\n animation-delay: -0.333333333333333s;\n}\n.loader__spinner div:nth-child(9) {\n -webkit-transform: rotate(240deg);\n transform: rotate(240deg);\n -webkit-animation-delay: -0.25s;\n animation-delay: -0.25s;\n}\n.loader__spinner div:nth-child(10) {\n -webkit-transform: rotate(270deg);\n transform: rotate(270deg);\n -webkit-animation-delay: -0.166666666666667s;\n animation-delay: -0.166666666666667s;\n}\n.loader__spinner div:nth-child(11) {\n -webkit-transform: rotate(300deg);\n transform: rotate(300deg);\n -webkit-animation-delay: -0.083333333333333s;\n animation-delay: -0.083333333333333s;\n}\n.loader__spinner div:nth-child(12) {\n -webkit-transform: rotate(330deg);\n transform: rotate(330deg);\n -webkit-animation-delay: 0s;\n animation-delay: 0s;\n}\n.loader__spinner {\n width: 40px;\n height: 40px;\n -webkit-transform: translate(-20px, -20px) scale(0.2) translate(20px, 20px);\n transform: translate(-20px, -20px) scale(0.2) translate(20px, 20px);\n}\n";
|
|
413
413
|
/**
|
|
414
414
|
* Loads CSS styles dynamically into the document.
|
|
@@ -650,11 +650,6 @@ var PaystackPop = (function () {
|
|
|
650
650
|
return PinInput;
|
|
651
651
|
}();
|
|
652
652
|
|
|
653
|
-
var CHARGE_TYPES = {
|
|
654
|
-
RECURRING: 'resume',
|
|
655
|
-
PREAUTHORIZATION: 'preauthorization',
|
|
656
|
-
DEFAULT: 'default'
|
|
657
|
-
};
|
|
658
653
|
/**
|
|
659
654
|
* Get the common headers for the request.
|
|
660
655
|
* @param {Object} param - Request parameters.
|
|
@@ -674,18 +669,6 @@ var PaystackPop = (function () {
|
|
|
674
669
|
Authorization: "Bearer ".concat(token)
|
|
675
670
|
});
|
|
676
671
|
};
|
|
677
|
-
/**
|
|
678
|
-
* Get the charge type from the URL.
|
|
679
|
-
* @returns {String} - Charge type.
|
|
680
|
-
*/
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
function getChargeType() {
|
|
684
|
-
var _window, _window$location, _window$location$path;
|
|
685
|
-
|
|
686
|
-
var chargeType = (_window = window) === null || _window === void 0 ? void 0 : (_window$location = _window.location) === null || _window$location === void 0 ? void 0 : (_window$location$path = _window$location.pathname) === null || _window$location$path === void 0 ? void 0 : _window$location$path.split('/').slice(1)[0];
|
|
687
|
-
return [CHARGE_TYPES.RECURRING, CHARGE_TYPES.PREAUTHORIZATION].includes(chargeType) ? chargeType : CHARGE_TYPES.DEFAULT;
|
|
688
|
-
}
|
|
689
672
|
/**
|
|
690
673
|
* send OTP to the user's email or phone number.
|
|
691
674
|
* @param {Object} transaction - Transaction object.
|
|
@@ -768,7 +751,7 @@ var PaystackPop = (function () {
|
|
|
768
751
|
function canPayWithLink(transaction) {
|
|
769
752
|
var _transaction$link_con, _transaction$link_con2;
|
|
770
753
|
|
|
771
|
-
return (transaction === null || transaction === void 0 ? void 0 : (_transaction$link_con = transaction.link_config) === null || _transaction$link_con === void 0 ? void 0 : _transaction$link_con.enabled) && (transaction === null || transaction === void 0 ? void 0 : (_transaction$link_con2 = transaction.link_config) === null || _transaction$link_con2 === void 0 ? void 0 : _transaction$link_con2.has_payment_instruments)
|
|
754
|
+
return (transaction === null || transaction === void 0 ? void 0 : (_transaction$link_con = transaction.link_config) === null || _transaction$link_con === void 0 ? void 0 : _transaction$link_con.enabled) && (transaction === null || transaction === void 0 ? void 0 : (_transaction$link_con2 = transaction.link_config) === null || _transaction$link_con2 === void 0 ? void 0 : _transaction$link_con2.has_payment_instruments);
|
|
772
755
|
}
|
|
773
756
|
|
|
774
757
|
var CountdownTimer = /*#__PURE__*/function () {
|
|
@@ -923,15 +906,11 @@ var PaystackPop = (function () {
|
|
|
923
906
|
this.container = document.createElement('div');
|
|
924
907
|
this.container.id = 'otp-retry-container';
|
|
925
908
|
this.resendOtpText = document.createElement('p');
|
|
926
|
-
this.otpErrorText = document.createElement('p');
|
|
927
909
|
this.otpHint = document.createElement('p');
|
|
928
910
|
this.countdownContainer = document.createElement('div');
|
|
929
911
|
this.resendOtpText.className = 'link-retry-text';
|
|
930
912
|
this.resendOtpText.innerText = OTP_RESEND_COUNT_CONFIG[this.otpResendCount].text;
|
|
931
913
|
this.container.appendChild(this.resendOtpText);
|
|
932
|
-
this.otpErrorText.className = 'link-retry-error';
|
|
933
|
-
this.otpErrorText.style.display = 'none';
|
|
934
|
-
this.container.appendChild(this.otpErrorText);
|
|
935
914
|
this.otpHint.className = 'link-retry-text';
|
|
936
915
|
this.otpHint.innerText = 'Still not getting OTPs?';
|
|
937
916
|
this.otpHint.style.display = 'none';
|
|
@@ -954,9 +933,8 @@ var PaystackPop = (function () {
|
|
|
954
933
|
transaction: this.transaction.id
|
|
955
934
|
}).then(function (response) {
|
|
956
935
|
return _this.onSuccess(response.data.token);
|
|
957
|
-
}).catch(function (
|
|
958
|
-
|
|
959
|
-
_this.otpErrorText.style.display = 'block';
|
|
936
|
+
}).catch(function () {// catching here so a unhandledrejection error is not thrown
|
|
937
|
+
// We don't want to show an error to the user in the event of a failure
|
|
960
938
|
});
|
|
961
939
|
}
|
|
962
940
|
}, {
|
|
@@ -1481,7 +1459,6 @@ var PaystackPop = (function () {
|
|
|
1481
1459
|
function getApplePayContent() {
|
|
1482
1460
|
var wrapper = document.createElement('div');
|
|
1483
1461
|
wrapper.classList.add('modal-wrapper');
|
|
1484
|
-
wrapper.innerHTML = wrapper.innerHTML + secureByPaystackWhite + secureByPaystackGrey;
|
|
1485
1462
|
wrapper.innerHTML = applePayMarkLight;
|
|
1486
1463
|
var applePayDescription = document.createElement('p');
|
|
1487
1464
|
applePayDescription.id = 'apple-pay-description';
|
|
@@ -1491,6 +1468,7 @@ var PaystackPop = (function () {
|
|
|
1491
1468
|
paymentButtonContainer.id = 'payment-request-button';
|
|
1492
1469
|
wrapper.appendChild(paymentButtonContainer);
|
|
1493
1470
|
wrapper.appendChild(getOtherPaymentOptionsButton('More payment options'));
|
|
1471
|
+
wrapper.innerHTML = wrapper.innerHTML + secureByPaystackWhite + secureByPaystackGrey;
|
|
1494
1472
|
return wrapper;
|
|
1495
1473
|
}
|
|
1496
1474
|
/*
|
|
@@ -1523,7 +1501,7 @@ var PaystackPop = (function () {
|
|
|
1523
1501
|
* */
|
|
1524
1502
|
|
|
1525
1503
|
|
|
1526
|
-
function getLinkContent(transaction) {
|
|
1504
|
+
function getLinkContent(transaction, closePreCheckoutModal) {
|
|
1527
1505
|
var wrapper = document.createElement('div');
|
|
1528
1506
|
wrapper.classList.add('modal-wrapper');
|
|
1529
1507
|
wrapper.innerHTML = wrapper.innerHTML + secureByPaystackWhite + secureByPaystackGrey;
|
|
@@ -1563,6 +1541,7 @@ var PaystackPop = (function () {
|
|
|
1563
1541
|
otpRetry.unmount();
|
|
1564
1542
|
loader.unmount();
|
|
1565
1543
|
pinInput.unmount();
|
|
1544
|
+
closePreCheckoutModal();
|
|
1566
1545
|
}).catch(function (error) {
|
|
1567
1546
|
loader.hide();
|
|
1568
1547
|
otpRetry.show();
|
|
@@ -1598,7 +1577,7 @@ var PaystackPop = (function () {
|
|
|
1598
1577
|
return wrapper;
|
|
1599
1578
|
}
|
|
1600
1579
|
|
|
1601
|
-
function mountPreCheckoutModal(id, transaction) {
|
|
1580
|
+
function mountPreCheckoutModal(id, transaction, closePreCheckoutModal) {
|
|
1602
1581
|
var mountedModal = document.querySelector("#pre-checkout-modal-".concat(id));
|
|
1603
1582
|
|
|
1604
1583
|
if (mountedModal) {
|
|
@@ -1637,7 +1616,7 @@ var PaystackPop = (function () {
|
|
|
1637
1616
|
applePayPaymentInfo.innerHTML = "<img class=\"merchant-logo\" src=\"".concat(merchantLogo, "\" alt=\"").concat(merchantName, " Logo\">\n <div class=\"customer-info\">\n <div class=\"customer-email\">").concat(label || email, "</div>\n <div class=\"transaction-amount\">Pay <span class=\"amount\">").concat(formattedAmount, "</span></div>\n </div>");
|
|
1638
1617
|
content.appendChild(applePayPaymentInfo);
|
|
1639
1618
|
content.innerHTML += applePayCloseButton;
|
|
1640
|
-
var wrapper = canPayWithLink(transaction) ? getLinkContent(transaction) : getApplePayContent();
|
|
1619
|
+
var wrapper = canPayWithLink(transaction) ? getLinkContent(transaction, closePreCheckoutModal) : getApplePayContent();
|
|
1641
1620
|
content.appendChild(wrapper);
|
|
1642
1621
|
var style = document.createElement('style');
|
|
1643
1622
|
style.textContent = preCheckoutModalCSS;
|
|
@@ -2529,9 +2508,16 @@ var PaystackPop = (function () {
|
|
|
2529
2508
|
inlineInstance = this;
|
|
2530
2509
|
var resumableTransaction = findResumableTransaction(this.transactions, params);
|
|
2531
2510
|
var transaction = resumableTransaction || new InlineTransaction(params);
|
|
2511
|
+
|
|
2512
|
+
var closePreCheckoutModal = function closePreCheckoutModal() {
|
|
2513
|
+
inlineInstance.closePreCheckoutModal();
|
|
2514
|
+
inlineInstance.animateCheckoutIn();
|
|
2515
|
+
};
|
|
2516
|
+
|
|
2532
2517
|
return new Promise(function (resolve, reject) {
|
|
2533
2518
|
transaction.requestInline().then(function (response) {
|
|
2534
|
-
var
|
|
2519
|
+
var linkEnabled = canPayWithLink(response);
|
|
2520
|
+
var shouldLoadPreCheckoutModal = linkEnabled || canUseApplePay(response.channels);
|
|
2535
2521
|
|
|
2536
2522
|
if (!shouldLoadPreCheckoutModal) {
|
|
2537
2523
|
inlineInstance.newTransaction({
|
|
@@ -2542,7 +2528,7 @@ var PaystackPop = (function () {
|
|
|
2542
2528
|
inlineInstance.preloadTransaction({
|
|
2543
2529
|
inlineTransaction: transaction
|
|
2544
2530
|
});
|
|
2545
|
-
inlineInstance.preCheckoutModal = mountPreCheckoutModal(inlineInstance.id, response);
|
|
2531
|
+
inlineInstance.preCheckoutModal = mountPreCheckoutModal(inlineInstance.id, response, closePreCheckoutModal);
|
|
2546
2532
|
inlineInstance.paymentRequestContainer = getPreCheckoutModalPaymentRequestContainer(inlineInstance.preCheckoutModal);
|
|
2547
2533
|
mountPaymentRequestButtons(inlineInstance.paymentRequestContainer, {
|
|
2548
2534
|
channels: response.channels,
|
|
@@ -2557,10 +2543,17 @@ var PaystackPop = (function () {
|
|
|
2557
2543
|
}
|
|
2558
2544
|
}, response.merchant_id).then(function () {
|
|
2559
2545
|
inlineInstance.registerPaymentRequestEventListeners();
|
|
2560
|
-
}).finally(function () {
|
|
2561
2546
|
inlineInstance.registerPreCheckoutModalEventListeners();
|
|
2562
2547
|
animatePreCheckoutModalIn(inlineInstance.preCheckoutModal);
|
|
2563
2548
|
resolve(transaction);
|
|
2549
|
+
}).catch(function () {
|
|
2550
|
+
if (linkEnabled) {
|
|
2551
|
+
inlineInstance.registerPreCheckoutModalEventListeners();
|
|
2552
|
+
animatePreCheckoutModalIn(inlineInstance.preCheckoutModal);
|
|
2553
|
+
resolve(transaction);
|
|
2554
|
+
} else {
|
|
2555
|
+
closePreCheckoutModal();
|
|
2556
|
+
}
|
|
2564
2557
|
});
|
|
2565
2558
|
}
|
|
2566
2559
|
}).catch(function (error) {
|
package/es/inline.js
CHANGED
|
@@ -402,10 +402,10 @@ var generateApplePayFallbackCSS = function generateApplePayFallbackCSS(_ref2) {
|
|
|
402
402
|
locale = _ref2.locale;
|
|
403
403
|
return "\n @supports (-webkit-appearance: -apple-pay-button) { \n .apple-pay-button {\n display: inline-block;\n -webkit-appearance: -apple-pay-button;\n width: ".concat(width, ";\n height: ").concat(height, ";\n border-radius: ").concat(borderRadius, ";\n padding: ").concat(padding, ";\n -apple-pay-button-type: ").concat(type, ";\n -webkit-locale: ").concat(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");
|
|
404
404
|
};
|
|
405
|
-
var preCheckoutModalCSS = "\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: 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: 350px;\n\n box-sizing: border-box;\n transform: translateY(238px);\n transition: transform 0.3s cubic-bezier(.16,.81,.32,1);\n }\n\n .modal-wrapper {\n padding: 0 16px;\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 font-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", \"Roboto\", \"Oxygen\", \"Ubuntu\",\n \"Cantarell\", \"Fira Sans\", \"Droid Sans\", \"Helvetica Neue\", sans-serif;\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: 30px;\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 margin: 0 auto;\n margin-top: 100px;\n }\n\n .pre-checkout-modal__content > * {\n margin-top: 0;\n margin-bottom: 40px;\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 #inline-button-wordmark--white {\n position: absolute;\n bottom: -50px;\n margin: auto;\n left: 0;\n right: 0;\n width: fit-content;\n }\n\n #inline-button-wordmark--grey {\n display: none;\n }\n\n .pre-checkout-modal__content #apple-pay-mark--light {\n margin-bottom: 16px;\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:
|
|
405
|
+
var preCheckoutModalCSS = "\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: 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: 350px;\n\n box-sizing: border-box;\n transform: translateY(238px);\n transition: transform 0.3s cubic-bezier(.16,.81,.32,1);\n }\n\n .modal-wrapper {\n padding: 0 16px;\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 font-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", \"Roboto\", \"Oxygen\", \"Ubuntu\",\n \"Cantarell\", \"Fira Sans\", \"Droid Sans\", \"Helvetica Neue\", sans-serif;\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: 30px;\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 margin: 0 auto;\n margin-top: 100px;\n }\n\n .pre-checkout-modal__content > * {\n margin-top: 0;\n margin-bottom: 40px;\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 #inline-button-wordmark--white {\n position: absolute;\n bottom: -50px;\n margin: auto;\n left: 0;\n right: 0;\n width: fit-content;\n }\n\n #inline-button-wordmark--grey {\n display: none;\n }\n\n .pre-checkout-modal__content #apple-pay-mark--light {\n margin-bottom: 16px;\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: 140%;\n font-size: 14px;\n font-weight: 500;\n margin: 0;\n padding: 0 20px;\n text-align: center;\n letter-spacing: -0.3px;\n }\n\n .pre-checkout-modal button {\n height: 42px;\n width: 100%;\n background: #FAFAFA;\n border: 1px solid #F2F3F3;\n box-sizing: border-box;\n border-radius: 3px;\n color: #4E4E4E;\n font-weight: 500;\n font-size: 14px;\n line-height: 24px;\n cursor: pointer;\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 .pre-checkout-modal button:hover, \n .pre-checkout-modal button:active, \n .pre-checkout-modal button:focus {\n background: #F2F3F3;\n }\n\n .pre-checkout-modal .link-description {\n color: #2f3d4d;\n font-size: 14px;\n letter-spacing: normal;\n line-height: 1.4;\n margin: 0 auto 24px;\n max-width: 260px;\n padding: 0;\n }\n\n .link-logo {\n margin-bottom: 24px;\n }\n\n .pre-checkout-modal .link-error {\n color: #d44141;\n margin-top: 24px;\n }\n\n .link-divider {\n margin-bottom: 16px;\n margin-top: 24px;\n position: relative;\n }\n\n .link-divider__container {\n align-items: center;\n bottom: 0;\n display: flex;\n left: 0;\n position: absolute;\n right: 0;\n top: 0;\n }\n\n .link-divider__line {\n border: 1px dashed #ccced0;\n width: 100%;\n }\n\n .link-divider__text-container {\n display: flex;\n justify-content: center;\n position: relative;\n }\n\n .link-divider__text {\n background-color: #fff;\n color: #999da1;\n font-size: 14px;\n font-weight: 500;\n letter-spacing: -.3px;\n line-height: 19.6px;\n margin-bottom: 2px;\n padding-left: 8px;\n padding-right: 8px;\n }\n\n .link-otp-not-received {\n background-color: #f5f6f7;\n padding: 20px;\n margin-bottom: 16px;\n border-radius: 4px;\n text-align: center;\n\n .description,\n .title {\n font-weight: 400;\n font-size: 14px;\n line-height: 21px;\n color: #323d4b;\n\n @media all and (min-width: 529px) {\n width: 270px;\n padding: 0 4px;\n margin: 0 auto;\n }\n }\n .title {\n font-weight: 500;\n margin-bottom: 12px;\n }\n .description {\n margin-bottom: 24px;\n }\n }\n\n\n #payment-request-button {\n width: 100%;\n height: fit-content;\n margin: 24px 0 16px 0;\n }\n\n #paystackpop-button {\n padding: 0 16px;\n }\n\n #apple-pay-close-button {\n position: absolute;\n text-align: center;\n top: 0;\n right: -26px;\n height: 16px;\n width: 16px;\n padding: 0;\n display: inline-block;\n z-index: 3;\n border-radius: 50%;\n background: transparent;\n transition: all 300ms;\n outline: none;\n cursor: pointer;\n border: none;\n }\n\n #apple-pay-close-button svg {\n width: initial;\n }\n \n #apple-pay-close-button:hover {\n background-color: #e22b28;\n }\n\n @media only screen and (max-width: 500px) {\n .pre-checkout-modal__content {\n max-width: 500px;\n border-radius: 0;\n padding-bottom: 0;\n }\n\n .modal-wrapper {\n padding: 0;\n }\n\n #inline-button-wordmark--white {\n display: none\n }\n \n #inline-button-wordmark--grey {\n display: block;\n width: 100%;\n margin: 16px 0;\n height: 13px;\n }\n\n #apple-pay-close-button {\n display: none;\n }\n }\n";
|
|
406
406
|
var PinInputCSS = "\n.pin-input-container {\n display: flex;\n justify-content: center;\n gap: 8px;\n .pin-input {\n border-radius: 3px;\n border: 1px solid #e4e4e4;\n color: #011b33;\n font-size: 14px;\n font-weight: 500;\n height: 40px;\n letter-spacing: -0.1px;\n line-height: 19.6px;\n margin: 0;\n outline: none;\n text-align: center;\n width: 40px;\n }\n .pin-input:hover,\n .pin-input--focused {\n border: 1px solid #77ade4;\n }\n}\n";
|
|
407
407
|
var CountdownTimerCSS = "\n.countdown-timer-container {\n display: flex;\n justify-content: center;\n gap: 4px;\n .countdown-message,\n .countdown-time {\n font-size: 12px;\n font-weight: 500;\n letter-spacing: 0em;\n line-height: 14px;\n text-align: center;\n }\n .countdown-time {\n color: #3bb75e;\n }\n .countdown-time--completing {\n color: #f05050;\n }\n}\n";
|
|
408
|
-
var OptRetryCSS = "\n.pre-checkout-modal .link-retry-text {\n color: #3bb75e;\n cursor: pointer;\n margin-top: 24px;\n}\n
|
|
408
|
+
var OptRetryCSS = "\n.pre-checkout-modal .link-retry-text {\n color: #3bb75e;\n cursor: pointer;\n margin-top: 24px;\n}\n";
|
|
409
409
|
var LoaderCSS = "\n.loader {\n margin: 24px auto 8px;\n text-align: center;\n color: white;\n}\n@keyframes loader__spinner {\n 0% {\n opacity: 1;\n }\n 100% {\n opacity: 0;\n }\n}\n@-webkit-keyframes loader__spinner {\n 0% {\n opacity: 1;\n }\n 100% {\n opacity: 0;\n }\n}\n.loader__spinner {\n position: relative;\n display: inline-block;\n}\n.loader__spinner div {\n left: 95px;\n top: 35px;\n position: absolute;\n -webkit-animation: loader__spinner linear 1s infinite;\n animation: loader__spinner linear 1s infinite;\n background: #393939;\n width: 10px;\n height: 30px;\n border-radius: 40%;\n -webkit-transform-origin: 5px 65px;\n transform-origin: 5px 65px;\n}\n.loader__spinner div:nth-child(1) {\n -webkit-transform: rotate(0deg);\n transform: rotate(0deg);\n -webkit-animation-delay: -0.916666666666667s;\n animation-delay: -0.916666666666667s;\n}\n.loader__spinner div:nth-child(2) {\n -webkit-transform: rotate(30deg);\n transform: rotate(30deg);\n -webkit-animation-delay: -0.833333333333333s;\n animation-delay: -0.833333333333333s;\n}\n.loader__spinner div:nth-child(3) {\n -webkit-transform: rotate(60deg);\n transform: rotate(60deg);\n -webkit-animation-delay: -0.75s;\n animation-delay: -0.75s;\n}\n.loader__spinner div:nth-child(4) {\n -webkit-transform: rotate(90deg);\n transform: rotate(90deg);\n -webkit-animation-delay: -0.666666666666667s;\n animation-delay: -0.666666666666667s;\n}\n.loader__spinner div:nth-child(5) {\n -webkit-transform: rotate(120deg);\n transform: rotate(120deg);\n -webkit-animation-delay: -0.583333333333333s;\n animation-delay: -0.583333333333333s;\n}\n.loader__spinner div:nth-child(6) {\n -webkit-transform: rotate(150deg);\n transform: rotate(150deg);\n -webkit-animation-delay: -0.5s;\n animation-delay: -0.5s;\n}\n.loader__spinner div:nth-child(7) {\n -webkit-transform: rotate(180deg);\n transform: rotate(180deg);\n -webkit-animation-delay: -0.416666666666667s;\n animation-delay: -0.416666666666667s;\n}\n.loader__spinner div:nth-child(8) {\n -webkit-transform: rotate(210deg);\n transform: rotate(210deg);\n -webkit-animation-delay: -0.333333333333333s;\n animation-delay: -0.333333333333333s;\n}\n.loader__spinner div:nth-child(9) {\n -webkit-transform: rotate(240deg);\n transform: rotate(240deg);\n -webkit-animation-delay: -0.25s;\n animation-delay: -0.25s;\n}\n.loader__spinner div:nth-child(10) {\n -webkit-transform: rotate(270deg);\n transform: rotate(270deg);\n -webkit-animation-delay: -0.166666666666667s;\n animation-delay: -0.166666666666667s;\n}\n.loader__spinner div:nth-child(11) {\n -webkit-transform: rotate(300deg);\n transform: rotate(300deg);\n -webkit-animation-delay: -0.083333333333333s;\n animation-delay: -0.083333333333333s;\n}\n.loader__spinner div:nth-child(12) {\n -webkit-transform: rotate(330deg);\n transform: rotate(330deg);\n -webkit-animation-delay: 0s;\n animation-delay: 0s;\n}\n.loader__spinner {\n width: 40px;\n height: 40px;\n -webkit-transform: translate(-20px, -20px) scale(0.2) translate(20px, 20px);\n transform: translate(-20px, -20px) scale(0.2) translate(20px, 20px);\n}\n";
|
|
410
410
|
/**
|
|
411
411
|
* Loads CSS styles dynamically into the document.
|
|
@@ -647,11 +647,6 @@ var PinInput = /*#__PURE__*/function () {
|
|
|
647
647
|
return PinInput;
|
|
648
648
|
}();
|
|
649
649
|
|
|
650
|
-
var CHARGE_TYPES = {
|
|
651
|
-
RECURRING: 'resume',
|
|
652
|
-
PREAUTHORIZATION: 'preauthorization',
|
|
653
|
-
DEFAULT: 'default'
|
|
654
|
-
};
|
|
655
650
|
/**
|
|
656
651
|
* Get the common headers for the request.
|
|
657
652
|
* @param {Object} param - Request parameters.
|
|
@@ -671,18 +666,6 @@ var getCommonHeaders = function getCommonHeaders(_ref) {
|
|
|
671
666
|
Authorization: "Bearer ".concat(token)
|
|
672
667
|
});
|
|
673
668
|
};
|
|
674
|
-
/**
|
|
675
|
-
* Get the charge type from the URL.
|
|
676
|
-
* @returns {String} - Charge type.
|
|
677
|
-
*/
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
function getChargeType() {
|
|
681
|
-
var _window, _window$location, _window$location$path;
|
|
682
|
-
|
|
683
|
-
var chargeType = (_window = window) === null || _window === void 0 ? void 0 : (_window$location = _window.location) === null || _window$location === void 0 ? void 0 : (_window$location$path = _window$location.pathname) === null || _window$location$path === void 0 ? void 0 : _window$location$path.split('/').slice(1)[0];
|
|
684
|
-
return [CHARGE_TYPES.RECURRING, CHARGE_TYPES.PREAUTHORIZATION].includes(chargeType) ? chargeType : CHARGE_TYPES.DEFAULT;
|
|
685
|
-
}
|
|
686
669
|
/**
|
|
687
670
|
* send OTP to the user's email or phone number.
|
|
688
671
|
* @param {Object} transaction - Transaction object.
|
|
@@ -765,7 +748,7 @@ function verifyLinkOtp(_ref3) {
|
|
|
765
748
|
function canPayWithLink(transaction) {
|
|
766
749
|
var _transaction$link_con, _transaction$link_con2;
|
|
767
750
|
|
|
768
|
-
return (transaction === null || transaction === void 0 ? void 0 : (_transaction$link_con = transaction.link_config) === null || _transaction$link_con === void 0 ? void 0 : _transaction$link_con.enabled) && (transaction === null || transaction === void 0 ? void 0 : (_transaction$link_con2 = transaction.link_config) === null || _transaction$link_con2 === void 0 ? void 0 : _transaction$link_con2.has_payment_instruments)
|
|
751
|
+
return (transaction === null || transaction === void 0 ? void 0 : (_transaction$link_con = transaction.link_config) === null || _transaction$link_con === void 0 ? void 0 : _transaction$link_con.enabled) && (transaction === null || transaction === void 0 ? void 0 : (_transaction$link_con2 = transaction.link_config) === null || _transaction$link_con2 === void 0 ? void 0 : _transaction$link_con2.has_payment_instruments);
|
|
769
752
|
}
|
|
770
753
|
|
|
771
754
|
var CountdownTimer = /*#__PURE__*/function () {
|
|
@@ -920,15 +903,11 @@ var OtpRetry = /*#__PURE__*/function () {
|
|
|
920
903
|
this.container = document.createElement('div');
|
|
921
904
|
this.container.id = 'otp-retry-container';
|
|
922
905
|
this.resendOtpText = document.createElement('p');
|
|
923
|
-
this.otpErrorText = document.createElement('p');
|
|
924
906
|
this.otpHint = document.createElement('p');
|
|
925
907
|
this.countdownContainer = document.createElement('div');
|
|
926
908
|
this.resendOtpText.className = 'link-retry-text';
|
|
927
909
|
this.resendOtpText.innerText = OTP_RESEND_COUNT_CONFIG[this.otpResendCount].text;
|
|
928
910
|
this.container.appendChild(this.resendOtpText);
|
|
929
|
-
this.otpErrorText.className = 'link-retry-error';
|
|
930
|
-
this.otpErrorText.style.display = 'none';
|
|
931
|
-
this.container.appendChild(this.otpErrorText);
|
|
932
911
|
this.otpHint.className = 'link-retry-text';
|
|
933
912
|
this.otpHint.innerText = 'Still not getting OTPs?';
|
|
934
913
|
this.otpHint.style.display = 'none';
|
|
@@ -951,9 +930,8 @@ var OtpRetry = /*#__PURE__*/function () {
|
|
|
951
930
|
transaction: this.transaction.id
|
|
952
931
|
}).then(function (response) {
|
|
953
932
|
return _this.onSuccess(response.data.token);
|
|
954
|
-
}).catch(function (
|
|
955
|
-
|
|
956
|
-
_this.otpErrorText.style.display = 'block';
|
|
933
|
+
}).catch(function () {// catching here so a unhandledrejection error is not thrown
|
|
934
|
+
// We don't want to show an error to the user in the event of a failure
|
|
957
935
|
});
|
|
958
936
|
}
|
|
959
937
|
}, {
|
|
@@ -1478,7 +1456,6 @@ function getOtherPaymentOptionsButton(text) {
|
|
|
1478
1456
|
function getApplePayContent() {
|
|
1479
1457
|
var wrapper = document.createElement('div');
|
|
1480
1458
|
wrapper.classList.add('modal-wrapper');
|
|
1481
|
-
wrapper.innerHTML = wrapper.innerHTML + secureByPaystackWhite + secureByPaystackGrey;
|
|
1482
1459
|
wrapper.innerHTML = applePayMarkLight;
|
|
1483
1460
|
var applePayDescription = document.createElement('p');
|
|
1484
1461
|
applePayDescription.id = 'apple-pay-description';
|
|
@@ -1488,6 +1465,7 @@ function getApplePayContent() {
|
|
|
1488
1465
|
paymentButtonContainer.id = 'payment-request-button';
|
|
1489
1466
|
wrapper.appendChild(paymentButtonContainer);
|
|
1490
1467
|
wrapper.appendChild(getOtherPaymentOptionsButton('More payment options'));
|
|
1468
|
+
wrapper.innerHTML = wrapper.innerHTML + secureByPaystackWhite + secureByPaystackGrey;
|
|
1491
1469
|
return wrapper;
|
|
1492
1470
|
}
|
|
1493
1471
|
/*
|
|
@@ -1520,7 +1498,7 @@ function getLinkOtpHelp(linkContainer) {
|
|
|
1520
1498
|
* */
|
|
1521
1499
|
|
|
1522
1500
|
|
|
1523
|
-
function getLinkContent(transaction) {
|
|
1501
|
+
function getLinkContent(transaction, closePreCheckoutModal) {
|
|
1524
1502
|
var wrapper = document.createElement('div');
|
|
1525
1503
|
wrapper.classList.add('modal-wrapper');
|
|
1526
1504
|
wrapper.innerHTML = wrapper.innerHTML + secureByPaystackWhite + secureByPaystackGrey;
|
|
@@ -1560,6 +1538,7 @@ function getLinkContent(transaction) {
|
|
|
1560
1538
|
otpRetry.unmount();
|
|
1561
1539
|
loader.unmount();
|
|
1562
1540
|
pinInput.unmount();
|
|
1541
|
+
closePreCheckoutModal();
|
|
1563
1542
|
}).catch(function (error) {
|
|
1564
1543
|
loader.hide();
|
|
1565
1544
|
otpRetry.show();
|
|
@@ -1595,7 +1574,7 @@ function getLinkContent(transaction) {
|
|
|
1595
1574
|
return wrapper;
|
|
1596
1575
|
}
|
|
1597
1576
|
|
|
1598
|
-
function mountPreCheckoutModal(id, transaction) {
|
|
1577
|
+
function mountPreCheckoutModal(id, transaction, closePreCheckoutModal) {
|
|
1599
1578
|
var mountedModal = document.querySelector("#pre-checkout-modal-".concat(id));
|
|
1600
1579
|
|
|
1601
1580
|
if (mountedModal) {
|
|
@@ -1634,7 +1613,7 @@ function mountPreCheckoutModal(id, transaction) {
|
|
|
1634
1613
|
applePayPaymentInfo.innerHTML = "<img class=\"merchant-logo\" src=\"".concat(merchantLogo, "\" alt=\"").concat(merchantName, " Logo\">\n <div class=\"customer-info\">\n <div class=\"customer-email\">").concat(label || email, "</div>\n <div class=\"transaction-amount\">Pay <span class=\"amount\">").concat(formattedAmount, "</span></div>\n </div>");
|
|
1635
1614
|
content.appendChild(applePayPaymentInfo);
|
|
1636
1615
|
content.innerHTML += applePayCloseButton;
|
|
1637
|
-
var wrapper = canPayWithLink(transaction) ? getLinkContent(transaction) : getApplePayContent();
|
|
1616
|
+
var wrapper = canPayWithLink(transaction) ? getLinkContent(transaction, closePreCheckoutModal) : getApplePayContent();
|
|
1638
1617
|
content.appendChild(wrapper);
|
|
1639
1618
|
var style = document.createElement('style');
|
|
1640
1619
|
style.textContent = preCheckoutModalCSS;
|
|
@@ -2526,9 +2505,16 @@ var Inline = /*#__PURE__*/function () {
|
|
|
2526
2505
|
inlineInstance = this;
|
|
2527
2506
|
var resumableTransaction = findResumableTransaction(this.transactions, params);
|
|
2528
2507
|
var transaction = resumableTransaction || new InlineTransaction(params);
|
|
2508
|
+
|
|
2509
|
+
var closePreCheckoutModal = function closePreCheckoutModal() {
|
|
2510
|
+
inlineInstance.closePreCheckoutModal();
|
|
2511
|
+
inlineInstance.animateCheckoutIn();
|
|
2512
|
+
};
|
|
2513
|
+
|
|
2529
2514
|
return new Promise(function (resolve, reject) {
|
|
2530
2515
|
transaction.requestInline().then(function (response) {
|
|
2531
|
-
var
|
|
2516
|
+
var linkEnabled = canPayWithLink(response);
|
|
2517
|
+
var shouldLoadPreCheckoutModal = linkEnabled || canUseApplePay(response.channels);
|
|
2532
2518
|
|
|
2533
2519
|
if (!shouldLoadPreCheckoutModal) {
|
|
2534
2520
|
inlineInstance.newTransaction({
|
|
@@ -2539,7 +2525,7 @@ var Inline = /*#__PURE__*/function () {
|
|
|
2539
2525
|
inlineInstance.preloadTransaction({
|
|
2540
2526
|
inlineTransaction: transaction
|
|
2541
2527
|
});
|
|
2542
|
-
inlineInstance.preCheckoutModal = mountPreCheckoutModal(inlineInstance.id, response);
|
|
2528
|
+
inlineInstance.preCheckoutModal = mountPreCheckoutModal(inlineInstance.id, response, closePreCheckoutModal);
|
|
2543
2529
|
inlineInstance.paymentRequestContainer = getPreCheckoutModalPaymentRequestContainer(inlineInstance.preCheckoutModal);
|
|
2544
2530
|
mountPaymentRequestButtons(inlineInstance.paymentRequestContainer, {
|
|
2545
2531
|
channels: response.channels,
|
|
@@ -2554,10 +2540,17 @@ var Inline = /*#__PURE__*/function () {
|
|
|
2554
2540
|
}
|
|
2555
2541
|
}, response.merchant_id).then(function () {
|
|
2556
2542
|
inlineInstance.registerPaymentRequestEventListeners();
|
|
2557
|
-
}).finally(function () {
|
|
2558
2543
|
inlineInstance.registerPreCheckoutModalEventListeners();
|
|
2559
2544
|
animatePreCheckoutModalIn(inlineInstance.preCheckoutModal);
|
|
2560
2545
|
resolve(transaction);
|
|
2546
|
+
}).catch(function () {
|
|
2547
|
+
if (linkEnabled) {
|
|
2548
|
+
inlineInstance.registerPreCheckoutModalEventListeners();
|
|
2549
|
+
animatePreCheckoutModalIn(inlineInstance.preCheckoutModal);
|
|
2550
|
+
resolve(transaction);
|
|
2551
|
+
} else {
|
|
2552
|
+
closePreCheckoutModal();
|
|
2553
|
+
}
|
|
2561
2554
|
});
|
|
2562
2555
|
}
|
|
2563
2556
|
}).catch(function (error) {
|
package/lib/inline.js
CHANGED
|
@@ -404,10 +404,10 @@ var generateApplePayFallbackCSS = function generateApplePayFallbackCSS(_ref2) {
|
|
|
404
404
|
locale = _ref2.locale;
|
|
405
405
|
return "\n @supports (-webkit-appearance: -apple-pay-button) { \n .apple-pay-button {\n display: inline-block;\n -webkit-appearance: -apple-pay-button;\n width: ".concat(width, ";\n height: ").concat(height, ";\n border-radius: ").concat(borderRadius, ";\n padding: ").concat(padding, ";\n -apple-pay-button-type: ").concat(type, ";\n -webkit-locale: ").concat(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");
|
|
406
406
|
};
|
|
407
|
-
var preCheckoutModalCSS = "\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: 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: 350px;\n\n box-sizing: border-box;\n transform: translateY(238px);\n transition: transform 0.3s cubic-bezier(.16,.81,.32,1);\n }\n\n .modal-wrapper {\n padding: 0 16px;\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 font-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", \"Roboto\", \"Oxygen\", \"Ubuntu\",\n \"Cantarell\", \"Fira Sans\", \"Droid Sans\", \"Helvetica Neue\", sans-serif;\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: 30px;\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 margin: 0 auto;\n margin-top: 100px;\n }\n\n .pre-checkout-modal__content > * {\n margin-top: 0;\n margin-bottom: 40px;\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 #inline-button-wordmark--white {\n position: absolute;\n bottom: -50px;\n margin: auto;\n left: 0;\n right: 0;\n width: fit-content;\n }\n\n #inline-button-wordmark--grey {\n display: none;\n }\n\n .pre-checkout-modal__content #apple-pay-mark--light {\n margin-bottom: 16px;\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:
|
|
407
|
+
var preCheckoutModalCSS = "\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: 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: 350px;\n\n box-sizing: border-box;\n transform: translateY(238px);\n transition: transform 0.3s cubic-bezier(.16,.81,.32,1);\n }\n\n .modal-wrapper {\n padding: 0 16px;\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 font-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", \"Roboto\", \"Oxygen\", \"Ubuntu\",\n \"Cantarell\", \"Fira Sans\", \"Droid Sans\", \"Helvetica Neue\", sans-serif;\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: 30px;\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 margin: 0 auto;\n margin-top: 100px;\n }\n\n .pre-checkout-modal__content > * {\n margin-top: 0;\n margin-bottom: 40px;\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 #inline-button-wordmark--white {\n position: absolute;\n bottom: -50px;\n margin: auto;\n left: 0;\n right: 0;\n width: fit-content;\n }\n\n #inline-button-wordmark--grey {\n display: none;\n }\n\n .pre-checkout-modal__content #apple-pay-mark--light {\n margin-bottom: 16px;\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: 140%;\n font-size: 14px;\n font-weight: 500;\n margin: 0;\n padding: 0 20px;\n text-align: center;\n letter-spacing: -0.3px;\n }\n\n .pre-checkout-modal button {\n height: 42px;\n width: 100%;\n background: #FAFAFA;\n border: 1px solid #F2F3F3;\n box-sizing: border-box;\n border-radius: 3px;\n color: #4E4E4E;\n font-weight: 500;\n font-size: 14px;\n line-height: 24px;\n cursor: pointer;\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 .pre-checkout-modal button:hover, \n .pre-checkout-modal button:active, \n .pre-checkout-modal button:focus {\n background: #F2F3F3;\n }\n\n .pre-checkout-modal .link-description {\n color: #2f3d4d;\n font-size: 14px;\n letter-spacing: normal;\n line-height: 1.4;\n margin: 0 auto 24px;\n max-width: 260px;\n padding: 0;\n }\n\n .link-logo {\n margin-bottom: 24px;\n }\n\n .pre-checkout-modal .link-error {\n color: #d44141;\n margin-top: 24px;\n }\n\n .link-divider {\n margin-bottom: 16px;\n margin-top: 24px;\n position: relative;\n }\n\n .link-divider__container {\n align-items: center;\n bottom: 0;\n display: flex;\n left: 0;\n position: absolute;\n right: 0;\n top: 0;\n }\n\n .link-divider__line {\n border: 1px dashed #ccced0;\n width: 100%;\n }\n\n .link-divider__text-container {\n display: flex;\n justify-content: center;\n position: relative;\n }\n\n .link-divider__text {\n background-color: #fff;\n color: #999da1;\n font-size: 14px;\n font-weight: 500;\n letter-spacing: -.3px;\n line-height: 19.6px;\n margin-bottom: 2px;\n padding-left: 8px;\n padding-right: 8px;\n }\n\n .link-otp-not-received {\n background-color: #f5f6f7;\n padding: 20px;\n margin-bottom: 16px;\n border-radius: 4px;\n text-align: center;\n\n .description,\n .title {\n font-weight: 400;\n font-size: 14px;\n line-height: 21px;\n color: #323d4b;\n\n @media all and (min-width: 529px) {\n width: 270px;\n padding: 0 4px;\n margin: 0 auto;\n }\n }\n .title {\n font-weight: 500;\n margin-bottom: 12px;\n }\n .description {\n margin-bottom: 24px;\n }\n }\n\n\n #payment-request-button {\n width: 100%;\n height: fit-content;\n margin: 24px 0 16px 0;\n }\n\n #paystackpop-button {\n padding: 0 16px;\n }\n\n #apple-pay-close-button {\n position: absolute;\n text-align: center;\n top: 0;\n right: -26px;\n height: 16px;\n width: 16px;\n padding: 0;\n display: inline-block;\n z-index: 3;\n border-radius: 50%;\n background: transparent;\n transition: all 300ms;\n outline: none;\n cursor: pointer;\n border: none;\n }\n\n #apple-pay-close-button svg {\n width: initial;\n }\n \n #apple-pay-close-button:hover {\n background-color: #e22b28;\n }\n\n @media only screen and (max-width: 500px) {\n .pre-checkout-modal__content {\n max-width: 500px;\n border-radius: 0;\n padding-bottom: 0;\n }\n\n .modal-wrapper {\n padding: 0;\n }\n\n #inline-button-wordmark--white {\n display: none\n }\n \n #inline-button-wordmark--grey {\n display: block;\n width: 100%;\n margin: 16px 0;\n height: 13px;\n }\n\n #apple-pay-close-button {\n display: none;\n }\n }\n";
|
|
408
408
|
var PinInputCSS = "\n.pin-input-container {\n display: flex;\n justify-content: center;\n gap: 8px;\n .pin-input {\n border-radius: 3px;\n border: 1px solid #e4e4e4;\n color: #011b33;\n font-size: 14px;\n font-weight: 500;\n height: 40px;\n letter-spacing: -0.1px;\n line-height: 19.6px;\n margin: 0;\n outline: none;\n text-align: center;\n width: 40px;\n }\n .pin-input:hover,\n .pin-input--focused {\n border: 1px solid #77ade4;\n }\n}\n";
|
|
409
409
|
var CountdownTimerCSS = "\n.countdown-timer-container {\n display: flex;\n justify-content: center;\n gap: 4px;\n .countdown-message,\n .countdown-time {\n font-size: 12px;\n font-weight: 500;\n letter-spacing: 0em;\n line-height: 14px;\n text-align: center;\n }\n .countdown-time {\n color: #3bb75e;\n }\n .countdown-time--completing {\n color: #f05050;\n }\n}\n";
|
|
410
|
-
var OptRetryCSS = "\n.pre-checkout-modal .link-retry-text {\n color: #3bb75e;\n cursor: pointer;\n margin-top: 24px;\n}\n
|
|
410
|
+
var OptRetryCSS = "\n.pre-checkout-modal .link-retry-text {\n color: #3bb75e;\n cursor: pointer;\n margin-top: 24px;\n}\n";
|
|
411
411
|
var LoaderCSS = "\n.loader {\n margin: 24px auto 8px;\n text-align: center;\n color: white;\n}\n@keyframes loader__spinner {\n 0% {\n opacity: 1;\n }\n 100% {\n opacity: 0;\n }\n}\n@-webkit-keyframes loader__spinner {\n 0% {\n opacity: 1;\n }\n 100% {\n opacity: 0;\n }\n}\n.loader__spinner {\n position: relative;\n display: inline-block;\n}\n.loader__spinner div {\n left: 95px;\n top: 35px;\n position: absolute;\n -webkit-animation: loader__spinner linear 1s infinite;\n animation: loader__spinner linear 1s infinite;\n background: #393939;\n width: 10px;\n height: 30px;\n border-radius: 40%;\n -webkit-transform-origin: 5px 65px;\n transform-origin: 5px 65px;\n}\n.loader__spinner div:nth-child(1) {\n -webkit-transform: rotate(0deg);\n transform: rotate(0deg);\n -webkit-animation-delay: -0.916666666666667s;\n animation-delay: -0.916666666666667s;\n}\n.loader__spinner div:nth-child(2) {\n -webkit-transform: rotate(30deg);\n transform: rotate(30deg);\n -webkit-animation-delay: -0.833333333333333s;\n animation-delay: -0.833333333333333s;\n}\n.loader__spinner div:nth-child(3) {\n -webkit-transform: rotate(60deg);\n transform: rotate(60deg);\n -webkit-animation-delay: -0.75s;\n animation-delay: -0.75s;\n}\n.loader__spinner div:nth-child(4) {\n -webkit-transform: rotate(90deg);\n transform: rotate(90deg);\n -webkit-animation-delay: -0.666666666666667s;\n animation-delay: -0.666666666666667s;\n}\n.loader__spinner div:nth-child(5) {\n -webkit-transform: rotate(120deg);\n transform: rotate(120deg);\n -webkit-animation-delay: -0.583333333333333s;\n animation-delay: -0.583333333333333s;\n}\n.loader__spinner div:nth-child(6) {\n -webkit-transform: rotate(150deg);\n transform: rotate(150deg);\n -webkit-animation-delay: -0.5s;\n animation-delay: -0.5s;\n}\n.loader__spinner div:nth-child(7) {\n -webkit-transform: rotate(180deg);\n transform: rotate(180deg);\n -webkit-animation-delay: -0.416666666666667s;\n animation-delay: -0.416666666666667s;\n}\n.loader__spinner div:nth-child(8) {\n -webkit-transform: rotate(210deg);\n transform: rotate(210deg);\n -webkit-animation-delay: -0.333333333333333s;\n animation-delay: -0.333333333333333s;\n}\n.loader__spinner div:nth-child(9) {\n -webkit-transform: rotate(240deg);\n transform: rotate(240deg);\n -webkit-animation-delay: -0.25s;\n animation-delay: -0.25s;\n}\n.loader__spinner div:nth-child(10) {\n -webkit-transform: rotate(270deg);\n transform: rotate(270deg);\n -webkit-animation-delay: -0.166666666666667s;\n animation-delay: -0.166666666666667s;\n}\n.loader__spinner div:nth-child(11) {\n -webkit-transform: rotate(300deg);\n transform: rotate(300deg);\n -webkit-animation-delay: -0.083333333333333s;\n animation-delay: -0.083333333333333s;\n}\n.loader__spinner div:nth-child(12) {\n -webkit-transform: rotate(330deg);\n transform: rotate(330deg);\n -webkit-animation-delay: 0s;\n animation-delay: 0s;\n}\n.loader__spinner {\n width: 40px;\n height: 40px;\n -webkit-transform: translate(-20px, -20px) scale(0.2) translate(20px, 20px);\n transform: translate(-20px, -20px) scale(0.2) translate(20px, 20px);\n}\n";
|
|
412
412
|
/**
|
|
413
413
|
* Loads CSS styles dynamically into the document.
|
|
@@ -649,11 +649,6 @@ var PinInput = /*#__PURE__*/function () {
|
|
|
649
649
|
return PinInput;
|
|
650
650
|
}();
|
|
651
651
|
|
|
652
|
-
var CHARGE_TYPES = {
|
|
653
|
-
RECURRING: 'resume',
|
|
654
|
-
PREAUTHORIZATION: 'preauthorization',
|
|
655
|
-
DEFAULT: 'default'
|
|
656
|
-
};
|
|
657
652
|
/**
|
|
658
653
|
* Get the common headers for the request.
|
|
659
654
|
* @param {Object} param - Request parameters.
|
|
@@ -673,18 +668,6 @@ var getCommonHeaders = function getCommonHeaders(_ref) {
|
|
|
673
668
|
Authorization: "Bearer ".concat(token)
|
|
674
669
|
});
|
|
675
670
|
};
|
|
676
|
-
/**
|
|
677
|
-
* Get the charge type from the URL.
|
|
678
|
-
* @returns {String} - Charge type.
|
|
679
|
-
*/
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
function getChargeType() {
|
|
683
|
-
var _window, _window$location, _window$location$path;
|
|
684
|
-
|
|
685
|
-
var chargeType = (_window = window) === null || _window === void 0 ? void 0 : (_window$location = _window.location) === null || _window$location === void 0 ? void 0 : (_window$location$path = _window$location.pathname) === null || _window$location$path === void 0 ? void 0 : _window$location$path.split('/').slice(1)[0];
|
|
686
|
-
return [CHARGE_TYPES.RECURRING, CHARGE_TYPES.PREAUTHORIZATION].includes(chargeType) ? chargeType : CHARGE_TYPES.DEFAULT;
|
|
687
|
-
}
|
|
688
671
|
/**
|
|
689
672
|
* send OTP to the user's email or phone number.
|
|
690
673
|
* @param {Object} transaction - Transaction object.
|
|
@@ -767,7 +750,7 @@ function verifyLinkOtp(_ref3) {
|
|
|
767
750
|
function canPayWithLink(transaction) {
|
|
768
751
|
var _transaction$link_con, _transaction$link_con2;
|
|
769
752
|
|
|
770
|
-
return (transaction === null || transaction === void 0 ? void 0 : (_transaction$link_con = transaction.link_config) === null || _transaction$link_con === void 0 ? void 0 : _transaction$link_con.enabled) && (transaction === null || transaction === void 0 ? void 0 : (_transaction$link_con2 = transaction.link_config) === null || _transaction$link_con2 === void 0 ? void 0 : _transaction$link_con2.has_payment_instruments)
|
|
753
|
+
return (transaction === null || transaction === void 0 ? void 0 : (_transaction$link_con = transaction.link_config) === null || _transaction$link_con === void 0 ? void 0 : _transaction$link_con.enabled) && (transaction === null || transaction === void 0 ? void 0 : (_transaction$link_con2 = transaction.link_config) === null || _transaction$link_con2 === void 0 ? void 0 : _transaction$link_con2.has_payment_instruments);
|
|
771
754
|
}
|
|
772
755
|
|
|
773
756
|
var CountdownTimer = /*#__PURE__*/function () {
|
|
@@ -922,15 +905,11 @@ var OtpRetry = /*#__PURE__*/function () {
|
|
|
922
905
|
this.container = document.createElement('div');
|
|
923
906
|
this.container.id = 'otp-retry-container';
|
|
924
907
|
this.resendOtpText = document.createElement('p');
|
|
925
|
-
this.otpErrorText = document.createElement('p');
|
|
926
908
|
this.otpHint = document.createElement('p');
|
|
927
909
|
this.countdownContainer = document.createElement('div');
|
|
928
910
|
this.resendOtpText.className = 'link-retry-text';
|
|
929
911
|
this.resendOtpText.innerText = OTP_RESEND_COUNT_CONFIG[this.otpResendCount].text;
|
|
930
912
|
this.container.appendChild(this.resendOtpText);
|
|
931
|
-
this.otpErrorText.className = 'link-retry-error';
|
|
932
|
-
this.otpErrorText.style.display = 'none';
|
|
933
|
-
this.container.appendChild(this.otpErrorText);
|
|
934
913
|
this.otpHint.className = 'link-retry-text';
|
|
935
914
|
this.otpHint.innerText = 'Still not getting OTPs?';
|
|
936
915
|
this.otpHint.style.display = 'none';
|
|
@@ -953,9 +932,8 @@ var OtpRetry = /*#__PURE__*/function () {
|
|
|
953
932
|
transaction: this.transaction.id
|
|
954
933
|
}).then(function (response) {
|
|
955
934
|
return _this.onSuccess(response.data.token);
|
|
956
|
-
}).catch(function (
|
|
957
|
-
|
|
958
|
-
_this.otpErrorText.style.display = 'block';
|
|
935
|
+
}).catch(function () {// catching here so a unhandledrejection error is not thrown
|
|
936
|
+
// We don't want to show an error to the user in the event of a failure
|
|
959
937
|
});
|
|
960
938
|
}
|
|
961
939
|
}, {
|
|
@@ -1480,7 +1458,6 @@ function getOtherPaymentOptionsButton(text) {
|
|
|
1480
1458
|
function getApplePayContent() {
|
|
1481
1459
|
var wrapper = document.createElement('div');
|
|
1482
1460
|
wrapper.classList.add('modal-wrapper');
|
|
1483
|
-
wrapper.innerHTML = wrapper.innerHTML + secureByPaystackWhite + secureByPaystackGrey;
|
|
1484
1461
|
wrapper.innerHTML = applePayMarkLight;
|
|
1485
1462
|
var applePayDescription = document.createElement('p');
|
|
1486
1463
|
applePayDescription.id = 'apple-pay-description';
|
|
@@ -1490,6 +1467,7 @@ function getApplePayContent() {
|
|
|
1490
1467
|
paymentButtonContainer.id = 'payment-request-button';
|
|
1491
1468
|
wrapper.appendChild(paymentButtonContainer);
|
|
1492
1469
|
wrapper.appendChild(getOtherPaymentOptionsButton('More payment options'));
|
|
1470
|
+
wrapper.innerHTML = wrapper.innerHTML + secureByPaystackWhite + secureByPaystackGrey;
|
|
1493
1471
|
return wrapper;
|
|
1494
1472
|
}
|
|
1495
1473
|
/*
|
|
@@ -1522,7 +1500,7 @@ function getLinkOtpHelp(linkContainer) {
|
|
|
1522
1500
|
* */
|
|
1523
1501
|
|
|
1524
1502
|
|
|
1525
|
-
function getLinkContent(transaction) {
|
|
1503
|
+
function getLinkContent(transaction, closePreCheckoutModal) {
|
|
1526
1504
|
var wrapper = document.createElement('div');
|
|
1527
1505
|
wrapper.classList.add('modal-wrapper');
|
|
1528
1506
|
wrapper.innerHTML = wrapper.innerHTML + secureByPaystackWhite + secureByPaystackGrey;
|
|
@@ -1562,6 +1540,7 @@ function getLinkContent(transaction) {
|
|
|
1562
1540
|
otpRetry.unmount();
|
|
1563
1541
|
loader.unmount();
|
|
1564
1542
|
pinInput.unmount();
|
|
1543
|
+
closePreCheckoutModal();
|
|
1565
1544
|
}).catch(function (error) {
|
|
1566
1545
|
loader.hide();
|
|
1567
1546
|
otpRetry.show();
|
|
@@ -1597,7 +1576,7 @@ function getLinkContent(transaction) {
|
|
|
1597
1576
|
return wrapper;
|
|
1598
1577
|
}
|
|
1599
1578
|
|
|
1600
|
-
function mountPreCheckoutModal(id, transaction) {
|
|
1579
|
+
function mountPreCheckoutModal(id, transaction, closePreCheckoutModal) {
|
|
1601
1580
|
var mountedModal = document.querySelector("#pre-checkout-modal-".concat(id));
|
|
1602
1581
|
|
|
1603
1582
|
if (mountedModal) {
|
|
@@ -1636,7 +1615,7 @@ function mountPreCheckoutModal(id, transaction) {
|
|
|
1636
1615
|
applePayPaymentInfo.innerHTML = "<img class=\"merchant-logo\" src=\"".concat(merchantLogo, "\" alt=\"").concat(merchantName, " Logo\">\n <div class=\"customer-info\">\n <div class=\"customer-email\">").concat(label || email, "</div>\n <div class=\"transaction-amount\">Pay <span class=\"amount\">").concat(formattedAmount, "</span></div>\n </div>");
|
|
1637
1616
|
content.appendChild(applePayPaymentInfo);
|
|
1638
1617
|
content.innerHTML += applePayCloseButton;
|
|
1639
|
-
var wrapper = canPayWithLink(transaction) ? getLinkContent(transaction) : getApplePayContent();
|
|
1618
|
+
var wrapper = canPayWithLink(transaction) ? getLinkContent(transaction, closePreCheckoutModal) : getApplePayContent();
|
|
1640
1619
|
content.appendChild(wrapper);
|
|
1641
1620
|
var style = document.createElement('style');
|
|
1642
1621
|
style.textContent = preCheckoutModalCSS;
|
|
@@ -2528,9 +2507,16 @@ var Inline = /*#__PURE__*/function () {
|
|
|
2528
2507
|
inlineInstance = this;
|
|
2529
2508
|
var resumableTransaction = findResumableTransaction(this.transactions, params);
|
|
2530
2509
|
var transaction = resumableTransaction || new InlineTransaction(params);
|
|
2510
|
+
|
|
2511
|
+
var closePreCheckoutModal = function closePreCheckoutModal() {
|
|
2512
|
+
inlineInstance.closePreCheckoutModal();
|
|
2513
|
+
inlineInstance.animateCheckoutIn();
|
|
2514
|
+
};
|
|
2515
|
+
|
|
2531
2516
|
return new Promise(function (resolve, reject) {
|
|
2532
2517
|
transaction.requestInline().then(function (response) {
|
|
2533
|
-
var
|
|
2518
|
+
var linkEnabled = canPayWithLink(response);
|
|
2519
|
+
var shouldLoadPreCheckoutModal = linkEnabled || canUseApplePay(response.channels);
|
|
2534
2520
|
|
|
2535
2521
|
if (!shouldLoadPreCheckoutModal) {
|
|
2536
2522
|
inlineInstance.newTransaction({
|
|
@@ -2541,7 +2527,7 @@ var Inline = /*#__PURE__*/function () {
|
|
|
2541
2527
|
inlineInstance.preloadTransaction({
|
|
2542
2528
|
inlineTransaction: transaction
|
|
2543
2529
|
});
|
|
2544
|
-
inlineInstance.preCheckoutModal = mountPreCheckoutModal(inlineInstance.id, response);
|
|
2530
|
+
inlineInstance.preCheckoutModal = mountPreCheckoutModal(inlineInstance.id, response, closePreCheckoutModal);
|
|
2545
2531
|
inlineInstance.paymentRequestContainer = getPreCheckoutModalPaymentRequestContainer(inlineInstance.preCheckoutModal);
|
|
2546
2532
|
mountPaymentRequestButtons(inlineInstance.paymentRequestContainer, {
|
|
2547
2533
|
channels: response.channels,
|
|
@@ -2556,10 +2542,17 @@ var Inline = /*#__PURE__*/function () {
|
|
|
2556
2542
|
}
|
|
2557
2543
|
}, response.merchant_id).then(function () {
|
|
2558
2544
|
inlineInstance.registerPaymentRequestEventListeners();
|
|
2559
|
-
}).finally(function () {
|
|
2560
2545
|
inlineInstance.registerPreCheckoutModalEventListeners();
|
|
2561
2546
|
animatePreCheckoutModalIn(inlineInstance.preCheckoutModal);
|
|
2562
2547
|
resolve(transaction);
|
|
2548
|
+
}).catch(function () {
|
|
2549
|
+
if (linkEnabled) {
|
|
2550
|
+
inlineInstance.registerPreCheckoutModalEventListeners();
|
|
2551
|
+
animatePreCheckoutModalIn(inlineInstance.preCheckoutModal);
|
|
2552
|
+
resolve(transaction);
|
|
2553
|
+
} else {
|
|
2554
|
+
closePreCheckoutModal();
|
|
2555
|
+
}
|
|
2563
2556
|
});
|
|
2564
2557
|
}
|
|
2565
2558
|
}).catch(function (error) {
|