@salla.sa/twilight-components 2.14.272 → 2.14.274
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-EG2Mf8a1.js → filepond-L1nMkdqn.js} +1 -1
- package/dist/cjs/{filepond-plugin-file-poster-DjNsnxTw.js → filepond-plugin-file-poster-BYZl5BE2.js} +1 -1
- package/dist/cjs/{filepond-plugin-file-validate-size-BlM1btNO.js → filepond-plugin-file-validate-size-DSrSXg4-.js} +1 -1
- package/dist/cjs/{filepond-plugin-file-validate-type-DhymSoh9.js → filepond-plugin-file-validate-type-CgnsyE2V.js} +1 -1
- package/dist/cjs/{filepond-plugin-image-edit-BQfvfpQ1.js → filepond-plugin-image-edit-lODj8ghv.js} +1 -1
- package/dist/cjs/{filepond-plugin-image-exif-orientation-DOi06s13.js → filepond-plugin-image-exif-orientation-uQ5EYlsy.js} +1 -1
- package/dist/cjs/{filepond-plugin-image-preview-Rfix7Xbt.js → filepond-plugin-image-preview-Cm1OgAvZ.js} +1 -1
- package/dist/cjs/{index-DS7mXxWq.js → index-BEeccvkl.js} +136 -26
- package/dist/cjs/{index-vIV5iX-W.js → index-D0NII6ks.js} +1 -1
- package/dist/cjs/loader.cjs.js +3 -4
- package/dist/cjs/{salla-add-product-button_51.cjs.entry.js → salla-accordion_62.cjs.entry.js} +2104 -120
- 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-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 +2 -2
- 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-accordion_4.cjs.entry.js → salla-order-details-options.cjs.entry.js} +1 -100
- package/dist/cjs/salla-order-details.cjs.entry.js +2 -2
- package/dist/cjs/salla-order-summary.cjs.entry.js +2 -2
- package/dist/cjs/salla-orders.cjs.entry.js +1 -1
- package/dist/cjs/salla-payments.cjs.entry.js +3 -3
- package/dist/cjs/salla-price-range.cjs.entry.js +3 -3
- package/dist/cjs/salla-review-card.cjs.entry.js +2 -2
- package/dist/cjs/salla-reviews-page.cjs.entry.js +2 -2
- package/dist/cjs/salla-reviews.cjs.entry.js +2 -2
- package/dist/cjs/salla-social.cjs.entry.js +2 -2
- package/dist/cjs/salla-tiered-offer.cjs.entry.js +1 -1
- package/dist/cjs/salla-tooltip.cjs.entry.js +2 -2
- 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 +3 -4
- package/dist/collection/collection-manifest.json +5 -0
- package/dist/collection/components/salla-accordion/salla-accordion-head.js +8 -2
- package/dist/collection/components/salla-comments/salla-comments.js +20 -1
- package/dist/collection/components/salla-conditional-fields/salla-conditional-fields.js +33 -5
- package/dist/collection/components/salla-multiple-bundle-product/components/salla-multiple-bundle-product-cart.css +0 -0
- package/dist/collection/components/salla-multiple-bundle-product/components/salla-multiple-bundle-product-cart.js +89 -0
- package/dist/collection/components/salla-multiple-bundle-product/components/salla-multiple-bundle-product-details.css +0 -0
- package/dist/collection/components/salla-multiple-bundle-product/components/salla-multiple-bundle-product-details.js +195 -0
- package/dist/collection/components/salla-multiple-bundle-product/components/salla-multiple-bundle-product-options-modal.css +3 -0
- package/dist/collection/components/salla-multiple-bundle-product/components/salla-multiple-bundle-product-options-modal.js +595 -0
- package/dist/collection/components/salla-multiple-bundle-product/components/salla-multiple-bundle-product-slider.css +0 -0
- package/dist/collection/components/salla-multiple-bundle-product/components/salla-multiple-bundle-product-slider.js +174 -0
- package/dist/collection/components/salla-multiple-bundle-product/interfaces.js +1 -0
- package/dist/collection/components/salla-multiple-bundle-product/salla-multiple-bundle-product.css +3 -0
- package/dist/collection/components/salla-multiple-bundle-product/salla-multiple-bundle-product.js +132 -0
- package/dist/collection/components/salla-notifications/salla-notification-item.js +1 -1
- package/dist/collection/components/salla-offer-modal/salla-offer-modal.js +1 -1
- package/dist/collection/components/salla-order-details/salla-order-details.js +1 -1
- package/dist/collection/components/salla-order-summary/salla-order-summary.js +1 -1
- package/dist/collection/components/salla-payments/salla-payments.js +2 -2
- package/dist/collection/components/salla-placeholder/salla-placeholder.js +1 -1
- package/dist/collection/components/salla-price-range/salla-price-range.js +2 -2
- package/dist/collection/components/salla-product-availability/salla-product-availability.js +1 -1
- package/dist/collection/components/salla-product-card/salla-product-card.js +5 -5
- package/dist/collection/components/salla-product-options/salla-product-options.js +105 -22
- package/dist/collection/components/salla-product-size-guide/salla-product-size-guide.js +2 -2
- package/dist/collection/components/salla-quantity-input/salla-quantity-input.js +1 -1
- package/dist/collection/components/salla-quick-buy/salla-quick-buy.js +1 -1
- package/dist/collection/components/salla-review-card/salla-review-card.js +1 -1
- package/dist/collection/components/salla-reviews/salla-reviews.js +1 -1
- package/dist/collection/components/salla-reviews-page/salla-reviews-page.js +1 -1
- package/dist/collection/components/salla-scopes/salla-scopes.js +1 -1
- package/dist/collection/components/salla-search/salla-search.js +3 -3
- package/dist/collection/components/salla-skeleton/salla-skeleton.js +1 -1
- package/dist/collection/components/salla-slider/salla-slider.js +2 -2
- package/dist/collection/components/salla-social/salla-social.js +1 -1
- package/dist/collection/components/salla-social-share/salla-social-share.js +1 -1
- package/dist/collection/components/salla-tabs/salla-tab-content.js +1 -1
- package/dist/collection/components/salla-tabs/salla-tab-header.js +1 -1
- package/dist/collection/components/salla-tabs/salla-tabs.js +1 -1
- package/dist/collection/components/salla-tel-input/salla-tel-input.js +1 -1
- package/dist/collection/components/salla-tooltip/salla-tooltip.js +1 -1
- package/dist/collection/components/salla-user-settings/salla-user-settings.js +1 -1
- package/dist/components/index.js +2 -2
- package/dist/components/salla-accordion-head2.js +2 -2
- package/dist/components/salla-comments.js +20 -1
- package/dist/components/salla-conditional-fields2.js +28 -6
- package/dist/components/salla-multiple-bundle-product-cart.d.ts +11 -0
- package/dist/components/salla-multiple-bundle-product-cart.js +9 -0
- package/dist/components/salla-multiple-bundle-product-cart2.js +153 -0
- package/dist/components/salla-multiple-bundle-product-details.d.ts +11 -0
- package/dist/components/salla-multiple-bundle-product-details.js +9 -0
- package/dist/components/salla-multiple-bundle-product-details2.js +283 -0
- package/dist/components/salla-multiple-bundle-product-options-modal.d.ts +11 -0
- package/dist/components/salla-multiple-bundle-product-options-modal.js +9 -0
- package/dist/components/salla-multiple-bundle-product-options-modal2.js +585 -0
- package/dist/components/salla-multiple-bundle-product-slider.d.ts +11 -0
- package/dist/components/salla-multiple-bundle-product-slider.js +9 -0
- package/dist/components/salla-multiple-bundle-product-slider2.js +81 -0
- package/dist/components/salla-multiple-bundle-product.d.ts +11 -0
- package/dist/components/salla-multiple-bundle-product.js +210 -0
- package/dist/components/salla-notification-item2.js +1 -1
- package/dist/components/salla-offer-modal.js +1 -1
- package/dist/components/salla-order-details.js +1 -1
- package/dist/components/salla-order-summary.js +1 -1
- package/dist/components/salla-payments.js +2 -2
- package/dist/components/salla-placeholder2.js +1 -1
- package/dist/components/salla-price-range2.js +2 -2
- package/dist/components/salla-product-availability2.js +1 -1
- package/dist/components/salla-product-card2.js +5 -5
- package/dist/components/salla-product-options.js +1 -810
- package/dist/{esm/salla-product-options.entry.js → components/salla-product-options2.js} +197 -30
- package/dist/components/salla-product-size-guide.js +2 -2
- package/dist/components/salla-quantity-input.js +1 -1
- package/dist/components/salla-quick-buy2.js +1 -1
- package/dist/components/salla-review-card2.js +1 -1
- package/dist/components/salla-reviews-page.js +1 -1
- package/dist/components/salla-reviews.js +1 -1
- package/dist/components/salla-scopes.js +1 -1
- package/dist/components/salla-search.js +3 -3
- package/dist/components/salla-skeleton2.js +1 -1
- package/dist/components/salla-slider2.js +2 -2
- package/dist/components/salla-social-share.js +1 -1
- package/dist/components/salla-social.js +1 -1
- package/dist/components/salla-tab-content2.js +1 -1
- package/dist/components/salla-tab-header2.js +1 -1
- package/dist/components/salla-tabs2.js +1 -1
- package/dist/components/salla-tel-input2.js +1 -1
- package/dist/components/salla-tooltip2.js +1 -1
- package/dist/components/salla-user-settings.js +1 -1
- package/dist/esm/{filepond-DbR8YXoW.js → filepond-JStnJXdo.js} +1 -1
- package/dist/esm/{filepond-plugin-file-poster-DEj3O3wZ.js → filepond-plugin-file-poster-13kSl6pa.js} +1 -1
- package/dist/esm/{filepond-plugin-file-validate-size-DYnIp5yF.js → filepond-plugin-file-validate-size-DGYz9wX6.js} +1 -1
- package/dist/esm/{filepond-plugin-file-validate-type-Cx_PD8SU.js → filepond-plugin-file-validate-type-7M_EeTPs.js} +1 -1
- package/dist/esm/{filepond-plugin-image-edit-BwmXRkmP.js → filepond-plugin-image-edit-C5N0Q0IF.js} +1 -1
- package/dist/esm/{filepond-plugin-image-exif-orientation-BtsMS4U-.js → filepond-plugin-image-exif-orientation-BvYJ1LVk.js} +1 -1
- package/dist/esm/{filepond-plugin-image-preview-DQ0c3hIt.js → filepond-plugin-image-preview-P4HnGsSt.js} +1 -1
- package/dist/esm/{index-D5PGwR59.js → index-Bdj1TBK9.js} +136 -26
- package/dist/esm/{index-xiIpq8fU.js → index-CqLymITv.js} +1 -1
- package/dist/esm/loader.js +3 -4
- package/dist/esm/{salla-add-product-button_51.entry.js → salla-accordion_62.entry.js} +2084 -111
- 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-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 +2 -2
- 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-accordion_4.entry.js → salla-order-details-options.entry.js} +2 -98
- package/dist/esm/salla-order-details.entry.js +2 -2
- package/dist/esm/salla-order-summary.entry.js +2 -2
- package/dist/esm/salla-orders.entry.js +1 -1
- package/dist/esm/salla-payments.entry.js +3 -3
- package/dist/esm/salla-price-range.entry.js +3 -3
- package/dist/esm/salla-review-card.entry.js +2 -2
- package/dist/esm/salla-reviews-page.entry.js +2 -2
- package/dist/esm/salla-reviews.entry.js +2 -2
- package/dist/esm/salla-social.entry.js +2 -2
- package/dist/esm/salla-tiered-offer.entry.js +1 -1
- package/dist/esm/salla-tooltip.entry.js +2 -2
- package/dist/esm/salla-verify.entry.js +1 -1
- package/dist/esm/salla-wallet.entry.js +1 -1
- package/dist/esm/twilight.js +3 -4
- package/dist/twilight/{p-56fa3b9c.entry.js → p-0f8534fd.entry.js} +1 -1
- package/dist/twilight/{p-3f412ab2.entry.js → p-1be88437.entry.js} +1 -1
- package/dist/twilight/{p-10856491.entry.js → p-1d81f143.entry.js} +1 -1
- package/dist/twilight/{p-4611a11b.entry.js → p-282f4f69.entry.js} +1 -1
- package/dist/twilight/{p-9e3f55be.entry.js → p-34e10e96.entry.js} +1 -1
- package/dist/twilight/{p-c15928d5.entry.js → p-3a4137eb.entry.js} +1 -1
- package/dist/twilight/{p-0ffafdea.entry.js → p-456d49c3.entry.js} +1 -1
- package/dist/twilight/{p-a61e2b8e.entry.js → p-4d05539c.entry.js} +1 -1
- package/dist/twilight/{p-e3b0a71f.entry.js → p-550d2b59.entry.js} +1 -1
- package/dist/twilight/{p-de200512.entry.js → p-57629f65.entry.js} +1 -1
- package/dist/twilight/p-5971eca7.entry.js +4 -0
- package/dist/twilight/p-723d7b1b.entry.js +4 -0
- package/dist/twilight/{p-92848d53.entry.js → p-78e6e403.entry.js} +1 -1
- package/dist/twilight/{p-2613f6dc.entry.js → p-895bd462.entry.js} +1 -1
- package/dist/twilight/p-9760fa21.entry.js +4 -0
- package/dist/twilight/{p-C4wd-bXb.js → p-AhRhML1e.js} +1 -1
- package/dist/twilight/{p-Bvez5luh.js → p-BP3jjHyr.js} +1 -1
- package/dist/twilight/{p-D5PGwR59.js → p-Bdj1TBK9.js} +2 -2
- package/dist/twilight/{p-BsHa_73h.js → p-Btn8p1Mk.js} +1 -1
- package/dist/twilight/{p-D0ZZ4jO5.js → p-CDM6fsL2.js} +2 -2
- package/dist/twilight/{p-CH8-uKSN.js → p-Ccp_rmSW.js} +1 -1
- package/dist/twilight/{p-DV_VEuIe.js → p-D6-aDTP4.js} +1 -1
- package/dist/twilight/{p-D5p2t_CX.js → p-DD6CdbcU.js} +1 -1
- package/dist/twilight/{p-DEUne75O.js → p-DYhkBiMu.js} +1 -1
- package/dist/twilight/p-a1e9d695.entry.js +4 -0
- package/dist/twilight/{p-eaad31d1.entry.js → p-a5681537.entry.js} +1 -1
- package/dist/twilight/{p-e95284d7.entry.js → p-a8d01888.entry.js} +1 -1
- package/dist/twilight/p-b254a752.entry.js +4 -0
- package/dist/twilight/{p-eae51196.entry.js → p-bd7a0c4f.entry.js} +1 -1
- package/dist/twilight/{p-7df916fc.entry.js → p-bf90a8c8.entry.js} +1 -1
- package/dist/twilight/p-c293f9c1.entry.js +11 -0
- package/dist/twilight/{p-b94ebbd9.entry.js → p-c9ad0ad1.entry.js} +1 -1
- package/dist/twilight/p-cc93a79e.entry.js +4 -0
- package/dist/twilight/{p-2bf21126.entry.js → p-e825aae4.entry.js} +1 -1
- package/dist/twilight/{p-8ba8efe1.entry.js → p-e99645f0.entry.js} +1 -1
- package/dist/twilight/{p-f3c29342.entry.js → p-f232e683.entry.js} +1 -1
- package/dist/twilight/{p-65b1fcea.entry.js → p-f7784dda.entry.js} +1 -1
- package/dist/twilight/{p-280c1f64.entry.js → p-f85916d5.entry.js} +1 -1
- package/dist/twilight/{p-bcab2639.entry.js → p-f96be282.entry.js} +1 -1
- package/dist/twilight/{p-b40d5871.entry.js → p-faee9d58.entry.js} +1 -1
- package/dist/twilight/twilight.esm.js +1 -1
- package/dist/types/components/salla-accordion/salla-accordion-head.d.ts +6 -0
- package/dist/types/components/salla-conditional-fields/salla-conditional-fields.d.ts +2 -0
- package/dist/types/components/salla-multiple-bundle-product/components/salla-multiple-bundle-product-cart.d.ts +10 -0
- package/dist/types/components/salla-multiple-bundle-product/components/salla-multiple-bundle-product-details.d.ts +20 -0
- package/dist/types/components/salla-multiple-bundle-product/components/salla-multiple-bundle-product-options-modal.d.ts +46 -0
- package/dist/types/components/salla-multiple-bundle-product/components/salla-multiple-bundle-product-slider.d.ts +22 -0
- package/dist/types/components/salla-multiple-bundle-product/interfaces.d.ts +101 -0
- package/dist/types/components/salla-multiple-bundle-product/salla-multiple-bundle-product.d.ts +42 -0
- package/dist/types/components/salla-product-options/salla-product-options.d.ts +21 -1
- package/dist/types/components.d.ts +298 -2
- package/package.json +5 -5
- package/dist/cjs/app-globals-OVEmNa5W.js +0 -38
- package/dist/cjs/camera-DytepEoK.js +0 -13
- package/dist/cjs/minus-CCryh1qf.js +0 -21
- package/dist/cjs/salla-booking-field_2.cjs.entry.js +0 -280
- package/dist/cjs/salla-product-options.cjs.entry.js +0 -715
- package/dist/esm/app-globals-BKgAyoNJ.js +0 -36
- package/dist/esm/camera-C6jIkM-X.js +0 -11
- package/dist/esm/minus-DfeagqF1.js +0 -18
- package/dist/esm/salla-booking-field_2.entry.js +0 -277
- package/dist/twilight/p-19c38b4a.entry.js +0 -11
- package/dist/twilight/p-8272b58f.entry.js +0 -4
- package/dist/twilight/p-989fcbb4.entry.js +0 -4
- package/dist/twilight/p-9f47b72b.entry.js +0 -4
- package/dist/twilight/p-C6jIkM-X.js +0 -4
- package/dist/twilight/p-DfeagqF1.js +0 -4
- package/dist/twilight/p-KHt1Smzh.js +0 -4
- package/dist/twilight/p-b8d41065.entry.js +0 -4
- package/dist/twilight/p-dd9695d6.entry.js +0 -4
- package/dist/twilight/p-e2ebb686.entry.js +0 -4
- package/dist/twilight/p-e30f7c20.entry.js +0 -4
- package/dist/twilight/p-fcb3e719.entry.js +0 -4
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Crafted with ❤ by Salla
|
|
3
|
-
*/
|
|
4
|
-
import{r as t,c as i,h as o,H as s,g as n}from"./p-D5PGwR59.js";import{I as a}from"./p-uTyAzPSy.js";import{C as e}from"./p-C6jIkM-X.js";var l,r;!function(t){t.COLOR="color",t.DATE="date",t.DATETIME="datetime",t.DONATION="donation",t.IMAGE="image",t.MULTIPLE_OPTIONS="multiple-options",t.NUMBER="number",t.SINGLE_OPTION="single-option",t.DIGITAL_CARD_VALUE="digital-code-value",t.COUNTRY="country",t.SPLITTER="splitter",t.TEXT="text",t.TEXTAREA="textarea",t.THUMBNAIL="thumbnail",t.TIME="time",t.RADIO="radio",t.CHECKBOX="checkbox",t.MAP="map",t.FILE="file",t.COLOR_PICKER="color_picker",t.BOOKING="booking"}(l||(l={})),function(t){t.Sar="SAR"}(r||(r={}));const p=class{constructor(s){if(t(this,s),this.changed=i(this,"changed"),this.fileTypes={pdf:"application/pdf",png:"image/png",jpg:"image/jpeg",word:"application/doc,application/ms-doc,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document",exl:"application/excel,application/vnd.ms-excel,application/x-excel,application/x-msexcel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",txt:"text/plain"},this.outOfStockText="",this.donationAmount=salla.lang.get("pages.products.donation_amount"),this.selectDonationAmount=salla.lang.getWithDefault("pages.products.select_donation_amount","تحديد مبلغ التبرع"),this.selectAmount=salla.lang.getWithDefault("pages.products.select_amount","اختر المبلغ"),this.isCustomDonation=!1,this.selectedOptions=[],this.disableCardValue=!0,this.availableDigitalCardValues=[],this.userInitiatedValidation=!1,this.outSkus=[],this.ignoreDefaultCardValue=!1,this.productId=salla.config.get("page.id"),this.handleDonationOptions=(t,i,o)=>{if("custom"===i&&"input"===o)return salla.helpers.inputDigitsOnly(t.target),void salla.event.emit("product-options::donation-changed",{id:this.productId,price:t.target.value});if(t.preventDefault(),t.stopPropagation(),this.isCustomDonation="custom"===t.target.value,this.donationInput){if("custom"===t.target.value?(this.donationInput.value="",this.donationInput.focus()):this.donationInput.value=t.target.value,"custom"===i)return;salla.event.emit("product-options::donation-changed",{id:this.productId,price:t.target.value})}},this.hideLabel=t=>!(t.type!==l.DONATION||!t.donation||t.donation.can_donate),this.getExpireDonationMessage=t=>{if(!t.donation)return;const i=t.donation.target_amount<=t.donation.collected_amount;return o("div",{class:{"s-product-options-donation-message":!0,"s-product-options-donation-completed":i,"s-product-options-donation-expired":!i}},o("p",null,t.donation.target_message),o("span",{innerHTML:i?salla.money(t.donation.target_amount):""}))},this.canDisabled=!salla.config.get("store.settings.product.notify_options_availability")||salla.url.is_page("cart"),salla.lang.onLoaded((()=>{this.outOfStockText=salla.lang.get("pages.products.out_of_stock"),this.donationAmount=salla.lang.get("pages.products.donation_amount"),this.selectDonationAmount=salla.lang.getWithDefault("pages.products.select_donation_amount","تحديد مبلغ التبرع"),this.selectAmount=salla.lang.getWithDefault("pages.products.select_amount","اختر المبلغ")})),this.options)try{return void this.setOptionsData(Array.isArray(this.options)?this.options:JSON.parse(this.options))}catch(t){salla.log("Bad json passed via options prop")}Array.isArray(this.optionsData)||(salla.log("Options is not an array[] ---\x3e ",this.optionsData),this.setOptionsData([])),this.productId&&!salla.url.is_page("cart")&&salla.api.product.getDetails(this.productId,["options"]).then((t=>this.setOptionsData(t.data.options)))}async setOptionsData(t){this.optionsData=t;const i=this;this.optionsData[0]?.details?.forEach((function(t){Object.entries(t.skus_availability||{}).filter((t=>!t[1])).map((t=>i.outSkus.push(Number(t[0]))))}))}async getSelectedOptionsData(){const t={};return this.host.getElementSallaData().forEach(((i,o)=>{o.startsWith("options[")&&(t[o.replace("options[","").replace("]","")]=i)})),t}async reportValidity(){const t=this.host.querySelectorAll("[required]");let i=!0;for(let o=0;o<t.length;o++)"reportValidity"in t[o]&&!t[o].reportValidity()&&(i=!1);return i}async hasOutOfStockOption(){return this.selectedOptions.some((t=>t.is_out))||this.selectedSkus?.length&&this.selectedSkus?.every((t=>this.outSkus.includes(t)))}async getSelectedOptions(){return this.selectedOptions}async getOption(t){return this.optionsData.find((i=>i.id===t))}invalidHandler(t,i){const o=t.target.closest(".s-product-options-option");o.classList.contains("s-product-options-option-error")||o.classList.add("s-product-options-option-error"),this.userInitiatedValidation&&!salla.url.is_page("cart")&&this.host.querySelector(".s-product-options-option-error")===o&&this.scrollToElement(o)}scrollToElement(t){t&&t.scrollIntoView({behavior:"smooth",block:"center"})}changedHandler(t,i,o=!0){const s={event:t,option:i,detail:null,productId:this.productId};if(i.details){const o=i.details.find((i=>Number(i.id)===Number(t.target.value)));s.detail=o}"country"===i.type&&this.handleCountryOptionChange(t,s.detail);const n=t.target.closest(".s-product-options-option");(t.target.value||(i.type===l.FILE||i.type===l.IMAGE)&&"added"===t.type||i.type===l.MAP&&"selected"===t.type&&t.target.lat&&t.target.lng)&&setTimeout((()=>{n.classList.remove("s-product-options-option-error")}),200),i.type===l.DONATION&&salla.event.emit("product-options::donation-changed",{id:this.productId,price:t.target.value}),this.setSelectedSkus(),this.handleRequiredMultipleOptions(i);const a=this.selectedOptions.findIndex((t=>t.option_id===s.option.id));if(s.option.type===l.MULTIPLE_OPTIONS){const t=this.selectedOptions.findIndex((t=>t.option_id===s.option.id&&t?.id===s.detail?.id));t>-1?this.selectedOptions.splice(t,1):this.selectedOptions.push({...s.detail,option_id:s.option.id})}else s.detail&&0!==Object.keys(s.detail).length?a>-1?this.selectedOptions[a]={...s.detail,option_id:s.option.id}:this.selectedOptions.push({...s.detail,option_id:s.option.id}):a>-1&&this.selectedOptions.splice(a,1);this.optionsData=this.optionsData.map((t=>t.id===s.option.id?{...t,details:t.details.map((t=>({...t,is_selected:s.option.type===l.MULTIPLE_OPTIONS?this.selectedOptions.some((i=>i.id===t.id)):Number(t.id)===Number(s.detail?.id),value:s.detail?.value})))}:t)),o&&(this.changed.emit(s),salla.event.emit("product-options::change",s))}setSelectedSkus(){this.selectedSkus=this.selectedOptions.map((t=>Object.keys(t.skus_availability||{}))).reduce(((t,i)=>t.filter((t=>i.includes(t)))),[]).map((t=>Number(t)))}handleRequiredMultipleOptions(t){if(t.type!==l.MULTIPLE_OPTIONS||!t.required)return;const i=this.host.querySelector(`[data-option-id="${t.id}"]`),o=i.querySelectorAll("input:checked").length;i.querySelectorAll("input").forEach((t=>t.toggleAttribute("required",!o)))}getLatLng(t,i){return t?t.split(",")["lat"===i?0:1]:""}getDisplayForType(t){return this[`${t.type}Option`]?this[`${t.type}Option`](t):t.type===l.COLOR_PICKER?this.colorPickerOption(t):t.type===l.MULTIPLE_OPTIONS?this.multipleOptions(t):t.type===l.SINGLE_OPTION?this.singleOption(t):t.type===l.DIGITAL_CARD_VALUE?this.digitalCardValuesOption(t):t.type===l.COUNTRY?this.countryOption(t):t.type===l.BOOKING&&salla.url.is_page("cart")?o("salla-booking-field",{onInvalidInput:i=>this.invalidHandler(i,t),option:t,productId:t.value}):(salla.log(`Couldn't find options type(${t.type})😢`),"")}getOptionShownWhen(t){return t.visibility_condition?{"data-show-when":`options[${t.visibility_condition.option}] ${t.visibility_condition.operator} ${t.visibility_condition.value}`}:{}}getAvailableDigitalCardSKUs(t){const i=this.optionsData.find((({type:t})=>"digital-code-value"===t));if(!i)throw new Error("product-options:: No digital card options found");const o=Object.keys(t.skus_availability).filter((i=>!1===t.skus_availability[i]));this.availableDigitalCardValues=i.details.filter((t=>!Object.keys(t.skus_availability).filter((t=>o.includes(t))).length))}handleCountryOptionChange(t,i){t.stopImmediatePropagation(),this.ignoreDefaultCardValue=!0;const o=this.host.querySelector("input[data-code-value]:checked");if(o&&(o.checked=!1),!this.optionsData.find((({type:t})=>"digital-code-value"===t)))throw new Error("product-options:: No digital card options found");this.getAvailableDigitalCardSKUs(i)}getSelectedDigitalCardOptions(t){const i=t.details.find((t=>t.is_selected)),o=t.details.find((t=>!!t.is_default))||t.details[0];if(["digital-code-value","country"].includes(t.type))return i||o}async componentWillLoad(){if(salla.url.is_page("cart")&&(this.disableCardValue=!1,this.fillSelectedOptions()),this.config)try{this.optionConfig="string"==typeof this.config?JSON.parse(this.config):this.config}catch(t){console.error("Failed to parse JSON in config prop:",t)}if(this.optionsData.filter((({type:t})=>["country","digital-card-value"].includes(t))).length>0&&salla.url.is_page("cart")){const t=this.optionsData.find((t=>"country"===t.type)),i=t&&this.getSelectedDigitalCardOptions(t);i&&this.getAvailableDigitalCardSKUs(i)}return this.outOfStockText=salla.lang.get("pages.products.out_of_stock"),await salla.onReady(),document.addEventListener("paste",this.handlePaste.bind(this)),!salla.storage.get("cart.id")&&this.optionsData.some((t=>["file","image"].includes(t.type)))?salla.api.cart.getCurrentCartId(!1,"salla-product-options"):null}handlePaste(t){const i=t.target;if(!(Salla.config.get("store.settings.content_copyright")&&Salla.helpers.hasApplePay()&&(i instanceof HTMLInputElement||i instanceof HTMLTextAreaElement)&&i.classList.contains("s-form-control")&&i.name.startsWith("options[")))return;t.preventDefault();const o=t.clipboardData?.getData("text")||"",s=i.selectionStart,n=i.selectionEnd,a=i.value.slice(0,s)+o+i.value.slice(n);i.value=a,i.setSelectionRange(s+o.length,s+o.length)}hideDigitalCardsOptions(t){return this.disableCardValue&&t.type===l.DIGITAL_CARD_VALUE&&!salla.url.is_page("cart")}render(){if(0!==this.optionsData?.length)return o(s,{class:"s-product-options-wrapper"},o("salla-conditional-fields",null,this.optionsData.map((t=>o("div",{key:t.id,class:"s-product-options-option-container"+(t.visibility_condition||this.hideDigitalCardsOptions(t)?" hidden":""),"data-option-id":t.id,...this.getOptionShownWhen(t)},"splitter"===t.name?this.splitterOption():o("div",{class:{"s-product-options-option":!0,"s-product-options-option-booking":t.type===l.BOOKING&&salla.url.is_page("cart")},"data-option-type":t.type,"data-option-required":`${t.required}`},o("label",{htmlFor:`options[${t.id}]`,class:"s-product-options-option-label "+(this.hideLabel(t)?"s-product-options-option-label-hidden":"")},o("b",null,t.name,t.required&&o("span",null," * ")," "),o("small",null,t.placeholder)),o("div",{class:"s-product-options-option-content "+(this.hideLabel(t)||t.type===l.BOOKING&&salla.url.is_page("cart")?"s-product-options-option-content-full-width":"")},this.getDisplayForType(t))))))))}generateUniqueKey(t){return this.uniqueKey?`${t}-${this.uniqueKey}`:t}fillSelectedOptions(){this.selectedOptions=this.optionsData.reduce(((t,i)=>{const o=i.details.filter((t=>t.is_selected)).map((t=>({...t,option_id:i.id})));return t.concat(o)}),[])}componentDidLoad(){if(0===this.optionsData?.length&&!this.optionsData.some((t=>t.type===l.DONATION)))return;const t=this.optionsData.find((t=>t.type===l.DONATION))?.details.find((t=>t.is_selected));t&&setTimeout((()=>{salla.event.emit("product-options::donation-changed",{id:this.productId,price:t.additional_price})}),1e3)}async enableUserInitiatedValidation(){this.userInitiatedValidation=!0}async validateAndScroll(){return await this.enableUserInitiatedValidation(),this.reportValidity()}donationOption(t,i){return o("div",{class:"s-product-options-donation-wrapper"},t.donation?.can_donate?[t.donation?o("div",{key:t.id,class:"s-product-options-donation-progress"},o("salla-progress-bar",{donation:t.donation})):"",t.details.length?[o("h4",{key:t.id},this.selectAmount),o("div",{key:t.id,class:"s-product-options-donation-options"},t.details.map(((i,s)=>o("div",{key:t.id,class:"s-product-options-donation-options-item"},o("input",{id:this.generateUniqueKey(`donation-option-${s}`),type:"radio",name:"donating_option",checked:i.is_selected,value:i.additional_price,onChange:t=>this.handleDonationOptions(t,i,"option")}),o("label",{htmlFor:this.generateUniqueKey(`donation-option-${s}`)},o("span",{innerHTML:salla.money(i.name)}))))),t.donation?.custom_amount_enabled?o("div",{class:"s-product-options-donation-options-item"},o("input",{id:this.generateUniqueKey("donation-option-custom"),type:"radio",name:"donating_option",value:"custom",onChange:t=>this.handleDonationOptions(t,"custom","option")}),o("label",{htmlFor:this.generateUniqueKey("donation-option-custom")},o("span",null," ",this.selectDonationAmount," "))):"")]:"",o("div",{key:t.id,class:{"s-product-options-donation-input-group":!0,shown:!t.details.length||t.details.length&&this.isCustomDonation}},o("input",{type:"text",id:"donating-amount",name:"donation_amount",class:"s-form-control",ref:t=>{this.donationInput=t},value:t.details.length&&t.details.some((t=>t.is_selected))?t.details.find((t=>t.is_selected)).additional_price:t.value,placeholder:t.placeholder,onInput:t=>this.handleDonationOptions(t,"custom","input"),onBlur:i=>this.changedHandler(i,t),onInvalid:i=>this.invalidHandler(i,t)}),o("span",{class:"s-product-options-donation-amount-currency"},salla.config.currency(salla.config.get("user.currency_code")).symbol))]:this.getExpireDonationMessage(t))}fileUploader(t,i=null){return o("salla-file-upload",{...i||{},"payload-name":"file",value:t.value,"instant-upload":!0,name:`options[${t.id}]`,required:!t.visibility_condition&&t.required,height:"120px",onAdded:i=>this.changedHandler(i,t),url:salla.cart.api.getUploadImageEndpoint(),"form-data":{cart_item_id:this.productId,product_id:this.productId},onInvalidInput:i=>this.invalidHandler(i,t),class:{"s-product-options-image-input":!0,required:t.required}},o("div",{class:"s-product-options-filepond-placeholder"},o("span",{class:"s-product-options-filepond-placeholder-icon",innerHTML:i.accept?.split(",").every((t=>t.includes("image")))?e:'\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-upload</title>\n<path d="M21.333 24c0.341 0 0.683-0.131 0.943-0.391 0.521-0.521 0.521-1.364 0-1.885l-5.333-5.333c-0.123-0.123-0.271-0.22-0.433-0.288-0.327-0.135-0.693-0.135-1.019 0-0.163 0.068-0.311 0.165-0.433 0.288l-5.333 5.333c-0.521 0.521-0.521 1.364 0 1.885s1.364 0.521 1.885 0l3.057-3.057v10.115c0 0.736 0.597 1.333 1.333 1.333s1.333-0.597 1.333-1.333v-10.115l3.057 3.057c0.26 0.26 0.601 0.391 0.943 0.391zM28.943 9.724l-9.333-9.333c-0.249-0.251-0.589-0.391-0.943-0.391h-12c-2.205 0-4 1.795-4 4v24c0 2.205 1.795 4 4 4h4c0.736 0 1.333-0.597 1.333-1.333s-0.597-1.333-1.333-1.333h-4c-0.735 0-1.333-0.599-1.333-1.333v-24c0-0.735 0.599-1.333 1.333-1.333h11.448l8.552 8.552v16.781c0 0.735-0.599 1.333-1.333 1.333h-4c-0.736 0-1.333 0.597-1.333 1.333s0.597 1.333 1.333 1.333h4c2.205 0 4-1.795 4-4v-17.333c0-0.353-0.14-0.693-0.391-0.943z"></path>\n</svg>\n'}),o("p",{class:"s-product-options-filepond-placeholder-text"},salla.lang.get("common.uploader.drag_and_drop")),o("span",{class:"filepond--label-action"},salla.lang.get("common.uploader.browse"))))}imageOption(t){return this.fileUploader(t,{accept:"image/png,image/jpeg,image/jpg,image/gif"})}fileOption(t){const i=t.details.map((t=>this.fileTypes[t.name])).filter(Boolean);return i?.length?this.fileUploader(t,{accept:i.join(",")}):"File types not selected."}numberOption(t){return o("input",{type:"text",value:t.value,class:"s-form-control",required:!t.visibility_condition&&t.required,name:`options[${t.id}]`,placeholder:t.placeholder,onBlur:i=>this.changedHandler(i,t),onInvalid:i=>this.invalidHandler(i,t),onInput:t=>salla.helpers.inputDigitsOnly(t.target)})}splitterOption(){return o("div",{class:"s-product-options-splitter"})}textOption(t){return o("div",{class:"s-product-options-text"},o("input",{type:"text",value:t.value,maxLength:t?.length,class:"s-form-control",required:!t.visibility_condition&&t.required,name:`options[${t.id}]`,placeholder:t.placeholder,onInvalid:i=>this.invalidHandler(i,t),onChange:i=>this.changedHandler(i,t)}))}textareaOption(t){return o("div",{class:"s-product-options-textarea"},o("div",{class:"mt-1"},o("textarea",{rows:4,value:t.value,maxLength:t?.length,class:"s-form-control",required:!t.visibility_condition&&t.required,id:`options[${t.id}]`,name:`options[${t.id}]`,placeholder:t.placeholder,onInvalid:i=>this.invalidHandler(i,t),onChange:i=>this.changedHandler(i,t)})))}mapOption(t){return o("salla-map",{zoom:15,lat:this.getLatLng(t.value,"lat"),lng:this.getLatLng(t.value,"lng"),name:`options[${t.id}]`,searchable:!0,required:t.required,onInvalidInput:i=>this.invalidHandler(i,t),onSelected:i=>this.changedHandler(i,t)})}colorPickerOption(t){return o("salla-color-picker",{onSubmitted:i=>this.changedHandler(i,t),name:`options[${t.id}]`,required:!t.visibility_condition&&t.required,onInvalidInput:i=>this.invalidHandler(i,t),color:t.value})}timeOption(t){return o("salla-datetime-picker",{noCalendar:!0,enableTime:!0,dateFormat:"h:i K",value:t.value,placeholder:t.name,required:!t.visibility_condition&&t.required,name:`options[${t.id}]`,class:"s-product-options-time-element",onInvalidInput:i=>this.invalidHandler(i,t),onPicked:i=>this.changedHandler(i,t)})}dateOption(t){return o("div",{class:"s-product-options-date-element"},o("salla-datetime-picker",{value:t.value,placeholder:t.name,required:!t.visibility_condition&&t.required,minDate:new Date,name:`options[${t.id}]`,onInvalidInput:i=>this.invalidHandler(i,t),onPicked:i=>this.changedHandler(i,t)}))}datetimeOption(t){return o("div",{class:"s-product-options-datetime-element"},o("salla-datetime-picker",{enableTime:!0,value:t.value,dateFormat:"Y-m-d G:i:K",placeholder:t.name,required:!t.visibility_condition&&t.required,name:`options[${t.id}]`,maxDate:t.to_date_time,minDate:t.from_date_time,onInvalidInput:i=>this.invalidHandler(i,t),onPicked:i=>this.changedHandler(i,t)}))}getOptionDetailName(t,i=!0,o){let s;return o&&o===l.COLOR&&(s=t.name+(i&&this.isOptionDetailOut(t)&&!salla.url.is_page("cart")&&!this.hideOutLabel?` <br/> <p> ${this.outOfStockText} </p>`:"")+(t.additional_price?` <p> (${salla.money(t.additional_price,!1)}) </p>`:"")),s||(s=t.name+(i&&this.isOptionDetailOut(t)&&!salla.url.is_page("cart")&&!this.hideOutLabel?` - ${this.outOfStockText}`:"")+(t.additional_price?` (${salla.money(t.additional_price,!1)})`:"")),s.replace("<i class=sicon-sar></i>",salla.config.currency()?.symbol||"ر.س")}isOptionDetailOut(t){if(t.is_out||!t.skus_availability||!this.selectedSkus?.length)return t.is_out;const i=this.selectedOptions.filter((i=>i.id===t.id)).length;if(i&&1===this.selectedOptions.length)return!1;if(i){const i=this.selectedSkus.filter((t=>this.outSkus.includes(t)));return Object.keys(t.skus_availability).some((t=>i.includes(Number(t))))}return this.selectedOptions.some((i=>i.is_out&&i.option_id!==t.option_id))}renderInput(t,i,s,n,a,e){const l=this.generateUniqueKey(`${t}-${s.id}-${i.id}`),r=this.isOptionDetailOut(i);return o("label",{class:{"s-product-options-disabled":r}},o("input",{id:l,type:t,name:a,value:i.id,disabled:r,required:n,checked:i.is_selected,onInvalid:t=>this.invalidHandler(t,s),onChange:t=>this.changedHandler(t,s)}),o("div",{class:{"s-product-options-grid-mode-span":e,"s-product-options-disabled":r}},this.getOptionDetailName(i)))}renderOptionDetails(t,i,o,s=!1){const n="radio"===t?`options[${i.id}]`:`options[${i.id}][]`;return i?.details.map((a=>this.renderInput(t,a,i,o,n,s)))}renderSelect(t){return o("div",null,o("select",{name:`options[${t.id}]`,required:!t.visibility_condition&&t.required,class:"s-form-control",onInvalid:i=>this.invalidHandler(i,t),onChange:i=>this.changedHandler(i,t)},o("option",{value:""},t.placeholder),t?.details.map((t=>o("option",{key:t.id,value:t.id,disabled:this.canDisabled&&this.isOptionDetailOut(t),selected:t.is_selected},this.getOptionDetailName(t))))))}renderButtonStyle(t,i,s){return o("div",{class:"s-product-options-grid-mode"},this.renderOptionDetails(t,i,s,!0))}singleOption(t){return"button"===this.optionConfig?.["single-option"]?.type?this.renderButtonStyle("radio",t,!t.visibility_condition&&t.required):this.renderSelect(t)}multipleOptions(t){const i="button"===this.optionConfig?.["multiple-option"]?.type,s=t.required&&!t.details.some((t=>t.is_selected))&&!t.visibility_condition;return i?this.renderButtonStyle("checkbox",t,s):o("div",{class:{"s-product-options-multiple-options-wrapper":!0,required:t.required}},this.renderOptionDetails("checkbox",t,s))}colorOption(t){return o("fieldset",{class:"s-product-options-colors-wrapper"},t?.details.map((i=>o("div",{class:"s-product-options-colors-item",key:i.id},o("input",{type:"radio",value:i.id,required:!t.visibility_condition&&t.required,checked:i.is_selected,name:`options[${t.id}]`,disabled:this.canDisabled&&this.isOptionDetailOut(i),id:this.generateUniqueKey(`color-${this.productId}-${t.id}-${i.id}`),onInvalid:i=>this.invalidHandler(i,t),onChange:i=>this.changedHandler(i,t)}),o("label",{htmlFor:this.generateUniqueKey(`color-${this.productId}-${t.id}-${i.id}`)},o("span",{style:{backgroundColor:i.color}}),o("div",{innerHTML:this.getOptionDetailName(i,!0,t.type)}))))))}thumbnailOption(t){return o("div",{class:"s-product-options-thumbnails-wrapper"},t.details.map((i=>o("div",{key:i.id},o("input",{type:"radio",value:i.id,"data-itemid":i.id,required:!t.visibility_condition&&t.required,checked:i.is_selected,name:`options[${t.id}]`,"data-img-id":i.option_value,disabled:this.canDisabled&&this.isOptionDetailOut(i),id:this.generateUniqueKey(`option_${this.productId}-${t.id}_${i.id}`),onInvalid:i=>this.invalidHandler(i,t),onChange:i=>this.changedHandler(i,t)}),o("label",{htmlFor:this.generateUniqueKey(`option_${this.productId}-${t.id}_${i.id}`),"data-img-id":i.option_value,class:"go-to-slide"},o("img",{"data-src":i.image,src:i.image,title:i.name,alt:i.name}),o("span",{innerHTML:a,class:"s-product-options-thumbnails-icon"}),this.isOptionDetailOut(i)?[o("small",{key:i.id,class:"s-product-options-thumbnails-stock-badge"},this.outOfStockText),this.canDisabled?o("div",{key:i.id,class:"s-product-options-thumbnails-badge-overlay"}):""]:""),o("p",null,this.getOptionDetailName(i,!1)," ")))))}digitalCardValuesOption(t){return o("div",{class:"s-product-options-digital-card-wrapper"},this.availableDigitalCardValues.length>0?this.availableDigitalCardValues.map((i=>{const s=String(i.id);return o("label",{htmlFor:this.generateUniqueKey(s.toString()),key:s,class:"s-product-options-digital-card-option"},o("input",{type:"radio","data-code-value":!0,class:"s-form-control s-product-options-digital-card-input",value:i.id,name:`options[${t.id}]`,id:this.generateUniqueKey(s.toString()),required:!t.visibility_condition&&t.required,onInvalid:i=>this.invalidHandler(i,t),...this.ignoreDefaultCardValue?{}:{defaultChecked:this.getSelectedDigitalCardOptions(t)?.id===i.id}}),o("span",null,i.name," ",salla.config?.currency()?.symbol))})):o("div",{class:"s-product-options-digital-card-out-of-stock"}))}countryOption(t){return o("div",{class:"s-product-options-digital-card-wrapper"},t.details.map((i=>o("label",{htmlFor:this.generateUniqueKey(i.id.toString()),key:i.id,class:{"s-product-options-digital-card-option":!0,"s-product-options-digital-card-option-stock-out":i.is_out}},o("input",{id:this.generateUniqueKey(i.id.toString()),type:"radio",class:"s-form-control s-product-options-digital-card-input",value:i.id,name:`options[${t.id}]`,disabled:i.is_out,required:!t.visibility_condition&&t.required,onInvalid:i=>this.invalidHandler(i,t),onChange:i=>this.changedHandler(i,t),onClick:()=>{this.disableCardValue=!1},...salla.url.is_page("cart")?{defaultChecked:this.getSelectedDigitalCardOptions(t)?.id===i.id}:{}}),o("img",{loading:"lazy",alt:i.code,height:24,width:24,class:"s-product-options-country-flag",src:`https://cdn.assets.salla.network/prod/admin/cp/assets/flags/1x1/${String(i.code).toLocaleLowerCase()}.svg`}),o("span",null,i.name)))))}get host(){return n(this)}};p.style="";export{p as salla_product_options}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Crafted with ❤ by Salla
|
|
3
|
-
*/
|
|
4
|
-
import{r as s,h as t,g as a}from"./p-D5PGwR59.js";import{a as i}from"./p-CgtvEd63.js";const e=class{constructor(t){s(this,t),this.currentSlug=salla.config.get("page.slug"),salla.onReady((()=>{this.currentSlug=salla.config.get("page.slug")})),this.advSlot=this.host.querySelector('[slot="adv"]')?.innerHTML||'<div class="s-advertisement-content"><h2 class="s-advertisement-content-main">{iconElem}{urlElem}</h2>{closeElem}</div>\n '}isNotVisible(s){return!!salla.storage.get(`statusAd-${s.id}`)}setCanDisplayFlag(s,t){t||(salla.storage.set(`statusAd-${s.id}`,"dismissed"),i({targets:this.host,opacity:[1,0],duration:300,height:[this.host.clientHeight,0],easing:"easeInOutQuad"}))}render(){if((!Array.isArray(this.advertisements)||this.advertisements.length)&&this.advertisements)return this.advertisements.map((s=>t("div",{class:{"s-hidden":this.isNotVisible(s),"s-advertisement":!0},"data-id":s.id,style:{"background-color":s.colors.bg,color:s.colors.text}},t("div",{id:"adv-slot",innerHTML:this.advSlot.replace("{iconElem}",`<i class="s-advertisement-content-icon ${s.icon}"></i>`).replace("{urlElem}",s.url?`<a href="${s.url}" target="${s.target}">${s.description}</a>`:s.description).replace("{closeElem}",'<button class="s-advertisement-action" aria-label="close-alert"><i class="sicon-cancel"></i></button>').replace("{icon}",s.icon).replace("{url}",s.url).replace("{target}",s.target).replace("{description}",s.description).replace("{bg_color}",s.colors.bg).replace("{text_color}",s.colors.text)}))))}componentWillLoad(){return new Promise((s=>salla.onReady(s))).then((()=>salla.api.advertisement.fetch(this.currentSlug))).then((s=>Array.isArray(s.data)?s.data.find((s=>!salla.storage.get(`statusAd-${s.id}`))):null)).then((s=>this.advertisements=s?[s]:[]))}componentDidRender(){Array.isArray(this.advertisements)&&!this.advertisements.length||!this.advertisements||(setTimeout((()=>{let s=this.host.querySelector(".s-advertisement-action");s&&s.addEventListener("click",(()=>this.setCanDisplayFlag(this.advertisements[0],!1)))})),this.host.querySelectorAll("#adv-slot").forEach((s=>s?.replaceWith(s?.firstChild))),this.host.querySelector('[slot="adv"]')?.remove(),i({targets:this.host,opacity:[0,1],duration:300,height:[0,this.host.clientHeight],easing:"easeInOutQuad"}))}get host(){return a(this)}};e.style=":host{display:block}";export{e as salla_advertisement}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Crafted with ❤ by Salla
|
|
3
|
-
*/
|
|
4
|
-
import{r as i,h as e}from"./p-D5PGwR59.js";const a=class{constructor(e){i(this,e)}render(){return e("a",{key:"15701825f2d0bb5b4bc21cf20114eae79af6b9aa",href:this.notification.url,class:{"s-notifications-item":!0,"s-notifications-item-shadow":!0,"s-notifications-item-read":!this.notification.is_new}},e("span",{key:"f87fba9d640a5c6cab81abe2d7537c2c89ee8857",class:"s-notifications-item-icon"},e("i",{key:"52590f17aacb20f87768a0dcc699e15303ca0e81",class:{"s-notifications-item-icon sicon-bell-ring":!0,"s-notifications-item-icon-new":this.notification.is_new}})),e("div",{key:"489bdb71b1caaa202604facffe47ce6a6825355b",class:"s-notifications-item-content"},e("div",{key:"53a0e1e2f2f1be650567c0b1b9cc779779bc2cdc",class:"s-notifications-item-content-leading"},e("h4",{key:"b7f6fd64ad3212d0810a4eb7ab0a33d4294498c7"},this.notification.title),e("p",{key:"3774bc0d5c619d73f97466283d28ed5204e9abe4"},this.notification.sub_title)),e("span",{key:"25c70649e341c3e7c659dec48e986945088b4dfa",class:"s-notifications-item-content-trailing"},e("i",{key:"eaca7d3e4b8254b5eb8ea7e864c5afac8529f019",class:"sicon-time s-notifications-item-content-trailing-icon"}),e("span",{key:"de695990f5d2b6e5a131373d863f1d2e1e002613"},this.notification.date))))}};a.style="";export{a as salla_notification_item}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Crafted with ❤ by Salla
|
|
3
|
-
*/
|
|
4
|
-
var c='\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>camera</title>\n<path d="M16 10.667c-4.044 0-7.333 3.289-7.333 7.333s3.289 7.333 7.333 7.333 7.333-3.289 7.333-7.333-3.289-7.333-7.333-7.333zM16 22.667c-2.573 0-4.667-2.093-4.667-4.667s2.093-4.667 4.667-4.667 4.667 2.093 4.667 4.667-2.093 4.667-4.667 4.667zM28 5.333h-3.287l-2.271-3.407c-0.248-0.371-0.664-0.593-1.109-0.593h-10.667c-0.445 0-0.861 0.223-1.109 0.593l-2.271 3.407h-3.287c-2.205 0-4 1.795-4 4v17.333c0 2.205 1.795 4 4 4h24c2.205 0 4-1.795 4-4v-17.333c0-2.205-1.795-4-4-4zM29.333 26.667c0 0.735-0.599 1.333-1.333 1.333h-24c-0.735 0-1.333-0.599-1.333-1.333v-17.333c0-0.735 0.599-1.333 1.333-1.333h4c0.445 0 0.861-0.223 1.109-0.593l2.272-3.407h9.239l2.271 3.407c0.248 0.371 0.664 0.593 1.109 0.593h4c0.735 0 1.333 0.599 1.333 1.333zM25.333 10.66c-0.736 0-1.333 0.604-1.333 1.34s0.597 1.333 1.333 1.333 1.333-0.597 1.333-1.333v-0.013c0-0.736-0.597-1.327-1.333-1.327z"></path>\n</svg>\n';export{c as C}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Crafted with ❤ by Salla
|
|
3
|
-
*/
|
|
4
|
-
var t='\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>add</title>\n<path d="M26.667 14.667h-9.333v-9.333c0-0.736-0.597-1.333-1.333-1.333s-1.333 0.597-1.333 1.333v9.333h-9.333c-0.736 0-1.333 0.597-1.333 1.333s0.597 1.333 1.333 1.333h9.333v9.333c0 0.736 0.597 1.333 1.333 1.333s1.333-0.597 1.333-1.333v-9.333h9.333c0.736 0 1.333-0.597 1.333-1.333s-0.597-1.333-1.333-1.333z"></path>\n</svg>\n',e='\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>minus</title>\n<path d="M26.667 14.667h-21.333c-0.736 0-1.333 0.597-1.333 1.333s0.597 1.333 1.333 1.333h21.333c0.736 0 1.333-0.597 1.333-1.333s-0.597-1.333-1.333-1.333z"></path>\n</svg>\n';export{e as m,t as p}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Crafted with ❤ by Salla
|
|
3
|
-
*/
|
|
4
|
-
import{L as e}from"./p-D5PGwR59.js";const t=function(){document.lazyLoadInstance||(document.lazyLoadInstance=new e({use_native:!0}),document.lazyLoadBackgrounds=new e({elements_selector:".lazy[data-bg]:not(.loaded)"})),"complete"!==document.readyState&&(document.addEventListener("DOMContentLoaded",(()=>document.lazyLoadInstance.update())),document.addEventListener("DOMContentLoaded",(()=>document.lazyLoadBackgrounds.update()))),salla.infiniteScroll.event.onAppend((()=>{document.lazyLoadInstance.update(),document.lazyLoadBackgrounds.update()}))};export{t as g}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Crafted with ❤ by Salla
|
|
3
|
-
*/
|
|
4
|
-
import{r as s,c as t,h as i,H as e,g as a}from"./p-D5PGwR59.js";import{H as h}from"./p-X-ZUrwUQ.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:"1987fec03cfe48cddc60af2d81bbc30a476dcb61",class:"s-filters-widget-container"},i("h3",{key:"4232775c4012d1be8bb3036d9d09e5d29d951ee4",class:"s-filters-widget-title",onClick:()=>this.toggleWidget()},i("span",{key:"61cf9ea5a69f3ab5377502a396cc84478c6152a1"},this.option.label),i("span",{key:"b75914eb06f9d419d0a89da2a8f2da2f891f3d27",class:"s-filters-widget-plusminus "+(this.isOpen?"s-filters-widget-plusminus-active":"")})),i("div",{key:"f65e2f8a44648b034dacf1bda1aa64b5398627b7",class:"s-filters-widget-content",ref:s=>this.widgetContent=s},i("div",{key:"adcafe169ce8cbef671263f3624bce071b168c36",class:"s-filters-widget-values",ref:s=>this.widgetValues=s},i("slot",{key:"fa006556e44e508c3c64cc5ae76cc826b7e7601e"}),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:"16a4ddeb365dc1d52fc51a8999fc6d7dbe094658",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 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Crafted with ❤ by Salla
|
|
3
|
-
*/
|
|
4
|
-
import{r as s,h as t,H as a,g as e,c as o}from"./p-D5PGwR59.js";import{p as i,m as c}from"./p-DfeagqF1.js";const l=class{constructor(t){s(this,t),this.collapsible=!0,this.bordered=!1,this.size="md",this.collapsed=!0,this.dir=document.dir||"rtl"}directionChangedHandler(s){this.dir=s.detail.dir}handleCollapse(s){this.collapsed=s.detail.payload.collapsed}setcollapsibleProp(){const s=this.host.querySelector("salla-accordion-head");this.collapsible&&s&&(s.setAttribute("collapsible","true"),s.setAttribute("collapsed",this.collapsed.toString()))}componentDidRender(){this.setcollapsibleProp();const s=this.host.querySelector("salla-accordion-body");this.collapsible&&(this.host.setAttribute("data-collapsed",this.collapsed.toString()),s?.setAttribute("data-collapsed",this.collapsed.toString()))}render(){return t(a,{key:"ed8e4c0f24fa4462654e94fa46706e892c141351",class:`s-accordion-wrapper ${this.dir} ${this.bordered?"s-accordion-wrapper-bordered":""} ${this.size?`size-${this.size}`:""}`,"data-collapsed":this.collapsed.toString()},t("slot",{key:"1dbda01c073f3018a55ebcf5d8613a82a5dc6b27"}))}get host(){return e(this)}};l.style="";const r=class{constructor(t){s(this,t)}render(){return t(a,{key:"298d42a5bf1bcefdb181ec35060220cf749b56ed",class:"s-accordion-body-wrapper"},t("slot",{key:"6ab081e8b71b5dc69fb66fbdec82b4725ab53b0d"}))}};r.style="";const d=class{constructor(t){s(this,t),this.accordionToggle=o(this,"accordionToggle"),this.collapsible=!1,this.collapsed=!0}emitCollapsePanel(){this.accordionToggle.emit({payload:{collapsed:this.collapsed}})}toggleCollapse(){this.collapsible&&(this.collapsed=!this.collapsed,this.host.parentElement?.setAttribute("data-collapsed",this.collapsed.toString()),this.host.parentElement?.querySelector("salla-accordion-body")?.setAttribute("data-collapsed",this.collapsed.toString()),this.emitCollapsePanel())}render(){return t(a,{key:"9bb7ad4ad615f5316968b48839b2433619bd3850","data-collapsed":this.collapsed.toString(),onClick:()=>this.toggleCollapse(),class:"s-accordion-head-wrapper"},t("div",{key:"6826492e1c552440d6407435dfe4e0ca3915cdf4",class:"s-accordion-head-wrapper-start"},t("slot",{key:"2c19c500b57444ac8f69c2f64616904a819f54da",name:"title"}),t("slot",{key:"a6ed0daccd969ec94128f5f749ccddfa9f62e5d3",name:"subtitle"}),t("slot",{key:"adc2122dce76eee34653bc3f47324188c89d80f1",name:"html"})),(this.collapsible||this.host.querySelector('[slot="note"]'))&&t("div",{key:"f61363b6836fb857a0e832de99175936ec4bce29",class:"s-accordion-head-wrapper-end"},t("slot",{key:"15ee81e943714b30bfbaf718364f5d34b14617eb",name:"note"}),this.collapsible&&t("button",{key:"c5f8d32af544ddfba7b2fc2f273ae5b2e8cb7ae5",class:{"s-accordion-head-wrapper-toggle":!0,active:!this.collapsed},onClick:s=>{s.stopPropagation(),this.toggleCollapse()}},t("span",{key:"4c4e3fa6ddeda1a59f65ba47665a9203356037a6",class:"s-accordion-head-wrapper-toggle-icon",innerHTML:this.collapsed?i:c}))))}get host(){return e(this)}};d.style="";const n=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(a,{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))))))))}};n.style="";export{l as salla_accordion,r as salla_accordion_body,d as salla_accordion_head,n as salla_order_details_options}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Crafted with ❤ by Salla
|
|
3
|
-
*/
|
|
4
|
-
import{r as t,h as s,H as c,g as a}from"./p-D5PGwR59.js";import{w as e}from"./p-DWksgowB.js";import{M as n}from"./p-DmgxDvXL.js";const i=class{constructor(s){t(this,s),this.contacts=salla.config.get("store.contacts"),this.iconsList={mobile:'\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>iphone</title>\n<path d="M15.053 27.613c0.133 0.12 0.28 0.213 0.44 0.28s0.333 0.107 0.507 0.107c0.36 0 0.693-0.135 0.947-0.387 0.12-0.135 0.213-0.28 0.28-0.44 0.080-0.16 0.107-0.333 0.107-0.507 0-0.347-0.147-0.695-0.387-0.947-0.507-0.493-1.387-0.493-1.893 0-0.12 0.12-0.213 0.267-0.28 0.44-0.067 0.16-0.107 0.333-0.107 0.507s0.040 0.347 0.107 0.507 0.16 0.305 0.28 0.44zM24 0h-16c-2.205 0-4 1.795-4 4v24c0 2.205 1.795 4 4 4h16c2.205 0 4-1.795 4-4v-24c0-2.205-1.795-4-4-4zM25.333 28c0 0.736-0.599 1.333-1.333 1.333h-16c-0.735 0-1.333-0.597-1.333-1.333v-4h18.667zM25.333 21.333h-18.667v-17.333c0-0.735 0.599-1.333 1.333-1.333h16c0.735 0 1.333 0.599 1.333 1.333z"></path>\n</svg>\n',whatsapp:e,phone:'\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>phone</title>\n<path d="M30.823 21.713l-3.883-3.883c-1.569-1.568-4.12-1.568-5.689 0l-2.568 2.568c-3.063-1.499-5.583-4.019-7.081-7.083l2.568-2.567c0.759-0.76 1.177-1.771 1.177-2.845s-0.419-2.084-1.179-2.844l-3.881-3.881c-1.52-1.521-4.171-1.521-5.689 0l-1.845 1.847c-2.22 2.219-3.183 5.407-2.573 8.527 1.98 10.144 10.125 18.292 20.269 20.271 0.616 0.121 1.236 0.18 1.849 0.18 2.492 0 4.896-0.972 6.677-2.752l1.847-1.847c1.568-1.571 1.568-4.121 0.001-5.691zM28.936 25.517l-1.845 1.847c-1.592 1.592-3.883 2.283-6.132 1.841-9.089-1.776-16.388-9.075-18.163-18.165-0.439-2.247 0.249-4.539 1.841-6.129l1.847-1.847c0.256-0.257 0.596-0.397 0.959-0.397s0.703 0.14 0.959 0.397l3.883 3.883c0.256 0.256 0.397 0.596 0.397 0.959s-0.141 0.703-0.397 0.96l-3.22 3.217c-0.383 0.384-0.496 0.959-0.287 1.457 1.813 4.339 5.343 7.868 9.683 9.684 0.497 0.207 1.073 0.095 1.457-0.288l3.22-3.22c0.529-0.529 1.389-0.528 1.917 0l3.881 3.883c0.528 0.529 0.528 1.389 0 1.919z"></path>\n</svg>\n',telegram:'\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>paper-plane-o</title>\n<path d="M31.5 0.482c0.375 0.268 0.554 0.696 0.482 1.143l-4.571 27.429c-0.054 0.339-0.268 0.625-0.571 0.804-0.161 0.089-0.357 0.143-0.554 0.143-0.143 0-0.286-0.036-0.429-0.089l-9.411-3.839-5.321 5.839c-0.214 0.25-0.518 0.375-0.839 0.375-0.143 0-0.286-0.018-0.411-0.071-0.446-0.179-0.732-0.607-0.732-1.071v-8.071l-8.429-3.446c-0.411-0.161-0.679-0.536-0.714-0.982-0.036-0.429 0.196-0.839 0.571-1.054l29.714-17.143c0.375-0.232 0.857-0.214 1.214 0.036zM25.393 27.25l3.946-23.625-25.607 14.768 6 2.446 15.411-11.411-8.536 14.232z"></path>\n</svg>\n',email:n},this.contactSlot=this.host.querySelector('[slot="contact"]')?.innerHTML||`<a href={link} class="s-contacts-item"><span class="s-contacts-icon">{icon}</span>${!this.iconsOnly&&"<span class='unicode'>{value}</span>"}</a>`,salla.onReady((()=>{this.contacts=salla.config.get("store.contacts")})),salla.lang.onLoaded((()=>{this.contactsTitle=this.contactsTitle||salla.lang.get("blocks.footer.social")}))}getContactsArray(){return Object.entries(this.contacts).filter((([t,s])=>""!==s)).map((([t,s])=>({type:t,value:s})))}getContactLink(t){const s=this.contacts[t];switch(t){case"phone":case"mobile":return`tel:${s}`;case"whatsapp":return salla.url.get("whatsapp/send");case"email":return`mailto:${s}`;case"telegram":return s.startsWith("https://t.me/")?s:`https://t.me/${s}`;default:return s}}getContactIcon(t){return this.iconsList[t]}componentWillLoad(){return new Promise((t=>salla.onReady(t)))}render(){const t=this.getContactsArray();if(t&&0!=t.length)return this.isHeader?s(c,{class:"s-contacts s-contacts-header"},t.filter((t=>"phone"==t.type||"email"==t.type)).map(((t,c)=>s("a",{href:this.getContactLink(t.type),key:c,class:"s-contacts-topnav-link"},"email"===t.type?t.value:[s("span",null,this.contactsTitle,": "),s("a",{class:"unicode",href:this.iconsList[t.type]},t.value)])))):s(c,{class:"s-contacts"},!this.hideTitle&&s("h3",{class:"s-contacts-title"},this.contactsTitle),s("div",{class:{"s-contacts-list":!0,"s-contacts-list-horizontal":this.horizontal,"s-contacts-list-vertical":!this.horizontal,"s-contacts-list-icons-only":this.iconsOnly}},t.map(((t,c)=>s("div",{key:c,id:"contact-slot",innerHTML:this.contactSlot.replace(/\{icon\}/g,this.getContactIcon(t.type)).replace(/\{value\}/g,t.value.toString()).replace(/\{link\}/g,this.getContactLink(t.type))})))))}componentDidRender(){this.host.querySelector('[slot="contact"]')?.remove()}get host(){return a(this)}};i.style=".unicode{unicode-bidi:plaintext}";export{i as salla_contacts}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Crafted with ❤ by Salla
|
|
3
|
-
*/
|
|
4
|
-
import{r as t,c as s,h as e,H as i,g as a}from"./p-D5PGwR59.js";import{F as l}from"./p-DL4h2bc3.js";import{H as r}from"./p-X-ZUrwUQ.js";import"./p-CgtvEd63.js";const o=class{constructor(e){t(this,e),this.changed=s(this,"changed"),this.isReady=!1,this.filtersData={},salla.event.on("filters::hidden",(()=>this.host.style.display="none")),salla.lang.onLoaded((()=>{this.apply=salla.lang.get("pages.checkout.apply"),this.reset=salla.lang.get("pages.categories.filters_reset")})),salla.event.on("filters::fetched",(({filters:t})=>{this.host.style.display="";let s={};this.filters=t.map((t=>{if(t.label={category_id:salla.lang.get("common.titles.categories"),brand_id:salla.lang.get("common.titles.brands"),rating:salla.lang.get("pages.categories.filter_rating"),price:salla.lang.get("pages.categories.filter_price")}[t.key]||t.label,"rating"==t.key){t.type=l.VALUES;let{max:s,min:e}=t.values;t.values=[5,4,3,2,1].filter((t=>t>=e||t<=s))}this.filtersData.variants&&t.type==l.VARIANTS&&(s.variants=this.filtersData.variants),this.filtersData[t.key]&&t.type!==l.VARIANTS&&(s[t.key]=this.filtersData[t.key]);let e=new URLSearchParams(window.location.search),i=!1;for(let t of e.keys())if(t.includes("filters")){i=!0;break}if("product.index"==salla.config.get("page.slug")&&0==Object.keys(s).length&&!i){let t=window.location.href,e=salla.config.get("page.id"),i=-1!==t.indexOf("?")?"&":"?",a=t+i+"filters[category_id]="+e;s.category_id=e,window.history.pushState({path:a},"",a)}return t})),this.filtersData=s,this.host.childNodes.forEach((async t=>t.setWidgetHeight&&await t.setWidgetHeight()))}))}async componentWillLoad(){try{const t=new URLSearchParams(window.location.search);this.filtersData=await r.extractFiltersFromUrl(t)}catch(t){console.warn("failed to get filters from URL",t.message)}}async getFilters(){return this.filtersData}async applyFilters(){if(!this.isReady)return;let t=Object.keys(this.filtersData).length>0;setTimeout((()=>{if(t){let t=new URL(window.location.href);for(const[s]of t.searchParams.entries())s.startsWith("filters")&&t.searchParams.delete(s);let s=this.encodeFilters(this.filtersData),e=t.search.split("&").filter((t=>!t.includes("filters"))).join("&");t.search=e?t.search.split("&filters")[0]+"&"+s:`?${s}`,window.history.pushState({},"",t.href)}else{let t=new URL(window.location.href);t.searchParams?.delete("filters"),window.history.pushState({},"",t.toString())}salla.event.emit("salla-filters::changed",this.filtersData),this.changed.emit(this.filtersData)}),300)}encodeFilters(t,s="filters"){const e=[];for(const i in t)if(Object.prototype.hasOwnProperty.call(t,i)){const a=t[i],l=s?`${s}[${i}]`:i;if(Array.isArray(a))for(let t=0;t<a.length;t++)e.push(`${l}[${t}]=${a[t]}`);else e.push("object"==typeof a&&null!==a?this.encodeFilters(a,l):`${l}=${a}`)}return e.join("&")}async resetFilters(){return this.removeFiltersQueryParams(),this.filtersData={},this.host.childNodes.forEach((t=>t.reset&&t.reset())),salla.event.emit("salla-filters::reset"),this.applyFilters()}removeFiltersQueryParams(){const t=new URLSearchParams(window.location.search),s=Array.from(t.keys()).filter((t=>!t.startsWith("filters["))).map((s=>`${encodeURIComponent(s)}=${encodeURIComponent(t.get(s))}`)).join("&"),e=s?`${window.location.pathname}?${s}`:window.location.pathname;window.history.pushState({},"",e)}handleOptionChange(t,s,e){s.type===l.RANGE&&(this.filtersData[s.key]=e);let i=t.target.checked;s.type===l.VARIANTS?(this.filtersData.variants=this.filtersData.variants||{},i&&(this.filtersData.variants[s.key]=e),i||delete this.filtersData.variants[s.key]):"radio"==t.target.type?(i&&(this.filtersData[s.key]=e),i||delete this.filtersData[s.key]):"checkbox"==t.target.type&&(this.filtersData[s.key]=this.filtersData[s.key]||[],i&&this.filtersData[s.key].push(e),this.filtersData[s.key]=this.filtersData[s.key].filter((t=>t!=e))),this.applyFilters()}render(){return e(i,{key:"54a625522588215230f1eb5a3ca94b8280b18040"},this.filters?.map((t=>e("salla-filters-widget",{option:t,filtersData:this.filtersData,onChanged:({detail:{event:t,option:s,value:e}})=>{this.handleOptionChange(t,s,e)}}))),this.filters?.length?e("div",{class:"s-filters-footer"},e("salla-button",{color:"gray",fill:"outline",onClick:()=>this.resetFilters()},this.reset)):"")}componentDidLoad(){this.isReady=!0}get host(){return a(this)}};o.style=":host{display:block}.s-rating-stars-small{line-height:12px}.s-filters-radio{background-image:none !important}";export{o as salla_filters}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Crafted with ❤ by Salla
|
|
3
|
-
*/
|
|
4
|
-
import{r as e,c as t,h as s,H as a,g as i}from"./p-D5PGwR59.js";const n=class{constructor(s){e(this,s),this.invalidInput=t(this,"invalidInput"),this.bookNowLabel=salla.lang.get("pages.cart.book_an_appointment","حجز موعد"),this.editLabel=salla.lang.get("pages.cart.edit_an_appointment","تعديل الموعد"),this.bookedLabel=salla.lang.get("pages.cart.booked_successfully","تمت اضافة الموعد بنجاح"),this.selectDate=salla.lang.get("pages.cart.select_appointment_date","حدد تاريخ الموعد"),this.bookingUrl="",this.iframeReady=!1,this.reservations=[],salla.lang.onLoaded((()=>this.setTranslations())),Salla.event.on("booking::open",(e=>this.handleBookingOpen(e)))}async setTranslations(){const e=(e,t,s)=>new Promise((a=>{salla.helpers.setNested(salla.lang.messages[e],t,s),a(!0)}));await e("ar.trans","pages.cart.book_an_appointment","حجز موعد"),await e("en.trans","pages.cart.book_an_appointment","Book an Appointment"),await e("ar.trans","pages.cart.edit_an_appointment","تعديل الموعد"),await e("en.trans","pages.cart.edit_an_appointment","Edit an Appointment"),await e("ar.trans","pages.cart.booked_successfully","تمت اضافة الموعد بنجاح"),await e("en.trans","pages.cart.booked_successfully","Booked Successfully"),await e("ar.trans","pages.cart.select_appointment_date","حدد تاريخ الموعد"),await e("en.trans","pages.cart.select_appointment_date","Select appointment date"),this.bookNowLabel=salla.lang.get("pages.cart.book_an_appointment"),this.editLabel=salla.lang.get("pages.cart.edit_an_appointment"),this.bookedLabel=salla.lang.get("pages.cart.booked_successfully"),this.selectDate=salla.lang.get("pages.cart.select_appointment_date")}openBookingModal(e,t=!1){if(!t||e.detail&&"number"==typeof e.detail&&e.detail===this.productId)return salla.config.isGuest()?(this.setAfterReloadEvent("booking::open-after-reload",this.productId),void salla.event.dispatch("login::open")):void salla.booking.add(this.productId,!1).then((e=>{if("booking"!==e.data.redirect.to)throw new Error("Unexpected redirect!");salla.event.dispatch("booking::open",{url:e.data.redirect.url,id:this.productId})})).catch((e=>{salla.error(salla.lang.get("common.errors.error_occurred")),salla.logger.error(e.response||e)}))}handleBookingOpen(e){e.id===this.productId&&(this.bookingUrl=salla.url.addParamToUrl("product_id",e.id,e.url),this.iframeReady=!0,setTimeout((()=>{this.modal.setTitle(this.selectDate),this.modal.open()}),100))}setAfterReloadEvent(e,t){salla.storage.set("afterReloadEvent",{event:e,payload:t})}emitAfterReloadEvent(){const e=salla.storage.get("afterReloadEvent");if(e&&e.event){const t=new CustomEvent(e.event,{detail:e.payload});window.dispatchEvent(t),salla.storage.remove("afterReloadEvent")}}componentWillLoad(){this.option&&this.option.details.length&&(this.reservations=this.option.details)}componentDidLoad(){window.addEventListener("booking::open-after-reload",(e=>this.openBookingModal(e,!0))),this.emitAfterReloadEvent(),window.addEventListener("message",this.handleMessageEvent.bind(this)),this.reservationsInput.addEventListener("invalid",(e=>this.invalidInput.emit(e))),this.reservationsInput.addEventListener("input",(()=>{this.reservationsInput.setCustomValidity(""),this.reservationsInput.reportValidity()}))}handleMessageEvent(e){if("booking"!==e.data.source)return;const t=e.data.type,s=e.data.message;if(localStorage.getItem("debug")&&console.log(`Received an action:${t}`,e.data),"error"===t){if(s.fields?.reservation)return void salla.notify.error(s.fields.reservation[0]);const e=Object.values(s.fields||[s.message]).flat().map((e=>`<li>${e}</li>`)).join("");salla.notify.error(`<ul>${e}</ul>`)}if("success"===t){if(Number(s.productId)!==Number(this.productId))return;this.reservations=s.data.reservations.map((e=>{if(e.time&&e.time.length>0){const t=e.time[0];return{date:e.date,day:e.day,from_timestamp:t.from,to_timestamp:t.to}}return null})).filter((e=>null!==e)),salla.notify.success(this.bookedLabel),this.modal?.close(),setTimeout((()=>window.location.reload()))}"height"===t&&(this.iframe.height=s?.height+"px")}bookingModal(){return s("salla-modal",{class:"s-booking-field-modal",ref:e=>this.modal=e,width:"md",position:"middle",noPadding:!0},s("iframe",{ref:e=>this.iframe=e,src:this.bookingUrl,frameborder:"0"}))}renderReservationDate(e){return s("span",{class:e.from_timestamp?"s-booking-field-reservations-has-time":""},s("i",{class:"s-booking-field-reservations-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>calendar</title>\n<path d="M28 2.667h-2.667v-1.333c0-0.736-0.597-1.333-1.333-1.333s-1.333 0.597-1.333 1.333v1.333h-13.333v-1.333c0-0.736-0.597-1.333-1.333-1.333s-1.333 0.597-1.333 1.333v1.333h-2.667c-2.205 0-4 1.795-4 4v21.333c0 2.205 1.795 4 4 4h24c2.205 0 4-1.795 4-4v-21.333c0-2.205-1.795-4-4-4zM29.333 28c0 0.736-0.599 1.333-1.333 1.333h-24c-0.736 0-1.333-0.599-1.333-1.333v-13.333h26.667zM29.333 12h-26.667v-5.333c0-0.736 0.599-1.333 1.333-1.333h2.667v2.667c0 0.736 0.597 1.333 1.333 1.333s1.333-0.597 1.333-1.333v-2.667h13.333v2.667c0 0.736 0.597 1.333 1.333 1.333s1.333-0.597 1.333-1.333v-2.667h2.667c0.736 0 1.333 0.599 1.333 1.333z"></path>\n</svg>\n'}),e.date)}renderReservationTime(e){return e.from_timestamp?s("span",{class:"s-booking-field-reservations-time"},s("i",{class:"s-booking-field-reservations-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>time</title>\n<path d="M16 0c-8.823 0-16 7.177-16 16s7.177 16 16 16 16-7.177 16-16-7.177-16-16-16zM16 29.333c-7.352 0-13.333-5.981-13.333-13.333s5.981-13.333 13.333-13.333 13.333 5.981 13.333 13.333-5.981 13.333-13.333 13.333zM16 8c-0.736 0-1.333 0.596-1.333 1.333v6.667h-4c-0.736 0-1.333 0.596-1.333 1.333s0.597 1.333 1.333 1.333h5.333c0.736 0 1.333-0.596 1.333-1.333v-8c0-0.737-0.597-1.333-1.333-1.333z"></path>\n</svg>\n'}),s("span",null,e.from_timestamp," - ",e.to_timestamp)):""}render(){return s(a,{key:"04c9e3dc3dc825bd6905221d858c260f7ca34748"},s("div",{key:"07ec38cec1bd1798640dd7ea9592bb3b17d945c6",class:"s-booking-field-main"},this.option.required||this.reservations.length>0?s("div",{class:"s-booking-field-price"},s("span",{innerHTML:salla.money(this.option.price)})):"",s("salla-button",{key:"6b71889cfc0429d15c466a6f194df31549f09786",class:"s-booking-field-book-now",size:"small",loaderPosition:"center",fill:"outline",onClick:e=>this.openBookingModal(e,!1)},s("span",{key:"a16f8db6f52c7751ea605efcae04057ca0dc5b61",class:"s-booking-field-book-now-content"},s("span",{key:"95f6086a599bcc620c87ece6c6ae9620dba15581",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>calendar-time</title>\n<path d="M22.667 17.333c-0.737 0-1.333 0.596-1.333 1.333v2.667h-2.667c-0.737 0-1.333 0.596-1.333 1.333s0.596 1.333 1.333 1.333h4c0.737 0 1.333-0.596 1.333-1.333v-4c0-0.737-0.596-1.333-1.333-1.333zM28 2.667h-2.667v-1.333c0-0.736-0.596-1.333-1.333-1.333s-1.333 0.597-1.333 1.333v1.333h-13.333v-1.333c0-0.736-0.596-1.333-1.333-1.333s-1.333 0.597-1.333 1.333v1.333h-2.667c-2.205 0-4 1.795-4 4v21.333c0 2.205 1.795 4 4 4h5.363c0.737 0 1.333-0.596 1.333-1.333s-0.596-1.333-1.333-1.333h-5.363c-0.736 0-1.333-0.597-1.333-1.333v-21.333c0-0.736 0.597-1.333 1.333-1.333h2.667v2.667c0 0.736 0.596 1.333 1.333 1.333s1.333-0.597 1.333-1.333v-2.667h13.333v2.667c0 0.736 0.596 1.333 1.333 1.333s1.333-0.597 1.333-1.333v-2.667h2.667c0.736 0 1.333 0.599 1.333 1.333v2.696c0 0.736 0.596 1.333 1.333 1.333s1.333-0.597 1.333-1.333v-2.696c0-2.205-1.795-4-4-4zM22 12c-5.515 0-10 4.485-10 10s4.485 10 10 10 10-4.485 10-10-4.485-10-10-10zM22 29.333c-4.043 0-7.333-3.291-7.333-7.333s3.291-7.333 7.333-7.333 7.333 3.291 7.333 7.333-3.291 7.333-7.333 7.333z"></path>\n</svg>\n'}),this.reservations.length?this.editLabel:this.bookNowLabel))),this.reservations.length>0&&s("div",{key:"b3615100bbfff3d98d0ac99145aaf53449790c94",class:"s-booking-field-reservations"},this.reservations.map(((e,t)=>s("div",{key:t,class:"s-booking-field-reservations-item"},this.renderReservationDate(e),this.renderReservationTime(e))))),s("input",{key:"126f14f2e520b8696bc7450e209bad30b267878b",class:"s-hidden",name:this.option.name,required:this.option.required,value:"[]"===JSON.stringify(this.reservations)?"":JSON.stringify(this.reservations),ref:e=>this.reservationsInput=e}),this.iframeReady&&this.bookingModal())}get host(){return i(this)}};n.style=":host{display:block}";const o=class{constructor(t){e(this,t)}hideAllOptions(e){this.host.querySelectorAll(`[data-show-when^="options[${e}"]`).forEach((e=>{e.classList.add("hidden"),this.hideAllOptions(e.dataset.optionId),this.disableInputs(e)}))}disableInputs(e){e.querySelectorAll("[name]").forEach((e=>{e.setAttribute("disabled",""),e.removeAttribute("required"),"select"===e?.tagName?.toLowerCase()&&(e.value=""),["checkbox"].includes(e.getAttribute("type"))&&e.hasOwnProperty("checked")&&(e.checked=!1)}))}changeHandler(e){if(salla.event.emit("salla-onditional-fields::change",e),salla.log("Received the change event: ",e),!e.target||!["SELECT"].includes(e.target.tagName)&&!["checkbox","radio"].includes(e.target.getAttribute("type")))return void salla.log("Ignore the change because is not a supported input: "+(e?.target?.tagName||"N/A"));let t=e.target.name.replace("[]",""),s="checkbox"===e.target.getAttribute("type"),a="radio"===e.target.getAttribute("type");salla.log("Trying to find all elements with condition:",`[data-show-when^="${t}"]`),this.host.querySelectorAll(`[data-show-when^="${t}"]`).forEach((t=>{let i,n=!t?.dataset.showWhen.includes("!="),o=t?.dataset.showWhen.replace(/(.*)(=|!=)(.*)/gm,"$3").trim();i=s?Array.from(this.host.querySelectorAll(`input[name="${e.target.name}"]:checked`),(e=>e?.value)).includes(o.toString()):a?e.target.checked&&e.target.value===o:o===e.target.value,salla.log("The input is ",s?"Multiple":a?"Radio":"Single"," value:",i),n&&i||!n&&!i?(t.classList.remove("hidden"),t.querySelectorAll("[name]").forEach((e=>{if(e.removeAttribute("disabled"),"true"===e.closest(".s-product-options-option").dataset.optionRequired&&e.setAttribute("required",""),"checkbox"===e.getAttribute("type")){const t=Array.from(document.querySelectorAll(`input[type="checkbox"][name="${e.getAttribute("name")}"]`));t.some((e=>e.checked))&&t.forEach((e=>{e.removeAttribute("required")}))}}))):(this.hideAllOptions(t.dataset.optionId),t.classList.add("hidden"),this.disableInputs(t))}))}componentDidRender(){this.host.querySelectorAll("[data-show-when]").forEach((e=>{let t=e?.dataset?.showWhen.replace(/(.*)(=|!=)(.*)/gm,"$1").trim();t&&this.changeHandler({target:this.host.querySelector('[name^="'+t+'"]')})}))}render(){return s(a,{key:"405156ba83b8731039c2dd0ff800f617150cc722"},s("slot",{key:"2bff17ce7b49fef9b028d673992d256b00e9481b"}))}get host(){return i(this)}};export{n as salla_booking_field,o as salla_conditional_fields}
|