@spot-flow/checkout-inline-js 0.1.46-dev.2 → 0.1.46

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.
@@ -37497,6 +37497,12 @@ class o2 {
37497
37497
  verification_status: "Failed",
37498
37498
  authentication_type: "PIN"
37499
37499
  }), this.cardResponse = a, this.cardResponseHeader = l, a.providerMessage ? this.warningScreen.setPaymentError(a.providerMessage) : this.warningScreen.setPaymentError("Payment failed"), this.warningScreen.hideReportIssue();
37500
+ else if (["success", "successful"].includes(a.status))
37501
+ this.currentStep = 5, this.cardResponse = a, this.cardResponseHeader = l, O.track("verify_payment", {
37502
+ payment_method: "Card",
37503
+ verification_status: "Success",
37504
+ authentication_type: "PIN"
37505
+ }), this.redirectTo(a, l, "success");
37500
37506
  else if (!["success", "successful"].includes(a.status) && a.status !== "failed")
37501
37507
  if (this.cardResponse = a, this.cardResponseHeader = l, a != null && a.authorization) {
37502
37508
  if (this.activeRef = a.reference, ((c = a == null ? void 0 : a.authorization) == null ? void 0 : c.mode) === "pin") {
@@ -37517,11 +37523,6 @@ class o2 {
37517
37523
  }
37518
37524
  } else
37519
37525
  this.currentStep = 4, a.providerMessage ? this.warningScreen.setPaymentError(a.providerMessage) : this.warningScreen.setPaymentError("Error with Payment"), this.warningScreen.hideReportIssue();
37520
- else ["success", "successful"].includes(a.status) && (this.currentStep = 5, this.cardResponse = a, this.cardResponseHeader = l, O.track("verify_payment", {
37521
- payment_method: "Card",
37522
- verification_status: "Success",
37523
- authentication_type: "PIN"
37524
- }), this.redirectTo(a, l, "success"));
37525
37526
  }).catch((a) => {
37526
37527
  O.track("verify_payment", {
37527
37528
  payment_method: "Card",
@@ -1393,7 +1393,7 @@ or you can use record.mirror to access the mirror instance during recording.`,tc
1393
1393
  <path
1394
1394
  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"
1395
1395
  fill="#0D0716" />
1396
- </svg>`},1e3))})})}renderComponent(){this.container.innerHTML=this.render(),this.attachListener()}}function A3(n){n.classList.remove("hidden"),requestAnimationFrame(()=>{n.classList.remove("opacity-0","scale-95")})}function ro(n){n.classList.add("opacity-0","scale-95"),n.addEventListener("transitionend",()=>n.classList.add("hidden"),{once:!0})}class jd{constructor({container:t,testCardContainer:r,keyEnvironment:e}){b(this,"container");b(this,"testCardContainer");b(this,"testCardInstance",null);b(this,"keyEnvironment",null);b(this,"isVisible",!1);this.container=t,this.testCardContainer=r,this.keyEnvironment=e,this.isVisible=!1}attachListener(){const t=this.container.querySelector("#test-cards-link");if(t){if(this.keyEnvironment!=="test"){t.classList.add("hidden");return}t.addEventListener("click",()=>{this.testCardInstance||(this.testCardInstance=new Fd({container:this.testCardContainer,closeCallback:()=>{this.testCardContainer.innerHTML="",ro(this.testCardContainer),t.classList.remove("text-tone-100","font-bold"),this.isVisible=!1}})),this.testCardInstance.renderComponent(),A3(this.testCardContainer),t.classList.add("text-tone-100","font-bold"),this.isVisible=!0})}}renderComponent(){this.container.innerHTML=this.render(),this.attachListener()}render(){return S3}}class x3{constructor({amount:t,totalAmount:r,container:e,customer:i,encryption:o,planId:s,token:a,currency:l,rdtCode:c,url:d,reference:h,onSuccess:f,callBackUrl:y,metadata:w,localCurrency:S,hidePaymentMethods:g,showPaymentMethods:k,onClose:A,restartTransactionProcess:x,retryingPayment:L,keys:E,testcardIsVisible:I}){b(this,"contents");b(this,"cardDetailForm");b(this,"cardOtpValidationForm");b(this,"merchantPlanDetail",{});b(this,"cardPinForm");b(this,"avsForm");b(this,"successScreen");b(this,"pageLoader");b(this,"warningScreen");b(this,"transactionIssuesScreen");b(this,"container");b(this,"onSuccess");b(this,"planId","");b(this,"customer");b(this,"token");b(this,"amount");b(this,"totalAmount");b(this,"encryption");b(this,"currency");b(this,"_currentStep");b(this,"activeRef");b(this,"rdtCode");b(this,"url");b(this,"reference");b(this,"callBackUrl");b(this,"metadata");b(this,"localCurrency");b(this,"hidePaymentMethods");b(this,"showPaymentMethods");b(this,"onClose");b(this,"cardResponse");b(this,"cardResponseHeader");b(this,"confirmationEnd");b(this,"confirmationProgress");b(this,"restartTransactionProcess");b(this,"retryingPayment");b(this,"isMaxRetriesReached");b(this,"isCancelledPlan");b(this,"isMobile",!1);b(this,"keys");b(this,"testcardIsVisible",!1);this.currency=l,this.onSuccess=f||(()=>null),this.keys=E,this.testcardIsVisible=I,this.container=e,this.encryption=o,this.token=a,this.customer=i,this.planId=s,this.amount=t,this.totalAmount=r,this.rdtCode=c,this.url=d,this.reference=h,this.callBackUrl=y,this.metadata=w,this.localCurrency=S,this._currentStep=1,this.activeRef="",this.contents=this.container.querySelector("#payment-content-view"),this.cardResponse={},this.cardResponseHeader={},this.hidePaymentMethods=g,this.showPaymentMethods=k,this.onClose=A,this.restartTransactionProcess=x,this.retryingPayment=L,this.isMaxRetriesReached=!1,this.isCancelledPlan=!1,this.renderCardContent(),O.track("card_opens",{payment_method:"Card"}),this.isMobile=window.matchMedia("(max-width: 767px)").matches}get currentStep(){return this._currentStep}set currentStep(t){this._currentStep=t,this.renderCardContent()}async submitCardDetails(t,r){t.preventDefault(),O.track("input_cardDetails",{payment_method:"Card",authentication_type:"PIN"});const e=this.container.querySelector(".spinner"),i=this.container.querySelector("#details-form-button-text"),o=await Rh(JSON.stringify(r),this.encryption);e&&i&&(e.classList.remove("hidden"),i.classList.add("hidden")),(()=>{var a;if(this.retryingPayment){const l={channel:"card",reference:this.reference,encryptedCard:o};return Fi(this.token,l,this.rdtCode,this.url)}else{const l={amount:this.amount,channel:"card",currency:this.currency||"USD",planId:this.planId,customer:this.customer,reference:this.reference,encryptedCard:o,callBackUrl:this.callBackUrl,metadata:this.metadata,...this.localCurrency&&{localCurrency:this.localCurrency},isCheckout:!0,...((a=this.merchantPlanDetail)==null?void 0:a.taxQuoteId)&&{taxQuoteId:this.merchantPlanDetail.taxQuoteId}};return gh(this.token,l,this.rdtCode,this.url)}})().then(({data:a,headers:l})=>{var c,d,h,f,y,w,S,g;if(a.status==="failed")this.currentStep=4,this.reference=a.reference,O.track("verify_payment",{payment_method:"Card",verification_status:"Failed",authentication_type:"PIN"}),this.cardResponse=a,this.cardResponseHeader=l,a.providerMessage?this.warningScreen.setPaymentError(a.providerMessage):this.warningScreen.setPaymentError("Payment failed"),this.warningScreen.hideReportIssue();else if(!["success","successful"].includes(a.status)&&a.status!=="failed")if(this.cardResponse=a,this.cardResponseHeader=l,a!=null&&a.authorization){if(this.activeRef=a.reference,((c=a==null?void 0:a.authorization)==null?void 0:c.mode)==="pin"){this.currentStep=2;return}if(((d=a==null?void 0:a.authorization)==null?void 0:d.mode)==="3DS"){(h=a==null?void 0:a.authorization)!=null&&h.redirectUrl&&this.redirectTo3DS((f=a==null?void 0:a.authorization)==null?void 0:f.redirectUrl),(y=a==null?void 0:a.authorization)!=null&&y.embeddedHtml&&this.redirectToPreciumDoc((w=a==null?void 0:a.authorization)==null?void 0:w.embeddedHtml);return}if(((S=a==null?void 0:a.authorization)==null?void 0:S.mode)==="otp"){this.cardResponse=a,this.currentStep=3;return}if(((g=a==null?void 0:a.authorization)==null?void 0:g.mode)==="avs"){this.currentStep=7;return}}else this.currentStep=4,a.providerMessage?this.warningScreen.setPaymentError(a.providerMessage):this.warningScreen.setPaymentError("Error with Payment"),this.warningScreen.hideReportIssue();else["success","successful"].includes(a.status)&&(this.currentStep=5,this.cardResponse=a,this.cardResponseHeader=l,O.track("verify_payment",{payment_method:"Card",verification_status:"Success",authentication_type:"PIN"}),this.redirectTo(a,l,"success"))}).catch(a=>{O.track("verify_payment",{payment_method:"Card",verification_status:"Null",authentication_type:"PIN"}),a.code==="payment_max_retry_attempts"?(this.isMaxRetriesReached=!0,this.verifyPaymentProcess(),this.currentStep=4,O.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")):(a.message?a.code==="7137"?(this.isCancelledPlan=!0,this.currentStep=4,O.track("cancelled_plan",{payment_method:"Card"}),this.warningScreen.setPaymentError(a.message,"","Go back to Merchant")):(this.currentStep=4,this.warningScreen.setPaymentError(a.message)):(this.currentStep=4,this.warningScreen.setPaymentError("Payment failed")),this.warningScreen.hideReportIssue())}).finally(()=>{e&&i&&(e.classList.add("hidden"),i.classList.remove("hidden"))})}cancellledPlanAction(){if(this.rdtCode)window.history.back();else{const t=document.getElementById("checkout-modal");t&&t.remove()}}handlePinRequest(t){if(t.length===4){const r={authorization:{pin:t},reference:this.activeRef};O.track("input_cardPin",{payment_method:"Card",authentication_type:"PIN"}),setTimeout(()=>{const e=this.container.querySelector("#pin-loader"),i=this.container.querySelector("#cancel-payment");e&&(e.innerHTML=`<svg class="animate-spin" width="40" height="40" viewBox="0 0 64 64" fill="none" xmlns="http://www.w3.org/2000/svg">
1396
+ </svg>`},1e3))})})}renderComponent(){this.container.innerHTML=this.render(),this.attachListener()}}function A3(n){n.classList.remove("hidden"),requestAnimationFrame(()=>{n.classList.remove("opacity-0","scale-95")})}function ro(n){n.classList.add("opacity-0","scale-95"),n.addEventListener("transitionend",()=>n.classList.add("hidden"),{once:!0})}class jd{constructor({container:t,testCardContainer:r,keyEnvironment:e}){b(this,"container");b(this,"testCardContainer");b(this,"testCardInstance",null);b(this,"keyEnvironment",null);b(this,"isVisible",!1);this.container=t,this.testCardContainer=r,this.keyEnvironment=e,this.isVisible=!1}attachListener(){const t=this.container.querySelector("#test-cards-link");if(t){if(this.keyEnvironment!=="test"){t.classList.add("hidden");return}t.addEventListener("click",()=>{this.testCardInstance||(this.testCardInstance=new Fd({container:this.testCardContainer,closeCallback:()=>{this.testCardContainer.innerHTML="",ro(this.testCardContainer),t.classList.remove("text-tone-100","font-bold"),this.isVisible=!1}})),this.testCardInstance.renderComponent(),A3(this.testCardContainer),t.classList.add("text-tone-100","font-bold"),this.isVisible=!0})}}renderComponent(){this.container.innerHTML=this.render(),this.attachListener()}render(){return S3}}class x3{constructor({amount:t,totalAmount:r,container:e,customer:i,encryption:o,planId:s,token:a,currency:l,rdtCode:c,url:d,reference:h,onSuccess:f,callBackUrl:y,metadata:w,localCurrency:S,hidePaymentMethods:g,showPaymentMethods:k,onClose:A,restartTransactionProcess:x,retryingPayment:L,keys:E,testcardIsVisible:I}){b(this,"contents");b(this,"cardDetailForm");b(this,"cardOtpValidationForm");b(this,"merchantPlanDetail",{});b(this,"cardPinForm");b(this,"avsForm");b(this,"successScreen");b(this,"pageLoader");b(this,"warningScreen");b(this,"transactionIssuesScreen");b(this,"container");b(this,"onSuccess");b(this,"planId","");b(this,"customer");b(this,"token");b(this,"amount");b(this,"totalAmount");b(this,"encryption");b(this,"currency");b(this,"_currentStep");b(this,"activeRef");b(this,"rdtCode");b(this,"url");b(this,"reference");b(this,"callBackUrl");b(this,"metadata");b(this,"localCurrency");b(this,"hidePaymentMethods");b(this,"showPaymentMethods");b(this,"onClose");b(this,"cardResponse");b(this,"cardResponseHeader");b(this,"confirmationEnd");b(this,"confirmationProgress");b(this,"restartTransactionProcess");b(this,"retryingPayment");b(this,"isMaxRetriesReached");b(this,"isCancelledPlan");b(this,"isMobile",!1);b(this,"keys");b(this,"testcardIsVisible",!1);this.currency=l,this.onSuccess=f||(()=>null),this.keys=E,this.testcardIsVisible=I,this.container=e,this.encryption=o,this.token=a,this.customer=i,this.planId=s,this.amount=t,this.totalAmount=r,this.rdtCode=c,this.url=d,this.reference=h,this.callBackUrl=y,this.metadata=w,this.localCurrency=S,this._currentStep=1,this.activeRef="",this.contents=this.container.querySelector("#payment-content-view"),this.cardResponse={},this.cardResponseHeader={},this.hidePaymentMethods=g,this.showPaymentMethods=k,this.onClose=A,this.restartTransactionProcess=x,this.retryingPayment=L,this.isMaxRetriesReached=!1,this.isCancelledPlan=!1,this.renderCardContent(),O.track("card_opens",{payment_method:"Card"}),this.isMobile=window.matchMedia("(max-width: 767px)").matches}get currentStep(){return this._currentStep}set currentStep(t){this._currentStep=t,this.renderCardContent()}async submitCardDetails(t,r){t.preventDefault(),O.track("input_cardDetails",{payment_method:"Card",authentication_type:"PIN"});const e=this.container.querySelector(".spinner"),i=this.container.querySelector("#details-form-button-text"),o=await Rh(JSON.stringify(r),this.encryption);e&&i&&(e.classList.remove("hidden"),i.classList.add("hidden")),(()=>{var a;if(this.retryingPayment){const l={channel:"card",reference:this.reference,encryptedCard:o};return Fi(this.token,l,this.rdtCode,this.url)}else{const l={amount:this.amount,channel:"card",currency:this.currency||"USD",planId:this.planId,customer:this.customer,reference:this.reference,encryptedCard:o,callBackUrl:this.callBackUrl,metadata:this.metadata,...this.localCurrency&&{localCurrency:this.localCurrency},isCheckout:!0,...((a=this.merchantPlanDetail)==null?void 0:a.taxQuoteId)&&{taxQuoteId:this.merchantPlanDetail.taxQuoteId}};return gh(this.token,l,this.rdtCode,this.url)}})().then(({data:a,headers:l})=>{var c,d,h,f,y,w,S,g;if(a.status==="failed")this.currentStep=4,this.reference=a.reference,O.track("verify_payment",{payment_method:"Card",verification_status:"Failed",authentication_type:"PIN"}),this.cardResponse=a,this.cardResponseHeader=l,a.providerMessage?this.warningScreen.setPaymentError(a.providerMessage):this.warningScreen.setPaymentError("Payment failed"),this.warningScreen.hideReportIssue();else if(["success","successful"].includes(a.status))this.currentStep=5,this.cardResponse=a,this.cardResponseHeader=l,O.track("verify_payment",{payment_method:"Card",verification_status:"Success",authentication_type:"PIN"}),this.redirectTo(a,l,"success");else if(!["success","successful"].includes(a.status)&&a.status!=="failed")if(this.cardResponse=a,this.cardResponseHeader=l,a!=null&&a.authorization){if(this.activeRef=a.reference,((c=a==null?void 0:a.authorization)==null?void 0:c.mode)==="pin"){this.currentStep=2;return}if(((d=a==null?void 0:a.authorization)==null?void 0:d.mode)==="3DS"){(h=a==null?void 0:a.authorization)!=null&&h.redirectUrl&&this.redirectTo3DS((f=a==null?void 0:a.authorization)==null?void 0:f.redirectUrl),(y=a==null?void 0:a.authorization)!=null&&y.embeddedHtml&&this.redirectToPreciumDoc((w=a==null?void 0:a.authorization)==null?void 0:w.embeddedHtml);return}if(((S=a==null?void 0:a.authorization)==null?void 0:S.mode)==="otp"){this.cardResponse=a,this.currentStep=3;return}if(((g=a==null?void 0:a.authorization)==null?void 0:g.mode)==="avs"){this.currentStep=7;return}}else this.currentStep=4,a.providerMessage?this.warningScreen.setPaymentError(a.providerMessage):this.warningScreen.setPaymentError("Error with Payment"),this.warningScreen.hideReportIssue()}).catch(a=>{O.track("verify_payment",{payment_method:"Card",verification_status:"Null",authentication_type:"PIN"}),a.code==="payment_max_retry_attempts"?(this.isMaxRetriesReached=!0,this.verifyPaymentProcess(),this.currentStep=4,O.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")):(a.message?a.code==="7137"?(this.isCancelledPlan=!0,this.currentStep=4,O.track("cancelled_plan",{payment_method:"Card"}),this.warningScreen.setPaymentError(a.message,"","Go back to Merchant")):(this.currentStep=4,this.warningScreen.setPaymentError(a.message)):(this.currentStep=4,this.warningScreen.setPaymentError("Payment failed")),this.warningScreen.hideReportIssue())}).finally(()=>{e&&i&&(e.classList.add("hidden"),i.classList.remove("hidden"))})}cancellledPlanAction(){if(this.rdtCode)window.history.back();else{const t=document.getElementById("checkout-modal");t&&t.remove()}}handlePinRequest(t){if(t.length===4){const r={authorization:{pin:t},reference:this.activeRef};O.track("input_cardPin",{payment_method:"Card",authentication_type:"PIN"}),setTimeout(()=>{const e=this.container.querySelector("#pin-loader"),i=this.container.querySelector("#cancel-payment");e&&(e.innerHTML=`<svg class="animate-spin" width="40" height="40" viewBox="0 0 64 64" fill="none" xmlns="http://www.w3.org/2000/svg">
1397
1397
  <path
1398
1398
  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"
1399
1399
  stroke="black" stroke-width="4" stroke-linejoin="round" />
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spot-flow/checkout-inline-js",
3
- "version": "0.1.46-dev.2",
3
+ "version": "0.1.46",
4
4
  "description": "",
5
5
  "main": "dist/checkout-inline.js",
6
6
  "module": "dist/checkout-inline.es.js",