@salla.sa/twilight-components 1.0.49 → 1.0.50
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-offer.cjs.entry.js +1 -1
- package/dist/collection/components/salla-offer/salla-offer.js +1 -1
- package/dist/esm/salla-offer.entry.js +1 -1
- package/dist/twilight-components/{p-152b7287.entry.js → p-59c23e12.entry.js} +1 -1
- package/dist/twilight-components/twilight-components.esm.js +1 -1
- package/package.json +1 -1
|
@@ -79,7 +79,7 @@ const SallaOffer = class {
|
|
|
79
79
|
.replace(/\{image\}/g, product.thumbnail)
|
|
80
80
|
.replace(/\{price\}/g, product.has_special_price
|
|
81
81
|
? salla.money(product.price) + '<span class="s-offer-product-old-price">' + salla.money(product.regular_price) + '</span>'
|
|
82
|
-
: salla.money(
|
|
82
|
+
: salla.money(product.price)) }, index.h("div", { class: "s-offer-btn-wrap" }, index.h("salla-button", { wide: true, "btn-style": 'outline-primary', "data-id": product.id, "loader-position": "center", onClick: this.addItem }, salla.lang.get('pages.cart.add_to_cart')))))), index.h("div", { class: "s-offer-slider-nav" }, index.h("button", { class: "s-offer-nav-btn s-offer-prev-btn" }, index.h("span", { class: "s-offer-nav-btn-icon sicon-keyboard_arrow_right" })), index.h("button", { class: "s-offer-nav-btn s-offer-next-btn" }, index.h("span", { class: "s-offer-nav-btn-icon sicon-keyboard_arrow_left" })))),
|
|
83
83
|
index.h("div", { class: "s-offer-footer", slot: "footer" }, this.offer.expiry_date ?
|
|
84
84
|
index.h("p", { class: "s-offer-expiry" }, this.offer_expires_in, " ", this.offer.expiry_date)
|
|
85
85
|
: '', index.h("label", { class: "s-offer-remember-label" }, index.h("input", { type: "checkbox", onChange: e => this.rememberMe(e), class: "s-offer-remember-input" }), "\u00A0 ", this.remember_my_choice)),
|
|
@@ -77,7 +77,7 @@ export class SallaOffer {
|
|
|
77
77
|
.replace(/\{image\}/g, product.thumbnail)
|
|
78
78
|
.replace(/\{price\}/g, product.has_special_price
|
|
79
79
|
? salla.money(product.price) + '<span class="s-offer-product-old-price">' + salla.money(product.regular_price) + '</span>'
|
|
80
|
-
: salla.money(
|
|
80
|
+
: salla.money(product.price)) },
|
|
81
81
|
h("div", { class: "s-offer-btn-wrap" },
|
|
82
82
|
h("salla-button", { wide: true, "btn-style": 'outline-primary', "data-id": product.id, "loader-position": "center", onClick: this.addItem }, salla.lang.get('pages.cart.add_to_cart')))))),
|
|
83
83
|
h("div", { class: "s-offer-slider-nav" },
|
|
@@ -75,7 +75,7 @@ const SallaOffer = class {
|
|
|
75
75
|
.replace(/\{image\}/g, product.thumbnail)
|
|
76
76
|
.replace(/\{price\}/g, product.has_special_price
|
|
77
77
|
? salla.money(product.price) + '<span class="s-offer-product-old-price">' + salla.money(product.regular_price) + '</span>'
|
|
78
|
-
: salla.money(
|
|
78
|
+
: salla.money(product.price)) }, h("div", { class: "s-offer-btn-wrap" }, h("salla-button", { wide: true, "btn-style": 'outline-primary', "data-id": product.id, "loader-position": "center", onClick: this.addItem }, salla.lang.get('pages.cart.add_to_cart')))))), h("div", { class: "s-offer-slider-nav" }, h("button", { class: "s-offer-nav-btn s-offer-prev-btn" }, h("span", { class: "s-offer-nav-btn-icon sicon-keyboard_arrow_right" })), h("button", { class: "s-offer-nav-btn s-offer-next-btn" }, h("span", { class: "s-offer-nav-btn-icon sicon-keyboard_arrow_left" })))),
|
|
79
79
|
h("div", { class: "s-offer-footer", slot: "footer" }, this.offer.expiry_date ?
|
|
80
80
|
h("p", { class: "s-offer-expiry" }, this.offer_expires_in, " ", this.offer.expiry_date)
|
|
81
81
|
: '', h("label", { class: "s-offer-remember-label" }, h("input", { type: "checkbox", onChange: e => this.rememberMe(e), class: "s-offer-remember-input" }), "\u00A0 ", this.remember_my_choice)),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as s,h as e,g as r}from"./p-cb1c59a2.js";import{H as a}from"./p-ed1c00c5.js";const o=class{constructor(e){var r,o;s(this,e),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"),a.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===(r=a.getElement('[slot="category"]'))||void 0===r?void 0:r.innerHTML)||'<i class="s-offer-badge-icon sicon-tag"></i><span class="s-offer-badge-text">{name}</span>',this.productSlot=(null===(o=a.getElement('[slot="product"]'))||void 0===o?void 0:o.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-product-image-wrap"><img class="s-offer-product-image" src="{image}" /></a><div class="s-offer-product-info"> <a href={url} class="s-offer-product-name">{name}</a> <div class="s-offer-product-price">{price}</div></div>'}render(){var s,r;return e("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?[e("div",{class:"s-offer-scrolled-slider-wrap"},e("div",{class:"s-offer-body s-offer-scrolled-slider"},(null===(s=this.offer.get.categories)||void 0===s?void 0:s.length)>0?this.offer.get.categories.map((s=>e("a",{href:s.urls.customer,class:"s-offer-badge s-offer-slider-item",innerHTML:this.categorySlot.replace(/\{name\}/g,s.name).replace(/\{url\}/g,s.urls.customer)}))):null===(r=this.offer.get.products)||void 0===r?void 0:r.map((s=>e("div",{class:"s-offer-product s-offer-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-product-old-price">'+salla.money(s.regular_price)+"</span>":salla.money(
|
|
1
|
+
import{r as s,h as e,g as r}from"./p-cb1c59a2.js";import{H as a}from"./p-ed1c00c5.js";const o=class{constructor(e){var r,o;s(this,e),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"),a.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===(r=a.getElement('[slot="category"]'))||void 0===r?void 0:r.innerHTML)||'<i class="s-offer-badge-icon sicon-tag"></i><span class="s-offer-badge-text">{name}</span>',this.productSlot=(null===(o=a.getElement('[slot="product"]'))||void 0===o?void 0:o.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-product-image-wrap"><img class="s-offer-product-image" src="{image}" /></a><div class="s-offer-product-info"> <a href={url} class="s-offer-product-name">{name}</a> <div class="s-offer-product-price">{price}</div></div>'}render(){var s,r;return e("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?[e("div",{class:"s-offer-scrolled-slider-wrap"},e("div",{class:"s-offer-body s-offer-scrolled-slider"},(null===(s=this.offer.get.categories)||void 0===s?void 0:s.length)>0?this.offer.get.categories.map((s=>e("a",{href:s.urls.customer,class:"s-offer-badge s-offer-slider-item",innerHTML:this.categorySlot.replace(/\{name\}/g,s.name).replace(/\{url\}/g,s.urls.customer)}))):null===(r=this.offer.get.products)||void 0===r?void 0:r.map((s=>e("div",{class:"s-offer-product s-offer-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-product-old-price">'+salla.money(s.regular_price)+"</span>":salla.money(s.price))},e("div",{class:"s-offer-btn-wrap"},e("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"))))))),e("div",{class:"s-offer-slider-nav"},e("button",{class:"s-offer-nav-btn s-offer-prev-btn"},e("span",{class:"s-offer-nav-btn-icon sicon-keyboard_arrow_right"})),e("button",{class:"s-offer-nav-btn s-offer-next-btn"},e("span",{class:"s-offer-nav-btn-icon sicon-keyboard_arrow_left"})))),e("div",{class:"s-offer-footer",slot:"footer"},this.offer.expiry_date?e("p",{class:"s-offer-expiry"},this.offer_expires_in," ",this.offer.expiry_date):"",e("label",{class:"s-offer-remember-label"},e("input",{type:"checkbox",onChange:s=>this.rememberMe(s),class:"s-offer-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-scrolled-slider-wrap"),e=this.host.querySelector(".s-offer-scrolled-slider"),r=this.host.querySelectorAll(".s-offer-nav-btn"),a=this.host.querySelector(".s-offer-next-btn"),o=this.host.querySelector(".s-offer-prev-btn"),t=this.host.querySelectorAll(".s-offer-slider-item"),i=20,l=0,f=3,n=t[0].offsetWidth,c=t.length*n,d=s.offsetWidth,h=c-d,b=!!document.body.classList.contains("rtl");h>i&&a.classList.add("s-offer-btn-is-active"),window.onresize=function(){d=s.offsetWidth,h=c-d},e.addEventListener("scroll",(function(){let s=Math.abs(e.scrollLeft),r=h-i;s<=i?(a.classList.add("s-offer-btn-is-active"),o.classList.remove("s-offer-btn-is-active")):s<r?(a.classList.add("s-offer-btn-is-active"),o.classList.add("s-offer-btn-is-active")):s>=r&&(a.classList.remove("s-offer-btn-is-active"),o.classList.add("s-offer-btn-is-active"))})),r.forEach((s=>{s.addEventListener("click",(function(){s.classList.contains("s-offer-next-btn")?l++:l--,e.scrollTo({top:0,left:n*f*l*(b?-1:1),behavior:"smooth"})}))}))}}get host(){return r(this)}};o.style="#salla-offer-modal .s-offer-body{-webkit-overflow-scrolling:touch}#salla-offer-modal .s-offer-body::-webkit-scrollbar{display:none}#salla-offer-modal .s-offer-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-prev-btn{background:linear-gradient(-90deg, #fff 25%, rgba(255, 255, 255, 0.4) 80%, rgba(255, 255, 255, 0) 100%)}";export{o as salla_offer}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{p as e,b as l}from"./p-cb1c59a2.js";(()=>{const l=import.meta.url,o={};return""!==l&&(o.resourcesUrl=new URL(".",l).href),e(o)})().then((e=>l([["p-4b774cf9",[[4,"salla-login",{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],show:[64]},[[0,"verified","onVerified"]]],[0,"salla-localization",{language:[1537],currency:[1537],languages:[32],currencies:[32],languagesTitle:[32],currenciesTitle:[32],isLoading:[32],show:[64],hide:[64],submit:[64]}],[0,"salla-search",{results:[32],placeholder:[32],noResultsText:[32]},[[0,"modalOpened","onModalOpen"],[0,"modalClosed","onModalClose"]]],[4,"salla-verify-modal",{withoutModal:[4,"without-modal"],url:[513],by:[1],autoReload:[4,"auto-reload"],title:[32],getCode:[64],show:[64]}],[0,"salla-tel-input",{mobile:[1025],countryCode:[1025,"country-code"],countryKey:[1025,"country-key"],mobileRequired:[32],countryCodeLabel:[32],mobileLabel:[32],tooShort:[32],tooLong:[32],invalidCountryCode:[32],invalidNumber:[32],errorMap:[32],getValues:[64],isValid:[64]}],[4,"salla-button",{btnStyle:[513,"btn-style"],loading:[516],disabled:[516],loaderPosition:[1,"loader-position"],wide:[4],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"],title:[32],show:[64],hide:[64],setTitle:[64],loading:[64],stopLoading:[64]}]]],["p-c0a7b5a2",[[4,"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]}]]],["p-e6c67b55",[[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-
|
|
1
|
+
import{p as e,b as l}from"./p-cb1c59a2.js";(()=>{const l=import.meta.url,o={};return""!==l&&(o.resourcesUrl=new URL(".",l).href),e(o)})().then((e=>l([["p-4b774cf9",[[4,"salla-login",{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],show:[64]},[[0,"verified","onVerified"]]],[0,"salla-localization",{language:[1537],currency:[1537],languages:[32],currencies:[32],languagesTitle:[32],currenciesTitle:[32],isLoading:[32],show:[64],hide:[64],submit:[64]}],[0,"salla-search",{results:[32],placeholder:[32],noResultsText:[32]},[[0,"modalOpened","onModalOpen"],[0,"modalClosed","onModalClose"]]],[4,"salla-verify-modal",{withoutModal:[4,"without-modal"],url:[513],by:[1],autoReload:[4,"auto-reload"],title:[32],getCode:[64],show:[64]}],[0,"salla-tel-input",{mobile:[1025],countryCode:[1025,"country-code"],countryKey:[1025,"country-key"],mobileRequired:[32],countryCodeLabel:[32],mobileLabel:[32],tooShort:[32],tooLong:[32],invalidCountryCode:[32],invalidNumber:[32],errorMap:[32],getValues:[64],isValid:[64]}],[4,"salla-button",{btnStyle:[513,"btn-style"],loading:[516],disabled:[516],loaderPosition:[1,"loader-position"],wide:[4],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"],title:[32],show:[64],hide:[64],setTitle:[64],loading:[64],stopLoading:[64]}]]],["p-c0a7b5a2",[[4,"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]}]]],["p-e6c67b55",[[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-59c23e12",[[0,"salla-offer",{offer:[32],offer_name:[32],offer_message:[32],offer_expires_in:[32],remember_my_choice:[32],show:[64],showOffer:[64]}]]],["p-b584e892",[[0,"salla-rating",{orderId:[2,"order-id"],order:[32],show:[64],hide:[64]}]]],["p-f89bc866",[[4,"salla-infinite-scroll",{nextPage:[1,"next-page"],nextPageAutoload:[1028,"next-page-autoload"],container:[1],item:[1],loadMore:[32],noMore:[32],failedToLoad:[32]}]]]],e)));
|