@spot-flow/checkout-inline-js 0.1.32-dev.5 → 0.1.32-dev.6

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.
@@ -35530,7 +35530,7 @@ class uu {
35530
35530
  this.email,
35531
35531
  this.amount,
35532
35532
  this.currency
35533
- ), this.cleanup(), this.switchTab(""), this.showPaymentMethods(), this.enablePaymentMethods(), this.renderPaymentMethodContent(), P.track("retry_payment");
35533
+ ), this.cleanup(), this.switchTab(""), this.showPaymentMethods(), this.setupPaymentMethodButtons(), this.renderPaymentMethodContent(), P.track("retry_payment");
35534
35534
  }
35535
35535
  defaultToEmptyContainer() {
35536
35536
  const e = document.querySelector(
@@ -35565,11 +35565,14 @@ class uu {
35565
35565
  }
35566
35566
  enablePaymentMethods() {
35567
35567
  const e = document.querySelectorAll(".tab-button");
35568
- e.forEach((t) => t.removeAttribute("disabled"));
35568
+ e.forEach((t) => {
35569
+ const s = t.getAttribute("data-name");
35570
+ s && !this.disabledChannels.includes(s) && t.removeAttribute("disabled");
35571
+ });
35569
35572
  const i = Array.from(e).find(
35570
35573
  (t) => t.getAttribute("data-name") === this.currentPaymentMethod
35571
35574
  );
35572
- i && i.removeAttribute("disabled");
35575
+ i && !this.disabledChannels.includes(this.currentPaymentMethod) && i.removeAttribute("disabled");
35573
35576
  }
35574
35577
  hidePaymentMethods() {
35575
35578
  const e = document.querySelector("#payment-methods-container");
@@ -1376,7 +1376,7 @@ or you can use record.mirror to access the mirror instance during recording.`;le
1376
1376
  </svg>
1377
1377
  <span class="text-tone-100 font-semibold">
1378
1378
  Go back
1379
- </span>`),i&&(i.innerHTML="Selected")):(e&&(e.classList.remove("flex","items-center","gap-2","mb-2"),e.innerHTML=""),i&&(i.innerHTML="Select your preferred")))}closeBTN(e){(()=>{this.cleanup(),e?(P.track("checkout_closes"),this.closeModal()):this.closePayment()})()}updatePaymentMethodView(e,i,t,o){switch(this.currentPaymentMethod){case"card":return this.card=new Ir({container:this.modalContainer,amount:t,currency:o,token:e,email:i,planId:this.planId,rdtCode:this.rdtCode,url:this.url,reference:this.reference,encryption:this.encryption,callBackUrl:this.callBackUrl,metadata:this.metadata,localCurrency:this.localCurrency,switchTab:()=>this.switchTab("card"),hidePaymentMethods:this.hidePaymentMethods.bind(this),showPaymentMethods:this.showPaymentMethods.bind(this),onClose:s=>{this.closeBTN.bind(this)(s)},restartTransactionProcess:this.setToDefaultEmptyContainer.bind(this),retryingPayment:this.retryingPayment});case"bank_transfer":return this.transfer=new Gr({amount:t,currency:o,closeModal:this.closeModal.bind(this),token:e,container:this.modalContainer,email:i,rdtCode:this.rdtCode,url:this.url,reference:this.reference,callBackUrl:this.callBackUrl,metadata:this.metadata,localCurrency:this.localCurrency,disablePaymentMethods:s=>{this.disablePaymentMethods.bind(this)(s)},restartTransactionProcess:this.setToDefaultEmptyContainer.bind(this),hidePaymentMethods:this.hidePaymentMethods.bind(this),retryingPayment:this.retryingPayment});case"ussd":return this.ussd=new qo({container:this.modalContainer,amount:t,currency:o,secret:this.merchantKey,rdtCode:this.rdtCode,url:this.url,email:this.email,reference:this.reference,callBackUrl:this.callBackUrl,metadata:this.metadata,localCurrency:this.localCurrency,closeModal:()=>this.closeModal(),switchTab:s=>this.switchTab.bind(s),hidePaymentMethods:this.hidePaymentMethods.bind(this),showPaymentMethods:this.showPaymentMethods.bind(this),disablePaymentMethods:s=>{this.disablePaymentMethods.bind(this)(s)}});case"mobile_money":return this.mobileMoney=new cl({container:this.modalContainer,email:this.email,currency:o,rdtCode:this.rdtCode,url:this.url,token:e,amount:this.amount,metadata:this.metadata,localCurrency:this.localCurrency,phoneNumber:this.phoneNumber,code:this.code,callBackUrl:this.callBackUrl,merchantKey:this.merchantKey,reference:this.reference,closeModal:()=>this.closeModal(),hidePaymentMethods:this.hidePaymentMethods.bind(this),showPaymentMethods:this.showPaymentMethods.bind(this),disablePaymentMethods:s=>{this.disablePaymentMethods.bind(this)(s)},onClose:s=>{this.closeBTN.bind(this)(s)},restartTransactionProcess:this.setToDefaultEmptyContainer.bind(this),retryingPayment:this.retryingPayment});case"eft":return this.eft=new ml({container:this.modalContainer,amount:t,currency:o,token:e,email:i,rdtCode:this.rdtCode,url:this.url,reference:this.reference,callBackUrl:this.callBackUrl,metadata:this.metadata,localCurrency:this.localCurrency,switchTab:()=>this.switchTab("eft"),hidePaymentMethods:this.hidePaymentMethods.bind(this),showPaymentMethods:this.showPaymentMethods.bind(this),onClose:s=>{this.closeBTN.bind(this)(s)},restartTransactionProcess:this.setToDefaultEmptyContainer.bind(this),retryingPayment:this.retryingPayment});default:return null}}renderPaymentMethodContent(){return(()=>{switch(this.currentPaymentMethod){case"card":return this.card.renderCardContent(this.merchantPlanDetail);case"bank_transfer":return this.transfer.renderTransferContent(this.merchantPlanDetail);case"ussd":return this.ussd.renderUssdContent(this.merchantPlanDetail);case"mobile_money":return this.mobileMoney.renderMobileMoneyContent(this.merchantPlanDetail);case"eft":return this.eft.renderEftContent(this.merchantPlanDetail);default:return this.defaultToEmptyContainer()}})()}setCurrentPaymentMethod(e){this.currentPaymentMethod=e;const i=document.querySelectorAll(".tab-button");i.forEach(o=>o.classList.remove("active"));const t=Array.from(i).find(o=>o.getAttribute("data-name")===e);t&&t.classList.add("active")}setToDefaultEmptyContainer(){this.currentPaymentMethod="",this.retryingPayment=!0,this.updatePaymentMethodView(this.merchantKey,this.email,this.amount,this.currency),this.cleanup(),this.switchTab(""),this.showPaymentMethods(),this.enablePaymentMethods(),this.renderPaymentMethodContent(),P.track("retry_payment")}defaultToEmptyContainer(){const e=document.querySelector("#payment-content-view");e.innerHTML=""}switchTab(e){this.currentPaymentMethod===e&&e!==""||(this.currentPaymentMethod==="bank_transfer"&&this.currentPaymentMethod!==e&&this.setToDefaultEmptyContainer(),this.setCurrentPaymentMethod(e),this.updatePaymentMethodView(this.merchantKey,this.email,this.amount,this.currency),this.cleanup(),this.showPaymentMethods(),this.renderPaymentMethodContent(),this.attachListeners(),this.isMobile&&(document.querySelectorAll(".tab-button").forEach(t=>{const o=t.getAttribute("data-name");this.disabledChannels.includes(o)||t.removeAttribute("disabled")}),e?document.querySelectorAll(".tab-button").forEach(o=>{o.getAttribute("data-name")!==e&&o.classList.add("hidden")}):document.querySelectorAll(".tab-button").forEach(o=>{const s=o.getAttribute("data-name");[...this.validChannels,...this.disabledChannels].includes(s)&&o.classList.remove("hidden")})))}disablePaymentMethods(e){this.currentPaymentMethod=e;const i=document.querySelectorAll(".tab-button");i.forEach(o=>o.setAttribute("disabled","true"));const t=Array.from(i).find(o=>o.getAttribute("data-name")===e);t&&t.removeAttribute("disabled")}enablePaymentMethods(){const e=document.querySelectorAll(".tab-button");e.forEach(t=>t.removeAttribute("disabled"));const i=Array.from(e).find(t=>t.getAttribute("data-name")===this.currentPaymentMethod);i&&i.removeAttribute("disabled")}hidePaymentMethods(){const e=document.querySelector("#payment-methods-container");e&&e.classList.add("hidden")}showPaymentMethods(){const e=document.querySelector("#payment-methods-container");e&&e.classList.remove("hidden")}cleanup(){this.transfer&&this.transfer.destroyTimer()}closeModal(e){this.modalContainer&&this.modalContainer.parentNode&&document.body.removeChild(this.modalContainer),e&&e()}setupParent(e){e&&e()}render(){return vs}}class Zo{constructor(e){m(this,"container");this.container=e}renderContent(e){var t;this.container.innerHTML=this.render();const i=document.getElementById("error-action-container");e&&i&&(i.classList.remove("hidden"),(t=i.querySelector("#go-back"))==null||t.addEventListener("click",()=>{window.location.href=e}))}render(){return`
1379
+ </span>`),i&&(i.innerHTML="Selected")):(e&&(e.classList.remove("flex","items-center","gap-2","mb-2"),e.innerHTML=""),i&&(i.innerHTML="Select your preferred")))}closeBTN(e){(()=>{this.cleanup(),e?(P.track("checkout_closes"),this.closeModal()):this.closePayment()})()}updatePaymentMethodView(e,i,t,o){switch(this.currentPaymentMethod){case"card":return this.card=new Ir({container:this.modalContainer,amount:t,currency:o,token:e,email:i,planId:this.planId,rdtCode:this.rdtCode,url:this.url,reference:this.reference,encryption:this.encryption,callBackUrl:this.callBackUrl,metadata:this.metadata,localCurrency:this.localCurrency,switchTab:()=>this.switchTab("card"),hidePaymentMethods:this.hidePaymentMethods.bind(this),showPaymentMethods:this.showPaymentMethods.bind(this),onClose:s=>{this.closeBTN.bind(this)(s)},restartTransactionProcess:this.setToDefaultEmptyContainer.bind(this),retryingPayment:this.retryingPayment});case"bank_transfer":return this.transfer=new Gr({amount:t,currency:o,closeModal:this.closeModal.bind(this),token:e,container:this.modalContainer,email:i,rdtCode:this.rdtCode,url:this.url,reference:this.reference,callBackUrl:this.callBackUrl,metadata:this.metadata,localCurrency:this.localCurrency,disablePaymentMethods:s=>{this.disablePaymentMethods.bind(this)(s)},restartTransactionProcess:this.setToDefaultEmptyContainer.bind(this),hidePaymentMethods:this.hidePaymentMethods.bind(this),retryingPayment:this.retryingPayment});case"ussd":return this.ussd=new qo({container:this.modalContainer,amount:t,currency:o,secret:this.merchantKey,rdtCode:this.rdtCode,url:this.url,email:this.email,reference:this.reference,callBackUrl:this.callBackUrl,metadata:this.metadata,localCurrency:this.localCurrency,closeModal:()=>this.closeModal(),switchTab:s=>this.switchTab.bind(s),hidePaymentMethods:this.hidePaymentMethods.bind(this),showPaymentMethods:this.showPaymentMethods.bind(this),disablePaymentMethods:s=>{this.disablePaymentMethods.bind(this)(s)}});case"mobile_money":return this.mobileMoney=new cl({container:this.modalContainer,email:this.email,currency:o,rdtCode:this.rdtCode,url:this.url,token:e,amount:this.amount,metadata:this.metadata,localCurrency:this.localCurrency,phoneNumber:this.phoneNumber,code:this.code,callBackUrl:this.callBackUrl,merchantKey:this.merchantKey,reference:this.reference,closeModal:()=>this.closeModal(),hidePaymentMethods:this.hidePaymentMethods.bind(this),showPaymentMethods:this.showPaymentMethods.bind(this),disablePaymentMethods:s=>{this.disablePaymentMethods.bind(this)(s)},onClose:s=>{this.closeBTN.bind(this)(s)},restartTransactionProcess:this.setToDefaultEmptyContainer.bind(this),retryingPayment:this.retryingPayment});case"eft":return this.eft=new ml({container:this.modalContainer,amount:t,currency:o,token:e,email:i,rdtCode:this.rdtCode,url:this.url,reference:this.reference,callBackUrl:this.callBackUrl,metadata:this.metadata,localCurrency:this.localCurrency,switchTab:()=>this.switchTab("eft"),hidePaymentMethods:this.hidePaymentMethods.bind(this),showPaymentMethods:this.showPaymentMethods.bind(this),onClose:s=>{this.closeBTN.bind(this)(s)},restartTransactionProcess:this.setToDefaultEmptyContainer.bind(this),retryingPayment:this.retryingPayment});default:return null}}renderPaymentMethodContent(){return(()=>{switch(this.currentPaymentMethod){case"card":return this.card.renderCardContent(this.merchantPlanDetail);case"bank_transfer":return this.transfer.renderTransferContent(this.merchantPlanDetail);case"ussd":return this.ussd.renderUssdContent(this.merchantPlanDetail);case"mobile_money":return this.mobileMoney.renderMobileMoneyContent(this.merchantPlanDetail);case"eft":return this.eft.renderEftContent(this.merchantPlanDetail);default:return this.defaultToEmptyContainer()}})()}setCurrentPaymentMethod(e){this.currentPaymentMethod=e;const i=document.querySelectorAll(".tab-button");i.forEach(o=>o.classList.remove("active"));const t=Array.from(i).find(o=>o.getAttribute("data-name")===e);t&&t.classList.add("active")}setToDefaultEmptyContainer(){this.currentPaymentMethod="",this.retryingPayment=!0,this.updatePaymentMethodView(this.merchantKey,this.email,this.amount,this.currency),this.cleanup(),this.switchTab(""),this.showPaymentMethods(),this.setupPaymentMethodButtons(),this.renderPaymentMethodContent(),P.track("retry_payment")}defaultToEmptyContainer(){const e=document.querySelector("#payment-content-view");e.innerHTML=""}switchTab(e){this.currentPaymentMethod===e&&e!==""||(this.currentPaymentMethod==="bank_transfer"&&this.currentPaymentMethod!==e&&this.setToDefaultEmptyContainer(),this.setCurrentPaymentMethod(e),this.updatePaymentMethodView(this.merchantKey,this.email,this.amount,this.currency),this.cleanup(),this.showPaymentMethods(),this.renderPaymentMethodContent(),this.attachListeners(),this.isMobile&&(document.querySelectorAll(".tab-button").forEach(t=>{const o=t.getAttribute("data-name");this.disabledChannels.includes(o)||t.removeAttribute("disabled")}),e?document.querySelectorAll(".tab-button").forEach(o=>{o.getAttribute("data-name")!==e&&o.classList.add("hidden")}):document.querySelectorAll(".tab-button").forEach(o=>{const s=o.getAttribute("data-name");[...this.validChannels,...this.disabledChannels].includes(s)&&o.classList.remove("hidden")})))}disablePaymentMethods(e){this.currentPaymentMethod=e;const i=document.querySelectorAll(".tab-button");i.forEach(o=>o.setAttribute("disabled","true"));const t=Array.from(i).find(o=>o.getAttribute("data-name")===e);t&&t.removeAttribute("disabled")}enablePaymentMethods(){const e=document.querySelectorAll(".tab-button");e.forEach(t=>{const o=t.getAttribute("data-name");o&&!this.disabledChannels.includes(o)&&t.removeAttribute("disabled")});const i=Array.from(e).find(t=>t.getAttribute("data-name")===this.currentPaymentMethod);i&&!this.disabledChannels.includes(this.currentPaymentMethod)&&i.removeAttribute("disabled")}hidePaymentMethods(){const e=document.querySelector("#payment-methods-container");e&&e.classList.add("hidden")}showPaymentMethods(){const e=document.querySelector("#payment-methods-container");e&&e.classList.remove("hidden")}cleanup(){this.transfer&&this.transfer.destroyTimer()}closeModal(e){this.modalContainer&&this.modalContainer.parentNode&&document.body.removeChild(this.modalContainer),e&&e()}setupParent(e){e&&e()}render(){return vs}}class Zo{constructor(e){m(this,"container");this.container=e}renderContent(e){var t;this.container.innerHTML=this.render();const i=document.getElementById("error-action-container");e&&i&&(i.classList.remove("hidden"),(t=i.querySelector("#go-back"))==null||t.addEventListener("click",()=>{window.location.href=e}))}render(){return`
1380
1380
  <div class="box-container">
1381
1381
 
1382
1382
  <div class="container-center h-[40vh] hidden mx-auto" id="shared-error-container">
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spot-flow/checkout-inline-js",
3
- "version": "0.1.32-dev.5",
3
+ "version": "0.1.32-dev.6",
4
4
  "description": "",
5
5
  "main": "dist/checkout-inline.js",
6
6
  "module": "dist/checkout-inline.es.js",