@salla.sa/twilight-components 1.0.77 → 1.0.79
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/cjs/salla-verify-modal.cjs.entry.js +1 -1
- package/dist/collection/components/salla-verify-modal/salla-verify-modal.js +1 -1
- package/dist/components/salla-verify-modal2.js +1 -1
- package/dist/esm/salla-verify-modal.entry.js +1 -1
- package/dist/twilight-components/p-11eca9be.entry.js +4 -0
- package/dist/twilight-components/twilight-components.esm.js +1 -1
- package/package.json +1 -1
- package/dist/twilight-components/p-05c60bb8.entry.js +0 -4
|
@@ -35,7 +35,7 @@ const SallaVerifyModal = class {
|
|
|
35
35
|
(_b = this.btn) === null || _b === void 0 ? void 0 : _b.setText(salla.lang.get('pages.profile.verify'));
|
|
36
36
|
});
|
|
37
37
|
if (this.withoutModal) {
|
|
38
|
-
this.modal = { open: () => '', close: () => '' };
|
|
38
|
+
this.modal = { open: () => '', close: () => '', setTitle: () => '' };
|
|
39
39
|
return;
|
|
40
40
|
}
|
|
41
41
|
salla.event.on('profile::verification', data => {
|
|
@@ -30,7 +30,7 @@ export class SallaVerifyModal {
|
|
|
30
30
|
(_b = this.btn) === null || _b === void 0 ? void 0 : _b.setText(salla.lang.get('pages.profile.verify'));
|
|
31
31
|
});
|
|
32
32
|
if (this.withoutModal) {
|
|
33
|
-
this.modal = { open: () => '', close: () => '' };
|
|
33
|
+
this.modal = { open: () => '', close: () => '', setTitle: () => '' };
|
|
34
34
|
return;
|
|
35
35
|
}
|
|
36
36
|
salla.event.on('profile::verification', data => {
|
|
@@ -34,7 +34,7 @@ const SallaVerifyModal = /*@__PURE__*/ proxyCustomElement(class extends HTMLElem
|
|
|
34
34
|
(_b = this.btn) === null || _b === void 0 ? void 0 : _b.setText(salla.lang.get('pages.profile.verify'));
|
|
35
35
|
});
|
|
36
36
|
if (this.withoutModal) {
|
|
37
|
-
this.modal = { open: () => '', close: () => '' };
|
|
37
|
+
this.modal = { open: () => '', close: () => '', setTitle: () => '' };
|
|
38
38
|
return;
|
|
39
39
|
}
|
|
40
40
|
salla.event.on('profile::verification', data => {
|
|
@@ -31,7 +31,7 @@ const SallaVerifyModal = class {
|
|
|
31
31
|
(_b = this.btn) === null || _b === void 0 ? void 0 : _b.setText(salla.lang.get('pages.profile.verify'));
|
|
32
32
|
});
|
|
33
33
|
if (this.withoutModal) {
|
|
34
|
-
this.modal = { open: () => '', close: () => '' };
|
|
34
|
+
this.modal = { open: () => '', close: () => '', setTitle: () => '' };
|
|
35
35
|
return;
|
|
36
36
|
}
|
|
37
37
|
salla.event.on('profile::verification', data => {
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Crafted with ❤ by Salla
|
|
3
|
+
*/
|
|
4
|
+
import{r as s,c as i,h as t,H as e,g as l}from"./p-8ee2e4db.js";import{H as a}from"./p-9d2ca9c8.js";const r=class{constructor(t){s(this,t),this.verified=i(this,"verified",7),this.initiated=!1,this.type="mobile",this.autoReload=!0,this.isProfileVerify=!1,salla.lang.onLoaded((()=>{var s,i;this.title=salla.lang.get("pages.profile.verify_title")+salla.lang.get("common.elements."+this.type),null===(s=this.modal)||void 0===s||s.setTitle(this.title),null===(i=this.btn)||void 0===i||i.setText(salla.lang.get("pages.profile.verify"))})),this.withoutModal?this.modal={open:()=>"",close:()=>"",setTitle:()=>""}:salla.event.on("profile::verification",(s=>{var i;this.isProfileVerify=!0,this.open(s),this.title=salla.lang.get("pages.profile.verify_title")+salla.lang.get("common.elements."+s.type),null===(i=this.modal)||void 0===i||i.setTitle(this.title)}))}async getCode(){return this.code.value}async open(s){var i;this.data=s,this.data.type=this.data.type||this.type,this.type=this.data.type,this.resendTimer(),this.otpInputs=this.host.querySelectorAll(".s-verify-modal-input"),this.initiated||(a.on("input",".s-verify-modal-input",(s=>salla.helpers.inputDigitsOnly(s.target))),a.onKeyUp(".s-verify-modal-input",(s=>{var i,t,e,l;let a=s.keyCode||s.charCode;s.target.value?(null===(i=s.target.nextElementSibling)||void 0===i||i.focus(),null===(t=s.target.nextElementSibling)||void 0===t||t.select()):[8,46].includes(a)&&(null===(e=s.target.previousElementSibling)||void 0===e||e.focus(),null===(l=s.target.previousElementSibling)||void 0===l||l.select()),this.toggleOTPSubmit()})),a.on("paste",".s-verify-modal-input",(s=>{let i=salla.helpers.number(s.clipboardData.getData("text")).replace(/[^0-9.]/g,"").replace("..",".");this.otpInputs.forEach(((s,t)=>s.value=i[t]||"")),this.toggleOTPSubmit(),setTimeout((()=>this.otpInputs[3].focus()),100)})),this.initiated=!0),this.reset(),!this.withoutModal&&(null===(i=this.modal)||void 0===i||i.setTitle(this.title)),this.modal.open()}toggleOTPSubmit(){let s=[];if(this.otpInputs.forEach((i=>i.value&&s.push(i.value))),this.code.value=s.join(""),4===s.length)return this.btn.removeAttribute("disabled"),void this.btn.click();this.btn.setAttribute("disabled","")}reset(){this.otpInputs.forEach((s=>s.value="")),this.code.value="",this.otpInputs[0].focus()}resendTimer(){a.showElement(this.resendMessage).hideElement(this.resend);let s=30,i=setInterval((()=>{-1===s?(clearTimeout(i),a.hideElement(this.resendMessage).showElement(this.resend)):(this.timer.innerHTML=`${s>=10?s:"0"+s} : 00`,s--)}),1e3)}resendCode(){return this.btn.stop().then((()=>this.btn.disable())).then((()=>{this.otpInputs.forEach((s=>s.value="")),this.otpInputs[0].focus()})).then((()=>salla.api.auth.resend(this.data))).then((()=>this.resendTimer())).catch((()=>this.resendTimer()))}submit(){let s=Object.assign({code:this.code.value},this.data);return this.btn.load().then((()=>this.btn.disable())).then((()=>this.isProfileVerify?salla.profile.verify(s):salla.auth.verify(s,!0))).then((s=>this.verified.emit(s))).then((()=>this.btn.stop()&&this.btn.disable())).then((()=>this.modal.close())).then((()=>this.autoReload&&window.location.reload())).catch((()=>this.btn.stop()&&this.btn.enable()&&this.reset()))}render(){return this.withoutModal?t(e,null,this.myBody()):t("salla-modal",{icon:"sicon-android-phone",width:"xs",id:"s-verify-modal",ref:s=>this.modal=s,"modal-title":this.title},this.myBody())}myBody(){return t("div",{id:"s-verify-modal"},t("div",{class:"s-verify-modal-message",innerHTML:salla.lang.get("pages.profile.verify_message")}),t("input",{type:"hidden",name:"code",maxlength:"4",required:!0,ref:s=>this.code=s}),t("div",{class:"s-verify-modal-codes",dir:"ltr"},[1,2,3,4].map((()=>t("input",{type:"text",maxlength:"1",class:"s-verify-modal-input",required:!0})))),t("div",{slot:"footer",class:"s-verify-modal-footer"},t("salla-button",{class:"s-verify-modal-submit","loader-position":"center",disabled:!0,onClick:()=>this.submit(),ref:s=>this.btn=s},salla.lang.get("pages.profile.verify")),t("p",{class:"s-verify-modal-resend-message",ref:s=>this.resendMessage=s},salla.lang.get("blocks.header.resend_after"),t("b",{class:"s-verify-modal-timer",ref:s=>this.timer=s})),t("a",{href:"#",class:"s-verify-modal-resend",onClick:()=>this.resendCode(),ref:s=>this.resend=s},salla.lang.get("blocks.comments.submit"))),t("slot",{name:"after-footer"}))}get host(){return l(this)}};r.style="salla-verify-modal{display:block}[dir=ltr] #s-verify-modal .s-verify-modal-back{transform:scale(-1)}";export{r as salla_verify_modal}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{p as e,b as a}from"./p-8ee2e4db.js";(()=>{const a=import.meta.url,l={};return""!==a&&(l.resourcesUrl=new URL(".",a).href),e(l)})().then((e=>a([["p-5fa50b46",[[4,"salla-add-product-button",{channels:[513],quantity:[514],donatingAmount:[514,"donating-amount"],productId:[520,"product-id"],productStatus:[513,"product-status"],productType:[513,"product-type"],disabled:[516]}],[0,"salla-search",{inline:[4],oval:[4],height:[2],results:[32],placeholder:[32],noResultsText:[32]},[[0,"modalOpened","onModalOpen"],[0,"modalClosed","onModalClose"]]],[0,"salla-product-availability",{channels:[1],productId:[2,"product-id"],isSubscribed:[1028,"is-subscribed"],subTitle:[32],mobileLabel:[32],emailLabel:[32],emailPlaceholder:[32],subscribedMessage:[32],title_:[32],emailErrorMsg:[32],isVisitorSubscribed:[32]}],[0,"salla-tel-input",{phone:[1025],name:[1],countryCode:[1025,"country-code"],mobileRequired:[32],countryCodeLabel:[32],mobileLabel:[32],tooShort:[32],tooLong:[32],invalidCountryCode:[32],invalidNumber:[32],errorMap:[32],getValues:[64],isValid:[64]}],[4,"salla-button",{shape:[513],color:[513],fill:[513],size:[513],width:[513],loading:[516],disabled:[516],loaderPosition:[1,"loader-position"],wide:[4],href:[1],load:[64],stop:[64],setText:[64],disable:[64],enable:[64]}],[4,"salla-modal",{isClosable:[1028,"is-closable"],width:[513],position:[513],visible:[516],isLoading:[1540,"is-loading"],subTitleFirst:[4,"sub-title-first"],noPadding:[4,"no-padding"],subTitle:[1,"sub-title"],icon:[1],iconStyle:[1,"icon-style"],imageIcon:[1,"image-icon"],modalTitle:[32],open:[64],close:[64],setTitle:[64],loading:[64],stopLoading:[64]}]]],["p-d82b45e3",[[4,"salla-login-modal",{isEmailAllowed:[1028,"is-email-allowed"],isMobileAllowed:[1028,"is-mobile-allowed"],isEmailRequired:[1028,"is-email-required"],title:[32],loginTypeTitle:[32],loginText:[32],smsLabel:[32],mobileLabel:[32],emailLabel:[32],enterText:[32],bySMSText:[32],byEmailText:[32],emailErrorMsg:[32],firstNameLabel:[32],lastNameLabel:[32],firstNameErrorMsg:[32],lastNameErrorMsg:[32],open:[64]},[[0,"verified","onVerified"]]]]],["p-34abe2be",[[0,"salla-rating-modal",{orderId:[2,"order-id"],order:[32],open:[64],close:[64]}]]],["p-8d60c7c0",[[4,"salla-branches",{position:[1],displayAs:[1,"display-as"],browseProductsFrom:[1,"browse-products-from"],branches:[16],current:[1026],open:[32],selected:[32],isOpenedBefore:[32],show:[64],hide:[64]}]]],["p-4f37512b",[[0,"salla-localization-modal",{language:[1537],currency:[1537],languages:[32],currencies:[32],languagesTitle:[32],currenciesTitle:[32],isLoading:[32],open:[64],close:[64],submit:[64]}]]],["p-0ed349dd",[[0,"salla-offer-modal",{offer:[32],offer_name:[32],offer_message:[32],offer_expires_in:[32],remember_my_choice:[32],add_to_cart:[32],out_of_stock:[32],open:[64],showOffer:[64]}]]],["p-4204e511",[[4,"salla-conditional-fields",null,[[0,"change","changeHandler"]]]]],["p-ca52e3ed",[[4,"salla-infinite-scroll",{nextPage:[1,"next-page"],autoload:[1028],container:[1],item:[1],loadMore:[32],noMore:[32],failedToLoad:[32]}]]],["p-f61388fb",[[0,"salla-installment",{price:[1],language:[1],currency:[1],tamaraIsActive:[32],tabbyIsActive:[32],spotiiIsActive:[32]}]]],["p-9f417e0d",[[4,"salla-quantity-input",{quantity:[32],decrease:[64],increase:[64],setValue:[64]}]]],["p-
|
|
4
|
+
import{p as e,b as a}from"./p-8ee2e4db.js";(()=>{const a=import.meta.url,l={};return""!==a&&(l.resourcesUrl=new URL(".",a).href),e(l)})().then((e=>a([["p-5fa50b46",[[4,"salla-add-product-button",{channels:[513],quantity:[514],donatingAmount:[514,"donating-amount"],productId:[520,"product-id"],productStatus:[513,"product-status"],productType:[513,"product-type"],disabled:[516]}],[0,"salla-search",{inline:[4],oval:[4],height:[2],results:[32],placeholder:[32],noResultsText:[32]},[[0,"modalOpened","onModalOpen"],[0,"modalClosed","onModalClose"]]],[0,"salla-product-availability",{channels:[1],productId:[2,"product-id"],isSubscribed:[1028,"is-subscribed"],subTitle:[32],mobileLabel:[32],emailLabel:[32],emailPlaceholder:[32],subscribedMessage:[32],title_:[32],emailErrorMsg:[32],isVisitorSubscribed:[32]}],[0,"salla-tel-input",{phone:[1025],name:[1],countryCode:[1025,"country-code"],mobileRequired:[32],countryCodeLabel:[32],mobileLabel:[32],tooShort:[32],tooLong:[32],invalidCountryCode:[32],invalidNumber:[32],errorMap:[32],getValues:[64],isValid:[64]}],[4,"salla-button",{shape:[513],color:[513],fill:[513],size:[513],width:[513],loading:[516],disabled:[516],loaderPosition:[1,"loader-position"],wide:[4],href:[1],load:[64],stop:[64],setText:[64],disable:[64],enable:[64]}],[4,"salla-modal",{isClosable:[1028,"is-closable"],width:[513],position:[513],visible:[516],isLoading:[1540,"is-loading"],subTitleFirst:[4,"sub-title-first"],noPadding:[4,"no-padding"],subTitle:[1,"sub-title"],icon:[1],iconStyle:[1,"icon-style"],imageIcon:[1,"image-icon"],modalTitle:[32],open:[64],close:[64],setTitle:[64],loading:[64],stopLoading:[64]}]]],["p-d82b45e3",[[4,"salla-login-modal",{isEmailAllowed:[1028,"is-email-allowed"],isMobileAllowed:[1028,"is-mobile-allowed"],isEmailRequired:[1028,"is-email-required"],title:[32],loginTypeTitle:[32],loginText:[32],smsLabel:[32],mobileLabel:[32],emailLabel:[32],enterText:[32],bySMSText:[32],byEmailText:[32],emailErrorMsg:[32],firstNameLabel:[32],lastNameLabel:[32],firstNameErrorMsg:[32],lastNameErrorMsg:[32],open:[64]},[[0,"verified","onVerified"]]]]],["p-34abe2be",[[0,"salla-rating-modal",{orderId:[2,"order-id"],order:[32],open:[64],close:[64]}]]],["p-8d60c7c0",[[4,"salla-branches",{position:[1],displayAs:[1,"display-as"],browseProductsFrom:[1,"browse-products-from"],branches:[16],current:[1026],open:[32],selected:[32],isOpenedBefore:[32],show:[64],hide:[64]}]]],["p-4f37512b",[[0,"salla-localization-modal",{language:[1537],currency:[1537],languages:[32],currencies:[32],languagesTitle:[32],currenciesTitle:[32],isLoading:[32],open:[64],close:[64],submit:[64]}]]],["p-0ed349dd",[[0,"salla-offer-modal",{offer:[32],offer_name:[32],offer_message:[32],offer_expires_in:[32],remember_my_choice:[32],add_to_cart:[32],out_of_stock:[32],open:[64],showOffer:[64]}]]],["p-4204e511",[[4,"salla-conditional-fields",null,[[0,"change","changeHandler"]]]]],["p-ca52e3ed",[[4,"salla-infinite-scroll",{nextPage:[1,"next-page"],autoload:[1028],container:[1],item:[1],loadMore:[32],noMore:[32],failedToLoad:[32]}]]],["p-f61388fb",[[0,"salla-installment",{price:[1],language:[1],currency:[1],tamaraIsActive:[32],tabbyIsActive:[32],spotiiIsActive:[32]}]]],["p-9f417e0d",[[4,"salla-quantity-input",{quantity:[32],decrease:[64],increase:[64],setValue:[64]}]]],["p-11eca9be",[[4,"salla-verify-modal",{withoutModal:[4,"without-modal"],type:[1],autoReload:[4,"auto-reload"],title:[32],isProfileVerify:[32],getCode:[64],open:[64]}]]],["p-18b36fe0",[[0,"salla-rating-stars",{name:[1],size:[1],value:[2]}]]]],e)));
|
package/package.json
CHANGED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Crafted with ❤ by Salla
|
|
3
|
-
*/
|
|
4
|
-
import{r as s,c as i,h as t,H as e,g as l}from"./p-8ee2e4db.js";import{H as a}from"./p-9d2ca9c8.js";const r=class{constructor(t){s(this,t),this.verified=i(this,"verified",7),this.initiated=!1,this.type="mobile",this.autoReload=!0,this.isProfileVerify=!1,salla.lang.onLoaded((()=>{var s,i;this.title=salla.lang.get("pages.profile.verify_title")+salla.lang.get("common.elements."+this.type),null===(s=this.modal)||void 0===s||s.setTitle(this.title),null===(i=this.btn)||void 0===i||i.setText(salla.lang.get("pages.profile.verify"))})),this.withoutModal?this.modal={open:()=>"",close:()=>""}:salla.event.on("profile::verification",(s=>{var i;this.isProfileVerify=!0,this.open(s),this.title=salla.lang.get("pages.profile.verify_title")+salla.lang.get("common.elements."+s.type),null===(i=this.modal)||void 0===i||i.setTitle(this.title)}))}async getCode(){return this.code.value}async open(s){var i;this.data=s,this.data.type=this.data.type||this.type,this.type=this.data.type,this.resendTimer(),this.otpInputs=this.host.querySelectorAll(".s-verify-modal-input"),this.initiated||(a.on("input",".s-verify-modal-input",(s=>salla.helpers.inputDigitsOnly(s.target))),a.onKeyUp(".s-verify-modal-input",(s=>{var i,t,e,l;let a=s.keyCode||s.charCode;s.target.value?(null===(i=s.target.nextElementSibling)||void 0===i||i.focus(),null===(t=s.target.nextElementSibling)||void 0===t||t.select()):[8,46].includes(a)&&(null===(e=s.target.previousElementSibling)||void 0===e||e.focus(),null===(l=s.target.previousElementSibling)||void 0===l||l.select()),this.toggleOTPSubmit()})),a.on("paste",".s-verify-modal-input",(s=>{let i=salla.helpers.number(s.clipboardData.getData("text")).replace(/[^0-9.]/g,"").replace("..",".");this.otpInputs.forEach(((s,t)=>s.value=i[t]||"")),this.toggleOTPSubmit(),setTimeout((()=>this.otpInputs[3].focus()),100)})),this.initiated=!0),this.reset(),!this.withoutModal&&(null===(i=this.modal)||void 0===i||i.setTitle(this.title)),this.modal.open()}toggleOTPSubmit(){let s=[];if(this.otpInputs.forEach((i=>i.value&&s.push(i.value))),this.code.value=s.join(""),4===s.length)return this.btn.removeAttribute("disabled"),void this.btn.click();this.btn.setAttribute("disabled","")}reset(){this.otpInputs.forEach((s=>s.value="")),this.code.value="",this.otpInputs[0].focus()}resendTimer(){a.showElement(this.resendMessage).hideElement(this.resend);let s=30,i=setInterval((()=>{-1===s?(clearTimeout(i),a.hideElement(this.resendMessage).showElement(this.resend)):(this.timer.innerHTML=`${s>=10?s:"0"+s} : 00`,s--)}),1e3)}resendCode(){return this.btn.stop().then((()=>this.btn.disable())).then((()=>{this.otpInputs.forEach((s=>s.value="")),this.otpInputs[0].focus()})).then((()=>salla.api.auth.resend(this.data))).then((()=>this.resendTimer())).catch((()=>this.resendTimer()))}submit(){let s=Object.assign({code:this.code.value},this.data);return this.btn.load().then((()=>this.btn.disable())).then((()=>this.isProfileVerify?salla.profile.verify(s):salla.auth.verify(s,!0))).then((s=>this.verified.emit(s))).then((()=>this.btn.stop()&&this.btn.disable())).then((()=>this.modal.close())).then((()=>this.autoReload&&window.location.reload())).catch((()=>this.btn.stop()&&this.btn.enable()&&this.reset()))}render(){return this.withoutModal?t(e,null,this.myBody()):t("salla-modal",{icon:"sicon-android-phone",width:"xs",id:"s-verify-modal",ref:s=>this.modal=s,"modal-title":this.title},this.myBody())}myBody(){return t("div",{id:"s-verify-modal"},t("div",{class:"s-verify-modal-message",innerHTML:salla.lang.get("pages.profile.verify_message")}),t("input",{type:"hidden",name:"code",maxlength:"4",required:!0,ref:s=>this.code=s}),t("div",{class:"s-verify-modal-codes",dir:"ltr"},[1,2,3,4].map((()=>t("input",{type:"text",maxlength:"1",class:"s-verify-modal-input",required:!0})))),t("div",{slot:"footer",class:"s-verify-modal-footer"},t("salla-button",{class:"s-verify-modal-submit","loader-position":"center",disabled:!0,onClick:()=>this.submit(),ref:s=>this.btn=s},salla.lang.get("pages.profile.verify")),t("p",{class:"s-verify-modal-resend-message",ref:s=>this.resendMessage=s},salla.lang.get("blocks.header.resend_after"),t("b",{class:"s-verify-modal-timer",ref:s=>this.timer=s})),t("a",{href:"#",class:"s-verify-modal-resend",onClick:()=>this.resendCode(),ref:s=>this.resend=s},salla.lang.get("blocks.comments.submit"))),t("slot",{name:"after-footer"}))}get host(){return l(this)}};r.style="salla-verify-modal{display:block}[dir=ltr] #s-verify-modal .s-verify-modal-back{transform:scale(-1)}";export{r as salla_verify_modal}
|