@salla.sa/twilight-components 2.14.353 → 2.14.355
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/bell-ring-BfKPinNo.js +13 -0
- package/dist/cjs/{interfaces-CX9-6aLf.js → camera-DytepEoK.js} +0 -11
- package/dist/cjs/cancel-De6vslRA.js +13 -0
- package/dist/cjs/cart-s-x1Fshk.js +13 -0
- package/dist/cjs/check-circle2-BDvlT4_n.js +13 -0
- package/dist/cjs/{check-CLRvuniI.js → check-x3w3-gpj.js} +2 -2
- package/dist/cjs/{filepond-7SxqaoXb.js → filepond-D0WqQOsJ.js} +1 -1
- package/dist/cjs/{filepond-plugin-file-poster-DwIv84hN.js → filepond-plugin-file-poster-ZuSz5Sia.js} +1 -1
- package/dist/cjs/{filepond-plugin-file-validate-size-NUNnIo4Q.js → filepond-plugin-file-validate-size-C3-G9fQU.js} +1 -1
- package/dist/cjs/{filepond-plugin-file-validate-type-CXI-hfww.js → filepond-plugin-file-validate-type-pC6E-hQQ.js} +1 -1
- package/dist/cjs/{filepond-plugin-image-edit-fBeBGIBb.js → filepond-plugin-image-edit-B6RJ-sf_.js} +1 -1
- package/dist/cjs/{filepond-plugin-image-exif-orientation-BmLTdQ6d.js → filepond-plugin-image-exif-orientation-BAKA7TOr.js} +1 -1
- package/dist/cjs/{filepond-plugin-image-preview-CssKRM6n.js → filepond-plugin-image-preview-C_5JV3u4.js} +1 -1
- package/dist/{esm/gift-C0JNGIpa.js → cjs/gift-CJ-3Yw_x.js} +4 -2
- package/dist/cjs/image-BoZ6Hums.js +13 -0
- package/dist/cjs/{index-B9TEdQDE.js → index-DdedaQQE.js} +1 -1
- package/dist/cjs/{index-B5soIVRX.js → index-DgOViweO.js} +136 -12
- package/dist/cjs/interfaces-CRqrf5RX.js +15 -0
- package/dist/cjs/keyboard_arrow_down-DHJ3FFZq.js +13 -0
- package/dist/cjs/keyboard_arrow_right-BayM_Il2.js +21 -0
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/minus-CCryh1qf.js +21 -0
- package/dist/cjs/salla-accordion-body_3.cjs.entry.js +775 -0
- package/dist/cjs/salla-accordion_6.cjs.entry.js +768 -0
- package/dist/cjs/salla-add-product-button_4.cjs.entry.js +2389 -0
- package/dist/cjs/salla-advertisement.cjs.entry.js +1 -1
- package/dist/cjs/salla-alert_2.cjs.entry.js +194 -0
- package/dist/cjs/salla-app-install-alert.cjs.entry.js +1 -1
- package/dist/cjs/salla-apps-icons.cjs.entry.js +2 -2
- package/dist/cjs/salla-booking-field_7.cjs.entry.js +1565 -0
- package/dist/cjs/{salla-cart-item-offers.cjs.entry.js → salla-cart-item-offers_2.cjs.entry.js} +104 -5
- package/dist/cjs/salla-comment-form_8.cjs.entry.js +1661 -0
- package/dist/cjs/salla-conditional-offer.cjs.entry.js +1 -1
- package/dist/cjs/salla-contacts.cjs.entry.js +3 -3
- package/dist/cjs/salla-count-down_2.cjs.entry.js +302 -0
- package/dist/cjs/salla-custom-fields.cjs.entry.js +4 -3
- 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-gifting.cjs.entry.js +488 -0
- package/dist/cjs/salla-hook.cjs.entry.js +1 -1
- package/dist/cjs/salla-infinite-scroll.cjs.entry.js +91 -0
- package/dist/cjs/salla-installment.cjs.entry.js +1 -1
- package/dist/cjs/salla-list-tile.cjs.entry.js +34 -0
- package/dist/cjs/salla-localization-modal.cjs.entry.js +137 -0
- package/dist/cjs/salla-login-modal.cjs.entry.js +320 -0
- package/dist/cjs/salla-loyalty-prize-item.cjs.entry.js +1 -1
- package/dist/cjs/salla-loyalty-program.cjs.entry.js +3 -3
- package/dist/cjs/salla-loyalty.cjs.entry.js +211 -0
- package/dist/cjs/salla-maintenance-alert.cjs.entry.js +40 -0
- package/dist/cjs/salla-menu.cjs.entry.js +139 -0
- package/dist/cjs/salla-metadata.cjs.entry.js +1 -1
- package/dist/cjs/salla-multiple-bundle-product-cart_2.cjs.entry.js +220 -0
- package/dist/cjs/salla-multiple-bundle-product-options-modal_2.cjs.entry.js +598 -0
- package/dist/cjs/salla-multiple-bundle-product.cjs.entry.js +69 -0
- 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-modal.cjs.entry.js +206 -0
- 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 +3 -3
- 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 +6 -18
- package/dist/cjs/salla-placeholder.cjs.entry.js +51 -0
- package/dist/cjs/salla-price-range.cjs.entry.js +1 -1
- package/dist/cjs/salla-product-size-guide.cjs.entry.js +66 -0
- package/dist/cjs/salla-products-list.cjs.entry.js +762 -0
- package/dist/cjs/salla-products-slider.cjs.entry.js +115 -0
- package/dist/cjs/salla-progress-bar.cjs.entry.js +73 -0
- package/dist/cjs/salla-quick-order.cjs.entry.js +239 -0
- package/dist/cjs/salla-rating-modal.cjs.entry.js +453 -0
- package/dist/cjs/salla-scopes.cjs.entry.js +180 -0
- package/dist/cjs/salla-search.cjs.entry.js +153 -0
- package/dist/cjs/salla-skeleton.cjs.entry.js +36 -0
- package/dist/cjs/salla-slider.cjs.entry.js +10428 -0
- package/dist/cjs/salla-social-share.cjs.entry.js +165 -0
- package/dist/cjs/salla-social.cjs.entry.js +4 -4
- package/dist/cjs/salla-tab-content_3.cjs.entry.js +157 -0
- 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-trust-badges.cjs.entry.js +1 -1
- package/dist/cjs/salla-user-menu.cjs.entry.js +275 -0
- package/dist/cjs/salla-user-profile.cjs.entry.js +145 -0
- package/dist/cjs/salla-user-settings.cjs.entry.js +88 -0
- package/dist/cjs/salla-verify.cjs.entry.js +1 -1
- package/dist/cjs/salla-wallet.cjs.entry.js +1 -1
- package/dist/cjs/search-c7Aa7lM9.js +13 -0
- package/dist/cjs/{special-discount-OVG_9Kf9.js → special-discount-DC2oXurL.js} +0 -8
- package/dist/cjs/star-DGcH7Yso.js +13 -0
- package/dist/cjs/star2-R146a27p.js +13 -0
- package/dist/cjs/twilight.cjs.js +2 -2
- package/dist/cjs/{vanilla-picker-C6fk8_TR.js → vanilla-picker-Cd4v7i9t.js} +1 -1
- package/dist/cjs/{whatsapp2-D7Sbg8Ey.js → whatsapp2-BdMd5Gx1.js} +2 -2
- package/dist/collection/collection-manifest.json +56 -2
- package/dist/collection/components/salla-apps-icons/salla-apps-icons.js +1 -1
- package/dist/collection/components/salla-payments/salla-payments.js +5 -17
- package/dist/collection/components/salla-product-options/salla-product-options.js +36 -3
- package/dist/collection/components/salla-products-slider/salla-products-slider.js +32 -1
- package/dist/collection/components/salla-slider/salla-slider.js +89 -29
- 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-apps-icons.js +1 -1
- package/dist/components/salla-payments.js +5 -17
- package/dist/components/salla-product-options2.js +19 -2
- package/dist/components/salla-products-slider2.js +2 -1
- package/dist/components/salla-slider2.js +69 -28
- 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/bell-ring-D3mWkc-3.js +11 -0
- package/dist/esm/{interfaces-CBT_Nxny.js → camera-C6jIkM-X.js} +1 -12
- package/dist/esm/cancel-BsLF_HK7.js +11 -0
- package/dist/esm/cart-DY4LZmNP.js +11 -0
- package/dist/esm/{check-uTyAzPSy.js → check-BsXh13x8.js} +2 -2
- package/dist/esm/check-circle2-BV4kqbdL.js +11 -0
- package/dist/esm/{filepond-Cuqyleyy.js → filepond-YrJ-JCRn.js} +1 -1
- package/dist/esm/{filepond-plugin-file-poster-C6Wara8q.js → filepond-plugin-file-poster-UWiXxhAl.js} +1 -1
- package/dist/esm/{filepond-plugin-file-validate-size-D-M3KSxo.js → filepond-plugin-file-validate-size-CuFnfvIq.js} +1 -1
- package/dist/esm/{filepond-plugin-file-validate-type-DzAl1VI8.js → filepond-plugin-file-validate-type-BgYsHZEQ.js} +1 -1
- package/dist/esm/{filepond-plugin-image-edit-flutfc9I.js → filepond-plugin-image-edit-BQtZWl9D.js} +1 -1
- package/dist/esm/{filepond-plugin-image-exif-orientation-B2UkG6iE.js → filepond-plugin-image-exif-orientation-Dp7a5KRi.js} +1 -1
- package/dist/esm/{filepond-plugin-image-preview-B4u8N2nE.js → filepond-plugin-image-preview-DvWrR7vg.js} +1 -1
- package/dist/{cjs/gift-BPDUPIY_.js → esm/gift-BChI23pG.js} +2 -4
- package/dist/esm/image-C-tzSDxw.js +11 -0
- package/dist/esm/{index-xWIb6INF.js → index-DwU5NnFF.js} +1 -1
- package/dist/esm/{index-6mr785rH.js → index-PHxPq4LJ.js} +137 -13
- package/dist/esm/interfaces-OF8QcbMM.js +15 -0
- package/dist/esm/keyboard_arrow_down-DCZbpt2a.js +11 -0
- package/dist/esm/keyboard_arrow_right-Vqpj4CWE.js +18 -0
- package/dist/esm/loader.js +3 -3
- package/dist/esm/minus-DfeagqF1.js +18 -0
- package/dist/esm/salla-accordion-body_3.entry.js +771 -0
- package/dist/esm/salla-accordion_6.entry.js +761 -0
- package/dist/esm/salla-add-product-button_4.entry.js +2384 -0
- package/dist/esm/salla-advertisement.entry.js +1 -1
- package/dist/esm/salla-alert_2.entry.js +191 -0
- package/dist/esm/salla-app-install-alert.entry.js +1 -1
- package/dist/esm/salla-apps-icons.entry.js +2 -2
- package/dist/esm/salla-booking-field_7.entry.js +1539 -0
- package/dist/esm/{salla-cart-item-offers.entry.js → salla-cart-item-offers_2.entry.js} +104 -6
- package/dist/esm/salla-comment-form_8.entry.js +1652 -0
- package/dist/esm/salla-conditional-offer.entry.js +1 -1
- package/dist/esm/salla-contacts.entry.js +3 -3
- package/dist/esm/salla-count-down_2.entry.js +299 -0
- package/dist/esm/salla-custom-fields.entry.js +3 -2
- package/dist/esm/salla-filters-widget.entry.js +1 -1
- package/dist/esm/salla-filters.entry.js +1 -1
- package/dist/esm/salla-gifting.entry.js +486 -0
- package/dist/esm/salla-hook.entry.js +1 -1
- package/dist/esm/salla-infinite-scroll.entry.js +89 -0
- package/dist/esm/salla-installment.entry.js +1 -1
- package/dist/esm/salla-list-tile.entry.js +32 -0
- package/dist/esm/salla-localization-modal.entry.js +135 -0
- package/dist/esm/salla-login-modal.entry.js +318 -0
- package/dist/esm/salla-loyalty-prize-item.entry.js +1 -1
- package/dist/esm/salla-loyalty-program.entry.js +3 -3
- package/dist/esm/salla-loyalty.entry.js +209 -0
- package/dist/esm/salla-maintenance-alert.entry.js +38 -0
- package/dist/esm/salla-menu.entry.js +137 -0
- package/dist/esm/salla-metadata.entry.js +1 -1
- package/dist/esm/salla-multiple-bundle-product-cart_2.entry.js +217 -0
- package/dist/esm/salla-multiple-bundle-product-options-modal_2.entry.js +595 -0
- package/dist/esm/salla-multiple-bundle-product.entry.js +67 -0
- package/dist/esm/salla-notification-item.entry.js +1 -1
- package/dist/esm/salla-notifications.entry.js +1 -1
- package/dist/esm/salla-offer-modal.entry.js +204 -0
- 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 +3 -3
- 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 +6 -18
- package/dist/esm/salla-placeholder.entry.js +49 -0
- package/dist/esm/salla-price-range.entry.js +1 -1
- package/dist/esm/salla-product-size-guide.entry.js +64 -0
- package/dist/esm/salla-products-list.entry.js +760 -0
- package/dist/esm/salla-products-slider.entry.js +113 -0
- package/dist/esm/salla-progress-bar.entry.js +71 -0
- package/dist/esm/salla-quick-order.entry.js +237 -0
- package/dist/esm/salla-rating-modal.entry.js +451 -0
- package/dist/esm/salla-scopes.entry.js +178 -0
- package/dist/esm/salla-search.entry.js +151 -0
- package/dist/esm/salla-skeleton.entry.js +34 -0
- package/dist/esm/salla-slider.entry.js +10426 -0
- package/dist/esm/salla-social-share.entry.js +163 -0
- package/dist/esm/salla-social.entry.js +3 -3
- package/dist/esm/salla-tab-content_3.entry.js +153 -0
- package/dist/esm/salla-tiered-offer.entry.js +1 -1
- package/dist/esm/salla-tooltip.entry.js +2 -2
- package/dist/esm/salla-trust-badges.entry.js +1 -1
- package/dist/esm/salla-user-menu.entry.js +273 -0
- package/dist/esm/salla-user-profile.entry.js +143 -0
- package/dist/esm/salla-user-settings.entry.js +86 -0
- package/dist/esm/salla-verify.entry.js +1 -1
- package/dist/esm/salla-wallet.entry.js +1 -1
- package/dist/esm/search-BscTeWDc.js +11 -0
- package/dist/esm/{special-discount-yRO-ZESF.js → special-discount-Ctkfc4K-.js} +1 -8
- package/dist/esm/star-ZT7ehBBk.js +11 -0
- package/dist/esm/star2-D4oPi1Ov.js +11 -0
- package/dist/esm/twilight.js +3 -3
- package/dist/esm/{vanilla-picker-B4PKRAhm.js → vanilla-picker-fpTcpsmb.js} +1 -1
- package/dist/esm/{whatsapp2-DWksgowB.js → whatsapp2-CgR-T_ZS.js} +2 -2
- package/dist/twilight/p-009d1b75.entry.js +4 -0
- package/dist/twilight/{p-16b8d78c.entry.js → p-04e21492.entry.js} +1 -1
- package/dist/twilight/{p-ac6fc286.entry.js → p-0cc07ad0.entry.js} +1 -1
- package/dist/twilight/p-0f45b27f.entry.js +4 -0
- package/dist/twilight/p-112b4c91.entry.js +4 -0
- package/dist/twilight/p-14749ab0.entry.js +4 -0
- package/dist/twilight/{p-0c87ef6c.entry.js → p-1c66e567.entry.js} +1 -1
- package/dist/twilight/p-1e405d4e.entry.js +4 -0
- package/dist/twilight/{p-33ea3141.entry.js → p-1eb76272.entry.js} +1 -1
- package/dist/twilight/p-2322e6fc.entry.js +4 -0
- package/dist/twilight/{p-7e39343d.entry.js → p-2626b358.entry.js} +1 -1
- package/dist/twilight/{p-18ebec2c.entry.js → p-29e92637.entry.js} +1 -1
- package/dist/twilight/p-2ca5a8af.entry.js +4 -0
- package/dist/twilight/{p-4253fc44.entry.js → p-2cb04fa6.entry.js} +1 -1
- package/dist/twilight/{p-19e07b9e.entry.js → p-2e97a6cd.entry.js} +1 -1
- package/dist/twilight/{p-zHj-W7EE.js → p-2tEKDOI-.js} +1 -1
- package/dist/twilight/p-30b58124.entry.js +4 -0
- package/dist/twilight/{p-8c7b7712.entry.js → p-333171ce.entry.js} +1 -1
- package/dist/twilight/p-33cd8edb.entry.js +4 -0
- package/dist/twilight/p-3774fa61.entry.js +4 -0
- package/dist/twilight/{p-5067322a.entry.js → p-37aa131b.entry.js} +1 -1
- package/dist/twilight/{p-dde21f4b.entry.js → p-3c76e2d4.entry.js} +1 -1
- package/dist/twilight/{p-2d209f96.entry.js → p-3cbbd625.entry.js} +1 -1
- package/dist/twilight/{p-6f5d02c6.entry.js → p-3db132b8.entry.js} +1 -1
- package/dist/twilight/p-3eff2372.entry.js +4 -0
- package/dist/twilight/p-428fe4e6.entry.js +4 -0
- package/dist/twilight/p-475a61f8.entry.js +4 -0
- package/dist/twilight/{p-BijadG7g.js → p-4D4VVK4U.js} +1 -1
- package/dist/twilight/p-4c31b81f.entry.js +4 -0
- package/dist/twilight/{p-c096e336.entry.js → p-52ffcaba.entry.js} +1 -1
- package/dist/twilight/p-534be529.entry.js +4 -0
- package/dist/twilight/p-59697c9b.entry.js +4 -0
- package/dist/twilight/p-5c5aba15.entry.js +4 -0
- package/dist/twilight/p-666bea2d.entry.js +4 -0
- package/dist/twilight/p-6a934903.entry.js +4 -0
- package/dist/twilight/{p-6f576591.entry.js → p-6e89154f.entry.js} +1 -1
- package/dist/twilight/p-6f69cfa5.entry.js +4 -0
- package/dist/twilight/{p-d4aaeef4.entry.js → p-76ce3ec0.entry.js} +1 -1
- package/dist/twilight/p-781f1219.entry.js +4 -0
- package/dist/twilight/p-78e33f77.entry.js +4 -0
- package/dist/twilight/p-79aa2c2f.entry.js +4 -0
- package/dist/twilight/p-7a2bd261.entry.js +4 -0
- package/dist/twilight/p-7a769233.entry.js +4 -0
- package/dist/twilight/{p-6472200c.entry.js → p-7eef10c9.entry.js} +1 -1
- package/dist/twilight/{p-2a26c1d6.entry.js → p-8606c783.entry.js} +1 -1
- package/dist/twilight/p-8719301a.entry.js +4 -0
- package/dist/twilight/p-8ad78dfa.entry.js +4 -0
- package/dist/twilight/{p-300624bb.entry.js → p-9bea43d6.entry.js} +1 -1
- package/dist/twilight/{p-8b018d82.entry.js → p-9c01357f.entry.js} +1 -1
- package/dist/twilight/{p-C0JNGIpa.js → p-BChI23pG.js} +1 -1
- package/dist/twilight/{p-Cuxsz9f-.js → p-BPRHuBhm.js} +1 -1
- package/dist/twilight/{p-B2SkkGH8.js → p-BRh_eoK1.js} +1 -1
- package/dist/twilight/p-BV4kqbdL.js +4 -0
- package/dist/twilight/{p-tFBCbVoG.js → p-BitILwJ_.js} +1 -1
- package/dist/twilight/p-BsLF_HK7.js +4 -0
- package/dist/twilight/{p-uTyAzPSy.js → p-BsXh13x8.js} +1 -1
- package/dist/twilight/p-BscTeWDc.js +4 -0
- package/dist/twilight/{p-ChfiVIJv.js → p-Bx_UY06u.js} +1 -1
- package/dist/twilight/p-C-tzSDxw.js +4 -0
- package/dist/twilight/{p-Bp_xKTyn.js → p-C6S8Hr36.js} +1 -1
- package/dist/twilight/p-C6jIkM-X.js +4 -0
- package/dist/twilight/p-CO-PeZ27.js +4 -0
- package/dist/twilight/{p-DWksgowB.js → p-CgR-T_ZS.js} +1 -1
- package/dist/twilight/p-Ctkfc4K-.js +4 -0
- package/dist/twilight/p-D3mWkc-3.js +4 -0
- package/dist/twilight/p-D4oPi1Ov.js +4 -0
- package/dist/twilight/p-DCZbpt2a.js +4 -0
- package/dist/twilight/p-DY4LZmNP.js +4 -0
- package/dist/twilight/p-DfeagqF1.js +4 -0
- package/dist/twilight/{p-DnELO4MH.js → p-DtkaGJwR.js} +1 -1
- package/dist/twilight/p-OF8QcbMM.js +4 -0
- package/dist/twilight/{p-6mr785rH.js → p-PHxPq4LJ.js} +2 -2
- package/dist/twilight/p-Vqpj4CWE.js +4 -0
- package/dist/twilight/p-ZT7ehBBk.js +4 -0
- package/dist/twilight/p-a5bb66a3.entry.js +4 -0
- package/dist/twilight/p-ad9c9773.entry.js +4 -0
- package/dist/twilight/p-b502e876.entry.js +4 -0
- package/dist/twilight/{p-e909d28b.entry.js → p-b8d8175a.entry.js} +1 -1
- package/dist/twilight/p-ba5fc67a.entry.js +4 -0
- package/dist/twilight/p-c3750eaa.entry.js +4 -0
- package/dist/twilight/p-d7037864.entry.js +4 -0
- package/dist/twilight/p-d9880694.entry.js +4 -0
- package/dist/twilight/p-db0b3ed2.entry.js +4 -0
- package/dist/twilight/{p-81702ecb.entry.js → p-dbb4ede5.entry.js} +1 -1
- package/dist/twilight/{p-28900b2e.entry.js → p-e017e403.entry.js} +1 -1
- package/dist/twilight/p-e31177e7.entry.js +4 -0
- package/dist/twilight/p-e5b90edd.entry.js +4 -0
- package/dist/twilight/{p-b60db6c8.entry.js → p-ec3f15ee.entry.js} +1 -1
- package/dist/twilight/p-edc41bbc.entry.js +4 -0
- package/dist/twilight/p-f2c23e42.entry.js +4 -0
- package/dist/twilight/p-f34f5a30.entry.js +4 -0
- package/dist/twilight/{p-4bc98557.entry.js → p-f578dea7.entry.js} +1 -1
- package/dist/twilight/{p-9946fa76.entry.js → p-ffbd5949.entry.js} +1 -1
- package/dist/twilight/{p-C_h1JDCU.js → p-fq0HEcD_.js} +1 -1
- package/dist/twilight/twilight.esm.js +1 -1
- package/dist/types/components/salla-payments/salla-payments.d.ts +0 -2
- package/dist/types/components/salla-product-options/salla-product-options.d.ts +8 -1
- package/dist/types/components/salla-products-slider/salla-products-slider.d.ts +8 -0
- package/dist/types/components/salla-slider/salla-slider.d.ts +20 -2
- package/dist/types/components.d.ts +26 -0
- package/package.json +5 -5
- package/dist/cjs/salla-accordion_62.cjs.entry.js +0 -22470
- package/dist/cjs/salla-review-card.cjs.entry.js +0 -183
- package/dist/cjs/salla-reviews-page.cjs.entry.js +0 -695
- package/dist/cjs/salla-reviews.cjs.entry.js +0 -106
- package/dist/esm/salla-accordion_62.entry.js +0 -22389
- package/dist/esm/salla-review-card.entry.js +0 -181
- package/dist/esm/salla-reviews-page.entry.js +0 -693
- package/dist/esm/salla-reviews.entry.js +0 -104
- package/dist/twilight/p-12e49031.entry.js +0 -4
- package/dist/twilight/p-5bf05092.entry.js +0 -4
- package/dist/twilight/p-67830f2a.entry.js +0 -4
- package/dist/twilight/p-751dddd4.entry.js +0 -4
- package/dist/twilight/p-9b22a7eb.entry.js +0 -4
- package/dist/twilight/p-CBT_Nxny.js +0 -4
- package/dist/twilight/p-Dz7o69vX.js +0 -4
- package/dist/twilight/p-a515a8cc.entry.js +0 -4
- package/dist/twilight/p-c4821f8b.entry.js +0 -4
- package/dist/twilight/p-de807340.entry.js +0 -4
- package/dist/twilight/p-fa585081.entry.js +0 -4
- package/dist/twilight/p-yRO-ZESF.js +0 -4
- package/dist/cjs/{twitter-pOrUNjXi.js → facebook-DbXua6B9.js} +2 -2
- package/dist/esm/{twitter-Dz7o69vX.js → facebook-CO-PeZ27.js} +2 -2
|
@@ -0,0 +1,595 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Crafted with ❤ by Salla
|
|
3
|
+
*/
|
|
4
|
+
import { r as registerInstance, c as createEvent, h, H as Host, a as getElement } from './index-PHxPq4LJ.js';
|
|
5
|
+
import { A as ArrowLeftIcon, a as ArrowRightIcon } from './keyboard_arrow_right-Vqpj4CWE.js';
|
|
6
|
+
|
|
7
|
+
const sallaMultipleBundleProductOptionsModalCss = ":host{display:block}";
|
|
8
|
+
|
|
9
|
+
const SallaMultipleBundleProductOptionsModal = class {
|
|
10
|
+
constructor(hostRef) {
|
|
11
|
+
registerInstance(this, hostRef);
|
|
12
|
+
this.optionsSaved = createEvent(this, "optionsSaved");
|
|
13
|
+
this.productSelected = createEvent(this, "productSelected");
|
|
14
|
+
this.product = null;
|
|
15
|
+
this.sectionId = null;
|
|
16
|
+
this.sectionIndex = 0;
|
|
17
|
+
this.productIndex = 0;
|
|
18
|
+
this.selectedOptions = {};
|
|
19
|
+
this.optionsResetTokens = {};
|
|
20
|
+
this.isLoading = false;
|
|
21
|
+
this.hasUnsavedChanges = false;
|
|
22
|
+
this.validationErrors = [];
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Generate a unique cache key for selected options using section ID, product index, and product ID
|
|
26
|
+
*/
|
|
27
|
+
generateCacheKey(sectionId, productIndex, productId) {
|
|
28
|
+
return `${sectionId || 'unknown'}-${productIndex || 0}-${productId || 'unknown'}`;
|
|
29
|
+
}
|
|
30
|
+
handleProductChange(newValue) {
|
|
31
|
+
// Use setTimeout to ensure modal is ready
|
|
32
|
+
setTimeout(() => {
|
|
33
|
+
if (this.modal && newValue) {
|
|
34
|
+
const title = newValue.name || '';
|
|
35
|
+
this.modal.setTitle(title);
|
|
36
|
+
}
|
|
37
|
+
}, 100);
|
|
38
|
+
// Reset validation errors when product changes
|
|
39
|
+
this.validationErrors = [];
|
|
40
|
+
this.hasUnsavedChanges = false;
|
|
41
|
+
}
|
|
42
|
+
async open() {
|
|
43
|
+
if (!this.modal) {
|
|
44
|
+
requestAnimationFrame(() => this.open());
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
this.isLoading = true;
|
|
48
|
+
// Set the title before opening
|
|
49
|
+
if (this.product?.name) {
|
|
50
|
+
this.modal.setTitle(this.product.name);
|
|
51
|
+
}
|
|
52
|
+
this.modal.open();
|
|
53
|
+
// Initialize selectedOptions with current selections from the component
|
|
54
|
+
setTimeout(async () => {
|
|
55
|
+
if (this.product?.id) {
|
|
56
|
+
await this.initializeSelectedOptions();
|
|
57
|
+
}
|
|
58
|
+
// Set title again after modal is fully loaded
|
|
59
|
+
if (this.product?.name) {
|
|
60
|
+
this.modal.setTitle(this.product.name);
|
|
61
|
+
}
|
|
62
|
+
this.modal.stopLoading();
|
|
63
|
+
this.isLoading = false;
|
|
64
|
+
}, 300);
|
|
65
|
+
}
|
|
66
|
+
async close() {
|
|
67
|
+
if (this.modal) {
|
|
68
|
+
this.modal.close();
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
async refreshOptionsState() {
|
|
72
|
+
// Force re-render by updating the component state
|
|
73
|
+
this.selectedOptions = { ...this.selectedOptions };
|
|
74
|
+
}
|
|
75
|
+
componentDidLoad() {
|
|
76
|
+
this.modalOpenListener = (data) => {
|
|
77
|
+
this.product = data.product;
|
|
78
|
+
this.sectionId = data.sectionId || null;
|
|
79
|
+
this.sectionIndex = data.sectionIndex || 0;
|
|
80
|
+
this.productIndex = data.productIndex || 0;
|
|
81
|
+
this.open();
|
|
82
|
+
};
|
|
83
|
+
salla.event.on('multiple-bundle-product-modal::open', this.modalOpenListener);
|
|
84
|
+
// Listen for clear-options event when a product is deselected
|
|
85
|
+
this.clearOptionsListener = (data) => {
|
|
86
|
+
if (!data || !data.productId)
|
|
87
|
+
return;
|
|
88
|
+
this.clearProductOptions(data.productId, data.sectionId, data.productIndex);
|
|
89
|
+
};
|
|
90
|
+
salla.event.on('multiple-bundle-product-modal::clear-options', this.clearOptionsListener);
|
|
91
|
+
// Create and store the option change listener for proper cleanup
|
|
92
|
+
this.optionChangeListener = (e) => {
|
|
93
|
+
const data = e.detail || e;
|
|
94
|
+
const { option, detail } = data;
|
|
95
|
+
// If data is a detail object (has option_id), find the option from product
|
|
96
|
+
const actualOption = option || (data.option_id && this.product?.options?.find(opt => opt.id === data.option_id || String(opt.id) === String(data.option_id)));
|
|
97
|
+
const actualDetail = detail || (data.id ? data : null);
|
|
98
|
+
if (this.product?.id && actualOption) {
|
|
99
|
+
this.handleOptionChange(Number(this.product.id), actualOption, actualDetail);
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
salla.event.on('product-options::change', this.optionChangeListener);
|
|
103
|
+
// Create and store the checkbox change listener for proper cleanup
|
|
104
|
+
this.checkboxChangeListener = (e) => {
|
|
105
|
+
const target = e.target;
|
|
106
|
+
// Check if this is a product selection checkbox
|
|
107
|
+
if (target && target.type === 'checkbox' && target.name && target.name.includes('bundle[') && target.name.includes('][id]')) {
|
|
108
|
+
// Extract section info from the checkbox name: bundle[sectionId][productIndex][id]
|
|
109
|
+
const nameMatch = target.name.match(/^bundle\[([^\]]+)\]\[([^\]]+)\]\[id\]$/);
|
|
110
|
+
if (nameMatch && !target.checked) {
|
|
111
|
+
const [, sectionId, productIndex] = nameMatch;
|
|
112
|
+
const productId = target.value;
|
|
113
|
+
const form = this.host.closest('form');
|
|
114
|
+
this.cleanupProductDeselection({
|
|
115
|
+
sectionId,
|
|
116
|
+
productIndex: parseInt(productIndex, 10),
|
|
117
|
+
productId,
|
|
118
|
+
form,
|
|
119
|
+
uncheckedInput: target,
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
// Listen for product checkbox changes to reset options when product is deselected
|
|
125
|
+
document.addEventListener('change', this.checkboxChangeListener);
|
|
126
|
+
}
|
|
127
|
+
disconnectedCallback() {
|
|
128
|
+
// Clean up event listeners to prevent memory leaks
|
|
129
|
+
if (this.checkboxChangeListener) {
|
|
130
|
+
document.removeEventListener('change', this.checkboxChangeListener);
|
|
131
|
+
}
|
|
132
|
+
if (this.optionChangeListener) {
|
|
133
|
+
salla.event.off('product-options::change', this.optionChangeListener);
|
|
134
|
+
}
|
|
135
|
+
if (this.modalOpenListener) {
|
|
136
|
+
salla.event.off('multiple-bundle-product-modal::open', this.modalOpenListener);
|
|
137
|
+
}
|
|
138
|
+
if (this.clearOptionsListener) {
|
|
139
|
+
salla.event.off('multiple-bundle-product-modal::clear-options', this.clearOptionsListener);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
cleanupProductDeselection(params) {
|
|
143
|
+
const { sectionId, productIndex, productId, form, uncheckedInput } = params;
|
|
144
|
+
this.clearProductOptions(productId, sectionId, productIndex);
|
|
145
|
+
if (form) {
|
|
146
|
+
const productInputPattern = `bundle[${sectionId}][${productIndex}]`;
|
|
147
|
+
Array.from(form.querySelectorAll(`input[name^="${productInputPattern}"]`)).forEach(input => {
|
|
148
|
+
if (input === uncheckedInput) {
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
const shouldRemoveHidden = input.type === 'hidden';
|
|
152
|
+
const shouldRemoveByDataset = input.getAttribute('data-product-id') === String(productId) &&
|
|
153
|
+
input.name?.startsWith(productInputPattern);
|
|
154
|
+
if (shouldRemoveHidden || shouldRemoveByDataset) {
|
|
155
|
+
input.remove();
|
|
156
|
+
}
|
|
157
|
+
});
|
|
158
|
+
requestAnimationFrame(() => {
|
|
159
|
+
const changeEvent = new window.Event('change', { bubbles: true });
|
|
160
|
+
form.dispatchEvent(changeEvent);
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
generateFormInputName(sectionId, productIndex, optionParentId) {
|
|
165
|
+
return `bundle[${sectionId}][${productIndex}][options][${optionParentId}]`;
|
|
166
|
+
}
|
|
167
|
+
async initializeSelectedOptions() {
|
|
168
|
+
if (!this.product?.id)
|
|
169
|
+
return;
|
|
170
|
+
const productId = this.product.id;
|
|
171
|
+
const cacheKey = this.generateCacheKey(this.sectionId, this.productIndex, productId);
|
|
172
|
+
const optionsEl = document.querySelector(`salla-product-options[product-id="${productId}"]`);
|
|
173
|
+
if (optionsEl) {
|
|
174
|
+
try {
|
|
175
|
+
const selectedOptions = await optionsEl.getSelectedOptions();
|
|
176
|
+
if (selectedOptions && selectedOptions.length > 0) {
|
|
177
|
+
this.selectedOptions = {
|
|
178
|
+
...this.selectedOptions,
|
|
179
|
+
[cacheKey]: selectedOptions,
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
catch (e) {
|
|
184
|
+
console.warn('Could not initialize selected options:', e);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
// Clear options state for a specific product
|
|
189
|
+
clearProductOptions(productId, sectionId, productIndex) {
|
|
190
|
+
const updatedSelectedOptions = { ...this.selectedOptions };
|
|
191
|
+
if (sectionId != null && productIndex != null && !Number.isNaN(productIndex)) {
|
|
192
|
+
const cacheKey = this.generateCacheKey(sectionId, productIndex, productId);
|
|
193
|
+
delete updatedSelectedOptions[cacheKey];
|
|
194
|
+
this.bumpOptionsResetToken(cacheKey);
|
|
195
|
+
}
|
|
196
|
+
else {
|
|
197
|
+
const productSuffix = `-${String(productId)}`;
|
|
198
|
+
const affectedKeys = [];
|
|
199
|
+
Object.keys(updatedSelectedOptions).forEach(key => {
|
|
200
|
+
if (key.endsWith(productSuffix)) {
|
|
201
|
+
delete updatedSelectedOptions[key];
|
|
202
|
+
affectedKeys.push(key);
|
|
203
|
+
}
|
|
204
|
+
});
|
|
205
|
+
affectedKeys.forEach(key => this.bumpOptionsResetToken(key));
|
|
206
|
+
}
|
|
207
|
+
this.selectedOptions = updatedSelectedOptions;
|
|
208
|
+
// Reset validation errors and unsaved changes
|
|
209
|
+
this.validationErrors = [];
|
|
210
|
+
this.hasUnsavedChanges = false;
|
|
211
|
+
}
|
|
212
|
+
bumpOptionsResetToken(cacheKey) {
|
|
213
|
+
if (!cacheKey)
|
|
214
|
+
return;
|
|
215
|
+
this.optionsResetTokens = {
|
|
216
|
+
...this.optionsResetTokens,
|
|
217
|
+
[cacheKey]: (this.optionsResetTokens[cacheKey] || 0) + 1,
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
async handleOptionChange(productId, option, detail) {
|
|
221
|
+
const cacheKey = this.generateCacheKey(this.sectionId, this.productIndex, productId);
|
|
222
|
+
// Get the current state from the component to ensure we have the latest selections
|
|
223
|
+
const optionsEl = document.querySelector(`salla-product-options[product-id="${productId}"]`);
|
|
224
|
+
let currentComponentSelections = [];
|
|
225
|
+
if (optionsEl) {
|
|
226
|
+
try {
|
|
227
|
+
currentComponentSelections = (await optionsEl.getSelectedOptions()) || [];
|
|
228
|
+
}
|
|
229
|
+
catch (e) {
|
|
230
|
+
console.warn('Could not get current selections from component:', e);
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
// If component returns data, use it; otherwise, fall back to manual tracking
|
|
234
|
+
if (currentComponentSelections.length > 0) {
|
|
235
|
+
// Component returned data, use it
|
|
236
|
+
this.selectedOptions = {
|
|
237
|
+
...this.selectedOptions,
|
|
238
|
+
[cacheKey]: currentComponentSelections,
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
else {
|
|
242
|
+
// If we have existing selections in internal state and component returns empty,
|
|
243
|
+
// it might be a deselection, so we should use manual tracking
|
|
244
|
+
if (this.selectedOptions[cacheKey] && this.selectedOptions[cacheKey].length > 0) {
|
|
245
|
+
// Component didn't return data, use manual tracking
|
|
246
|
+
const currentSelected = this.selectedOptions[cacheKey] || [];
|
|
247
|
+
const updatedSelected = [...currentSelected];
|
|
248
|
+
// Find existing selection for this specific option (by option_id)
|
|
249
|
+
const existingIndex = updatedSelected.findIndex(opt => opt.option_id === option.id);
|
|
250
|
+
if (existingIndex > -1) {
|
|
251
|
+
// Check if this is a deselection (detail might be null or undefined)
|
|
252
|
+
if (!detail || detail.id === null || detail.id === undefined) {
|
|
253
|
+
// Remove the option (deselection)
|
|
254
|
+
updatedSelected.splice(existingIndex, 1);
|
|
255
|
+
}
|
|
256
|
+
else {
|
|
257
|
+
// Replace existing selection for this option
|
|
258
|
+
updatedSelected[existingIndex] = { ...detail, option_id: option.id };
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
else {
|
|
262
|
+
// Only add if detail exists (not a deselection)
|
|
263
|
+
if (detail && detail.id !== null && detail.id !== undefined) {
|
|
264
|
+
updatedSelected.push({ ...detail, option_id: option.id });
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
this.selectedOptions = {
|
|
268
|
+
...this.selectedOptions,
|
|
269
|
+
[cacheKey]: updatedSelected,
|
|
270
|
+
};
|
|
271
|
+
}
|
|
272
|
+
else {
|
|
273
|
+
// No existing selections, component returned empty, and we're trying to add
|
|
274
|
+
// This might be the first selection, so add it manually
|
|
275
|
+
if (detail && detail.id !== null && detail.id !== undefined) {
|
|
276
|
+
this.selectedOptions = {
|
|
277
|
+
...this.selectedOptions,
|
|
278
|
+
[cacheKey]: [{ ...detail, option_id: option.id }],
|
|
279
|
+
};
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
this.hasUnsavedChanges = true;
|
|
284
|
+
this.validationErrors = []; // Clear validation errors when user makes changes
|
|
285
|
+
}
|
|
286
|
+
async validateOptions() {
|
|
287
|
+
if (!this.product?.options)
|
|
288
|
+
return true;
|
|
289
|
+
const errors = [];
|
|
290
|
+
const productId = this.product.id;
|
|
291
|
+
const cacheKey = this.generateCacheKey(this.sectionId, this.productIndex, productId);
|
|
292
|
+
// Get the actual selected options from the component
|
|
293
|
+
const optionsEl = document.querySelector(`salla-product-options[product-id="${productId}"]`);
|
|
294
|
+
let currentSelected = [];
|
|
295
|
+
if (optionsEl) {
|
|
296
|
+
try {
|
|
297
|
+
currentSelected = (await optionsEl.getSelectedOptions()) || [];
|
|
298
|
+
// Also check our internal state as fallback
|
|
299
|
+
const internalSelected = this.selectedOptions[cacheKey] || [];
|
|
300
|
+
// Use whichever has more selections, or if component returns empty but internal has data, use internal
|
|
301
|
+
if (internalSelected.length > currentSelected.length ||
|
|
302
|
+
(currentSelected.length === 0 && internalSelected.length > 0)) {
|
|
303
|
+
currentSelected = internalSelected;
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
catch (e) {
|
|
307
|
+
// Fallback to internal state
|
|
308
|
+
currentSelected = this.selectedOptions[cacheKey] || [];
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
else {
|
|
312
|
+
// Fallback to internal state
|
|
313
|
+
currentSelected = this.selectedOptions[cacheKey] || [];
|
|
314
|
+
}
|
|
315
|
+
// Check if any options are selected at all
|
|
316
|
+
if (currentSelected.length === 0) {
|
|
317
|
+
errors.push(salla.lang.get('pages.products.no_options_selected'));
|
|
318
|
+
}
|
|
319
|
+
// Check required options
|
|
320
|
+
this.product.options.forEach(option => {
|
|
321
|
+
if (option.required) {
|
|
322
|
+
const hasSelection = currentSelected.some(selected => {
|
|
323
|
+
return selected.option_id == option.id; // Use == instead of === for type flexibility
|
|
324
|
+
});
|
|
325
|
+
if (!hasSelection) {
|
|
326
|
+
errors.push(salla.lang.get('pages.products.required_option_missing', {
|
|
327
|
+
option: option.name,
|
|
328
|
+
}));
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
});
|
|
332
|
+
this.validationErrors = errors;
|
|
333
|
+
return errors.length === 0;
|
|
334
|
+
}
|
|
335
|
+
async onSave(e) {
|
|
336
|
+
e.preventDefault();
|
|
337
|
+
const productId = this.product?.id;
|
|
338
|
+
if (!productId)
|
|
339
|
+
return;
|
|
340
|
+
const cacheKey = this.generateCacheKey(this.sectionId, this.productIndex, productId);
|
|
341
|
+
// Small delay to ensure component state is updated
|
|
342
|
+
await new Promise(resolve => setTimeout(resolve, 100));
|
|
343
|
+
// Validate options before saving
|
|
344
|
+
const isValid = await this.validateOptions();
|
|
345
|
+
if (!isValid) {
|
|
346
|
+
salla.notify.error(this.validationErrors.join(', '));
|
|
347
|
+
return;
|
|
348
|
+
}
|
|
349
|
+
this.isLoading = true;
|
|
350
|
+
try {
|
|
351
|
+
// please don't change this with this.host.querySelector it will return null
|
|
352
|
+
const optionsEl = document.querySelector(`salla-product-options[product-id="${productId}"]`);
|
|
353
|
+
let selectedOptions = await optionsEl?.getSelectedOptions();
|
|
354
|
+
// If component returns empty but we have internal state, use internal state
|
|
355
|
+
if ((!selectedOptions || selectedOptions.length === 0) &&
|
|
356
|
+
this.selectedOptions[cacheKey]?.length > 0) {
|
|
357
|
+
selectedOptions = this.selectedOptions[cacheKey];
|
|
358
|
+
}
|
|
359
|
+
if (!selectedOptions || selectedOptions.length === 0) {
|
|
360
|
+
this.isLoading = false;
|
|
361
|
+
return;
|
|
362
|
+
}
|
|
363
|
+
// Store the selected options for this product using cache key
|
|
364
|
+
this.selectedOptions = {
|
|
365
|
+
...this.selectedOptions,
|
|
366
|
+
[cacheKey]: selectedOptions,
|
|
367
|
+
};
|
|
368
|
+
const form = this.host.closest('form');
|
|
369
|
+
if (!form) {
|
|
370
|
+
this.isLoading = false;
|
|
371
|
+
return;
|
|
372
|
+
}
|
|
373
|
+
// remove old inputs for this specific product in this specific section/index only
|
|
374
|
+
const productInputPattern = `bundle[${this.sectionId}][${this.productIndex}]`;
|
|
375
|
+
// Remove only hidden inputs and inputs with data-product-id, but preserve visible checkboxes
|
|
376
|
+
Array.from(form.querySelectorAll(`input[name^="${productInputPattern}"][type="hidden"]`)).forEach(el => el.remove());
|
|
377
|
+
// Also remove any inputs with data-product-id that match this specific pattern
|
|
378
|
+
Array.from(form.querySelectorAll(`[data-product-id="${productId}"][name^="${productInputPattern}"]`)).forEach(el => el.remove());
|
|
379
|
+
// Ensure the actual checkbox in the UI is checked to reflect the selection visually
|
|
380
|
+
const checkboxId = `bundle[${this.sectionId}][${this.productIndex}][id]`;
|
|
381
|
+
const checkbox = document.getElementById(checkboxId);
|
|
382
|
+
if (checkbox) {
|
|
383
|
+
checkbox.checked = true;
|
|
384
|
+
// Don't dispatch change event here to avoid double API calls
|
|
385
|
+
}
|
|
386
|
+
else {
|
|
387
|
+
// If checkbox doesn't exist, create a hidden input as fallback
|
|
388
|
+
const productSelectionInput = document.createElement('input');
|
|
389
|
+
productSelectionInput.type = 'hidden';
|
|
390
|
+
productSelectionInput.name = `bundle[${this.sectionId}][${this.productIndex}][id]`;
|
|
391
|
+
productSelectionInput.value = String(productId);
|
|
392
|
+
productSelectionInput.dataset.productId = String(productId);
|
|
393
|
+
form.appendChild(productSelectionInput);
|
|
394
|
+
}
|
|
395
|
+
// append new hidden inputs for options
|
|
396
|
+
selectedOptions.forEach((option) => {
|
|
397
|
+
// how to get option parent id?
|
|
398
|
+
const optionParentId = option.option_id;
|
|
399
|
+
const hidden = document.createElement('input');
|
|
400
|
+
hidden.type = 'hidden';
|
|
401
|
+
// Use productIndex for the form input name
|
|
402
|
+
hidden.name = this.generateFormInputName(this.sectionId, this.productIndex ?? 0, optionParentId);
|
|
403
|
+
hidden.value = String(option.id);
|
|
404
|
+
hidden.dataset.productId = String(productId);
|
|
405
|
+
form.appendChild(hidden);
|
|
406
|
+
});
|
|
407
|
+
// Trigger single form change event with all updates (product selection + options)
|
|
408
|
+
const changeEvent = new window.Event('change', { bubbles: true });
|
|
409
|
+
form.dispatchEvent(changeEvent);
|
|
410
|
+
// Emit custom event
|
|
411
|
+
this.optionsSaved.emit({
|
|
412
|
+
productId: Number(productId),
|
|
413
|
+
selectedOptions,
|
|
414
|
+
sectionId: this.sectionId,
|
|
415
|
+
productIndex: this.productIndex,
|
|
416
|
+
});
|
|
417
|
+
// Emit product selected event to check the card
|
|
418
|
+
if (this.sectionId) {
|
|
419
|
+
this.productSelected.emit({
|
|
420
|
+
productId: Number(productId),
|
|
421
|
+
sectionId: this.sectionId,
|
|
422
|
+
product: this.product,
|
|
423
|
+
fromModal: true,
|
|
424
|
+
});
|
|
425
|
+
}
|
|
426
|
+
// Show success message
|
|
427
|
+
salla.notify.success(salla.lang.get('pages.products.options_saved'));
|
|
428
|
+
this.hasUnsavedChanges = false;
|
|
429
|
+
this.validationErrors = [];
|
|
430
|
+
// close modal
|
|
431
|
+
this.modal.close();
|
|
432
|
+
}
|
|
433
|
+
catch (error) {
|
|
434
|
+
salla.notify.error(salla.lang.get('pages.products.options_save_error'));
|
|
435
|
+
}
|
|
436
|
+
finally {
|
|
437
|
+
this.isLoading = false;
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
// Method to get options with selected state preserved
|
|
441
|
+
getOptionsWithSelectedState() {
|
|
442
|
+
if (!this.product?.options)
|
|
443
|
+
return [];
|
|
444
|
+
const cacheKey = this.generateCacheKey(this.sectionId, this.productIndex, this.product.id);
|
|
445
|
+
const savedOptions = this.selectedOptions[cacheKey] || [];
|
|
446
|
+
return this.product.options.map(option => ({
|
|
447
|
+
...option,
|
|
448
|
+
details: option.details.map(detail => {
|
|
449
|
+
const isSelected = savedOptions.some(saved => {
|
|
450
|
+
return saved.id === detail.id;
|
|
451
|
+
});
|
|
452
|
+
return {
|
|
453
|
+
...detail,
|
|
454
|
+
is_selected: isSelected,
|
|
455
|
+
};
|
|
456
|
+
}),
|
|
457
|
+
}));
|
|
458
|
+
}
|
|
459
|
+
render() {
|
|
460
|
+
const productId = this.product?.id;
|
|
461
|
+
const optionsWithSelectedState = this.getOptionsWithSelectedState();
|
|
462
|
+
const cacheKey = this.generateCacheKey(this.sectionId, this.productIndex, productId);
|
|
463
|
+
const resetToken = this.optionsResetTokens[cacheKey] || 0;
|
|
464
|
+
const isDisabled = this.isLoading || optionsWithSelectedState.some(opt => opt.details.some(d => d.is_selected && d.is_out === true));
|
|
465
|
+
return (h(Host, { key: '28786c060499c9bfbacf025b75f21d0e8a2d6ab1' }, h("salla-modal", { key: '6322c0542ca2769f50ed6fc616c6d5c72d456c9c', isLoading: this.isLoading, ref: el => (this.modal = el), width: "md", centered: false, id: `s-multiple-bundle-product-options-modal-options-${productId}`, class: "s-multiple-bundle-product-options-modal-wrapper" }, h("div", { key: '812707c4108b5bdefa97e1ff7537998083e2403b', slot: "loading" }, h("salla-skeleton", { key: 'e82b875495873b66414ee4a75d845823373b4914', height: "100%", width: "100%" })), this.product?.images && this.product?.images.length > 0 && (h("salla-slider", { key: 'f1f3545637b182257f9107972a819ae9819de137', id: `details-slider-${this.product?.id}`, type: "thumbs", loop: false, "auto-height": true, "listen-to-thumbnails-option": true, showThumbsControls: false, controlsOuter: false, showControls: false, class: "s-multiple-bundle-product-options-modal-slider", verticalThumbs: true, thumbsConfig: {
|
|
466
|
+
centeredSlides: true,
|
|
467
|
+
centeredSlidesBounds: true,
|
|
468
|
+
slidesPerView: Math.min(5, Math.max(1, this.product?.images.length)),
|
|
469
|
+
watchOverflow: true,
|
|
470
|
+
watchSlidesProgress: true,
|
|
471
|
+
direction: 'vertical',
|
|
472
|
+
spaceBetween: 10,
|
|
473
|
+
} }, h("div", { key: '97b50195903a01376e057bc99ddb353fd3dfdb2b', slot: "items" }, this.product?.images &&
|
|
474
|
+
this.product?.images.map((image, index) => (h("div", { key: index, class: "swiper-slide" }, h("img", { src: image.url, alt: image.alt || `${this.product?.name} - Image ${index + 1}`, loading: "lazy", onError: e => {
|
|
475
|
+
e.target.style.display = 'none';
|
|
476
|
+
} }))))), this.product?.images && this.product?.images.length > 1 && (h("div", { key: 'ff943c9c8f175ff1c0374a13153b33889c468dda', slot: "thumbs" }, this.product?.images &&
|
|
477
|
+
this.product?.images.map((image, index) => (h("div", { key: index, "data-caption": `${this.product?.name} - Image ${index + 1}` }, h("img", { src: image.url, loading: "eager", class: "s-multiple-bundle-product-options-modal-slider-thumb", title: `${this.product?.name} - ${index + 1}`, alt: image.alt || `${this.product?.name} - ${index + 1}`, onError: e => {
|
|
478
|
+
e.target.style.display = 'none';
|
|
479
|
+
} })))))))), h("salla-product-options", { options: JSON.stringify(optionsWithSelectedState), key: `${cacheKey}-reset-${resetToken}`, "product-id": productId, "unique-key": `${cacheKey}-reset-${resetToken}` }), h("div", { key: '7555836d26018f6405bc54a1cd735b4030d4bdf1', slot: "footer" }, h("div", { key: 'a7ee5f19a4c11a1c61e4dc026fa8673e0ab74c3f', class: "s-multiple-bundle-product-options-modal-footer" }, h("salla-button", { key: '1da19964053766f3a1339ea0e77ab7aaa4d8a003', onClick: e => this.onSave(e), loading: this.isLoading, disabled: isDisabled }, this.isLoading
|
|
480
|
+
? salla.lang.get('common.elements.saving')
|
|
481
|
+
: salla.lang.get('common.elements.save')))))));
|
|
482
|
+
}
|
|
483
|
+
get host() { return getElement(this); }
|
|
484
|
+
static get watchers() { return {
|
|
485
|
+
"product": ["handleProductChange"]
|
|
486
|
+
}; }
|
|
487
|
+
};
|
|
488
|
+
SallaMultipleBundleProductOptionsModal.style = sallaMultipleBundleProductOptionsModalCss;
|
|
489
|
+
|
|
490
|
+
const sallaMultipleBundleProductSliderCss = "";
|
|
491
|
+
|
|
492
|
+
const SallaMultipleBundleProductSlider = class {
|
|
493
|
+
constructor(hostRef) {
|
|
494
|
+
registerInstance(this, hostRef);
|
|
495
|
+
this.productSelected = createEvent(this, "productSelected");
|
|
496
|
+
this.productOptionsSelected = createEvent(this, "productOptionsSelected");
|
|
497
|
+
this.selectedProducts = {};
|
|
498
|
+
this.savedOptionsByInstance = {};
|
|
499
|
+
this.handleProductClick = (product, productIndex) => {
|
|
500
|
+
// Find the checkbox input for this product
|
|
501
|
+
const checkboxId = this.generateEventName(this.section.id, productIndex);
|
|
502
|
+
const checkbox = document.getElementById(checkboxId);
|
|
503
|
+
if (!checkbox)
|
|
504
|
+
return;
|
|
505
|
+
if (checkbox) {
|
|
506
|
+
const willBeChecked = !checkbox.checked;
|
|
507
|
+
if (!willBeChecked) {
|
|
508
|
+
this.dispatchClearOptionsEvent(product, productIndex);
|
|
509
|
+
this.clearSavedOptionsState(this.section.id, productIndex);
|
|
510
|
+
}
|
|
511
|
+
// Toggle the checkbox state
|
|
512
|
+
checkbox.checked = willBeChecked;
|
|
513
|
+
// Dispatch a change event to trigger form validation/submission
|
|
514
|
+
requestAnimationFrame(() => {
|
|
515
|
+
const changeEvent = new window.Event('change', { bubbles: true });
|
|
516
|
+
checkbox.dispatchEvent(changeEvent);
|
|
517
|
+
});
|
|
518
|
+
}
|
|
519
|
+
this.productSelected.emit({
|
|
520
|
+
product,
|
|
521
|
+
sectionId: this.section.id,
|
|
522
|
+
});
|
|
523
|
+
};
|
|
524
|
+
this.handleOptionsClick = (product) => {
|
|
525
|
+
this.productOptionsSelected.emit({
|
|
526
|
+
product,
|
|
527
|
+
sectionId: this.section.id,
|
|
528
|
+
});
|
|
529
|
+
};
|
|
530
|
+
}
|
|
531
|
+
getProductInstanceKey(sectionId, productIndex) {
|
|
532
|
+
return `${sectionId}::${productIndex}`;
|
|
533
|
+
}
|
|
534
|
+
dispatchClearOptionsEvent(product, productIndex) {
|
|
535
|
+
salla.event.dispatch('multiple-bundle-product-modal::clear-options', {
|
|
536
|
+
productId: product.id,
|
|
537
|
+
sectionId: this.section.id,
|
|
538
|
+
sectionIndex: this.sectionIndex,
|
|
539
|
+
productIndex,
|
|
540
|
+
});
|
|
541
|
+
}
|
|
542
|
+
handleOptionsSaved(event) {
|
|
543
|
+
const detail = event.detail;
|
|
544
|
+
if (!detail)
|
|
545
|
+
return;
|
|
546
|
+
const { sectionId, productIndex, selectedOptions } = detail;
|
|
547
|
+
if (sectionId == null || sectionId !== this.section?.id)
|
|
548
|
+
return;
|
|
549
|
+
if (productIndex == null || Number.isNaN(productIndex))
|
|
550
|
+
return;
|
|
551
|
+
const key = this.getProductInstanceKey(sectionId, productIndex);
|
|
552
|
+
const hasOptions = !!selectedOptions?.length;
|
|
553
|
+
if (hasOptions) {
|
|
554
|
+
this.savedOptionsByInstance = {
|
|
555
|
+
...this.savedOptionsByInstance,
|
|
556
|
+
[key]: true,
|
|
557
|
+
};
|
|
558
|
+
}
|
|
559
|
+
else if (this.savedOptionsByInstance[key]) {
|
|
560
|
+
const updatedState = { ...this.savedOptionsByInstance };
|
|
561
|
+
delete updatedState[key];
|
|
562
|
+
this.savedOptionsByInstance = updatedState;
|
|
563
|
+
}
|
|
564
|
+
}
|
|
565
|
+
clearSavedOptionsState(sectionId, productIndex) {
|
|
566
|
+
const key = this.getProductInstanceKey(sectionId, productIndex);
|
|
567
|
+
if (!this.savedOptionsByInstance[key])
|
|
568
|
+
return;
|
|
569
|
+
const updatedState = { ...this.savedOptionsByInstance };
|
|
570
|
+
delete updatedState[key];
|
|
571
|
+
this.savedOptionsByInstance = updatedState;
|
|
572
|
+
}
|
|
573
|
+
generateEventName(sectionId, productIndex) {
|
|
574
|
+
return `bundle[${sectionId}][${productIndex}][id]`;
|
|
575
|
+
}
|
|
576
|
+
render() {
|
|
577
|
+
return (h(Host, { key: 'a1e7d56d8a50d1c31ba102d3246b0251516e0a73' }, h("salla-slider", { key: '8308576a46ec71f557a3d686d59cd0109d5bef0f', type: "carousel", controlsOuter: false, showControls: false, id: `accordion-multiple-bundle-product-${this.section.id}`, pagination: true, class: "s-multiple-bundle-product-wrapper-slider", sliderConfig: { spaceBetween: 0 } }, h("div", { key: '3ea742119ab77f129b8c60bbcc0f8c0f7bd3e97d', slot: "items" }, this?.section?.products?.map((product, productIndex) => {
|
|
578
|
+
const isChecked = this.selectedProducts[this.section.id]?.has(product.id) || false;
|
|
579
|
+
const hasSavedOptions = this.savedOptionsByInstance[this.getProductInstanceKey(this.section.id, productIndex)];
|
|
580
|
+
const optionsButtonLabel = hasSavedOptions
|
|
581
|
+
? salla.lang.getWithDefault('pages.products.edit_selected_options', 'تعديل الخيارات')
|
|
582
|
+
: salla.lang.get('pages.products.choose_from_options');
|
|
583
|
+
let optionsArrowIcon = salla.config.get('theme.is_rtl', true)
|
|
584
|
+
? ArrowLeftIcon
|
|
585
|
+
: ArrowRightIcon;
|
|
586
|
+
return (h("div", { class: `s-multiple-bundle-product-slide-one-third ${product.quantity == 0
|
|
587
|
+
? 's-multiple-bundle-product-slide-one-third-disabled'
|
|
588
|
+
: ''}`, key: product.id }, h("div", { class: "s-multiple-bundle-product-card" }, h("div", { class: "s-multiple-bundle-product-image-wrapper", onClick: () => this.handleProductClick(product, productIndex) }, h("input", { id: this.generateEventName(this.section.id, productIndex), type: "checkbox", class: "s-multiple-bundle-product-checkbox", checked: isChecked, name: this.generateEventName(this.section.id, productIndex), value: product.id }), h("img", { src: product.image.url || salla.url.cdn('images/s-empty.png'), loading: "lazy", alt: product.image.alt || product.name, class: "s-multiple-bundle-product-image" })), h("div", { class: "s-multiple-bundle-product-content-wrapper" }, h("div", { class: "s-multiple-bundle-product-content" }, h("div", { class: "s-multiple-bundle-product-details" }, h("div", { class: "s-multiple-bundle-product-title-wrapper" }, h("h2", { class: "s-multiple-bundle-product-title" }, h("a", { href: product?.url || '#', target: "_blank", rel: "noopener noreferrer" }, product.name))), h("div", { class: "s-multiple-bundle-product-price-wrapper" }, h("span", { class: "s-multiple-bundle-product-price" }, h("span", { innerHTML: salla.money(product.price) })), product.sale_price > 0 && (h("span", { class: "s-multiple-bundle-product-price-discount" }, h("span", { innerHTML: salla.money(product.regular_price) }))))), product.quantity_in_group > 0 && product.quantity !== 0 && (h("span", { class: "s-multiple-bundle-product-badge" }, salla.lang.get('pages.products.pieces'), h("span", null, product.quantity_in_group))), product.quantity === 0 && (h("span", { class: "s-multiple-bundle-product-badge" }, salla.lang.get('pages.products.quantity_in_group_finished')))), product.options?.length > 0 && (h("button", { class: "s-multiple-bundle-product-button", onClick: () => this.handleOptionsClick(product), type: "button" }, optionsButtonLabel, h("span", { class: "s-multiple-bundle-product-button-icon", innerHTML: optionsArrowIcon })))))));
|
|
589
|
+
})))));
|
|
590
|
+
}
|
|
591
|
+
get host() { return getElement(this); }
|
|
592
|
+
};
|
|
593
|
+
SallaMultipleBundleProductSlider.style = sallaMultipleBundleProductSliderCss;
|
|
594
|
+
|
|
595
|
+
export { SallaMultipleBundleProductOptionsModal as salla_multiple_bundle_product_options_modal, SallaMultipleBundleProductSlider as salla_multiple_bundle_product_slider };
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Crafted with ❤ by Salla
|
|
3
|
+
*/
|
|
4
|
+
import { r as registerInstance, h, H as Host } from './index-PHxPq4LJ.js';
|
|
5
|
+
|
|
6
|
+
const sallaMultipleBundleProductCss = ":host{display:block}";
|
|
7
|
+
|
|
8
|
+
const SallaMultipleBundleProduct = class {
|
|
9
|
+
constructor(hostRef) {
|
|
10
|
+
registerInstance(this, hostRef);
|
|
11
|
+
this.parsedSections = [];
|
|
12
|
+
}
|
|
13
|
+
parseProducts(newValue) {
|
|
14
|
+
let sections = [];
|
|
15
|
+
if (typeof newValue === 'string') {
|
|
16
|
+
try {
|
|
17
|
+
const parsed = JSON.parse(newValue);
|
|
18
|
+
sections = this.extractSections(parsed);
|
|
19
|
+
}
|
|
20
|
+
catch (e) {
|
|
21
|
+
console.error('Invalid JSON passed to bundleSections prop:', newValue);
|
|
22
|
+
sections = [];
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
else if (newValue) {
|
|
26
|
+
sections = this.extractSections(newValue);
|
|
27
|
+
}
|
|
28
|
+
this.parsedSections = sections;
|
|
29
|
+
}
|
|
30
|
+
extractSections(data) {
|
|
31
|
+
// Handle new nested structure: data.bundle.sections
|
|
32
|
+
if (data.bundle && data.bundle.sections && Array.isArray(data.bundle.sections)) {
|
|
33
|
+
return data.bundle.sections;
|
|
34
|
+
}
|
|
35
|
+
// Handle old flat structure: data is directly an array of sections
|
|
36
|
+
if (Array.isArray(data)) {
|
|
37
|
+
return data;
|
|
38
|
+
}
|
|
39
|
+
// Handle case where data.sections exists at root level
|
|
40
|
+
if (data.sections && Array.isArray(data.sections)) {
|
|
41
|
+
return data.sections;
|
|
42
|
+
}
|
|
43
|
+
console.warn('No valid sections found in data:', data);
|
|
44
|
+
return [];
|
|
45
|
+
}
|
|
46
|
+
isCartPage() {
|
|
47
|
+
return salla.url.is_page('cart');
|
|
48
|
+
}
|
|
49
|
+
renderCartPage() {
|
|
50
|
+
return h("salla-multiple-bundle-product-cart", { sections: this.parsedSections });
|
|
51
|
+
}
|
|
52
|
+
renderDetailsPage() {
|
|
53
|
+
return h("salla-multiple-bundle-product-details", { sections: this.parsedSections });
|
|
54
|
+
}
|
|
55
|
+
componentWillLoad() {
|
|
56
|
+
this.parseProducts(this.bundleSections);
|
|
57
|
+
}
|
|
58
|
+
render() {
|
|
59
|
+
return (h(Host, { key: '91666a9a9d0302d7f93f001b39d06160f2dc6960', class: "s-multiple-bundle-product-wrapper" }, this.isCartPage() ? this.renderCartPage() : this.renderDetailsPage()));
|
|
60
|
+
}
|
|
61
|
+
static get watchers() { return {
|
|
62
|
+
"bundleSections": ["parseProducts"]
|
|
63
|
+
}; }
|
|
64
|
+
};
|
|
65
|
+
SallaMultipleBundleProduct.style = sallaMultipleBundleProductCss;
|
|
66
|
+
|
|
67
|
+
export { SallaMultipleBundleProduct as salla_multiple_bundle_product };
|