@spot-flow/checkout-inline-js 0.1.39 → 0.1.40
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/checkout-inline.es.js +10 -10
- package/dist/checkout-inline.js +2 -2
- package/package.json +1 -1
|
@@ -34865,7 +34865,7 @@ class su {
|
|
|
34865
34865
|
const ou = `<div class="flex items-center justify-center md:justify-between w-full text-xxs mt-5">
|
|
34866
34866
|
<div class="text-tone-60"><span>Powered by</span> <span class="font-bold">Spotflow</span></div>
|
|
34867
34867
|
<div class="align-center text-tone-60 hidden md:flex gap-4">
|
|
34868
|
-
<span id="test-cards-link" class="hover:font-bold">Test Cards</span>
|
|
34868
|
+
<!-- <span id="test-cards-link" class="hover:font-bold">Test Cards</span> -->
|
|
34869
34869
|
<a href="https://ribbon-scowl-35f.notion.site/Terms-Conditions-940742f0a1b144498ffc1786c5bc6a08?pvs=4" target="_blank" class="hover:font-bold">Terms</a>
|
|
34870
34870
|
<a href="https://ribbon-scowl-35f.notion.site/Privacy-Policy-Spotflow-3997ee8d923d4cd39a3dc43b7249b713" target="_blank" class="hover:font-bold">Privacy</a>
|
|
34871
34871
|
<a href="mailto:hello@spotflow.one" class="hover:font-bold">Contact</a>
|
|
@@ -35529,7 +35529,7 @@ class cu {
|
|
|
35529
35529
|
);
|
|
35530
35530
|
En && v && Number(v.length) === d.value.length && P.track("input_phone_number", {
|
|
35531
35531
|
payment_method: "Mobile Money",
|
|
35532
|
-
phone_number:
|
|
35532
|
+
// phone_number: phoneNumberInput.value,
|
|
35533
35533
|
network: s.value
|
|
35534
35534
|
});
|
|
35535
35535
|
}), s.addEventListener("change", () => {
|
|
@@ -35541,16 +35541,16 @@ class cu {
|
|
|
35541
35541
|
}
|
|
35542
35542
|
})), i && i.classList.add("hidden"), !(!s || !t || !a) && e && e.addEventListener("submit", (l) => {
|
|
35543
35543
|
l.preventDefault();
|
|
35544
|
-
const d = this.
|
|
35545
|
-
(
|
|
35546
|
-
)[0].allowsZeros ? `0${t.value}` : t.value,
|
|
35544
|
+
const d = this.localCurrency !== this.currency ? this.localCurrency : this.currency, p = this.countryCode || d, g = En.filter(
|
|
35545
|
+
(k) => k.name === p
|
|
35546
|
+
)[0].allowsZeros ? `0${t.value}` : t.value, f = s.value, y = o ? o.value : "";
|
|
35547
35547
|
this.onAction(l)({
|
|
35548
|
-
code:
|
|
35548
|
+
code: f,
|
|
35549
35549
|
// "mtn-gh",
|
|
35550
|
-
phoneNumber:
|
|
35550
|
+
phoneNumber: g,
|
|
35551
35551
|
// "233987654321"
|
|
35552
|
-
...
|
|
35553
|
-
otp:
|
|
35552
|
+
...f === "orange" && {
|
|
35553
|
+
otp: y
|
|
35554
35554
|
}
|
|
35555
35555
|
}), P.track("start_payment", {
|
|
35556
35556
|
payment_method: "Mobile Money"
|
|
@@ -35580,7 +35580,7 @@ class cu {
|
|
|
35580
35580
|
i.appendChild(d), i.classList.remove("text-tone-50"), i.classList.add("text-tone-100");
|
|
35581
35581
|
});
|
|
35582
35582
|
}
|
|
35583
|
-
const t = this.container.querySelector("#region-code"), s = this.localCurrency ? this.localCurrency : this.currency, o = En.find(
|
|
35583
|
+
const t = this.container.querySelector("#region-code"), s = this.localCurrency !== this.currency ? this.localCurrency : this.currency, o = En.find(
|
|
35584
35584
|
(a) => a.name === (this.countryCode || s)
|
|
35585
35585
|
);
|
|
35586
35586
|
if (t) {
|
package/dist/checkout-inline.js
CHANGED
|
@@ -1500,7 +1500,7 @@ or you can use record.mirror to access the mirror instance during recording.`;le
|
|
|
1500
1500
|
`;a+="</div>"}a+="</div>"}a+="</div>",i.innerHTML=a}}}render(){return ul}}const ml=`<div class="flex items-center justify-center md:justify-between w-full text-xxs mt-5">
|
|
1501
1501
|
<div class="text-tone-60"><span>Powered by</span> <span class="font-bold">Spotflow</span></div>
|
|
1502
1502
|
<div class="align-center text-tone-60 hidden md:flex gap-4">
|
|
1503
|
-
<span id="test-cards-link" class="hover:font-bold">Test Cards</span>
|
|
1503
|
+
<!-- <span id="test-cards-link" class="hover:font-bold">Test Cards</span> -->
|
|
1504
1504
|
<a href="https://ribbon-scowl-35f.notion.site/Terms-Conditions-940742f0a1b144498ffc1786c5bc6a08?pvs=4" target="_blank" class="hover:font-bold">Terms</a>
|
|
1505
1505
|
<a href="https://ribbon-scowl-35f.notion.site/Privacy-Policy-Spotflow-3997ee8d923d4cd39a3dc43b7249b713" target="_blank" class="hover:font-bold">Privacy</a>
|
|
1506
1506
|
<a href="mailto:hello@spotflow.one" class="hover:font-bold">Contact</a>
|
|
@@ -1935,7 +1935,7 @@ or you can use record.mirror to access the mirror instance during recording.`;le
|
|
|
1935
1935
|
</p>
|
|
1936
1936
|
</div>
|
|
1937
1937
|
|
|
1938
|
-
</form>`;class yl{constructor(e){h(this,"container");h(this,"payment");h(this,"warningError");h(this,"pageLoader");h(this,"localCurrency");h(this,"amount");h(this,"totalAmount");h(this,"onAction");h(this,"switchScreen");h(this,"merchantKey");h(this,"rdtCode");h(this,"url");h(this,"currency");h(this,"restartTransactionProcess");h(this,"merchantDetails");h(this,"countryCode");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.amount=e.amount,this.totalAmount=e.totalAmount,this.merchantDetails=e.merchantDetails,this.restartTransactionProcess=e.restartTransactionProcess,this.warningError=new gn({container:this.container,onAction:this.restartTransactionProcess.bind(this)}),this.countryCode=e.countryCode}validateForm(){const e=this.container.querySelector("#phone-number-input"),i=this.container.querySelector("#network-search-input"),t=this.container.querySelector("#otp-input"),o=this.container.querySelector(".details-form-button"),s=this.container.querySelector("#phone-number-container"),a=this.container.querySelector("#phone-number-error");if(!e||!i||!o)return;const l=this.localCurrency?this.localCurrency:this.currency,d=Pn.find(v=>v.name===(this.countryCode||l));e.value.length>Number((d==null?void 0:d.length)||"9")?(s&&(s.classList.remove("border-tone-40"),s.classList.add("border-[#D62020]"),e.classList.remove("text-tone-100"),e.classList.add("text-[#D62020]")),a&&(a.classList.remove("hidden"),a.classList.add("block"),a.innerHTML="Please enter a valid phone number. You can remove the leading zero if it exists.")):(s&&(s.classList.remove("border-[#D62020]"),s.classList.add("border-tone-40"),e.classList.remove("text-[#D62020]"),e.classList.add("text-tone-100")),a&&(a.classList.remove("block"),a.classList.add("hidden"))),e.value.length>0&&e.value.length===Number((d==null?void 0:d.length)||"9")&&i.value?i.value==="orange"?t&&t.value.length>=6?o.disabled=!1:o.disabled=!0:o.disabled=!1:o.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("#otp-input"),a=this.container.querySelector(".details-form-button");a&&(a.disabled=!0),t&&o&&(t.addEventListener("input",l=>{const d=l.target;d.value=d.value.replace(/\D/g,""),this.validateForm();const v=this.localCurrency?this.localCurrency:this.currency,p=Pn.find(g=>g.name===(this.countryCode||v));Pn&&p&&Number(p.length)===d.value.length&&P.track("input_phone_number",{payment_method:"Mobile Money",
|
|
1938
|
+
</form>`;class yl{constructor(e){h(this,"container");h(this,"payment");h(this,"warningError");h(this,"pageLoader");h(this,"localCurrency");h(this,"amount");h(this,"totalAmount");h(this,"onAction");h(this,"switchScreen");h(this,"merchantKey");h(this,"rdtCode");h(this,"url");h(this,"currency");h(this,"restartTransactionProcess");h(this,"merchantDetails");h(this,"countryCode");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.amount=e.amount,this.totalAmount=e.totalAmount,this.merchantDetails=e.merchantDetails,this.restartTransactionProcess=e.restartTransactionProcess,this.warningError=new gn({container:this.container,onAction:this.restartTransactionProcess.bind(this)}),this.countryCode=e.countryCode}validateForm(){const e=this.container.querySelector("#phone-number-input"),i=this.container.querySelector("#network-search-input"),t=this.container.querySelector("#otp-input"),o=this.container.querySelector(".details-form-button"),s=this.container.querySelector("#phone-number-container"),a=this.container.querySelector("#phone-number-error");if(!e||!i||!o)return;const l=this.localCurrency?this.localCurrency:this.currency,d=Pn.find(v=>v.name===(this.countryCode||l));e.value.length>Number((d==null?void 0:d.length)||"9")?(s&&(s.classList.remove("border-tone-40"),s.classList.add("border-[#D62020]"),e.classList.remove("text-tone-100"),e.classList.add("text-[#D62020]")),a&&(a.classList.remove("hidden"),a.classList.add("block"),a.innerHTML="Please enter a valid phone number. You can remove the leading zero if it exists.")):(s&&(s.classList.remove("border-[#D62020]"),s.classList.add("border-tone-40"),e.classList.remove("text-[#D62020]"),e.classList.add("text-tone-100")),a&&(a.classList.remove("block"),a.classList.add("hidden"))),e.value.length>0&&e.value.length===Number((d==null?void 0:d.length)||"9")&&i.value?i.value==="orange"?t&&t.value.length>=6?o.disabled=!1:o.disabled=!0:o.disabled=!1:o.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("#otp-input"),a=this.container.querySelector(".details-form-button");a&&(a.disabled=!0),t&&o&&(t.addEventListener("input",l=>{const d=l.target;d.value=d.value.replace(/\D/g,""),this.validateForm();const v=this.localCurrency?this.localCurrency:this.currency,p=Pn.find(g=>g.name===(this.countryCode||v));Pn&&p&&Number(p.length)===d.value.length&&P.track("input_phone_number",{payment_method:"Mobile Money",network:o.value})}),o.addEventListener("change",()=>{if(this.validateForm(),o.value==="orange"){const l=this.container.querySelector("#otp-message"),d=this.container.querySelector("#otp-input-container");l&&l.classList.remove("hidden"),d&&d.classList.remove("hidden")}})),i&&i.classList.add("hidden"),!(!o||!t||!a)&&e&&e.addEventListener("submit",l=>{l.preventDefault();const d=this.localCurrency!==this.currency?this.localCurrency:this.currency,v=this.countryCode||d,g=Pn.filter(k=>k.name===v)[0].allowsZeros?`0${t.value}`:t.value,f=o.value,y=s?s.value:"";this.onAction(l)({code:f,phoneNumber:g,...f==="orange"&&{otp:y}}),P.track("start_payment",{payment_method:"Mobile Money"})})}displayButtonText(e){var t,o;const i=this.container.querySelector("#mobile-money-button-text");if(i){const s=this.localCurrency&&this.localCurrency!==this.currency?this.localCurrency:this.currency;i.textContent=`Continue to pay ${s} ${xe(this.totalAmount!==this.amount?this.totalAmount:this.amount*(this.currency==="USD"?(o=(t=this.merchantDetails)==null?void 0:t.rate)==null?void 0:o.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.currency?this.localCurrency:this.currency,s=Pn.find(a=>a.name===(this.countryCode||o));if(t){t.innerHTML=`
|
|
1939
1939
|
${s==null?void 0:s.icon}
|
|
1940
1940
|
<span class="text-tone-100 text-sm font-semibold">${s==null?void 0:s.dialCode}</span>
|
|
1941
1941
|
`;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),P.track("providers_loaded",{payment_method:"Mobile Money",provider_count:e.length})}).catch(e=>{this.switchScreen(5),P.track("providers_failed",{payment_method:"Mobile Money",error:e.message||"Unknown error"}),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">
|