@salla.sa/twilight-components 2.14.452 → 2.14.453
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-CUDa4yzK.js → filepond-CI66KMVO.js} +1 -1
- package/dist/cjs/{filepond-plugin-file-poster-ZBZ4eV18.js → filepond-plugin-file-poster-CBGq8ES2.js} +1 -1
- package/dist/cjs/{filepond-plugin-file-validate-size-MuHAoRee.js → filepond-plugin-file-validate-size-Hsu_GUsE.js} +1 -1
- package/dist/cjs/{filepond-plugin-file-validate-type-YJnozwws.js → filepond-plugin-file-validate-type-CSvG7Q9E.js} +1 -1
- package/dist/cjs/{filepond-plugin-image-edit-DoGvWbfA.js → filepond-plugin-image-edit-DmkDmRS0.js} +1 -1
- package/dist/cjs/{filepond-plugin-image-exif-orientation-DHT3msJG.js → filepond-plugin-image-exif-orientation-GPV7AlAH.js} +1 -1
- package/dist/cjs/{filepond-plugin-image-preview-Cilr0qGC.js → filepond-plugin-image-preview-CnaFJEOv.js} +1 -1
- package/dist/cjs/{functions-BD36RfEv.js → functions-Bqin1z7b.js} +1 -1
- package/dist/cjs/{index-B3yg95Y_.js → index-BZVIkGyK.js} +1 -1
- package/dist/cjs/{index-D-llXlYu.js → index-gD7UGzCL.js} +2 -2
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/salla-accordion-body_2.cjs.entry.js +1 -1
- package/dist/cjs/salla-accordion_6.cjs.entry.js +1 -1
- package/dist/cjs/salla-add-product-button_5.cjs.entry.js +1 -1
- package/dist/cjs/salla-advertisement.cjs.entry.js +1 -1
- package/dist/cjs/salla-alert_2.cjs.entry.js +1 -1
- package/dist/cjs/salla-app-install-alert.cjs.entry.js +1 -1
- package/dist/cjs/salla-apps-icons.cjs.entry.js +1 -1
- package/dist/cjs/salla-badge.cjs.entry.js +1 -1
- package/dist/cjs/salla-booking-field_7.cjs.entry.js +10 -10
- package/dist/cjs/salla-bullet-delivery_2.cjs.entry.js +1 -1
- package/dist/cjs/salla-cart-coupons.cjs.entry.js +1 -1
- package/dist/cjs/salla-cart-item-offers_2.cjs.entry.js +1 -1
- package/dist/cjs/salla-cashback-banner.cjs.entry.js +1 -1
- package/dist/cjs/salla-comment-form_8.cjs.entry.js +1 -1
- package/dist/cjs/salla-conditional-offer.cjs.entry.js +1 -1
- package/dist/cjs/salla-contacts.cjs.entry.js +1 -1
- package/dist/cjs/salla-cookies-bar.cjs.entry.js +1 -1
- package/dist/cjs/salla-count-down.cjs.entry.js +1 -1
- package/dist/cjs/salla-custom-fields.cjs.entry.js +1 -1
- package/dist/cjs/salla-delivery-promise.cjs.entry.js +1 -1
- package/dist/cjs/salla-edit-order-button.cjs.entry.js +1 -1
- package/dist/cjs/salla-filters-widget.cjs.entry.js +1 -1
- package/dist/cjs/salla-filters.cjs.entry.js +1 -1
- package/dist/cjs/salla-fulfillment-methods.cjs.entry.js +1 -1
- package/dist/cjs/salla-gifting.cjs.entry.js +1 -1
- package/dist/cjs/salla-hook.cjs.entry.js +1 -1
- package/dist/cjs/salla-infinite-scroll.cjs.entry.js +1 -1
- package/dist/cjs/salla-installment.cjs.entry.js +1 -1
- package/dist/cjs/salla-list-tile.cjs.entry.js +1 -1
- package/dist/cjs/salla-localization-modal.cjs.entry.js +1 -1
- package/dist/cjs/salla-login-modal.cjs.entry.js +1 -1
- package/dist/cjs/salla-loyalty-banner.cjs.entry.js +2 -2
- package/dist/cjs/salla-loyalty-hero_2.cjs.entry.js +2 -2
- package/dist/cjs/salla-loyalty-panel.cjs.entry.js +3 -3
- package/dist/cjs/salla-loyalty-points-banner.cjs.entry.js +1 -1
- package/dist/cjs/salla-loyalty-prize-item.cjs.entry.js +1 -1
- package/dist/cjs/salla-loyalty-program.cjs.entry.js +3 -3
- package/dist/cjs/salla-loyalty-reward.cjs.entry.js +2 -2
- package/dist/cjs/salla-loyalty.cjs.entry.js +1 -1
- package/dist/cjs/salla-maintenance-alert.cjs.entry.js +1 -1
- package/dist/cjs/salla-map.cjs.entry.js +1 -1
- package/dist/cjs/salla-menu.cjs.entry.js +1 -1
- package/dist/cjs/salla-metadata.cjs.entry.js +1 -1
- package/dist/cjs/salla-multiple-bundle-product-cart_2.cjs.entry.js +1 -1
- package/dist/cjs/salla-multiple-bundle-product-options-modal_2.cjs.entry.js +1 -1
- package/dist/cjs/salla-multiple-bundle-product.cjs.entry.js +1 -1
- package/dist/cjs/salla-next-order-coupon.cjs.entry.js +1 -1
- package/dist/cjs/salla-notification-item.cjs.entry.js +1 -1
- package/dist/cjs/salla-notifications.cjs.entry.js +1 -1
- package/dist/cjs/salla-offer-modal.cjs.entry.js +1 -1
- package/dist/cjs/salla-offer.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-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-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_2.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-progress-bar.cjs.entry.js +1 -1
- package/dist/cjs/salla-quick-order.cjs.entry.js +1 -1
- package/dist/cjs/salla-rating-modal.cjs.entry.js +1 -1
- package/dist/cjs/salla-reward-action_4.cjs.entry.js +3 -3
- package/dist/cjs/salla-scopes.cjs.entry.js +1 -1
- package/dist/cjs/salla-search.cjs.entry.js +1 -1
- package/dist/cjs/salla-skeleton.cjs.entry.js +1 -1
- package/dist/cjs/salla-slider.cjs.entry.js +1 -1
- package/dist/cjs/salla-social-share.cjs.entry.js +1 -1
- package/dist/cjs/salla-social.cjs.entry.js +1 -1
- package/dist/cjs/salla-tab-content_3.cjs.entry.js +1 -1
- package/dist/cjs/salla-tiered-offer.cjs.entry.js +1 -1
- package/dist/cjs/salla-tooltip.cjs.entry.js +1 -1
- package/dist/cjs/salla-trust-badges.cjs.entry.js +1 -1
- package/dist/cjs/salla-user-menu.cjs.entry.js +1 -1
- package/dist/cjs/salla-user-profile.cjs.entry.js +1 -1
- package/dist/cjs/salla-user-settings.cjs.entry.js +1 -1
- package/dist/cjs/salla-verify.cjs.entry.js +1 -1
- package/dist/cjs/salla-wallet.cjs.entry.js +1 -1
- package/dist/cjs/{tracked-promise-XWqMedEM.js → tracked-promise-D-r7wmoZ.js} +1 -1
- package/dist/cjs/twilight.cjs.js +1 -1
- package/dist/cjs/{vanilla-picker-DuVcVt-y.js → vanilla-picker-Bls8gs8C.js} +1 -1
- package/dist/components/index.js +2 -2
- package/dist/esm/{filepond-B8YVLlGK.js → filepond-CA-bRwmz.js} +1 -1
- package/dist/esm/{filepond-plugin-file-poster-BVHkBLq8.js → filepond-plugin-file-poster-CGF3FiKD.js} +1 -1
- package/dist/esm/{filepond-plugin-file-validate-size-Cq7xe76f.js → filepond-plugin-file-validate-size-83VtyXAg.js} +1 -1
- package/dist/esm/{filepond-plugin-file-validate-type-CTsg2jzF.js → filepond-plugin-file-validate-type-DK5fI0Pp.js} +1 -1
- package/dist/esm/{filepond-plugin-image-edit-B_lgP65N.js → filepond-plugin-image-edit-DiW845Zb.js} +1 -1
- package/dist/esm/{filepond-plugin-image-exif-orientation-CiQmLZE0.js → filepond-plugin-image-exif-orientation-DuJRdepD.js} +1 -1
- package/dist/esm/{filepond-plugin-image-preview-DEDwRroB.js → filepond-plugin-image-preview-CE3Z4l9U.js} +1 -1
- package/dist/esm/{functions-BTVjvurG.js → functions-ByUw56nX.js} +1 -1
- package/dist/esm/{index-iyZKRGHO.js → index-CDZKvBjs.js} +1 -1
- package/dist/esm/{index-Dimo1ZpU.js → index-DuhQONDF.js} +2 -2
- package/dist/esm/loader.js +2 -2
- package/dist/esm/salla-accordion-body_2.entry.js +1 -1
- package/dist/esm/salla-accordion_6.entry.js +1 -1
- package/dist/esm/salla-add-product-button_5.entry.js +1 -1
- package/dist/esm/salla-advertisement.entry.js +1 -1
- package/dist/esm/salla-alert_2.entry.js +1 -1
- package/dist/esm/salla-app-install-alert.entry.js +1 -1
- package/dist/esm/salla-apps-icons.entry.js +1 -1
- package/dist/esm/salla-badge.entry.js +1 -1
- package/dist/esm/salla-booking-field_7.entry.js +10 -10
- package/dist/esm/salla-bullet-delivery_2.entry.js +1 -1
- package/dist/esm/salla-cart-coupons.entry.js +1 -1
- package/dist/esm/salla-cart-item-offers_2.entry.js +1 -1
- package/dist/esm/salla-cashback-banner.entry.js +1 -1
- package/dist/esm/salla-comment-form_8.entry.js +1 -1
- package/dist/esm/salla-conditional-offer.entry.js +1 -1
- package/dist/esm/salla-contacts.entry.js +1 -1
- package/dist/esm/salla-cookies-bar.entry.js +1 -1
- package/dist/esm/salla-count-down.entry.js +1 -1
- package/dist/esm/salla-custom-fields.entry.js +1 -1
- package/dist/esm/salla-delivery-promise.entry.js +1 -1
- package/dist/esm/salla-edit-order-button.entry.js +1 -1
- package/dist/esm/salla-filters-widget.entry.js +1 -1
- package/dist/esm/salla-filters.entry.js +1 -1
- package/dist/esm/salla-fulfillment-methods.entry.js +1 -1
- package/dist/esm/salla-gifting.entry.js +1 -1
- package/dist/esm/salla-hook.entry.js +1 -1
- package/dist/esm/salla-infinite-scroll.entry.js +1 -1
- package/dist/esm/salla-installment.entry.js +1 -1
- package/dist/esm/salla-list-tile.entry.js +1 -1
- package/dist/esm/salla-localization-modal.entry.js +1 -1
- package/dist/esm/salla-login-modal.entry.js +1 -1
- package/dist/esm/salla-loyalty-banner.entry.js +2 -2
- package/dist/esm/salla-loyalty-hero_2.entry.js +2 -2
- package/dist/esm/salla-loyalty-panel.entry.js +3 -3
- package/dist/esm/salla-loyalty-points-banner.entry.js +1 -1
- package/dist/esm/salla-loyalty-prize-item.entry.js +1 -1
- package/dist/esm/salla-loyalty-program.entry.js +3 -3
- package/dist/esm/salla-loyalty-reward.entry.js +2 -2
- package/dist/esm/salla-loyalty.entry.js +1 -1
- package/dist/esm/salla-maintenance-alert.entry.js +1 -1
- package/dist/esm/salla-map.entry.js +1 -1
- package/dist/esm/salla-menu.entry.js +1 -1
- package/dist/esm/salla-metadata.entry.js +1 -1
- package/dist/esm/salla-multiple-bundle-product-cart_2.entry.js +1 -1
- package/dist/esm/salla-multiple-bundle-product-options-modal_2.entry.js +1 -1
- package/dist/esm/salla-multiple-bundle-product.entry.js +1 -1
- package/dist/esm/salla-next-order-coupon.entry.js +1 -1
- package/dist/esm/salla-notification-item.entry.js +1 -1
- package/dist/esm/salla-notifications.entry.js +1 -1
- package/dist/esm/salla-offer-modal.entry.js +1 -1
- package/dist/esm/salla-offer.entry.js +1 -1
- package/dist/esm/salla-order-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-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_2.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-progress-bar.entry.js +1 -1
- package/dist/esm/salla-quick-order.entry.js +1 -1
- package/dist/esm/salla-rating-modal.entry.js +1 -1
- package/dist/esm/salla-reward-action_4.entry.js +3 -3
- package/dist/esm/salla-scopes.entry.js +1 -1
- package/dist/esm/salla-search.entry.js +1 -1
- package/dist/esm/salla-skeleton.entry.js +1 -1
- package/dist/esm/salla-slider.entry.js +1 -1
- package/dist/esm/salla-social-share.entry.js +1 -1
- package/dist/esm/salla-social.entry.js +1 -1
- package/dist/esm/salla-tab-content_3.entry.js +1 -1
- package/dist/esm/salla-tiered-offer.entry.js +1 -1
- package/dist/esm/salla-tooltip.entry.js +1 -1
- package/dist/esm/salla-trust-badges.entry.js +1 -1
- package/dist/esm/salla-user-menu.entry.js +1 -1
- package/dist/esm/salla-user-profile.entry.js +1 -1
- package/dist/esm/salla-user-settings.entry.js +1 -1
- package/dist/esm/salla-verify.entry.js +1 -1
- package/dist/esm/salla-wallet.entry.js +1 -1
- package/dist/esm/{tracked-promise-CvY0ZPlq.js → tracked-promise-D8BEggEx.js} +1 -1
- package/dist/esm/twilight.js +2 -2
- package/dist/esm/{vanilla-picker-DR-rCO7V.js → vanilla-picker-rczekglZ.js} +1 -1
- package/dist/twilight/{p-be39695f.entry.js → p-0372d190.entry.js} +1 -1
- package/dist/twilight/{p-965ca629.entry.js → p-08b7f768.entry.js} +1 -1
- package/dist/twilight/{p-b8eedf15.entry.js → p-0a4586ca.entry.js} +1 -1
- package/dist/twilight/{p-99299763.entry.js → p-1017e250.entry.js} +1 -1
- package/dist/twilight/{p-615626cd.entry.js → p-11747cf8.entry.js} +1 -1
- package/dist/twilight/{p-1af6d934.entry.js → p-15682643.entry.js} +1 -1
- package/dist/twilight/{p-a1c2765d.entry.js → p-18c8c629.entry.js} +1 -1
- package/dist/twilight/{p-75f69c89.entry.js → p-1aee25ae.entry.js} +1 -1
- package/dist/twilight/{p-a86e5802.entry.js → p-2007425d.entry.js} +1 -1
- package/dist/twilight/{p-a1add8d1.entry.js → p-2170acb4.entry.js} +1 -1
- package/dist/twilight/{p-b4a2e25b.entry.js → p-26d213c4.entry.js} +1 -1
- package/dist/twilight/{p-f870a5da.entry.js → p-273d6a6e.entry.js} +1 -1
- package/dist/twilight/{p-5d44c12a.entry.js → p-2786dded.entry.js} +1 -1
- package/dist/twilight/{p-bd2364b9.entry.js → p-2a6c1741.entry.js} +1 -1
- package/dist/twilight/{p-884a8742.entry.js → p-2c2939d4.entry.js} +1 -1
- package/dist/twilight/{p-8f9cf7be.entry.js → p-2fbde35a.entry.js} +1 -1
- package/dist/twilight/{p-4e90d0fb.entry.js → p-34f6ae6d.entry.js} +1 -1
- package/dist/twilight/{p-81741aef.entry.js → p-372157de.entry.js} +1 -1
- package/dist/twilight/{p-43a4763b.entry.js → p-37f80d28.entry.js} +1 -1
- package/dist/twilight/{p-16339bf0.entry.js → p-38a6f460.entry.js} +1 -1
- package/dist/twilight/{p-63e74f12.entry.js → p-3cbaa7f2.entry.js} +1 -1
- package/dist/twilight/{p-41db9b1a.entry.js → p-3d099804.entry.js} +1 -1
- package/dist/twilight/{p-ac57d9b4.entry.js → p-40951b40.entry.js} +1 -1
- package/dist/twilight/{p-e65d2899.entry.js → p-4304d8dc.entry.js} +1 -1
- package/dist/twilight/{p-bd36fa14.entry.js → p-453e4a72.entry.js} +1 -1
- package/dist/twilight/{p-642345d6.entry.js → p-45cd6429.entry.js} +1 -1
- package/dist/twilight/{p-d061531b.entry.js → p-47a3ce29.entry.js} +1 -1
- package/dist/twilight/{p-7f07b3db.entry.js → p-4d951693.entry.js} +1 -1
- package/dist/twilight/{p-6b1aeef4.entry.js → p-4de3236d.entry.js} +1 -1
- package/dist/twilight/{p-d288d199.entry.js → p-4f12e7c1.entry.js} +1 -1
- package/dist/twilight/p-528b8028.entry.js +4 -0
- package/dist/twilight/{p-cb7c5983.entry.js → p-54fb9654.entry.js} +1 -1
- package/dist/twilight/{p-de91804b.entry.js → p-576644de.entry.js} +1 -1
- package/dist/twilight/{p-cfa61a61.entry.js → p-58fdeedc.entry.js} +1 -1
- package/dist/twilight/{p-02189879.entry.js → p-59171f9a.entry.js} +1 -1
- package/dist/twilight/{p-1e2f547d.entry.js → p-5c918928.entry.js} +1 -1
- package/dist/twilight/{p-8f93bae7.entry.js → p-5d611546.entry.js} +1 -1
- package/dist/twilight/{p-df78511a.entry.js → p-5f11aa48.entry.js} +1 -1
- package/dist/twilight/{p-BLQ1h81p.js → p-5g_iyHqw.js} +1 -1
- package/dist/twilight/{p-4a242b08.entry.js → p-60816f61.entry.js} +1 -1
- package/dist/twilight/{p-8eb1ea0f.entry.js → p-67c261a1.entry.js} +1 -1
- package/dist/twilight/{p-63c68634.entry.js → p-67cc7166.entry.js} +1 -1
- package/dist/twilight/{p-2b1d0041.entry.js → p-69d44de0.entry.js} +1 -1
- package/dist/twilight/{p-6eb716e9.entry.js → p-6a0cf220.entry.js} +1 -1
- package/dist/twilight/{p-023b2fdd.entry.js → p-6fc8780f.entry.js} +1 -1
- package/dist/twilight/{p-6bc83d28.entry.js → p-6ff0931f.entry.js} +1 -1
- package/dist/twilight/{p-81288fd1.entry.js → p-71970ff4.entry.js} +1 -1
- package/dist/twilight/{p-90933152.entry.js → p-7538d1ca.entry.js} +1 -1
- package/dist/twilight/{p-6802c454.entry.js → p-759d043a.entry.js} +1 -1
- package/dist/twilight/{p-addd0fd8.entry.js → p-795a49f3.entry.js} +1 -1
- package/dist/twilight/{p-c5d58f7b.entry.js → p-799f30e2.entry.js} +1 -1
- package/dist/twilight/{p-a64332cc.entry.js → p-83e6fef8.entry.js} +1 -1
- package/dist/twilight/{p-7edf9c5f.entry.js → p-86c591e2.entry.js} +1 -1
- package/dist/twilight/{p-a7a021e1.entry.js → p-88b678c5.entry.js} +1 -1
- package/dist/twilight/{p-17b94783.entry.js → p-8abe7b8f.entry.js} +1 -1
- package/dist/twilight/{p-206e6265.entry.js → p-9ab434b1.entry.js} +1 -1
- package/dist/twilight/{p-1b859261.entry.js → p-9ac8a7ac.entry.js} +1 -1
- package/dist/twilight/{p-DNGUZSFZ.js → p-B3G9rfPC.js} +1 -1
- package/dist/twilight/{p-Dxrx9S2J.js → p-BKFpjRDB.js} +1 -1
- package/dist/twilight/{p-C_of-n0U.js → p-BsgWQKc7.js} +1 -1
- package/dist/twilight/{p-C6CshMy7.js → p-C4dBxoYB.js} +1 -1
- package/dist/twilight/{p-ESYTDRNV.js → p-CGfi0Jw5.js} +1 -1
- package/dist/twilight/{p-JpkF-q4E.js → p-Cy7YnDlp.js} +1 -1
- package/dist/twilight/{p-Dd4Vpmci.js → p-D6K__xxx.js} +1 -1
- package/dist/twilight/{p-fUqHHnkG.js → p-Dl_ZiF1l.js} +1 -1
- package/dist/twilight/{p-D70qx2vr.js → p-DmbvyZsW.js} +1 -1
- package/dist/twilight/{p-Dimo1ZpU.js → p-DuhQONDF.js} +1 -1
- package/dist/twilight/{p-46039e28.entry.js → p-a0d7c935.entry.js} +1 -1
- package/dist/twilight/{p-60b9640d.entry.js → p-a4541cb8.entry.js} +1 -1
- package/dist/twilight/{p-453e432c.entry.js → p-a652277b.entry.js} +1 -1
- package/dist/twilight/{p-cf518897.entry.js → p-a66afb4d.entry.js} +1 -1
- package/dist/twilight/{p-4523e5c0.entry.js → p-a91f1358.entry.js} +1 -1
- package/dist/twilight/{p-5088b883.entry.js → p-ac41b9ff.entry.js} +1 -1
- package/dist/twilight/{p-74bb0829.entry.js → p-ae0bdaad.entry.js} +1 -1
- package/dist/twilight/{p-0d1154bf.entry.js → p-b06aab6f.entry.js} +1 -1
- package/dist/twilight/{p-bc324586.entry.js → p-b6f8c8c1.entry.js} +1 -1
- package/dist/twilight/{p-9c2d73d6.entry.js → p-b7756fec.entry.js} +1 -1
- package/dist/twilight/p-bJly2Q9f.js +4 -0
- package/dist/twilight/{p-0f6b0f92.entry.js → p-c0ad861a.entry.js} +1 -1
- package/dist/twilight/{p-4901594b.entry.js → p-c826dc76.entry.js} +1 -1
- package/dist/twilight/{p-266aa19a.entry.js → p-c95c6d89.entry.js} +1 -1
- package/dist/twilight/{p-48da0c37.entry.js → p-ca4473c0.entry.js} +1 -1
- package/dist/twilight/{p-b40525ea.entry.js → p-cacf40b0.entry.js} +1 -1
- package/dist/twilight/{p-653b4634.entry.js → p-cefb9ceb.entry.js} +1 -1
- package/dist/twilight/{p-bc633001.entry.js → p-d3976258.entry.js} +1 -1
- package/dist/twilight/{p-b5640db5.entry.js → p-d647e29f.entry.js} +1 -1
- package/dist/twilight/p-dcbd726f.entry.js +4 -0
- package/dist/twilight/{p-3e541136.entry.js → p-e0e40938.entry.js} +1 -1
- package/dist/twilight/{p-06ba7dd1.entry.js → p-e19fe246.entry.js} +1 -1
- package/dist/twilight/{p-6342b0a5.entry.js → p-e3736f87.entry.js} +1 -1
- package/dist/twilight/{p-b973cdeb.entry.js → p-f0012532.entry.js} +1 -1
- package/dist/twilight/{p-4d6914e5.entry.js → p-f2748268.entry.js} +1 -1
- package/dist/twilight/{p-02abc240.entry.js → p-f7adbf64.entry.js} +1 -1
- package/dist/twilight/{p-9612e6b1.entry.js → p-f7d53109.entry.js} +1 -1
- package/dist/twilight/{p-c2a09e77.entry.js → p-f8a71d06.entry.js} +1 -1
- package/dist/twilight/{p-ab456964.entry.js → p-f96e2074.entry.js} +1 -1
- package/dist/twilight/{p-8f197b19.entry.js → p-f96e6132.entry.js} +1 -1
- package/dist/twilight/{p-cc748f8d.entry.js → p-ff6e1a63.entry.js} +1 -1
- package/dist/twilight/twilight.esm.js +1 -1
- package/package.json +5 -5
- package/dist/twilight/p-98a1855a.entry.js +0 -4
- package/dist/twilight/p-D82DKoi_.js +0 -4
- package/dist/twilight/p-c19843de.entry.js +0 -4
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as a,c as e,h as s,H as r}from"./p-Dimo1ZpU.js";import{c as l,b as t,f as o}from"./p-D70qx2vr.js";import{S as c}from"./p-CXRKXFgT.js";import{S as d}from"./p-cgSL_BIo.js";import{S as i}from"./p-BZp0rKEO.js";import{S as n}from"./p-8Tsmrwno.js";import{T as y}from"./p-D82DKoi_.js";const p=class{constructor(s){a(this,s),this.actionClick=e(this,"actionClick"),this.isShopNow=a=>!!(salla.config.get("store.features")||[]).includes("loyalty-system-v2")&&"free_product"===a.key?.toLowerCase(),this.handleClick=a=>{salla.config.isGuest()?l((()=>salla.event.dispatch("login::open"))):this.actionClick.emit(a)}}render(){return s("div",{key:"95d6e753d49c7cb69e6f5e25ef6ccf3f916f4022",class:"s-loyalty-program-rewards-modal-action"},this.isShopNow(this.prize)?s("a",{href:this.prize.prize_url||salla.url.get(""),class:{"s-loyalty-program-rewards-action-base":!0,"s-loyalty-program-rewards-action-on":!0}},salla.lang.get("pages.loyalty_program.shop_now")):s("button",{onClick:this.handleClick,class:{"s-loyalty-program-rewards-action-base":!0,"s-loyalty-program-rewards-action-on":!0}},salla.lang.get("pages.loyalty_program.redeem_reward")))}};p.style="";const f=class{constructor(s){a(this,s),this.areaClick=e(this,"areaClick"),this.actionClick=e(this,"actionClick")}render(){return s(r,{key:"900a20618e1b3ce82778aa99715baf61689f3eee",class:"s-loyalty-program-reward-host"},s("div",{key:"95b326008c2799ee7d38b48bc57e0860a9386184",class:"s-loyalty-program-reward-container"},s("div",{key:"d846dc36fa4494ed9ac6152a982f18598936969f",onClick:a=>this.areaClick.emit(a),role:"button"},s("div",{key:"b8d23796827e4b07f6c271c50fa0e4aeb59f82fc",class:"s-loyalty-program-reward-img"},s("img",{key:"04a52401941d8a731e8d310397b1ad735bfe44db",alt:"",src:this.prize.image||salla.url.cdn("images/s-empty.png"),class:"s-loyalty-program-rewards-img"})),s("div",{key:"64fa967c98d615d7b16859c9d14b60e0c53fc5aa",class:"s-loyalty-program-reward-content"},s("div",{key:"bb8c34ce8f3bcec9599c87b56bea6abd793187df",class:"s-loyalty-program-reward-points"},s("salla-badge",{key:"f7d0a396cf754d1e8f9e8fddee53a7d545311148",size:"xs"},s("span",{key:"36f4e1ed873f1a231e2d5e51a2a8cc36bdcedfee",innerHTML:c}),s("span",{key:"638b3ecefbfcb424869987ab33478e67d9b5d9b8",class:"s-loyalty-program-rewards-points"},this.prize.cost_points," ",salla.lang.get("pages.loyalty_program.points")))),s("div",{key:"6f8386fccf201836d76a86e7fe5e6d3461bb5540",class:"s-loyalty-program-reward-title"},s("span",{key:"6d6692c44d6bac35da40108514471a3c56884d81"},this.prize.group_title)),s("div",{key:"6ad9ad90728ac7f882ff8db9cfadb5a6e12f3e25",class:"s-loyalty-program-reward-name"},s("div",{key:"ef4344c7cb67785a4cd66d36e303e40a610a5375",class:"s-loyalty-program-rewards-name",id:`prize-${this.prize.id}`},this.prize.name,this.prize.description?`: ${this.prize.description}`:"")))),s("div",{key:"5eee5a4f8b10cd790ce41e4a99d94f86bd26dd3b",class:"p-4"},s("slot",{key:"359d50033cdd3cce41901401bf0b75ba9c5aea1f",name:"action"},s("button",{key:"ea7aa1c5cd50937a27cef7580e508a1e3f8f852d",onClick:a=>this.actionClick.emit(a.detail),class:"s-loyalty-program-rewards-action-base s-loyalty-program-rewards-action-on"},salla.lang.get("pages.loyalty_program.show_reward"))))))}};f.style="";var m=function(a,e,s,r){var l,t=arguments.length,o=t<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,s):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(a,e,s,r);else for(var c=a.length-1;c>=0;c--)(l=a[c])&&(o=(t<3?l(o):t>3?l(e,s,o):l(e,s))||o);return t>3&&o&&Object.defineProperty(e,s,o),o};const g=(...a)=>a.map((a=>"s-loyalty-program-"+a)).join(" "),b=class{constructor(s){a(this,s),this.actionClick=e(this,"actionClick"),this.refreshKey=Date.now()}handlePrizeChange(){this.refreshKey=Date.now()}componentWillLoad(){"idle"===this.category.status&&this.category(),"idle"===this.brand.status&&this.brand()}getTermsAndConditions(){const a=Number((this.prize.order_minimum_amount||"0").split(".")[0])||0,e=Number((this.prize.coupon_maximum_amount||"0").split(".")[0])||0,s=[];return a&&s.push([salla.lang.get("pages.loyalty_program.order_minimum_amount"),`${a} ${salla.lang.get(`currency.${(salla.config.get("user.currency_code")||"").toLowerCase()}`)}`]),e&&s.push([salla.lang.get("pages.loyalty_program.coupon_maximum_amount"),`${e} ${salla.lang.get(`currency.${(salla.config.get("user.currency_code")||"").toLowerCase()}`)}`]),s}findItems(a){return a?.length?this.brand.data.concat(this.category.data).filter((e=>a.includes(e.id_))):[]}getIncludedItems(a,e){return a?.length?a:e?.length?this.findItems(e):[]}getProductIds(a){return a||[]}getItemsMarkers(a){return"both"===a?this.getItemsMarkers("included")+this.getItemsMarkers("excluded"):[this.prize[`${a}_product_ids`]?.length||0,this.prize[`${a}_brand_ids`]?.length||0,this.prize[`${a}_category_ids`]?.length||0].map(Boolean).map(Number).join("")}getItemsMarkersText(){if("FREE_SHIPPING"===this.prize.key)return salla.lang.get("pages.loyalty_program.redeem_for_free_shipping");switch(this.getItemsMarkers("included")){case"001":default:return salla.lang.get("pages.loyalty_program.redeem_on_specific_products");case"010":return salla.lang.get("pages.loyalty_program.redeem_on_specific_brands");case"100":return salla.lang.get("pages.loyalty_program.redeem_on_specific_categories");case"000":return salla.lang.get("pages.loyalty_program.redeem_on_all_products")}}getCategoriesJsx(a,e){return a.length?s("div",{class:g("reward-details-categories-wrapper")},s("div",{class:g("reward-details-categories")},s("h2",{class:g("reward-details-categories-heading")},e),s("ul",{class:g("reward-details-categories-list")},a.map((a=>s("li",null,s("a",{href:a.urls?.customer||a.url||a.lingual_urls?.[0],class:g("reward-details-categories-item")},s("span",{innerHTML:d}),s("span",{class:g("reward-details-categories-item-content")},a.name)))))))):""}getBrandsJsx(a,e){return a.length?s("div",{class:g("reward-details-items-brands","slider-arrows-edges")},s("div",null,s("h2",null,e),s("salla-slider",{id:`brands-${a.map((({id:a})=>a)).join("-")}`,"slider-config":'{"loop":false,"slidesPerView":"auto","spaceBetween":10}'},s("div",{slot:"items"},a.map((a=>s("a",{href:salla.url.get(t(a)),class:g("reward-brand-item")},s("img",{src:a.logo||salla.url.cdn("images/s-empty.png"),alt:""})))))))):""}getProductsJsx(a,e){return a?.length?s("div",{class:"s-loyalty-program-reward-details-items-products s-loyalty-program-slider-arrows-edges"},s("h2",null,e),s("salla-products-slider",{source:"selected",sourceValue:JSON.stringify(a),"slider-config":'{"loop":false,"slidesPerView":"auto","freeMode":true,"spaceBetween":0,"breakpoints":{"768":{"slidesPerView":3,"freeMode":false,"speed":300}}}'})):""}render(){const a=this.getTermsAndConditions();return s("div",{key:"280d646eff094c16596ca31ee57f4bd104958f8c",class:"s-loyalty-program-reward-modal"},s("div",{key:"a39d376f170684f754c4357dc64d02b5ffbb1ed2",class:"s-loyalty-program-points-modal-header"},s("h1",{key:"654e061c8852461a5248248ed2d95ef02a8a4711",class:"s-loyalty-program-points-modal-info"},salla.url.is_page("cart")?s("button",{class:"s-loyalty-program-back-btn",onClick:()=>l((()=>salla.event.dispatch("modal::open","loyalty-rewards-modal")))},s("span",{class:{"sicon-arrow-right":"rtl"===document.documentElement.getAttribute("dir"),"sicon-arrow-left":"ltr"===document.documentElement.getAttribute("dir")}})):"",this.prize.name)),s("div",{key:"8dce07ce81b0d6879efc0cba88523b6d3daf42bb",class:"s-loyalty-program-modal-scrollable-content"},s("div",{key:"f288d7483911af0bbc17a824ee4397ad0b3ef367",class:"s-loyalty-program-reward-details-header"},s("div",{key:"87686174a3a8c17558d0a97180cb4756a1edbefe",class:"s-loyalty-program-aspect-container"},s("img",{key:"31461e1503c50715f160e75cf7ffad59939fb93c",src:this.prize.image,alt:this.prize.name})),s("salla-badge",{key:"ed1fc08260885fa865279a9d2fc6af35c01e2bdc",size:"sm",bg:"light"},s("span",{key:"26eec953f9c5f3fa5aa118828faec50a4477e013",innerHTML:c}),s("span",{key:"db3bf908be0f28534e121da9e692d801d2ee6cf9",class:"s-loyalty-program-points-badge-points"},o(this.prize.cost_points)))),a.length?s("div",{class:"s-loyalty-program-terms-and-conditions"},s("h1",{class:"s-loyalty-program-terms-and-conditions-heading"},salla.lang.get("pages.loyalty_program.terms_and_conditions")),s("ul",{class:"s-loyalty-program-terms-and-conditions-list"},a.map((([a,e])=>s("li",{class:"s-loyalty-program-terms-and-conditions-item"},s("span",{class:"s-loyalty-program-terms-and-conditions-content"},a),s("span",{class:"s-loyalty-program-terms-and-conditions-content"},e)))))):"",s("div",{key:"bfdc4d22117ae86f3bb2140546b4b5a8ecd35f8e",class:"s-loyalty-program-reward-info-message"},s("h1",{key:"f03b30c0372fd83e4fa7815bbd76d307c6fbe3c1",class:"s-loyalty-program-reward-info-message-heading"},salla.lang.get("pages.loyalty_program.how_to_benefit_from_this_reward")),s("p",{key:"245acd0b8438230ff5d503e5819abb581f0ba14a",class:"s-loyalty-program-reward-info-message-content"},this.getItemsMarkersText())),"FREE_SHIPPING"===this.prize.key||"000000"===this.getItemsMarkers("both")?"":s("div",{class:"s-loyalty-program-reward-details"},s("salla-tabs",{key:this.refreshKey},"000"===this.getItemsMarkers("included")?"":[s("salla-tab-header",{slot:"header",name:"included",style:{display:"000"===this.getItemsMarkers("excluded")?"none":"block"}},s("span",{class:"s-loyalty-program-reward-details-tab-icon",innerHTML:i}),s("span",null,salla.lang.get("pages.loyalty_program.included"))),s("salla-tab-content",{slot:"content",name:"included"},s("div",{class:"s-loyalty-program-reward-details-items-wrapper"},this.getCategoriesJsx(this.getIncludedItems(this.prize.categories,this.prize.included_category_ids),salla.lang.get("pages.loyalty_program.included_categories")),this.getBrandsJsx(this.getIncludedItems(this.prize.brands,this.prize.included_brand_ids),salla.lang.get("pages.loyalty_program.included_brands")),this.getProductsJsx(this.getProductIds(this.prize.included_product_ids),salla.lang.get("pages.loyalty_program.included_products"))))],"000"===this.getItemsMarkers("excluded")?"":[s("salla-tab-header",{slot:"header",name:"excluded",style:{display:"000"===this.getItemsMarkers("included")?"none":"block"}},s("span",{class:"s-loyalty-program-reward-details-tab-icon",innerHTML:n}),s("span",null,salla.lang.get("pages.loyalty_program.excluded"))),s("salla-tab-content",{slot:"content",name:"excluded"},s("div",{class:"s-loyalty-program-reward-details-items-wrapper"},this.getCategoriesJsx(this.getIncludedItems(this.prize.excludedCategories,this.prize.excluded_category_ids),salla.lang.get("pages.loyalty_program.excluded_categories")),this.getBrandsJsx(this.getIncludedItems(this.prize.excludedBrands,this.prize.excluded_brand_ids),salla.lang.get("pages.loyalty_program.excluded_brands")),this.getProductsJsx(this.getProductIds(this.prize.excluded_product_ids),salla.lang.get("pages.loyalty_program.excluded_products"))))]))),s("salla-reward-action",{key:"e129546afde7da7fe66e250ce4de67d4523727be",onActionClick:a=>this.actionClick.emit(a.detail),prize:this.prize}))}static get watchers(){return{prize:["handlePrizeChange"]}}};m([y((async()=>(await salla.product.api.categories()).data),{initialData:[]})],b.prototype,"category",void 0),m([y((async()=>(await salla.api.request("/brands")).data),{initialData:[]})],b.prototype,"brand",void 0),b.style="";const h=class{constructor(e){a(this,e),this.productId=null}reset(a=0){setTimeout((()=>{l()}),a)}getApiErrorMessage(a){return a?.response?.data?.error?.message||a?.response?.data?.message||("string"==typeof a?a:null)||salla.lang.get("common.errors.error_occurred")}async handleConfirm(){try{await this.exchange(this.prize.id,null,this.productId),this.reset(300)}catch(a){salla.notify.error(this.getApiErrorMessage(a))}}handleCancel(){this.reset(0)}render(){return s(r,{key:"ceecba37884a11443b52b76dad69bd164b52b788"},s("div",{key:"598f185363b917969b9de0fb6a536884d6578c95",class:"s-loyalty-program-exchange-heading"},s("div",{key:"a2aa6b15d97533a973f7f2fb6a2cf517c147367d",class:"s-loyalty-program-circle-base s-loyalty-program-circle-size-xl s-loyalty-program-circle-variant-fill"},s("span",{key:"9745001d514643add62fe9a64df7fc2c0a694513",innerHTML:c})),s("h2",{key:"4819327aacc1307c0f75014d9faef50f55115289"},salla.lang.get("pages.loyalty_program.redeem_reward")),s("p",{key:"b39c99abcefb0f3baf609cd21049b083a115cdef"},salla.lang.get("pages.loyalty_program.redeem_confirmation")," ",s("span",{key:"50852d87c9686f66beddc7b0a0a3062f0ced1a61"},"(",this.prize.cost_points," ",salla.lang.get("pages.loyalty_program.point"),")")," ",salla.lang.get("pages.loyalty_program.for")," ",s("span",{key:"5a4baa0f02859ced6fdcf7ce77c31bf9b27c45e6"},"(",this.prize.name,")"))),s("div",{key:"b1f1067bd0f3a84231ac017f4b66a71277a5d209",class:"s-loyalty-program-exchange-btns"},s("button",{key:"7d4ce6c08fcac58290b364a0df55f8acb715d362",class:"s-loyalty-program-rewards-action-base s-loyalty-program-rewards-action-confirm",onClick:()=>this.handleConfirm()},s("span",{key:"ef1deb96c4bbb2843ae088b539848c15aacdb244",style:{opacity:"pending"!==this.exchange.status?"1":"0"}},salla.lang.get("common.elements.confirm")),s("span",{key:"0f949386c85d7544f7098e2bdc8c7ce4390c4383",class:"s-loyalty-program-exchange-loading",style:{opacity:"pending"===this.exchange.status?"1":"0"}},s("salla-loading",{key:"9cdfbfdc7ebfb2e1874f1956560dc464e4aa2a9f",color:"primary",size:24}))),s("button",{key:"79a2e8b44be5eb4b3ec5f1a285a8f4eba5324814",class:"s-loyalty-program-rewards-action-base s-loyalty-program-rewards-action-cancel",onClick:()=>this.handleCancel()},salla.lang.get("common.elements.cancel"))))}};(function(a,e,s,r){var l,t=arguments.length,o=t<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,s):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(a,e,s,r);else for(var c=a.length-1;c>=0;c--)(l=a[c])&&(o=(t<3?l(o):t>3?l(e,s,o):l(e,s))||o);t>3&&o&&Object.defineProperty(e,s,o)})([y((async(...a)=>await salla.loyalty.exchange(...a)))],h.prototype,"exchange",void 0),h.style="";export{p as salla_reward_action,f as salla_reward_card,b as salla_reward_details,h as salla_reward_exchange}
|
|
4
|
+
import{r as a,c as e,h as s,H as r}from"./p-DuhQONDF.js";import{c as l,b as t,f as o}from"./p-DmbvyZsW.js";import{S as c}from"./p-CXRKXFgT.js";import{S as d}from"./p-cgSL_BIo.js";import{S as i}from"./p-BZp0rKEO.js";import{S as n}from"./p-8Tsmrwno.js";import{T as y}from"./p-bJly2Q9f.js";const p=class{constructor(s){a(this,s),this.actionClick=e(this,"actionClick"),this.isShopNow=a=>!!(salla.config.get("store.features")||[]).includes("loyalty-system-v2")&&"free_product"===a.key?.toLowerCase(),this.handleClick=a=>{salla.config.isGuest()?l((()=>salla.event.dispatch("login::open"))):this.actionClick.emit(a)}}render(){return s("div",{key:"95d6e753d49c7cb69e6f5e25ef6ccf3f916f4022",class:"s-loyalty-program-rewards-modal-action"},this.isShopNow(this.prize)?s("a",{href:this.prize.prize_url||salla.url.get(""),class:{"s-loyalty-program-rewards-action-base":!0,"s-loyalty-program-rewards-action-on":!0}},salla.lang.get("pages.loyalty_program.shop_now")):s("button",{onClick:this.handleClick,class:{"s-loyalty-program-rewards-action-base":!0,"s-loyalty-program-rewards-action-on":!0}},salla.lang.get("pages.loyalty_program.redeem_reward")))}};p.style="";const f=class{constructor(s){a(this,s),this.areaClick=e(this,"areaClick"),this.actionClick=e(this,"actionClick")}render(){return s(r,{key:"900a20618e1b3ce82778aa99715baf61689f3eee",class:"s-loyalty-program-reward-host"},s("div",{key:"95b326008c2799ee7d38b48bc57e0860a9386184",class:"s-loyalty-program-reward-container"},s("div",{key:"d846dc36fa4494ed9ac6152a982f18598936969f",onClick:a=>this.areaClick.emit(a),role:"button"},s("div",{key:"b8d23796827e4b07f6c271c50fa0e4aeb59f82fc",class:"s-loyalty-program-reward-img"},s("img",{key:"04a52401941d8a731e8d310397b1ad735bfe44db",alt:"",src:this.prize.image||salla.url.cdn("images/s-empty.png"),class:"s-loyalty-program-rewards-img"})),s("div",{key:"64fa967c98d615d7b16859c9d14b60e0c53fc5aa",class:"s-loyalty-program-reward-content"},s("div",{key:"bb8c34ce8f3bcec9599c87b56bea6abd793187df",class:"s-loyalty-program-reward-points"},s("salla-badge",{key:"f7d0a396cf754d1e8f9e8fddee53a7d545311148",size:"xs"},s("span",{key:"36f4e1ed873f1a231e2d5e51a2a8cc36bdcedfee",innerHTML:c}),s("span",{key:"638b3ecefbfcb424869987ab33478e67d9b5d9b8",class:"s-loyalty-program-rewards-points"},this.prize.cost_points," ",salla.lang.get("pages.loyalty_program.points")))),s("div",{key:"6f8386fccf201836d76a86e7fe5e6d3461bb5540",class:"s-loyalty-program-reward-title"},s("span",{key:"6d6692c44d6bac35da40108514471a3c56884d81"},this.prize.group_title)),s("div",{key:"6ad9ad90728ac7f882ff8db9cfadb5a6e12f3e25",class:"s-loyalty-program-reward-name"},s("div",{key:"ef4344c7cb67785a4cd66d36e303e40a610a5375",class:"s-loyalty-program-rewards-name",id:`prize-${this.prize.id}`},this.prize.name,this.prize.description?`: ${this.prize.description}`:"")))),s("div",{key:"5eee5a4f8b10cd790ce41e4a99d94f86bd26dd3b",class:"p-4"},s("slot",{key:"359d50033cdd3cce41901401bf0b75ba9c5aea1f",name:"action"},s("button",{key:"ea7aa1c5cd50937a27cef7580e508a1e3f8f852d",onClick:a=>this.actionClick.emit(a.detail),class:"s-loyalty-program-rewards-action-base s-loyalty-program-rewards-action-on"},salla.lang.get("pages.loyalty_program.show_reward"))))))}};f.style="";var m=function(a,e,s,r){var l,t=arguments.length,o=t<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,s):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(a,e,s,r);else for(var c=a.length-1;c>=0;c--)(l=a[c])&&(o=(t<3?l(o):t>3?l(e,s,o):l(e,s))||o);return t>3&&o&&Object.defineProperty(e,s,o),o};const b=(...a)=>a.map((a=>"s-loyalty-program-"+a)).join(" "),g=class{constructor(s){a(this,s),this.actionClick=e(this,"actionClick"),this.refreshKey=Date.now()}handlePrizeChange(){this.refreshKey=Date.now()}componentWillLoad(){"idle"===this.category.status&&this.category(),"idle"===this.brand.status&&this.brand()}getTermsAndConditions(){const a=Number((this.prize.order_minimum_amount||"0").split(".")[0])||0,e=Number((this.prize.coupon_maximum_amount||"0").split(".")[0])||0,s=[];return a&&s.push([salla.lang.get("pages.loyalty_program.order_minimum_amount"),`${a} ${salla.lang.get(`currency.${(salla.config.get("user.currency_code")||"").toLowerCase()}`)}`]),e&&s.push([salla.lang.get("pages.loyalty_program.coupon_maximum_amount"),`${e} ${salla.lang.get(`currency.${(salla.config.get("user.currency_code")||"").toLowerCase()}`)}`]),s}findItems(a){return a?.length?this.brand.data.concat(this.category.data).filter((e=>a.includes(e.id_))):[]}getIncludedItems(a,e){return a?.length?a:e?.length?this.findItems(e):[]}getProductIds(a){return a||[]}getItemsMarkers(a){return"both"===a?this.getItemsMarkers("included")+this.getItemsMarkers("excluded"):[this.prize[`${a}_product_ids`]?.length||0,this.prize[`${a}_brand_ids`]?.length||0,this.prize[`${a}_category_ids`]?.length||0].map(Boolean).map(Number).join("")}getItemsMarkersText(){if("FREE_SHIPPING"===this.prize.key)return salla.lang.get("pages.loyalty_program.redeem_for_free_shipping");switch(this.getItemsMarkers("included")){case"001":default:return salla.lang.get("pages.loyalty_program.redeem_on_specific_products");case"010":return salla.lang.get("pages.loyalty_program.redeem_on_specific_brands");case"100":return salla.lang.get("pages.loyalty_program.redeem_on_specific_categories");case"000":return salla.lang.get("pages.loyalty_program.redeem_on_all_products")}}getCategoriesJsx(a,e){return a.length?s("div",{class:b("reward-details-categories-wrapper")},s("div",{class:b("reward-details-categories")},s("h2",{class:b("reward-details-categories-heading")},e),s("ul",{class:b("reward-details-categories-list")},a.map((a=>s("li",null,s("a",{href:a.urls?.customer||a.url||a.lingual_urls?.[0],class:b("reward-details-categories-item")},s("span",{innerHTML:d}),s("span",{class:b("reward-details-categories-item-content")},a.name)))))))):""}getBrandsJsx(a,e){return a.length?s("div",{class:b("reward-details-items-brands","slider-arrows-edges")},s("div",null,s("h2",null,e),s("salla-slider",{id:`brands-${a.map((({id:a})=>a)).join("-")}`,"slider-config":'{"loop":false,"slidesPerView":"auto","spaceBetween":10}'},s("div",{slot:"items"},a.map((a=>s("a",{href:salla.url.get(t(a)),class:b("reward-brand-item")},s("img",{src:a.logo||salla.url.cdn("images/s-empty.png"),alt:""})))))))):""}getProductsJsx(a,e){return a?.length?s("div",{class:"s-loyalty-program-reward-details-items-products s-loyalty-program-slider-arrows-edges"},s("h2",null,e),s("salla-products-slider",{source:"selected",sourceValue:JSON.stringify(a),"slider-config":'{"loop":false,"slidesPerView":"auto","freeMode":true,"spaceBetween":0,"breakpoints":{"768":{"slidesPerView":3,"freeMode":false,"speed":300}}}'})):""}render(){const a=this.getTermsAndConditions();return s("div",{key:"280d646eff094c16596ca31ee57f4bd104958f8c",class:"s-loyalty-program-reward-modal"},s("div",{key:"a39d376f170684f754c4357dc64d02b5ffbb1ed2",class:"s-loyalty-program-points-modal-header"},s("h1",{key:"654e061c8852461a5248248ed2d95ef02a8a4711",class:"s-loyalty-program-points-modal-info"},salla.url.is_page("cart")?s("button",{class:"s-loyalty-program-back-btn",onClick:()=>l((()=>salla.event.dispatch("modal::open","loyalty-rewards-modal")))},s("span",{class:{"sicon-arrow-right":"rtl"===document.documentElement.getAttribute("dir"),"sicon-arrow-left":"ltr"===document.documentElement.getAttribute("dir")}})):"",this.prize.name)),s("div",{key:"8dce07ce81b0d6879efc0cba88523b6d3daf42bb",class:"s-loyalty-program-modal-scrollable-content"},s("div",{key:"f288d7483911af0bbc17a824ee4397ad0b3ef367",class:"s-loyalty-program-reward-details-header"},s("div",{key:"87686174a3a8c17558d0a97180cb4756a1edbefe",class:"s-loyalty-program-aspect-container"},s("img",{key:"31461e1503c50715f160e75cf7ffad59939fb93c",src:this.prize.image,alt:this.prize.name})),s("salla-badge",{key:"ed1fc08260885fa865279a9d2fc6af35c01e2bdc",size:"sm",bg:"light"},s("span",{key:"26eec953f9c5f3fa5aa118828faec50a4477e013",innerHTML:c}),s("span",{key:"db3bf908be0f28534e121da9e692d801d2ee6cf9",class:"s-loyalty-program-points-badge-points"},o(this.prize.cost_points)))),a.length?s("div",{class:"s-loyalty-program-terms-and-conditions"},s("h1",{class:"s-loyalty-program-terms-and-conditions-heading"},salla.lang.get("pages.loyalty_program.terms_and_conditions")),s("ul",{class:"s-loyalty-program-terms-and-conditions-list"},a.map((([a,e])=>s("li",{class:"s-loyalty-program-terms-and-conditions-item"},s("span",{class:"s-loyalty-program-terms-and-conditions-content"},a),s("span",{class:"s-loyalty-program-terms-and-conditions-content"},e)))))):"",s("div",{key:"bfdc4d22117ae86f3bb2140546b4b5a8ecd35f8e",class:"s-loyalty-program-reward-info-message"},s("h1",{key:"f03b30c0372fd83e4fa7815bbd76d307c6fbe3c1",class:"s-loyalty-program-reward-info-message-heading"},salla.lang.get("pages.loyalty_program.how_to_benefit_from_this_reward")),s("p",{key:"245acd0b8438230ff5d503e5819abb581f0ba14a",class:"s-loyalty-program-reward-info-message-content"},this.getItemsMarkersText())),"FREE_SHIPPING"===this.prize.key||"000000"===this.getItemsMarkers("both")?"":s("div",{class:"s-loyalty-program-reward-details"},s("salla-tabs",{key:this.refreshKey},"000"===this.getItemsMarkers("included")?"":[s("salla-tab-header",{slot:"header",name:"included",style:{display:"000"===this.getItemsMarkers("excluded")?"none":"block"}},s("span",{class:"s-loyalty-program-reward-details-tab-icon",innerHTML:i}),s("span",null,salla.lang.get("pages.loyalty_program.included"))),s("salla-tab-content",{slot:"content",name:"included"},s("div",{class:"s-loyalty-program-reward-details-items-wrapper"},this.getCategoriesJsx(this.getIncludedItems(this.prize.categories,this.prize.included_category_ids),salla.lang.get("pages.loyalty_program.included_categories")),this.getBrandsJsx(this.getIncludedItems(this.prize.brands,this.prize.included_brand_ids),salla.lang.get("pages.loyalty_program.included_brands")),this.getProductsJsx(this.getProductIds(this.prize.included_product_ids),salla.lang.get("pages.loyalty_program.included_products"))))],"000"===this.getItemsMarkers("excluded")?"":[s("salla-tab-header",{slot:"header",name:"excluded",style:{display:"000"===this.getItemsMarkers("included")?"none":"block"}},s("span",{class:"s-loyalty-program-reward-details-tab-icon",innerHTML:n}),s("span",null,salla.lang.get("pages.loyalty_program.excluded"))),s("salla-tab-content",{slot:"content",name:"excluded"},s("div",{class:"s-loyalty-program-reward-details-items-wrapper"},this.getCategoriesJsx(this.getIncludedItems(this.prize.excludedCategories,this.prize.excluded_category_ids),salla.lang.get("pages.loyalty_program.excluded_categories")),this.getBrandsJsx(this.getIncludedItems(this.prize.excludedBrands,this.prize.excluded_brand_ids),salla.lang.get("pages.loyalty_program.excluded_brands")),this.getProductsJsx(this.getProductIds(this.prize.excluded_product_ids),salla.lang.get("pages.loyalty_program.excluded_products"))))]))),s("salla-reward-action",{key:"e129546afde7da7fe66e250ce4de67d4523727be",onActionClick:a=>this.actionClick.emit(a.detail),prize:this.prize}))}static get watchers(){return{prize:["handlePrizeChange"]}}};m([y((async()=>(await salla.product.api.categories()).data),{initialData:[]})],g.prototype,"category",void 0),m([y((async()=>(await salla.api.request("/brands")).data),{initialData:[]})],g.prototype,"brand",void 0),g.style="";const h=class{constructor(e){a(this,e),this.productId=null}reset(a=0){setTimeout((()=>{l()}),a)}getApiErrorMessage(a){return a?.response?.data?.error?.message||a?.response?.data?.message||("string"==typeof a?a:null)||salla.lang.get("common.errors.error_occurred")}async handleConfirm(){try{await this.exchange(this.prize.id,null,this.productId),this.reset(300)}catch(a){salla.notify.error(this.getApiErrorMessage(a))}}handleCancel(){this.reset(0)}render(){return s(r,{key:"ceecba37884a11443b52b76dad69bd164b52b788"},s("div",{key:"598f185363b917969b9de0fb6a536884d6578c95",class:"s-loyalty-program-exchange-heading"},s("div",{key:"a2aa6b15d97533a973f7f2fb6a2cf517c147367d",class:"s-loyalty-program-circle-base s-loyalty-program-circle-size-xl s-loyalty-program-circle-variant-fill"},s("span",{key:"9745001d514643add62fe9a64df7fc2c0a694513",innerHTML:c})),s("h2",{key:"4819327aacc1307c0f75014d9faef50f55115289"},salla.lang.get("pages.loyalty_program.redeem_reward")),s("p",{key:"b39c99abcefb0f3baf609cd21049b083a115cdef"},salla.lang.get("pages.loyalty_program.redeem_confirmation")," ",s("span",{key:"50852d87c9686f66beddc7b0a0a3062f0ced1a61"},"(",this.prize.cost_points," ",salla.lang.get("pages.loyalty_program.point"),")")," ",salla.lang.get("pages.loyalty_program.for")," ",s("span",{key:"5a4baa0f02859ced6fdcf7ce77c31bf9b27c45e6"},"(",this.prize.name,")"))),s("div",{key:"b1f1067bd0f3a84231ac017f4b66a71277a5d209",class:"s-loyalty-program-exchange-btns"},s("button",{key:"7d4ce6c08fcac58290b364a0df55f8acb715d362",class:"s-loyalty-program-rewards-action-base s-loyalty-program-rewards-action-confirm",onClick:()=>this.handleConfirm()},s("span",{key:"ef1deb96c4bbb2843ae088b539848c15aacdb244",style:{opacity:"pending"!==this.exchange.status?"1":"0"}},salla.lang.get("common.elements.confirm")),s("span",{key:"0f949386c85d7544f7098e2bdc8c7ce4390c4383",class:"s-loyalty-program-exchange-loading",style:{opacity:"pending"===this.exchange.status?"1":"0"}},s("salla-loading",{key:"9cdfbfdc7ebfb2e1874f1956560dc464e4aa2a9f",color:"primary",size:24}))),s("button",{key:"79a2e8b44be5eb4b3ec5f1a285a8f4eba5324814",class:"s-loyalty-program-rewards-action-base s-loyalty-program-rewards-action-cancel",onClick:()=>this.handleCancel()},salla.lang.get("common.elements.cancel"))))}};(function(a,e,s,r){var l,t=arguments.length,o=t<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,s):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(a,e,s,r);else for(var c=a.length-1;c>=0;c--)(l=a[c])&&(o=(t<3?l(o):t>3?l(e,s,o):l(e,s))||o);t>3&&o&&Object.defineProperty(e,s,o)})([y((async(...a)=>await salla.loyalty.exchange(...a)))],h.prototype,"exchange",void 0),h.style="";export{p as salla_reward_action,f as salla_reward_card,g as salla_reward_details,h as salla_reward_exchange}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as s,h as t,H as i}from"./p-
|
|
4
|
+
import{r as s,h as t,H as i}from"./p-DuhQONDF.js";const r=class{constructor(t){s(this,t),this.placeholderImage=salla.url.cdn("images/s-empty.png")}getProductImage(){return this.productDetails?.image?"string"==typeof this.productDetails.image?this.productDetails.image:this.productDetails.image.url||this.placeholderImage||salla.url.cdn("images/s-empty.png"):this.placeholderImage}getProductImageAlt(){return this.productDetails?.image&&"string"!=typeof this.productDetails.image?this.productDetails.image.alt||this.productDetails?.name||"":this.productDetails?.name||""}getAccordionId(){return`accordion-${this.productDetails?.id||"default"}`}getAccordionKey(){return this.productDetails?.id||"default"}shouldBeCollapsible(){return void 0!==this.collapsible?this.collapsible:this.productDetails?.options?.length>0}renderOptions(){return this.productDetails?.options?.length?t("salla-accordion-body",null,t("div",{class:"s-order-details-options"},t("salla-order-details-options",{options:this.productDetails.options}))):null}render(){if(!this.productDetails)return null;const s=this.shouldBeCollapsible();return t(i,{class:"s-order-details-bundle-wrapper"},t("salla-accordion",{key:this.getAccordionKey(),collapsed:!1,bordered:!0,collapsible:s,id:this.getAccordionId(),size:"sm"},t("salla-accordion-head",null,t("div",{class:"s-order-details-product"},t("div",{class:"s-order-details-product-content"},t("div",{class:"s-order-details-product-info"},t("div",{class:"s-order-details-product-image"},t("img",{src:this.getProductImage(),alt:this.getProductImageAlt()})),t("div",{class:"s-order-details-product-details"},t("a",{href:this.productDetails?.url||"#",class:"s-order-details-product-name"},this.productDetails?.name||""),this.productDetails?.quantity&&t("span",{class:"s-order-details-product-quantity"},"×",this.productDetails.quantity)))))),this.renderOptions()))}};r.style="";export{r as salla_order_details_multiple_bundle_product}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as s,h as t,H as i}from"./p-Dimo1ZpU.js";import{g as e,a,c as r,u as d,r as o,m as l,b as n,f as h,d as c,e as u,h as m,i as p}from"./p-C8xwacGT.js";import"./p-CoQJOPRz.js";const f=class{constructor(t){s(this,t),this.loading=!0,this.saveLoading=!1,this.payload={items:{update:[],remove:[],add:[]}},this.expired=!1,this.editPreview=null,this.productSearchQuery="",this.productsListKey=0,this.productsListSource="latest",this.productsListSourceValue="",this.selectedProductToAdd=null,this.addProductQuantity=1,this.addProductLoading=!1,this.addProductConfirmLoading=!1,this.mobileProductsModalMounted=!1,this.isMobileViewport=!1,this.isRTL=!0,this.mobileProductsListLoading=!1,this.confirming=!1,this.handleMobileProductSelected=s=>{s.stopPropagation(),this.handleProductSelected(s)},this.productsPanelMobileQuery="(max-width: 768px)",this.handleProductsPanelViewportChange=s=>{this.isMobileViewport=s.matches},this.hasProductTypeFilter=s=>{const t=s.indexOf("?"),i=(t>=0?s.slice(t+1):s).split("#")[0];return Array.from(new URLSearchParams(i)).some((([s,t])=>"product"===t&&/^filters\[types\](?:\[(?:\d*)\])?$/.test(s)))},this.hasExcludedCategoriesFilter=s=>{const t=s.indexOf("?"),i=(t>=0?s.slice(t+1):s).split("#")[0];return Array.from(new URLSearchParams(i)).some((([s])=>/^filters(?:\[|%5B)excluded_categories(?:\]|%5D)(?:\[|%5B)(?:\d*)(?:\]|%5D)$/.test(s)))},this.normalizeProductsListArrayParams=s=>s.replace(/(^|[?&])(includes|source_value|filters(?:\[|%5B)[^&=\]%]+?(?:\]|%5D))(\[|%5B)\d+(\]|%5D)(?==)/gi,((s,t,i,e,a)=>`${t}${i}${e}${a}`)),this.handleBeforeBuildListUrl=s=>{if("salla-order-edit-product-card"!==s.component?.productCardComponent||"string"!=typeof s.url)return;s.url=this.normalizeProductsListArrayParams(s.url),this.hasProductTypeFilter(s.url)||(s.url+=(s.url.includes("?")?"&":"?")+"filters[types][]=product");const t=this.getParsedExcludedCategories();if(t.length>0&&!this.hasExcludedCategoriesFilter(s.url)){const i=t.map((s=>`filters[excluded_categories][]=${encodeURIComponent(s)}`)).join("&");s.url+=`${s.url.includes("?")?"&":"?"}${i}`}},this.defaultProductsListSource="latest",this.debouncedProductSearch=salla.helpers.debounce((s=>this.applyProductSearch(s)),500),salla.onReady((()=>{this.isRTL=salla.config.get("theme.is_rtl",!0)}))}getParsedExcludedCategories(){if(!this.excludedCategories)return[];try{const s="string"==typeof this.excludedCategories?JSON.parse(this.excludedCategories):this.excludedCategories;return Array.isArray(s)?s.filter((s=>Number.isInteger(s)&&s>0)):[]}catch{return[]}}async componentWillLoad(){this.setupProductsPanelViewportQuery(),await salla.onReady(),this.unregisterBeforeBuildListUrlHook=salla.hooks.registerHook("salla-products-list","beforeBuildListUrl",this.handleBeforeBuildListUrl),this.loadFromProp(),this.startExpiryCheck()}disconnectedCallback(){clearInterval(this.expiryInterval),this.unregisterBeforeBuildListUrlHook?.(),this.productsPanelViewportQuery?.removeEventListener("change",this.handleProductsPanelViewportChange),this.mobileProductsModal?.removeEventListener("orderEditProductSelected",this.handleMobileProductSelected)}setupProductsPanelViewportQuery(){"undefined"!=typeof window&&"function"==typeof window.matchMedia&&(this.productsPanelViewportQuery=window.matchMedia(this.productsPanelMobileQuery),this.isMobileViewport=this.productsPanelViewportQuery.matches,this.productsPanelViewportQuery.addEventListener("change",this.handleProductsPanelViewportChange))}startExpiryCheck(){const s=this.order?.customer_editing_session?.ends_at;if(!s)return;const t=()=>new Date(`${s.replace(" ","T")}+03:00`).getTime()<=Date.now();t()?this.expired=!0:this.expiryInterval=setInterval((()=>{t()&&(this.expired=!0,clearInterval(this.expiryInterval))}),1e3)}loadFromProp(){try{if(!this.orderData)return void(this.error=salla.lang.getWithDefault("pages.orders.order_not_found","الطلب غير موجود"));const s="string"==typeof this.orderData?JSON.parse(this.orderData):this.orderData;this.order={...s,items:s.items.map((s=>({...s,selectedOptions:e(s)})))}}catch(s){this.error=salla.lang.getWithDefault("pages.orders.order_not_found","الطلب غير موجود")}finally{this.loading=!1}}applyProductSearch(s){const t=s?.trim()||"",i=t?"search":this.defaultProductsListSource,e="search"===i?JSON.stringify(t):"";this.productsListSource===i&&this.productsListSourceValue===e||(this.productsListSource=i,this.productsListSourceValue=e,this.productsListKey+=1)}handleProductSearch(s){const t=s.target?.value||"";this.productSearchQuery=t,this.debouncedProductSearch(t)}getProductsListKey(s){return`${s}-${this.productsListSource}-${this.productsListSourceValue}-${this.productsListKey}`}handleMobileProductsScroll(s){const t=s.currentTarget;if(t.scrollHeight-t.scrollTop-t.clientHeight>200||this.mobileProductsListLoading)return;const i=t.querySelector("salla-products-list");i&&(this.mobileProductsListLoading=!0,i.loadMore().finally((()=>{this.mobileProductsListLoading=!1})))}waitForNextFrame(){return new Promise((s=>requestAnimationFrame((()=>s(void 0)))))}async openMobileProductsModal(){this.mobileProductsModalMounted||(this.mobileProductsModalMounted=!0,await this.waitForNextFrame()),await(this.mobileProductsModal?.open?.())}setMobileProductsModal(s){this.mobileProductsModal!==s&&(this.mobileProductsModal?.removeEventListener("orderEditProductSelected",this.handleMobileProductSelected),this.mobileProductsModal=s,this.mobileProductsModal?.addEventListener("orderEditProductSelected",this.handleMobileProductSelected))}resetAddProductDrawer(){this.selectedProductToAdd=null,this.addProductQuantity=1,this.addProductLoading=!1,this.addProductConfirmLoading=!1,this.addProductOptions=null}getAddProductMaxQuantity(s=this.selectedProductToAdd){return a(s)}clampAddProductQuantity(s,t=this.selectedProductToAdd){return r(s,this.getAddProductMaxQuantity(t))}getApiErrorMessage(s){return s?.response?.data?.error?.message||s?.response?.data?.message}notifyApiError(s){const t=this.getApiErrorMessage(s);t&&salla.notify.error(t)}async validateAddProductOptions(){return!this.selectedProductToAdd?.options?.length||!!this.addProductOptions&&(await(this.addProductOptions.validateAndScroll?.())??await(this.addProductOptions.reportValidity?.())??!1)}updateLocalOrderItem(s,t,i,e){this.order={...this.order,items:d(this.order.items,s,t,i,e)}}removeLocalOrderItem(s){this.order={...this.order,items:o(this.order.items,s)}}setPayloadItems(s){this.payload={...this.payload,items:l(this.payload.items,s)}}handleAddProductQuantityChange(s){const t=s.detail,i=t?.quantity??parseInt(s.target?.value,10);isNaN(i)||i<1||(this.addProductQuantity=this.clampAddProductQuantity(i))}async handleProductSelected(s){const t=s.detail?.product;if(t?.id&&!this.addProductLoading){this.addProductLoading=!0;try{this.selectedProductToAdd=n(t),this.addProductQuantity=1,await(this.mobileProductsModal?.close?.()),await this.waitForNextFrame(),await(this.addProductDrawer?.open?.())}catch(s){this.notifyApiError(s)}finally{this.addProductLoading=!1}}}async confirmAddProduct(){if(this.selectedProductToAdd?.id&&!this.addProductConfirmLoading){this.addProductConfirmLoading=!0;try{const s=this.getAddProductMaxQuantity(),t=this.clampAddProductQuantity(this.addProductQuantity);t!==this.addProductQuantity&&(this.addProductQuantity=t);const i=this.addProductOptions;if(!await this.validateAddProductOptions())return void salla.notify.error(salla.lang.getWithDefault("common.messages.required_fields","يرجى تعبئة الحقول المطلوبة"));const e=await(i?.getSelectedOptionsData?.())||{},a=await(i?.getOptionsData?.())||this.selectedProductToAdd.options||[],d=h(this.order?.items,this.selectedProductToAdd.id,e);if(d){const i=r(d.quantity+t,s);return this.updateLocalOrderItem(d.id,i,a,e),this.setPayloadItems(d.isNew?{add:c(this.payload.items.add,d.id,i,e)}:{update:u(this.payload.items.update,d.id,i,e)}),void await(this.addProductDrawer?.close?.())}const o=m(this.selectedProductToAdd,t,a,e),l={itemId:o.id,product_id:this.selectedProductToAdd.id,quantity:t,options:e};this.order={...this.order,items:[...this.order.items,o]},this.setPayloadItems({add:[...this.payload.items.add,l]}),await(this.addProductDrawer?.close?.())}catch(s){this.notifyApiError(s)}finally{this.addProductConfirmLoading=!1}}}handleItemUpdated(s){if(!this.order)return;const{itemId:t,quantity:i,options:e,optionDefinitions:d}=s.detail,o=this.order.items.find((s=>s.id===t));if(!o)return;const l=r(i,a(o.product));if(o.isNew)return this.setPayloadItems({add:c(this.payload.items.add,t,l,e)}),void this.updateLocalOrderItem(t,l,d,e);this.setPayloadItems({update:u(this.payload.items.update,t,l,e??{})}),this.updateLocalOrderItem(t,l,d,e)}handleItemRemoved(s){if(!this.order)return;if(this.order.items.length<=1)return void salla.notify.error(salla.lang.getWithDefault("pages.orders.order_cannot_be_empty","لا يمكن إزالة جميع المنتجات من الطلب"));const{itemId:t}=s.detail,i=this.order.items.find((s=>s.id===t));if(i){if(i.isNew)return this.setPayloadItems({add:this.payload.items.add.filter((s=>s.itemId!==t))}),void this.removeLocalOrderItem(t);this.setPayloadItems({update:this.payload.items.update.filter((s=>s.id!==t)),remove:[...this.payload.items.remove,t]}),this.removeLocalOrderItem(t)}}get hasChanges(){return this.payload.items.update.length>0||this.payload.items.remove.length>0||this.payload.items.add.length>0}async saveOrder(){if(this.hasChanges){this.saveLoading=!0;try{const s=await salla.order.api.editOrder(this.orderId,p(this.payload));this.editPreview=s?.data?.data||s?.data,await(this.saveModal?.open?.())}catch(s){this.notifyApiError(s)}finally{this.saveLoading=!1}}}navigateToOrder(){const s=new URL(window.location.href);s.pathname=s.pathname.replace(/\/edit\/?$/,""),s.search="",window.location.href=s.href}handleConfirm(){this.confirming=!0,this.editPreview?.payment?.required&&this.editPreview.payment.payment_url?window.location.href=this.editPreview.payment.payment_url:this.navigateToOrder()}returnToOrderDetails(){this.confirming=!0,this.navigateToOrder()}getConfirmButtonIconClass(){return this.isRTL?"sicon-keyboard_arrow_left":"sicon-keyboard_arrow_right"}async cancelEditSession(){try{await salla.order.api.cancelEditSession(this.orderId),this.navigateToOrder()}catch(s){this.notifyApiError(s)}}renderProductsPanel(){const s=salla.lang.getWithDefault("pages.orders.add_product_to_order","أضف منتج للطلب");return t("section",{class:"s-order-edit-products-panel"},t("div",{class:"s-order-edit-products-header"},t("h2",{class:"s-order-edit-products-title"},s)),this.renderProductsPickerContent("panel"))}renderProductsPickerContent(s){return t("div",{class:{"s-order-edit-products-picker":!0,"s-order-edit-products-modal-content":"modal"===s}},t("label",{class:"s-order-edit-products-search"},t("i",{class:"sicon-search"}),t("input",{type:"search",class:"s-order-edit-products-search-input",placeholder:salla.lang.getWithDefault("pages.products.search_for_product","ابحث عن منتج"),value:this.productSearchQuery,onInput:s=>this.handleProductSearch(s)})),t("div",{class:"s-order-edit-products-list",onScroll:"modal"===s?s=>this.handleMobileProductsScroll(s):void 0},t("salla-products-list",{key:this.getProductsListKey(s),includes:["options"],source:this.productsListSource,"source-value":this.productsListSourceValue,autoload:!0,"product-card-component":"salla-order-edit-product-card"})))}renderMobileProductsModal(){return t("salla-modal",{ref:s=>this.setMobileProductsModal(s),width:"md",class:"s-order-edit-mobile-products-modal","modal-title":salla.lang.getWithDefault("pages.orders.add_product_to_order","أضف منتج للطلب"),onModalVisibilityChanged:s=>{s.detail||(this.mobileProductsModalMounted=!1)}},this.mobileProductsModalMounted?this.renderProductsPickerContent("modal"):null)}renderAddProductDrawer(){const s=this.selectedProductToAdd,i=s?.name||salla.lang.getWithDefault("common.elements.product","منتج"),e=s?.price,a=this.getAddProductMaxQuantity(s),r=s?`order-edit-add-${s.id}`:"order-edit-add",d={value:this.clampAddProductQuantity(this.addProductQuantity,s)};return a&&(d.max=a),t("salla-modal",{ref:s=>this.addProductDrawer=s,width:"md","modal-title":salla.lang.getWithDefault("pages.orders.add_product_to_order","أضف منتج للطلب"),onModalVisibilityChanged:s=>{s.detail||this.resetAddProductDrawer()}},t("div",{class:"s-order-edit-add-modal"},this.addProductLoading?t("div",{class:"s-order-edit-add-modal-loading"},t("salla-loading",null)):s?t("div",{class:"s-order-edit-add-modal-content"},t("div",{class:"s-order-edit-add-modal-header"},t("div",{class:"s-order-edit-add-modal-media"},s.image?.url&&t("img",{src:s.image.url,alt:s.image.alt||i,class:"s-order-edit-add-modal-image"}),t("div",{class:"s-order-edit-add-modal-details"},t("h3",{class:"s-order-edit-add-modal-name"},i),null!=e&&t("span",{class:"s-order-edit-add-modal-price",innerHTML:salla.money(e)})))),t("div",{class:"s-order-edit-add-modal-quantity"},t("h3",{class:"s-order-edit-add-modal-section-title"},salla.lang.getWithDefault("common.elements.quantity","الكمية")),t("div",{class:"s-order-edit-add-modal-quantity-input"},t("salla-quantity-input",{...d,onChange:s=>this.handleAddProductQuantityChange(s)}))),s.options?.length>0&&t("form",{onSubmit:s=>s.preventDefault()},t("salla-product-options",{ref:s=>this.addProductOptions=s,"product-id":s.id,"unique-key":r,options:JSON.stringify(s.options),key:`${r}-options`})),t("div",{class:"s-order-edit-add-modal-actions"},t("salla-button",{onClick:()=>this.confirmAddProduct(),loading:this.addProductConfirmLoading},salla.lang.getWithDefault("common.elements.confirm","تأكيد")),t("salla-button",{color:"gray",fill:"outline",onClick:()=>this.addProductDrawer?.close?.()},salla.lang.getWithDefault("common.elements.cancel","الغاء")))):null))}renderSaveModal(){const s=this.editPreview,i=s?.totals?.remaining_amount?.amount>0,e=s?.totals?.refund_amount?.amount>0,a=s?.totals?.tax?.amount?.amount;return t("salla-modal",{ref:s=>this.saveModal=s,width:"md",isClosable:!1,onModalVisibilityChanged:async s=>{s.detail||(this.editPreview=null,this.confirming||await this.cancelEditSession(),this.confirming=!1)}},t("div",{class:"s-order-edit-modal"},t("h2",{class:"s-order-edit-modal-title"},salla.lang.getWithDefault("pages.orders.edit_summary_title","ملخص الطلب بعد التعديل")),t("p",{class:"s-order-edit-modal-subtitle"},salla.lang.getWithDefault("pages.orders.cart_edits_saved","Your cart edits have been saved")),s?.items?.length>0&&t("div",{class:"s-order-edit-modal-items"},s.items.map((s=>{const i=this.order?.items?.find((t=>t.id==s.id)),e=i?.product?.image?.url,a=s.options?.join("/ ");return t("div",{class:"s-order-edit-modal-item"},t("div",{class:"s-order-edit-modal-item-start"},e&&t("img",{src:e,alt:s.name,class:"s-order-edit-modal-item-image"}),t("div",null,t("p",{class:"s-order-edit-modal-item-name"},s.name),a&&t("span",{class:"s-order-edit-modal-item-options"},a))),t("div",{class:"s-order-edit-modal-item-end"},t("span",{class:"s-order-edit-modal-item-quantity",dir:"ltr",innerHTML:s.quantity+" x "+s.price.amount}),t("span",{class:"s-order-edit-modal-item-price",innerHTML:salla.money(s.price.amount*s.quantity)})))}))),s?.totals?.updated_products_total&&t("div",{class:"s-order-edit-modal-row"},t("span",{class:"s-order-edit-modal-row-label"},salla.lang.getWithDefault("pages.orders.modified_products_total","مجموع المنتجات المعدلة")),t("span",{class:"s-order-edit-modal-row-value",innerHTML:salla.money(s.totals.updated_products_total.amount)})),a>0&&t("div",{class:"s-order-edit-modal-row"},t("span",{class:"s-order-edit-modal-tax-label"},t("i",{class:"sicon-info-circle s-order-edit-modal-tax-icon"}),salla.lang.getWithDefault("pages.orders.vat","ضريبة القيمة المضافة")),t("span",{class:"s-order-edit-modal-row-value",innerHTML:salla.money(a)})),s?.totals?.total&&t("div",{class:"s-order-edit-modal-total"},t("span",{class:"s-order-edit-modal-total-label"},salla.lang.getWithDefault("pages.orders.order_total","اجمالي الطلب")),t("span",{class:"s-order-edit-modal-total-value",innerHTML:salla.money(s.totals.total.amount)})),e&&t("div",{class:"s-order-edit-modal-refund"},t("i",{class:"sicon-info-circle s-order-edit-modal-refund-icon"}),t("p",{class:"s-order-edit-modal-refund-text"},salla.lang.getWithDefault("pages.orders.refund_message","سيتم تحويل فارق المبلغ على نفس وسيلة الدفع"))),t("div",{class:"s-order-edit-modal-btn-wrapper"},t("salla-button",{onClick:()=>this.handleConfirm()},i?salla.lang.getWithDefault("pages.orders.pay_difference","دفع فارق المبلغ"):e?salla.lang.getWithDefault("pages.orders.confirm_and_receive_difference","تأكيد واستلام فارق المبلغ"):salla.lang.getWithDefault("pages.orders.confirm_changes","تأكيد التعديلات"),t("i",{class:`${this.getConfirmButtonIconClass()} s-order-edit-modal-btn-icon`})),t("salla-button",{color:"gray",fill:"outline",onClick:()=>this.returnToOrderDetails()},salla.lang.getWithDefault("pages.orders.back_to_order_details","العودة إلى تفاصيل الطلب")))))}render(){if(this.loading)return t(i,null,t("salla-loading",null));if(this.expired)return t(i,null,t("div",{class:"s-order-edit-expired"},t("p",null,salla.lang.getWithDefault("pages.orders.edit_session_expired","انتهت مدة التعديل المتاحة")),t("salla-button",{onClick:()=>this.navigateToOrder()},salla.lang.getWithDefault("pages.orders.back_to_order","العودة إلى تفاصيل الطلب"))));if(this.error||!this.order)return t(i,null,t("div",{class:"s-order-edit-no-content-placeholder"},t("i",{class:"sicon-shopping-bag icon"}),t("p",null,this.error)));const s=this.order.items&&this.order.items.length>0,e=this.order.customer_editing_session?.ends_at;return t(i,null,e&&t("div",{class:"s-order-edit-timer-wrapper"},t("salla-count-down",{prefixText:salla.lang.getWithDefault("pages.orders.edit_within","يمكنك التعديل خلال"),date:e,horizontal:!0,withButton:!0,autoSegments:!0,labeled:!1,size:"sm",color:"primary"})),t("div",{class:"s-order-edit-layout"},this.isMobileViewport?null:this.renderProductsPanel(),t("section",{class:"s-order-edit-order-panel"},t("div",{class:"s-order-edit-items-wrapper"},t("h2",{class:"s-order-edit-items-title"},salla.lang.getWithDefault("pages.orders.order_products","منتجات الطلب")),s?this.order.items.map(((s,i)=>[t("salla-order-edit-item",{key:s.id,item:s,orderId:this.orderId}),i<this.order.items.length-1?t("div",{class:"s-order-edit-items-divider"}):null])):t("div",{class:"s-order-edit-no-content-placeholder"},t("i",{class:"sicon-shopping-bag icon"}),t("p",null,salla.lang.getWithDefault("common.elements.no_items","لا توجد عناصر")))),t("div",{class:"s-order-edit-actions"},t("salla-button",{class:"s-order-edit-mobile-products-trigger",color:"gray",size:"small",fill:"outline",onClick:()=>this.openMobileProductsModal()},t("i",{class:"sicon-add s-order-edit-mobile-products-trigger-icon"}),salla.lang.getWithDefault("pages.orders.add_product","إضافة منتج")),t("salla-button",{onClick:()=>this.saveOrder(),loading:this.saveLoading,size:"small",disabled:!this.hasChanges},salla.lang.getWithDefault("pages.orders.save_changes","حفظ التعديلات")),t("salla-button",{size:"small",color:"gray",fill:"outline",onClick:()=>this.cancelEditSession()},salla.lang.getWithDefault("common.elements.cancel","الغاء"))))),this.renderMobileProductsModal(),this.renderAddProductDrawer(),this.renderSaveModal())}};f.style=":host{display:block}";export{f as salla_order_edit}
|
|
4
|
+
import{r as s,h as t,H as i}from"./p-DuhQONDF.js";import{g as e,a,c as r,u as d,r as o,m as l,b as n,f as h,d as c,e as u,h as m,i as p}from"./p-C8xwacGT.js";import"./p-CoQJOPRz.js";const f=class{constructor(t){s(this,t),this.loading=!0,this.saveLoading=!1,this.payload={items:{update:[],remove:[],add:[]}},this.expired=!1,this.editPreview=null,this.productSearchQuery="",this.productsListKey=0,this.productsListSource="latest",this.productsListSourceValue="",this.selectedProductToAdd=null,this.addProductQuantity=1,this.addProductLoading=!1,this.addProductConfirmLoading=!1,this.mobileProductsModalMounted=!1,this.isMobileViewport=!1,this.isRTL=!0,this.mobileProductsListLoading=!1,this.confirming=!1,this.handleMobileProductSelected=s=>{s.stopPropagation(),this.handleProductSelected(s)},this.productsPanelMobileQuery="(max-width: 768px)",this.handleProductsPanelViewportChange=s=>{this.isMobileViewport=s.matches},this.hasProductTypeFilter=s=>{const t=s.indexOf("?"),i=(t>=0?s.slice(t+1):s).split("#")[0];return Array.from(new URLSearchParams(i)).some((([s,t])=>"product"===t&&/^filters\[types\](?:\[(?:\d*)\])?$/.test(s)))},this.hasExcludedCategoriesFilter=s=>{const t=s.indexOf("?"),i=(t>=0?s.slice(t+1):s).split("#")[0];return Array.from(new URLSearchParams(i)).some((([s])=>/^filters(?:\[|%5B)excluded_categories(?:\]|%5D)(?:\[|%5B)(?:\d*)(?:\]|%5D)$/.test(s)))},this.normalizeProductsListArrayParams=s=>s.replace(/(^|[?&])(includes|source_value|filters(?:\[|%5B)[^&=\]%]+?(?:\]|%5D))(\[|%5B)\d+(\]|%5D)(?==)/gi,((s,t,i,e,a)=>`${t}${i}${e}${a}`)),this.handleBeforeBuildListUrl=s=>{if("salla-order-edit-product-card"!==s.component?.productCardComponent||"string"!=typeof s.url)return;s.url=this.normalizeProductsListArrayParams(s.url),this.hasProductTypeFilter(s.url)||(s.url+=(s.url.includes("?")?"&":"?")+"filters[types][]=product");const t=this.getParsedExcludedCategories();if(t.length>0&&!this.hasExcludedCategoriesFilter(s.url)){const i=t.map((s=>`filters[excluded_categories][]=${encodeURIComponent(s)}`)).join("&");s.url+=`${s.url.includes("?")?"&":"?"}${i}`}},this.defaultProductsListSource="latest",this.debouncedProductSearch=salla.helpers.debounce((s=>this.applyProductSearch(s)),500),salla.onReady((()=>{this.isRTL=salla.config.get("theme.is_rtl",!0)}))}getParsedExcludedCategories(){if(!this.excludedCategories)return[];try{const s="string"==typeof this.excludedCategories?JSON.parse(this.excludedCategories):this.excludedCategories;return Array.isArray(s)?s.filter((s=>Number.isInteger(s)&&s>0)):[]}catch{return[]}}async componentWillLoad(){this.setupProductsPanelViewportQuery(),await salla.onReady(),this.unregisterBeforeBuildListUrlHook=salla.hooks.registerHook("salla-products-list","beforeBuildListUrl",this.handleBeforeBuildListUrl),this.loadFromProp(),this.startExpiryCheck()}disconnectedCallback(){clearInterval(this.expiryInterval),this.unregisterBeforeBuildListUrlHook?.(),this.productsPanelViewportQuery?.removeEventListener("change",this.handleProductsPanelViewportChange),this.mobileProductsModal?.removeEventListener("orderEditProductSelected",this.handleMobileProductSelected)}setupProductsPanelViewportQuery(){"undefined"!=typeof window&&"function"==typeof window.matchMedia&&(this.productsPanelViewportQuery=window.matchMedia(this.productsPanelMobileQuery),this.isMobileViewport=this.productsPanelViewportQuery.matches,this.productsPanelViewportQuery.addEventListener("change",this.handleProductsPanelViewportChange))}startExpiryCheck(){const s=this.order?.customer_editing_session?.ends_at;if(!s)return;const t=()=>new Date(`${s.replace(" ","T")}+03:00`).getTime()<=Date.now();t()?this.expired=!0:this.expiryInterval=setInterval((()=>{t()&&(this.expired=!0,clearInterval(this.expiryInterval))}),1e3)}loadFromProp(){try{if(!this.orderData)return void(this.error=salla.lang.getWithDefault("pages.orders.order_not_found","الطلب غير موجود"));const s="string"==typeof this.orderData?JSON.parse(this.orderData):this.orderData;this.order={...s,items:s.items.map((s=>({...s,selectedOptions:e(s)})))}}catch(s){this.error=salla.lang.getWithDefault("pages.orders.order_not_found","الطلب غير موجود")}finally{this.loading=!1}}applyProductSearch(s){const t=s?.trim()||"",i=t?"search":this.defaultProductsListSource,e="search"===i?JSON.stringify(t):"";this.productsListSource===i&&this.productsListSourceValue===e||(this.productsListSource=i,this.productsListSourceValue=e,this.productsListKey+=1)}handleProductSearch(s){const t=s.target?.value||"";this.productSearchQuery=t,this.debouncedProductSearch(t)}getProductsListKey(s){return`${s}-${this.productsListSource}-${this.productsListSourceValue}-${this.productsListKey}`}handleMobileProductsScroll(s){const t=s.currentTarget;if(t.scrollHeight-t.scrollTop-t.clientHeight>200||this.mobileProductsListLoading)return;const i=t.querySelector("salla-products-list");i&&(this.mobileProductsListLoading=!0,i.loadMore().finally((()=>{this.mobileProductsListLoading=!1})))}waitForNextFrame(){return new Promise((s=>requestAnimationFrame((()=>s(void 0)))))}async openMobileProductsModal(){this.mobileProductsModalMounted||(this.mobileProductsModalMounted=!0,await this.waitForNextFrame()),await(this.mobileProductsModal?.open?.())}setMobileProductsModal(s){this.mobileProductsModal!==s&&(this.mobileProductsModal?.removeEventListener("orderEditProductSelected",this.handleMobileProductSelected),this.mobileProductsModal=s,this.mobileProductsModal?.addEventListener("orderEditProductSelected",this.handleMobileProductSelected))}resetAddProductDrawer(){this.selectedProductToAdd=null,this.addProductQuantity=1,this.addProductLoading=!1,this.addProductConfirmLoading=!1,this.addProductOptions=null}getAddProductMaxQuantity(s=this.selectedProductToAdd){return a(s)}clampAddProductQuantity(s,t=this.selectedProductToAdd){return r(s,this.getAddProductMaxQuantity(t))}getApiErrorMessage(s){return s?.response?.data?.error?.message||s?.response?.data?.message}notifyApiError(s){const t=this.getApiErrorMessage(s);t&&salla.notify.error(t)}async validateAddProductOptions(){return!this.selectedProductToAdd?.options?.length||!!this.addProductOptions&&(await(this.addProductOptions.validateAndScroll?.())??await(this.addProductOptions.reportValidity?.())??!1)}updateLocalOrderItem(s,t,i,e){this.order={...this.order,items:d(this.order.items,s,t,i,e)}}removeLocalOrderItem(s){this.order={...this.order,items:o(this.order.items,s)}}setPayloadItems(s){this.payload={...this.payload,items:l(this.payload.items,s)}}handleAddProductQuantityChange(s){const t=s.detail,i=t?.quantity??parseInt(s.target?.value,10);isNaN(i)||i<1||(this.addProductQuantity=this.clampAddProductQuantity(i))}async handleProductSelected(s){const t=s.detail?.product;if(t?.id&&!this.addProductLoading){this.addProductLoading=!0;try{this.selectedProductToAdd=n(t),this.addProductQuantity=1,await(this.mobileProductsModal?.close?.()),await this.waitForNextFrame(),await(this.addProductDrawer?.open?.())}catch(s){this.notifyApiError(s)}finally{this.addProductLoading=!1}}}async confirmAddProduct(){if(this.selectedProductToAdd?.id&&!this.addProductConfirmLoading){this.addProductConfirmLoading=!0;try{const s=this.getAddProductMaxQuantity(),t=this.clampAddProductQuantity(this.addProductQuantity);t!==this.addProductQuantity&&(this.addProductQuantity=t);const i=this.addProductOptions;if(!await this.validateAddProductOptions())return void salla.notify.error(salla.lang.getWithDefault("common.messages.required_fields","يرجى تعبئة الحقول المطلوبة"));const e=await(i?.getSelectedOptionsData?.())||{},a=await(i?.getOptionsData?.())||this.selectedProductToAdd.options||[],d=h(this.order?.items,this.selectedProductToAdd.id,e);if(d){const i=r(d.quantity+t,s);return this.updateLocalOrderItem(d.id,i,a,e),this.setPayloadItems(d.isNew?{add:c(this.payload.items.add,d.id,i,e)}:{update:u(this.payload.items.update,d.id,i,e)}),void await(this.addProductDrawer?.close?.())}const o=m(this.selectedProductToAdd,t,a,e),l={itemId:o.id,product_id:this.selectedProductToAdd.id,quantity:t,options:e};this.order={...this.order,items:[...this.order.items,o]},this.setPayloadItems({add:[...this.payload.items.add,l]}),await(this.addProductDrawer?.close?.())}catch(s){this.notifyApiError(s)}finally{this.addProductConfirmLoading=!1}}}handleItemUpdated(s){if(!this.order)return;const{itemId:t,quantity:i,options:e,optionDefinitions:d}=s.detail,o=this.order.items.find((s=>s.id===t));if(!o)return;const l=r(i,a(o.product));if(o.isNew)return this.setPayloadItems({add:c(this.payload.items.add,t,l,e)}),void this.updateLocalOrderItem(t,l,d,e);this.setPayloadItems({update:u(this.payload.items.update,t,l,e??{})}),this.updateLocalOrderItem(t,l,d,e)}handleItemRemoved(s){if(!this.order)return;if(this.order.items.length<=1)return void salla.notify.error(salla.lang.getWithDefault("pages.orders.order_cannot_be_empty","لا يمكن إزالة جميع المنتجات من الطلب"));const{itemId:t}=s.detail,i=this.order.items.find((s=>s.id===t));if(i){if(i.isNew)return this.setPayloadItems({add:this.payload.items.add.filter((s=>s.itemId!==t))}),void this.removeLocalOrderItem(t);this.setPayloadItems({update:this.payload.items.update.filter((s=>s.id!==t)),remove:[...this.payload.items.remove,t]}),this.removeLocalOrderItem(t)}}get hasChanges(){return this.payload.items.update.length>0||this.payload.items.remove.length>0||this.payload.items.add.length>0}async saveOrder(){if(this.hasChanges){this.saveLoading=!0;try{const s=await salla.order.api.editOrder(this.orderId,p(this.payload));this.editPreview=s?.data?.data||s?.data,await(this.saveModal?.open?.())}catch(s){this.notifyApiError(s)}finally{this.saveLoading=!1}}}navigateToOrder(){const s=new URL(window.location.href);s.pathname=s.pathname.replace(/\/edit\/?$/,""),s.search="",window.location.href=s.href}handleConfirm(){this.confirming=!0,this.editPreview?.payment?.required&&this.editPreview.payment.payment_url?window.location.href=this.editPreview.payment.payment_url:this.navigateToOrder()}returnToOrderDetails(){this.confirming=!0,this.navigateToOrder()}getConfirmButtonIconClass(){return this.isRTL?"sicon-keyboard_arrow_left":"sicon-keyboard_arrow_right"}async cancelEditSession(){try{await salla.order.api.cancelEditSession(this.orderId),this.navigateToOrder()}catch(s){this.notifyApiError(s)}}renderProductsPanel(){const s=salla.lang.getWithDefault("pages.orders.add_product_to_order","أضف منتج للطلب");return t("section",{class:"s-order-edit-products-panel"},t("div",{class:"s-order-edit-products-header"},t("h2",{class:"s-order-edit-products-title"},s)),this.renderProductsPickerContent("panel"))}renderProductsPickerContent(s){return t("div",{class:{"s-order-edit-products-picker":!0,"s-order-edit-products-modal-content":"modal"===s}},t("label",{class:"s-order-edit-products-search"},t("i",{class:"sicon-search"}),t("input",{type:"search",class:"s-order-edit-products-search-input",placeholder:salla.lang.getWithDefault("pages.products.search_for_product","ابحث عن منتج"),value:this.productSearchQuery,onInput:s=>this.handleProductSearch(s)})),t("div",{class:"s-order-edit-products-list",onScroll:"modal"===s?s=>this.handleMobileProductsScroll(s):void 0},t("salla-products-list",{key:this.getProductsListKey(s),includes:["options"],source:this.productsListSource,"source-value":this.productsListSourceValue,autoload:!0,"product-card-component":"salla-order-edit-product-card"})))}renderMobileProductsModal(){return t("salla-modal",{ref:s=>this.setMobileProductsModal(s),width:"md",class:"s-order-edit-mobile-products-modal","modal-title":salla.lang.getWithDefault("pages.orders.add_product_to_order","أضف منتج للطلب"),onModalVisibilityChanged:s=>{s.detail||(this.mobileProductsModalMounted=!1)}},this.mobileProductsModalMounted?this.renderProductsPickerContent("modal"):null)}renderAddProductDrawer(){const s=this.selectedProductToAdd,i=s?.name||salla.lang.getWithDefault("common.elements.product","منتج"),e=s?.price,a=this.getAddProductMaxQuantity(s),r=s?`order-edit-add-${s.id}`:"order-edit-add",d={value:this.clampAddProductQuantity(this.addProductQuantity,s)};return a&&(d.max=a),t("salla-modal",{ref:s=>this.addProductDrawer=s,width:"md","modal-title":salla.lang.getWithDefault("pages.orders.add_product_to_order","أضف منتج للطلب"),onModalVisibilityChanged:s=>{s.detail||this.resetAddProductDrawer()}},t("div",{class:"s-order-edit-add-modal"},this.addProductLoading?t("div",{class:"s-order-edit-add-modal-loading"},t("salla-loading",null)):s?t("div",{class:"s-order-edit-add-modal-content"},t("div",{class:"s-order-edit-add-modal-header"},t("div",{class:"s-order-edit-add-modal-media"},s.image?.url&&t("img",{src:s.image.url,alt:s.image.alt||i,class:"s-order-edit-add-modal-image"}),t("div",{class:"s-order-edit-add-modal-details"},t("h3",{class:"s-order-edit-add-modal-name"},i),null!=e&&t("span",{class:"s-order-edit-add-modal-price",innerHTML:salla.money(e)})))),t("div",{class:"s-order-edit-add-modal-quantity"},t("h3",{class:"s-order-edit-add-modal-section-title"},salla.lang.getWithDefault("common.elements.quantity","الكمية")),t("div",{class:"s-order-edit-add-modal-quantity-input"},t("salla-quantity-input",{...d,onChange:s=>this.handleAddProductQuantityChange(s)}))),s.options?.length>0&&t("form",{onSubmit:s=>s.preventDefault()},t("salla-product-options",{ref:s=>this.addProductOptions=s,"product-id":s.id,"unique-key":r,options:JSON.stringify(s.options),key:`${r}-options`})),t("div",{class:"s-order-edit-add-modal-actions"},t("salla-button",{onClick:()=>this.confirmAddProduct(),loading:this.addProductConfirmLoading},salla.lang.getWithDefault("common.elements.confirm","تأكيد")),t("salla-button",{color:"gray",fill:"outline",onClick:()=>this.addProductDrawer?.close?.()},salla.lang.getWithDefault("common.elements.cancel","الغاء")))):null))}renderSaveModal(){const s=this.editPreview,i=s?.totals?.remaining_amount?.amount>0,e=s?.totals?.refund_amount?.amount>0,a=s?.totals?.tax?.amount?.amount;return t("salla-modal",{ref:s=>this.saveModal=s,width:"md",isClosable:!1,onModalVisibilityChanged:async s=>{s.detail||(this.editPreview=null,this.confirming||await this.cancelEditSession(),this.confirming=!1)}},t("div",{class:"s-order-edit-modal"},t("h2",{class:"s-order-edit-modal-title"},salla.lang.getWithDefault("pages.orders.edit_summary_title","ملخص الطلب بعد التعديل")),t("p",{class:"s-order-edit-modal-subtitle"},salla.lang.getWithDefault("pages.orders.cart_edits_saved","Your cart edits have been saved")),s?.items?.length>0&&t("div",{class:"s-order-edit-modal-items"},s.items.map((s=>{const i=this.order?.items?.find((t=>t.id==s.id)),e=i?.product?.image?.url,a=s.options?.join("/ ");return t("div",{class:"s-order-edit-modal-item"},t("div",{class:"s-order-edit-modal-item-start"},e&&t("img",{src:e,alt:s.name,class:"s-order-edit-modal-item-image"}),t("div",null,t("p",{class:"s-order-edit-modal-item-name"},s.name),a&&t("span",{class:"s-order-edit-modal-item-options"},a))),t("div",{class:"s-order-edit-modal-item-end"},t("span",{class:"s-order-edit-modal-item-quantity",dir:"ltr",innerHTML:s.quantity+" x "+s.price.amount}),t("span",{class:"s-order-edit-modal-item-price",innerHTML:salla.money(s.price.amount*s.quantity)})))}))),s?.totals?.updated_products_total&&t("div",{class:"s-order-edit-modal-row"},t("span",{class:"s-order-edit-modal-row-label"},salla.lang.getWithDefault("pages.orders.modified_products_total","مجموع المنتجات المعدلة")),t("span",{class:"s-order-edit-modal-row-value",innerHTML:salla.money(s.totals.updated_products_total.amount)})),a>0&&t("div",{class:"s-order-edit-modal-row"},t("span",{class:"s-order-edit-modal-tax-label"},t("i",{class:"sicon-info-circle s-order-edit-modal-tax-icon"}),salla.lang.getWithDefault("pages.orders.vat","ضريبة القيمة المضافة")),t("span",{class:"s-order-edit-modal-row-value",innerHTML:salla.money(a)})),s?.totals?.total&&t("div",{class:"s-order-edit-modal-total"},t("span",{class:"s-order-edit-modal-total-label"},salla.lang.getWithDefault("pages.orders.order_total","اجمالي الطلب")),t("span",{class:"s-order-edit-modal-total-value",innerHTML:salla.money(s.totals.total.amount)})),e&&t("div",{class:"s-order-edit-modal-refund"},t("i",{class:"sicon-info-circle s-order-edit-modal-refund-icon"}),t("p",{class:"s-order-edit-modal-refund-text"},salla.lang.getWithDefault("pages.orders.refund_message","سيتم تحويل فارق المبلغ على نفس وسيلة الدفع"))),t("div",{class:"s-order-edit-modal-btn-wrapper"},t("salla-button",{onClick:()=>this.handleConfirm()},i?salla.lang.getWithDefault("pages.orders.pay_difference","دفع فارق المبلغ"):e?salla.lang.getWithDefault("pages.orders.confirm_and_receive_difference","تأكيد واستلام فارق المبلغ"):salla.lang.getWithDefault("pages.orders.confirm_changes","تأكيد التعديلات"),t("i",{class:`${this.getConfirmButtonIconClass()} s-order-edit-modal-btn-icon`})),t("salla-button",{color:"gray",fill:"outline",onClick:()=>this.returnToOrderDetails()},salla.lang.getWithDefault("pages.orders.back_to_order_details","العودة إلى تفاصيل الطلب")))))}render(){if(this.loading)return t(i,null,t("salla-loading",null));if(this.expired)return t(i,null,t("div",{class:"s-order-edit-expired"},t("p",null,salla.lang.getWithDefault("pages.orders.edit_session_expired","انتهت مدة التعديل المتاحة")),t("salla-button",{onClick:()=>this.navigateToOrder()},salla.lang.getWithDefault("pages.orders.back_to_order","العودة إلى تفاصيل الطلب"))));if(this.error||!this.order)return t(i,null,t("div",{class:"s-order-edit-no-content-placeholder"},t("i",{class:"sicon-shopping-bag icon"}),t("p",null,this.error)));const s=this.order.items&&this.order.items.length>0,e=this.order.customer_editing_session?.ends_at;return t(i,null,e&&t("div",{class:"s-order-edit-timer-wrapper"},t("salla-count-down",{prefixText:salla.lang.getWithDefault("pages.orders.edit_within","يمكنك التعديل خلال"),date:e,horizontal:!0,withButton:!0,autoSegments:!0,labeled:!1,size:"sm",color:"primary"})),t("div",{class:"s-order-edit-layout"},this.isMobileViewport?null:this.renderProductsPanel(),t("section",{class:"s-order-edit-order-panel"},t("div",{class:"s-order-edit-items-wrapper"},t("h2",{class:"s-order-edit-items-title"},salla.lang.getWithDefault("pages.orders.order_products","منتجات الطلب")),s?this.order.items.map(((s,i)=>[t("salla-order-edit-item",{key:s.id,item:s,orderId:this.orderId}),i<this.order.items.length-1?t("div",{class:"s-order-edit-items-divider"}):null])):t("div",{class:"s-order-edit-no-content-placeholder"},t("i",{class:"sicon-shopping-bag icon"}),t("p",null,salla.lang.getWithDefault("common.elements.no_items","لا توجد عناصر")))),t("div",{class:"s-order-edit-actions"},t("salla-button",{class:"s-order-edit-mobile-products-trigger",color:"gray",size:"small",fill:"outline",onClick:()=>this.openMobileProductsModal()},t("i",{class:"sicon-add s-order-edit-mobile-products-trigger-icon"}),salla.lang.getWithDefault("pages.orders.add_product","إضافة منتج")),t("salla-button",{onClick:()=>this.saveOrder(),loading:this.saveLoading,size:"small",disabled:!this.hasChanges},salla.lang.getWithDefault("pages.orders.save_changes","حفظ التعديلات")),t("salla-button",{size:"small",color:"gray",fill:"outline",onClick:()=>this.cancelEditSession()},salla.lang.getWithDefault("common.elements.cancel","الغاء"))))),this.renderMobileProductsModal(),this.renderAddProductDrawer(),this.renderSaveModal())}};f.style=":host{display:block}";export{f as salla_order_edit}
|
|
@@ -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-Dimo1ZpU.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:"d11f8075e15cd1379d6754b5ce13c81fa7cf9f03",class:"s-multiple-bundle-product-wrapper"},e("div",{key:"293351d69f5e12039ecab876832c6164b1235dab",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:"74b123c432e77263cf0ddcf20ab742885c54d5f4",class:"s-multiple-bundle-product-wrapper"},e("div",{key:"24bef0958a2a7d29bb4485eac08c7e6b8614a00d",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:"556b4e51a4b79dfc00371a07296556fb74111524"}))}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-DuhQONDF.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:"d11f8075e15cd1379d6754b5ce13c81fa7cf9f03",class:"s-multiple-bundle-product-wrapper"},e("div",{key:"293351d69f5e12039ecab876832c6164b1235dab",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:"74b123c432e77263cf0ddcf20ab742885c54d5f4",class:"s-multiple-bundle-product-wrapper"},e("div",{key:"24bef0958a2a7d29bb4485eac08c7e6b8614a00d",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:"556b4e51a4b79dfc00371a07296556fb74111524"}))}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 as s,h as t,H as e,a as l}from"./p-Dimo1ZpU.js";import{A as i}from"./p-DCZbpt2a.js";import{B as a}from"./p-D3mWkc-3.js";import{P as o}from"./p-DY4LZmNP.js";import{W as n}from"./p-ZT7ehBBk.js";import{S as r}from"./p-8Tsmrwno.js";import{S as h}from"./p-D4oPi1Ov.js";import{S as c}from"./p-CXRKXFgT.js";var m='\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>user-circle</title>\n<path d="M16 22.964c-4.525 0-8.447 1.713-9.993 4.365-0.371 0.636-0.156 1.452 0.48 1.823s1.453 0.156 1.823-0.48c0.855-1.465 3.624-3.041 7.689-3.041s6.835 1.576 7.689 3.041c0.249 0.424 0.696 0.661 1.155 0.661 0.228 0 0.459-0.059 0.669-0.181 0.637-0.371 0.852-1.187 0.48-1.823-1.545-2.652-5.467-4.365-9.992-4.365zM22.667 13.631c0-3.676-2.991-6.667-6.667-6.667s-6.667 2.991-6.667 6.667 2.991 6.667 6.667 6.667 6.667-2.992 6.667-6.667zM12 13.631c0-2.205 1.795-4 4-4s4 1.795 4 4-1.795 4-4 4-4-1.795-4-4zM16 0.297c-8.823 0-16 7.177-16 16 0 2.941 0.821 5.831 2.373 8.357 0.252 0.411 0.689 0.636 1.137 0.636 0.239 0 0.479-0.064 0.696-0.197 0.628-0.385 0.824-1.207 0.439-1.833-1.295-2.108-1.979-4.516-1.979-6.963 0-7.352 5.981-13.333 13.333-13.333s13.333 5.981 13.333 13.333c0 2.448-0.684 4.856-1.979 6.961-0.385 0.628-0.189 1.448 0.437 1.835 0.627 0.384 1.448 0.189 1.835-0.437 1.553-2.527 2.373-5.416 2.373-8.359 0-8.823-7.177-16-16-16z"></path>\n</svg>\n';const u=class{constructor(t){s(this,t),this.accountLoading=!1,this.opened=!1,this.notifications=salla.lang.get("common.titles.notifications"),this.orders=salla.lang.get("common.titles.orders"),this.pending_orders=salla.lang.get("common.titles.pending_orders"),this.wishlist=salla.lang.get("common.titles.wishlist"),this.profile=salla.lang.get("common.titles.profile"),this.rating=salla.lang.get("common.titles.rating"),this.wallet=salla.lang.get("common.titles.wallet"),this.settings=salla.lang.get("common.titles.settings"),this.loyalty_program=salla.lang.get("pages.loyalty_program.loyalty_points"),this.logout=salla.lang.get("blocks.header.logout"),this.hello=salla.lang.get("pages.checkout.hello"),this.first_name=salla.storage.get("user.first_name")||"",this.last_name=salla.storage.get("user.last_name")||"",this.avatar=salla.storage.get("user.avatar")||salla.url.cdn("images/avatar.png",40,40),this.badges={notifications:salla.helpers.number(salla.storage.get("user.notifications")||0),pending_orders:salla.helpers.number(salla.storage.get("user.pending_orders")||0)},this.sallaAccountEnabled=!1,this.hasBadges=Number(salla.storage.get("user.pending_orders"))>0||Number(salla.storage.get("user.notifications"))>0,this.inline=!1,this.avatarOnly=!1,this.showHeader=!1,this.relativeDropdown=!1,this.showTrigger=!1,this.onClickOutside=()=>{this.opened=!1},this.OrderUpdate=0,this.items={notifications:a,orders:'\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>box-bankers</title>\n<path d="M28 1.333h-24c-2.205 0-4 1.795-4 4v5.333c0 0.736 0.597 1.333 1.333 1.333v14.667c0 2.205 1.795 4 4 4h21.333c2.205 0 4-1.795 4-4v-14.667c0.736 0 1.333-0.597 1.333-1.333v-5.333c0-2.205-1.795-4-4-4zM28 26.667c0 0.735-0.599 1.333-1.333 1.333h-21.333c-0.735 0-1.333-0.599-1.333-1.333v-14.667h5.333v2.667c0 1.471 1.196 2.667 2.667 2.667h8c1.471 0 2.667-1.196 2.667-2.667v-2.667h5.333zM12 14.667v-2.667h8v2.667zM29.333 9.333h-26.667v-4c0-0.735 0.599-1.333 1.333-1.333h24c0.735 0 1.333 0.599 1.333 1.333z"></path>\n</svg>\n',pending_orders:o,wishlist:n,wallet:'\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>wallet</title>\n<path d="M28 6.667h-24c-0.736 0-1.333-0.597-1.333-1.333s0.597-1.333 1.333-1.333h24c0.737 0 1.333-0.596 1.333-1.333s-0.596-1.333-1.333-1.333h-24c-2.204 0-3.999 1.793-4 3.997v18.669c0 3.676 2.991 6.667 6.667 6.667h21.333c2.205 0 4-1.795 4-4v-16c0-2.205-1.795-4-4-4zM29.333 26.667c0 0.736-0.597 1.333-1.333 1.333h-21.333c-2.205 0-4-1.795-4-4v-14.895c0.416 0.147 0.865 0.228 1.333 0.228h24c0.736 0 1.333 0.597 1.333 1.333zM22.667 14.667c-2.205 0-4 1.795-4 4s1.795 4 4 4 4-1.795 4-4-1.795-4-4-4zM22.667 20c-0.736 0-1.333-0.597-1.333-1.333s0.597-1.333 1.333-1.333 1.333 0.597 1.333 1.333-0.597 1.333-1.333 1.333z"></path>\n</svg>\n',loyalty_program:c,profile:m}}async componentWillLoad(){await salla.onReady(),await salla.lang.onLoaded(),this.loadTranslations(),this.initiate(),Salla.event.on("api::token.injected",(s=>this.profileUrl=this.buildProfileUrl(s))),this.sallaAccountEnabled=Salla.config.get("store.features")?.includes("salla-account"),this.items=this.sallaAccountEnabled?{...this.items,settings:'\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>settings</title>\n<path d="M29.717 19.037l-1.817-1.499c0.067-0.512 0.1-1.028 0.1-1.539s-0.033-1.027-0.1-1.54l1.817-1.499c1.177-0.969 1.479-2.633 0.716-3.956l-1.159-2.009c-0.761-1.324-2.349-1.895-3.784-1.359l-2.212 0.829c-0.817-0.627-1.704-1.139-2.649-1.535l-0.388-2.332c-0.251-1.507-1.54-2.6-3.067-2.6h-2.319c-1.525 0-2.815 1.093-3.065 2.6l-0.388 2.332c-0.945 0.396-1.833 0.909-2.649 1.535l-2.212-0.829c-1.428-0.533-3.021 0.036-3.783 1.359l-1.16 2.011c-0.763 1.323-0.46 2.985 0.716 3.955l1.817 1.499c-0.067 0.513-0.1 1.029-0.1 1.54s0.033 1.027 0.1 1.539l-1.819 1.5c-1.176 0.971-1.476 2.635-0.715 3.955l1.159 2.011c0.763 1.324 2.356 1.899 3.784 1.36l2.212-0.831c0.816 0.625 1.703 1.139 2.649 1.535l0.388 2.332c0.251 1.507 1.54 2.6 3.067 2.6h2.319c1.527 0 2.816-1.093 3.065-2.6l0.389-2.332c0.947-0.396 1.833-0.909 2.649-1.535l2.212 0.831c1.432 0.539 3.023-0.035 3.783-1.36l1.16-2.011c0.76-1.32 0.459-2.984-0.717-3.956zM28.123 21.663l-1.16 2.011c-0.108 0.188-0.336 0.267-0.536 0.193l-2.931-1.1c-0.459-0.173-0.979-0.079-1.349 0.248-0.923 0.811-1.979 1.423-3.139 1.819-0.464 0.157-0.804 0.559-0.885 1.043l-0.515 3.087c-0.033 0.215-0.216 0.371-0.433 0.371h-2.319c-0.217 0-0.4-0.156-0.436-0.371l-0.513-3.087c-0.080-0.484-0.42-0.884-0.885-1.043-1.16-0.396-2.216-1.008-3.139-1.819-0.248-0.217-0.561-0.332-0.88-0.332-0.157 0-0.316 0.028-0.469 0.084l-2.931 1.1c-0.199 0.079-0.428-0.004-0.537-0.193l-1.159-2.011c-0.109-0.191-0.067-0.428 0.101-0.568l2.409-1.985c0.379-0.312 0.555-0.807 0.46-1.288-0.119-0.605-0.179-1.219-0.179-1.821 0-0.604 0.060-1.217 0.181-1.823 0.095-0.481-0.081-0.976-0.46-1.288l-2.409-1.985c-0.168-0.139-0.211-0.376-0.101-0.567l1.16-2.011c0.107-0.188 0.332-0.268 0.536-0.193l2.931 1.1c0.459 0.172 0.979 0.079 1.348-0.247 0.924-0.812 1.98-1.424 3.139-1.817 0.465-0.159 0.805-0.559 0.885-1.044l0.513-3.088c0.036-0.215 0.219-0.371 0.436-0.371h2.319c0.217 0 0.4 0.156 0.436 0.371l0.515 3.088c0.081 0.484 0.42 0.885 0.885 1.044 1.157 0.393 2.213 1.005 3.139 1.817 0.371 0.325 0.889 0.42 1.349 0.247l2.929-1.099c0.203-0.076 0.428 0.005 0.537 0.193l1.159 2.009c0.109 0.191 0.067 0.428-0.101 0.567l-2.409 1.985c-0.379 0.312-0.555 0.807-0.46 1.288 0.119 0.605 0.179 1.219 0.179 1.823 0 0.603-0.060 1.216-0.181 1.821-0.095 0.48 0.081 0.975 0.46 1.288l2.408 1.984c0.169 0.141 0.212 0.379 0.103 0.569zM16.016 10.667c-2.941 0-5.333 2.392-5.333 5.333s2.392 5.333 5.333 5.333 5.333-2.392 5.333-5.333-2.392-5.333-5.333-5.333zM16.016 18.667c-1.471 0-2.667-1.196-2.667-2.667s1.196-2.667 2.667-2.667 2.667 1.196 2.667 2.667-1.196 2.667-2.667 2.667z"></path>\n</svg>\n'}:this.items,this.host.hasAttribute("with-rating")&&(this.items.rating=h),this.items.logout='\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>send-out</title>\n<path d="M16 26.667h-9.333c-0.736 0-1.333-0.597-1.333-1.333v-18.667c0-0.736 0.597-1.333 1.333-1.333h9.333c0.737 0 1.333-0.596 1.333-1.333s-0.596-1.333-1.333-1.333h-9.333c-2.205 0-4 1.795-4 4v18.667c0 2.205 1.795 4 4 4h9.333c0.737 0 1.333-0.596 1.333-1.333s-0.596-1.333-1.333-1.333zM29.231 15.491c-0.068-0.164-0.167-0.312-0.289-0.436l-5.332-5.332c-0.521-0.521-1.364-0.521-1.885 0s-0.521 1.364 0 1.885l3.057 3.059h-12.781c-0.737 0-1.333 0.596-1.333 1.333s0.596 1.333 1.333 1.333h12.781l-3.057 3.057c-0.521 0.521-0.521 1.364 0 1.885 0.26 0.26 0.601 0.391 0.943 0.391s0.683-0.131 0.943-0.391l5.332-5.332c0.124-0.123 0.221-0.271 0.289-0.435 0.135-0.325 0.135-0.693 0-1.019z"></path>\n</svg>\n';let s=Salla.storage.get("token");s||(s=""),this.profileUrl=this.buildProfileUrl(s);const t=this.host.querySelector('[slot="trigger"]');this.triggerSlot='<div class="s-user-menu-trigger"><div class="s-user-menu-avatar-wrap"><img class="s-user-menu-trigger-avatar" src="{avatar}" alt="{first_name}{last_name}" /></div><div class="s-user-menu-trigger-content"><span class="s-user-menu-trigger-hello">{hello}</span><p class="s-user-menu-trigger-name">{first_name} {last_name}</p></div> <i class="s-user-menu-trigger-icon">{icon}</i></div>',t&&(this.triggerSlot=t.innerHTML,t.innerHTML=this.replaceParams(t.innerHTML))}loadTranslations(){this.notifications=Salla.lang.get("common.titles.notifications"),this.orders=Salla.lang.get("common.titles.orders"),this.pending_orders=Salla.lang.get("common.titles.pending_orders"),this.wishlist=Salla.lang.get("common.titles.wishlist"),this.profile=Salla.lang.get("common.titles.profile"),this.hello=Salla.lang.get("pages.checkout.hello"),this.rating=Salla.lang.get("common.titles.rating"),this.wallet=Salla.lang.get("common.titles.wallet"),this.settings=Salla.lang.get("common.titles.settings"),this.loyalty_program=Salla.lang.get("pages.loyalty_program.loyalty_points"),this.logout=Salla.lang.get("blocks.header.logout")}initiate(){return Salla.config.isGuest()?this.autoMountLoginModal():(this.is_loggedIn=!0,!this.inline&&(salla.url.is_page("customer.notifications")||salla.url.is_page("customer.orders.index.pending")||salla.url.is_page("customer.profile")||(Date.now()-(salla.storage.get("user.fetched_at")||0))/1e3/60>30)?this.fetchFreshProfile():void salla.event.on("profile::info.fetched",(s=>{this.updateProfileState(s)})))}autoMountLoginModal(){this.showTrigger&&(document.querySelector("salla-login-modal")||Salla.hooks.mount("body:end",document.createElement("salla-login-modal")))}fetchFreshProfile(){salla.api.token?salla.profile.api.info().then((s=>{this.updateProfileState(s)})):salla.log("trying to fetchFreshProfile before injected the token!!")}updateProfileState(s){this.badges={notifications:salla.helpers.number(s.data.notifications||0),pending_orders:salla.helpers.number(s.data.pending_orders||0)},this.hasBadges=Number(s.data.pending_orders)>0||Number(s.data.notifications)>0,this.first_name=s.data.first_name,this.last_name=s.data.last_name,this.avatar=s.data.avatar||salla.url.cdn("images/avatar.png",40,40)}async open(s){this.opened=!this.opened,s.stopPropagation(),this.opened&&window.addEventListener("click",this.onClickOutside)}menuItemClicked(s,t){"logout"===t&&(s.preventDefault(),salla.auth.logout("sall-user-menu"))}replaceParams(s){return s.replace(/\{hello\}/g,this.hello).replace(/\{first_name\}/g,this.first_name).replace(/\{last_name\}/g,this.last_name).replace(/\{avatar\}/g,this.avatar).replace(/\{icon\}/g,i)}getTheHeader(){return t("div",{class:{"s-user-menu-trigger-slot":!0,"s-user-menu-red-dot":this.hasBadges,"s-user-menu-trigger-avatar-only":this.avatarOnly},id:"trigger-slot",onClick:s=>this.open(s),onKeyUp:s=>this.open(s),innerHTML:this.replaceParams(this.triggerSlot)})}getItemAnchorLinkAttrs(s){return"profile"===s&&this.profileUrl&&this.sallaAccountEnabled?{href:this.profileUrl,target:"_blank",rel:"noopener noreferrer"}:{href:Salla.url.get("loyalty_program"===s?"loyalty":s)}}getMenuItem([s,e],l){if(("wallet"!==s||window.can_access_wallet)&&("loyalty_program"!==s||Salla.config.get("store.features").includes("loyalty-system")))return t("li",{class:{"s-user-menu-dropdown-item":!0,"s-user-menu-dropdown-item-logout":l+1===Object.entries(this.items).length}},t("a",{...this.getItemAnchorLinkAttrs(s),class:"s-user-menu-dropdown-item-link",onClick:t=>this.menuItemClicked(t,s)},t("i",{class:"s-user-menu-dropdown-item-prefix",innerHTML:e}),t("span",{class:"s-user-menu-dropdown-item-title"},this[s]),["٠","0",void 0].includes(this.badges[s])?"":t("span",{class:"s-user-menu-dropdown-item-badge"},this.badges[s])))}componentShouldUpdate(){this.opened||window.removeEventListener("click",this.onClickOutside)}render(){return t(e,null,this.is_loggedIn?this.inline?t("ul",{class:"s-user-menu-inline"},Object.entries(this.items).map(((s,t)=>this.getMenuItem(s,t)))):t("div",{class:{"s-user-menu-wrapper":!0,"s-user-menu-relative-dropdown":this.relativeDropdown}},this.getTheHeader(),t("div",{class:{"s-user-menu-toggler":!0,opened:this.opened}},t("div",{class:"s-user-menu-dropdown",onClick:s=>s.stopPropagation(),onKeyUp:s=>s.stopPropagation()},this.showHeader?t("div",{class:"s-user-menu-dropdown-header"},t("img",{src:this.avatar,alt:`${this.first_name} ${this.last_name}`}),t("div",{class:"s-user-menu-dropdown-header-content"},t("span",null,this.hello),t("p",null,this.first_name," ",this.last_name)),t("button",{type:"button",class:"s-user-menu-dropdown-header-close",innerHTML:r,onClick:()=>{this.opened=!1}})):"",t("ul",{class:"s-user-menu-dropdown-list"},Object.entries(this.items).map(((s,t)=>this.getMenuItem(s,t))))))):t("slot",{name:"login-btn"},t("button",{type:"button",class:"s-user-menu-login-btn",onClick:()=>salla.event.dispatch("login::open"),innerHTML:m})))}async componentDidLoad(){await Salla.hooks.registerComponent("salla-user-menu",this),document.lazyLoadInstance?.update(this.host.querySelectorAll(".lazy"))}buildProfileUrl(s){return`${Salla.config.get("account.url","https://accounts.salla.com")}/${salla.config.get("user.language_code")}/user?store=${Salla.config.get("store.id")}&info=${encodeURIComponent(s)}`}get host(){return l(this)}};u.style="";export{u as salla_user_menu}
|
|
4
|
+
import{r as s,h as t,H as e,a as l}from"./p-DuhQONDF.js";import{A as i}from"./p-DCZbpt2a.js";import{B as a}from"./p-D3mWkc-3.js";import{P as o}from"./p-DY4LZmNP.js";import{W as n}from"./p-ZT7ehBBk.js";import{S as r}from"./p-8Tsmrwno.js";import{S as h}from"./p-D4oPi1Ov.js";import{S as c}from"./p-CXRKXFgT.js";var m='\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>user-circle</title>\n<path d="M16 22.964c-4.525 0-8.447 1.713-9.993 4.365-0.371 0.636-0.156 1.452 0.48 1.823s1.453 0.156 1.823-0.48c0.855-1.465 3.624-3.041 7.689-3.041s6.835 1.576 7.689 3.041c0.249 0.424 0.696 0.661 1.155 0.661 0.228 0 0.459-0.059 0.669-0.181 0.637-0.371 0.852-1.187 0.48-1.823-1.545-2.652-5.467-4.365-9.992-4.365zM22.667 13.631c0-3.676-2.991-6.667-6.667-6.667s-6.667 2.991-6.667 6.667 2.991 6.667 6.667 6.667 6.667-2.992 6.667-6.667zM12 13.631c0-2.205 1.795-4 4-4s4 1.795 4 4-1.795 4-4 4-4-1.795-4-4zM16 0.297c-8.823 0-16 7.177-16 16 0 2.941 0.821 5.831 2.373 8.357 0.252 0.411 0.689 0.636 1.137 0.636 0.239 0 0.479-0.064 0.696-0.197 0.628-0.385 0.824-1.207 0.439-1.833-1.295-2.108-1.979-4.516-1.979-6.963 0-7.352 5.981-13.333 13.333-13.333s13.333 5.981 13.333 13.333c0 2.448-0.684 4.856-1.979 6.961-0.385 0.628-0.189 1.448 0.437 1.835 0.627 0.384 1.448 0.189 1.835-0.437 1.553-2.527 2.373-5.416 2.373-8.359 0-8.823-7.177-16-16-16z"></path>\n</svg>\n';const u=class{constructor(t){s(this,t),this.accountLoading=!1,this.opened=!1,this.notifications=salla.lang.get("common.titles.notifications"),this.orders=salla.lang.get("common.titles.orders"),this.pending_orders=salla.lang.get("common.titles.pending_orders"),this.wishlist=salla.lang.get("common.titles.wishlist"),this.profile=salla.lang.get("common.titles.profile"),this.rating=salla.lang.get("common.titles.rating"),this.wallet=salla.lang.get("common.titles.wallet"),this.settings=salla.lang.get("common.titles.settings"),this.loyalty_program=salla.lang.get("pages.loyalty_program.loyalty_points"),this.logout=salla.lang.get("blocks.header.logout"),this.hello=salla.lang.get("pages.checkout.hello"),this.first_name=salla.storage.get("user.first_name")||"",this.last_name=salla.storage.get("user.last_name")||"",this.avatar=salla.storage.get("user.avatar")||salla.url.cdn("images/avatar.png",40,40),this.badges={notifications:salla.helpers.number(salla.storage.get("user.notifications")||0),pending_orders:salla.helpers.number(salla.storage.get("user.pending_orders")||0)},this.sallaAccountEnabled=!1,this.hasBadges=Number(salla.storage.get("user.pending_orders"))>0||Number(salla.storage.get("user.notifications"))>0,this.inline=!1,this.avatarOnly=!1,this.showHeader=!1,this.relativeDropdown=!1,this.showTrigger=!1,this.onClickOutside=()=>{this.opened=!1},this.OrderUpdate=0,this.items={notifications:a,orders:'\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>box-bankers</title>\n<path d="M28 1.333h-24c-2.205 0-4 1.795-4 4v5.333c0 0.736 0.597 1.333 1.333 1.333v14.667c0 2.205 1.795 4 4 4h21.333c2.205 0 4-1.795 4-4v-14.667c0.736 0 1.333-0.597 1.333-1.333v-5.333c0-2.205-1.795-4-4-4zM28 26.667c0 0.735-0.599 1.333-1.333 1.333h-21.333c-0.735 0-1.333-0.599-1.333-1.333v-14.667h5.333v2.667c0 1.471 1.196 2.667 2.667 2.667h8c1.471 0 2.667-1.196 2.667-2.667v-2.667h5.333zM12 14.667v-2.667h8v2.667zM29.333 9.333h-26.667v-4c0-0.735 0.599-1.333 1.333-1.333h24c0.735 0 1.333 0.599 1.333 1.333z"></path>\n</svg>\n',pending_orders:o,wishlist:n,wallet:'\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>wallet</title>\n<path d="M28 6.667h-24c-0.736 0-1.333-0.597-1.333-1.333s0.597-1.333 1.333-1.333h24c0.737 0 1.333-0.596 1.333-1.333s-0.596-1.333-1.333-1.333h-24c-2.204 0-3.999 1.793-4 3.997v18.669c0 3.676 2.991 6.667 6.667 6.667h21.333c2.205 0 4-1.795 4-4v-16c0-2.205-1.795-4-4-4zM29.333 26.667c0 0.736-0.597 1.333-1.333 1.333h-21.333c-2.205 0-4-1.795-4-4v-14.895c0.416 0.147 0.865 0.228 1.333 0.228h24c0.736 0 1.333 0.597 1.333 1.333zM22.667 14.667c-2.205 0-4 1.795-4 4s1.795 4 4 4 4-1.795 4-4-1.795-4-4-4zM22.667 20c-0.736 0-1.333-0.597-1.333-1.333s0.597-1.333 1.333-1.333 1.333 0.597 1.333 1.333-0.597 1.333-1.333 1.333z"></path>\n</svg>\n',loyalty_program:c,profile:m}}async componentWillLoad(){await salla.onReady(),await salla.lang.onLoaded(),this.loadTranslations(),this.initiate(),Salla.event.on("api::token.injected",(s=>this.profileUrl=this.buildProfileUrl(s))),this.sallaAccountEnabled=Salla.config.get("store.features")?.includes("salla-account"),this.items=this.sallaAccountEnabled?{...this.items,settings:'\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>settings</title>\n<path d="M29.717 19.037l-1.817-1.499c0.067-0.512 0.1-1.028 0.1-1.539s-0.033-1.027-0.1-1.54l1.817-1.499c1.177-0.969 1.479-2.633 0.716-3.956l-1.159-2.009c-0.761-1.324-2.349-1.895-3.784-1.359l-2.212 0.829c-0.817-0.627-1.704-1.139-2.649-1.535l-0.388-2.332c-0.251-1.507-1.54-2.6-3.067-2.6h-2.319c-1.525 0-2.815 1.093-3.065 2.6l-0.388 2.332c-0.945 0.396-1.833 0.909-2.649 1.535l-2.212-0.829c-1.428-0.533-3.021 0.036-3.783 1.359l-1.16 2.011c-0.763 1.323-0.46 2.985 0.716 3.955l1.817 1.499c-0.067 0.513-0.1 1.029-0.1 1.54s0.033 1.027 0.1 1.539l-1.819 1.5c-1.176 0.971-1.476 2.635-0.715 3.955l1.159 2.011c0.763 1.324 2.356 1.899 3.784 1.36l2.212-0.831c0.816 0.625 1.703 1.139 2.649 1.535l0.388 2.332c0.251 1.507 1.54 2.6 3.067 2.6h2.319c1.527 0 2.816-1.093 3.065-2.6l0.389-2.332c0.947-0.396 1.833-0.909 2.649-1.535l2.212 0.831c1.432 0.539 3.023-0.035 3.783-1.36l1.16-2.011c0.76-1.32 0.459-2.984-0.717-3.956zM28.123 21.663l-1.16 2.011c-0.108 0.188-0.336 0.267-0.536 0.193l-2.931-1.1c-0.459-0.173-0.979-0.079-1.349 0.248-0.923 0.811-1.979 1.423-3.139 1.819-0.464 0.157-0.804 0.559-0.885 1.043l-0.515 3.087c-0.033 0.215-0.216 0.371-0.433 0.371h-2.319c-0.217 0-0.4-0.156-0.436-0.371l-0.513-3.087c-0.080-0.484-0.42-0.884-0.885-1.043-1.16-0.396-2.216-1.008-3.139-1.819-0.248-0.217-0.561-0.332-0.88-0.332-0.157 0-0.316 0.028-0.469 0.084l-2.931 1.1c-0.199 0.079-0.428-0.004-0.537-0.193l-1.159-2.011c-0.109-0.191-0.067-0.428 0.101-0.568l2.409-1.985c0.379-0.312 0.555-0.807 0.46-1.288-0.119-0.605-0.179-1.219-0.179-1.821 0-0.604 0.060-1.217 0.181-1.823 0.095-0.481-0.081-0.976-0.46-1.288l-2.409-1.985c-0.168-0.139-0.211-0.376-0.101-0.567l1.16-2.011c0.107-0.188 0.332-0.268 0.536-0.193l2.931 1.1c0.459 0.172 0.979 0.079 1.348-0.247 0.924-0.812 1.98-1.424 3.139-1.817 0.465-0.159 0.805-0.559 0.885-1.044l0.513-3.088c0.036-0.215 0.219-0.371 0.436-0.371h2.319c0.217 0 0.4 0.156 0.436 0.371l0.515 3.088c0.081 0.484 0.42 0.885 0.885 1.044 1.157 0.393 2.213 1.005 3.139 1.817 0.371 0.325 0.889 0.42 1.349 0.247l2.929-1.099c0.203-0.076 0.428 0.005 0.537 0.193l1.159 2.009c0.109 0.191 0.067 0.428-0.101 0.567l-2.409 1.985c-0.379 0.312-0.555 0.807-0.46 1.288 0.119 0.605 0.179 1.219 0.179 1.823 0 0.603-0.060 1.216-0.181 1.821-0.095 0.48 0.081 0.975 0.46 1.288l2.408 1.984c0.169 0.141 0.212 0.379 0.103 0.569zM16.016 10.667c-2.941 0-5.333 2.392-5.333 5.333s2.392 5.333 5.333 5.333 5.333-2.392 5.333-5.333-2.392-5.333-5.333-5.333zM16.016 18.667c-1.471 0-2.667-1.196-2.667-2.667s1.196-2.667 2.667-2.667 2.667 1.196 2.667 2.667-1.196 2.667-2.667 2.667z"></path>\n</svg>\n'}:this.items,this.host.hasAttribute("with-rating")&&(this.items.rating=h),this.items.logout='\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>send-out</title>\n<path d="M16 26.667h-9.333c-0.736 0-1.333-0.597-1.333-1.333v-18.667c0-0.736 0.597-1.333 1.333-1.333h9.333c0.737 0 1.333-0.596 1.333-1.333s-0.596-1.333-1.333-1.333h-9.333c-2.205 0-4 1.795-4 4v18.667c0 2.205 1.795 4 4 4h9.333c0.737 0 1.333-0.596 1.333-1.333s-0.596-1.333-1.333-1.333zM29.231 15.491c-0.068-0.164-0.167-0.312-0.289-0.436l-5.332-5.332c-0.521-0.521-1.364-0.521-1.885 0s-0.521 1.364 0 1.885l3.057 3.059h-12.781c-0.737 0-1.333 0.596-1.333 1.333s0.596 1.333 1.333 1.333h12.781l-3.057 3.057c-0.521 0.521-0.521 1.364 0 1.885 0.26 0.26 0.601 0.391 0.943 0.391s0.683-0.131 0.943-0.391l5.332-5.332c0.124-0.123 0.221-0.271 0.289-0.435 0.135-0.325 0.135-0.693 0-1.019z"></path>\n</svg>\n';let s=Salla.storage.get("token");s||(s=""),this.profileUrl=this.buildProfileUrl(s);const t=this.host.querySelector('[slot="trigger"]');this.triggerSlot='<div class="s-user-menu-trigger"><div class="s-user-menu-avatar-wrap"><img class="s-user-menu-trigger-avatar" src="{avatar}" alt="{first_name}{last_name}" /></div><div class="s-user-menu-trigger-content"><span class="s-user-menu-trigger-hello">{hello}</span><p class="s-user-menu-trigger-name">{first_name} {last_name}</p></div> <i class="s-user-menu-trigger-icon">{icon}</i></div>',t&&(this.triggerSlot=t.innerHTML,t.innerHTML=this.replaceParams(t.innerHTML))}loadTranslations(){this.notifications=Salla.lang.get("common.titles.notifications"),this.orders=Salla.lang.get("common.titles.orders"),this.pending_orders=Salla.lang.get("common.titles.pending_orders"),this.wishlist=Salla.lang.get("common.titles.wishlist"),this.profile=Salla.lang.get("common.titles.profile"),this.hello=Salla.lang.get("pages.checkout.hello"),this.rating=Salla.lang.get("common.titles.rating"),this.wallet=Salla.lang.get("common.titles.wallet"),this.settings=Salla.lang.get("common.titles.settings"),this.loyalty_program=Salla.lang.get("pages.loyalty_program.loyalty_points"),this.logout=Salla.lang.get("blocks.header.logout")}initiate(){return Salla.config.isGuest()?this.autoMountLoginModal():(this.is_loggedIn=!0,!this.inline&&(salla.url.is_page("customer.notifications")||salla.url.is_page("customer.orders.index.pending")||salla.url.is_page("customer.profile")||(Date.now()-(salla.storage.get("user.fetched_at")||0))/1e3/60>30)?this.fetchFreshProfile():void salla.event.on("profile::info.fetched",(s=>{this.updateProfileState(s)})))}autoMountLoginModal(){this.showTrigger&&(document.querySelector("salla-login-modal")||Salla.hooks.mount("body:end",document.createElement("salla-login-modal")))}fetchFreshProfile(){salla.api.token?salla.profile.api.info().then((s=>{this.updateProfileState(s)})):salla.log("trying to fetchFreshProfile before injected the token!!")}updateProfileState(s){this.badges={notifications:salla.helpers.number(s.data.notifications||0),pending_orders:salla.helpers.number(s.data.pending_orders||0)},this.hasBadges=Number(s.data.pending_orders)>0||Number(s.data.notifications)>0,this.first_name=s.data.first_name,this.last_name=s.data.last_name,this.avatar=s.data.avatar||salla.url.cdn("images/avatar.png",40,40)}async open(s){this.opened=!this.opened,s.stopPropagation(),this.opened&&window.addEventListener("click",this.onClickOutside)}menuItemClicked(s,t){"logout"===t&&(s.preventDefault(),salla.auth.logout("sall-user-menu"))}replaceParams(s){return s.replace(/\{hello\}/g,this.hello).replace(/\{first_name\}/g,this.first_name).replace(/\{last_name\}/g,this.last_name).replace(/\{avatar\}/g,this.avatar).replace(/\{icon\}/g,i)}getTheHeader(){return t("div",{class:{"s-user-menu-trigger-slot":!0,"s-user-menu-red-dot":this.hasBadges,"s-user-menu-trigger-avatar-only":this.avatarOnly},id:"trigger-slot",onClick:s=>this.open(s),onKeyUp:s=>this.open(s),innerHTML:this.replaceParams(this.triggerSlot)})}getItemAnchorLinkAttrs(s){return"profile"===s&&this.profileUrl&&this.sallaAccountEnabled?{href:this.profileUrl,target:"_blank",rel:"noopener noreferrer"}:{href:Salla.url.get("loyalty_program"===s?"loyalty":s)}}getMenuItem([s,e],l){if(("wallet"!==s||window.can_access_wallet)&&("loyalty_program"!==s||Salla.config.get("store.features").includes("loyalty-system")))return t("li",{class:{"s-user-menu-dropdown-item":!0,"s-user-menu-dropdown-item-logout":l+1===Object.entries(this.items).length}},t("a",{...this.getItemAnchorLinkAttrs(s),class:"s-user-menu-dropdown-item-link",onClick:t=>this.menuItemClicked(t,s)},t("i",{class:"s-user-menu-dropdown-item-prefix",innerHTML:e}),t("span",{class:"s-user-menu-dropdown-item-title"},this[s]),["٠","0",void 0].includes(this.badges[s])?"":t("span",{class:"s-user-menu-dropdown-item-badge"},this.badges[s])))}componentShouldUpdate(){this.opened||window.removeEventListener("click",this.onClickOutside)}render(){return t(e,null,this.is_loggedIn?this.inline?t("ul",{class:"s-user-menu-inline"},Object.entries(this.items).map(((s,t)=>this.getMenuItem(s,t)))):t("div",{class:{"s-user-menu-wrapper":!0,"s-user-menu-relative-dropdown":this.relativeDropdown}},this.getTheHeader(),t("div",{class:{"s-user-menu-toggler":!0,opened:this.opened}},t("div",{class:"s-user-menu-dropdown",onClick:s=>s.stopPropagation(),onKeyUp:s=>s.stopPropagation()},this.showHeader?t("div",{class:"s-user-menu-dropdown-header"},t("img",{src:this.avatar,alt:`${this.first_name} ${this.last_name}`}),t("div",{class:"s-user-menu-dropdown-header-content"},t("span",null,this.hello),t("p",null,this.first_name," ",this.last_name)),t("button",{type:"button",class:"s-user-menu-dropdown-header-close",innerHTML:r,onClick:()=>{this.opened=!1}})):"",t("ul",{class:"s-user-menu-dropdown-list"},Object.entries(this.items).map(((s,t)=>this.getMenuItem(s,t))))))):t("slot",{name:"login-btn"},t("button",{type:"button",class:"s-user-menu-login-btn",onClick:()=>salla.event.dispatch("login::open"),innerHTML:m})))}async componentDidLoad(){await Salla.hooks.registerComponent("salla-user-menu",this),document.lazyLoadInstance?.update(this.host.querySelectorAll(".lazy"))}buildProfileUrl(s){return`${Salla.config.get("account.url","https://accounts.salla.com")}/${salla.config.get("user.language_code")}/user?store=${Salla.config.get("store.id")}&info=${encodeURIComponent(s)}`}get host(){return l(this)}};u.style="";export{u as salla_user_menu}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as e,h as a,a as s}from"./p-
|
|
4
|
+
import{r as e,h as a,a as s}from"./p-DuhQONDF.js";const l=class{constructor(a){e(this,a),this.hasError=!1,salla.event.on("size-guide::open",(e=>this.open(e))),salla.lang.onLoaded((()=>{this.placeholder_title=salla.lang.get("pages.products.size_guide_placeholder"),this.placeholder_description=salla.lang.get("pages.products.size_guide_placeholder_info"),this.modal_title=salla.lang.get("pages.products.size_guides")}))}async open(e){return this.modal.setTitle(this.modal_title),this.modal.open(),await salla.api.withoutNotifier((()=>salla.product.getSizeGuides(e))).then((e=>{this.guides=e.data})).catch((e=>{console.log(e),this.hasError=!0,this.placeholder_description=e.response?.data?.error?.message||e.response?.data})).finally((()=>this.modal.stopLoading()))}async close(){return this.modal.close()}showPlaceholder(){return a("salla-placeholder",{alignment:"center",iconSize:"xl"},a("div",{slot:"title"},this.placeholder_title),a("div",{slot:"description"},this.placeholder_description))}render(){return a("salla-modal",{key:"ad8cbc23e60bc0d463f5b94febeab699dd96e2b4",class:"s-product-size-guide-wrapper",id:"salla-product-size-guide-modal",isLoading:!0,"has-skeleton":!0,width:"md",ref:e=>this.modal=e},a("span",{key:"b3dc61221d36a2680f74280e5fdb7601e5e70e62",slot:"icon",class:"s-product-size-guide-header-icon",innerHTML:'\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>pencil-ruler</title>\n<path d="M3.057 11.609c0.26 0.26 0.601 0.391 0.943 0.391s0.683-0.131 0.943-0.391l6.667-6.667c0.521-0.521 0.521-1.364 0-1.885l-1.285-1.285c-1.143-1.143-2.661-1.772-4.276-1.772-1.616 0-3.135 0.629-4.276 1.772-1.143 1.141-1.772 2.66-1.772 4.276 0 1.615 0.629 3.135 1.772 4.276zM3.657 3.657c1.277-1.277 3.504-1.277 4.781 0l0.343 0.343-4.781 4.781-0.343-0.343c-0.639-0.639-0.991-1.488-0.991-2.391s0.352-1.752 0.991-2.391zM29.317 20.972c-0.2-0.707-0.932-1.119-1.645-0.921-0.709 0.2-1.121 0.937-0.921 1.645l1.987 7.041-7.041-1.987c-0.707-0.195-1.444 0.213-1.645 0.921-0.2 0.708 0.212 1.445 0.921 1.645l9.333 2.633c0.119 0.032 0.24 0.049 0.361 0.049 0.349 0 0.689-0.137 0.943-0.391 0.341-0.341 0.472-0.84 0.34-1.305zM31.609 8.772l-8.381-8.381c-0.5-0.5-1.385-0.5-1.885 0l-8.171 8.171s-0.001 0-0.001 0.001 0 0.001-0.001 0.001l-4.607 4.607s0 0-0.001 0 0 0 0 0.001l-8.171 8.171c-0.251 0.249-0.391 0.588-0.391 0.943 0 0.353 0.14 0.693 0.391 0.943l8.381 8.381c0.249 0.251 0.589 0.391 0.943 0.391s0.693-0.14 0.943-0.391l20.952-20.952c0.521-0.521 0.521-1.365 0-1.885zM9.715 28.781l-6.495-6.496 1.676-1.676 1.851 1.851c0.26 0.26 0.601 0.391 0.943 0.391s0.683-0.131 0.943-0.391c0.521-0.521 0.521-1.364 0-1.885l-1.851-1.851 2.724-2.724 3.008 3.008c0.26 0.26 0.601 0.391 0.943 0.391s0.683-0.131 0.943-0.391c0.521-0.521 0.521-1.364 0-1.885l-3.008-3.008 2.724-2.724 1.851 1.851c0.26 0.26 0.601 0.391 0.943 0.391s0.683-0.131 0.943-0.391c0.521-0.52 0.521-1.364 0-1.885l-1.851-1.851 2.724-2.724 3.008 3.008c0.26 0.26 0.601 0.391 0.943 0.391s0.683-0.131 0.943-0.391c0.521-0.521 0.521-1.365 0-1.885l-3.008-3.008 1.677-1.677 6.496 6.496z"></path>\n</svg>\n'}),a("div",{key:"9735c6681e3e7c15c5d346f6cfca4c7d34542061",slot:"loading"},a("div",{key:"65224399d086d931c5c978dd00cf2d4d1ec3c082",class:"s-product-size-guide-skeleton"},a("salla-skeleton",{key:"05c0eda8bc21f5a2e2a89424bed145e61cd5a29e",height:"15px",width:"25%"}),a("div",{key:"af0e4801d3e27f664b38577c61ae3fc15e4c5c95",class:"s-product-size-guide-skeleton-header"},a("salla-skeleton",{key:"614ad02c61d7c44ec768a060cf7a25f04b618056",height:"40px"}),a("salla-skeleton",{key:"a4da4e2fa6ded411938fd90c4e11d368baadf03e",height:"40px"}),a("salla-skeleton",{key:"fb2fc13e520d704ad02d9c90f3678d7ec18e89f9",height:"40px"}),a("salla-skeleton",{key:"8b4723988f62458876f4b915f11df73bbf7717a8",height:"40px"})),a("div",{key:"9ae65ff980ee9458d1c2996465dcd7815bae0c1f",class:"s-product-size-guide-skeleton-content"},a("salla-skeleton",{key:"9d970f8d2d116845a902f7bcab944b48c781024f",height:"15px",width:"25%"}),a("salla-skeleton",{key:"a8150338ad24a94552796f948b4dddfd280179aa",height:"10px",width:"75%"}),a("salla-skeleton",{key:"34446a9a1948c7c006f6e13b26cacd7e20d16238",height:"10px",width:"50%"}),a("salla-skeleton",{key:"8838c419ac7f384861188d7ab96e8f42473c04c0",height:"10px",width:"75%"}),a("salla-skeleton",{key:"21f8e182ba77e35b0f02f1cbcd21ee8effd94ac0",height:"10px",width:"100%"}),a("salla-skeleton",{key:"5391e8a3a133dd2ccf7087590113391da080ca8a",height:"10px",width:"25%"}),a("salla-skeleton",{key:"743ba490362dd541229cb5c60feb0b6dc5750714",height:"10px",width:"60%"}),a("salla-skeleton",{key:"58e6839c74e13e11f4ef84fa4ec85e1f2f9868f4",height:"10px",width:"45%"}),a("salla-skeleton",{key:"a6f771e12046112b282dede2d759ed3d019bedcc",height:"10px",width:"30%"})))),a("slot",{key:"3ed1875a19be5a65afbf912fb0819dd92ded3062",name:"header"}),!this.hasError&&this.guides?[a("salla-tabs",null,this.guides.map((e=>a("salla-tab-header",{slot:"header",name:e.name},a("span",null,e.name)))),this.guides.map((e=>a("salla-tab-content",{slot:"content",name:e.name},a("div",{innerHTML:e.description})))))]:this.showPlaceholder(),a("slot",{key:"ca9526f3f95675dab2a38d2715ed3cf842d93174",name:"footer"}))}get host(){return s(this)}};l.style="";export{l as salla_product_size_guide}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as s,h as t,H as o}from"./p-
|
|
4
|
+
import{r as s,h as t,H as o}from"./p-DuhQONDF.js";const e=class{constructor(t){s(this,t),this.bordered=!0,this.placeholderImage="images/placeholder.png",this.optionsData=[]}componentWillLoad(){this.parseOptionsData()}componentWillUpdate(){this.parseOptionsData()}parseOptionsData(){if(this.options)if("string"==typeof this.options)try{this.optionsData=JSON.parse(this.options)}catch(s){this.optionsData=[]}else this.optionsData=Array.isArray(this.options)?this.options:[];else this.optionsData=[]}renderOptionValue(s){return s.is_image?t("div",{class:"s-order-details-option-image-container"},t("a",{href:s.value,target:"_blank"},t("img",{class:"s-order-details-option-image",src:s.value||this.placeholderImage,alt:s.name}))):s.color?t("span",{title:s.value,class:"s-order-details-option-color-swatch",style:{backgroundColor:s.color}}):s.is_file?t("a",{href:s.value,target:"_blank",class:"s-order-details-option-file-link"},salla.lang.get("common.elements.attachments")):s.is_color_picker?t("div",{class:"s-order-details-option-color-picker"},t("div",{class:"s-order-details-option-color-picker-content"},t("span",{class:"s-order-details-option-color-picker-text"},s.value),t("span",{class:"s-order-details-option-color-picker-swatch",style:{backgroundColor:s.value,width:"1rem"}})),t("salla-button",{onClick:t=>this.copyToClipboard(t,s.value),shape:"link",class:"s-order-details-option-color-picker-button"},t("span",{class:"s-order-details-option-color-copy-icon",innerHTML:'\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>swap-fill</title>\n<path d="M28 10.667h-2.667c-0.736 0-1.333 0.596-1.333 1.333s0.597 1.333 1.333 1.333h2.667c0.735 0 1.333 0.597 1.333 1.333v13.333c0 0.736-0.599 1.333-1.333 1.333h-13.333c-0.735 0-1.333-0.597-1.333-1.333v-2.667c0-0.737-0.597-1.333-1.333-1.333s-1.333 0.596-1.333 1.333v2.667c0 2.205 1.795 4 4 4h13.333c2.205 0 4-1.795 4-4v-13.333c0-2.205-1.795-4-4-4zM21.333 17.333v-13.333c0-2.205-1.795-4-4-4h-13.333c-2.205 0-4 1.795-4 4v13.333c0 2.205 1.795 4 4 4h13.333c2.205 0 4-1.795 4-4zM2.667 17.333v-13.333c0-0.736 0.599-1.333 1.333-1.333h13.333c0.735 0 1.333 0.597 1.333 1.333v13.333c0 0.736-0.599 1.333-1.333 1.333h-13.333c-0.735 0-1.333-0.597-1.333-1.333z"></path>\n</svg>\n'}))):s.is_map&&s.latitude&&s.longitude?t("salla-map",{id:`location_map_${s.id}`,class:`map_${s.id}`,zoom:15,readonly:!0,lat:s.latitude,lng:s.longitude},t("div",{slot:"button"},t("button",{type:"button",class:"s-order-details-option-map-button",onClick:()=>this.openMap(s.id)},salla.lang.get("common.elements.show_location")))):t("span",{class:"s-order-details-option-default-text"},s.display_value||s.value)}copyToClipboard(s,t){s.preventDefault(),navigator.clipboard&&navigator.clipboard.writeText(t)}openMap(s){const t=document.querySelector(`salla-map.map_${s}`);t&&t.open&&t.open()}render(){if(!this.optionsData.length)return null;const s=this.bordered?"s-order-details-options-container":"s-order-details-options-container-borderless";return t(o,{class:"s-order-details-options-wrapper"},t("h2",{class:"s-order-details-options-title"},salla.lang.get("pages.cart.item_options")),t("div",{class:s},t("dl",{class:"s-order-details-options-list"},this.optionsData.map((s=>t("div",{key:s.id,class:"s-order-details-options-item"},t("dt",{class:"s-order-details-options-item-name"},s.name,":"),t("dd",{class:s.is_image?"s-order-details-options-item-value-image":"s-order-details-options-item-value-text"},this.renderOptionValue(s))))))))}};e.style="";export{e as salla_order_details_options}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as a,h as s,H as o,a as t}from"./p-
|
|
4
|
+
import{r as a,h as s,H as o,a as t}from"./p-DuhQONDF.js";const n=class{constructor(s){a(this,s)}async mount(a){this.host.before(a)}render(){return s(o,{key:"499483c55f2e1122d80768cd43e47f8e127a62b4"})}async componentDidLoad(){await Salla.hooks.registerComponent("salla-hook",this)}get host(){return t(this)}};n.style=":host {\n all: unset;\n display: none; /* marker only */\n }";export{n as salla_hook}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as s,h as i,H as e,a as t}from"./p-Dimo1ZpU.js";function l(s,i){localStorage.getItem("salla-delivery-promise-debug")&&(void 0!==i?console.log(s,i):console.log(s))}async function r(s,i){l("fetchCities start",{productId:s,keyword:i});const e=null!=i?`?keyword=${encodeURIComponent(i)}`:"",t=await salla.api.request(salla.url.api(`products/${s}/delivery-promises/cities${e}`));return t.success&&Array.isArray(t.data)&&0!==t.data.length?(l("fetchCities success",{count:t.data.length}),{cities:t.data}):(l("fetchCities: no data",{response:t}),{cities:[]})}function a(){const s=(Boolean(salla.config.get("store.settings.bullet_delivery.settings.remember_last_session"))?salla.storage.store:salla.storage.session).get("bullet_delivery_intent");return s&&"object"==typeof s?s:null}const o={deliveryTo:"توصيل إلى",pickupFromBranch:"الاستلام من فرع",noResults:"لا توجد نتائج",selectCity:"اختر المدينة",changeCityTitle:"تغيير المدينة",changeCitySubtitle:"",cityFieldLabel:"المدينة",modalSearchPlaceholder:"ابحث عن مدينة",confirmAddress:"تأكيد العنوان",errorDeliveryPromise:"لا يتوفر وعد تسليم لهذه المدينة",errorPickupPromise:"لا يتوفر وعد تسليم لهذا الفرع"},n="salla-bullet-delivery-override-ip",h=class{constructor(i){s(this,i),this.isDeliveryPromiseEnabled=!1,this.isLoginCycleEnabled=!1,this.canRender=!1,this.labels=o,this.selectedLabel=null,this.deliveryMessage=null,this.hasError=!1,this.errorMessage="",this.isLoadingPromises=!1,this.selectedCityLoginCycle=null,this.selectedBranchLoginCycle=null,this.cities=[],this.selectedCity=null,this.isLoadingCities=!1,this.cityPendingSelection=null,this.modalCities=[],this.isSearchingCities=!1,this.citySearchCounter=0,this.onBulletDeliveryConfirmed=()=>{this.applyBulletIntent()},this.handleCitySearch=s=>{if(clearTimeout(this.citySearchTimer),!s.trim())return this.modalCities=[...this.cities],void(this.isSearchingCities=!1);this.citySearchTimer=setTimeout((()=>this.searchCitiesRemote(s)),300)},this.handleHeaderClick=s=>{s.stopPropagation(),this.isLoginCycleEnabled?this.openBulletDeliveryModal():this.openCityChangeModal()}}async componentDidLoad(){await salla.onReady(),await salla.lang.onLoaded(),this.labels={deliveryTo:salla.lang.getWithDefault("pages.products.promise_deliver_to",o.deliveryTo),pickupFromBranch:salla.lang.getWithDefault("pages.products.promise_pickup_from_branch",o.pickupFromBranch),noResults:salla.lang.getWithDefault("common.elements.no_options",o.noResults),selectCity:salla.lang.getWithDefault("common.elements.select_city",o.selectCity),changeCityTitle:salla.lang.getWithDefault("pages.products.promise_change_city_title",o.changeCityTitle),changeCitySubtitle:salla.lang.getWithDefault("pages.products.promise_change_city_subtitle","قد تتغيّر مدة التوصيل حسب المدينة."),cityFieldLabel:salla.lang.getWithDefault("pages.products.promise_city_field",o.cityFieldLabel),modalSearchPlaceholder:salla.lang.getWithDefault("pages.products.promise_search_city",o.modalSearchPlaceholder),confirmAddress:salla.lang.getWithDefault("pages.checkout.confirm_address",o.confirmAddress),errorDeliveryPromise:salla.lang.getWithDefault("pages.products.promise_delivery_not_available",o.errorDeliveryPromise),errorPickupPromise:salla.lang.getWithDefault("pages.products.promise_pickup_not_available",o.errorPickupPromise)},this.isDeliveryPromiseEnabled=salla.config.get("store.features",[]).includes("delivery-promises"),this.isLoginCycleEnabled=salla.config.get("store.features",[]).includes("bullet-delivery-v2"),this.productId=salla.config.get("page.id"),this.isDeliveryPromiseEnabled?this.isLoginCycleEnabled?await this.initLoginCycleFlow():(this.selectedLabel=`${this.labels.deliveryTo} ${this.labels.selectCity}`,await this.loadCities()):this.canRender=!1}disconnectedCallback(){window.removeEventListener("bulletDeliveryConfirmed",this.onBulletDeliveryConfirmed)}getIPDeliveryLocation(){const s="store.shipping.delivery_location",i={cityId:salla.config.get(`${s}.city_id`),cityName:salla.config.get(`${s}.city_name`)};return localStorage.getItem(n)?JSON.parse(localStorage.getItem(n)):i}async initLoginCycleFlow(){const s=this.applyBulletIntent(),{cityId:i,cityName:e}=this.getIPDeliveryLocation();l("delivery promise login cycle flow getIPDeliveryLocation",this.getIPDeliveryLocation()),i&&e&&!s&&(this.selectedLabel=`${this.labels.deliveryTo} ${e}`,await this.loadDeliveryMessage(i,"city")),this.canRender=!0,window.addEventListener("bulletDeliveryConfirmed",this.onBulletDeliveryConfirmed)}applyBulletIntent(){const s=function(){const s=a();if(!s)return null;if("address"===s.type){const i=s.address_details?.city,e=null!=i?.id?Number(i.id):null!=s.city_id?Number(s.city_id):null,t=i?.name?.trim()||"";return null!=e?{type:"address",option:{id:e,name:t}}:null}if("branch"===s.type){const i=null!=s.branch_id?Number(s.branch_id):null!=s.branch_details?.id?Number(s.branch_details.id):null,e=s.branch_details?.name?.trim()||"";return null!=i?{type:"branch",option:{id:i,name:e}}:null}return null}();return s?("address"===s.type?(this.selectedCityLoginCycle=s.option,this.selectedBranchLoginCycle=null,this.selectedLabel=`${this.labels.deliveryTo} ${s.option.name||this.labels.selectCity}`,this.loadDeliveryMessage(s.option.id,"city")):(this.selectedBranchLoginCycle=s.option,this.selectedCityLoginCycle=null,this.selectedLabel=`${this.labels.pickupFromBranch} ${s.option.name}`,this.loadDeliveryMessage(s.option.id,"branch")),!0):(this.selectedLabel=`${this.labels.deliveryTo} ${this.labels.selectCity}`,this.selectedCityLoginCycle=null,this.selectedBranchLoginCycle=null,this.deliveryMessage=null,!1)}openBulletDeliveryModal(){salla.event.emit("salla::bullet-delivery.modal.open.requested",function(){const s=a(),i={};if("address"===s?.type&&null!=s.address_id&&(i.preselected_address_id=Number(s.address_id)),"branch"===s?.type){const e=s.branch_id??s.branch_details?.id;null!=e&&(i.preselected_branch_id=Number(e))}return i}())}async loadCities(){this.isLoadingCities=!0,this.hasError=!1;const{cityId:s,cityName:i}=this.getIPDeliveryLocation();l("delivery promise standard flow getIPDeliveryLocation",this.getIPDeliveryLocation());try{const{cities:e}=await r(this.productId);if(!e.length)return void(this.canRender=!1);if(this.cities=e,this.canRender=!0,s&&i){this.selectedLabel=`${this.labels.deliveryTo} ${i}`;const e=this.cities.find((i=>String(i.id)===String(s)));e&&(l("delivery promise standard flow autoCity found",e),this.selectedCity=e),await this.loadDeliveryMessage(s,"city")}}catch(s){this.hasError=!0,this.errorMessage=s.message||"Failed to load cities",this.canRender=!1}finally{this.isLoadingCities=!1}}async loadDeliveryMessage(s,i){this.isLoadingPromises=!0,this.hasError=!1,this.deliveryMessage=null;try{this.deliveryMessage=await async function(s,i,e,t){l("fetchDeliveryMessage start",{productId:s,id:i,optionType:e});let r="";r="city"!==e||t?`?reference_id=${i}&reference_type=${e}`:`?reference_id=${i}`;const a=await salla.api.withoutNotifier((()=>salla.api.request(salla.url.api(`products/${s}/delivery-promises${r}`))));if(!a.success)throw l("fetchDeliveryMessage error",{response:a}),new Error(a.error?.message||"Failed to fetch delivery promise");const o=a.data?.message?.trim();return l("fetchDeliveryMessage success",{message:o}),o||null}(this.productId,s,i,this.isLoginCycleEnabled)}catch(s){this.hasError=!0,this.errorMessage="city"===i?this.labels.errorDeliveryPromise:this.labels.errorPickupPromise}finally{this.isLoadingPromises=!1}}async openCityChangeModal(){this.cityModalRef&&(this.cityPendingSelection=null,this.modalCities=[...this.cities],await this.cityModalRef.setTitle(this.labels.changeCityTitle),await this.cityModalRef.open())}async searchCitiesRemote(s){const i=++this.citySearchCounter;this.isSearchingCities=!0;try{const{cities:e}=await r(this.productId,s);if(i!==this.citySearchCounter)return;this.modalCities=e}catch{if(i!==this.citySearchCounter)return;this.modalCities=[]}finally{i===this.citySearchCounter&&(this.isSearchingCities=!1)}}async handleConfirmCityModal(){if(!this.cityPendingSelection)return void await(this.cityModalRef?.close());const s=this.cityPendingSelection;this.selectedCity=s,this.selectedLabel=`${this.labels.deliveryTo} ${function(s){const i=salla.config.get("user.language_code");return i&&"ar"!==i&&s.name_en?.trim()?s.name_en.trim():s.name}(s)}`,await this.loadDeliveryMessage(s.id,"city"),await(this.cityModalRef?.close())}renderLoadingSkeleton(){return i(e,{class:"s-delivery-promise-wrapper s-delivery-promise-skeleton"},i("div",{class:"s-delivery-promise-container"},i("div",{class:"s-delivery-promise-header s-delivery-promise-header-skeleton"},i("div",{class:"s-delivery-promise-location"},i("salla-skeleton",{height:"14px",width:"180px"})),i("salla-skeleton",{height:"18px",width:"18px"})),i("div",{class:"s-delivery-promise-loading"},i("salla-skeleton",{height:"20px",width:"80%"}))))}renderDeliveryMessage(){return this.isLoadingPromises?i("div",{class:"s-delivery-promise-loading"},i("salla-skeleton",{height:"20px",width:"80%"})):this.deliveryMessage?i("div",{class:"s-delivery-promise-message"},this.deliveryMessage):null}renderCityModalBody(){return i("div",{class:"s-delivery-promise-modal-body"},i("salla-searchable-dropdown",{label:this.labels.cityFieldLabel,placeholder:this.labels.modalSearchPlaceholder,items:this.modalCities,selectedItem:this.cityPendingSelection,searching:this.isSearchingCities,required:!0,noResultsText:this.labels.noResults,inputId:"s-delivery-promise-modal-search",onItemSelected:s=>{this.cityPendingSelection=s.detail},onSearchInput:s=>{this.handleCitySearch(s.detail)}}))}renderCityChangeModal(){return this.isLoginCycleEnabled?null:i("salla-modal",{id:"s-delivery-promise-city-modal",ref:s=>{this.cityModalRef=s},class:"s-delivery-promise-city-modal",isClosable:!0,width:"md","modal-title":this.labels.changeCityTitle,subTitle:this.labels.changeCitySubtitle},this.renderCityModalBody(),i("salla-button",{slot:"footer",width:"wide",disabled:!this.cityPendingSelection,onClick:()=>this.handleConfirmCityModal()},!this.isLoadingPromises&&this.labels.confirmAddress))}render(){return this.isDeliveryPromiseEnabled?this.isLoadingCities?this.renderLoadingSkeleton():this.canRender?i(e,{class:"s-delivery-promise-wrapper"},i("div",{class:"s-delivery-promise-container"},i("div",{class:"s-delivery-promise-header",onClick:this.handleHeaderClick},i("div",{class:"s-delivery-promise-location"},i("span",{class:"s-delivery-promise-title"},this.selectedLabel)),i("i",{class:"sicon-keyboard_arrow_down s-delivery-promise-arrow"})),this.hasError&&i("div",{class:"s-delivery-promise-error"},this.errorMessage),!this.hasError&&this.renderDeliveryMessage()),this.renderCityChangeModal()):null:null}get host(){return t(this)}};export{h as salla_delivery_promise}
|
|
4
|
+
import{r as s,h as i,H as e,a as t}from"./p-DuhQONDF.js";function l(s,i){localStorage.getItem("salla-delivery-promise-debug")&&(void 0!==i?console.log(s,i):console.log(s))}async function r(s,i){l("fetchCities start",{productId:s,keyword:i});const e=null!=i?`?keyword=${encodeURIComponent(i)}`:"",t=await salla.api.request(salla.url.api(`products/${s}/delivery-promises/cities${e}`));return t.success&&Array.isArray(t.data)&&0!==t.data.length?(l("fetchCities success",{count:t.data.length}),{cities:t.data}):(l("fetchCities: no data",{response:t}),{cities:[]})}function a(){const s=(Boolean(salla.config.get("store.settings.bullet_delivery.settings.remember_last_session"))?salla.storage.store:salla.storage.session).get("bullet_delivery_intent");return s&&"object"==typeof s?s:null}const o={deliveryTo:"توصيل إلى",pickupFromBranch:"الاستلام من فرع",noResults:"لا توجد نتائج",selectCity:"اختر المدينة",changeCityTitle:"تغيير المدينة",changeCitySubtitle:"",cityFieldLabel:"المدينة",modalSearchPlaceholder:"ابحث عن مدينة",confirmAddress:"تأكيد العنوان",errorDeliveryPromise:"لا يتوفر وعد تسليم لهذه المدينة",errorPickupPromise:"لا يتوفر وعد تسليم لهذا الفرع"},n="salla-bullet-delivery-override-ip",h=class{constructor(i){s(this,i),this.isDeliveryPromiseEnabled=!1,this.isLoginCycleEnabled=!1,this.canRender=!1,this.labels=o,this.selectedLabel=null,this.deliveryMessage=null,this.hasError=!1,this.errorMessage="",this.isLoadingPromises=!1,this.selectedCityLoginCycle=null,this.selectedBranchLoginCycle=null,this.cities=[],this.selectedCity=null,this.isLoadingCities=!1,this.cityPendingSelection=null,this.modalCities=[],this.isSearchingCities=!1,this.citySearchCounter=0,this.onBulletDeliveryConfirmed=()=>{this.applyBulletIntent()},this.handleCitySearch=s=>{if(clearTimeout(this.citySearchTimer),!s.trim())return this.modalCities=[...this.cities],void(this.isSearchingCities=!1);this.citySearchTimer=setTimeout((()=>this.searchCitiesRemote(s)),300)},this.handleHeaderClick=s=>{s.stopPropagation(),this.isLoginCycleEnabled?this.openBulletDeliveryModal():this.openCityChangeModal()}}async componentDidLoad(){await salla.onReady(),await salla.lang.onLoaded(),this.labels={deliveryTo:salla.lang.getWithDefault("pages.products.promise_deliver_to",o.deliveryTo),pickupFromBranch:salla.lang.getWithDefault("pages.products.promise_pickup_from_branch",o.pickupFromBranch),noResults:salla.lang.getWithDefault("common.elements.no_options",o.noResults),selectCity:salla.lang.getWithDefault("common.elements.select_city",o.selectCity),changeCityTitle:salla.lang.getWithDefault("pages.products.promise_change_city_title",o.changeCityTitle),changeCitySubtitle:salla.lang.getWithDefault("pages.products.promise_change_city_subtitle","قد تتغيّر مدة التوصيل حسب المدينة."),cityFieldLabel:salla.lang.getWithDefault("pages.products.promise_city_field",o.cityFieldLabel),modalSearchPlaceholder:salla.lang.getWithDefault("pages.products.promise_search_city",o.modalSearchPlaceholder),confirmAddress:salla.lang.getWithDefault("pages.checkout.confirm_address",o.confirmAddress),errorDeliveryPromise:salla.lang.getWithDefault("pages.products.promise_delivery_not_available",o.errorDeliveryPromise),errorPickupPromise:salla.lang.getWithDefault("pages.products.promise_pickup_not_available",o.errorPickupPromise)},this.isDeliveryPromiseEnabled=salla.config.get("store.features",[]).includes("delivery-promises"),this.isLoginCycleEnabled=salla.config.get("store.features",[]).includes("bullet-delivery-v2"),this.productId=salla.config.get("page.id"),this.isDeliveryPromiseEnabled?this.isLoginCycleEnabled?await this.initLoginCycleFlow():(this.selectedLabel=`${this.labels.deliveryTo} ${this.labels.selectCity}`,await this.loadCities()):this.canRender=!1}disconnectedCallback(){window.removeEventListener("bulletDeliveryConfirmed",this.onBulletDeliveryConfirmed)}getIPDeliveryLocation(){const s="store.shipping.delivery_location",i={cityId:salla.config.get(`${s}.city_id`),cityName:salla.config.get(`${s}.city_name`)};return localStorage.getItem(n)?JSON.parse(localStorage.getItem(n)):i}async initLoginCycleFlow(){const s=this.applyBulletIntent(),{cityId:i,cityName:e}=this.getIPDeliveryLocation();l("delivery promise login cycle flow getIPDeliveryLocation",this.getIPDeliveryLocation()),i&&e&&!s&&(this.selectedLabel=`${this.labels.deliveryTo} ${e}`,await this.loadDeliveryMessage(i,"city")),this.canRender=!0,window.addEventListener("bulletDeliveryConfirmed",this.onBulletDeliveryConfirmed)}applyBulletIntent(){const s=function(){const s=a();if(!s)return null;if("address"===s.type){const i=s.address_details?.city,e=null!=i?.id?Number(i.id):null!=s.city_id?Number(s.city_id):null,t=i?.name?.trim()||"";return null!=e?{type:"address",option:{id:e,name:t}}:null}if("branch"===s.type){const i=null!=s.branch_id?Number(s.branch_id):null!=s.branch_details?.id?Number(s.branch_details.id):null,e=s.branch_details?.name?.trim()||"";return null!=i?{type:"branch",option:{id:i,name:e}}:null}return null}();return s?("address"===s.type?(this.selectedCityLoginCycle=s.option,this.selectedBranchLoginCycle=null,this.selectedLabel=`${this.labels.deliveryTo} ${s.option.name||this.labels.selectCity}`,this.loadDeliveryMessage(s.option.id,"city")):(this.selectedBranchLoginCycle=s.option,this.selectedCityLoginCycle=null,this.selectedLabel=`${this.labels.pickupFromBranch} ${s.option.name}`,this.loadDeliveryMessage(s.option.id,"branch")),!0):(this.selectedLabel=`${this.labels.deliveryTo} ${this.labels.selectCity}`,this.selectedCityLoginCycle=null,this.selectedBranchLoginCycle=null,this.deliveryMessage=null,!1)}openBulletDeliveryModal(){salla.event.emit("salla::bullet-delivery.modal.open.requested",function(){const s=a(),i={};if("address"===s?.type&&null!=s.address_id&&(i.preselected_address_id=Number(s.address_id)),"branch"===s?.type){const e=s.branch_id??s.branch_details?.id;null!=e&&(i.preselected_branch_id=Number(e))}return i}())}async loadCities(){this.isLoadingCities=!0,this.hasError=!1;const{cityId:s,cityName:i}=this.getIPDeliveryLocation();l("delivery promise standard flow getIPDeliveryLocation",this.getIPDeliveryLocation());try{const{cities:e}=await r(this.productId);if(!e.length)return void(this.canRender=!1);if(this.cities=e,this.canRender=!0,s&&i){this.selectedLabel=`${this.labels.deliveryTo} ${i}`;const e=this.cities.find((i=>String(i.id)===String(s)));e&&(l("delivery promise standard flow autoCity found",e),this.selectedCity=e),await this.loadDeliveryMessage(s,"city")}}catch(s){this.hasError=!0,this.errorMessage=s.message||"Failed to load cities",this.canRender=!1}finally{this.isLoadingCities=!1}}async loadDeliveryMessage(s,i){this.isLoadingPromises=!0,this.hasError=!1,this.deliveryMessage=null;try{this.deliveryMessage=await async function(s,i,e,t){l("fetchDeliveryMessage start",{productId:s,id:i,optionType:e});let r="";r="city"!==e||t?`?reference_id=${i}&reference_type=${e}`:`?reference_id=${i}`;const a=await salla.api.withoutNotifier((()=>salla.api.request(salla.url.api(`products/${s}/delivery-promises${r}`))));if(!a.success)throw l("fetchDeliveryMessage error",{response:a}),new Error(a.error?.message||"Failed to fetch delivery promise");const o=a.data?.message?.trim();return l("fetchDeliveryMessage success",{message:o}),o||null}(this.productId,s,i,this.isLoginCycleEnabled)}catch(s){this.hasError=!0,this.errorMessage="city"===i?this.labels.errorDeliveryPromise:this.labels.errorPickupPromise}finally{this.isLoadingPromises=!1}}async openCityChangeModal(){this.cityModalRef&&(this.cityPendingSelection=null,this.modalCities=[...this.cities],await this.cityModalRef.setTitle(this.labels.changeCityTitle),await this.cityModalRef.open())}async searchCitiesRemote(s){const i=++this.citySearchCounter;this.isSearchingCities=!0;try{const{cities:e}=await r(this.productId,s);if(i!==this.citySearchCounter)return;this.modalCities=e}catch{if(i!==this.citySearchCounter)return;this.modalCities=[]}finally{i===this.citySearchCounter&&(this.isSearchingCities=!1)}}async handleConfirmCityModal(){if(!this.cityPendingSelection)return void await(this.cityModalRef?.close());const s=this.cityPendingSelection;this.selectedCity=s,this.selectedLabel=`${this.labels.deliveryTo} ${function(s){const i=salla.config.get("user.language_code");return i&&"ar"!==i&&s.name_en?.trim()?s.name_en.trim():s.name}(s)}`,await this.loadDeliveryMessage(s.id,"city"),await(this.cityModalRef?.close())}renderLoadingSkeleton(){return i(e,{class:"s-delivery-promise-wrapper s-delivery-promise-skeleton"},i("div",{class:"s-delivery-promise-container"},i("div",{class:"s-delivery-promise-header s-delivery-promise-header-skeleton"},i("div",{class:"s-delivery-promise-location"},i("salla-skeleton",{height:"14px",width:"180px"})),i("salla-skeleton",{height:"18px",width:"18px"})),i("div",{class:"s-delivery-promise-loading"},i("salla-skeleton",{height:"20px",width:"80%"}))))}renderDeliveryMessage(){return this.isLoadingPromises?i("div",{class:"s-delivery-promise-loading"},i("salla-skeleton",{height:"20px",width:"80%"})):this.deliveryMessage?i("div",{class:"s-delivery-promise-message"},this.deliveryMessage):null}renderCityModalBody(){return i("div",{class:"s-delivery-promise-modal-body"},i("salla-searchable-dropdown",{label:this.labels.cityFieldLabel,placeholder:this.labels.modalSearchPlaceholder,items:this.modalCities,selectedItem:this.cityPendingSelection,searching:this.isSearchingCities,required:!0,noResultsText:this.labels.noResults,inputId:"s-delivery-promise-modal-search",onItemSelected:s=>{this.cityPendingSelection=s.detail},onSearchInput:s=>{this.handleCitySearch(s.detail)}}))}renderCityChangeModal(){return this.isLoginCycleEnabled?null:i("salla-modal",{id:"s-delivery-promise-city-modal",ref:s=>{this.cityModalRef=s},class:"s-delivery-promise-city-modal",isClosable:!0,width:"md","modal-title":this.labels.changeCityTitle,subTitle:this.labels.changeCitySubtitle},this.renderCityModalBody(),i("salla-button",{slot:"footer",width:"wide",disabled:!this.cityPendingSelection,onClick:()=>this.handleConfirmCityModal()},!this.isLoadingPromises&&this.labels.confirmAddress))}render(){return this.isDeliveryPromiseEnabled?this.isLoadingCities?this.renderLoadingSkeleton():this.canRender?i(e,{class:"s-delivery-promise-wrapper"},i("div",{class:"s-delivery-promise-container"},i("div",{class:"s-delivery-promise-header",onClick:this.handleHeaderClick},i("div",{class:"s-delivery-promise-location"},i("span",{class:"s-delivery-promise-title"},this.selectedLabel)),i("i",{class:"sicon-keyboard_arrow_down s-delivery-promise-arrow"})),this.hasError&&i("div",{class:"s-delivery-promise-error"},this.errorMessage),!this.hasError&&this.renderDeliveryMessage()),this.renderCityChangeModal()):null:null}get host(){return t(this)}};export{h as salla_delivery_promise}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as a,h as l,H as s,a as n}from"./p-
|
|
4
|
+
import{r as a,h as l,H as s,a as n}from"./p-DuhQONDF.js";import{s as t}from"./p-B-Rj6b9M.js";const C=class{constructor(l){a(this,l),this.pointsData=null,this.productId=null}async componentWillLoad(){try{if(await salla.onReady(),await salla.lang.onLoaded(),await t(),this.productId=this.host.dataset.productId||salla.config.get("page.id"),!this.productId)return;const a=await salla.api.request(`/loyalty/products/${this.productId}/points`).catch((()=>null));this.pointsData=a?.data||null}catch(a){salla?.logger?.warn?.("salla-loyalty-points-banner: init failed",a)}}render(){return this.productId&&this.pointsData?.points?l(s,null,l("div",{class:"s-loyalty-points-banner-container"},l("div",{class:"s-loyalty-points-banner-icon"},l("span",{class:"s-loyalty-points-banner-inner-icon",innerHTML:'<svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M8.76604 2.86201C9.31804 2.61001 9.93304 2.41501 10.611 2.27701C11.289 2.13901 12 2.07001 12.744 2.07001C13.572 2.07001 14.364 2.15401 15.12 2.32201C15.84 2.49001 16.356 2.81401 16.668 3.29401C16.932 3.70201 17.064 4.26001 17.064 4.96801V13.032C17.064 13.416 16.95 13.752 16.722 14.04C16.506 14.304 16.227 14.493 15.885 14.607C15.543 14.721 15.204 14.742 14.868 14.67C14.196 14.514 13.488 14.436 12.744 14.436C12.084 14.436 11.442 14.502 10.818 14.634C10.23 14.754 9.70204 14.922 9.23404 15.138C8.68204 15.39 8.06704 15.585 7.38904 15.723C6.71104 15.861 6.00004 15.93 5.25604 15.93C4.42804 15.93 3.63604 15.846 2.88004 15.678C2.18404 15.522 1.68004 15.21 1.36804 14.742C1.08004 14.322 0.936035 13.752 0.936035 13.032V4.96801C0.936035 4.58401 1.05004 4.24801 1.27804 3.96001C1.49404 3.69601 1.77304 3.50701 2.11504 3.39301C2.45704 3.27901 2.79604 3.25801 3.13204 3.33001C3.80404 3.48601 4.51204 3.56401 5.25604 3.56401C5.91604 3.56401 6.55804 3.49801 7.18204 3.36601C7.77004 3.24601 8.29804 3.07801 8.76604 2.86201ZM11.25 9.00001C11.25 8.59201 11.148 8.21701 10.944 7.87501C10.74 7.53301 10.467 7.26001 10.125 7.05601C9.78304 6.85201 9.40804 6.75001 9.00004 6.75001C8.59204 6.75001 8.21704 6.85201 7.87504 7.05601C7.53304 7.26001 7.26004 7.53301 7.05604 7.87501C6.85204 8.21701 6.75004 8.59201 6.75004 9.00001C6.75004 9.40801 6.85204 9.78301 7.05604 10.125C7.26004 10.467 7.53304 10.74 7.87504 10.944C8.21704 11.148 8.59204 11.25 9.00004 11.25C9.40804 11.25 9.78304 11.148 10.125 10.944C10.467 10.74 10.74 10.467 10.944 10.125C11.148 9.78301 11.25 9.40801 11.25 9.00001ZM14.328 7.79401C14.076 7.75801 13.812 7.73401 13.536 7.72201C13.38 7.71001 13.245 7.75501 13.131 7.85701C13.017 7.95901 12.954 8.08801 12.942 8.24401C12.93 8.40001 12.975 8.53501 13.077 8.64901C13.179 8.76301 13.308 8.82601 13.464 8.83801C13.704 8.85001 13.938 8.87401 14.166 8.91001C14.322 8.93401 14.463 8.90101 14.589 8.81101C14.715 8.72101 14.787 8.59801 14.805 8.44201C14.823 8.28601 14.787 8.14501 14.697 8.01901C14.607 7.89301 14.484 7.81801 14.328 7.79401ZM4.53604 9.16201C4.29604 9.15001 4.06204 9.12601 3.83404 9.09001C3.67804 9.06601 3.53704 9.09901 3.41104 9.18901C3.28504 9.27901 3.21304 9.40201 3.19504 9.55801C3.17704 9.71401 3.21304 9.85501 3.30304 9.98101C3.39304 10.107 3.51604 10.182 3.67204 10.206C3.92404 10.242 4.18804 10.266 4.46404 10.278C4.62004 10.29 4.75504 10.245 4.86904 10.143C4.98304 10.041 5.04604 9.91201 5.05804 9.75601C5.07004 9.60001 5.02504 9.46501 4.92304 9.35101C4.82104 9.23701 4.69204 9.17401 4.53604 9.16201Z" fill="white"/>\n</svg>\n'})),l("p",null,l("span",{class:"s-loyalty-points-banner-label"},salla.lang.get("pages.loyalty_program.earn")," "),l("span",{class:"s-loyalty-points-banner-label"},`+${this.pointsData.points}`," "),l("span",{class:"s-loyalty-points-banner-label"},salla.lang.get("pages.loyalty_program.loyalty_point")," "),l("span",{class:"s-loyalty-points-banner-description"},salla.lang.get("pages.loyalty_program.on_order_total_when_purchase"))))):null}get host(){return n(this)}};C.style="";export{C as salla_loyalty_points_banner}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as a,h as t,a as s}from"./p-
|
|
4
|
+
import{r as a,h as t,a as s}from"./p-DuhQONDF.js";import{s as l}from"./p-B-Rj6b9M.js";import{S as r}from"./p-CXRKXFgT.js";import{T as e}from"./p-bJly2Q9f.js";const o=class{constructor(t){a(this,t)}get productId(){return this.host.dataset.productId||salla.config.get("page.id")}componentWillLoad(){return salla.onReady().then((()=>salla.lang.onLoaded())).then((()=>l())).then((()=>this.prize())).catch((a=>salla.logger.error(a)))}handleClick(){salla.config.isGuest()?salla.event.dispatch("login::open"):this.exchangeModal.open()}render(){return"success"===this.prize.status&&this.productId?t("div",{class:"s-loyalty-program-banner-container"},t("div",null,t("p",{class:"s-loyalty-program-banner-container-banner-title"},salla.lang.get("pages.loyalty_program.want_to_redeem_free_product")),t("p",{class:"s-loyalty-program-banner-container-banner-subtitle"},salla.lang.get("pages.loyalty_program.exchange_points_for_free_product",{points:this.prize.data.cost_points}))),t("button",{onClick:()=>this.handleClick()},t("span",{innerHTML:r}),t("span",null,salla.lang.get("pages.loyalty_program.exchange_points"))),t("salla-modal",{ref:a=>this.exchangeModal=a,width:"sm"},this.prize.data?t("salla-reward-exchange",{productId:Number(this.productId),prize:this.prize.data}):"")):null}get host(){return s(this)}};(function(a,t,s,l){var r,e=arguments.length,o=e<3?t:null===l?l=Object.getOwnPropertyDescriptor(t,s):l;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(a,t,s,l);else for(var n=a.length-1;n>=0;n--)(r=a[n])&&(o=(e<3?r(o):e>3?r(t,s,o):r(t,s))||o);e>3&&o&&Object.defineProperty(t,s,o)})([e((async function(){if(!(salla.config.get("store.features")||[]).includes("loyalty-system"))return Promise.reject("Loyalty system is not enabled for merchant");const{loyalty_prize:a}=await salla.product.api.getDetails(this.productId);return a||Promise.reject("no loyalty prize for this product")}))],o.prototype,"prize",void 0),o.style="";export{o as salla_loyalty_banner}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as t,h as s,H as a}from"./p-
|
|
4
|
+
import{r as t,h as s,H as a}from"./p-DuhQONDF.js";const l=class{constructor(s){t(this,s),this.order=null,this.loading=!0}async componentWillLoad(){await salla.onReady(),await this.loadOrder()}async onOrderIdChange(){this.loading=!0,this.order=null,await this.loadOrder()}get paymentUrl(){return this.order?.customer_editing?.payment_url}async loadOrder(){const t=this.orderId||salla.config.get("page.id");if(t)try{const s=await salla.order.api.getDetails(t);this.order=s?.data??s??null}catch(t){salla.logger?.warn?.("[salla-edit-order-button] failed to fetch order details",t),this.order=null}finally{this.loading=!1}else this.loading=!1}renderEditButton(){return s("salla-count-down",{prefixText:salla.lang.getWithDefault("pages.orders.edit_within","يمكنك التعديل خلال"),buttonHref:this.order?.edit_url,buttonText:salla.lang.getWithDefault("pages.orders.edit_order","تعديل الطلب"),buttonIcon:"sicon-edit",date:this.order?.editable_until,horizontal:!0,autoSegments:!0,withButton:!0,labeled:!1,size:"sm",color:"primary"})}render(){return this.loading||!this.order?null:this.order?.is_editable?s(a,null,this.renderEditButton()):this.paymentUrl?s(a,null,s("salla-button",{href:this.paymentUrl,color:"primary",size:"small"},s("i",{class:"sicon-wallet"}),salla.lang.getWithDefault("pages.orders.pay_difference","دفع فارق المبلغ"))):null}static get watchers(){return{orderId:["onOrderIdChange"]}}};l.style=":host{display:block}";export{l as salla_edit_order_button}
|