@salla.sa/twilight-components 2.14.480 → 2.14.481
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{filepond-kIwfFiY4.js → filepond-BU-jXTBl.js} +1 -1
- package/dist/cjs/{filepond-plugin-file-poster-CbAmZLgn.js → filepond-plugin-file-poster-RwughT8q.js} +1 -1
- package/dist/cjs/{filepond-plugin-file-validate-size-iH_0ezqS.js → filepond-plugin-file-validate-size-0cnmN22U.js} +1 -1
- package/dist/cjs/{filepond-plugin-file-validate-type-B2YOvyGf.js → filepond-plugin-file-validate-type-CO8O6m_X.js} +1 -1
- package/dist/cjs/{filepond-plugin-image-edit-C5N-16uI.js → filepond-plugin-image-edit-D6jx4Pjj.js} +1 -1
- package/dist/cjs/{filepond-plugin-image-exif-orientation-aEzbNMDw.js → filepond-plugin-image-exif-orientation-axIyzrDe.js} +1 -1
- package/dist/cjs/{filepond-plugin-image-preview-RLbA7gqX.js → filepond-plugin-image-preview-BMgsi5If.js} +1 -1
- package/dist/cjs/{functions-BVKjPPbN.js → functions-Dtg2mNd5.js} +1 -1
- package/dist/cjs/{index-DjrWrGKt.js → index-BDebUujt.js} +1 -1
- package/dist/cjs/{index-RKu7wZSM.js → index-DUmFkKsZ.js} +2 -2
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/salla-accordion-body_2.cjs.entry.js +1 -1
- package/dist/cjs/salla-accordion_6.cjs.entry.js +1 -1
- package/dist/cjs/salla-add-product-button_5.cjs.entry.js +1 -1
- package/dist/cjs/salla-advertisement.cjs.entry.js +1 -1
- package/dist/cjs/salla-alert_2.cjs.entry.js +1 -1
- package/dist/cjs/salla-app-install-alert.cjs.entry.js +1 -1
- package/dist/cjs/salla-apps-icons.cjs.entry.js +1 -1
- package/dist/cjs/salla-badge.cjs.entry.js +1 -1
- package/dist/cjs/salla-booking-field_7.cjs.entry.js +10 -10
- package/dist/cjs/salla-bullet-delivery_2.cjs.entry.js +1 -1
- package/dist/cjs/salla-cart-coupons.cjs.entry.js +1 -1
- package/dist/cjs/salla-cart-item-offers_2.cjs.entry.js +1 -1
- package/dist/cjs/salla-cashback-banner.cjs.entry.js +1 -1
- package/dist/cjs/salla-comment-form_8.cjs.entry.js +1 -1
- package/dist/cjs/salla-conditional-offer.cjs.entry.js +1 -1
- package/dist/cjs/salla-contacts.cjs.entry.js +1 -1
- package/dist/cjs/salla-cookies-bar.cjs.entry.js +1 -1
- package/dist/cjs/salla-count-down.cjs.entry.js +1 -1
- package/dist/cjs/salla-custom-fields.cjs.entry.js +1 -1
- package/dist/cjs/salla-delivery-promise.cjs.entry.js +1 -1
- package/dist/cjs/salla-edit-order-button.cjs.entry.js +1 -1
- package/dist/cjs/salla-filters-widget.cjs.entry.js +1 -1
- package/dist/cjs/salla-filters.cjs.entry.js +1 -1
- package/dist/cjs/salla-fulfillment-methods.cjs.entry.js +1 -1
- package/dist/cjs/salla-gifting.cjs.entry.js +1 -1
- package/dist/cjs/salla-hook.cjs.entry.js +1 -1
- package/dist/cjs/salla-infinite-scroll.cjs.entry.js +1 -1
- package/dist/cjs/salla-installment.cjs.entry.js +1 -1
- package/dist/cjs/salla-list-tile.cjs.entry.js +1 -1
- package/dist/cjs/salla-localization-modal.cjs.entry.js +1 -1
- package/dist/cjs/salla-login-modal.cjs.entry.js +1 -1
- package/dist/cjs/salla-loyalty-banner.cjs.entry.js +2 -2
- package/dist/cjs/salla-loyalty-hero_2.cjs.entry.js +2 -2
- package/dist/cjs/salla-loyalty-panel.cjs.entry.js +3 -3
- package/dist/cjs/salla-loyalty-points-banner.cjs.entry.js +1 -1
- package/dist/cjs/salla-loyalty-points-history.cjs.entry.js +1 -1
- package/dist/cjs/salla-loyalty-prize-item.cjs.entry.js +1 -1
- package/dist/cjs/salla-loyalty-program.cjs.entry.js +3 -3
- package/dist/cjs/salla-loyalty-reward.cjs.entry.js +2 -2
- package/dist/cjs/salla-loyalty.cjs.entry.js +1 -1
- package/dist/cjs/salla-maintenance-alert.cjs.entry.js +1 -1
- package/dist/cjs/salla-map_2.cjs.entry.js +1 -1
- package/dist/cjs/salla-menu.cjs.entry.js +1 -1
- package/dist/cjs/salla-metadata.cjs.entry.js +1 -1
- package/dist/cjs/salla-multiple-bundle-product-cart_2.cjs.entry.js +1 -1
- package/dist/cjs/salla-multiple-bundle-product-options-modal_2.cjs.entry.js +1 -1
- package/dist/cjs/salla-multiple-bundle-product.cjs.entry.js +1 -1
- package/dist/cjs/salla-next-order-coupon.cjs.entry.js +1 -1
- package/dist/cjs/salla-notification-item.cjs.entry.js +1 -1
- package/dist/cjs/salla-notifications.cjs.entry.js +1 -1
- package/dist/cjs/salla-offer-modal.cjs.entry.js +1 -1
- package/dist/cjs/salla-offer.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-branch.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-edit-item.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-edit-product-card.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-edit.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-options-modal_3.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-summary.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-totals-card.cjs.entry.js +1 -1
- package/dist/cjs/salla-orders.cjs.entry.js +1 -1
- package/dist/cjs/salla-payments.cjs.entry.js +1 -1
- package/dist/cjs/salla-placeholder.cjs.entry.js +1 -1
- package/dist/cjs/salla-price-range.cjs.entry.js +1 -1
- package/dist/cjs/salla-product-card-embed.cjs.entry.js +1 -1
- package/dist/cjs/salla-product-size-guide.cjs.entry.js +1 -1
- package/dist/cjs/salla-products-list.cjs.entry.js +1 -1
- package/dist/cjs/salla-quick-order.cjs.entry.js +1 -1
- package/dist/cjs/salla-rating-modal.cjs.entry.js +1 -1
- package/dist/cjs/salla-reward-action_4.cjs.entry.js +3 -3
- package/dist/cjs/salla-scopes.cjs.entry.js +1 -1
- package/dist/cjs/salla-search.cjs.entry.js +1 -1
- package/dist/cjs/salla-skeleton.cjs.entry.js +1 -1
- package/dist/cjs/salla-slider.cjs.entry.js +1 -1
- package/dist/cjs/salla-social-share.cjs.entry.js +1 -1
- package/dist/cjs/salla-social.cjs.entry.js +1 -1
- package/dist/cjs/salla-tab-content_3.cjs.entry.js +1 -1
- package/dist/cjs/salla-tiered-offer.cjs.entry.js +1 -1
- package/dist/cjs/salla-tooltip.cjs.entry.js +1 -1
- package/dist/cjs/salla-trust-badges.cjs.entry.js +1 -1
- package/dist/cjs/salla-user-menu.cjs.entry.js +1 -1
- package/dist/cjs/salla-user-profile.cjs.entry.js +1 -1
- package/dist/cjs/salla-user-settings.cjs.entry.js +1 -1
- package/dist/cjs/salla-verify.cjs.entry.js +1 -1
- package/dist/cjs/salla-wallet.cjs.entry.js +1 -1
- package/dist/cjs/salla-wishlist-actions.cjs.entry.js +1 -1
- package/dist/cjs/{tracked-promise-B8pdpxb2.js → tracked-promise-DQbPZz8j.js} +1 -1
- package/dist/cjs/twilight.cjs.js +1 -1
- package/dist/cjs/{vanilla-picker-B6Vd66w8.js → vanilla-picker-Cf0IEAxU.js} +1 -1
- package/dist/components/index.js +2 -2
- package/dist/esm/{filepond-BUxO340w.js → filepond-DEIVYCk8.js} +1 -1
- package/dist/esm/{filepond-plugin-file-poster-DPDWNTQe.js → filepond-plugin-file-poster-DDPFacpf.js} +1 -1
- package/dist/esm/{filepond-plugin-file-validate-size-DrF6W6HS.js → filepond-plugin-file-validate-size-BK6TTAk0.js} +1 -1
- package/dist/esm/{filepond-plugin-file-validate-type-ByNgdCcv.js → filepond-plugin-file-validate-type-BeLdDHir.js} +1 -1
- package/dist/esm/{filepond-plugin-image-edit-D6lcie1e.js → filepond-plugin-image-edit-BdSsbhWf.js} +1 -1
- package/dist/esm/{filepond-plugin-image-exif-orientation-CEGVilMd.js → filepond-plugin-image-exif-orientation-CspYVPJR.js} +1 -1
- package/dist/esm/{filepond-plugin-image-preview-BInmqvtQ.js → filepond-plugin-image-preview-B1Rdh0IW.js} +1 -1
- package/dist/esm/{functions-CwbqVd0b.js → functions-C_5-G0lf.js} +1 -1
- package/dist/esm/{index-BqFb60iF.js → index-BFfD9GlY.js} +2 -2
- package/dist/esm/{index-BrHfsf3-.js → index-DLNCyofS.js} +1 -1
- package/dist/esm/loader.js +2 -2
- package/dist/esm/salla-accordion-body_2.entry.js +1 -1
- package/dist/esm/salla-accordion_6.entry.js +1 -1
- package/dist/esm/salla-add-product-button_5.entry.js +1 -1
- package/dist/esm/salla-advertisement.entry.js +1 -1
- package/dist/esm/salla-alert_2.entry.js +1 -1
- package/dist/esm/salla-app-install-alert.entry.js +1 -1
- package/dist/esm/salla-apps-icons.entry.js +1 -1
- package/dist/esm/salla-badge.entry.js +1 -1
- package/dist/esm/salla-booking-field_7.entry.js +10 -10
- package/dist/esm/salla-bullet-delivery_2.entry.js +1 -1
- package/dist/esm/salla-cart-coupons.entry.js +1 -1
- package/dist/esm/salla-cart-item-offers_2.entry.js +1 -1
- package/dist/esm/salla-cashback-banner.entry.js +1 -1
- package/dist/esm/salla-comment-form_8.entry.js +1 -1
- package/dist/esm/salla-conditional-offer.entry.js +1 -1
- package/dist/esm/salla-contacts.entry.js +1 -1
- package/dist/esm/salla-cookies-bar.entry.js +1 -1
- package/dist/esm/salla-count-down.entry.js +1 -1
- package/dist/esm/salla-custom-fields.entry.js +1 -1
- package/dist/esm/salla-delivery-promise.entry.js +1 -1
- package/dist/esm/salla-edit-order-button.entry.js +1 -1
- package/dist/esm/salla-filters-widget.entry.js +1 -1
- package/dist/esm/salla-filters.entry.js +1 -1
- package/dist/esm/salla-fulfillment-methods.entry.js +1 -1
- package/dist/esm/salla-gifting.entry.js +1 -1
- package/dist/esm/salla-hook.entry.js +1 -1
- package/dist/esm/salla-infinite-scroll.entry.js +1 -1
- package/dist/esm/salla-installment.entry.js +1 -1
- package/dist/esm/salla-list-tile.entry.js +1 -1
- package/dist/esm/salla-localization-modal.entry.js +1 -1
- package/dist/esm/salla-login-modal.entry.js +1 -1
- package/dist/esm/salla-loyalty-banner.entry.js +2 -2
- package/dist/esm/salla-loyalty-hero_2.entry.js +2 -2
- package/dist/esm/salla-loyalty-panel.entry.js +3 -3
- package/dist/esm/salla-loyalty-points-banner.entry.js +1 -1
- package/dist/esm/salla-loyalty-points-history.entry.js +1 -1
- 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-reward.entry.js +2 -2
- package/dist/esm/salla-loyalty.entry.js +1 -1
- package/dist/esm/salla-maintenance-alert.entry.js +1 -1
- package/dist/esm/salla-map_2.entry.js +1 -1
- package/dist/esm/salla-menu.entry.js +1 -1
- package/dist/esm/salla-metadata.entry.js +1 -1
- package/dist/esm/salla-multiple-bundle-product-cart_2.entry.js +1 -1
- package/dist/esm/salla-multiple-bundle-product-options-modal_2.entry.js +1 -1
- package/dist/esm/salla-multiple-bundle-product.entry.js +1 -1
- package/dist/esm/salla-next-order-coupon.entry.js +1 -1
- package/dist/esm/salla-notification-item.entry.js +1 -1
- package/dist/esm/salla-notifications.entry.js +1 -1
- package/dist/esm/salla-offer-modal.entry.js +1 -1
- package/dist/esm/salla-offer.entry.js +1 -1
- package/dist/esm/salla-order-branch.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-edit-item.entry.js +1 -1
- package/dist/esm/salla-order-edit-product-card.entry.js +1 -1
- package/dist/esm/salla-order-edit.entry.js +1 -1
- package/dist/esm/salla-order-options-modal_3.entry.js +1 -1
- package/dist/esm/salla-order-summary.entry.js +1 -1
- package/dist/esm/salla-order-totals-card.entry.js +1 -1
- package/dist/esm/salla-orders.entry.js +1 -1
- package/dist/esm/salla-payments.entry.js +1 -1
- package/dist/esm/salla-placeholder.entry.js +1 -1
- package/dist/esm/salla-price-range.entry.js +1 -1
- package/dist/esm/salla-product-card-embed.entry.js +1 -1
- package/dist/esm/salla-product-size-guide.entry.js +1 -1
- package/dist/esm/salla-products-list.entry.js +1 -1
- package/dist/esm/salla-quick-order.entry.js +1 -1
- package/dist/esm/salla-rating-modal.entry.js +1 -1
- package/dist/esm/salla-reward-action_4.entry.js +3 -3
- package/dist/esm/salla-scopes.entry.js +1 -1
- package/dist/esm/salla-search.entry.js +1 -1
- package/dist/esm/salla-skeleton.entry.js +1 -1
- package/dist/esm/salla-slider.entry.js +1 -1
- package/dist/esm/salla-social-share.entry.js +1 -1
- package/dist/esm/salla-social.entry.js +1 -1
- package/dist/esm/salla-tab-content_3.entry.js +1 -1
- package/dist/esm/salla-tiered-offer.entry.js +1 -1
- package/dist/esm/salla-tooltip.entry.js +1 -1
- package/dist/esm/salla-trust-badges.entry.js +1 -1
- package/dist/esm/salla-user-menu.entry.js +1 -1
- package/dist/esm/salla-user-profile.entry.js +1 -1
- package/dist/esm/salla-user-settings.entry.js +1 -1
- package/dist/esm/salla-verify.entry.js +1 -1
- package/dist/esm/salla-wallet.entry.js +1 -1
- package/dist/esm/salla-wishlist-actions.entry.js +1 -1
- package/dist/esm/{tracked-promise-DXr0erHx.js → tracked-promise-BFrCUkRf.js} +1 -1
- package/dist/esm/twilight.js +2 -2
- package/dist/esm/{vanilla-picker-5UIlzk8V.js → vanilla-picker-k4dXuf_r.js} +1 -1
- package/dist/twilight/{p-2d5469e5.entry.js → p-05573ec1.entry.js} +1 -1
- package/dist/twilight/{p-026f2d7b.entry.js → p-09d4cdc7.entry.js} +1 -1
- package/dist/twilight/{p-b8812978.entry.js → p-0e21c689.entry.js} +1 -1
- package/dist/twilight/{p-328689cc.entry.js → p-10deb584.entry.js} +1 -1
- package/dist/twilight/{p-fbd4f619.entry.js → p-10ef7d8a.entry.js} +1 -1
- package/dist/twilight/{p-e7c12354.entry.js → p-15c2aded.entry.js} +1 -1
- package/dist/twilight/{p-f4531bfe.entry.js → p-15f58bea.entry.js} +1 -1
- package/dist/twilight/{p-dfd88e06.entry.js → p-18ba0468.entry.js} +1 -1
- package/dist/twilight/{p-07ab0bf0.entry.js → p-18d3976e.entry.js} +1 -1
- package/dist/twilight/{p-c45ce221.entry.js → p-190339c7.entry.js} +1 -1
- package/dist/twilight/{p-67e934a3.entry.js → p-1bcb6681.entry.js} +1 -1
- package/dist/twilight/{p-96d7b307.entry.js → p-1be97b58.entry.js} +1 -1
- package/dist/twilight/{p-5083bfcd.entry.js → p-1c1aab79.entry.js} +1 -1
- package/dist/twilight/{p-92b0481d.entry.js → p-1ea3e01d.entry.js} +1 -1
- package/dist/twilight/{p-f5d7430f.entry.js → p-2565dc64.entry.js} +1 -1
- package/dist/twilight/{p-1c834218.entry.js → p-2765e4ec.entry.js} +1 -1
- package/dist/twilight/{p-778a42dc.entry.js → p-2ae4c174.entry.js} +1 -1
- package/dist/twilight/{p-b4301ee3.entry.js → p-2fda9f30.entry.js} +1 -1
- package/dist/twilight/{p-7cec181e.entry.js → p-319983e1.entry.js} +1 -1
- package/dist/twilight/p-3445cd8c.entry.js +4 -0
- package/dist/twilight/{p-9f5105fc.entry.js → p-34860b2b.entry.js} +1 -1
- package/dist/twilight/{p-2dbbfde8.entry.js → p-36242efb.entry.js} +1 -1
- package/dist/twilight/{p-97f56b3e.entry.js → p-364661cc.entry.js} +1 -1
- package/dist/twilight/{p-334df31d.entry.js → p-3c16c6b8.entry.js} +1 -1
- package/dist/twilight/{p-013dfb33.entry.js → p-3d0cf0b3.entry.js} +1 -1
- package/dist/twilight/{p-fd9754f2.entry.js → p-473c6e01.entry.js} +1 -1
- package/dist/twilight/{p-3592fb4b.entry.js → p-4763b0d3.entry.js} +1 -1
- package/dist/twilight/{p-d0bb3653.entry.js → p-4f1f71c6.entry.js} +1 -1
- package/dist/twilight/{p-7c95a27d.entry.js → p-55fc6c69.entry.js} +1 -1
- package/dist/twilight/{p-0f975c51.entry.js → p-56419305.entry.js} +1 -1
- package/dist/twilight/{p-53ce66a7.entry.js → p-56b806ac.entry.js} +1 -1
- package/dist/twilight/{p-767822b5.entry.js → p-58d198ed.entry.js} +1 -1
- package/dist/twilight/{p-315593b0.entry.js → p-5bd5b1db.entry.js} +1 -1
- package/dist/twilight/{p-248d1538.entry.js → p-697792ed.entry.js} +1 -1
- package/dist/twilight/{p-ec1fc331.entry.js → p-6978b18f.entry.js} +1 -1
- package/dist/twilight/{p-95643680.entry.js → p-6a9062fe.entry.js} +1 -1
- package/dist/twilight/{p-57d40198.entry.js → p-6c7e6d1e.entry.js} +1 -1
- package/dist/twilight/{p-a0855c31.entry.js → p-6e352c13.entry.js} +1 -1
- package/dist/twilight/{p-0c77267c.entry.js → p-6e5e98d4.entry.js} +1 -1
- package/dist/twilight/{p-fe86430c.entry.js → p-764fbd77.entry.js} +1 -1
- package/dist/twilight/{p-d9b7a9d1.entry.js → p-7b125382.entry.js} +1 -1
- package/dist/twilight/{p-f13103c6.entry.js → p-80a0774d.entry.js} +1 -1
- package/dist/twilight/{p-ff1c723f.entry.js → p-89c54a03.entry.js} +1 -1
- package/dist/twilight/{p-61e9018a.entry.js → p-8d963f16.entry.js} +1 -1
- package/dist/twilight/{p-c5662aa2.entry.js → p-942a93e8.entry.js} +1 -1
- package/dist/twilight/{p-3d68c74d.entry.js → p-97d0a70f.entry.js} +1 -1
- package/dist/twilight/{p-0b9b72c0.entry.js → p-9a9e8efe.entry.js} +1 -1
- package/dist/twilight/{p-43474ee2.entry.js → p-9b53b934.entry.js} +1 -1
- package/dist/twilight/{p-b3f07535.entry.js → p-9db3081f.entry.js} +1 -1
- package/dist/twilight/{p-0fd430cd.entry.js → p-9f32f1f0.entry.js} +1 -1
- package/dist/twilight/{p-CsHEfbM_.js → p-AuwIE7o-.js} +1 -1
- package/dist/twilight/{p-tJElNMug.js → p-BAyOlChZ.js} +1 -1
- package/dist/twilight/{p-BqFb60iF.js → p-BFfD9GlY.js} +1 -1
- package/dist/twilight/{p-DYL8LNIs.js → p-C5ES8RmQ.js} +1 -1
- package/dist/twilight/{p-DsKnWz05.js → p-CTlsIWU4.js} +1 -1
- package/dist/twilight/{p-BbiGVDjx.js → p-CYUz6ssw.js} +1 -1
- package/dist/twilight/{p-Bw6Lg6Nq.js → p-CgPACEOg.js} +1 -1
- package/dist/twilight/{p-DsHyM0bg.js → p-CsdaeDEP.js} +1 -1
- package/dist/twilight/{p-BRP9wXBV.js → p-CvPfojZm.js} +1 -1
- package/dist/twilight/{p-Kk0reIVI.js → p-DZapUZRi.js} +1 -1
- package/dist/twilight/{p-BnXdxK21.js → p-DlqVqj-B.js} +1 -1
- package/dist/twilight/{p-DlEXuybu.js → p-N2hoIVEP.js} +1 -1
- package/dist/twilight/{p-5a57d395.entry.js → p-a49b621f.entry.js} +1 -1
- package/dist/twilight/{p-8b366181.entry.js → p-a53b463a.entry.js} +1 -1
- package/dist/twilight/{p-e839d889.entry.js → p-a61c84d6.entry.js} +1 -1
- package/dist/twilight/{p-dec1388b.entry.js → p-a6aa3a35.entry.js} +1 -1
- package/dist/twilight/{p-cd3e9b52.entry.js → p-a7333036.entry.js} +1 -1
- package/dist/twilight/{p-dbd2a0de.entry.js → p-ab284e93.entry.js} +1 -1
- package/dist/twilight/{p-3e263ad6.entry.js → p-aedee164.entry.js} +1 -1
- package/dist/twilight/{p-d652aaf4.entry.js → p-af139470.entry.js} +1 -1
- package/dist/twilight/{p-46b9277f.entry.js → p-b05efe57.entry.js} +1 -1
- package/dist/twilight/{p-91dc3de7.entry.js → p-b071c543.entry.js} +1 -1
- package/dist/twilight/{p-a0ba26aa.entry.js → p-b0b9de4f.entry.js} +1 -1
- package/dist/twilight/{p-fd4989e9.entry.js → p-b401a024.entry.js} +1 -1
- package/dist/twilight/{p-7b8f78d8.entry.js → p-b47bbfd3.entry.js} +1 -1
- package/dist/twilight/{p-6c4ab4ae.entry.js → p-b4d80c1d.entry.js} +1 -1
- package/dist/twilight/{p-09373418.entry.js → p-b51ba869.entry.js} +1 -1
- package/dist/twilight/{p-23fb752f.entry.js → p-b5a4b20a.entry.js} +1 -1
- package/dist/twilight/{p-2a8797f7.entry.js → p-c34719c9.entry.js} +1 -1
- package/dist/twilight/{p-ac45f19d.entry.js → p-c50e24d7.entry.js} +1 -1
- package/dist/twilight/{p-63f568ad.entry.js → p-c97836ec.entry.js} +1 -1
- package/dist/twilight/{p-cd40e650.entry.js → p-cbf1c2e1.entry.js} +1 -1
- package/dist/twilight/{p-431fac85.entry.js → p-ce86f94a.entry.js} +1 -1
- package/dist/twilight/{p-2e5bb4f4.entry.js → p-d1d6ba0d.entry.js} +1 -1
- package/dist/twilight/{p-3fc7dfa2.entry.js → p-d2486369.entry.js} +1 -1
- package/dist/twilight/{p-ee0e575e.entry.js → p-d7f1567d.entry.js} +1 -1
- package/dist/twilight/{p-12eef889.entry.js → p-db0c8a1e.entry.js} +1 -1
- package/dist/twilight/{p-1f7b2325.entry.js → p-dc0d8c24.entry.js} +1 -1
- package/dist/twilight/{p-29b491ae.entry.js → p-e461afb0.entry.js} +1 -1
- package/dist/twilight/{p-ea9159eb.entry.js → p-e51e3e84.entry.js} +1 -1
- package/dist/twilight/{p-e23d218e.entry.js → p-e5d5414e.entry.js} +1 -1
- package/dist/twilight/{p-3889f710.entry.js → p-e806cb75.entry.js} +1 -1
- package/dist/twilight/{p-1a719573.entry.js → p-e9db8f68.entry.js} +1 -1
- package/dist/twilight/{p-d66338e0.entry.js → p-edb9b391.entry.js} +1 -1
- package/dist/twilight/{p-f9142099.entry.js → p-edea7fcd.entry.js} +1 -1
- package/dist/twilight/{p-81fc08bc.entry.js → p-ef35051f.entry.js} +1 -1
- package/dist/twilight/{p-9dc040ac.entry.js → p-f0aece35.entry.js} +1 -1
- package/dist/twilight/{p-535aff1f.entry.js → p-f1e59473.entry.js} +1 -1
- package/dist/twilight/{p-76196f47.entry.js → p-fcebdd50.entry.js} +1 -1
- package/dist/twilight/{p-daed6c53.entry.js → p-fd373a93.entry.js} +1 -1
- package/dist/twilight/twilight.esm.js +1 -1
- package/package.json +5 -5
- package/dist/twilight/p-fc337ff0.entry.js +0 -4
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as t,c as s,h as i,H as e,a as r}from"./p-BqFb60iF.js";import{a as o}from"./p-CgtvEd63.js";import{S as a}from"./p-DiKTtDW5.js";import{H as l}from"./p-BcbKK1Xp.js";const n=class{constructor(i){t(this,i),this.productsFetched=s(this,"productsFetched"),this.selectionChanged=s(this,"selectionChanged"),this.autoload=!1,this.productCardComponent="custom-salla-product-card",this.selectable=!1,this.page=1,this.placeholderText=salla.lang.get("pages.categories.no_products"),this.endOfText=salla.lang.get("common.elements.end_of_content"),this.failedLoadMore=salla.lang.get("common.elements.failed_to_load_more"),this.currentPage=salla.config.get("page"),this.filtersSnapshot=[],this.selectedProducts=new Map,this.lastViewedProductKey="lastViewedProductId",this.filtersKey="filters",this.infiniteScrollStateKey="infiniteScrollState",this.prevCategoryIdKey="prevCategoryId",this.isProcessing=!1,this.scrollTimeout=null,this.boundScrollToLastViewedProduct=()=>this.scrollToLastViewedProduct(),this.boundHandleScroll=()=>this.handleScroll(),this.specialPagesWithoutIds={"product.index.latest":"latest","product.index.offers":"offers","product.index.search":"search","product.index.sales":"sales"},this.onWishlistItemRemoved=(t,s)=>{if("wishlist"!==this.getSource()||!this.wrapper)return;const i=String(s),e=this.hasCustomComponent?this.productCardComponent:"salla-product-card";for(const t of Array.from(this.wrapper.children)){const s=t,r=t.querySelector(e),o=s.product?.id??r?.product?.id;if(null!=o&&String(o)===i){t.remove();break}}for(const t of Array.from(this.wrapper.children)){if(!t.classList.contains("s-products-list-selectable-item"))continue;const s=t;if(null!=s.product?.id&&String(s.product.id)===i&&!t.querySelector(e)){t.remove();break}}if(this.selectable){for(const t of Array.from(this.selectedProducts.keys()))String(t)===i&&this.selectedProducts.delete(t);this.emitSelection()}},this.includes=l.parseJson(this.includes||this.host.getAttribute("includes")),Array.isArray(this.includes)||(this.includes=null),l.setIncludes(this.includes),salla.lang.onLoaded((()=>{this.placeholderText=salla.lang.get("pages.categories.no_products"),this.endOfText=salla.lang.get("common.elements.end_of_content"),this.failedLoadMore=salla.lang.get("common.elements.failed_to_load_more"),this.currentPage=salla.config.get("page")}))}connectedCallback(){"scrollRestoration"in history&&(history.scrollRestoration="manual"),window.addEventListener("DOMContentLoaded",this.boundScrollToLastViewedProduct),salla.event.on("salla-filters::changed",(t=>this.setFilters(t))),salla.event.on("wishlist::removed",this.onWishlistItemRemoved)}disconnectedCallback(){window.removeEventListener("DOMContentLoaded",this.boundScrollToLastViewedProduct),window.removeEventListener("scroll",this.boundHandleScroll),salla.event.off("wishlist::removed",this.onWishlistItemRemoved)}async setFilters(t){if(t&&JSON.stringify(t)!==JSON.stringify(this.parsedFilters))return window.scrollTo({top:0,behavior:"smooth"}),this.parsedFilters=JSON.parse(JSON.stringify(t)),"product.index"==this.currentPage?.slug&&this.parsedFilters&&this.parsedFilters.category_id&&(this.currentCategoryIdFilter=[this.parsedFilters.category_id]),this.reload()}async reload(){!this.autoload&&this.loadMoreWrapper&&(this.loadMoreWrapper.style.display="none"),this.hasInfiniteScroll&&salla.infiniteScroll.destroy(this.infiniteScroll),await this.buildNextPageUrl(),this.wrapper.innerHTML="",this.hasInfiniteScroll?this.init():this.getInitialData(),this.showPlaceholder&&(this.showPlaceholder=!1,this.placeholderLoader=document.createElement("div"),this.placeholderLoader.classList.add("s-products-list-loading-wrapper"),this.placeholderLoader.style.display="inherit",this.placeholderLoader.innerHTML='<span class="s-button-loader s-button-loader-center s-infinite-scroll-btn-loader"></span>',this.host.insertAdjacentElement("afterend",this.placeholderLoader))}isFilterable(){return salla.config.get("store.settings.product.filters")&&this.filtersResults}getCachedFilters(){return Array.isArray(this.filtersSnapshot)&&this.filtersSnapshot.length?JSON.parse(JSON.stringify(this.filtersSnapshot)):null}emitFilters(t){if(!this.isFilterable())return;if(t.filters)return this.filtersResults=!0,this.filtersSnapshot=JSON.parse(JSON.stringify(t.filters)),void salla.event.emit("filters::fetched",{filters:t.filters});const s=t.cursor?.current>1?this.getCachedFilters():null;if(s)return this.filtersResults=!0,void salla.event.emit("filters::fetched",{filters:s});this.filtersSnapshot=[],salla.event.emit("filters::hidden")}isSourceWithoutValue(){const t=this.getSource();if("wishlist"===t){const t=new URLSearchParams(window.location.search);return!(t.has("source_value")||t.has("source_value[]")||this.sourceValue)}return["offers","latest","sales","top-rated","reorder"].includes(t)}animateItems(){o({targets:"salla-products-list salla-product-card",opacity:[0,1],duration:1200,translateY:[20,0],delay:function(t,s){return 100*s}})}async initBaseNextPageUrl(t){this.nextPage=salla.url.api(`products?source=${t}`),this.includes?.length&&(this.nextPage+=`&includes[]=${this.includes.join("&includes[]=")}`),this.limit&&(this.nextPage+=`&per_page=${this.limit>32?32:this.limit}`),this.sortBy&&(this.nextPage+=`&sort=${this.sortBy}`),"preview"===salla.config.get("theme.mode")&&(this.nextPage+="&use_username_url=1"),this.nextPage+="&filterable=1";for(const[t,s]of Object.entries(this.parsedFilters||{}))if("source_value"!==t&&"source_value[]"!==t)if(["string","number"].includes(typeof s))this.nextPage+=`&filters[${encodeURIComponent(t)}]=${encodeURIComponent(s)}`;else if(Array.isArray(s))s.forEach((s=>this.nextPage+=`&filters[${encodeURIComponent(t)}][]=${encodeURIComponent(s)}`));else if("object"==typeof s)for(const[i,e]of Object.entries(s))this.nextPage+=`&filters[${encodeURIComponent(t)}][${encodeURIComponent(i)}]=${encodeURIComponent(e)}`;this.nextPage=await this.applyBeforeBuildListUrl(this.nextPage)}async buildNextPageUrl(){let t=this.getSource();if("json"===t)return;const s=sessionStorage.getItem(this.infiniteScrollStateKey);if(s){const{nextPage:t}=JSON.parse(s);if(!t)return}if(await this.initBaseNextPageUrl(t),!this.isSourceWithoutValue())if(["search","related","landing-page"].includes(t))this.nextPage+=`&source_value=${this.getSourceValue()}`;else try{this.nextPage+=`&source_value[]=${this.getSourceValue().join("&source_value[]=")}`}catch(s){salla.logger.warn(`source-value prop should be array of ids ex source-value="[1,2,3]" for the source [${t}]`),this.sourceValueIsValid=!1}}loading(t=!0,s=!1){if(t){let t=s&&!this.autoload?this.btnLoader:this.loader;t&&(t.style.display="inherit")}else this.autoload||this.btnLoader&&(this.btnLoader.style.display="none"),this.loader&&(this.loader.style.display="none")}getItemHTML(t){"landing-page"===this.getSource()&&(t.url="");const s=document.createElement(this.hasCustomComponent?this.productCardComponent:"salla-product-card");return s.product=t,this.compactCards&&(s.compact=!0,s.toggleAttribute("compact",!0)),this.applyLandingPageStyles(s),this.applyHorizontalCardStyles(s),s.addEventListener("click",(s=>{s.target.closest("a")&&(l.saveProductSource(this.getSource()),this.hasInfiniteScroll&&(this.takeStateSnapshot(),sessionStorage.setItem(this.lastViewedProductKey,t.id)))})),this.selectable?this.wrapSelectableItem(s,t):s}wrapSelectableItem(t,s){const i=document.createElement("div");i.className="s-products-list-selectable-item",i.product=s;const e=this.selectedProducts.has(s.id);e&&i.classList.add("s-products-list-item-selected");const r=document.createElement("label");r.className="s-products-list-select-control",r.setAttribute("aria-label",salla.lang.get("common.elements.select","تحديد"));const o=document.createElement("input");return o.type="checkbox",o.className="s-products-list-select-checkbox",o.checked=e,o.addEventListener("change",(()=>this.toggleSelection(s,i,o.checked))),r.appendChild(o),i.appendChild(r),i.appendChild(t),i}toggleSelection(t,s,i){i?(this.selectedProducts.set(t.id,t),s?.classList.add("s-products-list-item-selected")):(this.selectedProducts.delete(t.id),s?.classList.remove("s-products-list-item-selected")),this.emitSelection()}emitSelection(){const t=Array.from(this.selectedProducts.values()),s=Array.from(this.selectedProducts.keys()),i={ids:s,products:t,count:s.length};this.selectionChanged.emit(i),salla.event.emit("salla-products-list::selection.changed",i)}onSelectableChanged(t,s){t!==s&&this.isReady&&this.wrapper&&(t||(this.selectedProducts.clear(),this.emitSelection()),this.reload())}applyLandingPageStyles(t){"landing-page"!==this.getSource()||this.hasCustomComponent||(t.toggleAttribute("hide-add-btn",!0),t.classList.add("s-product-card-fit-height"))}applyHorizontalCardStyles(t){this.horizontalCards&&(t.toggleAttribute("horizontal",!0),this.hasCustomComponent||t.toggleAttribute("shadow-on-hover",!0))}waitForResizing(t){let s=null;return new Promise((i=>{const e=new ResizeObserver((()=>{clearTimeout(s),s=setTimeout((()=>{e.disconnect(),i(null)}),160)}));e.observe(t)}))}waitForLayoutStable(t){let s=null;return new Promise((i=>{const e=new MutationObserver((()=>{clearTimeout(s),s=setTimeout((()=>{e.disconnect(),i(null)}),160)}));e.observe(t,{childList:!0,subtree:!0,attributes:!0})}))}async waitForStableLayout(t){return await Promise.allSettled([this.waitForResizing(t),this.waitForLayoutStable(t)])}scrollToLastViewedProduct(){const t=sessionStorage.getItem(this.lastViewedProductKey);t&&!salla.url.is_page("product.single")&&this.isElementLoaded(`[id*="${t}"]`).then((()=>{const s=this.wrapper?.querySelector(`[id*="${t}"]`);if(!s)return;const i=()=>{const t=()=>{s.scrollIntoView({block:"start",behavior:"instant"});const t=matchMedia("(max-width: 1024px)").matches?"header .inner":"ul.main-menu",i=window?.header_is_sticky?document.querySelector(t)?.getBoundingClientRect()?.height??56:0,e=parseInt(getComputedStyle(this.wrapper).rowGap)??16;scrollBy({top:-1*(i+e),behavior:"instant"})};requestAnimationFrame(t),s.querySelectorAll("img.lazy").forEach((s=>{const i=s,e=()=>{requestAnimationFrame(t),i.onload=i.onerror=null};i.onload=e,i.onerror=e})),this.removeScrollRestorationSession()};this.waitForStableLayout(this.host).then((()=>requestAnimationFrame(i)))}))}isElementLoaded(t){return new Promise((s=>{const i=setInterval((()=>{if(document.querySelector(t))return clearInterval(i),s(document.querySelector(t))}),50)}))}takeStateSnapshot(){const t=[];for(let s=0;s<this.wrapper.children.length;s++){const i=this.wrapper.children?.[s];t.push(i.product)}const s={pageIndex:Math.max((this.infiniteScroll?.pageIndex??1)-1,1),nextPage:this.nextPage,currentPageData:t};if(this.isFilterable()){const t=sessionStorage.getItem(this.filtersKey);sessionStorage.setItem(this.filtersKey,t||JSON.stringify(this.filtersSnapshot))}sessionStorage.setItem(this.infiniteScrollStateKey,JSON.stringify(s));let i=salla.config.get("page.id");const e=Object.keys(this.specialPagesWithoutIds).find((t=>salla.url.is_page(t)));e?i=this.specialPagesWithoutIds[e]:null!==i&&(i=String(i)),sessionStorage.setItem(this.prevCategoryIdKey,i)}removeScrollRestorationSession(){this.isFilterable()||sessionStorage.removeItem(this.filtersKey),sessionStorage.removeItem(this.infiniteScrollStateKey),sessionStorage.removeItem(this.lastViewedProductKey),sessionStorage.removeItem(this.prevCategoryIdKey)}loadStoredScrollState(){const t=sessionStorage.getItem(this.infiniteScrollStateKey),s=sessionStorage.getItem(this.filtersKey),i=sessionStorage.getItem(this.prevCategoryIdKey),e=this.specialPagesWithoutIds[salla.config.get("page.slug")]||null,r=salla.config.get("page.id"),o=salla.url.is_page("index"),a=salla.url.is_page("product.single"),l=e?i!==e:i!==String(r);if(i&&l&&!o&&!a||o&&!this.hasInfiniteScroll)return this.removeScrollRestorationSession(),this.switchToNormalBehavior=!0,!1;if(a)return this.switchToNormalBehavior=!0,!1;if(t)try{const{pageIndex:i,nextPage:e,currentPageData:r}=JSON.parse(t);if(s&&"undefined"!==s){const t=JSON.parse(s);this.filtersSnapshot=JSON.parse(JSON.stringify(t)),salla.event.emit("filters::fetched",{filters:t})}this.page=i,this.nextPage=e;for(let t=0;t<r.length;t++)this.wrapper.append(this.getItemHTML(r?.[t]));return!0}catch(t){console.error("Failed to load stored scroll state:",t),this.removeScrollRestorationSession()}return!1}getSource(){return l.getProductsSource(this.source)}isAuxiliaryProductsListSource(){return["json","selected","related","landing-page","recently"].includes(this.getSource())}getSourceValue(){if("wishlist"===this.getSource()){const t=new URLSearchParams(window.location.search),s=t.getAll("source_value[]").length?t.getAll("source_value[]"):t.getAll("source_value");if(s.length)return s}return this.currentCategoryIdFilter?this.currentCategoryIdFilter:l.getProductsSourceValue(this.source,this.sourceValue)}logFetchError(t,s,i,e,r){try{const o=r&&"object"==typeof r?r:null,a=this.getSourceValue();salla.analytics?.log("salla::products.list.fetch.error",{errorPhase:t,source:this.getSource(),sourceValue:"string"==typeof a&&a.length>200?`${a.slice(0,200)}…`:Array.isArray(a)?{length:a.length}:a,pageIndex:this.infiniteScroll?.pageIndex,fetchPath:i,httpStatus:e?.status,httpStatusText:e?.statusText,responseUrl:e?.url,...o&&{dataCount:Array.isArray(o.data)?o.data.length:void 0,responseKeys:Object.keys(o).slice(0,15),filtersCount:Array.isArray(o.filters)?o.filters.length:void 0},errorMessage:s instanceof Error?s.message:String(s),..."processing"===t&&s instanceof Error&&s.stack?{errorStack:s.stack.slice(0,500)}:{}})}catch{}}appendDataLayer(t){"object"==typeof dataLayer&&Array.isArray(dataLayer)&&dataLayer.push({event:"impressions",ecommerce:{currencyCode:salla.config.currency().code,impressions:t.map(((t,s)=>({id:t.id,name:t.name,price:t.price,brand:t.brand?.name||"",quantity:t.quantity,categories:[{name:t.category?.name||salla.config.get("page.title"),id:salla.config.get("page.id")}],category:t.category?.name||salla.config.get("page.title"),position:s+1})))}})}initiateInfiniteScroll(){if(!this.hasInfiniteScroll)return;const t=this.autoload&&this.includes&&this.includes.length>0;this.infiniteScroll=salla.infiniteScroll.initiate(this.wrapper,this.wrapper,{path:()=>this.nextPage,history:!1,nextPage:this.nextPage,scrollThreshold:!t&&!!this.autoload&&100,loadOnScroll:!t&&this.autoload},!0),this.infiniteScroll.pageIndex=this.page,this.infiniteScroll?.on("request",(()=>{this.loading(!0,!this.autoload)})),t&&window.addEventListener("scroll",this.boundHandleScroll),this.infiniteScroll?.on("load",(async(t,s,i)=>{if(!this.isProcessing){this.isProcessing=!0;try{if(!t.data?.length&&2===this.infiniteScroll.pageIndex)return this.showPlaceholder=!0,salla.infiniteScroll.destroy(this.infiniteScroll),this.loading(!1),void(this.placeholderLoader&&this.placeholderLoader.remove());this.includes&&await this.injectAndProcessData(t);const s=await this.handleResponse(t);this.infiniteScroll.appendItems(s),2===this.infiniteScroll.pageIndex&&(!this.autoload&&this.nextPage&&(this.loadMoreWrapper.style.display="block"),this.animateItems())}catch(e){console.error("Error during load:",e),this.logFetchError("processing",e,"string"==typeof s?s:void 0,i,t)}finally{this.isProcessing=!1}}})),this.infiniteScroll?.on("error",((t,s,i)=>{const e=i;this.status.querySelector(".s-infinite-scroll-error").classList.remove("s-hidden"),this.placeholderLoader&&this.placeholderLoader.remove(),this.loading(!1),this.isProcessing=!1,this.logFetchError("fetch",t,s,e)})),salla.onReady((()=>{sessionStorage.getItem(this.infiniteScrollStateKey)||this.manualLoadNextPage()}))}handleScroll(){this.isProcessing||this.scrollTimeout||(this.scrollTimeout=setTimeout((()=>{this.scrollTimeout=null,requestAnimationFrame((()=>{const t=this.wrapper.getBoundingClientRect(),s=window.innerHeight;t.bottom-s<=200&&!this.isProcessing&&this.nextPage&&this.manualLoadNextPage()}))}),200))}manualLoadNextPage(){this.nextPage&&this.infiniteScroll.loadNextPage()}async applyBeforeBuildListUrl(t){try{const s={component:this,url:t};return await salla.hooks.call("salla-products-list","beforeBuildListUrl",s),s.url}catch(s){return salla.logger.warn("beforeBuildListUrl hook failed",s?.message),t}}async resolveNextPageFromCursor(t){return t.cursor?t.cursor.next?await this.applyBeforeBuildListUrl(t.cursor.next):t.cursor.next:this.nextPage}async injectAndProcessData(t){try{await l.injectExtraFieldsToResponse(t)}catch(t){console.error("Error injecting data:",t)}}getInitialData(){return this.loading(),salla.api.withoutNotifier((()=>salla.product.api.fetch({source:l.getApiSource(this.getSource()),source_value:this.getSourceValue(),limit:this.limit}).then((async t=>t.data.length?(await l.injectExtraFieldsToResponse(t),this.firstPageResponse?void(await this.handleResponse(t)).forEach((t=>this.wrapper.append(t))):(this.firstPageResponse=t,void(this.nextPage=await this.resolveNextPageFromCursor(t)))):(this.showPlaceholder=!0,this.placeholderLoader&&this.placeholderLoader.remove(),void this.loading(!1))))))}async loadMore(){this.infiniteScroll?.loadNextPage()}async getSelected(){return{ids:Array.from(this.selectedProducts.keys()),products:Array.from(this.selectedProducts.values())}}async getLoadedProducts(){const t=[];if(!this.wrapper)return t;for(let s=0;s<this.wrapper.children.length;s++){const i=this.wrapper.children[s];i?.product&&t.push(i.product)}return t}async selectAll(){if(this.selectable&&this.wrapper){for(let t=0;t<this.wrapper.children.length;t++){const s=this.wrapper.children[t];if(s?.product){this.selectedProducts.set(s.product.id,s.product),s.classList.add("s-products-list-item-selected");const t=s.querySelector(".s-products-list-select-checkbox");t&&(t.checked=!0)}}this.emitSelection()}}async clearSelection(){this.selectedProducts.clear(),this.wrapper&&(this.wrapper.querySelectorAll(".s-products-list-select-checkbox").forEach((t=>t.checked=!1)),this.wrapper.querySelectorAll(".s-products-list-item-selected").forEach((t=>t.classList.remove("s-products-list-item-selected")))),this.emitSelection()}componentWillLoad(){return salla.onReady().then((async()=>{this.hasCustomComponent=!!customElements.get(this.productCardComponent),this.sourceValueIsValid=!(!this.getSourceValue()&&!this.isSourceWithoutValue()),this.hasInfiniteScroll=!this.isAuxiliaryProductsListSource()&&!this.limit;let t=new URLSearchParams(window.location.search);try{this.sortBy=this.sortBy||t.get("sort")||t.get("by"),this.parsedFilters=l.extractFiltersFromUrl(t),this.parsedFilters&&this.parsedFilters.category_id&&(this.currentCategoryIdFilter=[this.parsedFilters.category_id])}catch(t){salla.logger.warn("failed to get filters from url",t.message)}if(await this.buildNextPageUrl(),this.isReady=!0,!sessionStorage.getItem(this.infiniteScrollStateKey))if(this.sourceValueIsValid){if(!this.hasInfiniteScroll){if("json"===this.getSource())return this.getSourceValue().length?void setTimeout((()=>{this.getSourceValue().map((t=>this.wrapper.append(this.getItemHTML(t))))})):void(this.showPlaceholder=!0);if("selected"!==this.getSource()||this.getSourceValue().length)return this.getInitialData();this.showPlaceholder=!0}}else salla.logger.warn(`source-value prop is required for source [${this.getSource()}]`)}))}async componentDidLoad(){this.hasInfiniteScroll&&this.init(),await Salla.hooks.registerComponent("salla-products-list",this),this.loadStoredScrollState()?(this.autoload?!this.nextPage&&this.loading(!1):this.nextPage?this.loadMoreWrapper&&(this.loadMoreWrapper.style.display="block"):(this.loadMoreWrapper&&(this.loadMoreWrapper.style.display="none"),this.status.querySelector(".s-infinite-scroll-last").classList.remove("s-hidden")),this.scrollToLastViewedProduct()):!this.firstPageResponse&&this.switchToNormalBehavior?this.getInitialData().then((async()=>{this.firstPageResponse?((await this.handleResponse(this.firstPageResponse,!1)).forEach((t=>{this.wrapper.append(t)})),setTimeout((()=>{if(!this.autoload&&this.nextPage&&1==this.infiniteScroll.pageIndex){const t=this.host.querySelector(".s-infinite-scroll-wrapper");t&&(t.style.display="block")}}))):console.error("No response received after getInitialData.")})).catch((t=>{console.error("Error during initial data fetch:",t)})):this.firstPageResponse&&(await this.handleResponse(this.firstPageResponse,!1)).forEach((t=>this.wrapper.append(t)))}canRender(){return this.sourceValueIsValid&&this.isReady}render(){return this.canRender()?this.showPlaceholder?i("div",{class:"s-products-list-placeholder"},i("span",{innerHTML:a}),i("p",null,this.placeholderText)):i(e,{class:"s-products-list"},i("div",{class:{"s-products-list-wrapper":!0,"s-products-list-horizontal-cards":this.horizontalCards&&!this.filtersResults,"s-products-list-vertical-cards":!this.horizontalCards&&!this.rowCards&&!this.filtersResults,"s-products-list-row-cards":this.rowCards,"s-products-list-compact-cards":this.compactCards,"s-products-list-filters-results":this.filtersResults},ref:t=>this.wrapper=t}),i("div",{class:"s-infinite-scroll-status",ref:t=>this.status=t},i("p",{class:"s-infinite-scroll-last infinite-scroll-last s-hidden"},this.endOfText),i("p",{class:"s-infinite-scroll-error infinite-scroll-error s-hidden"},this.failedLoadMore)),this.autoload&&i("div",{class:"s-products-list-loading-wrapper",style:{display:"none"},ref:t=>this.loader=t},i("span",{class:"s-button-loader s-button-loader-center s-infinite-scroll-btn-loader"})),this.hasInfiniteScroll&&this.nextPage&&!this.autoload?i("div",{class:"s-infinite-scroll-wrapper",style:{display:"none"},ref:t=>this.loadMoreWrapper=t},i("button",{onClick:()=>this.loadMore(),class:"s-infinite-scroll-btn s-button-btn s-button-primary"},i("span",{class:"s-button-text s-infinite-scroll-btn-text"},this.loadMoreText?this.loadMoreText:salla.lang.get("common.elements.load_more")),i("span",{class:"s-button-loader s-button-loader-center s-infinite-scroll-btn-loader",ref:t=>this.btnLoader=t,style:{display:"none"}}))):""):""}init(){this.initiateInfiniteScroll(),this.loading()}async handleResponse(t,s=!0){if(!t)return[];let i=this.getSource();if(1===t.cursor?.current){if(!this.isAuxiliaryProductsListSource()){let s=l.getPageTitleForSource(i);try{if("search"===this.getSource())s=salla.lang.get("common.elements.search_about",{word:this.getSourceValue()});else if(!s){let i=this.parsedFilters.category_id||this.getSourceValue()[0];s=t.filters?.find((t=>"category_id"===t.key))?.values?.find((t=>t.key===i))?.value??""}s+=(s?" - ":"")+salla.lang.choice("blocks.header.products_count",t.data?.length),15===t.data.length&&(s=s.replace(t.data.length,salla.lang.get("common.elements.more_than")+" "+t.data.length)),t.title=s}catch(t){salla.logger.error("Error::falid to handle response",t)}}l.generateProductSchema(t.data)}this.appendDataLayer(t.data),t.nextPage=this.nextPage,t.source=this.getSource(),t.sourceValue=this.getSourceValue(),salla.event.emit("salla-products-list::products.fetched",t),this.productsFetched.emit(t),this.emitFilters(t),s&&(this.nextPage=await this.resolveNextPageFromCursor(t)),this.loading(!1),this.placeholderLoader&&this.placeholderLoader.remove(),this.hasInfiniteScroll&&!this.nextPage&&(this.infiniteScroll.option({scrollThreshold:!1,loadOnScroll:!1}),this.status.querySelector(".s-infinite-scroll-last").classList.remove("s-hidden"));const e=[];for(let s=0;s<t.data.length;s++)e.push(this.getItemHTML(t.data?.[s]));return e}get host(){return r(this)}static get watchers(){return{selectable:["onSelectableChanged"]}}};n.style='.s-products-list-selectable-item{position:relative;border-radius:0.5rem;transition:box-shadow 0.15s ease-in-out}.s-products-list-item-selected{box-shadow:0 0 0 2px var(--color-primary)}.s-products-list-select-control{position:absolute;top:10px;inset-inline-start:10px;z-index:5;display:inline-flex;align-items:center;justify-content:center;cursor:pointer}.s-products-list-select-checkbox{appearance:none;-webkit-appearance:none;-moz-appearance:none;position:relative;width:22px;height:22px;margin:0;cursor:pointer;color:var(--color-primary);border:1px solid rgba(0, 0, 0, 0.15);border-radius:6px;background-color:#fff;box-shadow:0 1px 3px rgba(0, 0, 0, 0.2);transition:background-color 0.15s ease-in-out, border-color 0.15s ease-in-out}.s-products-list-select-checkbox:hover{border-color:var(--color-primary)}.s-products-list-select-checkbox:focus,.s-products-list-select-checkbox:focus-visible{outline:none;border-color:var(--color-primary);box-shadow:0 1px 3px rgba(0, 0, 0, 0.2), 0 0 0 3px color-mix(in srgb, var(--color-primary) 30%, transparent)}.s-products-list-select-checkbox:checked,.s-products-list-select-checkbox:checked:hover,.s-products-list-select-checkbox:checked:focus{background-color:var(--color-primary);border-color:var(--color-primary)}.s-products-list-select-checkbox:checked::after{content:"";position:absolute;top:50%;left:50%;width:5px;height:10px;border:solid #fff;border-width:0 2px 2px 0;transform:translate(-50%, -60%) rotate(45deg)}.s-products-list-row-cards .s-products-list-select-control{top:50%;inset-inline-start:14px;transform:translateY(-50%)}.s-products-list-row-cards .s-products-list-selectable-item>:not(.s-products-list-select-control){padding-inline-start:2.75rem}';export{n as salla_products_list}
|
|
4
|
+
import{r as t,c as s,h as i,H as e,a as r}from"./p-BFfD9GlY.js";import{a as o}from"./p-CgtvEd63.js";import{S as a}from"./p-DiKTtDW5.js";import{H as l}from"./p-BcbKK1Xp.js";const n=class{constructor(i){t(this,i),this.productsFetched=s(this,"productsFetched"),this.selectionChanged=s(this,"selectionChanged"),this.autoload=!1,this.productCardComponent="custom-salla-product-card",this.selectable=!1,this.page=1,this.placeholderText=salla.lang.get("pages.categories.no_products"),this.endOfText=salla.lang.get("common.elements.end_of_content"),this.failedLoadMore=salla.lang.get("common.elements.failed_to_load_more"),this.currentPage=salla.config.get("page"),this.filtersSnapshot=[],this.selectedProducts=new Map,this.lastViewedProductKey="lastViewedProductId",this.filtersKey="filters",this.infiniteScrollStateKey="infiniteScrollState",this.prevCategoryIdKey="prevCategoryId",this.isProcessing=!1,this.scrollTimeout=null,this.boundScrollToLastViewedProduct=()=>this.scrollToLastViewedProduct(),this.boundHandleScroll=()=>this.handleScroll(),this.specialPagesWithoutIds={"product.index.latest":"latest","product.index.offers":"offers","product.index.search":"search","product.index.sales":"sales"},this.onWishlistItemRemoved=(t,s)=>{if("wishlist"!==this.getSource()||!this.wrapper)return;const i=String(s),e=this.hasCustomComponent?this.productCardComponent:"salla-product-card";for(const t of Array.from(this.wrapper.children)){const s=t,r=t.querySelector(e),o=s.product?.id??r?.product?.id;if(null!=o&&String(o)===i){t.remove();break}}for(const t of Array.from(this.wrapper.children)){if(!t.classList.contains("s-products-list-selectable-item"))continue;const s=t;if(null!=s.product?.id&&String(s.product.id)===i&&!t.querySelector(e)){t.remove();break}}if(this.selectable){for(const t of Array.from(this.selectedProducts.keys()))String(t)===i&&this.selectedProducts.delete(t);this.emitSelection()}},this.includes=l.parseJson(this.includes||this.host.getAttribute("includes")),Array.isArray(this.includes)||(this.includes=null),l.setIncludes(this.includes),salla.lang.onLoaded((()=>{this.placeholderText=salla.lang.get("pages.categories.no_products"),this.endOfText=salla.lang.get("common.elements.end_of_content"),this.failedLoadMore=salla.lang.get("common.elements.failed_to_load_more"),this.currentPage=salla.config.get("page")}))}connectedCallback(){"scrollRestoration"in history&&(history.scrollRestoration="manual"),window.addEventListener("DOMContentLoaded",this.boundScrollToLastViewedProduct),salla.event.on("salla-filters::changed",(t=>this.setFilters(t))),salla.event.on("wishlist::removed",this.onWishlistItemRemoved)}disconnectedCallback(){window.removeEventListener("DOMContentLoaded",this.boundScrollToLastViewedProduct),window.removeEventListener("scroll",this.boundHandleScroll),salla.event.off("wishlist::removed",this.onWishlistItemRemoved)}async setFilters(t){if(t&&JSON.stringify(t)!==JSON.stringify(this.parsedFilters))return window.scrollTo({top:0,behavior:"smooth"}),this.parsedFilters=JSON.parse(JSON.stringify(t)),"product.index"==this.currentPage?.slug&&this.parsedFilters&&this.parsedFilters.category_id&&(this.currentCategoryIdFilter=[this.parsedFilters.category_id]),this.reload()}async reload(){!this.autoload&&this.loadMoreWrapper&&(this.loadMoreWrapper.style.display="none"),this.hasInfiniteScroll&&salla.infiniteScroll.destroy(this.infiniteScroll),await this.buildNextPageUrl(),this.wrapper.innerHTML="",this.hasInfiniteScroll?this.init():this.getInitialData(),this.showPlaceholder&&(this.showPlaceholder=!1,this.placeholderLoader=document.createElement("div"),this.placeholderLoader.classList.add("s-products-list-loading-wrapper"),this.placeholderLoader.style.display="inherit",this.placeholderLoader.innerHTML='<span class="s-button-loader s-button-loader-center s-infinite-scroll-btn-loader"></span>',this.host.insertAdjacentElement("afterend",this.placeholderLoader))}isFilterable(){return salla.config.get("store.settings.product.filters")&&this.filtersResults}getCachedFilters(){return Array.isArray(this.filtersSnapshot)&&this.filtersSnapshot.length?JSON.parse(JSON.stringify(this.filtersSnapshot)):null}emitFilters(t){if(!this.isFilterable())return;if(t.filters)return this.filtersResults=!0,this.filtersSnapshot=JSON.parse(JSON.stringify(t.filters)),void salla.event.emit("filters::fetched",{filters:t.filters});const s=t.cursor?.current>1?this.getCachedFilters():null;if(s)return this.filtersResults=!0,void salla.event.emit("filters::fetched",{filters:s});this.filtersSnapshot=[],salla.event.emit("filters::hidden")}isSourceWithoutValue(){const t=this.getSource();if("wishlist"===t){const t=new URLSearchParams(window.location.search);return!(t.has("source_value")||t.has("source_value[]")||this.sourceValue)}return["offers","latest","sales","top-rated","reorder"].includes(t)}animateItems(){o({targets:"salla-products-list salla-product-card",opacity:[0,1],duration:1200,translateY:[20,0],delay:function(t,s){return 100*s}})}async initBaseNextPageUrl(t){this.nextPage=salla.url.api(`products?source=${t}`),this.includes?.length&&(this.nextPage+=`&includes[]=${this.includes.join("&includes[]=")}`),this.limit&&(this.nextPage+=`&per_page=${this.limit>32?32:this.limit}`),this.sortBy&&(this.nextPage+=`&sort=${this.sortBy}`),"preview"===salla.config.get("theme.mode")&&(this.nextPage+="&use_username_url=1"),this.nextPage+="&filterable=1";for(const[t,s]of Object.entries(this.parsedFilters||{}))if("source_value"!==t&&"source_value[]"!==t)if(["string","number"].includes(typeof s))this.nextPage+=`&filters[${encodeURIComponent(t)}]=${encodeURIComponent(s)}`;else if(Array.isArray(s))s.forEach((s=>this.nextPage+=`&filters[${encodeURIComponent(t)}][]=${encodeURIComponent(s)}`));else if("object"==typeof s)for(const[i,e]of Object.entries(s))this.nextPage+=`&filters[${encodeURIComponent(t)}][${encodeURIComponent(i)}]=${encodeURIComponent(e)}`;this.nextPage=await this.applyBeforeBuildListUrl(this.nextPage)}async buildNextPageUrl(){let t=this.getSource();if("json"===t)return;const s=sessionStorage.getItem(this.infiniteScrollStateKey);if(s){const{nextPage:t}=JSON.parse(s);if(!t)return}if(await this.initBaseNextPageUrl(t),!this.isSourceWithoutValue())if(["search","related","landing-page"].includes(t))this.nextPage+=`&source_value=${this.getSourceValue()}`;else try{this.nextPage+=`&source_value[]=${this.getSourceValue().join("&source_value[]=")}`}catch(s){salla.logger.warn(`source-value prop should be array of ids ex source-value="[1,2,3]" for the source [${t}]`),this.sourceValueIsValid=!1}}loading(t=!0,s=!1){if(t){let t=s&&!this.autoload?this.btnLoader:this.loader;t&&(t.style.display="inherit")}else this.autoload||this.btnLoader&&(this.btnLoader.style.display="none"),this.loader&&(this.loader.style.display="none")}getItemHTML(t){"landing-page"===this.getSource()&&(t.url="");const s=document.createElement(this.hasCustomComponent?this.productCardComponent:"salla-product-card");return s.product=t,this.compactCards&&(s.compact=!0,s.toggleAttribute("compact",!0)),this.applyLandingPageStyles(s),this.applyHorizontalCardStyles(s),s.addEventListener("click",(s=>{s.target.closest("a")&&(l.saveProductSource(this.getSource()),this.hasInfiniteScroll&&(this.takeStateSnapshot(),sessionStorage.setItem(this.lastViewedProductKey,t.id)))})),this.selectable?this.wrapSelectableItem(s,t):s}wrapSelectableItem(t,s){const i=document.createElement("div");i.className="s-products-list-selectable-item",i.product=s;const e=this.selectedProducts.has(s.id);e&&i.classList.add("s-products-list-item-selected");const r=document.createElement("label");r.className="s-products-list-select-control",r.setAttribute("aria-label",salla.lang.get("common.elements.select","تحديد"));const o=document.createElement("input");return o.type="checkbox",o.className="s-products-list-select-checkbox",o.checked=e,o.addEventListener("change",(()=>this.toggleSelection(s,i,o.checked))),r.appendChild(o),i.appendChild(r),i.appendChild(t),i}toggleSelection(t,s,i){i?(this.selectedProducts.set(t.id,t),s?.classList.add("s-products-list-item-selected")):(this.selectedProducts.delete(t.id),s?.classList.remove("s-products-list-item-selected")),this.emitSelection()}emitSelection(){const t=Array.from(this.selectedProducts.values()),s=Array.from(this.selectedProducts.keys()),i={ids:s,products:t,count:s.length};this.selectionChanged.emit(i),salla.event.emit("salla-products-list::selection.changed",i)}onSelectableChanged(t,s){t!==s&&this.isReady&&this.wrapper&&(t||(this.selectedProducts.clear(),this.emitSelection()),this.reload())}applyLandingPageStyles(t){"landing-page"!==this.getSource()||this.hasCustomComponent||(t.toggleAttribute("hide-add-btn",!0),t.classList.add("s-product-card-fit-height"))}applyHorizontalCardStyles(t){this.horizontalCards&&(t.toggleAttribute("horizontal",!0),this.hasCustomComponent||t.toggleAttribute("shadow-on-hover",!0))}waitForResizing(t){let s=null;return new Promise((i=>{const e=new ResizeObserver((()=>{clearTimeout(s),s=setTimeout((()=>{e.disconnect(),i(null)}),160)}));e.observe(t)}))}waitForLayoutStable(t){let s=null;return new Promise((i=>{const e=new MutationObserver((()=>{clearTimeout(s),s=setTimeout((()=>{e.disconnect(),i(null)}),160)}));e.observe(t,{childList:!0,subtree:!0,attributes:!0})}))}async waitForStableLayout(t){return await Promise.allSettled([this.waitForResizing(t),this.waitForLayoutStable(t)])}scrollToLastViewedProduct(){const t=sessionStorage.getItem(this.lastViewedProductKey);t&&!salla.url.is_page("product.single")&&this.isElementLoaded(`[id*="${t}"]`).then((()=>{const s=this.wrapper?.querySelector(`[id*="${t}"]`);if(!s)return;const i=()=>{const t=()=>{s.scrollIntoView({block:"start",behavior:"instant"});const t=matchMedia("(max-width: 1024px)").matches?"header .inner":"ul.main-menu",i=window?.header_is_sticky?document.querySelector(t)?.getBoundingClientRect()?.height??56:0,e=parseInt(getComputedStyle(this.wrapper).rowGap)??16;scrollBy({top:-1*(i+e),behavior:"instant"})};requestAnimationFrame(t),s.querySelectorAll("img.lazy").forEach((s=>{const i=s,e=()=>{requestAnimationFrame(t),i.onload=i.onerror=null};i.onload=e,i.onerror=e})),this.removeScrollRestorationSession()};this.waitForStableLayout(this.host).then((()=>requestAnimationFrame(i)))}))}isElementLoaded(t){return new Promise((s=>{const i=setInterval((()=>{if(document.querySelector(t))return clearInterval(i),s(document.querySelector(t))}),50)}))}takeStateSnapshot(){const t=[];for(let s=0;s<this.wrapper.children.length;s++){const i=this.wrapper.children?.[s];t.push(i.product)}const s={pageIndex:Math.max((this.infiniteScroll?.pageIndex??1)-1,1),nextPage:this.nextPage,currentPageData:t};if(this.isFilterable()){const t=sessionStorage.getItem(this.filtersKey);sessionStorage.setItem(this.filtersKey,t||JSON.stringify(this.filtersSnapshot))}sessionStorage.setItem(this.infiniteScrollStateKey,JSON.stringify(s));let i=salla.config.get("page.id");const e=Object.keys(this.specialPagesWithoutIds).find((t=>salla.url.is_page(t)));e?i=this.specialPagesWithoutIds[e]:null!==i&&(i=String(i)),sessionStorage.setItem(this.prevCategoryIdKey,i)}removeScrollRestorationSession(){this.isFilterable()||sessionStorage.removeItem(this.filtersKey),sessionStorage.removeItem(this.infiniteScrollStateKey),sessionStorage.removeItem(this.lastViewedProductKey),sessionStorage.removeItem(this.prevCategoryIdKey)}loadStoredScrollState(){const t=sessionStorage.getItem(this.infiniteScrollStateKey),s=sessionStorage.getItem(this.filtersKey),i=sessionStorage.getItem(this.prevCategoryIdKey),e=this.specialPagesWithoutIds[salla.config.get("page.slug")]||null,r=salla.config.get("page.id"),o=salla.url.is_page("index"),a=salla.url.is_page("product.single"),l=e?i!==e:i!==String(r);if(i&&l&&!o&&!a||o&&!this.hasInfiniteScroll)return this.removeScrollRestorationSession(),this.switchToNormalBehavior=!0,!1;if(a)return this.switchToNormalBehavior=!0,!1;if(t)try{const{pageIndex:i,nextPage:e,currentPageData:r}=JSON.parse(t);if(s&&"undefined"!==s){const t=JSON.parse(s);this.filtersSnapshot=JSON.parse(JSON.stringify(t)),salla.event.emit("filters::fetched",{filters:t})}this.page=i,this.nextPage=e;for(let t=0;t<r.length;t++)this.wrapper.append(this.getItemHTML(r?.[t]));return!0}catch(t){console.error("Failed to load stored scroll state:",t),this.removeScrollRestorationSession()}return!1}getSource(){return l.getProductsSource(this.source)}isAuxiliaryProductsListSource(){return["json","selected","related","landing-page","recently"].includes(this.getSource())}getSourceValue(){if("wishlist"===this.getSource()){const t=new URLSearchParams(window.location.search),s=t.getAll("source_value[]").length?t.getAll("source_value[]"):t.getAll("source_value");if(s.length)return s}return this.currentCategoryIdFilter?this.currentCategoryIdFilter:l.getProductsSourceValue(this.source,this.sourceValue)}logFetchError(t,s,i,e,r){try{const o=r&&"object"==typeof r?r:null,a=this.getSourceValue();salla.analytics?.log("salla::products.list.fetch.error",{errorPhase:t,source:this.getSource(),sourceValue:"string"==typeof a&&a.length>200?`${a.slice(0,200)}…`:Array.isArray(a)?{length:a.length}:a,pageIndex:this.infiniteScroll?.pageIndex,fetchPath:i,httpStatus:e?.status,httpStatusText:e?.statusText,responseUrl:e?.url,...o&&{dataCount:Array.isArray(o.data)?o.data.length:void 0,responseKeys:Object.keys(o).slice(0,15),filtersCount:Array.isArray(o.filters)?o.filters.length:void 0},errorMessage:s instanceof Error?s.message:String(s),..."processing"===t&&s instanceof Error&&s.stack?{errorStack:s.stack.slice(0,500)}:{}})}catch{}}appendDataLayer(t){"object"==typeof dataLayer&&Array.isArray(dataLayer)&&dataLayer.push({event:"impressions",ecommerce:{currencyCode:salla.config.currency().code,impressions:t.map(((t,s)=>({id:t.id,name:t.name,price:t.price,brand:t.brand?.name||"",quantity:t.quantity,categories:[{name:t.category?.name||salla.config.get("page.title"),id:salla.config.get("page.id")}],category:t.category?.name||salla.config.get("page.title"),position:s+1})))}})}initiateInfiniteScroll(){if(!this.hasInfiniteScroll)return;const t=this.autoload&&this.includes&&this.includes.length>0;this.infiniteScroll=salla.infiniteScroll.initiate(this.wrapper,this.wrapper,{path:()=>this.nextPage,history:!1,nextPage:this.nextPage,scrollThreshold:!t&&!!this.autoload&&100,loadOnScroll:!t&&this.autoload},!0),this.infiniteScroll.pageIndex=this.page,this.infiniteScroll?.on("request",(()=>{this.loading(!0,!this.autoload)})),t&&window.addEventListener("scroll",this.boundHandleScroll),this.infiniteScroll?.on("load",(async(t,s,i)=>{if(!this.isProcessing){this.isProcessing=!0;try{if(!t.data?.length&&2===this.infiniteScroll.pageIndex)return this.showPlaceholder=!0,salla.infiniteScroll.destroy(this.infiniteScroll),this.loading(!1),void(this.placeholderLoader&&this.placeholderLoader.remove());this.includes&&await this.injectAndProcessData(t);const s=await this.handleResponse(t);this.infiniteScroll.appendItems(s),2===this.infiniteScroll.pageIndex&&(!this.autoload&&this.nextPage&&(this.loadMoreWrapper.style.display="block"),this.animateItems())}catch(e){console.error("Error during load:",e),this.logFetchError("processing",e,"string"==typeof s?s:void 0,i,t)}finally{this.isProcessing=!1}}})),this.infiniteScroll?.on("error",((t,s,i)=>{const e=i;this.status.querySelector(".s-infinite-scroll-error").classList.remove("s-hidden"),this.placeholderLoader&&this.placeholderLoader.remove(),this.loading(!1),this.isProcessing=!1,this.logFetchError("fetch",t,s,e)})),salla.onReady((()=>{sessionStorage.getItem(this.infiniteScrollStateKey)||this.manualLoadNextPage()}))}handleScroll(){this.isProcessing||this.scrollTimeout||(this.scrollTimeout=setTimeout((()=>{this.scrollTimeout=null,requestAnimationFrame((()=>{const t=this.wrapper.getBoundingClientRect(),s=window.innerHeight;t.bottom-s<=200&&!this.isProcessing&&this.nextPage&&this.manualLoadNextPage()}))}),200))}manualLoadNextPage(){this.nextPage&&this.infiniteScroll.loadNextPage()}async applyBeforeBuildListUrl(t){try{const s={component:this,url:t};return await salla.hooks.call("salla-products-list","beforeBuildListUrl",s),s.url}catch(s){return salla.logger.warn("beforeBuildListUrl hook failed",s?.message),t}}async resolveNextPageFromCursor(t){return t.cursor?t.cursor.next?await this.applyBeforeBuildListUrl(t.cursor.next):t.cursor.next:this.nextPage}async injectAndProcessData(t){try{await l.injectExtraFieldsToResponse(t)}catch(t){console.error("Error injecting data:",t)}}getInitialData(){return this.loading(),salla.api.withoutNotifier((()=>salla.product.api.fetch({source:l.getApiSource(this.getSource()),source_value:this.getSourceValue(),limit:this.limit}).then((async t=>t.data.length?(await l.injectExtraFieldsToResponse(t),this.firstPageResponse?void(await this.handleResponse(t)).forEach((t=>this.wrapper.append(t))):(this.firstPageResponse=t,void(this.nextPage=await this.resolveNextPageFromCursor(t)))):(this.showPlaceholder=!0,this.placeholderLoader&&this.placeholderLoader.remove(),void this.loading(!1))))))}async loadMore(){this.infiniteScroll?.loadNextPage()}async getSelected(){return{ids:Array.from(this.selectedProducts.keys()),products:Array.from(this.selectedProducts.values())}}async getLoadedProducts(){const t=[];if(!this.wrapper)return t;for(let s=0;s<this.wrapper.children.length;s++){const i=this.wrapper.children[s];i?.product&&t.push(i.product)}return t}async selectAll(){if(this.selectable&&this.wrapper){for(let t=0;t<this.wrapper.children.length;t++){const s=this.wrapper.children[t];if(s?.product){this.selectedProducts.set(s.product.id,s.product),s.classList.add("s-products-list-item-selected");const t=s.querySelector(".s-products-list-select-checkbox");t&&(t.checked=!0)}}this.emitSelection()}}async clearSelection(){this.selectedProducts.clear(),this.wrapper&&(this.wrapper.querySelectorAll(".s-products-list-select-checkbox").forEach((t=>t.checked=!1)),this.wrapper.querySelectorAll(".s-products-list-item-selected").forEach((t=>t.classList.remove("s-products-list-item-selected")))),this.emitSelection()}componentWillLoad(){return salla.onReady().then((async()=>{this.hasCustomComponent=!!customElements.get(this.productCardComponent),this.sourceValueIsValid=!(!this.getSourceValue()&&!this.isSourceWithoutValue()),this.hasInfiniteScroll=!this.isAuxiliaryProductsListSource()&&!this.limit;let t=new URLSearchParams(window.location.search);try{this.sortBy=this.sortBy||t.get("sort")||t.get("by"),this.parsedFilters=l.extractFiltersFromUrl(t),this.parsedFilters&&this.parsedFilters.category_id&&(this.currentCategoryIdFilter=[this.parsedFilters.category_id])}catch(t){salla.logger.warn("failed to get filters from url",t.message)}if(await this.buildNextPageUrl(),this.isReady=!0,!sessionStorage.getItem(this.infiniteScrollStateKey))if(this.sourceValueIsValid){if(!this.hasInfiniteScroll){if("json"===this.getSource())return this.getSourceValue().length?void setTimeout((()=>{this.getSourceValue().map((t=>this.wrapper.append(this.getItemHTML(t))))})):void(this.showPlaceholder=!0);if("selected"!==this.getSource()||this.getSourceValue().length)return this.getInitialData();this.showPlaceholder=!0}}else salla.logger.warn(`source-value prop is required for source [${this.getSource()}]`)}))}async componentDidLoad(){this.hasInfiniteScroll&&this.init(),await Salla.hooks.registerComponent("salla-products-list",this),this.loadStoredScrollState()?(this.autoload?!this.nextPage&&this.loading(!1):this.nextPage?this.loadMoreWrapper&&(this.loadMoreWrapper.style.display="block"):(this.loadMoreWrapper&&(this.loadMoreWrapper.style.display="none"),this.status.querySelector(".s-infinite-scroll-last").classList.remove("s-hidden")),this.scrollToLastViewedProduct()):!this.firstPageResponse&&this.switchToNormalBehavior?this.getInitialData().then((async()=>{this.firstPageResponse?((await this.handleResponse(this.firstPageResponse,!1)).forEach((t=>{this.wrapper.append(t)})),setTimeout((()=>{if(!this.autoload&&this.nextPage&&1==this.infiniteScroll.pageIndex){const t=this.host.querySelector(".s-infinite-scroll-wrapper");t&&(t.style.display="block")}}))):console.error("No response received after getInitialData.")})).catch((t=>{console.error("Error during initial data fetch:",t)})):this.firstPageResponse&&(await this.handleResponse(this.firstPageResponse,!1)).forEach((t=>this.wrapper.append(t)))}canRender(){return this.sourceValueIsValid&&this.isReady}render(){return this.canRender()?this.showPlaceholder?i("div",{class:"s-products-list-placeholder"},i("span",{innerHTML:a}),i("p",null,this.placeholderText)):i(e,{class:"s-products-list"},i("div",{class:{"s-products-list-wrapper":!0,"s-products-list-horizontal-cards":this.horizontalCards&&!this.filtersResults,"s-products-list-vertical-cards":!this.horizontalCards&&!this.rowCards&&!this.filtersResults,"s-products-list-row-cards":this.rowCards,"s-products-list-compact-cards":this.compactCards,"s-products-list-filters-results":this.filtersResults},ref:t=>this.wrapper=t}),i("div",{class:"s-infinite-scroll-status",ref:t=>this.status=t},i("p",{class:"s-infinite-scroll-last infinite-scroll-last s-hidden"},this.endOfText),i("p",{class:"s-infinite-scroll-error infinite-scroll-error s-hidden"},this.failedLoadMore)),this.autoload&&i("div",{class:"s-products-list-loading-wrapper",style:{display:"none"},ref:t=>this.loader=t},i("span",{class:"s-button-loader s-button-loader-center s-infinite-scroll-btn-loader"})),this.hasInfiniteScroll&&this.nextPage&&!this.autoload?i("div",{class:"s-infinite-scroll-wrapper",style:{display:"none"},ref:t=>this.loadMoreWrapper=t},i("button",{onClick:()=>this.loadMore(),class:"s-infinite-scroll-btn s-button-btn s-button-primary"},i("span",{class:"s-button-text s-infinite-scroll-btn-text"},this.loadMoreText?this.loadMoreText:salla.lang.get("common.elements.load_more")),i("span",{class:"s-button-loader s-button-loader-center s-infinite-scroll-btn-loader",ref:t=>this.btnLoader=t,style:{display:"none"}}))):""):""}init(){this.initiateInfiniteScroll(),this.loading()}async handleResponse(t,s=!0){if(!t)return[];let i=this.getSource();if(1===t.cursor?.current){if(!this.isAuxiliaryProductsListSource()){let s=l.getPageTitleForSource(i);try{if("search"===this.getSource())s=salla.lang.get("common.elements.search_about",{word:this.getSourceValue()});else if(!s){let i=this.parsedFilters.category_id||this.getSourceValue()[0];s=t.filters?.find((t=>"category_id"===t.key))?.values?.find((t=>t.key===i))?.value??""}s+=(s?" - ":"")+salla.lang.choice("blocks.header.products_count",t.data?.length),15===t.data.length&&(s=s.replace(t.data.length,salla.lang.get("common.elements.more_than")+" "+t.data.length)),t.title=s}catch(t){salla.logger.error("Error::falid to handle response",t)}}l.generateProductSchema(t.data)}this.appendDataLayer(t.data),t.nextPage=this.nextPage,t.source=this.getSource(),t.sourceValue=this.getSourceValue(),salla.event.emit("salla-products-list::products.fetched",t),this.productsFetched.emit(t),this.emitFilters(t),s&&(this.nextPage=await this.resolveNextPageFromCursor(t)),this.loading(!1),this.placeholderLoader&&this.placeholderLoader.remove(),this.hasInfiniteScroll&&!this.nextPage&&(this.infiniteScroll.option({scrollThreshold:!1,loadOnScroll:!1}),this.status.querySelector(".s-infinite-scroll-last").classList.remove("s-hidden"));const e=[];for(let s=0;s<t.data.length;s++)e.push(this.getItemHTML(t.data?.[s]));return e}get host(){return r(this)}static get watchers(){return{selectable:["onSelectableChanged"]}}};n.style='.s-products-list-selectable-item{position:relative;border-radius:0.5rem;transition:box-shadow 0.15s ease-in-out}.s-products-list-item-selected{box-shadow:0 0 0 2px var(--color-primary)}.s-products-list-select-control{position:absolute;top:10px;inset-inline-start:10px;z-index:5;display:inline-flex;align-items:center;justify-content:center;cursor:pointer}.s-products-list-select-checkbox{appearance:none;-webkit-appearance:none;-moz-appearance:none;position:relative;width:22px;height:22px;margin:0;cursor:pointer;color:var(--color-primary);border:1px solid rgba(0, 0, 0, 0.15);border-radius:6px;background-color:#fff;box-shadow:0 1px 3px rgba(0, 0, 0, 0.2);transition:background-color 0.15s ease-in-out, border-color 0.15s ease-in-out}.s-products-list-select-checkbox:hover{border-color:var(--color-primary)}.s-products-list-select-checkbox:focus,.s-products-list-select-checkbox:focus-visible{outline:none;border-color:var(--color-primary);box-shadow:0 1px 3px rgba(0, 0, 0, 0.2), 0 0 0 3px color-mix(in srgb, var(--color-primary) 30%, transparent)}.s-products-list-select-checkbox:checked,.s-products-list-select-checkbox:checked:hover,.s-products-list-select-checkbox:checked:focus{background-color:var(--color-primary);border-color:var(--color-primary)}.s-products-list-select-checkbox:checked::after{content:"";position:absolute;top:50%;left:50%;width:5px;height:10px;border:solid #fff;border-width:0 2px 2px 0;transform:translate(-50%, -60%) rotate(45deg)}.s-products-list-row-cards .s-products-list-select-control{top:50%;inset-inline-start:14px;transform:translateY(-50%)}.s-products-list-row-cards .s-products-list-selectable-item>:not(.s-products-list-select-control){padding-inline-start:2.75rem}';export{n as salla_products_list}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as s,h as t,H as e}from"./p-
|
|
4
|
+
import{r as s,h as t,H as e}from"./p-BFfD9GlY.js";import{S as l}from"./p-BscTeWDc.js";var i;!function(s){s.DEFAULT="default",s.AVAILABILITY="availability"}(i||(i={}));const a=class{constructor(t){s(this,t),this.loadedScopes={[i.DEFAULT]:null,[i.AVAILABILITY]:null},this.translationLoaded=!1,this.mode=i.DEFAULT,this.scopes=[],this.originalScopesList=[],this.isOpenedBefore=salla.storage.get("branch-choosed-before"),this.hasError=!1,this.loading=!1,this.selection="optional",this.searchDisplayLimit=6,this.getFormTitle=()=>{if(this.originalScopesList?.length<2)return"";const s=salla.config.get("store.features")?.includes("multi-countries");return this.mode===i.DEFAULT?salla.lang.get(s?"blocks.scope.shopping_from_another_market":"blocks.scope.shopping_from_another_branch"):salla.lang.get("blocks.scope.search_for_availability_in_other_branches")},salla.event.on("scopes::open",(({mode:s=null,product_id:t=null}={})=>{this.open(s,t)})),salla.lang.onLoaded((()=>{this.translationLoaded=!0}))}get isNativeApp(){return!!salla.mobile?.isSpaWebview?.()}async close(){return await(this.modal?.close())}async open(s=i.DEFAULT,t=null){return this.isNativeApp?(salla.log("SallaScope:: delegated open to native app"),void salla.mobile?.openScopes?.()):(this.hasError=!1,this.mode=[i.AVAILABILITY,i.DEFAULT].includes(s)?s:i.DEFAULT,this.loading=!this.loadedScopes[this.mode],this.setScopeValues([]),salla.log("SallaScope:: opened"),this.modal.open(),this.loading?await salla.api.withoutNotifier((()=>s==i.AVAILABILITY?salla.scope.getProductAvailability(t):salla.scope.get())).then((t=>{if(s==i.AVAILABILITY)return this.setScopeValues(this.loadedScopes[i.AVAILABILITY]=t.data);this.setScopeValues(this.loadedScopes[this.mode]=t.data.scopes)})).catch((s=>{console.log(s),this.hasError=!0})).finally((()=>{this.modal.stopLoading(),this.loading=!1})):(this.setScopeValues(this.loadedScopes[this.mode]),this.modal.stopLoading()))}async handleSubmit(){let s={id:this.current_scope.id};return this.changeBtn.load(),await salla.scope.change(s).then((()=>{salla.storage.set("branch-choosed-before",!0),salla.storage.set("scope",{type:this.current_scope.type,id:this.current_scope.id}),salla.cart.reset(),window.location.replace(salla.helpers.addParamToUrl("scope",this.current_scope.id))})).catch((s=>console.log(s))).finally((()=>{this.changeBtn.stop()}))}setScopeValues(s){this.scopes=s,this.originalScopesList=s,1==s?.length?(this.current_scope=s[0],this.selected_scope=s[0],this.scopes=[s[0]]):(this.current_scope=s?.find((s=>s.selected)),this.selected_scope=s?.find((s=>s.selected)))}handleSearchFieldTyping(s){let t=s.target.value.toLocaleLowerCase();this.scopes=t?this.originalScopesList.filter((s=>s.name.toLowerCase().includes(t))):this.originalScopesList}handleScopeSelection(s){this.current_scope=this.scopes?.find((t=>t.id==s.target.value))}placeholderContent(){return t("salla-placeholder",{alignment:"center",class:"s-scopes-placeholder"},t("span",{slot:"title"},salla.lang.get("blocks.scope.branch_looking_for_not_found")),t("span",{slot:"description"},salla.lang.get("blocks.scope.our_services_not_available_in_this_branch")))}defaultContent(){return[t("div",{class:"s-scopes-container s-scrollbar"},this.scopes?.map((s=>t("div",{class:"s-scopes-input-wrap","data-selection":this.selection},t("input",{id:`${this.selection} + '_scope_' + ${s.id}`,name:"lang",type:"radio",value:s.id,onChange:s=>this.handleScopeSelection(s),class:"s-scopes-input",checked:!!this.current_scope&&this.current_scope.id==s.id}),t("label",{htmlFor:`${this.selection} + '_scope_' + ${s.id}`,class:"s-scopes-label s-scopes-clickable"},t("span",null,s.name)))))),this.footerContent()]}availabilityContent(){return t("div",{class:"s-scopes-container"},this.scopes?.map((s=>t("div",{class:"s-scopes-input-wrap","data-selection":this.selection},t("h2",{class:{"s-scopes-label":!0,"s-scopes-clickable":this.mode===i.DEFAULT}},t("span",null,s.name)),t("h2",{style:{color:s?.availability?.color},class:`s-scopes-${s?.availability?.key}`},s?.availability?.label)))))}footerContent(){return t("div",{class:"s-scopes-footer"},t("slot",{name:"footer"},t("salla-button",{ref:s=>this.changeBtn=s,disabled:!this.current_scope,onClick:()=>this.handleSubmit(),class:"s-scopes-submit","loader-position":"center",width:"wide"},salla.lang.get("common.elements.confirm"))))}componentWillLoad(){return salla.onReady()}render(){return this.isNativeApp?null:t(e,null,t("salla-modal",{ref:s=>this.modal=s,isClosable:!(!this.isOpenedBefore&&"optional"!=this.selection),class:"s-scopes-modal",isLoading:this.loading,"has-skeleton":!0},this.loading?t("div",{slot:"loading"},t("div",{class:"s-scopes-skeleton"},t("salla-list-tile",{class:"s-scopes-header"},t("div",{slot:"icon",class:"s-scopes-header-icon"},t("salla-skeleton",{type:"circle"})),t("div",{slot:"title",class:"s-scopes-header-title mb-5"},t("salla-skeleton",{height:"15px",width:"50%"})),t("div",{slot:"subtitle",class:"s-scopes-header-subtitle"},t("salla-skeleton",{height:"10px"}),t("salla-skeleton",{height:"10px",width:"75%"}))),t("div",{class:"s-scopes-skeleton-search"},t("salla-skeleton",{height:"10px",width:"50%"}),t("salla-skeleton",{height:"30px",width:"100%"})),t("div",{class:"s-scopes-skeleton-scopes"},t("salla-skeleton",{height:"10px",width:"30%"}),t("salla-skeleton",{height:"10px",width:"25%"}),t("salla-skeleton",{height:"10px",width:"30%"}),t("salla-skeleton",{height:"10px",width:"25%"}),t("salla-skeleton",{height:"10px",width:"30%"}),t("salla-skeleton",{height:"10px",width:"25%"}),t("salla-skeleton",{height:"10px",width:"30%"}),t("salla-skeleton",{height:"10px",width:"25%"})),t("div",{class:"s-scopes-skeleton-btn"},t("salla-skeleton",{height:"40px",width:"100%"})))):[t("salla-list-tile",{class:this.originalScopesList?.length?"s-scopes-header block":"s-hidden"},t("div",{slot:"icon",class:"s-scopes-header-icon",innerHTML:'\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>store-alt</title>\n<path d="M6.667 24h5.333c0.736 0 1.333-0.596 1.333-1.333s-0.597-1.333-1.333-1.333h-5.333c-0.736 0-1.333 0.596-1.333 1.333s0.597 1.333 1.333 1.333zM31.86 10.071l-4-8c-0.227-0.452-0.688-0.737-1.193-0.737h-21.333c-0.505 0-0.967 0.285-1.193 0.737l-4 8c-0.092 0.184-0.14 0.389-0.14 0.596v18.667c0 0.737 0.597 1.333 1.333 1.333h29.333c0.736 0 1.333-0.596 1.333-1.333v-18.667c0-0.207-0.048-0.412-0.14-0.596zM6.157 4h19.685l3.333 6.667h-26.352zM24 28h-5.333v-9.333h5.333zM29.333 28h-2.667v-10.667c0-0.737-0.597-1.333-1.333-1.333h-8c-0.736 0-1.333 0.596-1.333 1.333v10.667h-13.333v-14.667h26.667zM6.667 18.667h5.333c0.736 0 1.333-0.596 1.333-1.333s-0.597-1.333-1.333-1.333h-5.333c-0.736 0-1.333 0.596-1.333 1.333s0.597 1.333 1.333 1.333z"></path>\n</svg>\n'}),t("div",{slot:"title",class:"s-scopes-header-title"},salla.lang.get("blocks.scope.you_are_browse_store_from")),t("div",{slot:"subtitle",class:"s-scopes-header-subtitle"},this.selected_scope?this.selected_scope.name:"")),t("div",{class:"s-scopes-wrap"},!!this.originalScopesList?.length&&t("h4",{class:"s-scopes-title"},this.getFormTitle()),this.originalScopesList?.length>this.searchDisplayLimit?t("div",{class:"s-scopes-search-wrapper"},t("div",{class:"s-scopes-search-icon",innerHTML:l}),t("input",{type:"text",class:"s-scopes-search-input",onInput:s=>this.handleSearchFieldTyping(s),enterkeyhint:"search",placeholder:salla.lang.get("blocks.scope.searching_for_a_branch")})):"",this.hasError||!this.originalScopesList?.length&&this.mode!==i.AVAILABILITY?this.placeholderContent():this.mode===i.DEFAULT?this.defaultContent():this.availabilityContent())]))}async componentDidLoad(){await Salla.hooks.registerComponent("salla-scopes",this),salla.config.isMobileApp()||this.isNativeApp||this.isOpenedBefore||"mandatory"!=this.selection||this.open()}};a.style=".s-scopes-availability-content{display:flex;justify-content:center;align-items:center}.s-scopes-placeholder{flex:0 0 85%}";export{a as salla_scopes}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as e,h as t,H as a}from"./p-
|
|
4
|
+
import{r as e,h as t,H as a}from"./p-BFfD9GlY.js";const s=class{constructor(t){e(this,t),this.href=void 0,this.target="_self"}generateClass(){return{"s-list-tile-item":!0,"s-list-tile-item-href":!!this.href}}render(){return t(a,{key:"2b73681383da172ed01bb199b117d2063228e01e"},t("a",{key:"af5913df51093694667751d16b5ec686103791a4",class:this.generateClass(),href:this.href||"#",target:this.target,"aria-label":"List Tile Link"},t("div",{key:"49fdb468a67f0a015762a1539d2333ad694628ec",class:"s-list-tile-item-icon"},t("slot",{key:"97417d4c9bf63e498510549d08dbf5df55050526",name:"icon"})),t("div",{key:"53544687a14f2c992ad17d0194a10fba0ad40631",class:"s-list-tile-item-content"},t("div",{key:"a8803d707ccd88df74d425a004e5c180d0106c50",class:"s-list-tile-item-title"},t("slot",{key:"27b091e8cf03dc9253baf135bdc6a8166eac566c",name:"title"})),t("div",{key:"c2ab48314fe243e6cea9dd7e8f0be4104a0b89e3",class:"s-list-tile-item-subtitle"},t("slot",{key:"31c7e05be4026e990704926f6b29c8b1e570a548",name:"subtitle"}))),t("div",{key:"4fb89eaad3693b3b49e6d4ac72f09dca7c52eeeb",class:"s-list-tile-item-action"},t("slot",{key:"7e587373e0282a22387028aaa6a801b9909f707a",name:"action"}))))}};s.style="";export{s as salla_list_tile}
|