@spot-flow/checkout-inline-js 0.1.47-dev.1 → 0.1.47
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.
|
@@ -30475,6 +30475,12 @@ class Gd {
|
|
|
30475
30475
|
verification_status: "Failed",
|
|
30476
30476
|
authentication_type: "PIN"
|
|
30477
30477
|
}), this.cardResponse = l, this.cardResponseHeader = p, l.providerMessage ? this.warningScreen.setPaymentError(l.providerMessage) : this.warningScreen.setPaymentError("Payment failed"), this.warningScreen.hideReportIssue();
|
|
30478
|
+
else if (["success", "successful"].includes(l.status))
|
|
30479
|
+
this.currentStep = 5, this.cardResponse = l, this.cardResponseHeader = p, P.track("verify_payment", {
|
|
30480
|
+
payment_method: "Card",
|
|
30481
|
+
verification_status: "Success",
|
|
30482
|
+
authentication_type: "PIN"
|
|
30483
|
+
}), this.redirectTo(l, p, "success");
|
|
30478
30484
|
else if (!["success", "successful"].includes(l.status) && l.status !== "failed")
|
|
30479
30485
|
if (this.cardResponse = l, this.cardResponseHeader = p, l != null && l.authorization) {
|
|
30480
30486
|
if (this.activeRef = l.reference, ((v = l == null ? void 0 : l.authorization) == null ? void 0 : v.mode) === "pin") {
|
|
@@ -30495,11 +30501,6 @@ class Gd {
|
|
|
30495
30501
|
}
|
|
30496
30502
|
} else
|
|
30497
30503
|
this.currentStep = 4, l.providerMessage ? this.warningScreen.setPaymentError(l.providerMessage) : this.warningScreen.setPaymentError("Error with Payment"), this.warningScreen.hideReportIssue();
|
|
30498
|
-
else ["success", "successful"].includes(l.status) && (this.currentStep = 5, this.cardResponse = l, this.cardResponseHeader = p, P.track("verify_payment", {
|
|
30499
|
-
payment_method: "Card",
|
|
30500
|
-
verification_status: "Success",
|
|
30501
|
-
authentication_type: "PIN"
|
|
30502
|
-
}), this.redirectTo(l, p, "success"));
|
|
30503
30504
|
}).catch((l) => {
|
|
30504
30505
|
P.track("verify_payment", {
|
|
30505
30506
|
payment_method: "Card",
|
package/dist/checkout-inline.js
CHANGED
|
@@ -1376,7 +1376,7 @@ or you can use record.mirror to access the mirror instance during recording.`;le
|
|
|
1376
1376
|
<path
|
|
1377
1377
|
d="M4.66667 3.99992V1.99992C4.66667 1.82311 4.7369 1.65354 4.86193 1.52851C4.98695 1.40349 5.15652 1.33325 5.33333 1.33325H13.3333C13.5101 1.33325 13.6797 1.40349 13.8047 1.52851C13.9298 1.65354 14 1.82311 14 1.99992V11.3333C14 11.5101 13.9298 11.6796 13.8047 11.8047C13.6797 11.9297 13.5101 11.9999 13.3333 11.9999H11.3333V13.9999C11.3333 14.3679 11.0333 14.6666 10.662 14.6666H2.67133C2.58342 14.6671 2.49626 14.6503 2.41488 14.617C2.3335 14.5837 2.25949 14.5347 2.19711 14.4728C2.13472 14.4108 2.0852 14.3372 2.05137 14.256C2.01754 14.1749 2.00009 14.0878 2 13.9999L2.002 4.66659C2.002 4.29859 2.302 3.99992 2.67333 3.99992H4.66667ZM3.33533 5.33325L3.33333 13.3333H10V5.33325H3.33533ZM6 3.99992H11.3333V10.6666H12.6667V2.66659H6V3.99992Z"
|
|
1378
1378
|
fill="#0D0716" />
|
|
1379
|
-
</svg>`},1e3))})})}renderComponent(){this.container.innerHTML=this.render(),this.attachListener()}}function Yr(n){n.classList.remove("hidden"),requestAnimationFrame(()=>{n.classList.remove("opacity-0","scale-95")})}function Ri(n){n.classList.add("opacity-0","scale-95"),n.addEventListener("transitionend",()=>n.classList.add("hidden"),{once:!0})}class Qo{constructor({container:e,testCardContainer:i,keyEnvironment:t}){h(this,"container");h(this,"testCardContainer");h(this,"testCardInstance",null);h(this,"keyEnvironment",null);h(this,"isVisible",!1);this.container=e,this.testCardContainer=i,this.keyEnvironment=t,this.isVisible=!1}attachListener(){const e=this.container.querySelector("#test-cards-link");if(e){if(this.keyEnvironment!=="test"){e.classList.add("hidden");return}e.addEventListener("click",()=>{this.testCardInstance||(this.testCardInstance=new Yo({container:this.testCardContainer,closeCallback:()=>{this.testCardContainer.innerHTML="",Ri(this.testCardContainer),e.classList.remove("text-tone-100","font-bold"),this.isVisible=!1}})),this.testCardInstance.renderComponent(),Yr(this.testCardContainer),e.classList.add("text-tone-100","font-bold"),this.isVisible=!0})}}renderComponent(){this.container.innerHTML=this.render(),this.attachListener()}render(){return Jr}}function Oi(){return{httpBrowserLanguage:navigator.language||"en-US",httpBrowserJavaEnabled:!1,httpBrowserJavaScriptEnabled:!0,httpBrowserColorDepth:window.screen.colorDepth.toString(),httpBrowserScreenHeight:window.screen.height.toString(),httpBrowserScreenWidth:window.screen.width.toString(),httpBrowserTimeDifference:(-new Date().getTimezoneOffset()).toString(),userAgentBrowserValue:navigator.userAgent,deviceChannel:"Browser"}}class Qr{constructor({amount:e,totalAmount:i,container:t,customer:o,encryption:s,planId:r,token:d,currency:l,rdtCode:v,url:p,reference:g,onSuccess:b,callBackUrl:y,metadata:w,localCurrency:C,hidePaymentMethods:S,showPaymentMethods:_,onClose:A,restartTransactionProcess:M,retryingPayment:T,keys:D,testcardIsVisible:U}){h(this,"contents");h(this,"cardDetailForm");h(this,"cardOtpValidationForm");h(this,"merchantPlanDetail",{});h(this,"cardPinForm");h(this,"avsForm");h(this,"isw3dsForm");h(this,"successScreen");h(this,"pageLoader");h(this,"warningScreen");h(this,"transactionIssuesScreen");h(this,"container");h(this,"onSuccess");h(this,"planId","");h(this,"customer");h(this,"token");h(this,"amount");h(this,"totalAmount");h(this,"encryption");h(this,"currency");h(this,"_currentStep");h(this,"activeRef");h(this,"rdtCode");h(this,"url");h(this,"reference");h(this,"callBackUrl");h(this,"metadata");h(this,"localCurrency");h(this,"hidePaymentMethods");h(this,"showPaymentMethods");h(this,"onClose");h(this,"cardResponse");h(this,"cardResponseHeader");h(this,"confirmationEnd");h(this,"confirmationProgress");h(this,"restartTransactionProcess");h(this,"retryingPayment");h(this,"isMaxRetriesReached");h(this,"isCancelledPlan");h(this,"isMobile",!1);h(this,"keys");h(this,"testcardIsVisible",!1);this.currency=l,this.onSuccess=b||(()=>null),this.keys=D,this.testcardIsVisible=U,this.container=t,this.encryption=s,this.token=d,this.customer=o,this.planId=r,this.amount=e,this.totalAmount=i,this.rdtCode=v,this.url=p,this.reference=g,this.callBackUrl=y,this.metadata=w,this.localCurrency=C,this._currentStep=1,this.activeRef="",this.contents=this.container.querySelector("#payment-content-view"),this.cardResponse={},this.cardResponseHeader={},this.hidePaymentMethods=S,this.showPaymentMethods=_,this.onClose=A,this.restartTransactionProcess=M,this.retryingPayment=T,this.isMaxRetriesReached=!1,this.isCancelledPlan=!1,this.renderCardContent(),P.track("card_opens",{payment_method:"Card"}),this.isMobile=window.matchMedia("(max-width: 767px)").matches}get currentStep(){return this._currentStep}set currentStep(e){this._currentStep=e,this.renderCardContent()}async submitCardDetails(e,i){e.preventDefault(),P.track("input_cardDetails",{payment_method:"Card",authentication_type:"PIN"});const t=this.container.querySelector(".spinner"),o=this.container.querySelector("#details-form-button-text"),s=await Gs(JSON.stringify(i),this.encryption);t&&o&&(t.classList.remove("hidden"),o.classList.add("hidden"));const r=Oi();(()=>{var l;if(this.retryingPayment){const v={channel:"card",reference:this.reference,encryptedCard:s};return ci(this.token,v,this.rdtCode,this.url)}else{const v={amount:this.amount,channel:"card",currency:this.currency||"USD",planId:this.planId,customer:this.customer,reference:this.reference,encryptedCard:s,callBackUrl:this.callBackUrl,metadata:this.metadata,...this.localCurrency&&{localCurrency:this.localCurrency},isCheckout:!0,...((l=this.merchantPlanDetail)==null?void 0:l.taxQuoteId)&&{taxQuoteId:this.merchantPlanDetail.taxQuoteId},deviceInformation:r};return Ls(this.token,v,this.rdtCode,this.url)}})().then(({data:l,headers:v})=>{var p,g,b,y,w,C,S,_;if(l.status==="failed")this.currentStep=4,this.reference=l.reference,P.track("verify_payment",{payment_method:"Card",verification_status:"Failed",authentication_type:"PIN"}),this.cardResponse=l,this.cardResponseHeader=v,l.providerMessage?this.warningScreen.setPaymentError(l.providerMessage):this.warningScreen.setPaymentError("Payment failed"),this.warningScreen.hideReportIssue();else if(!["success","successful"].includes(l.status)&&l.status!=="failed")if(this.cardResponse=l,this.cardResponseHeader=v,l!=null&&l.authorization){if(this.activeRef=l.reference,((p=l==null?void 0:l.authorization)==null?void 0:p.mode)==="pin"){this.currentStep=2;return}if(((g=l==null?void 0:l.authorization)==null?void 0:g.mode)==="3DS"){(b=l==null?void 0:l.authorization)!=null&&b.redirectUrl&&this.redirectTo3DS((y=l==null?void 0:l.authorization)==null?void 0:y.redirectUrl),(w=l==null?void 0:l.authorization)!=null&&w.embeddedHtml&&this.redirectToPreciumDoc((C=l==null?void 0:l.authorization)==null?void 0:C.embeddedHtml);return}if(((S=l==null?void 0:l.authorization)==null?void 0:S.mode)==="otp"){this.cardResponse=l,this.currentStep=3;return}if(((_=l==null?void 0:l.authorization)==null?void 0:_.mode)==="avs"){this.currentStep=7;return}}else this.currentStep=4,l.providerMessage?this.warningScreen.setPaymentError(l.providerMessage):this.warningScreen.setPaymentError("Error with Payment"),this.warningScreen.hideReportIssue()
|
|
1379
|
+
</svg>`},1e3))})})}renderComponent(){this.container.innerHTML=this.render(),this.attachListener()}}function Yr(n){n.classList.remove("hidden"),requestAnimationFrame(()=>{n.classList.remove("opacity-0","scale-95")})}function Ri(n){n.classList.add("opacity-0","scale-95"),n.addEventListener("transitionend",()=>n.classList.add("hidden"),{once:!0})}class Qo{constructor({container:e,testCardContainer:i,keyEnvironment:t}){h(this,"container");h(this,"testCardContainer");h(this,"testCardInstance",null);h(this,"keyEnvironment",null);h(this,"isVisible",!1);this.container=e,this.testCardContainer=i,this.keyEnvironment=t,this.isVisible=!1}attachListener(){const e=this.container.querySelector("#test-cards-link");if(e){if(this.keyEnvironment!=="test"){e.classList.add("hidden");return}e.addEventListener("click",()=>{this.testCardInstance||(this.testCardInstance=new Yo({container:this.testCardContainer,closeCallback:()=>{this.testCardContainer.innerHTML="",Ri(this.testCardContainer),e.classList.remove("text-tone-100","font-bold"),this.isVisible=!1}})),this.testCardInstance.renderComponent(),Yr(this.testCardContainer),e.classList.add("text-tone-100","font-bold"),this.isVisible=!0})}}renderComponent(){this.container.innerHTML=this.render(),this.attachListener()}render(){return Jr}}function Oi(){return{httpBrowserLanguage:navigator.language||"en-US",httpBrowserJavaEnabled:!1,httpBrowserJavaScriptEnabled:!0,httpBrowserColorDepth:window.screen.colorDepth.toString(),httpBrowserScreenHeight:window.screen.height.toString(),httpBrowserScreenWidth:window.screen.width.toString(),httpBrowserTimeDifference:(-new Date().getTimezoneOffset()).toString(),userAgentBrowserValue:navigator.userAgent,deviceChannel:"Browser"}}class Qr{constructor({amount:e,totalAmount:i,container:t,customer:o,encryption:s,planId:r,token:d,currency:l,rdtCode:v,url:p,reference:g,onSuccess:b,callBackUrl:y,metadata:w,localCurrency:C,hidePaymentMethods:S,showPaymentMethods:_,onClose:A,restartTransactionProcess:M,retryingPayment:T,keys:D,testcardIsVisible:U}){h(this,"contents");h(this,"cardDetailForm");h(this,"cardOtpValidationForm");h(this,"merchantPlanDetail",{});h(this,"cardPinForm");h(this,"avsForm");h(this,"isw3dsForm");h(this,"successScreen");h(this,"pageLoader");h(this,"warningScreen");h(this,"transactionIssuesScreen");h(this,"container");h(this,"onSuccess");h(this,"planId","");h(this,"customer");h(this,"token");h(this,"amount");h(this,"totalAmount");h(this,"encryption");h(this,"currency");h(this,"_currentStep");h(this,"activeRef");h(this,"rdtCode");h(this,"url");h(this,"reference");h(this,"callBackUrl");h(this,"metadata");h(this,"localCurrency");h(this,"hidePaymentMethods");h(this,"showPaymentMethods");h(this,"onClose");h(this,"cardResponse");h(this,"cardResponseHeader");h(this,"confirmationEnd");h(this,"confirmationProgress");h(this,"restartTransactionProcess");h(this,"retryingPayment");h(this,"isMaxRetriesReached");h(this,"isCancelledPlan");h(this,"isMobile",!1);h(this,"keys");h(this,"testcardIsVisible",!1);this.currency=l,this.onSuccess=b||(()=>null),this.keys=D,this.testcardIsVisible=U,this.container=t,this.encryption=s,this.token=d,this.customer=o,this.planId=r,this.amount=e,this.totalAmount=i,this.rdtCode=v,this.url=p,this.reference=g,this.callBackUrl=y,this.metadata=w,this.localCurrency=C,this._currentStep=1,this.activeRef="",this.contents=this.container.querySelector("#payment-content-view"),this.cardResponse={},this.cardResponseHeader={},this.hidePaymentMethods=S,this.showPaymentMethods=_,this.onClose=A,this.restartTransactionProcess=M,this.retryingPayment=T,this.isMaxRetriesReached=!1,this.isCancelledPlan=!1,this.renderCardContent(),P.track("card_opens",{payment_method:"Card"}),this.isMobile=window.matchMedia("(max-width: 767px)").matches}get currentStep(){return this._currentStep}set currentStep(e){this._currentStep=e,this.renderCardContent()}async submitCardDetails(e,i){e.preventDefault(),P.track("input_cardDetails",{payment_method:"Card",authentication_type:"PIN"});const t=this.container.querySelector(".spinner"),o=this.container.querySelector("#details-form-button-text"),s=await Gs(JSON.stringify(i),this.encryption);t&&o&&(t.classList.remove("hidden"),o.classList.add("hidden"));const r=Oi();(()=>{var l;if(this.retryingPayment){const v={channel:"card",reference:this.reference,encryptedCard:s};return ci(this.token,v,this.rdtCode,this.url)}else{const v={amount:this.amount,channel:"card",currency:this.currency||"USD",planId:this.planId,customer:this.customer,reference:this.reference,encryptedCard:s,callBackUrl:this.callBackUrl,metadata:this.metadata,...this.localCurrency&&{localCurrency:this.localCurrency},isCheckout:!0,...((l=this.merchantPlanDetail)==null?void 0:l.taxQuoteId)&&{taxQuoteId:this.merchantPlanDetail.taxQuoteId},deviceInformation:r};return Ls(this.token,v,this.rdtCode,this.url)}})().then(({data:l,headers:v})=>{var p,g,b,y,w,C,S,_;if(l.status==="failed")this.currentStep=4,this.reference=l.reference,P.track("verify_payment",{payment_method:"Card",verification_status:"Failed",authentication_type:"PIN"}),this.cardResponse=l,this.cardResponseHeader=v,l.providerMessage?this.warningScreen.setPaymentError(l.providerMessage):this.warningScreen.setPaymentError("Payment failed"),this.warningScreen.hideReportIssue();else if(["success","successful"].includes(l.status))this.currentStep=5,this.cardResponse=l,this.cardResponseHeader=v,P.track("verify_payment",{payment_method:"Card",verification_status:"Success",authentication_type:"PIN"}),this.redirectTo(l,v,"success");else if(!["success","successful"].includes(l.status)&&l.status!=="failed")if(this.cardResponse=l,this.cardResponseHeader=v,l!=null&&l.authorization){if(this.activeRef=l.reference,((p=l==null?void 0:l.authorization)==null?void 0:p.mode)==="pin"){this.currentStep=2;return}if(((g=l==null?void 0:l.authorization)==null?void 0:g.mode)==="3DS"){(b=l==null?void 0:l.authorization)!=null&&b.redirectUrl&&this.redirectTo3DS((y=l==null?void 0:l.authorization)==null?void 0:y.redirectUrl),(w=l==null?void 0:l.authorization)!=null&&w.embeddedHtml&&this.redirectToPreciumDoc((C=l==null?void 0:l.authorization)==null?void 0:C.embeddedHtml);return}if(((S=l==null?void 0:l.authorization)==null?void 0:S.mode)==="otp"){this.cardResponse=l,this.currentStep=3;return}if(((_=l==null?void 0:l.authorization)==null?void 0:_.mode)==="avs"){this.currentStep=7;return}}else this.currentStep=4,l.providerMessage?this.warningScreen.setPaymentError(l.providerMessage):this.warningScreen.setPaymentError("Error with Payment"),this.warningScreen.hideReportIssue()}).catch(l=>{P.track("verify_payment",{payment_method:"Card",verification_status:"Null",authentication_type:"PIN"}),l.code==="payment_max_retry_attempts"?(this.isMaxRetriesReached=!0,this.verifyPaymentProcess(),this.currentStep=4,P.track("max_retries_reached",{payment_method:"Card"}),this.warningScreen.setPaymentError("Maximum retries","You have reached the maximum number of retries allowed. Go back to merchant website to start the payment process again.","Go back to Merchant")):(l.message?l.code==="7137"?(this.isCancelledPlan=!0,this.currentStep=4,P.track("cancelled_plan",{payment_method:"Card"}),this.warningScreen.setPaymentError(l.message,"","Go back to Merchant")):(this.currentStep=4,this.warningScreen.setPaymentError(l.message)):(this.currentStep=4,this.warningScreen.setPaymentError("Payment failed")),this.warningScreen.hideReportIssue())}).finally(()=>{t&&o&&(t.classList.add("hidden"),o.classList.remove("hidden"))})}cancellledPlanAction(){if(this.rdtCode)window.history.back();else{const e=document.getElementById("checkout-modal");e&&e.remove()}}handlePinRequest(e){if(e.length===4){const i={authorization:{pin:e},reference:this.activeRef};P.track("input_cardPin",{payment_method:"Card",authentication_type:"PIN"}),setTimeout(()=>{const t=this.container.querySelector("#pin-loader"),o=this.container.querySelector("#cancel-payment");t&&(t.innerHTML=`<svg class="animate-spin" width="40" height="40" viewBox="0 0 64 64" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
1380
1380
|
<path
|
|
1381
1381
|
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"
|
|
1382
1382
|
stroke="black" stroke-width="4" stroke-linejoin="round" />
|