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