@spot-flow/checkout-inline-js 0.1.34 → 0.1.35
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.
|
@@ -30123,7 +30123,7 @@ class Hd {
|
|
|
30123
30123
|
if (i) {
|
|
30124
30124
|
const l = this.currency, d = l === "USD" ? (s = (t = this.merchantPlanDetail) == null ? void 0 : t.rate) == null ? void 0 : s.from : l;
|
|
30125
30125
|
e ? i.textContent = e : i.textContent = `Continue to pay ${d} ${Le(
|
|
30126
|
-
this.totalAmount ? this.totalAmount : (this.amount || 0) * (l === "USD" ? (a = (o = this.merchantPlanDetail) == null ? void 0 : o.rate) == null ? void 0 : a.rate : 1),
|
|
30126
|
+
this.totalAmount !== this.amount ? this.totalAmount : (this.amount || 0) * (l === "USD" ? (a = (o = this.merchantPlanDetail) == null ? void 0 : o.rate) == null ? void 0 : a.rate : 1),
|
|
30127
30127
|
2
|
|
30128
30128
|
)}`;
|
|
30129
30129
|
}
|
|
@@ -33841,7 +33841,7 @@ class _s {
|
|
|
33841
33841
|
if (i) {
|
|
33842
33842
|
const t = this.localCurrency ? this.localCurrency : this.currency;
|
|
33843
33843
|
i.textContent = `Continue to pay ${t} ${Le(
|
|
33844
|
-
this.totalAmount ? this.totalAmount : this.amount * (this.rate ? this.rate : 1),
|
|
33844
|
+
this.totalAmount !== this.amount ? this.totalAmount : this.amount * (this.rate ? this.rate : 1),
|
|
33845
33845
|
2
|
|
33846
33846
|
)}`;
|
|
33847
33847
|
}
|
|
@@ -35214,7 +35214,7 @@ class cu {
|
|
|
35214
35214
|
if (i) {
|
|
35215
35215
|
const t = this.localCurrency ? this.localCurrency : this.currency;
|
|
35216
35216
|
i.textContent = `Continue to pay ${t} ${Le(
|
|
35217
|
-
this.totalAmount ? this.totalAmount : this.amount * (this.rate ? this.rate : 1),
|
|
35217
|
+
this.totalAmount !== this.amount ? this.totalAmount : this.amount * (this.rate ? this.rate : 1),
|
|
35218
35218
|
2
|
|
35219
35219
|
)}`;
|
|
35220
35220
|
}
|
package/dist/checkout-inline.js
CHANGED
|
@@ -840,7 +840,7 @@ or you can use record.mirror to access the mirror instance during recording.`;le
|
|
|
840
840
|
<path
|
|
841
841
|
d="M62 32C62 38.6156 59.8132 45.0457 55.78 50.2897C51.7468 55.5336 46.0932 59.2974 39.6992 60.9952C33.3052 62.693 26.5293 62.2297 20.4258 59.6774C14.3224 57.1251 9.2338 52.6268 5.95186 46.8827C2.66993 41.1385 1.37873 34.4707 2.2792 27.9166C3.17967 21.3626 6.22129 15.29 10.9308 10.6438C15.6402 5.9976 21.7534 3.0384 28.3191 2.22668C34.8847 1.41496 41.5345 2.79623 47.2337 6.15557"
|
|
842
842
|
stroke="black" stroke-width="4" stroke-linejoin="round" />
|
|
843
|
-
</svg>`),o&&o.classList.add("hidden"),li(this.token,i,this.rdtCode,this.url).then(({data:a,headers:l})=>{var d,v,p,g,f,y,w;if(a.status==="failed")P.track("verify_payment",{payment_method:"Card",verification_status:"Failed",authentication_type:"PIN"}),this.currentStep=4,a.providerMessage?this.warningScreen.setPaymentError(a.providerMessage):this.warningScreen.setPaymentError("Payment failed"),this.warningScreen.hideReportIssue();else if(["success","successful","failed"].includes(a.status))this.currentStep=5,this.redirectTo(a,l,"success"),P.track("verify_payment",{payment_method:"Card",verification_status:"Success",authentication_type:"PIN"});else{if(((d=a==null?void 0:a.authorization)==null?void 0:d.mode)==="3DS"){(v=a==null?void 0:a.authorization)!=null&&v.redirectUrl&&this.redirectTo3DS((p=a==null?void 0:a.authorization)==null?void 0:p.redirectUrl),(g=a==null?void 0:a.authorization)!=null&&g.embeddedHtml&&this.redirectToPreciumDoc((f=a==null?void 0:a.authorization)==null?void 0:f.embeddedHtml);return}if(((y=a==null?void 0:a.authorization)==null?void 0:y.mode)==="otp"){this.cardResponse=a,this.currentStep=3;return}if(((w=a==null?void 0:a.authorization)==null?void 0:w.mode)==="avs"){this.currentStep=7;return}}}).catch(a=>{P.track("verify_payment",{payment_method:"Card",verification_status:"Null",authentication_type:"PIN"}),this.currentStep=4,a.message?this.warningScreen.setPaymentError(a.message):this.warningScreen.setPaymentError("Payment failed"),this.warningScreen.hideReportIssue()})},300)}}showLoader(){this.pageLoader=new Re(this.contents),this.pageLoader.mountLoader()}pinErrorStates(e,i,t){const o=this.container.querySelector("#pin-error");o&&(o.innerHTML=e||"Payment Failed"),t&&t.classList.remove("hidden"),i&&(i.innerHTML="")}setPaymentError(e){const i=this.container.querySelector("#payment-warning-text"),t=this.container.querySelector(".warning-list");i&&(i.textContent=e),t&&[{text:"Try again with your card",action:"go-to-card"},{text:"Try again with transfer",action:"go-to-transfer"}].forEach(({action:s,text:a})=>{const l=document.createElement("button");l.textContent=a,l.setAttribute("id",s),l.classList.add("warning-button");const d=document.createElement("div");d.appendChild(l),t.appendChild(d)})}validatedAVS(e,i){e.stopPropagation(),e.preventDefault();const t=this.container.querySelector(".spinner"),o=this.container.querySelector("#avs-form-button-text"),s={authorization:{avs:{state:i==null?void 0:i.state,city:i==null?void 0:i.city,country:i==null?void 0:i.country,address:i==null?void 0:i.address,zipCode:(i==null?void 0:i.code)||"-"}},reference:this.activeRef};P.track("input_address",{payment_method:"Card",authentication_type:"AVS"}),t&&o&&(t.classList.remove("hidden"),o.classList.add("hidden")),li(this.token,s,this.rdtCode,this.url).then(({data:l,headers:d})=>{var v,p,g,f,y,w,C;if(l.status==="failed")this.currentStep=4,P.track("verify_payment",{payment_method:"Card",verification_status:"Failed",authentication_type:"AVS"}),l.providerMessage?this.warningScreen.setPaymentError(l.providerMessage):this.warningScreen.setPaymentError("Payment failed"),this.warningScreen.hideReportIssue();else if(["success","successful","failed"].includes(l.status))["success","successful"].includes(l.status)&&(this.currentStep=5,this.redirectTo(l,d,"success"),P.track("verify_payment",{payment_method:"Card",verification_status:"Success",authentication_type:"AVS"}));else{if(((v=l==null?void 0:l.authorization)==null?void 0:v.mode)==="pin"){this.currentStep=2;return}if(((p=l==null?void 0:l.authorization)==null?void 0:p.mode)==="3DS"){(g=l==null?void 0:l.authorization)!=null&&g.redirectUrl&&this.redirectTo3DS((f=l==null?void 0:l.authorization)==null?void 0:f.redirectUrl),(y=l==null?void 0:l.authorization)!=null&&y.embeddedHtml&&this.redirectToPreciumDoc((w=l==null?void 0:l.authorization)==null?void 0:w.embeddedHtml);return}if(((C=l==null?void 0:l.authorization)==null?void 0:C.mode)==="otp"){this.cardResponse=l,this.currentStep=3;return}}}).catch(l=>{this.currentStep=4,P.track("verify_payment",{payment_method:"Card",verification_status:"Null",authentication_type:"AVS"}),l.message?this.warningScreen.setPaymentError(l.message):this.warningScreen.setPaymentError("Payment failed"),this.warningScreen.hideReportIssue()}).finally(()=>{t&&o&&(t.classList.add("hidden"),o.classList.remove("hidden"))})}submitOtp(e,i){e.preventDefault();const t={authorization:{otp:i},reference:this.activeRef};this.currentStep=6,this.showLoader(),P.track("input_cardOTP",{payment_method:"Card",authentication_type:"PIN+0TP"}),li(this.token,t,this.rdtCode,this.url).then(({data:s,headers:a})=>{var l,d,v,p,g,f,y,w;if(s.status==="failed")this.currentStep=4,P.track("verify_payment",{payment_method:"Card",verification_status:"Failed",authentication_type:"PIN+0TP"}),s.providerMessage?this.warningScreen.setPaymentError(s.providerMessage):this.warningScreen.setPaymentError("Payment failed"),this.warningScreen.hideReportIssue();else if(["success","successful","failed"].includes(s.status))["success","successful"].includes(s.status)&&(this.currentStep=5,this.redirectTo(s,a,"success"),P.track("verify_payment",{payment_method:"Card",verification_status:"Success",authentication_type:"PIN+0TP"}));else{if(this.activeRef=s.reference,((l=s==null?void 0:s.authorization)==null?void 0:l.mode)==="pin"){this.currentStep=2;return}if(((d=s==null?void 0:s.authorization)==null?void 0:d.mode)==="3DS"){(v=s==null?void 0:s.authorization)!=null&&v.redirectUrl&&this.redirectTo3DS((p=s==null?void 0:s.authorization)==null?void 0:p.redirectUrl),(g=s==null?void 0:s.authorization)!=null&&g.embeddedHtml&&this.redirectToPreciumDoc((f=s==null?void 0:s.authorization)==null?void 0:f.embeddedHtml);return}if(((y=s==null?void 0:s.authorization)==null?void 0:y.mode)==="otp"){this.cardResponse=s,this.currentStep=3;return}if(((w=s==null?void 0:s.authorization)==null?void 0:w.mode)==="avs"){this.currentStep=7;return}this.currentStep=9}}).catch(s=>{this.currentStep=4,P.track("verify_payment",{payment_method:"Card",verification_status:"Failed",authentication_type:"PIN+0TP"}),s.message?this.warningScreen.setPaymentError(s.message):this.warningScreen.setPaymentError("Payment failed"),this.warningScreen.hideReportIssue()})}redirectTo3DS(e){const i=window.open("","_blank");if(!i){alert("Please enable popups for this site to complete the authentication.");return}i.location.href=e,P.track("auth_redirect",{payment_method:"Card",authentication_type:"3DS"}),this.currentStep=6,this.showLoader();const t=setInterval(()=>{i.closed&&(clearInterval(t),this.verifyPayment(({data:o,headers:s})=>{this.currentStep=5,P.track("verify_payment",{payment_method:"Card",verification_status:"Success",authentication_type:"3DS"}),this.redirectTo(o,s,"success")},({data:o})=>{this.currentStep=4,o.providerMessage?this.warningScreen.setPaymentError(o.providerMessage):this.warningScreen.setPaymentError("Payment transaction failed"),this.warningScreen.hideReportIssue(),P.track("verify_payment",{payment_method:"Card",verification_status:"Failed",authentication_type:"3DS"})}))},2e3)}redirectToPreciumDoc(e){const i=atob(e),t=new Blob([i],{type:"text/html"}),o=URL.createObjectURL(t),s=window.open(o,"_blank");if(s){s.document.close(),P.track("auth_redirect",{payment_method:"Card",authentication_type:"3DS"}),this.currentStep=6,this.showLoader();const a=setInterval(()=>{s.closed&&(clearInterval(a),this.verifyPayment(({data:l,headers:d})=>{this.currentStep=5,P.track("verify_payment",{payment_method:"Card",verification_status:"Success",authentication_type:"3DS"}),this.redirectTo(l,d,"success")},({data:l})=>{this.currentStep=4,l.providerMessage?this.warningScreen.setPaymentError(l.providerMessage):this.warningScreen.setPaymentError("Payment transaction failed"),this.warningScreen.hideReportIssue(),P.track("verify_payment",{payment_method:"Card",verification_status:"Failed",authentication_type:"3DS"})}))},2e3)}else alert("Please enable popups for this site to complete the authentication.")}async verifyPayment(e,i){try{const t=await sn(this.token,this.activeRef,void 0,this.rdtCode,this.url);t.data.status==="failed"?i(t):(["success","successful"].includes(t.data.status)&&e(t),t.data.status==="inProgress"&&(this.currentStep=10))}catch{this.currentStep=4,P.track("verify_payment",{payment_method:"Card",verification_status:"Null",authentication_type:"3DS"}),this.warningScreen.setPaymentError("Payment transaction failed"),this.warningScreen.hideReportIssue()}}async verifyPaymentProcess(){try{const e=await sn(this.token,this.reference,void 0,this.rdtCode,this.url);this.cardResponse=e.data,this.cardResponseHeader=e.headers}catch{this.currentStep=4}}goBackToMerchant(){this.redirectTo(this.cardResponse,this.cardResponseHeader,this.callBackUrl)}renderCardContent(e){var t,o;e&&(this.merchantPlanDetail=e);const i=document.getElementById("go-back");if(this.currentStep!==1?(this.hidePaymentMethods(),i==null||i.classList.add("hidden")):this.showPaymentMethods(),this.isMobile&&this.hidePaymentMethods(),this.contents){switch(this.currentStep){case 1:this.cardDetailForm=new Dt({container:this.contents,onAction:a=>l=>this.submitCardDetails.bind(this)(a,l),merchantName:this.merchantPlanDetail.merchantName,currency:this.localCurrency!==this.currency?this.localCurrency:this.currency}),this.cardDetailForm.renderContent();break;case 2:this.cardPinForm=new qs({container:this.contents,onClose:this.onClose,onAction:a=>this.handlePinRequest.bind(this)(a)}),this.cardPinForm.renderComponent();break;case 3:this.cardOtpValidationForm=new zs({container:this.contents,onClose:this.onClose,onAction:a=>l=>this.submitOtp.bind(this)(a,l),otpMessage:((t=this.cardResponse)==null?void 0:t.providerMessage)||"Please enter your OTP sent to your phone"}),this.cardOtpValidationForm.renderComponent();break;case 4:this.warningScreen=new gn({container:this.contents,onAction:this.isMaxRetriesReached?this.goBackToMerchant.bind(this):this.restartTransactionProcess.bind(this),onReportIssue:()=>this.currentStep=8}),this.contents.innerHTML=this.warningScreen.render(),this.warningScreen.attachListener();break;case 5:this.successScreen=new Fn({container:this.contents,amount:this.totalAmount,currency:this.currency,localCurrency:this.localCurrency,rate:(o=this.merchantPlanDetail)==null?void 0:o.rate.rate}),this.successScreen.renderComponent();break;case 6:this.pageLoader=new Re(this.contents),this.pageLoader.mountLoader(),this.pageLoader.updateMessage("Verifying Payment");break;case 7:this.avsForm=new Js({container:this.contents,onAction:a=>l=>this.validatedAVS.bind(this)(a,l)}),this.avsForm.renderComponent();break;case 8:this.transactionIssuesScreen=new mi({container:this.contents,onAction:()=>{var a;this.currentStep=4,this.warningScreen.setPaymentError(((a=this.cardResponse)==null?void 0:a.providerMessage)||"Payment failed")},url:this.url,rdtCode:this.rdtCode,token:this.token,paymentChannel:"card",callBackUrl:this.callBackUrl,paymentResponse:this.cardResponse,paymentResponseHeaders:this.cardResponseHeader}),this.transactionIssuesScreen.renderTransactionIssuesComponent();break;case 9:this.confirmationEnd=new Wo({container:this.contents,onAction:a=>{this.currentStep=a},ref:this.reference,token:this.token,rdtCode:this.rdtCode,url:this.url,callBackUrl:this.callBackUrl,paymentResponse:this.cardResponse,paymentResponseHeaders:this.cardResponseHeader}),this.confirmationEnd.renderComponent();break;case 10:this.confirmationProgress=new zr({container:this.contents,onAction:a=>{this.currentStep=a},ref:this.reference,onSuccess:this.onSuccess.bind(this),token:this.token,rdtCode:this.rdtCode,url:this.url,callBackUrl:this.callBackUrl,setPaymentResponses:(a,l)=>{this.cardResponse=a,this.cardResponseHeader=l},step:{failed:4,success:5,end:9},paymentMethod:"Card"}),this.confirmationProgress.renderComponent();break;default:this.cardDetailForm=new Dt({container:this.contents,onAction:a=>l=>this.submitCardDetails.bind(this)(a,l),merchantName:this.merchantPlanDetail.merchantName,currency:this.localCurrency?this.localCurrency:this.currency}),this.cardDetailForm.renderContent();break}this.displayButtonText();const s=this.container.querySelector("#card-currency");s&&(s.textContent=`${this.localCurrency?this.localCurrency:this.currency} Card`)}}redirectTo(e,i,t){const o=i.get("spf-redirect-url");this.callBackUrl=o||this.callBackUrl,this.callBackUrl?setTimeout(()=>{const s=new URL(this.callBackUrl);s.searchParams.append("status",e.status),s.searchParams.append("reference",e.reference),window.location.href=s.toString()},1800):t==="success"&&this.onSuccess(e)}displayButtonText(e){var t,o,s,a;const i=this.container.querySelector("#details-form-button-text");if(i){const l=this.currency,d=l==="USD"?(o=(t=this.merchantPlanDetail)==null?void 0:t.rate)==null?void 0:o.from:l;e?i.textContent=e:i.textContent=`Continue to pay ${d} ${xe(this.totalAmount?this.totalAmount:(this.amount||0)*(l==="USD"?(a=(s=this.merchantPlanDetail)==null?void 0:s.rate)==null?void 0:a.rate:1),2)}`}}}const qr=`<div>
|
|
843
|
+
</svg>`),o&&o.classList.add("hidden"),li(this.token,i,this.rdtCode,this.url).then(({data:a,headers:l})=>{var d,v,p,g,f,y,w;if(a.status==="failed")P.track("verify_payment",{payment_method:"Card",verification_status:"Failed",authentication_type:"PIN"}),this.currentStep=4,a.providerMessage?this.warningScreen.setPaymentError(a.providerMessage):this.warningScreen.setPaymentError("Payment failed"),this.warningScreen.hideReportIssue();else if(["success","successful","failed"].includes(a.status))this.currentStep=5,this.redirectTo(a,l,"success"),P.track("verify_payment",{payment_method:"Card",verification_status:"Success",authentication_type:"PIN"});else{if(((d=a==null?void 0:a.authorization)==null?void 0:d.mode)==="3DS"){(v=a==null?void 0:a.authorization)!=null&&v.redirectUrl&&this.redirectTo3DS((p=a==null?void 0:a.authorization)==null?void 0:p.redirectUrl),(g=a==null?void 0:a.authorization)!=null&&g.embeddedHtml&&this.redirectToPreciumDoc((f=a==null?void 0:a.authorization)==null?void 0:f.embeddedHtml);return}if(((y=a==null?void 0:a.authorization)==null?void 0:y.mode)==="otp"){this.cardResponse=a,this.currentStep=3;return}if(((w=a==null?void 0:a.authorization)==null?void 0:w.mode)==="avs"){this.currentStep=7;return}}}).catch(a=>{P.track("verify_payment",{payment_method:"Card",verification_status:"Null",authentication_type:"PIN"}),this.currentStep=4,a.message?this.warningScreen.setPaymentError(a.message):this.warningScreen.setPaymentError("Payment failed"),this.warningScreen.hideReportIssue()})},300)}}showLoader(){this.pageLoader=new Re(this.contents),this.pageLoader.mountLoader()}pinErrorStates(e,i,t){const o=this.container.querySelector("#pin-error");o&&(o.innerHTML=e||"Payment Failed"),t&&t.classList.remove("hidden"),i&&(i.innerHTML="")}setPaymentError(e){const i=this.container.querySelector("#payment-warning-text"),t=this.container.querySelector(".warning-list");i&&(i.textContent=e),t&&[{text:"Try again with your card",action:"go-to-card"},{text:"Try again with transfer",action:"go-to-transfer"}].forEach(({action:s,text:a})=>{const l=document.createElement("button");l.textContent=a,l.setAttribute("id",s),l.classList.add("warning-button");const d=document.createElement("div");d.appendChild(l),t.appendChild(d)})}validatedAVS(e,i){e.stopPropagation(),e.preventDefault();const t=this.container.querySelector(".spinner"),o=this.container.querySelector("#avs-form-button-text"),s={authorization:{avs:{state:i==null?void 0:i.state,city:i==null?void 0:i.city,country:i==null?void 0:i.country,address:i==null?void 0:i.address,zipCode:(i==null?void 0:i.code)||"-"}},reference:this.activeRef};P.track("input_address",{payment_method:"Card",authentication_type:"AVS"}),t&&o&&(t.classList.remove("hidden"),o.classList.add("hidden")),li(this.token,s,this.rdtCode,this.url).then(({data:l,headers:d})=>{var v,p,g,f,y,w,C;if(l.status==="failed")this.currentStep=4,P.track("verify_payment",{payment_method:"Card",verification_status:"Failed",authentication_type:"AVS"}),l.providerMessage?this.warningScreen.setPaymentError(l.providerMessage):this.warningScreen.setPaymentError("Payment failed"),this.warningScreen.hideReportIssue();else if(["success","successful","failed"].includes(l.status))["success","successful"].includes(l.status)&&(this.currentStep=5,this.redirectTo(l,d,"success"),P.track("verify_payment",{payment_method:"Card",verification_status:"Success",authentication_type:"AVS"}));else{if(((v=l==null?void 0:l.authorization)==null?void 0:v.mode)==="pin"){this.currentStep=2;return}if(((p=l==null?void 0:l.authorization)==null?void 0:p.mode)==="3DS"){(g=l==null?void 0:l.authorization)!=null&&g.redirectUrl&&this.redirectTo3DS((f=l==null?void 0:l.authorization)==null?void 0:f.redirectUrl),(y=l==null?void 0:l.authorization)!=null&&y.embeddedHtml&&this.redirectToPreciumDoc((w=l==null?void 0:l.authorization)==null?void 0:w.embeddedHtml);return}if(((C=l==null?void 0:l.authorization)==null?void 0:C.mode)==="otp"){this.cardResponse=l,this.currentStep=3;return}}}).catch(l=>{this.currentStep=4,P.track("verify_payment",{payment_method:"Card",verification_status:"Null",authentication_type:"AVS"}),l.message?this.warningScreen.setPaymentError(l.message):this.warningScreen.setPaymentError("Payment failed"),this.warningScreen.hideReportIssue()}).finally(()=>{t&&o&&(t.classList.add("hidden"),o.classList.remove("hidden"))})}submitOtp(e,i){e.preventDefault();const t={authorization:{otp:i},reference:this.activeRef};this.currentStep=6,this.showLoader(),P.track("input_cardOTP",{payment_method:"Card",authentication_type:"PIN+0TP"}),li(this.token,t,this.rdtCode,this.url).then(({data:s,headers:a})=>{var l,d,v,p,g,f,y,w;if(s.status==="failed")this.currentStep=4,P.track("verify_payment",{payment_method:"Card",verification_status:"Failed",authentication_type:"PIN+0TP"}),s.providerMessage?this.warningScreen.setPaymentError(s.providerMessage):this.warningScreen.setPaymentError("Payment failed"),this.warningScreen.hideReportIssue();else if(["success","successful","failed"].includes(s.status))["success","successful"].includes(s.status)&&(this.currentStep=5,this.redirectTo(s,a,"success"),P.track("verify_payment",{payment_method:"Card",verification_status:"Success",authentication_type:"PIN+0TP"}));else{if(this.activeRef=s.reference,((l=s==null?void 0:s.authorization)==null?void 0:l.mode)==="pin"){this.currentStep=2;return}if(((d=s==null?void 0:s.authorization)==null?void 0:d.mode)==="3DS"){(v=s==null?void 0:s.authorization)!=null&&v.redirectUrl&&this.redirectTo3DS((p=s==null?void 0:s.authorization)==null?void 0:p.redirectUrl),(g=s==null?void 0:s.authorization)!=null&&g.embeddedHtml&&this.redirectToPreciumDoc((f=s==null?void 0:s.authorization)==null?void 0:f.embeddedHtml);return}if(((y=s==null?void 0:s.authorization)==null?void 0:y.mode)==="otp"){this.cardResponse=s,this.currentStep=3;return}if(((w=s==null?void 0:s.authorization)==null?void 0:w.mode)==="avs"){this.currentStep=7;return}this.currentStep=9}}).catch(s=>{this.currentStep=4,P.track("verify_payment",{payment_method:"Card",verification_status:"Failed",authentication_type:"PIN+0TP"}),s.message?this.warningScreen.setPaymentError(s.message):this.warningScreen.setPaymentError("Payment failed"),this.warningScreen.hideReportIssue()})}redirectTo3DS(e){const i=window.open("","_blank");if(!i){alert("Please enable popups for this site to complete the authentication.");return}i.location.href=e,P.track("auth_redirect",{payment_method:"Card",authentication_type:"3DS"}),this.currentStep=6,this.showLoader();const t=setInterval(()=>{i.closed&&(clearInterval(t),this.verifyPayment(({data:o,headers:s})=>{this.currentStep=5,P.track("verify_payment",{payment_method:"Card",verification_status:"Success",authentication_type:"3DS"}),this.redirectTo(o,s,"success")},({data:o})=>{this.currentStep=4,o.providerMessage?this.warningScreen.setPaymentError(o.providerMessage):this.warningScreen.setPaymentError("Payment transaction failed"),this.warningScreen.hideReportIssue(),P.track("verify_payment",{payment_method:"Card",verification_status:"Failed",authentication_type:"3DS"})}))},2e3)}redirectToPreciumDoc(e){const i=atob(e),t=new Blob([i],{type:"text/html"}),o=URL.createObjectURL(t),s=window.open(o,"_blank");if(s){s.document.close(),P.track("auth_redirect",{payment_method:"Card",authentication_type:"3DS"}),this.currentStep=6,this.showLoader();const a=setInterval(()=>{s.closed&&(clearInterval(a),this.verifyPayment(({data:l,headers:d})=>{this.currentStep=5,P.track("verify_payment",{payment_method:"Card",verification_status:"Success",authentication_type:"3DS"}),this.redirectTo(l,d,"success")},({data:l})=>{this.currentStep=4,l.providerMessage?this.warningScreen.setPaymentError(l.providerMessage):this.warningScreen.setPaymentError("Payment transaction failed"),this.warningScreen.hideReportIssue(),P.track("verify_payment",{payment_method:"Card",verification_status:"Failed",authentication_type:"3DS"})}))},2e3)}else alert("Please enable popups for this site to complete the authentication.")}async verifyPayment(e,i){try{const t=await sn(this.token,this.activeRef,void 0,this.rdtCode,this.url);t.data.status==="failed"?i(t):(["success","successful"].includes(t.data.status)&&e(t),t.data.status==="inProgress"&&(this.currentStep=10))}catch{this.currentStep=4,P.track("verify_payment",{payment_method:"Card",verification_status:"Null",authentication_type:"3DS"}),this.warningScreen.setPaymentError("Payment transaction failed"),this.warningScreen.hideReportIssue()}}async verifyPaymentProcess(){try{const e=await sn(this.token,this.reference,void 0,this.rdtCode,this.url);this.cardResponse=e.data,this.cardResponseHeader=e.headers}catch{this.currentStep=4}}goBackToMerchant(){this.redirectTo(this.cardResponse,this.cardResponseHeader,this.callBackUrl)}renderCardContent(e){var t,o;e&&(this.merchantPlanDetail=e);const i=document.getElementById("go-back");if(this.currentStep!==1?(this.hidePaymentMethods(),i==null||i.classList.add("hidden")):this.showPaymentMethods(),this.isMobile&&this.hidePaymentMethods(),this.contents){switch(this.currentStep){case 1:this.cardDetailForm=new Dt({container:this.contents,onAction:a=>l=>this.submitCardDetails.bind(this)(a,l),merchantName:this.merchantPlanDetail.merchantName,currency:this.localCurrency!==this.currency?this.localCurrency:this.currency}),this.cardDetailForm.renderContent();break;case 2:this.cardPinForm=new qs({container:this.contents,onClose:this.onClose,onAction:a=>this.handlePinRequest.bind(this)(a)}),this.cardPinForm.renderComponent();break;case 3:this.cardOtpValidationForm=new zs({container:this.contents,onClose:this.onClose,onAction:a=>l=>this.submitOtp.bind(this)(a,l),otpMessage:((t=this.cardResponse)==null?void 0:t.providerMessage)||"Please enter your OTP sent to your phone"}),this.cardOtpValidationForm.renderComponent();break;case 4:this.warningScreen=new gn({container:this.contents,onAction:this.isMaxRetriesReached?this.goBackToMerchant.bind(this):this.restartTransactionProcess.bind(this),onReportIssue:()=>this.currentStep=8}),this.contents.innerHTML=this.warningScreen.render(),this.warningScreen.attachListener();break;case 5:this.successScreen=new Fn({container:this.contents,amount:this.totalAmount,currency:this.currency,localCurrency:this.localCurrency,rate:(o=this.merchantPlanDetail)==null?void 0:o.rate.rate}),this.successScreen.renderComponent();break;case 6:this.pageLoader=new Re(this.contents),this.pageLoader.mountLoader(),this.pageLoader.updateMessage("Verifying Payment");break;case 7:this.avsForm=new Js({container:this.contents,onAction:a=>l=>this.validatedAVS.bind(this)(a,l)}),this.avsForm.renderComponent();break;case 8:this.transactionIssuesScreen=new mi({container:this.contents,onAction:()=>{var a;this.currentStep=4,this.warningScreen.setPaymentError(((a=this.cardResponse)==null?void 0:a.providerMessage)||"Payment failed")},url:this.url,rdtCode:this.rdtCode,token:this.token,paymentChannel:"card",callBackUrl:this.callBackUrl,paymentResponse:this.cardResponse,paymentResponseHeaders:this.cardResponseHeader}),this.transactionIssuesScreen.renderTransactionIssuesComponent();break;case 9:this.confirmationEnd=new Wo({container:this.contents,onAction:a=>{this.currentStep=a},ref:this.reference,token:this.token,rdtCode:this.rdtCode,url:this.url,callBackUrl:this.callBackUrl,paymentResponse:this.cardResponse,paymentResponseHeaders:this.cardResponseHeader}),this.confirmationEnd.renderComponent();break;case 10:this.confirmationProgress=new zr({container:this.contents,onAction:a=>{this.currentStep=a},ref:this.reference,onSuccess:this.onSuccess.bind(this),token:this.token,rdtCode:this.rdtCode,url:this.url,callBackUrl:this.callBackUrl,setPaymentResponses:(a,l)=>{this.cardResponse=a,this.cardResponseHeader=l},step:{failed:4,success:5,end:9},paymentMethod:"Card"}),this.confirmationProgress.renderComponent();break;default:this.cardDetailForm=new Dt({container:this.contents,onAction:a=>l=>this.submitCardDetails.bind(this)(a,l),merchantName:this.merchantPlanDetail.merchantName,currency:this.localCurrency?this.localCurrency:this.currency}),this.cardDetailForm.renderContent();break}this.displayButtonText();const s=this.container.querySelector("#card-currency");s&&(s.textContent=`${this.localCurrency?this.localCurrency:this.currency} Card`)}}redirectTo(e,i,t){const o=i.get("spf-redirect-url");this.callBackUrl=o||this.callBackUrl,this.callBackUrl?setTimeout(()=>{const s=new URL(this.callBackUrl);s.searchParams.append("status",e.status),s.searchParams.append("reference",e.reference),window.location.href=s.toString()},1800):t==="success"&&this.onSuccess(e)}displayButtonText(e){var t,o,s,a;const i=this.container.querySelector("#details-form-button-text");if(i){const l=this.currency,d=l==="USD"?(o=(t=this.merchantPlanDetail)==null?void 0:t.rate)==null?void 0:o.from:l;e?i.textContent=e:i.textContent=`Continue to pay ${d} ${xe(this.totalAmount!==this.amount?this.totalAmount:(this.amount||0)*(l==="USD"?(a=(s=this.merchantPlanDetail)==null?void 0:s.rate)==null?void 0:a.rate:1),2)}`}}}const qr=`<div>
|
|
844
844
|
<div class="container-center h-[40vh] hidden" id="loader">
|
|
845
845
|
<img src="" alt="loader gif" />
|
|
846
846
|
</div>
|
|
@@ -1077,7 +1077,7 @@ or you can use record.mirror to access the mirror instance during recording.`;le
|
|
|
1077
1077
|
</div>
|
|
1078
1078
|
</div>
|
|
1079
1079
|
</div>
|
|
1080
|
-
</form>`;class Qo{constructor(e){m(this,"container");m(this,"bank_service");m(this,"bank_list");m(this,"onAction");m(this,"selectedBank");m(this,"currency");m(this,"localCurrency");m(this,"rate");m(this,"amount");m(this,"totalAmount");this.container=e.container,this.currency=e.currency,this.localCurrency=e.localCurrency,this.rate=e.rate,this.amount=e.amount,this.totalAmount=e.totalAmount,this.bank_list=[],this.bank_service=new il({token:e.merchantKey,rdtCode:e.rdtCode,url:e.url}),this.selectedBank={code:"",name:""},this.onAction=e.onAction?e.onAction:()=>null}attachListerner(){const e=document.getElementById("bank-search-input"),i=document.querySelectorAll(".select-option-tag"),t=document.querySelector("#ussd-bank-button"),o=document.querySelector("#ussdBanks");e&&e.addEventListener("change",s=>{var a,l;if(s.stopPropagation(),this.selectedBank={code:e.value,name:((l=(a=this.bank_list.filter(d=>d.code==e.value))==null?void 0:a[0])==null?void 0:l.name)||""},this.validateForm())t&&t.removeAttribute("disabled");else if(t){if(t.disabled)return;t.setAttribute("disabled","")}}),i&&Array.from(i).forEach(a=>{a.addEventListener("click",function(l){P.track("select_bank",{payment_method:"USSD"}),l.stopPropagation()})}),o&&o.addEventListener("submit",s=>{s.preventDefault(),this.onAction(this.selectedBank)})}validateForm(){return!!this.selectedBank.code}displayButtonText(e){const i=this.container.querySelector("#ussd-bank-button-text");if(i){const t=this.localCurrency?this.localCurrency:this.currency;i.textContent=`Continue to pay ${t} ${xe(this.totalAmount?this.totalAmount:this.amount*(this.rate?this.rate:1),2)}`}}renderContent(){this.container.innerHTML=this.render();const e=this.container.querySelector("#bank-search-input");if(e){const i=new Option("Select your bank","",!0,!0);i.disabled=!0,e.appendChild(i),e.classList.remove("text-tone-100"),e.classList.add("text-tone-50")}this.bank_service.getBankList().then(i=>{this.bank_list=i,e&&i.forEach(t=>{const o=new Option(t.name,t.code);e.appendChild(o),e.classList.remove("text-tone-50"),e.classList.add("text-tone-100")})}),this.displayButtonText(),this.attachListerner()}render(){return tl}}const ol=`<div id="viewCode">
|
|
1080
|
+
</form>`;class Qo{constructor(e){m(this,"container");m(this,"bank_service");m(this,"bank_list");m(this,"onAction");m(this,"selectedBank");m(this,"currency");m(this,"localCurrency");m(this,"rate");m(this,"amount");m(this,"totalAmount");this.container=e.container,this.currency=e.currency,this.localCurrency=e.localCurrency,this.rate=e.rate,this.amount=e.amount,this.totalAmount=e.totalAmount,this.bank_list=[],this.bank_service=new il({token:e.merchantKey,rdtCode:e.rdtCode,url:e.url}),this.selectedBank={code:"",name:""},this.onAction=e.onAction?e.onAction:()=>null}attachListerner(){const e=document.getElementById("bank-search-input"),i=document.querySelectorAll(".select-option-tag"),t=document.querySelector("#ussd-bank-button"),o=document.querySelector("#ussdBanks");e&&e.addEventListener("change",s=>{var a,l;if(s.stopPropagation(),this.selectedBank={code:e.value,name:((l=(a=this.bank_list.filter(d=>d.code==e.value))==null?void 0:a[0])==null?void 0:l.name)||""},this.validateForm())t&&t.removeAttribute("disabled");else if(t){if(t.disabled)return;t.setAttribute("disabled","")}}),i&&Array.from(i).forEach(a=>{a.addEventListener("click",function(l){P.track("select_bank",{payment_method:"USSD"}),l.stopPropagation()})}),o&&o.addEventListener("submit",s=>{s.preventDefault(),this.onAction(this.selectedBank)})}validateForm(){return!!this.selectedBank.code}displayButtonText(e){const i=this.container.querySelector("#ussd-bank-button-text");if(i){const t=this.localCurrency?this.localCurrency:this.currency;i.textContent=`Continue to pay ${t} ${xe(this.totalAmount!==this.amount?this.totalAmount:this.amount*(this.rate?this.rate:1),2)}`}}renderContent(){this.container.innerHTML=this.render();const e=this.container.querySelector("#bank-search-input");if(e){const i=new Option("Select your bank","",!0,!0);i.disabled=!0,e.appendChild(i),e.classList.remove("text-tone-100"),e.classList.add("text-tone-50")}this.bank_service.getBankList().then(i=>{this.bank_list=i,e&&i.forEach(t=>{const o=new Option(t.name,t.code);e.appendChild(o),e.classList.remove("text-tone-50"),e.classList.add("text-tone-100")})}),this.displayButtonText(),this.attachListerner()}render(){return tl}}const ol=`<div id="viewCode">
|
|
1081
1081
|
<div class="grid gap-4">
|
|
1082
1082
|
<div class="text-center">
|
|
1083
1083
|
<div class="md:w-4/5 mx-auto grid gap-3">
|
|
@@ -1721,7 +1721,7 @@ or you can use record.mirror to access the mirror instance during recording.`;le
|
|
|
1721
1721
|
Ghana Revenue Authority (GRA).
|
|
1722
1722
|
</div>
|
|
1723
1723
|
</div>
|
|
1724
|
-
</form>`;class yl{constructor(e){m(this,"container");m(this,"payment");m(this,"warningError");m(this,"pageLoader");m(this,"localCurrency");m(this,"rate");m(this,"amount");m(this,"totalAmount");m(this,"onAction");m(this,"switchScreen");m(this,"merchantKey");m(this,"rdtCode");m(this,"url");m(this,"currency");m(this,"restartTransactionProcess");this.container=e.container,this.onAction=e.onAction,this.switchScreen=e.switchScreen,this.url=e.url,this.merchantKey=e.merchantKey,this.rdtCode=e.rdtCode,this.currency=e.currency,this.localCurrency=e.localCurrency,this.rate=e.rate,this.amount=e.amount,this.totalAmount=e.totalAmount,this.restartTransactionProcess=e.restartTransactionProcess,this.warningError=new gn({container:this.container,onAction:this.restartTransactionProcess.bind(this)})}validateForm(){const e=this.container.querySelector("#phone-number-input"),i=this.container.querySelector("#network-search-input"),t=this.container.querySelector(".details-form-button"),o=this.container.querySelector("#phone-number-container"),s=this.container.querySelector("#phone-number-error");if(!e||!i||!t)return;const a=this.localCurrency?this.localCurrency:this.currency,l=Fi.find(d=>d.name===a);e.value.length>Number((l==null?void 0:l.length)||"9")?(o&&(o.classList.remove("border-tone-40"),o.classList.add("border-[#D62020]"),e.classList.remove("text-tone-100"),e.classList.add("text-[#D62020]")),s&&(s.classList.remove("hidden"),s.classList.add("block"),s.innerHTML="Please enter a valid phone number. You can remove the leading zero if it exists.")):(o&&(o.classList.remove("border-[#D62020]"),o.classList.add("border-tone-40"),e.classList.remove("text-[#D62020]"),e.classList.add("text-tone-100")),s&&(s.classList.remove("block"),s.classList.add("hidden"))),e.value.length>0&&e.value.length===Number((l==null?void 0:l.length)||"9")&&i.value?t.disabled=!1:t.disabled=!0}attachListener(){const e=document.querySelector("#mobile-money-form"),i=document.querySelector("#pci-dss"),t=this.container.querySelector("#phone-number-input"),o=this.container.querySelector("#network-search-input"),s=this.container.querySelector(".details-form-button");s&&(s.disabled=!0),t&&o&&(t.addEventListener("input",a=>{const l=a.target;l.value=l.value.replace(/\D/g,""),this.validateForm()}),o.addEventListener("change",()=>this.validateForm())),i&&i.classList.add("hidden"),!(!o||!t||!s)&&e&&e.addEventListener("submit",a=>{a.preventDefault();const l=`0${t.value}`,d=o.value;this.onAction(a)({code:d,phoneNumber:l}),P.track("start_payment",{payment_method:"Mobile Money"})})}displayButtonText(e){const i=this.container.querySelector("#mobile-money-button-text");if(i){const t=this.localCurrency?this.localCurrency:this.currency;i.textContent=`Continue to pay ${t} ${xe(this.totalAmount?this.totalAmount:this.amount*(this.rate?this.rate:1),2)}`}}renderComponent(e){this.container.innerHTML=this.render();const i=this.container.querySelector("#network-search-input");if(i){const a=new Option("Select your network","",!0,!0);a.disabled=!0,i.appendChild(a),i.classList.remove("text-tone-100"),i.classList.add("text-tone-50"),i&&e.forEach(l=>{const d=new Option(l.name,l.code);i.appendChild(d),i.classList.remove("text-tone-50"),i.classList.add("text-tone-100")})}const t=this.container.querySelector("#region-code"),o=this.localCurrency?this.localCurrency:this.currency,s=Fi.find(a=>a.name===o);if(t){t.innerHTML=`
|
|
1724
|
+
</form>`;class yl{constructor(e){m(this,"container");m(this,"payment");m(this,"warningError");m(this,"pageLoader");m(this,"localCurrency");m(this,"rate");m(this,"amount");m(this,"totalAmount");m(this,"onAction");m(this,"switchScreen");m(this,"merchantKey");m(this,"rdtCode");m(this,"url");m(this,"currency");m(this,"restartTransactionProcess");this.container=e.container,this.onAction=e.onAction,this.switchScreen=e.switchScreen,this.url=e.url,this.merchantKey=e.merchantKey,this.rdtCode=e.rdtCode,this.currency=e.currency,this.localCurrency=e.localCurrency,this.rate=e.rate,this.amount=e.amount,this.totalAmount=e.totalAmount,this.restartTransactionProcess=e.restartTransactionProcess,this.warningError=new gn({container:this.container,onAction:this.restartTransactionProcess.bind(this)})}validateForm(){const e=this.container.querySelector("#phone-number-input"),i=this.container.querySelector("#network-search-input"),t=this.container.querySelector(".details-form-button"),o=this.container.querySelector("#phone-number-container"),s=this.container.querySelector("#phone-number-error");if(!e||!i||!t)return;const a=this.localCurrency?this.localCurrency:this.currency,l=Fi.find(d=>d.name===a);e.value.length>Number((l==null?void 0:l.length)||"9")?(o&&(o.classList.remove("border-tone-40"),o.classList.add("border-[#D62020]"),e.classList.remove("text-tone-100"),e.classList.add("text-[#D62020]")),s&&(s.classList.remove("hidden"),s.classList.add("block"),s.innerHTML="Please enter a valid phone number. You can remove the leading zero if it exists.")):(o&&(o.classList.remove("border-[#D62020]"),o.classList.add("border-tone-40"),e.classList.remove("text-[#D62020]"),e.classList.add("text-tone-100")),s&&(s.classList.remove("block"),s.classList.add("hidden"))),e.value.length>0&&e.value.length===Number((l==null?void 0:l.length)||"9")&&i.value?t.disabled=!1:t.disabled=!0}attachListener(){const e=document.querySelector("#mobile-money-form"),i=document.querySelector("#pci-dss"),t=this.container.querySelector("#phone-number-input"),o=this.container.querySelector("#network-search-input"),s=this.container.querySelector(".details-form-button");s&&(s.disabled=!0),t&&o&&(t.addEventListener("input",a=>{const l=a.target;l.value=l.value.replace(/\D/g,""),this.validateForm()}),o.addEventListener("change",()=>this.validateForm())),i&&i.classList.add("hidden"),!(!o||!t||!s)&&e&&e.addEventListener("submit",a=>{a.preventDefault();const l=`0${t.value}`,d=o.value;this.onAction(a)({code:d,phoneNumber:l}),P.track("start_payment",{payment_method:"Mobile Money"})})}displayButtonText(e){const i=this.container.querySelector("#mobile-money-button-text");if(i){const t=this.localCurrency?this.localCurrency:this.currency;i.textContent=`Continue to pay ${t} ${xe(this.totalAmount!==this.amount?this.totalAmount:this.amount*(this.rate?this.rate:1),2)}`}}renderComponent(e){this.container.innerHTML=this.render();const i=this.container.querySelector("#network-search-input");if(i){const a=new Option("Select your network","",!0,!0);a.disabled=!0,i.appendChild(a),i.classList.remove("text-tone-100"),i.classList.add("text-tone-50"),i&&e.forEach(l=>{const d=new Option(l.name,l.code);i.appendChild(d),i.classList.remove("text-tone-50"),i.classList.add("text-tone-100")})}const t=this.container.querySelector("#region-code"),o=this.localCurrency?this.localCurrency:this.currency,s=Fi.find(a=>a.name===o);if(t){t.innerHTML=`
|
|
1725
1725
|
${s==null?void 0:s.icon}
|
|
1726
1726
|
<span class="text-tone-100 text-sm font-semibold">${s==null?void 0:s.dialCode}</span>
|
|
1727
1727
|
`;const a=t.querySelector("svg");a&&(a.setAttribute("width","20"),a.setAttribute("height","20"))}this.displayButtonText(),this.attachListener()}renderContent(){this.switchScreen(2),Ls(this.merchantKey,this.currency,this.rdtCode,this.url,this.localCurrency).then(e=>{this.renderComponent(e)}).catch(e=>{this.switchScreen(5),e.message?this.warningError.setPaymentError(e.message):this.warningError.setPaymentError("Unable to fetch network providers at this time.")})}render(){return gl}}const Cl=`<div id="checkoutMobileOtp">
|