@salla.sa/twilight-components 2.14.306 → 2.14.307
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-T68FpD2x.js → filepond-Btud-9cx.js} +1 -1
- package/dist/cjs/{filepond-plugin-file-poster-D2qWU0E8.js → filepond-plugin-file-poster--Gwmscgl.js} +1 -1
- package/dist/cjs/{filepond-plugin-file-validate-size-BBlP06s2.js → filepond-plugin-file-validate-size-BOJQxGjN.js} +1 -1
- package/dist/cjs/{filepond-plugin-file-validate-type-DsoFa7eA.js → filepond-plugin-file-validate-type-C77Hrmz7.js} +1 -1
- package/dist/cjs/{filepond-plugin-image-edit-Db2ao8Iq.js → filepond-plugin-image-edit-DI9lM8fO.js} +1 -1
- package/dist/cjs/{filepond-plugin-image-exif-orientation-BR30PCYO.js → filepond-plugin-image-exif-orientation-DLoZc-P9.js} +1 -1
- package/dist/cjs/{filepond-plugin-image-preview-CRbzO01p.js → filepond-plugin-image-preview-DHeIf3Qv.js} +1 -1
- package/dist/cjs/{index-_C7Hhk-4.js → index-BW35Qz0q.js} +1 -1
- package/dist/cjs/{index-B-Pk8e4E.js → index-C_8SUOhh.js} +2 -2
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/salla-accordion_62.cjs.entry.js +95 -67
- 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 +1 -1
- 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 +2 -2
- package/dist/collection/components/salla-file-upload/salla-file-upload.js +23 -14
- package/dist/collection/components/salla-rating-modal/salla-rating-modal.js +72 -61
- package/dist/components/index.js +2 -2
- package/dist/components/salla-file-upload2.js +22 -13
- package/dist/components/salla-rating-modal.js +64 -61
- package/dist/esm/{filepond-CEA-Ut0D.js → filepond-BDCqb9n1.js} +1 -1
- package/dist/esm/{filepond-plugin-file-poster-CrHfyiKb.js → filepond-plugin-file-poster-Csff9zr1.js} +1 -1
- package/dist/esm/{filepond-plugin-file-validate-size-BAjMQFxV.js → filepond-plugin-file-validate-size-uT0vdpSK.js} +1 -1
- package/dist/esm/{filepond-plugin-file-validate-type-3WttM4LY.js → filepond-plugin-file-validate-type-C71qG90l.js} +1 -1
- package/dist/esm/{filepond-plugin-image-edit-gXv8D0gp.js → filepond-plugin-image-edit-AV3f4iVU.js} +1 -1
- package/dist/esm/{filepond-plugin-image-exif-orientation-Cqa1508w.js → filepond-plugin-image-exif-orientation-BrahCgFe.js} +1 -1
- package/dist/esm/{filepond-plugin-image-preview-k7khQXHq.js → filepond-plugin-image-preview-B73Halt8.js} +1 -1
- package/dist/esm/{index-DzTVR6sF.js → index-CkTB8LrG.js} +2 -2
- package/dist/esm/{index-hJWVffcN.js → index-DAIvUtTl.js} +1 -1
- package/dist/esm/loader.js +3 -3
- package/dist/esm/salla-accordion_62.entry.js +95 -67
- 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 +1 -1
- 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 +3 -3
- package/dist/twilight/{p-eff7b7fd.entry.js → p-07e3af79.entry.js} +1 -1
- package/dist/twilight/{p-dc88b0d4.entry.js → p-152cca87.entry.js} +1 -1
- package/dist/twilight/{p-e2a7ad27.entry.js → p-1ac688b1.entry.js} +1 -1
- package/dist/twilight/{p-a6793957.entry.js → p-2bc66d76.entry.js} +1 -1
- package/dist/twilight/{p-8f7c61ae.entry.js → p-2e1acb31.entry.js} +1 -1
- package/dist/twilight/{p-e85c2ce3.entry.js → p-2f0c4c48.entry.js} +1 -1
- package/dist/twilight/{p-146fef48.entry.js → p-369e287b.entry.js} +1 -1
- package/dist/twilight/{p-27797654.entry.js → p-391bfab0.entry.js} +1 -1
- package/dist/twilight/{p-9f7048f9.entry.js → p-39fbc8df.entry.js} +1 -1
- package/dist/twilight/{p-2c10446c.entry.js → p-3d65ce04.entry.js} +1 -1
- package/dist/twilight/{p-7f980b83.entry.js → p-49d27a30.entry.js} +1 -1
- package/dist/twilight/{p-ead30e6f.entry.js → p-4b743277.entry.js} +1 -1
- package/dist/twilight/{p-4be84919.entry.js → p-50066053.entry.js} +1 -1
- package/dist/twilight/{p-e5fa1278.entry.js → p-5e393287.entry.js} +1 -1
- package/dist/twilight/{p-a962dc4e.entry.js → p-683db036.entry.js} +1 -1
- package/dist/twilight/{p-cafa3981.entry.js → p-69d77416.entry.js} +1 -1
- package/dist/twilight/{p-a1c13dc3.entry.js → p-6da8bb12.entry.js} +1 -1
- package/dist/twilight/{p-eaf534c7.entry.js → p-774db722.entry.js} +1 -1
- package/dist/twilight/{p-21474b0b.entry.js → p-7826e12d.entry.js} +1 -1
- package/dist/twilight/{p-f7a3fa8e.entry.js → p-7fec8b2b.entry.js} +1 -1
- package/dist/twilight/{p-CIpEMPXT.js → p-85r8le_w.js} +1 -1
- package/dist/twilight/{p-27735fc2.entry.js → p-89ed3133.entry.js} +1 -1
- package/dist/twilight/{p-CBEtXGh0.js → p-AkZZv6o3.js} +1 -1
- package/dist/twilight/{p-B65_j3d4.js → p-CDzETZL4.js} +1 -1
- package/dist/twilight/{p-BiU9nldp.js → p-CR3Odb2N.js} +1 -1
- package/dist/twilight/{p-DzTVR6sF.js → p-CkTB8LrG.js} +1 -1
- package/dist/twilight/{p-C8nDt0jG.js → p-CoViVjAD.js} +1 -1
- package/dist/twilight/{p-Czub2Z40.js → p-D9xbcyYI.js} +1 -1
- package/dist/twilight/{p-BakkriQz.js → p-Wr2wkBmL.js} +2 -2
- package/dist/twilight/{p-be48e8c4.entry.js → p-a4b4dfb6.entry.js} +1 -1
- package/dist/twilight/{p-0ae9e425.entry.js → p-a5611c44.entry.js} +1 -1
- package/dist/twilight/{p-dcf5a422.entry.js → p-b1eb710a.entry.js} +1 -1
- package/dist/twilight/{p-f2525950.entry.js → p-c4312308.entry.js} +1 -1
- package/dist/twilight/p-c7aec160.entry.js +11 -0
- package/dist/twilight/{p-c3bbc744.entry.js → p-d1e5e51e.entry.js} +1 -1
- package/dist/twilight/{p-8c264b4c.entry.js → p-d3fc316c.entry.js} +1 -1
- package/dist/twilight/{p-e7544665.entry.js → p-d70e73be.entry.js} +1 -1
- package/dist/twilight/{p-da06dd7e.entry.js → p-dbe530e9.entry.js} +1 -1
- package/dist/twilight/p-e0386eb6.entry.js +4 -0
- package/dist/twilight/{p-2a63d302.entry.js → p-e086a18a.entry.js} +1 -1
- package/dist/twilight/{p-cda9559e.entry.js → p-e41ed882.entry.js} +1 -1
- package/dist/twilight/{p-dd107ead.entry.js → p-ea727ca3.entry.js} +1 -1
- package/dist/twilight/{p-D6rcrZ5Y.js → p-xlB0zmD0.js} +1 -1
- package/dist/twilight/twilight.esm.js +1 -1
- package/dist/types/components/salla-file-upload/salla-file-upload.d.ts +5 -5
- package/dist/types/components/salla-rating-modal/salla-rating-modal.d.ts +21 -19
- package/dist/types/components.d.ts +2 -2
- package/package.json +5 -5
- package/dist/twilight/p-0924f4fa.entry.js +0 -4
- package/dist/twilight/p-7ab35a9b.entry.js +0 -11
|
@@ -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-DzTVR6sF.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-CkTB8LrG.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 t,h as e,a as o}from"./p-
|
|
4
|
+
import{r as t,h as e,a as o}from"./p-CkTB8LrG.js";const i=class{constructor(e){t(this,e),this.show=!1,this.targetElement=null}handleMouseOver(t){this.targetElement&&this.targetElement.contains(t.target)&&(this.show=!0)}handleMouseOut(t){this.targetElement&&this.targetElement.contains(t.target)&&(this.show=!1)}componentDidLoad(){this.targetElement=document.getElementById(this.targetId)}render(){return e("div",{key:"46f7eb1a696cc4716525911f374a04bab58c9593",class:"s-tooltip-container"},e("slot",{key:"9e24df4e71a0dac31d5d6b5f9991c14f7e2c6f3c"}),this.show&&e("div",{key:"bc359c1b14e02f1206fe26a62d0cd4ad1b5eb3ed",class:"s-tooltip-item"},this.text))}get el(){return o(this)}};i.style='.s-tooltip-container{position:relative;display:inline-block}.s-tooltip-item{position:absolute;transform:translateX(-39%);background-color:#baf3e6;color:#004d5a;bottom:100%;left:50%;text-align:center;border-radius:5px;z-index:1;white-space:nowrap;opacity:0;transition:opacity 0.3s;pointer-events:none;margin:0 0 16px 8px;padding:12px;max-width:150px;width:190px;white-space:normal;opacity:1}.s-tooltip-item::after{content:"";position:absolute;bottom:-10px;left:50%;margin-left:-5px;border-width:5px;border-style:solid;border-color:#baf3e6 transparent transparent transparent}.s-tooltip-item:dir(ltr){transform:translateX(-72%)}';export{i as salla_tooltip}
|
|
@@ -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-CkTB8LrG.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 a,h as t,H as l}from"./p-
|
|
4
|
+
import{r as a,h as t,H as l}from"./p-CkTB8LrG.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 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-CkTB8LrG.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,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as s,h as i,a as t}from"./p-
|
|
4
|
+
import{r as s,h as i,a as t}from"./p-CkTB8LrG.js";import{I as e}from"./p-uTyAzPSy.js";const r=class{constructor(i){s(this,i),this.currentSlide=0,this.showPurchaseCount=!1,this.startPoint={x:0,y:0},this.isSwiping=!1,this.isRTL="rtl",this.handlePointerDown=s=>{s.isPrimary&&(this.sliderElement?.setPointerCapture(s.pointerId),this.startSwipe(s.clientX,s.clientY),s.preventDefault())},this.handlePointerMove=s=>{this.isSwiping&&s.isPrimary&&s.preventDefault()},this.handlePointerUp=s=>{this.isSwiping&&s.isPrimary&&(this.sliderElement?.releasePointerCapture(s.pointerId),this.endSwipe(s.clientX,s.clientY))},this.handlePointerCancel=s=>{this.isSwiping&&s.isPrimary&&(this.sliderElement?.releasePointerCapture(s.pointerId),this.isSwiping=!1)},this.goToSlide=s=>{this.currentSlide=Math.max(0,Math.min(s,this.images.length-1))}}async componentDidLoad(){await salla.onReady(),this.showPurchaseCount=!!salla.config.get("store.settings.product.total_sold_enabled",!1),this.isRTL=salla.config.get("theme.is_rtl",!0),this.purchasedCount=salla.lang.getWithDefault("blocks.home.reviews.purchased_count",this.isRTL?` تم شراءه ${this.review.product?.sold_quantity} مرة`:`Purchased ${this.review.product.sold_quantity} times`,{count:this.review.product?.sold_quantity}),this.initializeSlider()}disconnectedCallback(){this.removeEventListeners()}get images(){const{review:s}=this;return s?.images?.length>1?s.images.map(((s,i)=>({url:s,alt:"",id:i}))):s?.product?.images||[]}get hasMultipleImages(){return this.images.length>1}get slideTransform(){return`translateX(${100*this.currentSlide*(this.isRTL?1:-1)}%)`}initializeSlider(){this.hasMultipleImages&&(this.sliderElement=this.el.querySelector(".s-review-card-slider-container"),this.sliderElement&&(this.sliderElement.style.touchAction="pan-y pinch-zoom",this.addEventListeners()))}addEventListeners(){this.sliderElement&&(this.sliderElement.addEventListener("pointerdown",this.handlePointerDown,{passive:!1}),this.sliderElement.addEventListener("pointermove",this.handlePointerMove,{passive:!1}),this.sliderElement.addEventListener("pointerup",this.handlePointerUp,{passive:!0}),this.sliderElement.addEventListener("pointercancel",this.handlePointerCancel,{passive:!0}))}removeEventListeners(){this.sliderElement&&(this.sliderElement.removeEventListener("pointerdown",this.handlePointerDown),this.sliderElement.removeEventListener("pointermove",this.handlePointerMove),this.sliderElement.removeEventListener("pointerup",this.handlePointerUp),this.sliderElement.removeEventListener("pointercancel",this.handlePointerCancel))}startSwipe(s,i){this.startPoint={x:s,y:i},this.isSwiping=!0}componentDidRender(){this.removeEventListeners(),this.addEventListeners()}endSwipe(s,i){this.isSwiping=!1,this.processSwipe(s-this.startPoint.x,i-this.startPoint.y)}processSwipe(s,i){if(Math.abs(s)<10||Math.abs(i)>Math.abs(s))return;const t=s<0;(this.isRTL?!t:t)?this.goToNextSlide():this.goToPrevSlide()}goToNextSlide(){this.currentSlide<this.images.length-1&&this.currentSlide++}goToPrevSlide(){this.currentSlide>0&&this.currentSlide--}renderStars(){return Array(5).fill(null).map(((s,t)=>i("span",{key:t,innerHTML:this.review.stars>=t+1?' <svg width="18" height="17" view-box="0 0 18 17" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path d="M9.00045 13.6951L3.71036 16.6563L4.89186 10.71L0.440918 6.59397L6.4612 5.88017L9.00045 0.375122L11.5396 5.88017L17.5599 6.59397L13.109 10.71L14.2905 16.6563L9.00045 13.6951Z" fill="currentcolor" />\n</svg>':' <svg width="18" height="17" view-box="0 0 18 17" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path d="M9.00045 13.6951L3.71036 16.6563L4.89186 10.71L0.440918 6.59397L6.4612 5.88017L9.00045 0.375122L11.5396 5.88017L17.5599 6.59397L13.109 10.71L14.2905 16.6563L9.00045 13.6951Z" fill="#DDDDDD" />\n</svg>'})))}renderDots(){return this.images.map((({url:s},t)=>i("button",{key:s||t,type:"button",class:"s-review-card-slider-dot "+(this.currentSlide===t?"active":""),onClick:()=>this.goToSlide(t),"aria-label":`Go to slide ${t+1}`,onPointerDown:()=>this.goToSlide(t)})))}renderSlider(){return this.hasMultipleImages?i("div",{class:"s-review-card-slider-container"},i("div",{class:"s-review-card-slides",style:{transform:this.slideTransform}},this.images.map((s=>i("div",{key:s?.id,class:"s-review-card-slider-slide"},i("img",{src:s.url,alt:s.alt||"Product image",width:275,height:275,loading:"lazy",draggable:!1}))))),i("div",{class:"s-review-card-slider-dots"},this.renderDots())):null}renderSingleImage(){const s=this.review?.product?.image;return!s||this.hasMultipleImages?null:i("img",{src:s.url,alt:s.alt||"Product image",class:"s-review-card-image",width:275,height:275,loading:"lazy",decoding:"async",draggable:!1})}renderHeader(){return i("div",{class:"s-review-card-header"},i("div",{class:"s-review-card-reviewer-name"},i("p",null,this.review?.name),this.review?.has_order&&i("span",{class:"s-review-card-verified-icon",innerHTML:e})),i("div",{class:"s-review-card-stars"},this.renderStars()))}renderProductInfo(){const s=this.review?.product;return s?i("a",{href:this.review?.product?.url,class:"s-review-card-product-container"},i("img",{alt:s.image?.alt||"Product",src:s.image?.url,class:"s-review-card-product-image",width:60,height:60,loading:"lazy",decoding:"async",draggable:!1}),i("div",{class:"s-review-card-product-details"},i("p",{class:"s-review-card-product-details-name"},s.name),this.showPurchaseCount?i("p",{class:"s-review-card-product-details-purchase-count"},i("span",{innerHTML:' <svg width="12" height="17" view-box="0 0 12 17" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path d="M6 16.2501C9.10658 16.2501 11.625 13.7317 11.625 10.6251C11.625 9.976 11.4523 9.35252 11.25 8.77232C9.99998 10.0075 9.05002 10.6251 8.4 10.6251C11.3966 5.37512 9.75 3.12512 5.25 0.125122C5.625 3.87475 3.15302 5.58043 2.14634 6.52757C1.0559 7.5535 0.375 9.00977 0.375 10.6251C0.375 13.7317 2.89339 16.2501 6 16.2501ZM6.53205 2.92636C8.96333 4.98908 8.97495 6.59185 7.09725 9.88157C6.5265 10.8815 7.2486 12.1251 8.4 12.1251C8.9163 12.1251 9.43807 11.9745 9.98917 11.6789C9.52342 13.4466 7.91393 14.7501 6 14.7501C3.72182 14.7501 1.875 12.9033 1.875 10.6251C1.875 9.47072 2.34959 8.39582 3.17419 7.62002C3.2687 7.53115 3.74812 7.1062 3.76858 7.08782C4.08646 6.8017 4.34835 6.54985 4.60718 6.2727C5.52998 5.28461 6.19283 4.18735 6.53205 2.92636Z" fill="currentcolor" />\n </svg>'}),this.purchasedCount):null)):null}render(){return i("div",{key:"8c2e3500d7844c43e455e707c460a842995eda13",class:"s-review-card-container"},this.renderSlider(),this.renderSingleImage(),a(),i("div",{key:"1b5cb3b515118ab578d2f64202e33ff2a67b3e89",class:"s-review-card-content"},this.renderHeader(),i("p",{key:"784abce956a5ee45aa0d90b5bd5427c2658bcf2c",class:"s-review-card-review-content",innerHTML:this.review?.content}),a(),this.renderProductInfo()))}get el(){return t(this)}},a=()=>i("div",{class:"s-review-card-divider "});r.style=":host{display:block}";export{r as salla_review_card}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as i,h as a}from"./p-
|
|
4
|
+
import{r as i,h as a}from"./p-CkTB8LrG.js";const e=class{constructor(a){i(this,a)}render(){return a("a",{key:"773f4784238c5d6ff060f996891d3b42e21703a0",href:this.notification.url,class:{"s-notifications-item":!0,"s-notifications-item-shadow":!0,"s-notifications-item-read":!this.notification.is_new}},a("span",{key:"9589e70416b9ae04d82331717d29192fcfb2b0ae",class:"s-notifications-item-icon"},a("i",{key:"2a208e20051f33ed305d15f9be13d6165ad577a6",class:{"s-notifications-item-icon sicon-bell-ring":!0,"s-notifications-item-icon-new":this.notification.is_new}})),a("div",{key:"4a94e411048a69a065458c867d792c679bcf5362",class:"s-notifications-item-content"},a("div",{key:"fc9ede08e2e14d7b578f2a36ea7219dff1b9118a",class:"s-notifications-item-content-leading"},a("h4",{key:"812d7fc74046793e2fc53afbd2b4d65445dc7d7a"},this.notification.title),a("p",{key:"7a38966f6755b4261465e7b780b1028a607c6e00"},this.notification.sub_title)),a("span",{key:"ba5058df85b4fe9a685f4ea1f52e333ee9b20b7f",class:"s-notifications-item-content-trailing"},a("i",{key:"c93b353212b21a3cbfca72ff8bacd39738b332ac",class:"sicon-time s-notifications-item-content-trailing-icon"}),a("span",{key:"8206298a9fa03cd100d64b4934622033caebe7fc"},this.notification.date))))}};e.style="";export{e as salla_notification_item}
|
|
@@ -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-CkTB8LrG.js";import{I as a}from"./p-uTyAzPSy.js";const e=class{constructor(t){s(this,t),this.codeCopied=null,this.noItemFound=!0,this.order_items=[],this.isDigitalCard=s=>"codes"===s.product.type,this.isDigitalProduct=s=>"digital"===s.product.type}async componentWillLoad(){return salla.lang.onLoaded((()=>{this.codes_text=salla.lang.get("pages.thank_you.codes"),this.copy_text=salla.lang.get("common.elements.copy"),this.files_text=salla.lang.get("pages.thank_you.files"),this.download_text=salla.lang.get("pages.thank_you.download")})),await this.getOrderItems()}copyToClipboardHandler(s){if(navigator&&"clipboard"in navigator)try{navigator.clipboard.writeText(s).then((()=>{this.codeCopied=s,this.copyCodeButtonTimeout=setTimeout((()=>{this.codeCopied=null}),3e3)}))}catch(s){salla.loggers.error("copy functionality is not supported by the browser")}}async getOrderItems(){const s=this.orderId||salla.config.get("page.id"),t="Failed to fetch order items";if(!s)throw salla.logger.error(t),new Error(t);try{const{data:{items:t=[]}}=await salla.api.request(`orders/${s}`);t.some((s=>this.isDigitalCard(s)||this.isDigitalProduct(s)))&&(this.order_items=t,this.noItemFound=!1)}catch(s){salla.logger.error(t)}}disconnectedCallback(){this.copyCodeButtonTimeout&&clearTimeout(this.copyCodeButtonTimeout)}render(){return t("ul",{key:"75e332734c187402dcf43b73ae3d464559893203",class:"s-order-summary-wrapper"},this.noItemFound?t("salla-placeholder",{alignment:"center"},t("span",{slot:"title"})):this.order_items.map((s=>this.isDigitalCard(s)?t("li",{key:s.product.id,class:"s-order-summary-item"},t("h2",{class:"s-order-summary-item-title"},this.codes_text," (",s.name,")"),s.codes.map((s=>t("div",{key:s.code,class:"s-order-summary-code-item-wrapper"},t("p",null,t("span",{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>debit-card-back</title>\n<path d="M30 28h-28c-1.105 0-2-0.895-2-2v0-18c0-1.105 0.895-2 2-2v0h28c1.105 0 2 0.895 2 2v0 18c0 1.105-0.895 2-2 2v0zM30 26v0zM2 8v18h28v-18zM31 14h-30c-0.552 0-1-0.448-1-1s0.448-1 1-1v0h30c0.552 0 1 0.448 1 1s-0.448 1-1 1v0zM11 22h-6c-0.552 0-1-0.448-1-1s0.448-1 1-1v0h6c0.552 0 1 0.448 1 1s-0.448 1-1 1v0zM24 24c-2.209 0-4-1.791-4-4s1.791-4 4-4c2.209 0 4 1.791 4 4v0c0 2.209-1.791 4-4 4v0zM24 18c-1.105 0-2 0.895-2 2s0.895 2 2 2c1.105 0 2-0.895 2-2v0c0-1.105-0.895-2-2-2v0zM20 24c-2.209 0-4-1.791-4-4s1.791-4 4-4v0c0.002 0 0.005 0 0.007 0 1.032 0 1.972 0.398 2.673 1.048l-0.003-0.002c0.191 0.183 0.311 0.439 0.311 0.724 0 0.552-0.448 1-1 1-0.257 0-0.492-0.097-0.669-0.257l0.001 0.001c-0.345-0.319-0.807-0.514-1.315-0.514-0.002 0-0.003 0-0.005 0h0c-1.105 0-2 0.895-2 2s0.895 2 2 2v0c0.002 0 0.004 0 0.007 0 0.508 0 0.971-0.195 1.317-0.515l-0.001 0.001c0.179-0.171 0.422-0.276 0.689-0.276 0.552 0 1 0.448 1 1 0 0.295-0.128 0.56-0.331 0.743l-0.001 0.001c-0.699 0.648-1.638 1.046-2.671 1.046-0.003 0-0.007 0-0.010 0h0.001z"></path>\n</svg>\n'}),t("span",null,s.code)),t("salla-button",{class:"s-order-summary-item-copy-button "+(this.codeCopied===s.code?"copied":""),onClick:()=>this.copyToClipboardHandler(s.code),shape:"link"},t("span",{innerHTML:this.codeCopied===s.code?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>swap-stroke</title>\n<path d="M6.667 18.667h-2.667c-0.736 0-1.333-0.597-1.333-1.333v-13.333c0-0.736 0.597-1.333 1.333-1.333h13.333c0.736 0 1.333 0.597 1.333 1.333v2.667c0 0.737 0.596 1.333 1.333 1.333s1.333-0.596 1.333-1.333v-2.667c0-2.205-1.795-4-4-4h-13.333c-2.205 0-4 1.795-4 4v13.333c0 2.205 1.795 4 4 4h2.667c0.737 0 1.333-0.596 1.333-1.333s-0.596-1.333-1.333-1.333zM28 10.667h-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-4v-13.333c0-2.205-1.795-4-4-4zM29.333 28c0 0.736-0.597 1.333-1.333 1.333h-13.333c-0.736 0-1.333-0.597-1.333-1.333v-13.333c0-0.736 0.597-1.333 1.333-1.333h13.333c0.736 0 1.333 0.597 1.333 1.333z"></path>\n</svg>\n'}),t("span",null,this.copy_text)))))):this.isDigitalProduct(s)?t("li",{key:s.product.id,class:"s-order-summary-item"},t("h2",{class:"s-order-summary-item-title"},this.files_text," (",s.name,")"),t("ul",null,s.files.map((s=>t("li",{class:"s-order-summary-digital-item-wrapper"},t("div",null,t("span",{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>file-archive</title>\n<path d="M17.333 16h-5.333c-0.737 0-1.333 0.597-1.333 1.333v2.667c0 2.205 1.795 4 4 4s4-1.795 4-4v-2.667c0-0.736-0.596-1.333-1.333-1.333zM16 20c0 0.735-0.597 1.333-1.333 1.333s-1.333-0.599-1.333-1.333v-1.333h2.667zM17.333 12h-5.333c-0.737 0-1.333 0.597-1.333 1.333s0.596 1.333 1.333 1.333h5.333c0.737 0 1.333-0.597 1.333-1.333s-0.596-1.333-1.333-1.333zM28.943 8.391l-8-8c-0.249-0.251-0.588-0.391-0.943-0.391h-13.333c-2.205 0-4 1.795-4 4v24c0 2.205 1.795 4 4 4h18.667c2.205 0 4-1.795 4-4v-18.667c0-0.353-0.14-0.693-0.391-0.943zM26.667 28c0 0.735-0.597 1.333-1.333 1.333h-18.667c-0.736 0-1.333-0.599-1.333-1.333v-24c0-0.735 0.597-1.333 1.333-1.333h12.781l7.219 7.219zM17.333 8h-5.333c-0.737 0-1.333 0.597-1.333 1.333s0.596 1.333 1.333 1.333h5.333c0.737 0 1.333-0.597 1.333-1.333s-0.596-1.333-1.333-1.333zM17.333 4h-5.333c-0.737 0-1.333 0.597-1.333 1.333s0.596 1.333 1.333 1.333h5.333c0.737 0 1.333-0.597 1.333-1.333s-0.596-1.333-1.333-1.333z"></path>\n</svg>\n'}),t("span",null,s.name)),t("a",{href:s.url,target:"_blank",class:"s-order-summary-item-download"},t("span",{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>download</title>\n<path d="M15.056 20.941c0.123 0.124 0.271 0.221 0.435 0.289 0.163 0.067 0.336 0.103 0.509 0.103s0.347-0.036 0.509-0.103c0.164-0.068 0.311-0.165 0.435-0.289l5.332-5.332c0.521-0.521 0.521-1.364 0-1.885s-1.364-0.521-1.885 0l-3.057 3.057v-12.781c0-0.737-0.597-1.333-1.333-1.333s-1.333 0.596-1.333 1.333v12.781l-3.057-3.057c-0.521-0.521-1.364-0.521-1.885 0s-0.521 1.364 0 1.885zM25.333 26.667h-18.667c-0.736 0-1.333 0.596-1.333 1.333s0.597 1.333 1.333 1.333h18.667c0.736 0 1.333-0.596 1.333-1.333s-0.597-1.333-1.333-1.333z"></path>\n</svg>\n'}),t("span",null,this.download_text))))))):null)))}};e.style=":host{display:block}";export{e as salla_order_summary}
|
|
@@ -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-CkTB8LrG.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-CkTB8LrG.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 e,h as s,H as a}from"./p-
|
|
4
|
+
import{r as e,h as s,H as a}from"./p-CkTB8LrG.js";const r=class{constructor(s){e(this,s),this.dark=!1,this.commercialRegisterLabel="",this.freelanceLabel=""}componentWillLoad(){this.initializeTranslations()}initializeTranslations(){salla.lang.onLoaded((()=>{const e=(e,s,a)=>{salla.helpers.setNested(salla.lang.messages[e],s,a)};e("ar.trans","blocks.footer.commercial_register","السجل التجاري"),e("en.trans","blocks.footer.commercial_register","Commercial Register"),e("ar.trans","blocks.footer.freelance","وثيقة العمل الحر"),e("en.trans","blocks.footer.freelance","Freelance Certificate"),this.commercialRegisterLabel=salla.lang.getWithDefault("blocks.footer.commercial_register","السجل التجاري"),this.freelanceLabel=salla.lang.getWithDefault("blocks.footer.freelance","وثيقة العمل الحر")}))}getBadgeData(){const e=salla.config.get("store.settings.commercial_number"),s=salla.config.get("store.settings.freelance_number");return e?{number:e,label:this.commercialRegisterLabel||"السجل التجاري",imageUrl:salla.url.cdn("images/commercial-register.png",70,70),type:"commercial"}:s?{number:s,label:this.freelanceLabel||"وثيقة العمل الحر",imageUrl:this.dark?salla.url.cdn("images/freelance-white.png"):salla.url.cdn("images/freelance.png"),type:"freelance"}:null}render(){const e=this.getBadgeData();return e?s(a,{class:"s-trust-badges-wrapper "+(this.dark?"dark":"")},s("img",{class:"s-trust-badges-image",width:"55",height:"55",src:e.imageUrl,alt:e.label}),s("div",{class:"s-trust-badges-content"},s("p",{class:"s-trust-badges-label"},e.label),s("b",{class:"s-trust-badges-number"},e.number))):null}};r.style="";export{r as salla_trust_badges}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as t,h as s,a as i}from"./p-
|
|
4
|
+
import{r as t,h as s,a as i}from"./p-CkTB8LrG.js";import{H as n}from"./p-Dljb4XCt.js";import"./p-CgtvEd63.js";const a=class{constructor(s){t(this,s),this.itemPerPage=10,this.no_notifications_trans=salla.lang.get("blocks.header.no_notifications"),this.load_more_text_trans=salla.lang.get("common.elements.load_more"),salla.lang.onLoaded((()=>{this.no_notifications_trans=salla.lang.get("blocks.header.no_notifications"),this.load_more_text_trans=salla.lang.get("common.elements.load_more")}))}loading(t=!0){let s=this.status?.querySelector(".s-button-text");s&&(n.toggleElementClassIf(s,"s-button-hide","s-button-show",(()=>t)),this.btnLoader.style.display=t?"inherit":"none")}getNotificationCard(t){const s=document.createElement("salla-notification-item");return s.notification=t,s.classList.add("s-block"),s}render(){return this.showPlaceholder?s("div",{class:"s-notifications-no-content"},s("salla-placeholder",{alignment:"center"},s("span",{slot:"title"},this.no_notifications_trans))):s("div",{class:"s-notifications-wrapper"},s("div",{class:"s-notifications-container",ref:t=>this.wrapper=t}),this.nextPage&&s("div",{class:"s-infinite-scroll-wrapper",ref:t=>this.status=t},s("button",{onClick:()=>this.loadMore(),class:"s-infinite-scroll-btn s-button-btn s-button-primary"},s("span",{class:"s-button-text s-infinite-scroll-btn-text"},this.loadMoreText??this.load_more_text_trans),s("span",{class:"s-button-loader s-button-loader-center s-infinite-scroll-btn-loader",ref:t=>this.btnLoader=t,style:{display:"none"}}))))}handleResponse(t){return t.map((t=>this.getNotificationCard(t)))}initiateInfiniteScroll(){this.wrapper?(this.infiniteScroll=salla.infiniteScroll.initiate(this.wrapper,this.wrapper,{path:()=>this.nextPage,history:!0,nextPage:this.nextPage,scrollThreshold:!1},!0),this.infiniteScroll?.on("request",(()=>{this.loading()})),this.infiniteScroll?.on("load",(t=>{this.loading(!1),this.pagination=t.pagination,this.nextPage=t.pagination.links?.next||null,this.handleResponse(t.data).forEach((t=>this.wrapper.append(t)));let s=this.host.querySelectorAll("salla-notification-item:not(.animated)");n.animateItems(s)})),this.infiniteScroll?.on("error",(t=>{salla.logger.error("Error loading more comments:",t)}))):salla.logger.error("Wrapper is undefined. Cannot initiate infinite scroll.")}async loadInitialData(){await salla.api.notifications.fetch({per_page:this.itemPerPage}).then((t=>{this.pagination=t.pagination,this.total=t.pagination.total,this.nextPage=t.pagination.links?.next||null,setTimeout((()=>{if(!t.data.length)return this.showPlaceholder=!0;this.handleResponse(t.data).forEach((t=>this.wrapper.append(t))),this.initiateInfiniteScroll();let s=this.wrapper.querySelectorAll("salla-notification-item:not(.animated)");n.animateItems(s)}),100)})).catch((t=>{salla.logger.error(t),this.showPlaceholder=!0,this.loading(!1)}))}async loadMore(){this.infiniteScroll?.loadNextPage()}async componentWillLoad(){await this.loadInitialData()}get host(){return i(this)}};a.style="";export{a as salla_notifications}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as c,h as l,H as t,a as s}from"./p-
|
|
4
|
+
import{r as c,h as l,H as t,a as s}from"./p-CkTB8LrG.js";import{f as i,t as e}from"./p-Dz7o69vX.js";const o=class{constructor(l){c(this,l),this.links=salla.config.get("store.social"),this.iconsList={instagram:'\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>instagram</title>\n<path d="M23 32h-14c-4.971 0-9-4.029-9-9v0-14c0-4.971 4.029-9 9-9v0h14c4.971 0 9 4.029 9 9v0 14c0 4.971-4.029 9-9 9v0zM9 2c-3.866 0-7 3.134-7 7v0 14c0 3.866 3.134 7 7 7v0h14c3.866 0 7-3.134 7-7v0-14c0-3.866-3.134-7-7-7v0zM16 24c-4.418 0-8-3.582-8-8s3.582-8 8-8c4.418 0 8 3.582 8 8v0c0 4.418-3.582 8-8 8v0zM16 10c-3.314 0-6 2.686-6 6s2.686 6 6 6c3.314 0 6-2.686 6-6v0c0-3.314-2.686-6-6-6v0zM25 9c-1.105 0-2-0.895-2-2s0.895-2 2-2c1.105 0 2 0.895 2 2v0c0 1.105-0.895 2-2 2v0zM25 7v0z"></path>\n</svg>\n',twitter:e,facebook:i,youtube:'\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>youtube</title>\n<path d="M16 28c-3.666 0-8.376-0.056-10.29-0.162-0.113 0.010-0.244 0.016-0.376 0.016-1.676 0-3.139-0.91-3.922-2.264l-0.012-0.022c-0.97-1.6-1.4-4.248-1.4-8.558s0.436-6.962 1.412-8.6c0.782-1.36 2.227-2.262 3.883-2.262 0.148 0 0.293 0.007 0.437 0.021l-0.018-0.001c1.872-0.124 6.544-0.168 10.286-0.168s8.4 0.044 10.292 0.168c0.124-0.012 0.267-0.019 0.412-0.019 1.656 0 3.101 0.905 3.866 2.247l0.012 0.022c0.982 1.624 1.418 4.27 1.418 8.582 0 4.338-0.438 6.982-1.422 8.6-0.789 1.364-2.241 2.268-3.904 2.268-0.133 0-0.265-0.006-0.395-0.017l0.017 0.001c-1.926 0.092-6.632 0.148-10.296 0.148zM16 8c-3.712 0-8.334 0.042-10.168 0.164-1.688 0.094-2.14 0.306-2.702 1.268-0.756 1.81-1.195 3.913-1.195 6.119 0 0.51 0.024 1.015 0.069 1.513l-0.005-0.064c-0.042 0.435-0.065 0.941-0.065 1.453 0 2.198 0.438 4.294 1.231 6.205l-0.039-0.107c0.566 0.968 1.022 1.184 2.708 1.296 3.29 0.184 17.022 0.184 20.34 0 1.678-0.11 2.132-0.326 2.684-1.28 0.764-1.803 1.208-3.899 1.208-6.1 0-0.513-0.024-1.020-0.071-1.52l0.005 0.064c0.042-0.436 0.065-0.943 0.065-1.455 0-2.203-0.439-4.303-1.235-6.218l0.040 0.107v-0.016c-0.554-0.958-1-1.17-2.684-1.264-1.862-0.122-6.644-0.164-10.186-0.164zM13 23c-0.552 0-1-0.448-1-1v0-10c0 0 0 0 0 0 0-0.552 0.448-1 1-1 0.196 0 0.38 0.057 0.534 0.154l-0.004-0.002 8 5c0.284 0.18 0.47 0.492 0.47 0.848s-0.186 0.668-0.466 0.846l-0.004 0.002-8 5c-0.15 0.095-0.334 0.152-0.53 0.152 0 0 0 0 0 0v0zM14 13.8v6.4l5.114-3.2z"></path>\n</svg>\n',snapchat:'\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>snapchat</title>\n<path d="M16.186 30h-0.266c-1.843-0.023-3.525-0.693-4.834-1.792l0.012 0.010c-0.476-0.405-1.043-0.72-1.665-0.909l-0.033-0.009c-0.287-0.044-0.617-0.069-0.954-0.069-0.492 0-0.972 0.053-1.434 0.155l0.044-0.008c-0.261 0.061-0.564 0.102-0.875 0.114l-0.009 0c-0.017 0.001-0.036 0.001-0.056 0.001-0.811 0-1.495-0.545-1.705-1.288l-0.003-0.012c-0.076-0.26-0.132-0.506-0.186-0.746-0.961-0.157-1.822-0.412-2.633-0.76l0.073 0.028c-0.667-0.259-1.199-0.745-1.509-1.362l-0.007-0.016c-0.082-0.189-0.135-0.409-0.146-0.64l-0-0.004c-0.002-0.031-0.003-0.067-0.003-0.103 0-0.841 0.614-1.538 1.417-1.668l0.010-0.001c0.822-0.141 1.555-0.438 2.198-0.859l-0.022 0.013c0.611-0.405 1.138-0.872 1.591-1.404l0.009-0.010c0.526-0.595 0.98-1.273 1.337-2.007l0.023-0.053c0.060-0.102 0.107-0.22 0.135-0.346l0.001-0.008c-0.092-0.020-0.73-0.222-0.972-0.298s-0.374-0.12-0.506-0.17c-0.546-0.205-1.016-0.487-1.424-0.839l0.006 0.005c-0.471-0.388-0.768-0.971-0.768-1.624 0-0.126 0.011-0.249 0.032-0.369l-0.002 0.013c0.143-0.644 0.551-1.172 1.1-1.474l0.011-0.006c0.389-0.241 0.861-0.384 1.366-0.384 0.347 0 0.678 0.067 0.982 0.19l-0.018-0.006c0.128 0.060 0.242 0.106 0.344 0.142-0.082-0.573-0.129-1.235-0.129-1.908 0-1.482 0.227-2.91 0.648-4.253l-0.027 0.101c0.512-1.142 1.207-2.114 2.056-2.925l0.004-0.003c0.7-0.664 1.516-1.214 2.413-1.616l0.055-0.022c1.128-0.5 2.444-0.794 3.828-0.8h0.592c1.386 0.007 2.701 0.301 3.893 0.825l-0.063-0.025c0.956 0.42 1.777 0.967 2.485 1.632l-0.005-0.004c0.855 0.815 1.55 1.789 2.039 2.876l0.023 0.058c0.396 1.237 0.625 2.659 0.625 4.135 0 0.658-0.045 1.304-0.133 1.938l0.008-0.073 0.172-0.076c0.303-0.16 0.661-0.253 1.042-0.253 0.374 0 0.728 0.091 1.039 0.251l-0.013-0.006c0.886 0.274 1.528 1.063 1.582 2.008l0 0.006c-0.001 0.602-0.25 1.146-0.65 1.536l-0 0c-0.429 0.408-0.945 0.73-1.516 0.935l-0.030 0.009c-0.144 0.056-0.316 0.112-0.504 0.17-0.367 0.103-0.686 0.235-0.984 0.398l0.024-0.012c0.018 0.030 0.042 0.094 0.086 0.18 0.963 2.174 2.834 3.796 5.118 4.4l0.054 0.012c0.814 0.133 1.427 0.83 1.427 1.671 0 0.036-0.001 0.072-0.003 0.108l0-0.005c-0.012 0.241-0.070 0.465-0.165 0.669l0.005-0.011c-0.319 0.624-0.847 1.103-1.489 1.352l-0.019 0.006c-0.739 0.323-1.6 0.578-2.497 0.724l-0.063 0.008c-0.056 0.264-0.112 0.496-0.186 0.742-0.215 0.747-0.893 1.284-1.696 1.284-0.011 0-0.021-0-0.032-0l0.002 0c-0.328-0.004-0.644-0.042-0.949-0.11l0.031 0.006c-0.404-0.090-0.869-0.142-1.345-0.142-0.353 0-0.7 0.029-1.038 0.083l0.037-0.005c-0.653 0.195-1.218 0.508-1.699 0.917l0.007-0.005c-1.275 1.065-2.916 1.731-4.71 1.788l-0.012 0zM8.444 25.218c0.457 0.001 0.904 0.041 1.339 0.117l-0.047-0.007c0.966 0.232 1.808 0.664 2.516 1.252l-0.010-0.008c0.96 0.829 2.199 1.357 3.56 1.427l0.014 0.001h0.37c1.373-0.070 2.61-0.597 3.576-1.43l-0.008 0.006c0.701-0.583 1.546-1.016 2.474-1.239l0.042-0.009c0.394-0.063 0.849-0.1 1.312-0.1 0.615 0 1.216 0.064 1.795 0.186l-0.057-0.010c0.105 0.023 0.238 0.045 0.372 0.059l0.016 0.001c0.042-0.162 0.076-0.314 0.11-0.47 0.059-0.339 0.156-0.641 0.287-0.924l-0.009 0.023 0.234-0.44 0.492-0.078c0.99-0.119 1.892-0.359 2.738-0.705l-0.070 0.025c0.086-0.040 0.158-0.076 0.216-0.11-2.748-0.86-4.933-2.816-6.081-5.342l-0.025-0.062c-0.184-0.31-0.294-0.684-0.294-1.083 0-0.27 0.050-0.528 0.14-0.765l-0.005 0.015c0.492-0.783 1.284-1.339 2.212-1.507l0.020-0.003c0.14-0.044 0.27-0.084 0.376-0.126 0.327-0.108 0.609-0.272 0.849-0.482l-0.003 0.002c0.074-0.106 0-0.2-0.216-0.284-0.094-0.041-0.203-0.065-0.318-0.066h-0c-0.529 0.242-1.142 0.411-1.786 0.474l-0.024 0.002c-0.313-0-0.612-0.064-0.883-0.18l0.015 0.006-0.628-0.28 0.072-1.272c0.093-0.623 0.146-1.342 0.146-2.074 0-1.269-0.16-2.501-0.46-3.677l0.022 0.103c-0.396-0.896-0.936-1.659-1.598-2.296l-0.002-0.002c-0.541-0.508-1.172-0.928-1.865-1.233l-0.043-0.017c-0.895-0.396-1.939-0.629-3.036-0.634h-0.002l-0.218-1v1h-0.348c-1.105 0.003-2.155 0.237-3.106 0.656l0.050-0.020c-0.733 0.322-1.361 0.742-1.903 1.253l0.003-0.003c-0.663 0.638-1.203 1.398-1.582 2.247l-0.018 0.045c-0.279 1.065-0.44 2.287-0.44 3.547 0 0.704 0.050 1.395 0.147 2.072l-0.009-0.078 0.080 1.372-0.618 0.284c-0.31 0.108-0.666 0.17-1.038 0.17-0.6 0-1.163-0.163-1.645-0.446l0.015 0.008c-0.019-0.001-0.041-0.002-0.064-0.002-0.154 0-0.299 0.039-0.425 0.109l0.005-0.002c-0.063 0.032-0.115 0.078-0.153 0.135l-0.001 0.001c0.258 0.244 0.567 0.435 0.91 0.556l0.018 0.006c0.094 0.036 0.2 0.070 0.32 0.108 0.971 0.167 1.784 0.732 2.282 1.516l0.008 0.014c0.087 0.225 0.137 0.486 0.137 0.758 0 0.403-0.11 0.781-0.303 1.104l0.005-0.010c-0.459 0.983-1.016 1.829-1.677 2.582l0.011-0.012c-0.588 0.687-1.26 1.279-2.004 1.768l-0.036 0.022c-0.689 0.451-1.49 0.805-2.346 1.017l-0.054 0.011c0.060 0.034 0.132 0.072 0.218 0.112 0.776 0.322 1.678 0.561 2.618 0.675l0.050 0.005 0.498 0.078 0.234 0.446c0.116 0.255 0.209 0.553 0.265 0.863l0.003 0.023c0.038 0.164 0.072 0.328 0.118 0.496 0.12-0.014 0.242-0.042 0.378-0.068 0.528-0.12 1.138-0.192 1.762-0.2l0.006-0zM30.244 22.892v0z"></path>\n</svg>\n',tiktok:'\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>tiktok</title>\n<path d="M29.046 7.029c-3.359 0-6.092-2.733-6.092-6.092 0-0.518-0.42-0.938-0.938-0.938h-5.021c-0.518 0-0.938 0.42-0.938 0.938v20.585c0 1.975-1.606 3.581-3.581 3.581s-3.581-1.606-3.581-3.581c0-1.975 1.606-3.581 3.581-3.581 0.518 0 0.938-0.42 0.938-0.938v-5.021c0-0.518-0.42-0.938-0.938-0.938-5.777 0-10.477 4.7-10.477 10.477s4.7 10.477 10.477 10.477c5.777 0 10.477-4.7 10.477-10.477v-9.112c1.866 0.995 3.942 1.514 6.092 1.514 0.518 0 0.938-0.42 0.938-0.938v-5.021c0-0.518-0.42-0.938-0.938-0.938zM28.108 12.011c-2.001-0.166-3.902-0.866-5.544-2.047-0.285-0.206-0.662-0.234-0.975-0.073s-0.51 0.482-0.51 0.834v10.798c0 4.743-3.859 8.602-8.602 8.602s-8.602-3.859-8.602-8.602c0-4.427 3.361-8.083 7.665-8.552v3.176c-2.563 0.446-4.519 2.687-4.519 5.376 0 3.009 2.447 5.456 5.456 5.456s5.456-2.448 5.456-5.456v-19.648h3.201c0.429 3.645 3.329 6.545 6.974 6.974z"></path>\n</svg>\n'},this.socialSlot=this.host.querySelector('[slot="social-item"]')?.innerHTML||'<a href={link} rel="noopener" target="_blank" title={type} aria-label={type}><span class="s-social-icon">{icon}</span></a>',salla.lang.onLoaded((()=>{this.links=salla.config.get("store.social")}))}getLinksArray(){return this.links?Object.entries(this.links).filter((([c,l])=>!!l&&"whatsapp"!==c)).map((([c,l])=>({type:c,value:l}))):[]}componentWillLoad(){return new Promise((c=>salla.onReady(c)))}render(){const c=this.getLinksArray();return l(t,{key:"8fb321cff071698640111ac5fccfb1fc8e130298"},l("ul",{key:"f00ef1d6ff429614000aba2af50514ea6f27a2f1",class:"s-social-list"},c.map((c=>l("li",{class:"s-social-link"},l("div",{id:"social-slot",innerHTML:this.socialSlot.replace(/\{icon\}/g,this.iconsList[c.type]).replace(/\{type\}/g,c.type).replace(/\{link\}/g,c.value.toString())}))))))}componentDidRender(){this.host.querySelectorAll("#social-slot").forEach((c=>c.replaceWith(c.firstChild))),this.host.querySelector('[slot="social-item"]')?.remove()}get host(){return s(this)}};o.style=":host{display:block}";export{o as salla_social}
|