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

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/es/inline.js CHANGED
@@ -342,6 +342,7 @@ var secureByPaystackGrey = "\n<svg id=\"inline-button-wordmark--grey\" width=\"1
342
342
  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";
343
343
  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";
344
344
  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>";
345
+ 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>";
345
346
 
346
347
  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";
347
348
  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";
@@ -401,7 +402,653 @@ var generateApplePayFallbackCSS = function generateApplePayFallbackCSS(_ref2) {
401
402
  locale = _ref2.locale;
402
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");
403
404
  };
404
- 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";
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: 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";
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
+ 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.pre-checkout-modal .link-retry-error {\n color: #d44141;\n margin-top: 24px;\n}\n";
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
+ /**
411
+ * Loads CSS styles dynamically into the document.
412
+ * @param {string} css - The CSS styles to be loaded.
413
+ * @param {string} id - A unique identifier for the CSS styles. This is used to check if the CSS has already been loaded.
414
+ */
415
+
416
+ function LoadCSS(css, id) {
417
+ var dataAttribute = "data-".concat(id, "-css"); // Check if the CSS has already been loaded
418
+
419
+ if (document.querySelector("style[dataAttribute]")) return;
420
+ var style = document.createElement('style');
421
+ style.textContent = css;
422
+ style.setAttribute(dataAttribute, '');
423
+ document.head.appendChild(style);
424
+ }
425
+
426
+ var PinInput = /*#__PURE__*/function () {
427
+ /**
428
+ * Creates a new instance of the PinInput component.
429
+ *
430
+ * @param {Object} props - The component props.
431
+ * @param {number} [props.pinInputLength=6] - The number of PIN input fields to display.
432
+ * @param {function(string):void} [props.onComplete] - A callback function that is called when the PIN is complete.
433
+ */
434
+ function PinInput() {
435
+ var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
436
+
437
+ _classCallCheck(this, PinInput);
438
+
439
+ this.pinInputLength = props.pinInputLength || 6;
440
+ this.onComplete = props.onComplete;
441
+ this.container = null;
442
+ this.pinInputArrayValue = [];
443
+ this.allInputFields = [];
444
+ this.inputFieldEventListeners = [];
445
+ this.focusedInputFieldIndex = 0;
446
+ }
447
+
448
+ _createClass(PinInput, [{
449
+ key: "render",
450
+ value: function render() {
451
+ LoadCSS(PinInputCSS, 'pin-input');
452
+ this.container = document.createElement('div');
453
+ this.container.id = 'pin-input-container';
454
+ this.container.classList.add('pin-input-container');
455
+
456
+ for (var i = 0; i < this.pinInputLength; i += 1) {
457
+ var pinInputField = document.createElement('input');
458
+ pinInputField.id = "pin-input-".concat(i);
459
+ pinInputField.classList.add('pin-input');
460
+ pinInputField.inputmode = 'numeric';
461
+ this.allInputFields.push(pinInputField);
462
+ this.pinInputArrayValue.push('');
463
+ this.container.appendChild(pinInputField);
464
+ }
465
+
466
+ this.focusInputFieldByIndex(0);
467
+ this.listenForInputFieldEvents();
468
+ return this.container;
469
+ }
470
+ }, {
471
+ key: "listenForInputFieldEvents",
472
+ value: function listenForInputFieldEvents() {
473
+ var _this = this;
474
+
475
+ var _loop = function _loop(index) {
476
+ var inputField = _this.allInputFields[index];
477
+
478
+ var inputEventListener = function inputEventListener(event) {
479
+ _this.onChange(event, index);
480
+ };
481
+
482
+ inputField.addEventListener('input', inputEventListener);
483
+
484
+ var keydownEventListener = function keydownEventListener(event) {
485
+ _this.onKeyDown(event, index);
486
+ };
487
+
488
+ inputField.addEventListener('keydown', keydownEventListener);
489
+
490
+ var focusEventListener = function focusEventListener() {
491
+ _this.focusedInputFieldIndex = index;
492
+ inputField.classList.add('pin-input--focused');
493
+ };
494
+
495
+ inputField.addEventListener('focus', focusEventListener);
496
+
497
+ var blurEventListener = function blurEventListener() {
498
+ inputField.classList.remove('pin-input--focused');
499
+ };
500
+
501
+ inputField.addEventListener('blur', blurEventListener);
502
+
503
+ var pasteEventListener = function pasteEventListener(event) {
504
+ _this.onPaste(event, index);
505
+ };
506
+
507
+ inputField.addEventListener('paste', pasteEventListener);
508
+
509
+ _this.inputFieldEventListeners.push({
510
+ inputEventListener: inputEventListener,
511
+ keydownEventListener: keydownEventListener,
512
+ focusEventListener: focusEventListener,
513
+ blurEventListener: blurEventListener,
514
+ pasteEventListener: pasteEventListener
515
+ });
516
+ };
517
+
518
+ for (var index = 0; index < this.allInputFields.length; index += 1) {
519
+ _loop(index);
520
+ }
521
+ }
522
+ }, {
523
+ key: "focusInputFieldByIndex",
524
+ value: function focusInputFieldByIndex() {
525
+ var index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
526
+ var inputField = this.allInputFields[index];
527
+ inputField.focus();
528
+ inputField.select();
529
+ this.focusedInputFieldIndex = index;
530
+ }
531
+ }, {
532
+ key: "focusNextInputField",
533
+ value: function focusNextInputField() {
534
+ var isFocusedLastInputField = this.focusedInputFieldIndex === this.allInputFields.length - 1;
535
+
536
+ if (isFocusedLastInputField) {
537
+ this.allInputFields[this.focusedInputFieldIndex].blur();
538
+ return;
539
+ }
540
+
541
+ this.focusInputFieldByIndex(this.focusedInputFieldIndex + 1);
542
+ }
543
+ }, {
544
+ key: "focusPreviousInputField",
545
+ value: function focusPreviousInputField() {
546
+ var isFocusedFirstInputField = this.focusedInputFieldIndex === 0;
547
+
548
+ if (isFocusedFirstInputField) {
549
+ return;
550
+ }
551
+
552
+ this.focusInputFieldByIndex(this.focusedInputFieldIndex - 1);
553
+ }
554
+ }, {
555
+ key: "onChange",
556
+ value: function onChange(event, inputFieldIndex) {
557
+ var isInvalidEntry = !/^\d{1}$/.test(Number(event.currentTarget.value));
558
+
559
+ if (isInvalidEntry) {
560
+ this.allInputFields[inputFieldIndex].value = '';
561
+ this.pinInputArrayValue[inputFieldIndex] = '';
562
+ return;
563
+ }
564
+
565
+ this.pinInputArrayValue[inputFieldIndex] = event.currentTarget.value;
566
+ this.focusNextInputField();
567
+
568
+ if (!this.pinInputArrayValue.includes('') && this.onComplete) {
569
+ this.onComplete(this.pinInputArrayValue.join(''));
570
+ }
571
+ }
572
+ }, {
573
+ key: "onKeyDown",
574
+ value: function onKeyDown(event, inputFieldIndex) {
575
+ var eventKey = event.key;
576
+
577
+ if (eventKey === 'ArrowLeft') {
578
+ this.focusPreviousInputField();
579
+ }
580
+
581
+ if (eventKey === 'ArrowRight') {
582
+ this.focusNextInputField();
583
+ }
584
+
585
+ if (eventKey === 'Backspace') {
586
+ event.preventDefault();
587
+ var inputFieldHasValue = this.allInputFields[inputFieldIndex].value.length > 0;
588
+
589
+ if (inputFieldHasValue) {
590
+ this.allInputFields[inputFieldIndex].value = '';
591
+ this.pinInputArrayValue[inputFieldIndex] = '';
592
+ } else if (inputFieldIndex !== 0) {
593
+ this.focusPreviousInputField();
594
+ this.allInputFields[inputFieldIndex - 1].value = '';
595
+ this.pinInputArrayValue[inputFieldIndex - 1] = '';
596
+ }
597
+ }
598
+ }
599
+ }, {
600
+ key: "onPaste",
601
+ value: function onPaste(event) {
602
+ event.preventDefault();
603
+ var pastedData = event.clipboardData.getData('text/plain');
604
+ var pastedValueArray = pastedData.trim().replace(/\D/g, '').split('');
605
+
606
+ for (var i = 0; i < this.allInputFields.length; i += 1) {
607
+ var currentInputField = this.allInputFields[i];
608
+ var pastedCharacter = pastedValueArray[i];
609
+
610
+ if (pastedCharacter) {
611
+ currentInputField.value = pastedCharacter;
612
+ this.pinInputArrayValue[i] = pastedCharacter;
613
+ } else {
614
+ currentInputField.value = '';
615
+ this.pinInputArrayValue[i] = '';
616
+ }
617
+ }
618
+
619
+ this.focusInputFieldByIndex(this.allInputFields.length - 1);
620
+
621
+ if (!this.pinInputArrayValue.includes('') && this.onComplete) {
622
+ this.onComplete(this.pinInputArrayValue.join(''));
623
+ }
624
+ }
625
+ }, {
626
+ key: "unmount",
627
+ value: function unmount() {
628
+ var _this2 = this;
629
+
630
+ this.allInputFields.forEach(function (input, index) {
631
+ var _this2$inputFieldEven = _this2.inputFieldEventListeners[index],
632
+ inputEventListener = _this2$inputFieldEven.inputEventListener,
633
+ keydownEventListener = _this2$inputFieldEven.keydownEventListener,
634
+ focusEventListener = _this2$inputFieldEven.focusEventListener,
635
+ blurEventListener = _this2$inputFieldEven.blurEventListener,
636
+ pasteEventListener = _this2$inputFieldEven.pasteEventListener;
637
+ input.removeEventListener('input', inputEventListener);
638
+ input.removeEventListener('keydown', keydownEventListener);
639
+ input.removeEventListener('focus', focusEventListener);
640
+ input.removeEventListener('blur', blurEventListener);
641
+ input.removeEventListener('paste', pasteEventListener);
642
+ });
643
+ this.container.remove();
644
+ }
645
+ }]);
646
+
647
+ return PinInput;
648
+ }();
649
+
650
+ var CHARGE_TYPES = {
651
+ RECURRING: 'resume',
652
+ PREAUTHORIZATION: 'preauthorization',
653
+ DEFAULT: 'default'
654
+ };
655
+ /**
656
+ * Get the common headers for the request.
657
+ * @param {Object} param - Request parameters.
658
+ * @param {String} param.token - Auth Token.
659
+ * @param {String} param.language - Language.
660
+ * @returns {Object} - Headers.
661
+ */
662
+
663
+ var getCommonHeaders = function getCommonHeaders(_ref) {
664
+ var token = _ref.token,
665
+ language = _ref.language;
666
+ return _objectSpread2(_objectSpread2({
667
+ 'Content-Type': 'application/json'
668
+ }, language && {
669
+ 'Accept-Language': language
670
+ }), token && {
671
+ Authorization: "Bearer ".concat(token)
672
+ });
673
+ };
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
+ /**
687
+ * send OTP to the user's email or phone number.
688
+ * @param {Object} transaction - Transaction object.
689
+ * @param {String} email - User's email.
690
+ * @param {Array} channels - Channels to send the OTP to.
691
+ * @returns {Promise<{status: boolean, message: string, data: {token: string}}>} - Response object.
692
+ */
693
+
694
+
695
+ function sendLinkOtp(_ref2) {
696
+ var _transaction$urlParam;
697
+
698
+ var transaction = _ref2.transaction,
699
+ email = _ref2.email,
700
+ _ref2$channels = _ref2.channels,
701
+ channels = _ref2$channels === void 0 ? ['sms'] : _ref2$channels;
702
+ var language = transaction === null || transaction === void 0 ? void 0 : (_transaction$urlParam = transaction.urlParameters) === null || _transaction$urlParam === void 0 ? void 0 : _transaction$urlParam.language;
703
+ return fetch(new URL('/saved_cards/authorize', config.paystackApiUrl).toString(), {
704
+ method: 'POST',
705
+ body: JSON.stringify({
706
+ channels: channels,
707
+ email: email,
708
+ transaction: transaction.id,
709
+ is_six_digit_otp: true
710
+ }),
711
+ headers: getCommonHeaders({
712
+ language: language
713
+ })
714
+ }).then(function (response) {
715
+ if (!response.ok) {
716
+ throw new Error('Failed to send OTP');
717
+ }
718
+
719
+ return response.json();
720
+ });
721
+ }
722
+ /**
723
+ * Verify OTP.
724
+ * @param {String} code - OTP code.
725
+ * @param {Object} transaction - Transaction object.
726
+ * @param {String} token - Auth Token.
727
+ * @returns {Promise<{status: boolean, message: string, data: {token: string}}>} - Response object.
728
+ */
729
+
730
+ function verifyLinkOtp(_ref3) {
731
+ var _transaction$urlParam2;
732
+
733
+ var code = _ref3.code,
734
+ transaction = _ref3.transaction,
735
+ token = _ref3.token;
736
+ var language = transaction === null || transaction === void 0 ? void 0 : (_transaction$urlParam2 = transaction.urlParameters) === null || _transaction$urlParam2 === void 0 ? void 0 : _transaction$urlParam2.language;
737
+ return fetch(new URL('/saved_cards/authorize/verify', config.paystackApiUrl).toString(), {
738
+ method: 'POST',
739
+ body: JSON.stringify({
740
+ code: code,
741
+ transaction: transaction.id
742
+ }),
743
+ headers: getCommonHeaders({
744
+ language: language,
745
+ token: token
746
+ })
747
+ }).then(function (response) {
748
+ if (!response.ok) {
749
+ throw new Error('Failed to verify OTP');
750
+ }
751
+
752
+ return response.json();
753
+ }).catch(function (error) {
754
+ 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
755
+
756
+ throw new Error(errorMessage);
757
+ });
758
+ }
759
+ /**
760
+ * Check if the transaction can be paid with a link.
761
+ * @param {Object} transaction - Transaction object.
762
+ * @returns {Boolean} - True if the transaction can be paid with link.
763
+ */
764
+
765
+ function canPayWithLink(transaction) {
766
+ var _transaction$link_con, _transaction$link_con2;
767
+
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) && getChargeType() === CHARGE_TYPES.DEFAULT;
769
+ }
770
+
771
+ var CountdownTimer = /*#__PURE__*/function () {
772
+ /**
773
+ * Creates an instance of CountdownTimer.
774
+ * @param {Object} props - The properties for the countdown timer.
775
+ * @param {number} [props.countdownDuration=60] - The duration of the countdown in seconds.
776
+ * @param {string} [props.countdownMessage='Resend OTP via SMS & WhatsApp in'] - The message to display during the countdown.
777
+ * @param {function} [props.onCountdownComplete] - A callback function to be executed when the countdown completes.
778
+ */
779
+ function CountdownTimer() {
780
+ var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
781
+
782
+ _classCallCheck(this, CountdownTimer);
783
+
784
+ this.container = null;
785
+ this.countdownMessageElement = null;
786
+ this.countdownTimeElement = null;
787
+ this.countdownDuration = props.countdownDuration || 60;
788
+ this.countdownMessage = props.countdownMessage || 'Resend OTP via SMS & WhatsApp in';
789
+ this.onCountdownComplete = props.onCountdownComplete || null; // This is the changing time state
790
+
791
+ this.remainingTime = this.countdownDuration;
792
+ this.countdownInterval = null;
793
+ }
794
+ /**
795
+ * Starts the countdown timer and returns the container element.
796
+ * @returns {HTMLElement} The container element for the countdown timer.
797
+ */
798
+
799
+
800
+ _createClass(CountdownTimer, [{
801
+ key: "render",
802
+ value: function render() {
803
+ LoadCSS(CountdownTimerCSS, 'countdown');
804
+ this.container = document.createElement('div');
805
+ this.container.id = 'countdown-timer';
806
+ this.container.classList.add('countdown-timer-container');
807
+ this.countdownTimeElement = document.createElement('span');
808
+ this.countdownTimeElement.classList.add('countdown-time');
809
+ this.countdownMessageElement = document.createElement('span');
810
+ this.countdownMessageElement.classList.add('countdown-message');
811
+ this.countdownMessageElement.innerHTML = "".concat(this.countdownMessage, "&nbsp;");
812
+ this.container.appendChild(this.countdownMessageElement);
813
+ this.container.appendChild(this.countdownTimeElement);
814
+ this.countdown();
815
+ return this.container;
816
+ }
817
+ /**
818
+ * Formats the remaining time in the countdown timer.
819
+ * @returns {string} The formatted time string (e.g., '1:30').
820
+ */
821
+
822
+ }, {
823
+ key: "formatCountDownTime",
824
+ value: function formatCountDownTime() {
825
+ var minutes = Math.floor(this.remainingTime / 60);
826
+ var seconds = this.remainingTime % 60;
827
+ var modifiedSeconds = seconds < 10 ? "0".concat(seconds) : seconds;
828
+ return "".concat(minutes, ":").concat(modifiedSeconds);
829
+ }
830
+ /**
831
+ * Starts the countdown timer and updates the displayed time every second.
832
+ */
833
+
834
+ }, {
835
+ key: "countdown",
836
+ value: function countdown() {
837
+ var _this = this;
838
+
839
+ this.countdownInterval = setInterval(function () {
840
+ if (_this.remainingTime > 0) {
841
+ var countdownCompletionPercentage = Math.round((_this.countdownDuration - _this.remainingTime) / _this.countdownDuration * 100);
842
+
843
+ if (countdownCompletionPercentage >= 80) {
844
+ _this.countdownTimeElement.classList.add('countdown-time--completing');
845
+ }
846
+ } else {
847
+ clearInterval(_this.countdownInterval);
848
+
849
+ if (typeof _this.onCountdownComplete === 'function') {
850
+ _this.onCountdownComplete();
851
+ }
852
+ }
853
+
854
+ _this.countdownTimeElement.innerHTML = _this.formatCountDownTime();
855
+ _this.remainingTime -= 1;
856
+ }, 1000);
857
+ }
858
+ /**
859
+ * Resets the countdown timer to the initial countdown duration and restarts the countdown.
860
+ */
861
+
862
+ }, {
863
+ key: "reset",
864
+ value: function reset() {
865
+ clearInterval(this.countdownInterval);
866
+ this.remainingTime = this.countdownDuration;
867
+ this.countdownTimeElement.classList.remove('countdown-time--completing');
868
+ this.countdown();
869
+ }
870
+ /**
871
+ * Removes the countdown timer from the DOM and clears the countdown interval.
872
+ */
873
+
874
+ }, {
875
+ key: "unmount",
876
+ value: function unmount() {
877
+ clearInterval(this.countdownInterval);
878
+ this.container.remove();
879
+ }
880
+ }]);
881
+
882
+ return CountdownTimer;
883
+ }();
884
+
885
+ var OTP_RESEND_COUNT_CONFIG = [{
886
+ text: 'Resend OTP via WhatsApp',
887
+ countdownMessage: 'Resend OTP via SMS & WhatsApp in',
888
+ channels: ['whatsapp']
889
+ }, {
890
+ text: 'Resend OTP via SMS & WhatsApp',
891
+ countdownMessage: 'Resending OTP ...',
892
+ channels: ['sms', 'whatsapp']
893
+ }];
894
+ /**
895
+ * Renders a button to resend OTPs and handles the resend logic.
896
+ * Provides a countdown timer and error handling.
897
+ * @param {Object} props - The component props.
898
+ * @param {Object} props.transaction - The transaction data
899
+ * @param {Function} props.onFail - The callback function called when OTPS fail multiple times
900
+ * @param {Function} props.onSuccess - The callback function called when OTPS are successfully sent
901
+ */
902
+
903
+ var OtpRetry = /*#__PURE__*/function () {
904
+ function OtpRetry() {
905
+ var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
906
+
907
+ _classCallCheck(this, OtpRetry);
908
+
909
+ this.transaction = props.transaction;
910
+ this.onFail = props.onFail;
911
+ this.onSuccess = props.onSuccess;
912
+ this.otpResendCount = 0;
913
+ this.handleClickEvent = this.handleClickEvent.bind(this);
914
+ }
915
+
916
+ _createClass(OtpRetry, [{
917
+ key: "render",
918
+ value: function render() {
919
+ LoadCSS(OptRetryCSS, 'otp-retry');
920
+ this.container = document.createElement('div');
921
+ this.container.id = 'otp-retry-container';
922
+ this.resendOtpText = document.createElement('p');
923
+ this.otpErrorText = document.createElement('p');
924
+ this.otpHint = document.createElement('p');
925
+ this.countdownContainer = document.createElement('div');
926
+ this.resendOtpText.className = 'link-retry-text';
927
+ this.resendOtpText.innerText = OTP_RESEND_COUNT_CONFIG[this.otpResendCount].text;
928
+ 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
+ this.otpHint.className = 'link-retry-text';
933
+ this.otpHint.innerText = 'Still not getting OTPs?';
934
+ this.otpHint.style.display = 'none';
935
+ this.otpHint.addEventListener('click', this.onFail);
936
+ this.container.appendChild(this.otpHint);
937
+ this.countdownContainer.style.marginTop = '24px';
938
+ this.container.appendChild(this.countdownContainer);
939
+ this.resendOtpText.addEventListener('click', this.handleClickEvent);
940
+ this.sendOtp(['sms']);
941
+ return this.container;
942
+ }
943
+ }, {
944
+ key: "sendOtp",
945
+ value: function sendOtp(channels) {
946
+ var _this = this;
947
+
948
+ sendLinkOtp({
949
+ channels: channels || OTP_RESEND_COUNT_CONFIG[this.otpResendCount].channels,
950
+ email: this.transaction.email,
951
+ transaction: this.transaction.id
952
+ }).then(function (response) {
953
+ return _this.onSuccess(response.data.token);
954
+ }).catch(function (error) {
955
+ _this.otpErrorText.innerText = error instanceof Error ? error.message : 'Unable to resend OTP';
956
+ _this.otpErrorText.style.display = 'block';
957
+ });
958
+ }
959
+ }, {
960
+ key: "handleClickEvent",
961
+ value: function handleClickEvent() {
962
+ var _this2 = this;
963
+
964
+ this.resendOtpText.style.display = 'none';
965
+ this.sendOtp(); // Set up the countdown timer with the appropriate message
966
+
967
+ var countdownMessage = OTP_RESEND_COUNT_CONFIG[this.otpResendCount].countdownMessage;
968
+ this.countdown = new CountdownTimer({
969
+ countdownMessage: countdownMessage,
970
+ onCountdownComplete: function onCountdownComplete() {
971
+ _this2.countdown.unmount();
972
+
973
+ if (_this2.otpResendCount === 1) {
974
+ _this2.otpHint.style.display = 'block';
975
+ return;
976
+ }
977
+
978
+ _this2.otpResendCount += 1;
979
+ _this2.resendOtpText.innerText = OTP_RESEND_COUNT_CONFIG[_this2.otpResendCount].text;
980
+ _this2.resendOtpText.style.display = 'block';
981
+ }
982
+ });
983
+ this.countdownContainer.appendChild(this.countdown.render());
984
+ }
985
+ }, {
986
+ key: "hide",
987
+ value: function hide() {
988
+ this.container.style.display = 'none';
989
+ }
990
+ }, {
991
+ key: "show",
992
+ value: function show() {
993
+ this.container.style.display = 'block';
994
+ }
995
+ }, {
996
+ key: "unmount",
997
+ value: function unmount() {
998
+ this.resendOtpText.removeEventListener('click', this.handleClickEvent);
999
+ this.otpHint.removeEventListener('click', this.onFail);
1000
+ this.countdown.unmount();
1001
+ this.container.remove();
1002
+ }
1003
+ }]);
1004
+
1005
+ return OtpRetry;
1006
+ }();
1007
+
1008
+ var Loader = /*#__PURE__*/function () {
1009
+ function Loader() {
1010
+ _classCallCheck(this, Loader);
1011
+
1012
+ this.container = null;
1013
+ }
1014
+
1015
+ _createClass(Loader, [{
1016
+ key: "render",
1017
+ value: function render() {
1018
+ LoadCSS(LoaderCSS, 'loader');
1019
+ this.container = document.createElement('div');
1020
+ this.container.classList.add('loader');
1021
+ this.hide();
1022
+ var spinnerElement = document.createElement('div');
1023
+ spinnerElement.classList.add('loader__spinner');
1024
+
1025
+ for (var i = 0; i < 12; i += 1) {
1026
+ var spinnerItemElement = document.createElement('div');
1027
+ spinnerElement.appendChild(spinnerItemElement);
1028
+ }
1029
+
1030
+ this.container.appendChild(spinnerElement);
1031
+ return this.container;
1032
+ }
1033
+ }, {
1034
+ key: "show",
1035
+ value: function show() {
1036
+ this.container.style.display = 'block';
1037
+ }
1038
+ }, {
1039
+ key: "hide",
1040
+ value: function hide() {
1041
+ this.container.style.display = 'none';
1042
+ }
1043
+ }, {
1044
+ key: "unmount",
1045
+ value: function unmount() {
1046
+ this.container.remove();
1047
+ }
1048
+ }]);
1049
+
1050
+ return Loader;
1051
+ }();
405
1052
 
