@salla.sa/twilight-components 1.0.97 → 1.0.98
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-modal.cjs.entry.js +7 -4
- package/dist/collection/components/salla-offer-modal/salla-offer-modal.js +7 -4
- package/dist/components/salla-offer-modal.js +7 -4
- package/dist/esm/salla-offer-modal.entry.js +7 -4
- package/dist/twilight-components/p-e435a209.entry.js +4 -0
- package/dist/twilight-components/twilight-components.esm.js +1 -1
- package/package.json +1 -1
- package/dist/twilight-components/p-c0709d5f.entry.js +0 -4
|
@@ -28,7 +28,7 @@ const SallaOfferModal = class {
|
|
|
28
28
|
});
|
|
29
29
|
this.categorySlot = ((_a = Helper.Helper.getElement('[slot="category"]')) === null || _a === void 0 ? void 0 : _a.innerHTML) || '<i class="s-offer-modal-badge-icon sicon-tag"></i><span class="s-offer-modal-badge-text">{name}</span>';
|
|
30
30
|
this.productSlot = ((_b = Helper.Helper.getElement('[slot="product"]')) === null || _b === void 0 ? void 0 : _b.innerHTML) || this.defaultProductSlot();
|
|
31
|
-
salla.
|
|
31
|
+
salla.product.event.onOfferExisted(offer => {
|
|
32
32
|
if (salla.storage.get('remember-offer-' + offer.id)) {
|
|
33
33
|
salla.log('User selected to don\'t show this offer again.');
|
|
34
34
|
return;
|
|
@@ -42,7 +42,7 @@ const SallaOfferModal = class {
|
|
|
42
42
|
*/
|
|
43
43
|
async open(product_id) {
|
|
44
44
|
//TODO:: make sure there is only one offer
|
|
45
|
-
return salla.
|
|
45
|
+
return salla.product.offers(product_id)
|
|
46
46
|
.then(response => this.showOffer(response.data[0]));
|
|
47
47
|
}
|
|
48
48
|
/**
|
|
@@ -59,6 +59,7 @@ const SallaOfferModal = class {
|
|
|
59
59
|
rememberMe(event) {
|
|
60
60
|
salla.storage.set('remember-offer-' + this.offer.id, event.target.checked);
|
|
61
61
|
}
|
|
62
|
+
//todo:: pass event then use sallaButton from it
|
|
62
63
|
addItem() {
|
|
63
64
|
// this here, is sallaButton
|
|
64
65
|
this['load']();
|
|
@@ -94,9 +95,11 @@ const SallaOfferModal = class {
|
|
|
94
95
|
componentDidRender() {
|
|
95
96
|
// Sooo mini Slider
|
|
96
97
|
if (this.offer && window.screen.width > 639) {
|
|
97
|
-
let sliderWrap =
|
|
98
|
+
let sliderWrap = document.querySelector('.s-offer-modal-scrolled-slider-wrap'), slider = document.querySelector('.s-offer-modal-scrolled-slider'), navButtons = document.querySelectorAll('.s-offer-modal-nav-btn'), nexBtn = document.querySelector('.s-offer-modal-next-btn'), prevBtn = document.querySelector('.s-offer-modal-prev-btn'), items = document.querySelectorAll('.s-offer-modal-slider-item'), sliderNavMargin = 20, // space before displaying the next/prev btns.
|
|
98
99
|
current = 0, // current slide
|
|
99
|
-
slidesToScroll = 3, itemsLength = items.length
|
|
100
|
+
slidesToScroll = 3, itemsLength = items.length;
|
|
101
|
+
console.log('items[0]:', items[0]);
|
|
102
|
+
let itemSize = items[0].offsetWidth, sliderSize = itemsLength * itemSize, sliderWrapperSize = sliderWrap.offsetWidth, sliderInvisibleSize = sliderSize - sliderWrapperSize, isRTL = document.body.classList.contains('rtl') ? true : false;
|
|
100
103
|
if (sliderInvisibleSize > sliderNavMargin)
|
|
101
104
|
nexBtn.classList.add('s-offer-modal-btn-is-active');
|
|
102
105
|
window.onresize = function () {
|
|
@@ -25,7 +25,7 @@ export class SallaOfferModal {
|
|
|
25
25
|
});
|
|
26
26
|
this.categorySlot = ((_a = Helper.getElement('[slot="category"]')) === null || _a === void 0 ? void 0 : _a.innerHTML) || '<i class="s-offer-modal-badge-icon sicon-tag"></i><span class="s-offer-modal-badge-text">{name}</span>';
|
|
27
27
|
this.productSlot = ((_b = Helper.getElement('[slot="product"]')) === null || _b === void 0 ? void 0 : _b.innerHTML) || this.defaultProductSlot();
|
|
28
|
-
salla.
|
|
28
|
+
salla.product.event.onOfferExisted(offer => {
|
|
29
29
|
if (salla.storage.get('remember-offer-' + offer.id)) {
|
|
30
30
|
salla.log('User selected to don\'t show this offer again.');
|
|
31
31
|
return;
|
|
@@ -39,7 +39,7 @@ export class SallaOfferModal {
|
|
|
39
39
|
*/
|
|
40
40
|
async open(product_id) {
|
|
41
41
|
//TODO:: make sure there is only one offer
|
|
42
|
-
return salla.
|
|
42
|
+
return salla.product.offers(product_id)
|
|
43
43
|
.then(response => this.showOffer(response.data[0]));
|
|
44
44
|
}
|
|
45
45
|
/**
|
|
@@ -56,6 +56,7 @@ export class SallaOfferModal {
|
|
|
56
56
|
rememberMe(event) {
|
|
57
57
|
salla.storage.set('remember-offer-' + this.offer.id, event.target.checked);
|
|
58
58
|
}
|
|
59
|
+
//todo:: pass event then use sallaButton from it
|
|
59
60
|
addItem() {
|
|
60
61
|
// this here, is sallaButton
|
|
61
62
|
this['load']();
|
|
@@ -107,9 +108,11 @@ export class SallaOfferModal {
|
|
|
107
108
|
componentDidRender() {
|
|
108
109
|
// Sooo mini Slider
|
|
109
110
|
if (this.offer && window.screen.width > 639) {
|
|
110
|
-
let sliderWrap =
|
|
111
|
+
let sliderWrap = document.querySelector('.s-offer-modal-scrolled-slider-wrap'), slider = document.querySelector('.s-offer-modal-scrolled-slider'), navButtons = document.querySelectorAll('.s-offer-modal-nav-btn'), nexBtn = document.querySelector('.s-offer-modal-next-btn'), prevBtn = document.querySelector('.s-offer-modal-prev-btn'), items = document.querySelectorAll('.s-offer-modal-slider-item'), sliderNavMargin = 20, // space before displaying the next/prev btns.
|
|
111
112
|
current = 0, // current slide
|
|
112
|
-
slidesToScroll = 3, itemsLength = items.length
|
|
113
|
+
slidesToScroll = 3, itemsLength = items.length;
|
|
114
|
+
console.log('items[0]:', items[0]);
|
|
115
|
+
let itemSize = items[0].offsetWidth, sliderSize = itemsLength * itemSize, sliderWrapperSize = sliderWrap.offsetWidth, sliderInvisibleSize = sliderSize - sliderWrapperSize, isRTL = document.body.classList.contains('rtl') ? true : false;
|
|
113
116
|
if (sliderInvisibleSize > sliderNavMargin)
|
|
114
117
|
nexBtn.classList.add('s-offer-modal-btn-is-active');
|
|
115
118
|
window.onresize = function () {
|
|
@@ -27,7 +27,7 @@ const SallaOfferModal$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEle
|
|
|
27
27
|
});
|
|
28
28
|
this.categorySlot = ((_a = Helper.getElement('[slot="category"]')) === null || _a === void 0 ? void 0 : _a.innerHTML) || '<i class="s-offer-modal-badge-icon sicon-tag"></i><span class="s-offer-modal-badge-text">{name}</span>';
|
|
29
29
|
this.productSlot = ((_b = Helper.getElement('[slot="product"]')) === null || _b === void 0 ? void 0 : _b.innerHTML) || this.defaultProductSlot();
|
|
30
|
-
salla.
|
|
30
|
+
salla.product.event.onOfferExisted(offer => {
|
|
31
31
|
if (salla.storage.get('remember-offer-' + offer.id)) {
|
|
32
32
|
salla.log('User selected to don\'t show this offer again.');
|
|
33
33
|
return;
|
|
@@ -41,7 +41,7 @@ const SallaOfferModal$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEle
|
|
|
41
41
|
*/
|
|
42
42
|
async open(product_id) {
|
|
43
43
|
//TODO:: make sure there is only one offer
|
|
44
|
-
return salla.
|
|
44
|
+
return salla.product.offers(product_id)
|
|
45
45
|
.then(response => this.showOffer(response.data[0]));
|
|
46
46
|
}
|
|
47
47
|
/**
|
|
@@ -58,6 +58,7 @@ const SallaOfferModal$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEle
|
|
|
58
58
|
rememberMe(event) {
|
|
59
59
|
salla.storage.set('remember-offer-' + this.offer.id, event.target.checked);
|
|
60
60
|
}
|
|
61
|
+
//todo:: pass event then use sallaButton from it
|
|
61
62
|
addItem() {
|
|
62
63
|
// this here, is sallaButton
|
|
63
64
|
this['load']();
|
|
@@ -93,9 +94,11 @@ const SallaOfferModal$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEle
|
|
|
93
94
|
componentDidRender() {
|
|
94
95
|
// Sooo mini Slider
|
|
95
96
|
if (this.offer && window.screen.width > 639) {
|
|
96
|
-
let sliderWrap =
|
|
97
|
+
let sliderWrap = document.querySelector('.s-offer-modal-scrolled-slider-wrap'), slider = document.querySelector('.s-offer-modal-scrolled-slider'), navButtons = document.querySelectorAll('.s-offer-modal-nav-btn'), nexBtn = document.querySelector('.s-offer-modal-next-btn'), prevBtn = document.querySelector('.s-offer-modal-prev-btn'), items = document.querySelectorAll('.s-offer-modal-slider-item'), sliderNavMargin = 20, // space before displaying the next/prev btns.
|
|
97
98
|
current = 0, // current slide
|
|
98
|
-
slidesToScroll = 3, itemsLength = items.length
|
|
99
|
+
slidesToScroll = 3, itemsLength = items.length;
|
|
100
|
+
console.log('items[0]:', items[0]);
|
|
101
|
+
let itemSize = items[0].offsetWidth, sliderSize = itemsLength * itemSize, sliderWrapperSize = sliderWrap.offsetWidth, sliderInvisibleSize = sliderSize - sliderWrapperSize, isRTL = document.body.classList.contains('rtl') ? true : false;
|
|
99
102
|
if (sliderInvisibleSize > sliderNavMargin)
|
|
100
103
|
nexBtn.classList.add('s-offer-modal-btn-is-active');
|
|
101
104
|
window.onresize = function () {
|
|
@@ -24,7 +24,7 @@ const SallaOfferModal = class {
|
|
|
24
24
|
});
|
|
25
25
|
this.categorySlot = ((_a = Helper.getElement('[slot="category"]')) === null || _a === void 0 ? void 0 : _a.innerHTML) || '<i class="s-offer-modal-badge-icon sicon-tag"></i><span class="s-offer-modal-badge-text">{name}</span>';
|
|
26
26
|
this.productSlot = ((_b = Helper.getElement('[slot="product"]')) === null || _b === void 0 ? void 0 : _b.innerHTML) || this.defaultProductSlot();
|
|
27
|
-
salla.
|
|
27
|
+
salla.product.event.onOfferExisted(offer => {
|
|
28
28
|
if (salla.storage.get('remember-offer-' + offer.id)) {
|
|
29
29
|
salla.log('User selected to don\'t show this offer again.');
|
|
30
30
|
return;
|
|
@@ -38,7 +38,7 @@ const SallaOfferModal = class {
|
|
|
38
38
|
*/
|
|
39
39
|
async open(product_id) {
|
|
40
40
|
//TODO:: make sure there is only one offer
|
|
41
|
-
return salla.
|
|
41
|
+
return salla.product.offers(product_id)
|
|
42
42
|
.then(response => this.showOffer(response.data[0]));
|
|
43
43
|
}
|
|
44
44
|
/**
|
|
@@ -55,6 +55,7 @@ const SallaOfferModal = class {
|
|
|
55
55
|
rememberMe(event) {
|
|
56
56
|
salla.storage.set('remember-offer-' + this.offer.id, event.target.checked);
|
|
57
57
|
}
|
|
58
|
+
//todo:: pass event then use sallaButton from it
|
|
58
59
|
addItem() {
|
|
59
60
|
// this here, is sallaButton
|
|
60
61
|
this['load']();
|
|
@@ -90,9 +91,11 @@ const SallaOfferModal = class {
|
|
|
90
91
|
componentDidRender() {
|
|
91
92
|
// Sooo mini Slider
|
|
92
93
|
if (this.offer && window.screen.width > 639) {
|
|
93
|
-
let sliderWrap =
|
|
94
|
+
let sliderWrap = document.querySelector('.s-offer-modal-scrolled-slider-wrap'), slider = document.querySelector('.s-offer-modal-scrolled-slider'), navButtons = document.querySelectorAll('.s-offer-modal-nav-btn'), nexBtn = document.querySelector('.s-offer-modal-next-btn'), prevBtn = document.querySelector('.s-offer-modal-prev-btn'), items = document.querySelectorAll('.s-offer-modal-slider-item'), sliderNavMargin = 20, // space before displaying the next/prev btns.
|
|
94
95
|
current = 0, // current slide
|
|
95
|
-
slidesToScroll = 3, itemsLength = items.length
|
|
96
|
+
slidesToScroll = 3, itemsLength = items.length;
|
|
97
|
+
console.log('items[0]:', items[0]);
|
|
98
|
+
let itemSize = items[0].offsetWidth, sliderSize = itemsLength * itemSize, sliderWrapperSize = sliderWrap.offsetWidth, sliderInvisibleSize = sliderSize - sliderWrapperSize, isRTL = document.body.classList.contains('rtl') ? true : false;
|
|
96
99
|
if (sliderInvisibleSize > sliderNavMargin)
|
|
97
100
|
nexBtn.classList.add('s-offer-modal-btn-is-active');
|
|
98
101
|
window.onresize = function () {
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Crafted with ❤ by Salla
|
|
3
|
+
*/
|
|
4
|
+
import{r as s,h as a,g as o}from"./p-1d0e664c.js";import{H as e}from"./p-9d2ca9c8.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"),this.add_to_cart=salla.lang.get("pages.cart.add_to_cart"),this.out_of_stock=salla.lang.get("pages.products.out_of_stock"),e.setHost(this.host),salla.lang.onLoaded((()=>{this.offer_expires_in=salla.lang.get("pages.products.offer_expires_in"),this.remember_my_choice=salla.lang.get("common.elements.remember_my_choice"),this.add_to_cart=salla.lang.get("pages.cart.add_to_cart"),this.out_of_stock=salla.lang.get("pages.products.out_of_stock")})),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.product.event.onOfferExisted((s=>{salla.storage.get("remember-offer-"+s.id)?salla.log("User selected to don't show this offer again."):this.open(s.product_id)}))}async open(s){return salla.product.offers(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.setTitle(this.offer_name),this.modal.open()}rememberMe(s){salla.storage.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","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":!0,"s-offer-modal-slider-item":!0,"s-offer-modal-not-available":!s.is_available},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",{width:"wide",fill:"outline","data-id":s.id,disabled:!s.is_available,"loader-position":"center",onClick:this.addItem},s.is_available?this.add_to_cart:this.out_of_stock)))))),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_left"})),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_right"})))),a("div",{class:"s-offer-modal-footer",slot:"footer"},this.offer.formatted_date?a("p",{class:"s-offer-modal-expiry"},this.offer_expires_in," ",this.offer.formatted_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.offer&&window.screen.width>639){let s=document.querySelector(".s-offer-modal-scrolled-slider-wrap"),a=document.querySelector(".s-offer-modal-scrolled-slider"),o=document.querySelectorAll(".s-offer-modal-nav-btn"),e=document.querySelector(".s-offer-modal-next-btn"),l=document.querySelector(".s-offer-modal-prev-btn"),r=document.querySelectorAll(".s-offer-modal-slider-item"),t=20,i=0,f=3,d=r.length;console.log("items[0]:",r[0]);let n=r[0].offsetWidth,c=d*n,m=s.offsetWidth,h=c-m,b=!!document.body.classList.contains("rtl");h>t&&e.classList.add("s-offer-modal-btn-is-active"),window.onresize=function(){m=s.offsetWidth,h=c-m},a.addEventListener("scroll",(function(){let s=Math.abs(a.scrollLeft),o=h-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:n*f*i*(b?-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%)}.rtl #salla-offer-modal .s-offer-modal-next-btn{transform:scale(-1) translateX(100%)}.rtl #salla-offer-modal .s-offer-modal-prev-btn{transform:scale(-1) translateX(-100%)}.rtl #salla-offer-modal .s-offer-modal-btn-is-active{transform:scale(-1) translateX(0)}";export{l as salla_offer_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-1d0e664c.js";(()=>{const a=import.meta.url,l={};return""!==a&&(l.resourcesUrl=new URL(".",a).href),e(l)})().then((e=>a([["p-6a736d5c",[[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,"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-2b1c3490",[[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]},[[8,"verified","onVerified"]]]]],["p-2384537d",[[0,"salla-rating-modal",{orderId:[2,"order-id"],order:[32],open:[64],close:[64]}]]],["p-210f5278",[[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-7fae6b84",[[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-
|
|
4
|
+
import{p as e,b as a}from"./p-1d0e664c.js";(()=>{const a=import.meta.url,l={};return""!==a&&(l.resourcesUrl=new URL(".",a).href),e(l)})().then((e=>a([["p-6a736d5c",[[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,"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-2b1c3490",[[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]},[[8,"verified","onVerified"]]]]],["p-2384537d",[[0,"salla-rating-modal",{orderId:[2,"order-id"],order:[32],open:[64],close:[64]}]]],["p-210f5278",[[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-7fae6b84",[[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-e435a209",[[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-d77dd260",[[4,"salla-conditional-fields",null,[[0,"change","changeHandler"]]]]],["p-56065da6",[[4,"salla-infinite-scroll",{nextPage:[1,"next-page"],autoload:[1028],container:[1],item:[1],loadMore:[32],noMore:[32],failedToLoad:[32]}]]],["p-8c69a096",[[0,"salla-installment",{price:[1],language:[1],currency:[1],tamaraIsActive:[32],tabbyIsActive:[32],spotiiIsActive:[32]}]]],["p-edbb12b2",[[4,"salla-quantity-input",{quantity:[32],decrease:[64],increase:[64],setValue:[64]}]]],["p-d762e16f",[[1,"salla-sizes-table"]]],["p-9e05640e",[[4,"salla-verify-modal",{withoutModal:[4,"without-modal"],type:[1025],autoReload:[4,"auto-reload"],title:[32],resendAfter:[32],isProfileVerify:[32],getCode:[64],open:[64]}]]],["p-ecaee6a4",[[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,h as a,g as o}from"./p-1d0e664c.js";import{H as l}from"./p-9d2ca9c8.js";const e=class{constructor(a){var o,e;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"),this.add_to_cart=salla.lang.get("pages.cart.add_to_cart"),this.out_of_stock=salla.lang.get("pages.products.out_of_stock"),l.setHost(this.host),salla.lang.onLoaded((()=>{this.offer_expires_in=salla.lang.get("pages.products.offer_expires_in"),this.remember_my_choice=salla.lang.get("common.elements.remember_my_choice"),this.add_to_cart=salla.lang.get("pages.cart.add_to_cart"),this.out_of_stock=salla.lang.get("pages.products.out_of_stock")})),this.categorySlot=(null===(o=l.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===(e=l.getElement('[slot="product"]'))||void 0===e?void 0:e.innerHTML)||this.defaultProductSlot(),salla.offer.event.onExisted((s=>{salla.storage.get("remember-offer-"+s.id)?salla.log("User selected to don't show this offer again."):this.open(s.product_id)}))}async open(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.setTitle(this.offer_name),this.modal.open()}rememberMe(s){salla.storage.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","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":!0,"s-offer-modal-slider-item":!0,"s-offer-modal-not-available":!s.is_available},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",{width:"wide",fill:"outline","data-id":s.id,disabled:!s.is_available,"loader-position":"center",onClick:this.addItem},s.is_available?this.add_to_cart:this.out_of_stock)))))),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_left"})),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_right"})))),a("div",{class:"s-offer-modal-footer",slot:"footer"},this.offer.formatted_date?a("p",{class:"s-offer-modal-expiry"},this.offer_expires_in," ",this.offer.formatted_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.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"),l=this.host.querySelector(".s-offer-modal-next-btn"),e=this.host.querySelector(".s-offer-modal-prev-btn"),r=this.host.querySelectorAll(".s-offer-modal-slider-item"),t=20,i=0,f=3,d=r[0].offsetWidth,n=r.length*d,c=s.offsetWidth,m=n-c,h=!!document.body.classList.contains("rtl");m>t&&l.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?(l.classList.add("s-offer-modal-btn-is-active"),e.classList.remove("s-offer-modal-btn-is-active")):s<o?(l.classList.add("s-offer-modal-btn-is-active"),e.classList.add("s-offer-modal-btn-is-active")):s>=o&&(l.classList.remove("s-offer-modal-btn-is-active"),e.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:d*f*i*(h?-1:1),behavior:"smooth"})}))}))}}get host(){return o(this)}};e.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%)}.rtl #salla-offer-modal .s-offer-modal-next-btn{transform:scale(-1) translateX(100%)}.rtl #salla-offer-modal .s-offer-modal-prev-btn{transform:scale(-1) translateX(-100%)}.rtl #salla-offer-modal .s-offer-modal-btn-is-active{transform:scale(-1) translateX(0)}";export{e as salla_offer_modal}
|