@salla.sa/twilight-components 2.14.593 → 2.14.595
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-Dh9Ih7bu.js → filepond-BmX7bEQk.js} +1 -1
- package/dist/cjs/{filepond-plugin-file-poster-C6Sx5vF0.js → filepond-plugin-file-poster-Cs6e85Vn.js} +1 -1
- package/dist/cjs/{filepond-plugin-file-validate-size-DdzdetN6.js → filepond-plugin-file-validate-size-CSk66JAo.js} +1 -1
- package/dist/cjs/{filepond-plugin-file-validate-type-DRWFKOpQ.js → filepond-plugin-file-validate-type-Piu3p2Um.js} +1 -1
- package/dist/cjs/{filepond-plugin-image-edit-B4vaf2kZ.js → filepond-plugin-image-edit-Ba9FBal4.js} +1 -1
- package/dist/cjs/{filepond-plugin-image-exif-orientation-BXfm40Ut.js → filepond-plugin-image-exif-orientation-zwtgHyrT.js} +1 -1
- package/dist/cjs/{filepond-plugin-image-preview-DQLCCOAs.js → filepond-plugin-image-preview-BmGjui8n.js} +1 -1
- package/dist/cjs/{index-CLrjVXN1.js → index-DkrDtx6i.js} +21 -7
- package/dist/cjs/{intlTelInput-o62W18dw.js → intlTelInput-Bty1-N7J.js} +1 -1
- package/dist/cjs/loader.cjs.js +2 -2
- 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 +286 -20
- package/dist/cjs/salla-cart-coupons.cjs.entry.js +68 -15
- package/dist/cjs/salla-cart-item-offers_2.cjs.entry.js +1 -1
- package/dist/cjs/salla-cart-summary-card.cjs.entry.js +29 -4
- 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_2.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-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 +2 -2
- package/dist/cjs/{vanilla-picker-FCNrUTtN.js → vanilla-picker-DgPfWupN.js} +1 -1
- package/dist/collection/components/salla-bullet-delivery/location-distance-warning.js +28 -0
- package/dist/collection/components/salla-bullet-delivery/location-icon.svg +26 -0
- package/dist/collection/components/salla-bullet-delivery/location-permission-notice.js +103 -0
- package/dist/collection/components/salla-bullet-delivery/salla-bullet-delivery.css +136 -0
- package/dist/collection/components/salla-bullet-delivery/salla-bullet-delivery.js +133 -19
- package/dist/collection/components/salla-cart-coupons/salla-cart-coupons.js +69 -15
- package/dist/collection/components/salla-cart-summary-card/salla-cart-summary-card.js +30 -3
- package/dist/collection/global/app.js +2 -0
- package/dist/collection/global/app.spec.ts +33 -0
- package/dist/collection/global/app.ts +2 -0
- package/dist/collection/global/chunk-errors.js +14 -0
- package/dist/collection/global/chunk-errors.spec.ts +47 -0
- package/dist/collection/global/chunk-errors.ts +13 -0
- package/dist/components/index.js +15 -2
- package/dist/components/salla-bullet-delivery.js +288 -20
- package/dist/components/salla-cart-coupons.js +68 -14
- package/dist/components/salla-cart-summary-card.js +30 -3
- package/dist/docs.json +1 -1
- package/dist/esm/{filepond-DTcw03Zq.js → filepond-DF26o67L.js} +1 -1
- package/dist/esm/{filepond-plugin-file-poster-Csk5cMw9.js → filepond-plugin-file-poster-B4epzDDH.js} +1 -1
- package/dist/esm/{filepond-plugin-file-validate-size-FFrf5LrW.js → filepond-plugin-file-validate-size-DILJc03j.js} +1 -1
- package/dist/esm/{filepond-plugin-file-validate-type-DeZP4xXd.js → filepond-plugin-file-validate-type-Bic7dGts.js} +1 -1
- package/dist/esm/{filepond-plugin-image-edit-DRKyd_1I.js → filepond-plugin-image-edit-DHfCLKK0.js} +1 -1
- package/dist/esm/{filepond-plugin-image-exif-orientation-CxVz7OAy.js → filepond-plugin-image-exif-orientation-C7y59Hrn.js} +1 -1
- package/dist/esm/{filepond-plugin-image-preview-CsKN7em3.js → filepond-plugin-image-preview-C-ZqWLeC.js} +1 -1
- package/dist/esm/{index-0Tl_yZW8.js → index-HRJpfiBN.js} +21 -7
- package/dist/esm/{intlTelInput-CBN9egFg.js → intlTelInput-DOVRUqFb.js} +1 -1
- package/dist/esm/loader.js +3 -3
- 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 +286 -20
- package/dist/esm/salla-cart-coupons.entry.js +68 -15
- package/dist/esm/salla-cart-item-offers_2.entry.js +1 -1
- package/dist/esm/salla-cart-summary-card.entry.js +29 -4
- 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_2.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-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 +3 -3
- package/dist/esm/{vanilla-picker-CiLp9ysz.js → vanilla-picker-DQKehCLa.js} +1 -1
- package/dist/twilight/global/app.spec.ts +33 -0
- package/dist/twilight/global/app.ts +2 -0
- package/dist/twilight/global/chunk-errors.spec.ts +47 -0
- package/dist/twilight/global/chunk-errors.ts +13 -0
- package/dist/twilight/{p-b566bc10.entry.js → p-02d79968.entry.js} +1 -1
- package/dist/twilight/{p-f445e7a3.entry.js → p-078e5ef8.entry.js} +1 -1
- package/dist/twilight/{p-40be8baa.entry.js → p-07e1822a.entry.js} +1 -1
- package/dist/twilight/{p-d744234e.entry.js → p-0e430b25.entry.js} +1 -1
- package/dist/twilight/{p-9a818822.entry.js → p-100260a2.entry.js} +1 -1
- package/dist/twilight/{p-1892ea42.entry.js → p-117c8823.entry.js} +1 -1
- package/dist/twilight/{p-449eae1d.entry.js → p-119aa7c1.entry.js} +1 -1
- package/dist/twilight/{p-e8cb4cd9.entry.js → p-14b78c6e.entry.js} +1 -1
- package/dist/twilight/{p-bc3ad6d2.entry.js → p-155f1fed.entry.js} +1 -1
- package/dist/twilight/{p-1abcc81d.entry.js → p-16b45c19.entry.js} +1 -1
- package/dist/twilight/{p-7c06ad6a.entry.js → p-1a684490.entry.js} +1 -1
- package/dist/twilight/{p-b0d66765.entry.js → p-1b0da3b9.entry.js} +1 -1
- package/dist/twilight/{p-fe27963f.entry.js → p-20d5665b.entry.js} +1 -1
- package/dist/twilight/{p-2cbed601.entry.js → p-231d4bf2.entry.js} +1 -1
- package/dist/twilight/{p-5cc28510.entry.js → p-235f40b0.entry.js} +1 -1
- package/dist/twilight/{p-7bee2390.entry.js → p-2413d450.entry.js} +1 -1
- package/dist/twilight/{p-6561d5d3.entry.js → p-25ea21a6.entry.js} +1 -1
- package/dist/twilight/{p-fea37c8c.entry.js → p-2c13b5e8.entry.js} +1 -1
- package/dist/twilight/{p-e8fa4bd0.entry.js → p-2f96a72f.entry.js} +1 -1
- package/dist/twilight/{p-fb527b4d.entry.js → p-312d231b.entry.js} +1 -1
- package/dist/twilight/{p-52e7b4f6.entry.js → p-313dbe67.entry.js} +1 -1
- package/dist/twilight/{p-636ffc46.entry.js → p-334fc442.entry.js} +1 -1
- package/dist/twilight/{p-c394f30a.entry.js → p-33a64882.entry.js} +1 -1
- package/dist/twilight/{p-fef5c118.entry.js → p-3c0be6b1.entry.js} +1 -1
- package/dist/twilight/{p-14c9ed90.entry.js → p-3e232b09.entry.js} +1 -1
- package/dist/twilight/{p-933807d7.entry.js → p-3f376a9d.entry.js} +1 -1
- package/dist/twilight/{p-7f59893d.entry.js → p-46ad2b0e.entry.js} +1 -1
- package/dist/twilight/{p-a764bfe7.entry.js → p-49d6d82e.entry.js} +1 -1
- package/dist/twilight/{p-cc7c4469.entry.js → p-49e2f73d.entry.js} +1 -1
- package/dist/twilight/{p-75fc9b99.entry.js → p-4cee6b43.entry.js} +1 -1
- package/dist/twilight/{p-e9372ca0.entry.js → p-4e0dcb5c.entry.js} +1 -1
- package/dist/twilight/{p-4701a008.entry.js → p-4e3a3c55.entry.js} +1 -1
- package/dist/twilight/{p-42426756.entry.js → p-4e74c79f.entry.js} +1 -1
- package/dist/twilight/{p-2ac1eac9.entry.js → p-4f9da81b.entry.js} +1 -1
- package/dist/twilight/{p-0fe961e0.entry.js → p-5134faef.entry.js} +1 -1
- package/dist/twilight/p-5b617110.entry.js +4 -0
- package/dist/twilight/{p-01b4b05f.entry.js → p-5bc3f956.entry.js} +1 -1
- package/dist/twilight/{p-299e7413.entry.js → p-5f0eca54.entry.js} +1 -1
- package/dist/twilight/{p-918fa44a.entry.js → p-5fae444a.entry.js} +1 -1
- package/dist/twilight/{p-65665ee3.entry.js → p-61c8e3c6.entry.js} +1 -1
- package/dist/twilight/{p-2d2db627.entry.js → p-6e8cb8fb.entry.js} +1 -1
- package/dist/twilight/{p-99e615a1.entry.js → p-6feb378a.entry.js} +1 -1
- package/dist/twilight/{p-1bf7cce7.entry.js → p-70c45a90.entry.js} +1 -1
- package/dist/twilight/{p-deb1139c.entry.js → p-73b8ed51.entry.js} +1 -1
- package/dist/twilight/p-75ed7d4e.entry.js +4 -0
- package/dist/twilight/{p-ddc61bff.entry.js → p-761e273c.entry.js} +1 -1
- package/dist/twilight/{p-253a352c.entry.js → p-768f5c26.entry.js} +1 -1
- package/dist/twilight/{p-288627a2.entry.js → p-76f49fd8.entry.js} +1 -1
- package/dist/twilight/{p-775f9b02.entry.js → p-7960e489.entry.js} +1 -1
- package/dist/twilight/{p-aec2d723.entry.js → p-7f38cf0c.entry.js} +1 -1
- package/dist/twilight/{p-179595d9.entry.js → p-7f58cf36.entry.js} +1 -1
- package/dist/twilight/{p-44afcd79.entry.js → p-83edd1a1.entry.js} +1 -1
- package/dist/twilight/{p-dc129d7a.entry.js → p-845e4790.entry.js} +1 -1
- package/dist/twilight/{p-31253c2d.entry.js → p-84c56f4d.entry.js} +1 -1
- package/dist/twilight/{p-4432411c.entry.js → p-8688c21f.entry.js} +1 -1
- package/dist/twilight/{p-821e9049.entry.js → p-87d34b7c.entry.js} +1 -1
- package/dist/twilight/{p-b01764d0.entry.js → p-8be3fa1c.entry.js} +1 -1
- package/dist/twilight/{p-f92d1971.entry.js → p-8dc7ae26.entry.js} +1 -1
- package/dist/twilight/{p-4d879cd3.entry.js → p-8e0a33dd.entry.js} +1 -1
- package/dist/twilight/{p-183e02ac.entry.js → p-8eabd62f.entry.js} +1 -1
- package/dist/twilight/{p-85ab4182.entry.js → p-8f0b6a64.entry.js} +1 -1
- package/dist/twilight/{p-d05e1bfd.entry.js → p-8fc42a50.entry.js} +1 -1
- package/dist/twilight/{p-ce9b6ac6.entry.js → p-943f3e5a.entry.js} +1 -1
- package/dist/twilight/{p-f176c43e.entry.js → p-96317fc8.entry.js} +1 -1
- package/dist/twilight/{p-0cc42e36.entry.js → p-96560ca2.entry.js} +1 -1
- package/dist/twilight/{p-3d533d87.entry.js → p-97b51153.entry.js} +1 -1
- package/dist/twilight/p-9a4a84b8.entry.js +4 -0
- package/dist/twilight/{p-e429b1e5.entry.js → p-9a723216.entry.js} +1 -1
- package/dist/twilight/{p-7c038d9d.entry.js → p-9c1bf3fb.entry.js} +1 -1
- package/dist/twilight/{p-Cbnu3aaI.js → p-BCFB-lfz.js} +1 -1
- package/dist/twilight/{p-CZkK9lyS.js → p-BFMu9w68.js} +1 -1
- package/dist/twilight/{p-YTWgVZ0u.js → p-BGUXYEQf.js} +2 -2
- package/dist/twilight/{p-BABHygiN.js → p-BdaR2plD.js} +1 -1
- package/dist/twilight/{p-CxpHph5p.js → p-CSRWBUvd.js} +1 -1
- package/dist/twilight/{p-BDO2BBmv.js → p-CliIfO7G.js} +1 -1
- package/dist/twilight/{p-BZHrTB2v.js → p-D1oXS6KY.js} +1 -1
- package/dist/twilight/{p-fP9RBas5.js → p-DlxVucku.js} +1 -1
- package/dist/twilight/{p-0Tl_yZW8.js → p-HRJpfiBN.js} +2 -2
- package/dist/twilight/{p-MugjBhYh.js → p-O5jKs1Zb.js} +1 -1
- package/dist/twilight/{p-0c26bedf.entry.js → p-a2cbbc56.entry.js} +1 -1
- package/dist/twilight/{p-ad9dcb47.entry.js → p-a3009d00.entry.js} +1 -1
- package/dist/twilight/{p-ae22bfeb.entry.js → p-b202c2d3.entry.js} +1 -1
- package/dist/twilight/{p-95b89c32.entry.js → p-b2b896d1.entry.js} +1 -1
- package/dist/twilight/{p-35d5e339.entry.js → p-b66c664b.entry.js} +1 -1
- package/dist/twilight/{p-9434c23f.entry.js → p-c327bc95.entry.js} +1 -1
- package/dist/twilight/{p-8e013db1.entry.js → p-c3afee2f.entry.js} +1 -1
- package/dist/twilight/{p-8d369871.entry.js → p-c699207a.entry.js} +1 -1
- package/dist/twilight/{p-aee17b8b.entry.js → p-c89d7291.entry.js} +1 -1
- package/dist/twilight/{p-eb590773.entry.js → p-c8d4b211.entry.js} +1 -1
- package/dist/twilight/{p-f828fefc.entry.js → p-c919171b.entry.js} +1 -1
- package/dist/twilight/{p-f4cff5cf.entry.js → p-d565b168.entry.js} +1 -1
- package/dist/twilight/{p-0433773a.entry.js → p-d7a70a29.entry.js} +1 -1
- package/dist/twilight/{p-af12fce1.entry.js → p-d8181149.entry.js} +1 -1
- package/dist/twilight/{p-a263bdbb.entry.js → p-d8a5198b.entry.js} +1 -1
- package/dist/twilight/{p-26adf02d.entry.js → p-db27df13.entry.js} +1 -1
- package/dist/twilight/{p-80f27669.entry.js → p-df8c51c2.entry.js} +1 -1
- package/dist/twilight/{p-220338b4.entry.js → p-e4d76bce.entry.js} +1 -1
- package/dist/twilight/{p-2da1eb61.entry.js → p-eb6f86fb.entry.js} +1 -1
- package/dist/twilight/{p-b9d2ae8a.entry.js → p-ee23fbba.entry.js} +1 -1
- package/dist/twilight/{p-6db61be2.entry.js → p-ee8d13fd.entry.js} +1 -1
- package/dist/twilight/{p-a735c70e.entry.js → p-ef09a761.entry.js} +1 -1
- package/dist/twilight/{p-e955b287.entry.js → p-f5e46494.entry.js} +1 -1
- package/dist/twilight/{p-bf3fdf6d.entry.js → p-f9abcf4f.entry.js} +1 -1
- package/dist/twilight/{p-3b5fe2ef.entry.js → p-fd0d136d.entry.js} +1 -1
- package/dist/twilight/{p-4d852a57.entry.js → p-fe72290f.entry.js} +1 -1
- package/dist/twilight/twilight.esm.js +1 -1
- package/dist/types/components/salla-bullet-delivery/location-distance-warning.d.ts +12 -0
- package/dist/types/components/salla-bullet-delivery/location-permission-notice.d.ts +39 -0
- package/dist/types/components/salla-bullet-delivery/salla-bullet-delivery.d.ts +31 -0
- package/dist/types/components/salla-cart-coupons/salla-cart-coupons.d.ts +14 -0
- package/dist/types/components/salla-cart-summary-card/salla-cart-summary-card.d.ts +3 -0
- package/dist/types/global/chunk-errors.d.ts +2 -0
- package/package.json +5 -5
- package/dist/twilight/p-17f2114f.entry.js +0 -4
- package/dist/twilight/p-b81474c4.entry.js +0 -4
- package/dist/twilight/p-d851751c.entry.js +0 -4
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// The spec environment already provides the salla global; booting the real SDK here needs a full store.
|
|
2
|
+
jest.mock('@salla.sa/twilight', () => ({}));
|
|
3
|
+
jest.mock('vanilla-lazyload', () => jest.fn().mockImplementation(() => ({ update: jest.fn() })));
|
|
4
|
+
|
|
5
|
+
import { consoleError } from '@stencil/core/internal/testing';
|
|
6
|
+
import app from './app';
|
|
7
|
+
|
|
8
|
+
describe('global app script', () => {
|
|
9
|
+
const originalInfiniteScroll = (salla as any).infiniteScroll;
|
|
10
|
+
const originalSalla = window.Salla;
|
|
11
|
+
|
|
12
|
+
beforeEach(() => {
|
|
13
|
+
(salla as any).infiniteScroll = { event: { onAppend: jest.fn() } };
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
afterEach(() => {
|
|
17
|
+
(salla as any).infiniteScroll = originalInfiniteScroll;
|
|
18
|
+
window.Salla = originalSalla;
|
|
19
|
+
jest.restoreAllMocks();
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
it('forwards component errors Stencil reports to the error monitor after boot', () => {
|
|
23
|
+
const captureChunkError = jest.fn();
|
|
24
|
+
window.Salla = { errorMonitor: { captureChunkError } } as any;
|
|
25
|
+
jest.spyOn(console, 'error').mockImplementation(() => undefined);
|
|
26
|
+
const error = new TypeError('Failed to fetch dynamically imported module: https://cdn/p-1.entry.js');
|
|
27
|
+
|
|
28
|
+
app();
|
|
29
|
+
consoleError(error);
|
|
30
|
+
|
|
31
|
+
expect(captureChunkError).toHaveBeenCalledWith(error, undefined);
|
|
32
|
+
});
|
|
33
|
+
});
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import '@salla.sa/twilight'
|
|
2
2
|
import LazyLoad from "vanilla-lazyload";
|
|
3
3
|
import { BASE_CSS } from './base-css';
|
|
4
|
+
import { reportChunkErrors } from './chunk-errors';
|
|
4
5
|
|
|
5
6
|
// Marks twilight chunk styles so the global script can spot them at runtime.
|
|
6
7
|
const TWILIGHT_STYLE_MARKER = '/*!twlt*/';
|
|
@@ -60,6 +61,7 @@ function pinTwilightStyles() {
|
|
|
60
61
|
}
|
|
61
62
|
|
|
62
63
|
export default function () {
|
|
64
|
+
reportChunkErrors();
|
|
63
65
|
injectBaseStyles();
|
|
64
66
|
pinTwilightStyles();
|
|
65
67
|
// Only initialize it one time for the entire application
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
// consoleError is the platform hook Stencil's lazy loader reports a failed chunk import() through.
|
|
2
|
+
import { consoleError } from '@stencil/core/internal/testing';
|
|
3
|
+
import { forwardComponentError, reportChunkErrors } from './chunk-errors';
|
|
4
|
+
|
|
5
|
+
describe('chunk-errors', () => {
|
|
6
|
+
const originalSalla = window.Salla;
|
|
7
|
+
let captureChunkError: jest.Mock;
|
|
8
|
+
|
|
9
|
+
beforeEach(() => {
|
|
10
|
+
captureChunkError = jest.fn();
|
|
11
|
+
window.Salla = { errorMonitor: { captureChunkError } };
|
|
12
|
+
jest.spyOn(console, 'error').mockImplementation(() => undefined);
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
afterEach(() => {
|
|
16
|
+
window.Salla = originalSalla;
|
|
17
|
+
jest.restoreAllMocks();
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it('routes errors Stencil reports to the error monitor once registered', () => {
|
|
21
|
+
const error = new TypeError('Failed to fetch dynamically imported module: https://cdn/p-1.entry.js');
|
|
22
|
+
const element = document.createElement('salla-button');
|
|
23
|
+
|
|
24
|
+
reportChunkErrors();
|
|
25
|
+
consoleError(error, element);
|
|
26
|
+
|
|
27
|
+
expect(captureChunkError).toHaveBeenCalledWith(error, element);
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
it('hands the swallowed import() error and its element to the error monitor', () => {
|
|
31
|
+
const error = new TypeError('Failed to fetch dynamically imported module: https://cdn/p-1.entry.js');
|
|
32
|
+
const element = document.createElement('salla-button');
|
|
33
|
+
|
|
34
|
+
forwardComponentError(error, element);
|
|
35
|
+
|
|
36
|
+
expect(captureChunkError).toHaveBeenCalledWith(error, element);
|
|
37
|
+
expect(console.error).toHaveBeenCalledWith(error, element);
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
it('keeps logging to the console when the Salla SDK is not loaded', () => {
|
|
41
|
+
window.Salla = undefined;
|
|
42
|
+
const error = new Error('boom');
|
|
43
|
+
|
|
44
|
+
expect(() => forwardComponentError(error)).not.toThrow();
|
|
45
|
+
expect(console.error).toHaveBeenCalledWith(error, undefined);
|
|
46
|
+
});
|
|
47
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { setErrorHandler } from '@stencil/core';
|
|
2
|
+
|
|
3
|
+
// Stencil swallows a failed chunk import() and only throws `Constructor for "<tag>#…" was not found`
|
|
4
|
+
// later; forward the original error so the frontend-error log shows why the chunk failed.
|
|
5
|
+
// console.error keeps Stencil's default output, which this handler replaces.
|
|
6
|
+
export function forwardComponentError(error: unknown, element?: Element) {
|
|
7
|
+
console.error(error, element);
|
|
8
|
+
window.Salla?.errorMonitor?.captureChunkError(error, element);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function reportChunkErrors() {
|
|
12
|
+
setErrorHandler(forwardComponentError);
|
|
13
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as t,h as i,H as e}from"./p-
|
|
4
|
+
import{r as t,h as i,H as e}from"./p-HRJpfiBN.js";import{f as s,g as l}from"./p-DqXpn47Z.js";const a=class{constructor(i){t(this,i),this.productRatings=[],this.allowUpdate=!1}async componentWillLoad(){await salla.onReady(),await this.loadOrderItem()}async onProductIdChange(){this.orderItem=void 0,this.productRatings=[],await this.loadOrderItem()}resolveFetchOrderId(){return salla.config.get("page.id")}sameId(t,i){return null!=t&&null!=i&&String(t)===String(i)}label(t,i){return"function"==typeof salla?.lang?.getWithDefault?salla.lang.getWithDefault(t,i):salla?.lang?.get?.(t)||i}toOrderItemRating(t){return{id:t.id??t.feedback_id,stars:t.stars??t.rating,content:t.content||"",is_pending:t.is_pending,can_update:t.can_update,images:t.images||[],videos:t.videos||[],product:t.product}}resolveOrderItem(t,i){const e=Array.isArray(t?.items)?t.items:[],s=i.find((t=>this.sameId(t.product?.id,this.productId)));if(!s)return;const l=e.find((t=>this.sameId(t.product?.id,this.productId)))||{product:s.product||{id:this.productId}};return{...l,product:l.product||s.product||{id:this.productId},rating:this.toOrderItemRating(s)}}async loadOrderItem(){const t=this.resolveFetchOrderId();if(t&&null!=this.productId&&""!==this.productId){this.fetchOrderId=t,this.allowUpdate=!!salla.config.get("store.settings.rating.allow_update");try{const i=await s(t);this.productRatings=l(i?.rating),this.orderItem=this.resolveOrderItem(i,this.productRatings)}catch(t){console.error("[salla-review-order-item] failed to load order item review",t)}}}renderActions(t){const e=t.rating;return e&&this.allowUpdate?i("div",{class:"rating-actions"},i("div",{class:"tooltip-toggle tooltip-toggle--hover icon-trigger mobile-shifted"},e.can_update?null:i("div",{class:"tooltip-content shadow-md rounded"},i("small",null,this.label("pages.order.edit_period_ended","انتهت مدة التعديل"),".")),i("salla-button",{"loader-position":"center",disabled:!e.can_update,shape:"icon",fill:"outline",color:"dark",size:"medium",onClick:()=>e.can_update?salla.event.dispatch("rating::edit",{type:"product",feedback_id:e.id}):void 0},i("i",{class:"sicon-format-border-color text-xl"}))),i("div",{class:"tooltip-toggle tooltip-toggle--hover icon-trigger mobile-shifted"},e.can_update?null:i("div",{class:"tooltip-content shadow-md rounded"},i("small",null,this.label("pages.order.delete_period_ended","انتهت مدة الحذف"),".")),i("salla-button",{"loader-position":"center",disabled:!e.can_update,shape:"icon",color:"danger",fill:"outline",size:"medium",onClick:()=>e.can_update?salla.event.dispatch("rating::delete",{feedback_id:e.id}):void 0},i("i",{class:"sicon-trash-2 text-xl"})))):null}serializeRatingMedia(t){return JSON.stringify({images:t.images||[],videos:t.videos||[],product:t.product})}serializeProductRatings(){return JSON.stringify(this.productRatings)}render(){const t=this.orderItem,s=t?.rating;return t&&s&&this.fetchOrderId?i(e,null,i("section",{class:"flex justify-between items-start border-t mt-10 pt-8"},i("div",null,i("p",{innerHTML:s.content||""}),s.is_pending?i("span",null,this.label("pages.rating.pending","قيد المراجعة")):null,i("div",{class:"flex flex-row flex-wrap gap-2"},i("salla-rating-stars",{size:"large",value:s.stars}),i("salla-review-factors-tags",{"order-id":this.fetchOrderId,"rating-id":s.id,"product-id":t.product?.id})),i("div",{class:"mt-2"},i("salla-attachments",{rating:this.serializeRatingMedia(s),"product-ratings":this.serializeProductRatings(),"product-id":t.product?.id??null,"max-visible":8,clickable:!0}))),this.renderActions(t))):i(e,null)}static get watchers(){return{productId:["onProductIdChange"]}}};export{a as salla_review_order_item}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r,h as e,a as t}from"./p-0Tl_yZW8.js";import{S as s}from"./p-BscTeWDc.js";import{C as a}from"./p-BsLF_HK7.js";import{A as i,a as o}from"./p-Vqpj4CWE.js";import{H as c}from"./p-Brgf4SAC.js";import"./p-CgtvEd63.js";const n="salla::search-history";function l(){if("undefined"==typeof window)return n;const r=new URLSearchParams(window.location.search).get("scope");return r?`${n}-${r}`:n}const h={searchPlaceholder:"",noOptions:"",outOfStock:"",close:"",back:"",remove:"",searchHistory:"",trendingCategories:"",mostSearched:"",searchSuggestions:"",categories:"",searchResults:"",searchViewAllTemplate:""},d={"common.elements.search_history":{ar:"آخر ما تم البحث عنه",en:"Recently Searched"},"common.elements.trending_categories":{ar:"التصنيفات الأكثر بحثاً",en:"Trending categories"},"common.elements.most_searched":{ar:"المنتجات الأكثر بحثاً",en:"Trending products"},"common.elements.search_suggestions":{ar:"اقتراحات البحث",en:"Search suggestions"},"common.elements.categories":{ar:"التصنيفات",en:"Categories"},"common.elements.search_results":{ar:"نتائج البحث",en:"Search results"},"common.elements.search_view_all":{ar:'عرض كل النتائج لـ ":word"',en:'View all results for ":word"'}};function p(r){return salla.url.get("search?q="+encodeURI(r))}function m(r,e){const[t,s=""]=r.split("?"),a=new URLSearchParams(s);return a.set("_svs",e),`${t}?${a.toString()}`}function g(r){const e=l();salla.storage.set(e,r)}const w={trendingCategories:[],mostSearchedProducts:[]};let u=null;const b=class{constructor(e){r(this,e),this.hasTrackedFocus=!1,this.hasLoadedPopularSearches=!1,this.translationLoaded=!1,this.labels=h,this.loading=!1,this.typing=!1,this.debounce=setTimeout((()=>""),1e3),this.search_term="",this.hasInputValue=!1,this.searchHistory=function(){const r=l(),e=salla.storage.get(r,[]);return Array.isArray(e)?e.filter((r=>"string"==typeof r)):[]}(),this.trendingCategories=[],this.mostSearchedProducts=[],this.placeholder=!1,this.inline=!1,this.oval=!1,this.height=60,this.maxWords=5,this.showAction=!1,this.tracking={searchFocus:()=>{this.hasTrackedFocus||(this.hasTrackedFocus=!0,salla.event.emit("salla-search::input.focused"))},productClick:(r,e)=>{c.saveProductSource("search"),this.commitSearchHistory(this.search_term),salla.event.emit("salla-search::product.clicked",[{product:r,position:e}])},recommendationClick:(r,e)=>{salla.event.emit("salla-search::recommendation.clicked",{term:r,source:e})}},salla.event.on("search::open",(()=>this.open()))}async open(){this.hasLoadedPopularSearches||(this.hasLoadedPopularSearches=!0,function(){if(!u){const r=salla.search.popular().then((r=>({trendingCategories:(r?.data?.categories||[]).map((r=>({name:r.name,url:m(salla.url.create("categories",r.id),"search-trending")}))),mostSearchedProducts:(r?.data?.products||[]).map((r=>({name:r.name,url:m(salla.url.create("products",r.id),"search-trending")})))}))).catch((()=>(u=null,w)));u=r}return u}().then((({trendingCategories:r,mostSearchedProducts:e})=>{this.trendingCategories=r,this.mostSearchedProducts=e}))),await(this.modal?.open().then((()=>setTimeout((()=>this.searchInput?.focus()),300))))}handleModalVisibilityChanged(r){r.target!==this.modal||r.detail||this.onModalClose()}onModalClose(){this.searchInput&&(this.searchInput.value=""),this.results=void 0,this.search_term="",this.hasInputValue=!1,this.afterSearching()}handleKeyDown(r){if("Enter"!==r.key)return;const e=this.searchInput?.value??"";e.length<=2||(e!==this.search_term&&(clearTimeout(this.debounce),this.typing=!1,this.search_term=e),this.commitSearchHistory(e),this.searchInput&&(this.searchInput.value=""),this.hasInputValue=!1,setTimeout((()=>{window.location.href=p(e)}),100))}commitSearchHistory(r){r&&(this.searchHistory=function(r,e){const t=e.trim();if(!t)return r;const s=r.filter((r=>r.toLowerCase()!==t.toLowerCase()));return[t,...s].slice(0,10)}(this.searchHistory,r),g(this.searchHistory))}removeFromSearchHistory(r){this.searchHistory=this.searchHistory.filter((e=>e!==r)),g(this.searchHistory),this.afterSearching()}async componentWillLoad(){await salla.lang.onLoaded(),function(){if(!salla?.lang?.addBulk)return;const r=Object.entries(d).reduce(((r,[e,t])=>(salla.lang.get(e)===e&&(r[e]=t),r)),{});Object.keys(r).length&&salla.lang.addBulk(r)}(),this.labels={searchPlaceholder:salla.lang.get("blocks.header.search_placeholder"),noOptions:salla.lang.get("common.elements.no_options"),outOfStock:salla.lang.get("pages.products.out_of_stock"),close:salla.lang.get("common.elements.close"),back:salla.lang.get("common.elements.back"),remove:salla.lang.get("common.elements.remove"),searchHistory:salla.lang.get("common.elements.search_history"),trendingCategories:salla.lang.get("common.elements.trending_categories"),mostSearched:salla.lang.get("common.elements.most_searched"),searchSuggestions:salla.lang.get("common.elements.search_suggestions"),categories:salla.lang.get("common.elements.categories"),searchResults:salla.lang.get("common.elements.search_results"),searchViewAllTemplate:salla.lang.get("common.elements.search_view_all")},this.translationLoaded=!0}debounceSearch(r){this.typing=!0,clearTimeout(this.debounce),this.debounce=setTimeout((()=>{this.typing=!1,this.search_term=r.target.value}),700)}limitWordsAndSearch(r){let e=r.target.value;this.hasInputValue=e.length>0;const t=e.trim().split(/\s+/);if(t.length>this.maxWords){const r=t.slice(0,this.maxWords).join(" ");this.searchInput&&(this.searchInput.value=r)}this.debounceSearch(r)}getQueryParam(r){return new URLSearchParams(window.location.search).get(r)}handleActionClick(){if(this.search_term&&this.search_term.length>2)return this.search(this.search_term)}handleSearch(r){r.length>2?this.search(r):(this.results=void 0,this.afterSearching())}search(r){this.loading=!0,salla.product.fetch({source:"search",source_value:r}).then((e=>{this.results=e,salla.event.emit("Products Searched",{query:r,total:e.data?.length,metadata:e.metadata})})).catch((r=>"Query is same as previous one!"!==r?this.results=void 0:null)).finally((()=>this.afterSearching()))}afterSearching(){this.loading=!1,salla.product.api.previousQuery=""}renderCategoriesSection(r){return this.trendingCategories.length?e("div",null,e("p",{class:"s-search-idle-section-title"},r),e("div",{class:"s-search-idle-categories-list"},this.trendingCategories.map((r=>e("a",{class:"s-search-idle-category-chip",href:r.url,onClick:()=>this.tracking.recommendationClick(r.name,"category")},r.name,r.count?e("span",{class:"s-search-idle-category-count"},r.count):null))))):null}renderMostSearchedProductsSection(r,t){return this.mostSearchedProducts.length?e("div",null,e("p",{class:"s-search-idle-section-title"},r),e("ul",{class:"s-search-most-searched-list"},this.mostSearchedProducts.map((r=>e("li",null,e("a",{class:"s-search-most-searched-item",href:r.url,onClick:()=>this.tracking.recommendationClick(r.name,t)},e("span",{class:"s-search-most-searched-icon",innerHTML:s}),r.name)))))):null}renderSearchHistorySection(){return!this.searchHistory.length||this.hasInputValue?null:e("div",null,e("p",{class:"s-search-idle-section-title"},this.labels.searchHistory),e("div",{class:"s-search-history-list"},this.searchHistory.map((r=>e("span",{class:"s-search-history-chip"},e("a",{class:"s-search-history-chip-term",href:m(p(r),"history"),onClick:()=>{this.tracking.recommendationClick(r,"history")}},e("span",{class:"s-search-history-chip-icon",innerHTML:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" color="currentColor" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round">\n <path d="M3.49902 14.9656C4.72475 18.4791 8.06749 21 11.999 21C16.9696 21 20.999 16.9706 20.999 12C20.999 7.02944 16.9696 3 11.999 3C8.29827 3 4.8984 5.6756 3.68943 8.5"></path>\n <path d="M11.999 7V12L14.999 14"></path>\n <path d="M7.49751 8.74363C7.49751 8.74363 3.81388 9.3026 3.25487 8.7436C2.69585 8.1846 3.25488 4.50098 3.25488 4.50098"></path>\n</svg>\n'}),r),e("button",{type:"button",class:"s-search-history-chip-remove","aria-label":this.labels.remove,onClick:()=>this.removeFromSearchHistory(r)},e("span",{innerHTML:a})))))))}renderIdlePanel(){return e("div",{class:{"s-search-idle-panel":!0,"s-search-idle-panel-empty":!(this.searchHistory.length>0&&!this.hasInputValue||this.trendingCategories.length>0||this.mostSearchedProducts.length>0)}},this.renderSearchHistorySection(),this.renderCategoriesSection(this.labels.trendingCategories),this.renderMostSearchedProductsSection(this.labels.mostSearched,"trending"))}renderResultsBody(){return e("div",{class:"s-search-results-body"},null,e("div",{class:{"s-search-results-grid-wrap":!0,"s-search-results-grid-wrap-no-sidebar":!0}},e("p",{class:"s-search-idle-section-title"},this.labels.searchResults),e("div",{class:"s-search-results-grid"},this.results?.data.map(((r,t)=>e("div",{key:r.id,class:"s-search-grid-item",onClick:()=>this.tracking.productClick(r,t)},e("salla-search-product-card",{product:{...r,url:r.url+"?from=search-bar"},hideAddBtn:!0})))),0===this.results?.data.length?e("p",{class:"s-search-no-results-placeholder"},this.labels.noOptions):null)))}renderViewAllLink(){return this.results?.data.length?e("a",{class:"s-search-view-all",href:p(this.search_term),onClick:()=>this.commitSearchHistory(this.search_term)},this.labels.searchViewAllTemplate.replace(":word",this.search_term),e("span",{class:"s-search-view-all-icon",innerHTML:salla.config.get("theme.is_rtl",!0)?i:o})):null}renderDropdown(){return this.results?this.renderResultsBody():this.renderIdlePanel()}renderInputWrapper(){const r=e("div",{class:"s-search-input-wrapper"},e("span",{class:"s-search-icon-wrap"},e("span",{class:"s-search-icon",innerHTML:this.loading?'<i class="s-search-spinner-loader"/>':s})),e("input",{type:"search",enterkeyhint:"search",autocomplete:"off",class:"s-search-input",placeholder:this.labels.searchPlaceholder,onInput:r=>this.limitWordsAndSearch(r),onKeyDown:r=>this.handleKeyDown(r),onFocus:()=>this.tracking.searchFocus(),ref:r=>this.searchInput=r,style:{height:this.height+"px",borderRadius:this.oval?this.height/2+"px":""}}),this.showAction?e("salla-button",{loading:this.loading,class:{"s-search-action":!0,"s-search-action-oval":this.oval},onClick:()=>this.handleActionClick()},!this.loading&&e("span",{innerHTML:s})):null);return e("div",{class:"s-search-input-row"},e("button",{type:"button",class:"s-search-back-btn","aria-label":this.labels.back,onClick:()=>this.modal?.close()},e("span",{innerHTML:salla.config.get("theme.is_rtl",!0)?o:i})),r)}renderPlaceholderTrigger(){return e("div",{class:"s-search-input-wrapper"},e("span",{class:"s-search-icon-wrap"},e("span",{class:"s-search-icon",innerHTML:s})),e("button",{type:"button",class:"s-search-input s-search-placeholder-trigger",onClick:()=>this.open(),style:{height:this.height+"px",borderRadius:this.oval?this.height/2+"px":""}},this.labels.searchPlaceholder))}renderInlineTrigger(){return e("div",{class:"s-search-input-wrapper"},e("span",{class:"s-search-icon-wrap"},e("span",{class:"s-search-icon",innerHTML:s})),e("input",{type:"search",readOnly:!0,class:"s-search-input s-search-placeholder-trigger",placeholder:this.labels.searchPlaceholder,onFocus:()=>this.open(),style:{height:this.height+"px",borderRadius:this.oval?this.height/2+"px":""}}))}renderModal(){return e("salla-modal",{position:"top",class:"s-search-modal s-search-modal-new","hide-close-button":!0,ref:r=>this.modal=r},e("div",{class:"s-search-panel"},this.renderInputWrapper(),this.renderDropdown(),this.renderViewAllLink()))}render(){return this.placeholder?e("div",{class:"s-search-placeholder-wrapper s-search-placeholder-wrapper-new s-search-inline"},this.renderPlaceholderTrigger(),this.renderModal()):this.inline?e("div",{class:"s-search-placeholder-wrapper s-search-placeholder-wrapper-new s-search-inline"},this.renderInlineTrigger(),this.renderModal()):this.renderModal()}componentDidLoad(){this.afterSearching()}get host(){return t(this)}static get watchers(){return{search_term:["handleSearch"]}}};b.style='/*!twlt*/.s-search-placeholder-wrapper{position:relative;display:inline-block}.s-search-placeholder-wrapper-new{display:block;width:100%}.s-search-input-wrapper{position:relative}.s-search-placeholder-trigger{cursor:pointer;appearance:none;text-align:start}.s-search-divider{border:none;border-top:1px solid #F3F4F6;margin:0.25rem 0}.visible{visibility:visible}.inline{display:inline}.hidden{display:none}.border{border-width:1px}.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-search-container{position:relative;z-index:99;max-height:14rem;border-radius:0.375rem;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms}.s-search-oval{border-radius:20px}.s-search-inline{min-width:220px}.s-search-container-open{max-height:24rem;border-radius:0px !important}.s-search-container-open .s-search-input{border-top-left-radius:0.375rem !important;border-top-right-radius:0.375rem !important;border-bottom-right-radius:0px !important;border-bottom-left-radius:0px !important;border-width:1px;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1))}.s-search-no-results .s-search-input{border-bottom-right-radius:0px;border-bottom-left-radius:0px;border-width:1px;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1))}.s-search-input{height:2.5rem;width:100%;border-radius:0.375rem;--tw-border-opacity:1;border-color:rgb(243 244 246 / var(--tw-border-opacity, 1));--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1));padding-top:0px;padding-bottom:0.125rem;font-size:0.875rem;line-height:1.25rem;--tw-text-opacity:1;color:rgb(75 85 99 / var(--tw-text-opacity, 1));transition-property:color, background-color, border-color, text-decoration-color, fill, stroke;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:300ms}.s-search-input:focus{--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1));--tw-ring-color:transparent}.s-search-input:where([dir="ltr"],[dir="ltr"] *){padding-left:2.5rem}.s-search-input:where([dir="rtl"],[dir="rtl"] *){padding-right:2.5rem}.s-search-input:focus{outline:2px solid transparent !important;outline-offset:2px !important;box-shadow:none !important;border-color:#e5e7eb !important}.s-search-modal-new .s-search-input{--tw-bg-opacity:1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.s-search-icon-wrap{position:absolute;top:50%;--tw-translate-y:-50%;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));line-height:1;--tw-text-opacity:1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.s-search-icon-wrap:where([dir="ltr"],[dir="ltr"] *){left:1rem}.s-search-icon-wrap:where([dir="rtl"],[dir="rtl"] *){right:1rem}.s-search-icon svg{height:1rem;width:1rem;fill:#9ca3af}.s-search-spinner-loader{display:block;height:1rem;width:1rem}@keyframes spin{to{transform:rotate(360deg)}}.s-search-spinner-loader{animation:spin 1s linear infinite;border-radius:9999px;border-width:2px;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1));border-right-color:var(--color-primary)}.s-search-results{position:absolute;margin:auto;max-height:24rem;width:100%;max-width:100%;overflow-y:auto;border-bottom-right-radius:0.375rem;border-bottom-left-radius:0.375rem;--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1));--tw-shadow:0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);--tw-shadow-colored:0 20px 25px -5px var(--tw-shadow-color), 0 8px 10px -6px 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-search-no-results{border-bottom-right-radius:0px !important;border-bottom-left-radius:0px !important}.s-search-no-results-placeholder{grid-column:1 / -1;padding:1rem;text-align:center;font-size:1rem;line-height:1.5rem;--tw-text-opacity:1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.s-search-product{display:flex;height:100%;justify-content:space-around;overflow:hidden;border-bottom-width:1px;--tw-border-opacity:1;border-color:rgb(243 244 246 / var(--tw-border-opacity, 1));background-color:transparent;padding-left:1rem;padding-right:1rem;padding-top:0.75rem;padding-bottom:0.75rem;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:300ms}.s-search-product:last-child{border-bottom-width:0px}.s-search-product:hover{--tw-bg-opacity:1;background-color:rgb(249 250 251 / var(--tw-bg-opacity, 1))}@media (min-width: 480px){.s-search-product{padding-left:1.25rem;padding-right:1.25rem}}.s-search-product-image-container{position:relative;height:3.5rem;width:5rem;overflow:hidden;border-radius:0.375rem;--tw-bg-opacity:1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.s-search-product-image{position:relative;height:100%;width:100%;object-fit:cover;font-size:0px}.s-search-product-image::before{position:absolute;top:0px;left:0px;height:100%;width:100%;--tw-bg-opacity:1;background-color:rgb(229 231 235 / var(--tw-bg-opacity, 1));--tw-content:\'\';content:var(--tw-content)}.s-search-product-details{flex:1 1 0%;padding-top:0.25rem}.s-search-product-details:where([dir="ltr"],[dir="ltr"] *){padding-left:1rem}@media (min-width: 480px){.s-search-product-details:where([dir="ltr"],[dir="ltr"] *){padding-left:1.25rem}}.s-search-product-details:where([dir="rtl"],[dir="rtl"] *){padding-right:1rem}@media (min-width: 480px){.s-search-product-details:where([dir="rtl"],[dir="rtl"] *){padding-right:1.25rem}}.s-search-product-title{margin-bottom:0.375rem;display:flex;flex-direction:column;align-items:baseline;justify-content:flex-start;font-size:0.875rem;font-weight:700;line-height:1.5rem;--tw-text-opacity:1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.s-search-product-price{display:flex;width:100%;align-items:center;font-size:0.875rem;line-height:1.25rem;font-weight:700;color:var(--color-primary)}.s-search-product-regular-price{padding-left:0.75rem;padding-right:0.75rem;font-weight:500;--tw-text-opacity:1;color:rgb(156 163 175 / var(--tw-text-opacity, 1));text-decoration-line:line-through}.s-search-product-not-available{--tw-grayscale:grayscale(100%);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-search-action{position:absolute;height:100%}.s-search-action:where([dir="ltr"],[dir="ltr"] *){right:0px}.s-search-action:where([dir="rtl"],[dir="rtl"] *){left:0px;border-top-right-radius:0px;border-bottom-right-radius:0px}.s-search-action-oval:where([dir="ltr"],[dir="ltr"] *){border-top-right-radius:9999px;border-bottom-right-radius:9999px}.s-search-action-oval:where([dir="rtl"],[dir="rtl"] *){border-top-left-radius:9999px;border-bottom-left-radius:9999px}.s-search-input-row{margin:1rem;display:flex;align-items:center}.s-search-back-btn{display:flex;flex-shrink:0;align-items:center;justify-content:center;padding:0.25rem;line-height:1;--tw-text-opacity:1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.s-search-back-btn:hover{--tw-text-opacity:1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}@media (min-width: 640px){.s-search-back-btn{display:none}}.s-search-back-btn svg{height:1.5rem;width:1.5rem;fill:#6b7280}.s-search-input-wrapper{position:relative;display:flex;flex-grow:1;align-items:center}.s-search-panel{display:flex;height:100%;flex-direction:column}.s-search-results-body{display:flex;min-height:0px;flex:1 1 0%;flex-direction:column;gap:0.75rem;overflow:hidden;--tw-shadow:0 -4px 6px -4px rgba(0,0,0,0.1);--tw-shadow-colored:0 -4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}@media (min-width: 640px){.s-search-results-body{flex-direction:row}}.s-search-results-grid-wrap{min-height:0px;min-width:0px;flex:1 1 0%;overflow-y:auto}@media (min-width: 640px){.s-search-results-grid-wrap{max-height:24rem !important}}.s-search-results-grid-wrap-no-sidebar{padding-left:1rem;padding-right:1rem}@media (min-width: 640px){.s-search-results-grid-wrap-no-sidebar{padding-left:1.25rem;padding-right:1.25rem}}.s-search-results-grid{display:grid;grid-template-columns:repeat(1, minmax(0, 1fr));align-content:flex-start;column-gap:0.75rem;row-gap:0.25rem}@media (min-width: 640px){.s-search-results-grid{grid-template-columns:repeat(2, minmax(0, 1fr))}}@media (min-width: 1024px){.s-search-results-grid{grid-template-columns:repeat(3, minmax(0, 1fr))}}.s-search-grid-item{cursor:pointer;border-radius:0.375rem;padding:0.25rem;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:300ms}.s-search-grid-item:hover{--tw-bg-opacity:1;background-color:rgb(249 250 251 / var(--tw-bg-opacity, 1))}.s-search-grid-item .s-product-card-out-badge{--tw-bg-opacity:1;background-color:rgb(254 226 226 / var(--tw-bg-opacity, 1));--tw-text-opacity:1;color:rgb(220 38 38 / var(--tw-text-opacity, 1))}.s-search-view-all{display:flex;flex-shrink:0;align-items:center;justify-content:center;gap:0.25rem;border-top-width:1px;--tw-border-opacity:1;border-color:rgb(243 244 246 / var(--tw-border-opacity, 1));padding:0.75rem;text-align:center;font-size:0.875rem;line-height:1.25rem;font-weight:500;--tw-text-opacity:1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.s-search-view-all:hover{text-decoration-line:underline}.s-search-view-all-icon{line-height:1}.s-search-view-all-icon svg{height:1rem;width:1rem;fill:#6b7280}.s-search-sidebar{max-height:none;width:100%;flex-shrink:0}.s-search-sidebar>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.s-search-sidebar{padding:0.5rem}@media (min-width: 640px){.s-search-sidebar{max-height:24rem !important;width:16rem;overflow-y:auto !important;--tw-bg-opacity:1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1));padding:0.75rem}}@media (min-width: 480px){.s-search-sidebar{width:13rem}}.s-search-sidebar:where([dir="ltr"],[dir="ltr"] *){--tw-shadow:4px 0 6px -4px rgba(0,0,0,0.1);--tw-shadow-colored:4px 0 6px -4px 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-search-sidebar:where([dir="rtl"],[dir="rtl"] *){--tw-shadow:-4px 0 6px -4px rgba(0,0,0,0.1);--tw-shadow-colored:-4px 0 6px -4px 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-search-idle-panel{min-height:6rem}.s-search-idle-panel>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.s-search-idle-panel{overflow-y:auto;padding:1rem;padding-top:0px;--tw-shadow:0 -4px 6px -4px rgba(0,0,0,0.1);--tw-shadow-colored:0 -4px 6px -4px 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-search-idle-panel-empty{max-height:none !important;min-height:0px !important;padding:0px !important;--tw-shadow:0 0 #0000 !important;--tw-shadow-colored:0 0 #0000 !important;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow) !important}.s-search-idle-section-title{margin-bottom:0.5rem;margin-top:0.5rem;font-size:1rem;line-height:1.5rem;--tw-text-opacity:1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.s-search-history-list{display:flex;flex-wrap:wrap;gap:0.5rem}.s-search-history-chip{display:inline-flex;align-items:center;gap:0.375rem;border-radius:9999px;--tw-bg-opacity:1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1));padding-top:0.375rem;padding-bottom:0.375rem;font-size:1rem;line-height:1.5rem;--tw-text-opacity:1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.s-search-history-chip:hover{background-color:color-mix(in srgb,var(--color-primary) 10%,transparent)}.s-search-history-chip:where([dir="ltr"],[dir="ltr"] *){padding-left:0.75rem;padding-right:0.5rem}.s-search-history-chip:where([dir="rtl"],[dir="rtl"] *){padding-right:0.75rem;padding-left:0.5rem}.s-search-history-chip-term{display:inline-flex;align-items:center;gap:0.25rem;line-height:1}.s-search-history-chip:hover .s-search-history-chip-term{color:var(--color-primary)}.s-search-history-chip-icon svg{height:0.875rem;width:0.875rem}.s-search-history-chip-remove svg{height:0.625rem;width:0.625rem;fill:#9ca3af}.s-search-idle-categories-list{display:flex;flex-wrap:wrap;gap:0.5rem}.s-search-idle-category-chip{display:inline-flex;align-items:center;gap:0.25rem;border-radius:9999px;--tw-bg-opacity:1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1));padding-left:0.75rem;padding-right:0.75rem;padding-top:0.375rem;padding-bottom:0.375rem;font-size:0.875rem;line-height:1.25rem;--tw-text-opacity:1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.s-search-idle-category-chip:hover{background-color:color-mix(in srgb,var(--color-primary) 10%,transparent);color:var(--color-primary)}.s-search-sidebar .s-search-idle-category-chip{--tw-bg-opacity:1;background-color:rgb(229 231 235 / var(--tw-bg-opacity, 1))}.s-search-idle-category-count{font-size:0.875rem;line-height:1.25rem;--tw-text-opacity:1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.s-search-most-searched-list{display:flex;flex-direction:column}.s-search-most-searched-item{display:flex;width:100%;align-items:center;gap:0.5rem;padding-top:0.375rem;padding-bottom:0.375rem;font-size:0.875rem;line-height:1.25rem;--tw-text-opacity:1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.s-search-most-searched-item:hover{color:var(--color-primary)}.s-search-most-searched-icon svg{height:0.875rem;width:0.875rem;fill:#9ca3af}@media (min-width: 640px){.s-search-modal .s-modal-wrapper{align-items:flex-start;padding:0}.s-search-modal .s-modal-spacer{display:inline}.s-search-modal .s-modal-body{padding:0;width:700px;max-width:90%;margin-top:3.2rem;border-radius:0.5rem;overflow:visible;position:relative !important}}.s-search-modal .s-modal-close{top:50%;transform:translateY(-50%)}@media (max-width: 639px){.s-search-modal .s-modal-body .s-search-results{position:static;margin-top:0}.s-search-modal.s-search-modal-new .s-modal-body{height:100dvh;max-height:100dvh !important}}@media (min-width: 640px){.s-search-modal.s-search-modal-new .s-modal-body{background:var(--color-surface, #fff);overflow:hidden;width:1100px;max-width:95%}}.s-search-product-card-out-of-stock img.loaded{--tw-grayscale:grayscale(100%);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-search-product-card-image img.loaded{position:relative;opacity:1}';export{b as salla_search}
|
|
4
|
+
import{r,h as e,a as t}from"./p-HRJpfiBN.js";import{S as s}from"./p-BscTeWDc.js";import{C as a}from"./p-BsLF_HK7.js";import{A as i,a as o}from"./p-Vqpj4CWE.js";import{H as c}from"./p-Brgf4SAC.js";import"./p-CgtvEd63.js";const n="salla::search-history";function l(){if("undefined"==typeof window)return n;const r=new URLSearchParams(window.location.search).get("scope");return r?`${n}-${r}`:n}const h={searchPlaceholder:"",noOptions:"",outOfStock:"",close:"",back:"",remove:"",searchHistory:"",trendingCategories:"",mostSearched:"",searchSuggestions:"",categories:"",searchResults:"",searchViewAllTemplate:""},d={"common.elements.search_history":{ar:"آخر ما تم البحث عنه",en:"Recently Searched"},"common.elements.trending_categories":{ar:"التصنيفات الأكثر بحثاً",en:"Trending categories"},"common.elements.most_searched":{ar:"المنتجات الأكثر بحثاً",en:"Trending products"},"common.elements.search_suggestions":{ar:"اقتراحات البحث",en:"Search suggestions"},"common.elements.categories":{ar:"التصنيفات",en:"Categories"},"common.elements.search_results":{ar:"نتائج البحث",en:"Search results"},"common.elements.search_view_all":{ar:'عرض كل النتائج لـ ":word"',en:'View all results for ":word"'}};function p(r){return salla.url.get("search?q="+encodeURI(r))}function m(r,e){const[t,s=""]=r.split("?"),a=new URLSearchParams(s);return a.set("_svs",e),`${t}?${a.toString()}`}function g(r){const e=l();salla.storage.set(e,r)}const w={trendingCategories:[],mostSearchedProducts:[]};let u=null;const b=class{constructor(e){r(this,e),this.hasTrackedFocus=!1,this.hasLoadedPopularSearches=!1,this.translationLoaded=!1,this.labels=h,this.loading=!1,this.typing=!1,this.debounce=setTimeout((()=>""),1e3),this.search_term="",this.hasInputValue=!1,this.searchHistory=function(){const r=l(),e=salla.storage.get(r,[]);return Array.isArray(e)?e.filter((r=>"string"==typeof r)):[]}(),this.trendingCategories=[],this.mostSearchedProducts=[],this.placeholder=!1,this.inline=!1,this.oval=!1,this.height=60,this.maxWords=5,this.showAction=!1,this.tracking={searchFocus:()=>{this.hasTrackedFocus||(this.hasTrackedFocus=!0,salla.event.emit("salla-search::input.focused"))},productClick:(r,e)=>{c.saveProductSource("search"),this.commitSearchHistory(this.search_term),salla.event.emit("salla-search::product.clicked",[{product:r,position:e}])},recommendationClick:(r,e)=>{salla.event.emit("salla-search::recommendation.clicked",{term:r,source:e})}},salla.event.on("search::open",(()=>this.open()))}async open(){this.hasLoadedPopularSearches||(this.hasLoadedPopularSearches=!0,function(){if(!u){const r=salla.search.popular().then((r=>({trendingCategories:(r?.data?.categories||[]).map((r=>({name:r.name,url:m(salla.url.create("categories",r.id),"search-trending")}))),mostSearchedProducts:(r?.data?.products||[]).map((r=>({name:r.name,url:m(salla.url.create("products",r.id),"search-trending")})))}))).catch((()=>(u=null,w)));u=r}return u}().then((({trendingCategories:r,mostSearchedProducts:e})=>{this.trendingCategories=r,this.mostSearchedProducts=e}))),await(this.modal?.open().then((()=>setTimeout((()=>this.searchInput?.focus()),300))))}handleModalVisibilityChanged(r){r.target!==this.modal||r.detail||this.onModalClose()}onModalClose(){this.searchInput&&(this.searchInput.value=""),this.results=void 0,this.search_term="",this.hasInputValue=!1,this.afterSearching()}handleKeyDown(r){if("Enter"!==r.key)return;const e=this.searchInput?.value??"";e.length<=2||(e!==this.search_term&&(clearTimeout(this.debounce),this.typing=!1,this.search_term=e),this.commitSearchHistory(e),this.searchInput&&(this.searchInput.value=""),this.hasInputValue=!1,setTimeout((()=>{window.location.href=p(e)}),100))}commitSearchHistory(r){r&&(this.searchHistory=function(r,e){const t=e.trim();if(!t)return r;const s=r.filter((r=>r.toLowerCase()!==t.toLowerCase()));return[t,...s].slice(0,10)}(this.searchHistory,r),g(this.searchHistory))}removeFromSearchHistory(r){this.searchHistory=this.searchHistory.filter((e=>e!==r)),g(this.searchHistory),this.afterSearching()}async componentWillLoad(){await salla.lang.onLoaded(),function(){if(!salla?.lang?.addBulk)return;const r=Object.entries(d).reduce(((r,[e,t])=>(salla.lang.get(e)===e&&(r[e]=t),r)),{});Object.keys(r).length&&salla.lang.addBulk(r)}(),this.labels={searchPlaceholder:salla.lang.get("blocks.header.search_placeholder"),noOptions:salla.lang.get("common.elements.no_options"),outOfStock:salla.lang.get("pages.products.out_of_stock"),close:salla.lang.get("common.elements.close"),back:salla.lang.get("common.elements.back"),remove:salla.lang.get("common.elements.remove"),searchHistory:salla.lang.get("common.elements.search_history"),trendingCategories:salla.lang.get("common.elements.trending_categories"),mostSearched:salla.lang.get("common.elements.most_searched"),searchSuggestions:salla.lang.get("common.elements.search_suggestions"),categories:salla.lang.get("common.elements.categories"),searchResults:salla.lang.get("common.elements.search_results"),searchViewAllTemplate:salla.lang.get("common.elements.search_view_all")},this.translationLoaded=!0}debounceSearch(r){this.typing=!0,clearTimeout(this.debounce),this.debounce=setTimeout((()=>{this.typing=!1,this.search_term=r.target.value}),700)}limitWordsAndSearch(r){let e=r.target.value;this.hasInputValue=e.length>0;const t=e.trim().split(/\s+/);if(t.length>this.maxWords){const r=t.slice(0,this.maxWords).join(" ");this.searchInput&&(this.searchInput.value=r)}this.debounceSearch(r)}getQueryParam(r){return new URLSearchParams(window.location.search).get(r)}handleActionClick(){if(this.search_term&&this.search_term.length>2)return this.search(this.search_term)}handleSearch(r){r.length>2?this.search(r):(this.results=void 0,this.afterSearching())}search(r){this.loading=!0,salla.product.fetch({source:"search",source_value:r}).then((e=>{this.results=e,salla.event.emit("Products Searched",{query:r,total:e.data?.length,metadata:e.metadata})})).catch((r=>"Query is same as previous one!"!==r?this.results=void 0:null)).finally((()=>this.afterSearching()))}afterSearching(){this.loading=!1,salla.product.api.previousQuery=""}renderCategoriesSection(r){return this.trendingCategories.length?e("div",null,e("p",{class:"s-search-idle-section-title"},r),e("div",{class:"s-search-idle-categories-list"},this.trendingCategories.map((r=>e("a",{class:"s-search-idle-category-chip",href:r.url,onClick:()=>this.tracking.recommendationClick(r.name,"category")},r.name,r.count?e("span",{class:"s-search-idle-category-count"},r.count):null))))):null}renderMostSearchedProductsSection(r,t){return this.mostSearchedProducts.length?e("div",null,e("p",{class:"s-search-idle-section-title"},r),e("ul",{class:"s-search-most-searched-list"},this.mostSearchedProducts.map((r=>e("li",null,e("a",{class:"s-search-most-searched-item",href:r.url,onClick:()=>this.tracking.recommendationClick(r.name,t)},e("span",{class:"s-search-most-searched-icon",innerHTML:s}),r.name)))))):null}renderSearchHistorySection(){return!this.searchHistory.length||this.hasInputValue?null:e("div",null,e("p",{class:"s-search-idle-section-title"},this.labels.searchHistory),e("div",{class:"s-search-history-list"},this.searchHistory.map((r=>e("span",{class:"s-search-history-chip"},e("a",{class:"s-search-history-chip-term",href:m(p(r),"history"),onClick:()=>{this.tracking.recommendationClick(r,"history")}},e("span",{class:"s-search-history-chip-icon",innerHTML:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" color="currentColor" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round">\n <path d="M3.49902 14.9656C4.72475 18.4791 8.06749 21 11.999 21C16.9696 21 20.999 16.9706 20.999 12C20.999 7.02944 16.9696 3 11.999 3C8.29827 3 4.8984 5.6756 3.68943 8.5"></path>\n <path d="M11.999 7V12L14.999 14"></path>\n <path d="M7.49751 8.74363C7.49751 8.74363 3.81388 9.3026 3.25487 8.7436C2.69585 8.1846 3.25488 4.50098 3.25488 4.50098"></path>\n</svg>\n'}),r),e("button",{type:"button",class:"s-search-history-chip-remove","aria-label":this.labels.remove,onClick:()=>this.removeFromSearchHistory(r)},e("span",{innerHTML:a})))))))}renderIdlePanel(){return e("div",{class:{"s-search-idle-panel":!0,"s-search-idle-panel-empty":!(this.searchHistory.length>0&&!this.hasInputValue||this.trendingCategories.length>0||this.mostSearchedProducts.length>0)}},this.renderSearchHistorySection(),this.renderCategoriesSection(this.labels.trendingCategories),this.renderMostSearchedProductsSection(this.labels.mostSearched,"trending"))}renderResultsBody(){return e("div",{class:"s-search-results-body"},null,e("div",{class:{"s-search-results-grid-wrap":!0,"s-search-results-grid-wrap-no-sidebar":!0}},e("p",{class:"s-search-idle-section-title"},this.labels.searchResults),e("div",{class:"s-search-results-grid"},this.results?.data.map(((r,t)=>e("div",{key:r.id,class:"s-search-grid-item",onClick:()=>this.tracking.productClick(r,t)},e("salla-search-product-card",{product:{...r,url:r.url+"?from=search-bar"},hideAddBtn:!0})))),0===this.results?.data.length?e("p",{class:"s-search-no-results-placeholder"},this.labels.noOptions):null)))}renderViewAllLink(){return this.results?.data.length?e("a",{class:"s-search-view-all",href:p(this.search_term),onClick:()=>this.commitSearchHistory(this.search_term)},this.labels.searchViewAllTemplate.replace(":word",this.search_term),e("span",{class:"s-search-view-all-icon",innerHTML:salla.config.get("theme.is_rtl",!0)?i:o})):null}renderDropdown(){return this.results?this.renderResultsBody():this.renderIdlePanel()}renderInputWrapper(){const r=e("div",{class:"s-search-input-wrapper"},e("span",{class:"s-search-icon-wrap"},e("span",{class:"s-search-icon",innerHTML:this.loading?'<i class="s-search-spinner-loader"/>':s})),e("input",{type:"search",enterkeyhint:"search",autocomplete:"off",class:"s-search-input",placeholder:this.labels.searchPlaceholder,onInput:r=>this.limitWordsAndSearch(r),onKeyDown:r=>this.handleKeyDown(r),onFocus:()=>this.tracking.searchFocus(),ref:r=>this.searchInput=r,style:{height:this.height+"px",borderRadius:this.oval?this.height/2+"px":""}}),this.showAction?e("salla-button",{loading:this.loading,class:{"s-search-action":!0,"s-search-action-oval":this.oval},onClick:()=>this.handleActionClick()},!this.loading&&e("span",{innerHTML:s})):null);return e("div",{class:"s-search-input-row"},e("button",{type:"button",class:"s-search-back-btn","aria-label":this.labels.back,onClick:()=>this.modal?.close()},e("span",{innerHTML:salla.config.get("theme.is_rtl",!0)?o:i})),r)}renderPlaceholderTrigger(){return e("div",{class:"s-search-input-wrapper"},e("span",{class:"s-search-icon-wrap"},e("span",{class:"s-search-icon",innerHTML:s})),e("button",{type:"button",class:"s-search-input s-search-placeholder-trigger",onClick:()=>this.open(),style:{height:this.height+"px",borderRadius:this.oval?this.height/2+"px":""}},this.labels.searchPlaceholder))}renderInlineTrigger(){return e("div",{class:"s-search-input-wrapper"},e("span",{class:"s-search-icon-wrap"},e("span",{class:"s-search-icon",innerHTML:s})),e("input",{type:"search",readOnly:!0,class:"s-search-input s-search-placeholder-trigger",placeholder:this.labels.searchPlaceholder,onFocus:()=>this.open(),style:{height:this.height+"px",borderRadius:this.oval?this.height/2+"px":""}}))}renderModal(){return e("salla-modal",{position:"top",class:"s-search-modal s-search-modal-new","hide-close-button":!0,ref:r=>this.modal=r},e("div",{class:"s-search-panel"},this.renderInputWrapper(),this.renderDropdown(),this.renderViewAllLink()))}render(){return this.placeholder?e("div",{class:"s-search-placeholder-wrapper s-search-placeholder-wrapper-new s-search-inline"},this.renderPlaceholderTrigger(),this.renderModal()):this.inline?e("div",{class:"s-search-placeholder-wrapper s-search-placeholder-wrapper-new s-search-inline"},this.renderInlineTrigger(),this.renderModal()):this.renderModal()}componentDidLoad(){this.afterSearching()}get host(){return t(this)}static get watchers(){return{search_term:["handleSearch"]}}};b.style='/*!twlt*/.s-search-placeholder-wrapper{position:relative;display:inline-block}.s-search-placeholder-wrapper-new{display:block;width:100%}.s-search-input-wrapper{position:relative}.s-search-placeholder-trigger{cursor:pointer;appearance:none;text-align:start}.s-search-divider{border:none;border-top:1px solid #F3F4F6;margin:0.25rem 0}.visible{visibility:visible}.inline{display:inline}.hidden{display:none}.border{border-width:1px}.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-search-container{position:relative;z-index:99;max-height:14rem;border-radius:0.375rem;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms}.s-search-oval{border-radius:20px}.s-search-inline{min-width:220px}.s-search-container-open{max-height:24rem;border-radius:0px !important}.s-search-container-open .s-search-input{border-top-left-radius:0.375rem !important;border-top-right-radius:0.375rem !important;border-bottom-right-radius:0px !important;border-bottom-left-radius:0px !important;border-width:1px;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1))}.s-search-no-results .s-search-input{border-bottom-right-radius:0px;border-bottom-left-radius:0px;border-width:1px;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1))}.s-search-input{height:2.5rem;width:100%;border-radius:0.375rem;--tw-border-opacity:1;border-color:rgb(243 244 246 / var(--tw-border-opacity, 1));--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1));padding-top:0px;padding-bottom:0.125rem;font-size:0.875rem;line-height:1.25rem;--tw-text-opacity:1;color:rgb(75 85 99 / var(--tw-text-opacity, 1));transition-property:color, background-color, border-color, text-decoration-color, fill, stroke;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:300ms}.s-search-input:focus{--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1));--tw-ring-color:transparent}.s-search-input:where([dir="ltr"],[dir="ltr"] *){padding-left:2.5rem}.s-search-input:where([dir="rtl"],[dir="rtl"] *){padding-right:2.5rem}.s-search-input:focus{outline:2px solid transparent !important;outline-offset:2px !important;box-shadow:none !important;border-color:#e5e7eb !important}.s-search-modal-new .s-search-input{--tw-bg-opacity:1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.s-search-icon-wrap{position:absolute;top:50%;--tw-translate-y:-50%;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));line-height:1;--tw-text-opacity:1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.s-search-icon-wrap:where([dir="ltr"],[dir="ltr"] *){left:1rem}.s-search-icon-wrap:where([dir="rtl"],[dir="rtl"] *){right:1rem}.s-search-icon svg{height:1rem;width:1rem;fill:#9ca3af}.s-search-spinner-loader{display:block;height:1rem;width:1rem}@keyframes spin{to{transform:rotate(360deg)}}.s-search-spinner-loader{animation:spin 1s linear infinite;border-radius:9999px;border-width:2px;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1));border-right-color:var(--color-primary)}.s-search-results{position:absolute;margin:auto;max-height:24rem;width:100%;max-width:100%;overflow-y:auto;border-bottom-right-radius:0.375rem;border-bottom-left-radius:0.375rem;--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1));--tw-shadow:0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);--tw-shadow-colored:0 20px 25px -5px var(--tw-shadow-color), 0 8px 10px -6px 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-search-no-results{border-bottom-right-radius:0px !important;border-bottom-left-radius:0px !important}.s-search-no-results-placeholder{grid-column:1 / -1;padding:1rem;text-align:center;font-size:1rem;line-height:1.5rem;--tw-text-opacity:1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.s-search-product{display:flex;height:100%;justify-content:space-around;overflow:hidden;border-bottom-width:1px;--tw-border-opacity:1;border-color:rgb(243 244 246 / var(--tw-border-opacity, 1));background-color:transparent;padding-left:1rem;padding-right:1rem;padding-top:0.75rem;padding-bottom:0.75rem;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:300ms}.s-search-product:last-child{border-bottom-width:0px}.s-search-product:hover{--tw-bg-opacity:1;background-color:rgb(249 250 251 / var(--tw-bg-opacity, 1))}@media (min-width: 480px){.s-search-product{padding-left:1.25rem;padding-right:1.25rem}}.s-search-product-image-container{position:relative;height:3.5rem;width:5rem;overflow:hidden;border-radius:0.375rem;--tw-bg-opacity:1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.s-search-product-image{position:relative;height:100%;width:100%;object-fit:cover;font-size:0px}.s-search-product-image::before{position:absolute;top:0px;left:0px;height:100%;width:100%;--tw-bg-opacity:1;background-color:rgb(229 231 235 / var(--tw-bg-opacity, 1));--tw-content:\'\';content:var(--tw-content)}.s-search-product-details{flex:1 1 0%;padding-top:0.25rem}.s-search-product-details:where([dir="ltr"],[dir="ltr"] *){padding-left:1rem}@media (min-width: 480px){.s-search-product-details:where([dir="ltr"],[dir="ltr"] *){padding-left:1.25rem}}.s-search-product-details:where([dir="rtl"],[dir="rtl"] *){padding-right:1rem}@media (min-width: 480px){.s-search-product-details:where([dir="rtl"],[dir="rtl"] *){padding-right:1.25rem}}.s-search-product-title{margin-bottom:0.375rem;display:flex;flex-direction:column;align-items:baseline;justify-content:flex-start;font-size:0.875rem;font-weight:700;line-height:1.5rem;--tw-text-opacity:1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.s-search-product-price{display:flex;width:100%;align-items:center;font-size:0.875rem;line-height:1.25rem;font-weight:700;color:var(--color-primary)}.s-search-product-regular-price{padding-left:0.75rem;padding-right:0.75rem;font-weight:500;--tw-text-opacity:1;color:rgb(156 163 175 / var(--tw-text-opacity, 1));text-decoration-line:line-through}.s-search-product-not-available{--tw-grayscale:grayscale(100%);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-search-action{position:absolute;height:100%}.s-search-action:where([dir="ltr"],[dir="ltr"] *){right:0px}.s-search-action:where([dir="rtl"],[dir="rtl"] *){left:0px;border-top-right-radius:0px;border-bottom-right-radius:0px}.s-search-action-oval:where([dir="ltr"],[dir="ltr"] *){border-top-right-radius:9999px;border-bottom-right-radius:9999px}.s-search-action-oval:where([dir="rtl"],[dir="rtl"] *){border-top-left-radius:9999px;border-bottom-left-radius:9999px}.s-search-input-row{margin:1rem;display:flex;align-items:center}.s-search-back-btn{display:flex;flex-shrink:0;align-items:center;justify-content:center;padding:0.25rem;line-height:1;--tw-text-opacity:1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.s-search-back-btn:hover{--tw-text-opacity:1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}@media (min-width: 640px){.s-search-back-btn{display:none}}.s-search-back-btn svg{height:1.5rem;width:1.5rem;fill:#6b7280}.s-search-input-wrapper{position:relative;display:flex;flex-grow:1;align-items:center}.s-search-panel{display:flex;height:100%;flex-direction:column}.s-search-results-body{display:flex;min-height:0px;flex:1 1 0%;flex-direction:column;gap:0.75rem;overflow:hidden;--tw-shadow:0 -4px 6px -4px rgba(0,0,0,0.1);--tw-shadow-colored:0 -4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}@media (min-width: 640px){.s-search-results-body{flex-direction:row}}.s-search-results-grid-wrap{min-height:0px;min-width:0px;flex:1 1 0%;overflow-y:auto}@media (min-width: 640px){.s-search-results-grid-wrap{max-height:24rem !important}}.s-search-results-grid-wrap-no-sidebar{padding-left:1rem;padding-right:1rem}@media (min-width: 640px){.s-search-results-grid-wrap-no-sidebar{padding-left:1.25rem;padding-right:1.25rem}}.s-search-results-grid{display:grid;grid-template-columns:repeat(1, minmax(0, 1fr));align-content:flex-start;column-gap:0.75rem;row-gap:0.25rem}@media (min-width: 640px){.s-search-results-grid{grid-template-columns:repeat(2, minmax(0, 1fr))}}@media (min-width: 1024px){.s-search-results-grid{grid-template-columns:repeat(3, minmax(0, 1fr))}}.s-search-grid-item{cursor:pointer;border-radius:0.375rem;padding:0.25rem;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:300ms}.s-search-grid-item:hover{--tw-bg-opacity:1;background-color:rgb(249 250 251 / var(--tw-bg-opacity, 1))}.s-search-grid-item .s-product-card-out-badge{--tw-bg-opacity:1;background-color:rgb(254 226 226 / var(--tw-bg-opacity, 1));--tw-text-opacity:1;color:rgb(220 38 38 / var(--tw-text-opacity, 1))}.s-search-view-all{display:flex;flex-shrink:0;align-items:center;justify-content:center;gap:0.25rem;border-top-width:1px;--tw-border-opacity:1;border-color:rgb(243 244 246 / var(--tw-border-opacity, 1));padding:0.75rem;text-align:center;font-size:0.875rem;line-height:1.25rem;font-weight:500;--tw-text-opacity:1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.s-search-view-all:hover{text-decoration-line:underline}.s-search-view-all-icon{line-height:1}.s-search-view-all-icon svg{height:1rem;width:1rem;fill:#6b7280}.s-search-sidebar{max-height:none;width:100%;flex-shrink:0}.s-search-sidebar>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.s-search-sidebar{padding:0.5rem}@media (min-width: 640px){.s-search-sidebar{max-height:24rem !important;width:16rem;overflow-y:auto !important;--tw-bg-opacity:1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1));padding:0.75rem}}@media (min-width: 480px){.s-search-sidebar{width:13rem}}.s-search-sidebar:where([dir="ltr"],[dir="ltr"] *){--tw-shadow:4px 0 6px -4px rgba(0,0,0,0.1);--tw-shadow-colored:4px 0 6px -4px 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-search-sidebar:where([dir="rtl"],[dir="rtl"] *){--tw-shadow:-4px 0 6px -4px rgba(0,0,0,0.1);--tw-shadow-colored:-4px 0 6px -4px 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-search-idle-panel{min-height:6rem}.s-search-idle-panel>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.s-search-idle-panel{overflow-y:auto;padding:1rem;padding-top:0px;--tw-shadow:0 -4px 6px -4px rgba(0,0,0,0.1);--tw-shadow-colored:0 -4px 6px -4px 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-search-idle-panel-empty{max-height:none !important;min-height:0px !important;padding:0px !important;--tw-shadow:0 0 #0000 !important;--tw-shadow-colored:0 0 #0000 !important;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow) !important}.s-search-idle-section-title{margin-bottom:0.5rem;margin-top:0.5rem;font-size:1rem;line-height:1.5rem;--tw-text-opacity:1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.s-search-history-list{display:flex;flex-wrap:wrap;gap:0.5rem}.s-search-history-chip{display:inline-flex;align-items:center;gap:0.375rem;border-radius:9999px;--tw-bg-opacity:1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1));padding-top:0.375rem;padding-bottom:0.375rem;font-size:1rem;line-height:1.5rem;--tw-text-opacity:1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.s-search-history-chip:hover{background-color:color-mix(in srgb,var(--color-primary) 10%,transparent)}.s-search-history-chip:where([dir="ltr"],[dir="ltr"] *){padding-left:0.75rem;padding-right:0.5rem}.s-search-history-chip:where([dir="rtl"],[dir="rtl"] *){padding-right:0.75rem;padding-left:0.5rem}.s-search-history-chip-term{display:inline-flex;align-items:center;gap:0.25rem;line-height:1}.s-search-history-chip:hover .s-search-history-chip-term{color:var(--color-primary)}.s-search-history-chip-icon svg{height:0.875rem;width:0.875rem}.s-search-history-chip-remove svg{height:0.625rem;width:0.625rem;fill:#9ca3af}.s-search-idle-categories-list{display:flex;flex-wrap:wrap;gap:0.5rem}.s-search-idle-category-chip{display:inline-flex;align-items:center;gap:0.25rem;border-radius:9999px;--tw-bg-opacity:1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1));padding-left:0.75rem;padding-right:0.75rem;padding-top:0.375rem;padding-bottom:0.375rem;font-size:0.875rem;line-height:1.25rem;--tw-text-opacity:1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.s-search-idle-category-chip:hover{background-color:color-mix(in srgb,var(--color-primary) 10%,transparent);color:var(--color-primary)}.s-search-sidebar .s-search-idle-category-chip{--tw-bg-opacity:1;background-color:rgb(229 231 235 / var(--tw-bg-opacity, 1))}.s-search-idle-category-count{font-size:0.875rem;line-height:1.25rem;--tw-text-opacity:1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.s-search-most-searched-list{display:flex;flex-direction:column}.s-search-most-searched-item{display:flex;width:100%;align-items:center;gap:0.5rem;padding-top:0.375rem;padding-bottom:0.375rem;font-size:0.875rem;line-height:1.25rem;--tw-text-opacity:1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.s-search-most-searched-item:hover{color:var(--color-primary)}.s-search-most-searched-icon svg{height:0.875rem;width:0.875rem;fill:#9ca3af}@media (min-width: 640px){.s-search-modal .s-modal-wrapper{align-items:flex-start;padding:0}.s-search-modal .s-modal-spacer{display:inline}.s-search-modal .s-modal-body{padding:0;width:700px;max-width:90%;margin-top:3.2rem;border-radius:0.5rem;overflow:visible;position:relative !important}}.s-search-modal .s-modal-close{top:50%;transform:translateY(-50%)}@media (max-width: 639px){.s-search-modal .s-modal-body .s-search-results{position:static;margin-top:0}.s-search-modal.s-search-modal-new .s-modal-body{height:100dvh;max-height:100dvh !important}}@media (min-width: 640px){.s-search-modal.s-search-modal-new .s-modal-body{background:var(--color-surface, #fff);overflow:hidden;width:1100px;max-width:95%}}.s-search-product-card-out-of-stock img.loaded{--tw-grayscale:grayscale(100%);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-search-product-card-image img.loaded{position:relative;opacity:1}';export{b as salla_search}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as t,h as a,H as l,a as r}from"./p-
|
|
4
|
+
import{r as t,h as a,H as l,a as r}from"./p-HRJpfiBN.js";const i=class{constructor(a){t(this,a),this.alertDelay=null,this.data=salla.config.get("store.app_install_prompt"),this.open=!1,this.closing=!1}connectedCallback(){salla.onReady((()=>{if(this.data=salla.config.get("store.app_install_prompt"),this.isMobileOrTabletDevice()){if(!this.data)return salla.logger.error("Failed to retrieve salla-app-install-alert config");this.ctaLink=salla.url.get("app"),this.alertDelay=setTimeout((()=>this.open=!0),3e3)}}))}disconnectedCallback(){clearTimeout(this.alertDelay)}isMobileOrTabletDevice(t=1024){if("undefined"==typeof window||"undefined"==typeof navigator||"undefined"==typeof document)return!1;const a=window.matchMedia(`(max-width: ${t}px)`).matches,l=/Macintosh|Android|iPhone|iPad|iPod/i.test(navigator.userAgent),r="ontouchstart"in window||"ontouchend"in document||navigator.maxTouchPoints>0;return l&&a&&r}closeAlert(){salla.storage.set("app_install_prompt_disabled",!0),this.closing=!0,this.host.addEventListener("animationend",(()=>{this.closing=!1,this.open=!1}),{once:!0})}shouldShowAlert(){return!salla.config.isMobileApp()}render(){return this.data&&this.shouldShowAlert()?a(l,{class:`s-app-install-alert-wrapper ${this.open?"open":""} ${this.closing?"closing":""}`,position:this.data.position},a("div",null,a("img",{src:this.data.icon,width:"58",height:"58",alt:`${salla.config.get("store.name")}`})),a("div",{class:"s-app-install-alert-content"},a("h2",{class:"s-app-install-alert-title"},this.data.title),a("p",{class:"s-app-install-alert-sub-title"},this.data.sub_title," "," ",a("a",{href:this.ctaLink,target:"_blank","aria-label":"download app",class:"s-app-install-alert-cta"},salla.lang.getWithDefault("blocks.footer.download_app_now","حمله الآن")))),a("button",{class:"s-app-install-alert-cancel-button","aria-label":"close alert",onClick:()=>this.closeAlert()},a("i",{class:"sicon-cancel"}))):null}get host(){return r(this)}};i.style='/*!twlt*/:host{display:block}.s-app-install-alert-wrapper{display:none;flex-direction:row;align-items:center;position:fixed;left:0;right:0;width:95%;margin-top:1rem;margin-bottom:1rem;margin-left:auto;margin-right:auto;z-index:999;border-radius:0.375rem;padding:0.75rem;gap:0.5rem;background-color:color-mix(in srgb, var(--color-primary) 15%, white);filter:drop-shadow(0 4px 3px rgba(0, 0, 0, 0.07)) drop-shadow(0 2px 2px rgba(0, 0, 0, 0.06))}.s-app-install-alert-wrapper.open[position=top]{display:flex;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes slideDownFromTop{0%{transform:translateY(-100%);opacity:0}100%{transform:translateY(-0%);opacity:1}}.s-app-install-alert-wrapper.open[position=top]{animation:slideDownFromTop .6s linear;transition-duration:500ms}.s-app-install-alert-wrapper:not(.open){display:none}.s-app-install-alert-content{width:100%}.s-app-install-alert-wrapper[position=top]{top:0px}.s-app-install-alert-wrapper.open[position=bottom]{display:flex}@keyframes slideUpFromBottom{0%{transform:translateY(100%);opacity:0}100%{transform:translateY(0%);opacity:1}}.s-app-install-alert-wrapper.open[position=bottom]{animation:slideUpFromBottom .6s linear}.s-app-install-alert-wrapper[position=bottom]{bottom:0px}@keyframes slideUPFromTop{0%{transform:translateY(-0%);opacity:1}100%{transform:translateY(-100%);opacity:0}}.s-app-install-alert-wrapper[position=top].closing{animation:slideUPFromTop .6s linear}@keyframes slideDownFromBottom{0%{transform:translateY(0%);opacity:1}100%{transform:translateY(100%);opacity:0}}.s-app-install-alert-wrapper[position=bottom].closing{animation:slideDownFromBottom .6s linear}.s-app-install-alert-wrapper.closing{animation-fill-mode:forwards}.s-app-install-alert-title{max-width:95%;font-size:1rem;line-height:1.5rem;font-weight:700;color:var(--color-primary)}.s-app-install-alert-sub-title{max-width:95%;font-size:0.875rem;line-height:1.25rem;font-weight:400}.s-app-install-alert-cta{color:var(--color-primary);text-decoration-line:underline}.s-app-install-alert-cancel-button{position:absolute;top:0.5rem}.s-app-install-alert-cancel-button:where([dir="ltr"],[dir="ltr"] *){right:0.75rem}.s-app-install-alert-cancel-button:where([dir="rtl"],[dir="rtl"] *){left:0.75rem}';export{i as salla_app_install_alert}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as t,h as e,H as s,a as l,F as i}from"./p-0Tl_yZW8.js";const n=class{constructor(e){t(this,e),this.sections=[],this.itemNumber=""}deleteItem(t,e){const s=this.host.closest("form");if(s){const l=s.getAttribute("id");if(l&&"string"==typeof l){const s=l.match(/item-(\d+)/)?.[1];this.itemNumber=s||"";const i=this.host.querySelector(`#accordion-${e.id}`);salla.cart.deleteItem(`${this.itemNumber}?product_id=${e.id}§ion_id=${t}`).then((()=>i?.remove()))}}}renderRemoveButton(t,s,l=!1){return e("salla-button",{type:"button",shape:l?"btn":"icon",fill:l?"outline":"solid",size:"small",color:"danger","aria-label":"Remove from the cart",onClick:()=>this.deleteItem(t,s)},l?salla.lang.get("common.elements.delete"):e("i",{class:"sicon-cancel"}))}renderAccordionHeader(t,s){const l=s?.options&&s?.options?.length>0;return e("div",{slot:"html",class:"s-multiple-bundle-product-cart-header-wrapper"},e("div",{class:"s-multiple-bundle-product-cart-header "+(l?"":"s-multiple-bundle-product-cart-header-no-options")},e("div",{class:"s-multiple-bundle-product-cart-header-content"},e("a",{href:s?.url,class:"s-multiple-bundle-product-cart-header-image-wrapper"},e("img",{src:s?.image?.url,alt:s?.image?.alt||s?.name,class:"s-multiple-bundle-product-cart-header-image"})),e("div",{class:"s-multiple-bundle-product-cart-header-content-details"},e("h2",{class:"s-multiple-bundle-product-cart-header-content-details-title"},e("a",{href:s?.url,class:"s-multiple-bundle-product-cart-header-content-details-title-link"},s?.name)),e("div",{class:"s-multiple-bundle-product-cart-header-content-details-price"},e("span",{class:"s-multiple-bundle-product-cart-header-content-details-price-regular"},e("span",{innerHTML:s?.price?salla.money(s?.price):""})),s?.sale_price>0&&e("span",{class:"s-multiple-bundle-product-cart-header-content-details-price-sale"},e("span",{innerHTML:salla.money(s?.sale_price)}))),s?.quantity_in_group>0&&0!==s?.quantity&&e("p",{class:"s-multiple-bundle-product-cart-header-content-details-quantity"},e("span",null,salla.lang.get("pages.products.number_of_pieces")),e("span",null,s?.quantity_in_group)))),!l&&e("div",{class:"s-multiple-bundle-product-cart-header-remove-button"},this.renderRemoveButton(t,s,!1))))}render(){return e(s,{key:"f4a66dc2916ad42108b551790e1a1a581a55d6b1",class:"s-multiple-bundle-product-wrapper"},e("div",{key:"fa96a2da58ee5be80c79c1a6fff66fbcf49cd87e",class:"s-multiple-bundle-product-wrapper-sections"},this.sections.map(((t,s)=>t.products.map((l=>{const i={sectionId:t.id,sectionIndex:s,productId:l.id};return e("salla-accordion",{key:l.id,collapsed:!1,bordered:!0,collapsible:!!(l.options&&l.options.length>0),size:"sm",id:`accordion-${l.id}`},e("salla-accordion-head",null,this.renderAccordionHeader(String(t.id),l)),l.options&&l.options.length>0&&e("salla-accordion-body",null,e("salla-product-options",{options:JSON.stringify(l.options),key:`${l.id}-persistent`,"product-id":l.id,"bundle-context":JSON.stringify(i)}),e("div",{class:"s-multiple-bundle-product-cart-body-remove-button"},this.renderRemoveButton(String(t.id),l,!0))))}))))))}get host(){return l(this)}};n.style="";const c=class{constructor(e){t(this,e),this.sections=[],this.selectedProducts={},this.productSelectedHandler=null,this.onSelectProduct=(t,e)=>{const s=e.id,l=this.selectedProducts[t]?.has(s)??!1,i=this.sections.find((e=>e.id==t));if(!(l&&i&&this.isProductSelectionLocked(i))){if(!l){if(!i)return;if(1!==this.getEffectiveMax(i)&&this.isAtSelectionLimit(i))return}this.selectedProducts={...this.selectedProducts,[t]:new Set(this.selectedProducts[t]||[])},l?(this.selectedProducts[t].delete(s),this.clearProductFormData(s,t),this.clearProductModalOptions(s,t)):1===this.getEffectiveMax(i)?this.syncSectionSelection(t,s):this.selectedProducts[t].add(s),this.selectedProducts={...this.selectedProducts},salla.event.dispatch("on-bundle-product-selected",{id:e.id,name:e.name,options:e.options,wasSelected:l,isSelected:!l})}},this.ensureProductSelected=(t,e)=>{this.selectedProducts={...this.selectedProducts,[t]:new Set(this.selectedProducts[t]||[])};const s=e.id;if(this.selectedProducts[t].has(s))return;const l=this.sections.find((e=>e.id==t));if(!l)return;const i=this.getEffectiveMax(l);if(1===i)this.syncSectionSelection(t,s);else{if(i>1&&this.isAtSelectionLimit(l))return;this.selectedProducts[t].add(s)}this.selectedProducts={...this.selectedProducts},salla.event.dispatch("on-bundle-product-selected",{id:e.id,name:e.name,options:e.options})},this.onSelectProductOptions=(t,e)=>{const s=this.sections.find((t=>t.id==e));if(!s||!this.canSelectProductInSection(s,t.id))return;const l=this.sections.findIndex((t=>t.id==e)),i=s.products?.findIndex((e=>e.id==t.id))??0,n=this.selectedProducts[e]?.has(t.id)??!1;salla.event.dispatch("multiple-bundle-product-modal::open",{product:t,sectionId:e,sectionIndex:l,productIndex:i,isProductAlreadySelected:n})},this.handleBundleSliderProductSelected=t=>{const{product:e,sectionId:s}=t.detail;this.onSelectProduct(s,e)},this.handleBundleSliderProductOptionsSelected=t=>{const{product:e,sectionId:s}=t.detail;this.onSelectProductOptions(e,s)}}isSingleProductSection(t){return 1===(t.products?.length??0)}getObligatoryMin(t){const e=t.obligatory_products;if(null==e)return 0;const s=Number(e);return Number.isNaN(s)?0:s}isProductSelectionLocked(t){return this.isSingleProductSection(t)&&1===this.getObligatoryMin(t)}getEffectiveMax(t){const e=t.products?.length??0,s=t.max_obligatory_products;return null!=s&&s>0?Math.min(s,e):e}getSelectedCount(t){return this.selectedProducts[t]?.size??0}isAtSelectionLimit(t){return this.getSelectedCount(t.id)>=this.getEffectiveMax(t)}canSelectProductInSection(t,e){return!!this.selectedProducts[t.id]?.has(e)||1===this.getEffectiveMax(t)||!this.isAtSelectionLimit(t)}async canSelectBundleProduct(t,e){const s=this.sections.find((e=>e.id==t));return!!s&&this.canSelectProductInSection(s,e)}queryProductCheckbox(t,e){const s=`input.s-multiple-bundle-product-checkbox[name="bundle[${t}][${e}][id]"]`,l=this.host.closest("form"),i=l?.querySelector(s);if(i)return i;for(const t of this.host.querySelectorAll("salla-multiple-bundle-product-slider")){const e=(t.shadowRoot??t).querySelector(s);if(e)return e}return null}dispatchBubblingChange(t){requestAnimationFrame((()=>{t.dispatchEvent(new window.Event("change",{bubbles:!0}))}))}clearSectionProductSlot(t,e,s){const l=this.queryProductCheckbox(t,s);l&&(l.checked=!1);const i=this.host.closest("form");if(i){const e=`bundle[${t}][${s}]`;Array.from(i.querySelectorAll("input")).forEach((t=>{t.name?.startsWith(e)&&("checkbox"===t.type&&t.name?.endsWith("][id]")?t.checked=!1:t.remove())}))}this.clearProductModalOptions(e,t)}syncSectionSelection(t,e){const s=this.sections.find((e=>e.id==t));s?.products?.forEach(((s,l)=>{s.id!=e&&this.clearSectionProductSlot(t,s.id,l)})),this.selectedProducts[t]=new Set([e]);const l=s?.products?.findIndex((t=>t.id==e))??-1,i=l>=0?this.queryProductCheckbox(t,l):null;i&&(i.checked=!0,this.dispatchBubblingChange(i))}autoSelectSingleProductSections(){if(!this.sections?.length)return;const t={...this.selectedProducts};let e=!1;const s=[];for(const l of this.sections){if(!this.isProductSelectionLocked(l))continue;const i=l.products?.[0];if(!i||!i.unlimited_quantity&&(i.quantity??0)<=0)continue;const n=l.id,c=new Set(t[n]||[]);c.has(i.id)||(c.add(i.id),t[n]=c,e=!0,s.push({product:i}))}e&&(this.selectedProducts=t,s.forEach((({product:t})=>{salla.event.dispatch("on-bundle-product-selected",{id:t.id,name:t.name,options:t.options})})))}clearProductFormData(t,e){if(null!=e){const s=this.sections.find((t=>t.id==e)),l=s?.products?.findIndex((e=>e.id==t))??-1;if(l>=0)return void this.clearSectionProductSlot(e,t,l)}const s=this.host.closest("form");s&&s.querySelectorAll(`[data-product-id="${t}"]`).forEach((t=>t.remove()))}clearProductModalOptions(t,e){let s=null,l=null;if(null!=e&&(s=this.sections.findIndex((t=>t.id==e)),s>-1)){const e=this.sections[s];if(e){const s=e.products?.findIndex((e=>e.id==t));l="number"==typeof s&&s>-1?s:null}}salla.event.dispatch("multiple-bundle-product-modal::clear-options",{productId:t,sectionId:e,sectionIndex:s,productIndex:l})}getProgressStatus(t){const e=this.getSelectedCount(t.id),s=this.getEffectiveMax(t);return s>0?`${e}/${s}`:"0"}getSectionSelectionNote(t){const e=this.getObligatoryMin(t),s=Number(t.max_obligatory_products)||0,l=e>0,i=s>0;return l||i?l&&i?e===s?salla.lang.getWithDefault("pages.products.bundle_select_exact",`اختر ${e} منتجات`,{count:e}):salla.lang.getWithDefault("pages.products.bundle_select_range",`اختر من ${e} إلى ${s} منتجات`,{min:e,max:s}):l?salla.lang.getWithDefault("pages.products.bundle_select_min",`اختر على الأقل ${e} منتجات`,{min:e}):salla.lang.getWithDefault("pages.products.bundle_select_max",`اختر حتى ${s} منتجات`,{max:s}):null}handleSectionsChange(){this.autoSelectSingleProductSections()}componentWillLoad(){this.autoSelectSingleProductSections()}renderAccordionHeader(t){const s=this.getSectionSelectionNote(t);return e(i,null,e("h2",{slot:"title"},t?.name),s?e("span",{slot:"note"},s):null,e("span",{slot:"progress"},this.getProgressStatus(t)))}componentDidLoad(){const t=this.host.querySelector("salla-multiple-bundle-product-options-modal");t&&(this.productSelectedHandler=t=>{const{productId:e,sectionId:s,product:l,fromModal:i}=t.detail;i?this.ensureProductSelected(s,l||{id:e}):this.onSelectProduct(s,l||{id:e})},t.addEventListener("productSelected",this.productSelectedHandler))}disconnectedCallback(){if(this.productSelectedHandler){const t=this.host.querySelector("salla-multiple-bundle-product-options-modal");t&&t.removeEventListener("productSelected",this.productSelectedHandler),this.productSelectedHandler=null}}render(){return e(s,{key:"379725e546f6eeb670a23166de2a2d829e48da96",class:"s-multiple-bundle-product-wrapper"},e("div",{key:"5939dfacd285738495dda3481d4974775152dc76",class:"s-multiple-bundle-product-wrapper-sections"},this.sections.map(((t,s)=>e("salla-accordion",{key:t.id,collapsed:0!==s},e("salla-accordion-head",null,this.renderAccordionHeader(t)),e("salla-accordion-body",null,e("salla-multiple-bundle-product-slider",{section:t,sectionIndex:s,selectedProducts:this.selectedProducts,selectionLimit:this.getEffectiveMax(t),isSelectionLocked:this.isProductSelectionLocked(t),onProductSelected:this.handleBundleSliderProductSelected,onProductOptionsSelected:this.handleBundleSliderProductOptionsSelected})))))),e("salla-multiple-bundle-product-options-modal",{key:"2270a07c784a748e7ffaf48164e5cc8b09116878"}))}get host(){return l(this)}static get watchers(){return{sections:["handleSectionsChange"]}}};c.style="";export{n as salla_multiple_bundle_product_cart,c as salla_multiple_bundle_product_details}
|
|
4
|
+
import{r as t,h as e,H as s,a as l,F as i}from"./p-HRJpfiBN.js";const n=class{constructor(e){t(this,e),this.sections=[],this.itemNumber=""}deleteItem(t,e){const s=this.host.closest("form");if(s){const l=s.getAttribute("id");if(l&&"string"==typeof l){const s=l.match(/item-(\d+)/)?.[1];this.itemNumber=s||"";const i=this.host.querySelector(`#accordion-${e.id}`);salla.cart.deleteItem(`${this.itemNumber}?product_id=${e.id}§ion_id=${t}`).then((()=>i?.remove()))}}}renderRemoveButton(t,s,l=!1){return e("salla-button",{type:"button",shape:l?"btn":"icon",fill:l?"outline":"solid",size:"small",color:"danger","aria-label":"Remove from the cart",onClick:()=>this.deleteItem(t,s)},l?salla.lang.get("common.elements.delete"):e("i",{class:"sicon-cancel"}))}renderAccordionHeader(t,s){const l=s?.options&&s?.options?.length>0;return e("div",{slot:"html",class:"s-multiple-bundle-product-cart-header-wrapper"},e("div",{class:"s-multiple-bundle-product-cart-header "+(l?"":"s-multiple-bundle-product-cart-header-no-options")},e("div",{class:"s-multiple-bundle-product-cart-header-content"},e("a",{href:s?.url,class:"s-multiple-bundle-product-cart-header-image-wrapper"},e("img",{src:s?.image?.url,alt:s?.image?.alt||s?.name,class:"s-multiple-bundle-product-cart-header-image"})),e("div",{class:"s-multiple-bundle-product-cart-header-content-details"},e("h2",{class:"s-multiple-bundle-product-cart-header-content-details-title"},e("a",{href:s?.url,class:"s-multiple-bundle-product-cart-header-content-details-title-link"},s?.name)),e("div",{class:"s-multiple-bundle-product-cart-header-content-details-price"},e("span",{class:"s-multiple-bundle-product-cart-header-content-details-price-regular"},e("span",{innerHTML:s?.price?salla.money(s?.price):""})),s?.sale_price>0&&e("span",{class:"s-multiple-bundle-product-cart-header-content-details-price-sale"},e("span",{innerHTML:salla.money(s?.sale_price)}))),s?.quantity_in_group>0&&0!==s?.quantity&&e("p",{class:"s-multiple-bundle-product-cart-header-content-details-quantity"},e("span",null,salla.lang.get("pages.products.number_of_pieces")),e("span",null,s?.quantity_in_group)))),!l&&e("div",{class:"s-multiple-bundle-product-cart-header-remove-button"},this.renderRemoveButton(t,s,!1))))}render(){return e(s,{key:"f4a66dc2916ad42108b551790e1a1a581a55d6b1",class:"s-multiple-bundle-product-wrapper"},e("div",{key:"fa96a2da58ee5be80c79c1a6fff66fbcf49cd87e",class:"s-multiple-bundle-product-wrapper-sections"},this.sections.map(((t,s)=>t.products.map((l=>{const i={sectionId:t.id,sectionIndex:s,productId:l.id};return e("salla-accordion",{key:l.id,collapsed:!1,bordered:!0,collapsible:!!(l.options&&l.options.length>0),size:"sm",id:`accordion-${l.id}`},e("salla-accordion-head",null,this.renderAccordionHeader(String(t.id),l)),l.options&&l.options.length>0&&e("salla-accordion-body",null,e("salla-product-options",{options:JSON.stringify(l.options),key:`${l.id}-persistent`,"product-id":l.id,"bundle-context":JSON.stringify(i)}),e("div",{class:"s-multiple-bundle-product-cart-body-remove-button"},this.renderRemoveButton(String(t.id),l,!0))))}))))))}get host(){return l(this)}};n.style="";const c=class{constructor(e){t(this,e),this.sections=[],this.selectedProducts={},this.productSelectedHandler=null,this.onSelectProduct=(t,e)=>{const s=e.id,l=this.selectedProducts[t]?.has(s)??!1,i=this.sections.find((e=>e.id==t));if(!(l&&i&&this.isProductSelectionLocked(i))){if(!l){if(!i)return;if(1!==this.getEffectiveMax(i)&&this.isAtSelectionLimit(i))return}this.selectedProducts={...this.selectedProducts,[t]:new Set(this.selectedProducts[t]||[])},l?(this.selectedProducts[t].delete(s),this.clearProductFormData(s,t),this.clearProductModalOptions(s,t)):1===this.getEffectiveMax(i)?this.syncSectionSelection(t,s):this.selectedProducts[t].add(s),this.selectedProducts={...this.selectedProducts},salla.event.dispatch("on-bundle-product-selected",{id:e.id,name:e.name,options:e.options,wasSelected:l,isSelected:!l})}},this.ensureProductSelected=(t,e)=>{this.selectedProducts={...this.selectedProducts,[t]:new Set(this.selectedProducts[t]||[])};const s=e.id;if(this.selectedProducts[t].has(s))return;const l=this.sections.find((e=>e.id==t));if(!l)return;const i=this.getEffectiveMax(l);if(1===i)this.syncSectionSelection(t,s);else{if(i>1&&this.isAtSelectionLimit(l))return;this.selectedProducts[t].add(s)}this.selectedProducts={...this.selectedProducts},salla.event.dispatch("on-bundle-product-selected",{id:e.id,name:e.name,options:e.options})},this.onSelectProductOptions=(t,e)=>{const s=this.sections.find((t=>t.id==e));if(!s||!this.canSelectProductInSection(s,t.id))return;const l=this.sections.findIndex((t=>t.id==e)),i=s.products?.findIndex((e=>e.id==t.id))??0,n=this.selectedProducts[e]?.has(t.id)??!1;salla.event.dispatch("multiple-bundle-product-modal::open",{product:t,sectionId:e,sectionIndex:l,productIndex:i,isProductAlreadySelected:n})},this.handleBundleSliderProductSelected=t=>{const{product:e,sectionId:s}=t.detail;this.onSelectProduct(s,e)},this.handleBundleSliderProductOptionsSelected=t=>{const{product:e,sectionId:s}=t.detail;this.onSelectProductOptions(e,s)}}isSingleProductSection(t){return 1===(t.products?.length??0)}getObligatoryMin(t){const e=t.obligatory_products;if(null==e)return 0;const s=Number(e);return Number.isNaN(s)?0:s}isProductSelectionLocked(t){return this.isSingleProductSection(t)&&1===this.getObligatoryMin(t)}getEffectiveMax(t){const e=t.products?.length??0,s=t.max_obligatory_products;return null!=s&&s>0?Math.min(s,e):e}getSelectedCount(t){return this.selectedProducts[t]?.size??0}isAtSelectionLimit(t){return this.getSelectedCount(t.id)>=this.getEffectiveMax(t)}canSelectProductInSection(t,e){return!!this.selectedProducts[t.id]?.has(e)||1===this.getEffectiveMax(t)||!this.isAtSelectionLimit(t)}async canSelectBundleProduct(t,e){const s=this.sections.find((e=>e.id==t));return!!s&&this.canSelectProductInSection(s,e)}queryProductCheckbox(t,e){const s=`input.s-multiple-bundle-product-checkbox[name="bundle[${t}][${e}][id]"]`,l=this.host.closest("form"),i=l?.querySelector(s);if(i)return i;for(const t of this.host.querySelectorAll("salla-multiple-bundle-product-slider")){const e=(t.shadowRoot??t).querySelector(s);if(e)return e}return null}dispatchBubblingChange(t){requestAnimationFrame((()=>{t.dispatchEvent(new window.Event("change",{bubbles:!0}))}))}clearSectionProductSlot(t,e,s){const l=this.queryProductCheckbox(t,s);l&&(l.checked=!1);const i=this.host.closest("form");if(i){const e=`bundle[${t}][${s}]`;Array.from(i.querySelectorAll("input")).forEach((t=>{t.name?.startsWith(e)&&("checkbox"===t.type&&t.name?.endsWith("][id]")?t.checked=!1:t.remove())}))}this.clearProductModalOptions(e,t)}syncSectionSelection(t,e){const s=this.sections.find((e=>e.id==t));s?.products?.forEach(((s,l)=>{s.id!=e&&this.clearSectionProductSlot(t,s.id,l)})),this.selectedProducts[t]=new Set([e]);const l=s?.products?.findIndex((t=>t.id==e))??-1,i=l>=0?this.queryProductCheckbox(t,l):null;i&&(i.checked=!0,this.dispatchBubblingChange(i))}autoSelectSingleProductSections(){if(!this.sections?.length)return;const t={...this.selectedProducts};let e=!1;const s=[];for(const l of this.sections){if(!this.isProductSelectionLocked(l))continue;const i=l.products?.[0];if(!i||!i.unlimited_quantity&&(i.quantity??0)<=0)continue;const n=l.id,c=new Set(t[n]||[]);c.has(i.id)||(c.add(i.id),t[n]=c,e=!0,s.push({product:i}))}e&&(this.selectedProducts=t,s.forEach((({product:t})=>{salla.event.dispatch("on-bundle-product-selected",{id:t.id,name:t.name,options:t.options})})))}clearProductFormData(t,e){if(null!=e){const s=this.sections.find((t=>t.id==e)),l=s?.products?.findIndex((e=>e.id==t))??-1;if(l>=0)return void this.clearSectionProductSlot(e,t,l)}const s=this.host.closest("form");s&&s.querySelectorAll(`[data-product-id="${t}"]`).forEach((t=>t.remove()))}clearProductModalOptions(t,e){let s=null,l=null;if(null!=e&&(s=this.sections.findIndex((t=>t.id==e)),s>-1)){const e=this.sections[s];if(e){const s=e.products?.findIndex((e=>e.id==t));l="number"==typeof s&&s>-1?s:null}}salla.event.dispatch("multiple-bundle-product-modal::clear-options",{productId:t,sectionId:e,sectionIndex:s,productIndex:l})}getProgressStatus(t){const e=this.getSelectedCount(t.id),s=this.getEffectiveMax(t);return s>0?`${e}/${s}`:"0"}getSectionSelectionNote(t){const e=this.getObligatoryMin(t),s=Number(t.max_obligatory_products)||0,l=e>0,i=s>0;return l||i?l&&i?e===s?salla.lang.getWithDefault("pages.products.bundle_select_exact",`اختر ${e} منتجات`,{count:e}):salla.lang.getWithDefault("pages.products.bundle_select_range",`اختر من ${e} إلى ${s} منتجات`,{min:e,max:s}):l?salla.lang.getWithDefault("pages.products.bundle_select_min",`اختر على الأقل ${e} منتجات`,{min:e}):salla.lang.getWithDefault("pages.products.bundle_select_max",`اختر حتى ${s} منتجات`,{max:s}):null}handleSectionsChange(){this.autoSelectSingleProductSections()}componentWillLoad(){this.autoSelectSingleProductSections()}renderAccordionHeader(t){const s=this.getSectionSelectionNote(t);return e(i,null,e("h2",{slot:"title"},t?.name),s?e("span",{slot:"note"},s):null,e("span",{slot:"progress"},this.getProgressStatus(t)))}componentDidLoad(){const t=this.host.querySelector("salla-multiple-bundle-product-options-modal");t&&(this.productSelectedHandler=t=>{const{productId:e,sectionId:s,product:l,fromModal:i}=t.detail;i?this.ensureProductSelected(s,l||{id:e}):this.onSelectProduct(s,l||{id:e})},t.addEventListener("productSelected",this.productSelectedHandler))}disconnectedCallback(){if(this.productSelectedHandler){const t=this.host.querySelector("salla-multiple-bundle-product-options-modal");t&&t.removeEventListener("productSelected",this.productSelectedHandler),this.productSelectedHandler=null}}render(){return e(s,{key:"379725e546f6eeb670a23166de2a2d829e48da96",class:"s-multiple-bundle-product-wrapper"},e("div",{key:"5939dfacd285738495dda3481d4974775152dc76",class:"s-multiple-bundle-product-wrapper-sections"},this.sections.map(((t,s)=>e("salla-accordion",{key:t.id,collapsed:0!==s},e("salla-accordion-head",null,this.renderAccordionHeader(t)),e("salla-accordion-body",null,e("salla-multiple-bundle-product-slider",{section:t,sectionIndex:s,selectedProducts:this.selectedProducts,selectionLimit:this.getEffectiveMax(t),isSelectionLocked:this.isProductSelectionLocked(t),onProductSelected:this.handleBundleSliderProductSelected,onProductOptionsSelected:this.handleBundleSliderProductOptionsSelected})))))),e("salla-multiple-bundle-product-options-modal",{key:"2270a07c784a748e7ffaf48164e5cc8b09116878"}))}get host(){return l(this)}static get watchers(){return{sections:["handleSectionsChange"]}}};c.style="";export{n as salla_multiple_bundle_product_cart,c as salla_multiple_bundle_product_details}
|
|
@@ -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-HRJpfiBN.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 e,h as t,H as r}from"./p-0Tl_yZW8.js";var i;!function(e){e.PERCENTAGE="percentage",e.FIXED="fixed"}(i||(i={}));const o={staticIcons:['<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="40" height="40" color="#000000" fill="none">\n <path d="M13.7276 3.44418L15.4874 6.99288C15.7274 7.48687 16.3673 7.9607 16.9073 8.05143L20.0969 8.58575C22.1367 8.92853 22.6167 10.4206 21.1468 11.8925L18.6671 14.3927C18.2471 14.8161 18.0172 15.6327 18.1471 16.2175L18.8571 19.3125C19.417 21.7623 18.1271 22.71 15.9774 21.4296L12.9877 19.6452C12.4478 19.3226 11.5579 19.3226 11.0079 19.6452L8.01827 21.4296C5.8785 22.71 4.57865 21.7522 5.13859 19.3125L5.84851 16.2175C5.97849 15.6327 5.74852 14.8161 5.32856 14.3927L2.84884 11.8925C1.389 10.4206 1.85895 8.92853 3.89872 8.58575L7.08837 8.05143C7.61831 7.9607 8.25824 7.48687 8.49821 6.99288L10.258 3.44418C11.2179 1.51861 12.7777 1.51861 13.7276 3.44418Z" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path>\n</svg>','<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" color="#000000" fill="none">\n <path d="M3 12C7.5 12 12 7.5 12 3C12 7.5 16.5 12 21 12C16.5 12 12 16.5 12 21C12 16.5 7.5 12 3 12Z" stroke="currentColor" stroke-width="1.5" stroke-linejoin="round"></path>\n <path d="M2 19.5C2.83333 19.5 4.5 17.8333 4.5 17C4.5 17.8333 6.16667 19.5 7 19.5C6.16667 19.5 4.5 21.1667 4.5 22C4.5 21.1667 2.83333 19.5 2 19.5Z" stroke="currentColor" stroke-width="1.5" stroke-linejoin="round"></path>\n <path d="M16 5C17 5 19 3 19 2C19 3 21 5 22 5C21 5 19 7 19 8C19 7 17 5 16 5Z" stroke="currentColor" stroke-width="1.5" stroke-linejoin="round"></path>\n</svg>','<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="40" height="40" color="#000000" fill="none">\n <path d="M14.2644 18.3717C14.5806 17.407 14.7387 16.9247 15.0616 16.593C15.215 16.4354 15.3932 16.3048 15.5887 16.2066C16.0003 16 16.5003 16 17.5002 16C18.5001 16 19.0001 16 19.4116 16.2066C19.6072 16.3048 19.7853 16.4354 19.9388 16.593C20.2617 16.9247 20.4198 17.407 20.736 18.3717L21.0624 19.3675C21.4561 20.5688 21.653 21.1694 21.3587 21.5847C21.0643 22 20.4418 22 19.1966 22H15.8038C14.5586 22 13.936 22 13.6417 21.5847C13.3473 21.1694 13.5442 20.5688 13.938 19.3675L14.2644 18.3717Z" stroke="currentColor" stroke-width="1.5"></path>\n <path d="M8.76421 10.3717C9.08041 9.40705 9.23851 8.92471 9.56143 8.59298C9.71485 8.43537 9.89299 8.3048 10.0885 8.20663C10.5001 8 11.0001 8 12 8C12.9999 8 13.4999 8 13.9115 8.20663C14.107 8.3048 14.2851 8.43537 14.4386 8.59298C14.7615 8.92471 14.9196 9.40705 15.2358 10.3717L15.5622 11.3675C15.956 12.5688 16.1528 13.1694 15.8585 13.5847C15.5642 14 14.9416 14 13.6964 14H10.3036C9.05842 14 8.43585 14 8.1415 13.5847C7.84716 13.1694 8.04404 12.5688 8.43779 11.3675L8.76421 10.3717Z" stroke="currentColor" stroke-width="1.5"></path>\n <path d="M3.26439 18.3717C3.58059 17.407 3.73869 16.9247 4.06162 16.593C4.21504 16.4354 4.39317 16.3048 4.58872 16.2066C5.00031 16 5.50027 16 6.50018 16C7.5001 16 8.00006 16 8.41165 16.2066C8.6072 16.3048 8.78533 16.4354 8.93875 16.593C9.26167 16.9247 9.41977 17.407 9.73597 18.3717L10.0624 19.3675C10.4561 20.5688 10.653 21.1694 10.3587 21.5847C10.0643 22 9.44176 22 8.19661 22H4.80375C3.5586 22 2.93603 22 2.64169 21.5847C2.34735 21.1694 2.54422 20.5688 2.93797 19.3675L3.26439 18.3717Z" stroke="currentColor" stroke-width="1.5"></path>\n <path d="M12 2V4M7.5 3.5L9 5M16.5 3.5L15 5" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"></path>\n</svg>','<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" color="#000000" fill="none">\n <path d="M5.78223 4.18192C6.43007 3.68319 6.754 3.43383 7.12788 3.27323C7.29741 3.20041 7.47367 3.14158 7.65459 3.09741C8.0536 3 8.4767 3 9.32289 3H14.6771C15.5233 3 15.9464 3 16.3454 3.09741C16.5263 3.14158 16.7026 3.20041 16.8721 3.27323C17.246 3.43383 17.5699 3.68319 18.2178 4.18192C20.3644 5.83448 21.4378 6.66077 21.8057 7.73078C21.9694 8.20673 22.0305 8.70728 21.9858 9.20461C21.8852 10.3227 21.0379 11.346 19.3433 13.3925L15.3498 18.2153C13.8126 20.0718 13.044 21 12 21C10.956 21 10.1874 20.0718 8.65018 18.2153L4.65671 13.3925C2.96208 11.346 2.11476 10.3227 2.0142 9.20461C1.96947 8.70728 2.03064 8.20673 2.1943 7.73078C2.56224 6.66077 3.63557 5.83448 5.78223 4.18192Z" stroke="currentColor" stroke-width="1.5"></path>\n <path d="M10 8.5H14" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path>\n</svg>'],staticColors:["#993018","#444444","#D18F36","#315F9C"]};class s{static findTierByIndex(e,t){return e.find((e=>e.index===t))||null}static findTierByName(e,t){return e.find((e=>e.tier_name===t))||null}static getTierNameByIndex(e,t){return this.findTierByIndex(e,t)?.tier_name}static findCurrentTierIndex(e,t){if(!t)return 0;for(let r=t.length-1;r>=0;r--)if(e>=t[r].threshold)return t[r].index;return 0}}const n=class{constructor(t){e(this,t),this.currentTierIndex=0,this.canRender=!1,this.isLoading=!1,this.handleTabClick=e=>{this.activeTabTier=e},salla.lang.onLoaded((()=>{this.loyaltyProgramText=salla.lang.get("blocks.tiered_offer.program_title"),this.currentTierText=salla.lang.get("blocks.tiered_offer.current_tier"),this.discountText=salla.lang.get("blocks.tiered_offer.discount"),this.benefitText=salla.lang.get("blocks.tiered_offer.tier_description")}))}async componentWillLoad(){try{if(await salla.onReady(),!this.checkFeatureEnabled())return;if(!this.checkCartExists())return;this.isLoading=!0;const e=await this.fetchTieredOfferData();if(!e)return;this.initializeComponent(e)}catch(e){this.canRender=!1,salla.logger.warn("salla-tiered-offer:: ",e)}finally{this.isLoading=!1}}checkFeatureEnabled(){return salla.config.get("store.features")?.includes("tiered-offer")}checkCartExists(){return!!salla.storage.get("cart")?.summary?.count}validateCouponCompatibility(e,t){return!(t&&!e.details?.applied_with_coupon)}shouldHideForGuest(){return salla.config.isGuest()}shouldHideUntilThreshold(e,t){return!(!e?.hide_until_threshold||0!==t)}resolveTierName(e,t){return s.getTierNameByIndex(e,t)||""}async fetchTieredOfferData(){try{const{data:e}=await salla.api.cart.offers(),t=e.find((e=>"tiered_offer"===e.type));return t?this.validateCouponCompatibility(t,salla.storage.get("cart")?.coupon)?t:(this.canRender=!1,null):null}catch(e){throw e}}initializeComponent(e){this.apiOfferData=e,this.tieredOfferData=this.mapApiDataToTiers(this.apiOfferData),this.loyaltyProgramText=this.apiOfferData.title||this.loyaltyProgramText;const t=this.findCurrentTierIndex(this.apiOfferData.details?.current_value||0);this.shouldHideForGuest()||this.shouldHideUntilThreshold(this.apiOfferData.details,t)?this.canRender=!1:(this.currentTierIndex=t,this.currentTier=this.resolveTierName(this.tieredOfferData.tiers,t),this.activeTabTier=this.currentTier||this.tieredOfferData.tiers[0]?.tier_name,this.canRender=!0)}componentDidLoad(){salla.event.on("cart::updated",(async e=>{let t=null;try{t=await this.fetchTieredOfferData()}catch(e){return void salla.logger.warn("salla-tiered-offer:: ",e)}t&&(this.tieredOfferData?this.updateOfferValues(e,t):this.initializeComponent(t))}))}mapApiDataToTiers(e){const t=[...e.details.discounts].sort(((e,t)=>e.min_spend-t.min_spend)).map(((e,t)=>({name:e.name,tier_name:e.name,discount:e.type===i.PERCENTAGE?`${salla.helpers.number(e.value)}%`:salla.money(e.value),icon:o.staticIcons[t]||o.staticIcons[0],threshold:e.min_spend,text_color:o.staticColors[t],index:t+1})));return{current_tier:s.getTierNameByIndex(t,this.findCurrentTierIndex(e.details.current_value,t)),tiers:t}}findCurrentTierIndex(e,t=this.tieredOfferData?.tiers){return s.findCurrentTierIndex(e,t||[])}updateOfferValues(e,t){if(!t||!this.tieredOfferData)return;if(!t.details?.discounts?.length)return void(this.canRender=!1);if(!this.validateCouponCompatibility(t,e.coupon))return void(this.canRender=!1);if(this.shouldHideForGuest())return void(this.canRender=!1);const r=this.mapApiDataToTiers(t),i=this.findCurrentTierIndex(t.details?.current_value||0,r.tiers);if(this.shouldHideUntilThreshold(t.details,i))return void(this.canRender=!1);if(!1===t.details?.with_current_cart)return void(this.canRender=!0);this.apiOfferData=t,this.tieredOfferData=r,this.canRender=!0,this.currentTierIndex=i,this.currentTier=this.resolveTierName(r.tiers,i);const o=this.currentTier||r.tiers[0]?.tier_name;this.activeTabTier!==o&&(this.activeTabTier=o)}getLoadingSkeletonView(){return t(r,null,t("div",{class:"s-tiered-offer-container"},t("div",{class:"s-tiered-offer-skeleton-wrapper"},t("div",{class:"s-tiered-offer-skeleton-title"},t("salla-skeleton",{height:"16px",width:"40%"})),t("div",{class:"s-tiered-offer-skeleton-subtitle"},t("salla-skeleton",{height:"20px",width:"60%"})),t("div",{class:"s-tiered-offer-skeleton-progress"},t("salla-skeleton",{height:"16px",width:"100%"})),t("div",{class:"s-tiered-offer-skeleton-tabs"},t("salla-skeleton",{height:"50px",width:"100%"})))))}getCurrentTierData(){return s.findTierByIndex(this.tieredOfferData.tiers,this.currentTierIndex)||this.tieredOfferData.tiers[0]}getProgressWidth(){const e=this.tieredOfferData.tiers.length;return this.findCurrentTierIndex(this.apiOfferData.details?.current_value||0)/e*100}calculateMilestonePosition(e,t){return 1===t?"calc(100% - 18px)":`${Math.max(2,Math.min(95,(e+1)/t*100-8/t))}%`}getMilestoneStyles(e,t,r){const i="rtl"===document.documentElement.dir,o=this.calculateMilestonePosition(t,r),s=e.name.length>6?"flex-end":"center";return{[i?"right":"left"]:o,alignItems:s,position:"absolute",transform:i?"translateX(50%)":"translateX(-50%)"}}getMilestoneIconStyles(e,t,r){return t?{color:e.text_color}:r?{color:"var(--color-primary)"}:{}}renderProgressBarBackground(e){return[t("div",{class:"s-tiered-offer-progress-bg"}),t("div",{class:"s-tiered-offer-progress-fill",style:{width:`${e}%`}})]}renderMilestoneIcon(e,r,i){const o=["s-tiered-offer-milestone-icon",r?"s-tiered-offer-milestone-active":"",i?"s-tiered-offer-milestone-completed":""].filter(Boolean).join(" ");return t("div",{class:o,style:this.getMilestoneIconStyles(e,r,i)},t("span",{innerHTML:e.icon}))}renderMilestoneName(e,r){return t("div",{class:"s-tiered-offer-milestone-name"},r&&t("span",{style:{color:e.text_color}},e.name))}renderMilestones(e,r){return t("div",{class:"s-tiered-offer-milestones-wrapper"},t("div",{class:1===r?"s-tiered-offer-single-milestone-justify-end":"s-tiered-offer-milestones"},this.tieredOfferData.tiers.map(((i,o)=>{const s=e>=i.threshold,n=i.tier_name===this.currentTier;return t("div",{class:"s-tiered-offer-milestone",style:this.getMilestoneStyles(i,o,r)},this.renderMilestoneIcon(i,n,s),this.renderMilestoneName(i,n))}))))}renderProgressBar(){const e=this.getProgressWidth(),r=this.tieredOfferData.tiers.length,i=this.apiOfferData.details?.current_value||0;return t("div",{class:"s-tiered-offer-progress-container"},t("div",{class:"s-tiered-offer-progress-wrapper"},this.renderProgressBarBackground(e),this.renderMilestones(i,r)))}renderTabs(){return t("div",{class:"s-tiered-offer-tabs-container"},t("div",{class:"s-tiered-offer-tab-headers"},this.tieredOfferData.tiers.map((e=>t("button",{class:"s-tiered-offer-tab-header "+(e.tier_name===this.activeTabTier?"s-tiered-offer-tab-active":""),onClick:()=>this.handleTabClick(e.tier_name)},t("span",null,e.name))))),t("div",{class:"s-tiered-offer-tab-content-wrapper"},(()=>{const e=s.findTierByName(this.tieredOfferData.tiers,this.activeTabTier);return e?t("div",{class:"s-tiered-offer-tab-content"},t("div",{class:"s-tiered-offer-tab-content-inner"},t("div",{class:"s-tiered-offer-discount-section"},t("p",{class:"s-tiered-offer-discount-title"},this.discountText," ",t("span",{innerHTML:e.discount})),t("p",{class:"s-tiered-offer-benefit-description"},this.benefitText," ",e.name)))):null})()))}render(){if(this.isLoading)return this.getLoadingSkeletonView();if(!this.canRender||!this.tieredOfferData)return null;const e=this.getCurrentTierData();return t(r,null,t("div",{class:"s-tiered-offer-container"},t("div",{class:"s-tiered-offer-header"},t("div",{class:"s-tiered-offer-header-content"},t("p",{class:"s-tiered-offer-program-title"},this.loyaltyProgramText),this.currentTier&&t("div",{class:"s-tiered-offer-current-tier-name-wrapper"},t("h2",{class:"s-tiered-offer-current-tier"},this.currentTierText," ",t("span",{class:"s-tiered-offer-tier-name"},e.name)),t("span",{innerHTML:e.icon})))),this.renderProgressBar(),this.renderTabs()))}};n.style="/*!twlt*/.s-tiered-offer-milestone-icon svg{color:currentColor}.s-tiered-offer-milestone-icon svg path{stroke:currentColor;fill:none}.s-tiered-offer-milestone-icon.s-tiered-offer-milestone-active svg path,.s-tiered-offer-milestone-icon.s-tiered-offer-milestone-completed svg path{fill:currentColor;stroke:none}.s-tiered-offer-milestone-icon.s-tiered-offer-milestone-active svg[fill=none] path,.s-tiered-offer-milestone-icon.s-tiered-offer-milestone-completed svg[fill=none] path{fill:none;stroke:currentColor}[dir=rtl] .s-tiered-offer-progress-wrapper .s-tiered-offer-progress-bg{transform:scaleX(-1)}[dir=rtl] .s-tiered-offer-progress-wrapper .s-tiered-offer-progress-fill{transform:scaleX(-1);left:auto}[dir=rtl] .flip-x{transform:scaleX(-1)}.visible{visibility:visible}.static{position:static}.fixed{position:fixed}.absolute{position:absolute}.hidden{display:none}.transform{transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.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-tiered-offer-container{position:relative;margin-bottom:1.25rem;width:100%;border-radius:0.5rem;--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1));padding:1rem;--tw-shadow:0 1px 2px 0 rgb(0 0 0 / 0.05);--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}@media (min-width: 640px){.s-tiered-offer-container{padding:1.25rem;padding-left:1.5rem;padding-right:1.5rem}}.s-tiered-offer-header{margin-bottom:1.5rem;display:flex;align-items:center;gap:0.75rem}.s-tiered-offer-header-content{flex:1 1 0%}.s-tiered-offer-current-tier-name-wrapper{display:flex;flex-direction:row;align-items:flex-start;gap:0.375rem}.s-tiered-offer-current-tier-name-wrapper h2{font-size:1.125rem;line-height:1.75rem}.s-tiered-offer-current-tier-name-wrapper svg{height:1.5rem;width:1.5rem}.s-tiered-offer-program-title{margin:0px;margin-bottom:0.5rem;--tw-text-opacity:1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.s-tiered-offer-program-title h2{font-size:1.125rem;line-height:1.75rem}.s-tiered-offer-current-tier{margin:0px;margin-bottom:0.375rem;font-weight:700}.s-tiered-offer-tier-name{font-weight:600;--tw-text-opacity:1;color:rgb(17 24 39 / var(--tw-text-opacity, 1))}.s-tiered-offer-progress-container{margin-top:1.5rem;margin-bottom:1rem}.s-tiered-offer-progress-wrapper{position:relative}.s-tiered-offer-progress-bg{position:absolute;top:0.5rem;left:1rem;right:1rem;height:1rem;border-radius:9999px;--tw-bg-opacity:1;background-color:rgb(229 231 235 / var(--tw-bg-opacity, 1))}.s-tiered-offer-progress-fill{position:absolute;top:0.5rem;height:1rem;border-radius:9999px;background-color:var(--color-primary);transition-property:all;transition-duration:500ms;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1)}.s-tiered-offer-milestones-wrapper{display:flex;justify-content:flex-end}.s-tiered-offer-milestones{position:relative;display:flex;height:3rem;width:100%;align-items:center;justify-content:space-between}.s-tiered-offer-single-milestone-justify-end{position:relative;display:flex;height:3rem;width:100%;align-items:center;justify-content:flex-end}.s-tiered-offer-milestone{display:flex;flex-direction:column;align-items:center}.s-tiered-offer-milestone-icon{position:relative;z-index:10;margin-top:0px;display:flex;height:2.25rem;width:2.25rem;align-items:center;justify-content:center;border-radius:0.75rem;border-width:2px;--tw-border-opacity:1;border-color:rgb(243 244 246 / var(--tw-border-opacity, 1));--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1));padding:0.25rem;--tw-text-opacity:1;color:rgb(107 114 128 / var(--tw-text-opacity, 1));--tw-shadow:0 1px 2px 0 rgb(0 0 0 / 0.05);--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);transition-property:all;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:300ms}.s-tiered-offer-milestone-icon span{display:flex;align-items:center;justify-content:center}.s-tiered-offer-milestone-icon svg{height:1.25rem;width:1.25rem;color:currentColor}.s-tiered-offer-milestone-name{margin-top:0.5rem;display:flex;height:1rem;align-items:center;justify-content:center}.s-tiered-offer-milestone-name span{text-align:center;font-size:0.875rem;line-height:1.25rem;font-weight:500}@media (min-width: 640px){.s-tiered-offer-milestone-name span{font-size:0.75rem;line-height:1rem}}.s-tiered-offer-tabs-container{margin-top:1rem}.s-tiered-offer-tab-headers{display:flex;gap:0.25rem;border-radius:0.375rem;border-width:1px;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1));--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1));padding:0.25rem}.s-tiered-offer-tab-header{display:flex;flex:1 1 0%;cursor:pointer;align-items:center;justify-content:center;border-radius:0.125rem;border-style:none;background-color:transparent;padding-top:0.625rem;padding-bottom:0.625rem;padding-left:0.75rem;padding-right:0.75rem;font-size:0.875rem;line-height:1.25rem;font-weight:500;--tw-text-opacity:1;color:rgb(75 85 99 / var(--tw-text-opacity, 1));transition-property:all;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:200ms}@media (min-width: 640px){.s-tiered-offer-tab-header{padding-top:0.5rem;padding-bottom:0.5rem;font-size:0.75rem;line-height:1rem}}.s-tiered-offer-tab-active{border-radius:0.375rem;background-color:var(--color-primary);--tw-text-opacity:1;color:rgb(255 255 255 / var(--tw-text-opacity, 1));--tw-shadow:0 1px 2px 0 rgb(0 0 0 / 0.05);--tw-shadow-colored:0 1px 2px 0 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-tiered-offer-tab-active:hover{background-color:var(--color-primary-dark);opacity:0.8}.s-tiered-offer-tab-content-wrapper{border-bottom-right-radius:0.375rem;border-bottom-left-radius:0.375rem;border-width:1px;border-top-width:0px;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1));--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.s-tiered-offer-tab-content{padding-left:1.5rem;padding-right:1.5rem}@media (min-width: 640px){.s-tiered-offer-tab-content{padding-left:1rem;padding-right:1rem}}.s-tiered-offer-tab-content.tab-hidden{display:none}.s-tiered-offer-tab-content-inner{padding-top:1rem}.s-tiered-offer-discount-section{margin-bottom:0.5rem}.s-tiered-offer-discount-title{margin:0px;margin-bottom:0.5rem;font-size:1rem;line-height:1.5rem;font-weight:700;--tw-text-opacity:1;color:rgb(17 24 39 / var(--tw-text-opacity, 1))}.s-tiered-offer-benefit-description{margin:0px;font-size:0.875rem;line-height:1.25rem;--tw-text-opacity:1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.s-tiered-offer-skeleton-wrapper{padding:1.25rem}.s-tiered-offer-skeleton-title{margin-bottom:0.75rem}.s-tiered-offer-skeleton-subtitle{margin-bottom:1.5rem}.s-tiered-offer-skeleton-progress{margin-bottom:1.25rem}";export{n as salla_tiered_offer}
|
|
4
|
+
import{r as e,h as t,H as r}from"./p-HRJpfiBN.js";var i;!function(e){e.PERCENTAGE="percentage",e.FIXED="fixed"}(i||(i={}));const o={staticIcons:['<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="40" height="40" color="#000000" fill="none">\n <path d="M13.7276 3.44418L15.4874 6.99288C15.7274 7.48687 16.3673 7.9607 16.9073 8.05143L20.0969 8.58575C22.1367 8.92853 22.6167 10.4206 21.1468 11.8925L18.6671 14.3927C18.2471 14.8161 18.0172 15.6327 18.1471 16.2175L18.8571 19.3125C19.417 21.7623 18.1271 22.71 15.9774 21.4296L12.9877 19.6452C12.4478 19.3226 11.5579 19.3226 11.0079 19.6452L8.01827 21.4296C5.8785 22.71 4.57865 21.7522 5.13859 19.3125L5.84851 16.2175C5.97849 15.6327 5.74852 14.8161 5.32856 14.3927L2.84884 11.8925C1.389 10.4206 1.85895 8.92853 3.89872 8.58575L7.08837 8.05143C7.61831 7.9607 8.25824 7.48687 8.49821 6.99288L10.258 3.44418C11.2179 1.51861 12.7777 1.51861 13.7276 3.44418Z" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path>\n</svg>','<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" color="#000000" fill="none">\n <path d="M3 12C7.5 12 12 7.5 12 3C12 7.5 16.5 12 21 12C16.5 12 12 16.5 12 21C12 16.5 7.5 12 3 12Z" stroke="currentColor" stroke-width="1.5" stroke-linejoin="round"></path>\n <path d="M2 19.5C2.83333 19.5 4.5 17.8333 4.5 17C4.5 17.8333 6.16667 19.5 7 19.5C6.16667 19.5 4.5 21.1667 4.5 22C4.5 21.1667 2.83333 19.5 2 19.5Z" stroke="currentColor" stroke-width="1.5" stroke-linejoin="round"></path>\n <path d="M16 5C17 5 19 3 19 2C19 3 21 5 22 5C21 5 19 7 19 8C19 7 17 5 16 5Z" stroke="currentColor" stroke-width="1.5" stroke-linejoin="round"></path>\n</svg>','<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="40" height="40" color="#000000" fill="none">\n <path d="M14.2644 18.3717C14.5806 17.407 14.7387 16.9247 15.0616 16.593C15.215 16.4354 15.3932 16.3048 15.5887 16.2066C16.0003 16 16.5003 16 17.5002 16C18.5001 16 19.0001 16 19.4116 16.2066C19.6072 16.3048 19.7853 16.4354 19.9388 16.593C20.2617 16.9247 20.4198 17.407 20.736 18.3717L21.0624 19.3675C21.4561 20.5688 21.653 21.1694 21.3587 21.5847C21.0643 22 20.4418 22 19.1966 22H15.8038C14.5586 22 13.936 22 13.6417 21.5847C13.3473 21.1694 13.5442 20.5688 13.938 19.3675L14.2644 18.3717Z" stroke="currentColor" stroke-width="1.5"></path>\n <path d="M8.76421 10.3717C9.08041 9.40705 9.23851 8.92471 9.56143 8.59298C9.71485 8.43537 9.89299 8.3048 10.0885 8.20663C10.5001 8 11.0001 8 12 8C12.9999 8 13.4999 8 13.9115 8.20663C14.107 8.3048 14.2851 8.43537 14.4386 8.59298C14.7615 8.92471 14.9196 9.40705 15.2358 10.3717L15.5622 11.3675C15.956 12.5688 16.1528 13.1694 15.8585 13.5847C15.5642 14 14.9416 14 13.6964 14H10.3036C9.05842 14 8.43585 14 8.1415 13.5847C7.84716 13.1694 8.04404 12.5688 8.43779 11.3675L8.76421 10.3717Z" stroke="currentColor" stroke-width="1.5"></path>\n <path d="M3.26439 18.3717C3.58059 17.407 3.73869 16.9247 4.06162 16.593C4.21504 16.4354 4.39317 16.3048 4.58872 16.2066C5.00031 16 5.50027 16 6.50018 16C7.5001 16 8.00006 16 8.41165 16.2066C8.6072 16.3048 8.78533 16.4354 8.93875 16.593C9.26167 16.9247 9.41977 17.407 9.73597 18.3717L10.0624 19.3675C10.4561 20.5688 10.653 21.1694 10.3587 21.5847C10.0643 22 9.44176 22 8.19661 22H4.80375C3.5586 22 2.93603 22 2.64169 21.5847C2.34735 21.1694 2.54422 20.5688 2.93797 19.3675L3.26439 18.3717Z" stroke="currentColor" stroke-width="1.5"></path>\n <path d="M12 2V4M7.5 3.5L9 5M16.5 3.5L15 5" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"></path>\n</svg>','<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" color="#000000" fill="none">\n <path d="M5.78223 4.18192C6.43007 3.68319 6.754 3.43383 7.12788 3.27323C7.29741 3.20041 7.47367 3.14158 7.65459 3.09741C8.0536 3 8.4767 3 9.32289 3H14.6771C15.5233 3 15.9464 3 16.3454 3.09741C16.5263 3.14158 16.7026 3.20041 16.8721 3.27323C17.246 3.43383 17.5699 3.68319 18.2178 4.18192C20.3644 5.83448 21.4378 6.66077 21.8057 7.73078C21.9694 8.20673 22.0305 8.70728 21.9858 9.20461C21.8852 10.3227 21.0379 11.346 19.3433 13.3925L15.3498 18.2153C13.8126 20.0718 13.044 21 12 21C10.956 21 10.1874 20.0718 8.65018 18.2153L4.65671 13.3925C2.96208 11.346 2.11476 10.3227 2.0142 9.20461C1.96947 8.70728 2.03064 8.20673 2.1943 7.73078C2.56224 6.66077 3.63557 5.83448 5.78223 4.18192Z" stroke="currentColor" stroke-width="1.5"></path>\n <path d="M10 8.5H14" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path>\n</svg>'],staticColors:["#993018","#444444","#D18F36","#315F9C"]};class s{static findTierByIndex(e,t){return e.find((e=>e.index===t))||null}static findTierByName(e,t){return e.find((e=>e.tier_name===t))||null}static getTierNameByIndex(e,t){return this.findTierByIndex(e,t)?.tier_name}static findCurrentTierIndex(e,t){if(!t)return 0;for(let r=t.length-1;r>=0;r--)if(e>=t[r].threshold)return t[r].index;return 0}}const n=class{constructor(t){e(this,t),this.currentTierIndex=0,this.canRender=!1,this.isLoading=!1,this.handleTabClick=e=>{this.activeTabTier=e},salla.lang.onLoaded((()=>{this.loyaltyProgramText=salla.lang.get("blocks.tiered_offer.program_title"),this.currentTierText=salla.lang.get("blocks.tiered_offer.current_tier"),this.discountText=salla.lang.get("blocks.tiered_offer.discount"),this.benefitText=salla.lang.get("blocks.tiered_offer.tier_description")}))}async componentWillLoad(){try{if(await salla.onReady(),!this.checkFeatureEnabled())return;if(!this.checkCartExists())return;this.isLoading=!0;const e=await this.fetchTieredOfferData();if(!e)return;this.initializeComponent(e)}catch(e){this.canRender=!1,salla.logger.warn("salla-tiered-offer:: ",e)}finally{this.isLoading=!1}}checkFeatureEnabled(){return salla.config.get("store.features")?.includes("tiered-offer")}checkCartExists(){return!!salla.storage.get("cart")?.summary?.count}validateCouponCompatibility(e,t){return!(t&&!e.details?.applied_with_coupon)}shouldHideForGuest(){return salla.config.isGuest()}shouldHideUntilThreshold(e,t){return!(!e?.hide_until_threshold||0!==t)}resolveTierName(e,t){return s.getTierNameByIndex(e,t)||""}async fetchTieredOfferData(){try{const{data:e}=await salla.api.cart.offers(),t=e.find((e=>"tiered_offer"===e.type));return t?this.validateCouponCompatibility(t,salla.storage.get("cart")?.coupon)?t:(this.canRender=!1,null):null}catch(e){throw e}}initializeComponent(e){this.apiOfferData=e,this.tieredOfferData=this.mapApiDataToTiers(this.apiOfferData),this.loyaltyProgramText=this.apiOfferData.title||this.loyaltyProgramText;const t=this.findCurrentTierIndex(this.apiOfferData.details?.current_value||0);this.shouldHideForGuest()||this.shouldHideUntilThreshold(this.apiOfferData.details,t)?this.canRender=!1:(this.currentTierIndex=t,this.currentTier=this.resolveTierName(this.tieredOfferData.tiers,t),this.activeTabTier=this.currentTier||this.tieredOfferData.tiers[0]?.tier_name,this.canRender=!0)}componentDidLoad(){salla.event.on("cart::updated",(async e=>{let t=null;try{t=await this.fetchTieredOfferData()}catch(e){return void salla.logger.warn("salla-tiered-offer:: ",e)}t&&(this.tieredOfferData?this.updateOfferValues(e,t):this.initializeComponent(t))}))}mapApiDataToTiers(e){const t=[...e.details.discounts].sort(((e,t)=>e.min_spend-t.min_spend)).map(((e,t)=>({name:e.name,tier_name:e.name,discount:e.type===i.PERCENTAGE?`${salla.helpers.number(e.value)}%`:salla.money(e.value),icon:o.staticIcons[t]||o.staticIcons[0],threshold:e.min_spend,text_color:o.staticColors[t],index:t+1})));return{current_tier:s.getTierNameByIndex(t,this.findCurrentTierIndex(e.details.current_value,t)),tiers:t}}findCurrentTierIndex(e,t=this.tieredOfferData?.tiers){return s.findCurrentTierIndex(e,t||[])}updateOfferValues(e,t){if(!t||!this.tieredOfferData)return;if(!t.details?.discounts?.length)return void(this.canRender=!1);if(!this.validateCouponCompatibility(t,e.coupon))return void(this.canRender=!1);if(this.shouldHideForGuest())return void(this.canRender=!1);const r=this.mapApiDataToTiers(t),i=this.findCurrentTierIndex(t.details?.current_value||0,r.tiers);if(this.shouldHideUntilThreshold(t.details,i))return void(this.canRender=!1);if(!1===t.details?.with_current_cart)return void(this.canRender=!0);this.apiOfferData=t,this.tieredOfferData=r,this.canRender=!0,this.currentTierIndex=i,this.currentTier=this.resolveTierName(r.tiers,i);const o=this.currentTier||r.tiers[0]?.tier_name;this.activeTabTier!==o&&(this.activeTabTier=o)}getLoadingSkeletonView(){return t(r,null,t("div",{class:"s-tiered-offer-container"},t("div",{class:"s-tiered-offer-skeleton-wrapper"},t("div",{class:"s-tiered-offer-skeleton-title"},t("salla-skeleton",{height:"16px",width:"40%"})),t("div",{class:"s-tiered-offer-skeleton-subtitle"},t("salla-skeleton",{height:"20px",width:"60%"})),t("div",{class:"s-tiered-offer-skeleton-progress"},t("salla-skeleton",{height:"16px",width:"100%"})),t("div",{class:"s-tiered-offer-skeleton-tabs"},t("salla-skeleton",{height:"50px",width:"100%"})))))}getCurrentTierData(){return s.findTierByIndex(this.tieredOfferData.tiers,this.currentTierIndex)||this.tieredOfferData.tiers[0]}getProgressWidth(){const e=this.tieredOfferData.tiers.length;return this.findCurrentTierIndex(this.apiOfferData.details?.current_value||0)/e*100}calculateMilestonePosition(e,t){return 1===t?"calc(100% - 18px)":`${Math.max(2,Math.min(95,(e+1)/t*100-8/t))}%`}getMilestoneStyles(e,t,r){const i="rtl"===document.documentElement.dir,o=this.calculateMilestonePosition(t,r),s=e.name.length>6?"flex-end":"center";return{[i?"right":"left"]:o,alignItems:s,position:"absolute",transform:i?"translateX(50%)":"translateX(-50%)"}}getMilestoneIconStyles(e,t,r){return t?{color:e.text_color}:r?{color:"var(--color-primary)"}:{}}renderProgressBarBackground(e){return[t("div",{class:"s-tiered-offer-progress-bg"}),t("div",{class:"s-tiered-offer-progress-fill",style:{width:`${e}%`}})]}renderMilestoneIcon(e,r,i){const o=["s-tiered-offer-milestone-icon",r?"s-tiered-offer-milestone-active":"",i?"s-tiered-offer-milestone-completed":""].filter(Boolean).join(" ");return t("div",{class:o,style:this.getMilestoneIconStyles(e,r,i)},t("span",{innerHTML:e.icon}))}renderMilestoneName(e,r){return t("div",{class:"s-tiered-offer-milestone-name"},r&&t("span",{style:{color:e.text_color}},e.name))}renderMilestones(e,r){return t("div",{class:"s-tiered-offer-milestones-wrapper"},t("div",{class:1===r?"s-tiered-offer-single-milestone-justify-end":"s-tiered-offer-milestones"},this.tieredOfferData.tiers.map(((i,o)=>{const s=e>=i.threshold,n=i.tier_name===this.currentTier;return t("div",{class:"s-tiered-offer-milestone",style:this.getMilestoneStyles(i,o,r)},this.renderMilestoneIcon(i,n,s),this.renderMilestoneName(i,n))}))))}renderProgressBar(){const e=this.getProgressWidth(),r=this.tieredOfferData.tiers.length,i=this.apiOfferData.details?.current_value||0;return t("div",{class:"s-tiered-offer-progress-container"},t("div",{class:"s-tiered-offer-progress-wrapper"},this.renderProgressBarBackground(e),this.renderMilestones(i,r)))}renderTabs(){return t("div",{class:"s-tiered-offer-tabs-container"},t("div",{class:"s-tiered-offer-tab-headers"},this.tieredOfferData.tiers.map((e=>t("button",{class:"s-tiered-offer-tab-header "+(e.tier_name===this.activeTabTier?"s-tiered-offer-tab-active":""),onClick:()=>this.handleTabClick(e.tier_name)},t("span",null,e.name))))),t("div",{class:"s-tiered-offer-tab-content-wrapper"},(()=>{const e=s.findTierByName(this.tieredOfferData.tiers,this.activeTabTier);return e?t("div",{class:"s-tiered-offer-tab-content"},t("div",{class:"s-tiered-offer-tab-content-inner"},t("div",{class:"s-tiered-offer-discount-section"},t("p",{class:"s-tiered-offer-discount-title"},this.discountText," ",t("span",{innerHTML:e.discount})),t("p",{class:"s-tiered-offer-benefit-description"},this.benefitText," ",e.name)))):null})()))}render(){if(this.isLoading)return this.getLoadingSkeletonView();if(!this.canRender||!this.tieredOfferData)return null;const e=this.getCurrentTierData();return t(r,null,t("div",{class:"s-tiered-offer-container"},t("div",{class:"s-tiered-offer-header"},t("div",{class:"s-tiered-offer-header-content"},t("p",{class:"s-tiered-offer-program-title"},this.loyaltyProgramText),this.currentTier&&t("div",{class:"s-tiered-offer-current-tier-name-wrapper"},t("h2",{class:"s-tiered-offer-current-tier"},this.currentTierText," ",t("span",{class:"s-tiered-offer-tier-name"},e.name)),t("span",{innerHTML:e.icon})))),this.renderProgressBar(),this.renderTabs()))}};n.style="/*!twlt*/.s-tiered-offer-milestone-icon svg{color:currentColor}.s-tiered-offer-milestone-icon svg path{stroke:currentColor;fill:none}.s-tiered-offer-milestone-icon.s-tiered-offer-milestone-active svg path,.s-tiered-offer-milestone-icon.s-tiered-offer-milestone-completed svg path{fill:currentColor;stroke:none}.s-tiered-offer-milestone-icon.s-tiered-offer-milestone-active svg[fill=none] path,.s-tiered-offer-milestone-icon.s-tiered-offer-milestone-completed svg[fill=none] path{fill:none;stroke:currentColor}[dir=rtl] .s-tiered-offer-progress-wrapper .s-tiered-offer-progress-bg{transform:scaleX(-1)}[dir=rtl] .s-tiered-offer-progress-wrapper .s-tiered-offer-progress-fill{transform:scaleX(-1);left:auto}[dir=rtl] .flip-x{transform:scaleX(-1)}.visible{visibility:visible}.static{position:static}.fixed{position:fixed}.absolute{position:absolute}.hidden{display:none}.transform{transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.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-tiered-offer-container{position:relative;margin-bottom:1.25rem;width:100%;border-radius:0.5rem;--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1));padding:1rem;--tw-shadow:0 1px 2px 0 rgb(0 0 0 / 0.05);--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}@media (min-width: 640px){.s-tiered-offer-container{padding:1.25rem;padding-left:1.5rem;padding-right:1.5rem}}.s-tiered-offer-header{margin-bottom:1.5rem;display:flex;align-items:center;gap:0.75rem}.s-tiered-offer-header-content{flex:1 1 0%}.s-tiered-offer-current-tier-name-wrapper{display:flex;flex-direction:row;align-items:flex-start;gap:0.375rem}.s-tiered-offer-current-tier-name-wrapper h2{font-size:1.125rem;line-height:1.75rem}.s-tiered-offer-current-tier-name-wrapper svg{height:1.5rem;width:1.5rem}.s-tiered-offer-program-title{margin:0px;margin-bottom:0.5rem;--tw-text-opacity:1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.s-tiered-offer-program-title h2{font-size:1.125rem;line-height:1.75rem}.s-tiered-offer-current-tier{margin:0px;margin-bottom:0.375rem;font-weight:700}.s-tiered-offer-tier-name{font-weight:600;--tw-text-opacity:1;color:rgb(17 24 39 / var(--tw-text-opacity, 1))}.s-tiered-offer-progress-container{margin-top:1.5rem;margin-bottom:1rem}.s-tiered-offer-progress-wrapper{position:relative}.s-tiered-offer-progress-bg{position:absolute;top:0.5rem;left:1rem;right:1rem;height:1rem;border-radius:9999px;--tw-bg-opacity:1;background-color:rgb(229 231 235 / var(--tw-bg-opacity, 1))}.s-tiered-offer-progress-fill{position:absolute;top:0.5rem;height:1rem;border-radius:9999px;background-color:var(--color-primary);transition-property:all;transition-duration:500ms;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1)}.s-tiered-offer-milestones-wrapper{display:flex;justify-content:flex-end}.s-tiered-offer-milestones{position:relative;display:flex;height:3rem;width:100%;align-items:center;justify-content:space-between}.s-tiered-offer-single-milestone-justify-end{position:relative;display:flex;height:3rem;width:100%;align-items:center;justify-content:flex-end}.s-tiered-offer-milestone{display:flex;flex-direction:column;align-items:center}.s-tiered-offer-milestone-icon{position:relative;z-index:10;margin-top:0px;display:flex;height:2.25rem;width:2.25rem;align-items:center;justify-content:center;border-radius:0.75rem;border-width:2px;--tw-border-opacity:1;border-color:rgb(243 244 246 / var(--tw-border-opacity, 1));--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1));padding:0.25rem;--tw-text-opacity:1;color:rgb(107 114 128 / var(--tw-text-opacity, 1));--tw-shadow:0 1px 2px 0 rgb(0 0 0 / 0.05);--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);transition-property:all;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:300ms}.s-tiered-offer-milestone-icon span{display:flex;align-items:center;justify-content:center}.s-tiered-offer-milestone-icon svg{height:1.25rem;width:1.25rem;color:currentColor}.s-tiered-offer-milestone-name{margin-top:0.5rem;display:flex;height:1rem;align-items:center;justify-content:center}.s-tiered-offer-milestone-name span{text-align:center;font-size:0.875rem;line-height:1.25rem;font-weight:500}@media (min-width: 640px){.s-tiered-offer-milestone-name span{font-size:0.75rem;line-height:1rem}}.s-tiered-offer-tabs-container{margin-top:1rem}.s-tiered-offer-tab-headers{display:flex;gap:0.25rem;border-radius:0.375rem;border-width:1px;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1));--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1));padding:0.25rem}.s-tiered-offer-tab-header{display:flex;flex:1 1 0%;cursor:pointer;align-items:center;justify-content:center;border-radius:0.125rem;border-style:none;background-color:transparent;padding-top:0.625rem;padding-bottom:0.625rem;padding-left:0.75rem;padding-right:0.75rem;font-size:0.875rem;line-height:1.25rem;font-weight:500;--tw-text-opacity:1;color:rgb(75 85 99 / var(--tw-text-opacity, 1));transition-property:all;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:200ms}@media (min-width: 640px){.s-tiered-offer-tab-header{padding-top:0.5rem;padding-bottom:0.5rem;font-size:0.75rem;line-height:1rem}}.s-tiered-offer-tab-active{border-radius:0.375rem;background-color:var(--color-primary);--tw-text-opacity:1;color:rgb(255 255 255 / var(--tw-text-opacity, 1));--tw-shadow:0 1px 2px 0 rgb(0 0 0 / 0.05);--tw-shadow-colored:0 1px 2px 0 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-tiered-offer-tab-active:hover{background-color:var(--color-primary-dark);opacity:0.8}.s-tiered-offer-tab-content-wrapper{border-bottom-right-radius:0.375rem;border-bottom-left-radius:0.375rem;border-width:1px;border-top-width:0px;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1));--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.s-tiered-offer-tab-content{padding-left:1.5rem;padding-right:1.5rem}@media (min-width: 640px){.s-tiered-offer-tab-content{padding-left:1rem;padding-right:1rem}}.s-tiered-offer-tab-content.tab-hidden{display:none}.s-tiered-offer-tab-content-inner{padding-top:1rem}.s-tiered-offer-discount-section{margin-bottom:0.5rem}.s-tiered-offer-discount-title{margin:0px;margin-bottom:0.5rem;font-size:1rem;line-height:1.5rem;font-weight:700;--tw-text-opacity:1;color:rgb(17 24 39 / var(--tw-text-opacity, 1))}.s-tiered-offer-benefit-description{margin:0px;font-size:0.875rem;line-height:1.25rem;--tw-text-opacity:1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.s-tiered-offer-skeleton-wrapper{padding:1.25rem}.s-tiered-offer-skeleton-title{margin-bottom:0.75rem}.s-tiered-offer-skeleton-subtitle{margin-bottom:1.5rem}.s-tiered-offer-skeleton-progress{margin-bottom:1.25rem}";export{n as salla_tiered_offer}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as t,h as e,c as r,a}from"./p-
|
|
4
|
+
import{r as t,h as e,c as r,a}from"./p-HRJpfiBN.js";const s=class{constructor(e){t(this,e),this.isSelected=!1}async getChild(){return{selected:this.selected.bind(this),unselect:this.unselect.bind(this),name:this.name}}unselect(){this.isSelected=!1}selected(){this.isSelected=!0}render(){return e("div",{key:"3107faffd358504438b464be5000682d403e1b22",class:{"s-tabs-content":!0,"s-tabs-content-selected":this.isSelected}},e("slot",{key:"e6fc9e480389b54f9e6e20a7c8ccdb880a4ee6d4"}))}};s.style="";const o=class{constructor(e){t(this,e),this.tabSelected=r(this,"tabSelected"),this.id=Math.random().toString(36).slice(2,10),this.activeClass=void 0,this.height=void 0,this.centered=!1,this.isSelected=!1}async getChild(){return{selected:this.selected.bind(this),unselect:this.unselect.bind(this),name:this.name,id:this.id}}unselect(){this.isSelected=!1}selected(){this.isSelected=!0}onClick(){this.getChild().then((t=>{this.tabSelected.emit(t)}))}render(){return[e("div",{key:"04bb51760a3e43aed1645cf724b90e21ee2631bf",class:{"s-tabs-header-item":!0,"s-tabs-bg-normal":!0,"s-tabs-active":this.isSelected},onClick:this.onClick.bind(this)},e("slot",{key:"c9d5fc5dbc0a45712c9aa5e03becc613590011ea"}))]}};o.style="";const i=class{constructor(e){t(this,e),this.backgroundColor=void 0,this.vertical=!1}componentWillLoad(){this.createGroup().then((()=>{const[t]=this.tabGroup;this.selectGroup(t)}))}onSelectedTab(t){const e=this.tabGroup.find((e=>e.header.id===t.detail.id));this.selectGroup(e)}async createGroup(){const t=Array.from(this.host.querySelectorAll("salla-tab-header"));this.tabsHeader=await Promise.all(t.map((async t=>await t.getChild())));const e=Array.from(this.host.querySelectorAll("salla-tab-content"));this.tabsContent=await Promise.all(e.map((async t=>await t.getChild()))),this.tabGroup=this.tabsHeader.map((t=>{const e=this.tabsContent.find((e=>e.name===t.name));return{header:t,content:e}}))}selectGroup(t){this.tabGroup.map((t=>{t.header.unselect(),t.content.unselect()})),t.header.selected(),t.content.selected()}render(){return[e("div",{key:"de6455b0d68cb3e174771ad7be1bc95141d61df1",class:"s-tabs"},e("div",{key:"57c21f00a709723fa0be789f388b3defb391bcb2",class:"s-tabs-header"},e("slot",{key:"b5107fab289f9d7c661ddd7c4cfea4795eb7bb19",name:"header"})),e("div",{key:"344d142adc8f6adbc70baf4009e2d594fdbaea06",class:"s-tabs-content-wrapper"},e("slot",{key:"acd41f2ebb7120a2c043d17740e5fd4d2db95276",name:"content"})))]}get host(){return a(this)}};i.style='/*!twlt*/.s-tabs-header{-ms-overflow-style:none;scrollbar-width:none;}.s-tabs-header::-webkit-scrollbar{display:none}.flex{display:flex}.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-loyalty-program-rewards-container .s-tabs-content-wrapper{padding:0px}@media (min-width: 768px){.s-loyalty-program-rewards-container .s-tabs-content-wrapper{padding-top:1rem}}.s-loyalty-program-rewards-container .s-tabs-header{display:flex;align-items:center;justify-content:space-between;border-style:none}.s-loyalty-program-rewards-container .s-tabs-header div{order:1}.s-loyalty-program-rewards-container .s-tabs-header-item{position:relative;margin:0px;display:flex;width:max-content;align-items:center;justify-content:center;gap:0.5rem;border-radius:0.5rem;background-color:transparent;padding-top:0.5rem;padding-bottom:0.5rem;padding-left:1rem;padding-right:1rem;font-size:0.875rem;line-height:1.25rem;--tw-text-opacity:1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.s-loyalty-program-rewards-container .s-tabs-bg-normal{background-color:transparent;--tw-text-opacity:1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.s-loyalty-program-rewards-container-cart .s-tabs-bg-normal{background-color:transparent;--tw-text-opacity:1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.s-loyalty-program-rewards-container-cart .s-tabs-header-item{display:flex;width:max-content;align-items:center;justify-content:center;gap:0.5rem;padding-top:0.5rem;padding-bottom:0.5rem;padding-left:1rem;padding-right:1rem;font-size:0.875rem;line-height:1.25rem}.s-loyalty-program-rewards-container-cart .s-tabs-content-wrapper{padding:0px}.s-loyalty-program-rewards-container-cart .s-tabs-header{overflow-x:auto;border-bottom-width:1px;border-color:var(--color-primary-light);padding-left:1.25rem;padding-right:1.25rem}@media (min-width: 640px){.s-loyalty-program-rewards-container-cart .s-tabs-header{margin-left:1.25rem;margin-right:1.25rem;padding-left:0px;padding-right:0px}}.s-loyalty-program-rewards-container .s-tabs-active{background-color:var(--color-primary-light);--tw-text-opacity:1;color:rgb(17 24 39 / var(--tw-text-opacity, 1))}.s-loyalty-program-rewards-container-cart .s-tabs-active{background-color:var(--color-primary-light);--tw-text-opacity:1;color:rgb(17 24 39 / var(--tw-text-opacity, 1))}.s-loyalty-program-reward-details .s-tabs-header{margin-top:0.5rem;margin-bottom:0.5rem;margin-left:1rem;margin-right:1rem;display:flex}.s-loyalty-program-reward-details .s-tabs-header>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-right:calc(0.5rem * var(--tw-space-x-reverse));margin-left:calc(0.5rem * calc(1 - var(--tw-space-x-reverse)))}.s-loyalty-program-reward-details .s-tabs-header{border-style:none}@media (min-width: 768px){.s-loyalty-program-reward-details .s-tabs-header{margin-left:3rem;margin-right:3rem}}.s-loyalty-program-reward-details .s-tabs-header:where([dir="rtl"],[dir="rtl"] *)>:not([hidden])~:not([hidden]){--tw-space-x-reverse:1}.s-loyalty-program-reward-details .s-tabs-header-item{display:flex;width:max-content;align-items:center}.s-loyalty-program-reward-details .s-tabs-header-item>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-right:calc(0.5rem * var(--tw-space-x-reverse));margin-left:calc(0.5rem * calc(1 - var(--tw-space-x-reverse)))}.s-loyalty-program-reward-details .s-tabs-header-item{border-radius:9999px;padding-top:0.25rem;padding-bottom:0.25rem;padding-left:1rem;padding-right:1rem}.s-loyalty-program-reward-details .s-tabs-header-item:where([dir="rtl"],[dir="rtl"] *)>:not([hidden])~:not([hidden]){--tw-space-x-reverse:1}.s-loyalty-program-reward-details .s-tabs-bg-normal{background-color:transparent;--tw-text-opacity:1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.s-loyalty-program-reward-details .s-tabs-active{background-color:var(--color-primary-light);font-weight:700;--tw-text-opacity:1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.s-loyalty-program-reward-details .s-tabs-header-item span{font-size:0.75rem;line-height:1rem;--tw-text-opacity:1;color:rgb(31 41 55 / var(--tw-text-opacity, 1))}.s-loyalty-program-tabs-hider .s-tabs-header{border-style:none}.s-product-size-guide-wrapper .s-tabs-content{max-height:60vh;overflow:auto}@media (min-width: 768px){.s-product-size-guide-wrapper .s-tabs-content{max-height:70vh}}.s-tabs-bg-normal{--tw-bg-opacity:1;background-color:rgb(249 250 251 / var(--tw-bg-opacity, 1))}.s-tabs-header{display:flex;cursor:pointer;align-content:center;justify-content:flex-start}.s-tabs-header>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-right:calc(0.25rem * var(--tw-space-x-reverse));margin-left:calc(0.25rem * calc(1 - var(--tw-space-x-reverse)))}.s-tabs-header{overflow-x:auto;border-bottom-width:2px;border-color:var(--color-primary)}@media (min-width: 768px){.s-tabs-header{overflow-x:hidden}}.s-tabs-header:where([dir="rtl"],[dir="rtl"] *)>:not([hidden])~:not([hidden]){--tw-space-x-reverse:1}.s-tabs-header *{pointer-events:auto !important}.s-tabs-header-item{border-top-left-radius:0.5rem;border-top-right-radius:0.5rem;--tw-bg-opacity:1;background-color:rgb(229 231 235 / var(--tw-bg-opacity, 1));padding-top:0.5rem;padding-bottom:0.5rem;padding-left:0.75rem;padding-right:0.75rem;font-size:0.875rem;line-height:1.25rem}@media (min-width: 768px){.s-tabs-header-item{padding-left:1.75rem;padding-right:1.75rem}}.s-tabs-content{display:none}.s-tabs-content-wrapper{padding-top:0.75rem}.s-tabs-content-selected{display:block}.s-tabs-active{background-color:var(--color-primary);--tw-text-opacity:1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}';export{s as salla_tab_content,o as salla_tab_header,i as salla_tabs}
|