@salla.sa/twilight-components 2.14.301 → 2.14.302
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/{filepond-CiGLkWY7.js → filepond-BRWi-MWe.js} +1 -1
- package/dist/cjs/{filepond-plugin-file-poster-113aCl-e.js → filepond-plugin-file-poster-BeKSlvGr.js} +1 -1
- package/dist/cjs/{filepond-plugin-file-validate-size-CiZz56Xi.js → filepond-plugin-file-validate-size-nonPpUBw.js} +1 -1
- package/dist/cjs/{filepond-plugin-file-validate-type-DTb9Ct3C.js → filepond-plugin-file-validate-type-BucCOm94.js} +1 -1
- package/dist/cjs/{filepond-plugin-image-edit-BL6ixM-6.js → filepond-plugin-image-edit-GnrEKFw1.js} +1 -1
- package/dist/cjs/{filepond-plugin-image-exif-orientation-DVosclA-.js → filepond-plugin-image-exif-orientation-CcyyVfMq.js} +1 -1
- package/dist/cjs/{filepond-plugin-image-preview-CNqKulm7.js → filepond-plugin-image-preview-C9Z27UBx.js} +1 -1
- package/dist/cjs/{index-DHfe8MsY.js → index--gjiun-h.js} +1 -1
- package/dist/cjs/{index-cNY_E-l7.js → index-BWcgfy8W.js} +2 -2
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/salla-accordion_62.cjs.entry.js +9 -9
- package/dist/cjs/salla-advertisement.cjs.entry.js +1 -1
- package/dist/cjs/salla-app-install-alert.cjs.entry.js +1 -1
- package/dist/cjs/salla-apps-icons.cjs.entry.js +1 -1
- package/dist/cjs/salla-cart-item-offers.cjs.entry.js +1 -1
- package/dist/cjs/salla-conditional-offer.cjs.entry.js +1 -1
- package/dist/cjs/salla-contacts.cjs.entry.js +3 -2
- package/dist/cjs/salla-custom-fields.cjs.entry.js +1 -1
- package/dist/cjs/salla-filters-widget.cjs.entry.js +1 -1
- package/dist/cjs/salla-filters.cjs.entry.js +1 -1
- package/dist/cjs/salla-installment.cjs.entry.js +1 -1
- package/dist/cjs/salla-loyalty-prize-item.cjs.entry.js +1 -1
- package/dist/cjs/salla-loyalty-program.cjs.entry.js +1 -1
- package/dist/cjs/salla-metadata.cjs.entry.js +1 -1
- package/dist/cjs/salla-notification-item.cjs.entry.js +1 -1
- package/dist/cjs/salla-notifications.cjs.entry.js +1 -1
- package/dist/cjs/salla-offer.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-details-multiple-bundle-product.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-details-options.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-details.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-summary.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-totals-card.cjs.entry.js +1 -1
- package/dist/cjs/salla-orders.cjs.entry.js +1 -1
- package/dist/cjs/salla-payments.cjs.entry.js +1 -1
- package/dist/cjs/salla-price-range.cjs.entry.js +1 -1
- package/dist/cjs/salla-review-card.cjs.entry.js +1 -1
- package/dist/cjs/salla-reviews-page.cjs.entry.js +1 -1
- package/dist/cjs/salla-reviews.cjs.entry.js +1 -1
- package/dist/cjs/salla-social.cjs.entry.js +1 -1
- package/dist/cjs/salla-tiered-offer.cjs.entry.js +1 -1
- package/dist/cjs/salla-tooltip.cjs.entry.js +1 -1
- package/dist/cjs/salla-trust-badges.cjs.entry.js +1 -1
- package/dist/cjs/salla-verify.cjs.entry.js +1 -1
- package/dist/cjs/salla-wallet.cjs.entry.js +1 -1
- package/dist/cjs/twilight.cjs.js +1 -1
- package/dist/collection/components/salla-contacts/salla-contacts.js +2 -1
- package/dist/components/index.js +2 -2
- package/dist/components/salla-contacts.js +2 -1
- package/dist/esm/{filepond-C7eUn4lx.js → filepond-DIi7VF0c.js} +1 -1
- package/dist/esm/{filepond-plugin-file-poster-vmXXIkL6.js → filepond-plugin-file-poster-C7auTp2H.js} +1 -1
- package/dist/esm/{filepond-plugin-file-validate-size-BZZqHehK.js → filepond-plugin-file-validate-size-DqiYtpc2.js} +1 -1
- package/dist/esm/{filepond-plugin-file-validate-type-BbwD6h-S.js → filepond-plugin-file-validate-type-Drt0dfiK.js} +1 -1
- package/dist/esm/{filepond-plugin-image-edit-xJ4IGVgP.js → filepond-plugin-image-edit-B8vrHstP.js} +1 -1
- package/dist/esm/{filepond-plugin-image-exif-orientation-BG7bHX2B.js → filepond-plugin-image-exif-orientation-CEFy5_xT.js} +1 -1
- package/dist/esm/{filepond-plugin-image-preview-DNRiGZ1w.js → filepond-plugin-image-preview-BJIFb11t.js} +1 -1
- package/dist/esm/{index-wTZ5u3Qu.js → index-DKAYrLM1.js} +2 -2
- package/dist/esm/{index-DMx0pIZZ.js → index-lg6hKynk.js} +1 -1
- package/dist/esm/loader.js +2 -2
- package/dist/esm/salla-accordion_62.entry.js +9 -9
- package/dist/esm/salla-advertisement.entry.js +1 -1
- package/dist/esm/salla-app-install-alert.entry.js +1 -1
- package/dist/esm/salla-apps-icons.entry.js +1 -1
- package/dist/esm/salla-cart-item-offers.entry.js +1 -1
- package/dist/esm/salla-conditional-offer.entry.js +1 -1
- package/dist/esm/salla-contacts.entry.js +3 -2
- package/dist/esm/salla-custom-fields.entry.js +1 -1
- package/dist/esm/salla-filters-widget.entry.js +1 -1
- package/dist/esm/salla-filters.entry.js +1 -1
- package/dist/esm/salla-installment.entry.js +1 -1
- package/dist/esm/salla-loyalty-prize-item.entry.js +1 -1
- package/dist/esm/salla-loyalty-program.entry.js +1 -1
- package/dist/esm/salla-metadata.entry.js +1 -1
- package/dist/esm/salla-notification-item.entry.js +1 -1
- package/dist/esm/salla-notifications.entry.js +1 -1
- package/dist/esm/salla-offer.entry.js +1 -1
- package/dist/esm/salla-order-details-multiple-bundle-product.entry.js +1 -1
- package/dist/esm/salla-order-details-options.entry.js +1 -1
- package/dist/esm/salla-order-details.entry.js +1 -1
- package/dist/esm/salla-order-summary.entry.js +1 -1
- package/dist/esm/salla-order-totals-card.entry.js +1 -1
- package/dist/esm/salla-orders.entry.js +1 -1
- package/dist/esm/salla-payments.entry.js +1 -1
- package/dist/esm/salla-price-range.entry.js +1 -1
- package/dist/esm/salla-review-card.entry.js +1 -1
- package/dist/esm/salla-reviews-page.entry.js +1 -1
- package/dist/esm/salla-reviews.entry.js +1 -1
- package/dist/esm/salla-social.entry.js +1 -1
- package/dist/esm/salla-tiered-offer.entry.js +1 -1
- package/dist/esm/salla-tooltip.entry.js +1 -1
- package/dist/esm/salla-trust-badges.entry.js +1 -1
- package/dist/esm/salla-verify.entry.js +1 -1
- package/dist/esm/salla-wallet.entry.js +1 -1
- package/dist/esm/twilight.js +2 -2
- package/dist/twilight/{p-509bef7a.entry.js → p-02ec6e21.entry.js} +1 -1
- package/dist/twilight/{p-b1c59aed.entry.js → p-04bf9f1e.entry.js} +1 -1
- package/dist/twilight/{p-1f90b598.entry.js → p-09e11910.entry.js} +1 -1
- package/dist/twilight/{p-19f51013.entry.js → p-0b6606df.entry.js} +1 -1
- package/dist/twilight/{p-21106ddd.entry.js → p-1276c373.entry.js} +1 -1
- package/dist/twilight/{p-7c851abe.entry.js → p-1b144eb9.entry.js} +1 -1
- package/dist/twilight/{p-0f8e76f9.entry.js → p-210fdc70.entry.js} +1 -1
- package/dist/twilight/{p-fcbf87ce.entry.js → p-407e93bd.entry.js} +1 -1
- package/dist/twilight/{p-9eea4938.entry.js → p-4f275162.entry.js} +1 -1
- package/dist/twilight/{p-fa941083.entry.js → p-5143a824.entry.js} +1 -1
- package/dist/twilight/{p-3578f709.entry.js → p-61f7623a.entry.js} +1 -1
- package/dist/twilight/{p-f17f2815.entry.js → p-6a14e2e4.entry.js} +1 -1
- package/dist/twilight/{p-6a22cdb0.entry.js → p-78f36598.entry.js} +1 -1
- package/dist/twilight/{p-620bf923.entry.js → p-7ca07684.entry.js} +1 -1
- package/dist/twilight/{p-31e4965e.entry.js → p-824bba69.entry.js} +1 -1
- package/dist/twilight/{p-d338a839.entry.js → p-83125835.entry.js} +1 -1
- package/dist/twilight/{p-32cc9ddd.entry.js → p-933fbd4d.entry.js} +1 -1
- package/dist/twilight/{p-E_gyshLJ.js → p-CF24vbMv.js} +1 -1
- package/dist/twilight/{p-DUi-y-L3.js → p-CXXmrPiy.js} +1 -1
- package/dist/twilight/{p-wTZ5u3Qu.js → p-DKAYrLM1.js} +1 -1
- package/dist/twilight/{p-CZNpa8Wt.js → p-DTof2E91.js} +1 -1
- package/dist/twilight/{p-cBibjZzs.js → p-Dukd0jtD.js} +1 -1
- package/dist/twilight/{p-492f76aa.entry.js → p-a5201709.entry.js} +1 -1
- package/dist/twilight/{p-7e77c246.entry.js → p-a6a38898.entry.js} +1 -1
- package/dist/twilight/{p-c89ca00d.entry.js → p-aaba5a2f.entry.js} +1 -1
- package/dist/twilight/{p-ffe0b3f8.entry.js → p-b54bb957.entry.js} +1 -1
- package/dist/twilight/{p-10d2d437.entry.js → p-ba2ce400.entry.js} +1 -1
- package/dist/twilight/{p-41a59f32.entry.js → p-bf9620c6.entry.js} +1 -1
- package/dist/twilight/{p-57fdc503.entry.js → p-c163648b.entry.js} +1 -1
- package/dist/twilight/{p-c7e91395.entry.js → p-c786edfa.entry.js} +1 -1
- package/dist/twilight/{p-1f3223b5.entry.js → p-c98d22e3.entry.js} +1 -1
- package/dist/twilight/{p-b1d0f305.entry.js → p-da5abb49.entry.js} +1 -1
- package/dist/twilight/{p-680fd54e.entry.js → p-dbac72c9.entry.js} +1 -1
- package/dist/twilight/{p-67354cb0.entry.js → p-dfb34dbd.entry.js} +1 -1
- package/dist/twilight/{p-a5774669.entry.js → p-e382c1f5.entry.js} +1 -1
- package/dist/twilight/{p-ec00e74e.entry.js → p-ee2e2c06.entry.js} +1 -1
- package/dist/twilight/{p-1015c659.entry.js → p-f10f54b7.entry.js} +2 -2
- package/dist/twilight/{p-21ffae60.entry.js → p-f10f5a36.entry.js} +1 -1
- package/dist/twilight/{p-95f2f372.entry.js → p-faddd04f.entry.js} +1 -1
- package/dist/twilight/{p-j-xabI8F.js → p-hhYSmY98.js} +2 -2
- package/dist/twilight/{p-B1qckR0H.js → p-pqbC2f_4.js} +1 -1
- package/dist/twilight/{p-ZsI3fS_o.js → p-vQaSX60M.js} +1 -1
- package/dist/twilight/{p-DMdYXt9I.js → p-zRye1rCZ.js} +1 -1
- package/dist/twilight/twilight.esm.js +1 -1
- package/package.json +5 -5
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as s,h as a,H as t,a as l}from"./p-
|
|
4
|
+
import{r as s,h as a,H as t,a as l}from"./p-DKAYrLM1.js";const r=class{constructor(a){s(this,a),this.apps=salla.config.get("store.apps"),this.appSlot=this.host.querySelector('[slot="app"]')?.innerHTML||"<img alt={name} src={icon} />",salla.onReady((()=>{this.apps=salla.config.get("store.apps")})),salla.lang.onLoaded((()=>{this.appsTitle=salla.lang.get("blocks.footer.download_apps")}))}getAppsArray(){return Object.entries(this.apps).map((([s,a])=>({name:s,value:a})))}componentWillLoad(){return new Promise((s=>salla.onReady(s)))}render(){const s=this.getAppsArray();if(!Array.isArray(s)||s.length)return a(t,{class:"s-apps-icons"},!this.hideTitle&&a("h3",null,this.appsTitle),a("div",{class:{"s-apps-icons-list":!0,vertical:this.vertical}},s.map(((s,t)=>a("a",{key:t,href:s.value,rel:"noreferrer",target:"_blank",class:"s-apps-icons-item",id:"app-slot",innerHTML:this.appSlot.replace(/\{icon\}/g,salla.url.cdn(`images/${s.name}.png`)).replace(/\{name\}/g,s.name)})))))}componentDidRender(){this.host.querySelector('[slot="app"]')?.remove()}get host(){return l(this)}};r.style=":host{display:block}";export{r as salla_apps_icons}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as s,c as t,h as i,H as e,a}from"./p-
|
|
4
|
+
import{r as s,c as t,h as i,H as e,a}from"./p-DKAYrLM1.js";import{H as h}from"./p-Dljb4XCt.js";import{F as l}from"./p-DL4h2bc3.js";import"./p-CgtvEd63.js";const r=class{constructor(i){s(this,i),this.changed=t(this,"changed"),this.initHeight=195,this.isOpen=!0,this.isShowMore=!1,this.showMoreLabel="عرض المزيد",this.showLessLabel="عرض أقل",this.page=salla.config.get("page")}connectedCallback(){this.withLoadMore="price"!=this.option.key&&Array.isArray(this.option.values)&&this.option.values.length>8,salla.onReady((()=>{this.page=salla.config.get("page")})),salla.lang.onLoaded((()=>{this.showMoreLabel=salla.lang.getWithDefault("common.titles.more",this.showMoreLabel),this.showLessLabel=salla.lang.getWithDefault("common.elements.show_less",this.showLessLabel)}))}componentDidLoad(){this.widgetValues.scrollHeight<this.initHeight&&(this.withLoadMore=!1),this.withLoadMore&&this.widgetValues&&(this.widgetValues.style.maxHeight=`${this.initHeight}px`),this.widgetContent.style.height=`${this.widgetContent.scrollHeight}px`}async setWidgetHeight(s=250){this.widgetContent.removeAttribute("style"),setTimeout((()=>{this.widgetContent.style.height=this.widgetContent.scrollHeight+"px"}),s)}async reset(){this.option.type===l.RANGE&&this.priceRange.reset(),Array.from(this.host.querySelectorAll("input")).forEach((s=>s.checked=!1))}async showMore(){this.isShowMore=!this.isShowMore,this.widgetContent.style.height="auto",this.widgetValues.style.maxHeight=this.isShowMore?`${this.widgetValues.scrollHeight}px`:`${this.initHeight}px`,setTimeout((()=>{this.widgetContent.style.height=`${this.widgetContent.scrollHeight}px`}),400)}async toggleWidget(){this.isOpen=!this.isOpen,h.toggleElementClassIf(this.widgetContent,"s-filters-widget-opened","s-filters-widget-closed",(()=>this.isOpen))}renderFilterOption(s){return[l.VALUES,l.MINIMUM,l.VARIANTS].includes(s.type)?s.values.map((t=>{let e="number"==typeof t?t:t.key||t.value;return i("label",{class:"s-filters-label",htmlFor:`${s.key}-option-${e}`,key:`${s.key}-option-${e}`},i("input",{id:`${s.key}-option-${e}`,name:s.key,type:"radio",checked:this.isSelectedOption(s,e),class:"s-filters-radio",onChange:t=>this.changed.emit({event:t,option:s,value:e})}),this.getOptionLabel(s,t))})):""}isSelectedOption(s,t){return s.type===l.MINIMUM?this.filtersData[s.key]==t:s.type===l.VARIANTS?this.filtersData[s.type]&&this.filtersData[s.type][Object.keys(this.filtersData[s.type])[0]]==t:s.type===l.RANGE?this.filtersData[s.key]&&this.filtersData[s.key].min==t.min&&this.filtersData[s.key].max==t.max:s.type===l.VALUES&&this.filtersData[s.key]&&Number(this.filtersData[s.key])==Number(t)}getOptionLabel(s,t){return"rating"==s.key?i("salla-rating-stars",{size:"small",value:t}):i("span",{class:"s-filters-option-name"},t.value||"null")}render(){return i(e,{key:"e22c4c9c5f69bd901a55c3b9c202e6cca14c1134",class:"s-filters-widget-container"},i("h3",{key:"758d6ddbff83b5416d1ef06ef790535587403613",class:"s-filters-widget-title",onClick:()=>this.toggleWidget()},i("span",{key:"77e0b8b00a6bed4d396142bd13ba83964e3a72d8"},this.option.label),i("span",{key:"481bbf3735b6a9fe629ec99004556bca0bbf7dd9",class:"s-filters-widget-plusminus "+(this.isOpen?"s-filters-widget-plusminus-active":"")})),i("div",{key:"a46631d62460351d6822a09ad864c51753aa7369",class:"s-filters-widget-content",ref:s=>this.widgetContent=s},i("div",{key:"fb5095c46cef0014859bc3d8acaf8a2661afa916",class:"s-filters-widget-values",ref:s=>this.widgetValues=s},i("slot",{key:"b4ac615c765b88a027675e095d5da28ad7cd8845"}),this.option.type!==l.RANGE?this.renderFilterOption(this.option):i("salla-price-range",{onChanged:s=>{this.changed.emit(s.detail)},ref:s=>this.priceRange=s,filtersData:this.filtersData,option:this.option})),this.withLoadMore&&i("a",{key:"9b3a08a990949130531810792dccb24192b57e46",class:"s-filters-widget-more",onClick:()=>this.showMore()},this.isShowMore?this.showLessLabel:this.showMoreLabel)))}get host(){return a(this)}};r.style=":host{display:block}";export{r as salla_filters_widget}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as s,h as t}from"./p-
|
|
4
|
+
import{r as s,h as t}from"./p-DKAYrLM1.js";import{S as i,A as e}from"./p-yRO-ZESF.js";import{G as c}from"./p-C0JNGIpa.js";const a=class{constructor(t){s(this,t),this.internalOffers=[],this.showAll=!1,this.freeLabel="",this.receivedOffer="",this.discountAmountLabel="",this.showMoreOffers="",this.icons={DiscountCouponIcon:'\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>discount-coupon</title>\n<path d="M27 28h-22c-0.552 0-1-0.448-1-1v0c0-1.657-1.343-3-3-3v0c-0.552 0-1-0.448-1-1v0-12c0-0.552 0.448-1 1-1v0c1.657 0 3-1.343 3-3v0c0-0.552 0.448-1 1-1v0h22c0.552 0 1 0.448 1 1v0c0 1.657 1.343 3 3 3v0c0.552 0 1 0.448 1 1v0 12c0 0.552-0.448 1-1 1v0c-1.657 0-3 1.343-3 3v0c0 0.552-0.448 1-1 1v0zM5.9 26h20.2c0.415-1.964 1.936-3.485 3.867-3.894l0.033-0.006v-10.2c-1.964-0.415-3.485-1.936-3.894-3.867l-0.006-0.033h-20.2c-0.415 1.964-1.936 3.485-3.867 3.894l-0.033 0.006v10.2c1.964 0.415 3.485 1.936 3.894 3.867l0.006 0.033zM20 7h2v3h-2v-3zM20 12h2v4h-2v-4zM20 18h2v4h-2v-4zM20 24h2v3h-2v-3zM9 16c-1.657 0-3-1.343-3-3s1.343-3 3-3c1.657 0 3 1.343 3 3v0c0 1.657-1.343 3-3 3v0zM9 12c-0.552 0-1 0.448-1 1s0.448 1 1 1c0.552 0 1-0.448 1-1v0c0-0.552-0.448-1-1-1v0zM15 24c-1.657 0-3-1.343-3-3s1.343-3 3-3c1.657 0 3 1.343 3 3v0c0 1.657-1.343 3-3 3v0zM15 20c-0.552 0-1 0.448-1 1s0.448 1 1 1c0.552 0 1-0.448 1-1v0c0-0.552-0.448-1-1-1v0zM7 24c-0.552-0-1-0.448-1-1 0-0.244 0.088-0.468 0.233-0.642l-0.001 0.002 10-12c0.185-0.221 0.461-0.36 0.769-0.36 0.553 0 1.001 0.448 1.001 1.001 0 0.245-0.088 0.469-0.233 0.643l0.001-0.002-10 12c-0.185 0.22-0.46 0.358-0.767 0.358-0.001 0-0.002 0-0.003 0h0z"></path>\n</svg>\n',GiftIcon:c,FireIcon:'\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>fire</title>\n<path d="M21.56 3.009c-0.052-0.047-0.116-0.065-0.173-0.103-0.073-0.048-0.143-0.1-0.223-0.132-0.083-0.033-0.165-0.047-0.252-0.063-0.081-0.016-0.16-0.035-0.243-0.035-0.089 0-0.172 0.020-0.26 0.037-0.080 0.016-0.159 0.028-0.236 0.059-0.084 0.035-0.157 0.088-0.235 0.14-0.053 0.036-0.115 0.053-0.165 0.097-0.049 0.044-0.988 0.895-2.288 2.255-2.364-2.839-4.476-4.815-4.576-4.908-0.056-0.052-0.127-0.075-0.188-0.115-0.075-0.049-0.143-0.105-0.224-0.137-0.080-0.032-0.163-0.041-0.245-0.057-0.085-0.016-0.167-0.040-0.252-0.040-0.084 0-0.163 0.023-0.245 0.039-0.087 0.016-0.172 0.025-0.253 0.059-0.080 0.032-0.147 0.087-0.22 0.135-0.063 0.041-0.133 0.064-0.189 0.116-0.453 0.423-11.092 10.408-11.092 18.095 0 7.977 4.935 13.549 12 13.549h8.667c6.673 0 11.333-5.115 11.333-12.439 0-7.052-10.013-16.167-10.44-16.552zM20.667 29.333h-7.777c-2.924 0-4.889-2.044-4.889-5.084 0-2.317 2.816-6.441 4.888-8.887 0.76 0.909 2.755 3.397 3.969 5.869 0.212 0.431 0.639 0.715 1.117 0.743 0.489 0.031 0.937-0.203 1.197-0.605 0.552-0.849 1.109-1.596 1.497-2.093 1.491 1.897 3.331 4.78 3.331 6.399 0 2.188-1.34 3.659-3.333 3.659zM26.537 27.052c0.081-0.44 0.129-0.899 0.129-1.377 0-3.269-3.713-7.847-4.46-8.735l-0.523-0.617c-0.507-0.599-1.528-0.599-2.035 0l-0.531 0.627c-0.147 0.175-0.495 0.599-0.936 1.187-1.595-2.597-3.495-4.776-3.595-4.889l-0.697-0.793c-0.507-0.577-1.499-0.577-2.004 0l-0.697 0.795c-0.6 0.684-5.856 6.803-5.856 11.001 0 0.881 0.127 1.712 0.356 2.484-1.896-1.933-3.023-4.821-3.023-8.283 0-4.915 6.073-11.997 9.329-15.255 1.001 1.008 2.692 2.789 4.368 4.927 0.243 0.309 0.609 0.496 1.001 0.509h0.048c0.376 0 0.735-0.159 0.988-0.439 0.889-0.981 1.693-1.795 2.269-2.359 3.051 2.965 8.663 9.323 8.663 13.727 0 3.171-1.031 5.769-2.796 7.491z"></path>\n</svg>\n',SpecialDiscountIcon:i,TagMoneyIcon:'\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>tag-money</title>\n<path d="M20.567 11.433c-0.521-0.521-1.364-0.521-1.885 0l-0.524 0.524c-1.28-0.819-3.091-0.681-4.191 0.419-0.631 0.631-0.976 1.468-0.976 2.359 0 0.889 0.347 1.727 0.976 2.357l0.943 0.943c0.171 0.171 0.195 0.368 0.195 0.472s-0.025 0.301-0.196 0.472c-0.169 0.169-0.367 0.195-0.471 0.195s-0.301-0.025-0.472-0.195l-2.357-2.357c-0.521-0.521-1.364-0.521-1.885 0s-0.521 1.364 0 1.885l0.944 0.941-0.472 0.472c-0.521 0.521-0.521 1.364 0 1.885 0.26 0.26 0.601 0.391 0.943 0.391s0.683-0.131 0.943-0.391l0.519-0.519c0.54 0.359 1.173 0.553 1.837 0.553 0.892 0 1.729-0.348 2.357-0.976 0.631-0.631 0.976-1.467 0.976-2.357s-0.347-1.727-0.976-2.357l-0.943-0.943c-0.26-0.26-0.26-0.684 0-0.944 0.259-0.259 0.683-0.261 0.944 0l1.885 1.887c0.521 0.521 1.364 0.521 1.885 0 0.521-0.52 0.521-1.364 0-1.885l-0.472-0.472 0.472-0.472c0.521-0.521 0.521-1.365 0.001-1.887zM28 0h-9.344c-1.059 0-2.056 0.411-2.809 1.153l-14.673 14.456c-1.56 1.56-1.561 4.097-0.001 5.657l9.56 9.56c0.755 0.755 1.76 1.172 2.828 1.173h0.003c1.068 0 2.072-0.416 2.833-1.179l14.451-14.668c0.743-0.753 1.153-1.751 1.153-2.809v-9.344c0-2.205-1.795-4-4-4zM29.333 13.344c0 0.353-0.137 0.685-0.385 0.937l-14.444 14.661c-0.252 0.252-0.587 0.391-0.941 0.391-0.001 0-0.001 0-0.001 0-0.356-0.001-0.691-0.139-0.943-0.392l-9.561-9.56c-0.52-0.52-0.52-1.365-0.005-1.88l14.667-14.449c0.253-0.248 0.585-0.385 0.937-0.385h9.344c0.736 0 1.333 0.597 1.333 1.333zM24 6.673c-0.737 0-1.333 0.604-1.333 1.341s0.596 1.333 1.333 1.333 1.333-0.596 1.333-1.333v-0.015c0-0.737-0.596-1.327-1.333-1.327z"></path>\n</svg>\n'},this.visibleOffersCount=3,this.handleCartItemUpdated=s=>{const t=s.data.cart.items.find((s=>s.id===this.itemId));t?.id===this.itemId&&(this.internalQuantity=t.quantity,this.internalOffers=t.detailed_offers||[],this.internalProductPrice=t.product_price)},this.toggleShowAll=()=>{this.showAll=!this.showAll}}async componentWillLoad(){await Salla.onReady(),await salla.lang.onLoaded((()=>{this.freeLabel=salla.lang.get("common.elements.freeExclam"),this.receivedOffer=salla.lang.get("pages.cart.received_offer"),this.discountAmountLabel=salla.lang.get("pages.cart.discount_amount"),this.showMoreOffers=salla.lang.get("pages.cart.show_more_offers")})),this.internalQuantity=this.quantity,this.internalOffers=this.parseOffers(this.offers),this.internalProductPrice=this.productPrice}componentDidLoad(){salla.event.on("cart::item.updated",(s=>this.handleCartItemUpdated(s)))}parseOffers(s){try{return"string"!=typeof s?(console.warn("Offers is not a string. Returning as-is.",s),Array.isArray(s)?s:[]):JSON.parse(s||"[]")}catch(s){return console.error("Failed to parse offers",s),[]}}get visibleOffers(){return this.internalOffers.slice(0,this.visibleOffersCount)}get hiddenOffers(){return this.internalOffers.slice(this.visibleOffersCount)}getPaidQty(s,t){return s-t.free_quantity}renderOffer(s,i){const e=this.getPaidQty(s,i);return t("div",{class:"s-cart-item-offers-box"},i.free_quantity>0&&e>0&&t("div",{class:"s-cart-item-offers-paid-free"},t("div",{class:"s-cart-item-offers-line"},salla.helpers.number(e)," × ",t("span",{innerHTML:salla.money(this.internalProductPrice)})),t("div",{class:"s-cart-item-offers-line"},salla.helpers.number(i.free_quantity)," ×",t("span",{class:"s-cart-item-offers-regular-price",innerHTML:salla.money(this.internalProductPrice)}),t("span",{class:"s-cart-item-offers-free-label"},this.freeLabel))),t("div",{class:"s-cart-item-offers-details"},t("span",{class:"s-cart-item-offers-icon",innerHTML:this.icons[i.discount_icon]||""}),t("div",null,t("p",{class:"s-cart-item-offers-title"},this.receivedOffer.replace(":offer",i.offer_name)),t("p",{class:"s-cart-item-offers-discount"},t("span",{innerHTML:this.discountAmountLabel.replace(":amount",salla.money(i.discount_amount.toFixed(2)))})))))}render(){return this.internalOffers?.length?t("div",{class:"s-cart-item-offers-container",id:`offers_list_${this.itemId}`},this.visibleOffers.map((s=>this.renderOffer(this.internalQuantity,s))),this.internalOffers?.length>this.visibleOffersCount&&t("div",{class:"s-cart-item-offers-show-more"},t("button",{class:"s-cart-item-offers-show-more-btn",onClick:this.toggleShowAll,type:"button"},t("span",{class:"s-cart-item-offers-show-more-label"},"+",this.hiddenOffers.length," ",this.showMoreOffers,t("span",{innerHTML:e,class:{"s-cart-item-offers-arrow-icon":!0,"s-cart-item-offers-arrow-open":this.showAll}})))),this.showAll&&t("div",{class:"s-cart-item-offers-collapsed",id:`offers_${this.itemId}`},this.hiddenOffers.map((s=>this.renderOffer(this.internalQuantity,s))))):null}};a.style=":host{display:block}";export{a as salla_cart_item_offers}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as s,h as t,H as o}from"./p-
|
|
4
|
+
import{r as s,h as t,H as o}from"./p-DKAYrLM1.js";const i=class{constructor(t){s(this,t),this.bordered=!0,this.placeholderImage="images/placeholder.png",this.optionsData=[]}componentWillLoad(){this.parseOptionsData()}componentWillUpdate(){this.parseOptionsData()}parseOptionsData(){if(this.options)if("string"==typeof this.options)try{this.optionsData=JSON.parse(this.options)}catch(s){this.optionsData=[]}else this.optionsData=Array.isArray(this.options)?this.options:[];else this.optionsData=[]}renderOptionValue(s){return s.is_image?t("div",{class:"s-order-details-option-image-container"},t("a",{href:s.value,target:"_blank"},t("img",{class:"s-order-details-option-image",src:s.value||this.placeholderImage,alt:s.name}))):s.color?t("span",{title:s.value,class:"s-order-details-option-color-swatch",style:{backgroundColor:s.color}}):s.is_file?t("a",{href:s.value,target:"_blank",class:"s-order-details-option-file-link"},"Attachments"):s.is_color_picker?t("div",{class:"s-order-details-option-color-picker"},t("div",{class:"s-order-details-option-color-picker-content"},t("span",{class:"s-order-details-option-color-picker-text"},s.value),t("span",{class:"s-order-details-option-color-picker-swatch",style:{backgroundColor:s.value,width:"1rem"}})),t("salla-button",{onClick:t=>this.copyToClipboard(t,s.value),shape:"link",class:"s-order-details-option-color-picker-button"},t("span",{class:"s-order-details-option-color-copy-icon",innerHTML:'\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>swap-fill</title>\n<path d="M28 10.667h-2.667c-0.736 0-1.333 0.596-1.333 1.333s0.597 1.333 1.333 1.333h2.667c0.735 0 1.333 0.597 1.333 1.333v13.333c0 0.736-0.599 1.333-1.333 1.333h-13.333c-0.735 0-1.333-0.597-1.333-1.333v-2.667c0-0.737-0.597-1.333-1.333-1.333s-1.333 0.596-1.333 1.333v2.667c0 2.205 1.795 4 4 4h13.333c2.205 0 4-1.795 4-4v-13.333c0-2.205-1.795-4-4-4zM21.333 17.333v-13.333c0-2.205-1.795-4-4-4h-13.333c-2.205 0-4 1.795-4 4v13.333c0 2.205 1.795 4 4 4h13.333c2.205 0 4-1.795 4-4zM2.667 17.333v-13.333c0-0.736 0.599-1.333 1.333-1.333h13.333c0.735 0 1.333 0.597 1.333 1.333v13.333c0 0.736-0.599 1.333-1.333 1.333h-13.333c-0.735 0-1.333-0.597-1.333-1.333z"></path>\n</svg>\n'}))):s.is_map&&s.latitude&&s.longitude?t("salla-map",{id:`location_map_${s.id}`,class:`map_${s.id}`,zoom:15,readonly:!0,lat:s.latitude,lng:s.longitude},t("div",{slot:"button"},t("button",{type:"button",class:"s-order-details-option-map-button",onClick:()=>this.openMap(s.id)},"Show Location"))):t("span",{class:"s-order-details-option-default-text"},s.display_value||s.value)}copyToClipboard(s,t){s.preventDefault(),navigator.clipboard&&navigator.clipboard.writeText(t)}openMap(s){const t=document.querySelector(`salla-map.map_${s}`);t&&t.open&&t.open()}render(){if(!this.optionsData.length)return null;const s=this.bordered?"s-order-details-options-container":"s-order-details-options-container-borderless";return t(o,{class:"s-order-details-options-wrapper"},t("h2",{class:"s-order-details-options-title"},salla.lang.get("pages.cart.item_options")),t("div",{class:s},t("dl",{class:"s-order-details-options-list"},this.optionsData.map((s=>t("div",{key:s.id,class:"s-order-details-options-item"},t("dt",{class:"s-order-details-options-item-name"},s.name,":"),t("dd",{class:s.is_image?"s-order-details-options-item-value-image":"s-order-details-options-item-value-text"},this.renderOptionValue(s))))))))}};i.style="";export{i as salla_order_details_options}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as s,h as a,H as r}from"./p-
|
|
4
|
+
import{r as s,h as a,H as r}from"./p-DKAYrLM1.js";const t=class{constructor(a){s(this,a)}handleOrderChange(s){s?this.setSummaryFromProp(s):this.summary=void 0}async componentWillLoad(){await Salla.onReady(),this.order&&this.setSummaryFromProp(this.order)}setSummaryFromProp(s){try{const a="string"==typeof s?JSON.parse(s):s;this.summary=a}catch(s){salla.logger.error("Failed to parse order summary data",s),this.summary=void 0}}renderTotalRow(s,r,t,l,o){return a("div",{class:"s-order-totals-card-row"},a("div",{class:"s-order-totals-card-row-inner"},a("dt",{class:t||"s-order-totals-card-label"},s),a("dd",{class:l||"s-order-totals-card-value"},a(o?"b":"span",{innerHTML:salla.money(r)}))))}renderDiscountRow(){return this.summary?.discounts?.map((s=>a("div",{class:"s-order-totals-card-row",key:s.name},a("div",{class:"s-order-totals-card-row-inner"},a("dt",{class:"s-order-totals-card-discount"},s.name),a("dd",{class:"s-order-totals-card-value"},s.discount)))))}renderRefundRow(s){return a("div",{class:"s-order-totals-card-row"},a("div",{class:"s-order-totals-card-row-inner"},a("dt",{class:"s-order-totals-card-refund-label"},a("span",{class:"s-order-totals-card-refund-icon"},a("i",{class:"sicon-info"})),a("span",null," ",salla.lang.get("pages.orders.refund_amount"))),a("dd",{class:"s-order-totals-card-refund-value"},a("b",{innerHTML:salla.money(s)}))))}render(){if(!this.summary)return a(r,{class:"s-order-totals-card-wrapper"});const{summary:s}=this,t=!!Array.isArray(s.options)&&s.options.length>0;return a(r,{class:"s-order-totals-card-wrapper"},a("div",{class:"s-order-totals-card-panel"},a("h2",{id:"summary-heading",class:"s-order-totals-card-heading"},salla.lang.get("pages.orders.summary")),a("div",{class:"s-order-totals-card-flow"},a("dl",{class:"s-order-totals-card-list"},this.renderTotalRow(salla.lang.get("pages.cart.items_total"),s.sub_total),t&&this.renderTotalRow(salla.lang.get("pages.cart.order_options_total"),s.options_total),s.discounts&&this.renderDiscountRow(),s.cod_cost&&this.renderTotalRow(salla.lang.get("pages.orders.cod_cost"),s.cod_cost,""),s.shipping_cost&&this.renderTotalRow(salla.lang.get("pages.orders.shipping_cost"),s.shipping_cost,"s-order-totals-card-shipping"),s.tax&&this.renderTotalRow(`${salla.lang.get("pages.cart.tax")} ${s.tax.percent}%`,s.tax.amount,""),s.paid_amount?this.renderTotalRow(salla.lang.get("pages.orders.partially_paid"),s.paid_amount,""):null,s.remaining_amount?this.renderTotalRow(salla.lang.get("pages.orders.remaining_amount"),s.remaining_amount,""):null,a("div",{class:"s-order-totals-card-total"},this.renderTotalRow(salla.lang.get("pages.orders.final_total"),s.total,"s-order-totals-card-total-label","s-order-totals-card-total-value",!0)),s.refund_amount?a("div",{class:"s-order-totals-card-refund"},this.renderRefundRow(s.refund_amount)):null))))}static get watchers(){return{order:["handleOrderChange"]}}};t.style=":host{display:block}";export{t as salla_order_totals_card}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as s,h as t,F as e,H as a}from"./p-
|
|
4
|
+
import{r as s,h as t,F as e,H as a}from"./p-DKAYrLM1.js";const r=class{constructor(t){s(this,t)}parseOrderDetailsData(s){this.parsedOrderDetailsData=s,this.parsedOrderDetailsData="string"==typeof this.orderDetails?JSON.parse(s):s}componentWillLoad(){this.parseOrderDetailsData(this.orderDetails),console.log("Parent componentWillLoad - parsedOrderDetailsData:",this.parsedOrderDetailsData)}renderOrderDetailsContent(){return this.parsedOrderDetailsData?[this.parsedOrderDetailsData.options&&this.parsedOrderDetailsData.options.length>0&&t("salla-order-details-options",{options:this.parsedOrderDetailsData.options}),this.parsedOrderDetailsData.sub_products&&this.parsedOrderDetailsData.sub_products.length>0&&t(e,null,t("h2",{class:"s-order-details-bundle-title"},salla.lang.get("pages.orders.sub_products")),t("div",{class:"s-order-details-bundle-content"},this.parsedOrderDetailsData.sub_products.map((s=>t("salla-order-details-multiple-bundle-product",{key:s?.id,productDetails:s})))))]:(console.warn("No parsedOrderDetailsData available"),null)}render(){return t(a,{key:"ca263aa861d52fdf36b6a842f6e58d07f27a6d1f",class:"s-order-details-wrapper"},this.renderOrderDetailsContent())}static get watchers(){return{orderDetails:["parseOrderDetailsData"]}}};r.style="";export{r as salla_order_details}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as s,c as e,h as i}from"./p-
|
|
4
|
+
import{r as s,c as e,h as i}from"./p-DKAYrLM1.js";import{C as t,F as l}from"./p-CBT_Nxny.js";const a=class{constructor(i){s(this,i),this.fieldChanged=e(this,"fieldChanged"),this.fileUploaded=e(this,"fileUploaded"),this.isEditable=!0,this.fieldErrors={},this.isSubmitting=!1}get dragAndDropText(){return salla.lang.get("common.uploader.drag_and_drop")}get browseText(){return salla.lang.get("common.uploader.browse")}get saveButtonText(){return salla.lang.get("common.elements.save")}async setFields(s){this.parsedFields=s}async getFieldValues(){return this.parsedFields?.reduce(((s,e)=>(s[`custom_fields[${e.id}]`]=e.value,s)),{})||{}}async validateFields(){if(!this.parsedFields)return!0;const s=this.parsedFields.reduce(((s,e)=>(!e.required||e.value&&""!==e.value||(s[e.id.toString()]=`${e.label} is required`),s)),{});return this.fieldErrors=s,0===Object.keys(s).length}handleFieldChange(s,e){const i=e.target.value;s.value=i,this.clearFieldError(s.id);const t=!(s.required&&!i);t||this.setFieldError(s.id,`${s.label} is required`),this.fieldChanged.emit({fieldId:s.id,value:i,isValid:t})}handleFileUpload(s,e){const{error:i,file:t}=e.detail,l=!i;this.clearFieldError(s.id),l?s.value=t:this.setFieldError(s.id,"File upload failed"),this.fileUploaded.emit({fieldId:s.id,file:t,isValid:l})}clearFieldError(s){this.fieldErrors={...this.fieldErrors},delete this.fieldErrors[s]}setFieldError(s,e){this.fieldErrors={...this.fieldErrors,[s]:e}}renderTextField(s){return i("input",{disabled:!this.isEditable,type:s.type,id:`custom-field-${s.id}`,value:s.value?.toString()||"",onChange:e=>this.handleFieldChange(s,e),name:`${s.id}`,class:"form-input",required:s.required})}renderFileField(s){return i("salla-file-upload",{url:salla.url.api("upload"),id:`custom-field-${s.id}`,name:`${s.id}`,type:"registration",value:s.value,height:"120px",onAdded:e=>this.handleFileUpload(s,e),required:s.required,disabled:!this.isEditable,onUploaded:s=>{s.target.value=s.target.value?.url},allowRemove:!0,onRemoved:e=>{e.preventDefault(),e.stopPropagation(),s.value="",e.target.value=""},payloadName:"files[]",payloadParams:{type:"registration"},"instant-upload":!0},i("div",{class:"s-custom-fields-filepond-placeholder"},i("span",{class:"s-custom-fields-filepond-placeholder-icon"},i("i",{innerHTML:t})),i("p",{class:"s-custom-fields-filepond-placeholder-text"},this.dragAndDropText),i("span",{class:"filepond--label-action"},this.browseText)))}renderField(s){return i("div",{class:"s-custom-fields-field",key:s.id},i("label",{class:"s-custom-fields-field-label",htmlFor:`custom-field-${s.id}`},s.label,s.required&&i("span",{class:"s-custom-fields-required"},"*")),i("div",null,s.type===l.Photo?this.renderFileField(s):this.renderTextField(s),this.fieldErrors[s.id]&&i("p",{class:"s-custom-fields-error"},this.fieldErrors[s.id])))}componentWillLoad(){this.parsedFields=this.parseFields(this.fields)}parseFields(s){return s?"string"==typeof s?JSON.parse(s):Array.isArray(s)?s:[]:[]}async handleSubmit(s){s.preventDefault(),this.isSubmitting=!0;try{const e={},i=s.target.elements;for(let s=0;s<i.length;s++){const t=i[s];t.name&&!t.name.startsWith("hidden")&&t.value&&(e[t.name]=t.value)}await salla.api.profile.updateCustomFields({id:salla.config.get("store.id"),fields:e})}finally{this.isSubmitting=!1}}render(){return this.parsedFields?.length?i("form",{class:"s-custom-fields-wrapper",onSubmit:this.handleSubmit},this.parsedFields.map((s=>this.renderField(s))),i("salla-button",{type:"submit",loading:this.isSubmitting,disabled:this.isSubmitting||!this.isEditable,"loader-position":"end",class:"s-custom-fields-submit-btn"},this.saveButtonText)):null}};a.style=":host{display:block}";export{a as salla_custom_fields}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as e,h as t,H as r}from"./p-wTZ5u3Qu.js";var s;!function(e){e.PERCENTAGE="percentage",e.FIXED="fixed"}(s||(s={}));const i={staticIcons:['<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="40" height="40" color="#000000" fill="none">\n <path d="M13.7276 3.44418L15.4874 6.99288C15.7274 7.48687 16.3673 7.9607 16.9073 8.05143L20.0969 8.58575C22.1367 8.92853 22.6167 10.4206 21.1468 11.8925L18.6671 14.3927C18.2471 14.8161 18.0172 15.6327 18.1471 16.2175L18.8571 19.3125C19.417 21.7623 18.1271 22.71 15.9774 21.4296L12.9877 19.6452C12.4478 19.3226 11.5579 19.3226 11.0079 19.6452L8.01827 21.4296C5.8785 22.71 4.57865 21.7522 5.13859 19.3125L5.84851 16.2175C5.97849 15.6327 5.74852 14.8161 5.32856 14.3927L2.84884 11.8925C1.389 10.4206 1.85895 8.92853 3.89872 8.58575L7.08837 8.05143C7.61831 7.9607 8.25824 7.48687 8.49821 6.99288L10.258 3.44418C11.2179 1.51861 12.7777 1.51861 13.7276 3.44418Z" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path>\n</svg>','<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" color="#000000" fill="none">\n <path d="M3 12C7.5 12 12 7.5 12 3C12 7.5 16.5 12 21 12C16.5 12 12 16.5 12 21C12 16.5 7.5 12 3 12Z" stroke="currentColor" stroke-width="1.5" stroke-linejoin="round"></path>\n <path d="M2 19.5C2.83333 19.5 4.5 17.8333 4.5 17C4.5 17.8333 6.16667 19.5 7 19.5C6.16667 19.5 4.5 21.1667 4.5 22C4.5 21.1667 2.83333 19.5 2 19.5Z" stroke="currentColor" stroke-width="1.5" stroke-linejoin="round"></path>\n <path d="M16 5C17 5 19 3 19 2C19 3 21 5 22 5C21 5 19 7 19 8C19 7 17 5 16 5Z" stroke="currentColor" stroke-width="1.5" stroke-linejoin="round"></path>\n</svg>','<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="40" height="40" color="#000000" fill="none">\n <path d="M14.2644 18.3717C14.5806 17.407 14.7387 16.9247 15.0616 16.593C15.215 16.4354 15.3932 16.3048 15.5887 16.2066C16.0003 16 16.5003 16 17.5002 16C18.5001 16 19.0001 16 19.4116 16.2066C19.6072 16.3048 19.7853 16.4354 19.9388 16.593C20.2617 16.9247 20.4198 17.407 20.736 18.3717L21.0624 19.3675C21.4561 20.5688 21.653 21.1694 21.3587 21.5847C21.0643 22 20.4418 22 19.1966 22H15.8038C14.5586 22 13.936 22 13.6417 21.5847C13.3473 21.1694 13.5442 20.5688 13.938 19.3675L14.2644 18.3717Z" stroke="currentColor" stroke-width="1.5"></path>\n <path d="M8.76421 10.3717C9.08041 9.40705 9.23851 8.92471 9.56143 8.59298C9.71485 8.43537 9.89299 8.3048 10.0885 8.20663C10.5001 8 11.0001 8 12 8C12.9999 8 13.4999 8 13.9115 8.20663C14.107 8.3048 14.2851 8.43537 14.4386 8.59298C14.7615 8.92471 14.9196 9.40705 15.2358 10.3717L15.5622 11.3675C15.956 12.5688 16.1528 13.1694 15.8585 13.5847C15.5642 14 14.9416 14 13.6964 14H10.3036C9.05842 14 8.43585 14 8.1415 13.5847C7.84716 13.1694 8.04404 12.5688 8.43779 11.3675L8.76421 10.3717Z" stroke="currentColor" stroke-width="1.5"></path>\n <path d="M3.26439 18.3717C3.58059 17.407 3.73869 16.9247 4.06162 16.593C4.21504 16.4354 4.39317 16.3048 4.58872 16.2066C5.00031 16 5.50027 16 6.50018 16C7.5001 16 8.00006 16 8.41165 16.2066C8.6072 16.3048 8.78533 16.4354 8.93875 16.593C9.26167 16.9247 9.41977 17.407 9.73597 18.3717L10.0624 19.3675C10.4561 20.5688 10.653 21.1694 10.3587 21.5847C10.0643 22 9.44176 22 8.19661 22H4.80375C3.5586 22 2.93603 22 2.64169 21.5847C2.34735 21.1694 2.54422 20.5688 2.93797 19.3675L3.26439 18.3717Z" stroke="currentColor" stroke-width="1.5"></path>\n <path d="M12 2V4M7.5 3.5L9 5M16.5 3.5L15 5" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"></path>\n</svg>','<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" color="#000000" fill="none">\n <path d="M5.78223 4.18192C6.43007 3.68319 6.754 3.43383 7.12788 3.27323C7.29741 3.20041 7.47367 3.14158 7.65459 3.09741C8.0536 3 8.4767 3 9.32289 3H14.6771C15.5233 3 15.9464 3 16.3454 3.09741C16.5263 3.14158 16.7026 3.20041 16.8721 3.27323C17.246 3.43383 17.5699 3.68319 18.2178 4.18192C20.3644 5.83448 21.4378 6.66077 21.8057 7.73078C21.9694 8.20673 22.0305 8.70728 21.9858 9.20461C21.8852 10.3227 21.0379 11.346 19.3433 13.3925L15.3498 18.2153C13.8126 20.0718 13.044 21 12 21C10.956 21 10.1874 20.0718 8.65018 18.2153L4.65671 13.3925C2.96208 11.346 2.11476 10.3227 2.0142 9.20461C1.96947 8.70728 2.03064 8.20673 2.1943 7.73078C2.56224 6.66077 3.63557 5.83448 5.78223 4.18192Z" stroke="currentColor" stroke-width="1.5"></path>\n <path d="M10 8.5H14" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path>\n</svg>'],staticColors:["#993018","#444444","#D18F36","#315F9C"]};class o{static findTierByIndex(e,t){return e.find((e=>e.index===t))||null}static findTierByName(e,t){return e.find((e=>e.tier_name===t))||null}static getTierNameByIndex(e,t){return this.findTierByIndex(e,t)?.tier_name}static findCurrentTierIndex(e,t){if(!t)return 0;for(let r=t.length-1;r>=0;r--)if(e>=t[r].threshold)return t[r].index;return 0}}const n=class{constructor(t){e(this,t),this.currentTierIndex=0,this.canRender=!1,this.isLoading=!1,this.handleTabClick=e=>{this.activeTabTier=e},salla.lang.onLoaded((()=>{this.loyaltyProgramText=salla.lang.get("blocks.tiered_offer.program_title"),this.currentTierText=salla.lang.get("blocks.tiered_offer.current_tier"),this.discountText=salla.lang.get("blocks.tiered_offer.discount"),this.benefitText=salla.lang.get("blocks.tiered_offer.tier_description")}))}async componentWillLoad(){try{if(await salla.onReady(),!this.checkFeatureEnabled())return;if(!this.checkCartExists())return;this.isLoading=!0;const e=await this.fetchTieredOfferData();if(!e)return;this.initializeComponent(e)}catch(e){this.canRender=!1,salla.logger.warn("salla-tiered-offer:: ",e)}finally{this.isLoading=!1}}checkFeatureEnabled(){return salla.config.get("store.features")?.includes("tiered-offer")}checkCartExists(){return!!salla.storage.get("cart")?.summary?.count}validateCouponCompatibility(e,t){return!(t&&!e.details?.applied_with_coupon)}async fetchTieredOfferData(){try{const{data:e}=await salla.api.cart.offers(),t=e.find((e=>"tiered_offer"===e.type));return t?this.validateCouponCompatibility(t,salla.storage.get("cart")?.coupon)?t:(this.canRender=!1,null):null}catch(e){throw e}}initializeComponent(e){this.apiOfferData=e,this.tieredOfferData=this.mapApiDataToTiers(this.apiOfferData),this.loyaltyProgramText=this.apiOfferData.title||this.loyaltyProgramText;const t=this.findCurrentTierIndex(this.apiOfferData.details?.current_value||0);0!==t?(this.currentTierIndex=t,this.currentTier=o.getTierNameByIndex(this.tieredOfferData.tiers,t),this.activeTabTier=this.currentTier,this.canRender=!0):this.canRender=!1}componentDidLoad(){salla.event.on("cart::updated",(async e=>{const t=await this.fetchTieredOfferData();t&&this.updateOfferValues(e,t)}))}mapApiDataToTiers(e){const t=[...e.details.discounts].sort(((e,t)=>e.min_spend-t.min_spend)).map(((e,t)=>({name:e.name,tier_name:e.name,discount:e.type===s.PERCENTAGE?`${salla.helpers.number(e.value)}%`:salla.money(e.value),icon:i.staticIcons[t]||i.staticIcons[0],threshold:e.min_spend,text_color:i.staticColors[t],index:t+1})));return{current_tier:o.getTierNameByIndex(t,this.findCurrentTierIndex(e.details.current_value,t)),tiers:t}}findCurrentTierIndex(e,t=this.tieredOfferData?.tiers){return o.findCurrentTierIndex(e,t||[])}updateOfferValues(e,t){if(!t||!this.tieredOfferData)return;if(!this.validateCouponCompatibility(t,e.coupon))return void(this.canRender=!1);if(this.canRender=!0,!1===t.details?.with_current_cart)return;const r=t.details?.current_value||0;this.apiOfferData=t;const s=this.findCurrentTierIndex(r);0!==s?(this.canRender=!0,this.currentTierIndex=s,this.currentTier=o.getTierNameByIndex(this.tieredOfferData.tiers,s),this.activeTabTier!==this.currentTier&&(this.activeTabTier=this.currentTier)):this.canRender=!1}getLoadingSkeletonView(){return t(r,null,t("div",{class:"s-tiered-offer-container"},t("div",{class:"s-tiered-offer-skeleton-wrapper"},t("div",{class:"s-tiered-offer-skeleton-title"},t("salla-skeleton",{height:"16px",width:"40%"})),t("div",{class:"s-tiered-offer-skeleton-subtitle"},t("salla-skeleton",{height:"20px",width:"60%"})),t("div",{class:"s-tiered-offer-skeleton-progress"},t("salla-skeleton",{height:"16px",width:"100%"})),t("div",{class:"s-tiered-offer-skeleton-tabs"},t("salla-skeleton",{height:"50px",width:"100%"})))))}getCurrentTierData(){return o.findTierByIndex(this.tieredOfferData.tiers,this.currentTierIndex)||this.tieredOfferData.tiers[0]}getProgressWidth(){const e=this.tieredOfferData.tiers.length;return this.findCurrentTierIndex(this.apiOfferData.details?.current_value||0)/e*100}calculateMilestonePosition(e,t){return 1===t?"calc(100% - 18px)":`${Math.max(2,Math.min(95,(e+1)/t*100-8/t))}%`}getMilestoneStyles(e,t,r){const s="rtl"===document.documentElement.dir,i=this.calculateMilestonePosition(t,r),o=e.name.length>6?"flex-end":"center";return{[s?"right":"left"]:i,alignItems:o,position:"absolute",transform:s?"translateX(50%)":"translateX(-50%)"}}getMilestoneIconStyles(e,t,r){return t?{color:e.text_color}:r?{color:"var(--color-primary)"}:{}}renderProgressBarBackground(e){return[t("div",{class:"s-tiered-offer-progress-bg"}),t("div",{class:"s-tiered-offer-progress-fill",style:{width:`${e}%`}})]}renderMilestoneIcon(e,r,s){const i=["s-tiered-offer-milestone-icon",r?"s-tiered-offer-milestone-active":"",s?"s-tiered-offer-milestone-completed":""].filter(Boolean).join(" ");return t("div",{class:i,style:this.getMilestoneIconStyles(e,r,s)},t("span",{innerHTML:e.icon}))}renderMilestoneName(e,r){return t("div",{class:"s-tiered-offer-milestone-name"},r&&t("span",{style:{color:e.text_color}},e.name))}renderMilestones(e,r){return t("div",{class:"s-tiered-offer-milestones-wrapper"},t("div",{class:1===r?"s-tiered-offer-single-milestone-justify-end":"s-tiered-offer-milestones"},this.tieredOfferData.tiers.map(((s,i)=>{const o=e>=s.threshold,n=s.tier_name===this.currentTier;return t("div",{class:"s-tiered-offer-milestone",style:this.getMilestoneStyles(s,i,r)},this.renderMilestoneIcon(s,n,o),this.renderMilestoneName(s,n))}))))}renderProgressBar(){const e=this.getProgressWidth(),r=this.tieredOfferData.tiers.length,s=this.apiOfferData.details?.current_value||0;return t("div",{class:"s-tiered-offer-progress-container"},t("div",{class:"s-tiered-offer-progress-wrapper"},this.renderProgressBarBackground(e),this.renderMilestones(s,r)))}renderTabs(){return t("div",{class:"s-tiered-offer-tabs-container"},t("div",{class:"s-tiered-offer-tab-headers"},this.tieredOfferData.tiers.map((e=>t("button",{class:"s-tiered-offer-tab-header "+(e.tier_name===this.activeTabTier?"s-tiered-offer-tab-active":""),onClick:()=>this.handleTabClick(e.tier_name)},t("span",null,e.name))))),t("div",{class:"s-tiered-offer-tab-content-wrapper"},(()=>{const e=o.findTierByName(this.tieredOfferData.tiers,this.activeTabTier);return e?t("div",{class:"s-tiered-offer-tab-content"},t("div",{class:"s-tiered-offer-tab-content-inner"},t("div",{class:"s-tiered-offer-discount-section"},t("p",{class:"s-tiered-offer-discount-title"},this.discountText," ",t("span",{innerHTML:e.discount})),t("p",{class:"s-tiered-offer-benefit-description"},this.benefitText," ",e.name)))):null})()))}render(){if(this.isLoading)return this.getLoadingSkeletonView();if(!this.canRender||!this.tieredOfferData)return null;const e=this.getCurrentTierData();return t(r,null,t("div",{class:"s-tiered-offer-container"},t("div",{class:"s-tiered-offer-header"},t("div",{class:"s-tiered-offer-header-content"},t("p",{class:"s-tiered-offer-program-title"},this.loyaltyProgramText),t("div",{class:"s-tiered-offer-current-tier-name-wrapper"},t("h2",{class:"s-tiered-offer-current-tier"},this.currentTierText," ",t("span",{class:"s-tiered-offer-tier-name"},e.name)),t("span",{innerHTML:e.icon})))),this.renderProgressBar(),this.renderTabs()))}};n.style=".s-tiered-offer-milestone-icon svg{color:currentColor}.s-tiered-offer-milestone-icon svg path{stroke:currentColor;fill:none}.s-tiered-offer-milestone-icon.s-tiered-offer-milestone-active svg path,.s-tiered-offer-milestone-icon.s-tiered-offer-milestone-completed svg path{fill:currentColor;stroke:none}.s-tiered-offer-milestone-icon.s-tiered-offer-milestone-active svg[fill=none] path,.s-tiered-offer-milestone-icon.s-tiered-offer-milestone-completed svg[fill=none] path{fill:none;stroke:currentColor}[dir=rtl] .s-tiered-offer-progress-wrapper .s-tiered-offer-progress-bg{transform:scaleX(-1)}[dir=rtl] .s-tiered-offer-progress-wrapper .s-tiered-offer-progress-fill{transform:scaleX(-1);left:auto}[dir=rtl] .flip-x{transform:scaleX(-1)}";export{n as salla_tiered_offer}
|
|
4
|
+
import{r as e,h as t,H as r}from"./p-DKAYrLM1.js";var s;!function(e){e.PERCENTAGE="percentage",e.FIXED="fixed"}(s||(s={}));const i={staticIcons:['<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="40" height="40" color="#000000" fill="none">\n <path d="M13.7276 3.44418L15.4874 6.99288C15.7274 7.48687 16.3673 7.9607 16.9073 8.05143L20.0969 8.58575C22.1367 8.92853 22.6167 10.4206 21.1468 11.8925L18.6671 14.3927C18.2471 14.8161 18.0172 15.6327 18.1471 16.2175L18.8571 19.3125C19.417 21.7623 18.1271 22.71 15.9774 21.4296L12.9877 19.6452C12.4478 19.3226 11.5579 19.3226 11.0079 19.6452L8.01827 21.4296C5.8785 22.71 4.57865 21.7522 5.13859 19.3125L5.84851 16.2175C5.97849 15.6327 5.74852 14.8161 5.32856 14.3927L2.84884 11.8925C1.389 10.4206 1.85895 8.92853 3.89872 8.58575L7.08837 8.05143C7.61831 7.9607 8.25824 7.48687 8.49821 6.99288L10.258 3.44418C11.2179 1.51861 12.7777 1.51861 13.7276 3.44418Z" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path>\n</svg>','<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" color="#000000" fill="none">\n <path d="M3 12C7.5 12 12 7.5 12 3C12 7.5 16.5 12 21 12C16.5 12 12 16.5 12 21C12 16.5 7.5 12 3 12Z" stroke="currentColor" stroke-width="1.5" stroke-linejoin="round"></path>\n <path d="M2 19.5C2.83333 19.5 4.5 17.8333 4.5 17C4.5 17.8333 6.16667 19.5 7 19.5C6.16667 19.5 4.5 21.1667 4.5 22C4.5 21.1667 2.83333 19.5 2 19.5Z" stroke="currentColor" stroke-width="1.5" stroke-linejoin="round"></path>\n <path d="M16 5C17 5 19 3 19 2C19 3 21 5 22 5C21 5 19 7 19 8C19 7 17 5 16 5Z" stroke="currentColor" stroke-width="1.5" stroke-linejoin="round"></path>\n</svg>','<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="40" height="40" color="#000000" fill="none">\n <path d="M14.2644 18.3717C14.5806 17.407 14.7387 16.9247 15.0616 16.593C15.215 16.4354 15.3932 16.3048 15.5887 16.2066C16.0003 16 16.5003 16 17.5002 16C18.5001 16 19.0001 16 19.4116 16.2066C19.6072 16.3048 19.7853 16.4354 19.9388 16.593C20.2617 16.9247 20.4198 17.407 20.736 18.3717L21.0624 19.3675C21.4561 20.5688 21.653 21.1694 21.3587 21.5847C21.0643 22 20.4418 22 19.1966 22H15.8038C14.5586 22 13.936 22 13.6417 21.5847C13.3473 21.1694 13.5442 20.5688 13.938 19.3675L14.2644 18.3717Z" stroke="currentColor" stroke-width="1.5"></path>\n <path d="M8.76421 10.3717C9.08041 9.40705 9.23851 8.92471 9.56143 8.59298C9.71485 8.43537 9.89299 8.3048 10.0885 8.20663C10.5001 8 11.0001 8 12 8C12.9999 8 13.4999 8 13.9115 8.20663C14.107 8.3048 14.2851 8.43537 14.4386 8.59298C14.7615 8.92471 14.9196 9.40705 15.2358 10.3717L15.5622 11.3675C15.956 12.5688 16.1528 13.1694 15.8585 13.5847C15.5642 14 14.9416 14 13.6964 14H10.3036C9.05842 14 8.43585 14 8.1415 13.5847C7.84716 13.1694 8.04404 12.5688 8.43779 11.3675L8.76421 10.3717Z" stroke="currentColor" stroke-width="1.5"></path>\n <path d="M3.26439 18.3717C3.58059 17.407 3.73869 16.9247 4.06162 16.593C4.21504 16.4354 4.39317 16.3048 4.58872 16.2066C5.00031 16 5.50027 16 6.50018 16C7.5001 16 8.00006 16 8.41165 16.2066C8.6072 16.3048 8.78533 16.4354 8.93875 16.593C9.26167 16.9247 9.41977 17.407 9.73597 18.3717L10.0624 19.3675C10.4561 20.5688 10.653 21.1694 10.3587 21.5847C10.0643 22 9.44176 22 8.19661 22H4.80375C3.5586 22 2.93603 22 2.64169 21.5847C2.34735 21.1694 2.54422 20.5688 2.93797 19.3675L3.26439 18.3717Z" stroke="currentColor" stroke-width="1.5"></path>\n <path d="M12 2V4M7.5 3.5L9 5M16.5 3.5L15 5" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"></path>\n</svg>','<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" color="#000000" fill="none">\n <path d="M5.78223 4.18192C6.43007 3.68319 6.754 3.43383 7.12788 3.27323C7.29741 3.20041 7.47367 3.14158 7.65459 3.09741C8.0536 3 8.4767 3 9.32289 3H14.6771C15.5233 3 15.9464 3 16.3454 3.09741C16.5263 3.14158 16.7026 3.20041 16.8721 3.27323C17.246 3.43383 17.5699 3.68319 18.2178 4.18192C20.3644 5.83448 21.4378 6.66077 21.8057 7.73078C21.9694 8.20673 22.0305 8.70728 21.9858 9.20461C21.8852 10.3227 21.0379 11.346 19.3433 13.3925L15.3498 18.2153C13.8126 20.0718 13.044 21 12 21C10.956 21 10.1874 20.0718 8.65018 18.2153L4.65671 13.3925C2.96208 11.346 2.11476 10.3227 2.0142 9.20461C1.96947 8.70728 2.03064 8.20673 2.1943 7.73078C2.56224 6.66077 3.63557 5.83448 5.78223 4.18192Z" stroke="currentColor" stroke-width="1.5"></path>\n <path d="M10 8.5H14" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path>\n</svg>'],staticColors:["#993018","#444444","#D18F36","#315F9C"]};class o{static findTierByIndex(e,t){return e.find((e=>e.index===t))||null}static findTierByName(e,t){return e.find((e=>e.tier_name===t))||null}static getTierNameByIndex(e,t){return this.findTierByIndex(e,t)?.tier_name}static findCurrentTierIndex(e,t){if(!t)return 0;for(let r=t.length-1;r>=0;r--)if(e>=t[r].threshold)return t[r].index;return 0}}const n=class{constructor(t){e(this,t),this.currentTierIndex=0,this.canRender=!1,this.isLoading=!1,this.handleTabClick=e=>{this.activeTabTier=e},salla.lang.onLoaded((()=>{this.loyaltyProgramText=salla.lang.get("blocks.tiered_offer.program_title"),this.currentTierText=salla.lang.get("blocks.tiered_offer.current_tier"),this.discountText=salla.lang.get("blocks.tiered_offer.discount"),this.benefitText=salla.lang.get("blocks.tiered_offer.tier_description")}))}async componentWillLoad(){try{if(await salla.onReady(),!this.checkFeatureEnabled())return;if(!this.checkCartExists())return;this.isLoading=!0;const e=await this.fetchTieredOfferData();if(!e)return;this.initializeComponent(e)}catch(e){this.canRender=!1,salla.logger.warn("salla-tiered-offer:: ",e)}finally{this.isLoading=!1}}checkFeatureEnabled(){return salla.config.get("store.features")?.includes("tiered-offer")}checkCartExists(){return!!salla.storage.get("cart")?.summary?.count}validateCouponCompatibility(e,t){return!(t&&!e.details?.applied_with_coupon)}async fetchTieredOfferData(){try{const{data:e}=await salla.api.cart.offers(),t=e.find((e=>"tiered_offer"===e.type));return t?this.validateCouponCompatibility(t,salla.storage.get("cart")?.coupon)?t:(this.canRender=!1,null):null}catch(e){throw e}}initializeComponent(e){this.apiOfferData=e,this.tieredOfferData=this.mapApiDataToTiers(this.apiOfferData),this.loyaltyProgramText=this.apiOfferData.title||this.loyaltyProgramText;const t=this.findCurrentTierIndex(this.apiOfferData.details?.current_value||0);0!==t?(this.currentTierIndex=t,this.currentTier=o.getTierNameByIndex(this.tieredOfferData.tiers,t),this.activeTabTier=this.currentTier,this.canRender=!0):this.canRender=!1}componentDidLoad(){salla.event.on("cart::updated",(async e=>{const t=await this.fetchTieredOfferData();t&&this.updateOfferValues(e,t)}))}mapApiDataToTiers(e){const t=[...e.details.discounts].sort(((e,t)=>e.min_spend-t.min_spend)).map(((e,t)=>({name:e.name,tier_name:e.name,discount:e.type===s.PERCENTAGE?`${salla.helpers.number(e.value)}%`:salla.money(e.value),icon:i.staticIcons[t]||i.staticIcons[0],threshold:e.min_spend,text_color:i.staticColors[t],index:t+1})));return{current_tier:o.getTierNameByIndex(t,this.findCurrentTierIndex(e.details.current_value,t)),tiers:t}}findCurrentTierIndex(e,t=this.tieredOfferData?.tiers){return o.findCurrentTierIndex(e,t||[])}updateOfferValues(e,t){if(!t||!this.tieredOfferData)return;if(!this.validateCouponCompatibility(t,e.coupon))return void(this.canRender=!1);if(this.canRender=!0,!1===t.details?.with_current_cart)return;const r=t.details?.current_value||0;this.apiOfferData=t;const s=this.findCurrentTierIndex(r);0!==s?(this.canRender=!0,this.currentTierIndex=s,this.currentTier=o.getTierNameByIndex(this.tieredOfferData.tiers,s),this.activeTabTier!==this.currentTier&&(this.activeTabTier=this.currentTier)):this.canRender=!1}getLoadingSkeletonView(){return t(r,null,t("div",{class:"s-tiered-offer-container"},t("div",{class:"s-tiered-offer-skeleton-wrapper"},t("div",{class:"s-tiered-offer-skeleton-title"},t("salla-skeleton",{height:"16px",width:"40%"})),t("div",{class:"s-tiered-offer-skeleton-subtitle"},t("salla-skeleton",{height:"20px",width:"60%"})),t("div",{class:"s-tiered-offer-skeleton-progress"},t("salla-skeleton",{height:"16px",width:"100%"})),t("div",{class:"s-tiered-offer-skeleton-tabs"},t("salla-skeleton",{height:"50px",width:"100%"})))))}getCurrentTierData(){return o.findTierByIndex(this.tieredOfferData.tiers,this.currentTierIndex)||this.tieredOfferData.tiers[0]}getProgressWidth(){const e=this.tieredOfferData.tiers.length;return this.findCurrentTierIndex(this.apiOfferData.details?.current_value||0)/e*100}calculateMilestonePosition(e,t){return 1===t?"calc(100% - 18px)":`${Math.max(2,Math.min(95,(e+1)/t*100-8/t))}%`}getMilestoneStyles(e,t,r){const s="rtl"===document.documentElement.dir,i=this.calculateMilestonePosition(t,r),o=e.name.length>6?"flex-end":"center";return{[s?"right":"left"]:i,alignItems:o,position:"absolute",transform:s?"translateX(50%)":"translateX(-50%)"}}getMilestoneIconStyles(e,t,r){return t?{color:e.text_color}:r?{color:"var(--color-primary)"}:{}}renderProgressBarBackground(e){return[t("div",{class:"s-tiered-offer-progress-bg"}),t("div",{class:"s-tiered-offer-progress-fill",style:{width:`${e}%`}})]}renderMilestoneIcon(e,r,s){const i=["s-tiered-offer-milestone-icon",r?"s-tiered-offer-milestone-active":"",s?"s-tiered-offer-milestone-completed":""].filter(Boolean).join(" ");return t("div",{class:i,style:this.getMilestoneIconStyles(e,r,s)},t("span",{innerHTML:e.icon}))}renderMilestoneName(e,r){return t("div",{class:"s-tiered-offer-milestone-name"},r&&t("span",{style:{color:e.text_color}},e.name))}renderMilestones(e,r){return t("div",{class:"s-tiered-offer-milestones-wrapper"},t("div",{class:1===r?"s-tiered-offer-single-milestone-justify-end":"s-tiered-offer-milestones"},this.tieredOfferData.tiers.map(((s,i)=>{const o=e>=s.threshold,n=s.tier_name===this.currentTier;return t("div",{class:"s-tiered-offer-milestone",style:this.getMilestoneStyles(s,i,r)},this.renderMilestoneIcon(s,n,o),this.renderMilestoneName(s,n))}))))}renderProgressBar(){const e=this.getProgressWidth(),r=this.tieredOfferData.tiers.length,s=this.apiOfferData.details?.current_value||0;return t("div",{class:"s-tiered-offer-progress-container"},t("div",{class:"s-tiered-offer-progress-wrapper"},this.renderProgressBarBackground(e),this.renderMilestones(s,r)))}renderTabs(){return t("div",{class:"s-tiered-offer-tabs-container"},t("div",{class:"s-tiered-offer-tab-headers"},this.tieredOfferData.tiers.map((e=>t("button",{class:"s-tiered-offer-tab-header "+(e.tier_name===this.activeTabTier?"s-tiered-offer-tab-active":""),onClick:()=>this.handleTabClick(e.tier_name)},t("span",null,e.name))))),t("div",{class:"s-tiered-offer-tab-content-wrapper"},(()=>{const e=o.findTierByName(this.tieredOfferData.tiers,this.activeTabTier);return e?t("div",{class:"s-tiered-offer-tab-content"},t("div",{class:"s-tiered-offer-tab-content-inner"},t("div",{class:"s-tiered-offer-discount-section"},t("p",{class:"s-tiered-offer-discount-title"},this.discountText," ",t("span",{innerHTML:e.discount})),t("p",{class:"s-tiered-offer-benefit-description"},this.benefitText," ",e.name)))):null})()))}render(){if(this.isLoading)return this.getLoadingSkeletonView();if(!this.canRender||!this.tieredOfferData)return null;const e=this.getCurrentTierData();return t(r,null,t("div",{class:"s-tiered-offer-container"},t("div",{class:"s-tiered-offer-header"},t("div",{class:"s-tiered-offer-header-content"},t("p",{class:"s-tiered-offer-program-title"},this.loyaltyProgramText),t("div",{class:"s-tiered-offer-current-tier-name-wrapper"},t("h2",{class:"s-tiered-offer-current-tier"},this.currentTierText," ",t("span",{class:"s-tiered-offer-tier-name"},e.name)),t("span",{innerHTML:e.icon})))),this.renderProgressBar(),this.renderTabs()))}};n.style=".s-tiered-offer-milestone-icon svg{color:currentColor}.s-tiered-offer-milestone-icon svg path{stroke:currentColor;fill:none}.s-tiered-offer-milestone-icon.s-tiered-offer-milestone-active svg path,.s-tiered-offer-milestone-icon.s-tiered-offer-milestone-completed svg path{fill:currentColor;stroke:none}.s-tiered-offer-milestone-icon.s-tiered-offer-milestone-active svg[fill=none] path,.s-tiered-offer-milestone-icon.s-tiered-offer-milestone-completed svg[fill=none] path{fill:none;stroke:currentColor}[dir=rtl] .s-tiered-offer-progress-wrapper .s-tiered-offer-progress-bg{transform:scaleX(-1)}[dir=rtl] .s-tiered-offer-progress-wrapper .s-tiered-offer-progress-fill{transform:scaleX(-1);left:auto}[dir=rtl] .flip-x{transform:scaleX(-1)}";export{n as salla_tiered_offer}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as a,h as t,H as l}from"./p-
|
|
4
|
+
import{r as a,h as t,H as l}from"./p-DKAYrLM1.js";const s=class{constructor(t){a(this,t),this.isLoading=!1,this.nextPageUrl="",this.handleClick=()=>{this.loadMoreTransactions()}}componentWillLoad(){return salla.onReady().then((()=>this.loadTransactions()))}async loadTransactions(){this.isLoading=!0;try{let a="/balance/wallet?per_page=10&page=1",t=await salla.api.request(a);this.nextPageUrl=t.data.transactions.next_page_url,this.transactionsArray=t.data.transactions,this.balance=t.data.balance}catch(a){console.error("Error loading wallet transactions",a)}finally{this.isLoading=!1}}async loadMoreTransactions(){this.isLoading=!0;try{let a=this.nextPageUrl||"/balance/wallet?page=2&per_page=10",t=await salla.api.request(a);this.nextPageUrl=t.data.transactions.next_page_url,this.transactionsArray.push(...t.data.transactions.data),this.balance=t.data.balance}catch(a){console.error("Error loading wallet transactions",a)}finally{this.isLoading=!1}}render(){return this.transactionsArray.length>0?t(l,null,t("table",{class:"s-wallet-table"},t("tbody",{class:"s-wallet-table-tbody"},t("tr",{class:"s-table__tr"},t("td",null,t("div",{class:"s-wallet-table-balance-container"},t("i",{class:"s-wallet-table-balance-icon sicon-wallet"}),t("div",null,t("div",{innerHTML:salla.money(this.balance)}),t("div",{class:"font-normal text-gray-400"}," ",salla.lang.get("pages.wallet.balance")))))))),t("h2",{style:{"margin-top":"32px"}},salla.lang.get("pages.wallet.title")),t("table",{class:"s-wallet-table"},t("thead",{class:"s-wallet-table-head"},t("tr",{class:"s-wallet-table-head-tr"},t("th",{scope:"col"},salla.lang.get("pages.wallet.transaction_number")),t("th",{scope:"col",class:"s-wallet-table-head-tr-th"},salla.lang.get("pages.wallet.amount")),t("th",{scope:"col",class:"s-wallet-table-head-tr-th"},salla.lang.get("pages.wallet.date")),t("th",{scope:"col",class:"s-wallet-table-head-tr-th"},salla.lang.get("pages.wallet.order_no")),t("th",{scope:"col",class:"s-wallet-table-head-tr-th"},salla.lang.get("pages.wallet.expiry_date")),t("th",{scope:"col",class:"s-wallet-table-head-tr-th"},salla.lang.get("pages.wallet.transaction_type")," "))),t("tbody",{class:"s-wallet-table-tbody"},this.transactionsArray.map((a=>t("tr",{class:"s-wallet-table-tbody-tr s-wallet-table-tbody-tr-shadow animated"},t("td",{class:"s-wallet-table-tbody-tr-td"},t("div",{class:"s-wallet-table-tbody-tr-td-content"},t("span",{class:"s-wallet-mobile-title"},salla.lang.get("pages.wallet.transaction_number"),":"),a.id&&t("span",{class:"hidden md:inline-block"},"#",a.id),t("div",{class:"flex items-center md:hidden"},t("salla-button",{class:"relative",color:"dark",shape:"link","data-content":a.order_id},a.order_id&&t("span",null,"#",a.order_id))))),t("td",{id:"main123",class:"s-wallet-table-tbody-tr-td"},t("div",{id:"main124",class:"s-wallet-table-tbody-tr-td-content"},t("span",{id:"main125",class:"s-wallet-mobile-title"},salla.lang.get("pages.wallet.amount"),":"),t("div",{innerHTML:salla.money(a.amount)}))),t("td",{class:"s-wallet-table-tbody-tr-td"},t("div",{class:"s-wallet-table-tbody-tr-td-content"},t("span",{class:"s-wallet-mobile-title"},salla.lang.get("pages.wallet.date"),":"),a.created_at&&new Date(1e3*a.created_at).toLocaleDateString(salla.lang.locale,{weekday:"long",year:"numeric",month:"long",day:"numeric",hour:"numeric"}))),t("td",{id:"main133",class:"s-wallet-table-tbody-tr-td"},t("div",{id:"main134",class:"s-wallet-table-tbody-tr-td-content"},t("span",{id:"main135",class:"s-wallet-mobile-title"},salla.lang.get("pages.wallet.order_no"),":"),t("span",{class:"rtl:mr-auto ltr:ml-auto md:mx-0"},a.order_id&&t("span",null,"#",a.order_id)))),t("td",{id:"main143",class:"s-wallet-table-tbody-tr-td"},t("div",{id:"main144",class:"s-wallet-table-tbody-tr-td-content"},t("span",{id:"main145",class:"s-wallet-mobile-title"},salla.lang.get("pages.wallet.expiry_date"),":"),t("span",null,a.expired_at&&new Date(1e3*a.expired_at).toLocaleDateString(salla.lang.locale,{weekday:"long",year:"numeric",month:"long",day:"numeric",hour:"numeric"})))),t("td",{class:"s-wallet-table-tbody-tr-td"},t("div",{class:"s-wallet-table-tbody-tr-td-content"},t("div",null,t("span",{class:"s-wallet-mobile-title"},salla.lang.get("pages.wallet.transaction_type"),":")),t("div",{class:{"s-wallet-table-transaction-status-default":!0,"s-wallet-table-transaction-status-cashback":"cashback"===a.action_type,"s-wallet-table-transaction-status-refund":"refund"===a.action_type,"s-wallet-table-transaction-status-purchase":"purchase_by_wallet"===a.action_type}},!!a.description&&t("i",{id:a.id.toString(),class:"sicon-information text-lg rtl:ml-4 ltr:mr-4 s-wallet-table-transaction-status-icon-success"}),!!a.description&&t("salla-tooltip",{text:a.description,targetId:a.id.toString()}),t("span",null,a.title))))))))),t("div",{class:"s-infinite-scroll-wrapper"},!!this.nextPageUrl&&t("salla-button",{onClick:this.handleClick,loading:this.isLoading},salla.lang.get("common.elements.load_more")))):t(l,null,t("h2",{style:{"margin-top":"32px"}},salla.lang.get("pages.wallet.title")),t("div",{class:"s-wallet-table-empty-state"},t("i",{class:"sicon-full-wallet"}),t("div",{class:"text-center p-3 text-xl font-bold "},salla.lang.get("pages.wallet.no_transactions")),t("div",{class:"text-center text-gray-400 text-sm font-normal "},salla.lang.get("pages.wallet.zero_balance")," ")))}};s.style=".s-wallet-table{min-width:100%}.s-wallet-table-balance-container{display:flex !important;align-items:center !important;justify-content:flex-start !important;gap:1rem}.s-wallet-table-balance-icon{border-radius:50%;width:52px;height:52px;font-size:25px;padding:16px 13px;background:var(--color-primary-reverse);color:var(--color-primary)}.s-wallet-table-empty-state{display:flex;flex-direction:column;align-items:center}.s-wallet-table-empty-state i{font-size:80px;margin:4rem 0 2rem;color:var(--infinte-color)}.s-wallet-table-transaction-status{padding:6px 19px !important;border-radius:20px;width:max-content;display:flex;align-items:center}.s-wallet-table-transaction-status-default{background:#fff6eb;color:#a46f29}.s-wallet-table-transaction-status-cashback{background:#effbf6;color:#00af6c}.s-wallet-table-transaction-status-refund{background:#ecf3fe;color:#5196f3}.s-wallet-table-transaction-status-purchase{background:#feecec;color:#f55157}.s-wallet-table-transaction-status-icons-success{color:#00af6c}";export{s as salla_wallet}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as s,h as e,a as t}from"./p-
|
|
4
|
+
import{r as s,h as e,a as t}from"./p-DKAYrLM1.js";var i,r;!function(s){s.ProductDetail="product.single",s.Cart="cart"}(i||(i={})),function(s){s.Conditional="conditional",s.PercentageOrFixed="fixed",s.DiscountsTable="discounts_table",s.Bank="bank",s.BuyXGetY="buy_x_get_y",s.SpecialPrice="special_price"}(r||(r={}));const a=class{constructor(e){s(this,e),this.productCardComponent="custom-salla-product-card",this.offersList=[],this.isMultipleBank=!1,this.isBankOffer=!1,this.canRender=!1,this.showOffer=salla.config.get("store.settings.product.show_special_offers"),this.offer_with_price_text=salla.lang.get("pages.offer.with_price",{price:""}),this.with_discount_text=salla.lang.get("pages.products.with_a_discount"),this.product_discount_text=salla.lang.get("pages.products.discount"),this.special_offer_text=salla.lang.get("pages.products.special_offer"),this.multipleBankOfferTitleText=salla.lang.get("pages.offer.multiple_bank_offers_title"),this.multipleBankOfferTitleDescription=salla.lang.get("pages.offer.multiple_bank_offers_message"),this.buy_quantity_text=s=>salla.lang.get("pages.offer.buy_quantity",{quantity:s}),salla.lang.onLoaded((()=>{this.offer_with_price_text=salla.lang.get("pages.offer.with_price"),this.with_discount_text=salla.lang.get("pages.products.with_a_discount"),this.product_discount_text=salla.lang.get("pages.products.discount"),this.special_offer_text=salla.lang.get("pages.products.special_offer"),this.multipleBankOfferTitleText=salla.lang.get("pages.offer.multiple_bank_offers_title"),this.multipleBankOfferTitleDescription=salla.lang.get("pages.offer.multiple_bank_offers_message"),this.buy_quantity_text(0)})),salla.onReady((()=>{this.currentPage=salla.config.get("page.slug"),this.userCurrency=salla.config.get("currencies")[salla.config.get("user.currency_code")].symbol})),this.categorySlot=this.host.querySelector('[slot="category"]')?.innerHTML||'<a href={url} class="s-offer-slide-cat-entry"><i class={icon}></i><h4>{name}</h4></a>'}async getEndpointByPageName(){return this.currentPage==i.Cart?`offers/cart/${await Salla.cart.getCurrentCartId()}`:this.currentPage==i.ProductDetail?`offers/product/${salla.config.get("page.id")}`:"offers"}emitPromotionViewed(){this.offersList.length&&this.canRender&&this.showOffer&&salla.event.emit("promotion::viewed",[{id:this.offersList[0].id,name:this.offersList[0].title,creative:this.offersList[0].description||"",position:1}])}emitPromotionClicked(s=1){this.offersList.length&&this.canRender&&this.showOffer&&salla.event.emit("promotion::clicked",[{id:this.offersList[0].id,name:this.offersList[0].title,creative:this.offersList[0].description||"",position:s}])}componentWillLoad(){return this.hasCustomComponent=!!customElements.get(this.productCardComponent),new Promise((s=>salla.onReady(s))).then((()=>{if(this.showOffer=!salla.url.is_page("product.single")||salla.config.get("store.settings.product.show_special_offers"),!this.showOffer)throw new Error("Merchant disabled showing the offers on product page")})).then((async()=>salla.api.request(await this.getEndpointByPageName()))).then((s=>{if(!(this.offersList=s.data).length)throw new Error("salla-offers:: There is no offers!");const e=this.offersList.find((s=>[r.SpecialPrice,r.Bank,r.BuyXGetY,r.DiscountsTable].includes(s.type)));if(!e)throw new Error("salla-offers:: Offer type not supported yet!");if(e.type===r.DiscountsTable)return this.offersList=[e];if(this.isBankOffer=e.type===r.Bank)return this.offersList=this.offersList.filter((s=>s.type===r.Bank)),this.isMultipleBank=this.offersList.length>1,this.offersList;if(e.type===r.SpecialPrice){const s=e.details;return"product"===s.apply_to?salla.product.api.fetch({source:"selected",source_value:s.targets}).then((s=>(e.details.products=s.data,this.offersList=[e]))):salla.product.api.categories().then((t=>{const i=this.findCategories(t.data,s.targets);return e.details.categories=i,this.offersList=[e]}))}const t=e.details.get;return"products"===t.source?salla.product.api.fetch({source:"selected",source_value:t.source_value}).then((s=>(t.products=s.data,e.details.get=t,this.offersList=[e]))):salla.product.api.categories().then((s=>(t.categories=this.findCategories(s.data,t.source_value),e.details.get=t,this.offersList=[e])))})).then((s=>{salla.storage.set(this.getStorageKey(),{offers:s,stored_at:(new Date).getTime()}),this.canRender=!0})).catch((s=>{salla.logger.warn(s)}))}componentDidLoad(){let s=this.host.querySelector(".s-slider-block__title-nav");s?.classList.add("s-offer-bank-payment-nav"),this.emitPromotionViewed()}findCategories(s,e){let t=[];for(const i of s)e.includes(i.id_||i.id)&&t.push(i),i.sub_categories?.length>0&&(t=t.concat(this.findCategories(i.sub_categories,e)));return t}getStorageKey(){try{const s=salla.config.get("page.slug").replace(".","_"),e=salla.lang.getLocale(),t=salla.config.currency().code;if(!s||!e||!t)throw new Error("Unable to get the storage key.");return`s-offers-${s}-${salla.config.get("page.id")}-${e}-${t}`}catch(s){return""}}getOffersFromStorage(){let s=salla.storage.get(this.getStorageKey());return!s||s.stored_at<(new Date).getTime()-6e5?(salla.storage.remove(this.getStorageKey()),null):(this.canRender=!0,Promise.resolve(s.offers))}render(){if(!this.offersList.length||!this.canRender||!this.showOffer)return null;const s=this.offersList[0],t={"block-title":this.isBankOffer?this.isMultipleBank?this.multipleBankOfferTitleText:null:s.title,"block-subTitle":this.isBankOffer?this.isMultipleBank?this.multipleBankOfferTitleDescription:null:s.description,"show-controls":this.isMultipleBank};return e("div",{class:"s-offer-wrapper",onClick:()=>this.emitPromotionClicked()},e("p",{class:"s-offer-corner-badge"},this.special_offer_text),e("salla-slider",{type:"carousel",id:"offer-slider",...t},e("div",{slot:"items"},this.renderSectionForOfferType(s.type))))}renderSectionForOfferType(s){return this.isBankOffer?this.renderBankSection():s==r.SpecialPrice?this.renderSpecialPriceSection():s==r.BuyXGetY?this.renderBuyXGetYSection():this.renderDiscountTableSection()}getCategoriesSection(s){return e("div",{class:"s-offer-slide-one-sixth swiper-slide",innerHTML:this.categorySlot.replace(/\{url\}/g,s.url).replace(/\{icon\}/g,s.icon||"sicon-store").replace(/\{name\}/g,s.name)})}renderBuyXGetYSection(){const s=this.offersList[0].details;return[s.get.products?.map((s=>e("div",{class:"s-offer-slide-one-fourth"},this.hasCustomComponent?e(this.productCardComponent,{product:s}):e("salla-product-card",{"shadow-on-hover":!0,product:s})))),s.get.categories?.map((s=>this.getCategoriesSection(s)))]}renderBankSection(){return this.offersList.map((s=>e("div",{class:{"s-offer-slide-one-sixth":this.isMultipleBank,"s-offer-bank-wrapper-sinlge-item":!this.isMultipleBank}},e("div",{class:{"s-offer-bank-wrapper":!0,"s-offer-slide-one-sixth":!this.isMultipleBank,"s-offer-bank-wrapper-multi-spacer":this.isMultipleBank}},e("div",{class:"s-offer-bank-logo"},e("img",{src:s.details.logo||salla.url.cdn("images/s-empty.png"),"data-src":s.details.logo,alt:s.title+" offer"})),e("ul",{class:"s-offer-bank-payment-wrapper"},s.details.payments.map((s=>e("li",{class:"s-offer-bank-payment-single"},e("img",{src:salla.url.cdn("images/payment/"+s+".png")||salla.url.cdn("images/s-empty.png"),"data-src":salla.url.cdn("images/payment/"+s+".png"),alt:"payment"}))))),this.isMultipleBank?e("p",{class:"s-offer-bank-payment-discount-percent"},`${this.product_discount_text} ${s.details.discount_value}${"percentage"===s.details.discount_type&&"%"}`):""),this.isMultipleBank?"":e("div",{class:"s-offer-bank-message s-offer-slide-one-fourth"},e("h2",null,this.offersList[0].title),e("p",{innerHTML:this.generateBankDescription(this.offersList[0].description,s.details.discount_value)})))))}generateBankDescription(s,e){return s.replace(new RegExp(`${e} %`),`<span class="s-offer-bank-message-amount">${e} %</span>`)}renderDiscountTableSection(){let s=this.offersList[0].details.show_price_after_discount;return this.offersList[0].details.discounts?.map((t=>e("div",{class:"s-offer-slide-one-fourth"},e("div",{class:"s-offer-slide-offer-entry"},e("div",{class:"s-offer-slide-offer-entry-price-quantity-container"},e("p",{class:"s-offer-slide-offer-entry-quantity"},this.buy_quantity_text(t.quantity)),s?e("div",{class:"s-offer-slide-offer-entry-price"},e("span",null,this.offer_with_price_text),e("span",{class:"s-offer-slide-offer-entry-price-amount"},t.discounted_amount)," ",e("span",null,this.userCurrency)):""),e("p",{class:"s-offer-slide-offer-entry-price-amount-percent"},this.with_discount_text,"(",e("span",null,t.percentage,!!t.percentage&&"%"),")")))))}renderSpecialPriceSection(){const s=this.offersList[0].details;return["product"===s.apply_to&&s.products?.map((s=>e("div",{class:"s-offer-slide-one-fourth"},this.hasCustomComponent?e(this.productCardComponent,{product:s}):e("salla-product-card",{"shadow-on-hover":!0,product:s})))),"category"===s.apply_to&&s.categories?.map((s=>this.getCategoriesSection(s)))]}get host(){return t(this)}};a.style='.s-offer-wrapper .s-slider-block__title h2{font-size:1.125rem;line-height:1.75rem;color:#f87171}.s-offer-wrapper .s-slider-block__title h2::before{font-family:"sallaicons";content:"\\ee30" !important;position:absolute;top:1rem;font-size:3rem;font-weight:400;line-height:1;color:#fef2f2}.s-offer-bank-wrapper-sinlge-item{display:flex;align-items:center !important;gap:14px}.s-offer-bank-wrapper{display:flex !important;width:100% !important}';export{a as salla_offer}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as s,h as t,H as a,a as i}from"./p-
|
|
4
|
+
import{r as s,h as t,H as a,a as i}from"./p-DKAYrLM1.js";const e=class{constructor(t){s(this,t),this.exclude=[]}componentWillLoad(){return salla.onReady().then((()=>{if("string"==typeof this.exclude)try{this.exclude=JSON.parse(this.exclude)}catch(s){salla.logger.error("salla-payments:: failed to parse the exclude props!",this.exclude),this.exclude=[]}this.placeholderImage=salla.url.cdn("images/s-empty.png"),this.paymentSlot=this.host.querySelector('[slot="payment"]')?.innerHTML||`<li class="s-payments-list-item"><img class="lazy" width="100%" height="100%" src="${this.placeholderImage}" data-src="{image}" alt={payment} /><li>`,this.sbcSlot=this.host.querySelector('[slot="sbc"]')?.innerHTML||`<li class="s-payments-list-item"><a target="_blank" href="{link}"> <img width="100%" height="100%" src="${this.placeholderImage}" data-src={image} class="lazy s-payments-sbc-image" alt="SBC"/></a><li>`,this.codSlot=this.host.querySelector('[slot="cod"]')?.innerHTML||`<li class="s-payments-list-item"> <img width="100%" height="100%" src="${this.placeholderImage}" data-src={image} class="lazy" alt="COD"/><li>`,this.payments=salla.config.get("store.settings.payments")}))}render(){const s=!this.exclude.includes("made-in-ksa")&&salla.config.get("store.settings.made_in_ksa"),i=this.exclude.includes("sbc")?null:salla.config.get("store.settings.certificate.id");return t(a,{key:"8276f249b8d93b9bffbe2c41f19c0ae1c9dd38e3",class:"s-payments-list-wrap"},t("ul",{key:"e224c241d5a9a80addf788741b582e5ce50361be",class:"s-payments-list"},s&&t("li",{key:"5402987d68874ad1b51b44fb2ded39f95ab076bc",class:"s-payments-list-item"},t("img",{key:"8d8cb75b6b3b4975e23b4c12586844a1fdd32a5c",class:"lazy",width:"100%",height:"100%",decoding:"async",loading:"lazy","data-src":salla.url.cdn("images/made-in-ksa.svg",58,58),alt:"made in KSA certified"})),this.payments.map((s=>t("div","cod"==s?{id:"cod-slot",innerHTML:this.codSlot.replace(/\{image\}/g,salla.url.cdn("images/payment/cod_mini.png",58,58))}:{id:"payment-slot",innerHTML:this.paymentSlot.replace(/\{image\}/g,salla.url.cdn(`images/payment/${s}_mini.png`,58,58)).replace(/\{payment\}/g,s)}))),i&&t("div",{key:"b4fb77e93619190b04b265198f8ccced369b85e5",id:"sbc-slot",innerHTML:this.sbcSlot.replace(/\{image\}/g,salla.url.cdn("images/sbc.png",58,58)).replace(/\{link\}/g,`https://eauthenticate.saudibusiness.gov.sa/certificate-details/${i}`)})))}componentDidLoad(){document.lazyLoadInstance?.update(this.host.querySelectorAll(".lazy")),this.host.querySelectorAll(".lazy").forEach((s=>{s.addEventListener("load",(()=>{s.setAttribute("width","100%"),s.setAttribute("height","100%")}))}))}componentDidRender(){this.host.querySelectorAll("#payment-slot").forEach((s=>s.replaceWith(s.firstChild))),this.host.querySelectorAll("#sbc-slot").forEach((s=>s.replaceWith(s.firstChild))),this.host.querySelectorAll("#cod-slot").forEach((s=>s.replaceWith(s.firstChild))),this.host.querySelector('[slot="payment"]')?.remove(),this.host.querySelector('[slot="sbc"]')?.remove(),this.host.querySelector('[slot="cod"]')?.remove()}get host(){return i(this)}};e.style=":host{display:block}";export{e as salla_payments}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as t,c as e,h as s,H as i}from"./p-
|
|
4
|
+
import{r as t,c as e,h as s,H as i}from"./p-DKAYrLM1.js";import{a}from"./p-BedNk7k1.js";const l=class{constructor(s){t(this,s),this.changed=e(this,"changed"),this.min=0,this.max=1e4,this.moreThanLabel="أكثر من",this.lessThanLabel="أقل من",this.toLabel="الى",this.fromLabel="من",this.typing=!1,this.isMin=!1,this.isRTL=salla.config.get("theme.is_rtl",!0),this.filterValues=[]}connectedCallback(){if(this.filtersData&&this.filtersData?.price&&(this.minPrice=this.filtersData.price.min,this.maxPrice=this.filtersData.price.max),salla.lang.onLoaded((()=>{this.moreThanLabel=salla.lang.getWithDefault("common.elements.more_than",this.moreThanLabel),this.lessThanLabel=salla.lang.getWithDefault("common.elements.less_than",this.lessThanLabel),this.toLabel=salla.lang.getWithDefault("common.elements.to",this.toLabel),this.fromLabel=salla.lang.getWithDefault("common.elements.from",this.fromLabel)})),1==this.option.values.length)return;if(this.option.values.length<=5)return void(this.filterValues=this.option.values);const t=Math.ceil(this.option.values.length/5);for(let e=0;e<this.option.values.length;e+=t)this.filterValues.push(this.option.values.slice(e,e+t).reduce(((t,e)=>(t.to=e.to,t.count+=e.count,t))))}async reset(){this.minInput.value=null,this.maxInput.value=null,this.minPrice=null,this.maxPrice=null}getPriceLabel(t){return isNaN(t.from)||t.from<1?`${this.lessThanLabel} ${salla.money(t.to)}`:isNaN(t.to)||t.to<1?`${this.moreThanLabel} ${salla.money(t.from)}`:`${salla.money(t.from)} ${this.toLabel} ${salla.money(t.to)}`}minInputValidation(t){t&&(t>this.max||this.maxPrice&&t>this.maxPrice)||(t<this.min?this.minPrice=this.min:t&&(this.minPrice=t))}maxInputValidation(t){t&&(t<this.min||this.minPrice&&t<this.minPrice)||t>this.max&&(this.maxPrice=this.max)}async changedEventHandler(t){salla.helpers.inputDigitsOnly(this.minInput),salla.helpers.inputDigitsOnly(this.maxInput);const e=this.minPrice?1*+this.minPrice:null,s=this.maxPrice?1*+this.maxPrice:null;this.maxPrice||(this.maxPrice=""),this.isMin?this.minInputValidation(e):(this.minPrice||(this.minPrice=0),this.maxInputValidation(s)),this.isReady&&this.changed.emit({event:t,option:this.option,value:{max:this.maxPrice,min:this.minPrice}})}handleMinMaxPrice(t,e){this.minPrice=e.from,this.maxPrice="*"!==e.to?e.to:"",this.changedEventHandler(t)}isChecked(t){return!(!this.minPrice&&!this.maxPrice)&&(((t.from<1||"*"==t.from)&&0==this.minPrice||t.from==this.minPrice)&&("*"==t.to||!t.to||t.to==this.maxPrice))}handleMinPrice(t){this.isMin=!0;const e=t.target.value;this.minPrice=""===e?0:e}handleMaxPrice(t){this.isMin=!1;const e=t.target.value;this.maxPrice=void 0===e?"":e}render(){return s(i,{key:"552a7f89180b1888c75f59f62eec181a2368121a"},this.filterValues.map(((t,e)=>s("label",{class:"s-filters-label",htmlFor:`${this.option.key}-${e}`,key:e},s("input",{id:`${this.option.key}-${e}`,name:"price",type:"radio",checked:this.isChecked(t),class:"s-filters-radio",onChange:e=>this.handleMinMaxPrice(e,t)}),s("span",{innerHTML:this.getPriceLabel(t)})))),s("div",{key:"312f58873bb27b320bfb007b4166069dd4878c5e",class:"flex justify-center items-center"},s("div",{key:"f224028f07314f9b072879981df3854047cad91a",class:"relative max-w-xl w-full"},s("div",{key:"4bd29b84e2c93ff56ce17d239c7630f161b9de06",class:"s-price-range-inputs"},s("div",{key:"17e1c8f73ed6c1d22e4bd7d23ebdb16d4b69ad68",class:"s-price-range-relative"},s("div",{key:"fd73e14ee31d8fbcc149e0af6089a6b902eb824c",class:"s-price-range-currency"}," ",salla.config.currency().symbol),s("input",{key:"2f5fc23ef544b3c4c6a7135246a069bfc9b2abac",type:"number",maxlength:"5",ref:t=>this.minInput=t,onBlur:t=>this.handleMinPrice(t),value:this.minPrice,placeholder:this.fromLabel,class:"s-price-range-number-input"})),s("div",{key:"d671109259f5ce6c206e9a3c7cf74ad53aa69966",class:"s-price-range-gray-text"}," -"),s("div",{key:"cea2f1d4a0d56adced021a8ca5d17ced39bbf18d",class:"s-price-range-relative"},s("div",{key:"c7fe13448b4d73a10f57729ac3f07928d37bd2ec",class:"s-price-range-currency"}," ",salla.config.currency().symbol),s("input",{key:"5c2791c4618717f48e31d46012774a42347b9eaf",type:"number",maxlength:"5",ref:t=>this.maxInput=t,onBlur:t=>this.handleMaxPrice(t),value:this.maxPrice,placeholder:this.toLabel,class:"s-price-range-number-input","aria-describedby":"price-currency"})),s("salla-button",{key:"4decec6d9296d73f5263df95fde23d739e04538f",color:"gray",shape:"icon",size:"small",fill:"outline",onClick:t=>this.changedEventHandler(t)},s("span",{key:"2149837cfc2b0723bcf9b1593badc23c8a6e4a14",innerHTML:this.isRTL?a:'\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>arrow-right</title>\n<path d="M29.217 15.465c-0.019-0.044-0.056-0.077-0.080-0.119-0.067-0.116-0.139-0.227-0.236-0.317-0.011-0.009-0.013-0.024-0.024-0.033l-10.667-9.333c-0.553-0.484-1.396-0.429-1.881 0.125-0.484 0.555-0.428 1.396 0.127 1.881l7.996 6.997h-20.452c-0.737 0-1.333 0.597-1.333 1.333s0.596 1.333 1.333 1.333h20.452l-7.996 6.997c-0.555 0.485-0.611 1.327-0.127 1.881 0.264 0.3 0.633 0.455 1.004 0.455 0.312 0 0.625-0.109 0.877-0.331l10.667-9.333c0.011-0.009 0.015-0.024 0.024-0.033 0.097-0.091 0.169-0.201 0.236-0.317 0.024-0.041 0.060-0.075 0.080-0.119 0.073-0.163 0.116-0.343 0.116-0.533s-0.043-0.371-0.116-0.535z"></path>\n</svg>\n'}))))))}componentDidLoad(){this.isReady=!0}};l.style=":host{display:block}.rtl .rtl-range-slider,[dir=rtl] .rtl-range-slider{transform:rotateY(180deg)}.rtl .rtl-range-numbers,[dir=rtl] .rtl-range-numbers{flex-direction:row-reverse}.rtl .form-select,.rtl select,[dir=rtl] .form-select,[dir=rtl] select{background-position:left 0.5rem center;padding-right:12px}.rtl .menu-divide li:not(:last-child):after,[dir=rtl] .menu-divide li:not(:last-child):after{left:0;right:auto}input[type=range]::-webkit-slider-thumb{pointer-events:all;width:24px;height:24px;-webkit-appearance:none}[type=checkbox]:checked{background-size:80%}";export{l as salla_price_range}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{d as e}from"./p-
|
|
4
|
+
import{d as e}from"./p-DKAYrLM1.js";function E(e,E){return E.forEach((function(E){E&&"string"!=typeof E&&!Array.isArray(E)&&Object.keys(E).forEach((function(i){if("default"!==i&&!(i in e)){var _=Object.getOwnPropertyDescriptor(E,i);Object.defineProperty(e,i,_.get?_:{enumerable:!0,get:function(){return E[i]}})}}))})),Object.freeze(e)}var i,_,l={exports:{}},n=i?l.exports:(i=1,l.exports=(_=function(e){var E=e.addFilter,i=e.utils,_=i.Type,l=i.replaceInString,n=i.toNaturalFileSize;return E("ALLOW_HOPPER_ITEM",(function(e,E){var i=E.query;if(!i("GET_ALLOW_FILE_SIZE_VALIDATION"))return!0;var _=i("GET_MAX_FILE_SIZE");if(null!==_&&e.size>_)return!1;var l=i("GET_MIN_FILE_SIZE");return!(null!==l&&e.size<l)})),E("LOAD_FILE",(function(e,E){var i=E.query;return new Promise((function(E,_){if(!i("GET_ALLOW_FILE_SIZE_VALIDATION"))return E(e);var t=i("GET_FILE_VALIDATE_SIZE_FILTER");if(t&&!t(e))return E(e);var I=i("GET_MAX_FILE_SIZE");if(null!==I&&e.size>I)_({status:{main:i("GET_LABEL_MAX_FILE_SIZE_EXCEEDED"),sub:l(i("GET_LABEL_MAX_FILE_SIZE"),{filesize:n(I,".",i("GET_FILE_SIZE_BASE"),i("GET_FILE_SIZE_LABELS",i))})}});else{var L=i("GET_MIN_FILE_SIZE");if(null!==L&&e.size<L)_({status:{main:i("GET_LABEL_MIN_FILE_SIZE_EXCEEDED"),sub:l(i("GET_LABEL_MIN_FILE_SIZE"),{filesize:n(L,".",i("GET_FILE_SIZE_BASE"),i("GET_FILE_SIZE_LABELS",i))})}});else{var a=i("GET_MAX_TOTAL_FILE_SIZE");if(null!==a&&i("GET_ACTIVE_ITEMS").reduce((function(e,E){return e+E.fileSize}),0)>a)return void _({status:{main:i("GET_LABEL_MAX_TOTAL_FILE_SIZE_EXCEEDED"),sub:l(i("GET_LABEL_MAX_TOTAL_FILE_SIZE"),{filesize:n(a,".",i("GET_FILE_SIZE_BASE"),i("GET_FILE_SIZE_LABELS",i))})}});E(e)}}}))})),{options:{allowFileSizeValidation:[!0,_.BOOLEAN],maxFileSize:[null,_.INT],minFileSize:[null,_.INT],maxTotalFileSize:[null,_.INT],fileValidateSizeFilter:[null,_.FUNCTION],labelMinFileSizeExceeded:["File is too small",_.STRING],labelMinFileSize:["Minimum file size is {filesize}",_.STRING],labelMaxFileSizeExceeded:["File is too large",_.STRING],labelMaxFileSize:["Maximum file size is {filesize}",_.STRING],labelMaxTotalFileSizeExceeded:["Maximum total size exceeded",_.STRING],labelMaxTotalFileSize:["Maximum total file size is {filesize}",_.STRING]}}},"undefined"!=typeof window&&void 0!==window.document&&document.dispatchEvent(new CustomEvent("FilePond:pluginloaded",{detail:_})),_)),t=E({__proto__:null,default:e(n)},[n]);
|
|
5
5
|
/*!
|
|
6
6
|
* FilePondPluginFileValidateSize 2.2.8
|
|
7
7
|
* Licensed under MIT, https://opensource.org/licenses/MIT/
|