@salla.sa/twilight-components 1.0.96 → 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.
@@ -22,7 +22,6 @@ const SallaInstallment = class {
22
22
  this.currency = salla.config.get('user.currency_code');
23
23
  salla.onReady(() => {
24
24
  const installment = salla.config.get('store.settings.installments');
25
- console.log("🚀 ~ file: salla-installment.tsx ~ line 12 ~ SallaInstallment ~ salla.onReady ~ installment", installment);
26
25
  this.tamaraIsActive = installment.indexOf('tamara_installment') != -1;
27
26
  this.tabbyIsActive = installment.indexOf('tabby_installment') != -1;
28
27
  this.spotiiIsActive = installment.indexOf('spotii_pay') != -1;
@@ -77,7 +76,6 @@ const SallaInstallment = class {
77
76
  };
78
77
  var script = document.createElement('script');
79
78
  // script.setAttribute('src', 'https://store.test/themes/default/assets/js/price-widget-ar-salla.js');
80
- console.log("🚀 ~ file: salla-installment.tsx ~ line 106 ~ SallaInstallment ~ componentDidLoad ~ ;", salla.url.cdn('js/price-widget-ar-salla.js'));
81
79
  script.setAttribute('src', salla.url.cdn('js/price-widget-ar-salla.js'));
82
80
  document.head.appendChild(script);
83
81
  }
@@ -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.offer.event.onExisted(offer => {
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.api.offer.details(product_id)
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 = this.host.querySelector('.s-offer-modal-scrolled-slider-wrap'), slider = this.host.querySelector('.s-offer-modal-scrolled-slider'), navButtons = this.host.querySelectorAll('.s-offer-modal-nav-btn'), nexBtn = this.host.querySelector('.s-offer-modal-next-btn'), prevBtn = this.host.querySelector('.s-offer-modal-prev-btn'), items = this.host.querySelectorAll('.s-offer-modal-slider-item'), sliderNavMargin = 20, // space before displaying the next/prev btns.
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, itemSize = items[0].offsetWidth, sliderSize = itemsLength * itemSize, sliderWrapperSize = sliderWrap.offsetWidth, sliderInvisibleSize = sliderSize - sliderWrapperSize, isRTL = document.body.classList.contains('rtl') ? true : false;
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 () {
@@ -14,7 +14,6 @@ export class SallaInstallment {
14
14
  this.currency = salla.config.get('user.currency_code');
15
15
  salla.onReady(() => {
16
16
  const installment = salla.config.get('store.settings.installments');
17
- console.log("🚀 ~ file: salla-installment.tsx ~ line 12 ~ SallaInstallment ~ salla.onReady ~ installment", installment);
18
17
  this.tamaraIsActive = installment.indexOf('tamara_installment') != -1;
19
18
  this.tabbyIsActive = installment.indexOf('tabby_installment') != -1;
20
19
  this.spotiiIsActive = installment.indexOf('spotii_pay') != -1;
@@ -74,7 +73,6 @@ export class SallaInstallment {
74
73
  };
75
74
  var script = document.createElement('script');
76
75
  // script.setAttribute('src', 'https://store.test/themes/default/assets/js/price-widget-ar-salla.js');
77
- console.log("🚀 ~ file: salla-installment.tsx ~ line 106 ~ SallaInstallment ~ componentDidLoad ~ ;", salla.url.cdn('js/price-widget-ar-salla.js'));
78
76
  script.setAttribute('src', salla.url.cdn('js/price-widget-ar-salla.js'));
79
77
  document.head.appendChild(script);
80
78
  }
@@ -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.offer.event.onExisted(offer => {
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.api.offer.details(product_id)
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 = this.host.querySelector('.s-offer-modal-scrolled-slider-wrap'), slider = this.host.querySelector('.s-offer-modal-scrolled-slider'), navButtons = this.host.querySelectorAll('.s-offer-modal-nav-btn'), nexBtn = this.host.querySelector('.s-offer-modal-next-btn'), prevBtn = this.host.querySelector('.s-offer-modal-prev-btn'), items = this.host.querySelectorAll('.s-offer-modal-slider-item'), sliderNavMargin = 20, // space before displaying the next/prev btns.
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, itemSize = items[0].offsetWidth, sliderSize = itemsLength * itemSize, sliderWrapperSize = sliderWrap.offsetWidth, sliderInvisibleSize = sliderSize - sliderWrapperSize, isRTL = document.body.classList.contains('rtl') ? true : false;
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 () {
@@ -19,7 +19,6 @@ const SallaInstallment$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEl
19
19
  this.currency = salla.config.get('user.currency_code');
20
20
  salla.onReady(() => {
21
21
  const installment = salla.config.get('store.settings.installments');
22
- console.log("🚀 ~ file: salla-installment.tsx ~ line 12 ~ SallaInstallment ~ salla.onReady ~ installment", installment);
23
22
  this.tamaraIsActive = installment.indexOf('tamara_installment') != -1;
24
23
  this.tabbyIsActive = installment.indexOf('tabby_installment') != -1;
25
24
  this.spotiiIsActive = installment.indexOf('spotii_pay') != -1;
@@ -74,7 +73,6 @@ const SallaInstallment$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEl
74
73
  };
75
74
  var script = document.createElement('script');
76
75
  // script.setAttribute('src', 'https://store.test/themes/default/assets/js/price-widget-ar-salla.js');
77
- console.log("🚀 ~ file: salla-installment.tsx ~ line 106 ~ SallaInstallment ~ componentDidLoad ~ ;", salla.url.cdn('js/price-widget-ar-salla.js'));
78
76
  script.setAttribute('src', salla.url.cdn('js/price-widget-ar-salla.js'));
79
77
  document.head.appendChild(script);
80
78
  }
@@ -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.offer.event.onExisted(offer => {
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.api.offer.details(product_id)
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 = this.host.querySelector('.s-offer-modal-scrolled-slider-wrap'), slider = this.host.querySelector('.s-offer-modal-scrolled-slider'), navButtons = this.host.querySelectorAll('.s-offer-modal-nav-btn'), nexBtn = this.host.querySelector('.s-offer-modal-next-btn'), prevBtn = this.host.querySelector('.s-offer-modal-prev-btn'), items = this.host.querySelectorAll('.s-offer-modal-slider-item'), sliderNavMargin = 20, // space before displaying the next/prev btns.
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, itemSize = items[0].offsetWidth, sliderSize = itemsLength * itemSize, sliderWrapperSize = sliderWrap.offsetWidth, sliderInvisibleSize = sliderSize - sliderWrapperSize, isRTL = document.body.classList.contains('rtl') ? true : false;
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 () {
@@ -18,7 +18,6 @@ const SallaInstallment = class {
18
18
  this.currency = salla.config.get('user.currency_code');
19
19
  salla.onReady(() => {
20
20
  const installment = salla.config.get('store.settings.installments');
21
- console.log("🚀 ~ file: salla-installment.tsx ~ line 12 ~ SallaInstallment ~ salla.onReady ~ installment", installment);
22
21
  this.tamaraIsActive = installment.indexOf('tamara_installment') != -1;
23
22
  this.tabbyIsActive = installment.indexOf('tabby_installment') != -1;
24
23
  this.spotiiIsActive = installment.indexOf('spotii_pay') != -1;
@@ -73,7 +72,6 @@ const SallaInstallment = class {
73
72
  };
74
73
  var script = document.createElement('script');
75
74
  // script.setAttribute('src', 'https://store.test/themes/default/assets/js/price-widget-ar-salla.js');
76
- console.log("🚀 ~ file: salla-installment.tsx ~ line 106 ~ SallaInstallment ~ componentDidLoad ~ ;", salla.url.cdn('js/price-widget-ar-salla.js'));
77
75
  script.setAttribute('src', salla.url.cdn('js/price-widget-ar-salla.js'));
78
76
  document.head.appendChild(script);
79
77
  }
@@ -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.offer.event.onExisted(offer => {
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.api.offer.details(product_id)
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 = this.host.querySelector('.s-offer-modal-scrolled-slider-wrap'), slider = this.host.querySelector('.s-offer-modal-scrolled-slider'), navButtons = this.host.querySelectorAll('.s-offer-modal-nav-btn'), nexBtn = this.host.querySelector('.s-offer-modal-next-btn'), prevBtn = this.host.querySelector('.s-offer-modal-prev-btn'), items = this.host.querySelectorAll('.s-offer-modal-slider-item'), sliderNavMargin = 20, // space before displaying the next/prev btns.
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, itemSize = items[0].offsetWidth, sliderSize = itemsLength * itemSize, sliderWrapperSize = sliderWrap.offsetWidth, sliderInvisibleSize = sliderSize - sliderWrapperSize, isRTL = document.body.classList.contains('rtl') ? true : false;
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 t,h as o,H as a}from"./p-1d0e664c.js";const r=class{constructor(o){t(this,o),this.language=salla.config.get("user.language_code"),this.currency=salla.config.get("user.currency_code"),salla.onReady((()=>{const t=salla.config.get("store.settings.installments");this.tamaraIsActive=-1!=t.indexOf("tamara_installment"),this.tabbyIsActive=-1!=t.indexOf("tabby_installment"),this.spotiiIsActive=-1!=t.indexOf("spotii_pay")}))}render(){return o(a,null,this.tamaraIsActive?o("div",{class:"tamara-product-widget","data-price":this.price,"data-currency":this.currency,"data-lang":this.language,"data-payment-type":"installment"}):"",this.tabbyIsActive?o("div",{id:"tabbyPromoWrapper"},o("div",{id:"tabbyPromo"})):"",this.spotiiIsActive?o("div",{class:"spotii-wrapper"},o("div",{class:"spotii-promo"},this.price)):"")}componentDidLoad(){var t;this.tamaraIsActive&&((t=document.createElement("script")).setAttribute("src","https://cdn.tamara.co/widget/product-widget.min.js"),document.head.appendChild(t),t.onload=()=>{window.TamaraProductWidget.init({lang:this.language}),setTimeout((()=>{window.TamaraProductWidget.render()}),300)}),this.tabbyIsActive&&((t=document.createElement("script")).setAttribute("src","https://checkout.tabby.ai/tabby-promo.js"),document.head.appendChild(t),t.onload=()=>{new(0,window.TabbyPromo)({selector:"#tabbyPromo",currency:this.currency,price:this.price,lang:this.language}),document.querySelectorAll(".tabby-promo-snippet__logo").forEach((function(t){t.setAttribute("aria-label","Tabby Logo")}))}),this.spotiiIsActive&&(window.spotiiConfig={targetXPath:[".spotii-wrapper"],renderToPath:[".spotii-promo"],currency:this.currency},(t=document.createElement("script")).setAttribute("src",salla.url.cdn("js/price-widget-ar-salla.js")),document.head.appendChild(t))}};r.style="#tabbyPromoWrapper{background:white;border-radius:0.375rem;transition:box-shadow 0.5s cubic-bezier(0.4, 0, 0.2, 1);margin-bottom:20px}.salla-y #tabbyPromoWrapper{border:1px solid var(--color-grey-dark);border-radius:12px}#tabbyPromoWrapper:hover{box-shadow:0 0 #0000, 0 0 #0000, 5px 10px 30px #2B2D340D}#tabbyPromoWrapper #tabbyPromo *{font-family:var(--font-main)}#tabbyPromoWrapper #tabbyPromo>div>div{max-width:none;padding:15px;box-shadow:none;border:none}#tabbyPromoWrapper #tabbyPromo .tabby-promo-snippet{max-width:100%;min-height:100px;padding:18px 20px;border:none}#tabbyPromoWrapper #tabbyPromo .tabby-promo-snippet__text,#tabbyPromoWrapper #tabbyPromo .tabby-promo-snippet__link{font-size:var(--font-sm);color:var(--color-text) !important}#tabbyPromoWrapper #tabbyPromo .tabby-promo-snippet__link{font-weight:bold}.tabby-promo-wrapper #tabby-promo{font-family:var(--font-main) !important}.tabby-promo-wrapper #tabby-promo .tabby-promo__feature-title{font-size:var(--font-md)}.tabby-promo-wrapper #tabby-promo .tabby-promo__feature-desc{font-size:var(--font-sm);line-height:20px}.tamara-product-widget{margin-bottom:20px}.tamara-product-widget,.spotii-wrapper{min-height:100px;position:relative;color:var(--color-text);font-size:var(--font-sm);line-height:1.25;padding:18px 20px 18px 100px !important;background:white;border-radius:0.375rem;transition:box-shadow 0.5s cubic-bezier(0.4, 0, 0.2, 1)}.salla-y .tamara-product-widget,.salla-y .spotii-wrapper{border-radius:12px;border:1px solid var(--color-grey-dark)}.tamara-product-widget:hover,.spotii-wrapper:hover{box-shadow:0 0 #0000, 0 0 #0000, 5px 10px 30px #2B2D340D}.spotii-wrapper .spotii-promo{font-size:var(--font-md)}.spotii-wrapper .spotii-product-widget{font-size:var(--font-sm);margin-top:10px}.tamara-product-widget .tamara-logo{position:absolute;left:20px;top:18px;margin:0 !important}.ltr .tamara-product-widget .tamara-logo{right:20px;left:auto}.tamara-product-widget span{font-family:var(--font-main);font-size:var(--font-sm);color:var(--color-text)}.tamara-product-widget span:last-child{display:block;position:relative;margin-top:8px}.tamara-popup__wrap{overflow:auto !important}";export{r as salla_installment}
@@ -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-c0709d5f",[[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-04c4dadb",[[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)));
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,6 +1,6 @@
1
1
  {
2
2
  "name": "@salla.sa/twilight-components",
3
- "version": "1.0.96",
3
+ "version": "1.0.98",
4
4
  "license": "MIT",
5
5
  "author": "Salla Team <support@salla.dev> (https://salla.dev)",
6
6
  "bugs": {
@@ -1,4 +0,0 @@
1
- /*!
2
- * Crafted with ❤ by Salla
3
- */
4
- import{r as t,h as a,H as o}from"./p-1d0e664c.js";const r=class{constructor(a){t(this,a),this.language=salla.config.get("user.language_code"),this.currency=salla.config.get("user.currency_code"),salla.onReady((()=>{const t=salla.config.get("store.settings.installments");console.log("🚀 ~ file: salla-installment.tsx ~ line 12 ~ SallaInstallment ~ salla.onReady ~ installment",t),this.tamaraIsActive=-1!=t.indexOf("tamara_installment"),this.tabbyIsActive=-1!=t.indexOf("tabby_installment"),this.spotiiIsActive=-1!=t.indexOf("spotii_pay")}))}render(){return a(o,null,this.tamaraIsActive?a("div",{class:"tamara-product-widget","data-price":this.price,"data-currency":this.currency,"data-lang":this.language,"data-payment-type":"installment"}):"",this.tabbyIsActive?a("div",{id:"tabbyPromoWrapper"},a("div",{id:"tabbyPromo"})):"",this.spotiiIsActive?a("div",{class:"spotii-wrapper"},a("div",{class:"spotii-promo"},this.price)):"")}componentDidLoad(){if(this.tamaraIsActive&&((t=document.createElement("script")).setAttribute("src","https://cdn.tamara.co/widget/product-widget.min.js"),document.head.appendChild(t),t.onload=()=>{window.TamaraProductWidget.init({lang:this.language}),setTimeout((()=>{window.TamaraProductWidget.render()}),300)}),this.tabbyIsActive&&((t=document.createElement("script")).setAttribute("src","https://checkout.tabby.ai/tabby-promo.js"),document.head.appendChild(t),t.onload=()=>{new(0,window.TabbyPromo)({selector:"#tabbyPromo",currency:this.currency,price:this.price,lang:this.language}),document.querySelectorAll(".tabby-promo-snippet__logo").forEach((function(t){t.setAttribute("aria-label","Tabby Logo")}))}),this.spotiiIsActive){window.spotiiConfig={targetXPath:[".spotii-wrapper"],renderToPath:[".spotii-promo"],currency:this.currency};var t=document.createElement("script");console.log("🚀 ~ file: salla-installment.tsx ~ line 106 ~ SallaInstallment ~ componentDidLoad ~ ;",salla.url.cdn("js/price-widget-ar-salla.js")),t.setAttribute("src",salla.url.cdn("js/price-widget-ar-salla.js")),document.head.appendChild(t)}}};r.style="#tabbyPromoWrapper{background:white;border-radius:0.375rem;transition:box-shadow 0.5s cubic-bezier(0.4, 0, 0.2, 1);margin-bottom:20px}.salla-y #tabbyPromoWrapper{border:1px solid var(--color-grey-dark);border-radius:12px}#tabbyPromoWrapper:hover{box-shadow:0 0 #0000, 0 0 #0000, 5px 10px 30px #2B2D340D}#tabbyPromoWrapper #tabbyPromo *{font-family:var(--font-main)}#tabbyPromoWrapper #tabbyPromo>div>div{max-width:none;padding:15px;box-shadow:none;border:none}#tabbyPromoWrapper #tabbyPromo .tabby-promo-snippet{max-width:100%;min-height:100px;padding:18px 20px;border:none}#tabbyPromoWrapper #tabbyPromo .tabby-promo-snippet__text,#tabbyPromoWrapper #tabbyPromo .tabby-promo-snippet__link{font-size:var(--font-sm);color:var(--color-text) !important}#tabbyPromoWrapper #tabbyPromo .tabby-promo-snippet__link{font-weight:bold}.tabby-promo-wrapper #tabby-promo{font-family:var(--font-main) !important}.tabby-promo-wrapper #tabby-promo .tabby-promo__feature-title{font-size:var(--font-md)}.tabby-promo-wrapper #tabby-promo .tabby-promo__feature-desc{font-size:var(--font-sm);line-height:20px}.tamara-product-widget{margin-bottom:20px}.tamara-product-widget,.spotii-wrapper{min-height:100px;position:relative;color:var(--color-text);font-size:var(--font-sm);line-height:1.25;padding:18px 20px 18px 100px !important;background:white;border-radius:0.375rem;transition:box-shadow 0.5s cubic-bezier(0.4, 0, 0.2, 1)}.salla-y .tamara-product-widget,.salla-y .spotii-wrapper{border-radius:12px;border:1px solid var(--color-grey-dark)}.tamara-product-widget:hover,.spotii-wrapper:hover{box-shadow:0 0 #0000, 0 0 #0000, 5px 10px 30px #2B2D340D}.spotii-wrapper .spotii-promo{font-size:var(--font-md)}.spotii-wrapper .spotii-product-widget{font-size:var(--font-sm);margin-top:10px}.tamara-product-widget .tamara-logo{position:absolute;left:20px;top:18px;margin:0 !important}.ltr .tamara-product-widget .tamara-logo{right:20px;left:auto}.tamara-product-widget span{font-family:var(--font-main);font-size:var(--font-sm);color:var(--color-text)}.tamara-product-widget span:last-child{display:block;position:relative;margin-top:8px}.tamara-popup__wrap{overflow:auto !important}";export{r as salla_installment}
@@ -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}