@salla.sa/twilight-components 1.0.52 → 1.0.53
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/index.cjs.js +2 -2
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/salla-branches.cjs.entry.js +2 -2
- package/dist/cjs/salla-button.cjs.entry.js +16 -21
- package/dist/cjs/salla-localization-modal.cjs.entry.js +1 -1
- package/dist/cjs/{salla-login-modal-a2c7fa5d.js → salla-login-modal-54cc2e83.js} +1 -1
- package/dist/cjs/salla-login-modal.cjs.entry.js +1 -1
- package/dist/cjs/salla-modal_2.cjs.entry.js +2 -2
- package/dist/cjs/salla-offer-modal.cjs.entry.js +2 -2
- package/dist/cjs/salla-product-availability.cjs.entry.js +2 -2
- package/dist/cjs/{salla-search-99d08b1f.js → salla-search-f76c6d61.js} +15 -4
- package/dist/cjs/salla-tel-input.cjs.entry.js +2 -4
- package/dist/cjs/twilight-components.cjs.js +1 -1
- package/dist/collection/components/salla-branches/salla-branches.js +2 -2
- package/dist/collection/components/salla-button/salla-button.css +51 -1
- package/dist/collection/components/salla-button/salla-button.js +54 -25
- package/dist/collection/components/salla-localization-modal/salla-localization-modal.css +5 -1
- package/dist/collection/components/salla-login-modal/salla-login-modal.js +1 -1
- package/dist/collection/components/salla-modal/salla-modal.css +4 -1
- package/dist/collection/components/salla-offer-modal/salla-offer-modal.js +2 -2
- package/dist/collection/components/salla-product-availability/salla-product-availability.js +2 -2
- package/dist/collection/components/salla-search/salla-search.css +11 -0
- package/dist/collection/components/salla-search/salla-search.js +79 -13
- package/dist/collection/components/salla-tel-input/salla-tel-input.js +2 -4
- package/dist/esm/index.js +2 -2
- package/dist/esm/loader.js +1 -1
- package/dist/esm/salla-branches.entry.js +2 -2
- package/dist/esm/salla-button.entry.js +16 -21
- package/dist/esm/salla-localization-modal.entry.js +1 -1
- package/dist/esm/{salla-login-modal-187c1f98.js → salla-login-modal-473768a6.js} +1 -1
- package/dist/esm/salla-login-modal.entry.js +1 -1
- package/dist/esm/salla-modal_2.entry.js +2 -2
- package/dist/esm/salla-offer-modal.entry.js +2 -2
- package/dist/esm/salla-product-availability.entry.js +2 -2
- package/dist/esm/{salla-search-2e3e60cb.js → salla-search-7521be0c.js} +15 -4
- package/dist/esm/salla-tel-input.entry.js +2 -4
- package/dist/esm/twilight-components.js +1 -1
- package/dist/twilight-components/index.esm.js +1 -1
- package/dist/twilight-components/{p-05dff05e.entry.js → p-105af48d.entry.js} +1 -1
- package/dist/twilight-components/p-10ea748b.js +1 -0
- package/dist/twilight-components/{p-ea455ae9.entry.js → p-134fa158.entry.js} +1 -1
- package/dist/twilight-components/p-17ebe444.entry.js +1 -0
- package/dist/twilight-components/p-2a032b88.entry.js +1 -0
- package/dist/twilight-components/p-2f3f4cce.entry.js +1 -0
- package/dist/twilight-components/p-669a9b08.entry.js +1 -0
- package/dist/twilight-components/p-78b10bac.entry.js +1 -0
- package/dist/twilight-components/{p-1f873057.entry.js → p-c51984d6.entry.js} +1 -1
- package/dist/twilight-components/p-e4f716b0.js +1 -0
- package/dist/twilight-components/twilight-components.esm.js +1 -1
- package/dist/types/components/salla-button/salla-button.d.ts +9 -2
- package/dist/types/components/salla-search/salla-search.d.ts +4 -0
- package/dist/types/components.d.ts +24 -2
- package/package.json +1 -1
- package/dist/twilight-components/p-0b599094.js +0 -1
- package/dist/twilight-components/p-2e03db57.entry.js +0 -1
- package/dist/twilight-components/p-5ffd56fb.js +0 -1
- package/dist/twilight-components/p-88d1bb89.entry.js +0 -1
- package/dist/twilight-components/p-8bfa19fb.entry.js +0 -1
- package/dist/twilight-components/p-c0a7b5a2.entry.js +0 -1
- package/dist/twilight-components/p-e6c67b55.entry.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as s,h as a,g as o}from"./p-cb1c59a2.js";import{H as e}from"./p-ed1c00c5.js";const l=class{constructor(a){var o,l;s(this,a),this.offer=null,this.offer_expires_in=salla.lang.get("pages.products.offer_expires_in"),this.remember_my_choice=salla.lang.get("commone.remember_my_choice"),e.setHost(this.host),salla.event.on("languages::translations.loaded",(()=>{this.offer_expires_in=salla.lang.get("pages.products.offer_expires_in"),this.remember_my_choice=salla.lang.get("common.remember_my_choice")})),this.categorySlot=(null===(o=e.getElement('[slot="category"]'))||void 0===o?void 0:o.innerHTML)||'<i class="s-offer-modal-badge-icon sicon-tag"></i><span class="s-offer-modal-badge-text">{name}</span>',this.productSlot=(null===(l=e.getElement('[slot="product"]'))||void 0===l?void 0:l.innerHTML)||this.defaultProductSlot(),salla.offer.event.onExisted((s=>{salla.localData.get("remember-offer-"+s.offer.offer_id)?salla.log("User selected to don't show this offer again."):this.show(s.product_id)}))}async show(s){return salla.api.offer.details(s).then((s=>this.showOffer(s.data[0])))}async showOffer(s){return this.offer=s,this.offer_name=s.name,this.offer_message=s.message,this.modal.show()}rememberMe(s){salla.localData.set("remember-offer-"+this.offer.id,s.target.checked)}addItem(){return this.load(),salla.cart.api.quickAdd(this.dataset.id).finally((()=>this.stop()))}defaultProductSlot(){return'<a href={url} class="s-offer-modal-product-image-wrap"><img class="s-offer-modal-product-image" src="{image}" /></a><div class="s-offer-modal-product-info"> <a href={url} class="s-offer-modal-product-name">{name}</a> <div class="s-offer-modal-product-price">{price}</div></div>'}render(){var s,o;return a("salla-modal",{id:"salla-offer-modal","sub-title-first":!0,icon:"sicon-special-discount",title:"عروض رائعة في انتظارك، ماذا نتنظر!","sub-title":this.offer_message,ref:s=>this.modal=s,"is-loading":null===this.offer},null!==this.offer?[a("div",{class:"s-offer-modal-scrolled-slider-wrap"},a("div",{class:"s-offer-modal-body s-offer-modal-scrolled-slider"},(null===(s=this.offer.get.categories)||void 0===s?void 0:s.length)>0?this.offer.get.categories.map((s=>a("a",{href:s.urls.customer,class:"s-offer-modal-badge s-offer-modal-slider-item",innerHTML:this.categorySlot.replace(/\{name\}/g,s.name).replace(/\{url\}/g,s.urls.customer)}))):null===(o=this.offer.get.products)||void 0===o?void 0:o.map((s=>a("div",{class:"s-offer-modal-product s-offer-modal-slider-item",id:"product_"+s.id,innerHTML:this.productSlot.replace(/\{name\}/g,s.name).replace(/\{url\}/g,s.url).replace(/\{image\}/g,s.thumbnail).replace(/\{price\}/g,s.has_special_price?salla.money(s.price)+'<span class="s-offer-modal-product-old-price">'+salla.money(s.regular_price)+"</span>":salla.money(s.price))},a("div",{class:"s-offer-modal-btn-wrap"},a("salla-button",{wide:!0,"btn-style":"outline-primary","data-id":s.id,"loader-position":"center",onClick:this.addItem},salla.lang.get("pages.cart.add_to_cart"))))))),a("div",{class:"s-offer-modal-slider-nav"},a("button",{class:"s-offer-modal-nav-btn s-offer-modal-prev-btn"},a("span",{class:"s-offer-modal-nav-btn-icon sicon-keyboard_arrow_right"})),a("button",{class:"s-offer-modal-nav-btn s-offer-modal-next-btn"},a("span",{class:"s-offer-modal-nav-btn-icon sicon-keyboard_arrow_left"})))),a("div",{class:"s-offer-modal-footer",slot:"footer"},this.offer.expiry_date?a("p",{class:"s-offer-modal-expiry"},this.offer_expires_in," ",this.offer.expiry_date):"",a("label",{class:"s-offer-modal-remember-label"},a("input",{type:"checkbox",onChange:s=>this.rememberMe(s),class:"s-offer-modal-remember-input"})," ",this.remember_my_choice))]:"")}componentDidRender(){if(this.modal.querySelectorAll("[hidden]").forEach((s=>s.removeAttribute("hidden"))),this.offer&&window.screen.width>639){let s=this.host.querySelector(".s-offer-modal-scrolled-slider-wrap"),a=this.host.querySelector(".s-offer-modal-scrolled-slider"),o=this.host.querySelectorAll(".s-offer-modal-nav-btn"),e=this.host.querySelector(".s-offer-modal-next-btn"),l=this.host.querySelector(".s-offer-modal-prev-btn"),r=this.host.querySelectorAll(".s-offer-modal-slider-item"),t=20,i=0,d=3,f=r[0].offsetWidth,n=r.length*f,c=s.offsetWidth,m=n-c,h=!!document.body.classList.contains("rtl");m>t&&e.classList.add("s-offer-modal-btn-is-active"),window.onresize=function(){c=s.offsetWidth,m=n-c},a.addEventListener("scroll",(function(){let s=Math.abs(a.scrollLeft),o=m-t;s<=t?(e.classList.add("s-offer-modal-btn-is-active"),l.classList.remove("s-offer-modal-btn-is-active")):s<o?(e.classList.add("s-offer-modal-btn-is-active"),l.classList.add("s-offer-modal-btn-is-active")):s>=o&&(e.classList.remove("s-offer-modal-btn-is-active"),l.classList.add("s-offer-modal-btn-is-active"))})),o.forEach((s=>{s.addEventListener("click",(function(){s.classList.contains("s-offer-modal-next-btn")?i++:i--,a.scrollTo({top:0,left:f*d*i*(h?-1:1),behavior:"smooth"})}))}))}}get host(){return o(this)}};l.style="#salla-offer-modal .s-offer-modal-body{-webkit-overflow-scrolling:touch}#salla-offer-modal .s-offer-modal-body::-webkit-scrollbar{display:none}#salla-offer-modal .s-offer-modal-next-btn{background:linear-gradient(90deg, #fff 25%, rgba(255, 255, 255, 0.4) 80%, rgba(255, 255, 255, 0) 100%)}#salla-offer-modal .s-offer-modal-prev-btn{background:linear-gradient(-90deg, #fff 25%, rgba(255, 255, 255, 0.4) 80%, rgba(255, 255, 255, 0) 100%)}";export{l as salla_offer_modal}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as s,h as i,H as t,g as a}from"./p-cb1c59a2.js";import{H as l}from"./p-ed1c00c5.js";const e=class{constructor(i){s(this,i),this.isUser=l.isUser(),this.productId=salla.config.get("page.id"),this.isSubscribed=!1,this.submit=async()=>{if(this.isUser)return salla.api.product.availabilitySubscribe(this.productId).then((()=>this.isSubscribed=!0));let{mobile:s,countryCode:i}=await this.mobileInput.getValues(),t={id:this.productId,country_code:i};return""!==s&&(t.mobile=s),""!==this.email.value&&(t.email=this.email.value),await this.validateform(),this.btn.load().then((()=>this.btn.disable())).then((()=>salla.api.product.availabilitySubscribe(t))).then((()=>{this.isSubscribed=!0,salla.localData.set(`product-${this.productId}-subscribed`,!0)})).then((()=>this.btn.stop())).then((()=>this.modal.hide())).catch((()=>this.btn.stop()&&this.btn.enable()))},this.typing=(s,i)=>{const t=s.target.nextElementSibling;s.target.classList.remove("s-has-error"),(null==t?void 0:t.classList.contains("s-product-availability-error-msg"))&&(t.innerText=""),"Enter"==s.key&&i()},salla.event.on("languages::translations.loaded",(()=>{var s,i,t,a;this.subscribedMessage=salla.lang.get("pages.products.notify_availability_success"),this.title_=this.host.title||salla.lang.get("pages.products.notify_availability_title"),this.subTitle=salla.lang.get("pages.products.notify_availability_subtitle"),this.mobileLabel=salla.lang.get("common.elements.mobile"),this.emailLabel=salla.lang.get("common.elements.email"),this.emailPlaceholder=salla.lang.get("common.elements.email_placeholder"),this.emailErrorMsg=salla.lang.get("common.elements.email_is_valid"),null===(s=this.modal)||void 0===s||s.setTitle(this.title_),null===(i=this.btn)||void 0===i||i.setText(salla.lang.get("common.elements.submit")),null===(t=this.cancelBtn)||void 0===t||t.setText(salla.lang.get("common.elements.cancel")),null===(a=this.inlineBtn)||void 0===a||a.setText(salla.lang.get("pages.products.notify_availability"))})),this.isUser||(this.channelsWatcher(this.channels),this.title_=this.host.title||salla.lang.get("pages.products.notify_availability_title"),this.host.removeAttribute("title"),this.isVisitorSubscribed=salla.localData.get(`product-${this.productId}-subscribed`))}channelsWatcher(s){this.channels_=s.split(",")}async validateform(){if(this.channels_.includes("email")){const s=l.isValidEmail(this.email.value);if(s)return;!s&&this.validateField(this.email,this.emailErrorMsg)}if(!this.channels_.includes("sms")||!await this.mobileInput.isValid())throw"Please insert required fields"}validateField(s,i){s.classList.add("s-has-error"),s.nextElementSibling.innerText="* "+i}render(){return i(t,{id:"s-product-availability"},this.isSubscribed||this.isVisitorSubscribed?i("div",{class:"s-product-availability-subscribed"},i("i",{class:"sicon-bell-ring s-product-availability-subs-icon"})," ",this.subscribedMessage):i("slot",null,i("salla-button",{onClick:()=>this.isUser?this.submit():this.modal.show(),wide:!0,ref:s=>this.inlineBtn=s},salla.lang.get("pages.products.notify_availability"))),this.isUser||this.isSubscribed||this.isVisitorSubscribed?"":this.renderModal())}renderModal(){return i("salla-modal",{ref:s=>this.modal=s,title:this.title_,subTitle:this.subTitle,icon:"sicon-bell-ring",width:"sm"},i("div",{class:"s-product-availability-body"},this.channels_.includes("email")?[i("label",{class:"s-product-availability-label"},this.emailLabel),i("input",{class:"s-product-availability-input",onKeyDown:s=>this.typing(s,this.submit),placeholder:this.emailPlaceholder,ref:s=>this.email=s,type:"email"}),i("span",{class:"s-product-availability-error-msg"})]:"",this.channels_.includes("sms")?[i("label",{class:"s-product-availability-label"},this.mobileLabel),i("salla-tel-input",{ref:s=>this.mobileInput=s,onKeyDown:s=>this.typing(s,this.submit)})]:""),i("div",{slot:"footer",class:"s-product-availability-footer"},i("salla-button",{wide:!0,"btn-style":"outline",onClick:()=>this.modal.hide(),ref:s=>this.cancelBtn=s},salla.lang.get("common.elements.cancel")),i("salla-button",{"loader-position":"center",wide:!0,ref:s=>this.btn=s,onClick:()=>this.submit()},salla.lang.get("common.elements.submit"))))}get host(){return a(this)}static get watchers(){return{channels:["channelsWatcher"]}}};e.style="";export{e as salla_product_availability}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as s,h as a,g as e}from"./p-cb1c59a2.js";const t=class{constructor(a){s(this,a),this.open=!1,this.isOpenedBefore=salla.localData.get("branch-choosed-before"),this.displayAs="default",this.browseProductsFrom="all",this.branches=[{id:1,name:"فرع الرياض",open:!0,available:!0,limited:!1,tag:"متوفر"},{id:2,name:"فرع جدة",open:!1,available:!1,limited:!1,tag:"غير متوفر"},{id:3,name:"فرع مكة",open:!0,available:!0,limited:!1,tag:"متوفر"},{id:4,name:"فرع المدينة",open:!0,available:!0,limited:!1,tag:"متوفر"},{id:5,name:"فرع جازان",open:!0,available:!0,limited:!0,tag:"الكمية محدودة"}],this.current=1,this.currentBranch=s=>this.branches.filter((s=>s.id==this.current))[0][s],this.statusColor=(s=null)=>s?s.limited?"s-branches-color-red":s.available?"s-branches-color-green":"s-branches-color-gray":this.currentBranch("limited")?"s-branches-color-red":this.currentBranch("available")?"s-branches-color-green":"s-branches-color-gray",this.isChoiceable=()=>"all"!==this.browseProductsFrom&&"single"==this.position||"header"==this.position,this.formTitle=()=>this.isChoiceable()?"توفر المنتج في الفروع الآخرى":"التسوق من فرع آخر",salla.event.on("branches::show",(()=>this.show())),salla.event.on("languages::translations.loaded",(()=>{var s;return null===(s=this.btn)||void 0===s?void 0:s.setText(salla.lang.get("common.elements.ok"))}))}async show(){return this.modal.show()}async hide(){return this.modal.hide()}handelChange(s){this.selected=s.target.value}handleSubmit(){this.btn.load().then((()=>{setTimeout((()=>location.reload()),2e3)})),salla.localData.set("branch-choosed-before",!0),this.show(),setTimeout((()=>{this.current=this.selected}),300)}render(){return a("salla-modal",{icon:"sicon-store-alt",title:"فرع الرياض","sub-title":"أنت الآن تتصفح المتجر من","sub-title-first":!0,"is-closable":this.isOpenedBefore||"popup"!=this.displayAs?"true":"false",ref:s=>this.modal=s,width:"sm",id:"s-branches-modal",class:"s-hidden"},a("h4",{class:"s-branches-title"},this.formTitle()),this.branches.length<=5?a("div",{class:"s-branches-space-v"},this.branches.map((s=>a("div",{class:"s-branches-input-wrap"},a("input",{id:this.position+"_branch_"+s.id,disabled:!s.open&&this.isChoiceable(),name:"lang",type:"radio",value:s.id,onChange:s=>this.handelChange(s),class:{"s-branches-input":!0,"opacity-50":!s.open,"s-hidden":!this.isChoiceable()},checked:this.current==s.id}),a("label",{htmlFor:this.position+"_branch_"+s.id,class:{"s-branches-label":!0,"s-branches-clickable":this.isChoiceable()}},a("span",{class:{"s-branches-is-closed":!s.open}},s.name),this.isChoiceable()?a("small",{class:"s-branches-closed-badge"},s.open?"":"مُغلق"):a("span",{class:this.statusColor(s)},s.tag)))))):a("select",{class:"s-branches-select",onInput:s=>this.handelChange(s)},this.branches.map((s=>a("option",{value:s.id,disabled:!s.open,selected:this.selected==s.id},s.name," ",s.open?"":"- مُغلق")))),this.isChoiceable()?a("slot",{name:"footer"},a("salla-button",{ref:s=>this.btn=s,onClick:()=>this.handleSubmit(),class:"s-branches-submit",wide:!0},salla.lang.get("common.elements.ok"))):"")}componentDidRender(){this.isOpenedBefore||"popup"!=this.displayAs||this.show()}get host(){return e(this)}};t.style="";export{t as salla_branches}
|