@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,760 @@
|
|
|
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 anime } from './anime.es-CgtvEd63.js';
|
|
6
|
+
import { S as ShoppingBag } from './shopping-bag-DiKTtDW5.js';
|
|
7
|
+
import { H as Helper } from './Helper-B5RLi6Xo.js';
|
|
8
|
+
|
|
9
|
+
const sallaProductsListCss = "";
|
|
10
|
+
|
|
11
|
+
const SallaProductsList = class {
|
|
12
|
+
constructor(hostRef) {
|
|
13
|
+
registerInstance(this, hostRef);
|
|
14
|
+
this.productsFetched = createEvent(this, "productsFetched");
|
|
15
|
+
/**
|
|
16
|
+
* Autoload next page when scroll
|
|
17
|
+
*/
|
|
18
|
+
this.autoload = false;
|
|
19
|
+
/**
|
|
20
|
+
* Custom Card Component for the Salla Products List.
|
|
21
|
+
*
|
|
22
|
+
* This component allows you to customize the appearance of individual product cards within a Salla Products List.
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* <salla-products-list product-card-component="my-custom-card-style1" ...
|
|
26
|
+
* <salla-products-list product-card-component="my-custom-card-style2" ...
|
|
27
|
+
*/
|
|
28
|
+
this.productCardComponent = 'custom-salla-product-card';
|
|
29
|
+
// State
|
|
30
|
+
this.page = 1;
|
|
31
|
+
this.placeholderText = salla.lang.get('pages.categories.no_products');
|
|
32
|
+
this.endOfText = salla.lang.get('common.elements.end_of_content');
|
|
33
|
+
this.failedLoadMore = salla.lang.get('common.elements.failed_to_load_more');
|
|
34
|
+
this.currentPage = salla.config.get('page');
|
|
35
|
+
this.filtersSnapshot = [];
|
|
36
|
+
this.lastViewedProductKey = "lastViewedProductId";
|
|
37
|
+
this.filtersKey = "filters";
|
|
38
|
+
this.infiniteScrollStateKey = "infiniteScrollState";
|
|
39
|
+
this.prevCategoryIdKey = "prevCategoryId";
|
|
40
|
+
this.isProcessing = false; // Tracks if we are processing data
|
|
41
|
+
this.scrollTimeout = null;
|
|
42
|
+
this.boundScrollToLastViewedProduct = () => this.scrollToLastViewedProduct();
|
|
43
|
+
this.boundHandleScroll = () => this.handleScroll();
|
|
44
|
+
this.specialPagesWithoutIds = {
|
|
45
|
+
'product.index.latest': 'latest',
|
|
46
|
+
'product.index.offers': 'offers',
|
|
47
|
+
'product.index.search': 'search',
|
|
48
|
+
'product.index.sales': 'sales'
|
|
49
|
+
};
|
|
50
|
+
//TODO:: check why `this.includes` not working!!
|
|
51
|
+
this.includes = Helper.parseJson(this.includes || this.host.getAttribute('includes'));
|
|
52
|
+
if (!Array.isArray(this.includes)) {
|
|
53
|
+
this.includes = null;
|
|
54
|
+
}
|
|
55
|
+
Helper.setIncludes(this.includes);
|
|
56
|
+
salla.lang.onLoaded(() => {
|
|
57
|
+
this.placeholderText = salla.lang.get('pages.categories.no_products');
|
|
58
|
+
this.endOfText = salla.lang.get('common.elements.end_of_content');
|
|
59
|
+
this.failedLoadMore = salla.lang.get('common.elements.failed_to_load_more');
|
|
60
|
+
this.currentPage = salla.config.get('page');
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
connectedCallback() {
|
|
64
|
+
//Override browser scroll restoration default behaviour
|
|
65
|
+
if ("scrollRestoration" in history)
|
|
66
|
+
history.scrollRestoration = "manual";
|
|
67
|
+
// required for scroll restoration case when the component loads before DOM content is completed (slow internet bandwidth /low device specs)
|
|
68
|
+
window.addEventListener('DOMContentLoaded', this.boundScrollToLastViewedProduct);
|
|
69
|
+
salla.event.on('salla-filters::changed', filters => this.setFilters(filters));
|
|
70
|
+
}
|
|
71
|
+
disconnectedCallback() {
|
|
72
|
+
window.removeEventListener('DOMContentLoaded', this.boundScrollToLastViewedProduct);
|
|
73
|
+
window.removeEventListener('scroll', this.boundHandleScroll);
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Set parsed filters data from URI
|
|
77
|
+
* @param filters
|
|
78
|
+
*/
|
|
79
|
+
async setFilters(filters) {
|
|
80
|
+
if (!filters || JSON.stringify(filters) === JSON.stringify(this.parsedFilters)) {
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
window.scrollTo({ top: 0, behavior: 'smooth' });
|
|
84
|
+
// Create a deep copy of the filters object to avoid mutating the original object
|
|
85
|
+
this.parsedFilters = JSON.parse(JSON.stringify(filters));
|
|
86
|
+
this.filtersSnapshot = this.parsedFilters;
|
|
87
|
+
if (this.currentPage?.slug == "product.index" && this.parsedFilters && this.parsedFilters.category_id) {
|
|
88
|
+
this.currentCategoryIdFilter = [this.parsedFilters.category_id];
|
|
89
|
+
}
|
|
90
|
+
return this.reload();
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Reload the list of products (entire content of the component).
|
|
94
|
+
*/
|
|
95
|
+
async reload() {
|
|
96
|
+
!this.autoload && this.loadMoreWrapper && (this.loadMoreWrapper.style.display = 'none');
|
|
97
|
+
this.hasInfiniteScroll && salla.infiniteScroll.destroy(this.infiniteScroll);
|
|
98
|
+
this.buildNextPageUrl();
|
|
99
|
+
// TODO: this is problematic in testing, for the time being it's been resolved like this
|
|
100
|
+
this.wrapper.innerHTML = '';
|
|
101
|
+
if (this.hasInfiniteScroll) {
|
|
102
|
+
this.init();
|
|
103
|
+
}
|
|
104
|
+
else {
|
|
105
|
+
this.getInitialData();
|
|
106
|
+
}
|
|
107
|
+
// Special case for the placeholder loader
|
|
108
|
+
if (this.showPlaceholder) {
|
|
109
|
+
this.showPlaceholder = false;
|
|
110
|
+
this.placeholderLoader = document.createElement('div');
|
|
111
|
+
this.placeholderLoader.classList.add('s-products-list-loading-wrapper');
|
|
112
|
+
this.placeholderLoader.style.display = 'inherit';
|
|
113
|
+
this.placeholderLoader.innerHTML = `<span class="s-button-loader s-button-loader-center s-infinite-scroll-btn-loader"></span>`;
|
|
114
|
+
this.host.insertAdjacentElement('afterend', this.placeholderLoader);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
isFilterable() {
|
|
118
|
+
return salla.config.get('store.settings.product.filters') && this.filtersResults;
|
|
119
|
+
}
|
|
120
|
+
isSourceWithoutValue() {
|
|
121
|
+
return ['offers', 'latest', 'sales', 'wishlist', 'top-rated', 'reorder'].includes(this.getSource());
|
|
122
|
+
}
|
|
123
|
+
animateItems() {
|
|
124
|
+
anime({
|
|
125
|
+
targets: 'salla-products-list salla-product-card',
|
|
126
|
+
opacity: [0, 1],
|
|
127
|
+
duration: 1200,
|
|
128
|
+
translateY: [20, 0],
|
|
129
|
+
delay: function (_el, i) {
|
|
130
|
+
return i * 100;
|
|
131
|
+
},
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
initBaseNextPageUrl(source) {
|
|
135
|
+
this.nextPage = salla.url.api(`products?source=${source}`);
|
|
136
|
+
if (this.includes?.length) {
|
|
137
|
+
this.nextPage += `&includes[]=${this.includes.join('&includes[]=')}`;
|
|
138
|
+
}
|
|
139
|
+
if (this.limit) {
|
|
140
|
+
this.nextPage += `&per_page=${this.limit > 32 ? 32 : this.limit}`;
|
|
141
|
+
}
|
|
142
|
+
if (this.sortBy) {
|
|
143
|
+
this.nextPage += `&sort=${this.sortBy}`;
|
|
144
|
+
}
|
|
145
|
+
if (salla.config.get('theme.mode') === 'preview') {
|
|
146
|
+
this.nextPage += `&use_username_url=1`;
|
|
147
|
+
}
|
|
148
|
+
this.nextPage += '&filterable=1';
|
|
149
|
+
for (const [key, value] of Object.entries(this.parsedFilters || {})) {
|
|
150
|
+
if (["string", "number"].includes(typeof value)) {
|
|
151
|
+
// @ts-ignore
|
|
152
|
+
this.nextPage += `&filters[${encodeURIComponent(key)}]=${encodeURIComponent(value)}`;
|
|
153
|
+
}
|
|
154
|
+
else if (Array.isArray(value)) {
|
|
155
|
+
value.forEach(item => this.nextPage += `&filters[${encodeURIComponent(key)}][]=${encodeURIComponent(item)}`);
|
|
156
|
+
}
|
|
157
|
+
else if (typeof value === 'object') {
|
|
158
|
+
for (const [k, v] of Object.entries(value)) {
|
|
159
|
+
this.nextPage += `&filters[${encodeURIComponent(key)}][${encodeURIComponent(k)}]=${encodeURIComponent(v)}`;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
buildNextPageUrl() {
|
|
165
|
+
let source = this.getSource();
|
|
166
|
+
if (source === 'json') {
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
const snapshot = sessionStorage.getItem(this.infiniteScrollStateKey);
|
|
170
|
+
if (snapshot) {
|
|
171
|
+
const { nextPage } = JSON.parse(snapshot);
|
|
172
|
+
if (!nextPage) {
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
this.initBaseNextPageUrl(source);
|
|
177
|
+
if (this.isSourceWithoutValue()) {
|
|
178
|
+
return;
|
|
179
|
+
}
|
|
180
|
+
if (['search', 'related', 'landing-page'].includes(source)) {
|
|
181
|
+
this.nextPage += `&source_value=${this.getSourceValue()}`;
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
try {
|
|
185
|
+
this.nextPage += `&source_value[]=${this.getSourceValue().join('&source_value[]=')}`;
|
|
186
|
+
}
|
|
187
|
+
catch (e) {
|
|
188
|
+
salla.logger.warn(`source-value prop should be array of ids ex source-value="[1,2,3]" for the source [${source}]`);
|
|
189
|
+
this.sourceValueIsValid = false;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
loading(isLoading = true, isBtn = false) {
|
|
193
|
+
if (!isLoading) {
|
|
194
|
+
if (!this.autoload) {
|
|
195
|
+
this.btnLoader && (this.btnLoader.style.display = 'none');
|
|
196
|
+
}
|
|
197
|
+
this.loader && (this.loader.style.display = 'none');
|
|
198
|
+
}
|
|
199
|
+
else {
|
|
200
|
+
let currentLoader = isBtn && !this.autoload ? this.btnLoader : this.loader;
|
|
201
|
+
currentLoader && (currentLoader.style.display = 'inherit');
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
getItemHTML(product) {
|
|
205
|
+
//as a request they don't want to let the user to open the product details
|
|
206
|
+
//todo:: find a better way to handle this request
|
|
207
|
+
this.getSource() === 'landing-page' && (product.url = '');
|
|
208
|
+
const customComponentTag = this.hasCustomComponent ? this.productCardComponent : 'salla-product-card';
|
|
209
|
+
const productCard = document.createElement(customComponentTag);
|
|
210
|
+
productCard.product = product;
|
|
211
|
+
this.applyLandingPageStyles(productCard);
|
|
212
|
+
this.applyHorizontalCardStyles(productCard);
|
|
213
|
+
// Attach click event listener to save the current products snapshot
|
|
214
|
+
productCard.addEventListener('click', (event) => {
|
|
215
|
+
const target = event.target;
|
|
216
|
+
// Check if the clicked element is an anchor or inside an anchor
|
|
217
|
+
const anchor = target.closest('a');
|
|
218
|
+
if (anchor) {
|
|
219
|
+
Helper.saveProductSource(this.getSource());
|
|
220
|
+
if (this.hasInfiniteScroll) {
|
|
221
|
+
this.takeStateSnapshot();
|
|
222
|
+
sessionStorage.setItem(this.lastViewedProductKey, product.id);
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
});
|
|
226
|
+
return productCard;
|
|
227
|
+
}
|
|
228
|
+
applyLandingPageStyles(productCard) {
|
|
229
|
+
if (this.getSource() === 'landing-page' && !this.hasCustomComponent) {
|
|
230
|
+
productCard.toggleAttribute('hide-add-btn', true);
|
|
231
|
+
productCard.classList.add('s-product-card-fit-height');
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
applyHorizontalCardStyles(productCard) {
|
|
235
|
+
if (!this.horizontalCards) {
|
|
236
|
+
return;
|
|
237
|
+
}
|
|
238
|
+
productCard.setAttribute('horizontal', true);
|
|
239
|
+
if (!this.hasCustomComponent) {
|
|
240
|
+
productCard.setAttribute('shadow-on-hover', true);
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
waitForResizing(element) {
|
|
244
|
+
let timeout = null;
|
|
245
|
+
return new Promise((resolve) => {
|
|
246
|
+
const resizeObserver = new ResizeObserver(() => {
|
|
247
|
+
clearTimeout(timeout);
|
|
248
|
+
timeout = setTimeout(() => {
|
|
249
|
+
resizeObserver.disconnect();
|
|
250
|
+
resolve(null);
|
|
251
|
+
}, 160); // Adjust delay as needed for your layout
|
|
252
|
+
});
|
|
253
|
+
resizeObserver.observe(element); // Watch the body or a specific container
|
|
254
|
+
});
|
|
255
|
+
}
|
|
256
|
+
waitForLayoutStable(element) {
|
|
257
|
+
let timeout = null;
|
|
258
|
+
return new Promise((resolve) => {
|
|
259
|
+
const observer = new MutationObserver(() => {
|
|
260
|
+
clearTimeout(timeout);
|
|
261
|
+
timeout = setTimeout(() => {
|
|
262
|
+
observer.disconnect();
|
|
263
|
+
resolve(null);
|
|
264
|
+
}, 160); // Adjust delay as needed for your layout
|
|
265
|
+
});
|
|
266
|
+
// Observe changes to the entire body, including child nodes and attributes.
|
|
267
|
+
observer.observe(element, {
|
|
268
|
+
childList: true,
|
|
269
|
+
subtree: true,
|
|
270
|
+
attributes: true,
|
|
271
|
+
});
|
|
272
|
+
});
|
|
273
|
+
}
|
|
274
|
+
async waitForStableLayout(element) {
|
|
275
|
+
// Wait for DOM mutations and layout shifts to stabilize
|
|
276
|
+
return await Promise.allSettled([
|
|
277
|
+
this.waitForResizing(element),
|
|
278
|
+
this.waitForLayoutStable(element)
|
|
279
|
+
]);
|
|
280
|
+
}
|
|
281
|
+
scrollToLastViewedProduct() {
|
|
282
|
+
const lastViewedProductId = sessionStorage.getItem(this.lastViewedProductKey);
|
|
283
|
+
if (!lastViewedProductId || salla.url.is_page('product.single'))
|
|
284
|
+
return;
|
|
285
|
+
this.isElementLoaded(`[id*="${lastViewedProductId}"]`)
|
|
286
|
+
.then(() => {
|
|
287
|
+
const productCard = this.wrapper?.querySelector(`[id*="${lastViewedProductId}"]`);
|
|
288
|
+
if (!productCard)
|
|
289
|
+
return;
|
|
290
|
+
const scrollToPosition = () => {
|
|
291
|
+
const scrollToProductCard = () => {
|
|
292
|
+
// calculations is located here for last second changes in the ui (ie. sticky header height)
|
|
293
|
+
productCard.scrollIntoView({ block: 'start', behavior: 'instant' });
|
|
294
|
+
const headerSelector = matchMedia('(max-width: 1024px)').matches ? "header .inner" : "ul.main-menu";
|
|
295
|
+
const headerHeight = window?.header_is_sticky ? (document.querySelector(headerSelector)?.getBoundingClientRect()?.height ?? 56) : 0;
|
|
296
|
+
const cardsListRowGap = parseInt(getComputedStyle(this.wrapper).rowGap) ?? 16;
|
|
297
|
+
const productCardOffset = headerHeight + cardsListRowGap;
|
|
298
|
+
scrollBy({ top: productCardOffset * -1, behavior: 'instant' });
|
|
299
|
+
};
|
|
300
|
+
//start scrolling to the product card position
|
|
301
|
+
requestAnimationFrame(scrollToProductCard);
|
|
302
|
+
const productImages = productCard.querySelectorAll('img.lazy');
|
|
303
|
+
productImages.forEach((image) => {
|
|
304
|
+
const productImage = image;
|
|
305
|
+
const handleImageEvent = () => {
|
|
306
|
+
requestAnimationFrame(scrollToProductCard);
|
|
307
|
+
productImage.onload = productImage.onerror = null;
|
|
308
|
+
};
|
|
309
|
+
productImage.onload = handleImageEvent;
|
|
310
|
+
productImage.onerror = handleImageEvent;
|
|
311
|
+
});
|
|
312
|
+
// remove snapshot of product cards items in session storage after scroll restoration completiion
|
|
313
|
+
this.removeScrollRestorationSession();
|
|
314
|
+
return void 0;
|
|
315
|
+
};
|
|
316
|
+
this.waitForStableLayout(this.host).then(() => requestAnimationFrame(scrollToPosition));
|
|
317
|
+
});
|
|
318
|
+
}
|
|
319
|
+
isElementLoaded(selector) {
|
|
320
|
+
return new Promise((resolve => {
|
|
321
|
+
const interval = setInterval(() => {
|
|
322
|
+
if (document.querySelector(selector)) {
|
|
323
|
+
clearInterval(interval);
|
|
324
|
+
return resolve(document.querySelector(selector));
|
|
325
|
+
}
|
|
326
|
+
}, 50);
|
|
327
|
+
}));
|
|
328
|
+
}
|
|
329
|
+
;
|
|
330
|
+
takeStateSnapshot() {
|
|
331
|
+
const currentPageData = [];
|
|
332
|
+
// Classic for-loop for performance
|
|
333
|
+
for (let i = 0; i < this.wrapper.children.length; i++) {
|
|
334
|
+
const child = this.wrapper.children?.[i];
|
|
335
|
+
currentPageData.push(child.product);
|
|
336
|
+
}
|
|
337
|
+
const scrollState = {
|
|
338
|
+
pageIndex: Math.max((this.infiniteScroll?.pageIndex ?? 1) - 1, 1),
|
|
339
|
+
nextPage: this.nextPage,
|
|
340
|
+
currentPageData
|
|
341
|
+
};
|
|
342
|
+
if (this.isFilterable()) {
|
|
343
|
+
const existingFilters = sessionStorage.getItem(this.filtersKey);
|
|
344
|
+
sessionStorage.setItem(this.filtersKey, existingFilters || JSON.stringify(this.filtersSnapshot));
|
|
345
|
+
}
|
|
346
|
+
sessionStorage.setItem(this.infiniteScrollStateKey, JSON.stringify(scrollState));
|
|
347
|
+
// Determine and store the correct prevCategoryId
|
|
348
|
+
let prevCategoryId = salla.config.get('page.id'); // Number or null
|
|
349
|
+
const currentPage = Object.keys(this.specialPagesWithoutIds).find(page => salla.url.is_page(page));
|
|
350
|
+
if (currentPage) {
|
|
351
|
+
prevCategoryId = this.specialPagesWithoutIds[currentPage];
|
|
352
|
+
}
|
|
353
|
+
else if (prevCategoryId !== null) {
|
|
354
|
+
prevCategoryId = String(prevCategoryId); // Ensure it's stored as a string
|
|
355
|
+
}
|
|
356
|
+
sessionStorage.setItem(this.prevCategoryIdKey, prevCategoryId);
|
|
357
|
+
}
|
|
358
|
+
removeScrollRestorationSession() {
|
|
359
|
+
if (!this.isFilterable()) {
|
|
360
|
+
sessionStorage.removeItem(this.filtersKey);
|
|
361
|
+
}
|
|
362
|
+
sessionStorage.removeItem(this.infiniteScrollStateKey);
|
|
363
|
+
sessionStorage.removeItem(this.lastViewedProductKey);
|
|
364
|
+
sessionStorage.removeItem(this.prevCategoryIdKey);
|
|
365
|
+
}
|
|
366
|
+
loadStoredScrollState() {
|
|
367
|
+
const storedState = sessionStorage.getItem(this.infiniteScrollStateKey);
|
|
368
|
+
const filetrsState = sessionStorage.getItem(this.filtersKey);
|
|
369
|
+
/*
|
|
370
|
+
* Remove the scroll restoration session under the following conditions:
|
|
371
|
+
* 1. The user has navigated to a different category page:
|
|
372
|
+
* - If the previously stored category ID is different from the current one.
|
|
373
|
+
* - This includes "latest", "offers", "sales" and "search" pages.
|
|
374
|
+
*
|
|
375
|
+
* 2. The user is on the homepage, but infinite scroll is disabled.
|
|
376
|
+
*
|
|
377
|
+
* 3. The user is on a product page.
|
|
378
|
+
*/
|
|
379
|
+
const prevCategory = sessionStorage.getItem(this.prevCategoryIdKey); // Get previously stored category
|
|
380
|
+
const currentPageSlug = this.specialPagesWithoutIds[salla.config.get('page.slug')] || null;
|
|
381
|
+
const currentPageId = salla.config.get('page.id'); // Number or null
|
|
382
|
+
const isHomepage = salla.url.is_page('index');
|
|
383
|
+
const isProductPage = salla.url.is_page('product.single');
|
|
384
|
+
const isDifferentCategory = currentPageSlug
|
|
385
|
+
? prevCategory !== currentPageSlug // Compare slugs for special pages
|
|
386
|
+
: prevCategory !== String(currentPageId); // Compare IDs otherwise
|
|
387
|
+
if ((prevCategory && isDifferentCategory && !isHomepage && !isProductPage)
|
|
388
|
+
||
|
|
389
|
+
(isHomepage && !this.hasInfiniteScroll)) {
|
|
390
|
+
this.removeScrollRestorationSession();
|
|
391
|
+
this.switchToNormalBehavior = true;
|
|
392
|
+
return false;
|
|
393
|
+
}
|
|
394
|
+
// Keep the snapshot in product page that contains salla-products-list but without scroll restoration
|
|
395
|
+
if (isProductPage) {
|
|
396
|
+
this.switchToNormalBehavior = true;
|
|
397
|
+
return false;
|
|
398
|
+
}
|
|
399
|
+
if (storedState) {
|
|
400
|
+
try {
|
|
401
|
+
const { pageIndex, nextPage, currentPageData } = JSON.parse(storedState);
|
|
402
|
+
if (filetrsState !== 'undefined') {
|
|
403
|
+
const filters = JSON.parse(filetrsState);
|
|
404
|
+
salla.event.emit('filters::fetched', { filters });
|
|
405
|
+
}
|
|
406
|
+
this.page = pageIndex;
|
|
407
|
+
this.nextPage = nextPage;
|
|
408
|
+
// more performant on larger set of data
|
|
409
|
+
for (let i = 0; i < currentPageData.length; i++) {
|
|
410
|
+
this.wrapper.append(this.getItemHTML(currentPageData?.[i]));
|
|
411
|
+
}
|
|
412
|
+
return true;
|
|
413
|
+
}
|
|
414
|
+
catch (error) {
|
|
415
|
+
console.error('Failed to load stored scroll state:', error);
|
|
416
|
+
this.removeScrollRestorationSession();
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
return false;
|
|
420
|
+
}
|
|
421
|
+
getSource() {
|
|
422
|
+
return Helper.getProductsSource(this.source);
|
|
423
|
+
}
|
|
424
|
+
getSourceValue() {
|
|
425
|
+
return this.currentCategoryIdFilter ? this.currentCategoryIdFilter : Helper.getProductsSourceValue(this.source, this.sourceValue);
|
|
426
|
+
}
|
|
427
|
+
appendDataLayer(data) {
|
|
428
|
+
if (typeof dataLayer !== 'object' || !Array.isArray(dataLayer)) {
|
|
429
|
+
//todo:: check if we should define it here
|
|
430
|
+
return;
|
|
431
|
+
}
|
|
432
|
+
dataLayer.push({
|
|
433
|
+
"event": "impressions",
|
|
434
|
+
"ecommerce": {
|
|
435
|
+
"currencyCode": salla.config.currency().code,
|
|
436
|
+
// "event_id":"", // todo
|
|
437
|
+
"impressions": data.map((product, index) => {
|
|
438
|
+
return {
|
|
439
|
+
"id": product.id,
|
|
440
|
+
"name": product.name,
|
|
441
|
+
"price": product.price,
|
|
442
|
+
"brand": product.brand?.name || '',
|
|
443
|
+
"quantity": product.quantity,
|
|
444
|
+
// "variant": "",
|
|
445
|
+
"categories": [
|
|
446
|
+
{
|
|
447
|
+
"name": product.category?.name || salla.config.get('page.title'),
|
|
448
|
+
"id": salla.config.get('page.id')
|
|
449
|
+
}
|
|
450
|
+
],
|
|
451
|
+
"category": product.category?.name || salla.config.get('page.title'),
|
|
452
|
+
'position': index + 1
|
|
453
|
+
};
|
|
454
|
+
})
|
|
455
|
+
}
|
|
456
|
+
});
|
|
457
|
+
}
|
|
458
|
+
initiateInfiniteScroll() {
|
|
459
|
+
if (!this.hasInfiniteScroll) {
|
|
460
|
+
return;
|
|
461
|
+
}
|
|
462
|
+
const shouldApplyManualLoad = this.autoload && this.includes && this.includes.length > 0;
|
|
463
|
+
this.infiniteScroll = salla.infiniteScroll.initiate(this.wrapper, this.wrapper, {
|
|
464
|
+
path: () => this.nextPage,
|
|
465
|
+
history: false,
|
|
466
|
+
nextPage: this.nextPage,
|
|
467
|
+
scrollThreshold: shouldApplyManualLoad ? false : this.autoload ? 100 : false,
|
|
468
|
+
loadOnScroll: shouldApplyManualLoad ? false : this.autoload
|
|
469
|
+
}, true);
|
|
470
|
+
this.infiniteScroll.pageIndex = this.page;
|
|
471
|
+
this.infiniteScroll?.on('request', () => {
|
|
472
|
+
this.loading(true, this.autoload ? false : true);
|
|
473
|
+
});
|
|
474
|
+
// Manual scroll listener
|
|
475
|
+
shouldApplyManualLoad && window.addEventListener('scroll', this.boundHandleScroll);
|
|
476
|
+
this.infiniteScroll?.on('load', async (response) => {
|
|
477
|
+
if (this.isProcessing)
|
|
478
|
+
return;
|
|
479
|
+
this.isProcessing = true;
|
|
480
|
+
try {
|
|
481
|
+
if (!response.data?.length && this.infiniteScroll.pageIndex === 2) {
|
|
482
|
+
this.showPlaceholder = true;
|
|
483
|
+
salla.infiniteScroll.destroy(this.infiniteScroll);
|
|
484
|
+
this.loading(false);
|
|
485
|
+
this.placeholderLoader && this.placeholderLoader.remove();
|
|
486
|
+
return;
|
|
487
|
+
}
|
|
488
|
+
if (this.includes) {
|
|
489
|
+
await this.injectAndProcessData(response);
|
|
490
|
+
}
|
|
491
|
+
const items = this.handleResponse(response);
|
|
492
|
+
this.infiniteScroll.appendItems(items);
|
|
493
|
+
if (this.infiniteScroll.pageIndex === 2) {
|
|
494
|
+
if (!this.autoload && this.nextPage) {
|
|
495
|
+
this.loadMoreWrapper.style.display = 'block';
|
|
496
|
+
}
|
|
497
|
+
this.animateItems();
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
catch (error) {
|
|
501
|
+
console.error('Error during load:', error);
|
|
502
|
+
}
|
|
503
|
+
finally {
|
|
504
|
+
this.isProcessing = false;
|
|
505
|
+
}
|
|
506
|
+
});
|
|
507
|
+
this.infiniteScroll?.on('error', () => {
|
|
508
|
+
console.log('Error occurred during request');
|
|
509
|
+
this.status.querySelector('.s-infinite-scroll-error').classList.remove('s-hidden');
|
|
510
|
+
this.placeholderLoader && this.placeholderLoader.remove();
|
|
511
|
+
this.loading(false);
|
|
512
|
+
this.isProcessing = false;
|
|
513
|
+
});
|
|
514
|
+
salla.onReady(() => {
|
|
515
|
+
const snapshot = sessionStorage.getItem(this.infiniteScrollStateKey);
|
|
516
|
+
if (!snapshot) {
|
|
517
|
+
this.manualLoadNextPage();
|
|
518
|
+
}
|
|
519
|
+
});
|
|
520
|
+
}
|
|
521
|
+
handleScroll() {
|
|
522
|
+
if (this.isProcessing)
|
|
523
|
+
return;
|
|
524
|
+
if (this.scrollTimeout)
|
|
525
|
+
return;
|
|
526
|
+
this.scrollTimeout = setTimeout(() => {
|
|
527
|
+
this.scrollTimeout = null;
|
|
528
|
+
// Defer layout reads to next frame to avoid forced reflow (Lighthouse/PageSpeed)
|
|
529
|
+
requestAnimationFrame(() => {
|
|
530
|
+
const wrapperRect = this.wrapper.getBoundingClientRect();
|
|
531
|
+
const windowHeight = window.innerHeight;
|
|
532
|
+
const distanceToBottom = wrapperRect.bottom - windowHeight;
|
|
533
|
+
// Trigger only when the wrapper bottom is within 200px of the viewport bottom
|
|
534
|
+
if (distanceToBottom <= 200 && !this.isProcessing && this.nextPage) {
|
|
535
|
+
// Reached near the bottom of the wrapper, loading next page...
|
|
536
|
+
this.manualLoadNextPage();
|
|
537
|
+
}
|
|
538
|
+
});
|
|
539
|
+
}, 200);
|
|
540
|
+
}
|
|
541
|
+
manualLoadNextPage() {
|
|
542
|
+
if (this.nextPage) {
|
|
543
|
+
this.infiniteScroll.loadNextPage();
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
async injectAndProcessData(response) {
|
|
547
|
+
try {
|
|
548
|
+
await Helper.injectExtraFieldsToResponse(response);
|
|
549
|
+
}
|
|
550
|
+
catch (error) {
|
|
551
|
+
console.error('Error injecting data:', error);
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
getInitialData() {
|
|
555
|
+
this.loading();
|
|
556
|
+
return salla.product.api.fetch({ source: Helper.getApiSource(this.getSource()), source_value: this.getSourceValue(), limit: this.limit }).then(async (response) => {
|
|
557
|
+
if (!response.data.length) {
|
|
558
|
+
this.showPlaceholder = true;
|
|
559
|
+
this.placeholderLoader && this.placeholderLoader.remove();
|
|
560
|
+
this.loading(false);
|
|
561
|
+
return;
|
|
562
|
+
}
|
|
563
|
+
await Helper.injectExtraFieldsToResponse(response);
|
|
564
|
+
//this.firstPageResponse will be null only in the first page, after that it will be assinged,
|
|
565
|
+
//for the first page we need to inject the dom after the load, see @method componentDidLoad
|
|
566
|
+
if (!this.firstPageResponse) {
|
|
567
|
+
this.firstPageResponse = response;
|
|
568
|
+
this.nextPage = response.cursor ? response.cursor.next : this.nextPage;
|
|
569
|
+
return;
|
|
570
|
+
}
|
|
571
|
+
this.handleResponse(response).forEach(card => this.wrapper.append(card));
|
|
572
|
+
});
|
|
573
|
+
}
|
|
574
|
+
async loadMore() {
|
|
575
|
+
this.infiniteScroll?.loadNextPage();
|
|
576
|
+
}
|
|
577
|
+
componentWillLoad() {
|
|
578
|
+
return salla.onReady()
|
|
579
|
+
.then(() => {
|
|
580
|
+
this.hasCustomComponent = !!customElements.get(this.productCardComponent);
|
|
581
|
+
this.sourceValueIsValid = !!(this.getSourceValue() || this.isSourceWithoutValue());
|
|
582
|
+
this.hasInfiniteScroll = !['json', 'selected', 'related', 'landing-page', 'recently'].includes(this.getSource()) && !this.limit;
|
|
583
|
+
let searchParams = new URLSearchParams(window.location.search);
|
|
584
|
+
try {
|
|
585
|
+
this.sortBy = this.sortBy || searchParams.get('sort') || searchParams.get('by');
|
|
586
|
+
this.parsedFilters = Helper.extractFiltersFromUrl(searchParams);
|
|
587
|
+
if (this.parsedFilters && this.parsedFilters.category_id) {
|
|
588
|
+
this.currentCategoryIdFilter = [this.parsedFilters.category_id];
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
catch (e) {
|
|
592
|
+
salla.logger.warn('failed to get filters from url', e.message);
|
|
593
|
+
}
|
|
594
|
+
this.buildNextPageUrl();
|
|
595
|
+
this.isReady = true;
|
|
596
|
+
const snapshot = sessionStorage.getItem(this.infiniteScrollStateKey);
|
|
597
|
+
if (!!snapshot) {
|
|
598
|
+
return;
|
|
599
|
+
}
|
|
600
|
+
if (!this.sourceValueIsValid) {
|
|
601
|
+
salla.logger.warn(`source-value prop is required for source [${this.getSource()}]`);
|
|
602
|
+
return;
|
|
603
|
+
}
|
|
604
|
+
if (this.hasInfiniteScroll) {
|
|
605
|
+
return;
|
|
606
|
+
}
|
|
607
|
+
// Handle json source
|
|
608
|
+
if (this.getSource() === 'json') {
|
|
609
|
+
if (!this.getSourceValue().length) {
|
|
610
|
+
this.showPlaceholder = true;
|
|
611
|
+
return;
|
|
612
|
+
}
|
|
613
|
+
//todo:: avoid using timeout, just assigne the data to the this.firstPageResponse and it should work fine, because it will be rendered in componentDidLoad
|
|
614
|
+
setTimeout(() => {
|
|
615
|
+
let productsList = this.getSourceValue();
|
|
616
|
+
productsList.map(product => this.wrapper.append(this.getItemHTML(product)));
|
|
617
|
+
});
|
|
618
|
+
return;
|
|
619
|
+
}
|
|
620
|
+
// Handle selected source
|
|
621
|
+
if (this.getSource() === 'selected' && !this.getSourceValue().length) {
|
|
622
|
+
this.showPlaceholder = true;
|
|
623
|
+
return;
|
|
624
|
+
}
|
|
625
|
+
return this.getInitialData();
|
|
626
|
+
});
|
|
627
|
+
}
|
|
628
|
+
async componentDidLoad() {
|
|
629
|
+
this.hasInfiniteScroll && this.init();
|
|
630
|
+
await Salla.hooks.registerComponent('salla-products-list', this);
|
|
631
|
+
if (this.loadStoredScrollState()) {
|
|
632
|
+
if (this.autoload) {
|
|
633
|
+
!this.nextPage && this.loading(false);
|
|
634
|
+
}
|
|
635
|
+
else if (!this.nextPage) {
|
|
636
|
+
this.loadMoreWrapper && (this.loadMoreWrapper.style.display = 'none');
|
|
637
|
+
this.status.querySelector('.s-infinite-scroll-last').classList.remove('s-hidden');
|
|
638
|
+
}
|
|
639
|
+
else {
|
|
640
|
+
this.loadMoreWrapper && (this.loadMoreWrapper.style.display = 'block');
|
|
641
|
+
}
|
|
642
|
+
this.scrollToLastViewedProduct();
|
|
643
|
+
}
|
|
644
|
+
else if (!this.firstPageResponse && this.switchToNormalBehavior) {
|
|
645
|
+
this.getInitialData()
|
|
646
|
+
.then(() => {
|
|
647
|
+
if (this.firstPageResponse) {
|
|
648
|
+
this.handleResponse(this.firstPageResponse, false).forEach(card => {
|
|
649
|
+
this.wrapper.append(card);
|
|
650
|
+
});
|
|
651
|
+
setTimeout(() => {
|
|
652
|
+
if (!this.autoload && this.nextPage && this.infiniteScroll.pageIndex == 1) {
|
|
653
|
+
const loadMoreWrapper = this.host.querySelector('.s-infinite-scroll-wrapper');
|
|
654
|
+
loadMoreWrapper && (loadMoreWrapper.style.display = 'block');
|
|
655
|
+
}
|
|
656
|
+
});
|
|
657
|
+
}
|
|
658
|
+
else {
|
|
659
|
+
console.error("No response received after getInitialData.");
|
|
660
|
+
}
|
|
661
|
+
})
|
|
662
|
+
.catch(error => {
|
|
663
|
+
console.error("Error during initial data fetch:", error);
|
|
664
|
+
});
|
|
665
|
+
}
|
|
666
|
+
else {
|
|
667
|
+
this.firstPageResponse && this.handleResponse(this.firstPageResponse, false).forEach(card => this.wrapper.append(card));
|
|
668
|
+
}
|
|
669
|
+
}
|
|
670
|
+
canRender() {
|
|
671
|
+
return this.sourceValueIsValid && this.isReady;
|
|
672
|
+
}
|
|
673
|
+
render() {
|
|
674
|
+
if (!this.canRender()) {
|
|
675
|
+
return '';
|
|
676
|
+
}
|
|
677
|
+
if (this.showPlaceholder) {
|
|
678
|
+
return h("div", { class: "s-products-list-placeholder" }, h("span", { innerHTML: ShoppingBag }), h("p", null, this.placeholderText));
|
|
679
|
+
}
|
|
680
|
+
return (h(Host, { class: "s-products-list" }, h("div", { class: {
|
|
681
|
+
"s-products-list-wrapper": true,
|
|
682
|
+
's-products-list-horizontal-cards': this.horizontalCards && !this.filtersResults,
|
|
683
|
+
's-products-list-vertical-cards': !this.horizontalCards && !this.rowCards && !this.filtersResults,
|
|
684
|
+
's-products-list-row-cards': this.rowCards,
|
|
685
|
+
's-products-list-filters-results': this.filtersResults,
|
|
686
|
+
}, ref: wrapper => this.wrapper = wrapper }), h("div", { class: "s-infinite-scroll-status", ref: status => this.status = status }, h("p", { class: "s-infinite-scroll-last infinite-scroll-last s-hidden" }, this.endOfText), h("p", { class: "s-infinite-scroll-error infinite-scroll-error s-hidden" }, this.failedLoadMore)), this.autoload && h("div", { class: "s-products-list-loading-wrapper", style: { "display": "none" }, ref: loader => this.loader = loader }, h("span", { class: "s-button-loader s-button-loader-center s-infinite-scroll-btn-loader" })), this.hasInfiniteScroll && this.nextPage && !this.autoload ? (h("div", { class: "s-infinite-scroll-wrapper", style: { "display": "none" }, ref: loadMoreWrapper => this.loadMoreWrapper = loadMoreWrapper }, h("button", { onClick: () => this.loadMore(), class: "s-infinite-scroll-btn s-button-btn s-button-primary" }, h("span", { class: "s-button-text s-infinite-scroll-btn-text" }, this.loadMoreText ? this.loadMoreText : salla.lang.get('common.elements.load_more')), h("span", { class: "s-button-loader s-button-loader-center s-infinite-scroll-btn-loader", ref: btnLoader => this.btnLoader = btnLoader, style: { "display": "none" } })))) : ""));
|
|
687
|
+
}
|
|
688
|
+
init() {
|
|
689
|
+
this.initiateInfiniteScroll();
|
|
690
|
+
this.loading();
|
|
691
|
+
}
|
|
692
|
+
handleResponse(response, shouldBuildNextPage = true) {
|
|
693
|
+
//todo:: check why it reach here undfined one time🤔
|
|
694
|
+
if (!response) {
|
|
695
|
+
return [];
|
|
696
|
+
}
|
|
697
|
+
let source = this.getSource();
|
|
698
|
+
let title = '';
|
|
699
|
+
//help the developer to know the current page title
|
|
700
|
+
if (response.cursor?.current === 1) {
|
|
701
|
+
title = Helper.getPageTitleForSource(source);
|
|
702
|
+
try {
|
|
703
|
+
if (this.getSource() === 'search') {
|
|
704
|
+
title = salla.lang.get('common.elements.search_about', { 'word': this.getSourceValue() });
|
|
705
|
+
}
|
|
706
|
+
else if (!title) {
|
|
707
|
+
let catId = this.parsedFilters.category_id || this.getSourceValue()[0];
|
|
708
|
+
// get the first filter that its key is category_id, then get the value when filter.value.*.key==catId
|
|
709
|
+
title = response.filters?.find(filter => filter.key === 'category_id')?.values?.find(cat => cat.key === catId)?.value ?? '';
|
|
710
|
+
this.filtersSnapshot = response.filters;
|
|
711
|
+
}
|
|
712
|
+
title += (title ? ' - ' : '') + salla.lang.choice('blocks.header.products_count', response.data?.length);
|
|
713
|
+
if (response.data.length === 15) {
|
|
714
|
+
title = title.replace(response.data.length, salla.lang.get('common.elements.more_than') + ' ' + response.data.length);
|
|
715
|
+
}
|
|
716
|
+
response.title = title;
|
|
717
|
+
}
|
|
718
|
+
catch (e) {
|
|
719
|
+
salla.logger.error('Error::falid to handle response', e);
|
|
720
|
+
}
|
|
721
|
+
//inject the SEO schema
|
|
722
|
+
//handleResponse works only on the infinite-scroll and infinite scroll works only on the categories pages and main latest-page ..etc, so no need to add condition
|
|
723
|
+
Helper.generateProductSchema(response.data);
|
|
724
|
+
}
|
|
725
|
+
this.appendDataLayer(response.data);
|
|
726
|
+
response.nextPage = this.nextPage;
|
|
727
|
+
response.source = this.getSource();
|
|
728
|
+
response.sourceValue = this.getSourceValue();
|
|
729
|
+
salla.event.emit('salla-products-list::products.fetched', response);
|
|
730
|
+
this.productsFetched.emit(response);
|
|
731
|
+
//💡 when source is related, cursor will not be existed
|
|
732
|
+
if (response.filters && this.isFilterable()) {
|
|
733
|
+
this.filtersResults = true;
|
|
734
|
+
this.filtersSnapshot = JSON.parse(JSON.stringify(response.filters));
|
|
735
|
+
salla.event.emit('filters::fetched', { filters: response.filters });
|
|
736
|
+
}
|
|
737
|
+
else if (this.isFilterable()) {
|
|
738
|
+
salla.event.emit('filters::hidden');
|
|
739
|
+
}
|
|
740
|
+
//because: this.nextPage is state we don't need to touch it after the build, to avoid the re-rendering
|
|
741
|
+
if (shouldBuildNextPage) {
|
|
742
|
+
this.nextPage = response.cursor ? response.cursor.next : this.nextPage;
|
|
743
|
+
}
|
|
744
|
+
this.loading(false);
|
|
745
|
+
this.placeholderLoader && this.placeholderLoader.remove();
|
|
746
|
+
if (this.hasInfiniteScroll && !this.nextPage) {
|
|
747
|
+
this.infiniteScroll.option({ scrollThreshold: false, loadOnScroll: false });
|
|
748
|
+
this.status.querySelector('.s-infinite-scroll-last').classList.remove('s-hidden');
|
|
749
|
+
}
|
|
750
|
+
const productCardsView = [];
|
|
751
|
+
for (let i = 0; i < response.data.length; i++) {
|
|
752
|
+
productCardsView.push(this.getItemHTML(response.data?.[i]));
|
|
753
|
+
}
|
|
754
|
+
return productCardsView;
|
|
755
|
+
}
|
|
756
|
+
get host() { return getElement(this); }
|
|
757
|
+
};
|
|
758
|
+
SallaProductsList.style = sallaProductsListCss;
|
|
759
|
+
|
|
760
|
+
export { SallaProductsList as salla_products_list };
|