406
1053
  var amountSubunitToBase = function amountSubunitToBase() {
407
1054
  var amount = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
@@ -537,6 +1184,10 @@ function createIframe(id) {
537
1184
  return iframe;
538
1185
  }
539
1186
 
1187
+ function getCheckoutIframe(id) {
1188
+ return document.getElementById("inline-checkout-".concat(id));
1189
+ }
1190
+
540
1191
  function mountCheckoutIframe(id) {
541
1192
  var iframe = createIframe("inline-checkout-".concat(id));
542
1193
  iframe.src = "".concat(config.checkoutUrl, "popup");
@@ -801,7 +1452,7 @@ function mountPaymentRequestButtons(container, _ref3, merchantId) {
801
1452
  });
802
1453
  }
803
1454
  function removeAllChildNodes(parent) {
804
- while (parent.firstChild) {
1455
+ while (parent !== null && parent !== void 0 && parent.firstChild) {
805
1456
  parent.removeChild(parent.firstChild);
806
1457
  }
807
1458
  }
@@ -811,6 +1462,139 @@ function getPreCheckoutModalOpenPaystackPopButton(modal) {
811
1462
  function getPreCheckoutModalPaymentRequestContainer(modal) {
812
1463
  return modal.querySelector('#payment-request-button');
813
1464
  }
1465
+
1466
+ function getOtherPaymentOptionsButton(text) {
1467
+ var openPaystackPopButton = document.createElement('button');
1468
+ openPaystackPopButton.id = 'paystackpop-button';
1469
+ openPaystackPopButton.innerText = text;
1470
+ return openPaystackPopButton;
1471
+ }
1472
+ /*
1473
+ * This function returns a container with the Apple Pay button and other payment options
1474
+ * @returns {HTMLElement} - The container with the Apple Pay button and other payment options
1475
+ */
1476
+
1477
+
1478
+ function getApplePayContent() {
1479
+ var wrapper = document.createElement('div');
1480
+ wrapper.classList.add('modal-wrapper');
1481
+ wrapper.innerHTML = applePayMarkLight;
1482
+ var applePayDescription = document.createElement('p');
1483
+ applePayDescription.id = 'apple-pay-description';
1484
+ applePayDescription.innerHTML = 'Pay with Apple Pay to complete your purchase without filling a form';
1485
+ wrapper.appendChild(applePayDescription);
1486
+ var paymentButtonContainer = document.createElement('div');
1487
+ paymentButtonContainer.id = 'payment-request-button';
1488
+ wrapper.appendChild(paymentButtonContainer);
1489
+ wrapper.appendChild(getOtherPaymentOptionsButton('More payment options'));
1490
+ wrapper.innerHTML = wrapper.innerHTML + secureByPaystackWhite + secureByPaystackGrey;
1491
+ return wrapper;
1492
+ }
1493
+ /*
1494
+ * This function returns a container with a button to help users who do not receive OTPs
1495
+ * @param {HTMLElement} linkContainer - The container holding the link OTP input
1496
+ * @returns {HTMLElement} - The container with the help button
1497
+ */
1498
+
1499
+
1500
+ function getLinkOtpHelp(linkContainer) {
1501
+ var container = document.createElement('div');
1502
+ container.classList.add('link-otp-not-received');
1503
+ 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>";
1504
+ var backButton = container.querySelector('#link-back');
1505
+
1506
+ var handleBackClick = function handleBackClick() {
1507
+ container.remove(); // eslint-disable-next-line no-param-reassign
1508
+
1509
+ linkContainer.style.display = 'block';
1510
+ backButton.removeEventListener('click', handleBackClick);
1511
+ };
1512
+
1513
+ backButton.addEventListener('click', handleBackClick);
1514
+ return container;
1515
+ }
1516
+ /*
1517
+ * This function returns a container with the link OTP input and other payment options
1518
+ * @param {Object} transaction - The transaction object
1519
+ * @returns {HTMLElement} - The container with the link OTP input and other payment options
1520
+ * */
1521
+
1522
+
1523
+ function getLinkContent(transaction) {
1524
+ var wrapper = document.createElement('div');
1525
+ wrapper.classList.add('modal-wrapper');
1526
+ wrapper.innerHTML = wrapper.innerHTML + secureByPaystackWhite + secureByPaystackGrey;
1527
+ var linkContainer = document.createElement('div');
1528
+ linkContainer.id = 'link-container';
1529
+ wrapper.appendChild(linkContainer);
1530
+ var iconContainer = document.createElement('div');
1531
+ iconContainer.innerHTML = linkLogo;
1532
+ iconContainer.className = 'link-logo';
1533
+ linkContainer.appendChild(iconContainer);
1534
+ var formattedPhoneNumber = "**** *** ".concat(transaction.link_config.registered_phone);
1535
+ var linkDescription = document.createElement('p');
1536
+ linkDescription.id = 'link-description';
1537
+ linkDescription.innerHTML = "Please enter the OTP that was sent to ".concat(formattedPhoneNumber, " to use your saved payment methods");
1538
+ linkDescription.className = 'link-description';
1539
+ linkContainer.appendChild(linkDescription);
1540
+ var loader;
1541
+ var otpRetry;
1542
+ var linkToken = '';
1543
+ var linkError = document.createElement('p');
1544
+ linkError.id = 'link-error';
1545
+ linkError.className = 'link-error';
1546
+ var pinInput = new PinInput({
1547
+ onComplete: function onComplete(otp) {
1548
+ linkError.style.display = 'none';
1549
+ otpRetry.hide();
1550
+ loader.show();
1551
+ verifyLinkOtp({
1552
+ code: otp,
1553
+ transaction: transaction,
1554
+ token: linkToken
1555
+ }).then(function (response) {
1556
+ getCheckoutIframe().contentWindow.postMessage({
1557
+ type: 'link-success',
1558
+ data: response
1559
+ }, '*');
1560
+ otpRetry.unmount();
1561
+ loader.unmount();
1562
+ pinInput.unmount();
1563
+ }).catch(function (error) {
1564
+ loader.hide();
1565
+ otpRetry.show();
1566
+ linkError.innerText = error.message;
1567
+ linkError.style.display = 'block';
1568
+ });
1569
+ }
1570
+ });
1571
+ linkContainer.appendChild(pinInput.render());
1572
+ linkContainer.appendChild(linkError);
1573
+ loader = new Loader();
1574
+ linkContainer.appendChild(loader.render());
1575
+ otpRetry = new OtpRetry({
1576
+ onSuccess: function onSuccess(token) {
1577
+ linkToken = token;
1578
+ },
1579
+ onFail: function onFail() {
1580
+ linkContainer.style.display = 'none';
1581
+ wrapper.appendChild(getLinkOtpHelp(linkContainer));
1582
+ },
1583
+ transaction: transaction
1584
+ });
1585
+ linkContainer.appendChild(otpRetry.render());
1586
+ var divider = document.createElement('div');
1587
+ divider.className = 'link-divider';
1588
+ 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>';
1589
+ linkContainer.appendChild(divider); // We have to set the correct ID so that the ApplePay button can be mounted in Inline.js
1590
+
1591
+ var applePayButtonContainer = document.createElement('div');
1592
+ applePayButtonContainer.id = 'payment-request-button';
1593
+ linkContainer.appendChild(applePayButtonContainer);
1594
+ linkContainer.appendChild(getOtherPaymentOptionsButton('Use other payment methods'));
1595
+ return wrapper;
1596
+ }
1597
+
814
1598
  function mountPreCheckoutModal(id, transaction) {
815
1599
  var mountedModal = document.querySelector("#pre-checkout-modal-".concat(id));
816
1600
 
@@ -850,21 +1634,7 @@ function mountPreCheckoutModal(id, transaction) {
850
1634
  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>");
851
1635
  content.appendChild(applePayPaymentInfo);
852
1636
  content.innerHTML += applePayCloseButton;
853
- var wrapper = document.createElement('div');
854
- wrapper.classList.add('modal-wrapper');
855
- wrapper.innerHTML = applePayMarkLight;
856
- var applePayDescription = document.createElement('p');
857
- applePayDescription.id = 'apple-pay-description';
858
- applePayDescription.innerHTML = 'Pay with Apple Pay to complete your purchase without filling a form';
859
- wrapper.appendChild(applePayDescription);
860
- var paymentButtonContainer = document.createElement('div');
861
- paymentButtonContainer.id = 'payment-request-button';
862
- wrapper.appendChild(paymentButtonContainer);
863
- var openPaystackPopButton = document.createElement('button');
864
- openPaystackPopButton.id = 'paystackpop-button';
865
- openPaystackPopButton.innerText = 'More payment options';
866
- wrapper.appendChild(openPaystackPopButton);
867
- wrapper.innerHTML = wrapper.innerHTML + secureByPaystackWhite + secureByPaystackGrey;
1637
+ var wrapper = canPayWithLink(transaction) ? getLinkContent(transaction) : getApplePayContent();
868
1638
  content.appendChild(wrapper);
869
1639
  var style = document.createElement('style');
870
1640
  style.textContent = preCheckoutModalCSS;
@@ -1326,17 +2096,6 @@ var isIOS = function isIOS() {
1326
2096
  return iOSDevices.includes(devicePlatform) || // iPAD os safari detection. iPad OS uses the same version of safari as Mac OS
1327
2097
  userAgent.includes('Mac') && 'ontouchend' in document;
1328
2098
  };
1329
- var isAppleOS = function isAppleOS() {
1330
- var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
1331
- platform = _ref2.platform,
1332
- _ref2$userAgent = _ref2.userAgent,
1333
- userAgent = _ref2$userAgent === void 0 ? window && window.navigator && window.navigator.userAgent : _ref2$userAgent;
1334
-
1335
- var devicePlatform = platform || DEVICE_PLATFORM;
1336
- var isSafari = userAgent && !!userAgent.match(/Version\/[\d.]+.*Safari/);
1337
- var isMAC = devicePlatform && /(Mac)/i.test(devicePlatform);
1338
- return isIOS() || isMAC && isSafari;
1339
- };
1340
2099
 
1341
2100
  /* eslint-env browser */
1342
2101
  var AnalyticsAPI = {
@@ -1760,10 +2519,6 @@ var Inline = /*#__PURE__*/function () {
1760
2519
  }, {
1761
2520
  key: "checkout",
1762
2521
  value: function checkout(params) {
1763
- if (!(deviceSupportsApplePay() && isAppleOS())) {
1764
- return Promise.resolve(this.newTransaction(params));
1765
- }
1766
-
1767
2522
  if (this.activeTransaction()) {
1768
2523
  this.activeTransaction().cancel();
1769
2524
  }
@@ -1773,7 +2528,7 @@ var Inline = /*#__PURE__*/function () {
1773
2528
  var transaction = resumableTransaction || new InlineTransaction(params);
1774
2529
  return new Promise(function (resolve, reject) {
1775
2530
  transaction.requestInline().then(function (response) {
1776
- var shouldLoadPreCheckoutModal = response.channels.includes('apple_pay');
2531
+ var shouldLoadPreCheckoutModal = canPayWithLink(response) || canUseApplePay(response.channels);
1777
2532
 
1778
2533
  if (!shouldLoadPreCheckoutModal) {
1779
2534
  inlineInstance.newTransaction({
@@ -1798,14 +2553,11 @@ var Inline = /*#__PURE__*/function () {
1798
2553
  }
1799
2554
  }
1800
2555
  }, response.merchant_id).then(function () {
1801
- inlineInstance.registerPreCheckoutModalEventListeners();
1802
2556
  inlineInstance.registerPaymentRequestEventListeners();
2557
+ }).finally(function () {
2558
+ inlineInstance.registerPreCheckoutModalEventListeners();
1803
2559
  animatePreCheckoutModalIn(inlineInstance.preCheckoutModal);
1804
2560
  resolve(transaction);
1805
- }).catch(function () {
1806
- inlineInstance.closePreCheckoutModal();
1807
- inlineInstance.animateCheckoutIn();
1808
- resolve(transaction);
1809
2561
  });
1810
2562
  }
1811
2563
  }).catch(function (error) {