@paystack/inline-js 2.19.0-dev.1 → 2.19.0-dev.2

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
@@ -345,6 +345,7 @@ var PaystackPop = (function () {
345
345
  var applePayMarkLight = "\n <svg width=\"51\" height=\"32\" viewBox=\"0 0 51 32\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\" id=\"apple-pay-mark--light\">\n <g>\n <path d=\"M46.0162 0H4.98386C4.81297 0 4.64177 0 4.47118 0.000996555C4.32698 0.00202331 4.18311 0.00362383 4.03925 0.00754966C3.72548 0.0160355 3.40903 0.0345472 3.09919 0.0902335C2.7844 0.146886 2.49148 0.239294 2.20571 0.384791C1.92477 0.52766 1.66757 0.71453 1.44468 0.937516C1.22169 1.1605 1.03482 1.41728 0.891977 1.69852C0.74645 1.98429 0.653982 2.27731 0.597722 2.59234C0.541737 2.90227 0.523101 3.21866 0.514645 3.53209C0.51078 3.67596 0.509122 3.81982 0.508183 3.96366C0.507186 4.13461 0.507519 4.30545 0.507519 4.4767V27.5236C0.507519 27.6949 0.507186 27.8654 0.508183 28.0367C0.509122 28.1805 0.51078 28.3244 0.514645 28.4683C0.523101 28.7814 0.541737 29.0978 0.597722 29.4077C0.653982 29.7228 0.74645 30.0157 0.891977 30.3015C1.03482 30.5827 1.22169 30.8399 1.44468 31.0625C1.66757 31.2859 1.92477 31.4727 2.20571 31.6152C2.49148 31.7611 2.7844 31.8535 3.09919 31.9102C3.40903 31.9655 3.72548 31.9843 4.03925 31.9928C4.18311 31.9961 4.32698 31.998 4.47118 31.9987C4.64177 32 4.81297 32 4.98386 32H46.0162C46.1868 32 46.358 32 46.5286 31.9987C46.6724 31.998 46.8163 31.9961 46.9608 31.9928C47.2739 31.9843 47.5903 31.9655 47.9009 31.9102C48.2153 31.8535 48.5083 31.7611 48.7941 31.6152C49.0753 31.4727 49.3317 31.2859 49.5551 31.0625C49.7777 30.8399 49.9646 30.5827 50.1078 30.3015C50.2537 30.0157 50.346 29.7228 50.402 29.4077C50.458 29.0978 50.4762 28.7814 50.4847 28.4683C50.4886 28.3244 50.4906 28.1805 50.4912 28.0367C50.4925 27.8654 50.4926 27.6949 50.4926 27.5236V4.4767C50.4926 4.30545 50.4925 4.13461 50.4912 3.96366C50.4906 3.81982 50.4886 3.67596 50.4847 3.53209C50.4762 3.21866 50.458 2.90227 50.402 2.59234C50.346 2.27731 50.2537 1.98429 50.1078 1.69852C49.9646 1.41728 49.7777 1.1605 49.5551 0.937516C49.3317 0.71453 49.0753 0.52766 48.7941 0.384791C48.5083 0.239294 48.2153 0.146886 47.9009 0.0902335C47.5903 0.0345472 47.2739 0.0160355 46.9608 0.00754966C46.8163 0.00362383 46.6724 0.00202331 46.5286 0.000996555C46.358 0 46.1868 0 46.0162 0Z\" fill=\"black\"/>\n <path d=\"M46.0162 1.06662L46.521 1.06759C46.6577 1.06855 46.7945 1.07003 46.932 1.07378C47.1711 1.08024 47.4509 1.09319 47.7117 1.13994C47.9384 1.18077 48.1285 1.24286 48.311 1.33575C48.4911 1.42728 48.6562 1.54723 48.8003 1.69113C48.9449 1.83599 49.065 2.0013 49.1578 2.18343C49.2501 2.36447 49.3118 2.55369 49.3524 2.78205C49.3991 3.04001 49.412 3.32055 49.4185 3.56121C49.4222 3.69704 49.424 3.83287 49.4247 3.97194C49.426 4.14012 49.4259 4.3082 49.4259 4.47671V27.5236C49.4259 27.6921 49.426 27.8599 49.4246 28.0317C49.424 28.1675 49.4222 28.3033 49.4185 28.4394C49.4119 28.6797 49.3991 28.9601 49.3519 29.2211C49.3118 29.4463 49.2502 29.6356 49.1573 29.8175C49.0648 29.9992 48.9449 30.1643 48.8009 30.3083C48.656 30.4532 48.4915 30.5728 48.3092 30.6652C48.1281 30.7576 47.9383 30.8197 47.7138 30.8601C47.4477 30.9075 47.1562 30.9205 46.9367 30.9265C46.7986 30.9296 46.6611 30.9315 46.5203 30.9321C46.3525 30.9334 46.1841 30.9334 46.0162 30.9334H4.98386C4.98162 30.9334 4.97945 30.9334 4.97718 30.9334C4.81127 30.9334 4.64503 30.9334 4.4761 30.9321C4.33836 30.9315 4.20093 30.9296 4.06805 30.9266C3.8435 30.9205 3.55181 30.9075 3.2879 30.8604C3.06151 30.8197 2.87171 30.7576 2.68822 30.664C2.50766 30.5724 2.34329 30.453 2.19831 30.3077C2.05444 30.1641 1.93488 29.9995 1.84245 29.8176C1.74992 29.6358 1.68801 29.446 1.64731 29.218C1.60025 28.9576 1.58733 28.6783 1.58087 28.4396C1.57718 28.303 1.57564 28.1664 1.57476 28.0305L1.5741 27.6295L1.57413 27.5236V4.47671L1.5741 4.37083L1.57473 3.97067C1.57564 3.83402 1.57718 3.6974 1.58087 3.56088C1.58733 3.32197 1.60025 3.04258 1.64769 2.77991C1.68804 2.55405 1.74992 2.36422 1.84293 2.18155C1.93464 2.001 2.05441 1.83617 2.19903 1.69158C2.34308 1.54747 2.50799 1.42767 2.6897 1.33527C2.87122 1.24283 3.06138 1.18077 3.28778 1.14003C3.54864 1.09316 3.82861 1.08024 4.06839 1.07375C4.20507 1.07003 4.34174 1.06855 4.4774 1.06762L4.98386 1.06662H46.0162Z\" fill=\"white\"/>\n <path d=\"M14.1531 10.7629C14.5811 10.2276 14.8715 9.50886 14.7949 8.77435C14.1684 8.80551 13.4038 9.18768 12.9612 9.72342C12.5638 10.1822 12.212 10.9311 12.3037 11.6348C13.007 11.6958 13.7097 11.2832 14.1531 10.7629Z\" fill=\"black\"/>\n <path d=\"M14.7869 11.7722C13.7655 11.7114 12.8972 12.3519 12.4094 12.3519C11.9214 12.3519 11.1745 11.8029 10.3667 11.8177C9.31521 11.8331 8.33959 12.4276 7.80602 13.3731C6.70857 15.2646 7.51641 18.0704 8.58362 19.611C9.10188 20.3731 9.72648 21.2123 10.5495 21.1822C11.3271 21.1517 11.6319 20.6787 12.5771 20.6787C13.5216 20.6787 13.7961 21.1822 14.6192 21.1669C15.4729 21.1516 16.0065 20.4044 16.5248 19.6415C17.1193 18.7727 17.3627 17.9338 17.378 17.8877C17.3627 17.8725 15.732 17.2469 15.7169 15.3711C15.7015 13.8004 16.9972 13.0534 17.0581 13.007C16.3265 11.9249 15.1832 11.8029 14.7869 11.7722Z\" fill=\"black\"/>\n <path d=\"M23.68 9.64661C25.8999 9.64661 27.4457 11.1768 27.4457 13.4046C27.4457 15.6404 25.8681 17.1786 23.6244 17.1786H21.1665V21.0872H19.3907V9.64661H23.68V9.64661ZM21.1665 15.688H23.2041C24.7502 15.688 25.6302 14.8556 25.6302 13.4126C25.6302 11.9697 24.7502 11.1451 23.2121 11.1451H21.1665V15.688Z\" fill=\"black\"/>\n <path d=\"M27.9097 18.7167C27.9097 17.2578 29.0276 16.3619 31.0098 16.2509L33.293 16.1162V15.474C33.293 14.5464 32.6666 13.9914 31.6203 13.9914C30.629 13.9914 30.0106 14.467 29.8601 15.2124H28.2428C28.3379 13.7059 29.6222 12.5959 31.6836 12.5959C33.7053 12.5959 34.9976 13.6663 34.9976 15.3392V21.0872H33.3563V19.7156H33.3169C32.8333 20.6433 31.7787 21.2299 30.6847 21.2299C29.0514 21.2299 27.9097 20.2151 27.9097 18.7167ZM33.293 17.9635V17.3055L31.2395 17.4323C30.2167 17.5037 29.6381 17.9556 29.6381 18.6691C29.6381 19.3985 30.2406 19.8742 31.1603 19.8742C32.3574 19.8742 33.293 19.0496 33.293 17.9635Z\" fill=\"black\"/>\n <path d=\"M36.547 24.1556V22.768C36.6736 22.7997 36.959 22.7997 37.1018 22.7997C37.8946 22.7997 38.3228 22.4668 38.5843 21.6105C38.5843 21.5946 38.7351 21.1031 38.7351 21.0952L35.7224 12.7466H37.5774L39.6866 19.5333H39.7181L41.8273 12.7466H43.6349L40.5109 21.5232C39.7976 23.5451 38.973 24.1952 37.2447 24.1952C37.1018 24.1952 36.6736 24.1793 36.547 24.1556Z\" fill=\"black\"/>\n </g>\n <defs>\n <clipPath id=\"clip0\">\n <rect width=\"49.9851\" height=\"32\" fill=\"white\" transform=\"translate(0.507462)\"/>\n </clipPath>\n </defs>\n </svg>\n";
346
346
  var applePayCloseButton = "\n <button type=\"button\" id=\"apple-pay-close-button\">\n <svg width=\"10\" height=\"9\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path\n d=\"M5.572 4.033L8.89.71a.4.4 0 0 0-.566-.566L5.003 3.459 1.681.145a.4.4 0 0 0-.566.566L4.44 4.033\n 1.115 7.354a.398.398 0 0 0 0 .566.4.4 0 0 0 .566 0l3.322-3.33 3.322 3.33a.4.4 0 0 0 .566-.566L5.57 4.033z\"\n fill=\"white\"\n />\n </svg>\n </button>\n";
347
347
  var errorIcon = "<svg width=\"50\" height=\"30\" viewBox=\"0 0 21 17\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" id=\"error-icon\">\n <g id=\"Page-1\" stroke=\"none\" stroke-width=\"1\" fill=\"none\" fill-rule=\"evenodd\">\n <g id=\"error\" fill-rule=\"nonzero\">\n <path d=\"M9.14672,0.47855 L0.14829,15.47855 C-0.0403320234,15.7872042 -0.0475647902,16.1736607 0.129375884,16.4891566 C0.306316558,16.8046526 0.639843999,16.9999993 1.00157,17 L19.43546,17 C19.797186,16.9999993 20.1307134,16.8046526 20.3076541,16.4891566 C20.4845948,16.1736607 20.477362,15.7872042 20.28874,15.47855 L10.85328,0.47855 C10.671624,0.181297031 10.3483651,3.00996351e-06 10,3.00996351e-06 C9.6516349,3.00996351e-06 9.32837603,0.181297031 9.14672,0.47855 Z\" id=\"Shape\" fill=\"#FFAA22\"></path>\n <rect id=\"Rectangle-path\" fill=\"#FFFFFF\" x=\"9\" y=\"6\" width=\"2\" height=\"5\"></rect>\n <rect id=\"Rectangle-path\" fill=\"#FFFFFF\" x=\"9\" y=\"12\" width=\"2\" height=\"2\"></rect>\n </g>\n </g>\n</svg>";
348
+ var linkLogo = "<svg width=\"39\" height=\"18\" viewBox=\"0 0 39 18\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path\n d=\"M4.00075 17.5C2.96075 17.5 2.19275 17.236 1.69675 16.708C1.20075 16.18 0.95275 15.468 0.95275 14.572V1.228C0.95275 1.084 1.00075 0.963999 1.09675 0.868C1.19275 0.755999 1.32075 0.699999 1.48075 0.699999H3.88075C4.04075 0.699999 4.16875 0.755999 4.26475 0.868C4.36075 0.963999 4.40875 1.084 4.40875 1.228V13.876C4.40875 14.1 4.47275 14.284 4.60075 14.428C4.72875 14.556 4.90475 14.62 5.12875 14.62H5.87275C6.20875 14.62 6.37675 14.788 6.37675 15.124V16.852C6.37675 17.284 6.15275 17.5 5.70475 17.5H4.00075ZM9.33869 4.564C8.76269 4.564 8.26669 4.356 7.85069 3.94C7.45069 3.524 7.25069 3.036 7.25069 2.476C7.25069 1.9 7.45069 1.404 7.85069 0.987999C8.26669 0.571999 8.76269 0.363999 9.33869 0.363999C9.89869 0.363999 10.3787 0.571999 10.7787 0.987999C11.1947 1.404 11.4027 1.9 11.4027 2.476C11.4027 3.036 11.1947 3.524 10.7787 3.94C10.3787 4.356 9.89869 4.564 9.33869 4.564ZM10.5387 17.5H8.11469C7.97069 17.5 7.84269 17.452 7.73069 17.356C7.63469 17.244 7.58669 17.116 7.58669 16.972V6.34C7.58669 6.196 7.63469 6.076 7.73069 5.98C7.84269 5.868 7.97069 5.812 8.11469 5.812H10.5387C10.6827 5.812 10.8027 5.868 10.8987 5.98C10.9947 6.076 11.0427 6.196 11.0427 6.34V16.972C11.0427 17.116 10.9947 17.244 10.8987 17.356C10.8027 17.452 10.6827 17.5 10.5387 17.5ZM21.9019 17.02V11.476C21.9019 10.628 21.6699 9.948 21.2059 9.436C20.7419 8.924 20.1019 8.668 19.2859 8.668C18.4699 8.668 17.8139 8.932 17.3179 9.46C16.8219 9.972 16.5739 10.644 16.5739 11.476V17.02C16.5739 17.164 16.5179 17.284 16.4059 17.38C16.3099 17.46 16.1899 17.5 16.0459 17.5H13.6219C13.4779 17.5 13.3579 17.452 13.2619 17.356C13.1659 17.26 13.1179 17.14 13.1179 16.996V6.34C13.1179 6.196 13.1659 6.076 13.2619 5.98C13.3579 5.868 13.4779 5.812 13.6219 5.812H16.0459C16.1739 5.812 16.2939 5.86 16.4059 5.956C16.5179 6.052 16.5739 6.164 16.5739 6.292V7.036C17.4379 5.996 18.7019 5.476 20.3659 5.476C21.8859 5.476 23.1019 5.956 24.0139 6.916C24.9259 7.876 25.3819 9.084 25.3819 10.54V17.02C25.3819 17.164 25.3259 17.284 25.2139 17.38C25.1179 17.46 24.9979 17.5 24.8539 17.5H22.4299C22.2859 17.5 22.1579 17.46 22.0459 17.38C21.9499 17.284 21.9019 17.164 21.9019 17.02ZM30.7771 16.996C30.7771 17.14 30.7291 17.26 30.6331 17.356C30.5371 17.452 30.4171 17.5 30.2731 17.5H27.8491C27.7051 17.5 27.5771 17.452 27.4651 17.356C27.3691 17.26 27.3211 17.14 27.3211 16.996V1.204C27.3211 1.06 27.3691 0.94 27.4651 0.844C27.5771 0.747999 27.7051 0.699999 27.8491 0.699999H30.2731C30.4171 0.699999 30.5371 0.747999 30.6331 0.844C30.7291 0.94 30.7771 1.06 30.7771 1.204V9.892H31.6171L34.2811 6.22C34.4411 5.948 34.6731 5.812 34.9771 5.812H37.5691C37.8091 5.812 37.9611 5.9 38.0251 6.076C38.1051 6.252 38.0731 6.444 37.9291 6.652L34.5931 10.996L38.4811 16.636C38.6251 16.844 38.6491 17.044 38.5531 17.236C38.4731 17.412 38.2971 17.5 38.0251 17.5H35.3131C35.0091 17.5 34.7691 17.356 34.5931 17.068L31.6891 12.676H30.7771V16.996Z\"\n fill=\"#4E4E4E\" />\n</svg>";
348
349
 
349
350
  var loaderHTML = "\n <!DOCTYPE html>\n <html lang=\"en\">\n\n <head>\n <meta charset=\"UTF-8\">\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n <meta http-equiv=\"X-UA-Compatible\" content=\"ie=edge\">\n <title>Paystack Popup Loader</title>\n <style>\n .app-loader {\n margin: 200px 0;\n text-align: center;\n color: white;\n } \n @keyframes app-loader__spinner {\n 0% {\n opacity: 1;\n }\n 100% {\n opacity: 0;\n }\n }\n @-webkit-keyframes app-loader__spinner {\n 0% {\n opacity: 1;\n }\n 100% {\n opacity: 0;\n }\n }\n .app-loader__spinner {\n position: relative;\n display: inline-block;\n }\n .app-loader__spinner div {\n left: 95px;\n top: 35px;\n position: absolute;\n -webkit-animation: app-loader__spinner linear 1s infinite;\n animation: app-loader__spinner linear 1s infinite;\n background: white;\n width: 10px;\n height: 30px;\n border-radius: 40%;\n -webkit-transform-origin: 5px 65px;\n transform-origin: 5px 65px;\n }\n .app-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 .app-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 .app-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 .app-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 .app-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 .app-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 .app-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 .app-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 .app-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 .app-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 .app-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 .app-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 .app-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 </style>\n </head>\n\n <body>\n <div id=\"app-loader\" class=\"app-loader\">\n <div id=\"spinner\" class=\"app-loader__spinner\">\n <div></div><div></div><div></div><div></div><div></div><div></div><div>\n </div><div></div><div></div><div></div><div></div><div></div>\n </div>\n </div>\n </body>\n\n </html>\n";
350
351
  var backgroundCSS = "\n z-index: 999999999999999;\n background: transparent;\n background: rgba(0, 0, 0, 0.75); \n border: 0px none transparent;\n overflow-x: hidden;\n overflow-y: hidden;\n margin: 0;\n padding: 0;\n -webkit-tap-highlight-color: transparent;\n -webkit-touch-callout: none;\n position: fixed;\n left: 0;\n top: 0;\n width: 100%;\n height: 100%;\n transition: opacity 0.3s;\n -webkit-transition: opacity 0.3s;\n visibility: hidden;\n display: none;\n";
@@ -404,7 +405,653 @@ var PaystackPop = (function () {
404
405
  locale = _ref2.locale;
405
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");
406
407
  };
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: 30px 24px;\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: 450px;\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 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: 28px;\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: 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: 14px;\n line-height: 14px;\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 #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
+ 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: 28px;\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: 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: 14px;\n line-height: 14px;\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 .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
+ 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
+ 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.pre-checkout-modal .link-retry-error {\n color: #d44141;\n margin-top: 24px;\n}\n";
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
+ /**
414
+ * Loads CSS styles dynamically into the document.
415
+ * @param {string} css - The CSS styles to be loaded.
416
+ * @param {string} id - A unique identifier for the CSS styles. This is used to check if the CSS has already been loaded.
417
+ */
418
+
419
+ function LoadCSS(css, id) {
420
+ var dataAttribute = "data-".concat(id, "-css"); // Check if the CSS has already been loaded
421
+
422
+ if (document.querySelector("style[dataAttribute]")) return;
423
+ var style = document.createElement('style');
424
+ style.textContent = css;
425
+ style.setAttribute(dataAttribute, '');
426
+ document.head.appendChild(style);
427
+ }
428
+
429
+ var PinInput = /*#__PURE__*/function () {
430
+ /**
431
+ * Creates a new instance of the PinInput component.
432
+ *
433
+ * @param {Object} props - The component props.
434
+ * @param {number} [props.pinInputLength=6] - The number of PIN input fields to display.
435
+ * @param {function(string):void} [props.onComplete] - A callback function that is called when the PIN is complete.
436
+ */
437
+ function PinInput() {
438
+ var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
439
+
440
+ _classCallCheck(this, PinInput);
441
+
442
+ this.pinInputLength = props.pinInputLength || 6;
443
+ this.onComplete = props.onComplete;
444
+ this.container = null;
445
+ this.pinInputArrayValue = [];
446
+ this.allInputFields = [];
447
+ this.inputFieldEventListeners = [];
448
+ this.focusedInputFieldIndex = 0;
449
+ }
450
+
451
+ _createClass(PinInput, [{
452
+ key: "render",
453
+ value: function render() {
454
+ LoadCSS(PinInputCSS, 'pin-input');
455
+ this.container = document.createElement('div');
456
+ this.container.id = 'pin-input-container';
457
+ this.container.classList.add('pin-input-container');
458
+
459
+ for (var i = 0; i < this.pinInputLength; i += 1) {
460
+ var pinInputField = document.createElement('input');
461
+ pinInputField.id = "pin-input-".concat(i);
462
+ pinInputField.classList.add('pin-input');
463
+ pinInputField.inputmode = 'numeric';
464
+ this.allInputFields.push(pinInputField);
465
+ this.pinInputArrayValue.push('');
466
+ this.container.appendChild(pinInputField);
467
+ }
468
+
469
+ this.focusInputFieldByIndex(0);
470
+ this.listenForInputFieldEvents();
471
+ return this.container;
472
+ }
473
+ }, {
474
+ key: "listenForInputFieldEvents",
475
+ value: function listenForInputFieldEvents() {
476
+ var _this = this;
477
+
478
+ var _loop = function _loop(index) {
479
+ var inputField = _this.allInputFields[index];
480
+
481
+ var inputEventListener = function inputEventListener(event) {
482
+ _this.onChange(event, index);
483
+ };
484
+
485
+ inputField.addEventListener('input', inputEventListener);
486
+
487
+ var keydownEventListener = function keydownEventListener(event) {
488
+ _this.onKeyDown(event, index);
489
+ };
490
+
491
+ inputField.addEventListener('keydown', keydownEventListener);
492
+
493
+ var focusEventListener = function focusEventListener() {
494
+ _this.focusedInputFieldIndex = index;
495
+ inputField.classList.add('pin-input--focused');
496
+ };
497
+
498
+ inputField.addEventListener('focus', focusEventListener);
499
+
500
+ var blurEventListener = function blurEventListener() {
501
+ inputField.classList.remove('pin-input--focused');
502
+ };
503
+
504
+ inputField.addEventListener('blur', blurEventListener);
505
+
506
+ var pasteEventListener = function pasteEventListener(event) {
507
+ _this.onPaste(event, index);
508
+ };
509
+
510
+ inputField.addEventListener('paste', pasteEventListener);
511
+
512
+ _this.inputFieldEventListeners.push({
513
+ inputEventListener: inputEventListener,
514
+ keydownEventListener: keydownEventListener,
515
+ focusEventListener: focusEventListener,
516
+ blurEventListener: blurEventListener,
517
+ pasteEventListener: pasteEventListener
518
+ });
519
+ };
520
+
521
+ for (var index = 0; index < this.allInputFields.length; index += 1) {
522
+ _loop(index);
523
+ }
524
+ }
525
+ }, {
526
+ key: "focusInputFieldByIndex",
527
+ value: function focusInputFieldByIndex() {
528
+ var index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
529
+ var inputField = this.allInputFields[index];
530
+ inputField.focus();
531
+ inputField.select();
532
+ this.focusedInputFieldIndex = index;
533
+ }
534
+ }, {
535
+ key: "focusNextInputField",
536
+ value: function focusNextInputField() {
537
+ var isFocusedLastInputField = this.focusedInputFieldIndex === this.allInputFields.length - 1;
538
+
539
+ if (isFocusedLastInputField) {
540
+ this.allInputFields[this.focusedInputFieldIndex].blur();
541
+ return;
542
+ }
543
+
544
+ this.focusInputFieldByIndex(this.focusedInputFieldIndex + 1);
545
+ }
546
+ }, {
547
+ key: "focusPreviousInputField",
548
+ value: function focusPreviousInputField() {
549
+ var isFocusedFirstInputField = this.focusedInputFieldIndex === 0;
550
+
551
+ if (isFocusedFirstInputField) {
552
+ return;
553
+ }
554
+
555
+ this.focusInputFieldByIndex(this.focusedInputFieldIndex - 1);
556
+ }
557
+ }, {
558
+ key: "onChange",
559
+ value: function onChange(event, inputFieldIndex) {
560
+ var isInvalidEntry = !/^\d{1}$/.test(Number(event.currentTarget.value));
561
+
562
+ if (isInvalidEntry) {
563
+ this.allInputFields[inputFieldIndex].value = '';
564
+ this.pinInputArrayValue[inputFieldIndex] = '';
565
+ return;
566
+ }
567
+
568
+ this.pinInputArrayValue[inputFieldIndex] = event.currentTarget.value;
569
+ this.focusNextInputField();
570
+
571
+ if (!this.pinInputArrayValue.includes('') && this.onComplete) {
572
+ this.onComplete(this.pinInputArrayValue.join(''));
573
+ }
574
+ }
575
+ }, {
576
+ key: "onKeyDown",
577
+ value: function onKeyDown(event, inputFieldIndex) {
578
+ var eventKey = event.key;
579
+
580
+ if (eventKey === 'ArrowLeft') {
581
+ this.focusPreviousInputField();
582
+ }
583
+
584
+ if (eventKey === 'ArrowRight') {
585
+ this.focusNextInputField();
586
+ }
587
+
588
+ if (eventKey === 'Backspace') {
589
+ event.preventDefault();
590
+ var inputFieldHasValue = this.allInputFields[inputFieldIndex].value.length > 0;
591
+
592
+ if (inputFieldHasValue) {
593
+ this.allInputFields[inputFieldIndex].value = '';
594
+ this.pinInputArrayValue[inputFieldIndex] = '';
595
+ } else if (inputFieldIndex !== 0) {
596
+ this.focusPreviousInputField();
597
+ this.allInputFields[inputFieldIndex - 1].value = '';
598
+ this.pinInputArrayValue[inputFieldIndex - 1] = '';
599
+ }
600
+ }
601
+ }
602
+ }, {
603
+ key: "onPaste",
604
+ value: function onPaste(event) {
605
+ event.preventDefault();
606
+ var pastedData = event.clipboardData.getData('text/plain');
607
+ var pastedValueArray = pastedData.trim().replace(/\D/g, '').split('');
608
+
609
+ for (var i = 0; i < this.allInputFields.length; i += 1) {
610
+ var currentInputField = this.allInputFields[i];
611
+ var pastedCharacter = pastedValueArray[i];
612
+
613
+ if (pastedCharacter) {
614
+ currentInputField.value = pastedCharacter;
615
+ this.pinInputArrayValue[i] = pastedCharacter;
616
+ } else {
617
+ currentInputField.value = '';
618
+ this.pinInputArrayValue[i] = '';
619
+ }
620
+ }
621
+
622
+ this.focusInputFieldByIndex(this.allInputFields.length - 1);
623
+
624
+ if (!this.pinInputArrayValue.includes('') && this.onComplete) {
625
+ this.onComplete(this.pinInputArrayValue.join(''));
626
+ }
627
+ }
628
+ }, {
629
+ key: "unmount",
630
+ value: function unmount() {
631
+ var _this2 = this;
632
+
633
+ this.allInputFields.forEach(function (input, index) {
634
+ var _this2$inputFieldEven = _this2.inputFieldEventListeners[index],
635
+ inputEventListener = _this2$inputFieldEven.inputEventListener,
636
+ keydownEventListener = _this2$inputFieldEven.keydownEventListener,
637
+ focusEventListener = _this2$inputFieldEven.focusEventListener,
638
+ blurEventListener = _this2$inputFieldEven.blurEventListener,
639
+ pasteEventListener = _this2$inputFieldEven.pasteEventListener;
640
+ input.removeEventListener('input', inputEventListener);
641
+ input.removeEventListener('keydown', keydownEventListener);
642
+ input.removeEventListener('focus', focusEventListener);
643
+ input.removeEventListener('blur', blurEventListener);
644
+ input.removeEventListener('paste', pasteEventListener);
645
+ });
646
+ this.container.remove();
647
+ }
648
+ }]);
649
+
650
+ return PinInput;
651
+ }();
652
+
653
+ var CHARGE_TYPES = {
654
+ RECURRING: 'resume',
655
+ PREAUTHORIZATION: 'preauthorization',
656
+ DEFAULT: 'default'
657
+ };
658
+ /**
659
+ * Get the common headers for the request.
660
+ * @param {Object} param - Request parameters.
661
+ * @param {String} param.token - Auth Token.
662
+ * @param {String} param.language - Language.
663
+ * @returns {Object} - Headers.
664
+ */
665
+
666
+ var getCommonHeaders = function getCommonHeaders(_ref) {
667
+ var token = _ref.token,
668
+ language = _ref.language;
669
+ return _objectSpread2(_objectSpread2({
670
+ 'Content-Type': 'application/json'
671
+ }, language && {
672
+ 'Accept-Language': language
673
+ }), token && {
674
+ Authorization: "Bearer ".concat(token)
675
+ });
676
+ };
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
+ /**
690
+ * send OTP to the user's email or phone number.
691
+ * @param {Object} transaction - Transaction object.
692
+ * @param {String} email - User's email.
693
+ * @param {Array} channels - Channels to send the OTP to.
694
+ * @returns {Promise<{status: boolean, message: string, data: {token: string}}>} - Response object.
695
+ */
696
+
697
+
698
+ function sendLinkOtp(_ref2) {
699
+ var _transaction$urlParam;
700
+
701
+ var transaction = _ref2.transaction,
702
+ email = _ref2.email,
703
+ _ref2$channels = _ref2.channels,
704
+ channels = _ref2$channels === void 0 ? ['sms'] : _ref2$channels;
705
+ var language = transaction === null || transaction === void 0 ? void 0 : (_transaction$urlParam = transaction.urlParameters) === null || _transaction$urlParam === void 0 ? void 0 : _transaction$urlParam.language;
706
+ return fetch(new URL('/saved_cards/authorize', config.paystackApiUrl).toString(), {
707
+ method: 'POST',
708
+ body: JSON.stringify({
709
+ channels: channels,
710
+ email: email,
711
+ transaction: transaction.id,
712
+ is_six_digit_otp: true
713
+ }),
714
+ headers: getCommonHeaders({
715
+ language: language
716
+ })
717
+ }).then(function (response) {
718
+ if (!response.ok) {
719
+ throw new Error('Failed to send OTP');
720
+ }
721
+
722
+ return response.json();
723
+ });
724
+ }
725
+ /**
726
+ * Verify OTP.
727
+ * @param {String} code - OTP code.
728
+ * @param {Object} transaction - Transaction object.
729
+ * @param {String} token - Auth Token.
730
+ * @returns {Promise<{status: boolean, message: string, data: {token: string}}>} - Response object.
731
+ */
732
+
733
+ function verifyLinkOtp(_ref3) {
734
+ var _transaction$urlParam2;
735
+
736
+ var code = _ref3.code,
737
+ transaction = _ref3.transaction,
738
+ token = _ref3.token;
739
+ var language = transaction === null || transaction === void 0 ? void 0 : (_transaction$urlParam2 = transaction.urlParameters) === null || _transaction$urlParam2 === void 0 ? void 0 : _transaction$urlParam2.language;
740
+ return fetch(new URL('/saved_cards/authorize/verify', config.paystackApiUrl).toString(), {
741
+ method: 'POST',
742
+ body: JSON.stringify({
743
+ code: code,
744
+ transaction: transaction.id
745
+ }),
746
+ headers: getCommonHeaders({
747
+ language: language,
748
+ token: token
749
+ })
750
+ }).then(function (response) {
751
+ if (!response.ok) {
752
+ throw new Error('Failed to verify OTP');
753
+ }
754
+
755
+ return response.json();
756
+ }).catch(function (error) {
757
+ var errorMessage = error instanceof Error ? error.message : 'Failed to verify OTP'; // We throw a new Error here so we can react to it in dom.js
758
+
759
+ throw new Error(errorMessage);
760
+ });
761
+ }
762
+ /**
763
+ * Check if the transaction can be paid with a link.
764
+ * @param {Object} transaction - Transaction object.
765
+ * @returns {Boolean} - True if the transaction can be paid with link.
766
+ */
767
+
768
+ function canPayWithLink(transaction) {
769
+ var _transaction$link_con, _transaction$link_con2;
770
+
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) && getChargeType() === CHARGE_TYPES.DEFAULT;
772
+ }
773
+
774
+ var CountdownTimer = /*#__PURE__*/function () {
775
+ /**
776
+ * Creates an instance of CountdownTimer.
777
+ * @param {Object} props - The properties for the countdown timer.
778
+ * @param {number} [props.countdownDuration=60] - The duration of the countdown in seconds.
779
+ * @param {string} [props.countdownMessage='Resend OTP via SMS & WhatsApp in'] - The message to display during the countdown.
780
+ * @param {function} [props.onCountdownComplete] - A callback function to be executed when the countdown completes.
781
+ */
782
+ function CountdownTimer() {
783
+ var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
784
+
785
+ _classCallCheck(this, CountdownTimer);
786
+
787
+ this.container = null;
788
+ this.countdownMessageElement = null;
789
+ this.countdownTimeElement = null;
790
+ this.countdownDuration = props.countdownDuration || 60;
791
+ this.countdownMessage = props.countdownMessage || 'Resend OTP via SMS & WhatsApp in';
792
+ this.onCountdownComplete = props.onCountdownComplete || null; // This is the changing time state
793
+
794
+ this.remainingTime = this.countdownDuration;
795
+ this.countdownInterval = null;
796
+ }
797
+ /**
798
+ * Starts the countdown timer and returns the container element.
799
+ * @returns {HTMLElement} The container element for the countdown timer.
800
+ */
801
+
802
+
803
+ _createClass(CountdownTimer, [{
804
+ key: "render",
805
+ value: function render() {
806
+ LoadCSS(CountdownTimerCSS, 'countdown');
807
+ this.container = document.createElement('div');
808
+ this.container.id = 'countdown-timer';
809
+ this.container.classList.add('countdown-timer-container');
810
+ this.countdownTimeElement = document.createElement('span');
811
+ this.countdownTimeElement.classList.add('countdown-time');
812
+ this.countdownMessageElement = document.createElement('span');
813
+ this.countdownMessageElement.classList.add('countdown-message');
814
+ this.countdownMessageElement.innerHTML = "".concat(this.countdownMessage, "&nbsp;");
815
+ this.container.appendChild(this.countdownMessageElement);
816
+ this.container.appendChild(this.countdownTimeElement);
817
+ this.countdown();
818
+ return this.container;
819
+ }
820
+ /**
821
+ * Formats the remaining time in the countdown timer.
822
+ * @returns {string} The formatted time string (e.g., '1:30').
823
+ */
824
+
825
+ }, {
826
+ key: "formatCountDownTime",
827
+ value: function formatCountDownTime() {
828
+ var minutes = Math.floor(this.remainingTime / 60);
829
+ var seconds = this.remainingTime % 60;
830
+ var modifiedSeconds = seconds < 10 ? "0".concat(seconds) : seconds;
831
+ return "".concat(minutes, ":").concat(modifiedSeconds);
832
+ }
833
+ /**
834
+ * Starts the countdown timer and updates the displayed time every second.
835
+ */
836
+
837
+ }, {
838
+ key: "countdown",
839
+ value: function countdown() {
840
+ var _this = this;
841
+
842
+ this.countdownInterval = setInterval(function () {
843
+ if (_this.remainingTime > 0) {
844
+ var countdownCompletionPercentage = Math.round((_this.countdownDuration - _this.remainingTime) / _this.countdownDuration * 100);
845
+
846
+ if (countdownCompletionPercentage >= 80) {
847
+ _this.countdownTimeElement.classList.add('countdown-time--completing');
848
+ }
849
+ } else {
850
+ clearInterval(_this.countdownInterval);
851
+
852
+ if (typeof _this.onCountdownComplete === 'function') {
853
+ _this.onCountdownComplete();
854
+ }
855
+ }
856
+
857
+ _this.countdownTimeElement.innerHTML = _this.formatCountDownTime();
858
+ _this.remainingTime -= 1;
859
+ }, 1000);
860
+ }
861
+ /**
862
+ * Resets the countdown timer to the initial countdown duration and restarts the countdown.
863
+ */
864
+
865
+ }, {
866
+ key: "reset",
867
+ value: function reset() {
868
+ clearInterval(this.countdownInterval);
869
+ this.remainingTime = this.countdownDuration;
870
+ this.countdownTimeElement.classList.remove('countdown-time--completing');
871
+ this.countdown();
872
+ }
873
+ /**
874
+ * Removes the countdown timer from the DOM and clears the countdown interval.
875
+ */
876
+
877
+ }, {
878
+ key: "unmount",
879
+ value: function unmount() {
880
+ clearInterval(this.countdownInterval);
881
+ this.container.remove();
882
+ }
883
+ }]);
884
+
885
+ return CountdownTimer;
886
+ }();
887
+
888
+ var OTP_RESEND_COUNT_CONFIG = [{
889
+ text: 'Resend OTP via WhatsApp',
890
+ countdownMessage: 'Resend OTP via SMS & WhatsApp in',
891
+ channels: ['whatsapp']
892
+ }, {
893
+ text: 'Resend OTP via SMS & WhatsApp',
894
+ countdownMessage: 'Resending OTP ...',
895
+ channels: ['sms', 'whatsapp']
896
+ }];
897
+ /**
898
+ * Renders a button to resend OTPs and handles the resend logic.
899
+ * Provides a countdown timer and error handling.
900
+ * @param {Object} props - The component props.
901
+ * @param {Object} props.transaction - The transaction data
902
+ * @param {Function} props.onFail - The callback function called when OTPS fail multiple times
903
+ * @param {Function} props.onSuccess - The callback function called when OTPS are successfully sent
904
+ */
905
+
906
+ var OtpRetry = /*#__PURE__*/function () {
907
+ function OtpRetry() {
908
+ var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
909
+
910
+ _classCallCheck(this, OtpRetry);
911
+
912
+ this.transaction = props.transaction;
913
+ this.onFail = props.onFail;
914
+ this.onSuccess = props.onSuccess;
915
+ this.otpResendCount = 0;
916
+ this.handleClickEvent = this.handleClickEvent.bind(this);
917
+ }
918
+
919
+ _createClass(OtpRetry, [{
920
+ key: "render",
921
+ value: function render() {
922
+ LoadCSS(OptRetryCSS, 'otp-retry');
923
+ this.container = document.createElement('div');
924
+ this.container.id = 'otp-retry-container';
925
+ this.resendOtpText = document.createElement('p');
926
+ this.otpErrorText = document.createElement('p');
927
+ this.otpHint = document.createElement('p');
928
+ this.countdownContainer = document.createElement('div');
929
+ this.resendOtpText.className = 'link-retry-text';
930
+ this.resendOtpText.innerText = OTP_RESEND_COUNT_CONFIG[this.otpResendCount].text;
931
+ 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
+ this.otpHint.className = 'link-retry-text';
936
+ this.otpHint.innerText = 'Still not getting OTPs?';
937
+ this.otpHint.style.display = 'none';
938
+ this.otpHint.addEventListener('click', this.onFail);
939
+ this.container.appendChild(this.otpHint);
940
+ this.countdownContainer.style.marginTop = '24px';
941
+ this.container.appendChild(this.countdownContainer);
942
+ this.resendOtpText.addEventListener('click', this.handleClickEvent);
943
+ this.sendOtp(['sms']);
944
+ return this.container;
945
+ }
946
+ }, {
947
+ key: "sendOtp",
948
+ value: function sendOtp(channels) {
949
+ var _this = this;
950
+
951
+ sendLinkOtp({
952
+ channels: channels || OTP_RESEND_COUNT_CONFIG[this.otpResendCount].channels,
953
+ email: this.transaction.email,
954
+ transaction: this.transaction.id
955
+ }).then(function (response) {
956
+ return _this.onSuccess(response.data.token);
957
+ }).catch(function (error) {
958
+ _this.otpErrorText.innerText = error instanceof Error ? error.message : 'Unable to resend OTP';
959
+ _this.otpErrorText.style.display = 'block';
960
+ });
961
+ }
962
+ }, {
963
+ key: "handleClickEvent",
964
+ value: function handleClickEvent() {
965
+ var _this2 = this;
966
+
967
+ this.resendOtpText.style.display = 'none';
968
+ this.sendOtp(); // Set up the countdown timer with the appropriate message
969
+
970
+ var countdownMessage = OTP_RESEND_COUNT_CONFIG[this.otpResendCount].countdownMessage;
971
+ this.countdown = new CountdownTimer({
972
+ countdownMessage: countdownMessage,
973
+ onCountdownComplete: function onCountdownComplete() {
974
+ _this2.countdown.unmount();
975
+
976
+ if (_this2.otpResendCount === 1) {
977
+ _this2.otpHint.style.display = 'block';
978
+ return;
979
+ }
980
+
981
+ _this2.otpResendCount += 1;
982
+ _this2.resendOtpText.innerText = OTP_RESEND_COUNT_CONFIG[_this2.otpResendCount].text;
983
+ _this2.resendOtpText.style.display = 'block';
984
+ }
985
+ });
986
+ this.countdownContainer.appendChild(this.countdown.render());
987
+ }
988
+ }, {
989
+ key: "hide",
990
+ value: function hide() {
991
+ this.container.style.display = 'none';
992
+ }
993
+ }, {
994
+ key: "show",
995
+ value: function show() {
996
+ this.container.style.display = 'block';
997
+ }
998
+ }, {
999
+ key: "unmount",
1000
+ value: function unmount() {
1001
+ this.resendOtpText.removeEventListener('click', this.handleClickEvent);
1002
+ this.otpHint.removeEventListener('click', this.onFail);
1003
+ this.countdown.unmount();
1004
+ this.container.remove();
1005
+ }
1006
+ }]);
1007
+
1008
+ return OtpRetry;
1009
+ }();
1010
+
1011
+ var Loader = /*#__PURE__*/function () {
1012
+ function Loader() {
1013
+ _classCallCheck(this, Loader);
1014
+
1015
+ this.container = null;
1016
+ }
1017
+
1018
+ _createClass(Loader, [{
1019
+ key: "render",
1020
+ value: function render() {
1021
+ LoadCSS(LoaderCSS, 'loader');
1022
+ this.container = document.createElement('div');
1023
+ this.container.classList.add('loader');
1024
+ this.hide();
1025
+ var spinnerElement = document.createElement('div');
1026
+ spinnerElement.classList.add('loader__spinner');
1027
+
1028
+ for (var i = 0; i < 12; i += 1) {
1029
+ var spinnerItemElement = document.createElement('div');
1030
+ spinnerElement.appendChild(spinnerItemElement);
1031
+ }
1032
+
1033
+ this.container.appendChild(spinnerElement);
1034
+ return this.container;
1035
+ }
1036
+ }, {
1037
+ key: "show",
1038
+ value: function show() {
1039
+ this.container.style.display = 'block';
1040
+ }
1041
+ }, {
1042
+ key: "hide",
1043
+ value: function hide() {
1044
+ this.container.style.display = 'none';
1045
+ }
1046
+ }, {
1047
+ key: "unmount",
1048
+ value: function unmount() {
1049
+ this.container.remove();
1050
+ }
1051
+ }]);
1052
+
1053
+ return Loader;
1054
+ }();
408
1055
 
409
1056
  var amountSubunitToBase = function amountSubunitToBase() {
410
1057
  var amount = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
@@ -540,6 +1187,10 @@ var PaystackPop = (function () {
540
1187
  return iframe;
541
1188
  }
542
1189
 
1190
+ function getCheckoutIframe(id) {
1191
+ return document.getElementById("inline-checkout-".concat(id));
1192
+ }
1193
+
543
1194
  function mountCheckoutIframe(id) {
544
1195
  var iframe = createIframe("inline-checkout-".concat(id));
545
1196
  iframe.src = "".concat(config.checkoutUrl, "popup");
@@ -804,7 +1455,7 @@ var PaystackPop = (function () {
804
1455
  });
805
1456
  }
806
1457
  function removeAllChildNodes(parent) {
807
- while (parent.firstChild) {
1458
+ while (parent !== null && parent !== void 0 && parent.firstChild) {
808
1459
  parent.removeChild(parent.firstChild);
809
1460
  }
810
1461
  }
@@ -814,6 +1465,139 @@ var PaystackPop = (function () {
814
1465
  function getPreCheckoutModalPaymentRequestContainer(modal) {
815
1466
  return modal.querySelector('#payment-request-button');
816
1467
  }
1468
+
1469
+ function getOtherPaymentOptionsButton(text) {
1470
+ var openPaystackPopButton = document.createElement('button');
1471
+ openPaystackPopButton.id = 'paystackpop-button';
1472
+ openPaystackPopButton.innerText = text;
1473
+ return openPaystackPopButton;
1474
+ }
1475
+ /*
1476
+ * This function returns a container with the Apple Pay button and other payment options
1477
+ * @returns {HTMLElement} - The container with the Apple Pay button and other payment options
1478
+ */
1479
+
1480
+
1481
+ function getApplePayContent() {
1482
+ var wrapper = document.createElement('div');
1483
+ wrapper.classList.add('modal-wrapper');
1484
+ wrapper.innerHTML = wrapper.innerHTML + secureByPaystackWhite + secureByPaystackGrey;
1485
+ wrapper.innerHTML = applePayMarkLight;
1486
+ var applePayDescription = document.createElement('p');
1487
+ applePayDescription.id = 'apple-pay-description';
1488
+ applePayDescription.innerHTML = 'Pay with Apple Pay to complete your purchase without filling a form';
1489
+ wrapper.appendChild(applePayDescription);
1490
+ var paymentButtonContainer = document.createElement('div');
1491
+ paymentButtonContainer.id = 'payment-request-button';
1492
+ wrapper.appendChild(paymentButtonContainer);
1493
+ wrapper.appendChild(getOtherPaymentOptionsButton('More payment options'));
1494
+ return wrapper;
1495
+ }
1496
+ /*
1497
+ * This function returns a container with a button to help users who do not receive OTPs
1498
+ * @param {HTMLElement} linkContainer - The container holding the link OTP input
1499
+ * @returns {HTMLElement} - The container with the help button
1500
+ */
1501
+
1502
+
1503
+ function getLinkOtpHelp(linkContainer) {
1504
+ var container = document.createElement('div');
1505
+ container.classList.add('link-otp-not-received');
1506
+ container.innerHTML = "<p class=\"title\">Still not getting OTPs?</p><p class=\"description\">We've tried sending your OTP through all our available channels. If you don't get the OTP within 10 minutes, please try paying using other payment methods.</p><button type=\"button\" id=\"link-back\">Back</button>";
1507
+ var backButton = container.querySelector('#link-back');
1508
+
1509
+ var handleBackClick = function handleBackClick() {
1510
+ container.remove(); // eslint-disable-next-line no-param-reassign
1511
+
1512
+ linkContainer.style.display = 'block';
1513
+ backButton.removeEventListener('click', handleBackClick);
1514
+ };
1515
+
1516
+ backButton.addEventListener('click', handleBackClick);
1517
+ return container;
1518
+ }
1519
+ /*
1520
+ * This function returns a container with the link OTP input and other payment options
1521
+ * @param {Object} transaction - The transaction object
1522
+ * @returns {HTMLElement} - The container with the link OTP input and other payment options
1523
+ * */
1524
+
1525
+
1526
+ function getLinkContent(transaction) {
1527
+ var wrapper = document.createElement('div');
1528
+ wrapper.classList.add('modal-wrapper');
1529
+ wrapper.innerHTML = wrapper.innerHTML + secureByPaystackWhite + secureByPaystackGrey;
1530
+ var linkContainer = document.createElement('div');
1531
+ linkContainer.id = 'link-container';
1532
+ wrapper.appendChild(linkContainer);
1533
+ var iconContainer = document.createElement('div');
1534
+ iconContainer.innerHTML = linkLogo;
1535
+ iconContainer.className = 'link-logo';
1536
+ linkContainer.appendChild(iconContainer);
1537
+ var formattedPhoneNumber = "**** *** ".concat(transaction.link_config.registered_phone);
1538
+ var linkDescription = document.createElement('p');
1539
+ linkDescription.id = 'link-description';
1540
+ linkDescription.innerHTML = "Please enter the OTP that was sent to ".concat(formattedPhoneNumber, " to use your saved payment methods");
1541
+ linkDescription.className = 'link-description';
1542
+ linkContainer.appendChild(linkDescription);
1543
+ var loader;
1544
+ var otpRetry;
1545
+ var linkToken = '';
1546
+ var linkError = document.createElement('p');
1547
+ linkError.id = 'link-error';
1548
+ linkError.className = 'link-error';
1549
+ var pinInput = new PinInput({
1550
+ onComplete: function onComplete(otp) {
1551
+ linkError.style.display = 'none';
1552
+ otpRetry.hide();
1553
+ loader.show();
1554
+ verifyLinkOtp({
1555
+ code: otp,
1556
+ transaction: transaction,
1557
+ token: linkToken
1558
+ }).then(function (response) {
1559
+ getCheckoutIframe().contentWindow.postMessage({
1560
+ type: 'link-success',
1561
+ data: response
1562
+ }, '*');
1563
+ otpRetry.unmount();
1564
+ loader.unmount();
1565
+ pinInput.unmount();
1566
+ }).catch(function (error) {
1567
+ loader.hide();
1568
+ otpRetry.show();
1569
+ linkError.innerText = error.message;
1570
+ linkError.style.display = 'block';
1571
+ });
1572
+ }
1573
+ });
1574
+ linkContainer.appendChild(pinInput.render());
1575
+ linkContainer.appendChild(linkError);
1576
+ loader = new Loader();
1577
+ linkContainer.appendChild(loader.render());
1578
+ otpRetry = new OtpRetry({
1579
+ onSuccess: function onSuccess(token) {
1580
+ linkToken = token;
1581
+ },
1582
+ onFail: function onFail() {
1583
+ linkContainer.style.display = 'none';
1584
+ wrapper.appendChild(getLinkOtpHelp(linkContainer));
1585
+ },
1586
+ transaction: transaction
1587
+ });
1588
+ linkContainer.appendChild(otpRetry.render());
1589
+ var divider = document.createElement('div');
1590
+ divider.className = 'link-divider';
1591
+ divider.innerHTML = '<div class="link-divider__container"><div class="link-divider__line"></div></div><div class="link-divider__text-container"><span class="link-divider__text">or</span></div>';
1592
+ linkContainer.appendChild(divider); // We have to set the correct ID so that the ApplePay button can be mounted in Inline.js
1593
+
1594
+ var applePayButtonContainer = document.createElement('div');
1595
+ applePayButtonContainer.id = 'payment-request-button';
1596
+ linkContainer.appendChild(applePayButtonContainer);
1597
+ linkContainer.appendChild(getOtherPaymentOptionsButton('Use other payment methods'));
1598
+ return wrapper;
1599
+ }
1600
+
817
1601
  function mountPreCheckoutModal(id, transaction) {
818
1602
  var mountedModal = document.querySelector("#pre-checkout-modal-".concat(id));
819
1603
 
@@ -853,21 +1637,7 @@ var PaystackPop = (function () {
853
1637
  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>");
854
1638
  content.appendChild(applePayPaymentInfo);
855
1639
  content.innerHTML += applePayCloseButton;
856
- var wrapper = document.createElement('div');
857
- wrapper.classList.add('modal-wrapper');
858
- wrapper.innerHTML = applePayMarkLight;
859
- var applePayDescription = document.createElement('p');
860
- applePayDescription.id = 'apple-pay-description';
861
- applePayDescription.innerHTML = 'Pay with Apple Pay to complete your purchase without filling a form';
862
- wrapper.appendChild(applePayDescription);
863
- var paymentButtonContainer = document.createElement('div');
864
- paymentButtonContainer.id = 'payment-request-button';
865
- wrapper.appendChild(paymentButtonContainer);
866
- var openPaystackPopButton = document.createElement('button');
867
- openPaystackPopButton.id = 'paystackpop-button';
868
- openPaystackPopButton.innerText = 'More payment options';
869
- wrapper.appendChild(openPaystackPopButton);
870
- wrapper.innerHTML = wrapper.innerHTML + secureByPaystackWhite + secureByPaystackGrey;
1640
+ var wrapper = canPayWithLink(transaction) ? getLinkContent(transaction) : getApplePayContent();
871
1641
  content.appendChild(wrapper);
872
1642
  var style = document.createElement('style');
873
1643
  style.textContent = preCheckoutModalCSS;
@@ -1329,17 +2099,6 @@ var PaystackPop = (function () {
1329
2099
  return iOSDevices.includes(devicePlatform) || // iPAD os safari detection. iPad OS uses the same version of safari as Mac OS
1330
2100
  userAgent.includes('Mac') && 'ontouchend' in document;
1331
2101
  };
1332
- var isAppleOS = function isAppleOS() {
1333
- var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
1334
- platform = _ref2.platform,
1335
- _ref2$userAgent = _ref2.userAgent,
1336
- userAgent = _ref2$userAgent === void 0 ? window && window.navigator && window.navigator.userAgent : _ref2$userAgent;
1337
-
1338
- var devicePlatform = platform || DEVICE_PLATFORM;
1339
- var isSafari = userAgent && !!userAgent.match(/Version\/[\d.]+.*Safari/);
1340
- var isMAC = devicePlatform && /(Mac)/i.test(devicePlatform);
1341
- return isIOS() || isMAC && isSafari;
1342
- };
1343
2102
 
1344
2103
  /* eslint-env browser */
1345
2104
  var AnalyticsAPI = {
@@ -1763,10 +2522,6 @@ var PaystackPop = (function () {
1763
2522
  }, {
1764
2523
  key: "checkout",
1765
2524
  value: function checkout(params) {
1766
- if (!(deviceSupportsApplePay() && isAppleOS())) {
1767
- return Promise.resolve(this.newTransaction(params));
1768
- }
1769
-
1770
2525
  if (this.activeTransaction()) {
1771
2526
  this.activeTransaction().cancel();
1772
2527
  }
@@ -1776,7 +2531,7 @@ var PaystackPop = (function () {
1776
2531
  var transaction = resumableTransaction || new InlineTransaction(params);
1777
2532
  return new Promise(function (resolve, reject) {
1778
2533
  transaction.requestInline().then(function (response) {
1779
- var shouldLoadPreCheckoutModal = response.channels.includes('apple_pay');
2534
+ var shouldLoadPreCheckoutModal = canPayWithLink(response) || canUseApplePay(response.channels);
1780
2535
 
1781
2536
  if (!shouldLoadPreCheckoutModal) {
1782
2537
  inlineInstance.newTransaction({
@@ -1801,14 +2556,11 @@ var PaystackPop = (function () {
1801
2556
  }
1802
2557
  }
1803
2558
  }, response.merchant_id).then(function () {
1804
- inlineInstance.registerPreCheckoutModalEventListeners();
1805
2559
  inlineInstance.registerPaymentRequestEventListeners();
2560
+ }).finally(function () {
2561
+ inlineInstance.registerPreCheckoutModalEventListeners();
1806
2562
  animatePreCheckoutModalIn(inlineInstance.preCheckoutModal);
1807
2563
  resolve(transaction);
1808
- }).catch(function () {
1809
- inlineInstance.closePreCheckoutModal();
1810
- inlineInstance.animateCheckoutIn();
1811
- resolve(transaction);
1812
2564
  });
1813
2565
  }
1814
2566
  }).catch(function (error) {