@salla.sa/twilight-components 2.14.577 → 2.14.578
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-iflxa4A5.js → filepond-DiR3VLv1.js} +1 -1
- package/dist/cjs/{filepond-plugin-file-poster-NZ84xlKh.js → filepond-plugin-file-poster-nSVncWQX.js} +1 -1
- package/dist/cjs/{filepond-plugin-file-validate-size-m8Z_JlZX.js → filepond-plugin-file-validate-size-D9FVy7ku.js} +1 -1
- package/dist/cjs/{filepond-plugin-file-validate-type-BfF6LYAT.js → filepond-plugin-file-validate-type-DWLGWFMm.js} +1 -1
- package/dist/cjs/{filepond-plugin-image-edit-DfRJ3iRj.js → filepond-plugin-image-edit-BUN73Jrt.js} +1 -1
- package/dist/cjs/{filepond-plugin-image-exif-orientation-BZxYZai-.js → filepond-plugin-image-exif-orientation-M1B6zNIu.js} +1 -1
- package/dist/cjs/{filepond-plugin-image-preview-BQ7HvH2d.js → filepond-plugin-image-preview-rMpT7_vG.js} +1 -1
- package/dist/cjs/{index-CSe-ijAV.js → index-BNHXq4J1.js} +2 -2
- package/dist/cjs/{intlTelInput-DHfYz8vv.js → intlTelInput-BXKy7dKL.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-applied-filters.cjs.entry.js +1 -1
- package/dist/cjs/salla-apps-icons.cjs.entry.js +1 -1
- package/dist/cjs/salla-attachment-view_9.cjs.entry.js +10 -10
- 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-bullet-delivery_3.cjs.entry.js +1 -1
- package/dist/cjs/salla-cart-coupons.cjs.entry.js +1 -1
- package/dist/cjs/salla-cart-item-offers_2.cjs.entry.js +1 -1
- package/dist/cjs/salla-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_9.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-gift-card-redeem.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_3.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.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-card.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-review-order-item.cjs.entry.js +1 -1
- package/dist/cjs/salla-scopes.cjs.entry.js +1 -1
- package/dist/cjs/salla-search-product-card.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-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/salla-wishlist-summary.cjs.entry.js +1 -1
- package/dist/cjs/twilight.cjs.js +1 -1
- package/dist/cjs/{vanilla-picker-Brk9Mb54.js → vanilla-picker-BRDtzTXg.js} +1 -1
- package/dist/components/index.js +2 -2
- package/dist/esm/{filepond-Qm94dFPs.js → filepond-BwghrUtU.js} +1 -1
- package/dist/esm/{filepond-plugin-file-poster-CHpnwHYe.js → filepond-plugin-file-poster-BSHgdKdz.js} +1 -1
- package/dist/esm/{filepond-plugin-file-validate-size-BwHBxxMg.js → filepond-plugin-file-validate-size-COeX-Fsa.js} +1 -1
- package/dist/esm/{filepond-plugin-file-validate-type-BD-yTEPO.js → filepond-plugin-file-validate-type-DAJwjUfE.js} +1 -1
- package/dist/esm/{filepond-plugin-image-edit-DKc0Yw10.js → filepond-plugin-image-edit-FJ7O8w2Y.js} +1 -1
- package/dist/esm/{filepond-plugin-image-exif-orientation-CepmNFGF.js → filepond-plugin-image-exif-orientation-h5s5nLZn.js} +1 -1
- package/dist/esm/{filepond-plugin-image-preview-FhnzagMd.js → filepond-plugin-image-preview-DK3eAJuw.js} +1 -1
- package/dist/esm/{index-BAXTlrSC.js → index-DVa_W0x-.js} +2 -2
- package/dist/esm/{intlTelInput-BJlOPJYY.js → intlTelInput-BLZLrvhk.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-applied-filters.entry.js +1 -1
- package/dist/esm/salla-apps-icons.entry.js +1 -1
- package/dist/esm/salla-attachment-view_9.entry.js +10 -10
- package/dist/esm/salla-badge.entry.js +1 -1
- package/dist/esm/salla-basket-gap.entry.js +1 -1
- package/dist/esm/salla-bullet-delivery_3.entry.js +1 -1
- package/dist/esm/salla-cart-coupons.entry.js +1 -1
- package/dist/esm/salla-cart-item-offers_2.entry.js +1 -1
- package/dist/esm/salla-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_9.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-gift-card-redeem.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_3.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.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-card.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-review-order-item.entry.js +1 -1
- package/dist/esm/salla-scopes.entry.js +1 -1
- package/dist/esm/salla-search-product-card.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-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/salla-wishlist-summary.entry.js +1 -1
- package/dist/esm/twilight.js +2 -2
- package/dist/esm/{vanilla-picker-C_cY41gl.js → vanilla-picker-JqbLxseG.js} +1 -1
- package/dist/twilight/{p-7b0cf8a1.entry.js → p-00a0d988.entry.js} +1 -1
- package/dist/twilight/{p-1fbb0b22.entry.js → p-02bd5552.entry.js} +1 -1
- package/dist/twilight/{p-3dd612a6.entry.js → p-046eb273.entry.js} +1 -1
- package/dist/twilight/{p-e944f02a.entry.js → p-04bf9f29.entry.js} +1 -1
- package/dist/twilight/{p-884104a3.entry.js → p-07ea4960.entry.js} +1 -1
- package/dist/twilight/{p-f514b9f5.entry.js → p-0c36b661.entry.js} +1 -1
- package/dist/twilight/{p-2e3a56de.entry.js → p-0c8f4565.entry.js} +1 -1
- package/dist/twilight/{p-292a0b4a.entry.js → p-0ff7ac40.entry.js} +1 -1
- package/dist/twilight/{p-665bc308.entry.js → p-119a44ea.entry.js} +1 -1
- package/dist/twilight/{p-a73a785d.entry.js → p-16268215.entry.js} +1 -1
- package/dist/twilight/{p-fc500047.entry.js → p-1b48620d.entry.js} +1 -1
- package/dist/twilight/{p-1762fd86.entry.js → p-1c5cd7fb.entry.js} +1 -1
- package/dist/twilight/{p-56609a91.entry.js → p-1d45c039.entry.js} +1 -1
- package/dist/twilight/{p-97fee81d.entry.js → p-1f042e3d.entry.js} +1 -1
- package/dist/twilight/{p-03c959bb.entry.js → p-2218d50a.entry.js} +1 -1
- package/dist/twilight/{p-2ba4956f.entry.js → p-224bd58c.entry.js} +1 -1
- package/dist/twilight/{p-411c1ab0.entry.js → p-263e3811.entry.js} +1 -1
- package/dist/twilight/{p-a9fcdac5.entry.js → p-26f9e1cb.entry.js} +1 -1
- package/dist/twilight/{p-ce1d3ad9.entry.js → p-273c4a64.entry.js} +1 -1
- package/dist/twilight/{p-ab3ad37f.entry.js → p-2c4173ae.entry.js} +1 -1
- package/dist/twilight/{p-8a865d37.entry.js → p-2e7c1ade.entry.js} +1 -1
- package/dist/twilight/{p-e95fd91e.entry.js → p-2f902a5f.entry.js} +1 -1
- package/dist/twilight/{p-898ce93b.entry.js → p-3043fba8.entry.js} +1 -1
- package/dist/twilight/{p-bf845ea7.entry.js → p-330bfb39.entry.js} +1 -1
- package/dist/twilight/{p-5a77257c.entry.js → p-38beec17.entry.js} +1 -1
- package/dist/twilight/{p-2c543420.entry.js → p-3c1edffe.entry.js} +1 -1
- package/dist/twilight/{p-abc3e5d5.entry.js → p-3c4115b4.entry.js} +1 -1
- package/dist/twilight/{p-d3cf9f8a.entry.js → p-3da970fa.entry.js} +1 -1
- package/dist/twilight/{p-d3556d1f.entry.js → p-3e880649.entry.js} +1 -1
- package/dist/twilight/{p-7d08dcfb.entry.js → p-417f4ee9.entry.js} +1 -1
- package/dist/twilight/{p-3153f560.entry.js → p-4a258ffa.entry.js} +1 -1
- package/dist/twilight/{p-c63ff8ef.entry.js → p-50ead09a.entry.js} +1 -1
- package/dist/twilight/{p-6bfe12d5.entry.js → p-51f541f6.entry.js} +1 -1
- package/dist/twilight/{p-2e4064eb.entry.js → p-570ce1bf.entry.js} +1 -1
- package/dist/twilight/{p-13abf9ca.entry.js → p-62b7e4b0.entry.js} +1 -1
- package/dist/twilight/{p-84cff600.entry.js → p-62bd8286.entry.js} +1 -1
- package/dist/twilight/{p-70451662.entry.js → p-635f58e2.entry.js} +1 -1
- package/dist/twilight/{p-80302c52.entry.js → p-66409f05.entry.js} +1 -1
- package/dist/twilight/{p-ea7846fd.entry.js → p-69ca98fa.entry.js} +1 -1
- package/dist/twilight/{p-b356f3f6.entry.js → p-69f34ab3.entry.js} +1 -1
- package/dist/twilight/{p-072ee78f.entry.js → p-6b598327.entry.js} +1 -1
- package/dist/twilight/{p-8fc2eb01.entry.js → p-6b8e2423.entry.js} +1 -1
- package/dist/twilight/{p-59a7ca2e.entry.js → p-6c59eb72.entry.js} +1 -1
- package/dist/twilight/{p-ce80fb8f.entry.js → p-6dad7861.entry.js} +1 -1
- package/dist/twilight/{p-fa6f2b27.entry.js → p-71ee45a3.entry.js} +1 -1
- package/dist/twilight/{p-3a3815a2.entry.js → p-727ac742.entry.js} +1 -1
- package/dist/twilight/{p-44a6598e.entry.js → p-75b63475.entry.js} +1 -1
- package/dist/twilight/{p-dd18ac5c.entry.js → p-78b3cf27.entry.js} +1 -1
- package/dist/twilight/{p-cc1b3318.entry.js → p-7b0803c9.entry.js} +1 -1
- package/dist/twilight/{p-51fb8841.entry.js → p-7e51dc33.entry.js} +1 -1
- package/dist/twilight/{p-f0ca37fc.entry.js → p-86e360be.entry.js} +1 -1
- package/dist/twilight/{p-faadae59.entry.js → p-890b88b3.entry.js} +1 -1
- package/dist/twilight/{p-637670fa.entry.js → p-947bf9b6.entry.js} +1 -1
- package/dist/twilight/{p-7f3e110c.entry.js → p-9634e7d0.entry.js} +1 -1
- package/dist/twilight/{p-0bcca7f8.entry.js → p-99c7dd97.entry.js} +1 -1
- package/dist/twilight/{p-DpI1J-G1.js → p-9aAPuew1.js} +1 -1
- package/dist/twilight/{p-e4ff7a77.entry.js → p-9c52cb41.entry.js} +1 -1
- package/dist/twilight/{p-SguJQlDo.js → p-BHtvvcCS.js} +1 -1
- package/dist/twilight/{p-D5lNzFgl.js → p-CA7Sra_6.js} +1 -1
- package/dist/twilight/{p-CvebbG3m.js → p-CC91r4GE.js} +1 -1
- package/dist/twilight/{p-C6WaobtY.js → p-Cbhg78C4.js} +1 -1
- package/dist/twilight/{p-BWpg3MwW.js → p-DIBthtdI.js} +1 -1
- package/dist/twilight/{p-BAXTlrSC.js → p-DVa_W0x-.js} +1 -1
- package/dist/twilight/{p-DGzNHmGp.js → p-Dp9Zd07l.js} +2 -2
- package/dist/twilight/{p-DnrvXyI6.js → p-ITMMjiXB.js} +1 -1
- package/dist/twilight/{p-162fa48e.entry.js → p-a038ec4d.entry.js} +1 -1
- package/dist/twilight/{p-6605f258.entry.js → p-a2f9f947.entry.js} +1 -1
- package/dist/twilight/{p-bb35af04.entry.js → p-a3b3834a.entry.js} +1 -1
- package/dist/twilight/{p-8c750736.entry.js → p-a65676a5.entry.js} +1 -1
- package/dist/twilight/{p-9920bbad.entry.js → p-a6716bdf.entry.js} +1 -1
- package/dist/twilight/{p-6de608eb.entry.js → p-a96bc4db.entry.js} +1 -1
- package/dist/twilight/{p-e0d834a7.entry.js → p-ac22df6b.entry.js} +1 -1
- package/dist/twilight/{p-806083b4.entry.js → p-b39b354c.entry.js} +1 -1
- package/dist/twilight/{p-fdc97278.entry.js → p-b8a6ae4d.entry.js} +1 -1
- package/dist/twilight/{p-9e054110.entry.js → p-bef4c09a.entry.js} +1 -1
- package/dist/twilight/{p-18c41e9a.entry.js → p-c077a099.entry.js} +1 -1
- package/dist/twilight/{p-13c35685.entry.js → p-c1a3d4f0.entry.js} +1 -1
- package/dist/twilight/{p-7d37b650.entry.js → p-c2a4dd3a.entry.js} +1 -1
- package/dist/twilight/{p-99b9bf66.entry.js → p-c911c7e3.entry.js} +1 -1
- package/dist/twilight/{p-b55fb51b.entry.js → p-c98857c6.entry.js} +1 -1
- package/dist/twilight/{p-e7c4d4cc.entry.js → p-cdeb3199.entry.js} +1 -1
- package/dist/twilight/{p-08cedab0.entry.js → p-cff0a6fe.entry.js} +1 -1
- package/dist/twilight/{p-51d83216.entry.js → p-d00aabe7.entry.js} +1 -1
- package/dist/twilight/{p-5c4e2ed3.entry.js → p-d152f64a.entry.js} +1 -1
- package/dist/twilight/{p-f2e13d28.entry.js → p-d6d14cc1.entry.js} +1 -1
- package/dist/twilight/{p-c38fb150.entry.js → p-d741db0f.entry.js} +1 -1
- package/dist/twilight/{p-5f464161.entry.js → p-d8a5839a.entry.js} +1 -1
- package/dist/twilight/{p-e66856c5.entry.js → p-d8b98f58.entry.js} +1 -1
- package/dist/twilight/{p-a2d07dba.entry.js → p-d8ee5381.entry.js} +1 -1
- package/dist/twilight/{p-28cdaf6b.entry.js → p-d958f0ce.entry.js} +1 -1
- package/dist/twilight/{p-c90600b1.entry.js → p-dbf1b48c.entry.js} +1 -1
- package/dist/twilight/{p-6f9bc285.entry.js → p-e55f94e6.entry.js} +1 -1
- package/dist/twilight/{p-9b4a0dd3.entry.js → p-e5cf40cb.entry.js} +1 -1
- package/dist/twilight/{p-073e1363.entry.js → p-ea41b789.entry.js} +1 -1
- package/dist/twilight/{p-0227316e.entry.js → p-ea4ee318.entry.js} +1 -1
- package/dist/twilight/{p-3cef6be2.entry.js → p-f07093cc.entry.js} +1 -1
- package/dist/twilight/{p-423d852d.entry.js → p-f41b5822.entry.js} +1 -1
- package/dist/twilight/{p-10a68a21.entry.js → p-f4df7fef.entry.js} +1 -1
- package/dist/twilight/{p-58c1bf51.entry.js → p-f6c02f02.entry.js} +1 -1
- package/dist/twilight/{p-c2e871ae.entry.js → p-f72c5177.entry.js} +1 -1
- package/dist/twilight/{p-dda4d231.entry.js → p-f78738bd.entry.js} +1 -1
- package/dist/twilight/{p-0806da7e.entry.js → p-f8327d5e.entry.js} +1 -1
- package/dist/twilight/{p-00a727c3.entry.js → p-f83821db.entry.js} +1 -1
- package/dist/twilight/{p-1fd6a10e.entry.js → p-fce7780c.entry.js} +1 -1
- package/dist/twilight/{p-a79c04a2.entry.js → p-fe0fcf0e.entry.js} +1 -1
- package/dist/twilight/{p-_f6GlygH.js → p-xewFxkoJ.js} +1 -1
- package/dist/twilight/twilight.esm.js +1 -1
- package/package.json +5 -5
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as t,c as s,h as i,H as e,a as n}from"./p-BAXTlrSC.js";import{A as o,a as l}from"./p-Vqpj4CWE.js";const d=class{constructor(i){t(this,i),this.optionsSaved=s(this,"optionsSaved"),this.productSelected=s(this,"productSelected"),this.product=null,this.sectionId=null,this.sectionIndex=0,this.productIndex=0,this.selectedOptions={},this.optionsResetTokens={},this.isLoading=!1,this.hasUnsavedChanges=!1,this.validationErrors=[],this.isProductAlreadySelected=!1}generateCacheKey(t,s,i){return`${t||"unknown"}-${s||0}-${i||"unknown"}`}handleProductChange(t){setTimeout((()=>{this.modal&&t&&this.modal.setTitle(t.name||"")}),100),this.validationErrors=[],this.hasUnsavedChanges=!1}async open(){this.modal?(this.isLoading=!0,this.product?.name&&this.modal.setTitle(this.product.name),this.modal.open(),setTimeout((async()=>{this.product?.id&&await this.initializeSelectedOptions(),this.product?.name&&this.modal.setTitle(this.product.name),this.modal.stopLoading(),this.isLoading=!1}),300)):requestAnimationFrame((()=>this.open()))}async close(){this.modal&&this.modal.close()}async refreshOptionsState(){this.selectedOptions={...this.selectedOptions}}componentDidLoad(){this.modalOpenListener=t=>{this.product=t.product,this.sectionId=t.sectionId||null,this.sectionIndex=t.sectionIndex||0,this.productIndex=t.productIndex||0,this.isProductAlreadySelected=!!t.isProductAlreadySelected,this.open()},salla.event.on("multiple-bundle-product-modal::open",this.modalOpenListener),this.clearOptionsListener=t=>{t&&t.productId&&this.clearProductOptions(t.productId,t.sectionId,t.productIndex)},salla.event.on("multiple-bundle-product-modal::clear-options",this.clearOptionsListener),this.optionChangeListener=t=>{const s=t.detail||t,{option:i,detail:e}=s,n=i||s.option_id&&this.product?.options?.find((t=>t.id===s.option_id||String(t.id)===String(s.option_id))),o=e||(s.id?s:null);this.product?.id&&n&&this.handleOptionChange(Number(this.product.id),n,o)},salla.event.on("product-options::change",this.optionChangeListener),this.checkboxChangeListener=t=>{const s=t.target;if(s&&"checkbox"===s.type&&s.name&&s.name.includes("bundle[")&&s.name.includes("][id]")){const t=s.name.match(/^bundle\[([^\]]+)\]\[([^\]]+)\]\[id\]$/);if(t&&!s.checked){if("true"===s.getAttribute("data-selection-locked"))return void(s.checked=!0);const[,i,e]=t,n=s.value,o=this.host.closest("form");this.cleanupProductDeselection({sectionId:i,productIndex:parseInt(e,10),productId:n,form:o,uncheckedInput:s})}}},document.addEventListener("change",this.checkboxChangeListener)}disconnectedCallback(){this.checkboxChangeListener&&document.removeEventListener("change",this.checkboxChangeListener),this.optionChangeListener&&salla.event.off("product-options::change",this.optionChangeListener),this.modalOpenListener&&salla.event.off("multiple-bundle-product-modal::open",this.modalOpenListener),this.clearOptionsListener&&salla.event.off("multiple-bundle-product-modal::clear-options",this.clearOptionsListener)}cleanupProductDeselection(t){const{sectionId:s,productIndex:i,productId:e,form:n,uncheckedInput:o}=t;if(this.clearProductOptions(e,s,i),n){const t=`bundle[${s}][${i}]`;Array.from(n.querySelectorAll(`input[name^="${t}"]`)).forEach((s=>{if(s===o)return;const i="hidden"===s.type,n=s.getAttribute("data-product-id")===String(e)&&s.name?.startsWith(t);(i||n)&&s.remove()})),requestAnimationFrame((()=>{const t=new window.Event("change",{bubbles:!0});n.dispatchEvent(t)}))}}generateFormInputName(t,s,i){return`bundle[${t}][${s}][options][${i}]`}async initializeSelectedOptions(){if(!this.product?.id)return;const t=this.product.id,s=this.generateCacheKey(this.sectionId,this.productIndex,t),i=document.querySelector(`salla-product-options[product-id="${t}"]`);if(i)try{const t=await i.getSelectedOptions();t&&t.length>0&&(this.selectedOptions={...this.selectedOptions,[s]:t})}catch(t){console.warn("Could not initialize selected options:",t)}}clearProductOptions(t,s,i){const e={...this.selectedOptions};if(null==s||null==i||Number.isNaN(i)){const s=`-${String(t)}`,i=[];Object.keys(e).forEach((t=>{t.endsWith(s)&&(delete e[t],i.push(t))})),i.forEach((t=>this.bumpOptionsResetToken(t)))}else{const n=this.generateCacheKey(s,i,t);delete e[n],this.bumpOptionsResetToken(n)}this.selectedOptions=e,this.validationErrors=[],this.hasUnsavedChanges=!1}bumpOptionsResetToken(t){t&&(this.optionsResetTokens={...this.optionsResetTokens,[t]:(this.optionsResetTokens[t]||0)+1})}async handleOptionChange(t,s,i){const e=this.generateCacheKey(this.sectionId,this.productIndex,t),n=document.querySelector(`salla-product-options[product-id="${t}"]`);let o=[];if(n)try{o=await n.getSelectedOptions()||[]}catch(t){console.warn("Could not get current selections from component:",t)}if(o.length>0)this.selectedOptions={...this.selectedOptions,[e]:o};else if(this.selectedOptions[e]&&this.selectedOptions[e].length>0){const t=[...this.selectedOptions[e]||[]],n=t.findIndex((t=>t.option_id===s.id));n>-1?i&&null!=i.id?t[n]={...i,option_id:s.id}:t.splice(n,1):i&&null!=i.id&&t.push({...i,option_id:s.id}),this.selectedOptions={...this.selectedOptions,[e]:t}}else i&&null!=i.id&&(this.selectedOptions={...this.selectedOptions,[e]:[{...i,option_id:s.id}]});this.hasUnsavedChanges=!0,this.validationErrors=[]}async validateOptions(){if(!this.product?.options)return!0;const t=[],s=this.product.id,i=this.generateCacheKey(this.sectionId,this.productIndex,s),e=document.querySelector(`salla-product-options[product-id="${s}"]`);let n=[];if(e)try{n=await e.getSelectedOptions()||[];const t=this.selectedOptions[i]||[];(t.length>n.length||0===n.length&&t.length>0)&&(n=t)}catch(t){n=this.selectedOptions[i]||[]}else n=this.selectedOptions[i]||[];return 0===n.length&&t.push(salla.lang.get("pages.products.no_options_selected")),this.product.options.forEach((s=>{s.required&&(n.some((t=>t.option_id==s.id))||t.push(salla.lang.get("pages.products.required_option_missing",{option:s.name})))})),this.validationErrors=t,0===t.length}async onSave(t){t.preventDefault();const s=this.product?.id;if(!s)return;const i=this.generateCacheKey(this.sectionId,this.productIndex,s);if(await new Promise((t=>setTimeout(t,100))),await this.validateOptions()){if(!this.isProductAlreadySelected&&null!=this.sectionId){const t=this.host.closest("salla-multiple-bundle-product-details");if(!await(t?.canSelectBundleProduct(this.sectionId,s)))return void salla.notify.error(salla.lang.getWithDefault("pages.products.bundle_selection_limit_reached","لا يمكنك اختيار المزيد من المنتجات في هذا القسم"))}this.isLoading=!0;try{const t=document.querySelector(`salla-product-options[product-id="${s}"]`);let e=await(t?.getSelectedOptions());if((!e||0===e.length)&&this.selectedOptions[i]?.length>0&&(e=this.selectedOptions[i]),!e||0===e.length)return void(this.isLoading=!1);this.selectedOptions={...this.selectedOptions,[i]:e};const n=this.host.closest("form");if(!n)return void(this.isLoading=!1);const o=`bundle[${this.sectionId}][${this.productIndex}]`;Array.from(n.querySelectorAll(`input[name^="${o}"][type="hidden"]`)).forEach((t=>t.remove())),Array.from(n.querySelectorAll(`[data-product-id="${s}"][name^="${o}"]`)).forEach((t=>t.remove()));const l=`bundle[${this.sectionId}][${this.productIndex}][id]`,d=document.getElementById(l);if(d)d.checked=!0;else{const t=document.createElement("input");t.type="hidden",t.name=`bundle[${this.sectionId}][${this.productIndex}][id]`,t.value=String(s),t.dataset.productId=String(s),n.appendChild(t)}e.forEach((t=>{const i=t.option_id,e=document.createElement("input");e.type="hidden",e.name=this.generateFormInputName(this.sectionId,this.productIndex??0,i),e.value=String(t.id),e.dataset.productId=String(s),n.appendChild(e)}));const a=new window.Event("change",{bubbles:!0});n.dispatchEvent(a),this.optionsSaved.emit({productId:Number(s),selectedOptions:e,sectionId:this.sectionId,productIndex:this.productIndex}),this.sectionId&&this.productSelected.emit({productId:Number(s),sectionId:this.sectionId,product:this.product,fromModal:!0}),salla.notify.success(salla.lang.get("pages.products.options_saved")),this.hasUnsavedChanges=!1,this.validationErrors=[],this.modal.close()}catch(t){salla.notify.error(salla.lang.get("pages.products.options_save_error"))}finally{this.isLoading=!1}}else salla.notify.error(this.validationErrors.join(", "))}getOptionsWithSelectedState(){if(!this.product?.options)return[];const t=this.generateCacheKey(this.sectionId,this.productIndex,this.product.id),s=this.selectedOptions[t]||[];return this.product.options.map((t=>({...t,details:t.details.map((t=>{const i=s.some((s=>s.id===t.id));return{...t,is_selected:i}}))})))}render(){const t=this.product?.id,s=this.getOptionsWithSelectedState(),n=this.generateCacheKey(this.sectionId,this.productIndex,t),o=this.optionsResetTokens[n]||0,l=this.isLoading||s.some((t=>t.details.some((t=>t.is_selected&&!0===t.is_out))));return i(e,{key:"80217a97bc81ba7eb770cfa88347530b5cc0850d"},i("salla-modal",{key:"f23a97440cdb8418a0f8cf129328fb8c0a0a4fc5",isLoading:this.isLoading,ref:t=>this.modal=t,width:"md",centered:!1,id:`s-multiple-bundle-product-options-modal-options-${t}`,class:"s-multiple-bundle-product-options-modal-wrapper"},i("div",{key:"06dfaf9708dd142dd0e44b6846cc0ca49be39bb6",slot:"loading"},i("salla-skeleton",{key:"a5d348f9a5158ee85d418f30f302a929f0a4dbdd",height:"100%",width:"100%"})),this.product?.images&&this.product?.images.length>0&&i("salla-slider",{key:"d3b1a1bb86708a807ee0c3a0168440f9d38b1eb8",id:`details-slider-${this.product?.id}`,type:"thumbs",loop:!1,"auto-height":!0,"listen-to-thumbnails-option":!0,showThumbsControls:!1,controlsOuter:!1,showControls:!1,class:"s-multiple-bundle-product-options-modal-slider",verticalThumbs:!0,thumbsConfig:{centeredSlides:!0,centeredSlidesBounds:!0,slidesPerView:Math.min(5,Math.max(1,this.product?.images.length)),watchOverflow:!0,watchSlidesProgress:!0,direction:"vertical",spaceBetween:10}},i("div",{key:"b7d04522efcb3f0a85ac78a9bf6f654973f6c777",slot:"items"},this.product?.images&&this.product?.images.map(((t,s)=>i("div",{key:s,class:"swiper-slide"},i("img",{src:t.url,alt:t.alt||`${this.product?.name} - Image ${s+1}`,loading:"lazy",onError:t=>{t.target.style.display="none"}}))))),this.product?.images&&this.product?.images.length>1&&i("div",{key:"3751a38d528780bb5f6ede2eb74365eefd5d42c7",slot:"thumbs"},this.product?.images&&this.product?.images.map(((t,s)=>i("div",{key:s,"data-caption":`${this.product?.name} - Image ${s+1}`},i("img",{src:t.url,loading:"eager",class:"s-multiple-bundle-product-options-modal-slider-thumb",title:`${this.product?.name} - ${s+1}`,alt:t.alt||`${this.product?.name} - ${s+1}`,onError:t=>{t.target.style.display="none"}})))))),i("salla-product-options",{options:JSON.stringify(s),key:`${n}-reset-${o}`,"product-id":t,"unique-key":`${n}-reset-${o}`}),i("div",{key:"68d6671c68f3753edd92f3c8ea8c91774038da59",slot:"footer"},i("div",{key:"f980914dbdbbea3aa02f6c816e2372f7bb09009e",class:"s-multiple-bundle-product-options-modal-footer"},i("salla-button",{key:"5d67dc612aa88fbc6eb11bcd5be0fc6d77a15aba",onClick:t=>this.onSave(t),loading:this.isLoading,disabled:l},this.isLoading?salla.lang.get("common.elements.saving"):salla.lang.get("common.elements.save"))))))}get host(){return n(this)}static get watchers(){return{product:["handleProductChange"]}}};d.style=":host{display:block}";const a=class{constructor(i){t(this,i),this.productSelected=s(this,"productSelected"),this.productOptionsSelected=s(this,"productOptionsSelected"),this.selectedProducts={},this.isSelectionLocked=!1,this.selectionLimit=0,this.savedOptionsByInstance={},this.handleProductClick=(t,s)=>{const i=this.selectedProducts[this.section.id]?.has(t.id)||!1,e=this.getCheckbox(this.section.id,s);if(i&&this.isSelectionLocked)return void(e&&(e.checked=!0));if(!i&&this.isMaxSelectionReached()&&1!==this.selectionLimit)return;if(1===this.selectionLimit&&!i)return void this.productSelected.emit({product:t,sectionId:this.section.id});if(!e)return;const n=!e.checked;n||(this.dispatchClearOptionsEvent(t,s),this.clearSavedOptionsState(this.section.id,s)),e.checked=n,requestAnimationFrame((()=>{const t=new window.Event("change",{bubbles:!0});e.dispatchEvent(t)})),this.productSelected.emit({product:t,sectionId:this.section.id})},this.handleOptionsClick=t=>{!this.selectedProducts[this.section.id]?.has(t.id)&&this.isMaxSelectionReached()&&1!==this.selectionLimit||this.productOptionsSelected.emit({product:t,sectionId:this.section.id})}}getSelectedCount(){return this.selectedProducts[this.section?.id]?.size??0}isMaxSelectionReached(){return this.selectionLimit>1&&this.getSelectedCount()>=this.selectionLimit}isProductSelectionDisabled(t,s){return 0===t.quantity||!s&&this.isMaxSelectionReached()}getProductInstanceKey(t,s){return`${t}::${s}`}dispatchClearOptionsEvent(t,s){salla.event.dispatch("multiple-bundle-product-modal::clear-options",{productId:t.id,sectionId:this.section.id,sectionIndex:this.sectionIndex,productIndex:s})}handleOptionsSaved(t){const s=t.detail;if(!s)return;const{sectionId:i,productIndex:e,selectedOptions:n}=s;if(null==i||i!==this.section?.id)return;if(null==e||Number.isNaN(e))return;const o=this.getProductInstanceKey(i,e);if(n?.length)this.savedOptionsByInstance={...this.savedOptionsByInstance,[o]:!0};else if(this.savedOptionsByInstance[o]){const t={...this.savedOptionsByInstance};delete t[o],this.savedOptionsByInstance=t}}clearSavedOptionsState(t,s){const i=this.getProductInstanceKey(t,s);if(!this.savedOptionsByInstance[i])return;const e={...this.savedOptionsByInstance};delete e[i],this.savedOptionsByInstance=e}generateEventName(t,s){return`bundle[${t}][${s}][id]`}getCheckbox(t,s){const i=this.generateEventName(t,s);return this.host.querySelector(`input.s-multiple-bundle-product-checkbox[name="${i}"]`)}preventLockedDeselect(t,s){if(!this.isSelectionLocked||!s)return;t.preventDefault(),t.stopPropagation();const i=t.target;"checkbox"===i?.type&&(i.checked=!0)}render(){return i(e,{key:"84a2765b8e57fa7d4d757c7e0c8a634199e7f121"},i("salla-slider",{key:"67d1748a2c19adca4db056bd3b5e5de6813aa367",type:"carousel",controlsOuter:!1,showControls:!1,id:`accordion-multiple-bundle-product-${this.section.id}`,pagination:!0,class:"s-multiple-bundle-product-wrapper-slider",sliderConfig:{spaceBetween:0}},i("div",{key:"04547e4a998d15377a2d5573bd0c4d8d33a93af7",slot:"items"},this?.section?.products?.map(((t,s)=>{const e=this.selectedProducts[this.section.id]?.has(t.id)||!1,n=e&&this.isSelectionLocked,d=this.isProductSelectionDisabled(t,e),a=this.savedOptionsByInstance[this.getProductInstanceKey(this.section.id,s)]?salla.lang.getWithDefault("pages.products.edit_selected_options","تعديل الخيارات"):salla.lang.get("pages.products.choose_from_options");let c=salla.config.get("theme.is_rtl",!0)?o:l;return i("div",{class:"s-multiple-bundle-product-slide-one-third"+(d?" s-multiple-bundle-product-slide-one-third-disabled":""),key:t.id},i("div",{class:"s-multiple-bundle-product-card"},i("div",{class:"s-multiple-bundle-product-image-wrapper",onClick:()=>this.handleProductClick(t,s)},i("input",{id:this.generateEventName(this.section.id,s),type:"checkbox",class:"s-multiple-bundle-product-checkbox",checked:e,"data-selection-locked":n?"true":void 0,name:this.generateEventName(this.section.id,s),value:t.id,onClick:t=>this.preventLockedDeselect(t,e),onChange:t=>this.preventLockedDeselect(t,e)}),i("img",{src:t.image.url||salla.url.cdn("images/s-empty.png"),loading:"lazy",alt:t.image.alt||t.name,class:"s-multiple-bundle-product-image"})),i("div",{class:"s-multiple-bundle-product-content-wrapper"},i("div",{class:"s-multiple-bundle-product-content"},i("div",{class:"s-multiple-bundle-product-details"},i("div",{class:"s-multiple-bundle-product-title-wrapper"},i("h2",{class:"s-multiple-bundle-product-title"},i("a",{href:t?.url||"#",target:"_blank",rel:"noopener noreferrer"},t.name))),i("div",{class:"s-multiple-bundle-product-price-wrapper"},i("span",{class:"s-multiple-bundle-product-price"},i("span",{innerHTML:salla.money(t.price)})),t.sale_price>0&&i("span",{class:"s-multiple-bundle-product-price-discount"},i("span",{innerHTML:salla.money(t.regular_price)})))),t.quantity_in_group>0&&0!==t.quantity&&i("span",{class:"s-multiple-bundle-product-badge"},salla.lang.get("pages.products.pieces"),i("span",null,t.quantity_in_group)),0===t.quantity&&i("span",{class:"s-multiple-bundle-product-badge"},salla.lang.get("pages.products.quantity_in_group_finished"))),t.options?.length>0&&i("button",{class:"s-multiple-bundle-product-button",onClick:()=>this.handleOptionsClick(t),type:"button"},a,i("span",{class:"s-multiple-bundle-product-button-icon",innerHTML:c})))))})))))}get host(){return n(this)}};a.style="";export{d as salla_multiple_bundle_product_options_modal,a as salla_multiple_bundle_product_slider}
|
|
4
|
+
import{r as t,c as s,h as i,H as e,a as n}from"./p-DVa_W0x-.js";import{A as o,a as l}from"./p-Vqpj4CWE.js";const d=class{constructor(i){t(this,i),this.optionsSaved=s(this,"optionsSaved"),this.productSelected=s(this,"productSelected"),this.product=null,this.sectionId=null,this.sectionIndex=0,this.productIndex=0,this.selectedOptions={},this.optionsResetTokens={},this.isLoading=!1,this.hasUnsavedChanges=!1,this.validationErrors=[],this.isProductAlreadySelected=!1}generateCacheKey(t,s,i){return`${t||"unknown"}-${s||0}-${i||"unknown"}`}handleProductChange(t){setTimeout((()=>{this.modal&&t&&this.modal.setTitle(t.name||"")}),100),this.validationErrors=[],this.hasUnsavedChanges=!1}async open(){this.modal?(this.isLoading=!0,this.product?.name&&this.modal.setTitle(this.product.name),this.modal.open(),setTimeout((async()=>{this.product?.id&&await this.initializeSelectedOptions(),this.product?.name&&this.modal.setTitle(this.product.name),this.modal.stopLoading(),this.isLoading=!1}),300)):requestAnimationFrame((()=>this.open()))}async close(){this.modal&&this.modal.close()}async refreshOptionsState(){this.selectedOptions={...this.selectedOptions}}componentDidLoad(){this.modalOpenListener=t=>{this.product=t.product,this.sectionId=t.sectionId||null,this.sectionIndex=t.sectionIndex||0,this.productIndex=t.productIndex||0,this.isProductAlreadySelected=!!t.isProductAlreadySelected,this.open()},salla.event.on("multiple-bundle-product-modal::open",this.modalOpenListener),this.clearOptionsListener=t=>{t&&t.productId&&this.clearProductOptions(t.productId,t.sectionId,t.productIndex)},salla.event.on("multiple-bundle-product-modal::clear-options",this.clearOptionsListener),this.optionChangeListener=t=>{const s=t.detail||t,{option:i,detail:e}=s,n=i||s.option_id&&this.product?.options?.find((t=>t.id===s.option_id||String(t.id)===String(s.option_id))),o=e||(s.id?s:null);this.product?.id&&n&&this.handleOptionChange(Number(this.product.id),n,o)},salla.event.on("product-options::change",this.optionChangeListener),this.checkboxChangeListener=t=>{const s=t.target;if(s&&"checkbox"===s.type&&s.name&&s.name.includes("bundle[")&&s.name.includes("][id]")){const t=s.name.match(/^bundle\[([^\]]+)\]\[([^\]]+)\]\[id\]$/);if(t&&!s.checked){if("true"===s.getAttribute("data-selection-locked"))return void(s.checked=!0);const[,i,e]=t,n=s.value,o=this.host.closest("form");this.cleanupProductDeselection({sectionId:i,productIndex:parseInt(e,10),productId:n,form:o,uncheckedInput:s})}}},document.addEventListener("change",this.checkboxChangeListener)}disconnectedCallback(){this.checkboxChangeListener&&document.removeEventListener("change",this.checkboxChangeListener),this.optionChangeListener&&salla.event.off("product-options::change",this.optionChangeListener),this.modalOpenListener&&salla.event.off("multiple-bundle-product-modal::open",this.modalOpenListener),this.clearOptionsListener&&salla.event.off("multiple-bundle-product-modal::clear-options",this.clearOptionsListener)}cleanupProductDeselection(t){const{sectionId:s,productIndex:i,productId:e,form:n,uncheckedInput:o}=t;if(this.clearProductOptions(e,s,i),n){const t=`bundle[${s}][${i}]`;Array.from(n.querySelectorAll(`input[name^="${t}"]`)).forEach((s=>{if(s===o)return;const i="hidden"===s.type,n=s.getAttribute("data-product-id")===String(e)&&s.name?.startsWith(t);(i||n)&&s.remove()})),requestAnimationFrame((()=>{const t=new window.Event("change",{bubbles:!0});n.dispatchEvent(t)}))}}generateFormInputName(t,s,i){return`bundle[${t}][${s}][options][${i}]`}async initializeSelectedOptions(){if(!this.product?.id)return;const t=this.product.id,s=this.generateCacheKey(this.sectionId,this.productIndex,t),i=document.querySelector(`salla-product-options[product-id="${t}"]`);if(i)try{const t=await i.getSelectedOptions();t&&t.length>0&&(this.selectedOptions={...this.selectedOptions,[s]:t})}catch(t){console.warn("Could not initialize selected options:",t)}}clearProductOptions(t,s,i){const e={...this.selectedOptions};if(null==s||null==i||Number.isNaN(i)){const s=`-${String(t)}`,i=[];Object.keys(e).forEach((t=>{t.endsWith(s)&&(delete e[t],i.push(t))})),i.forEach((t=>this.bumpOptionsResetToken(t)))}else{const n=this.generateCacheKey(s,i,t);delete e[n],this.bumpOptionsResetToken(n)}this.selectedOptions=e,this.validationErrors=[],this.hasUnsavedChanges=!1}bumpOptionsResetToken(t){t&&(this.optionsResetTokens={...this.optionsResetTokens,[t]:(this.optionsResetTokens[t]||0)+1})}async handleOptionChange(t,s,i){const e=this.generateCacheKey(this.sectionId,this.productIndex,t),n=document.querySelector(`salla-product-options[product-id="${t}"]`);let o=[];if(n)try{o=await n.getSelectedOptions()||[]}catch(t){console.warn("Could not get current selections from component:",t)}if(o.length>0)this.selectedOptions={...this.selectedOptions,[e]:o};else if(this.selectedOptions[e]&&this.selectedOptions[e].length>0){const t=[...this.selectedOptions[e]||[]],n=t.findIndex((t=>t.option_id===s.id));n>-1?i&&null!=i.id?t[n]={...i,option_id:s.id}:t.splice(n,1):i&&null!=i.id&&t.push({...i,option_id:s.id}),this.selectedOptions={...this.selectedOptions,[e]:t}}else i&&null!=i.id&&(this.selectedOptions={...this.selectedOptions,[e]:[{...i,option_id:s.id}]});this.hasUnsavedChanges=!0,this.validationErrors=[]}async validateOptions(){if(!this.product?.options)return!0;const t=[],s=this.product.id,i=this.generateCacheKey(this.sectionId,this.productIndex,s),e=document.querySelector(`salla-product-options[product-id="${s}"]`);let n=[];if(e)try{n=await e.getSelectedOptions()||[];const t=this.selectedOptions[i]||[];(t.length>n.length||0===n.length&&t.length>0)&&(n=t)}catch(t){n=this.selectedOptions[i]||[]}else n=this.selectedOptions[i]||[];return 0===n.length&&t.push(salla.lang.get("pages.products.no_options_selected")),this.product.options.forEach((s=>{s.required&&(n.some((t=>t.option_id==s.id))||t.push(salla.lang.get("pages.products.required_option_missing",{option:s.name})))})),this.validationErrors=t,0===t.length}async onSave(t){t.preventDefault();const s=this.product?.id;if(!s)return;const i=this.generateCacheKey(this.sectionId,this.productIndex,s);if(await new Promise((t=>setTimeout(t,100))),await this.validateOptions()){if(!this.isProductAlreadySelected&&null!=this.sectionId){const t=this.host.closest("salla-multiple-bundle-product-details");if(!await(t?.canSelectBundleProduct(this.sectionId,s)))return void salla.notify.error(salla.lang.getWithDefault("pages.products.bundle_selection_limit_reached","لا يمكنك اختيار المزيد من المنتجات في هذا القسم"))}this.isLoading=!0;try{const t=document.querySelector(`salla-product-options[product-id="${s}"]`);let e=await(t?.getSelectedOptions());if((!e||0===e.length)&&this.selectedOptions[i]?.length>0&&(e=this.selectedOptions[i]),!e||0===e.length)return void(this.isLoading=!1);this.selectedOptions={...this.selectedOptions,[i]:e};const n=this.host.closest("form");if(!n)return void(this.isLoading=!1);const o=`bundle[${this.sectionId}][${this.productIndex}]`;Array.from(n.querySelectorAll(`input[name^="${o}"][type="hidden"]`)).forEach((t=>t.remove())),Array.from(n.querySelectorAll(`[data-product-id="${s}"][name^="${o}"]`)).forEach((t=>t.remove()));const l=`bundle[${this.sectionId}][${this.productIndex}][id]`,d=document.getElementById(l);if(d)d.checked=!0;else{const t=document.createElement("input");t.type="hidden",t.name=`bundle[${this.sectionId}][${this.productIndex}][id]`,t.value=String(s),t.dataset.productId=String(s),n.appendChild(t)}e.forEach((t=>{const i=t.option_id,e=document.createElement("input");e.type="hidden",e.name=this.generateFormInputName(this.sectionId,this.productIndex??0,i),e.value=String(t.id),e.dataset.productId=String(s),n.appendChild(e)}));const a=new window.Event("change",{bubbles:!0});n.dispatchEvent(a),this.optionsSaved.emit({productId:Number(s),selectedOptions:e,sectionId:this.sectionId,productIndex:this.productIndex}),this.sectionId&&this.productSelected.emit({productId:Number(s),sectionId:this.sectionId,product:this.product,fromModal:!0}),salla.notify.success(salla.lang.get("pages.products.options_saved")),this.hasUnsavedChanges=!1,this.validationErrors=[],this.modal.close()}catch(t){salla.notify.error(salla.lang.get("pages.products.options_save_error"))}finally{this.isLoading=!1}}else salla.notify.error(this.validationErrors.join(", "))}getOptionsWithSelectedState(){if(!this.product?.options)return[];const t=this.generateCacheKey(this.sectionId,this.productIndex,this.product.id),s=this.selectedOptions[t]||[];return this.product.options.map((t=>({...t,details:t.details.map((t=>{const i=s.some((s=>s.id===t.id));return{...t,is_selected:i}}))})))}render(){const t=this.product?.id,s=this.getOptionsWithSelectedState(),n=this.generateCacheKey(this.sectionId,this.productIndex,t),o=this.optionsResetTokens[n]||0,l=this.isLoading||s.some((t=>t.details.some((t=>t.is_selected&&!0===t.is_out))));return i(e,{key:"80217a97bc81ba7eb770cfa88347530b5cc0850d"},i("salla-modal",{key:"f23a97440cdb8418a0f8cf129328fb8c0a0a4fc5",isLoading:this.isLoading,ref:t=>this.modal=t,width:"md",centered:!1,id:`s-multiple-bundle-product-options-modal-options-${t}`,class:"s-multiple-bundle-product-options-modal-wrapper"},i("div",{key:"06dfaf9708dd142dd0e44b6846cc0ca49be39bb6",slot:"loading"},i("salla-skeleton",{key:"a5d348f9a5158ee85d418f30f302a929f0a4dbdd",height:"100%",width:"100%"})),this.product?.images&&this.product?.images.length>0&&i("salla-slider",{key:"d3b1a1bb86708a807ee0c3a0168440f9d38b1eb8",id:`details-slider-${this.product?.id}`,type:"thumbs",loop:!1,"auto-height":!0,"listen-to-thumbnails-option":!0,showThumbsControls:!1,controlsOuter:!1,showControls:!1,class:"s-multiple-bundle-product-options-modal-slider",verticalThumbs:!0,thumbsConfig:{centeredSlides:!0,centeredSlidesBounds:!0,slidesPerView:Math.min(5,Math.max(1,this.product?.images.length)),watchOverflow:!0,watchSlidesProgress:!0,direction:"vertical",spaceBetween:10}},i("div",{key:"b7d04522efcb3f0a85ac78a9bf6f654973f6c777",slot:"items"},this.product?.images&&this.product?.images.map(((t,s)=>i("div",{key:s,class:"swiper-slide"},i("img",{src:t.url,alt:t.alt||`${this.product?.name} - Image ${s+1}`,loading:"lazy",onError:t=>{t.target.style.display="none"}}))))),this.product?.images&&this.product?.images.length>1&&i("div",{key:"3751a38d528780bb5f6ede2eb74365eefd5d42c7",slot:"thumbs"},this.product?.images&&this.product?.images.map(((t,s)=>i("div",{key:s,"data-caption":`${this.product?.name} - Image ${s+1}`},i("img",{src:t.url,loading:"eager",class:"s-multiple-bundle-product-options-modal-slider-thumb",title:`${this.product?.name} - ${s+1}`,alt:t.alt||`${this.product?.name} - ${s+1}`,onError:t=>{t.target.style.display="none"}})))))),i("salla-product-options",{options:JSON.stringify(s),key:`${n}-reset-${o}`,"product-id":t,"unique-key":`${n}-reset-${o}`}),i("div",{key:"68d6671c68f3753edd92f3c8ea8c91774038da59",slot:"footer"},i("div",{key:"f980914dbdbbea3aa02f6c816e2372f7bb09009e",class:"s-multiple-bundle-product-options-modal-footer"},i("salla-button",{key:"5d67dc612aa88fbc6eb11bcd5be0fc6d77a15aba",onClick:t=>this.onSave(t),loading:this.isLoading,disabled:l},this.isLoading?salla.lang.get("common.elements.saving"):salla.lang.get("common.elements.save"))))))}get host(){return n(this)}static get watchers(){return{product:["handleProductChange"]}}};d.style=":host{display:block}";const a=class{constructor(i){t(this,i),this.productSelected=s(this,"productSelected"),this.productOptionsSelected=s(this,"productOptionsSelected"),this.selectedProducts={},this.isSelectionLocked=!1,this.selectionLimit=0,this.savedOptionsByInstance={},this.handleProductClick=(t,s)=>{const i=this.selectedProducts[this.section.id]?.has(t.id)||!1,e=this.getCheckbox(this.section.id,s);if(i&&this.isSelectionLocked)return void(e&&(e.checked=!0));if(!i&&this.isMaxSelectionReached()&&1!==this.selectionLimit)return;if(1===this.selectionLimit&&!i)return void this.productSelected.emit({product:t,sectionId:this.section.id});if(!e)return;const n=!e.checked;n||(this.dispatchClearOptionsEvent(t,s),this.clearSavedOptionsState(this.section.id,s)),e.checked=n,requestAnimationFrame((()=>{const t=new window.Event("change",{bubbles:!0});e.dispatchEvent(t)})),this.productSelected.emit({product:t,sectionId:this.section.id})},this.handleOptionsClick=t=>{!this.selectedProducts[this.section.id]?.has(t.id)&&this.isMaxSelectionReached()&&1!==this.selectionLimit||this.productOptionsSelected.emit({product:t,sectionId:this.section.id})}}getSelectedCount(){return this.selectedProducts[this.section?.id]?.size??0}isMaxSelectionReached(){return this.selectionLimit>1&&this.getSelectedCount()>=this.selectionLimit}isProductSelectionDisabled(t,s){return 0===t.quantity||!s&&this.isMaxSelectionReached()}getProductInstanceKey(t,s){return`${t}::${s}`}dispatchClearOptionsEvent(t,s){salla.event.dispatch("multiple-bundle-product-modal::clear-options",{productId:t.id,sectionId:this.section.id,sectionIndex:this.sectionIndex,productIndex:s})}handleOptionsSaved(t){const s=t.detail;if(!s)return;const{sectionId:i,productIndex:e,selectedOptions:n}=s;if(null==i||i!==this.section?.id)return;if(null==e||Number.isNaN(e))return;const o=this.getProductInstanceKey(i,e);if(n?.length)this.savedOptionsByInstance={...this.savedOptionsByInstance,[o]:!0};else if(this.savedOptionsByInstance[o]){const t={...this.savedOptionsByInstance};delete t[o],this.savedOptionsByInstance=t}}clearSavedOptionsState(t,s){const i=this.getProductInstanceKey(t,s);if(!this.savedOptionsByInstance[i])return;const e={...this.savedOptionsByInstance};delete e[i],this.savedOptionsByInstance=e}generateEventName(t,s){return`bundle[${t}][${s}][id]`}getCheckbox(t,s){const i=this.generateEventName(t,s);return this.host.querySelector(`input.s-multiple-bundle-product-checkbox[name="${i}"]`)}preventLockedDeselect(t,s){if(!this.isSelectionLocked||!s)return;t.preventDefault(),t.stopPropagation();const i=t.target;"checkbox"===i?.type&&(i.checked=!0)}render(){return i(e,{key:"84a2765b8e57fa7d4d757c7e0c8a634199e7f121"},i("salla-slider",{key:"67d1748a2c19adca4db056bd3b5e5de6813aa367",type:"carousel",controlsOuter:!1,showControls:!1,id:`accordion-multiple-bundle-product-${this.section.id}`,pagination:!0,class:"s-multiple-bundle-product-wrapper-slider",sliderConfig:{spaceBetween:0}},i("div",{key:"04547e4a998d15377a2d5573bd0c4d8d33a93af7",slot:"items"},this?.section?.products?.map(((t,s)=>{const e=this.selectedProducts[this.section.id]?.has(t.id)||!1,n=e&&this.isSelectionLocked,d=this.isProductSelectionDisabled(t,e),a=this.savedOptionsByInstance[this.getProductInstanceKey(this.section.id,s)]?salla.lang.getWithDefault("pages.products.edit_selected_options","تعديل الخيارات"):salla.lang.get("pages.products.choose_from_options");let c=salla.config.get("theme.is_rtl",!0)?o:l;return i("div",{class:"s-multiple-bundle-product-slide-one-third"+(d?" s-multiple-bundle-product-slide-one-third-disabled":""),key:t.id},i("div",{class:"s-multiple-bundle-product-card"},i("div",{class:"s-multiple-bundle-product-image-wrapper",onClick:()=>this.handleProductClick(t,s)},i("input",{id:this.generateEventName(this.section.id,s),type:"checkbox",class:"s-multiple-bundle-product-checkbox",checked:e,"data-selection-locked":n?"true":void 0,name:this.generateEventName(this.section.id,s),value:t.id,onClick:t=>this.preventLockedDeselect(t,e),onChange:t=>this.preventLockedDeselect(t,e)}),i("img",{src:t.image.url||salla.url.cdn("images/s-empty.png"),loading:"lazy",alt:t.image.alt||t.name,class:"s-multiple-bundle-product-image"})),i("div",{class:"s-multiple-bundle-product-content-wrapper"},i("div",{class:"s-multiple-bundle-product-content"},i("div",{class:"s-multiple-bundle-product-details"},i("div",{class:"s-multiple-bundle-product-title-wrapper"},i("h2",{class:"s-multiple-bundle-product-title"},i("a",{href:t?.url||"#",target:"_blank",rel:"noopener noreferrer"},t.name))),i("div",{class:"s-multiple-bundle-product-price-wrapper"},i("span",{class:"s-multiple-bundle-product-price"},i("span",{innerHTML:salla.money(t.price)})),t.sale_price>0&&i("span",{class:"s-multiple-bundle-product-price-discount"},i("span",{innerHTML:salla.money(t.regular_price)})))),t.quantity_in_group>0&&0!==t.quantity&&i("span",{class:"s-multiple-bundle-product-badge"},salla.lang.get("pages.products.pieces"),i("span",null,t.quantity_in_group)),0===t.quantity&&i("span",{class:"s-multiple-bundle-product-badge"},salla.lang.get("pages.products.quantity_in_group_finished"))),t.options?.length>0&&i("button",{class:"s-multiple-bundle-product-button",onClick:()=>this.handleOptionsClick(t),type:"button"},a,i("span",{class:"s-multiple-bundle-product-button-icon",innerHTML:c})))))})))))}get host(){return n(this)}};a.style="";export{d as salla_multiple_bundle_product_options_modal,a as salla_multiple_bundle_product_slider}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as t,h as a,H as e,a as r}from"./p-BAXTlrSC.js";import{f as i}from"./p-CRW60UDr.js";const s=class{constructor(a){t(this,a),this.limit=10,this.products=[],this.isLoading=!0,this.canRender=!0,this.title="",this.addToCartLabel="",this.weightLabel="",this.discountLabel="",this.placeholder="",this.fetchGeneration=0,this.isSyncingCart=!1,this.cartItemChangedHandler=t=>{const a=t?.data?.cart?.items??[],e=a.map((t=>String(t.product_id))).filter(Boolean);this.syncCartItemsDom(a),this.fetchRecommendations(e)},this.beforeAddItemHandler=t=>{const a=String(t?.id??"");a&&this.products.some((t=>String(t.id)===a))&&salla.cart?.api&&(salla.cart.api.addToCartSource="basket_gap")},this.addButtonSuccessHandler=t=>{const a=t?.target?.getAttribute?.("product-id");if(!a)return;const e=this.products.find((t=>String(t.id)===String(a)));if(!e)return;const r=t?.detail?.data?.items??[],i=r.find((t=>String(t.product_id)===String(e.id)))??r.slice(-1)[0];salla.event.emit("salla-basket-gap::product.added",[{product:e,position:this.products.indexOf(e)+1,cartItem:i,cartId:t?.detail?.data?.id,source:"basket_gap"}])},salla.lang.onLoaded((()=>{this.title=salla.lang.get("pages.cart.basket_gap_title"),this.addToCartLabel=salla.lang.get("pages.cart.add_to_cart"),this.weightLabel=salla.lang.get("pages.products.weight"),this.discountLabel=salla.lang.get("pages.products.discount")}))}componentWillLoad(){salla.onReady().then((()=>{if(!salla.config.get("store.settings.cart.basket_gap"))return this.canRender=!1,void(this.isLoading=!1);this.title=salla.lang.get("pages.cart.basket_gap_title"),this.addToCartLabel=salla.lang.get("pages.cart.add_to_cart"),this.weightLabel=salla.lang.get("pages.products.weight"),this.discountLabel=salla.lang.get("pages.products.discount"),this.placeholder=salla.url.asset(salla.config.get("theme.settings.placeholder"));const t=salla.storage.get("cart"),a=(t?.items??[]).map((t=>String(t.product_id))).filter(Boolean);return a.length?this.fetchRecommendations(a):salla.api.cart.details().then((({data:{cart:t}})=>{const a=(t?.items??[]).map((t=>String(t.product_id))).filter(Boolean);return this.fetchRecommendations(a)})).catch((()=>{this.canRender=!1,this.isLoading=!1}))}))}componentDidLoad(){this.positionUnderCartItems()}componentDidUpdate(){document.lazyLoadInstance?.update(this.host.querySelectorAll(".lazy")),this.positionUnderCartItems()}getCartItemForms(t=document){return Array.from(t.querySelectorAll('form[id^="item-"]')).filter((t=>!t.closest(".cart-options")))}positionUnderCartItems(){const t=this.getCartItemForms(),a=t[t.length-1];a&&a.nextElementSibling!==this.host&&a.after(this.host)}syncCartItemsDom(t){t?.length&&!this.isSyncingCart&&t.filter((t=>!document.getElementById("item-"+t.id))).length&&(this.isSyncingCart=!0,fetch(window.location.href,{headers:{"X-Requested-With":"XMLHttpRequest"},credentials:"same-origin"}).then((t=>t.text())).then((t=>{const a=(new DOMParser).parseFromString(t,"text/html"),e=this.getCartItemForms(a),r=this.getCartItemForms();if(!e.length||!r.length)return;const i=r[0],s=i.parentElement;s&&(e.forEach((t=>{s.insertBefore(document.importNode(t,!0),i)})),r.forEach((t=>t.remove())),document.lazyLoadInstance?.update?.(),this.positionUnderCartItems())})).catch((()=>{})).finally((()=>{this.isSyncingCart=!1})))}connectedCallback(){salla.event.on("cart::item.added",this.cartItemChangedHandler),salla.event.on("cart::item.deleted",this.cartItemChangedHandler),salla.event.on("cart::before.add.item",this.beforeAddItemHandler),this.host.addEventListener("success",this.addButtonSuccessHandler)}disconnectedCallback(){salla.event.off("cart::item.added",this.cartItemChangedHandler),salla.event.off("cart::item.deleted",this.cartItemChangedHandler),salla.event.off("cart::before.add.item",this.beforeAddItemHandler),this.host.removeEventListener("success",this.addButtonSuccessHandler)}getCartProductIds(t){if(t?.length)return new Set(t);const a=salla.storage.get("cart");return new Set((a?.items??[]).map((t=>String(t.product_id))).filter(Boolean))}fetchRecommendations(t){if(!t.length)return this.canRender=!1,this.isLoading=!1,Promise.resolve();const a=++this.fetchGeneration;return i(t).then((e=>{if(a!==this.fetchGeneration)return;const r=this.getCartProductIds(t),i=e.filter((t=>!r.has(t)));if(i.length)return this.fetchProducts(i.slice(0,this.limit),a);this.canRender=!1})).catch((()=>{a===this.fetchGeneration&&(this.canRender=!1)})).finally((()=>{a===this.fetchGeneration&&(this.isLoading=!1)}))}fetchProducts(t,a){return salla.api.withoutNotifier((()=>salla.product.api.fetch({source:"selected",source_value:t,limit:this.limit}))).then((t=>{a===this.fetchGeneration&&(this.products=t?.data??[],this.canRender=this.products.length>0)})).catch((()=>{a===this.fetchGeneration&&(this.canRender=!1)}))}getDiscountLabel(t){if(t.promotion_title)return t.promotion_title;if(t.is_on_sale&&t.regular_price>0&&t.sale_price>0){const a=Math.round(100*(1-t.sale_price/t.regular_price));return a>0?`${this.discountLabel} ${a}%`:null}return null}formatDate(t){const a=new Date(1e3*t),e=String(a.getMonth()+1).padStart(2,"0"),r=String(a.getDate()).padStart(2,"0");return`${a.getFullYear()}-${e}-${r}`}getSkeletonView(){return a(e,{class:"s-basket-gap-entry"},a("div",{class:"s-basket-gap-skeleton"},a("salla-skeleton",{height:"16px",width:"40%",style:{marginBottom:"16px"}}),Array(3).fill(null).map(((t,e)=>a("div",{key:e,class:"s-basket-gap-skeleton-card"},a("salla-skeleton",{height:"64px",width:"64px",style:{borderRadius:"8px",flexShrink:"0"}}),a("div",{class:"s-basket-gap-skeleton-info"},a("salla-skeleton",{height:"14px",width:"50%"}),a("salla-skeleton",{height:"12px",width:"25%",style:{marginTop:"6px"}}),a("salla-skeleton",{height:"10px",width:"35%",style:{marginTop:"4px"}})),a("salla-skeleton",{height:"36px",width:"100px",style:{borderRadius:"6px",flexShrink:"0",marginInlineStart:"auto"}}))))))}getProductCard(t){const e=this.getDiscountLabel(t);return a("div",{key:t.id,class:"s-basket-gap-card"},a("a",{href:t.url,class:"s-basket-gap-card-image"},a("img",{class:"lazy",src:this.placeholder,"data-src":t.image?.url,alt:t.image?.alt||t.name})),a("div",{class:"s-basket-gap-card-info"},a("h3",{class:"s-basket-gap-card-name"},a("a",{href:t.url},t.name)),t.is_on_sale?a("div",{class:"s-basket-gap-card-sale-price"},a("span",{innerHTML:salla.money(t.sale_price)}),a("del",{innerHTML:salla.money(t.regular_price)})):a("span",{class:"s-basket-gap-card-price",innerHTML:salla.money(t.price)}),t.weight_label&&a("span",{class:"s-basket-gap-card-weight"},this.weightLabel," ",t.weight_label)),a("div",{class:"s-basket-gap-card-actions"},(t.promotion_title||t.discount_ends||t.is_on_sale)&&a("div",{class:"s-basket-gap-card-offer"},a("i",{class:"sicon-gift"}),e&&a("span",null,e),t.discount_ends&&[a("salla-count-down",{date:this.formatDate(t.discount_ends),"end-of-day":!0,digits:"en","auto-segments":!0}),a("i",{class:"sicon-alarm"})]),a("salla-add-product-button",{class:"s-basket-gap-card-btn","product-id":t.id,"product-status":t.status,"product-type":t.type},this.addToCartLabel)))}render(){return this.canRender?this.isLoading?this.getSkeletonView():this.products.length?a(e,{class:"s-basket-gap-entry"},this.title&&a("h2",{class:"s-basket-gap-title"},this.title),a("div",{class:"s-basket-gap-list"},this.products.map((t=>this.getProductCard(t))))):null:null}get host(){return r(this)}};s.style='/*!twlt*/:host{display:block}.block{display:block}.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-basket-gap-entry{margin-top:1.25rem;margin-bottom:1.25rem;display:block;border-radius:0.375rem;--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1));padding:1.25rem}.s-basket-gap-title{margin-bottom:1rem;font-size:1.125rem;line-height:1.75rem;font-weight:700}.s-basket-gap-list{display:flex;flex-direction:column}.s-basket-gap-list>:not([hidden])~:not([hidden]){--tw-divide-y-reverse:0;border-top-width:calc(1px * calc(1 - var(--tw-divide-y-reverse)));border-bottom-width:calc(1px * var(--tw-divide-y-reverse));--tw-divide-opacity:1;border-color:rgb(243 244 246 / var(--tw-divide-opacity, 1))}.s-basket-gap-card{display:flex;flex-wrap:wrap;align-items:center;column-gap:0.75rem;row-gap:0.625rem;padding-top:1rem;padding-bottom:1rem}.s-basket-gap-card-image{height:4rem;width:4rem;flex-shrink:0;overflow:hidden;border-radius:0.375rem;border-width:1px;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1))}.s-basket-gap-card-image img{height:100%;width:100%;object-fit:cover}.s-basket-gap-card-info{display:flex;min-width:0px;flex:1 1 0%;flex-direction:column;gap:0.25rem}.s-basket-gap-card-actions{display:flex;width:100%;align-items:center;justify-content:flex-end;gap:0.5rem}@media (min-width: 640px){.s-basket-gap-card-actions{width:auto}}.s-basket-gap-card-name{font-size:0.875rem;line-height:1.25rem;font-weight:600;line-height:1.25;--tw-text-opacity:1;color:rgb(31 41 55 / var(--tw-text-opacity, 1))}.s-basket-gap-card-name a:hover{color:var(--color-primary)}.s-basket-gap-card-price{font-size:0.875rem;line-height:1.25rem;--tw-text-opacity:1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.s-basket-gap-card-sale-price{display:flex;align-items:center;gap:0.5rem}.s-basket-gap-card-sale-price span{font-size:0.875rem;line-height:1.25rem;font-weight:700;--tw-text-opacity:1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.s-basket-gap-card-sale-price del{font-size:0.75rem;line-height:1rem;--tw-text-opacity:1;color:rgb(156 163 175 / var(--tw-text-opacity, 1));text-decoration-line:line-through}.s-basket-gap-card-weight{font-size:0.75rem;line-height:1rem;--tw-text-opacity:1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.s-basket-gap-card-offer{display:flex;flex-shrink:0;align-items:center;gap:0.25rem;border-radius:0.375rem;--tw-bg-opacity:1;background-color:rgb(240 253 244 / var(--tw-bg-opacity, 1));padding-left:9px;padding-right:9px;padding-top:3px;padding-bottom:3px;font-size:11px;font-weight:500;--tw-text-opacity:1;color:rgb(21 128 61 / var(--tw-text-opacity, 1))}.s-basket-gap-card-offer i{font-size:0.75rem;line-height:1rem}.s-basket-gap-card-offer span{font-weight:700;--tw-text-opacity:1 !important;color:rgb(31 41 55 / var(--tw-text-opacity, 1)) !important}.s-basket-gap-card-offer salla-count-down{flex-shrink:0}.s-basket-gap-card-offer salla-count-down:where([dir="ltr"],[dir="ltr"] *){margin-inline-start:0.25rem}.s-basket-gap-card-offer salla-count-down:where([dir="rtl"],[dir="rtl"] *){margin-inline-end:0.25rem}.s-basket-gap-card-offer .s-count-down-list{margin-left:-0px !important;margin-right:-0px !important;margin-bottom:0px !important;margin-top:0px !important;display:inline-flex;flex-wrap:nowrap;align-items:center;justify-content:flex-start !important;column-gap:0px;--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal) var(--tw-slashed-zero) var(--tw-numeric-figure) var(--tw-numeric-spacing) var(--tw-numeric-fraction)}.s-basket-gap-card-offer .s-count-down-list:where([dir="ltr"],[dir="ltr"] *){flex-direction:row-reverse !important}.s-basket-gap-card-offer .s-count-down-list:where([dir="rtl"],[dir="rtl"] *){flex-direction:row !important}.s-basket-gap-card-offer .s-count-down-item{position:relative !important;margin-left:0px !important;margin-right:0px !important;display:inline-flex !important;width:auto !important;flex:none !important;flex-grow:0 !important;flex-direction:row !important;align-items:center !important;justify-content:center !important;padding-top:0px !important;padding-bottom:0px !important;padding-left:0px !important;padding-right:0px !important;font-size:12px !important;font-weight:700 !important;line-height:1 !important;--tw-text-opacity:1 !important;color:rgb(21 128 61 / var(--tw-text-opacity, 1)) !important}.s-basket-gap-card-offer .s-count-down-item-value{display:inline-block !important;width:2ch !important;min-width:2ch !important;text-align:center;--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal) var(--tw-slashed-zero) var(--tw-numeric-figure) var(--tw-numeric-spacing) var(--tw-numeric-fraction);line-height:1}.s-basket-gap-card-offer .s-count-down-item-label{display:none}.s-basket-gap-entry .s-basket-gap-card-offer.s-basket-gap-card-offer .s-count-down-item::before{content:none !important}.s-basket-gap-entry .s-basket-gap-card-offer.s-basket-gap-card-offer .s-count-down-item::after{content:none !important;position:static;left:auto;right:auto;transform:none}[dir=\'rtl\'] .s-basket-gap-entry .s-basket-gap-card-offer.s-basket-gap-card-offer .s-count-down-item:not(:last-child)::after{content:\':\' !important;position:static;left:auto;right:auto;transform:none;margin-left:0.15rem;margin-right:0.15rem;color:#15803d;font-size:12px;font-weight:700;line-height:1}[dir=\'ltr\'] .s-basket-gap-entry .s-basket-gap-card-offer.s-basket-gap-card-offer .s-count-down-item:not(:first-child)::after{content:\':\' !important;position:static;left:auto;right:auto;transform:none;margin-left:0.15rem;margin-right:0.15rem;color:#15803d;font-size:12px;font-weight:700;line-height:1}.s-basket-gap-card-btn{flex-shrink:0}.s-basket-gap-card-btn salla-button .s-button-btn{border-radius:var(--s-radius, 0.25rem);border-width:1px !important;border-color:var(--color-primary) !important;background-color:transparent !important;color:var(--color-primary) !important}.s-basket-gap-card-btn salla-button .s-button-btn:hover{background-color:var(--color-primary) !important;--tw-text-opacity:1 !important;color:rgb(255 255 255 / var(--tw-text-opacity, 1)) !important}.s-basket-gap-card-btn salla-button .s-button-loader:before{border-top-color:var(--color-primary) !important;border-left-color:var(--color-primary) !important;border-bottom-color:rgb(243 244 246 / var(--tw-border-opacity, 1)) !important;--tw-border-opacity:1 !important;border-right-color:rgb(243 244 246 / var(--tw-border-opacity, 1)) !important}.s-basket-gap-skeleton{display:flex;flex-direction:column;gap:0.75rem}.s-basket-gap-skeleton-card{display:flex;align-items:center;gap:0.75rem;padding-top:0.75rem;padding-bottom:0.75rem}.s-basket-gap-skeleton-info{display:flex;flex:1 1 0%;flex-direction:column;gap:0.5rem}';export{s as salla_basket_gap}
|
|
4
|
+
import{r as t,h as a,H as e,a as r}from"./p-DVa_W0x-.js";import{f as i}from"./p-CRW60UDr.js";const s=class{constructor(a){t(this,a),this.limit=10,this.products=[],this.isLoading=!0,this.canRender=!0,this.title="",this.addToCartLabel="",this.weightLabel="",this.discountLabel="",this.placeholder="",this.fetchGeneration=0,this.isSyncingCart=!1,this.cartItemChangedHandler=t=>{const a=t?.data?.cart?.items??[],e=a.map((t=>String(t.product_id))).filter(Boolean);this.syncCartItemsDom(a),this.fetchRecommendations(e)},this.beforeAddItemHandler=t=>{const a=String(t?.id??"");a&&this.products.some((t=>String(t.id)===a))&&salla.cart?.api&&(salla.cart.api.addToCartSource="basket_gap")},this.addButtonSuccessHandler=t=>{const a=t?.target?.getAttribute?.("product-id");if(!a)return;const e=this.products.find((t=>String(t.id)===String(a)));if(!e)return;const r=t?.detail?.data?.items??[],i=r.find((t=>String(t.product_id)===String(e.id)))??r.slice(-1)[0];salla.event.emit("salla-basket-gap::product.added",[{product:e,position:this.products.indexOf(e)+1,cartItem:i,cartId:t?.detail?.data?.id,source:"basket_gap"}])},salla.lang.onLoaded((()=>{this.title=salla.lang.get("pages.cart.basket_gap_title"),this.addToCartLabel=salla.lang.get("pages.cart.add_to_cart"),this.weightLabel=salla.lang.get("pages.products.weight"),this.discountLabel=salla.lang.get("pages.products.discount")}))}componentWillLoad(){salla.onReady().then((()=>{if(!salla.config.get("store.settings.cart.basket_gap"))return this.canRender=!1,void(this.isLoading=!1);this.title=salla.lang.get("pages.cart.basket_gap_title"),this.addToCartLabel=salla.lang.get("pages.cart.add_to_cart"),this.weightLabel=salla.lang.get("pages.products.weight"),this.discountLabel=salla.lang.get("pages.products.discount"),this.placeholder=salla.url.asset(salla.config.get("theme.settings.placeholder"));const t=salla.storage.get("cart"),a=(t?.items??[]).map((t=>String(t.product_id))).filter(Boolean);return a.length?this.fetchRecommendations(a):salla.api.cart.details().then((({data:{cart:t}})=>{const a=(t?.items??[]).map((t=>String(t.product_id))).filter(Boolean);return this.fetchRecommendations(a)})).catch((()=>{this.canRender=!1,this.isLoading=!1}))}))}componentDidLoad(){this.positionUnderCartItems()}componentDidUpdate(){document.lazyLoadInstance?.update(this.host.querySelectorAll(".lazy")),this.positionUnderCartItems()}getCartItemForms(t=document){return Array.from(t.querySelectorAll('form[id^="item-"]')).filter((t=>!t.closest(".cart-options")))}positionUnderCartItems(){const t=this.getCartItemForms(),a=t[t.length-1];a&&a.nextElementSibling!==this.host&&a.after(this.host)}syncCartItemsDom(t){t?.length&&!this.isSyncingCart&&t.filter((t=>!document.getElementById("item-"+t.id))).length&&(this.isSyncingCart=!0,fetch(window.location.href,{headers:{"X-Requested-With":"XMLHttpRequest"},credentials:"same-origin"}).then((t=>t.text())).then((t=>{const a=(new DOMParser).parseFromString(t,"text/html"),e=this.getCartItemForms(a),r=this.getCartItemForms();if(!e.length||!r.length)return;const i=r[0],s=i.parentElement;s&&(e.forEach((t=>{s.insertBefore(document.importNode(t,!0),i)})),r.forEach((t=>t.remove())),document.lazyLoadInstance?.update?.(),this.positionUnderCartItems())})).catch((()=>{})).finally((()=>{this.isSyncingCart=!1})))}connectedCallback(){salla.event.on("cart::item.added",this.cartItemChangedHandler),salla.event.on("cart::item.deleted",this.cartItemChangedHandler),salla.event.on("cart::before.add.item",this.beforeAddItemHandler),this.host.addEventListener("success",this.addButtonSuccessHandler)}disconnectedCallback(){salla.event.off("cart::item.added",this.cartItemChangedHandler),salla.event.off("cart::item.deleted",this.cartItemChangedHandler),salla.event.off("cart::before.add.item",this.beforeAddItemHandler),this.host.removeEventListener("success",this.addButtonSuccessHandler)}getCartProductIds(t){if(t?.length)return new Set(t);const a=salla.storage.get("cart");return new Set((a?.items??[]).map((t=>String(t.product_id))).filter(Boolean))}fetchRecommendations(t){if(!t.length)return this.canRender=!1,this.isLoading=!1,Promise.resolve();const a=++this.fetchGeneration;return i(t).then((e=>{if(a!==this.fetchGeneration)return;const r=this.getCartProductIds(t),i=e.filter((t=>!r.has(t)));if(i.length)return this.fetchProducts(i.slice(0,this.limit),a);this.canRender=!1})).catch((()=>{a===this.fetchGeneration&&(this.canRender=!1)})).finally((()=>{a===this.fetchGeneration&&(this.isLoading=!1)}))}fetchProducts(t,a){return salla.api.withoutNotifier((()=>salla.product.api.fetch({source:"selected",source_value:t,limit:this.limit}))).then((t=>{a===this.fetchGeneration&&(this.products=t?.data??[],this.canRender=this.products.length>0)})).catch((()=>{a===this.fetchGeneration&&(this.canRender=!1)}))}getDiscountLabel(t){if(t.promotion_title)return t.promotion_title;if(t.is_on_sale&&t.regular_price>0&&t.sale_price>0){const a=Math.round(100*(1-t.sale_price/t.regular_price));return a>0?`${this.discountLabel} ${a}%`:null}return null}formatDate(t){const a=new Date(1e3*t),e=String(a.getMonth()+1).padStart(2,"0"),r=String(a.getDate()).padStart(2,"0");return`${a.getFullYear()}-${e}-${r}`}getSkeletonView(){return a(e,{class:"s-basket-gap-entry"},a("div",{class:"s-basket-gap-skeleton"},a("salla-skeleton",{height:"16px",width:"40%",style:{marginBottom:"16px"}}),Array(3).fill(null).map(((t,e)=>a("div",{key:e,class:"s-basket-gap-skeleton-card"},a("salla-skeleton",{height:"64px",width:"64px",style:{borderRadius:"8px",flexShrink:"0"}}),a("div",{class:"s-basket-gap-skeleton-info"},a("salla-skeleton",{height:"14px",width:"50%"}),a("salla-skeleton",{height:"12px",width:"25%",style:{marginTop:"6px"}}),a("salla-skeleton",{height:"10px",width:"35%",style:{marginTop:"4px"}})),a("salla-skeleton",{height:"36px",width:"100px",style:{borderRadius:"6px",flexShrink:"0",marginInlineStart:"auto"}}))))))}getProductCard(t){const e=this.getDiscountLabel(t);return a("div",{key:t.id,class:"s-basket-gap-card"},a("a",{href:t.url,class:"s-basket-gap-card-image"},a("img",{class:"lazy",src:this.placeholder,"data-src":t.image?.url,alt:t.image?.alt||t.name})),a("div",{class:"s-basket-gap-card-info"},a("h3",{class:"s-basket-gap-card-name"},a("a",{href:t.url},t.name)),t.is_on_sale?a("div",{class:"s-basket-gap-card-sale-price"},a("span",{innerHTML:salla.money(t.sale_price)}),a("del",{innerHTML:salla.money(t.regular_price)})):a("span",{class:"s-basket-gap-card-price",innerHTML:salla.money(t.price)}),t.weight_label&&a("span",{class:"s-basket-gap-card-weight"},this.weightLabel," ",t.weight_label)),a("div",{class:"s-basket-gap-card-actions"},(t.promotion_title||t.discount_ends||t.is_on_sale)&&a("div",{class:"s-basket-gap-card-offer"},a("i",{class:"sicon-gift"}),e&&a("span",null,e),t.discount_ends&&[a("salla-count-down",{date:this.formatDate(t.discount_ends),"end-of-day":!0,digits:"en","auto-segments":!0}),a("i",{class:"sicon-alarm"})]),a("salla-add-product-button",{class:"s-basket-gap-card-btn","product-id":t.id,"product-status":t.status,"product-type":t.type},this.addToCartLabel)))}render(){return this.canRender?this.isLoading?this.getSkeletonView():this.products.length?a(e,{class:"s-basket-gap-entry"},this.title&&a("h2",{class:"s-basket-gap-title"},this.title),a("div",{class:"s-basket-gap-list"},this.products.map((t=>this.getProductCard(t))))):null:null}get host(){return r(this)}};s.style='/*!twlt*/:host{display:block}.block{display:block}.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-basket-gap-entry{margin-top:1.25rem;margin-bottom:1.25rem;display:block;border-radius:0.375rem;--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1));padding:1.25rem}.s-basket-gap-title{margin-bottom:1rem;font-size:1.125rem;line-height:1.75rem;font-weight:700}.s-basket-gap-list{display:flex;flex-direction:column}.s-basket-gap-list>:not([hidden])~:not([hidden]){--tw-divide-y-reverse:0;border-top-width:calc(1px * calc(1 - var(--tw-divide-y-reverse)));border-bottom-width:calc(1px * var(--tw-divide-y-reverse));--tw-divide-opacity:1;border-color:rgb(243 244 246 / var(--tw-divide-opacity, 1))}.s-basket-gap-card{display:flex;flex-wrap:wrap;align-items:center;column-gap:0.75rem;row-gap:0.625rem;padding-top:1rem;padding-bottom:1rem}.s-basket-gap-card-image{height:4rem;width:4rem;flex-shrink:0;overflow:hidden;border-radius:0.375rem;border-width:1px;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1))}.s-basket-gap-card-image img{height:100%;width:100%;object-fit:cover}.s-basket-gap-card-info{display:flex;min-width:0px;flex:1 1 0%;flex-direction:column;gap:0.25rem}.s-basket-gap-card-actions{display:flex;width:100%;align-items:center;justify-content:flex-end;gap:0.5rem}@media (min-width: 640px){.s-basket-gap-card-actions{width:auto}}.s-basket-gap-card-name{font-size:0.875rem;line-height:1.25rem;font-weight:600;line-height:1.25;--tw-text-opacity:1;color:rgb(31 41 55 / var(--tw-text-opacity, 1))}.s-basket-gap-card-name a:hover{color:var(--color-primary)}.s-basket-gap-card-price{font-size:0.875rem;line-height:1.25rem;--tw-text-opacity:1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.s-basket-gap-card-sale-price{display:flex;align-items:center;gap:0.5rem}.s-basket-gap-card-sale-price span{font-size:0.875rem;line-height:1.25rem;font-weight:700;--tw-text-opacity:1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.s-basket-gap-card-sale-price del{font-size:0.75rem;line-height:1rem;--tw-text-opacity:1;color:rgb(156 163 175 / var(--tw-text-opacity, 1));text-decoration-line:line-through}.s-basket-gap-card-weight{font-size:0.75rem;line-height:1rem;--tw-text-opacity:1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.s-basket-gap-card-offer{display:flex;flex-shrink:0;align-items:center;gap:0.25rem;border-radius:0.375rem;--tw-bg-opacity:1;background-color:rgb(240 253 244 / var(--tw-bg-opacity, 1));padding-left:9px;padding-right:9px;padding-top:3px;padding-bottom:3px;font-size:11px;font-weight:500;--tw-text-opacity:1;color:rgb(21 128 61 / var(--tw-text-opacity, 1))}.s-basket-gap-card-offer i{font-size:0.75rem;line-height:1rem}.s-basket-gap-card-offer span{font-weight:700;--tw-text-opacity:1 !important;color:rgb(31 41 55 / var(--tw-text-opacity, 1)) !important}.s-basket-gap-card-offer salla-count-down{flex-shrink:0}.s-basket-gap-card-offer salla-count-down:where([dir="ltr"],[dir="ltr"] *){margin-inline-start:0.25rem}.s-basket-gap-card-offer salla-count-down:where([dir="rtl"],[dir="rtl"] *){margin-inline-end:0.25rem}.s-basket-gap-card-offer .s-count-down-list{margin-left:-0px !important;margin-right:-0px !important;margin-bottom:0px !important;margin-top:0px !important;display:inline-flex;flex-wrap:nowrap;align-items:center;justify-content:flex-start !important;column-gap:0px;--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal) var(--tw-slashed-zero) var(--tw-numeric-figure) var(--tw-numeric-spacing) var(--tw-numeric-fraction)}.s-basket-gap-card-offer .s-count-down-list:where([dir="ltr"],[dir="ltr"] *){flex-direction:row-reverse !important}.s-basket-gap-card-offer .s-count-down-list:where([dir="rtl"],[dir="rtl"] *){flex-direction:row !important}.s-basket-gap-card-offer .s-count-down-item{position:relative !important;margin-left:0px !important;margin-right:0px !important;display:inline-flex !important;width:auto !important;flex:none !important;flex-grow:0 !important;flex-direction:row !important;align-items:center !important;justify-content:center !important;padding-top:0px !important;padding-bottom:0px !important;padding-left:0px !important;padding-right:0px !important;font-size:12px !important;font-weight:700 !important;line-height:1 !important;--tw-text-opacity:1 !important;color:rgb(21 128 61 / var(--tw-text-opacity, 1)) !important}.s-basket-gap-card-offer .s-count-down-item-value{display:inline-block !important;width:2ch !important;min-width:2ch !important;text-align:center;--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal) var(--tw-slashed-zero) var(--tw-numeric-figure) var(--tw-numeric-spacing) var(--tw-numeric-fraction);line-height:1}.s-basket-gap-card-offer .s-count-down-item-label{display:none}.s-basket-gap-entry .s-basket-gap-card-offer.s-basket-gap-card-offer .s-count-down-item::before{content:none !important}.s-basket-gap-entry .s-basket-gap-card-offer.s-basket-gap-card-offer .s-count-down-item::after{content:none !important;position:static;left:auto;right:auto;transform:none}[dir=\'rtl\'] .s-basket-gap-entry .s-basket-gap-card-offer.s-basket-gap-card-offer .s-count-down-item:not(:last-child)::after{content:\':\' !important;position:static;left:auto;right:auto;transform:none;margin-left:0.15rem;margin-right:0.15rem;color:#15803d;font-size:12px;font-weight:700;line-height:1}[dir=\'ltr\'] .s-basket-gap-entry .s-basket-gap-card-offer.s-basket-gap-card-offer .s-count-down-item:not(:first-child)::after{content:\':\' !important;position:static;left:auto;right:auto;transform:none;margin-left:0.15rem;margin-right:0.15rem;color:#15803d;font-size:12px;font-weight:700;line-height:1}.s-basket-gap-card-btn{flex-shrink:0}.s-basket-gap-card-btn salla-button .s-button-btn{border-radius:var(--s-radius, 0.25rem);border-width:1px !important;border-color:var(--color-primary) !important;background-color:transparent !important;color:var(--color-primary) !important}.s-basket-gap-card-btn salla-button .s-button-btn:hover{background-color:var(--color-primary) !important;--tw-text-opacity:1 !important;color:rgb(255 255 255 / var(--tw-text-opacity, 1)) !important}.s-basket-gap-card-btn salla-button .s-button-loader:before{border-top-color:var(--color-primary) !important;border-left-color:var(--color-primary) !important;border-bottom-color:rgb(243 244 246 / var(--tw-border-opacity, 1)) !important;--tw-border-opacity:1 !important;border-right-color:rgb(243 244 246 / var(--tw-border-opacity, 1)) !important}.s-basket-gap-skeleton{display:flex;flex-direction:column;gap:0.75rem}.s-basket-gap-skeleton-card{display:flex;align-items:center;gap:0.75rem;padding-top:0.75rem;padding-bottom:0.75rem}.s-basket-gap-skeleton-info{display:flex;flex:1 1 0%;flex-direction:column;gap:0.5rem}';export{s as salla_basket_gap}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as s,h as e,H as t,a as i}from"./p-BAXTlrSC.js";import{C as o}from"./p-BsLF_HK7.js";const a=class{constructor(e){s(this,e),this.isVisible=!0,this.step="consent",this.isMobile=!1,this.mobileBreakpoint=768,this.mobileQueryHandler=s=>this.isMobile=s.matches,this.openRequestedHandler=()=>this.open(),this.authLoggedInHandler=()=>this.syncConsentAfterLogin(),this.authLoggedOutHandler=()=>this.clearLocalConsent(),this.necessaryCookieKey="necessary_cookies",this.performanceCookieKey="performance_cookies",this.functionalCookieKey="functional_cookies",this.advertisingCookieKey="advertising_cookies",this.consentCookieDays=365,this.trackingCookiesByCategory={performance_cookies:["_ga","_ga_*","_gid","_gat","_gat_gtag_*","_hjSessionUser_*","_hjSession_*","_hjIncludedInSessionSample_*","_hjAbsoluteSessionInProgress","_hjFirstSeen","_clck","_clsk","MUID","MR","ANONCHK","_ym_uid","_ym_d","_ym_isad"],advertising_cookies:["_gcl_au","_gcl_aw","_gcl_dc","IDE","test_cookie","1P_JAR","NID","_fbp","_fbc","fr","_ttp","_scid","sc_at","personalization_id","guest_id","muc_ads","_pin_unauth","_pinterest_ct_ua","li_sugr","bcookie","lidc","UserMatchHistory","AnalyticsSyncHistory"],functional_cookies:["intercom-id-*","intercom-session-*","__zlcmid","crisp-client%2Fsession%2F*","YSC","VISITOR_INFO1_LIVE","PREF"]},this.performanceEnabled=!1,this.functionsEnabled=!1,this.adsEnabled=!1}async componentWillLoad(){await Salla.onReady(),await Salla.lang.onLoaded(),this.loadTranslations(),Salla.event.on("salla-cookies-bar::open",this.openRequestedHandler),Salla.event.on("auth::logged.in",this.authLoggedInHandler),Salla.event.on("auth::logged.out",this.authLoggedOutHandler),this.unregisterAfterFetchMenuItemsHook=Salla.hooks.registerHook("salla-menu","afterFetchMenuItems",(s=>this.appendCookiesSettingsLink(s))),this.hydrateToggleState(),Salla.storage.get("cookies-consent")&&(this.isVisible=!1),this.enforceCurrentConsent()}isArabicLocale(){return(Salla.lang.getLocale?.()??document.documentElement.lang??"ar").toLowerCase().startsWith("ar")}translate(s,e,t){const i=Salla.lang.get(s);return i&&i!==s?i:this.isArabicLocale()?e:t}loadTranslations(){this.titleLabel=this.translate("common.cookies.settings_title","تخصيص إعدادات ملفات تعريف الارتباط","Customize Cookie Preferences Settings"),this.saveLabel=this.translate("common.cookies.save","حفظ الخيارات","Save Options"),this.messageLabel=Salla.lang.get("common.cookies.message"),this.linkLabel=Salla.lang.get("common.cookies.link"),this.acceptLabel=this.translate("common.cookies.accept","قبول","Accept"),this.acceptAllLabel=this.translate("common.cookies.accept_all","قبول الكل","Accept All"),this.customizeLabel=this.translate("common.cookies.customize","تخصيص","Customize"),this.essentialTitleLabel=this.translate("common.cookies.categories.essential.title","ملفات تعريف الارتباط الضرورية","Essential Cookies"),this.essentialDescriptionLabel=this.translate("common.cookies.categories.essential.description","ضروريه لتشغيل الوظائف الأساسية للموقع الإلكتروني.","Required for the website's basic functions."),this.essentialBadgeLabel=this.translate("common.cookies.categories.essential.badge","إجباري","Required"),this.performanceTitleLabel=this.translate("common.cookies.categories.performance.title","ملفات تعريف الارتباط الخاصة بالأداء","Performance Cookies"),this.performanceDescriptionLabel=this.translate("common.cookies.categories.performance.description","تساعدنا في تحليل كيفية استخدامك للموقع وتحسين أدائه.","Help us analyze site usage and improve performance."),this.functionsTitleLabel=this.translate("common.cookies.categories.functions.title","ملفات تعريف الارتباط الوظيفية","Functional Cookies"),this.functionsDescriptionLabel=this.translate("common.cookies.categories.functions.description","تُتيح لك تجربة مخصصة وتفعيل ميزات متقدمة داخل الموقع.","Enable enhanced functionality and personalization."),this.adsTitleLabel=this.translate("common.cookies.categories.ads.title","ملفات تعريف الارتباط الإعلانية","Advertising Cookies"),this.adsDescriptionLabel=this.translate("common.cookies.categories.ads.description","تُستخدم لعرض محتوى تسويقي مخصص يناسب اهتماماتك.","Allow personalized content.")}componentDidLoad(){this.mobileQuery=window.matchMedia(`(max-width: ${this.mobileBreakpoint-1}px)`),this.isMobile=this.mobileQuery.matches,this.mobileQuery.addEventListener("change",this.mobileQueryHandler)}disconnectedCallback(){this.mobileQuery?.removeEventListener("change",this.mobileQueryHandler),Salla.event.off("salla-cookies-bar::open",this.openRequestedHandler),Salla.event.off("auth::logged.in",this.authLoggedInHandler),Salla.event.off("auth::logged.out",this.authLoggedOutHandler),this.unregisterAfterFetchMenuItemsHook?.(),this.unregisterAfterFetchMenuItemsHook=void 0}allCategoryKeys(){return[this.necessaryCookieKey,this.performanceCookieKey,this.functionalCookieKey,this.advertisingCookieKey]}writeLocalConsentCookies(s){for(const e of this.allCategoryKeys())Salla.cookie.set(e,String(e===this.necessaryCookieKey||s.includes(e)),this.consentCookieDays)}applyConsent(s){this.writeLocalConsentCookies(s),this.sweepDisabledCategoryCookies(s),Salla.config.isGuest()||Salla.api.request("account/data-privacy",{points:s},"post").catch((()=>{}))}currentConsentPoints(){return Salla.storage.get("cookies-consent")?this.allCategoryKeys().filter((s=>s===this.necessaryCookieKey||"true"===Salla.cookie.get(s))):null}enforceCurrentConsent(){const s=this.currentConsentPoints();s&&this.sweepDisabledCategoryCookies(s)}hydrateToggleState(){const s=this.currentConsentPoints();s&&(this.performanceEnabled=s.includes(this.performanceCookieKey),this.functionsEnabled=s.includes(this.functionalCookieKey),this.adsEnabled=s.includes(this.advertisingCookieKey))}clearLocalConsent(){for(const s of this.allCategoryKeys())Salla.cookie.remove(s);Salla.storage.remove("cookies-consent"),this.isVisible=!0}syncConsentAfterLogin(){const s=this.currentConsentPoints();s&&Salla.api.request("account/data-privacy",{points:s},"post").catch((()=>{}))}cookieNameMatchesPattern(s,e){return e.endsWith("*")?s.startsWith(e.slice(0,-1)):s===e}sweepDisabledCategoryCookies(s){const e=Object.keys(this.trackingCookiesByCategory).filter((e=>!s.includes(e)));if(!e.length)return;const t=e.flatMap((s=>this.trackingCookiesByCategory[s]));document.cookie.split(";").map((s=>s.split("=")[0].trim())).filter((s=>t.some((e=>this.cookieNameMatchesPattern(s,e))))).forEach((s=>Salla.cookie.remove(s)))}dismiss(s){this.isVisible=!1,Salla.event.emit(`salla-cookies-bar::${s}`),Salla.storage.set("cookies-consent",s)}savePreferences(){const s=[this.necessaryCookieKey];this.performanceEnabled&&s.push(this.performanceCookieKey),this.functionsEnabled&&s.push(this.functionalCookieKey),this.adsEnabled&&s.push(this.advertisingCookieKey),this.applyConsent(s),this.dismiss("accepted")}async accept(){return this.applyConsent(this.allCategoryKeys()),this.dismiss("accepted"),this.host}async reject(){return this.applyConsent([this.necessaryCookieKey]),this.dismiss("rejected"),this.host}async open(){return this.hydrateToggleState(),this.step="consent",this.isVisible=!0,this.host}openPreferences(){this.hydrateToggleState(),this.step="preferences"}isRtl(){return Salla.config.get("theme.is_rtl",!0)}appendCookiesSettingsLink(s){const e=Salla.config.get("store.features")?.includes("website-cookies");if(!e||!s?.withCookiePreferences||"footer"!==s?.source)return;const t="#cookies-settings",i=s?.menus.some((s=>s?.url===t));i||(s.menus=[...s.menus,{id:"cookies-settings",order:null,title:Salla.lang.get("common.cookies.settings"),url:t,target:"_self",is_by_form_builder:!1,children:[],image:null,callback:()=>Salla.event.emit("salla-cookies-bar::open")}])}renderToggle(s,t,i,o){return e("label",{class:{"s-toggle":!0,"s-toggle--disabled":t}},e("input",{class:"s-toggle-input",type:"checkbox",checked:s,disabled:t,"aria-label":i,onChange:()=>o?.()}),e("div",{class:"s-toggle-switcher"}))}renderCategory(s,t,i,o){return e("div",{class:"s-cookies-bar-category"},e("div",{class:"s-cookies-bar-category-content"},e("div",{class:"s-cookies-bar-category-title-row"},e("span",{class:"s-cookies-bar-category-title"},s),o&&e("span",{class:"s-cookies-bar-badge"},o)),e("p",{class:"s-cookies-bar-category-description m-0"},t)),i)}renderMessage(){return e("p",{class:"s-cookies-bar-message m-0"},this.messageLabel,Salla.config.get("policy_url")&&e("a",{href:Salla.config.get("policy_url"),target:"_blank",class:"s-cookies-bar-link text-primary ms-1"}," ",this.linkLabel))}renderConsentStep(){return e("div",{class:"s-cookies-bar-consent"},this.renderMessage(),e("div",{class:"s-cookies-bar-consent-actions"},e("salla-button",{class:"s-cookies-bar-btn--customize",color:"primary",fill:"outline",type:"button",size:this.isMobile?"small":"medium",onClick:()=>this.openPreferences()},this.customizeLabel),e("salla-button",{class:"s-cookies-bar-btn--accept",color:"primary",fill:"solid",type:"button",size:this.isMobile?"small":"medium",onClick:()=>this.accept()},this.acceptAllLabel)))}renderPreferencesStep(){return e("div",null,e("div",{class:"s-cookies-bar-header"},e("h3",{class:"s-cookies-bar-title m-0"},this.titleLabel),e("button",{type:"button",class:"s-cookies-bar-close","aria-label":this.titleLabel,onClick:()=>this.reject()},e("span",{innerHTML:o}))),e("div",{class:"s-cookies-bar-categories"},this.renderCategory(this.essentialTitleLabel,this.essentialDescriptionLabel,this.renderToggle(!0,!0,this.essentialTitleLabel),this.essentialBadgeLabel),this.renderCategory(this.performanceTitleLabel,this.performanceDescriptionLabel,this.renderToggle(this.performanceEnabled,!1,this.performanceTitleLabel,(()=>this.performanceEnabled=!this.performanceEnabled))),this.renderCategory(this.functionsTitleLabel,this.functionsDescriptionLabel,this.renderToggle(this.functionsEnabled,!1,this.functionsTitleLabel,(()=>this.functionsEnabled=!this.functionsEnabled))),this.renderCategory(this.adsTitleLabel,this.adsDescriptionLabel,this.renderToggle(this.adsEnabled,!1,this.adsTitleLabel,(()=>this.adsEnabled=!this.adsEnabled)))),e("div",{class:"s-cookies-bar-footer"},this.renderMessage(),e("salla-button",{class:"s-cookies-bar-btn--save",color:"primary",fill:"solid",type:"button",size:this.isMobile?"small":"medium",onClick:()=>this.savePreferences()},this.saveLabel)))}render(){return this.isVisible?e(t,null,e("div",{dir:this.isRtl()?"rtl":"ltr",class:"s-cookies-bar"},"consent"===this.step?this.renderConsentStep():this.renderPreferencesStep())):e(t,null)}get host(){return i(this)}};a.style='/*!twlt*/:host{display:block;overflow:visible}.s-cookies-bar{position:fixed;bottom:1rem;left:50%;transform:translateX(-50%);z-index:100;background-color:#fff;border-radius:1rem;padding:1.25rem;width:calc(100% - 2rem);max-width:48rem;box-shadow:0 10px 30px -5px rgba(0, 0, 0, 0.2)}.s-cookies-bar-consent{display:flex;flex-direction:row;align-items:center;gap:1rem;flex-wrap:wrap}@media (max-width: 640px){.s-cookies-bar-consent{flex-direction:column;align-items:end}}.s-cookies-bar-consent-actions{display:flex;align-items:center;gap:0.75rem;flex-shrink:0}.s-cookies-bar-header{display:flex;align-items:center;justify-content:space-between;gap:1rem;margin-bottom:1.25rem}.s-cookies-bar-title{font-size:1rem;font-weight:bold;color:#1f2937}.s-cookies-bar-close{display:inline-flex;align-items:center;justify-content:center;width:2rem;height:2rem;padding:0;border:none;background:transparent;cursor:pointer;flex-shrink:0}.s-cookies-bar-close svg{width:1.125rem;height:1.125rem;fill:currentColor}.s-cookies-bar-close:hover{color:#4b5563}.s-cookies-bar-categories{display:flex;flex-direction:column;gap:1rem}.s-cookies-bar-category{display:flex;align-items:flex-start;justify-content:space-between;gap:1rem}.s-cookies-bar-category .s-toggle{flex-shrink:0}.s-cookies-bar-category .s-toggle--disabled{cursor:not-allowed}.s-cookies-bar-category-title-row{display:flex;align-items:center;gap:0.5rem}.s-cookies-bar-category-title{font-size:0.875rem;font-weight:500;color:#1f2937}.s-cookies-bar-category-description{font-size:0.75rem;color:#9ca3af;margin-top:0.25rem}.s-cookies-bar-badge{display:inline-flex;align-items:center;padding:0.0625rem 0.5rem;border-radius:9999px;background-color:#f3f4f6;color:#6b7280;font-size:0.6875rem;font-weight:500;white-space:nowrap}.s-cookies-bar-footer{display:flex;align-items:center;gap:0.75rem;margin-top:1.25rem;padding-top:1.25rem;border-top:1px solid #e5e7eb}.s-cookies-bar-message{flex:1;font-size:0.75rem;line-height:1.625;font-weight:700}.s-cookies-bar-btn--save{flex-shrink:0}.visible{visibility:visible}.invisible{visibility:hidden}.m-0{margin:0px}.ms-1{margin-inline-start:0.25rem}.resize{resize:both}.text-primary{color:var(--color-primary)}.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}.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)}.toggle-checkbox .s-toggle-input{position:absolute;visibility:hidden}.toggle-checkbox .s-toggle-switcher{display:inline-block;background:#ccc;border-radius:16px;width:40px;height:25px;position:relative;vertical-align:middle;transition:background 0.25s}.toggle-checkbox .s-toggle-switcher:before,.toggle-checkbox .s-toggle-switcher:after{content:""}.toggle-checkbox .s-toggle-switcher:before{display:block;background:#fff;border-radius:50%;box-shadow:0 0 0 1px rgba(0,0,0,0.25);width:20px;height:21px;position:absolute;top:2.2px;left:1px;transition:left 0.25s}.toggle-checkbox .s-toggle-input:checked+div{background:#30D158}.toggle-checkbox .s-toggle-input:checked+div:before{left:18px}.s-toggle{cursor:pointer;display:inline-block}.s-toggle .s-toggle-input{position:absolute;visibility:hidden}.s-toggle .s-toggle-label{margin-left:5px;position:relative;top:2px}.s-toggle .s-toggle-switcher{display:inline-block;background:#ccc;border-radius:16px;width:40px;height:25px;position:relative;vertical-align:middle;transition:background 0.25s}.s-toggle .s-toggle-switcher:before,.s-toggle .s-toggle-switcher:after{content:""}.s-toggle .s-toggle-switcher:before{display:block;background:#fff;border-radius:50%;box-shadow:0 0 0 1px rgba(0,0,0,0.25);width:20px;height:21px;position:absolute;top:2.2px;left:1px;transition:left 0.25s}.s-toggle .s-toggle-input:checked+div{background:#30D158}.s-toggle .s-toggle-input:checked+div:before{left:18px}';export{a as salla_cookies_bar}
|
|
4
|
+
import{r as s,h as e,H as t,a as i}from"./p-DVa_W0x-.js";import{C as o}from"./p-BsLF_HK7.js";const a=class{constructor(e){s(this,e),this.isVisible=!0,this.step="consent",this.isMobile=!1,this.mobileBreakpoint=768,this.mobileQueryHandler=s=>this.isMobile=s.matches,this.openRequestedHandler=()=>this.open(),this.authLoggedInHandler=()=>this.syncConsentAfterLogin(),this.authLoggedOutHandler=()=>this.clearLocalConsent(),this.necessaryCookieKey="necessary_cookies",this.performanceCookieKey="performance_cookies",this.functionalCookieKey="functional_cookies",this.advertisingCookieKey="advertising_cookies",this.consentCookieDays=365,this.trackingCookiesByCategory={performance_cookies:["_ga","_ga_*","_gid","_gat","_gat_gtag_*","_hjSessionUser_*","_hjSession_*","_hjIncludedInSessionSample_*","_hjAbsoluteSessionInProgress","_hjFirstSeen","_clck","_clsk","MUID","MR","ANONCHK","_ym_uid","_ym_d","_ym_isad"],advertising_cookies:["_gcl_au","_gcl_aw","_gcl_dc","IDE","test_cookie","1P_JAR","NID","_fbp","_fbc","fr","_ttp","_scid","sc_at","personalization_id","guest_id","muc_ads","_pin_unauth","_pinterest_ct_ua","li_sugr","bcookie","lidc","UserMatchHistory","AnalyticsSyncHistory"],functional_cookies:["intercom-id-*","intercom-session-*","__zlcmid","crisp-client%2Fsession%2F*","YSC","VISITOR_INFO1_LIVE","PREF"]},this.performanceEnabled=!1,this.functionsEnabled=!1,this.adsEnabled=!1}async componentWillLoad(){await Salla.onReady(),await Salla.lang.onLoaded(),this.loadTranslations(),Salla.event.on("salla-cookies-bar::open",this.openRequestedHandler),Salla.event.on("auth::logged.in",this.authLoggedInHandler),Salla.event.on("auth::logged.out",this.authLoggedOutHandler),this.unregisterAfterFetchMenuItemsHook=Salla.hooks.registerHook("salla-menu","afterFetchMenuItems",(s=>this.appendCookiesSettingsLink(s))),this.hydrateToggleState(),Salla.storage.get("cookies-consent")&&(this.isVisible=!1),this.enforceCurrentConsent()}isArabicLocale(){return(Salla.lang.getLocale?.()??document.documentElement.lang??"ar").toLowerCase().startsWith("ar")}translate(s,e,t){const i=Salla.lang.get(s);return i&&i!==s?i:this.isArabicLocale()?e:t}loadTranslations(){this.titleLabel=this.translate("common.cookies.settings_title","تخصيص إعدادات ملفات تعريف الارتباط","Customize Cookie Preferences Settings"),this.saveLabel=this.translate("common.cookies.save","حفظ الخيارات","Save Options"),this.messageLabel=Salla.lang.get("common.cookies.message"),this.linkLabel=Salla.lang.get("common.cookies.link"),this.acceptLabel=this.translate("common.cookies.accept","قبول","Accept"),this.acceptAllLabel=this.translate("common.cookies.accept_all","قبول الكل","Accept All"),this.customizeLabel=this.translate("common.cookies.customize","تخصيص","Customize"),this.essentialTitleLabel=this.translate("common.cookies.categories.essential.title","ملفات تعريف الارتباط الضرورية","Essential Cookies"),this.essentialDescriptionLabel=this.translate("common.cookies.categories.essential.description","ضروريه لتشغيل الوظائف الأساسية للموقع الإلكتروني.","Required for the website's basic functions."),this.essentialBadgeLabel=this.translate("common.cookies.categories.essential.badge","إجباري","Required"),this.performanceTitleLabel=this.translate("common.cookies.categories.performance.title","ملفات تعريف الارتباط الخاصة بالأداء","Performance Cookies"),this.performanceDescriptionLabel=this.translate("common.cookies.categories.performance.description","تساعدنا في تحليل كيفية استخدامك للموقع وتحسين أدائه.","Help us analyze site usage and improve performance."),this.functionsTitleLabel=this.translate("common.cookies.categories.functions.title","ملفات تعريف الارتباط الوظيفية","Functional Cookies"),this.functionsDescriptionLabel=this.translate("common.cookies.categories.functions.description","تُتيح لك تجربة مخصصة وتفعيل ميزات متقدمة داخل الموقع.","Enable enhanced functionality and personalization."),this.adsTitleLabel=this.translate("common.cookies.categories.ads.title","ملفات تعريف الارتباط الإعلانية","Advertising Cookies"),this.adsDescriptionLabel=this.translate("common.cookies.categories.ads.description","تُستخدم لعرض محتوى تسويقي مخصص يناسب اهتماماتك.","Allow personalized content.")}componentDidLoad(){this.mobileQuery=window.matchMedia(`(max-width: ${this.mobileBreakpoint-1}px)`),this.isMobile=this.mobileQuery.matches,this.mobileQuery.addEventListener("change",this.mobileQueryHandler)}disconnectedCallback(){this.mobileQuery?.removeEventListener("change",this.mobileQueryHandler),Salla.event.off("salla-cookies-bar::open",this.openRequestedHandler),Salla.event.off("auth::logged.in",this.authLoggedInHandler),Salla.event.off("auth::logged.out",this.authLoggedOutHandler),this.unregisterAfterFetchMenuItemsHook?.(),this.unregisterAfterFetchMenuItemsHook=void 0}allCategoryKeys(){return[this.necessaryCookieKey,this.performanceCookieKey,this.functionalCookieKey,this.advertisingCookieKey]}writeLocalConsentCookies(s){for(const e of this.allCategoryKeys())Salla.cookie.set(e,String(e===this.necessaryCookieKey||s.includes(e)),this.consentCookieDays)}applyConsent(s){this.writeLocalConsentCookies(s),this.sweepDisabledCategoryCookies(s),Salla.config.isGuest()||Salla.api.request("account/data-privacy",{points:s},"post").catch((()=>{}))}currentConsentPoints(){return Salla.storage.get("cookies-consent")?this.allCategoryKeys().filter((s=>s===this.necessaryCookieKey||"true"===Salla.cookie.get(s))):null}enforceCurrentConsent(){const s=this.currentConsentPoints();s&&this.sweepDisabledCategoryCookies(s)}hydrateToggleState(){const s=this.currentConsentPoints();s&&(this.performanceEnabled=s.includes(this.performanceCookieKey),this.functionsEnabled=s.includes(this.functionalCookieKey),this.adsEnabled=s.includes(this.advertisingCookieKey))}clearLocalConsent(){for(const s of this.allCategoryKeys())Salla.cookie.remove(s);Salla.storage.remove("cookies-consent"),this.isVisible=!0}syncConsentAfterLogin(){const s=this.currentConsentPoints();s&&Salla.api.request("account/data-privacy",{points:s},"post").catch((()=>{}))}cookieNameMatchesPattern(s,e){return e.endsWith("*")?s.startsWith(e.slice(0,-1)):s===e}sweepDisabledCategoryCookies(s){const e=Object.keys(this.trackingCookiesByCategory).filter((e=>!s.includes(e)));if(!e.length)return;const t=e.flatMap((s=>this.trackingCookiesByCategory[s]));document.cookie.split(";").map((s=>s.split("=")[0].trim())).filter((s=>t.some((e=>this.cookieNameMatchesPattern(s,e))))).forEach((s=>Salla.cookie.remove(s)))}dismiss(s){this.isVisible=!1,Salla.event.emit(`salla-cookies-bar::${s}`),Salla.storage.set("cookies-consent",s)}savePreferences(){const s=[this.necessaryCookieKey];this.performanceEnabled&&s.push(this.performanceCookieKey),this.functionsEnabled&&s.push(this.functionalCookieKey),this.adsEnabled&&s.push(this.advertisingCookieKey),this.applyConsent(s),this.dismiss("accepted")}async accept(){return this.applyConsent(this.allCategoryKeys()),this.dismiss("accepted"),this.host}async reject(){return this.applyConsent([this.necessaryCookieKey]),this.dismiss("rejected"),this.host}async open(){return this.hydrateToggleState(),this.step="consent",this.isVisible=!0,this.host}openPreferences(){this.hydrateToggleState(),this.step="preferences"}isRtl(){return Salla.config.get("theme.is_rtl",!0)}appendCookiesSettingsLink(s){const e=Salla.config.get("store.features")?.includes("website-cookies");if(!e||!s?.withCookiePreferences||"footer"!==s?.source)return;const t="#cookies-settings",i=s?.menus.some((s=>s?.url===t));i||(s.menus=[...s.menus,{id:"cookies-settings",order:null,title:Salla.lang.get("common.cookies.settings"),url:t,target:"_self",is_by_form_builder:!1,children:[],image:null,callback:()=>Salla.event.emit("salla-cookies-bar::open")}])}renderToggle(s,t,i,o){return e("label",{class:{"s-toggle":!0,"s-toggle--disabled":t}},e("input",{class:"s-toggle-input",type:"checkbox",checked:s,disabled:t,"aria-label":i,onChange:()=>o?.()}),e("div",{class:"s-toggle-switcher"}))}renderCategory(s,t,i,o){return e("div",{class:"s-cookies-bar-category"},e("div",{class:"s-cookies-bar-category-content"},e("div",{class:"s-cookies-bar-category-title-row"},e("span",{class:"s-cookies-bar-category-title"},s),o&&e("span",{class:"s-cookies-bar-badge"},o)),e("p",{class:"s-cookies-bar-category-description m-0"},t)),i)}renderMessage(){return e("p",{class:"s-cookies-bar-message m-0"},this.messageLabel,Salla.config.get("policy_url")&&e("a",{href:Salla.config.get("policy_url"),target:"_blank",class:"s-cookies-bar-link text-primary ms-1"}," ",this.linkLabel))}renderConsentStep(){return e("div",{class:"s-cookies-bar-consent"},this.renderMessage(),e("div",{class:"s-cookies-bar-consent-actions"},e("salla-button",{class:"s-cookies-bar-btn--customize",color:"primary",fill:"outline",type:"button",size:this.isMobile?"small":"medium",onClick:()=>this.openPreferences()},this.customizeLabel),e("salla-button",{class:"s-cookies-bar-btn--accept",color:"primary",fill:"solid",type:"button",size:this.isMobile?"small":"medium",onClick:()=>this.accept()},this.acceptAllLabel)))}renderPreferencesStep(){return e("div",null,e("div",{class:"s-cookies-bar-header"},e("h3",{class:"s-cookies-bar-title m-0"},this.titleLabel),e("button",{type:"button",class:"s-cookies-bar-close","aria-label":this.titleLabel,onClick:()=>this.reject()},e("span",{innerHTML:o}))),e("div",{class:"s-cookies-bar-categories"},this.renderCategory(this.essentialTitleLabel,this.essentialDescriptionLabel,this.renderToggle(!0,!0,this.essentialTitleLabel),this.essentialBadgeLabel),this.renderCategory(this.performanceTitleLabel,this.performanceDescriptionLabel,this.renderToggle(this.performanceEnabled,!1,this.performanceTitleLabel,(()=>this.performanceEnabled=!this.performanceEnabled))),this.renderCategory(this.functionsTitleLabel,this.functionsDescriptionLabel,this.renderToggle(this.functionsEnabled,!1,this.functionsTitleLabel,(()=>this.functionsEnabled=!this.functionsEnabled))),this.renderCategory(this.adsTitleLabel,this.adsDescriptionLabel,this.renderToggle(this.adsEnabled,!1,this.adsTitleLabel,(()=>this.adsEnabled=!this.adsEnabled)))),e("div",{class:"s-cookies-bar-footer"},this.renderMessage(),e("salla-button",{class:"s-cookies-bar-btn--save",color:"primary",fill:"solid",type:"button",size:this.isMobile?"small":"medium",onClick:()=>this.savePreferences()},this.saveLabel)))}render(){return this.isVisible?e(t,null,e("div",{dir:this.isRtl()?"rtl":"ltr",class:"s-cookies-bar"},"consent"===this.step?this.renderConsentStep():this.renderPreferencesStep())):e(t,null)}get host(){return i(this)}};a.style='/*!twlt*/:host{display:block;overflow:visible}.s-cookies-bar{position:fixed;bottom:1rem;left:50%;transform:translateX(-50%);z-index:100;background-color:#fff;border-radius:1rem;padding:1.25rem;width:calc(100% - 2rem);max-width:48rem;box-shadow:0 10px 30px -5px rgba(0, 0, 0, 0.2)}.s-cookies-bar-consent{display:flex;flex-direction:row;align-items:center;gap:1rem;flex-wrap:wrap}@media (max-width: 640px){.s-cookies-bar-consent{flex-direction:column;align-items:end}}.s-cookies-bar-consent-actions{display:flex;align-items:center;gap:0.75rem;flex-shrink:0}.s-cookies-bar-header{display:flex;align-items:center;justify-content:space-between;gap:1rem;margin-bottom:1.25rem}.s-cookies-bar-title{font-size:1rem;font-weight:bold;color:#1f2937}.s-cookies-bar-close{display:inline-flex;align-items:center;justify-content:center;width:2rem;height:2rem;padding:0;border:none;background:transparent;cursor:pointer;flex-shrink:0}.s-cookies-bar-close svg{width:1.125rem;height:1.125rem;fill:currentColor}.s-cookies-bar-close:hover{color:#4b5563}.s-cookies-bar-categories{display:flex;flex-direction:column;gap:1rem}.s-cookies-bar-category{display:flex;align-items:flex-start;justify-content:space-between;gap:1rem}.s-cookies-bar-category .s-toggle{flex-shrink:0}.s-cookies-bar-category .s-toggle--disabled{cursor:not-allowed}.s-cookies-bar-category-title-row{display:flex;align-items:center;gap:0.5rem}.s-cookies-bar-category-title{font-size:0.875rem;font-weight:500;color:#1f2937}.s-cookies-bar-category-description{font-size:0.75rem;color:#9ca3af;margin-top:0.25rem}.s-cookies-bar-badge{display:inline-flex;align-items:center;padding:0.0625rem 0.5rem;border-radius:9999px;background-color:#f3f4f6;color:#6b7280;font-size:0.6875rem;font-weight:500;white-space:nowrap}.s-cookies-bar-footer{display:flex;align-items:center;gap:0.75rem;margin-top:1.25rem;padding-top:1.25rem;border-top:1px solid #e5e7eb}.s-cookies-bar-message{flex:1;font-size:0.75rem;line-height:1.625;font-weight:700}.s-cookies-bar-btn--save{flex-shrink:0}.visible{visibility:visible}.invisible{visibility:hidden}.m-0{margin:0px}.ms-1{margin-inline-start:0.25rem}.resize{resize:both}.text-primary{color:var(--color-primary)}.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}.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)}.toggle-checkbox .s-toggle-input{position:absolute;visibility:hidden}.toggle-checkbox .s-toggle-switcher{display:inline-block;background:#ccc;border-radius:16px;width:40px;height:25px;position:relative;vertical-align:middle;transition:background 0.25s}.toggle-checkbox .s-toggle-switcher:before,.toggle-checkbox .s-toggle-switcher:after{content:""}.toggle-checkbox .s-toggle-switcher:before{display:block;background:#fff;border-radius:50%;box-shadow:0 0 0 1px rgba(0,0,0,0.25);width:20px;height:21px;position:absolute;top:2.2px;left:1px;transition:left 0.25s}.toggle-checkbox .s-toggle-input:checked+div{background:#30D158}.toggle-checkbox .s-toggle-input:checked+div:before{left:18px}.s-toggle{cursor:pointer;display:inline-block}.s-toggle .s-toggle-input{position:absolute;visibility:hidden}.s-toggle .s-toggle-label{margin-left:5px;position:relative;top:2px}.s-toggle .s-toggle-switcher{display:inline-block;background:#ccc;border-radius:16px;width:40px;height:25px;position:relative;vertical-align:middle;transition:background 0.25s}.s-toggle .s-toggle-switcher:before,.s-toggle .s-toggle-switcher:after{content:""}.s-toggle .s-toggle-switcher:before{display:block;background:#fff;border-radius:50%;box-shadow:0 0 0 1px rgba(0,0,0,0.25);width:20px;height:21px;position:absolute;top:2.2px;left:1px;transition:left 0.25s}.s-toggle .s-toggle-input:checked+div{background:#30D158}.s-toggle .s-toggle-input:checked+div:before{left:18px}';export{a as salla_cookies_bar}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as t,h as s,a as o}from"./p-BAXTlrSC.js";const e=class{constructor(s){t(this,s),this.resolveFn=null,this.rejectFn=null,this.optionsRefs=new Map,this.changeHandler=null,this.submitCallback=null,this._realOrderOptions=[],this._collectedFreeOptions=[],this._isWizard=!1,this._freeQueue=[],this._freeIndex=0,this._collectedFreeProducts=[],this._orderBasePrice=0,this._accumulatedExtra=0,this.orderOptions=[],this.basePrice=0,this.liveTotal=0,this.isSubmitting=!1,this.sessionId=0,this.paymentMode="default",this.freeProduct=null,this.inFreeStep=!1,this.title="",this.subtitle="",this.submitLabel="",this.totalLabel="",this.requiredMessage="",this.freeProductTitle="خيارات المنتج المجاني",this.freeProductSubtitle="اختر ما يناسبك من خيارات المنتج",this.freeProductContinueLabel="تابع واحصل على هديتك الان",this.handleClose=()=>{this.isSubmitting||(this.rejectFn?.({reason:"dismissed"}),this.resolveFn=null,this.rejectFn=null,this.detachChangeListener(),this.reset())},salla.lang.onLoaded((()=>this.loadTranslations()))}componentWillLoad(){this.loadTranslations()}isRtl(){return"rtl"===document?.documentElement?.getAttribute("dir")}t(t,s){const o=salla.lang.get(t);return o&&o!==t?o:s}loadTranslations(){this.title=salla.lang.get("blocks.order_options.title"),this.subtitle=salla.lang.get("blocks.order_options.subtitle"),this.submitLabel=salla.lang.get("blocks.order_options.continue"),this.totalLabel=salla.lang.get("blocks.order_options.total"),this.requiredMessage=salla.lang.get("blocks.order_options.required_message"),this.freeProductTitle=this.t("pages.products.free_product_options_title","خيارات المنتج المجاني"),this.freeProductSubtitle=this.t("pages.products.free_product_options_subtitle","اختر ما يناسبك من خيارات المنتج"),this.freeProductContinueLabel=this.t("pages.products.free_product_cta","تابع واحصل على هديتك الان")}async open(t){const s=t=>(Array.isArray(t)?t:[]).map((t=>({...t,details:t.details??[]}))),o=s(t.orderOptions),e=this.buildFreeQueue(t,s);return this._realOrderOptions=o,this._collectedFreeOptions=[],this._collectedFreeProducts=[],this._freeQueue=e,this._freeIndex=0,this._orderBasePrice=Number(t.basePrice)||0,this._accumulatedExtra=0,this._isWizard=e.length+(o.length>0?1:0)>1,this.isSubmitting=!1,this.optionsRefs.clear(),this.submitCallback=t.onSubmit??null,this.paymentMode=t.paymentMode??"default",e.length>0?this.loadFreeStep(0):(this.sessionId++,this.inFreeStep=!1,this.orderOptions=o,this.freeProduct=null,this.basePrice=Number(t.basePrice)||0,this.liveTotal=this.basePrice+this.seedOptionsPrice(this.orderOptions)),await(this.modal?.open()),this.modal?.setTitle(this.inFreeStep?this.freeProductTitle:this.title),this.attachChangeListener(),new Promise(((t,s)=>{this.resolveFn=t,this.rejectFn=s}))}buildFreeQueue(t,s){const o=[];if((Array.isArray(t.freeProducts)?t.freeProducts:[]).forEach((t=>{const e=s(t?.options);e.length&&o.push({product:t?.product?{...t.product,offer_name:t.offer_name??t.product.offer_name??null}:null,options:e,quantity:Number(t?.quantity)>0?Number(t.quantity):1})})),o.length)return o;const e=s(t.freeProductOptions);return e.length&&o.push({product:t.freeProduct??null,options:e,quantity:1}),o}loadFreeStep(t){const s=this._freeQueue[t];this._freeIndex=t,this.optionsRefs.clear(),this.inFreeStep=!0,this.orderOptions=s.options,this.freeProduct=s.product,this.basePrice=0,this.liveTotal=this.seedOptionsPrice(s.options),this.sessionId++}async close(){await(this.modal?.close())}collectOrderOptionsSync(){const t=[];for(const[,s]of this.optionsRefs)s&&s.querySelectorAll('[name^="options["],[name*="[options]["]').forEach((s=>{if(s instanceof HTMLInputElement&&("radio"===s.type||"checkbox"===s.type)&&!s.checked)return;const o=s.name.match(/(?:^|\[)options\]?\[(\d+)\]/);if(!o)return;const e=s.value;if(""===e||null==e)return;const i=Number(e);t.push({id:Number(o[1]),value:Number.isFinite(i)&&e===String(i)?i:e})}));return t}validateSync(){let t=!0;for(const[,s]of this.optionsRefs)s&&s.querySelectorAll("[required]").forEach((s=>{s.disabled||s.closest(".hidden")||"reportValidity"in s&&!s.reportValidity()&&(t=!1)}));return t}seedOptionsPrice(t){let s=0;return t.forEach((t=>{(t.details||[]).forEach((t=>{t.is_selected&&(s+=Number(t.total_price??t.additional_price)||0)}))})),s}attachChangeListener(){this.detachChangeListener(),this.changeHandler=()=>this.recomputeTotal(),salla.event.on("product-options::change",this.changeHandler)}detachChangeListener(){this.changeHandler&&(salla.event.off("product-options::change",this.changeHandler),this.changeHandler=null)}async recomputeTotal(){let t=0;for(const[,s]of this.optionsRefs)s&&(("function"==typeof s.getSelectedOptions?await s.getSelectedOptions():[])||[]).forEach((s=>{t+=Number(s.total_price??s.additional_price)||0}));this.liveTotal=this.basePrice+t}handleSubmit(){if(this.isSubmitting)return;if(!this.validateSync())return void salla.notify?.error?.(this.requiredMessage);if(this.inFreeStep){const t=this._freeQueue[this._freeIndex],s=this.collectOrderOptionsSync();if(0===this._freeIndex&&(this._collectedFreeOptions=s),s.length&&t?.product?.id){const o={};s.forEach((({id:t,value:s})=>{o[t]=s})),this._collectedFreeProducts.push({productId:t.product.id,quantity:t.quantity,options:o})}this._accumulatedExtra+=Math.max(0,this.liveTotal-this.basePrice);const o=this._freeIndex+1;return o<this._freeQueue.length?(this.loadFreeStep(o),void this.modal?.setTitle(this.freeProductTitle)):this._realOrderOptions.length?(this.optionsRefs.clear(),this.inFreeStep=!1,this.freeProduct=null,this.orderOptions=this._realOrderOptions,this.basePrice=this._orderBasePrice,this.liveTotal=this._orderBasePrice+this.seedOptionsPrice(this._realOrderOptions),this.sessionId++,void this.modal?.setTitle(this.title)):(this.isSubmitting=!0,this.liveTotal=this._orderBasePrice,this.fireSubmitCallback([]),this.resolveAndClose([]),void(this.isSubmitting=!1))}this.isSubmitting=!0;const t=this.collectOrderOptionsSync();this.fireSubmitCallback(t),this.resolveAndClose(t),this.isSubmitting=!1}finalTotal(){return Math.round(100*(this.liveTotal+this._accumulatedExtra))/100}fireSubmitCallback(t){try{this.submitCallback?.(t,this.finalTotal(),this._collectedFreeProducts)}catch(t){salla?.logger?.warn?.("order-options modal onSubmit threw",t)}}resolveAndClose(t){this.resolveFn?.({orderOptions:t,freeProductOptions:this._collectedFreeOptions,freeProducts:this._collectedFreeProducts}),this.resolveFn=null,this.rejectFn=null,this.submitCallback=null,this.detachChangeListener(),this.modal?.close().then((()=>this.reset()))}reset(){this.orderOptions=[],this.freeProduct=null,this.inFreeStep=!1,this.optionsRefs.clear(),this.liveTotal=0,this._realOrderOptions=[],this._collectedFreeOptions=[],this._collectedFreeProducts=[],this._freeQueue=[],this._freeIndex=0,this._isWizard=!1}render(){const t=salla.money(Math.round(100*this.liveTotal)/100),o=this.inFreeStep,e=o?String(this.freeProduct?.id||`free-prod-${this.orderOptions[0]?.id}`):`order-options-${this.orderOptions[0]?.id}`,i=o?`free-product-options-${this._freeIndex}`:"order-options",r=[...this._freeQueue.map((()=>this.freeProductTitle)),...this._realOrderOptions.length?[this.title]:[]],a=o?this._freeIndex:this._freeQueue.length,l=a===Math.max(0,r.length-1),d="apple-pay"===this.paymentMode&&l;return s("salla-modal",{key:"60e626bb49f8592c952182c182e6d73ddcaadeed",ref:t=>this.modal=t,class:"s-order-options-modal-host"+(this._isWizard?" s-oom-wizard-modal":""),width:"md","modal-title":this._isWizard?" ":o?this.freeProductTitle:this.title,onModalVisibilityChanged:t=>{t.detail||this.handleClose()}},this._isWizard&&s("div",{key:"a842b5d1566c8bb0bd68d5986fb092c14f8a01d6",slot:"icon",class:"s-oom-steps"},r.map(((t,o)=>[o>0&&s("div",{class:"s-oom-connector"}),s("div",{class:"s-oom-step "+(o===a?"active":o<a?"done":"")},s("span",{class:"s-oom-step-num"},o+1),s("span",{class:"s-oom-step-label"},t))]))),s("div",{key:"1f61a756dcf824bf4d8be71ccbd9a0c2742851d2",class:"s-order-options-modal-body"},o&&this.freeProduct&&s("div",{key:"667841475dff0deda06d8d04e0a2841f33ec54b6",class:"s-oom-free-product-card"},this.freeProduct.thumbnail&&s("img",{key:"129b99226216f0c1ca59fccbc0ba35d5af8cdee7",class:"s-oom-free-product-thumb",src:this.freeProduct.thumbnail,alt:this.freeProduct.name}),s("div",{key:"ae385e2d4fb967144743d67eadd50f31c23332ec",class:"s-oom-free-product-info"},s("span",{key:"4f48a3fd0af91435060a0d303a6d0f77f5afd1bc",class:"s-oom-free-product-name"},this.freeProduct.name),s("div",{key:"de62961aba2246c1d52d411461d6a45aed620eab",class:"s-oom-free-product-tags"},s("span",{key:"db1af48cc1a7583a7f2d026159ff01f03ad216bf",class:"s-oom-free-badge"},this.t("common.elements.free","مجاني")),this.freeProduct.offer_name&&s("span",{key:"ce595bccd755e908deb1c566758ca3629171962b",class:"s-oom-free-offer-name"},this.freeProduct.offer_name)))),s("p",{key:"161740bddbf25369392f362f9613f2e9c6a94fc1",class:"s-order-options-modal-subtitle"},o?this.freeProductSubtitle:this.subtitle),s("div",{key:"20d3f92f0f3782d599ec5ce923c2dad93f7c7608",class:"s-order-options-modal-fields"},this.orderOptions.length>0&&s("salla-product-options",{key:this.sessionId,ref:t=>{t&&(this.optionsRefs.set(i,t),t.seedSelectedOptions?.())},"product-id":e,"unique-key":i,options:JSON.stringify(this.orderOptions),"hide-out-label":"1","no-padding":!0}))),s("div",{key:"c80a0c1f1b32e5396483171196879bc43713c2f4",slot:"footer",class:"s-order-options-modal-footer"},d?s("div",{class:"s-order-options-modal-apple-pay-wrap"},s("div",{class:"s-order-options-modal-apple-pay-total"},s("span",{class:"s-order-options-modal-apple-pay-label"},this.totalLabel),s("span",{class:"s-order-options-modal-apple-pay-amount",innerHTML:t})),s("apple-pay-button",{locale:salla?.config?.get?.("user.language_code")||"ar",buttonstyle:"black",type:"buy",class:"s-order-options-modal-apple-pay",onClick:()=>this.handleSubmit()})):s("salla-button",{type:"button",color:"primary",fill:"solid",width:"wide",loading:this.isSubmitting,onClick:()=>this.handleSubmit()},s("span",{class:"s-order-options-modal-cta-content"},s("span",{class:"s-order-options-modal-cta-text"},o?this.freeProductContinueLabel:this.submitLabel),o?s("i",{class:{"s-oom-cta-arrow":!0,"sicon-arrow-left":this.isRtl(),"sicon-arrow-right":!this.isRtl()}}):s("span",{class:"s-order-options-modal-cta-total",innerHTML:t})))))}get host(){return o(this)}};e.style='/*!twlt*/@charset "UTF-8";.s-order-options-modal-host .s-modal-header-inner,.s-order-options-modal-host .s-modal-header-content,.s-order-options-modal-host .s-modal-title{text-align:start !important}.s-order-options-modal-host.s-oom-wizard-modal .s-modal-title{display:none}.s-order-options-modal-host.s-oom-wizard-modal .s-modal-header-inner{flex:1;min-width:0}.s-order-options-modal-host.s-oom-wizard-modal .s-modal-header-content{display:none}.s-oom-steps{display:flex;align-items:center;justify-content:flex-start;gap:0.5rem;width:100%;padding:0}.s-oom-step{display:inline-flex;align-items:center;gap:0.375rem;padding:0.375rem 0.75rem 0.375rem 0.625rem;border-radius:9999px;font-size:0.8125rem;font-weight:600;line-height:1;white-space:nowrap;color:#9ca3af;background:transparent;border:1.5px solid #e5e7eb;transition:background 0.2s, color 0.2s, border-color 0.2s}.s-oom-step.active{background:#1a2533;color:#ffffff;border-color:#1a2533}.s-oom-step.active .s-oom-step-num{background:rgba(255, 255, 255, 0.2);color:#ffffff}.s-oom-step.done{color:#6b7280;border-color:#d1d5db}.s-oom-step-num{display:inline-flex;align-items:center;justify-content:center;width:1.25rem;height:1.25rem;border-radius:50%;font-size:0.6875rem;font-weight:700;background:#e5e7eb;color:#6b7280;flex-shrink:0}.s-oom-step-label{font-size:0.8125rem}.s-oom-connector{flex:1;max-width:3rem;height:0;border-top:1.5px dashed #d1d5db}.s-oom-free-product-card{display:flex;align-items:center;gap:0.75rem;padding:0.75rem 1rem;margin-bottom:1rem;border:1px solid #e5e7eb;border-radius:0.75rem;background:#f9fafb;}.s-oom-free-product-info{display:flex;flex-direction:column;gap:0.25rem;min-width:0;flex:1}.s-oom-free-product-tags{display:flex;flex-wrap:wrap;align-items:center;gap:0.375rem}.s-oom-free-product-name{font-size:0.9375rem;font-weight:700;color:#111827;line-height:1.4;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.s-oom-free-badge{display:inline-block;padding:0.125rem 0.5rem;border-radius:9999px;font-size:0.6875rem;font-weight:600;color:#059669;background:#d1fae5;align-self:flex-start}.s-oom-free-offer-name{display:inline-block;padding:0.125rem 0.5rem;border-radius:9999px;font-size:0.6875rem;font-weight:500;color:#6b7280;background:#f3f4f6;align-self:flex-start}.s-oom-free-product-thumb{width:3.5rem;height:3.5rem;object-fit:cover;border-radius:0.5rem;flex-shrink:0;border:1px solid #e5e7eb}.s-order-options-modal-body{padding-top:0.25rem;max-height:60vh;overflow-y:auto;overscroll-behavior:contain}.s-order-options-modal-subtitle{font-size:0.875rem;color:#6b7280;margin-bottom:1rem;text-align:start}.s-order-options-modal-cta-content{display:flex;align-items:center;justify-content:center;gap:0.5rem;width:100%}.s-order-options-modal-cta-text{flex:1;text-align:center}.s-order-options-modal-apple-pay{display:block;width:100%;--apple-pay-button-width:100%;--apple-pay-button-height:44px;--apple-pay-button-border-radius:0.75rem}.s-order-options-modal-apple-pay-wrap{display:flex;flex-direction:column;gap:0.75rem;width:100%}.s-order-options-modal-apple-pay-total{display:flex;align-items:center;justify-content:space-between;gap:0.5rem}.s-order-options-modal-apple-pay-label,.s-order-options-modal-apple-pay-amount{font-size:1.125rem;line-height:1.5rem;font-weight:700;color:#111827}.s-oom-cta-arrow{font-size:0.875rem;flex-shrink:0}.static{position:static}.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)}.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-options-modal-body{display:block;max-height:60vh;overflow-y:auto;overscroll-behavior:contain}.s-order-options-modal-subtitle{margin-bottom:1rem;font-size:0.875rem;line-height:1.5rem;--tw-text-opacity:1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.s-order-options-modal-fields{display:flex;flex-direction:column;gap:1rem}.s-order-options-modal-item{display:block}.s-order-options-modal-footer{display:flex;width:100%;align-items:center}.s-order-options-modal-cta-content{display:flex;align-items:center;gap:0.25rem}.s-order-options-modal-cta-text{font-weight:700}.s-order-options-modal-cta-total{font-weight:700}';export{e as salla_order_options_modal}
|
|
4
|
+
import{r as t,h as s,a as o}from"./p-DVa_W0x-.js";const e=class{constructor(s){t(this,s),this.resolveFn=null,this.rejectFn=null,this.optionsRefs=new Map,this.changeHandler=null,this.submitCallback=null,this._realOrderOptions=[],this._collectedFreeOptions=[],this._isWizard=!1,this._freeQueue=[],this._freeIndex=0,this._collectedFreeProducts=[],this._orderBasePrice=0,this._accumulatedExtra=0,this.orderOptions=[],this.basePrice=0,this.liveTotal=0,this.isSubmitting=!1,this.sessionId=0,this.paymentMode="default",this.freeProduct=null,this.inFreeStep=!1,this.title="",this.subtitle="",this.submitLabel="",this.totalLabel="",this.requiredMessage="",this.freeProductTitle="خيارات المنتج المجاني",this.freeProductSubtitle="اختر ما يناسبك من خيارات المنتج",this.freeProductContinueLabel="تابع واحصل على هديتك الان",this.handleClose=()=>{this.isSubmitting||(this.rejectFn?.({reason:"dismissed"}),this.resolveFn=null,this.rejectFn=null,this.detachChangeListener(),this.reset())},salla.lang.onLoaded((()=>this.loadTranslations()))}componentWillLoad(){this.loadTranslations()}isRtl(){return"rtl"===document?.documentElement?.getAttribute("dir")}t(t,s){const o=salla.lang.get(t);return o&&o!==t?o:s}loadTranslations(){this.title=salla.lang.get("blocks.order_options.title"),this.subtitle=salla.lang.get("blocks.order_options.subtitle"),this.submitLabel=salla.lang.get("blocks.order_options.continue"),this.totalLabel=salla.lang.get("blocks.order_options.total"),this.requiredMessage=salla.lang.get("blocks.order_options.required_message"),this.freeProductTitle=this.t("pages.products.free_product_options_title","خيارات المنتج المجاني"),this.freeProductSubtitle=this.t("pages.products.free_product_options_subtitle","اختر ما يناسبك من خيارات المنتج"),this.freeProductContinueLabel=this.t("pages.products.free_product_cta","تابع واحصل على هديتك الان")}async open(t){const s=t=>(Array.isArray(t)?t:[]).map((t=>({...t,details:t.details??[]}))),o=s(t.orderOptions),e=this.buildFreeQueue(t,s);return this._realOrderOptions=o,this._collectedFreeOptions=[],this._collectedFreeProducts=[],this._freeQueue=e,this._freeIndex=0,this._orderBasePrice=Number(t.basePrice)||0,this._accumulatedExtra=0,this._isWizard=e.length+(o.length>0?1:0)>1,this.isSubmitting=!1,this.optionsRefs.clear(),this.submitCallback=t.onSubmit??null,this.paymentMode=t.paymentMode??"default",e.length>0?this.loadFreeStep(0):(this.sessionId++,this.inFreeStep=!1,this.orderOptions=o,this.freeProduct=null,this.basePrice=Number(t.basePrice)||0,this.liveTotal=this.basePrice+this.seedOptionsPrice(this.orderOptions)),await(this.modal?.open()),this.modal?.setTitle(this.inFreeStep?this.freeProductTitle:this.title),this.attachChangeListener(),new Promise(((t,s)=>{this.resolveFn=t,this.rejectFn=s}))}buildFreeQueue(t,s){const o=[];if((Array.isArray(t.freeProducts)?t.freeProducts:[]).forEach((t=>{const e=s(t?.options);e.length&&o.push({product:t?.product?{...t.product,offer_name:t.offer_name??t.product.offer_name??null}:null,options:e,quantity:Number(t?.quantity)>0?Number(t.quantity):1})})),o.length)return o;const e=s(t.freeProductOptions);return e.length&&o.push({product:t.freeProduct??null,options:e,quantity:1}),o}loadFreeStep(t){const s=this._freeQueue[t];this._freeIndex=t,this.optionsRefs.clear(),this.inFreeStep=!0,this.orderOptions=s.options,this.freeProduct=s.product,this.basePrice=0,this.liveTotal=this.seedOptionsPrice(s.options),this.sessionId++}async close(){await(this.modal?.close())}collectOrderOptionsSync(){const t=[];for(const[,s]of this.optionsRefs)s&&s.querySelectorAll('[name^="options["],[name*="[options]["]').forEach((s=>{if(s instanceof HTMLInputElement&&("radio"===s.type||"checkbox"===s.type)&&!s.checked)return;const o=s.name.match(/(?:^|\[)options\]?\[(\d+)\]/);if(!o)return;const e=s.value;if(""===e||null==e)return;const i=Number(e);t.push({id:Number(o[1]),value:Number.isFinite(i)&&e===String(i)?i:e})}));return t}validateSync(){let t=!0;for(const[,s]of this.optionsRefs)s&&s.querySelectorAll("[required]").forEach((s=>{s.disabled||s.closest(".hidden")||"reportValidity"in s&&!s.reportValidity()&&(t=!1)}));return t}seedOptionsPrice(t){let s=0;return t.forEach((t=>{(t.details||[]).forEach((t=>{t.is_selected&&(s+=Number(t.total_price??t.additional_price)||0)}))})),s}attachChangeListener(){this.detachChangeListener(),this.changeHandler=()=>this.recomputeTotal(),salla.event.on("product-options::change",this.changeHandler)}detachChangeListener(){this.changeHandler&&(salla.event.off("product-options::change",this.changeHandler),this.changeHandler=null)}async recomputeTotal(){let t=0;for(const[,s]of this.optionsRefs)s&&(("function"==typeof s.getSelectedOptions?await s.getSelectedOptions():[])||[]).forEach((s=>{t+=Number(s.total_price??s.additional_price)||0}));this.liveTotal=this.basePrice+t}handleSubmit(){if(this.isSubmitting)return;if(!this.validateSync())return void salla.notify?.error?.(this.requiredMessage);if(this.inFreeStep){const t=this._freeQueue[this._freeIndex],s=this.collectOrderOptionsSync();if(0===this._freeIndex&&(this._collectedFreeOptions=s),s.length&&t?.product?.id){const o={};s.forEach((({id:t,value:s})=>{o[t]=s})),this._collectedFreeProducts.push({productId:t.product.id,quantity:t.quantity,options:o})}this._accumulatedExtra+=Math.max(0,this.liveTotal-this.basePrice);const o=this._freeIndex+1;return o<this._freeQueue.length?(this.loadFreeStep(o),void this.modal?.setTitle(this.freeProductTitle)):this._realOrderOptions.length?(this.optionsRefs.clear(),this.inFreeStep=!1,this.freeProduct=null,this.orderOptions=this._realOrderOptions,this.basePrice=this._orderBasePrice,this.liveTotal=this._orderBasePrice+this.seedOptionsPrice(this._realOrderOptions),this.sessionId++,void this.modal?.setTitle(this.title)):(this.isSubmitting=!0,this.liveTotal=this._orderBasePrice,this.fireSubmitCallback([]),this.resolveAndClose([]),void(this.isSubmitting=!1))}this.isSubmitting=!0;const t=this.collectOrderOptionsSync();this.fireSubmitCallback(t),this.resolveAndClose(t),this.isSubmitting=!1}finalTotal(){return Math.round(100*(this.liveTotal+this._accumulatedExtra))/100}fireSubmitCallback(t){try{this.submitCallback?.(t,this.finalTotal(),this._collectedFreeProducts)}catch(t){salla?.logger?.warn?.("order-options modal onSubmit threw",t)}}resolveAndClose(t){this.resolveFn?.({orderOptions:t,freeProductOptions:this._collectedFreeOptions,freeProducts:this._collectedFreeProducts}),this.resolveFn=null,this.rejectFn=null,this.submitCallback=null,this.detachChangeListener(),this.modal?.close().then((()=>this.reset()))}reset(){this.orderOptions=[],this.freeProduct=null,this.inFreeStep=!1,this.optionsRefs.clear(),this.liveTotal=0,this._realOrderOptions=[],this._collectedFreeOptions=[],this._collectedFreeProducts=[],this._freeQueue=[],this._freeIndex=0,this._isWizard=!1}render(){const t=salla.money(Math.round(100*this.liveTotal)/100),o=this.inFreeStep,e=o?String(this.freeProduct?.id||`free-prod-${this.orderOptions[0]?.id}`):`order-options-${this.orderOptions[0]?.id}`,i=o?`free-product-options-${this._freeIndex}`:"order-options",r=[...this._freeQueue.map((()=>this.freeProductTitle)),...this._realOrderOptions.length?[this.title]:[]],a=o?this._freeIndex:this._freeQueue.length,l=a===Math.max(0,r.length-1),d="apple-pay"===this.paymentMode&&l;return s("salla-modal",{key:"60e626bb49f8592c952182c182e6d73ddcaadeed",ref:t=>this.modal=t,class:"s-order-options-modal-host"+(this._isWizard?" s-oom-wizard-modal":""),width:"md","modal-title":this._isWizard?" ":o?this.freeProductTitle:this.title,onModalVisibilityChanged:t=>{t.detail||this.handleClose()}},this._isWizard&&s("div",{key:"a842b5d1566c8bb0bd68d5986fb092c14f8a01d6",slot:"icon",class:"s-oom-steps"},r.map(((t,o)=>[o>0&&s("div",{class:"s-oom-connector"}),s("div",{class:"s-oom-step "+(o===a?"active":o<a?"done":"")},s("span",{class:"s-oom-step-num"},o+1),s("span",{class:"s-oom-step-label"},t))]))),s("div",{key:"1f61a756dcf824bf4d8be71ccbd9a0c2742851d2",class:"s-order-options-modal-body"},o&&this.freeProduct&&s("div",{key:"667841475dff0deda06d8d04e0a2841f33ec54b6",class:"s-oom-free-product-card"},this.freeProduct.thumbnail&&s("img",{key:"129b99226216f0c1ca59fccbc0ba35d5af8cdee7",class:"s-oom-free-product-thumb",src:this.freeProduct.thumbnail,alt:this.freeProduct.name}),s("div",{key:"ae385e2d4fb967144743d67eadd50f31c23332ec",class:"s-oom-free-product-info"},s("span",{key:"4f48a3fd0af91435060a0d303a6d0f77f5afd1bc",class:"s-oom-free-product-name"},this.freeProduct.name),s("div",{key:"de62961aba2246c1d52d411461d6a45aed620eab",class:"s-oom-free-product-tags"},s("span",{key:"db1af48cc1a7583a7f2d026159ff01f03ad216bf",class:"s-oom-free-badge"},this.t("common.elements.free","مجاني")),this.freeProduct.offer_name&&s("span",{key:"ce595bccd755e908deb1c566758ca3629171962b",class:"s-oom-free-offer-name"},this.freeProduct.offer_name)))),s("p",{key:"161740bddbf25369392f362f9613f2e9c6a94fc1",class:"s-order-options-modal-subtitle"},o?this.freeProductSubtitle:this.subtitle),s("div",{key:"20d3f92f0f3782d599ec5ce923c2dad93f7c7608",class:"s-order-options-modal-fields"},this.orderOptions.length>0&&s("salla-product-options",{key:this.sessionId,ref:t=>{t&&(this.optionsRefs.set(i,t),t.seedSelectedOptions?.())},"product-id":e,"unique-key":i,options:JSON.stringify(this.orderOptions),"hide-out-label":"1","no-padding":!0}))),s("div",{key:"c80a0c1f1b32e5396483171196879bc43713c2f4",slot:"footer",class:"s-order-options-modal-footer"},d?s("div",{class:"s-order-options-modal-apple-pay-wrap"},s("div",{class:"s-order-options-modal-apple-pay-total"},s("span",{class:"s-order-options-modal-apple-pay-label"},this.totalLabel),s("span",{class:"s-order-options-modal-apple-pay-amount",innerHTML:t})),s("apple-pay-button",{locale:salla?.config?.get?.("user.language_code")||"ar",buttonstyle:"black",type:"buy",class:"s-order-options-modal-apple-pay",onClick:()=>this.handleSubmit()})):s("salla-button",{type:"button",color:"primary",fill:"solid",width:"wide",loading:this.isSubmitting,onClick:()=>this.handleSubmit()},s("span",{class:"s-order-options-modal-cta-content"},s("span",{class:"s-order-options-modal-cta-text"},o?this.freeProductContinueLabel:this.submitLabel),o?s("i",{class:{"s-oom-cta-arrow":!0,"sicon-arrow-left":this.isRtl(),"sicon-arrow-right":!this.isRtl()}}):s("span",{class:"s-order-options-modal-cta-total",innerHTML:t})))))}get host(){return o(this)}};e.style='/*!twlt*/@charset "UTF-8";.s-order-options-modal-host .s-modal-header-inner,.s-order-options-modal-host .s-modal-header-content,.s-order-options-modal-host .s-modal-title{text-align:start !important}.s-order-options-modal-host.s-oom-wizard-modal .s-modal-title{display:none}.s-order-options-modal-host.s-oom-wizard-modal .s-modal-header-inner{flex:1;min-width:0}.s-order-options-modal-host.s-oom-wizard-modal .s-modal-header-content{display:none}.s-oom-steps{display:flex;align-items:center;justify-content:flex-start;gap:0.5rem;width:100%;padding:0}.s-oom-step{display:inline-flex;align-items:center;gap:0.375rem;padding:0.375rem 0.75rem 0.375rem 0.625rem;border-radius:9999px;font-size:0.8125rem;font-weight:600;line-height:1;white-space:nowrap;color:#9ca3af;background:transparent;border:1.5px solid #e5e7eb;transition:background 0.2s, color 0.2s, border-color 0.2s}.s-oom-step.active{background:#1a2533;color:#ffffff;border-color:#1a2533}.s-oom-step.active .s-oom-step-num{background:rgba(255, 255, 255, 0.2);color:#ffffff}.s-oom-step.done{color:#6b7280;border-color:#d1d5db}.s-oom-step-num{display:inline-flex;align-items:center;justify-content:center;width:1.25rem;height:1.25rem;border-radius:50%;font-size:0.6875rem;font-weight:700;background:#e5e7eb;color:#6b7280;flex-shrink:0}.s-oom-step-label{font-size:0.8125rem}.s-oom-connector{flex:1;max-width:3rem;height:0;border-top:1.5px dashed #d1d5db}.s-oom-free-product-card{display:flex;align-items:center;gap:0.75rem;padding:0.75rem 1rem;margin-bottom:1rem;border:1px solid #e5e7eb;border-radius:0.75rem;background:#f9fafb;}.s-oom-free-product-info{display:flex;flex-direction:column;gap:0.25rem;min-width:0;flex:1}.s-oom-free-product-tags{display:flex;flex-wrap:wrap;align-items:center;gap:0.375rem}.s-oom-free-product-name{font-size:0.9375rem;font-weight:700;color:#111827;line-height:1.4;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.s-oom-free-badge{display:inline-block;padding:0.125rem 0.5rem;border-radius:9999px;font-size:0.6875rem;font-weight:600;color:#059669;background:#d1fae5;align-self:flex-start}.s-oom-free-offer-name{display:inline-block;padding:0.125rem 0.5rem;border-radius:9999px;font-size:0.6875rem;font-weight:500;color:#6b7280;background:#f3f4f6;align-self:flex-start}.s-oom-free-product-thumb{width:3.5rem;height:3.5rem;object-fit:cover;border-radius:0.5rem;flex-shrink:0;border:1px solid #e5e7eb}.s-order-options-modal-body{padding-top:0.25rem;max-height:60vh;overflow-y:auto;overscroll-behavior:contain}.s-order-options-modal-subtitle{font-size:0.875rem;color:#6b7280;margin-bottom:1rem;text-align:start}.s-order-options-modal-cta-content{display:flex;align-items:center;justify-content:center;gap:0.5rem;width:100%}.s-order-options-modal-cta-text{flex:1;text-align:center}.s-order-options-modal-apple-pay{display:block;width:100%;--apple-pay-button-width:100%;--apple-pay-button-height:44px;--apple-pay-button-border-radius:0.75rem}.s-order-options-modal-apple-pay-wrap{display:flex;flex-direction:column;gap:0.75rem;width:100%}.s-order-options-modal-apple-pay-total{display:flex;align-items:center;justify-content:space-between;gap:0.5rem}.s-order-options-modal-apple-pay-label,.s-order-options-modal-apple-pay-amount{font-size:1.125rem;line-height:1.5rem;font-weight:700;color:#111827}.s-oom-cta-arrow{font-size:0.875rem;flex-shrink:0}.static{position:static}.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)}.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-options-modal-body{display:block;max-height:60vh;overflow-y:auto;overscroll-behavior:contain}.s-order-options-modal-subtitle{margin-bottom:1rem;font-size:0.875rem;line-height:1.5rem;--tw-text-opacity:1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.s-order-options-modal-fields{display:flex;flex-direction:column;gap:1rem}.s-order-options-modal-item{display:block}.s-order-options-modal-footer{display:flex;width:100%;align-items:center}.s-order-options-modal-cta-content{display:flex;align-items:center;gap:0.25rem}.s-order-options-modal-cta-text{font-weight:700}.s-order-options-modal-cta-total{font-weight:700}';export{e as salla_order_options_modal}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as e,c as a,h as t,H as s}from"./p-
|
|
4
|
+
import{r as e,c as a,h as t,H as s}from"./p-DVa_W0x-.js";const i=class{constructor(t){e(this,t),this.prizeItemSelected=a(this,"prizeItemSelected")}onPrizeItemClick(){this.prizeItemSelected.emit(this.item)}render(){return t(s,{key:"b50a0407d3ddec72fef3b7f4ff325c14ee52edfa"},t("div",{key:"a6f180164b4bbed6b0a8c534dda70d7ce8a8d0d5",onClick:this.onPrizeItemClick.bind(this)},t("img",{key:"3314cec7f2adf02d4d7b0623d95aaa87c8c5a4e0",class:"s-loyalty-prize-item-image",src:this.item.image,alt:this.item.name}),t("div",{key:"6a33d5bfcd00e231f9b9a21d8d7b9e8cbb263e7c",class:"s-loyalty-prize-item-title"},this.item.name),t("div",{key:"333c4b1548e13601edb9405460fde38fde274997",class:"s-loyalty-prize-item-subtitle"},this.item.description),t("div",{key:"dbf09413ed15affa54dd0e5bbbb425bdf89d2a42",class:"s-loyalty-prize-item-points"},this.item.cost_points," ",salla.lang.get("pages.loyalty_program.point"))))}};i.style="salla-loyalty-prize-item:hover{box-shadow:0 5px 15px 1px rgba(0, 0, 0, 0.04) !important}";export{i as salla_loyalty_prize_item}
|
|
@@ -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-DVa_W0x-.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,h as e,H as i}from"./p-
|
|
4
|
+
import{r as t,h as e,H as i}from"./p-DVa_W0x-.js";const s=class{constructor(e){t(this,e),this.href=void 0,this.target="_self"}generateClass(){return{"s-list-tile-item":!0,"s-list-tile-item-href":!!this.href}}render(){return e(i,{key:"859bfbc8049ae8391ac35db575f9eac29651d45d"},e("a",{key:"94cfc3500071ef1b45d5120cc0b3f2234978d089",class:this.generateClass(),href:this.href||"#",target:this.target,"aria-label":"List Tile Link"},e("div",{key:"dcf0437211174d449ef381f96103e3661a0373ae",class:"s-list-tile-item-icon"},e("slot",{key:"e446499ef938c4c6017c57ebf6df800d0324aee0",name:"icon"})),e("div",{key:"87403147cde0cab458181c36d797f85ee9390d8a",class:"s-list-tile-item-content"},e("div",{key:"b585f7f0f23d83cb8b128d7a225d6561430bf81e",class:"s-list-tile-item-title"},e("slot",{key:"756b1d8edbc9272a4aae4fa1e63c8531ca8851f5",name:"title"})),e("div",{key:"1ce5eae34219802f67eea914efb1d2300ea7e896",class:"s-list-tile-item-subtitle"},e("slot",{key:"8bac18580d009d7d910f4e92b798ff3338ce6632",name:"subtitle"}))),e("div",{key:"2477624cd43d6c0292d40395e38a0a4fe6d07be4",class:"s-list-tile-item-action"},e("slot",{key:"b51e25e3f127e39289dd4d8949fc72d1b9cbd044",name:"action"}))))}};s.style='/*!twlt*/.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)}.s-gifting-widget .s-list-tile-item-icon{display:none}.s-gifting-widget-vertical .s-list-tile-item-icon{display:block}.s-gifting-widget-vertical .s-list-tile-item-title svg{fill:var(--color-primary)}.s-gifting-widget-vertical .s-list-tile-item-subtitle{padding-right:3.5rem;font-size:0.75rem;line-height:1rem;--tw-text-opacity:1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.s-gifting-widget-vertical .s-list-tile-item{flex-wrap:wrap;padding:0px}@media (min-width: 1024px){.s-gifting-widget-vertical .s-list-tile-item-action{flex:1 1 0%}}.s-gifting-widget .s-list-tile-item{flex-direction:column;justify-content:space-between;gap:1rem;border-radius:0.75rem;border-width:1px;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1));padding:1.25rem;text-align:center}@media (min-width: 768px){.s-gifting-widget .s-list-tile-item{text-align:left}}@media (min-width: 1024px){.s-gifting-widget .s-list-tile-item{flex-direction:row}}@media (min-width: 768px){.s-gifting-widget .s-list-tile-item:where([dir="rtl"],[dir="rtl"] *){text-align:right}}.s-list-tile-item{position:relative;display:flex;align-items:center;--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1));padding:0.75rem;--tw-text-opacity:1;color:rgb(17 24 39 / var(--tw-text-opacity, 1));text-decoration-line:none}.s-list-tile-item-href{cursor:pointer}.s-list-tile-item-icon{margin-right:1rem;flex-shrink:0}.s-list-tile-item-icon:where([dir="rtl"],[dir="rtl"] *){margin-left:1rem;margin-right:0px}.s-list-tile-item-title{font-size:1rem;line-height:1.5rem}.s-list-tile-item-subtitle{font-size:0.875rem;line-height:1.25rem}.s-loyalty-skeleton .s-list-tile-item-content{display:block;width:100%}.s-loyalty-widget .s-list-tile-item{padding:0px !important}.s-loyalty-after-exchange .s-list-tile-item{position:relative;justify-content:space-between;overflow:hidden;border-radius:var(--s-radius, 0.25rem);padding-top:0.75rem;padding-bottom:0.75rem}.s-loyalty-after-exchange .s-list-tile-item::after{pointer-events:none;position:absolute;inset:0px;display:block;height:100%;width:100%;background-color:var(--color-primary);opacity:.08;--tw-content:\'\';content:var(--tw-content)}.s-loyalty-after-exchange .s-list-tile-item .s-list-tile-item-title{font-size:15px}.s-loyalty-program-after-exchange .s-list-tile-item{position:relative;justify-content:space-between;overflow:hidden;border-radius:var(--s-radius, 0.25rem);background-color:var(--color-primary);padding-top:0.75rem;padding-bottom:0.75rem}.s-loyalty-program-after-exchange .s-list-tile-item .s-list-tile-item-title{font-size:0.875rem;line-height:1.25rem}.s-loyalty-program-panel-widget .s-list-tile-item{padding:0px !important}.s-scopes-skeleton .s-list-tile-item-content{display:block;width:100%}.s-scopes-skeleton .s-list-tile-item-icon{margin-right:2rem}.s-scopes-skeleton .s-list-tile-item-icon:where([dir="rtl"],[dir="rtl"] *){margin-right:0px;margin-left:2rem}.s-user-settings-section .s-list-tile-item{align-items:flex-start;background-color:transparent;padding:1.25rem}@media (min-width: 768px){.s-user-settings-section .s-list-tile-item{align-items:center}}.s-user-settings-section .s-list-tile-item-action{margin-left:auto}.s-user-settings-section .s-list-tile-item-action:where([dir="rtl"],[dir="rtl"] *){margin-right:auto;margin-left:0px}.s-user-settings-section .s-list-tile-item-action button{width:100%;padding:10px}.s-user-settings-section-delete-user .s-list-tile-item{flex-wrap:wrap}@media (min-width: 768px){.s-user-settings-section-delete-user .s-list-tile-item{flex-wrap:nowrap}}.s-user-settings-section-delete-user .s-list-tile-item-icon{position:relative;top:5px}@media (min-width: 768px){.s-user-settings-section-delete-user .s-list-tile-item-icon{top:0px}}@media (max-width: 768px){.s-user-settings-section-delete-user .s-list-tile-item-content{flex:1 0 85%}.s-user-settings-section-delete-user .s-list-tile-item-action{flex:1 1 100%;margin-top:1rem}}';export{s as salla_list_tile}
|