@paystack/inline-js 2.25.0 → 2.26.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/lib/inline.js CHANGED
@@ -1 +1,2457 @@
1
- "use strict";function e(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,a=Array(t);n<t;n++)a[n]=e[n];return a}function t(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,u(a.key),a)}}function a(e,t,a){return t&&n(e.prototype,t),a&&n(e,a),Object.defineProperty(e,"prototype",{writable:!1}),e}function r(e,t,n){return(t=u(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,a)}return n}function o(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?i(Object(n),!0).forEach(function(t){r(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function c(e,t){if(null==e)return{};var n,a,r=function(e,t){if(null==e)return{};var n={};for(var a in e)if({}.hasOwnProperty.call(e,a)){if(-1!==t.indexOf(a))continue;n[a]=e[a]}return n}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)n=i[a],-1===t.indexOf(n)&&{}.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function s(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var a,r,i,o,c=[],s=!0,l=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(a=i.call(n)).done)&&(c.push(a.value),c.length!==t);s=!0);}catch(e){l=!0,r=e}finally{try{if(!s&&null!=n.return&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw r}}return c}}(e,t)||d(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function l(t){return function(t){if(Array.isArray(t))return e(t)}(t)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(t)||d(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function u(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var a=n.call(e,t||"default");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function p(e){return p="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},p(e)}function d(t,n){if(t){if("string"==typeof t)return e(t,n);var a={}.toString.call(t).slice(8,-1);return"Object"===a&&t.constructor&&(a=t.constructor.name),"Map"===a||"Set"===a?Array.from(t):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?e(t,n):void 0}}var h={cookieTestUrl:"https://legacy-staging.paystack.co/test-iframe/start.html",publishableKey:"uFmz/uE/SDT6GupOrSEXIZXGByjQ0zFkPyc9LqKHFqnTI0WPN3JS5kQPo/j9or0TOXlqMQj2lzHn/UGsQT4XeQ==",publicKey:"-----BEGIN PUBLIC KEY-----\r\nMFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBALhZs/7hP0g0+hrqTq0hFyGVxgco0NMx\r\nZD8nPS6ihxap0yNFjzdyUuZED6P4/aK9Ezl5ajEI9pcx5/1BrEE+F3kCAwEAAQ==\r\n-----END PUBLIC KEY-----",applePayVersion:6,applePayValidateSessionPath:"applepay/validate-session/",applePayChargePath:"applepay/charge"},m=o(o({},h),{},{checkoutUrl:"http://localhost:8081/",paymentBaseUrl:"https://legacy-staging.paystack.co/",paystackApiUrl:"https://studio-api.paystack.co/",siteUrl:"https://paystack.com",pusherKey:"1c7b262ee18455815893",pusherUrl:"http://localhost:8081/static/vendor/pusher.min.js"}),y=o(o({},h),{},{checkoutUrl:"https://checkout-studio.paystack.com/",paymentBaseUrl:"https://legacy-staging.paystack.co/",paystackApiUrl:"https://studio-api.paystack.co/",siteUrl:"https://beta.paystack.com",pusherKey:"1c7b262ee18455815893",pusherUrl:"https://checkout-studio.paystack.com/static/vendor/pusher.min.js"}),f={dev:m,staging:y,production:o(o({},h),{},{checkoutUrl:"https://checkout.paystack.com/",paymentBaseUrl:"https://standard.paystack.co/",paystackApiUrl:"https://api.paystack.co/",siteUrl:"https://paystack.com",pusherKey:"8e4b9b7ca3418bd5cdc8",pusherUrl:"https://checkout.paystack.com/static/vendor/pusher.min.js"})}.production||y;function g(e,t){var n=[];return Object.keys(e).forEach(function(a){var r=t?"".concat(t,"[").concat(a,"]"):a,i=e[r];n.push(null!==i&&"object"===("undefined"==typeof v?"undefined":p(v))?g(i,r):"".concat(encodeURIComponent(a),"=").concat(encodeURIComponent(i)))}),n.join("&")}function b(){return document.currentScript||(e=document.getElementsByTagName("script"))[e.length-1];var e}function k(){var e=[],t=b();if(t){var n=Array.prototype.slice.call(t.attributes);e=Object.keys(n).filter(function(e){var t=n[e].nodeName;return t&&t.indexOf("data")>-1}).map(function(e){return n[e].nodeName})}return e}var w={height:"50px",width:"auto",borderRadius:"3px",padding:"10px",locale:"en",type:"pay"},C=function(e){return e&&"object"===p(e)?Object.keys(w).reduce(function(t,n){return o(o({},t),{},r({},n,e[n]||w[n]))},{}):w},P=function(){return Number(parseFloat((arguments.length>0&&void 0!==arguments[0]?arguments[0]:0)/100).toFixed(2))},S={headers:{accept:"application/json, text/plain, */*","accept-language":"en-GB,en-US;q=0.9,en;q=0.8","content-type":"application/x-www-form-urlencoded","sec-ch-ua-mobile":"?0","sec-fetch-dest":"empty","sec-fetch-mode":"cors","sec-fetch-site":"cross-site"},referrerPolicy:"no-referrer-when-downgrade",method:"POST",mode:"cors",credentials:"omit"};function x(e){return Object.keys(e).reduce(function(t,n){var a=encodeURIComponent(n),r=encodeURIComponent(e[n]),i="".concat(a,"=").concat(r);return[].concat(l(t),[i])},[]).join("&")}var A=function(e){return{biannually:"BIANNUAL PLAN",annually:"ANNUAL PLAN"}[e]||"".concat(e.toUpperCase()," PLAN")},q=function(){try{return window.location&&"https:"===window.location.protocol&&window.ApplePaySession&&window.ApplePaySession.supportsVersion(f.applePayVersion)}catch(e){return!1}},E=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return q()&&e.includes("apple_pay")};function T(e){var t=document.createElement("iframe");return t.setAttribute("frameBorder","0"),t.setAttribute("allowtransparency","true"),t.id=e,t.style.display="none",t}function _(e){return e.querySelector("apple-pay-button")||e.querySelector("#apple-pay-button")}function I(e){return document.querySelector("#".concat(e))}function O(e,t,n){var a=t.channels,r=void 0===a?[]:a,i=t.styles,o=void 0===i?{}:i,c={applePay:!1};return new Promise(function(t,a){if(e)if(E(r)){if(_(e))return c.applePay=!0,void t(c);(function(e,t){var n=t.container,a=t.integrity;return new Promise(function(t,r){e||r("No script url");var i=document.createElement("script");i.src=e,i.crossOrigin="anonymous",a&&(i.integrity=a),i.addEventListener("load",function(){t(!0)}),i.addEventListener("error",function(){i.remove(),r(!1)}),n?n.appendChild(i):document.head.appendChild(i)})})("https://applepay.cdn-apple.com/jsapi/v1.1.0/apple-pay-sdk.js",{container:e,integrity:"sha384-z/6BVHCcSypLSykOVpaT1PQWHOOgU45uOOlMkgi/bElX4yFqmChNMb7qiv80wFav"}).then(function(){if(n&&1077497!==n&&window&&!Array.isArray(window.webpackJsonp))throw new Error("Incorrect data type for 'webpackJsonp', expected array, got ".concat(p(window.webpackJsonp),". Switching to fallback apple pay button"));!function(e,t){var n,a,r,i,o,c=t.styles,s=t.theme,l=document.createElement("style"),u=(a=(n=c).height,r=n.width,i=n.borderRadius,o=n.padding,"\n apple-pay-button {\n --apple-pay-button-width: ".concat(r,";\n --apple-pay-button-height: ").concat(a,";\n --apple-pay-button-border-radius: ").concat(i,";\n --apple-pay-button-padding: ").concat(o,";\n --apple-pay-button-box-sizing: border-box;\n width: ").concat(r,";\n }\n"));l.type="text/css",l.styleSheet?l.styleSheet.cssText=u:l.appendChild(document.createTextNode(u)),e.appendChild(l);var p=document.createElement("apple-pay-button");p.setAttribute("buttonstyle","light"===s?"white":"black"),p.setAttribute("type",c.type),p.setAttribute("locale",c.locale),e.appendChild(p)}(e,{styles:C(o.applePay),theme:o.theme}),c.applePay=!0,t(c)}).catch(function(){!function(e,t){var n,a,r,i,o,c,s,l=t.styles,u=t.theme,p=document.createElement("style"),d=(a=(n=l).height,r=n.width,i=n.borderRadius,o=n.padding,c=n.type,s=n.locale,"\n @supports (-webkit-appearance: -apple-pay-button) { \n .apple-pay-button {\n display: inline-block;\n -webkit-appearance: -apple-pay-button;\n width: ".concat(r,";\n height: ").concat(a,";\n border-radius: ").concat(i,";\n padding: ").concat(o,";\n -apple-pay-button-type: ").concat(c,";\n -webkit-locale: ").concat(s,";\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"));p.type="text/css",p.styleSheet?p.styleSheet.cssText=d:p.appendChild(document.createTextNode(d)),e.appendChild(p);var h=document.createElement("button");h.classList.add("apple-pay-button","light"===u?"apple-pay-button-white":"apple-pay-button-black"),h.id="apple-pay-button";var m=document.createElement("span");m.classList.add("logo"),h.appendChild(m),e.appendChild(h)}(e,{styles:C(o.applePay),theme:o.theme}),c.applePay=!0,t(c)})}else a("No wallet payment method is available on this device");else a("Container to mount elements was not provided")})}function z(e){for(;e.firstChild;)e.removeChild(e.firstChild)}var j=[{value:"key",required:!0,types:["string"]},{value:"amount",required:!0,or:["plan","planCode"],types:["string","number"]},{value:"currency",required:!1,types:["string"]},{value:"email",required:!0,or:["customerCode"],types:["string"]},{value:"label",required:!1,types:["string"]},{value:"firstName",required:!1,types:["string"]},{value:"lastName",required:!1,types:["string"]},{value:"reference",required:!1,types:["string"]},{value:"phone",required:!1,types:["string"]},{value:"customerCode",required:!1,override:"email",types:["string"]},{value:"channels",required:!1,types:["array"]},{value:"paymentRequest",required:!1,types:["string","number"]},{value:"paymentPage",required:!1,types:["string"]},{value:"hash",required:!1,types:["string"]},{value:"container",required:!1,types:["string"]},{value:"metadata",required:!1,types:["object"]},{value:"subaccountCode",required:!1,types:["string"]},{value:"bearer",required:!1,types:["string"]},{value:"transactionCharge",required:!1,types:["string","number"]},{value:"planCode",required:!1,override:"amount",types:["string"]},{value:"subscriptionCount",required:!1,types:["number"]},{value:"planInterval",required:!1,types:["string"]},{value:"subscriptionLimit",required:!1,types:["number"]},{value:"subscriptionStartDate",required:!1,types:["string"]},{value:"accessCode",required:!1,types:["string"]},{value:"onError",required:!1,types:["function"]},{value:"onLoad",required:!1,types:["function"]},{value:"onSuccess",required:!1,types:["function"]},{value:"onCancel",required:!1,types:["function"]},{value:"callback",required:!1,types:["function"]},{value:"onClose",required:!1,types:["function"]},{value:"onBankTransferConfirmationPending",required:!1,types:["function"]},{value:"firstname",required:!1,types:["string"]},{value:"lastname",required:!1,types:["string"]},{value:"customer_code",required:!1,types:["string"]},{value:"payment_request",required:!1,types:["string","number"]},{value:"subaccount",required:!1,types:["string"]},{value:"transaction_charge",required:!1,types:["number","string"]},{value:"plan",required:!1,types:["string"]},{value:"quantity",required:!1,types:["number"]},{value:"interval",required:!1,types:["string"]},{value:"invoice_limit",required:!1,types:["number","string"]},{value:"start_date",required:!1,types:["string"]},{value:"payment_page",required:!1,types:["number","string"]},{value:"order_id",required:!1,types:["number"]},{value:"ref",required:!1,types:["string"]},{value:"card",required:!1,types:["string"]},{value:"bank",required:!1,types:["string"]},{value:"split",required:!1,types:["object"]},{value:"split_code",required:!1,types:["string"]},{value:"transaction_type",required:!1,types:["string"]},{value:"subscription",required:!1,types:["number"]},{value:"language",required:!1,types:["string"]},{value:"connect_account",required:!1,types:["string"]},{value:"connect_split",required:!1,types:["array"]}];function V(e){return(null==e?void 0:e.length)>500?e.split("?")[0]:e}function M(e){var t,n,a,r,i=o({},e);i.metadata=e.metadata||{},i.metadata.referrer=(t=window.location,n=t.href,a=void 0===n?"":n,r=t.ancestorOrigins,[a].concat(l(void 0===r?[]:r)).map(V).join(",")),i.metadata=JSON.stringify(i.metadata),i.mode="popup",e.split&&"string"!=typeof e.split&&(i.split=JSON.stringify(i.split));return void 0!==i.card&&["false",!1].indexOf(i.card)>-1&&(i.channels=["bank"],delete i.card),void 0!==i.bank&&["false",!1].indexOf(i.bank)>-1&&(i.channels=["card"],delete i.bank),[{to:"firstname",from:"firstName"},{to:"lastname",from:"lastName"},{to:"customer_code",from:"customerCode"},{to:"payment_request",from:"paymentRequest"},{to:"subaccount",from:"subaccountCode"},{to:"transaction_charge",from:"transactionCharge"},{to:"plan",from:"planCode"},{to:"quantity",from:"subscriptionCount"},{to:"interval",from:"planInterval"},{to:"invoice_limit",from:"subscriptionLimit"},{to:"start_date",from:"subscriptionStartDate"},{to:"ref",from:"reference"}].forEach(function(e){i[e.from]&&(i[e.to]=i[e.from],delete i[e.from])}),Object.values(e).forEach(function(t,n){if("function"==typeof t){var a=Object.keys(e)[n];delete i[a]}}),i}var L=["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"],U=window&&window.navigator&&(window.navigator.platform||window.navigator.userAgentData&&window.navigator.userAgentData.platform),N=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.platform,n=e.userAgent,a=void 0===n?window&&window.navigator&&window.navigator.userAgent:n,r=t||U;return L.includes(r)||a.includes("Mac")&&"ontouchend"in document},B=function(e,t,n){var a="".concat(f.paystackApiUrl,"transaction/update_log/").concat(e),r={Authorization:"Bearer ".concat(t)};return fetch(a,{method:"POST",body:JSON.stringify({payload:JSON.stringify(n)}),headers:r})},R=function(e,t){var n="".concat(f.paystackApiUrl,"transaction/set_ip/").concat(e),a={Authorization:"Bearer ".concat(t)};return fetch(n,{method:"POST",headers:a})},D={initializeLog:function(e){var t=e||{},n=t.attempts,a=t.authentication,r=t.errors,i=t.history;this.log={start_time:Math.round(Date.now()/1e3),time_spent:0,attempts:n||0,authentication:a,errors:r||0,success:!1,mobile:N(),input:[],history:i||[]}},getTimeSpent:function(){var e=Math.round(Date.now()/1e3);return this.log.time_spent=e-this.log.start_time,this.log.time_spent},logAPIResponse:function(e,t){switch(e.status){case"success":return this.logApiSuccess(t);case"failed":return this.logApiError(e.message);default:return!1}},logValidationResponse:function(e){return this.log.history.push({type:"action",message:e,time:this.getTimeSpent()}),this.saveLog()},logAttempt:function(e){var t="Attempted to pay";return e&&(t+=" with ".concat(e)),this.log.attempts+=1,this.log.history.push({type:"action",message:t,time:this.getTimeSpent()}),this.saveLog()},logApiError:function(e){var t="Error";return e&&(t+=": ".concat(e)),this.log.errors+=1,this.log.history.push({type:"error",message:t,time:this.getTimeSpent()}),this.saveLog()},logApiSuccess:function(e){var t="Successfully paid";return e&&(t+=" with ".concat(e)),this.log.success=!0,this.log.history.push({type:"success",message:t,time:this.getTimeSpent()}),this.saveLog()},saveLog:function(){try{if(this.response)return B(this.id,this.response.merchant_key,this.log)}catch(e){}},saveIpAddress:function(){try{if(this.response)return R(this.id,this.response.merchant_key)}catch(e){}}},F=["language","connect_account"],W={requestInline:function(){var e=this,t=this.urlParameters,n=t.language,a=t.connect_account,r=c(t,F),i=o({"Content-Type":"application/json"},n&&{"Accept-Language":n});return(this.accessCode?fetch(new URL("transaction/verify_access_code/".concat(this.accessCode),f.paystackApiUrl).toString(),{headers:i}):fetch(new URL("/checkout/request_inline",f.paystackApiUrl).toString(),{method:"POST",body:JSON.stringify(r),headers:o(o({},i),a&&{"x-connect-account":a})})).then(function(e){return e.json()}).then(function(t){if(!1===t.status)throw new Error(t.message);return e.response=t.data,e.id=t.data.id,e.status=t.data.transaction_status,e.accessCode=t.data.access_code,e.log=null,Object.assign(e,D),e.initializeLog(t.data.log),e.saveIpAddress(),t.data})}},J=function(){return a(function e(n){t(this,e),function(e){function t(e,t){this.message=e,this.issues=t||[]}if(!e||"object"!==p(e))throw new t("Transaction parameters should be a non-empty object");var n=e;if("accessCode"in n)return{accessCode:n.accessCode};Object.keys(n).forEach(function(e){void 0!==j.find(function(t){return t.value===e})||delete n[e]});var a=Object.keys(n),r=[];if(j.filter(function(e){return e.required}).forEach(function(e){var t=!n[e.value],a=e.or?e.or.some(function(e){return n[e]}):null;t&&!a&&r.push({message:"Required parameter missing: ".concat(e.value)})}),a.forEach(function(e){var t=n[e],a=j.find(function(t){return t.value===e}),i=p(t);"object"===i&&Array.isArray(t)&&(i="array"),a.types.indexOf(i)<=-1&&r.push({message:"Invalid parameter type: ".concat(e),validTypes:a.types})}),a.forEach(function(e){var t=j.find(function(t){return t.value===e});t.override&&delete n[t.override]}),r.length)throw new t("Invalid transaction parameters",r)}(n),this.parameters=n,this.urlParameters=M(n),this.id=null,this.status=null,this.accessCode=n.accessCode||null,this.authorizationUrl=null,this.errors=[],this.response=null,this.isActive=!0;var a=n.onError,r=n.onLoad,i=n.onSuccess,o=n.onCancel,c=n.callback,s=n.onClose,l=n.onBankTransferConfirmationPending;this.callbacks={onError:a,onLoad:r,onSuccess:i,onCancel:o,onBankTransferConfirmationPending:l},this.deprecatedCallbacks={callback:c,onClose:s},Object.assign(this,W)},[{key:"onSetupError",value:function(e){this.logError(e),this.callbacks.onError&&this.callbacks.onError(e)}},{key:"onLoad",value:function(e){var t=e.id,n=e.customer,a=e.accessCode;Object.assign(this,{id:t,customer:n,accessCode:a}),this.authorizationUrl="".concat(f.checkoutUrl).concat(a),this.callbacks.onLoad&&this.callbacks.onLoad({id:t,customer:n,accessCode:a})}},{key:"onSuccess",value:function(e){this.isActive=!1,this.response=e,this.status=e.status,this.callbacks.onSuccess&&this.callbacks.onSuccess(e),this.deprecatedCallbacks.callback&&this.deprecatedCallbacks.callback(e)}},{key:"setStatus",value:function(e){this.status=e}},{key:"onCancel",value:function(){this.callbacks.onCancel&&this.callbacks.onCancel(),this.deprecatedCallbacks.onClose&&this.deprecatedCallbacks.onClose()}},{key:"cancel",value:function(){this.isActive=!1,this.onCancel()}},{key:"onBankTransferConfirmationPending",value:function(){this.cancel(),this.callbacks.onBankTransferConfirmationPending&&this.callbacks.onBankTransferConfirmationPending()}},{key:"logError",value:function(e){this.errors.push(e)}}])}(),K=console?console.warn||console.log:function(){};function Q(e,t,n){K('"'.concat(e,'" has been deprecated, please use "').concat(t,'". ').concat(n||""))}var G,H=["preload","inlineTransaction","transactionData"],X=["container","styles","onElementsMount"];function Y(e,t){if(!e.length)return null;var n=e.filter(function(e){var n,a,r,i,o=!e.status||"abandoned"===e.status,c=(n=e.parameters,a=t,r=Object.keys(n).sort().join("")===Object.keys(a).sort().join(""),i=Object.values(n).sort().join("")===Object.values(a).sort().join(""),r&&i);return o&&c});return n.length?n[n.length-1]:null}function Z(e){var t=e.checkoutIframe,n=e.urlParameters;t&&n&&t.contentWindow.postMessage({type:"inline:url",path:"newTransaction",params:n},"*")}var $="trackPaymentError",ee="trackPaymentAttempt",te="trackPaymentCompletion";function ne(e){throw K(e),new Error(e)}var ae,re,ie=function(){function e(n){var a,r;t(this,e),this.id=function(){for(var e="",t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",n=0;n<5;n+=1)e+=t.charAt(Math.floor(62*Math.random()));return e}(),this.transactions=[],this.isOpen=!1,this.isLoaded=!1,this.isDeprecatedApi=n&&n.isDeprecatedApi,n&&n.isEmbed?this.isEmbed=!0:n&&n.isPaymentRequest&&(n.container&&I(n.container)||ne("A container is required to mount the payment request button"),this.paymentRequestContainer=I(n.container),this.paymentRequestTransaction=null),this.backgroundIframe=function(e){var t=T("inline-background-".concat(e));t.style.cssText="\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",t.style.colorScheme="light",document.body.appendChild(t);var n=t.contentWindow.document;return n.open(),n.write('\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'),n.close(),t}(this.id),this.checkoutIframe=(a=this.id,(r=T("inline-checkout-".concat(a))).src="".concat(f.checkoutUrl,"popup?precheckout=true"),r.style.cssText="\n z-index: 999999999999999;\n background: transparent;\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 visibility: hidden;\n display: none;\n height: 100%;\n",r.style.colorScheme="light",r.setAttribute("allowpaymentrequest","true"),r.setAttribute("allow","payment; clipboard-read; clipboard-write"),document.body.appendChild(r),r),this.registerListeners()}return a(e,[{key:"registerListeners",value:function(){var e=this;window.addEventListener("message",function(t){var n="".concat(t.origin,"/")===f.checkoutUrl,a=e.checkoutIframe&&e.checkoutIframe.contentWindow===t.source,r=e.isEmbed;n||a?e.respondToEvent(t):r&&e.respondToEmbedEvents(t)})}},{key:"sendAnalyticsEventToCheckout",value:function(e,t){this.checkoutIframe.contentWindow.postMessage({type:"analytics",action:e,params:t},"*")}},{key:"checkout",value:function(e){this.activeTransaction()&&this.activeTransaction().cancel(),G=this;var t=Y(this.transactions,e)||new J(e);return new Promise(function(e,n){t.requestInline().then(function(n){G.newTransaction({inlineTransaction:t,transactionData:n}),e(t)}).catch(function(e){t.onSetupError({status:!1,message:e.message}),n(e)})})}},{key:"newTransaction",value:function(e){var t=e.preload,n=e.inlineTransaction,a=e.transactionData,r=c(e,H),i=this.paymentRequestContainer&&_(this.paymentRequestContainer);if(this.activeTransaction()&&!i&&this.activeTransaction().cancel(),n&&a)return this.transactions.push(n),this.isDeprecatedApi||this.open({accessCode:a.access_code,language:n.urlParameters.language},t),n;var o=Y(this.transactions,n?n.parameters:r);if(o)return o.isActive=!0,this.isDeprecatedApi||this.open({accessCode:o.accessCode,language:o.urlParameters.language},t),o;var s=n||new J(r),l=s.accessCode?{accessCode:s.accessCode,language:s.urlParameters.language}:s.urlParameters;return this.transactions.push(s),this.isDeprecatedApi||this.open(l,t),s}},{key:"preloadTransaction",value:function(e){var t=this;this.newTransaction(o(o({},e),{},{preload:!0}));return function(){return t.animateCheckoutIn()}}},{key:"paymentRequest",value:function(e){var t=e.container,n=e.styles,a=e.onElementsMount,r=c(e,X);return G=this,new Promise(function(i,o){var c=document.querySelector("#".concat(e.loadPaystackCheckoutButton));if(q()){G.activeTransaction()&&G.activeTransaction().cancel(),t&&I(t)||ne("A container is required to mount the payment request button"),G.paymentRequestContainer=I(t);var s=Y(G.transactions,r),l=s||new J(r);l.requestInline().then(function(e){O(G.paymentRequestContainer,{channels:e.channels,styles:n},e.merchant_id).then(function(e){a&&a(e)}).catch(function(){a&&a(null)}).finally(function(){if(s?l.isActive=!0:G.transactions.push(l),G.registerPaymentRequestEventListeners(),c){var t=G.preloadTransaction({inlineTransaction:l,transactionData:e});c.onclick=t}i(l)})}).catch(function(e){l.onSetupError({status:!1,message:e.message}),o(e)})}else{if(e&&e.loadPaystackCheckoutButton)if(c){var u=G.preloadTransaction(r);c.onclick=u}else K("This device does not support any payment request wallet options. Please consult our documentation at https://developers.paystack.co/docs/paystack-inline to see how to load alternative payment options using 'loadPaystackCheckoutButton'");a&&a(null);var p=G.activeTransaction();i(p)}})}},{key:"registerApplePayEventListener",value:function(){var e=this;_(this.paymentRequestContainer).onclick=function(){return e.startApplePay()}}},{key:"registerPaymentRequestEventListeners",value:function(){var e=this.activeTransaction();e&&E(e.response.channels)?this.registerApplePayEventListener():z(this.paymentRequestContainer)}},{key:"startApplePay",value:function(){var e,t,n,a,r,i=this,c="apple pay",s=this.activeTransaction();if(s){var l={channel:"apple_pay",paymentMethod:c,currency:s.currency,amount:s.amount},u={channel:"apple_pay",currency:s.currency,amount:s.amount,timeSpent:s.getTimeSpent()};try{s.logAttempt(c),this.sendAnalyticsEventToCheckout(ee,l);var p=(e={currency:s.response.currency,amount:s.response.amount,merchantName:s.response.merchant_name,interval:s.response.plan_details&&s.response.plan_details.interval},t=e.currency,n=e.amount,a=e.merchantName,r=e.interval,o({countryCode:"NG",currencyCode:t,merchantCapabilities:["supports3DS","supportsCredit","supportsDebit"],supportedNetworks:["visa","masterCard"],requiredBillingContactFields:["postalAddress","name","phone","email"],total:{label:"".concat(a," - Paystack"),type:"final",amount:String(P(n))}},"string"==typeof r&&""!==r.trim()&&{lineItems:[{label:A(r),amount:String(P(n))}]})),d=new window.ApplePaySession(f.applePayVersion,p);d.onvalidatemerchant=function(e){var t=function(e){var t=e.transactionId,n=e.validationURL,a=e.merchantName,r=e.domainName,i=void 0===r?window&&window.location&&window.location.hostname:r,c="".concat(f.paymentBaseUrl).concat(f.applePayValidateSessionPath),s=x({transaction:t,sessionUrl:n,displayName:a,domainName:i});return fetch(c,o(o({},S),{},{body:s})).then(function(e){return e.json()})}({validationURL:e.validationURL,transactionId:s.id,merchantName:s.response.merchant_name});t.then(function(e){"success"!==e.status?s.onSetupError(e):d.completeMerchantValidation(e.data),s.logValidationResponse(e.message)}).catch(function(e){s.onSetupError(e)})},d.oncancel=function(){s.onCancel()},d.onpaymentauthorized=function(e){var t=e.payment,n=function(e){var t=e.transactionId,n=e.payment,a="".concat(f.paymentBaseUrl).concat(f.applePayChargePath),r=x({transaction:t,paymentObject:JSON.stringify(n)});return fetch(a,o(o({},S),{},{body:r})).then(function(e){return e.json()})}({transactionId:s.id,payment:t});n.then(function(e){s.logAPIResponse(e,c),"success"===e.status?(d.completePayment(d.STATUS_SUCCESS),s.onSuccess(e),i.sendAnalyticsEventToCheckout(te,u)):(d.completePayment(d.STATUS_FAILURE),s.onSetupError(e),i.sendAnalyticsEventToCheckout($,{channel:"apple_pay",message:e&&e.message||"Transaction attempt failed"}))}).catch(function(e){d.completePayment(d.STATUS_FAILURE),s.onSetupError(e),i.sendAnalyticsEventToCheckout($,{channel:"apple_pay",message:e&&e.message||"Error occurred"})})},d.begin()}catch(e){s.onSetupError(e)}}else ne("Could not initiate apple pay transaction")}},{key:"resumeTransaction",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.onSuccess,a=t.onCancel,r=t.onLoad,i=t.onError;return this.newTransaction({accessCode:e,onSuccess:n,onCancel:a,onLoad:r,onError:i})}},{key:"activeTransaction",value:function(){var e=this.transactions.filter(function(e){return e.isActive}),t=e.length?e[e.length-1]:null;return t}},{key:"cancelTransaction",value:function(e){var t=this.transactions.find(function(t){return t.id===e})||this.activeTransaction();t&&(t.cancel(),this.close())}},{key:"respondToEvent",value:function(e){if(e){var t,n,a=this.activeTransaction();try{var r=e.data||e.message,i=r.event,o=r.data;if(i)switch(i){case"loaded:checkout":if(this.isLoaded=!0,a){var c=this.checkoutIframe,s=a.urlParameters,l=a.response;Z({checkoutIframe:c,urlParameters:l?{accessCode:l.access_code,language:null==s?void 0:s.language}:s})}break;case"loaded:transaction":t=this.backgroundIframe,(n=t.contentWindow.document)&&(n.getElementById("app-loader").style.display="none"),a.onLoad(o);break;case"error":"setup"===o.type?a.onSetupError(o):a.logError(o);break;case"cancel":case"close":this.close();var u=o&&o.status;u&&a.setStatus(u),this.paymentRequestContainer&&_(this.paymentRequestContainer)||(a.isActive=!1),a.onCancel();break;case"transfer:pending":this.close();var p=o&&o.status;p&&a.setStatus(p),a.onBankTransferConfirmationPending();break;case"success":this.close(),a.onSuccess(o)}}catch(e){}}}},{key:"respondToEmbedEvents",value:function(e){var t,n,a=this.activeTransaction(),r=e.data||e.message;if(r&&("string"==typeof r||r instanceof String)){var i={action:n=(t=r)&&"string"==typeof t?t.split(" ")[0]:null,data:n?t.split(" ").slice(2).join(" "):null};if(i&&"PaystackClose"===i.action)i.data&&a.onSuccess(r);"PaystackTLSClose"===i.action&&a.cancel()}}},{key:"animateCheckoutIn",value:function(){var e,t=this;if(!this.isOpen){var n=this.checkoutIframe,a=this.backgroundIframe;(e={checkoutIframe:n,backgroundIframe:a},new Promise(function(t,n){e||n("No dom element provided");var a=e.checkoutIframe,r=e.backgroundIframe;a&&r||n("No dom element provided"),a.style.display="",a.style.visibility="visible",r.style.display="",r.style.visibility="visible",t()})).then(function(){t.checkoutIframe.contentWindow.postMessage("render","*")}),this.isOpen=!0}}},{key:"open",value:function(e,t){e&&(Z({checkoutIframe:this.checkoutIframe,urlParameters:e}),t||this.animateCheckoutIn())}},{key:"close",value:function(){var e=this;if(this.isOpen){var t,n=this.checkoutIframe,a=this.backgroundIframe;(t={checkoutIframe:n,backgroundIframe:a},new Promise(function(e,n){t||n("No dom element provided");var a=t.checkoutIframe,r=t.backgroundIframe;a&&r||n("No dom element provided"),r.style.opacity=0,a.style.display="none",a.style.visibility="hidden",setTimeout(function(){r.style.display="none",r.style.visibility="hidden",r.style.opacity=1,e()},300)})).then(function(){e.checkoutIframe.contentWindow.postMessage("close","*")}),this.isOpen=!1}}},{key:"isLoaded",value:function(){return this.isLoaded}}],[{key:"setup",value:function(t){var n=t&&t.container;G||(G=new e({isDeprecatedApi:!0,isEmbed:n})),Q("PaystackPop.setup()","new PaystackPop()","Please consult our documentation at https://developers.paystack.co/docs/paystack-inline");var a=G.newTransaction(t,"deprecated"),r=a.urlParameters;if(n){var i="".concat(f.siteUrl,"/assets/payment/production/inline.html?").concat(g(r)),o=function(e,t){var n=T("embed-checkout-".concat(e));return n.style.cssText="\n background: transparent;\n background: rgba(0,0,0,0);\n border: 0px none transparent;\n overflow-x: hidden;\n overflow-y: hidden;\n nmargin: 0;\n padding: 0;\n -webkit-tap-highlight-color: transparent;\n -webkit-touch-callout: none;\n left: 0;\n top: 0;\n width: 100%;\n height: 100%;\n visibility: hidden;\n display: none;\n",n.src=t,n.id=e,n.name=e,n.setAttribute("allowpaymentrequest","true"),n.setAttribute("allow","payment; clipboard-read; clipboard-write"),n}(G.id,i);!function(e,t){var n=document.getElementById(e);n.innerHTML="",n.removeAttribute("style"),n.className="paystack-embed-container",n.style.position="relative",n.style.width="100%",n.appendChild(t)}(t.container,o),o.onload=function(){var e;o.contentWindow.postMessage("PaystackOpen ".concat(G.id),"*"),e=o,new Promise(function(t,n){e||n("No dom element provided"),e.style.display="",e.style.visibility="visible",t()})}}else a.openIframe=function(){Q("openIframe","open","Please consult our documentation at https://developers.paystack.co/docs/paystack-inline"),G.open(r)};return a}}])}();if(ae=k().length>0,re=b()&&"FORM"===b().parentElement.tagName,ae&&re){var oe,ce=function(){var e={},t=b();return k().forEach(function(n){var a=t.getAttribute(n),r=n.split("data-")[1].replace(/-([a-z])/g,function(e){return e[1].toUpperCase()});e[r]=a}),function(e){if(e.buttonId&&!document.getElementById(e.buttonId))throw new Error("Please make sure the buttonId is an element available in the DOM");var t=o({},e);t.buttonText=e.buttonText||"Pay",t.buttonVariant="normal",t.buttonWordmarkVariant="normal";var n=["normal","light"];return e.buttonVariant&&n.indexOf(e.buttonVariant)>-1&&(t.buttonVariant=e.buttonVariant),e.buttonWordmarkVariant&&n.indexOf(e.buttonWordmarkVariant)>-1&&(t.buttonWordmarkVariant=e.buttonWordmarkVariant),t}(e)}(),se=b().parentElement;G||(G=new ie),function(e){var t;if(e.id)(t=document.getElementById(e.id)).setAttribute("data-inline-id",e.id);else{var n=document.createElement("div");n.id="inline-button-".concat(e.inlineId),n.innerHTML=function(e){var t,n,a={normal:'\n <svg id="inline-button-wordmark" width="137" height="13" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path d="M.037 5.095l1.075-.135c-.011-.774-.025-1.944-.013-2.149C1.19 1.364 2.38.134 3.81.013 3.9.006 3.99.002 4.077 0a2.947 2.947 0 0 1 2.046.76c.574.509.95 1.26 1.008 2.007.015.192.01 1.491.01 2.257l1.096.163L8.2 11.44 4.093 12 0 11.346l.037-6.251zm4.106-.514l1.724.256c-.007-.933-.05-2.295-.26-2.654-.319-.545-.846-.867-1.443-.88h-.063c-.607.008-1.138.322-1.458.864-.222.378-.266 1.66-.265 2.637l1.765-.223zM18.228 10.108c-.576 0-1.064-.072-1.464-.216a2.864 2.864 0 0 1-.972-.6 2.552 2.552 0 0 1-.588-.864 4.067 4.067 0 0 1-.252-1.044h1.008c.032.256.088.5.168.732.08.224.204.424.372.6.168.168.388.304.66.408.28.096.636.144 1.068.144.28 0 .536-.036.768-.108.24-.08.448-.192.624-.336.176-.144.312-.316.408-.516.104-.2.156-.42.156-.66 0-.24-.032-.448-.096-.624a1.02 1.02 0 0 0-.336-.468 1.885 1.885 0 0 0-.636-.324 6.4 6.4 0 0 0-1.008-.228 8.79 8.79 0 0 1-1.212-.276 3.246 3.246 0 0 1-.9-.432 1.982 1.982 0 0 1-.564-.672c-.128-.272-.192-.6-.192-.984 0-.328.068-.632.204-.912.136-.288.324-.536.564-.744.248-.208.54-.372.876-.492.336-.12.708-.18 1.116-.18.864 0 1.548.204 2.052.612.512.4.812.984.9 1.752h-.936c-.104-.544-.316-.932-.636-1.164-.32-.24-.78-.36-1.38-.36-.592 0-1.04.132-1.344.396a1.255 1.255 0 0 0-.444.996c0 .208.024.396.072.564.056.16.156.3.3.42.152.12.36.228.624.324a6.72 6.72 0 0 0 1.068.228c.48.072.9.168 1.26.288.36.12.664.276.912.468s.432.428.552.708c.128.28.192.624.192 1.032 0 .36-.076.696-.228 1.008a2.472 2.472 0 0 1-.612.804c-.264.224-.58.4-.948.528-.36.128-.752.192-1.176.192zM25.355 10.108c-.44 0-.848-.076-1.224-.228a2.916 2.916 0 0 1-.96-.636 2.966 2.966 0 0 1-.636-1.008 3.77 3.77 0 0 1-.216-1.308v-.096c0-.472.072-.904.216-1.296.144-.4.344-.74.6-1.02.264-.288.576-.508.936-.66.36-.16.756-.24 1.188-.24.36 0 .708.06 1.044.18.344.112.648.292.912.54.264.248.472.572.624.972.16.392.24.868.24 1.428v.324h-4.728c.024.72.204 1.272.54 1.656.336.376.828.564 1.476.564.984 0 1.54-.364 1.668-1.092h.996c-.112.632-.408 1.112-.888 1.44-.48.32-1.076.48-1.788.48zm1.704-3.852c-.048-.648-.232-1.112-.552-1.392-.312-.28-.728-.42-1.248-.42-.512 0-.932.164-1.26.492-.32.32-.524.76-.612 1.32h3.672zM32.091 10.108c-.44 0-.848-.072-1.224-.216a3.054 3.054 0 0 1-.972-.636 3.12 3.12 0 0 1-.648-1.008 3.626 3.626 0 0 1-.228-1.32v-.096c0-.48.08-.916.24-1.308.16-.4.376-.74.648-1.02.28-.28.604-.496.972-.648.376-.16.772-.24 1.188-.24.328 0 .644.04.948.12.312.08.588.208.828.384.248.168.456.392.624.672.168.28.276.62.324 1.02h-.984c-.08-.496-.284-.848-.612-1.056-.32-.208-.696-.312-1.128-.312a1.93 1.93 0 0 0-.804.168c-.24.112-.452.272-.636.48a2.23 2.23 0 0 0-.42.744 2.991 2.991 0 0 0-.156.996v.096c0 .776.188 1.364.564 1.764.384.392.88.588 1.488.588.224 0 .436-.032.636-.096a1.651 1.651 0 0 0 .96-.768c.112-.192.18-.416.204-.672h.924a2.595 2.595 0 0 1-.276.948 2.386 2.386 0 0 1-.576.744c-.24.208-.52.372-.84.492-.32.12-.668.18-1.044.18zM38.335 10.108a2.83 2.83 0 0 1-.876-.132 1.724 1.724 0 0 1-.684-.42 2.145 2.145 0 0 1-.456-.756c-.112-.304-.168-.672-.168-1.104V3.724h.996v3.924c0 .552.116.956.348 1.212.24.256.608.384 1.104.384.224 0 .44-.036.648-.108.208-.072.392-.18.552-.324.16-.144.288-.324.384-.54.096-.216.144-.464.144-.744V3.724h.996V10h-.996v-.996c-.144.296-.388.556-.732.78-.336.216-.756.324-1.26.324zM43.216 3.724h.996v1.128c.2-.352.452-.64.756-.864.312-.232.748-.356 1.308-.372v.936a4.461 4.461 0 0 0-.852.12 1.647 1.647 0 0 0-.66.324 1.472 1.472 0 0 0-.408.612c-.096.248-.144.564-.144.948V10h-.996V3.724zM50 10.108c-.44 0-.848-.076-1.224-.228a2.916 2.916 0 0 1-.96-.636 2.966 2.966 0 0 1-.636-1.008 3.77 3.77 0 0 1-.216-1.308v-.096c0-.472.072-.904.216-1.296.144-.4.344-.74.6-1.02.264-.288.576-.508.936-.66.36-.16.756-.24 1.188-.24.36 0 .708.06 1.044.18.344.112.648.292.912.54.264.248.472.572.624.972.16.392.24.868.24 1.428v.324h-4.728c.024.72.204 1.272.54 1.656.336.376.828.564 1.476.564.984 0 1.54-.364 1.668-1.092h.996c-.112.632-.408 1.112-.888 1.44-.48.32-1.076.48-1.788.48zm1.704-3.852c-.048-.648-.232-1.112-.552-1.392-.312-.28-.728-.42-1.248-.42-.512 0-.932.164-1.26.492-.32.32-.524.76-.612 1.32h3.672zM56.496 10.108c-.408 0-.788-.068-1.14-.204a2.683 2.683 0 0 1-.9-.612 3.01 3.01 0 0 1-.588-.984 4.01 4.01 0 0 1-.204-1.32v-.096c0-.48.072-.92.216-1.32.144-.4.344-.744.6-1.032.256-.296.564-.524.924-.684.36-.16.756-.24 1.188-.24.528 0 .956.112 1.284.336.328.216.584.476.768.78V.724h.996V10h-.996V8.92c-.088.152-.208.3-.36.444a2.792 2.792 0 0 1-.516.384 2.874 2.874 0 0 1-.6.252c-.216.072-.44.108-.672.108zm.108-.828c.288 0 .56-.048.816-.144.256-.096.476-.24.66-.432.184-.2.328-.448.432-.744.112-.304.168-.656.168-1.056v-.096c0-.808-.18-1.404-.54-1.788-.352-.384-.836-.576-1.452-.576-.624 0-1.112.208-1.464.624-.352.416-.528 1.008-.528 1.776v.096c0 .392.048.736.144 1.032.104.296.24.54.408.732.176.192.38.336.612.432.232.096.48.144.744.144zM67.712 10.108c-.512 0-.948-.112-1.308-.336a2.38 2.38 0 0 1-.816-.804V10h-.996V.724h.996V4.78a1.92 1.92 0 0 1 .348-.432c.152-.144.32-.268.504-.372.192-.112.396-.2.612-.264.216-.064.436-.096.66-.096.408 0 .788.072 1.14.216.352.144.652.352.9.624.256.272.456.604.6.996.144.392.216.832.216 1.32v.096c0 .48-.068.92-.204 1.32a3.103 3.103 0 0 1-.576 1.02 2.583 2.583 0 0 1-.9.672 2.937 2.937 0 0 1-1.176.228zm-.096-.828c.624 0 1.1-.2 1.428-.6.328-.408.492-.996.492-1.764V6.82c0-.4-.052-.748-.156-1.044a2.095 2.095 0 0 0-.42-.732 1.53 1.53 0 0 0-.612-.444 1.798 1.798 0 0 0-.744-.156c-.288 0-.56.048-.816.144a1.71 1.71 0 0 0-.648.444c-.184.192-.328.44-.432.744a3.152 3.152 0 0 0-.156 1.044v.096c0 .8.192 1.396.576 1.788.384.384.88.576 1.488.576zM73.63 9.352l-2.46-5.628h1.068l1.92 4.5 1.74-4.5h1.02l-3.468 8.46h-1.008l1.188-2.832zM87.127 3.669A3.138 3.138 0 0 0 86.1 2.95a3.09 3.09 0 0 0-1.228-.25c-.448 0-.848.086-1.187.26a2.199 2.199 0 0 0-.662.497v-.191a.387.387 0 0 0-.214-.348.323.323 0 0 0-.14-.03h-1.315a.314.314 0 0 0-.254.116.377.377 0 0 0-.1.262v8.97c0 .1.034.188.1.258a.34.34 0 0 0 .254.103h1.341a.342.342 0 0 0 .244-.103.336.336 0 0 0 .11-.259v-3.06c.178.202.417.357.702.464.35.134.72.203 1.093.203.43 0 .848-.082 1.242-.248a3.124 3.124 0 0 0 1.04-.724c.305-.326.545-.709.707-1.128a3.93 3.93 0 0 0 .263-1.477c0-.54-.086-1.037-.263-1.477a3.387 3.387 0 0 0-.706-1.12zm-1.204 3.24c-.073.19-.18.362-.315.51a1.415 1.415 0 0 1-1.065.466c-.2.001-.4-.04-.584-.12a1.484 1.484 0 0 1-.49-.346 1.593 1.593 0 0 1-.32-.51 1.738 1.738 0 0 1-.115-.63c0-.224.04-.435.115-.631a1.532 1.532 0 0 1 .804-.846c.185-.086.386-.13.59-.129.215 0 .414.044.593.13.177.083.338.199.474.341a1.622 1.622 0 0 1 .425 1.135c0 .225-.037.436-.112.63zM95.298 2.89h-1.33a.339.339 0 0 0-.246.11.384.384 0 0 0-.108.266v.166a1.856 1.856 0 0 0-.602-.472 2.525 2.525 0 0 0-1.166-.258 3.227 3.227 0 0 0-2.284.964 3.554 3.554 0 0 0-.734 1.123 3.827 3.827 0 0 0-.275 1.477c0 .54.092 1.037.275 1.477.184.434.427.817.728 1.128a3.146 3.146 0 0 0 2.277.973c.437 0 .834-.088 1.173-.259.25-.13.456-.287.608-.471v.177a.34.34 0 0 0 .11.259.341.341 0 0 0 .244.104h1.33a.324.324 0 0 0 .25-.105.349.349 0 0 0 .102-.258V3.267a.377.377 0 0 0-.1-.262.325.325 0 0 0-.252-.115zM93.502 6.9a1.55 1.55 0 0 1-.312.511c-.136.143-.296.26-.473.344-.178.085-.38.129-.596.129-.207 0-.407-.044-.59-.13a1.501 1.501 0 0 1-.791-.855 1.766 1.766 0 0 1-.112-.62c0-.225.038-.436.112-.632.075-.193.181-.364.314-.504.137-.143.3-.26.478-.342.182-.085.382-.129.59-.129.215 0 .417.044.595.13.178.085.338.2.473.341a1.623 1.623 0 0 1 .424 1.135c0 .215-.037.424-.112.622zM108.567 6.094a2.265 2.265 0 0 0-.654-.402c-.247-.101-.509-.181-.785-.235l-1.014-.204c-.26-.05-.441-.117-.543-.203a.328.328 0 0 1-.136-.264c0-.11.063-.2.189-.282.137-.086.329-.13.566-.13.26 0 .518.053.757.157.243.106.471.226.67.36.295.187.546.162.727-.053l.487-.57a.543.543 0 0 0 .152-.357c0-.128-.064-.245-.185-.351-.207-.184-.533-.378-.971-.568-.437-.192-.987-.29-1.637-.29-.427 0-.82.058-1.168.172-.35.116-.65.276-.893.474-.245.204-.438.44-.57.713a2 2 0 0 0-.198.875c0 .56.167 1.017.496 1.358.328.333.766.56 1.304.67l1.054.232c.3.062.528.132.675.21.129.067.19.163.19.297 0 .12-.061.227-.188.324-.133.104-.342.155-.622.155a1.83 1.83 0 0 1-.831-.19 3.056 3.056 0 0 1-.678-.458.995.995 0 0 0-.307-.17c-.126-.037-.268.003-.431.13l-.583.461c-.169.145-.24.32-.209.522.029.194.19.394.491.62.269.193.614.368 1.029.518.415.151.901.229 1.453.229.444 0 .854-.058 1.215-.172.362-.119.681-.278.941-.48a2.056 2.056 0 0 0 .819-1.663c0-.319-.053-.6-.165-.836a1.843 1.843 0 0 0-.447-.6zM114.383 7.73a.363.363 0 0 0-.295-.192.55.55 0 0 0-.343.113c-.095.062-.198.11-.306.141a.75.75 0 0 1-.426.013.43.43 0 0 1-.181-.093.554.554 0 0 1-.143-.204.92.92 0 0 1-.059-.362v-2.46h1.731c.099 0 .188-.04.266-.117a.368.368 0 0 0 .112-.26V3.268a.369.369 0 0 0-.115-.268.38.38 0 0 0-.263-.109h-1.732V1.216a.354.354 0 0 0-.108-.27.347.347 0 0 0-.243-.104h-1.344a.36.36 0 0 0-.34.226.371.371 0 0 0-.027.148V2.89h-.767a.324.324 0 0 0-.255.115.385.385 0 0 0-.098.262V4.31a.4.4 0 0 0 .212.346c.044.021.092.032.14.03h.768v2.925c0 .39.069.726.2 1.003.132.274.305.504.514.676.217.178.465.31.731.388.27.084.551.126.833.126.385 0 .75-.061 1.094-.18a2.13 2.13 0 0 0 .861-.552c.152-.181.17-.381.046-.581l-.463-.76zM121.672 2.89h-1.329a.339.339 0 0 0-.244.11.39.39 0 0 0-.08.122.394.394 0 0 0-.027.144v.166a1.906 1.906 0 0 0-.605-.472c-.335-.173-.726-.258-1.168-.258-.42 0-.834.083-1.226.249a3.24 3.24 0 0 0-1.055.715 3.528 3.528 0 0 0-.734 1.123 3.79 3.79 0 0 0-.276 1.477c0 .54.092 1.037.275 1.477.184.434.428.817.729 1.128a3.138 3.138 0 0 0 2.273.973 2.59 2.59 0 0 0 1.175-.259c.255-.13.457-.287.612-.471v.177a.34.34 0 0 0 .108.259.343.343 0 0 0 .243.104h1.329a.335.335 0 0 0 .252-.105.364.364 0 0 0 .102-.258V3.267a.38.38 0 0 0-.1-.262.332.332 0 0 0-.115-.087.311.311 0 0 0-.139-.028zM119.876 6.9a1.534 1.534 0 0 1-.786.855 1.362 1.362 0 0 1-.594.129c-.207 0-.405-.044-.588-.13a1.516 1.516 0 0 1-.792-.855 1.757 1.757 0 0 1-.113-.62c0-.225.037-.436.112-.632.073-.187.179-.358.314-.504.138-.143.3-.26.479-.342.184-.086.385-.13.588-.129.217 0 .415.044.594.13.181.085.34.2.472.341.134.143.24.313.314.504a1.73 1.73 0 0 1 0 1.253zM128.978 7.64l-.763-.593c-.146-.118-.284-.15-.404-.1a.742.742 0 0 0-.279.205 2.527 2.527 0 0 1-.583.535c-.192.122-.444.183-.742.183-.219 0-.42-.04-.6-.122a1.423 1.423 0 0 1-.469-.342 1.575 1.575 0 0 1-.308-.51 1.751 1.751 0 0 1-.106-.617c0-.228.034-.438.106-.632.07-.192.173-.363.308-.503.135-.144.295-.26.472-.342.187-.088.391-.132.597-.13.298 0 .547.064.742.187.198.126.396.306.584.534.078.092.17.16.278.206.122.048.259.016.401-.101l.762-.594a.53.53 0 0 0 .201-.269.437.437 0 0 0-.034-.365 3.329 3.329 0 0 0-1.18-1.127c-.504-.291-1.108-.441-1.784-.441a3.519 3.519 0 0 0-2.51 1.033c-.322.322-.576.71-.747 1.137a3.68 3.68 0 0 0-.273 1.407c0 .495.093.968.273 1.402.173.424.427.808.747 1.128a3.527 3.527 0 0 0 2.51 1.034c.676 0 1.28-.149 1.784-.444a3.286 3.286 0 0 0 1.182-1.13.411.411 0 0 0 .055-.173.415.415 0 0 0-.023-.182.624.624 0 0 0-.197-.273zM136.06 9.045l-2.104-3.143 1.801-2.415c.094-.139.119-.272.075-.397-.031-.09-.116-.2-.334-.2h-1.425a.52.52 0 0 0-.234.058.482.482 0 0 0-.209.205L132.191 5.2h-.349V.363a.37.37 0 0 0-.099-.26.352.352 0 0 0-.253-.103h-1.332a.37.37 0 0 0-.337.22.346.346 0 0 0-.027.143V9.29c0 .103.038.193.11.259a.353.353 0 0 0 .254.104h1.333a.328.328 0 0 0 .251-.105.346.346 0 0 0 .075-.119.333.333 0 0 0 .024-.14V6.927h.386l1.571 2.446c.112.187.267.281.46.281h1.491c.226 0 .32-.11.358-.202.054-.13.038-.262-.047-.406zM102.863 2.89h-1.489a.389.389 0 0 0-.298.122.544.544 0 0 0-.13.249l-1.099 4.167h-.268l-1.182-4.167a.66.66 0 0 0-.113-.247.329.329 0 0 0-.264-.124h-1.544c-.199 0-.325.066-.372.193a.588.588 0 0 0-.002.37l1.887 5.865c.03.093.08.17.145.232a.388.388 0 0 0 .281.104h.798l-.066.19-.19.547a.872.872 0 0 1-.29.426.7.7 0 0 1-.442.148.956.956 0 0 1-.4-.09 1.842 1.842 0 0 1-.35-.209.62.62 0 0 0-.335-.115h-.016c-.13 0-.243.074-.334.216l-.474.708c-.193.304-.086.504.039.615.234.224.528.399.875.524.344.125.723.186 1.126.186.682 0 1.252-.187 1.689-.565.435-.376.756-.887.952-1.524l2.188-7.258c.05-.155.05-.284.005-.389-.037-.08-.125-.174-.327-.174z" fill="#011B33"/>\n </svg>',light:'\n <svg id="inline-button-wordmark--white" width="137" height="13" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path d="M.037 5.095l1.075-.135c-.011-.774-.025-1.944-.013-2.149C1.19 1.364 2.38.134 3.81.013 3.9.006 3.99.002 4.077 0a2.947 2.947 0 0 1 2.046.76c.574.509.95 1.26 1.008 2.007.015.192.01 1.491.01 2.257l1.096.163L8.2 11.44 4.093 12 0 11.346l.037-6.251zm4.106-.514l1.724.256c-.007-.933-.05-2.295-.26-2.654-.319-.545-.846-.867-1.443-.88h-.063c-.607.008-1.138.322-1.458.864-.222.378-.266 1.66-.265 2.637l1.765-.223zM18.228 10.108c-.576 0-1.064-.072-1.464-.216a2.864 2.864 0 0 1-.972-.6 2.552 2.552 0 0 1-.588-.864 4.067 4.067 0 0 1-.252-1.044h1.008c.032.256.088.5.168.732.08.224.204.424.372.6.168.168.388.304.66.408.28.096.636.144 1.068.144.28 0 .536-.036.768-.108.24-.08.448-.192.624-.336.176-.144.312-.316.408-.516.104-.2.156-.42.156-.66 0-.24-.032-.448-.096-.624a1.02 1.02 0 0 0-.336-.468 1.885 1.885 0 0 0-.636-.324 6.4 6.4 0 0 0-1.008-.228 8.79 8.79 0 0 1-1.212-.276 3.246 3.246 0 0 1-.9-.432 1.982 1.982 0 0 1-.564-.672c-.128-.272-.192-.6-.192-.984 0-.328.068-.632.204-.912.136-.288.324-.536.564-.744.248-.208.54-.372.876-.492.336-.12.708-.18 1.116-.18.864 0 1.548.204 2.052.612.512.4.812.984.9 1.752h-.936c-.104-.544-.316-.932-.636-1.164-.32-.24-.78-.36-1.38-.36-.592 0-1.04.132-1.344.396a1.255 1.255 0 0 0-.444.996c0 .208.024.396.072.564.056.16.156.3.3.42.152.12.36.228.624.324a6.72 6.72 0 0 0 1.068.228c.48.072.9.168 1.26.288.36.12.664.276.912.468s.432.428.552.708c.128.28.192.624.192 1.032 0 .36-.076.696-.228 1.008a2.472 2.472 0 0 1-.612.804c-.264.224-.58.4-.948.528-.36.128-.752.192-1.176.192zM25.355 10.108c-.44 0-.848-.076-1.224-.228a2.916 2.916 0 0 1-.96-.636 2.966 2.966 0 0 1-.636-1.008 3.77 3.77 0 0 1-.216-1.308v-.096c0-.472.072-.904.216-1.296.144-.4.344-.74.6-1.02.264-.288.576-.508.936-.66.36-.16.756-.24 1.188-.24.36 0 .708.06 1.044.18.344.112.648.292.912.54.264.248.472.572.624.972.16.392.24.868.24 1.428v.324h-4.728c.024.72.204 1.272.54 1.656.336.376.828.564 1.476.564.984 0 1.54-.364 1.668-1.092h.996c-.112.632-.408 1.112-.888 1.44-.48.32-1.076.48-1.788.48zm1.704-3.852c-.048-.648-.232-1.112-.552-1.392-.312-.28-.728-.42-1.248-.42-.512 0-.932.164-1.26.492-.32.32-.524.76-.612 1.32h3.672zM32.091 10.108c-.44 0-.848-.072-1.224-.216a3.054 3.054 0 0 1-.972-.636 3.12 3.12 0 0 1-.648-1.008 3.626 3.626 0 0 1-.228-1.32v-.096c0-.48.08-.916.24-1.308.16-.4.376-.74.648-1.02.28-.28.604-.496.972-.648.376-.16.772-.24 1.188-.24.328 0 .644.04.948.12.312.08.588.208.828.384.248.168.456.392.624.672.168.28.276.62.324 1.02h-.984c-.08-.496-.284-.848-.612-1.056-.32-.208-.696-.312-1.128-.312a1.93 1.93 0 0 0-.804.168c-.24.112-.452.272-.636.48a2.23 2.23 0 0 0-.42.744 2.991 2.991 0 0 0-.156.996v.096c0 .776.188 1.364.564 1.764.384.392.88.588 1.488.588.224 0 .436-.032.636-.096a1.651 1.651 0 0 0 .96-.768c.112-.192.18-.416.204-.672h.924a2.595 2.595 0 0 1-.276.948 2.386 2.386 0 0 1-.576.744c-.24.208-.52.372-.84.492-.32.12-.668.18-1.044.18zM38.335 10.108a2.83 2.83 0 0 1-.876-.132 1.724 1.724 0 0 1-.684-.42 2.145 2.145 0 0 1-.456-.756c-.112-.304-.168-.672-.168-1.104V3.724h.996v3.924c0 .552.116.956.348 1.212.24.256.608.384 1.104.384.224 0 .44-.036.648-.108.208-.072.392-.18.552-.324.16-.144.288-.324.384-.54.096-.216.144-.464.144-.744V3.724h.996V10h-.996v-.996c-.144.296-.388.556-.732.78-.336.216-.756.324-1.26.324zM43.216 3.724h.996v1.128c.2-.352.452-.64.756-.864.312-.232.748-.356 1.308-.372v.936a4.461 4.461 0 0 0-.852.12 1.647 1.647 0 0 0-.66.324 1.472 1.472 0 0 0-.408.612c-.096.248-.144.564-.144.948V10h-.996V3.724zM50 10.108c-.44 0-.848-.076-1.224-.228a2.916 2.916 0 0 1-.96-.636 2.966 2.966 0 0 1-.636-1.008 3.77 3.77 0 0 1-.216-1.308v-.096c0-.472.072-.904.216-1.296.144-.4.344-.74.6-1.02.264-.288.576-.508.936-.66.36-.16.756-.24 1.188-.24.36 0 .708.06 1.044.18.344.112.648.292.912.54.264.248.472.572.624.972.16.392.24.868.24 1.428v.324h-4.728c.024.72.204 1.272.54 1.656.336.376.828.564 1.476.564.984 0 1.54-.364 1.668-1.092h.996c-.112.632-.408 1.112-.888 1.44-.48.32-1.076.48-1.788.48zm1.704-3.852c-.048-.648-.232-1.112-.552-1.392-.312-.28-.728-.42-1.248-.42-.512 0-.932.164-1.26.492-.32.32-.524.76-.612 1.32h3.672zM56.496 10.108c-.408 0-.788-.068-1.14-.204a2.683 2.683 0 0 1-.9-.612 3.01 3.01 0 0 1-.588-.984 4.01 4.01 0 0 1-.204-1.32v-.096c0-.48.072-.92.216-1.32.144-.4.344-.744.6-1.032.256-.296.564-.524.924-.684.36-.16.756-.24 1.188-.24.528 0 .956.112 1.284.336.328.216.584.476.768.78V.724h.996V10h-.996V8.92c-.088.152-.208.3-.36.444a2.792 2.792 0 0 1-.516.384 2.874 2.874 0 0 1-.6.252c-.216.072-.44.108-.672.108zm.108-.828c.288 0 .56-.048.816-.144.256-.096.476-.24.66-.432.184-.2.328-.448.432-.744.112-.304.168-.656.168-1.056v-.096c0-.808-.18-1.404-.54-1.788-.352-.384-.836-.576-1.452-.576-.624 0-1.112.208-1.464.624-.352.416-.528 1.008-.528 1.776v.096c0 .392.048.736.144 1.032.104.296.24.54.408.732.176.192.38.336.612.432.232.096.48.144.744.144zM67.712 10.108c-.512 0-.948-.112-1.308-.336a2.38 2.38 0 0 1-.816-.804V10h-.996V.724h.996V4.78a1.92 1.92 0 0 1 .348-.432c.152-.144.32-.268.504-.372.192-.112.396-.2.612-.264.216-.064.436-.096.66-.096.408 0 .788.072 1.14.216.352.144.652.352.9.624.256.272.456.604.6.996.144.392.216.832.216 1.32v.096c0 .48-.068.92-.204 1.32a3.103 3.103 0 0 1-.576 1.02 2.583 2.583 0 0 1-.9.672 2.937 2.937 0 0 1-1.176.228zm-.096-.828c.624 0 1.1-.2 1.428-.6.328-.408.492-.996.492-1.764V6.82c0-.4-.052-.748-.156-1.044a2.095 2.095 0 0 0-.42-.732 1.53 1.53 0 0 0-.612-.444 1.798 1.798 0 0 0-.744-.156c-.288 0-.56.048-.816.144a1.71 1.71 0 0 0-.648.444c-.184.192-.328.44-.432.744a3.152 3.152 0 0 0-.156 1.044v.096c0 .8.192 1.396.576 1.788.384.384.88.576 1.488.576zM73.63 9.352l-2.46-5.628h1.068l1.92 4.5 1.74-4.5h1.02l-3.468 8.46h-1.008l1.188-2.832zM87.127 3.669A3.138 3.138 0 0 0 86.1 2.95a3.09 3.09 0 0 0-1.228-.25c-.448 0-.848.086-1.187.26a2.199 2.199 0 0 0-.662.497v-.191a.387.387 0 0 0-.214-.348.323.323 0 0 0-.14-.03h-1.315a.314.314 0 0 0-.254.116.377.377 0 0 0-.1.262v8.97c0 .1.034.188.1.258a.34.34 0 0 0 .254.103h1.341a.342.342 0 0 0 .244-.103.336.336 0 0 0 .11-.259v-3.06c.178.202.417.357.702.464.35.134.72.203 1.093.203.43 0 .848-.082 1.242-.248a3.124 3.124 0 0 0 1.04-.724c.305-.326.545-.709.707-1.128a3.93 3.93 0 0 0 .263-1.477c0-.54-.086-1.037-.263-1.477a3.387 3.387 0 0 0-.706-1.12zm-1.204 3.24c-.073.19-.18.362-.315.51a1.415 1.415 0 0 1-1.065.466c-.2.001-.4-.04-.584-.12a1.484 1.484 0 0 1-.49-.346 1.593 1.593 0 0 1-.32-.51 1.738 1.738 0 0 1-.115-.63c0-.224.04-.435.115-.631a1.532 1.532 0 0 1 .804-.846c.185-.086.386-.13.59-.129.215 0 .414.044.593.13.177.083.338.199.474.341a1.622 1.622 0 0 1 .425 1.135c0 .225-.037.436-.112.63zM95.298 2.89h-1.33a.339.339 0 0 0-.246.11.384.384 0 0 0-.108.266v.166a1.856 1.856 0 0 0-.602-.472 2.525 2.525 0 0 0-1.166-.258 3.227 3.227 0 0 0-2.284.964 3.554 3.554 0 0 0-.734 1.123 3.827 3.827 0 0 0-.275 1.477c0 .54.092 1.037.275 1.477.184.434.427.817.728 1.128a3.146 3.146 0 0 0 2.277.973c.437 0 .834-.088 1.173-.259.25-.13.456-.287.608-.471v.177a.34.34 0 0 0 .11.259.341.341 0 0 0 .244.104h1.33a.324.324 0 0 0 .25-.105.349.349 0 0 0 .102-.258V3.267a.377.377 0 0 0-.1-.262.325.325 0 0 0-.252-.115zM93.502 6.9a1.55 1.55 0 0 1-.312.511c-.136.143-.296.26-.473.344-.178.085-.38.129-.596.129-.207 0-.407-.044-.59-.13a1.501 1.501 0 0 1-.791-.855 1.766 1.766 0 0 1-.112-.62c0-.225.038-.436.112-.632.075-.193.181-.364.314-.504.137-.143.3-.26.478-.342.182-.085.382-.129.59-.129.215 0 .417.044.595.13.178.085.338.2.473.341a1.623 1.623 0 0 1 .424 1.135c0 .215-.037.424-.112.622zM108.567 6.094a2.265 2.265 0 0 0-.654-.402c-.247-.101-.509-.181-.785-.235l-1.014-.204c-.26-.05-.441-.117-.543-.203a.328.328 0 0 1-.136-.264c0-.11.063-.2.189-.282.137-.086.329-.13.566-.13.26 0 .518.053.757.157.243.106.471.226.67.36.295.187.546.162.727-.053l.487-.57a.543.543 0 0 0 .152-.357c0-.128-.064-.245-.185-.351-.207-.184-.533-.378-.971-.568-.437-.192-.987-.29-1.637-.29-.427 0-.82.058-1.168.172-.35.116-.65.276-.893.474-.245.204-.438.44-.57.713a2 2 0 0 0-.198.875c0 .56.167 1.017.496 1.358.328.333.766.56 1.304.67l1.054.232c.3.062.528.132.675.21.129.067.19.163.19.297 0 .12-.061.227-.188.324-.133.104-.342.155-.622.155a1.83 1.83 0 0 1-.831-.19 3.056 3.056 0 0 1-.678-.458.995.995 0 0 0-.307-.17c-.126-.037-.268.003-.431.13l-.583.461c-.169.145-.24.32-.209.522.029.194.19.394.491.62.269.193.614.368 1.029.518.415.151.901.229 1.453.229.444 0 .854-.058 1.215-.172.362-.119.681-.278.941-.48a2.056 2.056 0 0 0 .819-1.663c0-.319-.053-.6-.165-.836a1.843 1.843 0 0 0-.447-.6zM114.383 7.73a.363.363 0 0 0-.295-.192.55.55 0 0 0-.343.113c-.095.062-.198.11-.306.141a.75.75 0 0 1-.426.013.43.43 0 0 1-.181-.093.554.554 0 0 1-.143-.204.92.92 0 0 1-.059-.362v-2.46h1.731c.099 0 .188-.04.266-.117a.368.368 0 0 0 .112-.26V3.268a.369.369 0 0 0-.115-.268.38.38 0 0 0-.263-.109h-1.732V1.216a.354.354 0 0 0-.108-.27.347.347 0 0 0-.243-.104h-1.344a.36.36 0 0 0-.34.226.371.371 0 0 0-.027.148V2.89h-.767a.324.324 0 0 0-.255.115.385.385 0 0 0-.098.262V4.31a.4.4 0 0 0 .212.346c.044.021.092.032.14.03h.768v2.925c0 .39.069.726.2 1.003.132.274.305.504.514.676.217.178.465.31.731.388.27.084.551.126.833.126.385 0 .75-.061 1.094-.18a2.13 2.13 0 0 0 .861-.552c.152-.181.17-.381.046-.581l-.463-.76zM121.672 2.89h-1.329a.339.339 0 0 0-.244.11.39.39 0 0 0-.08.122.394.394 0 0 0-.027.144v.166a1.906 1.906 0 0 0-.605-.472c-.335-.173-.726-.258-1.168-.258-.42 0-.834.083-1.226.249a3.24 3.24 0 0 0-1.055.715 3.528 3.528 0 0 0-.734 1.123 3.79 3.79 0 0 0-.276 1.477c0 .54.092 1.037.275 1.477.184.434.428.817.729 1.128a3.138 3.138 0 0 0 2.273.973 2.59 2.59 0 0 0 1.175-.259c.255-.13.457-.287.612-.471v.177a.34.34 0 0 0 .108.259.343.343 0 0 0 .243.104h1.329a.335.335 0 0 0 .252-.105.364.364 0 0 0 .102-.258V3.267a.38.38 0 0 0-.1-.262.332.332 0 0 0-.115-.087.311.311 0 0 0-.139-.028zM119.876 6.9a1.534 1.534 0 0 1-.786.855 1.362 1.362 0 0 1-.594.129c-.207 0-.405-.044-.588-.13a1.516 1.516 0 0 1-.792-.855 1.757 1.757 0 0 1-.113-.62c0-.225.037-.436.112-.632.073-.187.179-.358.314-.504.138-.143.3-.26.479-.342.184-.086.385-.13.588-.129.217 0 .415.044.594.13.181.085.34.2.472.341.134.143.24.313.314.504a1.73 1.73 0 0 1 0 1.253zM128.978 7.64l-.763-.593c-.146-.118-.284-.15-.404-.1a.742.742 0 0 0-.279.205 2.527 2.527 0 0 1-.583.535c-.192.122-.444.183-.742.183-.219 0-.42-.04-.6-.122a1.423 1.423 0 0 1-.469-.342 1.575 1.575 0 0 1-.308-.51 1.751 1.751 0 0 1-.106-.617c0-.228.034-.438.106-.632.07-.192.173-.363.308-.503.135-.144.295-.26.472-.342.187-.088.391-.132.597-.13.298 0 .547.064.742.187.198.126.396.306.584.534.078.092.17.16.278.206.122.048.259.016.401-.101l.762-.594a.53.53 0 0 0 .201-.269.437.437 0 0 0-.034-.365 3.329 3.329 0 0 0-1.18-1.127c-.504-.291-1.108-.441-1.784-.441a3.519 3.519 0 0 0-2.51 1.033c-.322.322-.576.71-.747 1.137a3.68 3.68 0 0 0-.273 1.407c0 .495.093.968.273 1.402.173.424.427.808.747 1.128a3.527 3.527 0 0 0 2.51 1.034c.676 0 1.28-.149 1.784-.444a3.286 3.286 0 0 0 1.182-1.13.411.411 0 0 0 .055-.173.415.415 0 0 0-.023-.182.624.624 0 0 0-.197-.273zM136.06 9.045l-2.104-3.143 1.801-2.415c.094-.139.119-.272.075-.397-.031-.09-.116-.2-.334-.2h-1.425a.52.52 0 0 0-.234.058.482.482 0 0 0-.209.205L132.191 5.2h-.349V.363a.37.37 0 0 0-.099-.26.352.352 0 0 0-.253-.103h-1.332a.37.37 0 0 0-.337.22.346.346 0 0 0-.027.143V9.29c0 .103.038.193.11.259a.353.353 0 0 0 .254.104h1.333a.328.328 0 0 0 .251-.105.346.346 0 0 0 .075-.119.333.333 0 0 0 .024-.14V6.927h.386l1.571 2.446c.112.187.267.281.46.281h1.491c.226 0 .32-.11.358-.202.054-.13.038-.262-.047-.406zM102.863 2.89h-1.489a.389.389 0 0 0-.298.122.544.544 0 0 0-.13.249l-1.099 4.167h-.268l-1.182-4.167a.66.66 0 0 0-.113-.247.329.329 0 0 0-.264-.124h-1.544c-.199 0-.325.066-.372.193a.588.588 0 0 0-.002.37l1.887 5.865c.03.093.08.17.145.232a.388.388 0 0 0 .281.104h.798l-.066.19-.19.547a.872.872 0 0 1-.29.426.7.7 0 0 1-.442.148.956.956 0 0 1-.4-.09 1.842 1.842 0 0 1-.35-.209.62.62 0 0 0-.335-.115h-.016c-.13 0-.243.074-.334.216l-.474.708c-.193.304-.086.504.039.615.234.224.528.399.875.524.344.125.723.186 1.126.186.682 0 1.252-.187 1.689-.565.435-.376.756-.887.952-1.524l2.188-7.258c.05-.155.05-.284.005-.389-.037-.08-.125-.174-.327-.174z" fill="#ffffff"/>\n </svg>\n'};return"\n <style>\n #inline-button-".concat(e.inlineId," {\n position: relative;\n text-align: center;\n display: inline-block;\n }\n #inline-button-").concat(e.inlineId,"__trigger {\n ").concat((t=e.variant||"normal",n={normal:"\n background: linear-gradient(180deg,#44b669 0,#40ad57);\n text-shadow: 1px 1px 1px rgba(0,0,0,.1);\n color: #ffffff;\n ",light:"\n background: white;\n text-shadow: none;\n color: #011b33;\n "},"".concat("\n box-sizing: border-box;\n display: inline-block;\n line-height: 1;\n white-space: nowrap;\n margin: 0 0 10px;\n text-align: center;\n -webkit-appearance: none;\n outline: none;\n font-size: 14px;\n font-weight: 600;\n border-radius: 6px;\n cursor: pointer;\n padding: 16px 24px;\n box-shadow: 0px 1px 4px rgba(0, 0, 0, 0.15);\n transition: all .3s ease;\n border: none;\n min-width: 190px;\n ").concat(n[t])),"\n }\n #inline-button-").concat(e.inlineId,"__trigger:hover {\n box-shadow: 0px 4px 12px rgba(0, 0, 0, 0.2);\n }\n #inline-button-").concat(e.inlineId,'__trigger:active {\n transform: translateY(3px);\n }\n </style>\n <button id="inline-button-').concat(e.inlineId,'__trigger" data-inline-id="').concat(e.inlineId,'">').concat(e.text||"Pay"," ").concat(e.currency||"NGN"," ").concat(e.amount,'</button>\n <div id="inline-button-').concat(e.inlineId,'__wordmark">\n ').concat(a[e.wordmarkVariant||"normal"],"\n </div>\n ")}(e),e.parent.parentNode.insertBefore(n,e.parent.nextSibling),t=s(n.getElementsByTagName("button"),1)[0]}return t}({inlineId:G.id,amount:ce.amount/100,currency:ce.currency,id:ce.buttonId,text:ce.buttonText,variant:ce.buttonVariant,wordmarkVariant:ce.buttonWordmarkVariant,parent:b()}).addEventListener("click",function(e){e.preventDefault(),oe?G.resumeTransaction(oe.accessCode):oe=G.newTransaction(o(o({},ce),{},{onSuccess:function(e){var t,n,a,r,i,o;t={type:"hidden",name:"reference",value:e.reference,parent:se},n=t.type,a=t.value,r=t.name,i=t.parent,(o=document.createElement("input")).type=n,o.value=a,o.name=r,i.appendChild(o),se.submit()}}))})}module.exports=ie;
1
+ 'use strict';
2
+
3
+ function _arrayLikeToArray(r, a) {
4
+ (null == a || a > r.length) && (a = r.length);
5
+ for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
6
+ return n;
7
+ }
8
+ function _arrayWithHoles(r) {
9
+ if (Array.isArray(r)) return r;
10
+ }
11
+ function _arrayWithoutHoles(r) {
12
+ if (Array.isArray(r)) return _arrayLikeToArray(r);
13
+ }
14
+ function _classCallCheck(a, n) {
15
+ if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
16
+ }
17
+ function _defineProperties(e, r) {
18
+ for (var t = 0; t < r.length; t++) {
19
+ var o = r[t];
20
+ o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o);
21
+ }
22
+ }
23
+ function _createClass(e, r, t) {
24
+ return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", {
25
+ writable: !1
26
+ }), e;
27
+ }
28
+ function _defineProperty(e, r, t) {
29
+ return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
30
+ value: t,
31
+ enumerable: !0,
32
+ configurable: !0,
33
+ writable: !0
34
+ }) : e[r] = t, e;
35
+ }
36
+ function _iterableToArray(r) {
37
+ if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
38
+ }
39
+ function _iterableToArrayLimit(r, l) {
40
+ var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
41
+ if (null != t) {
42
+ var e,
43
+ n,
44
+ i,
45
+ u,
46
+ a = [],
47
+ f = !0,
48
+ o = !1;
49
+ try {
50
+ if (i = (t = t.call(r)).next, 0 === l) {
51
+ if (Object(t) !== t) return;
52
+ f = !1;
53
+ } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
54
+ } catch (r) {
55
+ o = !0, n = r;
56
+ } finally {
57
+ try {
58
+ if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
59
+ } finally {
60
+ if (o) throw n;
61
+ }
62
+ }
63
+ return a;
64
+ }
65
+ }
66
+ function _nonIterableRest() {
67
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
68
+ }
69
+ function _nonIterableSpread() {
70
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
71
+ }
72
+ function ownKeys(e, r) {
73
+ var t = Object.keys(e);
74
+ if (Object.getOwnPropertySymbols) {
75
+ var o = Object.getOwnPropertySymbols(e);
76
+ r && (o = o.filter(function (r) {
77
+ return Object.getOwnPropertyDescriptor(e, r).enumerable;
78
+ })), t.push.apply(t, o);
79
+ }
80
+ return t;
81
+ }
82
+ function _objectSpread2(e) {
83
+ for (var r = 1; r < arguments.length; r++) {
84
+ var t = null != arguments[r] ? arguments[r] : {};
85
+ r % 2 ? ownKeys(Object(t), !0).forEach(function (r) {
86
+ _defineProperty(e, r, t[r]);
87
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {
88
+ Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
89
+ });
90
+ }
91
+ return e;
92
+ }
93
+ function _objectWithoutProperties(e, t) {
94
+ if (null == e) return {};
95
+ var o,
96
+ r,
97
+ i = _objectWithoutPropertiesLoose(e, t);
98
+ if (Object.getOwnPropertySymbols) {
99
+ var n = Object.getOwnPropertySymbols(e);
100
+ for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
101
+ }
102
+ return i;
103
+ }
104
+ function _objectWithoutPropertiesLoose(r, e) {
105
+ if (null == r) return {};
106
+ var t = {};
107
+ for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
108
+ if (-1 !== e.indexOf(n)) continue;
109
+ t[n] = r[n];
110
+ }
111
+ return t;
112
+ }
113
+ function _slicedToArray(r, e) {
114
+ return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
115
+ }
116
+ function _toConsumableArray(r) {
117
+ return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread();
118
+ }
119
+ function _toPrimitive(t, r) {
120
+ if ("object" != typeof t || !t) return t;
121
+ var e = t[Symbol.toPrimitive];
122
+ if (void 0 !== e) {
123
+ var i = e.call(t, r || "default");
124
+ if ("object" != typeof i) return i;
125
+ throw new TypeError("@@toPrimitive must return a primitive value.");
126
+ }
127
+ return ("string" === r ? String : Number)(t);
128
+ }
129
+ function _toPropertyKey(t) {
130
+ var i = _toPrimitive(t, "string");
131
+ return "symbol" == typeof i ? i : i + "";
132
+ }
133
+ function _typeof(o) {
134
+ "@babel/helpers - typeof";
135
+
136
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
137
+ return typeof o;
138
+ } : function (o) {
139
+ return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
140
+ }, _typeof(o);
141
+ }
142
+ function _unsupportedIterableToArray(r, a) {
143
+ if (r) {
144
+ if ("string" == typeof r) return _arrayLikeToArray(r, a);
145
+ var t = {}.toString.call(r).slice(8, -1);
146
+ return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
147
+ }
148
+ }
149
+
150
+ var baseConfig = {
151
+ cookieTestUrl: 'https://legacy-staging.paystack.co/test-iframe/start.html',
152
+ publishableKey: 'uFmz/uE/SDT6GupOrSEXIZXGByjQ0zFkPyc9LqKHFqnTI0WPN3JS5kQPo/j9or0TOXlqMQj2lzHn/UGsQT4XeQ==',
153
+ publicKey: '-----BEGIN PUBLIC KEY-----' + '\r\n' + 'MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBALhZs/7hP0g0+hrqTq0hFyGVxgco0NMx' + '\r\n' + 'ZD8nPS6ihxap0yNFjzdyUuZED6P4/aK9Ezl5ajEI9pcx5/1BrEE+F3kCAwEAAQ==' + '\r\n' + '-----END PUBLIC KEY-----',
154
+ applePayVersion: 6,
155
+ applePayValidateSessionPath: 'applepay/validate-session/',
156
+ applePayChargePath: 'applepay/charge',
157
+ googlePayChargePath: 'googlepay/charge'
158
+ };
159
+ var devConfig = _objectSpread2(_objectSpread2({}, baseConfig), {}, {
160
+ environment: 'dev',
161
+ checkoutUrl: 'http://localhost:8081/',
162
+ paymentBaseUrl: 'https://legacy-staging.paystack.co/',
163
+ paystackApiUrl: 'https://studio-api.paystack.co/',
164
+ siteUrl: 'https://paystack.com',
165
+ pusherKey: '1c7b262ee18455815893',
166
+ pusherUrl: 'http://localhost:8081/static/vendor/pusher.min.js'
167
+ });
168
+ var stagingConfig = _objectSpread2(_objectSpread2({}, baseConfig), {}, {
169
+ environment: 'staging',
170
+ checkoutUrl: 'https://checkout-studio.paystack.com/',
171
+ paymentBaseUrl: 'https://legacy-staging.paystack.co/',
172
+ paystackApiUrl: 'https://studio-api.paystack.co/',
173
+ siteUrl: 'https://beta.paystack.com',
174
+ pusherKey: '1c7b262ee18455815893',
175
+ pusherUrl: 'https://checkout-studio.paystack.com/static/vendor/pusher.min.js'
176
+ });
177
+ var productionConfig = _objectSpread2(_objectSpread2({}, baseConfig), {}, {
178
+ environment: 'production',
179
+ checkoutUrl: 'https://checkout.paystack.com/',
180
+ paymentBaseUrl: 'https://standard.paystack.co/',
181
+ paystackApiUrl: 'https://api.paystack.co/',
182
+ siteUrl: 'https://paystack.com',
183
+ pusherKey: '8e4b9b7ca3418bd5cdc8',
184
+ pusherUrl: 'https://checkout.paystack.com/static/vendor/pusher.min.js'
185
+ });
186
+ var configurations = {
187
+ dev: devConfig,
188
+ staging: stagingConfig,
189
+ production: productionConfig
190
+ };
191
+
192
+ /* eslint-disable */
193
+ var config = configurations['staging'] || stagingConfig;
194
+
195
+ function randomId() {
196
+ var text = '';
197
+ var possible = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
198
+ for (var i = 0; i < 5; i += 1) {
199
+ text += possible.charAt(Math.floor(Math.random() * possible.length));
200
+ }
201
+ return text;
202
+ }
203
+
204
+ function serialize(obj, prefix) {
205
+ var queryString = [];
206
+ Object.keys(obj).forEach(function (key) {
207
+ var updatedKey = prefix ? "".concat(prefix, "[").concat(key, "]") : key;
208
+ var value = obj[updatedKey];
209
+ queryString.push(value !== null && (typeof v === "undefined" ? "undefined" : _typeof(v)) === 'object' ? serialize(value, updatedKey) : "".concat(encodeURIComponent(key), "=").concat(encodeURIComponent(value)));
210
+ });
211
+ return queryString.join('&');
212
+ }
213
+
214
+ function parseResponse(message) {
215
+ var action = message && typeof message === 'string' ? message.split(' ')[0] : null;
216
+ var data = action ? message.split(' ').slice(2).join(' ') : null;
217
+ return {
218
+ action: action,
219
+ data: data
220
+ };
221
+ }
222
+
223
+ function similarObjects(o1, o2) {
224
+ var equalKeys = Object.keys(o1).sort().join('') === Object.keys(o2).sort().join('');
225
+ var equalValues = Object.values(o1).sort().join('') === Object.values(o2).sort().join('');
226
+ return equalKeys && equalValues;
227
+ }
228
+
229
+ /* eslint-env browser */
230
+ function getLastScript() {
231
+ var scripts = document.getElementsByTagName('script');
232
+ return scripts[scripts.length - 1];
233
+ }
234
+ function getSourceScript() {
235
+ return document.currentScript || getLastScript();
236
+ }
237
+ function getDataAttributes() {
238
+ var dataAttributes = [];
239
+ var sourceScript = getSourceScript();
240
+ if (sourceScript) {
241
+ var attributes = Array.prototype.slice.call(sourceScript.attributes);
242
+ dataAttributes = Object.keys(attributes).filter(function (key) {
243
+ var element = attributes[key].nodeName;
244
+ return element && element.indexOf('data') > -1;
245
+ }).map(function (index) {
246
+ return attributes[index].nodeName;
247
+ });
248
+ }
249
+ return dataAttributes;
250
+ }
251
+ function scriptCanUseDataAttributes() {
252
+ var hasDataAttributes = getDataAttributes().length > 0;
253
+ var hasParentForm = getSourceScript() && getSourceScript().parentElement.tagName === 'FORM';
254
+ return hasDataAttributes && hasParentForm;
255
+ }
256
+ function getDataAttributesAsParameters() {
257
+ function convertToCamelCase(value) {
258
+ return value.replace(/-([a-z])/g, function (g) {
259
+ return g[1].toUpperCase();
260
+ });
261
+ }
262
+ function validateLazyParameters(parameters) {
263
+ if (parameters.buttonId && !document.getElementById(parameters.buttonId)) {
264
+ throw new Error('Please make sure the buttonId is an element available in the DOM');
265
+ }
266
+ var updatedParameters = _objectSpread2({}, parameters);
267
+ updatedParameters.buttonText = parameters.buttonText || 'Pay';
268
+ updatedParameters.buttonVariant = 'normal';
269
+ updatedParameters.buttonWordmarkVariant = 'normal';
270
+ var allowedVariants = ['normal', 'light'];
271
+ if (parameters.buttonVariant && allowedVariants.indexOf(parameters.buttonVariant) > -1) {
272
+ updatedParameters.buttonVariant = parameters.buttonVariant;
273
+ }
274
+ if (parameters.buttonWordmarkVariant && allowedVariants.indexOf(parameters.buttonWordmarkVariant) > -1) {
275
+ updatedParameters.buttonWordmarkVariant = parameters.buttonWordmarkVariant;
276
+ }
277
+ return updatedParameters;
278
+ }
279
+ var parameters = {};
280
+ var sourceScript = getSourceScript();
281
+ var dataAttributes = getDataAttributes();
282
+ dataAttributes.forEach(function (attribute) {
283
+ var attributeValue = sourceScript.getAttribute(attribute);
284
+ var attributeSplit = attribute.split('data-');
285
+ var attributeName = convertToCamelCase(attributeSplit[1]);
286
+ parameters[attributeName] = attributeValue;
287
+ });
288
+ return validateLazyParameters(parameters);
289
+ }
290
+
291
+ var secureByPaystack = "\n <svg id=\"inline-button-wordmark\" width=\"137\" height=\"13\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M.037 5.095l1.075-.135c-.011-.774-.025-1.944-.013-2.149C1.19 1.364 2.38.134 3.81.013 3.9.006 3.99.002 4.077 0a2.947 2.947 0 0 1 2.046.76c.574.509.95 1.26 1.008 2.007.015.192.01 1.491.01 2.257l1.096.163L8.2 11.44 4.093 12 0 11.346l.037-6.251zm4.106-.514l1.724.256c-.007-.933-.05-2.295-.26-2.654-.319-.545-.846-.867-1.443-.88h-.063c-.607.008-1.138.322-1.458.864-.222.378-.266 1.66-.265 2.637l1.765-.223zM18.228 10.108c-.576 0-1.064-.072-1.464-.216a2.864 2.864 0 0 1-.972-.6 2.552 2.552 0 0 1-.588-.864 4.067 4.067 0 0 1-.252-1.044h1.008c.032.256.088.5.168.732.08.224.204.424.372.6.168.168.388.304.66.408.28.096.636.144 1.068.144.28 0 .536-.036.768-.108.24-.08.448-.192.624-.336.176-.144.312-.316.408-.516.104-.2.156-.42.156-.66 0-.24-.032-.448-.096-.624a1.02 1.02 0 0 0-.336-.468 1.885 1.885 0 0 0-.636-.324 6.4 6.4 0 0 0-1.008-.228 8.79 8.79 0 0 1-1.212-.276 3.246 3.246 0 0 1-.9-.432 1.982 1.982 0 0 1-.564-.672c-.128-.272-.192-.6-.192-.984 0-.328.068-.632.204-.912.136-.288.324-.536.564-.744.248-.208.54-.372.876-.492.336-.12.708-.18 1.116-.18.864 0 1.548.204 2.052.612.512.4.812.984.9 1.752h-.936c-.104-.544-.316-.932-.636-1.164-.32-.24-.78-.36-1.38-.36-.592 0-1.04.132-1.344.396a1.255 1.255 0 0 0-.444.996c0 .208.024.396.072.564.056.16.156.3.3.42.152.12.36.228.624.324a6.72 6.72 0 0 0 1.068.228c.48.072.9.168 1.26.288.36.12.664.276.912.468s.432.428.552.708c.128.28.192.624.192 1.032 0 .36-.076.696-.228 1.008a2.472 2.472 0 0 1-.612.804c-.264.224-.58.4-.948.528-.36.128-.752.192-1.176.192zM25.355 10.108c-.44 0-.848-.076-1.224-.228a2.916 2.916 0 0 1-.96-.636 2.966 2.966 0 0 1-.636-1.008 3.77 3.77 0 0 1-.216-1.308v-.096c0-.472.072-.904.216-1.296.144-.4.344-.74.6-1.02.264-.288.576-.508.936-.66.36-.16.756-.24 1.188-.24.36 0 .708.06 1.044.18.344.112.648.292.912.54.264.248.472.572.624.972.16.392.24.868.24 1.428v.324h-4.728c.024.72.204 1.272.54 1.656.336.376.828.564 1.476.564.984 0 1.54-.364 1.668-1.092h.996c-.112.632-.408 1.112-.888 1.44-.48.32-1.076.48-1.788.48zm1.704-3.852c-.048-.648-.232-1.112-.552-1.392-.312-.28-.728-.42-1.248-.42-.512 0-.932.164-1.26.492-.32.32-.524.76-.612 1.32h3.672zM32.091 10.108c-.44 0-.848-.072-1.224-.216a3.054 3.054 0 0 1-.972-.636 3.12 3.12 0 0 1-.648-1.008 3.626 3.626 0 0 1-.228-1.32v-.096c0-.48.08-.916.24-1.308.16-.4.376-.74.648-1.02.28-.28.604-.496.972-.648.376-.16.772-.24 1.188-.24.328 0 .644.04.948.12.312.08.588.208.828.384.248.168.456.392.624.672.168.28.276.62.324 1.02h-.984c-.08-.496-.284-.848-.612-1.056-.32-.208-.696-.312-1.128-.312a1.93 1.93 0 0 0-.804.168c-.24.112-.452.272-.636.48a2.23 2.23 0 0 0-.42.744 2.991 2.991 0 0 0-.156.996v.096c0 .776.188 1.364.564 1.764.384.392.88.588 1.488.588.224 0 .436-.032.636-.096a1.651 1.651 0 0 0 .96-.768c.112-.192.18-.416.204-.672h.924a2.595 2.595 0 0 1-.276.948 2.386 2.386 0 0 1-.576.744c-.24.208-.52.372-.84.492-.32.12-.668.18-1.044.18zM38.335 10.108a2.83 2.83 0 0 1-.876-.132 1.724 1.724 0 0 1-.684-.42 2.145 2.145 0 0 1-.456-.756c-.112-.304-.168-.672-.168-1.104V3.724h.996v3.924c0 .552.116.956.348 1.212.24.256.608.384 1.104.384.224 0 .44-.036.648-.108.208-.072.392-.18.552-.324.16-.144.288-.324.384-.54.096-.216.144-.464.144-.744V3.724h.996V10h-.996v-.996c-.144.296-.388.556-.732.78-.336.216-.756.324-1.26.324zM43.216 3.724h.996v1.128c.2-.352.452-.64.756-.864.312-.232.748-.356 1.308-.372v.936a4.461 4.461 0 0 0-.852.12 1.647 1.647 0 0 0-.66.324 1.472 1.472 0 0 0-.408.612c-.096.248-.144.564-.144.948V10h-.996V3.724zM50 10.108c-.44 0-.848-.076-1.224-.228a2.916 2.916 0 0 1-.96-.636 2.966 2.966 0 0 1-.636-1.008 3.77 3.77 0 0 1-.216-1.308v-.096c0-.472.072-.904.216-1.296.144-.4.344-.74.6-1.02.264-.288.576-.508.936-.66.36-.16.756-.24 1.188-.24.36 0 .708.06 1.044.18.344.112.648.292.912.54.264.248.472.572.624.972.16.392.24.868.24 1.428v.324h-4.728c.024.72.204 1.272.54 1.656.336.376.828.564 1.476.564.984 0 1.54-.364 1.668-1.092h.996c-.112.632-.408 1.112-.888 1.44-.48.32-1.076.48-1.788.48zm1.704-3.852c-.048-.648-.232-1.112-.552-1.392-.312-.28-.728-.42-1.248-.42-.512 0-.932.164-1.26.492-.32.32-.524.76-.612 1.32h3.672zM56.496 10.108c-.408 0-.788-.068-1.14-.204a2.683 2.683 0 0 1-.9-.612 3.01 3.01 0 0 1-.588-.984 4.01 4.01 0 0 1-.204-1.32v-.096c0-.48.072-.92.216-1.32.144-.4.344-.744.6-1.032.256-.296.564-.524.924-.684.36-.16.756-.24 1.188-.24.528 0 .956.112 1.284.336.328.216.584.476.768.78V.724h.996V10h-.996V8.92c-.088.152-.208.3-.36.444a2.792 2.792 0 0 1-.516.384 2.874 2.874 0 0 1-.6.252c-.216.072-.44.108-.672.108zm.108-.828c.288 0 .56-.048.816-.144.256-.096.476-.24.66-.432.184-.2.328-.448.432-.744.112-.304.168-.656.168-1.056v-.096c0-.808-.18-1.404-.54-1.788-.352-.384-.836-.576-1.452-.576-.624 0-1.112.208-1.464.624-.352.416-.528 1.008-.528 1.776v.096c0 .392.048.736.144 1.032.104.296.24.54.408.732.176.192.38.336.612.432.232.096.48.144.744.144zM67.712 10.108c-.512 0-.948-.112-1.308-.336a2.38 2.38 0 0 1-.816-.804V10h-.996V.724h.996V4.78a1.92 1.92 0 0 1 .348-.432c.152-.144.32-.268.504-.372.192-.112.396-.2.612-.264.216-.064.436-.096.66-.096.408 0 .788.072 1.14.216.352.144.652.352.9.624.256.272.456.604.6.996.144.392.216.832.216 1.32v.096c0 .48-.068.92-.204 1.32a3.103 3.103 0 0 1-.576 1.02 2.583 2.583 0 0 1-.9.672 2.937 2.937 0 0 1-1.176.228zm-.096-.828c.624 0 1.1-.2 1.428-.6.328-.408.492-.996.492-1.764V6.82c0-.4-.052-.748-.156-1.044a2.095 2.095 0 0 0-.42-.732 1.53 1.53 0 0 0-.612-.444 1.798 1.798 0 0 0-.744-.156c-.288 0-.56.048-.816.144a1.71 1.71 0 0 0-.648.444c-.184.192-.328.44-.432.744a3.152 3.152 0 0 0-.156 1.044v.096c0 .8.192 1.396.576 1.788.384.384.88.576 1.488.576zM73.63 9.352l-2.46-5.628h1.068l1.92 4.5 1.74-4.5h1.02l-3.468 8.46h-1.008l1.188-2.832zM87.127 3.669A3.138 3.138 0 0 0 86.1 2.95a3.09 3.09 0 0 0-1.228-.25c-.448 0-.848.086-1.187.26a2.199 2.199 0 0 0-.662.497v-.191a.387.387 0 0 0-.214-.348.323.323 0 0 0-.14-.03h-1.315a.314.314 0 0 0-.254.116.377.377 0 0 0-.1.262v8.97c0 .1.034.188.1.258a.34.34 0 0 0 .254.103h1.341a.342.342 0 0 0 .244-.103.336.336 0 0 0 .11-.259v-3.06c.178.202.417.357.702.464.35.134.72.203 1.093.203.43 0 .848-.082 1.242-.248a3.124 3.124 0 0 0 1.04-.724c.305-.326.545-.709.707-1.128a3.93 3.93 0 0 0 .263-1.477c0-.54-.086-1.037-.263-1.477a3.387 3.387 0 0 0-.706-1.12zm-1.204 3.24c-.073.19-.18.362-.315.51a1.415 1.415 0 0 1-1.065.466c-.2.001-.4-.04-.584-.12a1.484 1.484 0 0 1-.49-.346 1.593 1.593 0 0 1-.32-.51 1.738 1.738 0 0 1-.115-.63c0-.224.04-.435.115-.631a1.532 1.532 0 0 1 .804-.846c.185-.086.386-.13.59-.129.215 0 .414.044.593.13.177.083.338.199.474.341a1.622 1.622 0 0 1 .425 1.135c0 .225-.037.436-.112.63zM95.298 2.89h-1.33a.339.339 0 0 0-.246.11.384.384 0 0 0-.108.266v.166a1.856 1.856 0 0 0-.602-.472 2.525 2.525 0 0 0-1.166-.258 3.227 3.227 0 0 0-2.284.964 3.554 3.554 0 0 0-.734 1.123 3.827 3.827 0 0 0-.275 1.477c0 .54.092 1.037.275 1.477.184.434.427.817.728 1.128a3.146 3.146 0 0 0 2.277.973c.437 0 .834-.088 1.173-.259.25-.13.456-.287.608-.471v.177a.34.34 0 0 0 .11.259.341.341 0 0 0 .244.104h1.33a.324.324 0 0 0 .25-.105.349.349 0 0 0 .102-.258V3.267a.377.377 0 0 0-.1-.262.325.325 0 0 0-.252-.115zM93.502 6.9a1.55 1.55 0 0 1-.312.511c-.136.143-.296.26-.473.344-.178.085-.38.129-.596.129-.207 0-.407-.044-.59-.13a1.501 1.501 0 0 1-.791-.855 1.766 1.766 0 0 1-.112-.62c0-.225.038-.436.112-.632.075-.193.181-.364.314-.504.137-.143.3-.26.478-.342.182-.085.382-.129.59-.129.215 0 .417.044.595.13.178.085.338.2.473.341a1.623 1.623 0 0 1 .424 1.135c0 .215-.037.424-.112.622zM108.567 6.094a2.265 2.265 0 0 0-.654-.402c-.247-.101-.509-.181-.785-.235l-1.014-.204c-.26-.05-.441-.117-.543-.203a.328.328 0 0 1-.136-.264c0-.11.063-.2.189-.282.137-.086.329-.13.566-.13.26 0 .518.053.757.157.243.106.471.226.67.36.295.187.546.162.727-.053l.487-.57a.543.543 0 0 0 .152-.357c0-.128-.064-.245-.185-.351-.207-.184-.533-.378-.971-.568-.437-.192-.987-.29-1.637-.29-.427 0-.82.058-1.168.172-.35.116-.65.276-.893.474-.245.204-.438.44-.57.713a2 2 0 0 0-.198.875c0 .56.167 1.017.496 1.358.328.333.766.56 1.304.67l1.054.232c.3.062.528.132.675.21.129.067.19.163.19.297 0 .12-.061.227-.188.324-.133.104-.342.155-.622.155a1.83 1.83 0 0 1-.831-.19 3.056 3.056 0 0 1-.678-.458.995.995 0 0 0-.307-.17c-.126-.037-.268.003-.431.13l-.583.461c-.169.145-.24.32-.209.522.029.194.19.394.491.62.269.193.614.368 1.029.518.415.151.901.229 1.453.229.444 0 .854-.058 1.215-.172.362-.119.681-.278.941-.48a2.056 2.056 0 0 0 .819-1.663c0-.319-.053-.6-.165-.836a1.843 1.843 0 0 0-.447-.6zM114.383 7.73a.363.363 0 0 0-.295-.192.55.55 0 0 0-.343.113c-.095.062-.198.11-.306.141a.75.75 0 0 1-.426.013.43.43 0 0 1-.181-.093.554.554 0 0 1-.143-.204.92.92 0 0 1-.059-.362v-2.46h1.731c.099 0 .188-.04.266-.117a.368.368 0 0 0 .112-.26V3.268a.369.369 0 0 0-.115-.268.38.38 0 0 0-.263-.109h-1.732V1.216a.354.354 0 0 0-.108-.27.347.347 0 0 0-.243-.104h-1.344a.36.36 0 0 0-.34.226.371.371 0 0 0-.027.148V2.89h-.767a.324.324 0 0 0-.255.115.385.385 0 0 0-.098.262V4.31a.4.4 0 0 0 .212.346c.044.021.092.032.14.03h.768v2.925c0 .39.069.726.2 1.003.132.274.305.504.514.676.217.178.465.31.731.388.27.084.551.126.833.126.385 0 .75-.061 1.094-.18a2.13 2.13 0 0 0 .861-.552c.152-.181.17-.381.046-.581l-.463-.76zM121.672 2.89h-1.329a.339.339 0 0 0-.244.11.39.39 0 0 0-.08.122.394.394 0 0 0-.027.144v.166a1.906 1.906 0 0 0-.605-.472c-.335-.173-.726-.258-1.168-.258-.42 0-.834.083-1.226.249a3.24 3.24 0 0 0-1.055.715 3.528 3.528 0 0 0-.734 1.123 3.79 3.79 0 0 0-.276 1.477c0 .54.092 1.037.275 1.477.184.434.428.817.729 1.128a3.138 3.138 0 0 0 2.273.973 2.59 2.59 0 0 0 1.175-.259c.255-.13.457-.287.612-.471v.177a.34.34 0 0 0 .108.259.343.343 0 0 0 .243.104h1.329a.335.335 0 0 0 .252-.105.364.364 0 0 0 .102-.258V3.267a.38.38 0 0 0-.1-.262.332.332 0 0 0-.115-.087.311.311 0 0 0-.139-.028zM119.876 6.9a1.534 1.534 0 0 1-.786.855 1.362 1.362 0 0 1-.594.129c-.207 0-.405-.044-.588-.13a1.516 1.516 0 0 1-.792-.855 1.757 1.757 0 0 1-.113-.62c0-.225.037-.436.112-.632.073-.187.179-.358.314-.504.138-.143.3-.26.479-.342.184-.086.385-.13.588-.129.217 0 .415.044.594.13.181.085.34.2.472.341.134.143.24.313.314.504a1.73 1.73 0 0 1 0 1.253zM128.978 7.64l-.763-.593c-.146-.118-.284-.15-.404-.1a.742.742 0 0 0-.279.205 2.527 2.527 0 0 1-.583.535c-.192.122-.444.183-.742.183-.219 0-.42-.04-.6-.122a1.423 1.423 0 0 1-.469-.342 1.575 1.575 0 0 1-.308-.51 1.751 1.751 0 0 1-.106-.617c0-.228.034-.438.106-.632.07-.192.173-.363.308-.503.135-.144.295-.26.472-.342.187-.088.391-.132.597-.13.298 0 .547.064.742.187.198.126.396.306.584.534.078.092.17.16.278.206.122.048.259.016.401-.101l.762-.594a.53.53 0 0 0 .201-.269.437.437 0 0 0-.034-.365 3.329 3.329 0 0 0-1.18-1.127c-.504-.291-1.108-.441-1.784-.441a3.519 3.519 0 0 0-2.51 1.033c-.322.322-.576.71-.747 1.137a3.68 3.68 0 0 0-.273 1.407c0 .495.093.968.273 1.402.173.424.427.808.747 1.128a3.527 3.527 0 0 0 2.51 1.034c.676 0 1.28-.149 1.784-.444a3.286 3.286 0 0 0 1.182-1.13.411.411 0 0 0 .055-.173.415.415 0 0 0-.023-.182.624.624 0 0 0-.197-.273zM136.06 9.045l-2.104-3.143 1.801-2.415c.094-.139.119-.272.075-.397-.031-.09-.116-.2-.334-.2h-1.425a.52.52 0 0 0-.234.058.482.482 0 0 0-.209.205L132.191 5.2h-.349V.363a.37.37 0 0 0-.099-.26.352.352 0 0 0-.253-.103h-1.332a.37.37 0 0 0-.337.22.346.346 0 0 0-.027.143V9.29c0 .103.038.193.11.259a.353.353 0 0 0 .254.104h1.333a.328.328 0 0 0 .251-.105.346.346 0 0 0 .075-.119.333.333 0 0 0 .024-.14V6.927h.386l1.571 2.446c.112.187.267.281.46.281h1.491c.226 0 .32-.11.358-.202.054-.13.038-.262-.047-.406zM102.863 2.89h-1.489a.389.389 0 0 0-.298.122.544.544 0 0 0-.13.249l-1.099 4.167h-.268l-1.182-4.167a.66.66 0 0 0-.113-.247.329.329 0 0 0-.264-.124h-1.544c-.199 0-.325.066-.372.193a.588.588 0 0 0-.002.37l1.887 5.865c.03.093.08.17.145.232a.388.388 0 0 0 .281.104h.798l-.066.19-.19.547a.872.872 0 0 1-.29.426.7.7 0 0 1-.442.148.956.956 0 0 1-.4-.09 1.842 1.842 0 0 1-.35-.209.62.62 0 0 0-.335-.115h-.016c-.13 0-.243.074-.334.216l-.474.708c-.193.304-.086.504.039.615.234.224.528.399.875.524.344.125.723.186 1.126.186.682 0 1.252-.187 1.689-.565.435-.376.756-.887.952-1.524l2.188-7.258c.05-.155.05-.284.005-.389-.037-.08-.125-.174-.327-.174z\" fill=\"#011B33\"/>\n </svg>";
292
+ var secureByPaystackWhite = "\n <svg id=\"inline-button-wordmark--white\" width=\"137\" height=\"13\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M.037 5.095l1.075-.135c-.011-.774-.025-1.944-.013-2.149C1.19 1.364 2.38.134 3.81.013 3.9.006 3.99.002 4.077 0a2.947 2.947 0 0 1 2.046.76c.574.509.95 1.26 1.008 2.007.015.192.01 1.491.01 2.257l1.096.163L8.2 11.44 4.093 12 0 11.346l.037-6.251zm4.106-.514l1.724.256c-.007-.933-.05-2.295-.26-2.654-.319-.545-.846-.867-1.443-.88h-.063c-.607.008-1.138.322-1.458.864-.222.378-.266 1.66-.265 2.637l1.765-.223zM18.228 10.108c-.576 0-1.064-.072-1.464-.216a2.864 2.864 0 0 1-.972-.6 2.552 2.552 0 0 1-.588-.864 4.067 4.067 0 0 1-.252-1.044h1.008c.032.256.088.5.168.732.08.224.204.424.372.6.168.168.388.304.66.408.28.096.636.144 1.068.144.28 0 .536-.036.768-.108.24-.08.448-.192.624-.336.176-.144.312-.316.408-.516.104-.2.156-.42.156-.66 0-.24-.032-.448-.096-.624a1.02 1.02 0 0 0-.336-.468 1.885 1.885 0 0 0-.636-.324 6.4 6.4 0 0 0-1.008-.228 8.79 8.79 0 0 1-1.212-.276 3.246 3.246 0 0 1-.9-.432 1.982 1.982 0 0 1-.564-.672c-.128-.272-.192-.6-.192-.984 0-.328.068-.632.204-.912.136-.288.324-.536.564-.744.248-.208.54-.372.876-.492.336-.12.708-.18 1.116-.18.864 0 1.548.204 2.052.612.512.4.812.984.9 1.752h-.936c-.104-.544-.316-.932-.636-1.164-.32-.24-.78-.36-1.38-.36-.592 0-1.04.132-1.344.396a1.255 1.255 0 0 0-.444.996c0 .208.024.396.072.564.056.16.156.3.3.42.152.12.36.228.624.324a6.72 6.72 0 0 0 1.068.228c.48.072.9.168 1.26.288.36.12.664.276.912.468s.432.428.552.708c.128.28.192.624.192 1.032 0 .36-.076.696-.228 1.008a2.472 2.472 0 0 1-.612.804c-.264.224-.58.4-.948.528-.36.128-.752.192-1.176.192zM25.355 10.108c-.44 0-.848-.076-1.224-.228a2.916 2.916 0 0 1-.96-.636 2.966 2.966 0 0 1-.636-1.008 3.77 3.77 0 0 1-.216-1.308v-.096c0-.472.072-.904.216-1.296.144-.4.344-.74.6-1.02.264-.288.576-.508.936-.66.36-.16.756-.24 1.188-.24.36 0 .708.06 1.044.18.344.112.648.292.912.54.264.248.472.572.624.972.16.392.24.868.24 1.428v.324h-4.728c.024.72.204 1.272.54 1.656.336.376.828.564 1.476.564.984 0 1.54-.364 1.668-1.092h.996c-.112.632-.408 1.112-.888 1.44-.48.32-1.076.48-1.788.48zm1.704-3.852c-.048-.648-.232-1.112-.552-1.392-.312-.28-.728-.42-1.248-.42-.512 0-.932.164-1.26.492-.32.32-.524.76-.612 1.32h3.672zM32.091 10.108c-.44 0-.848-.072-1.224-.216a3.054 3.054 0 0 1-.972-.636 3.12 3.12 0 0 1-.648-1.008 3.626 3.626 0 0 1-.228-1.32v-.096c0-.48.08-.916.24-1.308.16-.4.376-.74.648-1.02.28-.28.604-.496.972-.648.376-.16.772-.24 1.188-.24.328 0 .644.04.948.12.312.08.588.208.828.384.248.168.456.392.624.672.168.28.276.62.324 1.02h-.984c-.08-.496-.284-.848-.612-1.056-.32-.208-.696-.312-1.128-.312a1.93 1.93 0 0 0-.804.168c-.24.112-.452.272-.636.48a2.23 2.23 0 0 0-.42.744 2.991 2.991 0 0 0-.156.996v.096c0 .776.188 1.364.564 1.764.384.392.88.588 1.488.588.224 0 .436-.032.636-.096a1.651 1.651 0 0 0 .96-.768c.112-.192.18-.416.204-.672h.924a2.595 2.595 0 0 1-.276.948 2.386 2.386 0 0 1-.576.744c-.24.208-.52.372-.84.492-.32.12-.668.18-1.044.18zM38.335 10.108a2.83 2.83 0 0 1-.876-.132 1.724 1.724 0 0 1-.684-.42 2.145 2.145 0 0 1-.456-.756c-.112-.304-.168-.672-.168-1.104V3.724h.996v3.924c0 .552.116.956.348 1.212.24.256.608.384 1.104.384.224 0 .44-.036.648-.108.208-.072.392-.18.552-.324.16-.144.288-.324.384-.54.096-.216.144-.464.144-.744V3.724h.996V10h-.996v-.996c-.144.296-.388.556-.732.78-.336.216-.756.324-1.26.324zM43.216 3.724h.996v1.128c.2-.352.452-.64.756-.864.312-.232.748-.356 1.308-.372v.936a4.461 4.461 0 0 0-.852.12 1.647 1.647 0 0 0-.66.324 1.472 1.472 0 0 0-.408.612c-.096.248-.144.564-.144.948V10h-.996V3.724zM50 10.108c-.44 0-.848-.076-1.224-.228a2.916 2.916 0 0 1-.96-.636 2.966 2.966 0 0 1-.636-1.008 3.77 3.77 0 0 1-.216-1.308v-.096c0-.472.072-.904.216-1.296.144-.4.344-.74.6-1.02.264-.288.576-.508.936-.66.36-.16.756-.24 1.188-.24.36 0 .708.06 1.044.18.344.112.648.292.912.54.264.248.472.572.624.972.16.392.24.868.24 1.428v.324h-4.728c.024.72.204 1.272.54 1.656.336.376.828.564 1.476.564.984 0 1.54-.364 1.668-1.092h.996c-.112.632-.408 1.112-.888 1.44-.48.32-1.076.48-1.788.48zm1.704-3.852c-.048-.648-.232-1.112-.552-1.392-.312-.28-.728-.42-1.248-.42-.512 0-.932.164-1.26.492-.32.32-.524.76-.612 1.32h3.672zM56.496 10.108c-.408 0-.788-.068-1.14-.204a2.683 2.683 0 0 1-.9-.612 3.01 3.01 0 0 1-.588-.984 4.01 4.01 0 0 1-.204-1.32v-.096c0-.48.072-.92.216-1.32.144-.4.344-.744.6-1.032.256-.296.564-.524.924-.684.36-.16.756-.24 1.188-.24.528 0 .956.112 1.284.336.328.216.584.476.768.78V.724h.996V10h-.996V8.92c-.088.152-.208.3-.36.444a2.792 2.792 0 0 1-.516.384 2.874 2.874 0 0 1-.6.252c-.216.072-.44.108-.672.108zm.108-.828c.288 0 .56-.048.816-.144.256-.096.476-.24.66-.432.184-.2.328-.448.432-.744.112-.304.168-.656.168-1.056v-.096c0-.808-.18-1.404-.54-1.788-.352-.384-.836-.576-1.452-.576-.624 0-1.112.208-1.464.624-.352.416-.528 1.008-.528 1.776v.096c0 .392.048.736.144 1.032.104.296.24.54.408.732.176.192.38.336.612.432.232.096.48.144.744.144zM67.712 10.108c-.512 0-.948-.112-1.308-.336a2.38 2.38 0 0 1-.816-.804V10h-.996V.724h.996V4.78a1.92 1.92 0 0 1 .348-.432c.152-.144.32-.268.504-.372.192-.112.396-.2.612-.264.216-.064.436-.096.66-.096.408 0 .788.072 1.14.216.352.144.652.352.9.624.256.272.456.604.6.996.144.392.216.832.216 1.32v.096c0 .48-.068.92-.204 1.32a3.103 3.103 0 0 1-.576 1.02 2.583 2.583 0 0 1-.9.672 2.937 2.937 0 0 1-1.176.228zm-.096-.828c.624 0 1.1-.2 1.428-.6.328-.408.492-.996.492-1.764V6.82c0-.4-.052-.748-.156-1.044a2.095 2.095 0 0 0-.42-.732 1.53 1.53 0 0 0-.612-.444 1.798 1.798 0 0 0-.744-.156c-.288 0-.56.048-.816.144a1.71 1.71 0 0 0-.648.444c-.184.192-.328.44-.432.744a3.152 3.152 0 0 0-.156 1.044v.096c0 .8.192 1.396.576 1.788.384.384.88.576 1.488.576zM73.63 9.352l-2.46-5.628h1.068l1.92 4.5 1.74-4.5h1.02l-3.468 8.46h-1.008l1.188-2.832zM87.127 3.669A3.138 3.138 0 0 0 86.1 2.95a3.09 3.09 0 0 0-1.228-.25c-.448 0-.848.086-1.187.26a2.199 2.199 0 0 0-.662.497v-.191a.387.387 0 0 0-.214-.348.323.323 0 0 0-.14-.03h-1.315a.314.314 0 0 0-.254.116.377.377 0 0 0-.1.262v8.97c0 .1.034.188.1.258a.34.34 0 0 0 .254.103h1.341a.342.342 0 0 0 .244-.103.336.336 0 0 0 .11-.259v-3.06c.178.202.417.357.702.464.35.134.72.203 1.093.203.43 0 .848-.082 1.242-.248a3.124 3.124 0 0 0 1.04-.724c.305-.326.545-.709.707-1.128a3.93 3.93 0 0 0 .263-1.477c0-.54-.086-1.037-.263-1.477a3.387 3.387 0 0 0-.706-1.12zm-1.204 3.24c-.073.19-.18.362-.315.51a1.415 1.415 0 0 1-1.065.466c-.2.001-.4-.04-.584-.12a1.484 1.484 0 0 1-.49-.346 1.593 1.593 0 0 1-.32-.51 1.738 1.738 0 0 1-.115-.63c0-.224.04-.435.115-.631a1.532 1.532 0 0 1 .804-.846c.185-.086.386-.13.59-.129.215 0 .414.044.593.13.177.083.338.199.474.341a1.622 1.622 0 0 1 .425 1.135c0 .225-.037.436-.112.63zM95.298 2.89h-1.33a.339.339 0 0 0-.246.11.384.384 0 0 0-.108.266v.166a1.856 1.856 0 0 0-.602-.472 2.525 2.525 0 0 0-1.166-.258 3.227 3.227 0 0 0-2.284.964 3.554 3.554 0 0 0-.734 1.123 3.827 3.827 0 0 0-.275 1.477c0 .54.092 1.037.275 1.477.184.434.427.817.728 1.128a3.146 3.146 0 0 0 2.277.973c.437 0 .834-.088 1.173-.259.25-.13.456-.287.608-.471v.177a.34.34 0 0 0 .11.259.341.341 0 0 0 .244.104h1.33a.324.324 0 0 0 .25-.105.349.349 0 0 0 .102-.258V3.267a.377.377 0 0 0-.1-.262.325.325 0 0 0-.252-.115zM93.502 6.9a1.55 1.55 0 0 1-.312.511c-.136.143-.296.26-.473.344-.178.085-.38.129-.596.129-.207 0-.407-.044-.59-.13a1.501 1.501 0 0 1-.791-.855 1.766 1.766 0 0 1-.112-.62c0-.225.038-.436.112-.632.075-.193.181-.364.314-.504.137-.143.3-.26.478-.342.182-.085.382-.129.59-.129.215 0 .417.044.595.13.178.085.338.2.473.341a1.623 1.623 0 0 1 .424 1.135c0 .215-.037.424-.112.622zM108.567 6.094a2.265 2.265 0 0 0-.654-.402c-.247-.101-.509-.181-.785-.235l-1.014-.204c-.26-.05-.441-.117-.543-.203a.328.328 0 0 1-.136-.264c0-.11.063-.2.189-.282.137-.086.329-.13.566-.13.26 0 .518.053.757.157.243.106.471.226.67.36.295.187.546.162.727-.053l.487-.57a.543.543 0 0 0 .152-.357c0-.128-.064-.245-.185-.351-.207-.184-.533-.378-.971-.568-.437-.192-.987-.29-1.637-.29-.427 0-.82.058-1.168.172-.35.116-.65.276-.893.474-.245.204-.438.44-.57.713a2 2 0 0 0-.198.875c0 .56.167 1.017.496 1.358.328.333.766.56 1.304.67l1.054.232c.3.062.528.132.675.21.129.067.19.163.19.297 0 .12-.061.227-.188.324-.133.104-.342.155-.622.155a1.83 1.83 0 0 1-.831-.19 3.056 3.056 0 0 1-.678-.458.995.995 0 0 0-.307-.17c-.126-.037-.268.003-.431.13l-.583.461c-.169.145-.24.32-.209.522.029.194.19.394.491.62.269.193.614.368 1.029.518.415.151.901.229 1.453.229.444 0 .854-.058 1.215-.172.362-.119.681-.278.941-.48a2.056 2.056 0 0 0 .819-1.663c0-.319-.053-.6-.165-.836a1.843 1.843 0 0 0-.447-.6zM114.383 7.73a.363.363 0 0 0-.295-.192.55.55 0 0 0-.343.113c-.095.062-.198.11-.306.141a.75.75 0 0 1-.426.013.43.43 0 0 1-.181-.093.554.554 0 0 1-.143-.204.92.92 0 0 1-.059-.362v-2.46h1.731c.099 0 .188-.04.266-.117a.368.368 0 0 0 .112-.26V3.268a.369.369 0 0 0-.115-.268.38.38 0 0 0-.263-.109h-1.732V1.216a.354.354 0 0 0-.108-.27.347.347 0 0 0-.243-.104h-1.344a.36.36 0 0 0-.34.226.371.371 0 0 0-.027.148V2.89h-.767a.324.324 0 0 0-.255.115.385.385 0 0 0-.098.262V4.31a.4.4 0 0 0 .212.346c.044.021.092.032.14.03h.768v2.925c0 .39.069.726.2 1.003.132.274.305.504.514.676.217.178.465.31.731.388.27.084.551.126.833.126.385 0 .75-.061 1.094-.18a2.13 2.13 0 0 0 .861-.552c.152-.181.17-.381.046-.581l-.463-.76zM121.672 2.89h-1.329a.339.339 0 0 0-.244.11.39.39 0 0 0-.08.122.394.394 0 0 0-.027.144v.166a1.906 1.906 0 0 0-.605-.472c-.335-.173-.726-.258-1.168-.258-.42 0-.834.083-1.226.249a3.24 3.24 0 0 0-1.055.715 3.528 3.528 0 0 0-.734 1.123 3.79 3.79 0 0 0-.276 1.477c0 .54.092 1.037.275 1.477.184.434.428.817.729 1.128a3.138 3.138 0 0 0 2.273.973 2.59 2.59 0 0 0 1.175-.259c.255-.13.457-.287.612-.471v.177a.34.34 0 0 0 .108.259.343.343 0 0 0 .243.104h1.329a.335.335 0 0 0 .252-.105.364.364 0 0 0 .102-.258V3.267a.38.38 0 0 0-.1-.262.332.332 0 0 0-.115-.087.311.311 0 0 0-.139-.028zM119.876 6.9a1.534 1.534 0 0 1-.786.855 1.362 1.362 0 0 1-.594.129c-.207 0-.405-.044-.588-.13a1.516 1.516 0 0 1-.792-.855 1.757 1.757 0 0 1-.113-.62c0-.225.037-.436.112-.632.073-.187.179-.358.314-.504.138-.143.3-.26.479-.342.184-.086.385-.13.588-.129.217 0 .415.044.594.13.181.085.34.2.472.341.134.143.24.313.314.504a1.73 1.73 0 0 1 0 1.253zM128.978 7.64l-.763-.593c-.146-.118-.284-.15-.404-.1a.742.742 0 0 0-.279.205 2.527 2.527 0 0 1-.583.535c-.192.122-.444.183-.742.183-.219 0-.42-.04-.6-.122a1.423 1.423 0 0 1-.469-.342 1.575 1.575 0 0 1-.308-.51 1.751 1.751 0 0 1-.106-.617c0-.228.034-.438.106-.632.07-.192.173-.363.308-.503.135-.144.295-.26.472-.342.187-.088.391-.132.597-.13.298 0 .547.064.742.187.198.126.396.306.584.534.078.092.17.16.278.206.122.048.259.016.401-.101l.762-.594a.53.53 0 0 0 .201-.269.437.437 0 0 0-.034-.365 3.329 3.329 0 0 0-1.18-1.127c-.504-.291-1.108-.441-1.784-.441a3.519 3.519 0 0 0-2.51 1.033c-.322.322-.576.71-.747 1.137a3.68 3.68 0 0 0-.273 1.407c0 .495.093.968.273 1.402.173.424.427.808.747 1.128a3.527 3.527 0 0 0 2.51 1.034c.676 0 1.28-.149 1.784-.444a3.286 3.286 0 0 0 1.182-1.13.411.411 0 0 0 .055-.173.415.415 0 0 0-.023-.182.624.624 0 0 0-.197-.273zM136.06 9.045l-2.104-3.143 1.801-2.415c.094-.139.119-.272.075-.397-.031-.09-.116-.2-.334-.2h-1.425a.52.52 0 0 0-.234.058.482.482 0 0 0-.209.205L132.191 5.2h-.349V.363a.37.37 0 0 0-.099-.26.352.352 0 0 0-.253-.103h-1.332a.37.37 0 0 0-.337.22.346.346 0 0 0-.027.143V9.29c0 .103.038.193.11.259a.353.353 0 0 0 .254.104h1.333a.328.328 0 0 0 .251-.105.346.346 0 0 0 .075-.119.333.333 0 0 0 .024-.14V6.927h.386l1.571 2.446c.112.187.267.281.46.281h1.491c.226 0 .32-.11.358-.202.054-.13.038-.262-.047-.406zM102.863 2.89h-1.489a.389.389 0 0 0-.298.122.544.544 0 0 0-.13.249l-1.099 4.167h-.268l-1.182-4.167a.66.66 0 0 0-.113-.247.329.329 0 0 0-.264-.124h-1.544c-.199 0-.325.066-.372.193a.588.588 0 0 0-.002.37l1.887 5.865c.03.093.08.17.145.232a.388.388 0 0 0 .281.104h.798l-.066.19-.19.547a.872.872 0 0 1-.29.426.7.7 0 0 1-.442.148.956.956 0 0 1-.4-.09 1.842 1.842 0 0 1-.35-.209.62.62 0 0 0-.335-.115h-.016c-.13 0-.243.074-.334.216l-.474.708c-.193.304-.086.504.039.615.234.224.528.399.875.524.344.125.723.186 1.126.186.682 0 1.252-.187 1.689-.565.435-.376.756-.887.952-1.524l2.188-7.258c.05-.155.05-.284.005-.389-.037-.08-.125-.174-.327-.174z\" fill=\"#ffffff\"/>\n </svg>\n";
293
+
294
+ var APPLE_PAY_SDK_SOURCE = 'https://applepay.cdn-apple.com/jsapi/v1.1.0/apple-pay-sdk.js';
295
+ var APPLE_PAY_SDK_INTEGRITY_HASH = 'sha384-z/6BVHCcSypLSykOVpaT1PQWHOOgU45uOOlMkgi/bElX4yFqmChNMb7qiv80wFav';
296
+ var GOOGLE_PAY_SDK_SOURCE = 'https://pay.google.com/gp/p/js/pay.js';
297
+ var PAYMENT_REQUEST_BUTTON_HEIGHT = '50px';
298
+ var GOOGLE_PAY_BUTTON_RADIUS = 3;
299
+ var PAYMENT_REQUEST_BUTTON_ORIENTATION = {
300
+ HORIZONTAL: 'horizontal',
301
+ VERTICAL: 'vertical'
302
+ };
303
+ var PAYMENT_REQUEST_BUTTON_THEME = {
304
+ LIGHT: 'light',
305
+ DARK: 'dark'
306
+ };
307
+ var CHANNELS = {
308
+ APPLE_PAY: 'apple_pay',
309
+ GOOGLE_PAY: 'google_pay'
310
+ };
311
+ var TRANSACTION_STATUS = {
312
+ SUCCESS: 'success',
313
+ FAILED: 'failed',
314
+ AUTH: 'auth'
315
+ };
316
+ var TRANSACTION_DOMAIN = {
317
+ TEST: 'test',
318
+ LIVE: 'live'
319
+ };
320
+ var ENVIRONMENT = {
321
+ DEV: 'dev',
322
+ STAGING: 'staging',
323
+ PRODUCTION: 'production'
324
+ };
325
+ var GOOGLE_PAY_STATUS_CODE = {
326
+ CANCELED: 'CANCELED',
327
+ DEVELOPER_ERROR: 'DEVELOPER_ERROR',
328
+ MERCHANT_ACCOUNT_ERROR: 'MERCHANT_ACCOUNT_ERROR'
329
+ };
330
+ var GOOGLE_PAY_TIMEOUT_MS = 10000;
331
+ var CURRENCY_COUNTRYCODE_MAPPING = {
332
+ NGN: 'NG',
333
+ GHS: 'GH',
334
+ KES: 'KE',
335
+ ZAR: 'ZA',
336
+ XOF: 'CI',
337
+ EGP: 'EG'
338
+ };
339
+
340
+ 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";
341
+ 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";
342
+ var checkoutCSS = "\n z-index: 999999999999999;\n background: transparent;\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 visibility: hidden;\n display: none;\n height: 100%;\n";
343
+ var embedCSS = "\n background: transparent;\n background: rgba(0,0,0,0);\n border: 0px none transparent;\n overflow-x: hidden;\n overflow-y: hidden;\n nmargin: 0;\n padding: 0;\n -webkit-tap-highlight-color: transparent;\n -webkit-touch-callout: none;\n left: 0;\n top: 0;\n width: 100%;\n height: 100%;\n visibility: hidden;\n display: none;\n";
344
+ function generateInlineButtonCSS(variant) {
345
+ var baseCSS = "\n box-sizing: border-box;\n display: inline-block;\n line-height: 1;\n white-space: nowrap;\n margin: 0 0 10px;\n text-align: center;\n -webkit-appearance: none;\n outline: none;\n font-size: 14px;\n font-weight: 600;\n border-radius: 6px;\n cursor: pointer;\n padding: 16px 24px;\n box-shadow: 0px 1px 4px rgba(0, 0, 0, 0.15);\n transition: all .3s ease;\n border: none;\n min-width: 190px;\n ";
346
+ var greenCSS = "\n background: linear-gradient(180deg,#44b669 0,#40ad57);\n text-shadow: 1px 1px 1px rgba(0,0,0,.1);\n color: #ffffff;\n ";
347
+ var whiteCSS = "\n background: white;\n text-shadow: none;\n color: #011b33;\n ";
348
+ var colorVariants = {
349
+ normal: greenCSS,
350
+ light: whiteCSS
351
+ };
352
+ return "".concat(baseCSS).concat(colorVariants[variant]);
353
+ }
354
+ function generateInlineButtonHTML(options) {
355
+ var wordmarkVariants = {
356
+ normal: secureByPaystack,
357
+ light: secureByPaystackWhite
358
+ };
359
+ var buttonHTML = "\n <style>\n #inline-button-".concat(options.inlineId, " {\n position: relative;\n text-align: center;\n display: inline-block;\n }\n #inline-button-").concat(options.inlineId, "__trigger {\n ").concat(generateInlineButtonCSS(options.variant || 'normal'), "\n }\n #inline-button-").concat(options.inlineId, "__trigger:hover {\n box-shadow: 0px 4px 12px rgba(0, 0, 0, 0.2);\n }\n #inline-button-").concat(options.inlineId, "__trigger:active {\n transform: translateY(3px);\n }\n </style>\n <button id=\"inline-button-").concat(options.inlineId, "__trigger\" data-inline-id=\"").concat(options.inlineId, "\">").concat(options.text || 'Pay', " ").concat(options.currency || 'NGN', " ").concat(options.amount, "</button>\n <div id=\"inline-button-").concat(options.inlineId, "__wordmark\">\n ").concat(wordmarkVariants[options.wordmarkVariant || 'normal'], "\n </div>\n ");
360
+ return buttonHTML;
361
+ }
362
+ var defaultCustomApplePayStyles = {
363
+ height: PAYMENT_REQUEST_BUTTON_HEIGHT,
364
+ width: 'auto',
365
+ borderRadius: '3px',
366
+ padding: '10px',
367
+ locale: 'en',
368
+ type: 'pay'
369
+ };
370
+ var parseApplePayCustomStyles = function parseApplePayCustomStyles(styles) {
371
+ if (!(styles && _typeof(styles) === 'object')) {
372
+ return defaultCustomApplePayStyles;
373
+ }
374
+ var customStyles = Object.keys(defaultCustomApplePayStyles).reduce(function (newDefaultStyles, key) {
375
+ return _objectSpread2(_objectSpread2({}, newDefaultStyles), {}, _defineProperty({}, key, styles[key] || defaultCustomApplePayStyles[key]));
376
+ }, {});
377
+ return customStyles;
378
+ };
379
+ var generateApplePayCSS = function generateApplePayCSS(_ref) {
380
+ var height = _ref.height,
381
+ width = _ref.width,
382
+ borderRadius = _ref.borderRadius,
383
+ padding = _ref.padding;
384
+ return "\n apple-pay-button {\n --apple-pay-button-width: ".concat(width, ";\n --apple-pay-button-height: ").concat(height, ";\n --apple-pay-button-border-radius: ").concat(borderRadius, ";\n --apple-pay-button-padding: ").concat(padding, ";\n --apple-pay-button-box-sizing: border-box;\n width: ").concat(width, ";\n }\n");
385
+ };
386
+ var generateApplePayFallbackCSS = function generateApplePayFallbackCSS(_ref2) {
387
+ var height = _ref2.height,
388
+ width = _ref2.width,
389
+ borderRadius = _ref2.borderRadius,
390
+ padding = _ref2.padding,
391
+ type = _ref2.type,
392
+ locale = _ref2.locale;
393
+ 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");
394
+ };
395
+ var generatePaymentRequestInnerWrapperCSS = function generatePaymentRequestInnerWrapperCSS(orientation) {
396
+ var isVertical = orientation === PAYMENT_REQUEST_BUTTON_ORIENTATION.VERTICAL;
397
+ return "\n #paystack-payment-request-inner-wrapper {\n display: flex;\n flex-direction: ".concat(isVertical ? 'column' : 'row', ";\n gap: 8px;\n width: 100%;\n max-width: 100%;\n }\n\n #paystack-payment-request-inner-wrapper > * {\n min-width: 0;\n ").concat(isVertical ? '' : 'flex: 1 1 0;', "\n }\n\n #paystack-payment-request-inner-wrapper > apple-pay-button,\n #paystack-payment-request-inner-wrapper > #apple-pay-button {\n order: 1;\n }\n #paystack-payment-request-inner-wrapper > #google-pay-button-container {\n order: 2;\n }\n");
398
+ };
399
+ var generateGooglePayCSS = function generateGooglePayCSS() {
400
+ var _ref3 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
401
+ height = _ref3.height,
402
+ width = _ref3.width;
403
+ return "\n #google-pay-button-container {\n width: ".concat(width || 'auto', ";\n height: ").concat(height || PAYMENT_REQUEST_BUTTON_HEIGHT, ";\n overflow: hidden;\n }\n #google-pay-button-container:empty {\n display: none;\n }\n #google-pay-button-container > div,\n #google-pay-button-container button,\n #google-pay-button-container iframe {\n width: 100%;\n max-width: 100%;\n height: 100%;\n min-width: 100%;\n }\n #google-pay-button-container button {\n outline: none !important;\n }\n");
404
+ };
405
+ var generateGooglePayLoadingCSS = function generateGooglePayLoadingCSS() {
406
+ var _ref4 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
407
+ borderRadius = _ref4.borderRadius,
408
+ buttonColor = _ref4.buttonColor;
409
+ var isWhite = buttonColor === 'white';
410
+ return "\n #google-pay-loading-button {\n width: 100%;\n height: 100%;\n border: ".concat(isWhite ? '1px solid #3C4043' : 'none', ";\n border-radius: ").concat(borderRadius === undefined ? GOOGLE_PAY_BUTTON_RADIUS : borderRadius, "px;\n background: ").concat(isWhite ? '#ffffff' : '#000000', ";\n cursor: default;\n display: flex;\n align-items: center;\n justify-content: center;\n }\n #google-pay-loading-button__spinner {\n width: 18px;\n height: 18px;\n border: 2px solid ").concat(isWhite ? 'rgba(60, 64, 67, 0.25)' : 'rgba(255, 255, 255, 0.35)', ";\n border-top-color: ").concat(isWhite ? '#3c4043' : '#ffffff', ";\n border-radius: 50%;\n animation: google-pay-spin 0.8s linear infinite;\n }\n @keyframes google-pay-spin {\n to { transform: rotate(360deg); }\n }\n");
411
+ };
412
+ function appendCSS(container, css) {
413
+ var style = document.createElement('style');
414
+ style.type = 'text/css';
415
+ style.textContent = css;
416
+ container.appendChild(style);
417
+ }
418
+
419
+ var amountSubunitToBase = function amountSubunitToBase() {
420
+ var amount = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
421
+ return Number(parseFloat(amount / 100).toFixed(2));
422
+ };
423
+
424
+ /* eslint-disable prefer-promise-reject-errors */
425
+ /* eslint-env browser */
426
+
427
+ var loadScript = function loadScript(url) {
428
+ var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
429
+ container = _ref.container,
430
+ integrity = _ref.integrity;
431
+ return new Promise(function (resolve, reject) {
432
+ if (!url) {
433
+ reject('No script url');
434
+ }
435
+ var script = document.createElement('script');
436
+ script.src = url;
437
+ if (integrity) {
438
+ script.crossOrigin = 'anonymous';
439
+ script.integrity = integrity;
440
+ }
441
+ script.addEventListener('load', function () {
442
+ resolve(true);
443
+ });
444
+ script.addEventListener('error', function () {
445
+ script.remove();
446
+ reject(false);
447
+ });
448
+ if (container) {
449
+ container.appendChild(script);
450
+ } else {
451
+ document.head.appendChild(script);
452
+ }
453
+ });
454
+ };
455
+
456
+ var requestConfig = {
457
+ headers: {
458
+ accept: 'application/json, text/plain, */*',
459
+ 'accept-language': 'en-GB,en-US;q=0.9,en;q=0.8',
460
+ 'content-type': 'application/x-www-form-urlencoded',
461
+ 'sec-ch-ua-mobile': '?0',
462
+ 'sec-fetch-dest': 'empty',
463
+ 'sec-fetch-mode': 'cors',
464
+ 'sec-fetch-site': 'cross-site'
465
+ },
466
+ referrerPolicy: 'no-referrer-when-downgrade',
467
+ method: 'POST',
468
+ mode: 'cors',
469
+ credentials: 'omit'
470
+ };
471
+ function createFormBody(params) {
472
+ var formBody = Object.keys(params).reduce(function (formBodyArray, key) {
473
+ var encodedKey = encodeURIComponent(key);
474
+ var encodedValue = encodeURIComponent(params[key]);
475
+ var encodedFormBody = "".concat(encodedKey, "=").concat(encodedValue);
476
+ return [].concat(_toConsumableArray(formBodyArray), [encodedFormBody]);
477
+ }, []);
478
+ return formBody.join('&');
479
+ }
480
+ var formatIntervalString = function formatIntervalString(interval) {
481
+ var plans = {
482
+ biannually: 'BIANNUAL PLAN',
483
+ annually: 'ANNUAL PLAN'
484
+ };
485
+ return plans[interval] || "".concat(interval.toUpperCase(), " PLAN");
486
+ };
487
+ var generateApplePaymentRequestObject = function generateApplePaymentRequestObject(_ref) {
488
+ var currency = _ref.currency,
489
+ amount = _ref.amount,
490
+ merchantName = _ref.merchantName,
491
+ interval = _ref.interval;
492
+ return _objectSpread2({
493
+ countryCode: 'NG',
494
+ currencyCode: currency,
495
+ merchantCapabilities: ['supports3DS', 'supportsCredit', 'supportsDebit'],
496
+ supportedNetworks: ['visa', 'masterCard'],
497
+ requiredBillingContactFields: ['postalAddress', 'name', 'phone', 'email'],
498
+ total: {
499
+ label: "".concat(merchantName, " - Paystack"),
500
+ type: 'final',
501
+ amount: String(amountSubunitToBase(amount))
502
+ }
503
+ }, typeof interval === 'string' && interval.trim() !== '' && {
504
+ lineItems: [{
505
+ label: formatIntervalString(interval),
506
+ amount: String(amountSubunitToBase(amount))
507
+ }]
508
+ });
509
+ };
510
+ var validateApplePaySession = function validateApplePaySession(_ref2) {
511
+ var transactionId = _ref2.transactionId,
512
+ validationURL = _ref2.validationURL,
513
+ merchantName = _ref2.merchantName,
514
+ _ref2$domainName = _ref2.domainName,
515
+ domainName = _ref2$domainName === void 0 ? window && window.location && window.location.hostname : _ref2$domainName;
516
+ var validateSessionUrl = "".concat(config.paymentBaseUrl).concat(config.applePayValidateSessionPath);
517
+ var params = {
518
+ transaction: transactionId,
519
+ sessionUrl: validationURL,
520
+ displayName: merchantName,
521
+ domainName: domainName
522
+ };
523
+ var formBody = createFormBody(params);
524
+ var validateSession = fetch(validateSessionUrl, _objectSpread2(_objectSpread2({}, requestConfig), {}, {
525
+ body: formBody
526
+ })).then(function (response) {
527
+ return response.json();
528
+ });
529
+ return validateSession;
530
+ };
531
+ var chargeApplePay = function chargeApplePay(_ref3) {
532
+ var transactionId = _ref3.transactionId,
533
+ payment = _ref3.payment;
534
+ var chargeApplePayUrl = "".concat(config.paymentBaseUrl).concat(config.applePayChargePath);
535
+ var params = {
536
+ transaction: transactionId,
537
+ paymentObject: JSON.stringify(payment)
538
+ };
539
+ var formBody = createFormBody(params);
540
+ var charge = fetch(chargeApplePayUrl, _objectSpread2(_objectSpread2({}, requestConfig), {}, {
541
+ body: formBody
542
+ })).then(function (response) {
543
+ return response.json();
544
+ });
545
+ return charge;
546
+ };
547
+ var deviceSupportsApplePay = function deviceSupportsApplePay() {
548
+ try {
549
+ return window.isSecureContext && window.ApplePaySession && window.ApplePaySession.supportsVersion(config.applePayVersion);
550
+ } catch (error) {
551
+ return false;
552
+ }
553
+ };
554
+ var canUseApplePay = function canUseApplePay() {
555
+ var channels = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
556
+ return deviceSupportsApplePay() && channels.includes(CHANNELS.APPLE_PAY);
557
+ };
558
+ var loadApplePay = function loadApplePay() {
559
+ return loadScript(APPLE_PAY_SDK_SOURCE, {
560
+ integrity: APPLE_PAY_SDK_INTEGRITY_HASH
561
+ }).then(function () {
562
+ /**
563
+ * The Apple Pay SDK expects `window.webpackJsonp` to be array-like
564
+ * but we have seen instances where that is not the case, causing the SDK to throw errors
565
+ * so in this scenario, we opt out of using the SDK
566
+ */
567
+ if (window && !Array.isArray(window.webpackJsonp)) {
568
+ throw new Error("Incorrect data type for 'webpackJsonp', expected array, got ".concat(_typeof(window.webpackJsonp), ". Switching to fallback apple pay button"));
569
+ }
570
+ });
571
+ };
572
+
573
+ var getChannelAmount = function getChannelAmount(response, channel) {
574
+ var channelFees = (response && response.channel_fees_and_amount || {})[channel];
575
+ var amount = channelFees && channelFees.amount;
576
+ return amount == null ? response && response.amount : amount;
577
+ };
578
+
579
+ // eslint-disable-next-line no-console
580
+ var logWarning = console ? console.warn || console.log : function () {};
581
+ function printDeprecationNotice(oldName, newName, extraMessage) {
582
+ logWarning("\"".concat(oldName, "\" has been deprecated, please use \"").concat(newName, "\". ").concat(extraMessage || ''));
583
+ }
584
+
585
+ var withTimeoutDeadline = function withTimeoutDeadline(promise, onTimeout, timeoutMs) {
586
+ var timeoutId;
587
+ var deadline = new Promise(function (resolve) {
588
+ timeoutId = setTimeout(function () {
589
+ try {
590
+ resolve(onTimeout());
591
+ } catch (_unused) {
592
+ resolve(null);
593
+ }
594
+ }, timeoutMs);
595
+ });
596
+ return Promise.race([promise, deadline]).then(function (value) {
597
+ clearTimeout(timeoutId);
598
+ return value;
599
+ }, function (error) {
600
+ clearTimeout(timeoutId);
601
+ throw error;
602
+ });
603
+ };
604
+
605
+ /**
606
+ * Never advertised here: a `PAN_ONLY` charge comes back needing a 3DS step-up,
607
+ * and inline-js can't handle it
608
+ */
609
+ var UNSUPPORTED_AUTH_METHODS = ['PAN_ONLY'];
610
+ var paymentsClient = null;
611
+ var paymentsClientEnvironment = null;
612
+ var getGooglePayConfig = function getGooglePayConfig(transaction) {
613
+ var response = transaction && transaction.response;
614
+ var channelSettings = response && response.channel_settings;
615
+ return channelSettings && channelSettings[CHANNELS.GOOGLE_PAY] || null;
616
+ };
617
+ var getSupportedAuthMethods = function getSupportedAuthMethods(googlePayConfig) {
618
+ return (googlePayConfig && googlePayConfig.allowed_card_auth_methods || []).filter(function (authMethod) {
619
+ return !UNSUPPORTED_AUTH_METHODS.includes(authMethod);
620
+ });
621
+ };
622
+ var resolveGooglePayEnvironment = function resolveGooglePayEnvironment(response) {
623
+ var isTest = !!response && response.domain === TRANSACTION_DOMAIN.TEST;
624
+ return config.environment === ENVIRONMENT.PRODUCTION && !isTest ? 'PRODUCTION' : 'TEST';
625
+ };
626
+ var getGooglePayClient = function getGooglePayClient(environment) {
627
+ if (!paymentsClient || paymentsClientEnvironment !== environment) {
628
+ paymentsClient = new window.google.payments.api.PaymentsClient({
629
+ environment: environment
630
+ });
631
+ paymentsClientEnvironment = environment;
632
+ }
633
+ return paymentsClient;
634
+ };
635
+ var hasGooglePaySDKLoaded = function hasGooglePaySDKLoaded() {
636
+ return !!(window.google && window.google.payments && window.google.payments.api && window.google.payments.api.PaymentsClient);
637
+ };
638
+ var buildBaseRequest = function buildBaseRequest(googlePayConfig) {
639
+ return {
640
+ apiVersion: googlePayConfig.api_version.major,
641
+ apiVersionMinor: googlePayConfig.api_version.minor
642
+ };
643
+ };
644
+ var buildCardPaymentMethod = function buildCardPaymentMethod(googlePayConfig, authMethods) {
645
+ return {
646
+ type: 'CARD',
647
+ parameters: {
648
+ allowedAuthMethods: authMethods,
649
+ allowedCardNetworks: googlePayConfig.allowed_card_networks,
650
+ billingAddressRequired: true,
651
+ billingAddressParameters: googlePayConfig.billing_address_parameters,
652
+ assuranceDetailsRequired: true
653
+ }
654
+ };
655
+ };
656
+ var buildMerchantInfo = function buildMerchantInfo(googlePayConfig) {
657
+ var merchantInfo = googlePayConfig.merchant_info || {};
658
+ return {
659
+ merchantId: merchantInfo.merchantId,
660
+ merchantName: merchantInfo.merchantName,
661
+ merchantOrigin: merchantInfo.merchantOrigin
662
+ };
663
+ };
664
+ var warnOnOriginMismatch = function warnOnOriginMismatch(googlePayConfig) {
665
+ var registeredOrigin = googlePayConfig.merchant_info && googlePayConfig.merchant_info.merchantOrigin;
666
+ var hostname = window.location.hostname;
667
+ if (registeredOrigin && registeredOrigin !== hostname) {
668
+ logWarning("Google Pay: the registered merchantOrigin (\"".concat(registeredOrigin, "\") does not match this page (\"").concat(hostname, "\"). Google may reject the payment sheet. Update the domain in Dashboard > Developers > Google Pay."));
669
+ }
670
+ };
671
+ var buildPaymentDataRequest = function buildPaymentDataRequest(transaction) {
672
+ var googlePayConfig = getGooglePayConfig(transaction);
673
+ var response = transaction.response;
674
+ var authMethods = getSupportedAuthMethods(googlePayConfig);
675
+ return _objectSpread2(_objectSpread2({}, buildBaseRequest(googlePayConfig)), {}, {
676
+ allowedPaymentMethods: [_objectSpread2(_objectSpread2({}, buildCardPaymentMethod(googlePayConfig, authMethods)), {}, {
677
+ tokenizationSpecification: googlePayConfig.tokenization_specification
678
+ })],
679
+ transactionInfo: {
680
+ totalPriceStatus: 'FINAL',
681
+ totalPrice: amountSubunitToBase(getChannelAmount(response, CHANNELS.GOOGLE_PAY)).toFixed(2),
682
+ currencyCode: response.currency,
683
+ countryCode: CURRENCY_COUNTRYCODE_MAPPING[response.currency] || CURRENCY_COUNTRYCODE_MAPPING.NGN
684
+ },
685
+ merchantInfo: buildMerchantInfo(googlePayConfig),
686
+ emailRequired: true
687
+ });
688
+ };
689
+ var chargeGooglePay = function chargeGooglePay(_ref) {
690
+ var transactionId = _ref.transactionId,
691
+ paymentData = _ref.paymentData;
692
+ var chargeUrl = "".concat(config.paymentBaseUrl).concat(config.googlePayChargePath);
693
+ return fetch(chargeUrl, {
694
+ headers: {
695
+ 'content-type': 'application/x-www-form-urlencoded'
696
+ },
697
+ method: 'POST',
698
+ mode: 'cors',
699
+ credentials: 'omit',
700
+ body: createFormBody({
701
+ transaction: transactionId,
702
+ paymentObject: JSON.stringify(paymentData)
703
+ })
704
+ }).then(function (response) {
705
+ return response.json();
706
+ });
707
+ };
708
+ var canUseGooglePay = function canUseGooglePay(transaction) {
709
+ var googlePayConfig = getGooglePayConfig(transaction);
710
+ if (!googlePayConfig) {
711
+ logWarning('Google Pay: no merchant configuration on this transaction. Add your merchant details in Dashboard > Developers > Google Pay.');
712
+ return Promise.resolve(null);
713
+ }
714
+ var authMethods = getSupportedAuthMethods(googlePayConfig);
715
+ if (!authMethods.length || !googlePayConfig.tokenization_specification || !hasGooglePaySDKLoaded()) {
716
+ return Promise.resolve(null);
717
+ }
718
+ warnOnOriginMismatch(googlePayConfig);
719
+ var readiness = Promise.resolve().then(function () {
720
+ var client = getGooglePayClient(resolveGooglePayEnvironment(transaction.response));
721
+ return client.isReadyToPay(_objectSpread2(_objectSpread2({}, buildBaseRequest(googlePayConfig)), {}, {
722
+ allowedPaymentMethods: [buildCardPaymentMethod(googlePayConfig, authMethods)],
723
+ existingPaymentMethodRequired: true
724
+ }));
725
+ }).then(function (_ref2) {
726
+ var result = _ref2.result;
727
+ return !!result;
728
+ }).catch(function () {
729
+ return null;
730
+ });
731
+ return readiness;
732
+ };
733
+ var loadGooglePay = function loadGooglePay(transaction) {
734
+ var response = transaction && transaction.response || {};
735
+ var channels = response.channels || [];
736
+ if (!channels.includes(CHANNELS.GOOGLE_PAY)) {
737
+ return Promise.resolve(null);
738
+ }
739
+ var loadSdk = hasGooglePaySDKLoaded() ? Promise.resolve(true) : loadScript(GOOGLE_PAY_SDK_SOURCE).then(function () {
740
+ return hasGooglePaySDKLoaded();
741
+ });
742
+ return withTimeoutDeadline(loadSdk.catch(function () {
743
+ return false;
744
+ }).then(function (loaded) {
745
+ if (!loaded) {
746
+ return null;
747
+ }
748
+ return canUseGooglePay(transaction);
749
+ }), function () {
750
+ return null;
751
+ }, GOOGLE_PAY_TIMEOUT_MS);
752
+ };
753
+
754
+ var _excluded$2 = ["height", "width"];
755
+ function createIframe(id) {
756
+ var iframe = document.createElement('iframe');
757
+ iframe.setAttribute('frameBorder', '0');
758
+ iframe.setAttribute('allowtransparency', 'true');
759
+ iframe.id = id;
760
+ iframe.style.display = 'none';
761
+ return iframe;
762
+ }
763
+ function mountCheckoutIframe(id) {
764
+ var iframe = createIframe("inline-checkout-".concat(id));
765
+ // `precheckout=true` tells checkout to render the precheckout view itself;
766
+ // without it, checkout assumes an older inline-js that renders its own modal.
767
+ iframe.src = "".concat(config.checkoutUrl, "popup?precheckout=true");
768
+ iframe.style.cssText = checkoutCSS;
769
+ iframe.style.colorScheme = 'light';
770
+ iframe.setAttribute('allowpaymentrequest', 'true');
771
+ iframe.setAttribute('allow', 'payment; clipboard-read; clipboard-write');
772
+ document.body.appendChild(iframe);
773
+ return iframe;
774
+ }
775
+ function mountBackgroundIframe(id) {
776
+ var iframe = createIframe("inline-background-".concat(id));
777
+ iframe.style.cssText = backgroundCSS;
778
+ iframe.style.colorScheme = 'light';
779
+ document.body.appendChild(iframe);
780
+ var bgWindow = iframe.contentWindow.document;
781
+ bgWindow.open();
782
+ bgWindow.write(loaderHTML);
783
+ bgWindow.close();
784
+ return iframe;
785
+ }
786
+ function mountEmbedCheckoutIframe(id, src) {
787
+ var iframe = createIframe("embed-checkout-".concat(id));
788
+ iframe.style.cssText = embedCSS;
789
+ iframe.src = src;
790
+ iframe.id = id;
791
+ iframe.name = id;
792
+ iframe.setAttribute('allowpaymentrequest', 'true');
793
+ iframe.setAttribute('allow', 'payment; clipboard-read; clipboard-write');
794
+ return iframe;
795
+ }
796
+ function getApplePayButton(container) {
797
+ return container.querySelector('apple-pay-button') || container.querySelector('#apple-pay-button');
798
+ }
799
+ function appendIframeToContainer(containerId, iframe) {
800
+ var container = document.getElementById(containerId);
801
+ container.innerHTML = '';
802
+ container.removeAttribute('style');
803
+ container.className = 'paystack-embed-container';
804
+ container.style.position = 'relative';
805
+ container.style.width = '100%';
806
+ container.appendChild(iframe);
807
+ }
808
+ function hideLoader(iframe) {
809
+ var bgWindow = iframe.contentWindow.document;
810
+ if (bgWindow) {
811
+ bgWindow.getElementById('app-loader').style.display = 'none';
812
+ }
813
+ }
814
+ function animateCheckoutIn(domElements) {
815
+ return new Promise(function (resolve, reject) {
816
+ if (!domElements) {
817
+ reject('No dom element provided');
818
+ }
819
+ var checkoutIframe = domElements.checkoutIframe,
820
+ backgroundIframe = domElements.backgroundIframe;
821
+ if (!checkoutIframe || !backgroundIframe) {
822
+ reject('No dom element provided');
823
+ }
824
+ checkoutIframe.style.display = '';
825
+ checkoutIframe.style.visibility = 'visible';
826
+ backgroundIframe.style.display = '';
827
+ backgroundIframe.style.visibility = 'visible';
828
+ resolve();
829
+ });
830
+ }
831
+ function animateCheckoutOut(domElements) {
832
+ return new Promise(function (resolve, reject) {
833
+ if (!domElements) {
834
+ reject('No dom element provided');
835
+ }
836
+ var checkoutIframe = domElements.checkoutIframe,
837
+ backgroundIframe = domElements.backgroundIframe;
838
+ if (!checkoutIframe || !backgroundIframe) {
839
+ reject('No dom element provided');
840
+ }
841
+ backgroundIframe.style.opacity = 0;
842
+ checkoutIframe.style.display = 'none';
843
+ checkoutIframe.style.visibility = 'hidden';
844
+ setTimeout(function () {
845
+ backgroundIframe.style.display = 'none';
846
+ backgroundIframe.style.visibility = 'hidden';
847
+ backgroundIframe.style.opacity = 1;
848
+ resolve();
849
+ }, 300);
850
+ });
851
+ }
852
+ function mountLazyInlineButton(options) {
853
+ var inlineButton;
854
+ if (options.id) {
855
+ inlineButton = document.getElementById(options.id);
856
+ inlineButton.setAttribute('data-inline-id', options.id);
857
+ } else {
858
+ var inlineDiv = document.createElement('div');
859
+ inlineDiv.id = "inline-button-".concat(options.inlineId);
860
+ inlineDiv.innerHTML = generateInlineButtonHTML(options);
861
+ options.parent.parentNode.insertBefore(inlineDiv, options.parent.nextSibling);
862
+ var _inlineDiv$getElement = inlineDiv.getElementsByTagName('button');
863
+ var _inlineDiv$getElement2 = _slicedToArray(_inlineDiv$getElement, 1);
864
+ inlineButton = _inlineDiv$getElement2[0];
865
+ }
866
+ return inlineButton;
867
+ }
868
+ function animateEmbedCheckoutIn(checkoutIframe) {
869
+ return new Promise(function (resolve, reject) {
870
+ if (!checkoutIframe) {
871
+ reject('No dom element provided');
872
+ }
873
+ // eslint-disable-next-line no-param-reassign
874
+ checkoutIframe.style.display = '';
875
+ // eslint-disable-next-line no-param-reassign
876
+ checkoutIframe.style.visibility = 'visible';
877
+ resolve();
878
+ });
879
+ }
880
+ function mountInput(options) {
881
+ var type = options.type,
882
+ value = options.value,
883
+ name = options.name,
884
+ parent = options.parent;
885
+ var input = document.createElement('input');
886
+ input.type = type;
887
+ input.value = value;
888
+ input.name = name;
889
+ parent.appendChild(input);
890
+ }
891
+ function mountApplePayButton(container, _ref) {
892
+ var styles = _ref.styles,
893
+ theme = _ref.theme,
894
+ onClick = _ref.onClick;
895
+ appendCSS(container, generateApplePayCSS(styles));
896
+ var button = document.createElement('apple-pay-button');
897
+ button.setAttribute('buttonstyle', theme === PAYMENT_REQUEST_BUTTON_THEME.LIGHT ? 'white' : 'black');
898
+ button.setAttribute('type', styles.type);
899
+ button.setAttribute('locale', styles.locale);
900
+ if (onClick) {
901
+ button.onclick = onClick;
902
+ }
903
+ container.appendChild(button);
904
+ return button;
905
+ }
906
+ function mountApplePayFallbackButton(container, _ref2) {
907
+ var styles = _ref2.styles,
908
+ theme = _ref2.theme,
909
+ onClick = _ref2.onClick;
910
+ appendCSS(container, generateApplePayFallbackCSS(styles));
911
+ var button = document.createElement('button');
912
+ button.classList.add('apple-pay-button', theme === PAYMENT_REQUEST_BUTTON_THEME.LIGHT ? 'apple-pay-button-white' : 'apple-pay-button-black');
913
+ button.id = 'apple-pay-button';
914
+ var applePayLogo = document.createElement('span');
915
+ applePayLogo.classList.add('logo');
916
+ button.appendChild(applePayLogo);
917
+ if (onClick) {
918
+ button.onclick = onClick;
919
+ }
920
+ container.appendChild(button);
921
+ return button;
922
+ }
923
+ function getPaymentRequestContainer(container) {
924
+ return document.querySelector("#".concat(container));
925
+ }
926
+ function removeAllChildNodes(parent) {
927
+ while (parent.firstChild) {
928
+ parent.removeChild(parent.firstChild);
929
+ }
930
+ }
931
+ function getGooglePayButton(container) {
932
+ return container.querySelector('#google-pay-button-container');
933
+ }
934
+ function toggleGooglePayLoadingState(container, isLoading) {
935
+ if (!container) {
936
+ return;
937
+ }
938
+ var button = container.querySelector('#google-pay-button');
939
+ var loadingButton = container.querySelector('#google-pay-loading-button');
940
+ if (!button || !loadingButton) {
941
+ return;
942
+ }
943
+ button.style.display = isLoading ? 'none' : '';
944
+ loadingButton.style.display = isLoading ? 'flex' : 'none';
945
+ }
946
+ function mountGooglePayButton(container, _ref3) {
947
+ var transaction = _ref3.transaction,
948
+ _ref3$styles = _ref3.styles,
949
+ styles = _ref3$styles === void 0 ? {} : _ref3$styles,
950
+ onClick = _ref3.onClick;
951
+ var _ref4 = styles.googlePay || {},
952
+ height = _ref4.height,
953
+ width = _ref4.width,
954
+ googlePayStyles = _objectWithoutProperties(_ref4, _excluded$2);
955
+ var googlePayConfig = getGooglePayConfig(transaction);
956
+ appendCSS(container, generateGooglePayCSS({
957
+ height: height,
958
+ width: width
959
+ }));
960
+ var buttonColor = googlePayStyles.buttonColor || (styles.theme === PAYMENT_REQUEST_BUTTON_THEME.LIGHT ? 'white' : 'black');
961
+ appendCSS(container, generateGooglePayLoadingCSS({
962
+ borderRadius: googlePayStyles.buttonRadius,
963
+ buttonColor: buttonColor
964
+ }));
965
+ var buttonContainer = document.createElement('div');
966
+ buttonContainer.id = 'google-pay-button-container';
967
+ var client = getGooglePayClient(resolveGooglePayEnvironment(transaction.response));
968
+ var button = client.createButton(_objectSpread2(_objectSpread2({
969
+ buttonColor: buttonColor,
970
+ buttonType: 'pay',
971
+ buttonRadius: GOOGLE_PAY_BUTTON_RADIUS,
972
+ buttonSizeMode: 'fill'
973
+ }, googlePayStyles), {}, {
974
+ onClick: onClick,
975
+ allowedPaymentMethods: [buildCardPaymentMethod(googlePayConfig, getSupportedAuthMethods(googlePayConfig))]
976
+ }));
977
+ container.appendChild(buttonContainer);
978
+ var buttonWrapper = document.createElement('div');
979
+ buttonWrapper.id = 'google-pay-button';
980
+ buttonWrapper.appendChild(button);
981
+ buttonContainer.appendChild(buttonWrapper);
982
+ var loadingButton = document.createElement('button');
983
+ loadingButton.id = 'google-pay-loading-button';
984
+ loadingButton.type = 'button';
985
+ loadingButton.disabled = true;
986
+ loadingButton.setAttribute('aria-busy', 'true');
987
+ loadingButton.style.display = 'none';
988
+ var spinner = document.createElement('span');
989
+ spinner.id = 'google-pay-loading-button__spinner';
990
+ loadingButton.appendChild(spinner);
991
+ buttonContainer.appendChild(loadingButton);
992
+ return buttonContainer;
993
+ }
994
+ function getMountedPaymentRequestButtons(container) {
995
+ if (!container) {
996
+ return [];
997
+ }
998
+ return [getApplePayButton(container), getGooglePayButton(container)].filter(Boolean);
999
+ }
1000
+ function mountPaymentRequestButtons(container, _ref5) {
1001
+ var transaction = _ref5.transaction,
1002
+ _ref5$styles = _ref5.styles,
1003
+ styles = _ref5$styles === void 0 ? {} : _ref5$styles,
1004
+ onClickApplePayButton = _ref5.onClickApplePayButton,
1005
+ onClickGooglePayButton = _ref5.onClickGooglePayButton;
1006
+ if (!container) {
1007
+ return Promise.reject('Container to mount elements was not provided');
1008
+ }
1009
+ removeAllChildNodes(container);
1010
+ appendCSS(container, generatePaymentRequestInnerWrapperCSS(styles.orientation));
1011
+ var innerWrapper = document.createElement('div');
1012
+ innerWrapper.id = 'paystack-payment-request-inner-wrapper';
1013
+ innerWrapper.style.display = 'none';
1014
+ container.appendChild(innerWrapper);
1015
+ var revealWrapper = function revealWrapper(button) {
1016
+ if (button) {
1017
+ innerWrapper.style.display = '';
1018
+ }
1019
+ return button;
1020
+ };
1021
+ var applePayOptions = {
1022
+ styles: parseApplePayCustomStyles(styles.applePay),
1023
+ theme: styles.theme,
1024
+ onClick: onClickApplePayButton
1025
+ };
1026
+ var channels = transaction.response && transaction.response.channels || [];
1027
+ var applePayButton = Promise.resolve(null);
1028
+ if (canUseApplePay(channels)) {
1029
+ applePayButton = loadApplePay().then(function () {
1030
+ return mountApplePayButton(innerWrapper, applePayOptions);
1031
+ }).catch(function () {
1032
+ return mountApplePayFallbackButton(innerWrapper, applePayOptions);
1033
+ }).then(revealWrapper).catch(function () {
1034
+ return null;
1035
+ });
1036
+ } else if (channels.includes(CHANNELS.APPLE_PAY)) {
1037
+ logWarning('Apple Pay: this device or browser cannot pay with Apple Pay. It requires Safari on an Apple device, over HTTPS.');
1038
+ }
1039
+ var googlePayButton = loadGooglePay(transaction).then(function (isReadyToPay) {
1040
+ if (!isReadyToPay) {
1041
+ return null;
1042
+ }
1043
+ return mountGooglePayButton(innerWrapper, {
1044
+ transaction: transaction,
1045
+ styles: styles,
1046
+ onClick: onClickGooglePayButton
1047
+ });
1048
+ }).then(revealWrapper).catch(function () {
1049
+ return null;
1050
+ });
1051
+ return Promise.all([applePayButton, googlePayButton]).then(function (_ref6) {
1052
+ var _ref7 = _slicedToArray(_ref6, 2),
1053
+ applePay = _ref7[0],
1054
+ googlePay = _ref7[1];
1055
+ if (!applePay && !googlePay) {
1056
+ return null;
1057
+ }
1058
+ return {
1059
+ applePay: !!applePay,
1060
+ googlePay: !!googlePay
1061
+ };
1062
+ });
1063
+ }
1064
+
1065
+ var allParameters = [{
1066
+ value: 'key',
1067
+ required: true,
1068
+ types: ['string']
1069
+ }, {
1070
+ value: 'amount',
1071
+ required: true,
1072
+ or: ['plan', 'planCode'],
1073
+ types: ['string', 'number']
1074
+ }, {
1075
+ value: 'currency',
1076
+ required: false,
1077
+ types: ['string']
1078
+ }, {
1079
+ value: 'email',
1080
+ required: true,
1081
+ or: ['customerCode'],
1082
+ types: ['string']
1083
+ }, {
1084
+ value: 'label',
1085
+ required: false,
1086
+ types: ['string']
1087
+ }, {
1088
+ value: 'firstName',
1089
+ required: false,
1090
+ types: ['string']
1091
+ }, {
1092
+ value: 'lastName',
1093
+ required: false,
1094
+ types: ['string']
1095
+ }, {
1096
+ value: 'reference',
1097
+ required: false,
1098
+ types: ['string']
1099
+ }, {
1100
+ value: 'phone',
1101
+ required: false,
1102
+ types: ['string']
1103
+ }, {
1104
+ value: 'customerCode',
1105
+ required: false,
1106
+ override: 'email',
1107
+ types: ['string']
1108
+ }, {
1109
+ value: 'channels',
1110
+ required: false,
1111
+ types: ['array']
1112
+ }, {
1113
+ value: 'paymentRequest',
1114
+ required: false,
1115
+ types: ['string', 'number']
1116
+ }, {
1117
+ value: 'paymentPage',
1118
+ required: false,
1119
+ types: ['string']
1120
+ }, {
1121
+ value: 'hash',
1122
+ required: false,
1123
+ types: ['string']
1124
+ }, {
1125
+ value: 'container',
1126
+ required: false,
1127
+ types: ['string']
1128
+ }, {
1129
+ value: 'metadata',
1130
+ required: false,
1131
+ types: ['object']
1132
+ }, {
1133
+ value: 'subaccountCode',
1134
+ required: false,
1135
+ types: ['string']
1136
+ }, {
1137
+ value: 'bearer',
1138
+ required: false,
1139
+ types: ['string']
1140
+ }, {
1141
+ value: 'transactionCharge',
1142
+ required: false,
1143
+ types: ['string', 'number']
1144
+ }, {
1145
+ value: 'planCode',
1146
+ required: false,
1147
+ override: 'amount',
1148
+ types: ['string']
1149
+ }, {
1150
+ value: 'subscriptionCount',
1151
+ required: false,
1152
+ types: ['number']
1153
+ }, {
1154
+ value: 'planInterval',
1155
+ required: false,
1156
+ types: ['string']
1157
+ }, {
1158
+ value: 'subscriptionLimit',
1159
+ required: false,
1160
+ types: ['number']
1161
+ }, {
1162
+ value: 'subscriptionStartDate',
1163
+ required: false,
1164
+ types: ['string']
1165
+ }, {
1166
+ value: 'accessCode',
1167
+ required: false,
1168
+ types: ['string']
1169
+ }, {
1170
+ value: 'onError',
1171
+ required: false,
1172
+ types: ['function']
1173
+ }, {
1174
+ value: 'onLoad',
1175
+ required: false,
1176
+ types: ['function']
1177
+ }, {
1178
+ value: 'onSuccess',
1179
+ required: false,
1180
+ types: ['function']
1181
+ }, {
1182
+ value: 'onCancel',
1183
+ required: false,
1184
+ types: ['function']
1185
+ }, {
1186
+ value: 'callback',
1187
+ required: false,
1188
+ types: ['function']
1189
+ }, {
1190
+ value: 'onClose',
1191
+ required: false,
1192
+ types: ['function']
1193
+ }, {
1194
+ value: 'onBankTransferConfirmationPending',
1195
+ required: false,
1196
+ types: ['function']
1197
+ }, {
1198
+ value: 'firstname',
1199
+ required: false,
1200
+ types: ['string']
1201
+ }, {
1202
+ value: 'lastname',
1203
+ required: false,
1204
+ types: ['string']
1205
+ }, {
1206
+ value: 'customer_code',
1207
+ required: false,
1208
+ types: ['string']
1209
+ }, {
1210
+ value: 'payment_request',
1211
+ required: false,
1212
+ types: ['string', 'number']
1213
+ }, {
1214
+ value: 'subaccount',
1215
+ required: false,
1216
+ types: ['string']
1217
+ }, {
1218
+ value: 'transaction_charge',
1219
+ required: false,
1220
+ types: ['number', 'string']
1221
+ }, {
1222
+ value: 'plan',
1223
+ required: false,
1224
+ types: ['string']
1225
+ }, {
1226
+ value: 'quantity',
1227
+ required: false,
1228
+ types: ['number']
1229
+ }, {
1230
+ value: 'interval',
1231
+ required: false,
1232
+ types: ['string']
1233
+ }, {
1234
+ value: 'invoice_limit',
1235
+ required: false,
1236
+ types: ['number', 'string']
1237
+ }, {
1238
+ value: 'start_date',
1239
+ required: false,
1240
+ types: ['string']
1241
+ }, {
1242
+ value: 'payment_page',
1243
+ required: false,
1244
+ types: ['number', 'string']
1245
+ }, {
1246
+ value: 'order_id',
1247
+ required: false,
1248
+ types: ['number']
1249
+ }, {
1250
+ value: 'ref',
1251
+ required: false,
1252
+ types: ['string']
1253
+ }, {
1254
+ value: 'card',
1255
+ required: false,
1256
+ types: ['string']
1257
+ }, {
1258
+ value: 'bank',
1259
+ required: false,
1260
+ types: ['string']
1261
+ }, {
1262
+ value: 'split',
1263
+ required: false,
1264
+ types: ['object']
1265
+ }, {
1266
+ value: 'split_code',
1267
+ required: false,
1268
+ types: ['string']
1269
+ }, {
1270
+ value: 'transaction_type',
1271
+ required: false,
1272
+ types: ['string']
1273
+ }, {
1274
+ value: 'subscription',
1275
+ required: false,
1276
+ types: ['number']
1277
+ }, {
1278
+ value: 'language',
1279
+ required: false,
1280
+ types: ['string']
1281
+ }, {
1282
+ value: 'connect_account',
1283
+ required: false,
1284
+ types: ['string']
1285
+ }, {
1286
+ value: 'connect_split',
1287
+ required: false,
1288
+ types: ['array']
1289
+ }];
1290
+ function validate(args) {
1291
+ function ValidationError(message, issues) {
1292
+ this.message = message;
1293
+ this.issues = issues || [];
1294
+ }
1295
+ if (!args || _typeof(args) !== 'object') {
1296
+ throw new ValidationError('Transaction parameters should be a non-empty object');
1297
+ }
1298
+ var transactionParameters = args;
1299
+
1300
+ // If it's a transaction resumption, move on
1301
+ if ('accessCode' in transactionParameters) {
1302
+ var accessCode = transactionParameters.accessCode;
1303
+ return {
1304
+ accessCode: accessCode
1305
+ };
1306
+ }
1307
+
1308
+ // Filter unneeded parameters
1309
+ Object.keys(transactionParameters).forEach(function (key) {
1310
+ var usedParameter = allParameters.find(function (parameter) {
1311
+ return parameter.value === key;
1312
+ }) !== undefined;
1313
+ if (!usedParameter) {
1314
+ delete transactionParameters[key];
1315
+ }
1316
+ });
1317
+ var transactionKeys = Object.keys(transactionParameters);
1318
+ var validationErrors = [];
1319
+
1320
+ // Check for required parameters
1321
+ var requiredParameters = allParameters.filter(function (param) {
1322
+ return param.required;
1323
+ });
1324
+ requiredParameters.forEach(function (key) {
1325
+ var parameterIsMissing = !transactionParameters[key.value];
1326
+ var parameterHasAlternative = key.or ? key.or.some(function (option) {
1327
+ return transactionParameters[option];
1328
+ }) : null;
1329
+ if (parameterIsMissing && !parameterHasAlternative) {
1330
+ validationErrors.push({
1331
+ message: "Required parameter missing: ".concat(key.value)
1332
+ });
1333
+ }
1334
+ });
1335
+
1336
+ // Check for validity
1337
+ transactionKeys.forEach(function (key) {
1338
+ var parameterValue = transactionParameters[key];
1339
+ var parameterObject = allParameters.find(function (parameter) {
1340
+ return parameter.value === key;
1341
+ });
1342
+ var providedType = _typeof(parameterValue);
1343
+ if (providedType === 'object' && Array.isArray(parameterValue)) {
1344
+ providedType = 'array';
1345
+ }
1346
+ var invalidType = parameterObject.types.indexOf(providedType) <= -1;
1347
+ if (invalidType) {
1348
+ validationErrors.push({
1349
+ message: "Invalid parameter type: ".concat(key),
1350
+ validTypes: parameterObject.types
1351
+ });
1352
+ }
1353
+ });
1354
+
1355
+ // Override keys where necessary
1356
+ transactionKeys.forEach(function (key) {
1357
+ var parameterObject = allParameters.find(function (parameter) {
1358
+ return parameter.value === key;
1359
+ });
1360
+ if (parameterObject.override) {
1361
+ delete transactionParameters[parameterObject.override];
1362
+ }
1363
+ });
1364
+ if (validationErrors.length) {
1365
+ throw new ValidationError('Invalid transaction parameters', validationErrors);
1366
+ }
1367
+ return transactionParameters;
1368
+ }
1369
+
1370
+ /* eslint-env browser */
1371
+ function splitURL(url) {
1372
+ if ((url === null || url === void 0 ? void 0 : url.length) > 500) {
1373
+ return url.split('?')[0];
1374
+ }
1375
+ return url;
1376
+ }
1377
+ function getReferrer() {
1378
+ var _window$location = window.location,
1379
+ _window$location$href = _window$location.href,
1380
+ href = _window$location$href === void 0 ? '' : _window$location$href,
1381
+ _window$location$ance = _window$location.ancestorOrigins,
1382
+ ancestorOrigins = _window$location$ance === void 0 ? [] : _window$location$ance;
1383
+ return [href].concat(_toConsumableArray(ancestorOrigins)).map(splitURL).join(',');
1384
+ }
1385
+
1386
+ function buildQuery(parameters) {
1387
+ var formattedParameters = _objectSpread2({}, parameters);
1388
+ formattedParameters.metadata = parameters.metadata || {};
1389
+ formattedParameters.metadata.referrer = getReferrer();
1390
+ formattedParameters.metadata = JSON.stringify(formattedParameters.metadata);
1391
+ formattedParameters.mode = 'popup';
1392
+ if (parameters.split && typeof parameters.split !== 'string') {
1393
+ formattedParameters.split = JSON.stringify(formattedParameters.split);
1394
+ }
1395
+ var parametersToChange = [{
1396
+ to: 'firstname',
1397
+ from: 'firstName'
1398
+ }, {
1399
+ to: 'lastname',
1400
+ from: 'lastName'
1401
+ }, {
1402
+ to: 'customer_code',
1403
+ from: 'customerCode'
1404
+ }, {
1405
+ to: 'payment_request',
1406
+ from: 'paymentRequest'
1407
+ }, {
1408
+ to: 'subaccount',
1409
+ from: 'subaccountCode'
1410
+ }, {
1411
+ to: 'transaction_charge',
1412
+ from: 'transactionCharge'
1413
+ }, {
1414
+ to: 'plan',
1415
+ from: 'planCode'
1416
+ }, {
1417
+ to: 'quantity',
1418
+ from: 'subscriptionCount'
1419
+ }, {
1420
+ to: 'interval',
1421
+ from: 'planInterval'
1422
+ }, {
1423
+ to: 'invoice_limit',
1424
+ from: 'subscriptionLimit'
1425
+ }, {
1426
+ to: 'start_date',
1427
+ from: 'subscriptionStartDate'
1428
+ }, {
1429
+ to: 'ref',
1430
+ from: 'reference'
1431
+ }];
1432
+
1433
+ // handle very old case of people disabling channels by sending card/bank params
1434
+
1435
+ if (formattedParameters.card !== undefined && ['false', false].indexOf(formattedParameters.card) > -1) {
1436
+ formattedParameters.channels = ['bank'];
1437
+ delete formattedParameters.card;
1438
+ }
1439
+ if (formattedParameters.bank !== undefined && ['false', false].indexOf(formattedParameters.bank) > -1) {
1440
+ formattedParameters.channels = ['card'];
1441
+ delete formattedParameters.bank;
1442
+ }
1443
+ parametersToChange.forEach(function (key) {
1444
+ var hasValue = formattedParameters[key.from];
1445
+ if (hasValue) {
1446
+ formattedParameters[key.to] = formattedParameters[key.from];
1447
+ delete formattedParameters[key.from];
1448
+ }
1449
+ });
1450
+ Object.values(parameters).forEach(function (value, index) {
1451
+ if (typeof value === 'function') {
1452
+ var key = Object.keys(parameters)[index];
1453
+ delete formattedParameters[key];
1454
+ }
1455
+ });
1456
+ return formattedParameters;
1457
+ }
1458
+
1459
+ /* eslint-env browser */
1460
+
1461
+ var iOSDevices = ['iPad Simulator', 'iPhone Simulator', 'iPod Simulator', 'iPad', 'iPhone', 'iPod'];
1462
+
1463
+ /**
1464
+ * navigator.platform is deprecated and will eventually be removed
1465
+ * but the recommended alternative `navigator.userAgentData` has limited browser support
1466
+ * so it is used as a fallback here.
1467
+ */
1468
+ var DEVICE_PLATFORM = window && window.navigator && (window.navigator.platform || window.navigator.userAgentData && window.navigator.userAgentData.platform);
1469
+ var isIOS = function isIOS() {
1470
+ var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
1471
+ platform = _ref.platform,
1472
+ _ref$userAgent = _ref.userAgent,
1473
+ userAgent = _ref$userAgent === void 0 ? window && window.navigator && window.navigator.userAgent : _ref$userAgent;
1474
+ var devicePlatform = platform || DEVICE_PLATFORM;
1475
+ return iOSDevices.includes(devicePlatform) ||
1476
+ // iPAD os safari detection. iPad OS uses the same version of safari as Mac OS
1477
+ userAgent.includes('Mac') && 'ontouchend' in document;
1478
+ };
1479
+
1480
+ /* eslint-env browser */
1481
+ var AnalyticsAPI = {
1482
+ saveLog: function saveLog(transactionId, merchantPublicKey, log) {
1483
+ var url = "".concat(config.paystackApiUrl, "transaction/update_log/").concat(transactionId);
1484
+ var headers = {
1485
+ Authorization: "Bearer ".concat(merchantPublicKey)
1486
+ };
1487
+ return fetch(url, {
1488
+ method: 'POST',
1489
+ body: JSON.stringify({
1490
+ payload: JSON.stringify(log)
1491
+ }),
1492
+ headers: headers
1493
+ });
1494
+ },
1495
+ saveIp: function saveIp(transactionId, merchantPublicKey) {
1496
+ var url = "".concat(config.paystackApiUrl, "transaction/set_ip/").concat(transactionId);
1497
+ var headers = {
1498
+ Authorization: "Bearer ".concat(merchantPublicKey)
1499
+ };
1500
+ return fetch(url, {
1501
+ method: 'POST',
1502
+ headers: headers
1503
+ });
1504
+ }
1505
+ };
1506
+
1507
+ var AnalyticsFunctions = {
1508
+ initializeLog: function initializeLog(log) {
1509
+ var _ref = log || {},
1510
+ attempts = _ref.attempts,
1511
+ authentication = _ref.authentication,
1512
+ errors = _ref.errors,
1513
+ history = _ref.history;
1514
+ this.log = {
1515
+ start_time: Math.round(Date.now() / 1000),
1516
+ time_spent: 0,
1517
+ attempts: attempts || 0,
1518
+ authentication: authentication,
1519
+ errors: errors || 0,
1520
+ success: false,
1521
+ mobile: isIOS(),
1522
+ input: [],
1523
+ history: history || []
1524
+ };
1525
+ },
1526
+ getTimeSpent: function getTimeSpent() {
1527
+ var currentTimeInSeconds = Math.round(Date.now() / 1000);
1528
+ this.log.time_spent = currentTimeInSeconds - this.log.start_time;
1529
+ return this.log.time_spent;
1530
+ },
1531
+ logAPIResponse: function logAPIResponse(response, channel) {
1532
+ switch (response.status) {
1533
+ case TRANSACTION_STATUS.SUCCESS:
1534
+ return this.logApiSuccess(channel);
1535
+ case TRANSACTION_STATUS.FAILED:
1536
+ return this.logApiError(response.message);
1537
+ default:
1538
+ return false;
1539
+ }
1540
+ },
1541
+ logValidationResponse: function logValidationResponse(message) {
1542
+ this.log.history.push({
1543
+ type: 'action',
1544
+ message: message,
1545
+ time: this.getTimeSpent()
1546
+ });
1547
+ return this.saveLog();
1548
+ },
1549
+ logAttempt: function logAttempt(channel) {
1550
+ var message = 'Attempted to pay';
1551
+ if (channel) {
1552
+ message += " with ".concat(channel);
1553
+ }
1554
+ this.log.attempts += 1;
1555
+ this.log.history.push({
1556
+ type: 'action',
1557
+ message: message,
1558
+ time: this.getTimeSpent()
1559
+ });
1560
+ return this.saveLog();
1561
+ },
1562
+ logApiError: function logApiError(error) {
1563
+ var message = 'Error';
1564
+ if (error) {
1565
+ message += ": ".concat(error);
1566
+ }
1567
+ this.log.errors += 1;
1568
+ this.log.history.push({
1569
+ type: 'error',
1570
+ message: message,
1571
+ time: this.getTimeSpent()
1572
+ });
1573
+ return this.saveLog();
1574
+ },
1575
+ logApiSuccess: function logApiSuccess(channel) {
1576
+ var message = 'Successfully paid';
1577
+ if (channel) {
1578
+ message += " with ".concat(channel);
1579
+ }
1580
+ this.log.success = true;
1581
+ this.log.history.push({
1582
+ type: 'success',
1583
+ message: message,
1584
+ time: this.getTimeSpent()
1585
+ });
1586
+ return this.saveLog();
1587
+ },
1588
+ saveLog: function saveLog() {
1589
+ try {
1590
+ if (this.response) {
1591
+ return AnalyticsAPI.saveLog(this.id, this.response.merchant_key, this.log);
1592
+ }
1593
+ } catch (error) {
1594
+ // we don't need to do anything since this should not affect the transaction
1595
+ }
1596
+ return undefined;
1597
+ },
1598
+ saveIpAddress: function saveIpAddress() {
1599
+ try {
1600
+ if (this.response) {
1601
+ return AnalyticsAPI.saveIp(this.id, this.response.merchant_key);
1602
+ }
1603
+ } catch (error) {
1604
+ // we don't need to do anything since this should not affect the transaction
1605
+ }
1606
+ return undefined;
1607
+ }
1608
+ };
1609
+
1610
+ var _excluded$1 = ["language", "connect_account"];
1611
+ var TransactionApi = {
1612
+ requestInline: function requestInline() {
1613
+ var inlineTransactionInstance = this;
1614
+ var _this$urlParameters = this.urlParameters,
1615
+ language = _this$urlParameters.language,
1616
+ connectAccount = _this$urlParameters.connect_account,
1617
+ params = _objectWithoutProperties(_this$urlParameters, _excluded$1);
1618
+ var request;
1619
+ var headers = _objectSpread2({
1620
+ 'Content-Type': 'application/json'
1621
+ }, language && {
1622
+ 'Accept-Language': language
1623
+ });
1624
+ if (this.accessCode) {
1625
+ request = fetch(new URL("transaction/verify_access_code/".concat(this.accessCode), config.paystackApiUrl).toString(), {
1626
+ headers: headers
1627
+ });
1628
+ } else {
1629
+ request = fetch(new URL('/checkout/request_inline', config.paystackApiUrl).toString(), {
1630
+ method: 'POST',
1631
+ body: JSON.stringify(params),
1632
+ headers: _objectSpread2(_objectSpread2({}, headers), connectAccount && {
1633
+ 'x-connect-account': connectAccount
1634
+ })
1635
+ });
1636
+ }
1637
+ return request.then(function (res) {
1638
+ return res.json();
1639
+ }).then(function (res) {
1640
+ if (res.status === false) {
1641
+ throw new Error(res.message);
1642
+ }
1643
+ inlineTransactionInstance.response = res.data;
1644
+ inlineTransactionInstance.id = res.data.id;
1645
+ inlineTransactionInstance.status = res.data.transaction_status;
1646
+ inlineTransactionInstance.accessCode = res.data.access_code;
1647
+
1648
+ // Analytics
1649
+ inlineTransactionInstance.log = null;
1650
+ Object.assign(inlineTransactionInstance, AnalyticsFunctions);
1651
+ inlineTransactionInstance.initializeLog(res.data.log);
1652
+ inlineTransactionInstance.saveIpAddress();
1653
+ return res.data;
1654
+ });
1655
+ }
1656
+ };
1657
+
1658
+ var InlineTransaction = /*#__PURE__*/function () {
1659
+ function InlineTransaction(data) {
1660
+ _classCallCheck(this, InlineTransaction);
1661
+ validate(data);
1662
+ this.parameters = data;
1663
+ this.urlParameters = buildQuery(data);
1664
+ this.id = null;
1665
+ this.status = null;
1666
+ this.accessCode = data.accessCode || null;
1667
+ this.authorizationUrl = null;
1668
+ this.errors = [];
1669
+ this.response = null;
1670
+ this.isActive = true;
1671
+ var onError = data.onError,
1672
+ onLoad = data.onLoad,
1673
+ onSuccess = data.onSuccess,
1674
+ onCancel = data.onCancel,
1675
+ callback = data.callback,
1676
+ onClose = data.onClose,
1677
+ onBankTransferConfirmationPending = data.onBankTransferConfirmationPending;
1678
+ this.callbacks = {
1679
+ onError: onError,
1680
+ onLoad: onLoad,
1681
+ onSuccess: onSuccess,
1682
+ onCancel: onCancel,
1683
+ onBankTransferConfirmationPending: onBankTransferConfirmationPending
1684
+ };
1685
+ this.deprecatedCallbacks = {
1686
+ callback: callback,
1687
+ onClose: onClose
1688
+ };
1689
+ Object.assign(this, TransactionApi);
1690
+ }
1691
+ return _createClass(InlineTransaction, [{
1692
+ key: "onSetupError",
1693
+ value: function onSetupError(response) {
1694
+ this.logError(response);
1695
+ if (this.callbacks.onError) {
1696
+ this.callbacks.onError(response);
1697
+ }
1698
+ }
1699
+ }, {
1700
+ key: "onLoad",
1701
+ value: function onLoad(response) {
1702
+ var id = response.id,
1703
+ customer = response.customer,
1704
+ accessCode = response.accessCode;
1705
+ Object.assign(this, {
1706
+ id: id,
1707
+ customer: customer,
1708
+ accessCode: accessCode
1709
+ });
1710
+ this.authorizationUrl = "".concat(config.checkoutUrl).concat(accessCode);
1711
+ if (this.callbacks.onLoad) {
1712
+ this.callbacks.onLoad({
1713
+ id: id,
1714
+ customer: customer,
1715
+ accessCode: accessCode
1716
+ });
1717
+ }
1718
+ }
1719
+ }, {
1720
+ key: "onSuccess",
1721
+ value: function onSuccess(response) {
1722
+ this.isActive = false;
1723
+ this.response = response;
1724
+ this.status = response.status;
1725
+ if (this.callbacks.onSuccess) {
1726
+ this.callbacks.onSuccess(response);
1727
+ }
1728
+ // Added for backwards compatibility
1729
+ if (this.deprecatedCallbacks.callback) {
1730
+ this.deprecatedCallbacks.callback(response);
1731
+ }
1732
+ }
1733
+ }, {
1734
+ key: "setStatus",
1735
+ value: function setStatus(status) {
1736
+ this.status = status;
1737
+ }
1738
+ }, {
1739
+ key: "onCancel",
1740
+ value: function onCancel() {
1741
+ if (this.callbacks.onCancel) {
1742
+ this.callbacks.onCancel();
1743
+ }
1744
+ // Added for backwards compatibility
1745
+ if (this.deprecatedCallbacks.onClose) {
1746
+ this.deprecatedCallbacks.onClose();
1747
+ }
1748
+ }
1749
+ }, {
1750
+ key: "cancel",
1751
+ value: function cancel() {
1752
+ this.isActive = false;
1753
+ this.onCancel();
1754
+ }
1755
+ }, {
1756
+ key: "onBankTransferConfirmationPending",
1757
+ value: function onBankTransferConfirmationPending() {
1758
+ this.cancel();
1759
+ if (this.callbacks.onBankTransferConfirmationPending) {
1760
+ this.callbacks.onBankTransferConfirmationPending();
1761
+ }
1762
+ }
1763
+ }, {
1764
+ key: "logError",
1765
+ value: function logError(error) {
1766
+ this.errors.push(error);
1767
+ }
1768
+ }]);
1769
+ }();
1770
+
1771
+ var _excluded = ["preload", "inlineTransaction", "transactionData"],
1772
+ _excluded2 = ["container", "styles", "onElementsMount"],
1773
+ _excluded3 = ["data"];
1774
+ var inlineInstance;
1775
+ function findResumableTransaction(transactions, parameters) {
1776
+ if (!transactions.length) {
1777
+ return null;
1778
+ }
1779
+ var similarAbandonedTransactions = transactions.filter(function (transaction) {
1780
+ var isAbandoned = !transaction.status || transaction.status === 'abandoned';
1781
+ var hasSimilarParameters = similarObjects(transaction.parameters, parameters);
1782
+ return isAbandoned && hasSimilarParameters;
1783
+ });
1784
+ var resumableTransaction = similarAbandonedTransactions.length ? similarAbandonedTransactions[similarAbandonedTransactions.length - 1] : null;
1785
+ return resumableTransaction;
1786
+ }
1787
+ function notifyIframeToUpdateURL(options) {
1788
+ var checkoutIframe = options.checkoutIframe,
1789
+ urlParameters = options.urlParameters;
1790
+ if (!checkoutIframe || !urlParameters) {
1791
+ return;
1792
+ }
1793
+ checkoutIframe.contentWindow.postMessage({
1794
+ type: 'inline:url',
1795
+ path: 'newTransaction',
1796
+ params: urlParameters
1797
+ }, '*');
1798
+ }
1799
+ var analyticsActions = {
1800
+ TRACK_PAYMENT_ERROR: 'trackPaymentError',
1801
+ TRACK_PAYMENT_ATTEMPT: 'trackPaymentAttempt',
1802
+ TRACK_PAYMENT_COMPLETION: 'trackPaymentCompletion'
1803
+ };
1804
+ function handleError(message) {
1805
+ logWarning(message);
1806
+ throw new Error(message);
1807
+ }
1808
+ var Inline = /*#__PURE__*/function () {
1809
+ function Inline(params) {
1810
+ _classCallCheck(this, Inline);
1811
+ this.id = randomId();
1812
+ this.transactions = [];
1813
+ this.isOpen = false;
1814
+ this.isLoaded = false;
1815
+ this.isCharging = false;
1816
+ this.isDeprecatedApi = params && params.isDeprecatedApi; // track deprecatedApi
1817
+ if (params && params.isEmbed) {
1818
+ this.isEmbed = true;
1819
+ } else if (params && params.isPaymentRequest) {
1820
+ if (!(params.container && getPaymentRequestContainer(params.container))) {
1821
+ handleError('A container is required to mount the payment request button');
1822
+ }
1823
+ this.paymentRequestContainer = getPaymentRequestContainer(params.container);
1824
+ this.paymentRequestTransaction = null;
1825
+ }
1826
+ this.backgroundIframe = mountBackgroundIframe(this.id);
1827
+ this.checkoutIframe = mountCheckoutIframe(this.id);
1828
+ this.registerListeners();
1829
+ }
1830
+ return _createClass(Inline, [{
1831
+ key: "registerListeners",
1832
+ value: function registerListeners() {
1833
+ var _this = this;
1834
+ window.addEventListener('message', function (event) {
1835
+ var isCheckoutIframe = "".concat(event.origin, "/") === config.checkoutUrl;
1836
+ var isThisInline = _this.checkoutIframe && _this.checkoutIframe.contentWindow === event.source;
1837
+ var isEmbed = _this.isEmbed;
1838
+ if (isCheckoutIframe || isThisInline) {
1839
+ _this.respondToEvent(event);
1840
+ } else if (isEmbed) {
1841
+ _this.respondToEmbedEvents(event);
1842
+ }
1843
+ });
1844
+ }
1845
+ }, {
1846
+ key: "sendAnalyticsEventToCheckout",
1847
+ value: function sendAnalyticsEventToCheckout(action, params) {
1848
+ this.checkoutIframe.contentWindow.postMessage({
1849
+ type: 'analytics',
1850
+ action: action,
1851
+ params: params
1852
+ }, '*');
1853
+ }
1854
+ }, {
1855
+ key: "checkout",
1856
+ value: function checkout(params) {
1857
+ if (this.activeTransaction()) {
1858
+ this.activeTransaction().cancel();
1859
+ }
1860
+ inlineInstance = this;
1861
+ var resumableTransaction = findResumableTransaction(this.transactions, params);
1862
+ var transaction = resumableTransaction || new InlineTransaction(params);
1863
+ return new Promise(function (resolve, reject) {
1864
+ transaction.requestInline().then(function (response) {
1865
+ inlineInstance.newTransaction({
1866
+ inlineTransaction: transaction,
1867
+ transactionData: response
1868
+ });
1869
+ resolve(transaction);
1870
+ }).catch(function (error) {
1871
+ transaction.onSetupError({
1872
+ status: false,
1873
+ message: error.message
1874
+ });
1875
+ reject(error);
1876
+ });
1877
+ });
1878
+ }
1879
+ }, {
1880
+ key: "newTransaction",
1881
+ value: function newTransaction(_ref) {
1882
+ var preload = _ref.preload,
1883
+ inlineTransaction = _ref.inlineTransaction,
1884
+ transactionData = _ref.transactionData,
1885
+ options = _objectWithoutProperties(_ref, _excluded);
1886
+ var hasPaymentRequestButtons = this.hasMountedPaymentRequestButtons();
1887
+ var activeTransaction = this.activeTransaction();
1888
+ if (activeTransaction && !hasPaymentRequestButtons && activeTransaction !== inlineTransaction) {
1889
+ activeTransaction.cancel();
1890
+ }
1891
+ if (inlineTransaction && transactionData) {
1892
+ if (!this.transactions.includes(inlineTransaction)) {
1893
+ this.transactions.push(inlineTransaction);
1894
+ }
1895
+ if (!this.isDeprecatedApi) {
1896
+ // TODO: reintroduce this when we resolve checkout caching issues
1897
+ // this.open({ transactionData }, preload);
1898
+ this.open({
1899
+ accessCode: transactionData.access_code,
1900
+ language: inlineTransaction.urlParameters.language
1901
+ }, preload);
1902
+ }
1903
+ return inlineTransaction;
1904
+ }
1905
+ var resumableTransaction = findResumableTransaction(this.transactions, inlineTransaction ? inlineTransaction.parameters : options);
1906
+ if (resumableTransaction) {
1907
+ resumableTransaction.isActive = true;
1908
+ if (!this.isDeprecatedApi) {
1909
+ // We could potentially optimize this also by checking if there is a `response` property on `resumableTransaction`
1910
+ this.open({
1911
+ accessCode: resumableTransaction.accessCode,
1912
+ language: resumableTransaction.urlParameters.language
1913
+ }, preload);
1914
+ }
1915
+ return resumableTransaction;
1916
+ }
1917
+ var transaction = inlineTransaction || new InlineTransaction(options);
1918
+ var params = transaction.accessCode ? {
1919
+ accessCode: transaction.accessCode,
1920
+ language: transaction.urlParameters.language
1921
+ } : transaction.urlParameters;
1922
+ this.transactions.push(transaction);
1923
+ if (!this.isDeprecatedApi) {
1924
+ this.open(params, preload);
1925
+ }
1926
+ return transaction;
1927
+ }
1928
+ }, {
1929
+ key: "preloadTransaction",
1930
+ value: function preloadTransaction(options) {
1931
+ var _this2 = this;
1932
+ this.newTransaction(_objectSpread2(_objectSpread2({}, options), {}, {
1933
+ preload: true
1934
+ }));
1935
+ var loadPopup = function loadPopup() {
1936
+ return _this2.animateCheckoutIn();
1937
+ };
1938
+ return loadPopup;
1939
+ }
1940
+ }, {
1941
+ key: "paymentRequest",
1942
+ value: function paymentRequest(parameters) {
1943
+ var _this3 = this;
1944
+ var container = parameters.container,
1945
+ styles = parameters.styles,
1946
+ onElementsMount = parameters.onElementsMount,
1947
+ transactionParams = _objectWithoutProperties(parameters, _excluded2);
1948
+ inlineInstance = this;
1949
+ return new Promise(function (resolve, reject) {
1950
+ var loadPaystackCheckoutButton = document.querySelector("#".concat(parameters.loadPaystackCheckoutButton));
1951
+ if (inlineInstance.activeTransaction()) {
1952
+ inlineInstance.activeTransaction().cancel();
1953
+ }
1954
+ if (!(container && getPaymentRequestContainer(container))) {
1955
+ handleError('A container is required to mount the payment request button');
1956
+ }
1957
+ inlineInstance.paymentRequestContainer = getPaymentRequestContainer(container);
1958
+ var resumableTransaction = findResumableTransaction(inlineInstance.transactions, transactionParams);
1959
+ var transaction = resumableTransaction || new InlineTransaction(transactionParams);
1960
+ transaction.requestInline().then(function (response) {
1961
+ if (resumableTransaction) {
1962
+ transaction.isActive = true;
1963
+ } else {
1964
+ inlineInstance.transactions.push(transaction);
1965
+ }
1966
+ return mountPaymentRequestButtons(inlineInstance.paymentRequestContainer, {
1967
+ transaction: transaction,
1968
+ styles: styles,
1969
+ onClickApplePayButton: function onClickApplePayButton() {
1970
+ return _this3.startApplePay();
1971
+ },
1972
+ onClickGooglePayButton: function onClickGooglePayButton() {
1973
+ return _this3.startGooglePay();
1974
+ }
1975
+ }).then(function (mountedElements) {
1976
+ if (onElementsMount) {
1977
+ onElementsMount(mountedElements);
1978
+ }
1979
+ }).catch(function () {
1980
+ if (onElementsMount) {
1981
+ onElementsMount(null);
1982
+ }
1983
+ }).finally(function () {
1984
+ if (loadPaystackCheckoutButton) {
1985
+ var loadPopup = inlineInstance.preloadTransaction({
1986
+ inlineTransaction: transaction,
1987
+ transactionData: response
1988
+ });
1989
+ loadPaystackCheckoutButton.onclick = loadPopup;
1990
+ } else if (!inlineInstance.hasMountedPaymentRequestButtons()) {
1991
+ logWarning("No payment request button could be mounted on this device. Please consult our documentation at https://developers.paystack.co/docs/paystack-inline to see how to load alternative payment options using 'loadPaystackCheckoutButton'");
1992
+ }
1993
+ resolve(transaction);
1994
+ });
1995
+ }).catch(function (error) {
1996
+ transaction.onSetupError({
1997
+ status: false,
1998
+ message: error.message
1999
+ });
2000
+ reject(error);
2001
+ });
2002
+ });
2003
+ }
2004
+ }, {
2005
+ key: "hasMountedPaymentRequestButtons",
2006
+ value: function hasMountedPaymentRequestButtons() {
2007
+ return getMountedPaymentRequestButtons(this.paymentRequestContainer).length > 0;
2008
+ }
2009
+ }, {
2010
+ key: "startGooglePay",
2011
+ value: function startGooglePay() {
2012
+ var _this4 = this;
2013
+ var paymentMethod = 'google pay';
2014
+ var transaction = this.activeTransaction();
2015
+ if (transaction && transaction.response) {
2016
+ if (this.isCharging) {
2017
+ return;
2018
+ }
2019
+ this.isCharging = true;
2020
+ try {
2021
+ var analyticsPayload = {
2022
+ channel: CHANNELS.GOOGLE_PAY,
2023
+ currency: transaction.response.currency,
2024
+ amount: getChannelAmount(transaction.response, CHANNELS.GOOGLE_PAY)
2025
+ };
2026
+ transaction.logAttempt(paymentMethod);
2027
+ this.sendAnalyticsEventToCheckout(analyticsActions.TRACK_PAYMENT_ATTEMPT, _objectSpread2(_objectSpread2({}, analyticsPayload), {}, {
2028
+ paymentMethod: paymentMethod
2029
+ }));
2030
+ var client = getGooglePayClient(resolveGooglePayEnvironment(transaction.response));
2031
+ client.loadPaymentData(buildPaymentDataRequest(transaction)).then(function (paymentData) {
2032
+ toggleGooglePayLoadingState(_this4.paymentRequestContainer, true);
2033
+ return chargeGooglePay({
2034
+ transactionId: transaction.id,
2035
+ paymentData: paymentData
2036
+ });
2037
+ }).then(function (response) {
2038
+ toggleGooglePayLoadingState(_this4.paymentRequestContainer, false);
2039
+ _this4.isCharging = false;
2040
+ transaction.logAPIResponse(response, paymentMethod);
2041
+ if (response.status === TRANSACTION_STATUS.SUCCESS) {
2042
+ var data = response.data,
2043
+ envelope = _objectWithoutProperties(response, _excluded3);
2044
+ try {
2045
+ transaction.onSuccess(_objectSpread2(_objectSpread2({}, data), envelope));
2046
+ } catch (error) {
2047
+ logWarning("Google Pay: the onSuccess callback threw. ".concat(error && error.message || error));
2048
+ }
2049
+ _this4.sendAnalyticsEventToCheckout(analyticsActions.TRACK_PAYMENT_COMPLETION, _objectSpread2(_objectSpread2({}, analyticsPayload), {}, {
2050
+ timeSpent: transaction.getTimeSpent()
2051
+ }));
2052
+ return;
2053
+ }
2054
+
2055
+ // `auth` means a step-up we cannot render here, so say so rather
2056
+ // than leaving the customer holding a token with nowhere to go.
2057
+ var message = response.status === TRANSACTION_STATUS.AUTH ? 'This card requires additional authentication, which is not supported here. Please use another payment method.' : response && response.message || 'Transaction attempt failed';
2058
+ transaction.onSetupError(_objectSpread2(_objectSpread2({}, response), {}, {
2059
+ message: message
2060
+ }));
2061
+ _this4.sendAnalyticsEventToCheckout(analyticsActions.TRACK_PAYMENT_ERROR, {
2062
+ channel: CHANNELS.GOOGLE_PAY,
2063
+ message: message
2064
+ });
2065
+ }, function (error) {
2066
+ toggleGooglePayLoadingState(_this4.paymentRequestContainer, false);
2067
+ _this4.isCharging = false;
2068
+ if (error && error.statusCode === GOOGLE_PAY_STATUS_CODE.CANCELED) {
2069
+ transaction.onCancel();
2070
+ return;
2071
+ }
2072
+ var statusCode = error && error.statusCode;
2073
+ if (statusCode === GOOGLE_PAY_STATUS_CODE.DEVELOPER_ERROR || statusCode === GOOGLE_PAY_STATUS_CODE.MERCHANT_ACCOUNT_ERROR) {
2074
+ logWarning("Google Pay: ".concat(statusCode, ". Google rejected the merchant or the origin serving the button. Check that the merchant ID and domain saved in Dashboard > Developers > Google Pay match this page."));
2075
+ }
2076
+ var message = error && (error.statusMessage || error.message) || 'Could not complete the Google Pay payment';
2077
+ transaction.onSetupError({
2078
+ status: false,
2079
+ message: message
2080
+ });
2081
+ _this4.sendAnalyticsEventToCheckout(analyticsActions.TRACK_PAYMENT_ERROR, {
2082
+ channel: CHANNELS.GOOGLE_PAY,
2083
+ message: message
2084
+ });
2085
+ }).catch(function (error) {
2086
+ _this4.isCharging = false;
2087
+ transaction.onSetupError({
2088
+ status: false,
2089
+ message: error && error.message || 'Could not complete the Google Pay payment'
2090
+ });
2091
+ });
2092
+ } catch (error) {
2093
+ this.isCharging = false;
2094
+ transaction.onSetupError(error);
2095
+ }
2096
+ } else {
2097
+ handleError('Could not initiate google pay transaction');
2098
+ }
2099
+ }
2100
+ }, {
2101
+ key: "startApplePay",
2102
+ value: function startApplePay() {
2103
+ var _this5 = this;
2104
+ var paymentMethod = 'apple pay';
2105
+ var transaction = this.activeTransaction();
2106
+ if (transaction && transaction.response) {
2107
+ if (this.isCharging) {
2108
+ return;
2109
+ }
2110
+ this.isCharging = true;
2111
+ try {
2112
+ var analyticsPayload = {
2113
+ channel: CHANNELS.APPLE_PAY,
2114
+ currency: transaction.response.currency,
2115
+ amount: getChannelAmount(transaction.response, CHANNELS.APPLE_PAY)
2116
+ };
2117
+ transaction.logAttempt(paymentMethod);
2118
+ this.sendAnalyticsEventToCheckout(analyticsActions.TRACK_PAYMENT_ATTEMPT, _objectSpread2(_objectSpread2({}, analyticsPayload), {}, {
2119
+ paymentMethod: paymentMethod
2120
+ }));
2121
+ var applePayPaymentRequest = generateApplePaymentRequestObject({
2122
+ currency: transaction.response.currency,
2123
+ amount: getChannelAmount(transaction.response, CHANNELS.APPLE_PAY),
2124
+ merchantName: transaction.response.merchant_name,
2125
+ interval: transaction.response.plan_details && transaction.response.plan_details.interval
2126
+ });
2127
+ var applePaySession = new window.ApplePaySession(config.applePayVersion, applePayPaymentRequest);
2128
+ applePaySession.onvalidatemerchant = function (_ref2) {
2129
+ var validationURL = _ref2.validationURL;
2130
+ var validateSession = validateApplePaySession({
2131
+ validationURL: validationURL,
2132
+ transactionId: transaction.id,
2133
+ merchantName: transaction.response.merchant_name
2134
+ });
2135
+ validateSession.then(function (response) {
2136
+ if (response.status !== TRANSACTION_STATUS.SUCCESS) {
2137
+ _this5.isCharging = false;
2138
+ transaction.onSetupError(response);
2139
+ } else {
2140
+ applePaySession.completeMerchantValidation(response.data);
2141
+ }
2142
+ transaction.logValidationResponse(response.message);
2143
+ }).catch(function (error) {
2144
+ _this5.isCharging = false;
2145
+ transaction.onSetupError(error);
2146
+ });
2147
+ };
2148
+ applePaySession.oncancel = function () {
2149
+ _this5.isCharging = false;
2150
+ transaction.onCancel();
2151
+ };
2152
+ applePaySession.onpaymentauthorized = function (_ref3) {
2153
+ var payment = _ref3.payment;
2154
+ var charge = chargeApplePay({
2155
+ transactionId: transaction.id,
2156
+ payment: payment
2157
+ });
2158
+ charge.then(function (response) {
2159
+ transaction.logAPIResponse(response, paymentMethod);
2160
+ _this5.isCharging = false;
2161
+ if (response.status === TRANSACTION_STATUS.SUCCESS) {
2162
+ applePaySession.completePayment(applePaySession.STATUS_SUCCESS);
2163
+ transaction.onSuccess(response);
2164
+ _this5.sendAnalyticsEventToCheckout(analyticsActions.TRACK_PAYMENT_COMPLETION, _objectSpread2(_objectSpread2({}, analyticsPayload), {}, {
2165
+ timeSpent: transaction.getTimeSpent()
2166
+ }));
2167
+ } else {
2168
+ applePaySession.completePayment(applePaySession.STATUS_FAILURE);
2169
+ transaction.onSetupError(response);
2170
+ _this5.sendAnalyticsEventToCheckout(analyticsActions.TRACK_PAYMENT_ERROR, {
2171
+ channel: CHANNELS.APPLE_PAY,
2172
+ message: response && response.message || 'Transaction attempt failed'
2173
+ });
2174
+ }
2175
+ }).catch(function (error) {
2176
+ _this5.isCharging = false;
2177
+ applePaySession.completePayment(applePaySession.STATUS_FAILURE);
2178
+ transaction.onSetupError(error);
2179
+ _this5.sendAnalyticsEventToCheckout(analyticsActions.TRACK_PAYMENT_ERROR, {
2180
+ channel: CHANNELS.APPLE_PAY,
2181
+ message: error && error.message || 'Error occurred'
2182
+ });
2183
+ });
2184
+ };
2185
+ applePaySession.begin();
2186
+ } catch (error) {
2187
+ this.isCharging = false;
2188
+ transaction.onSetupError(error);
2189
+ }
2190
+ } else {
2191
+ handleError('Could not initiate apple pay transaction');
2192
+ }
2193
+ }
2194
+ }, {
2195
+ key: "resumeTransaction",
2196
+ value: function resumeTransaction(accessCode) {
2197
+ var callbacks = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
2198
+ var onSuccess = callbacks.onSuccess,
2199
+ onCancel = callbacks.onCancel,
2200
+ onLoad = callbacks.onLoad,
2201
+ onError = callbacks.onError;
2202
+ return this.newTransaction({
2203
+ accessCode: accessCode,
2204
+ onSuccess: onSuccess,
2205
+ onCancel: onCancel,
2206
+ onLoad: onLoad,
2207
+ onError: onError
2208
+ });
2209
+ }
2210
+ }, {
2211
+ key: "activeTransaction",
2212
+ value: function activeTransaction() {
2213
+ var activeTransactions = this.transactions.filter(function (transaction) {
2214
+ return transaction.isActive;
2215
+ });
2216
+ var activeTransaction = activeTransactions.length ? activeTransactions[activeTransactions.length - 1] : null;
2217
+ return activeTransaction;
2218
+ }
2219
+ }, {
2220
+ key: "cancelTransaction",
2221
+ value: function cancelTransaction(id) {
2222
+ var transaction = this.transactions.find(function (t) {
2223
+ return t.id === id;
2224
+ }) || this.activeTransaction();
2225
+ if (transaction) {
2226
+ transaction.cancel();
2227
+ this.close();
2228
+ }
2229
+ }
2230
+ }, {
2231
+ key: "respondToEvent",
2232
+ value: function respondToEvent(event) {
2233
+ if (!event) {
2234
+ return;
2235
+ }
2236
+ var activeTransaction = this.activeTransaction();
2237
+ try {
2238
+ var actualEvent = event.data || event.message;
2239
+ var eventType = actualEvent.event,
2240
+ eventData = actualEvent.data;
2241
+ if (eventType) {
2242
+ switch (eventType) {
2243
+ case 'loaded:checkout':
2244
+ this.isLoaded = true;
2245
+ if (activeTransaction) {
2246
+ var checkoutIframe = this.checkoutIframe;
2247
+ var urlParameters = activeTransaction.urlParameters,
2248
+ response = activeTransaction.response;
2249
+ // TODO: reintroduce this when we resolve checkout caching issues
2250
+ // const params = response
2251
+ // ? { transactionData: response }
2252
+ // : urlParameters;
2253
+
2254
+ var params = response ? {
2255
+ accessCode: response.access_code,
2256
+ language: urlParameters === null || urlParameters === void 0 ? void 0 : urlParameters.language
2257
+ } : urlParameters;
2258
+ notifyIframeToUpdateURL({
2259
+ checkoutIframe: checkoutIframe,
2260
+ urlParameters: params
2261
+ });
2262
+ }
2263
+ break;
2264
+ case 'loaded:transaction':
2265
+ hideLoader(this.backgroundIframe);
2266
+ activeTransaction.onLoad(eventData);
2267
+ break;
2268
+ case 'error':
2269
+ {
2270
+ var error = eventData;
2271
+ if (error.type === 'setup') {
2272
+ activeTransaction.onSetupError(eventData);
2273
+ } else {
2274
+ activeTransaction.logError(eventData);
2275
+ }
2276
+ break;
2277
+ }
2278
+ case 'cancel':
2279
+ case 'close':
2280
+ {
2281
+ this.close();
2282
+ var status = eventData && eventData.status;
2283
+ if (status) {
2284
+ activeTransaction.setStatus(status);
2285
+ }
2286
+ var hasPaymentRequestButtons = this.hasMountedPaymentRequestButtons();
2287
+ if (!hasPaymentRequestButtons) {
2288
+ activeTransaction.isActive = false;
2289
+ }
2290
+ activeTransaction.onCancel();
2291
+ break;
2292
+ }
2293
+ case 'transfer:pending':
2294
+ {
2295
+ this.close();
2296
+ var _status = eventData && eventData.status;
2297
+ if (_status) {
2298
+ activeTransaction.setStatus(_status);
2299
+ }
2300
+ activeTransaction.onBankTransferConfirmationPending();
2301
+ break;
2302
+ }
2303
+ case 'success':
2304
+ this.close();
2305
+ activeTransaction.onSuccess(eventData);
2306
+ break;
2307
+ default:
2308
+ break;
2309
+ }
2310
+ }
2311
+ } catch (error) {
2312
+ // do nothing
2313
+ }
2314
+ }
2315
+ }, {
2316
+ key: "respondToEmbedEvents",
2317
+ value: function respondToEmbedEvents(event) {
2318
+ var activeTransaction = this.activeTransaction();
2319
+ var eventData = event.data || event.message;
2320
+ if (eventData && (typeof eventData === 'string' || eventData instanceof String)) {
2321
+ var response = parseResponse(eventData);
2322
+ var oldCheckoutCloseResponse = response && response.action === 'PaystackClose';
2323
+ if (oldCheckoutCloseResponse) {
2324
+ var chargeResponse = response.data;
2325
+ if (chargeResponse) {
2326
+ activeTransaction.onSuccess(eventData);
2327
+ }
2328
+ }
2329
+ if (response.action === 'PaystackTLSClose') {
2330
+ activeTransaction.cancel();
2331
+ }
2332
+ }
2333
+ }
2334
+ }, {
2335
+ key: "animateCheckoutIn",
2336
+ value: function animateCheckoutIn$1() {
2337
+ var _this6 = this;
2338
+ if (!this.isOpen) {
2339
+ var checkoutIframe = this.checkoutIframe,
2340
+ backgroundIframe = this.backgroundIframe;
2341
+ animateCheckoutIn({
2342
+ checkoutIframe: checkoutIframe,
2343
+ backgroundIframe: backgroundIframe
2344
+ }).then(function () {
2345
+ _this6.checkoutIframe.contentWindow.postMessage('render', '*');
2346
+ });
2347
+ this.isOpen = true;
2348
+ }
2349
+ }
2350
+ }, {
2351
+ key: "open",
2352
+ value: function open(urlParameters, preload) {
2353
+ if (!urlParameters) {
2354
+ return;
2355
+ }
2356
+ var checkoutIframe = this.checkoutIframe;
2357
+ notifyIframeToUpdateURL({
2358
+ checkoutIframe: checkoutIframe,
2359
+ urlParameters: urlParameters
2360
+ });
2361
+ if (!preload) {
2362
+ this.animateCheckoutIn();
2363
+ }
2364
+ }
2365
+ }, {
2366
+ key: "close",
2367
+ value: function close() {
2368
+ var _this7 = this;
2369
+ if (!this.isOpen) {
2370
+ return;
2371
+ }
2372
+ var checkoutIframe = this.checkoutIframe,
2373
+ backgroundIframe = this.backgroundIframe;
2374
+ animateCheckoutOut({
2375
+ checkoutIframe: checkoutIframe,
2376
+ backgroundIframe: backgroundIframe
2377
+ }).then(function () {
2378
+ _this7.checkoutIframe.contentWindow.postMessage('close', '*');
2379
+ });
2380
+ this.isOpen = false;
2381
+ }
2382
+ }, {
2383
+ key: "isLoaded",
2384
+ value: function isLoaded() {
2385
+ return this.isLoaded;
2386
+ }
2387
+ }], [{
2388
+ key: "setup",
2389
+ value: function setup(parameters) {
2390
+ var isDeprecatedApi = true;
2391
+ var isEmbed = parameters && parameters.container;
2392
+ if (!inlineInstance) {
2393
+ inlineInstance = new Inline({
2394
+ isDeprecatedApi: isDeprecatedApi,
2395
+ isEmbed: isEmbed
2396
+ });
2397
+ }
2398
+ printDeprecationNotice('PaystackPop.setup()', 'new PaystackPop()', 'Please consult our documentation at https://developers.paystack.co/docs/paystack-inline');
2399
+ var transaction = inlineInstance.newTransaction(parameters, 'deprecated');
2400
+ var urlParameters = transaction.urlParameters;
2401
+ if (isEmbed) {
2402
+ var inlineUrl = "".concat(config.siteUrl, "/assets/payment/production/inline.html?").concat(serialize(urlParameters));
2403
+ var iframe = mountEmbedCheckoutIframe(inlineInstance.id, inlineUrl);
2404
+ appendIframeToContainer(parameters.container, iframe);
2405
+ iframe.onload = function onLoad() {
2406
+ iframe.contentWindow.postMessage("PaystackOpen ".concat(inlineInstance.id), '*');
2407
+ animateEmbedCheckoutIn(iframe);
2408
+ };
2409
+ } else {
2410
+ // attach openIframe method
2411
+ transaction.openIframe = function () {
2412
+ printDeprecationNotice('openIframe', 'open', 'Please consult our documentation at https://developers.paystack.co/docs/paystack-inline');
2413
+ inlineInstance.open(urlParameters);
2414
+ };
2415
+ }
2416
+ return transaction;
2417
+ }
2418
+ }]);
2419
+ }();
2420
+ if (scriptCanUseDataAttributes()) {
2421
+ var parameters = getDataAttributesAsParameters();
2422
+ var parentForm = getSourceScript().parentElement;
2423
+ if (!inlineInstance) {
2424
+ inlineInstance = new Inline();
2425
+ }
2426
+ var transaction;
2427
+ var inlineButton = mountLazyInlineButton({
2428
+ inlineId: inlineInstance.id,
2429
+ amount: parameters.amount / 100,
2430
+ currency: parameters.currency,
2431
+ id: parameters.buttonId,
2432
+ text: parameters.buttonText,
2433
+ variant: parameters.buttonVariant,
2434
+ wordmarkVariant: parameters.buttonWordmarkVariant,
2435
+ parent: getSourceScript()
2436
+ });
2437
+ inlineButton.addEventListener('click', function (e) {
2438
+ e.preventDefault();
2439
+ if (!transaction) {
2440
+ transaction = inlineInstance.newTransaction(_objectSpread2(_objectSpread2({}, parameters), {}, {
2441
+ onSuccess: function onSuccess(response) {
2442
+ mountInput({
2443
+ type: 'hidden',
2444
+ name: 'reference',
2445
+ value: response.reference,
2446
+ parent: parentForm
2447
+ });
2448
+ parentForm.submit();
2449
+ }
2450
+ }));
2451
+ } else {
2452
+ inlineInstance.resumeTransaction(transaction.accessCode);
2453
+ }
2454
+ });
2455
+ }
2456
+
2457
+ module.exports = Inline;