@salla.sa/twilight-components 2.14.538 → 2.14.539
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-CtSUl5Ct.js → filepond-CIpOpiw6.js} +1 -1
- package/dist/cjs/{filepond-plugin-file-poster-MbB20g2i.js → filepond-plugin-file-poster-CPV_SZrj.js} +1 -1
- package/dist/cjs/{filepond-plugin-file-validate-size-Djvu0kmc.js → filepond-plugin-file-validate-size-C_XGylG1.js} +1 -1
- package/dist/cjs/{filepond-plugin-file-validate-type-D7LBD397.js → filepond-plugin-file-validate-type-CmVS48lk.js} +1 -1
- package/dist/cjs/{filepond-plugin-image-edit-CD_ps_ik.js → filepond-plugin-image-edit-KfqhH5F9.js} +1 -1
- package/dist/cjs/{filepond-plugin-image-exif-orientation-6yimvoyt.js → filepond-plugin-image-exif-orientation-BfRIDxO-.js} +1 -1
- package/dist/cjs/{filepond-plugin-image-preview-B9Co2A29.js → filepond-plugin-image-preview-DlvO4sHZ.js} +1 -1
- package/dist/cjs/{index-CS4z8Mi_.js → index-CMDyFi6Q.js} +2 -2
- package/dist/cjs/{intlTelInput-C2d0ZWHY.js → intlTelInput-BK34b4sR.js} +1 -1
- 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-basket-gap.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 +34 -16
- 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-cart-summary-card.cjs.entry.js +1 -1
- package/dist/cjs/salla-cashback-banner.cjs.entry.js +1 -1
- package/dist/cjs/salla-comment-factors.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_10.cjs.entry.js +1 -1
- package/dist/cjs/salla-loyalty-exchange-product-card.cjs.entry.js +1 -1
- 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.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_2.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-cancel.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_2.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-shipments.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-products-slider.cjs.entry.js +1 -1
- package/dist/cjs/salla-quick-order.cjs.entry.js +1 -1
- package/dist/cjs/salla-rating-modal-v2.cjs.entry.js +1 -1
- package/dist/cjs/salla-rating-modal.cjs.entry.js +1 -1
- package/dist/cjs/salla-review-factors-tags.cjs.entry.js +1 -1
- 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/twilight.cjs.js +1 -1
- package/dist/cjs/{vanilla-picker-CU_KPkZ1.js → vanilla-picker-DYTpjTDj.js} +1 -1
- package/dist/collection/components/salla-bullet-delivery/helpers.js +14 -0
- package/dist/collection/components/salla-bullet-delivery/salla-bullet-delivery.js +20 -16
- package/dist/components/index.js +2 -2
- package/dist/components/salla-bullet-delivery.js +33 -15
- package/dist/esm/{filepond-DPHK5C54.js → filepond-DMUE9Fyj.js} +1 -1
- package/dist/esm/{filepond-plugin-file-poster-d3QMLqXZ.js → filepond-plugin-file-poster-DBZQTm7s.js} +1 -1
- package/dist/esm/{filepond-plugin-file-validate-size-ddyhZs41.js → filepond-plugin-file-validate-size-CrKxdsNW.js} +1 -1
- package/dist/esm/{filepond-plugin-file-validate-type-CJvnicil.js → filepond-plugin-file-validate-type-DvEJrucY.js} +1 -1
- package/dist/esm/{filepond-plugin-image-edit-CkhsRCAn.js → filepond-plugin-image-edit-C6ptCg9o.js} +1 -1
- package/dist/esm/{filepond-plugin-image-exif-orientation-DuQyWmiv.js → filepond-plugin-image-exif-orientation-IcgeTieF.js} +1 -1
- package/dist/esm/{filepond-plugin-image-preview-D7QjrK0d.js → filepond-plugin-image-preview-CDMh74os.js} +1 -1
- package/dist/esm/{index-B8_UK_fg.js → index-CjQzkU95.js} +2 -2
- package/dist/esm/{intlTelInput-B9yY2tRj.js → intlTelInput-Dsx2z7pR.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-basket-gap.entry.js +1 -1
- package/dist/esm/salla-booking-field_7.entry.js +10 -10
- package/dist/esm/salla-bullet-delivery_2.entry.js +34 -16
- 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-cart-summary-card.entry.js +1 -1
- package/dist/esm/salla-cashback-banner.entry.js +1 -1
- package/dist/esm/salla-comment-factors.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_10.entry.js +1 -1
- package/dist/esm/salla-loyalty-exchange-product-card.entry.js +1 -1
- 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.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_2.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-cancel.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_2.entry.js +1 -1
- package/dist/esm/salla-order-shipments.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-products-slider.entry.js +1 -1
- package/dist/esm/salla-quick-order.entry.js +1 -1
- package/dist/esm/salla-rating-modal-v2.entry.js +1 -1
- package/dist/esm/salla-rating-modal.entry.js +1 -1
- package/dist/esm/salla-review-factors-tags.entry.js +1 -1
- 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/twilight.js +2 -2
- package/dist/esm/{vanilla-picker-BSz2-wvu.js → vanilla-picker-oYjMgYry.js} +1 -1
- package/dist/twilight/{p-16d9d755.entry.js → p-0a1271e1.entry.js} +1 -1
- package/dist/twilight/{p-2f3d4e4e.entry.js → p-1151ebd7.entry.js} +1 -1
- package/dist/twilight/{p-9be6697f.entry.js → p-116e7555.entry.js} +1 -1
- package/dist/twilight/{p-50a22b2c.entry.js → p-1470e96a.entry.js} +1 -1
- package/dist/twilight/{p-dbe69b54.entry.js → p-14c72ffd.entry.js} +1 -1
- package/dist/twilight/{p-02bbd257.entry.js → p-152c657e.entry.js} +1 -1
- package/dist/twilight/{p-e491102e.entry.js → p-1754903f.entry.js} +1 -1
- package/dist/twilight/{p-8bf0cc70.entry.js → p-187a502c.entry.js} +1 -1
- package/dist/twilight/{p-e0e7454d.entry.js → p-1c31cec0.entry.js} +1 -1
- package/dist/twilight/{p-d7392ff8.entry.js → p-1c369bcf.entry.js} +1 -1
- package/dist/twilight/{p-1dfa3b27.entry.js → p-1d2804ac.entry.js} +1 -1
- package/dist/twilight/{p-00ce360c.entry.js → p-1dd1fef0.entry.js} +1 -1
- package/dist/twilight/{p-b078ccc9.entry.js → p-1fb46b43.entry.js} +1 -1
- package/dist/twilight/{p-a337f80b.entry.js → p-236f371d.entry.js} +1 -1
- package/dist/twilight/{p-054f3d0b.entry.js → p-250d7ab2.entry.js} +1 -1
- package/dist/twilight/{p-da4b3ba6.entry.js → p-27a0a4cc.entry.js} +1 -1
- package/dist/twilight/{p-85345231.entry.js → p-298ff716.entry.js} +1 -1
- package/dist/twilight/{p-b3e8b4d9.entry.js → p-2babb4bd.entry.js} +1 -1
- package/dist/twilight/{p-3d511460.entry.js → p-2c6c0844.entry.js} +1 -1
- package/dist/twilight/{p-d1e84f6b.entry.js → p-2e112687.entry.js} +1 -1
- package/dist/twilight/{p-3b5cc06e.entry.js → p-2e43ddf0.entry.js} +1 -1
- package/dist/twilight/{p-3c98087c.entry.js → p-3052178c.entry.js} +1 -1
- package/dist/twilight/{p-78b7cb89.entry.js → p-31c36417.entry.js} +1 -1
- package/dist/twilight/{p-68f2e246.entry.js → p-331679d8.entry.js} +1 -1
- package/dist/twilight/{p-2b70199f.entry.js → p-37413a02.entry.js} +1 -1
- package/dist/twilight/{p-7591fcad.entry.js → p-3b6b3c54.entry.js} +1 -1
- package/dist/twilight/{p-d9e7120d.entry.js → p-3bc64439.entry.js} +1 -1
- package/dist/twilight/{p-cd1d84e9.entry.js → p-3bdba697.entry.js} +1 -1
- package/dist/twilight/{p-d176de00.entry.js → p-3c22551b.entry.js} +1 -1
- package/dist/twilight/{p-73cd41fa.entry.js → p-3f26f1c5.entry.js} +1 -1
- package/dist/twilight/{p-314aaef4.entry.js → p-40217fcc.entry.js} +1 -1
- package/dist/twilight/{p-dd24b858.entry.js → p-4058b619.entry.js} +1 -1
- package/dist/twilight/{p-f2bbeed7.entry.js → p-437fe6f1.entry.js} +1 -1
- package/dist/twilight/{p-45413551.entry.js → p-44cfb2c2.entry.js} +1 -1
- package/dist/twilight/{p-4e76cc16.entry.js → p-4868c03c.entry.js} +1 -1
- package/dist/twilight/{p-cde03bb7.entry.js → p-48db7b95.entry.js} +1 -1
- package/dist/twilight/{p-ed5031aa.entry.js → p-49e6fe86.entry.js} +1 -1
- package/dist/twilight/{p-5b78ff50.entry.js → p-51a860bc.entry.js} +1 -1
- package/dist/twilight/{p-d5f63b95.entry.js → p-54d0db9a.entry.js} +1 -1
- package/dist/twilight/{p-249fb9a3.entry.js → p-58184ae2.entry.js} +1 -1
- package/dist/twilight/{p-a768e51b.entry.js → p-5b03dca8.entry.js} +1 -1
- package/dist/twilight/{p-563eb741.entry.js → p-5bbf829e.entry.js} +1 -1
- package/dist/twilight/{p-c3c48232.entry.js → p-5d01f25c.entry.js} +1 -1
- package/dist/twilight/{p-5684d0f8.entry.js → p-5e9fb02d.entry.js} +1 -1
- package/dist/twilight/{p-78c4d093.entry.js → p-664f0936.entry.js} +1 -1
- package/dist/twilight/{p-0ea80795.entry.js → p-665bca88.entry.js} +1 -1
- package/dist/twilight/{p-37bf885e.entry.js → p-67e88dc4.entry.js} +1 -1
- package/dist/twilight/{p-1a7af76b.entry.js → p-68c8772a.entry.js} +1 -1
- package/dist/twilight/{p-63cae95d.entry.js → p-699bea26.entry.js} +1 -1
- package/dist/twilight/{p-4207c1a3.entry.js → p-6ed4c9bb.entry.js} +1 -1
- package/dist/twilight/{p-306890a8.entry.js → p-7c74dc6e.entry.js} +1 -1
- package/dist/twilight/{p-a741ac5e.entry.js → p-7f73ff43.entry.js} +1 -1
- package/dist/twilight/{p-86a361e4.entry.js → p-80ff5572.entry.js} +1 -1
- package/dist/twilight/{p-56d5e4c7.entry.js → p-8230c543.entry.js} +6 -6
- package/dist/twilight/{p-9830acfc.entry.js → p-82c12191.entry.js} +1 -1
- package/dist/twilight/{p-d3eebc36.entry.js → p-84f35767.entry.js} +1 -1
- package/dist/twilight/{p-f663b4a4.entry.js → p-8ae7bf96.entry.js} +1 -1
- package/dist/twilight/{p-6dde9e14.entry.js → p-8bce41c8.entry.js} +1 -1
- package/dist/twilight/{p-0f23ae67.entry.js → p-8ef3693b.entry.js} +1 -1
- package/dist/twilight/{p-5bf27714.entry.js → p-8fa84b87.entry.js} +1 -1
- package/dist/twilight/{p-361ceb35.entry.js → p-91b4a1a0.entry.js} +1 -1
- package/dist/twilight/{p-99b70539.entry.js → p-997c4966.entry.js} +1 -1
- package/dist/twilight/{p-526a826c.entry.js → p-9b6db6a7.entry.js} +1 -1
- package/dist/twilight/{p-25d06ec0.entry.js → p-9c7fcbb0.entry.js} +1 -1
- package/dist/twilight/{p-0b2c0f48.entry.js → p-9fa351ab.entry.js} +1 -1
- package/dist/twilight/{p-DaamyJSZ.js → p-B9VKgTTF.js} +1 -1
- package/dist/twilight/{p-C6ayRPtn.js → p-BiyhYWus.js} +1 -1
- package/dist/twilight/{p-D6fzhuhC.js → p-BtymczNp.js} +1 -1
- package/dist/twilight/{p-0_ExyxPG.js → p-C1wu6qA1.js} +1 -1
- package/dist/twilight/{p-nuG4txey.js → p-C6w35AiQ.js} +1 -1
- package/dist/twilight/{p-BCXr9HaJ.js → p-CGDRqU6i.js} +2 -2
- package/dist/twilight/{p-B8_UK_fg.js → p-CjQzkU95.js} +1 -1
- package/dist/twilight/{p-BWIa_6im.js → p-CmQyEOxJ.js} +1 -1
- package/dist/twilight/{p-DIjxGw7w.js → p-D2uiOzVz.js} +1 -1
- package/dist/twilight/{p-DDGtN95g.js → p-DfJdKB52.js} +1 -1
- package/dist/twilight/{p-84a2bf28.entry.js → p-a1494e64.entry.js} +1 -1
- package/dist/twilight/{p-5a893b7d.entry.js → p-a3f00389.entry.js} +1 -1
- package/dist/twilight/{p-5690d7cd.entry.js → p-a669483e.entry.js} +1 -1
- package/dist/twilight/{p-15edaa75.entry.js → p-a802826b.entry.js} +1 -1
- package/dist/twilight/{p-da7ae476.entry.js → p-ae536a61.entry.js} +1 -1
- package/dist/twilight/{p-3eb3acd1.entry.js → p-aeb76c46.entry.js} +1 -1
- package/dist/twilight/{p-fb97a82d.entry.js → p-b0e86201.entry.js} +1 -1
- package/dist/twilight/{p-fdbdc8f3.entry.js → p-b1812d5c.entry.js} +1 -1
- package/dist/twilight/{p-3aaa53c0.entry.js → p-b193c991.entry.js} +1 -1
- package/dist/twilight/{p-05055aa6.entry.js → p-b3fe5e44.entry.js} +1 -1
- package/dist/twilight/{p-b4418299.entry.js → p-b69e98a8.entry.js} +1 -1
- package/dist/twilight/{p-837ebad8.entry.js → p-bbe79568.entry.js} +1 -1
- package/dist/twilight/{p-3a1c360f.entry.js → p-bf183f3a.entry.js} +1 -1
- package/dist/twilight/{p-9dfaa3ed.entry.js → p-c254b6fa.entry.js} +1 -1
- package/dist/twilight/{p-c4362957.entry.js → p-cb179aba.entry.js} +1 -1
- package/dist/twilight/{p-ae05ee76.entry.js → p-cc2b960c.entry.js} +1 -1
- package/dist/twilight/{p-a667842e.entry.js → p-db02986a.entry.js} +1 -1
- package/dist/twilight/{p-45cae5c6.entry.js → p-dd5800dd.entry.js} +1 -1
- package/dist/twilight/{p-bf58de87.entry.js → p-e020f1c3.entry.js} +1 -1
- package/dist/twilight/{p-0dca6c20.entry.js → p-e701a3dc.entry.js} +1 -1
- package/dist/twilight/{p-69c3b48c.entry.js → p-f1eebeda.entry.js} +1 -1
- package/dist/twilight/{p-c22173bf.entry.js → p-f4bdf19e.entry.js} +1 -1
- package/dist/twilight/{p-933a4956.entry.js → p-f7298462.entry.js} +1 -1
- package/dist/twilight/{p-5a473895.entry.js → p-fa28a89f.entry.js} +1 -1
- package/dist/twilight/{p-eb6ef0b8.entry.js → p-faaf4423.entry.js} +1 -1
- package/dist/twilight/{p-af34df62.entry.js → p-fe7990b7.entry.js} +1 -1
- package/dist/twilight/twilight.esm.js +1 -1
- package/dist/types/components/salla-bullet-delivery/helpers.d.ts +9 -0
- package/package.json +5 -5
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as t,h as e,H as r}from"./p-
|
|
4
|
+
import{r as t,h as e,H as r}from"./p-CjQzkU95.js";const i=class{constructor(e){t(this,e),this.parsedSections=[]}parseProducts(t){let e=[];if("string"==typeof t)try{const r=JSON.parse(t);e=this.extractSections(r)}catch(r){console.error("Invalid JSON passed to bundleSections prop:",t),e=[]}else t&&(e=this.extractSections(t));this.parsedSections=e}extractSections(t){return t.bundle&&t.bundle.sections&&Array.isArray(t.bundle.sections)?t.bundle.sections:Array.isArray(t)?t:t.sections&&Array.isArray(t.sections)?t.sections:(console.warn("No valid sections found in data:",t),[])}isCartPage(){return salla.url.is_page("cart")}renderCartPage(){return e("salla-multiple-bundle-product-cart",{sections:this.parsedSections})}renderDetailsPage(){return e("salla-multiple-bundle-product-details",{sections:this.parsedSections})}componentWillLoad(){this.parseProducts(this.bundleSections)}render(){return e(r,{key:"db7efe81ce29dd1bc45cc5f1dbd45b6b03e31de8",class:"s-multiple-bundle-product-wrapper"},this.isCartPage()?this.renderCartPage():this.renderDetailsPage())}static get watchers(){return{bundleSections:["parseProducts"]}}};i.style="/*!twlt*/:host{display:block}.visible{visibility:visible}.hidden{display:none}.shadow{--tw-shadow:0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}.outline{outline-style:solid}.btn{display:inline-flex;flex:1 1 0%;align-items:center;justify-content:center;white-space:nowrap;border-radius:0.375rem;padding-left:1.5rem;padding-right:1.5rem;padding-bottom:0.625rem;padding-top:0.5rem;font-size:0.875rem;line-height:1.25rem;font-weight:700;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:300ms}.btn:hover{opacity:0.8}.s-multiple-bundle-product-wrapper{margin-bottom:1.25rem;display:block}.s-multiple-bundle-product-wrapper-sections{display:flex;flex-direction:column;gap:1rem}.s-multiple-bundle-product-wrapper-slider .swiper{display:block !important}.s-multiple-bundle-product-wrapper-slider .swiper-pagination{position:static}.s-multiple-bundle-product-wrapper-slider .swiper-pagination .swiper-pagination-bullet{height:8px;width:8px}.s-multiple-bundle-product-slide-one-third{height:auto;width:100% !important}@media (min-width: 640px){.s-multiple-bundle-product-slide-one-third{width:100% !important}}@media (min-width: 768px){.s-multiple-bundle-product-slide-one-third{width:50% !important}}@media (min-width: 1024px){.s-multiple-bundle-product-slide-one-third{width:35.7% !important}}.s-multiple-bundle-product-slide-one-third-disabled{pointer-events:none;cursor:not-allowed}.s-multiple-bundle-product-slide-one-third-disabled .s-multiple-bundle-product-image-wrapper{opacity:0.5}.s-multiple-bundle-product-slide-one-third-disabled .s-multiple-bundle-product-button{--tw-text-opacity:1;color:rgb(229 231 235 / var(--tw-text-opacity, 1))}.s-multiple-bundle-product-card{position:relative;display:flex;height:100%;width:100%;flex-direction:column;overflow:hidden;border-radius:0.5rem;border-width:1px;border-style:solid;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1))}.s-multiple-bundle-product-checkbox{position:absolute;top:0.25rem;right:0.5rem;height:1rem;width:1rem;border-radius:var(--s-radius, 0.25rem);--tw-border-opacity:1;border-color:rgb(209 213 219 / var(--tw-border-opacity, 1));accent-color:#16a34a}.s-multiple-bundle-product-image-wrapper{display:flex;height:200px;justify-content:center}.s-multiple-bundle-product-image{width:100%;object-fit:cover}.s-multiple-bundle-product-content-wrapper{padding:0.5rem;line-height:1rem}.s-multiple-bundle-product-content{display:flex;align-items:flex-start;justify-content:space-between;gap:0.5rem}.s-multiple-bundle-product-details{display:flex;flex-direction:column}.s-multiple-bundle-product-title-wrapper{flex:1 1 0%}.s-multiple-bundle-product-title{font-size:9px;font-weight:500;line-height:1rem;--tw-text-opacity:1;color:rgb(29 78 216 / var(--tw-text-opacity, 1))}.s-multiple-bundle-product-price-wrapper{display:flex;align-items:center;gap:0.25rem}.s-multiple-bundle-product-price{font-size:9px;font-weight:700;--tw-text-opacity:1;color:rgb(31 41 55 / var(--tw-text-opacity, 1))}.s-multiple-bundle-product-price-discount{margin-left:0.5rem;font-size:8px;--tw-text-opacity:1;color:rgb(107 114 128 / var(--tw-text-opacity, 1));text-decoration-line:line-through}.s-multiple-bundle-product-button{display:flex;align-items:center;gap:0.25rem;border-radius:0.5rem;border-width:0px;text-align:start;font-size:10px;font-weight:700;--tw-text-opacity:1;color:rgb(22 163 74 / var(--tw-text-opacity, 1));transition-property:color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms}.s-multiple-bundle-product-button:hover{--tw-text-opacity:1;color:rgb(59 130 246 / var(--tw-text-opacity, 1))}.s-multiple-bundle-product-button-icon{font-size:10px;font-weight:700}.s-multiple-bundle-product-button-icon svg{height:1rem;width:1rem;fill:#16a34a}.s-multiple-bundle-product-button-disabled-icon{pointer-events:none;opacity:0.5}.s-multiple-bundle-product-badge{display:flex;flex-shrink:0;align-items:center;gap:0.25rem;border-radius:9999px;--tw-bg-opacity:1;background-color:rgb(229 231 235 / var(--tw-bg-opacity, 1));padding-left:0.5rem;padding-right:0.5rem;font-size:7px;--tw-text-opacity:1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.s-multiple-bundle-product-options-modal-footer{display:flex;justify-content:flex-end}.s-multiple-bundle-product-options-modal-slider{margin-top:1.25rem;display:flex;gap:1.25rem}.s-multiple-bundle-product-options-modal-slider .s-slider-container .swiper-slide{display:flex;align-items:center;justify-content:center}.s-multiple-bundle-product-options-modal-slider .s-slider-thumbs{margin-top:0px !important}.s-multiple-bundle-product-options-modal-slider .s-slider-thumbs-container{position:static;margin:0px !important;width:40px !important;transform:none !important;padding-left:0px !important;padding-right:0px !important;padding-top:0.5rem !important;padding-bottom:0.5rem !important}.s-multiple-bundle-product-options-modal-slider .s-slider-thumbs-container .swiper-slide{margin-top:0px !important;display:flex !important;height:40px !important;width:100%;align-items:center;justify-content:center;padding:0.25rem}.s-multiple-bundle-product-cart-header-wrapper{width:100%}.s-multiple-bundle-product-cart-header{display:flex;align-items:center;gap:1rem}.s-multiple-bundle-product-cart-header-no-options{justify-content:space-between}.s-multiple-bundle-product-cart-header-content{display:flex;align-items:center;gap:1rem}.s-multiple-bundle-product-cart-header-remove-button{display:flex;align-items:center;gap:0.25rem}.s-multiple-bundle-product-cart-body-remove-button{display:flex;align-items:center;justify-content:flex-end;gap:0.25rem}.s-multiple-bundle-product-cart-header-image-wrapper{position:relative;flex-shrink:0;overflow:hidden}.s-multiple-bundle-product-cart-header-image{height:4rem;width:4rem;flex:none;border-radius:0.375rem;border-width:1px;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1));--tw-bg-opacity:1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1));object-fit:cover;object-position:center}.s-multiple-bundle-product-cart-header-content-details>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(0.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(0.25rem * var(--tw-space-y-reverse))}.s-multiple-bundle-product-cart-header-content-details-title{font-size:1rem;font-weight:500;line-height:1.5rem;--tw-text-opacity:1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.s-multiple-bundle-product-cart-header-content-details-price{display:flex;align-items:center;gap:0.25rem}.s-multiple-bundle-product-cart-header-content-details-price-regular{font-size:0.75rem;line-height:1rem;font-weight:700;--tw-text-opacity:1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.s-multiple-bundle-product-cart-header-content-details-price-sale{font-size:0.75rem;line-height:1rem;--tw-text-opacity:1;color:rgb(107 114 128 / var(--tw-text-opacity, 1));text-decoration-line:line-through}.s-multiple-bundle-product-cart-header-content-details-quantity{display:flex;align-items:center;gap:0.25rem;font-size:0.75rem;line-height:1rem;--tw-text-opacity:1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.s-multiple-bundle-product-cart-header-content-details-title-link{font-size:1rem;line-height:1.5rem;font-weight:500}.s-multiple-bundle-product-options-modal-slider-thumb{height:100%;width:100%;overflow:hidden;border-radius:0.375rem;--tw-bg-opacity:1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1));object-fit:cover}";export{i as salla_multiple_bundle_product}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as t,h as o,a as r}from"./p-
|
|
4
|
+
import{r as t,h as o,a as r}from"./p-CjQzkU95.js";const a=class{constructor(o){t(this,o),this.theme="default",this.show=!1,this.targetElement=null}handleMouseOver(t){this.targetElement&&this.targetElement.contains(t.target)&&(this.show=!0)}handleMouseOut(t){this.targetElement&&this.targetElement.contains(t.target)&&(this.show=!1)}componentDidLoad(){this.targetElement=document.getElementById(this.targetId)}render(){const t=["default","dark"].includes(this.theme)?this.theme:"default";return o("div",{key:"84dfb23d4eb2689ff71b65c4a8b24dd36f8cb6ca",class:"s-tooltip-container"},o("div",{key:"59d3bac320e20f99de1c4bf49531a61962190efc",class:`s-tooltip-item s-tooltip-item--${t}`,style:{display:this.show?"block":"none"}},this.text?o("span",null,this.text):o("slot",null)))}get el(){return r(this)}};a.style='/*!twlt*/.s-tooltip-container{position:relative;display:inline-block}.s-tooltip-item{position:absolute;transform:translateX(-63%) translateY(-50%);background-color:var(--color-primary);color:var(--color-primary-reverse);bottom:100%;left:50%;text-align:center;border-radius:5px;z-index:1;white-space:nowrap;transition:opacity 0.3s;pointer-events:none;margin:0 0 16px 8px;padding:12px;max-width:150px;width:190px;white-space:normal;opacity:1}.s-tooltip-item::after{content:"";position:absolute;bottom:-10px;left:50%;margin-left:-5px;border-width:5px;border-style:solid;border-color:var(--color-primary) transparent transparent transparent}.s-tooltip-item:dir(ltr){transform:translateX(-72%)}.s-tooltip-item--dark{background-color:#555555;color:white;padding:5px 15px;border-radius:8px;font-size:12px;font-weight:normal;max-width:330px;width:max-content}.s-tooltip-item--dark::after{border-color:#555555 transparent transparent transparent}.block{display:block}.shadow{--tw-shadow:0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}';export{a as salla_tooltip}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r,h as e,H as n,F as t}from"./p-B8_UK_fg.js";function i(r,e){if("string"!=typeof r)return r??e;const n=r.trim();if(!n)return e;try{return JSON.parse(n)}catch{return e}}function o(r){if(r)return"string"==typeof r?i(r,void 0):r}function a(r,e="ar"){const[n,t]=String(r).trim().split(":").map(Number);if(!Number.isFinite(n)||!Number.isFinite(t))return r;const i=new Date(2e3,0,1,n,t),o={hour:"numeric",minute:"2-digit",hour12:!0};try{return i.toLocaleTimeString(e,o)}catch{return i.toLocaleTimeString("ar",o)}}const s=class{constructor(e){r(this,e),this.stackCards=!1,this.isLoading=!1}componentWillLoad(){return this.getBranchData()}async getBranchData(){const r=salla.config.get("page.id");if(r){this.isLoading=!0;try{const e=await salla.order.api.getBranchDetails(r);this.branchData=this.parseBranchResponse(e)}catch(r){this.notifyApiError(r)}finally{this.isLoading=!1}}}parseBranchResponse(r){const e=r?.data?.data||r?.data||r;return e&&"object"==typeof e&&Object.prototype.hasOwnProperty.call(e,"branch")?e.branch?o(e.branch):void 0:o(e)}getApiErrorMessage(r){return r?.response?.data?.error?.message||r?.response?.data?.message}notifyApiError(r){const e=this.getApiErrorMessage(r);e&&salla.notify.error(e)}label(r,e){return salla.lang.getWithDefault(r,e)}get preparationText(){const r=this.branchData?.preparation_time_range;if(!r?.from||!r?.to)return"";const e=salla.helpers.number(r.from.value),n=salla.helpers.number(r.to.value),t=this.unitLabel(r.to.unit),i=e===n?e:`${e}-${n}`;return this.label("pages.orders.pickup_ready_after","جاهز للاستلام بعد :time").replace(":time",`${i} ${t}`)}unitLabel(r){const e=function(r){const e=String(r||"hour").toLowerCase();return e.startsWith("min")?"minute":e.startsWith("day")?"day":"hour"}(r);return"minute"===e?this.label("pages.checkout.minute","دقيقة"):"day"===e?this.label("pages.checkout.day","يوم"):this.label("pages.checkout.hour","ساعة")}get workingHoursItems(){const r=this.branchData;if(!r)return[];if(!0===r.always_open||1===r.always_open||"1"===r.always_open)return[this.label("pages.orders.branch_always_open","مفتوح على مدار الساعة")];const e=salla.lang.locale||"ar";return(r.working_hours||[]).filter((r=>r?.name&&r.times?.length)).map((r=>{const n=r.times[0];return`${r.name}: ${a(n.from,e)} - ${a(n.to,e)}`}))}get branchAddress(){return this.branchData?.address||""}get mapUrl(){const r=this.branchData?.location;if(null!=r?.lat&&null!=r?.lng)return`https://www.google.com/maps?q=${r.lat},${r.lng}`}get phone(){return function(r){const e=i(r,null),n=e&&"object"==typeof e?e.phone:"";return"string"==typeof n?n.trim():""}(this.branchData?.contacts)}renderDetailsColumn(){const r=this.phone;return r?e("div",{class:"s-order-branch-details"},e("div",{class:"s-order-branch-info-card"},e("span",{class:"s-order-branch-info-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>phone-talking</title>\n<path d="M18.667 8c2.941 0 5.333 2.392 5.333 5.333 0 0.737 0.596 1.333 1.333 1.333s1.333-0.596 1.333-1.333c0-4.412-3.588-8-8-8-0.737 0-1.333 0.596-1.333 1.333s0.596 1.333 1.333 1.333zM18.667 2.667c5.881 0 10.667 4.785 10.667 10.667 0 0.737 0.596 1.333 1.333 1.333s1.333-0.596 1.333-1.333c0-7.352-5.981-13.333-13.333-13.333-0.737 0-1.333 0.596-1.333 1.333s0.596 1.333 1.333 1.333zM26.939 17.831c-1.568-1.568-4.119-1.568-5.689 0l-2.567 2.568c-3.064-1.499-5.584-4.019-7.083-7.083l2.569-2.567c1.567-1.569 1.567-4.121-0.001-5.689l-3.88-3.881c-1.521-1.521-4.169-1.521-5.691 0l-1.847 1.847c-2.22 2.22-3.183 5.408-2.573 8.527 1.979 10.144 10.127 18.292 20.271 20.271 0.617 0.121 1.236 0.18 1.851 0.18 2.491 0 4.895-0.972 6.676-2.752l1.847-1.847c1.569-1.569 1.569-4.12 0-5.689zM28.936 25.517l-1.847 1.847c-1.591 1.591-3.876 2.281-6.131 1.841-9.089-1.776-16.388-9.075-18.163-18.165-0.439-2.247 0.249-4.539 1.841-6.129l1.847-1.847c0.256-0.257 0.597-0.397 0.959-0.397s0.701 0.14 0.959 0.397l3.883 3.883c0.528 0.528 0.528 1.389 0 1.917l-3.22 3.219c-0.383 0.384-0.496 0.959-0.288 1.457 1.815 4.34 5.344 7.868 9.684 9.684 0.5 0.205 1.075 0.095 1.457-0.288l3.219-3.219c0.528-0.531 1.389-0.529 1.917-0.001l3.883 3.883c0.529 0.529 0.529 1.389 0 1.919z"></path>\n</svg>\n'}),e("div",{class:"s-order-branch-info-text"},e("span",{class:"s-order-branch-info-label"},this.label("pages.orders.branch_contacts","ارقام التواصل")),e("span",{class:"s-order-branch-info-value",dir:"ltr"},r)))):null}renderWorkingHoursCard(){const r=this.workingHoursItems;return r.length?e("div",{class:"s-order-branch-info-card s-order-branch-hours-card"},e("span",{class:"s-order-branch-info-icon","aria-hidden":"true"},e("i",{class:"sicon-calendar-alt"})),e("div",{class:"s-order-branch-info-text"},e("span",{class:"s-order-branch-info-label"},this.label("pages.checkout.working_hours","ساعات العمل")),e("div",{class:"s-order-branch-hours-list"},r.map((r=>e("span",{class:"s-order-branch-hours-item"},r)))))):null}renderBranchIdentityCard(){const r=this.branchData,n=this.branchAddress,t=this.preparationText;return e("section",{class:"s-order-branch-card"},e("div",{class:"s-order-branch-location"},e("div",{class:"s-order-branch-identity"},e("span",{class:"s-order-branch-store-icon"},e("i",{class:"sicon-store","aria-hidden":"true"})),e("div",{class:"s-order-branch-text"},e("div",{class:"s-order-branch-name-row"},r?.name?e("span",{class:"s-order-branch-name"},r.name):null,t?e("span",{class:"s-order-branch-ready"},t):null),n?e("span",{class:"s-order-branch-address"},n):null)),this.mapUrl?e("div",{class:"s-order-branch-actions"},e("a",{href:this.mapUrl,target:"_blank",rel:"noopener noreferrer",class:"s-order-branch-map-link"},e("span",null,this.label("pages.orders.branch_map","موقع الفرع علي الخريطة")),e("span",{class:"s-order-branch-action-icon",innerHTML:'<svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M6.95448 2.79419C9.7395 1.84477 11.132 1.37005 11.881 2.11902C12.6299 2.86799 12.1552 4.2605 11.2058 7.04551L10.5593 8.94203C9.83014 11.0809 9.46556 12.1503 8.8646 12.2388C8.70303 12.2626 8.53577 12.2483 8.37592 12.197C7.78135 12.0061 7.46705 10.8785 6.83846 8.62339C6.69903 8.12319 6.62932 7.87308 6.47057 7.68206C6.4245 7.62662 6.37338 7.5755 6.31794 7.52943C6.12692 7.37068 5.87681 7.30097 5.37661 7.16154C3.12148 6.53295 1.99391 6.21865 1.80302 5.62408C1.7517 5.46423 1.73738 5.29698 1.76117 5.1354C1.84968 4.53444 2.91911 4.16986 5.05797 3.44072L6.95448 2.79419Z" stroke="currentColor" stroke-width="1.5"/>\n</svg>\n'}))):null))}render(){return this.isLoading||!this.branchData?e(n,{class:"s-order-branch-wrapper"}):e(n,{class:"s-order-branch-wrapper"},this.stackCards?e(t,null,this.renderBranchIdentityCard(),this.renderDetailsColumn()):e("div",{class:"s-order-branch-container"},this.renderBranchIdentityCard(),this.renderDetailsColumn()),this.renderWorkingHoursCard())}};s.style="/*!twlt*/:host{display:block}.s-order-branch-ready{background-color:color-mix(in srgb, var(--color-primary) 30%, transparent)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.s-order-branch-wrapper{margin-bottom:1.5rem;display:flex;flex-direction:column;gap:1rem;font-family:inherit}.s-order-branch-container{display:grid;grid-template-columns:repeat(1, minmax(0, 1fr));align-items:stretch;gap:1rem}@media (min-width: 768px){.s-order-branch-container{grid-template-columns:repeat(2, minmax(0, 1fr))}}.s-order-branch-details{display:grid;align-content:stretch;gap:1rem}.s-order-branch-info-card{display:flex;min-height:68px;align-items:center;justify-content:space-between;gap:0.75rem;border-radius:0.5rem;border-width:1px;border-color:var(--color-border,#eee);background-color:var(--color-surface,#fff);padding:0.75rem}.s-order-branch-info-text{display:flex;min-width:0px;flex:1 1 0%;flex-direction:column;gap:3px;text-align:start}.s-order-branch-info-label{font-size:0.75rem;line-height:1rem;line-height:1.35;color:var(--color-text-secondary,#666)}.s-order-branch-info-value{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:0.875rem;line-height:1.25rem;font-weight:500;line-height:1.45;color:var(--color-text-primary,#1d1d1d)}.s-order-branch-hours-card .s-order-branch-info-text{gap:0.5rem}.s-order-branch-hours-list{display:flex;flex-wrap:wrap;align-items:center;gap:0.5rem}.s-order-branch-hours-item{display:inline-flex;align-items:center;white-space:nowrap;border-radius:0.375rem;border-width:1px;border-color:var(--color-border,#eee);padding-left:0.625rem;padding-right:0.625rem;padding-top:0.25rem;padding-bottom:0.25rem;font-size:0.75rem;line-height:1rem;font-weight:500;line-height:1.45;color:var(--color-text-primary,#1d1d1d)}.s-order-branch-info-action{display:inline-flex;height:3rem;width:3rem;flex-shrink:0;align-items:center;justify-content:center;border-radius:0.5rem;background-color:var(--color-surface-secondary,#f6f6f6);color:var(--color-text-primary,#2b2d34);text-decoration-line:none}.s-order-branch-info-icon{display:inline-flex;height:3rem;width:3rem;align-items:center;justify-content:center;border-radius:0.375rem;--tw-bg-opacity:1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1));font-size:22px;color:currentColor}.s-order-branch-info-icon svg{height:1.5rem;width:1.5rem;fill:currentColor}.s-order-branch-card{display:flex;flex-direction:column;gap:0.75rem;border-radius:0.5rem;border-width:1px;border-color:var(--color-border,#eee);background-color:var(--color-surface,#fff);padding:1rem}@media (min-width: 768px){.s-order-branch-card{padding:1.25rem}}.s-order-branch-ready{display:inline-flex;flex-shrink:0;align-items:center;white-space:nowrap;border-radius:9999px;border-width:1px;border-color:var(--color-primary,#236e4c);padding-left:0.75rem;padding-right:0.75rem;padding-top:0.25rem;padding-bottom:0.25rem;font-size:0.75rem;line-height:1rem;font-weight:500;color:var(--color-primary-dark,#0c2519)}.s-order-branch-location{display:flex;min-height:52px;flex-direction:column;align-items:stretch;justify-content:space-between;gap:1.5rem}@media (min-width: 768px){.s-order-branch-location{flex-direction:row;align-items:center}}.s-order-branch-identity{display:flex;min-width:0px;flex:1 1 0%;align-items:center;gap:0.75rem}.s-order-branch-store-icon{display:inline-flex;height:3rem;width:3rem;flex-shrink:0;align-items:center;justify-content:center;--tw-bg-opacity:1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1));font-size:1.5rem;line-height:2rem;color:var(--color-text-primary,#2b2d34)}.s-order-branch-store-icon svg{height:1em;width:1em;fill:currentColor}.s-order-branch-text{display:flex;min-width:0px;flex-direction:column;gap:0.25rem;text-align:start}.s-order-branch-name-row{display:flex;flex-wrap:wrap;align-items:center;gap:0.5rem}.s-order-branch-name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:1rem;line-height:1.5rem;font-weight:500;line-height:1.45;color:var(--color-text-primary,#2b2d34)}.s-order-branch-address{overflow-wrap:break-word;font-size:0.75rem;line-height:1rem;line-height:1.45;color:var(--color-text-secondary,#666)}.s-order-branch-actions{display:flex;flex-shrink:0;flex-wrap:wrap;align-items:center;gap:0.75rem}@media (min-width: 768px){.s-order-branch-actions{flex-wrap:nowrap}}.s-order-branch-map-link{display:inline-flex;min-height:2.25rem;align-items:center;justify-content:center;gap:0.5rem;white-space:nowrap;border-radius:0.375rem;border-width:1px;border-color:var(--color-primary,#236e4c);padding-left:0.875rem;padding-right:0.875rem;padding-top:0.5rem;padding-bottom:0.5rem;font-size:0.875rem;line-height:1.25rem;font-weight:700;line-height:1.2;color:var(--color-primary,#236e4c);text-decoration-line:none}.s-order-branch-action-icon{display:inline-flex;align-items:center;justify-content:center;font-size:0.875rem;line-height:1.25rem;color:currentColor}.s-order-branch-action-icon svg{height:1em;width:1em}";export{s as salla_order_branch}
|
|
4
|
+
import{r,h as e,H as n,F as t}from"./p-CjQzkU95.js";function i(r,e){if("string"!=typeof r)return r??e;const n=r.trim();if(!n)return e;try{return JSON.parse(n)}catch{return e}}function o(r){if(r)return"string"==typeof r?i(r,void 0):r}function a(r,e="ar"){const[n,t]=String(r).trim().split(":").map(Number);if(!Number.isFinite(n)||!Number.isFinite(t))return r;const i=new Date(2e3,0,1,n,t),o={hour:"numeric",minute:"2-digit",hour12:!0};try{return i.toLocaleTimeString(e,o)}catch{return i.toLocaleTimeString("ar",o)}}const s=class{constructor(e){r(this,e),this.stackCards=!1,this.isLoading=!1}componentWillLoad(){return this.getBranchData()}async getBranchData(){const r=salla.config.get("page.id");if(r){this.isLoading=!0;try{const e=await salla.order.api.getBranchDetails(r);this.branchData=this.parseBranchResponse(e)}catch(r){this.notifyApiError(r)}finally{this.isLoading=!1}}}parseBranchResponse(r){const e=r?.data?.data||r?.data||r;return e&&"object"==typeof e&&Object.prototype.hasOwnProperty.call(e,"branch")?e.branch?o(e.branch):void 0:o(e)}getApiErrorMessage(r){return r?.response?.data?.error?.message||r?.response?.data?.message}notifyApiError(r){const e=this.getApiErrorMessage(r);e&&salla.notify.error(e)}label(r,e){return salla.lang.getWithDefault(r,e)}get preparationText(){const r=this.branchData?.preparation_time_range;if(!r?.from||!r?.to)return"";const e=salla.helpers.number(r.from.value),n=salla.helpers.number(r.to.value),t=this.unitLabel(r.to.unit),i=e===n?e:`${e}-${n}`;return this.label("pages.orders.pickup_ready_after","جاهز للاستلام بعد :time").replace(":time",`${i} ${t}`)}unitLabel(r){const e=function(r){const e=String(r||"hour").toLowerCase();return e.startsWith("min")?"minute":e.startsWith("day")?"day":"hour"}(r);return"minute"===e?this.label("pages.checkout.minute","دقيقة"):"day"===e?this.label("pages.checkout.day","يوم"):this.label("pages.checkout.hour","ساعة")}get workingHoursItems(){const r=this.branchData;if(!r)return[];if(!0===r.always_open||1===r.always_open||"1"===r.always_open)return[this.label("pages.orders.branch_always_open","مفتوح على مدار الساعة")];const e=salla.lang.locale||"ar";return(r.working_hours||[]).filter((r=>r?.name&&r.times?.length)).map((r=>{const n=r.times[0];return`${r.name}: ${a(n.from,e)} - ${a(n.to,e)}`}))}get branchAddress(){return this.branchData?.address||""}get mapUrl(){const r=this.branchData?.location;if(null!=r?.lat&&null!=r?.lng)return`https://www.google.com/maps?q=${r.lat},${r.lng}`}get phone(){return function(r){const e=i(r,null),n=e&&"object"==typeof e?e.phone:"";return"string"==typeof n?n.trim():""}(this.branchData?.contacts)}renderDetailsColumn(){const r=this.phone;return r?e("div",{class:"s-order-branch-details"},e("div",{class:"s-order-branch-info-card"},e("span",{class:"s-order-branch-info-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>phone-talking</title>\n<path d="M18.667 8c2.941 0 5.333 2.392 5.333 5.333 0 0.737 0.596 1.333 1.333 1.333s1.333-0.596 1.333-1.333c0-4.412-3.588-8-8-8-0.737 0-1.333 0.596-1.333 1.333s0.596 1.333 1.333 1.333zM18.667 2.667c5.881 0 10.667 4.785 10.667 10.667 0 0.737 0.596 1.333 1.333 1.333s1.333-0.596 1.333-1.333c0-7.352-5.981-13.333-13.333-13.333-0.737 0-1.333 0.596-1.333 1.333s0.596 1.333 1.333 1.333zM26.939 17.831c-1.568-1.568-4.119-1.568-5.689 0l-2.567 2.568c-3.064-1.499-5.584-4.019-7.083-7.083l2.569-2.567c1.567-1.569 1.567-4.121-0.001-5.689l-3.88-3.881c-1.521-1.521-4.169-1.521-5.691 0l-1.847 1.847c-2.22 2.22-3.183 5.408-2.573 8.527 1.979 10.144 10.127 18.292 20.271 20.271 0.617 0.121 1.236 0.18 1.851 0.18 2.491 0 4.895-0.972 6.676-2.752l1.847-1.847c1.569-1.569 1.569-4.12 0-5.689zM28.936 25.517l-1.847 1.847c-1.591 1.591-3.876 2.281-6.131 1.841-9.089-1.776-16.388-9.075-18.163-18.165-0.439-2.247 0.249-4.539 1.841-6.129l1.847-1.847c0.256-0.257 0.597-0.397 0.959-0.397s0.701 0.14 0.959 0.397l3.883 3.883c0.528 0.528 0.528 1.389 0 1.917l-3.22 3.219c-0.383 0.384-0.496 0.959-0.288 1.457 1.815 4.34 5.344 7.868 9.684 9.684 0.5 0.205 1.075 0.095 1.457-0.288l3.219-3.219c0.528-0.531 1.389-0.529 1.917-0.001l3.883 3.883c0.529 0.529 0.529 1.389 0 1.919z"></path>\n</svg>\n'}),e("div",{class:"s-order-branch-info-text"},e("span",{class:"s-order-branch-info-label"},this.label("pages.orders.branch_contacts","ارقام التواصل")),e("span",{class:"s-order-branch-info-value",dir:"ltr"},r)))):null}renderWorkingHoursCard(){const r=this.workingHoursItems;return r.length?e("div",{class:"s-order-branch-info-card s-order-branch-hours-card"},e("span",{class:"s-order-branch-info-icon","aria-hidden":"true"},e("i",{class:"sicon-calendar-alt"})),e("div",{class:"s-order-branch-info-text"},e("span",{class:"s-order-branch-info-label"},this.label("pages.checkout.working_hours","ساعات العمل")),e("div",{class:"s-order-branch-hours-list"},r.map((r=>e("span",{class:"s-order-branch-hours-item"},r)))))):null}renderBranchIdentityCard(){const r=this.branchData,n=this.branchAddress,t=this.preparationText;return e("section",{class:"s-order-branch-card"},e("div",{class:"s-order-branch-location"},e("div",{class:"s-order-branch-identity"},e("span",{class:"s-order-branch-store-icon"},e("i",{class:"sicon-store","aria-hidden":"true"})),e("div",{class:"s-order-branch-text"},e("div",{class:"s-order-branch-name-row"},r?.name?e("span",{class:"s-order-branch-name"},r.name):null,t?e("span",{class:"s-order-branch-ready"},t):null),n?e("span",{class:"s-order-branch-address"},n):null)),this.mapUrl?e("div",{class:"s-order-branch-actions"},e("a",{href:this.mapUrl,target:"_blank",rel:"noopener noreferrer",class:"s-order-branch-map-link"},e("span",null,this.label("pages.orders.branch_map","موقع الفرع علي الخريطة")),e("span",{class:"s-order-branch-action-icon",innerHTML:'<svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M6.95448 2.79419C9.7395 1.84477 11.132 1.37005 11.881 2.11902C12.6299 2.86799 12.1552 4.2605 11.2058 7.04551L10.5593 8.94203C9.83014 11.0809 9.46556 12.1503 8.8646 12.2388C8.70303 12.2626 8.53577 12.2483 8.37592 12.197C7.78135 12.0061 7.46705 10.8785 6.83846 8.62339C6.69903 8.12319 6.62932 7.87308 6.47057 7.68206C6.4245 7.62662 6.37338 7.5755 6.31794 7.52943C6.12692 7.37068 5.87681 7.30097 5.37661 7.16154C3.12148 6.53295 1.99391 6.21865 1.80302 5.62408C1.7517 5.46423 1.73738 5.29698 1.76117 5.1354C1.84968 4.53444 2.91911 4.16986 5.05797 3.44072L6.95448 2.79419Z" stroke="currentColor" stroke-width="1.5"/>\n</svg>\n'}))):null))}render(){return this.isLoading||!this.branchData?e(n,{class:"s-order-branch-wrapper"}):e(n,{class:"s-order-branch-wrapper"},this.stackCards?e(t,null,this.renderBranchIdentityCard(),this.renderDetailsColumn()):e("div",{class:"s-order-branch-container"},this.renderBranchIdentityCard(),this.renderDetailsColumn()),this.renderWorkingHoursCard())}};s.style="/*!twlt*/:host{display:block}.s-order-branch-ready{background-color:color-mix(in srgb, var(--color-primary) 30%, transparent)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.s-order-branch-wrapper{margin-bottom:1.5rem;display:flex;flex-direction:column;gap:1rem;font-family:inherit}.s-order-branch-container{display:grid;grid-template-columns:repeat(1, minmax(0, 1fr));align-items:stretch;gap:1rem}@media (min-width: 768px){.s-order-branch-container{grid-template-columns:repeat(2, minmax(0, 1fr))}}.s-order-branch-details{display:grid;align-content:stretch;gap:1rem}.s-order-branch-info-card{display:flex;min-height:68px;align-items:center;justify-content:space-between;gap:0.75rem;border-radius:0.5rem;border-width:1px;border-color:var(--color-border,#eee);background-color:var(--color-surface,#fff);padding:0.75rem}.s-order-branch-info-text{display:flex;min-width:0px;flex:1 1 0%;flex-direction:column;gap:3px;text-align:start}.s-order-branch-info-label{font-size:0.75rem;line-height:1rem;line-height:1.35;color:var(--color-text-secondary,#666)}.s-order-branch-info-value{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:0.875rem;line-height:1.25rem;font-weight:500;line-height:1.45;color:var(--color-text-primary,#1d1d1d)}.s-order-branch-hours-card .s-order-branch-info-text{gap:0.5rem}.s-order-branch-hours-list{display:flex;flex-wrap:wrap;align-items:center;gap:0.5rem}.s-order-branch-hours-item{display:inline-flex;align-items:center;white-space:nowrap;border-radius:0.375rem;border-width:1px;border-color:var(--color-border,#eee);padding-left:0.625rem;padding-right:0.625rem;padding-top:0.25rem;padding-bottom:0.25rem;font-size:0.75rem;line-height:1rem;font-weight:500;line-height:1.45;color:var(--color-text-primary,#1d1d1d)}.s-order-branch-info-action{display:inline-flex;height:3rem;width:3rem;flex-shrink:0;align-items:center;justify-content:center;border-radius:0.5rem;background-color:var(--color-surface-secondary,#f6f6f6);color:var(--color-text-primary,#2b2d34);text-decoration-line:none}.s-order-branch-info-icon{display:inline-flex;height:3rem;width:3rem;align-items:center;justify-content:center;border-radius:0.375rem;--tw-bg-opacity:1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1));font-size:22px;color:currentColor}.s-order-branch-info-icon svg{height:1.5rem;width:1.5rem;fill:currentColor}.s-order-branch-card{display:flex;flex-direction:column;gap:0.75rem;border-radius:0.5rem;border-width:1px;border-color:var(--color-border,#eee);background-color:var(--color-surface,#fff);padding:1rem}@media (min-width: 768px){.s-order-branch-card{padding:1.25rem}}.s-order-branch-ready{display:inline-flex;flex-shrink:0;align-items:center;white-space:nowrap;border-radius:9999px;border-width:1px;border-color:var(--color-primary,#236e4c);padding-left:0.75rem;padding-right:0.75rem;padding-top:0.25rem;padding-bottom:0.25rem;font-size:0.75rem;line-height:1rem;font-weight:500;color:var(--color-primary-dark,#0c2519)}.s-order-branch-location{display:flex;min-height:52px;flex-direction:column;align-items:stretch;justify-content:space-between;gap:1.5rem}@media (min-width: 768px){.s-order-branch-location{flex-direction:row;align-items:center}}.s-order-branch-identity{display:flex;min-width:0px;flex:1 1 0%;align-items:center;gap:0.75rem}.s-order-branch-store-icon{display:inline-flex;height:3rem;width:3rem;flex-shrink:0;align-items:center;justify-content:center;--tw-bg-opacity:1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1));font-size:1.5rem;line-height:2rem;color:var(--color-text-primary,#2b2d34)}.s-order-branch-store-icon svg{height:1em;width:1em;fill:currentColor}.s-order-branch-text{display:flex;min-width:0px;flex-direction:column;gap:0.25rem;text-align:start}.s-order-branch-name-row{display:flex;flex-wrap:wrap;align-items:center;gap:0.5rem}.s-order-branch-name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:1rem;line-height:1.5rem;font-weight:500;line-height:1.45;color:var(--color-text-primary,#2b2d34)}.s-order-branch-address{overflow-wrap:break-word;font-size:0.75rem;line-height:1rem;line-height:1.45;color:var(--color-text-secondary,#666)}.s-order-branch-actions{display:flex;flex-shrink:0;flex-wrap:wrap;align-items:center;gap:0.75rem}@media (min-width: 768px){.s-order-branch-actions{flex-wrap:nowrap}}.s-order-branch-map-link{display:inline-flex;min-height:2.25rem;align-items:center;justify-content:center;gap:0.5rem;white-space:nowrap;border-radius:0.375rem;border-width:1px;border-color:var(--color-primary,#236e4c);padding-left:0.875rem;padding-right:0.875rem;padding-top:0.5rem;padding-bottom:0.5rem;font-size:0.875rem;line-height:1.25rem;font-weight:700;line-height:1.2;color:var(--color-primary,#236e4c);text-decoration-line:none}.s-order-branch-action-icon{display:inline-flex;align-items:center;justify-content:center;font-size:0.875rem;line-height:1.25rem;color:currentColor}.s-order-branch-action-icon svg{height:1em;width:1em}";export{s as salla_order_branch}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as e,h as o}from"./p-
|
|
4
|
+
import{r as e,h as o}from"./p-CjQzkU95.js";import{T as t}from"./p-CJUR4sUM.js";import{i as r}from"./p-DqDX5na4.js";const n=class{constructor(o){e(this,o),this.coupon=null,this.isLoading=!0,this.titlePercentTpl="",this.titleFixedTpl="",this.badgeLabel="",this.minSpendTpl="",this.expiresTpl="",this.shopNowLabel="",this.copyLabel="",this.copiedLabel=""}componentWillLoad(){Salla.onReady().then((()=>Salla.lang.onLoaded())).then((()=>(this.loadTranslations(),this.loadCoupon()))).catch((()=>{this.isLoading=!1}))}loadTranslations(){this.titlePercentTpl=Salla.lang.get("pages.thank_you.next_order_coupon_title_percent")||"",this.titleFixedTpl=Salla.lang.get("pages.thank_you.next_order_coupon_title_fixed")||"",this.badgeLabel=Salla.lang.get("pages.thank_you.next_order_coupon_badge")||"",this.minSpendTpl=Salla.lang.get("pages.thank_you.next_order_coupon_min_spend")||"",this.expiresTpl=Salla.lang.get("pages.thank_you.next_order_coupon_expires")||"",this.shopNowLabel=Salla.lang.get("pages.thank_you.next_order_coupon_shop_now")||"",this.copyLabel=Salla.lang.get("common.elements.copy")||"",this.copiedLabel=Salla.lang.get("pages.thank_you.next_order_coupon_copied")||""}async loadCoupon(){try{const e=await salla.api.request("coupons",{params:{type:"thankyou"}}),o=e?.data,t=Array.isArray(o)?o:Array.isArray(o?.data)?o.data:[];this.coupon=t[0]??null}catch{this.coupon=null}finally{this.isLoading=!1}}async copyCode(){if(this.coupon)try{await navigator.clipboard.writeText(this.coupon.code),salla.notify.success(this.copiedLabel),salla.event.dispatch("salla::next-order-coupon.code.copied",{code:this.coupon.code})}catch{}}isPercentage(){return"P"===this.coupon?.type||"percentage"===this.coupon?.type}formatAmount(){if(!this.coupon)return"";if(this.isPercentage())return`${salla.helpers.number(this.coupon.amount)}%`;const e=this.coupon.amount;return o("span","object"==typeof e&&e.amount?{innerHTML:salla.money(e.amount,e.currency)}:{innerHTML:salla.money(e)})}formatMinSpend(){const e=this.coupon?.minimum_amount;return e&&("object"!=typeof e||e.amount)?"string"==typeof e?e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,"""):salla.money(e.amount,e.currency):""}formatExpiry(){const e=this.coupon?.expiry_date;return e?new Date(e).toLocaleDateString(Salla.lang.locale||"en-GB"):""}renderSkeleton(){return o("div",{class:"s-next-order-coupon-wrapper s-next-order-coupon-skeleton"},o("div",{class:"s-next-order-coupon-inner"},o("div",{class:"s-next-order-coupon-info"},o("salla-skeleton",{type:"normal",width:"48px",height:"48px"}),o("div",{class:"s-next-order-coupon-details"},o("salla-skeleton",{height:"14px",width:"220px"}),o("salla-skeleton",{height:"12px",width:"140px"}))),o("div",{class:"s-next-order-coupon-actions"},o("salla-skeleton",{height:"40px",width:"140px"}),o("salla-skeleton",{height:"40px",width:"100px"}))))}renderTitle(){const e=this.formatAmount(),t=this.isPercentage()?this.titlePercentTpl:this.titleFixedTpl,r=this.isPercentage()?":amount%":":amount",n=t.split(r);return o("p",{class:"s-next-order-coupon-title"},n[0],o("span",{class:"s-next-order-coupon-amount"},e),n[1]||"")}render(){if(this.isLoading)return this.renderSkeleton();if(!this.coupon)return null;const e=this.formatMinSpend(),n=this.formatExpiry();return o("div",{class:"s-next-order-coupon-wrapper"},o("div",{class:"s-next-order-coupon-inner"},o("div",{class:"s-next-order-coupon-info"},o("div",{class:"s-next-order-coupon-icon-wrap"},o("span",{class:"s-next-order-coupon-icon-bg"}),o("span",{class:"s-next-order-coupon-icon",innerHTML:t})),o("div",{class:"s-next-order-coupon-details"},o("div",{class:"s-next-order-coupon-title-row"},this.renderTitle(),o("span",{class:"s-next-order-coupon-badge"},o("span",{class:"s-next-order-coupon-badge-bg"}),o("span",{class:"s-next-order-coupon-badge-text"},this.badgeLabel))),(e||n)&&o("p",{class:"s-next-order-coupon-meta"},e&&o("span",{innerHTML:this.minSpendTpl.replace(":amount",e)}),n&&o("span",null,this.expiresTpl.replace(":date",n))))),o("div",{class:"s-next-order-coupon-actions"},o("div",{class:"s-next-order-coupon-code-box"},o("span",{class:"s-next-order-coupon-code-text"},this.coupon.code),o("salla-button",{shape:"link",class:"s-next-order-coupon-copy-btn",title:this.copyLabel,onClick:()=>this.copyCode()},o("span",{class:"s-next-order-coupon-copy-icon",innerHTML:r}))),o("salla-button",{href:salla.url.get(""),class:"s-next-order-coupon-shop-btn"},this.shopNowLabel))))}};n.style="/*!twlt*/:host{display:block}.fixed{position:fixed}.s-next-order-coupon-wrapper{margin-bottom:1.5rem;border-radius:0.375rem;--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1));padding-left:1rem;padding-right:1rem;padding-top:1rem;padding-bottom:1rem}@media (min-width: 768px){.s-next-order-coupon-wrapper{margin-bottom:2rem;padding-left:2rem;padding-right:2rem}}.s-next-order-coupon-inner{display:flex;flex-direction:column;gap:1rem}@media (min-width: 768px){.s-next-order-coupon-inner{flex-direction:row;align-items:center;justify-content:space-between}}.s-next-order-coupon-info{display:flex;min-width:0px;flex:1 1 0%;align-items:center;gap:0.75rem}.s-next-order-coupon-icon-wrap{position:relative;display:flex;height:3rem;width:3rem;flex-shrink:0;align-items:center;justify-content:center;border-radius:var(--s-radius, 0.25rem)}.s-next-order-coupon-icon-bg{position:absolute;inset:0px;border-radius:var(--s-radius, 0.25rem);background-color:var(--color-primary);opacity:0.25}.s-next-order-coupon-icon{position:relative;color:var(--color-primary)}.s-next-order-coupon-icon svg{height:1.5rem;width:1.75rem;fill:currentColor}.s-next-order-coupon-details{display:flex;min-width:0px;flex-direction:column;gap:0.5rem}.s-next-order-coupon-title-row{display:flex;flex-wrap:wrap;align-items:center;gap:0.375rem}.s-next-order-coupon-title{font-size:1rem;line-height:1.5rem;font-weight:700;line-height:1.375}.s-next-order-coupon-amount{color:var(--color-primary)}.s-next-order-coupon-badge{position:relative;display:inline-flex;height:1.5rem;align-items:center;border-radius:9999px;padding-left:0.75rem;padding-right:0.75rem;font-size:0.75rem;line-height:1rem;color:var(--color-primary)}.s-next-order-coupon-badge-bg{position:absolute;inset:0px;border-radius:9999px;background-color:var(--color-primary);opacity:0.25}.s-next-order-coupon-badge-text{position:relative}.s-next-order-coupon-meta{display:flex;flex-wrap:wrap;column-gap:0.25rem;font-size:0.875rem;line-height:1.25rem;line-height:1.375;--tw-text-opacity:1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.s-next-order-coupon-actions{display:flex;flex-direction:column;gap:0.75rem}@media (min-width: 768px){.s-next-order-coupon-actions{flex-shrink:0;flex-direction:row;align-items:center}}.s-next-order-coupon-code-box{display:flex;height:2.5rem;width:100%;align-items:center;justify-content:center;gap:0.5rem;border-radius:0.375rem;border-width:1px;border-style:dashed;border-color:var(--color-primary);padding-left:1rem;padding-right:1rem}@media (min-width: 768px){.s-next-order-coupon-code-box{width:auto}}.s-next-order-coupon-code-text{font-size:1rem;line-height:1.5rem;line-height:1;letter-spacing:0.025em}.s-next-order-coupon-copy-btn{display:flex;height:auto !important;align-items:center;padding:0px !important}.s-next-order-coupon-copy-icon{pointer-events:none;color:var(--color-primary)}.s-next-order-coupon-copy-icon svg{height:1rem;width:1rem;fill:currentColor}.s-next-order-coupon-shop-btn{width:100%;white-space:nowrap;text-align:center}@media (min-width: 768px){.s-next-order-coupon-shop-btn{width:auto}}@keyframes pulse{50%{opacity:.5}}.s-next-order-coupon-skeleton{animation:pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite}";export{n as salla_next_order_coupon}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as t,c as r,h as e,H as i,a as s}from"./p-B8_UK_fg.js";import{e as o}from"./p-DzAIgzdz.js";const a=class{constructor(e){t(this,e),this.verified=r(this,"verified"),this.translationLoaded=!1,this.display="modal",this.type="mobile",this.autoReload=!0,this.supportWebAuth=!0,this.resendAfter=30,this.isProfileVerify=!1,salla.lang.onLoaded((()=>{this.translationLoaded=!0,this.title=salla.lang.get("pages.profile.verify_title")+salla.lang.get("common.elements."+this.type),this.modal?.setTitle(this.title)})),"inline"!=this.display?(salla.event.on("profile::verification",(t=>{let r=Array.isArray(t)?t[0]:t;"delete_account"===r?.request_type||document.getElementById("salla-user-settings-delete-modal")?.hasAttribute("visible")||(this.isProfileVerify=!0,this.open(r),this.title=salla.lang.get("pages.profile.verify_title")+salla.lang.get("common.elements."+r.type),this.modal?.setTitle(this.title))})),salla.event.on("modalClosed",(()=>{this.resendAfter=0,this.timer.innerHTML="30 : 00"}))):this.modal={open:()=>"",close:()=>"",setTitle:()=>""}}splitNumber(t){this.resetError();let r=t.data||t.target.value;r&&1!==r.length&&this.modifyNext(t.target,r)}modifyNext(t,r){t.value=r[0],r=r.substring(1),t.nextElementSibling&&r.length?this.modifyNext(t.nextElementSibling,r):t.nextElementSibling||0!==r.length?t.nextElementSibling&&0===r.length&&t.nextElementSibling.focus():t.focus()}checkAllInputs(){let t=!0;for(let r=0;r<this.otpInputs.length;r++)""===this.otpInputs[r].value&&(t=!1);return t}handleKeyUp(t){if(this.resetError(),["Alt","Shift","Control","AltGraph","Ctrl"].includes(t.key))return;let r=t.keyCode||t.charCode;t.target.value?(t.target.nextElementSibling?.focus(),t.target.nextElementSibling?.select()):[8,46].includes(r)&&(t.target.previousElementSibling?.focus(),t.target.previousElementSibling?.select()),t.target.value.length>1&&this.splitNumber(t)}handlePaste(t){this.resetError();let r=(salla.helpers.number(t.clipboardData.getData("text"))||"").replace(/[^0-9]/g,"");r=r.substring(0,this.otpInputs.length),this.otpInputs.forEach((t=>t.value="")),this.modifyNext(this.otpInputs[0],r)}handleInput(t){this.resetError(),salla.helpers.inputDigitsOnly(t.target),this.checkAllInputs()&&setTimeout((()=>{this.toggleOTPSubmit()}),100)}resetError(){this.hasError=!1,this.errorMessage=""}handleFocus(t){t.target!==this.firstOtpInput&&(""==this.firstOtpInput?.value&&this.firstOtpInput.focus(),""==t.target.previousElementSibling.value&&t.target.previousElementSibling.focus())}async getCode(){return this.code.value}async open(t){this.data=t,this.data.type=this.data.type||this.type,this.type=this.data.type,this.resendTimer(),this.otpInputs=this.body.querySelectorAll(".s-verify-input"),this.firstOtpInput=this.body.querySelector("#otp-1"),this.reset(),this.resetError(),"modal"==this.display&&this.modal?.setTitle(this.title),this.modal.open(),this.firstOtpInput?.addEventListener("input",(t=>this.splitNumber(t))),setTimeout((()=>this.otpInputs[0].focus()),100)}toggleOTPSubmit(){let t=[];if(this.otpInputs.forEach((r=>r.value&&t.push(r.value))),this.code.value=t.join(""),4===t.length)return this.btn.disable(),void this.btn.click();this.btn.enable()}reset(){this.otpInputs.forEach((t=>t.value="")),this.code.value="",this.otpInputs[0].focus()}resendTimer(){this.resendMessage.style.display="block",this.resend.style.display="none",this.resendAfter=30;let t=setInterval((()=>{this.resendAfter<=0?(clearInterval(t),this.resend.style.display="block",this.resendMessage.style.display="none"):(this.timer.innerHTML=`${this.resendAfter>=10?this.resendAfter:"0"+this.resendAfter} : 00`,this.resendAfter--)}),1e3)}resendCode(){return this.btn.stop().then((()=>this.btn.disable())).then((()=>{this.otpInputs.forEach((t=>t.value="")),this.otpInputs[0].focus()})).then((()=>salla.api.auth.resend(this.data))).finally((()=>this.resendTimer()))}submit(){if(this.code.value.length<4)return this.otpInputs[this.code.value.length].focus(),void salla.log("Trying to submit without 4 digits!");let t={code:this.code.value,...this.data};return this.btn.load().then((()=>this.btn.disable())).then((()=>this.isProfileVerify?salla.profile.verify(t):salla.auth.verify(t,this.supportWebAuth))).then((t=>this.verified.emit(t))).then((()=>this.btn.stop()&&this.btn.disable())).then((()=>this.modal.close())).then((()=>this.autoReload&&window.location.reload())).catch((t=>{this.hasError=!0,this.errorMessage=t.response?.data?.error?.message||salla.lang.get("common.errors.error_occurred"),t.response?salla.logger.error(t):console.log("Unexpected error",t),this.btn.stop()&&this.btn.enable()&&this.reset()}))}render(){return"inline"==this.display?e(i,null,this.myBody()):e("salla-modal",{width:"xs",class:"s-verify",ref:t=>this.modal=t,"modal-title":this.title},e("span",{slot:"icon",class:"s-verify-header-icon",innerHTML:"mobile"==this.type?'\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>android-phone</title>\n<path d="M22.667 0h-13.333c-2.941 0-5.333 2.392-5.333 5.333v21.333c0 2.941 2.392 5.333 5.333 5.333h13.333c2.941 0 5.333-2.392 5.333-5.333v-21.333c0-2.941-2.392-5.333-5.333-5.333zM25.333 26.667c0 1.471-1.196 2.667-2.667 2.667h-13.333c-1.471 0-2.667-1.196-2.667-2.667v-2.667h18.667zM25.333 21.333h-18.667v-16c0-1.471 1.196-2.667 2.667-2.667h13.333c1.471 0 2.667 1.196 2.667 2.667zM13.333 28h5.333c0.736 0 1.333-0.597 1.333-1.333s-0.597-1.333-1.333-1.333h-5.333c-0.736 0-1.333 0.597-1.333 1.333s0.597 1.333 1.333 1.333z"></path>\n</svg>\n':o}),this.myBody())}myBody(){return e("div",{class:"s-verify-body",ref:t=>this.body=t},e("div",{class:"s-verify-message",innerHTML:salla.lang.get("pages.profile.verify_message")}),e("slot",{name:"mobile"}),e("slot",{name:"email"}),e("input",{type:"hidden",name:"code",maxlength:"4",required:!0,ref:t=>this.code=t}),e("div",{class:{"s-verify-codes":!0,"has-error":this.hasError},dir:"ltr"},[1,2,3,4].map((t=>e("input",{type:"number",autocomplete:"one-time-code",pattern:"[0-9]*",inputmode:"numeric",maxlength:"1",value:"",id:`otp-${t}`,class:{"s-verify-input":!0,"s-has-error":this.hasError},onInput:t=>this.handleInput(t),onPaste:t=>this.handlePaste(t),onKeyUp:t=>this.handleKeyUp(t),onFocus:t=>this.handleFocus(t),required:!0})))),this.hasError&&this.errorMessage?e("span",{class:"s-verify-error-message"},this.errorMessage):"",e("div",{slot:"footer",class:"s-verify-footer"},e("salla-button",{class:"s-verify-submit","loader-position":"center",disabled:!0,onClick:()=>this.submit(),ref:t=>this.btn=t},salla.lang.get("pages.profile.verify")),e("p",{class:"s-verify-resend-message",ref:t=>this.resendMessage=t},salla.lang.get("blocks.header.resend_after"),e("b",{class:"s-verify-timer",ref:t=>this.timer=t})),e("a",{href:"#",class:"s-verify-resend",onClick:()=>this.resendCode(),ref:t=>this.resend=t},salla.lang.get("blocks.comments.submit"))),e("slot",{name:"after-footer"}))}get host(){return s(this)}};a.style='/*!twlt*/salla-verify{display:block}.s-verify-input{}.s-verify-input::-webkit-outer-spin-button,.s-verify-input::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}.s-verify-input[type=number]{-moz-appearance:textfield}.visible{visibility:visible}.block{display:block}.inline{display:inline}.hidden{display:none}.s-has-error{--tw-border-opacity:1;border-color:rgb(248 113 113 / var(--tw-border-opacity, 1))}.s-has-error:focus{--tw-border-opacity:1;border-color:rgb(239 68 68 / var(--tw-border-opacity, 1))}.btn{display:inline-flex;flex:1 1 0%;align-items:center;justify-content:center;white-space:nowrap;border-radius:0.375rem;padding-left:1.5rem;padding-right:1.5rem;padding-bottom:0.625rem;padding-top:0.5rem;font-size:0.875rem;line-height:1.25rem;font-weight:700;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:300ms}.btn:hover{opacity:0.8}.has-error .s-form-label{color:#ff443a}.has-error .s-form-control,.has-error .s-tel-input-control,.has-error .s-datetime-picker-input{border-color:#ff443a;color:#ff443a}.s-has-error{--tw-border-opacity:1 !important;border-color:rgb(239 68 68 / var(--tw-border-opacity, 1)) !important;--tw-text-opacity:1 !important;color:rgb(239 68 68 / var(--tw-text-opacity, 1)) !important}.s-verify-message{text-align:center;font-size:0.875rem;line-height:1.25rem;--tw-text-opacity:1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.s-verify-label{margin-bottom:1rem;display:block;text-align:center;font-size:0.875rem;line-height:1.25rem}.s-verify-codes{margin-left:-0.25rem;margin-right:-0.25rem;margin-bottom:1.25rem;display:flex;justify-content:space-between}.s-verify-codes.has-error{margin-bottom:0px}.s-verify-input{margin-left:0.25rem;margin-right:0.25rem;height:2.5rem;width:100%;border-radius:var(--s-radius, 0.25rem);border-width:1px;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1));padding-left:0.5rem;padding-right:0.5rem;text-align:center;font-size:1.125rem;line-height:1.75rem;font-weight:700;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms}.s-verify-input:focus{border-color:var(--color-primary)}.s-verify-input:is(.dark *){--tw-border-opacity:1;border-color:rgb(75 85 99 / var(--tw-border-opacity, 1));--tw-bg-opacity:1;background-color:rgb(75 85 99 / var(--tw-bg-opacity, 1))}.s-verify-footer{text-align:center}.s-verify-submit{margin-bottom:1.25rem;width:100%}.s-verify-header-icon{display:inline-flex;height:3rem;width:3rem;align-items:center;justify-content:center;border-radius:9999px;border-width:1px;border-style:solid;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1))}@media (min-width: 640px){.s-verify-header-icon{margin-left:auto;margin-right:auto;margin-bottom:1rem;height:5rem;width:5rem}}.s-verify-header-icon:where([dir="ltr"],[dir="ltr"] *){margin-right:0.5rem}@media (min-width: 640px){.s-verify-header-icon:where([dir="ltr"],[dir="ltr"] *){margin-right:0px}}.s-verify-header-icon:where([dir="rtl"],[dir="rtl"] *){margin-left:0.5rem}@media (min-width: 640px){.s-verify-header-icon:where([dir="rtl"],[dir="rtl"] *){margin-left:0px}}.s-verify-resend-message{font-size:0.875rem;line-height:1.25rem;--tw-text-opacity:1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.s-verify-error-message{margin-bottom:1.25rem;display:block;height:1.75rem;padding-top:0.75rem;text-align:center;font-size:0.75rem;line-height:1rem;--tw-border-opacity:1;border-color:rgb(248 113 113 / var(--tw-border-opacity, 1))}.s-verify-error-message:focus{--tw-border-opacity:1;border-color:rgb(239 68 68 / var(--tw-border-opacity, 1))}.s-verify-error-message{--tw-border-opacity:1 !important;border-color:rgb(239 68 68 / var(--tw-border-opacity, 1)) !important;--tw-text-opacity:1 !important;color:rgb(239 68 68 / var(--tw-text-opacity, 1)) !important}.s-verify-timer{margin-left:0.25rem;margin-right:0.25rem;--tw-text-opacity:1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.s-verify-resend{text-align:center;font-size:0.875rem;line-height:1.25rem;color:var(--color-primary)}.s-verify-back{position:absolute;left:10px;top:10px;display:flex;height:2rem;width:2rem;align-items:center;justify-content:center;border-radius:9999px;--tw-bg-opacity:1;background-color:rgb(249 250 251 / var(--tw-bg-opacity, 1));font-size:1.125rem;line-height:1.75rem;--tw-text-opacity:1;color:rgb(75 85 99 / var(--tw-text-opacity, 1));transition-property:color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms}.s-verify-back:hover{--tw-bg-opacity:1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.s-verify-back:where([dir="rtl"],[dir="rtl"] *){left:unset;right:10px}.s-verify-back svg{height:18px;width:18px}[dir=\'ltr\'] .s-verify-back{transform:scale(-1)}';export{a as salla_verify}
|
|
4
|
+
import{r as t,c as r,h as e,H as i,a as s}from"./p-CjQzkU95.js";import{e as o}from"./p-DzAIgzdz.js";const a=class{constructor(e){t(this,e),this.verified=r(this,"verified"),this.translationLoaded=!1,this.display="modal",this.type="mobile",this.autoReload=!0,this.supportWebAuth=!0,this.resendAfter=30,this.isProfileVerify=!1,salla.lang.onLoaded((()=>{this.translationLoaded=!0,this.title=salla.lang.get("pages.profile.verify_title")+salla.lang.get("common.elements."+this.type),this.modal?.setTitle(this.title)})),"inline"!=this.display?(salla.event.on("profile::verification",(t=>{let r=Array.isArray(t)?t[0]:t;"delete_account"===r?.request_type||document.getElementById("salla-user-settings-delete-modal")?.hasAttribute("visible")||(this.isProfileVerify=!0,this.open(r),this.title=salla.lang.get("pages.profile.verify_title")+salla.lang.get("common.elements."+r.type),this.modal?.setTitle(this.title))})),salla.event.on("modalClosed",(()=>{this.resendAfter=0,this.timer.innerHTML="30 : 00"}))):this.modal={open:()=>"",close:()=>"",setTitle:()=>""}}splitNumber(t){this.resetError();let r=t.data||t.target.value;r&&1!==r.length&&this.modifyNext(t.target,r)}modifyNext(t,r){t.value=r[0],r=r.substring(1),t.nextElementSibling&&r.length?this.modifyNext(t.nextElementSibling,r):t.nextElementSibling||0!==r.length?t.nextElementSibling&&0===r.length&&t.nextElementSibling.focus():t.focus()}checkAllInputs(){let t=!0;for(let r=0;r<this.otpInputs.length;r++)""===this.otpInputs[r].value&&(t=!1);return t}handleKeyUp(t){if(this.resetError(),["Alt","Shift","Control","AltGraph","Ctrl"].includes(t.key))return;let r=t.keyCode||t.charCode;t.target.value?(t.target.nextElementSibling?.focus(),t.target.nextElementSibling?.select()):[8,46].includes(r)&&(t.target.previousElementSibling?.focus(),t.target.previousElementSibling?.select()),t.target.value.length>1&&this.splitNumber(t)}handlePaste(t){this.resetError();let r=(salla.helpers.number(t.clipboardData.getData("text"))||"").replace(/[^0-9]/g,"");r=r.substring(0,this.otpInputs.length),this.otpInputs.forEach((t=>t.value="")),this.modifyNext(this.otpInputs[0],r)}handleInput(t){this.resetError(),salla.helpers.inputDigitsOnly(t.target),this.checkAllInputs()&&setTimeout((()=>{this.toggleOTPSubmit()}),100)}resetError(){this.hasError=!1,this.errorMessage=""}handleFocus(t){t.target!==this.firstOtpInput&&(""==this.firstOtpInput?.value&&this.firstOtpInput.focus(),""==t.target.previousElementSibling.value&&t.target.previousElementSibling.focus())}async getCode(){return this.code.value}async open(t){this.data=t,this.data.type=this.data.type||this.type,this.type=this.data.type,this.resendTimer(),this.otpInputs=this.body.querySelectorAll(".s-verify-input"),this.firstOtpInput=this.body.querySelector("#otp-1"),this.reset(),this.resetError(),"modal"==this.display&&this.modal?.setTitle(this.title),this.modal.open(),this.firstOtpInput?.addEventListener("input",(t=>this.splitNumber(t))),setTimeout((()=>this.otpInputs[0].focus()),100)}toggleOTPSubmit(){let t=[];if(this.otpInputs.forEach((r=>r.value&&t.push(r.value))),this.code.value=t.join(""),4===t.length)return this.btn.disable(),void this.btn.click();this.btn.enable()}reset(){this.otpInputs.forEach((t=>t.value="")),this.code.value="",this.otpInputs[0].focus()}resendTimer(){this.resendMessage.style.display="block",this.resend.style.display="none",this.resendAfter=30;let t=setInterval((()=>{this.resendAfter<=0?(clearInterval(t),this.resend.style.display="block",this.resendMessage.style.display="none"):(this.timer.innerHTML=`${this.resendAfter>=10?this.resendAfter:"0"+this.resendAfter} : 00`,this.resendAfter--)}),1e3)}resendCode(){return this.btn.stop().then((()=>this.btn.disable())).then((()=>{this.otpInputs.forEach((t=>t.value="")),this.otpInputs[0].focus()})).then((()=>salla.api.auth.resend(this.data))).finally((()=>this.resendTimer()))}submit(){if(this.code.value.length<4)return this.otpInputs[this.code.value.length].focus(),void salla.log("Trying to submit without 4 digits!");let t={code:this.code.value,...this.data};return this.btn.load().then((()=>this.btn.disable())).then((()=>this.isProfileVerify?salla.profile.verify(t):salla.auth.verify(t,this.supportWebAuth))).then((t=>this.verified.emit(t))).then((()=>this.btn.stop()&&this.btn.disable())).then((()=>this.modal.close())).then((()=>this.autoReload&&window.location.reload())).catch((t=>{this.hasError=!0,this.errorMessage=t.response?.data?.error?.message||salla.lang.get("common.errors.error_occurred"),t.response?salla.logger.error(t):console.log("Unexpected error",t),this.btn.stop()&&this.btn.enable()&&this.reset()}))}render(){return"inline"==this.display?e(i,null,this.myBody()):e("salla-modal",{width:"xs",class:"s-verify",ref:t=>this.modal=t,"modal-title":this.title},e("span",{slot:"icon",class:"s-verify-header-icon",innerHTML:"mobile"==this.type?'\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>android-phone</title>\n<path d="M22.667 0h-13.333c-2.941 0-5.333 2.392-5.333 5.333v21.333c0 2.941 2.392 5.333 5.333 5.333h13.333c2.941 0 5.333-2.392 5.333-5.333v-21.333c0-2.941-2.392-5.333-5.333-5.333zM25.333 26.667c0 1.471-1.196 2.667-2.667 2.667h-13.333c-1.471 0-2.667-1.196-2.667-2.667v-2.667h18.667zM25.333 21.333h-18.667v-16c0-1.471 1.196-2.667 2.667-2.667h13.333c1.471 0 2.667 1.196 2.667 2.667zM13.333 28h5.333c0.736 0 1.333-0.597 1.333-1.333s-0.597-1.333-1.333-1.333h-5.333c-0.736 0-1.333 0.597-1.333 1.333s0.597 1.333 1.333 1.333z"></path>\n</svg>\n':o}),this.myBody())}myBody(){return e("div",{class:"s-verify-body",ref:t=>this.body=t},e("div",{class:"s-verify-message",innerHTML:salla.lang.get("pages.profile.verify_message")}),e("slot",{name:"mobile"}),e("slot",{name:"email"}),e("input",{type:"hidden",name:"code",maxlength:"4",required:!0,ref:t=>this.code=t}),e("div",{class:{"s-verify-codes":!0,"has-error":this.hasError},dir:"ltr"},[1,2,3,4].map((t=>e("input",{type:"number",autocomplete:"one-time-code",pattern:"[0-9]*",inputmode:"numeric",maxlength:"1",value:"",id:`otp-${t}`,class:{"s-verify-input":!0,"s-has-error":this.hasError},onInput:t=>this.handleInput(t),onPaste:t=>this.handlePaste(t),onKeyUp:t=>this.handleKeyUp(t),onFocus:t=>this.handleFocus(t),required:!0})))),this.hasError&&this.errorMessage?e("span",{class:"s-verify-error-message"},this.errorMessage):"",e("div",{slot:"footer",class:"s-verify-footer"},e("salla-button",{class:"s-verify-submit","loader-position":"center",disabled:!0,onClick:()=>this.submit(),ref:t=>this.btn=t},salla.lang.get("pages.profile.verify")),e("p",{class:"s-verify-resend-message",ref:t=>this.resendMessage=t},salla.lang.get("blocks.header.resend_after"),e("b",{class:"s-verify-timer",ref:t=>this.timer=t})),e("a",{href:"#",class:"s-verify-resend",onClick:()=>this.resendCode(),ref:t=>this.resend=t},salla.lang.get("blocks.comments.submit"))),e("slot",{name:"after-footer"}))}get host(){return s(this)}};a.style='/*!twlt*/salla-verify{display:block}.s-verify-input{}.s-verify-input::-webkit-outer-spin-button,.s-verify-input::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}.s-verify-input[type=number]{-moz-appearance:textfield}.visible{visibility:visible}.block{display:block}.inline{display:inline}.hidden{display:none}.s-has-error{--tw-border-opacity:1;border-color:rgb(248 113 113 / var(--tw-border-opacity, 1))}.s-has-error:focus{--tw-border-opacity:1;border-color:rgb(239 68 68 / var(--tw-border-opacity, 1))}.btn{display:inline-flex;flex:1 1 0%;align-items:center;justify-content:center;white-space:nowrap;border-radius:0.375rem;padding-left:1.5rem;padding-right:1.5rem;padding-bottom:0.625rem;padding-top:0.5rem;font-size:0.875rem;line-height:1.25rem;font-weight:700;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:300ms}.btn:hover{opacity:0.8}.has-error .s-form-label{color:#ff443a}.has-error .s-form-control,.has-error .s-tel-input-control,.has-error .s-datetime-picker-input{border-color:#ff443a;color:#ff443a}.s-has-error{--tw-border-opacity:1 !important;border-color:rgb(239 68 68 / var(--tw-border-opacity, 1)) !important;--tw-text-opacity:1 !important;color:rgb(239 68 68 / var(--tw-text-opacity, 1)) !important}.s-verify-message{text-align:center;font-size:0.875rem;line-height:1.25rem;--tw-text-opacity:1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.s-verify-label{margin-bottom:1rem;display:block;text-align:center;font-size:0.875rem;line-height:1.25rem}.s-verify-codes{margin-left:-0.25rem;margin-right:-0.25rem;margin-bottom:1.25rem;display:flex;justify-content:space-between}.s-verify-codes.has-error{margin-bottom:0px}.s-verify-input{margin-left:0.25rem;margin-right:0.25rem;height:2.5rem;width:100%;border-radius:var(--s-radius, 0.25rem);border-width:1px;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1));padding-left:0.5rem;padding-right:0.5rem;text-align:center;font-size:1.125rem;line-height:1.75rem;font-weight:700;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms}.s-verify-input:focus{border-color:var(--color-primary)}.s-verify-input:is(.dark *){--tw-border-opacity:1;border-color:rgb(75 85 99 / var(--tw-border-opacity, 1));--tw-bg-opacity:1;background-color:rgb(75 85 99 / var(--tw-bg-opacity, 1))}.s-verify-footer{text-align:center}.s-verify-submit{margin-bottom:1.25rem;width:100%}.s-verify-header-icon{display:inline-flex;height:3rem;width:3rem;align-items:center;justify-content:center;border-radius:9999px;border-width:1px;border-style:solid;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1))}@media (min-width: 640px){.s-verify-header-icon{margin-left:auto;margin-right:auto;margin-bottom:1rem;height:5rem;width:5rem}}.s-verify-header-icon:where([dir="ltr"],[dir="ltr"] *){margin-right:0.5rem}@media (min-width: 640px){.s-verify-header-icon:where([dir="ltr"],[dir="ltr"] *){margin-right:0px}}.s-verify-header-icon:where([dir="rtl"],[dir="rtl"] *){margin-left:0.5rem}@media (min-width: 640px){.s-verify-header-icon:where([dir="rtl"],[dir="rtl"] *){margin-left:0px}}.s-verify-resend-message{font-size:0.875rem;line-height:1.25rem;--tw-text-opacity:1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.s-verify-error-message{margin-bottom:1.25rem;display:block;height:1.75rem;padding-top:0.75rem;text-align:center;font-size:0.75rem;line-height:1rem;--tw-border-opacity:1;border-color:rgb(248 113 113 / var(--tw-border-opacity, 1))}.s-verify-error-message:focus{--tw-border-opacity:1;border-color:rgb(239 68 68 / var(--tw-border-opacity, 1))}.s-verify-error-message{--tw-border-opacity:1 !important;border-color:rgb(239 68 68 / var(--tw-border-opacity, 1)) !important;--tw-text-opacity:1 !important;color:rgb(239 68 68 / var(--tw-text-opacity, 1)) !important}.s-verify-timer{margin-left:0.25rem;margin-right:0.25rem;--tw-text-opacity:1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.s-verify-resend{text-align:center;font-size:0.875rem;line-height:1.25rem;color:var(--color-primary)}.s-verify-back{position:absolute;left:10px;top:10px;display:flex;height:2rem;width:2rem;align-items:center;justify-content:center;border-radius:9999px;--tw-bg-opacity:1;background-color:rgb(249 250 251 / var(--tw-bg-opacity, 1));font-size:1.125rem;line-height:1.75rem;--tw-text-opacity:1;color:rgb(75 85 99 / var(--tw-text-opacity, 1));transition-property:color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms}.s-verify-back:hover{--tw-bg-opacity:1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.s-verify-back:where([dir="rtl"],[dir="rtl"] *){left:unset;right:10px}.s-verify-back svg{height:18px;width:18px}[dir=\'ltr\'] .s-verify-back{transform:scale(-1)}';export{a as salla_verify}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r,h as e,H as s}from"./p-
|
|
4
|
+
import{r,h as e,H as s}from"./p-CjQzkU95.js";import{i as t}from"./p-DqDX5na4.js";class i{async run(r){this.abort();const{signal:e}=this.controller=new AbortController;try{const s=await r(e);return e.aborted?{aborted:!0}:{aborted:!1,result:s}}catch(r){if(e.aborted)return{aborted:!0};throw r}}abort(){this.controller?.abort()}}const o=class{constructor(e){r(this,e),this.shipments=[],this.request=new i}async componentWillLoad(){return await salla.onReady(),this.fetchShipments()}async onOrderIdChange(){this.shipments=[],await this.fetchShipments()}disconnectedCallback(){this.request.abort()}async fetchShipments(){if(this.request.abort(),!salla.config.get("store.features",[]).includes("thankyou-page-multi-shipments"))return;const r=this.orderId||salla.config.get("page.id");if(r)try{const{aborted:e,result:s}=await this.request.run((e=>salla.order.api.getShipments(r,e)));if(e)return;const t=s?.data;this.shipments=Array.isArray(t)?t:Array.isArray(t?.data)?t.data:[]}catch(r){const e=r?.response?.data?.error?.message||r?.response?.data?.message;e&&salla.notify.error(e)}}label(r,e){return salla.lang.getWithDefault(r,e)}async copyTracking(r){try{await navigator.clipboard.writeText(r),salla.notify.success(this.label("common.elements.copied","تم النسخ"))}catch{}}renderTracking(r){const s=r.number;return s&&0!==Number(s)?e("span",{class:"s-order-shipments-tracking"},this.label("pages.thank_you.tracking_no","رقم تتبع الشحنة"),e("b",{dir:"ltr"},"#",s),e("button",{type:"button",class:"s-order-shipments-copy",title:this.label("common.elements.copy","نسخ"),onClick:()=>this.copyTracking(String(s))},e("span",{innerHTML:t}))):e("span",{class:"s-order-shipments-placeholder"},this.label("pages.thank_you.tracking_placeholder","سيتم تعيين رقم تتبع بمجرد تجهيز الشحنة"))}renderShipment(r,s){return e("div",{class:"s-order-shipments-card"},e("div",{class:"s-order-shipments-header"},r.logo?e("img",{src:r.logo,class:"s-order-shipments-logo",alt:r.name||"",width:"56",height:"32"}):null,e("span",{class:"s-order-shipments-title"},this.label("pages.thank_you.shipment","الشحنة")," (",s+1,")")),e("div",{class:"s-order-shipments-info"},this.renderTracking(r)),e("div",{class:"s-order-shipments-items"},(r.products||[]).map((r=>e("span",{class:"s-order-shipments-item",title:r.name},r.image?e("img",{src:r.image,alt:r.name,width:"56",height:"56"}):e("span",{class:"s-order-shipments-item-name"},r.name))))))}render(){return this.shipments.length<2?e(s,{class:"s-order-shipments-empty"}):e(s,{class:"s-order-shipments-wrapper"},e("div",{class:"s-order-shipments-list"},this.shipments.map(((r,e)=>this.renderShipment(r,e)))))}static get watchers(){return{orderId:["onOrderIdChange"]}}};o.style="/*!twlt*/:host{display:block}.s-order-shipments-wrapper{display:block}.s-order-shipments-empty{display:none}.s-order-shipments-list{display:flex;flex-wrap:wrap;gap:1rem}.s-order-shipments-card{display:flex;min-width:16rem;flex:1 1 0%;flex-basis:25%;flex-direction:column;gap:0.75rem;border-radius:1rem;background-color:var(--color-surface);padding:1rem;--tw-shadow:0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);--tw-shadow-colored:0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}.s-order-shipments-header{display:flex;gap:0.5rem}.s-order-shipments-title{font-size:15px;font-weight:700;color:var(--color-text-primary)}.s-order-shipments-logo{height:3rem;width:3rem;flex-shrink:0;border-radius:9999px;object-fit:cover}.s-order-shipments-info{display:flex;flex-wrap:wrap;align-items:center;column-gap:0.75rem;row-gap:0.5rem;font-size:13px;color:var(--color-text-secondary)}.s-order-shipments-tracking{display:inline-flex;align-items:center;gap:0.25rem}.s-order-shipments-placeholder{color:var(--color-text-secondary)}.s-order-shipments-copy{display:inline-flex;cursor:pointer;align-items:center;border-width:0px;background-color:transparent;padding:0px;color:currentColor}.s-order-shipments-copy svg{height:0.875rem;width:0.875rem;fill:currentColor}.s-order-shipments-items{display:flex;gap:0.5rem;overflow-x:auto}.s-order-shipments-item{display:inline-flex;height:4.5rem;width:4.5rem;flex-shrink:0;align-items:center;justify-content:center;overflow:hidden;border-radius:0.75rem;border-width:1px;border-color:var(--color-border);padding:0.375rem}.s-order-shipments-item img{display:block;height:100%;width:100%;object-fit:contain}.s-order-shipments-item-name{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:3;padding-left:0.25rem;padding-right:0.25rem;text-align:center;font-size:10px;line-height:1.25;color:var(--color-text-secondary)}";export{o as salla_order_shipments}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as t,c as s,h as e,H as i,a as r}from"./p-B8_UK_fg.js";import{a as o}from"./p-CgtvEd63.js";import{S as a}from"./p-DiKTtDW5.js";import{H as n}from"./p-DOBDDG4K.js";const l=class{constructor(e){t(this,e),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 e=String(s),i=this.hasCustomComponent?this.productCardComponent:"salla-product-card";for(const t of Array.from(this.wrapper.children)){const s=t,r=t.querySelector(i),o=s.product?.id??r?.product?.id;if(null!=o&&String(o)===e){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)===e&&!t.querySelector(i)){t.remove();break}}if(this.selectable){for(const t of Array.from(this.selectedProducts.keys()))String(t)===e&&this.selectedProducts.delete(t);this.emitSelection()}},this.onWishlistStorageSynced=()=>n.syncWishlistIcons(this.wrapper,`${this.productCardComponent}, salla-product-card`),this.includes=n.parseJson(this.includes||this.host.getAttribute("includes")),Array.isArray(this.includes)||(this.includes=null),n.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),salla.event.on("wishlist::storage.synced",this.onWishlistStorageSynced)}disconnectedCallback(){window.removeEventListener("DOMContentLoaded",this.boundScrollToLastViewedProduct),window.removeEventListener("scroll",this.boundHandleScroll),salla.event.off("wishlist::removed",this.onWishlistItemRemoved),salla.event.off("wishlist::storage.synced",this.onWishlistStorageSynced)}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.currentCategoryIdFilter=this.parsedFilters?.category_id?this.toCategoryIdFilter(this.parsedFilters.category_id):null),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[e,i]of Object.entries(s))this.nextPage+=`&filters[${encodeURIComponent(t)}][${encodeURIComponent(e)}]=${encodeURIComponent(i)}`;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=>{const e=s.target;e.closest("a")?(n.saveProductSource(this.getSource()),n.saveProductPosition(t.position),this.hasInfiniteScroll&&(this.takeStateSnapshot(),sessionStorage.setItem(this.lastViewedProductKey,t.id))):e.closest("salla-add-product-button")&&n.saveProductPosition(t.position)})),this.selectable?this.wrapSelectableItem(s,t):s}wrapSelectableItem(t,s){const e=document.createElement("div");e.className="s-products-list-selectable-item",e.product=s;const i=this.selectedProducts.has(s.id);i&&e.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=i,o.addEventListener("change",(()=>this.toggleSelection(s,e,o.checked))),r.appendChild(o),e.appendChild(r),e.appendChild(t),e}toggleSelection(t,s,e){e?(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()),e={ids:s,products:t,count:s.length};this.selectionChanged.emit(e),salla.event.emit("salla-products-list::selection.changed",e)}appendProductCards(t){this.wrapper&&((Array.isArray(t)?t:[t]).forEach((t=>this.wrapper.append(t))),this.onWishlistStorageSynced())}refreshWishlistIconsAfterHydration(){return salla.wishlist.api.syncStorageFromServer()}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((e=>{const i=new ResizeObserver((()=>{clearTimeout(s),s=setTimeout((()=>{i.disconnect(),e(null)}),160)}));i.observe(t)}))}waitForLayoutStable(t){let s=null,e=null;return new Promise((i=>{let r;const o=()=>{clearTimeout(s),clearTimeout(e),r.disconnect(),i(null)};r=new MutationObserver((()=>{clearTimeout(s),s=setTimeout(o,160)})),r.observe(t,{childList:!0,subtree:!0,attributes:!0}),e=setTimeout(o,1e3)}))}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 e=()=>{const t=()=>{s.scrollIntoView({block:"start",behavior:"instant"});const t=matchMedia("(max-width: 1024px)").matches?"header .inner":"ul.main-menu",e=window?.header_is_sticky?document.querySelector(t)?.getBoundingClientRect()?.height??56:0,i=parseInt(getComputedStyle(this.wrapper).rowGap)??16;scrollBy({top:-1*(e+i),behavior:"instant"})};requestAnimationFrame(t),s.querySelectorAll("img.lazy").forEach((s=>{const e=s,i=()=>{requestAnimationFrame(t),e.onload=e.onerror=null};e.onload=i,e.onerror=i})),this.removeScrollRestorationSession()};this.waitForStableLayout(this.host).then((()=>requestAnimationFrame(e)))}))}isElementLoaded(t){return new Promise((s=>{const e=setInterval((()=>{if(document.querySelector(t))return clearInterval(e),s(document.querySelector(t))}),50)}))}takeStateSnapshot(){const t=[];for(let s=0;s<this.wrapper.children.length;s++){const e=this.wrapper.children?.[s];t.push(e.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 e=salla.config.get("page.id");const i=Object.keys(this.specialPagesWithoutIds).find((t=>salla.url.is_page(t)));i?e=this.specialPagesWithoutIds[i]:null!==e&&(e=String(e)),sessionStorage.setItem(this.prevCategoryIdKey,e)}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),e=sessionStorage.getItem(this.prevCategoryIdKey),i=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"),n=i?e!==i:e!==String(r);if(e&&n&&!o&&!a||o&&!this.hasInfiniteScroll)return this.removeScrollRestorationSession(),this.switchToNormalBehavior=!0,!1;if(a)return this.switchToNormalBehavior=!0,!1;if(t)try{const{pageIndex:e,nextPage:i,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})}return this.page=e,this.nextPage=i,this.appendProductCards(r.map((t=>this.getItemHTML(t)))),!0}catch(t){console.error("Failed to load stored scroll state:",t),this.removeScrollRestorationSession()}return!1}getSource(){return n.getProductsSource(this.source)}isAuxiliaryProductsListSource(){return["json","selected","related","landing-page","recently"].includes(this.getSource())}toCategoryIdFilter(t){return Array.isArray(t)?t:t&&"object"==typeof t?Object.values(t):[t]}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:n.getProductsSourceValue(this.source,this.sourceValue)}getResponseHeader(t,s){if(!t)return;if("function"==typeof t.get)return t.get(s)||void 0;const e=t[s]??t[s.toLowerCase()];return"string"==typeof e?e:Array.isArray(e)&&"string"==typeof e[0]?e[0]:void 0}logFetchError(t,s,e,i){try{const r=s instanceof Error?s.name:void 0,o=s instanceof Error?s.message:String(s),a=i?.url||e,n=this.getResponseHeader(i?.headers,"cf-ray"),l=this.getResponseHeader(i?.headers,"cf-mitigated"),c=this.getResponseHeader(i?.headers,"server"),h="challenge"===l?.toLowerCase()||403===i?.status&&(!!n||!!c?.toLowerCase().includes("cloudflare")),d=`${r||""} ${o}`;let p="processing"===t?"processing":"unknown";"fetch"===t&&(h?p="cloudflare":/(?:^|\/)null(?:[/?#]|$)/i.test(a||"")?p="invalid_url":/timeout|timed out|abort/i.test(d)?p="timeout":!i?.status&&/fetch|network|load failed|connection/i.test(d)?p="network":i?.status&&(p="http")),salla.analytics?.log("salla::products.list.fetch.error",{errorPhase:t,failureType:p,cloudflareBlock:h,sourceList:this.getSource(),pageIndex:this.infiniteScroll?.pageIndex,httpStatus:i?.status,responseUrl:a,cfRay:n,cfMitigated:l,errorName:r,errorMessage:o.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,e)=>{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),this.onWishlistStorageSynced(),2===this.infiniteScroll.pageIndex&&(!this.autoload&&this.nextPage&&(this.loadMoreWrapper.style.display="block"),this.animateItems(),this.refreshInfiniteScrollMeasurements())}catch(t){console.error("Error during load:",t),this.logFetchError("processing",t,"string"==typeof s?s:void 0,e)}finally{this.isProcessing=!1}}})),this.infiniteScroll?.on("error",((t,s,e)=>{const i=e;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,i)})),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()}refreshInfiniteScrollMeasurements(){this.autoload&&this.infiniteScroll?.updateMeasurements&&this.waitForStableLayout(document.body).then((()=>this.infiniteScroll?.updateMeasurements?.()))}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 n.injectExtraFieldsToResponse(t)}catch(t){console.error("Error injecting data:",t)}}getInitialData(){return this.loading(),salla.api.withoutNotifier((()=>salla.product.api.fetch({source:n.getApiSource(this.getSource()),source_value:this.getSourceValue(),limit:this.limit}).catch((t=>{const s=t?.response,e=s?.request?.responseURL||t?.config?.url;throw this.logFetchError("fetch",t,e,{status:s?.status,url:e,headers:s?.headers}),t})).then((async t=>t.data.length?(await n.injectExtraFieldsToResponse(t),this.firstPageResponse?void this.appendProductCards(await this.handleResponse(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 e=this.wrapper.children[s];e?.product&&t.push(e.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=n.extractFiltersFromUrl(t),this.parsedFilters&&this.parsedFilters.category_id&&(this.currentCategoryIdFilter=this.toCategoryIdFilter(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.appendProductCards(this.getSourceValue().map((t=>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.refreshInfiniteScrollMeasurements()):!this.firstPageResponse&&this.switchToNormalBehavior?this.getInitialData().then((async()=>{this.firstPageResponse?(this.appendProductCards(await this.handleResponse(this.firstPageResponse,!1)),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&&this.appendProductCards(await this.handleResponse(this.firstPageResponse,!1)),await this.refreshWishlistIconsAfterHydration()}canRender(){return this.sourceValueIsValid&&this.isReady}render(){return this.canRender()?this.showPlaceholder?e("div",{class:"s-products-list-placeholder"},e("span",{innerHTML:a}),e("p",null,this.placeholderText)):e(i,{class:"s-products-list"},e("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}),e("div",{class:"s-infinite-scroll-status",ref:t=>this.status=t},e("p",{class:"s-infinite-scroll-last infinite-scroll-last s-hidden"},this.endOfText),e("p",{class:"s-infinite-scroll-error infinite-scroll-error s-hidden"},this.failedLoadMore)),this.autoload&&e("div",{class:"s-products-list-loading-wrapper",style:{display:"none"},ref:t=>this.loader=t},e("span",{class:"s-button-loader s-button-loader-center s-infinite-scroll-btn-loader"})),this.hasInfiniteScroll&&this.nextPage&&!this.autoload?e("div",{class:"s-infinite-scroll-wrapper",style:{display:"none"},ref:t=>this.loadMoreWrapper=t},e("button",{onClick:()=>this.loadMore(),class:"s-infinite-scroll-btn s-button-btn s-button-primary"},e("span",{class:"s-button-text s-infinite-scroll-btn-text"},this.loadMoreText?this.loadMoreText:salla.lang.get("common.elements.load_more")),e("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 e=this.getSource();if(1===t.cursor?.current){if(!this.isAuxiliaryProductsListSource()){let s=n.getPageTitleForSource(e);try{if("search"===this.getSource())s=salla.lang.get("common.elements.search_about",{word:this.getSourceValue()});else if(!s){let e=Object.keys(this.parsedFilters||{}).length?null:this.getSourceValue()[0];s=t.filters?.find((t=>"category_id"===t.key))?.values?.find((t=>t.key==e))?.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)}}n.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"));let i=await this.applyBeforeAppendItems(t.data);const r=[];for(let t=0;t<i.length;t++)r.push(this.getItemHTML(i[t]));return r}async applyBeforeAppendItems(t){const s={component:this,items:t};try{return await salla.hooks.call("salla-products-list","beforeAppendItems",s),Array.isArray(s.items)?s.items:t}catch{return t}}get host(){return r(this)}static get watchers(){return{selectable:["onSelectableChanged"]}}};l.style="/*!twlt*/.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}.sticky{position:sticky}.block{display:block}.grid{display:grid}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.s-products-list-placeholder{display:flex;flex-direction:column;align-items:center;justify-content:center;padding-top:2.5rem;padding-bottom:5rem;--tw-text-opacity:1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.s-products-list-placeholder p{padding-top:0.5rem;text-align:center;--tw-text-opacity:1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.s-products-list-placeholder span{margin-bottom:1rem;display:flex;height:8rem;width:8rem;align-items:center;justify-content:center;border-radius:9999px;--tw-bg-opacity:1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1));font-size:3rem;line-height:1;--tw-text-opacity:1;color:rgb(209 213 219 / var(--tw-text-opacity, 1))}.s-products-list-placeholder span svg{margin-left:auto;margin-right:auto;height:4rem;width:4rem;fill:#d1d5db;text-align:center}.s-button-btn{position:relative;display:inline-flex;flex:1 1 0%;user-select:none;flex-direction:row-reverse;align-items:center;justify-content:center;white-space:nowrap;border-radius:var(--s-radius, 0.25rem);border-style:solid;padding-left:1.5rem;padding-right:1.5rem;padding-bottom:0.625rem;padding-top:0.5rem;font-size:0.875rem;line-height:1.25rem;font-weight:700;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:300ms}.s-button-btn:hover{opacity:0.8}.s-button-primary{border-width:1px;border-color:var(--color-primary);background-color:var(--color-primary);color:var(--color-primary-reverse)}.s-button-primary:hover{background-color:var(--color-primary-dark)}.s-button-text{pointer-events:none;align-items:center;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;transition-property:opacity;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:300ms}.s-button-loader{margin-left:0.5rem;margin-right:0.5rem;display:flex;align-items:center;justify-content:center;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms}.s-button-loader::before{display:inline-block;height:1rem;content:var(--tw-content);width:1rem}@keyframes spin{to{content:var(--tw-content);transform:rotate(360deg)}}.s-button-loader::before{animation:spin 1s linear infinite;border-radius:9999px;border-width:2px;border-style:solid;border-top-color:var(--color-primary);border-left-color:var(--color-primary);border-bottom-color:rgb(243 244 246 / var(--tw-border-opacity, 1));--tw-border-opacity:1;border-right-color:rgb(243 244 246 / var(--tw-border-opacity, 1));--tw-content:'';content:var(--tw-content)}.s-button-loader-center .s-button-loader{position:absolute;top:50%;left:50%;margin:0px !important;--tw-translate-y:-50%;--tw-translate-x:-50%;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.s-comments-item-like-btn .s-button-text{display:flex;flex-direction:row-reverse;gap:0.5rem}.s-hidden{display:none}.s-offer-products-list-single-column .s-products-list-wrapper{display:grid !important;grid-template-columns:repeat(1, minmax(0, 1fr)) !important;gap:0.75rem}.s-offer-drawer-card .s-products-list-compact-cards{margin-bottom:0px !important}.s-order-edit-products-list .s-products-list-wrapper{gap:1rem;grid-template-columns:repeat(2,minmax(0,1fr))}@media (min-width: 769px){.s-order-edit-products-list .s-products-list-wrapper{grid-template-columns:repeat(3, minmax(0, 1fr))}}.s-order-edit-mobile-products-modal .products-list .s-products-list-wrapper{gap:0.625rem;grid-template-columns:repeat(2,minmax(0,1fr))}.s-products-list-wrapper{margin-bottom:2rem;display:grid}.s-products-list-placeholder{display:flex;flex-direction:column;align-items:center;justify-content:center;padding-top:2.5rem;padding-bottom:5rem;--tw-text-opacity:1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.s-products-list-placeholder p{padding-top:0.5rem;text-align:center;--tw-text-opacity:1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.s-products-list-row-cards{display:grid;gap:1rem}.s-products-list-vertical-cards{grid-template-columns:repeat(2, minmax(0, 1fr));gap:0.625rem}@media (min-width: 640px){.s-products-list-vertical-cards{gap:1rem}}@media (min-width: 768px){.s-products-list-vertical-cards{grid-template-columns:repeat(3, minmax(0, 1fr));gap:1.5rem}}@media (min-width: 1024px){.s-products-list-vertical-cards{grid-template-columns:repeat(4, minmax(0, 1fr))}}.s-products-list-loading-wrapper{display:flex;height:5rem;align-items:center;justify-content:center}.s-products-list-filters-results{grid-template-columns:repeat(2, minmax(0, 1fr));gap:0.625rem}@media (min-width: 640px){.s-products-list-filters-results{gap:1rem}}@media (min-width: 768px){.s-products-list-filters-results{grid-template-columns:repeat(3, minmax(0, 1fr));gap:1.5rem}}.s-products-list-horizontal-cards{grid-template-columns:repeat(1, minmax(0, 1fr));gap:1rem}@media (min-width: 640px){.s-products-list-horizontal-cards{gap:2rem}}@media (min-width: 1024px){.s-products-list-horizontal-cards{grid-template-columns:repeat(2, minmax(0, 1fr))}}.s-products-list-compact-cards{display:flex !important;flex-direction:column !important;gap:0px !important}.s-products-list-placeholder span{margin-bottom:1rem;display:flex;height:8rem;width:8rem;align-items:center;justify-content:center;border-radius:9999px;--tw-bg-opacity:1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1));font-size:3rem;line-height:1;--tw-text-opacity:1;color:rgb(209 213 219 / var(--tw-text-opacity, 1))}.s-products-list-placeholder span svg{margin-left:auto;margin-right:auto;height:4rem;width:4rem;fill:#d1d5db;text-align:center}/*!twlt*/.s-button-btn{position:relative;display:inline-flex;flex:1 1 0%;user-select:none;flex-direction:row-reverse;align-items:center;justify-content:center;white-space:nowrap;border-radius:var(--s-radius, 0.25rem);border-style:solid;padding-left:1.5rem;padding-right:1.5rem;padding-bottom:0.625rem;padding-top:0.5rem;font-size:0.875rem;line-height:1.25rem;font-weight:700;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:300ms}.s-button-btn:hover{opacity:0.8}.s-button-primary{border-width:1px;border-color:var(--color-primary);background-color:var(--color-primary);color:var(--color-primary-reverse)}.s-button-primary:hover{background-color:var(--color-primary-dark)}.s-button-text{pointer-events:none;align-items:center;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;transition-property:opacity;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:300ms}.s-button-loader{margin-left:0.5rem;margin-right:0.5rem;display:flex;align-items:center;justify-content:center;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms}.s-button-loader::before{display:inline-block;height:1rem;content:var(--tw-content);width:1rem}@keyframes spin{to{content:var(--tw-content);transform:rotate(360deg)}}.s-button-loader::before{animation:spin 1s linear infinite;border-radius:9999px;border-width:2px;border-style:solid;border-top-color:var(--color-primary);border-left-color:var(--color-primary);border-bottom-color:rgb(243 244 246 / var(--tw-border-opacity, 1));--tw-border-opacity:1;border-right-color:rgb(243 244 246 / var(--tw-border-opacity, 1));--tw-content:'';content:var(--tw-content)}.s-button-loader-center .s-button-loader{position:absolute;top:50%;left:50%;margin:0px !important;--tw-translate-y:-50%;--tw-translate-x:-50%;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.s-comments-item-like-btn .s-button-text{display:flex;flex-direction:row-reverse;gap:0.5rem}.s-infinite-scroll-wrapper{margin-top:1rem;text-align:center}.s-infinite-scroll-last{margin:0px;text-align:center}.s-infinite-scroll-error{margin:0px;text-align:center}";export{l as salla_products_list}
|
|
4
|
+
import{r as t,c as s,h as e,H as i,a as r}from"./p-CjQzkU95.js";import{a as o}from"./p-CgtvEd63.js";import{S as a}from"./p-DiKTtDW5.js";import{H as n}from"./p-DOBDDG4K.js";const l=class{constructor(e){t(this,e),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 e=String(s),i=this.hasCustomComponent?this.productCardComponent:"salla-product-card";for(const t of Array.from(this.wrapper.children)){const s=t,r=t.querySelector(i),o=s.product?.id??r?.product?.id;if(null!=o&&String(o)===e){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)===e&&!t.querySelector(i)){t.remove();break}}if(this.selectable){for(const t of Array.from(this.selectedProducts.keys()))String(t)===e&&this.selectedProducts.delete(t);this.emitSelection()}},this.onWishlistStorageSynced=()=>n.syncWishlistIcons(this.wrapper,`${this.productCardComponent}, salla-product-card`),this.includes=n.parseJson(this.includes||this.host.getAttribute("includes")),Array.isArray(this.includes)||(this.includes=null),n.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),salla.event.on("wishlist::storage.synced",this.onWishlistStorageSynced)}disconnectedCallback(){window.removeEventListener("DOMContentLoaded",this.boundScrollToLastViewedProduct),window.removeEventListener("scroll",this.boundHandleScroll),salla.event.off("wishlist::removed",this.onWishlistItemRemoved),salla.event.off("wishlist::storage.synced",this.onWishlistStorageSynced)}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.currentCategoryIdFilter=this.parsedFilters?.category_id?this.toCategoryIdFilter(this.parsedFilters.category_id):null),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[e,i]of Object.entries(s))this.nextPage+=`&filters[${encodeURIComponent(t)}][${encodeURIComponent(e)}]=${encodeURIComponent(i)}`;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=>{const e=s.target;e.closest("a")?(n.saveProductSource(this.getSource()),n.saveProductPosition(t.position),this.hasInfiniteScroll&&(this.takeStateSnapshot(),sessionStorage.setItem(this.lastViewedProductKey,t.id))):e.closest("salla-add-product-button")&&n.saveProductPosition(t.position)})),this.selectable?this.wrapSelectableItem(s,t):s}wrapSelectableItem(t,s){const e=document.createElement("div");e.className="s-products-list-selectable-item",e.product=s;const i=this.selectedProducts.has(s.id);i&&e.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=i,o.addEventListener("change",(()=>this.toggleSelection(s,e,o.checked))),r.appendChild(o),e.appendChild(r),e.appendChild(t),e}toggleSelection(t,s,e){e?(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()),e={ids:s,products:t,count:s.length};this.selectionChanged.emit(e),salla.event.emit("salla-products-list::selection.changed",e)}appendProductCards(t){this.wrapper&&((Array.isArray(t)?t:[t]).forEach((t=>this.wrapper.append(t))),this.onWishlistStorageSynced())}refreshWishlistIconsAfterHydration(){return salla.wishlist.api.syncStorageFromServer()}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((e=>{const i=new ResizeObserver((()=>{clearTimeout(s),s=setTimeout((()=>{i.disconnect(),e(null)}),160)}));i.observe(t)}))}waitForLayoutStable(t){let s=null,e=null;return new Promise((i=>{let r;const o=()=>{clearTimeout(s),clearTimeout(e),r.disconnect(),i(null)};r=new MutationObserver((()=>{clearTimeout(s),s=setTimeout(o,160)})),r.observe(t,{childList:!0,subtree:!0,attributes:!0}),e=setTimeout(o,1e3)}))}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 e=()=>{const t=()=>{s.scrollIntoView({block:"start",behavior:"instant"});const t=matchMedia("(max-width: 1024px)").matches?"header .inner":"ul.main-menu",e=window?.header_is_sticky?document.querySelector(t)?.getBoundingClientRect()?.height??56:0,i=parseInt(getComputedStyle(this.wrapper).rowGap)??16;scrollBy({top:-1*(e+i),behavior:"instant"})};requestAnimationFrame(t),s.querySelectorAll("img.lazy").forEach((s=>{const e=s,i=()=>{requestAnimationFrame(t),e.onload=e.onerror=null};e.onload=i,e.onerror=i})),this.removeScrollRestorationSession()};this.waitForStableLayout(this.host).then((()=>requestAnimationFrame(e)))}))}isElementLoaded(t){return new Promise((s=>{const e=setInterval((()=>{if(document.querySelector(t))return clearInterval(e),s(document.querySelector(t))}),50)}))}takeStateSnapshot(){const t=[];for(let s=0;s<this.wrapper.children.length;s++){const e=this.wrapper.children?.[s];t.push(e.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 e=salla.config.get("page.id");const i=Object.keys(this.specialPagesWithoutIds).find((t=>salla.url.is_page(t)));i?e=this.specialPagesWithoutIds[i]:null!==e&&(e=String(e)),sessionStorage.setItem(this.prevCategoryIdKey,e)}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),e=sessionStorage.getItem(this.prevCategoryIdKey),i=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"),n=i?e!==i:e!==String(r);if(e&&n&&!o&&!a||o&&!this.hasInfiniteScroll)return this.removeScrollRestorationSession(),this.switchToNormalBehavior=!0,!1;if(a)return this.switchToNormalBehavior=!0,!1;if(t)try{const{pageIndex:e,nextPage:i,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})}return this.page=e,this.nextPage=i,this.appendProductCards(r.map((t=>this.getItemHTML(t)))),!0}catch(t){console.error("Failed to load stored scroll state:",t),this.removeScrollRestorationSession()}return!1}getSource(){return n.getProductsSource(this.source)}isAuxiliaryProductsListSource(){return["json","selected","related","landing-page","recently"].includes(this.getSource())}toCategoryIdFilter(t){return Array.isArray(t)?t:t&&"object"==typeof t?Object.values(t):[t]}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:n.getProductsSourceValue(this.source,this.sourceValue)}getResponseHeader(t,s){if(!t)return;if("function"==typeof t.get)return t.get(s)||void 0;const e=t[s]??t[s.toLowerCase()];return"string"==typeof e?e:Array.isArray(e)&&"string"==typeof e[0]?e[0]:void 0}logFetchError(t,s,e,i){try{const r=s instanceof Error?s.name:void 0,o=s instanceof Error?s.message:String(s),a=i?.url||e,n=this.getResponseHeader(i?.headers,"cf-ray"),l=this.getResponseHeader(i?.headers,"cf-mitigated"),c=this.getResponseHeader(i?.headers,"server"),h="challenge"===l?.toLowerCase()||403===i?.status&&(!!n||!!c?.toLowerCase().includes("cloudflare")),d=`${r||""} ${o}`;let p="processing"===t?"processing":"unknown";"fetch"===t&&(h?p="cloudflare":/(?:^|\/)null(?:[/?#]|$)/i.test(a||"")?p="invalid_url":/timeout|timed out|abort/i.test(d)?p="timeout":!i?.status&&/fetch|network|load failed|connection/i.test(d)?p="network":i?.status&&(p="http")),salla.analytics?.log("salla::products.list.fetch.error",{errorPhase:t,failureType:p,cloudflareBlock:h,sourceList:this.getSource(),pageIndex:this.infiniteScroll?.pageIndex,httpStatus:i?.status,responseUrl:a,cfRay:n,cfMitigated:l,errorName:r,errorMessage:o.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,e)=>{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),this.onWishlistStorageSynced(),2===this.infiniteScroll.pageIndex&&(!this.autoload&&this.nextPage&&(this.loadMoreWrapper.style.display="block"),this.animateItems(),this.refreshInfiniteScrollMeasurements())}catch(t){console.error("Error during load:",t),this.logFetchError("processing",t,"string"==typeof s?s:void 0,e)}finally{this.isProcessing=!1}}})),this.infiniteScroll?.on("error",((t,s,e)=>{const i=e;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,i)})),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()}refreshInfiniteScrollMeasurements(){this.autoload&&this.infiniteScroll?.updateMeasurements&&this.waitForStableLayout(document.body).then((()=>this.infiniteScroll?.updateMeasurements?.()))}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 n.injectExtraFieldsToResponse(t)}catch(t){console.error("Error injecting data:",t)}}getInitialData(){return this.loading(),salla.api.withoutNotifier((()=>salla.product.api.fetch({source:n.getApiSource(this.getSource()),source_value:this.getSourceValue(),limit:this.limit}).catch((t=>{const s=t?.response,e=s?.request?.responseURL||t?.config?.url;throw this.logFetchError("fetch",t,e,{status:s?.status,url:e,headers:s?.headers}),t})).then((async t=>t.data.length?(await n.injectExtraFieldsToResponse(t),this.firstPageResponse?void this.appendProductCards(await this.handleResponse(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 e=this.wrapper.children[s];e?.product&&t.push(e.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=n.extractFiltersFromUrl(t),this.parsedFilters&&this.parsedFilters.category_id&&(this.currentCategoryIdFilter=this.toCategoryIdFilter(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.appendProductCards(this.getSourceValue().map((t=>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.refreshInfiniteScrollMeasurements()):!this.firstPageResponse&&this.switchToNormalBehavior?this.getInitialData().then((async()=>{this.firstPageResponse?(this.appendProductCards(await this.handleResponse(this.firstPageResponse,!1)),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&&this.appendProductCards(await this.handleResponse(this.firstPageResponse,!1)),await this.refreshWishlistIconsAfterHydration()}canRender(){return this.sourceValueIsValid&&this.isReady}render(){return this.canRender()?this.showPlaceholder?e("div",{class:"s-products-list-placeholder"},e("span",{innerHTML:a}),e("p",null,this.placeholderText)):e(i,{class:"s-products-list"},e("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}),e("div",{class:"s-infinite-scroll-status",ref:t=>this.status=t},e("p",{class:"s-infinite-scroll-last infinite-scroll-last s-hidden"},this.endOfText),e("p",{class:"s-infinite-scroll-error infinite-scroll-error s-hidden"},this.failedLoadMore)),this.autoload&&e("div",{class:"s-products-list-loading-wrapper",style:{display:"none"},ref:t=>this.loader=t},e("span",{class:"s-button-loader s-button-loader-center s-infinite-scroll-btn-loader"})),this.hasInfiniteScroll&&this.nextPage&&!this.autoload?e("div",{class:"s-infinite-scroll-wrapper",style:{display:"none"},ref:t=>this.loadMoreWrapper=t},e("button",{onClick:()=>this.loadMore(),class:"s-infinite-scroll-btn s-button-btn s-button-primary"},e("span",{class:"s-button-text s-infinite-scroll-btn-text"},this.loadMoreText?this.loadMoreText:salla.lang.get("common.elements.load_more")),e("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 e=this.getSource();if(1===t.cursor?.current){if(!this.isAuxiliaryProductsListSource()){let s=n.getPageTitleForSource(e);try{if("search"===this.getSource())s=salla.lang.get("common.elements.search_about",{word:this.getSourceValue()});else if(!s){let e=Object.keys(this.parsedFilters||{}).length?null:this.getSourceValue()[0];s=t.filters?.find((t=>"category_id"===t.key))?.values?.find((t=>t.key==e))?.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)}}n.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"));let i=await this.applyBeforeAppendItems(t.data);const r=[];for(let t=0;t<i.length;t++)r.push(this.getItemHTML(i[t]));return r}async applyBeforeAppendItems(t){const s={component:this,items:t};try{return await salla.hooks.call("salla-products-list","beforeAppendItems",s),Array.isArray(s.items)?s.items:t}catch{return t}}get host(){return r(this)}static get watchers(){return{selectable:["onSelectableChanged"]}}};l.style="/*!twlt*/.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}.sticky{position:sticky}.block{display:block}.grid{display:grid}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.s-products-list-placeholder{display:flex;flex-direction:column;align-items:center;justify-content:center;padding-top:2.5rem;padding-bottom:5rem;--tw-text-opacity:1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.s-products-list-placeholder p{padding-top:0.5rem;text-align:center;--tw-text-opacity:1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.s-products-list-placeholder span{margin-bottom:1rem;display:flex;height:8rem;width:8rem;align-items:center;justify-content:center;border-radius:9999px;--tw-bg-opacity:1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1));font-size:3rem;line-height:1;--tw-text-opacity:1;color:rgb(209 213 219 / var(--tw-text-opacity, 1))}.s-products-list-placeholder span svg{margin-left:auto;margin-right:auto;height:4rem;width:4rem;fill:#d1d5db;text-align:center}.s-button-btn{position:relative;display:inline-flex;flex:1 1 0%;user-select:none;flex-direction:row-reverse;align-items:center;justify-content:center;white-space:nowrap;border-radius:var(--s-radius, 0.25rem);border-style:solid;padding-left:1.5rem;padding-right:1.5rem;padding-bottom:0.625rem;padding-top:0.5rem;font-size:0.875rem;line-height:1.25rem;font-weight:700;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:300ms}.s-button-btn:hover{opacity:0.8}.s-button-primary{border-width:1px;border-color:var(--color-primary);background-color:var(--color-primary);color:var(--color-primary-reverse)}.s-button-primary:hover{background-color:var(--color-primary-dark)}.s-button-text{pointer-events:none;align-items:center;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;transition-property:opacity;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:300ms}.s-button-loader{margin-left:0.5rem;margin-right:0.5rem;display:flex;align-items:center;justify-content:center;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms}.s-button-loader::before{display:inline-block;height:1rem;content:var(--tw-content);width:1rem}@keyframes spin{to{content:var(--tw-content);transform:rotate(360deg)}}.s-button-loader::before{animation:spin 1s linear infinite;border-radius:9999px;border-width:2px;border-style:solid;border-top-color:var(--color-primary);border-left-color:var(--color-primary);border-bottom-color:rgb(243 244 246 / var(--tw-border-opacity, 1));--tw-border-opacity:1;border-right-color:rgb(243 244 246 / var(--tw-border-opacity, 1));--tw-content:'';content:var(--tw-content)}.s-button-loader-center .s-button-loader{position:absolute;top:50%;left:50%;margin:0px !important;--tw-translate-y:-50%;--tw-translate-x:-50%;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.s-comments-item-like-btn .s-button-text{display:flex;flex-direction:row-reverse;gap:0.5rem}.s-hidden{display:none}.s-offer-products-list-single-column .s-products-list-wrapper{display:grid !important;grid-template-columns:repeat(1, minmax(0, 1fr)) !important;gap:0.75rem}.s-offer-drawer-card .s-products-list-compact-cards{margin-bottom:0px !important}.s-order-edit-products-list .s-products-list-wrapper{gap:1rem;grid-template-columns:repeat(2,minmax(0,1fr))}@media (min-width: 769px){.s-order-edit-products-list .s-products-list-wrapper{grid-template-columns:repeat(3, minmax(0, 1fr))}}.s-order-edit-mobile-products-modal .products-list .s-products-list-wrapper{gap:0.625rem;grid-template-columns:repeat(2,minmax(0,1fr))}.s-products-list-wrapper{margin-bottom:2rem;display:grid}.s-products-list-placeholder{display:flex;flex-direction:column;align-items:center;justify-content:center;padding-top:2.5rem;padding-bottom:5rem;--tw-text-opacity:1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.s-products-list-placeholder p{padding-top:0.5rem;text-align:center;--tw-text-opacity:1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.s-products-list-row-cards{display:grid;gap:1rem}.s-products-list-vertical-cards{grid-template-columns:repeat(2, minmax(0, 1fr));gap:0.625rem}@media (min-width: 640px){.s-products-list-vertical-cards{gap:1rem}}@media (min-width: 768px){.s-products-list-vertical-cards{grid-template-columns:repeat(3, minmax(0, 1fr));gap:1.5rem}}@media (min-width: 1024px){.s-products-list-vertical-cards{grid-template-columns:repeat(4, minmax(0, 1fr))}}.s-products-list-loading-wrapper{display:flex;height:5rem;align-items:center;justify-content:center}.s-products-list-filters-results{grid-template-columns:repeat(2, minmax(0, 1fr));gap:0.625rem}@media (min-width: 640px){.s-products-list-filters-results{gap:1rem}}@media (min-width: 768px){.s-products-list-filters-results{grid-template-columns:repeat(3, minmax(0, 1fr));gap:1.5rem}}.s-products-list-horizontal-cards{grid-template-columns:repeat(1, minmax(0, 1fr));gap:1rem}@media (min-width: 640px){.s-products-list-horizontal-cards{gap:2rem}}@media (min-width: 1024px){.s-products-list-horizontal-cards{grid-template-columns:repeat(2, minmax(0, 1fr))}}.s-products-list-compact-cards{display:flex !important;flex-direction:column !important;gap:0px !important}.s-products-list-placeholder span{margin-bottom:1rem;display:flex;height:8rem;width:8rem;align-items:center;justify-content:center;border-radius:9999px;--tw-bg-opacity:1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1));font-size:3rem;line-height:1;--tw-text-opacity:1;color:rgb(209 213 219 / var(--tw-text-opacity, 1))}.s-products-list-placeholder span svg{margin-left:auto;margin-right:auto;height:4rem;width:4rem;fill:#d1d5db;text-align:center}/*!twlt*/.s-button-btn{position:relative;display:inline-flex;flex:1 1 0%;user-select:none;flex-direction:row-reverse;align-items:center;justify-content:center;white-space:nowrap;border-radius:var(--s-radius, 0.25rem);border-style:solid;padding-left:1.5rem;padding-right:1.5rem;padding-bottom:0.625rem;padding-top:0.5rem;font-size:0.875rem;line-height:1.25rem;font-weight:700;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:300ms}.s-button-btn:hover{opacity:0.8}.s-button-primary{border-width:1px;border-color:var(--color-primary);background-color:var(--color-primary);color:var(--color-primary-reverse)}.s-button-primary:hover{background-color:var(--color-primary-dark)}.s-button-text{pointer-events:none;align-items:center;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;transition-property:opacity;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:300ms}.s-button-loader{margin-left:0.5rem;margin-right:0.5rem;display:flex;align-items:center;justify-content:center;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms}.s-button-loader::before{display:inline-block;height:1rem;content:var(--tw-content);width:1rem}@keyframes spin{to{content:var(--tw-content);transform:rotate(360deg)}}.s-button-loader::before{animation:spin 1s linear infinite;border-radius:9999px;border-width:2px;border-style:solid;border-top-color:var(--color-primary);border-left-color:var(--color-primary);border-bottom-color:rgb(243 244 246 / var(--tw-border-opacity, 1));--tw-border-opacity:1;border-right-color:rgb(243 244 246 / var(--tw-border-opacity, 1));--tw-content:'';content:var(--tw-content)}.s-button-loader-center .s-button-loader{position:absolute;top:50%;left:50%;margin:0px !important;--tw-translate-y:-50%;--tw-translate-x:-50%;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.s-comments-item-like-btn .s-button-text{display:flex;flex-direction:row-reverse;gap:0.5rem}.s-infinite-scroll-wrapper{margin-top:1rem;text-align:center}.s-infinite-scroll-last{margin:0px;text-align:center}.s-infinite-scroll-error{margin:0px;text-align:center}";export{l as salla_products_list}
|