@salla.sa/twilight-components 2.14.549 → 2.14.551
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/{Helper-6RI07gZo.js → Helper-D1YsoJud.js} +46 -0
- package/dist/cjs/{filepond-COUccQWv.js → filepond-C99K1KEB.js} +1 -1
- package/dist/cjs/{filepond-plugin-file-poster-B_yyvbJ6.js → filepond-plugin-file-poster-CggRjTNg.js} +1 -1
- package/dist/cjs/{filepond-plugin-file-validate-size-KDZtJpSs.js → filepond-plugin-file-validate-size-B009kdAV.js} +1 -1
- package/dist/cjs/{filepond-plugin-file-validate-type-Dbm_-1V2.js → filepond-plugin-file-validate-type-DZs9-bai.js} +1 -1
- package/dist/cjs/{filepond-plugin-image-edit-C-q8yFXi.js → filepond-plugin-image-edit-DNNheErX.js} +1 -1
- package/dist/cjs/{filepond-plugin-image-exif-orientation-C2Q2chpj.js → filepond-plugin-image-exif-orientation-ChN0IpOy.js} +1 -1
- package/dist/cjs/{filepond-plugin-image-preview-DVK8eIMv.js → filepond-plugin-image-preview-BZo2ftGo.js} +1 -1
- package/dist/cjs/{index-CSq9uCjw.js → index-0JUvtl0d.js} +6 -2
- package/dist/cjs/{intlTelInput-NQOLNYxO.js → intlTelInput-D84-rI5D.js} +1 -1
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/salla-accordion-body_2.cjs.entry.js +1 -1
- package/dist/cjs/salla-accordion_6.cjs.entry.js +2 -2
- package/dist/cjs/salla-add-product-button_5.cjs.entry.js +2 -2
- package/dist/cjs/salla-advertisement.cjs.entry.js +1 -1
- package/dist/cjs/salla-alert_2.cjs.entry.js +1 -1
- package/dist/cjs/salla-app-install-alert.cjs.entry.js +1 -1
- package/dist/cjs/salla-applied-filters.cjs.entry.js +175 -0
- package/dist/cjs/salla-apps-icons.cjs.entry.js +1 -1
- package/dist/cjs/salla-attachment-view_9.cjs.entry.js +11 -11
- package/dist/cjs/salla-badge.cjs.entry.js +1 -1
- package/dist/cjs/salla-basket-gap.cjs.entry.js +1 -1
- package/dist/cjs/salla-bullet-delivery_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-cart-summary-card.cjs.entry.js +1 -1
- package/dist/cjs/salla-cashback-banner.cjs.entry.js +1 -1
- package/dist/cjs/salla-comment-factors.cjs.entry.js +1 -1
- package/dist/cjs/salla-comment-form_9.cjs.entry.js +2 -2
- 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 +10 -11
- package/dist/cjs/salla-filters.cjs.entry.js +14 -79
- 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 +2 -2
- package/dist/cjs/salla-installment.cjs.entry.js +1 -1
- package/dist/cjs/salla-list-tile.cjs.entry.js +1 -1
- package/dist/cjs/salla-localization-modal.cjs.entry.js +1 -1
- package/dist/cjs/salla-login-modal.cjs.entry.js +1 -1
- package/dist/cjs/salla-loyalty-banner_10.cjs.entry.js +1 -1
- package/dist/cjs/salla-loyalty-exchange-product-card.cjs.entry.js +1 -1
- package/dist/cjs/salla-loyalty-points-banner.cjs.entry.js +1 -1
- package/dist/cjs/salla-loyalty-points-history.cjs.entry.js +1 -1
- package/dist/cjs/salla-loyalty-prize-item.cjs.entry.js +1 -1
- package/dist/cjs/salla-loyalty.cjs.entry.js +1 -1
- package/dist/cjs/salla-maintenance-alert.cjs.entry.js +1 -1
- package/dist/cjs/salla-map_2.cjs.entry.js +1 -1
- package/dist/cjs/salla-menu.cjs.entry.js +1 -1
- package/dist/cjs/salla-metadata.cjs.entry.js +1 -1
- package/dist/cjs/salla-multiple-bundle-product-cart_2.cjs.entry.js +1 -1
- package/dist/cjs/salla-multiple-bundle-product-options-modal_2.cjs.entry.js +1 -1
- package/dist/cjs/salla-multiple-bundle-product.cjs.entry.js +1 -1
- package/dist/cjs/salla-next-order-coupon.cjs.entry.js +1 -1
- package/dist/cjs/salla-notification-item_2.cjs.entry.js +2 -2
- package/dist/cjs/salla-offer-modal.cjs.entry.js +1 -1
- package/dist/cjs/salla-offer.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-branch.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-cancel.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-details-multiple-bundle-product.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-details-options.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-details.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-edit-item.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-edit-product-card.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-edit.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-options-modal_2.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-shipments.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-summary.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-totals-card.cjs.entry.js +1 -1
- package/dist/cjs/salla-orders.cjs.entry.js +2 -2
- package/dist/cjs/salla-payments.cjs.entry.js +1 -1
- package/dist/cjs/salla-placeholder.cjs.entry.js +1 -1
- package/dist/cjs/salla-price-range.cjs.entry.js +1 -1
- package/dist/cjs/salla-product-card-embed.cjs.entry.js +1 -1
- package/dist/cjs/salla-product-size-guide.cjs.entry.js +1 -1
- package/dist/cjs/salla-products-list.cjs.entry.js +2 -2
- package/dist/cjs/salla-products-slider.cjs.entry.js +2 -2
- package/dist/cjs/salla-quick-order.cjs.entry.js +1 -1
- package/dist/cjs/salla-rating-modal-v2.cjs.entry.js +2 -2
- package/dist/cjs/salla-rating-modal.cjs.entry.js +2 -2
- package/dist/cjs/salla-review-factors-tags.cjs.entry.js +1 -1
- package/dist/cjs/salla-review-order-item.cjs.entry.js +1 -1
- package/dist/cjs/salla-scopes.cjs.entry.js +1 -1
- package/dist/cjs/salla-search.cjs.entry.js +2 -2
- package/dist/cjs/salla-skeleton.cjs.entry.js +1 -1
- package/dist/cjs/salla-slider.cjs.entry.js +1 -1
- package/dist/cjs/salla-social-share.cjs.entry.js +1 -1
- package/dist/cjs/salla-social.cjs.entry.js +1 -1
- package/dist/cjs/salla-tab-content_3.cjs.entry.js +1 -1
- package/dist/cjs/salla-tiered-offer.cjs.entry.js +1 -1
- package/dist/cjs/salla-tooltip.cjs.entry.js +1 -1
- package/dist/cjs/salla-trust-badges.cjs.entry.js +1 -1
- package/dist/cjs/salla-user-menu.cjs.entry.js +1 -1
- package/dist/cjs/salla-user-profile.cjs.entry.js +1 -1
- package/dist/cjs/salla-user-settings.cjs.entry.js +1 -1
- package/dist/cjs/salla-verify.cjs.entry.js +1 -1
- package/dist/cjs/salla-wallet.cjs.entry.js +1 -1
- package/dist/cjs/salla-wishlist-actions.cjs.entry.js +1 -1
- package/dist/cjs/twilight.cjs.js +2 -2
- package/dist/cjs/{vanilla-picker-My41190Y.js → vanilla-picker-D8r5xyK7.js} +1 -1
- package/dist/collection/Helpers/Helper.js +28 -0
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/salla-applied-filters/salla-applied-filters.css +115 -0
- package/dist/collection/components/salla-applied-filters/salla-applied-filters.js +185 -0
- package/dist/collection/components/salla-filters/salla-filters.css +0 -119
- package/dist/collection/components/salla-filters/salla-filters.js +27 -73
- package/dist/components/Helper.js +47 -1
- package/dist/components/index.js +2 -2
- package/dist/components/salla-applied-filters.d.ts +11 -0
- package/dist/components/salla-applied-filters.js +195 -0
- package/dist/components/salla-filters-widget2.js +2 -21
- package/dist/components/salla-filters.js +10 -76
- package/dist/esm/{Helper-CBmYxrzX.js → Helper-DsjZ6kte.js} +47 -1
- package/dist/esm/{filepond-CA4TWKuz.js → filepond-DuMUHI7t.js} +1 -1
- package/dist/esm/{filepond-plugin-file-poster-C4_NyGjO.js → filepond-plugin-file-poster-Dv25V2UU.js} +1 -1
- package/dist/esm/{filepond-plugin-file-validate-size-DVV7mZ-K.js → filepond-plugin-file-validate-size-Dxl4yPm6.js} +1 -1
- package/dist/esm/{filepond-plugin-file-validate-type-DT1IX9KM.js → filepond-plugin-file-validate-type-C602myuq.js} +1 -1
- package/dist/esm/{filepond-plugin-image-edit-RrqhOPfq.js → filepond-plugin-image-edit-DLd3ht_R.js} +1 -1
- package/dist/esm/{filepond-plugin-image-exif-orientation-Dc9_Qlva.js → filepond-plugin-image-exif-orientation-BaQ5DNLu.js} +1 -1
- package/dist/esm/{filepond-plugin-image-preview-Iu7ULzAy.js → filepond-plugin-image-preview-C-RFNs7l.js} +1 -1
- package/dist/esm/{index-C0qiFNJn.js → index-BsIeN-bg.js} +6 -2
- package/dist/esm/{intlTelInput-CrkMI_sC.js → intlTelInput-Cf6zBu5Y.js} +1 -1
- package/dist/esm/loader.js +3 -3
- package/dist/esm/salla-accordion-body_2.entry.js +1 -1
- package/dist/esm/salla-accordion_6.entry.js +2 -2
- package/dist/esm/salla-add-product-button_5.entry.js +2 -2
- package/dist/esm/salla-advertisement.entry.js +1 -1
- package/dist/esm/salla-alert_2.entry.js +1 -1
- package/dist/esm/salla-app-install-alert.entry.js +1 -1
- package/dist/esm/salla-applied-filters.entry.js +173 -0
- package/dist/esm/salla-apps-icons.entry.js +1 -1
- package/dist/esm/salla-attachment-view_9.entry.js +11 -11
- package/dist/esm/salla-badge.entry.js +1 -1
- package/dist/esm/salla-basket-gap.entry.js +1 -1
- package/dist/esm/salla-bullet-delivery_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-cart-summary-card.entry.js +1 -1
- package/dist/esm/salla-cashback-banner.entry.js +1 -1
- package/dist/esm/salla-comment-factors.entry.js +1 -1
- package/dist/esm/salla-comment-form_9.entry.js +2 -2
- 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 +2 -3
- package/dist/esm/salla-filters.entry.js +8 -73
- 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 +2 -2
- package/dist/esm/salla-installment.entry.js +1 -1
- package/dist/esm/salla-list-tile.entry.js +1 -1
- package/dist/esm/salla-localization-modal.entry.js +1 -1
- package/dist/esm/salla-login-modal.entry.js +1 -1
- package/dist/esm/salla-loyalty-banner_10.entry.js +1 -1
- package/dist/esm/salla-loyalty-exchange-product-card.entry.js +1 -1
- package/dist/esm/salla-loyalty-points-banner.entry.js +1 -1
- package/dist/esm/salla-loyalty-points-history.entry.js +1 -1
- package/dist/esm/salla-loyalty-prize-item.entry.js +1 -1
- package/dist/esm/salla-loyalty.entry.js +1 -1
- package/dist/esm/salla-maintenance-alert.entry.js +1 -1
- package/dist/esm/salla-map_2.entry.js +1 -1
- package/dist/esm/salla-menu.entry.js +1 -1
- package/dist/esm/salla-metadata.entry.js +1 -1
- package/dist/esm/salla-multiple-bundle-product-cart_2.entry.js +1 -1
- package/dist/esm/salla-multiple-bundle-product-options-modal_2.entry.js +1 -1
- package/dist/esm/salla-multiple-bundle-product.entry.js +1 -1
- package/dist/esm/salla-next-order-coupon.entry.js +1 -1
- package/dist/esm/salla-notification-item_2.entry.js +2 -2
- package/dist/esm/salla-offer-modal.entry.js +1 -1
- package/dist/esm/salla-offer.entry.js +1 -1
- package/dist/esm/salla-order-branch.entry.js +1 -1
- package/dist/esm/salla-order-cancel.entry.js +1 -1
- package/dist/esm/salla-order-details-multiple-bundle-product.entry.js +1 -1
- package/dist/esm/salla-order-details-options.entry.js +1 -1
- package/dist/esm/salla-order-details.entry.js +1 -1
- package/dist/esm/salla-order-edit-item.entry.js +1 -1
- package/dist/esm/salla-order-edit-product-card.entry.js +1 -1
- package/dist/esm/salla-order-edit.entry.js +1 -1
- package/dist/esm/salla-order-options-modal_2.entry.js +1 -1
- package/dist/esm/salla-order-shipments.entry.js +1 -1
- package/dist/esm/salla-order-summary.entry.js +1 -1
- package/dist/esm/salla-order-totals-card.entry.js +1 -1
- package/dist/esm/salla-orders.entry.js +2 -2
- package/dist/esm/salla-payments.entry.js +1 -1
- package/dist/esm/salla-placeholder.entry.js +1 -1
- package/dist/esm/salla-price-range.entry.js +1 -1
- package/dist/esm/salla-product-card-embed.entry.js +1 -1
- package/dist/esm/salla-product-size-guide.entry.js +1 -1
- package/dist/esm/salla-products-list.entry.js +2 -2
- package/dist/esm/salla-products-slider.entry.js +2 -2
- package/dist/esm/salla-quick-order.entry.js +1 -1
- package/dist/esm/salla-rating-modal-v2.entry.js +2 -2
- package/dist/esm/salla-rating-modal.entry.js +2 -2
- package/dist/esm/salla-review-factors-tags.entry.js +1 -1
- package/dist/esm/salla-review-order-item.entry.js +1 -1
- package/dist/esm/salla-scopes.entry.js +1 -1
- package/dist/esm/salla-search.entry.js +2 -2
- package/dist/esm/salla-skeleton.entry.js +1 -1
- package/dist/esm/salla-slider.entry.js +1 -1
- package/dist/esm/salla-social-share.entry.js +1 -1
- package/dist/esm/salla-social.entry.js +1 -1
- package/dist/esm/salla-tab-content_3.entry.js +1 -1
- package/dist/esm/salla-tiered-offer.entry.js +1 -1
- package/dist/esm/salla-tooltip.entry.js +1 -1
- package/dist/esm/salla-trust-badges.entry.js +1 -1
- package/dist/esm/salla-user-menu.entry.js +1 -1
- package/dist/esm/salla-user-profile.entry.js +1 -1
- package/dist/esm/salla-user-settings.entry.js +1 -1
- package/dist/esm/salla-verify.entry.js +1 -1
- package/dist/esm/salla-wallet.entry.js +1 -1
- package/dist/esm/salla-wishlist-actions.entry.js +1 -1
- package/dist/esm/twilight.js +3 -3
- package/dist/esm/{vanilla-picker-Cf9pEgos.js → vanilla-picker-S7qZ7YZm.js} +1 -1
- package/dist/twilight/{p-2a64e50b.entry.js → p-01406425.entry.js} +1 -1
- package/dist/twilight/{p-i-tkvIE0.js → p-035DwuUC.js} +1 -1
- package/dist/twilight/{p-bbd2cb8c.entry.js → p-07adeb89.entry.js} +1 -1
- package/dist/twilight/{p-e806b976.entry.js → p-0944d367.entry.js} +1 -1
- package/dist/twilight/{p-e190e1cf.entry.js → p-0a332226.entry.js} +1 -1
- package/dist/twilight/{p-adbf6324.entry.js → p-0e3d72ab.entry.js} +1 -1
- package/dist/twilight/{p-368beadc.entry.js → p-1118bee2.entry.js} +1 -1
- package/dist/twilight/{p-a37a692a.entry.js → p-13c4b450.entry.js} +1 -1
- package/dist/twilight/{p-e36310e2.entry.js → p-18639885.entry.js} +1 -1
- package/dist/twilight/{p-dc7f11e4.entry.js → p-18a604c5.entry.js} +1 -1
- package/dist/twilight/{p-5364f42e.entry.js → p-1abe8321.entry.js} +1 -1
- package/dist/twilight/{p-27b6fd51.entry.js → p-1bf18c56.entry.js} +1 -1
- package/dist/twilight/{p-c3bed022.entry.js → p-211324e6.entry.js} +1 -1
- package/dist/twilight/p-22cb8a9c.entry.js +4 -0
- package/dist/twilight/{p-c2005d4a.entry.js → p-2331e63a.entry.js} +1 -1
- package/dist/twilight/{p-ab86dc29.entry.js → p-27456209.entry.js} +1 -1
- package/dist/twilight/{p-c72a1861.entry.js → p-2a3d30d1.entry.js} +1 -1
- package/dist/twilight/{p-4d149e9e.entry.js → p-2a683382.entry.js} +1 -1
- package/dist/twilight/{p-7e26332e.entry.js → p-2bef08e8.entry.js} +1 -1
- package/dist/twilight/{p-73db9793.entry.js → p-2c48bb97.entry.js} +1 -1
- package/dist/twilight/p-2df31e90.entry.js +4 -0
- package/dist/twilight/{p-7122a097.entry.js → p-2ff7bb22.entry.js} +1 -1
- package/dist/twilight/{p-ed5d8787.entry.js → p-357b5593.entry.js} +1 -1
- package/dist/twilight/{p-8c086859.entry.js → p-3aa6fa7d.entry.js} +1 -1
- package/dist/twilight/{p-a5185029.entry.js → p-3c2cc4fe.entry.js} +1 -1
- package/dist/twilight/{p-c15eeb62.entry.js → p-3fb485a6.entry.js} +1 -1
- package/dist/twilight/{p-e4c3ca60.entry.js → p-43f8f33b.entry.js} +1 -1
- package/dist/twilight/{p-354da069.entry.js → p-47713dd1.entry.js} +1 -1
- package/dist/twilight/{p-86cec54b.entry.js → p-49738042.entry.js} +1 -1
- package/dist/twilight/{p-499ccb8b.entry.js → p-49f9e536.entry.js} +1 -1
- package/dist/twilight/{p-945b3f38.entry.js → p-4ef06a6f.entry.js} +1 -1
- package/dist/twilight/{p-55c716a4.entry.js → p-501c0798.entry.js} +1 -1
- package/dist/twilight/{p-a5f477fd.entry.js → p-523572e9.entry.js} +1 -1
- package/dist/twilight/{p-f3bd1c09.entry.js → p-54974d98.entry.js} +1 -1
- package/dist/twilight/{p-a9554697.entry.js → p-56845467.entry.js} +1 -1
- package/dist/twilight/{p-3c99951e.entry.js → p-569c6d6c.entry.js} +1 -1
- package/dist/twilight/{p-14f2c393.entry.js → p-56f164bb.entry.js} +1 -1
- package/dist/twilight/{p-8fa81b10.entry.js → p-5918dd8d.entry.js} +1 -1
- package/dist/twilight/{p-95117a08.entry.js → p-5ba2eb55.entry.js} +1 -1
- package/dist/twilight/{p-28efc3a8.entry.js → p-5cd4b67f.entry.js} +1 -1
- package/dist/twilight/{p-bf9cc549.entry.js → p-5dfd449d.entry.js} +1 -1
- package/dist/twilight/{p-a30ae3e6.entry.js → p-683db553.entry.js} +1 -1
- package/dist/twilight/{p-d322a3e8.entry.js → p-68d754be.entry.js} +1 -1
- package/dist/twilight/{p-84181d45.entry.js → p-6a746b8a.entry.js} +1 -1
- package/dist/twilight/{p-0357b501.entry.js → p-6c5a1ded.entry.js} +1 -1
- package/dist/twilight/{p-4358c48e.entry.js → p-6d787fa0.entry.js} +1 -1
- package/dist/twilight/{p-6da4a9b3.entry.js → p-6edd1008.entry.js} +1 -1
- package/dist/twilight/{p-7bdf543a.entry.js → p-6f3516a1.entry.js} +1 -1
- package/dist/twilight/{p-a72bf47b.entry.js → p-6f58ac6a.entry.js} +1 -1
- package/dist/twilight/{p-4cfccc31.entry.js → p-704553fb.entry.js} +1 -1
- package/dist/twilight/{p-f51a1326.entry.js → p-709c2184.entry.js} +1 -1
- package/dist/twilight/{p-453f92f9.entry.js → p-83a5b8a4.entry.js} +1 -1
- package/dist/twilight/{p-c0d89d74.entry.js → p-847cdd79.entry.js} +1 -1
- package/dist/twilight/p-84cffb13.entry.js +4 -0
- package/dist/twilight/{p-dc51e991.entry.js → p-869fe4c0.entry.js} +1 -1
- package/dist/twilight/{p-32af49cd.entry.js → p-8711224a.entry.js} +1 -1
- package/dist/twilight/{p-ee7530fe.entry.js → p-8ebb86ce.entry.js} +1 -1
- package/dist/twilight/{p-875beddd.entry.js → p-9025e5d9.entry.js} +1 -1
- package/dist/twilight/{p-4a8b3e89.entry.js → p-906b36e3.entry.js} +1 -1
- package/dist/twilight/{p-a9b9deb9.entry.js → p-90f29c99.entry.js} +1 -1
- package/dist/twilight/{p-42efd1b1.entry.js → p-9dd126e2.entry.js} +1 -1
- package/dist/twilight/{p-a909aff5.entry.js → p-9f431f78.entry.js} +1 -1
- package/dist/twilight/{p-5be5be8b.entry.js → p-9fdbe8a0.entry.js} +1 -1
- package/dist/twilight/{p-CW2JQnYK.js → p-B3oo4tIx.js} +1 -1
- package/dist/twilight/p-BRZVMxhy.js +9 -0
- package/dist/twilight/{p-C0qiFNJn.js → p-BsIeN-bg.js} +1 -1
- package/dist/twilight/{p-ClV-F79e.js → p-CPiqlSTo.js} +1 -1
- package/dist/twilight/{p-CyO2XGkr.js → p-CaCiueRc.js} +1 -1
- package/dist/twilight/p-D6rFREuQ.js +4 -0
- package/dist/twilight/{p-BeFR_h3q.js → p-DNS31w5e.js} +1 -1
- package/dist/twilight/{p-l7Rr63jq.js → p-DeX830vG.js} +1 -1
- package/dist/twilight/{p-b5028411.entry.js → p-a01f64e7.entry.js} +1 -1
- package/dist/twilight/{p-344f751a.entry.js → p-a037e47d.entry.js} +1 -1
- package/dist/twilight/{p-709af483.entry.js → p-a0ed97f5.entry.js} +1 -1
- package/dist/twilight/{p-8f2f8693.entry.js → p-a30390a7.entry.js} +1 -1
- package/dist/twilight/{p-b3ba53c5.entry.js → p-a344db00.entry.js} +1 -1
- package/dist/twilight/{p-b6d259be.entry.js → p-a3579980.entry.js} +1 -1
- package/dist/twilight/{p-7a1169f6.entry.js → p-a46a9d28.entry.js} +1 -1
- package/dist/twilight/{p-33c2f3bc.entry.js → p-a64771f7.entry.js} +1 -1
- package/dist/twilight/{p-a243d3cc.entry.js → p-a8316527.entry.js} +1 -1
- package/dist/twilight/{p-e2d501f5.entry.js → p-a9ef3c52.entry.js} +1 -1
- package/dist/twilight/{p-ecaf7d87.entry.js → p-aa8962f8.entry.js} +1 -1
- package/dist/twilight/{p-0dea4239.entry.js → p-aa91a230.entry.js} +1 -1
- package/dist/twilight/{p-b2662a4f.entry.js → p-af348a67.entry.js} +1 -1
- package/dist/twilight/{p-1adf1893.entry.js → p-b1e0bc90.entry.js} +1 -1
- package/dist/twilight/{p-0d44c47f.entry.js → p-b238c74b.entry.js} +1 -1
- package/dist/twilight/{p-6da0b2b3.entry.js → p-b5a2342c.entry.js} +1 -1
- package/dist/twilight/{p-b73b7e15.entry.js → p-be0ac755.entry.js} +1 -1
- package/dist/twilight/{p-6bedb896.entry.js → p-cdba9d35.entry.js} +1 -1
- package/dist/twilight/{p-fba13fd5.entry.js → p-d5215891.entry.js} +1 -1
- package/dist/twilight/{p-a8561cc8.entry.js → p-e3e2baa2.entry.js} +1 -1
- package/dist/twilight/{p-7f11af86.entry.js → p-e875f53e.entry.js} +1 -1
- package/dist/twilight/{p-ae96e338.entry.js → p-ea968ba3.entry.js} +1 -1
- package/dist/twilight/{p-88148fed.entry.js → p-eb3a095b.entry.js} +1 -1
- package/dist/twilight/{p-c82b8aa7.entry.js → p-ebc6ba28.entry.js} +1 -1
- package/dist/twilight/{p-b8da968d.entry.js → p-ecdbd18f.entry.js} +1 -1
- package/dist/twilight/{p-4ebdef90.entry.js → p-ef145c1e.entry.js} +1 -1
- package/dist/twilight/{p-5d71c16a.entry.js → p-efe6493f.entry.js} +1 -1
- package/dist/twilight/{p-5d261682.entry.js → p-f037e508.entry.js} +1 -1
- package/dist/twilight/{p-34889d17.entry.js → p-f4f355e5.entry.js} +1 -1
- package/dist/twilight/{p-862f7fda.entry.js → p-fed3efba.entry.js} +1 -1
- package/dist/twilight/{p-b217fea1.entry.js → p-ff37c2af.entry.js} +1 -1
- package/dist/twilight/{p-yV2X3Oc1.js → p-mgSPapOV.js} +1 -1
- package/dist/twilight/{p-C7NprL2x.js → p-wqmCmzsY.js} +1 -1
- package/dist/twilight/twilight.esm.js +1 -1
- package/dist/types/Helpers/Helper.d.ts +10 -0
- package/dist/types/components/salla-applied-filters/salla-applied-filters.d.ts +37 -0
- package/dist/types/components/salla-filters/salla-filters.d.ts +3 -11
- package/dist/types/components.d.ts +17 -0
- package/package.json +5 -5
- package/dist/cjs/interfaces-DZDQwN6-.js +0 -23
- package/dist/esm/interfaces-DL4h2bc3.js +0 -23
- package/dist/twilight/p-01b52f2f.entry.js +0 -4
- package/dist/twilight/p-B3th5No1.js +0 -9
- package/dist/twilight/p-DL4h2bc3.js +0 -4
- package/dist/twilight/p-DOBDDG4K.js +0 -4
- package/dist/twilight/p-c55c576c.entry.js +0 -4
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as t,f as i,h as a,H as s,a as e}from"./p-C0qiFNJn.js";import{S as r}from"./p-CeFAfcTv.js";import{S as o}from"./p-lMgMt31Q.js";import{C as n}from"./p-BV4kqbdL.js";import{H as l}from"./p-DOBDDG4K.js";import{I as d}from"./p-C-tzSDxw.js";import{W as h}from"./p-CgR-T_ZS.js";import{M as m}from"./p-DmgxDvXL.js";import{b as c}from"./p-DrXX8XG8.js";import"./p-CgtvEd63.js";function g(t){const i=t.split(/[?#]/,1)[0];return/\.(mp4|webm|mov|avi|mkv)$/i.test(i)}function p(t){return t.reduce(((t,i)=>i?(g(i)?t.videos.push(i):t.images.push(i),t):t),{images:[],videos:[]})}function u(t){return p(t.map((t=>t?.url||"")).filter(Boolean))}function f(t){return t?Array.isArray(t)?t.filter(Boolean):t.split(",").map((t=>t.trim())).filter(Boolean):[]}function w(t){return t.reduce(((t,i)=>(g(i?.url||"")?t.video+=1:t.image+=1,t)),{image:0,video:0})}function v(t,i){const a=String(i);let s=!1;return t.filter((t=>{const i=null!=t?.id?String(t.id):"",e=String(t?.url??"");return!(i===a||e===a)||!!s||(s=!0,!1)}))}function b(t,i,a){const{images:s,videos:e}=u(a);t&&(t.value=s.join(",")),i&&(i.value=e.join(","))}function y(t,i,a){i||delete t.images,a||delete t.videos}const _="600px",x=class{constructor(i){t(this,i),this.hasError=!1,this.showContactWidget=!0,this.errorMessage="",this.images=[],this.productImages={},this.editItemImages=[],this.productReviewFactors={},this.editFactorRatings={},this.productMainRatings={},this.productFactorRatings={},this.contact_body=(t,i,a)=>salla.lang.get("pages.rating.contact_subject",{store:t,id:i,customer:a}),this.editMode=!1,this.defaultMode=!1,this.deleteMode=!1,this.shouldOpenDeleteModal=!1,this.editItem=null,this.allowAttachImages=!1,this.allowAttachVideos=!1,this.allowContactSupport=!1,this.uploadCounts={},this.uploadImageCounts={},this.uploadVideoCounts={},this.hasUploadsInProgress=!1,this.loyaltyImageRatingPoints=0,this.dragAndDropFilesLabel=salla.lang.get("common.uploader.drag_and_drop_files"),this.contactSubjectLabel=salla.lang.get("pages.rating.contact_subject"),this.editReviewLabel=salla.lang.get("pages.rating.edit_review"),this.allowedImagesTypesLabel=salla.lang.get("common.uploader.allowed_images_types"),this.threeImagesMax=salla.lang.get("common.uploader.max_three_images"),this.areYouSureLabel=salla.lang.get("pages.rating.are_you_sure_you_want_to_delete_review"),this.confirmDeletionLabel=salla.lang.get("pages.rating.confirm_deletion"),this.cancelLabel=salla.lang.get("common.elements.cancel"),this.confirmDeleteBtn=salla.lang.get("common.elements.confirm_delete"),this.updatedSuccessfullyLabel=salla.lang.get("pages.rating.review_updated_successfully"),this.deletedSuccessfullyLabel=salla.lang.get("pages.rating.review_deleted_successfully"),this.contactUsLabel=salla.lang.get("blocks.footer.social"),this.requiredFactorsLabel=salla.lang.get("pages.rating.rate_required_factors"),this.rateTheFollowingLabel=salla.lang.get("pages.rating.rate_the_following_factors"),this.loyaltyPointsForImagesLabel=salla.lang.get("pages.rating.loyalty_points_for_images",{points:":points"}),this.contentRefs=[],this.hiddenInputs=[],this.hiddenVideoInputs=[],this.uploadingByProductId={},this.userFilledFactorKeys={},this.boundRatingRows=new WeakSet,this.stepsCount=0,this.currentIndex=0,this.submitted=[],this.thanksCountdownInterval=null,this.MAX_IMAGE_UPLOAD_LIMIT=10,this.MAX_VIDEO_UPLOAD_LIMIT=5,this.MAX_VIDEO_FILE_SIZE="100MB",this.MAX_VIDEO_DURATION=60,this.MAX_PARALLEL_UPLOADS=10,this.scheduleWizardSetup=!1}syncStoreSettings(){void 0===this.orderId&&(this.orderId=salla.config.get("page.id")),this.allowAttachImages=!!salla.config.get("store.settings.rating.allow_attach_images"),this.allowAttachVideos=!!salla.config.get("store.settings.rating.allow_attach_videos"),this.allowContactSupport=!!salla.config.get("store.settings.rating.allow_contact_support"),this.refreshMediaLabels()}canAttachMedia(){return this.allowAttachImages||this.allowAttachVideos}getMediaUploadAccept(){return c(this.allowAttachImages,this.allowAttachVideos)}refreshMediaLabels(){this.allowedImagesTypesLabel=this.getAllowedMediaTypesLabel(),this.threeImagesMax=this.getMaxUploadHintLabel()}getAllowedMediaTypesLabel(){return this.allowAttachImages&&this.allowAttachVideos?salla.lang.get("common.uploader.allowed_media_types"):this.allowAttachImages?salla.lang.get("common.uploader.allowed_images_types"):this.allowAttachVideos?salla.lang.get("common.uploader.allowed_videos_types"):""}getMaxUploadHintLabel(){return this.allowAttachImages&&this.allowAttachVideos?salla.lang.get("common.uploader.max_three_images"):this.allowAttachImages?salla.lang.get("common.uploader.max_images_count",{count:this.MAX_IMAGE_UPLOAD_LIMIT}):this.allowAttachVideos?salla.lang.get("common.uploader.max_videos_count",{count:this.MAX_VIDEO_UPLOAD_LIMIT}):""}setUploadCount(t,i,a,s){this.uploadCounts={...this.uploadCounts,[t]:i},null!=a&&(this.uploadImageCounts={...this.uploadImageCounts,[t]:a}),null!=s&&(this.uploadVideoCounts={...this.uploadVideoCounts,[t]:s})}setUploaderProcessing(t,i){this.uploadingByProductId={...this.uploadingByProductId,[t]:i},this.hasUploadsInProgress=Object.values(this.uploadingByProductId).some(Boolean)}scheduleUploaderHeightRefresh(){[50,150,350].forEach((t=>{setTimeout((()=>this.updateBodyHeight()),t)}))}handleGalleryCountUpdate(t,i){this.setUploadCount(t,i.count,i.imageCount,i.videoCount),this.setUploaderProcessing(t,!!i.uploading),this.scheduleUploaderHeightRefresh()}isUnverifiedReview(){return null===this.orderId&&!!this.productId}getRatingOrderId(){return this.orderId||salla.config.get("page.id")}getSubmitOrderId(){return this.orderId}isCustomerOrderShape(t){if(!t||"object"!=typeof t)return!1;const i=t;return!!i.rating&&(Array.isArray(i.items)||Array.isArray(i.products)||Array.isArray(i.rating?.product)||Array.isArray(i.rating?.products))}getBootstrapOrder(){const t=salla.config.get("page");if(this.isCustomerOrderShape(t))return t;if(t&&"object"==typeof t){const i=t;if(Array.isArray(i.products))return t;const a=i.order;if(this.isCustomerOrderShape(a))return a}}async loadCustomerOrderForEdit(){const t=this.getBootstrapOrder();if(t?.rating?.product||t?.rating?.products)this.order=t;else try{const t=await salla.api.withoutNotifier((()=>salla.order.api.getDetails(this.getRatingOrderId())));t?.data&&(this.order=t.data)}catch(t){if(!this.order){const t=await salla.api.withoutNotifier((()=>salla.rating.api.order(this.getRatingOrderId())));this.order=t.data}}}getOrderProductRatings(t=this.order){return t?.rating?[...this.normalizeToArray(t.rating.product),...this.normalizeToArray(t.rating.products)]:[]}getMatchedProductRating(t=this.order,i,a){return this.getOrderProductRatings(t).find((t=>Number(t?.id??t?.feedback_id)===Number(a)||Number(t?.product_id??t?.product?.id)===Number(i)))}hasRatingFeedback(t){const i=t?.rating;return null!=i&&""!==i&&Number(i)>0}isTestimonialsEnabled(t=this.order){return!(this.productId||!1===t?.testimonials_enabled||this.hasRatingFeedback(t?.store?.feedback)||!0!==t?.testimonials_enabled&&!t?.allowed_ratings?.testimonials_enabled)}isProductsEnabled(t=this.order){return!1!==t?.products_enabled&&this.getRateableProducts(t).length>0}isShippingEnabled(t=this.order){return!(this.productId||!1===t?.shipping_enabled||this.hasRatingFeedback(t?.shipping?.feedback)||!t?.shipping?.company||!0!==t?.shipping_enabled&&!t?.allowed_ratings?.shipping_enabled)}getOrderProducts(t=this.order){return Array.isArray(t?.products)?t.products.filter((t=>t?.product?.id)):[]}getRateableProducts(t=this.order){return this.getOrderProducts(t).filter((t=>!(this.hasRatingFeedback(t?.feedback)||this.productId&&String(t.product.id)!==String(this.productId))))}getStepsCount(t=this.order){if(!t)return 0;let i=0;return this.isTestimonialsEnabled(t)&&i++,this.isProductsEnabled(t)&&(i+=this.getRateableProducts(t).length),this.isShippingEnabled(t)&&t.shipping?.company&&i++,i}afterOrderLoaded(){this.stepsCount=this.getStepsCount(),this.scheduleWizardSetup=!0,i(this)}async setOrder(t,i){this.orderId=t,this.productId=i,this.order=void 0,this.hasError=!1,this.errorMessage=void 0,this.showContactWidget=!0}async loadUnverifiedProductOrder(){const t=await salla.api.withoutNotifier((()=>salla.product.api.getDetails(this.productId))).catch((()=>null)),i=t?.data;this.order={products:[{feedback:void 0,product:{id:Number(this.productId),name:i?.name||"",thumbnail:i?.image?.url||salla.url.cdn("images/s-empty.png")}}],products_enabled:!0,testimonials_enabled:!1,shipping_enabled:!1,thanks_message:""},this.productReviewFactors=await this.fetchAllProductReviewFactors(this.order)}escapeHtml(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}getModalTitle(){if(this.isUnverifiedReview()){const t=this.escapeHtml(this.getRateableProducts()[0]?.product?.name||"");return`${salla.lang.get("pages.rating.rate")} ${t}`.trim()}return`${salla.lang.get("pages.rating.rate_order")} <span class="unicode">(#${this.order?.id})</span>`}async open(){return await salla.onReady(),this.syncStoreSettings(),this.defaultMode=!0,this.currentIndex=0,this.submitted=[],new Promise((t=>{setTimeout((()=>{this.modal?.open().then((()=>this.order||(this.isUnverifiedReview()?this.loadUnverifiedProductOrder():salla.api.withoutNotifier((()=>salla.rating.api.order(this.getRatingOrderId()))).then((async t=>{this.order=t.data,this.productReviewFactors=await this.fetchAllProductReviewFactors(t.data)}))))).then((()=>this.readyUpLoyaltyPoints())).then((()=>this.modal?.setTitle(this.getModalTitle()))).then((()=>{const t={};for(const i of this.getRateableProducts())t[i.product.id]=[];this.productImages=t,this.uploadCounts=Object.fromEntries(Object.keys(t).map((t=>[Number(t),0])))})).then((()=>this.modal?.stopLoading())).then((()=>this.afterOrderLoaded())).catch((i=>{t(!1),this.hasError=!0,this.errorMessage=i.response?.data?.error?.message||i.response?.data,this.modal?.stopLoading()})),t(!0)}),50)}))}async openEditModal(t){await salla.onReady(),this.syncStoreSettings(),this.defaultMode=!1,this.editMode=!0,this.editType=t.type,this.editFeedbackId=t.feedback_id;try{await this.fetchEditItem(t.feedback_id),await this.readyUpLoyaltyPoints(),"product"===this.editType&&this.editItem?.product?.id&&(await this.loadCustomerOrderForEdit(),await this.ensureProductFactorsLoaded(this.editItem.product.id),this.editFactorRatings={...this.buildEditFactorRatings(this.editItem.product.id)},this.markExistingFactorRatingsAsUserFilled(this.editItem.product.id,this.editFactorRatings)),this.editModal?.open(),"product"===this.editType&&this.canAttachMedia()&&this.scheduleUploaderHeightRefresh()}catch(t){this.hasError=!0,this.errorMessage=t.response?.data?.error?.message||t.response?.data}}async fetchEditItem(t){const i=`rating/${t}/show`,a=await salla.api.request(i);if(this.editItem=a.data,this.canAttachMedia()&&"product"==this.editType){const t=(this.editItem.images||[]).filter(Boolean),i=(this.editItem.videos||[]).filter(Boolean);let a=[...t,...i];if(!i.length&&t.length){const i=p(t);a=[...i.images,...i.videos]}if(a=a.filter((t=>g(t)?this.allowAttachVideos:this.allowAttachImages)),a.length){this.editItemImages=a.map((t=>function(t){return{id:t,url:t}}(t)));const t=w(this.editItemImages);this.setUploadCount(this.editItem.product.id,this.editItemImages.length,t.image,t.video)}}}async editReview(){if(this.hasUploadsInProgress)return;const t=`rating/${this.editFeedbackId}`;let i;if("product"===this.editType){const t=this.editModal?.querySelector('[data-type="products"]')||this.currentTab;if(i=this.buildProductRatingPayload(this.collectFormData(t),t),!i.product_id&&this.editItem?.product?.id&&(i.product_id=String(this.editItem.product.id)),this.canAttachMedia()){const{images:t,videos:a}=u(this.editItemImages);this.allowAttachImages&&(i.images=t),this.allowAttachVideos&&(i.videos=a)}y(i,this.allowAttachImages,this.allowAttachVideos)}else i=this.collectFormData(this.editModal),i.images&&(i.images=f(i.images)),i.videos&&(i.videos=f(i.videos)),y(i,this.allowAttachImages,this.allowAttachVideos);await salla.api.request(t,i,"put").then((t=>{this.editModal?.close(),salla.notify.success(t.message||this.updatedSuccessfullyLabel),setTimeout((()=>{window.location.reload()}),500)}))}async openDeleteModal(t){return this.defaultMode=!1,this.deleteMode=!0,this.deleteFeedbackId=t.feedback_id,this.shouldOpenDeleteModal=!0,new Promise((t=>{setTimeout((()=>{this.deleteModal?.open().then((()=>t(!0)))}),50)}))}async deleteReview(){const t=`rating/${this.deleteFeedbackId}`;await salla.api.request(t,null,"delete").then((()=>{this.deleteModal?.close(),salla.notify.success(this.deletedSuccessfullyLabel),setTimeout((()=>{window.location.reload()}),500)}))}async close(){return this.modal?.close()}handleWizard(){this.steps=this.modal?.querySelectorAll(".s-rating-modal-step"),this.dots=this.modal?.querySelectorAll(".s-rating-modal-step-dot"),0!==this.stepsCount?this.showActiveStep():this.showThankYou()}refreshWizardRefs(){this.modal&&(this.steps=this.modal.querySelectorAll(".s-rating-modal-step"),this.dots=this.modal.querySelectorAll(".s-rating-modal-step-dot"))}showActiveStep(t=null){if(this.refreshWizardRefs(),this.currentTab=t||this.steps?.[this.currentIndex],!this.currentTab)return;l.toggleClassIf(".s-rating-modal-step-dot","s-rating-modal-bg-gray","s-rating-modal-bg-primary",(t=>t!=this.dots?.[this.currentIndex])).toggleClassIf(".s-rating-modal-step","s-rating-modal-active","s-rating-modal-hidden",(t=>t==this.currentTab)),0!==this.currentIndex&&(l.toggleElementClassIf(this.currentTab,"s-rating-modal-unactive","s-rating-modal-hidden",(()=>!0)),setTimeout((()=>l.toggleElementClassIf(this.currentTab,"s-rating-modal-active","s-rating-modal-unactive",(()=>!0))),300));const i=this.steps?.[this.currentIndex+1]?.dataset.type;this.nextBtn?.setText(i?`${salla.lang.get("pages.rating.rate")} ${salla.lang.get(`pages.rating.${i}`)}`:salla.lang.get("pages.rating.send_ratings")),setTimeout((()=>this.updateBodyHeight()),0),setTimeout((()=>this.updateBodyHeight()),150)}updateBodyHeight(){this.body&&this.currentTab&&(this.body.style.height="products"!==this.currentTab.dataset.type?`${this.currentTab.offsetHeight+(this.editMode?60:0)}px`:"auto")}previousTab(){this.currentIndex>0&&this.currentIndex--,l.toggleElementClassIf(this.backBtn,"s-rating-modal-unvisiable","block",(()=>0==this.currentIndex)),this.showActiveStep()}async submit(){if(!this.hasUploadsInProgress){this.refreshWizardRefs();try{this.submittedBefore()||this.validate(),salla.config.canLeave=!1,await(this.nextBtn?.load()),this.submittedBefore()||await this.sendFeedback(),this.currentTab?.querySelectorAll("[name],.s-rating-modal-btn-star").forEach((t=>t.setAttribute("disabled",""))),this.currentIndex<this.stepsCount&&this.currentIndex++,this.showActiveStep(),l.toggleClassIf("#prev-btn","block","s-rating-modal-unvisiable",(()=>!0)),this.currentIndex===this.stepsCount&&(this.showThankYou(),this.showContactWidget=!1)}finally{this.nextBtn?.stop(),salla.config.canLeave=!0}}}submittedBefore(){return this.submitted.includes(this.currentIndex)}getRatingHiddenInput(t){const i=t,a=i.querySelector?.(".rating_hidden_input");if(a?.name)return a;const s=i.querySelector?.("salla-rating-stars");return s?.shadowRoot?.querySelector(".rating_hidden_input")||null}collectNamedInputs(t){const i=new Set,a=[],s=t=>{t?.name&&!i.has(t)&&(i.add(t),a.push(t))};return t.querySelectorAll("[name]").forEach((t=>{t.closest("salla-file-upload")||s(t)})),t.querySelectorAll("salla-rating-stars").forEach((t=>{s(this.getRatingHiddenInput(t))})),a}normalizeFactorsList(t){return t?Array.isArray(t)?t:"object"==typeof t?Object.values(t).filter((t=>t&&"object"==typeof t)):[]:[]}validate(t=null,i=null){if(!t&&"products"===this.currentTab?.dataset?.type)return void this.currentTab.querySelectorAll(".rating-outer-form").forEach((t=>this.validate(t,"product")));const a=t??this.currentTab;if(!a)return;const s=a.querySelector(".s-rating-modal-product-rating-row-main"),e=this.getRatingHiddenInput(s||a),r=e?.value,o=a.querySelector(".s-rating-modal-validation-msg"),n=i||a.getAttribute("data-type");if(!r)throw o.innerHTML=salla.lang.get(`pages.rating.rate_${n}_stars`).replace(" (:item)",""),new Error(o.innerHTML);if("product"===n&&Array.from(a.querySelectorAll('.s-rating-modal-product-factor-row[data-required="true"]')).some((t=>{const i=this.getRatingHiddenInput(t);return!i?.value})))throw o.innerHTML=this.requiredFactorsLabel,new Error(o.innerHTML);o&&(o.innerHTML="")}collectFormData(t=this.currentTab){if(!t)return{};const i={};return this.collectNamedInputs(t).forEach((t=>{const a=salla.helpers.inputData(t.name,t.value,i);i[a.name]=a.value})),i}buildProductRatingPayload(t,i=this.currentTab){if(!i)return{};if(!t.rating){const a=i.querySelector(".s-rating-modal-product-rating-row-main"),s=this.getRatingHiddenInput(a||i);s?.value&&(t.rating=s.value)}const a=Number(t.product_id);let s=[],e=[];t.images?s=f(t.images):this.editMode&&this.canAttachMedia()&&a?s=u(this.editItemImages).images:this.canAttachMedia()&&a&&(s=u(this.productImages[a]||[]).images),t.videos?e=f(t.videos):this.editMode&&this.canAttachMedia()&&a?e=u(this.editItemImages).videos:this.canAttachMedia()&&a&&(e=u(this.productImages[a]||[]).videos);const r=this.normalizeFactorsList(t.factors).filter((t=>t?.id&&t?.rating)).map((t=>({id:String(t.id),rating:String(t.rating)}))),o={order_id:this.getSubmitOrderId(),product_id:String(t.product_id),rating:String(t.rating),comment:t.comment||t.content||"",factors:r,type:"products"};return this.allowAttachImages&&(o.images=s),this.allowAttachVideos&&(o.videos=e),o}async sendFeedback(){this.refreshWizardRefs();const t=this.currentTab?.dataset?.type;if("products"===t){const t=this.collectFormData(this.currentTab),i=this.buildProductRatingPayload(t,this.currentTab);if(!i.product_id||!i.rating)throw new Error("Missing product rating data");const a=await salla.rating.api.products(i);return this.submitted.push(this.currentIndex),a}const i=this.collectFormData(this.currentTab);if(0===Object.keys(i).length)return;if(i.order_id=this.getSubmitOrderId(),i.type=t,!t)return;const a=await salla.rating.api[t](i);return this.submitted.push(this.currentIndex),a}clearThanksCountdown(){null!==this.thanksCountdownInterval&&(clearInterval(this.thanksCountdownInterval),this.thanksCountdownInterval=null)}showThankYou(){let t=10;this.clearThanksCountdown(),this.thanksCountdownInterval=setInterval((()=>{this.thanksTime&&(this.thanksTime.innerHTML="00:0"+t--,t>0||(this.clearThanksCountdown(),this.thanksTime.remove(),this.close().then((()=>window.location.reload()))))}),1e3),this.modal?.querySelector(".s-rating-modal-footer")?.classList.add("s-rating-modal-unvisiable"),this.showActiveStep(this.thanksTab)}getFilepondPlaceholder(){return`<div class="s-rating-modal-filepond-placeholder"><span class="s-rating-modal-filepond-placeholder-icon">${d}</span><p class="s-rating-modal-filepond-placeholder-text">${this.dragAndDropFilesLabel}<br>\n <span> ${this.allowedImagesTypesLabel} <br> ${this.threeImagesMax} </span></p></div>`}getCustomerName(){return`${salla.config.get("user.first_name")||salla.storage.get("user.first_name")||""} ${salla.config.get("user.last_name")||salla.storage.get("user.last_name")||""}`}async readyUpLoyaltyPoints(){const t=salla.loyalty?.isFeatureEnabled?.();if(!t)return void(this.loyaltyImageRatingPoints=0);const i=salla.config.get("store.settings.rating.rating_product_points")||0,a=salla.config.get("store.settings.rating.rating_product_with_image_points")||0;this.loyaltyImageRatingPoints=Number(a)+Number(i)}loyaltyPointsNote(){if(!this.loyaltyImageRatingPoints||!this.loyaltyPointsForImagesLabel||this.isUnverifiedReview())return null;const t=a("svg",{width:"17",height:"17",viewBox:"0 0 17 17",fill:"none",xmlns:"http://www.w3.org/2000/svg"},a("path",{d:"M10 0C13.6819 0 16.6667 2.98477 16.6667 6.66664C16.6667 9.37047 15.057 11.6984 12.7437 12.7444C11.6978 15.0575 9.3701 16.6666 6.66668 16.6666C2.98477 16.6666 0 13.6819 0 9.99998C0 7.29656 1.60918 4.96894 3.92195 3.92276C4.96827 1.60964 7.29618 0 10 0ZM6.66668 5C3.90524 5 1.66667 7.23856 1.66667 9.99998C1.66667 12.7614 3.90524 15 6.66668 15C9.4281 15 11.6667 12.7614 11.6667 9.99998C11.6667 7.23856 9.4281 5 6.66668 5ZM7.50002 5.83333V6.66664H9.16668V8.33331H5.83333C5.60322 8.33331 5.41667 8.51989 5.41667 8.74998C5.41667 8.95456 5.56407 9.12464 5.75844 9.15998L5.83333 9.16664H7.50002C8.6506 9.16664 9.58335 10.0994 9.58335 11.25C9.58335 12.4006 8.6506 13.3333 7.50002 13.3333V14.1666H5.83333V13.3333H4.16667V11.6666H7.50002C7.7301 11.6666 7.91668 11.4801 7.91668 11.25C7.91668 11.0455 7.76927 10.8753 7.57493 10.8401L7.50002 10.8333H5.83333C4.68274 10.8333 3.75 9.90056 3.75 8.74998C3.75 7.59939 4.68274 6.66664 5.83333 6.66664V5.83333H7.50002ZM10 1.66667C8.51377 1.66667 7.17893 2.31513 6.26313 3.34457C6.39704 3.33736 6.53138 3.33333 6.66668 3.33333C10.3486 3.33333 13.3333 6.3181 13.3333 9.99998C13.3333 10.1356 13.3293 10.2702 13.3213 10.4037C14.3513 9.48814 15 8.15314 15 6.66664C15 3.90524 12.7614 1.66667 10 1.66667Z",fill:"#008C56"}));return a("div",{class:"s-rating-modal-loyalty-points-note-container"},a("span",{class:"s-rating-modal-loyalty-points-note-icon"},t),a("p",{class:"s-rating-modal-loyalty-points-note-text"},this.loyaltyPointsForImagesLabel.replace(":points",String(this.loyaltyImageRatingPoints))))}normalizeReviewFactorsPayload(t){const i=t?.data??t?.factors;return Array.isArray(i)?i.flatMap((t=>{const i=Array.isArray(t?.items)?[...t.items]:null;if(i?.length){i.sort(((t,i)=>(Number(t?.sort)||0)-(Number(i?.sort)||0)));const a=!!t?.is_required;return i.filter((t=>null!=t?.id&&""!==t?.id)).map((t=>({id:t.id,name:t?.name,required:a})))}return null==t?.id||""===t?.id?[]:[{id:t.id,name:t?.name,required:t?.required??t?.is_required??!1}]})):[]}async fetchProductReviewFactors(t){try{const i=await salla.api.request(`review/factors/${t}/form`);return this.normalizeReviewFactorsPayload(i)}catch(t){return[]}}async fetchAllProductReviewFactors(t){const i=this.getRateableProducts(t);if(!i.length)return{};const a=await Promise.all(i.map((async t=>{const i=await this.fetchProductReviewFactors(t.product.id);return[t.product.id,i]})));return Object.fromEntries(a)}async ensureProductFactorsLoaded(t){if(!t||this.productReviewFactors[t])return;const i=await this.fetchProductReviewFactors(t);this.productReviewFactors={...this.productReviewFactors,[t]:i}}getFactorFieldName(t,i,a){return t?`${t}[factors][${i}][${a}]`:`factors[${i}][${a}]`}normalizeToArray(t){return null==t?[]:Array.isArray(t)?t:[t]}isFactorReviewsList(t){return Array.isArray(t)&&t.length>0&&t.every((t=>t&&"object"==typeof t&&(void 0!==t.rating||void 0!==t.stars||void 0!==t.value)))}getFactorReviewsFromRecord(t){if(!t)return[];for(const i of["factor_reviews","review_factors","factors"]){const a=t[i];if(this.isFactorReviewsList(a))return a}return[]}getEditFactorReviewsList(t){const i=[this.order,this.getBootstrapOrder()].filter(Boolean);for(const a of i){const i=this.getMatchedProductRating(a,t,this.editFeedbackId),s=this.getFactorReviewsFromRecord(i);if(s.length)return s}const a=this.getOrderProducts(this.order).find((i=>Number(i.product?.id)===Number(t))),s=[this.editItem?.factor_reviews,this.editItem?.review_factors,this.editItem?.product?.review_factors,this.editItem?.product?.factor_reviews,this.editItem?.factors,a?.factor_reviews,a?.review_factors,a?.feedback?.factor_reviews];for(const t of s)if(Array.isArray(t)&&t.length>0)return t;return[]}getFactorKey(t,i){return null!=t.id&&""!==t.id?`id:${t.id}`:t.name?`name:${t.name.trim()}`:`index:${i}`}getFactorRatingsForProduct(t){return this.editMode?this.editFactorRatings:this.productFactorRatings[t]||{}}setFactorRatingsForProduct(t,i){this.editMode?this.editFactorRatings=i:this.productFactorRatings={...this.productFactorRatings,[t]:i}}markExistingFactorRatingsAsUserFilled(t,i){const a=this.productReviewFactors[t]||[],s=new Set;a.forEach(((t,a)=>{const e=this.getFactorKey(t,a),r=void 0!==t.id?i[String(t.id)]:void 0,o=t.name?i[t.name.trim()]:void 0;void 0===r&&void 0===o&&void 0===i[`__index_${a}`]||s.add(e)})),this.userFilledFactorKeys[t]=s}shouldAutofillFactors(t){return t>=4}autofillUnfilledFactors(t,i){const a=this.productReviewFactors[t]||[];if(!a.length)return;const s=this.userFilledFactorKeys[t]||new Set,e={...this.getFactorRatingsForProduct(t)},r=this.shouldAutofillFactors(i);let o=!1;a.forEach(((t,a)=>{const n=this.getFactorKey(t,a);if(!s.has(n)){if(r)return void 0!==t.id&&(e[String(t.id)]=i),t.name&&(e[t.name.trim()]=i),e[`__index_${a}`]=i,void(o=!0);void 0!==t.id&&void 0!==e[String(t.id)]&&(delete e[String(t.id)],o=!0),t.name&&void 0!==e[t.name.trim()]&&(delete e[t.name.trim()],o=!0),void 0!==e[`__index_${a}`]&&(delete e[`__index_${a}`],o=!0)}})),o&&this.setFactorRatingsForProduct(t,e)}handleMainRatingChange(t,i){this.editMode?this.editMainRating=i:this.productMainRatings={...this.productMainRatings,[t]:i},this.autofillUnfilledFactors(t,i)}handleFactorRatingChange(t,i,a){this.userFilledFactorKeys[t]||(this.userFilledFactorKeys[t]=new Set),this.userFilledFactorKeys[t].add(i);const s=this.productReviewFactors[t]||[],e=s.findIndex(((t,a)=>this.getFactorKey(t,a)===i));if(e<0)return;const r=s[e],o={...this.getFactorRatingsForProduct(t)};void 0!==r.id&&(o[String(r.id)]=a),r.name&&(o[r.name.trim()]=a),o[`__index_${e}`]=a,this.setFactorRatingsForProduct(t,o)}setupProductRatingAutofill(t,i){t&&!this.boundRatingRows.has(t)&&(this.boundRatingRows.add(t),t.addEventListener("click",(a=>{const s=a.target;if(!s.closest(".s-rating-stars-btn-star"))return;const e=s.closest(".s-rating-modal-product-rating-row-main"),r=s.closest(".s-rating-modal-product-factor-row");requestAnimationFrame((()=>{if(e&&t.contains(e)){const t=Number(this.getRatingHiddenInput(e)?.value);t>0&&this.handleMainRatingChange(i,t)}else if(r&&t.contains(r)){const t=r.getAttribute("data-factor-key"),a=Number(this.getRatingHiddenInput(r)?.value);t&&a>0&&this.handleFactorRatingChange(i,t,a)}}))})))}buildEditFactorRatings(t){return this.getEditFactorReviewsList(t).reduce(((t,i,a)=>{const s=Number(i?.rating??i?.stars??i?.value);if(Number.isNaN(s))return t;const e=i?.id??i?.factor_id;return null!=e&&""!==e&&(t[String(e)]=s),i?.name&&(t[i.name.trim()]=s),t[`__index_${a}`]=s,t}),{})}renderProductStep(t,i){return a("section",{class:"s-rating-modal-step s-rating-modal-hidden","data-type":"products","data-product-id":t.product.id,key:t.product.id},a("div",{class:"s-rating-modal-product"},this.allowAttachImages&&this.loyaltyPointsNote(),a("div",{class:"rating-outer-form","data-stars-error":salla.lang.get("pages.rating.rate_product_stars")},a("div",{class:"s-rating-modal-product-details",ref:i=>i&&this.setupProductRatingAutofill(i,t.product.id)},a("div",{class:"s-rating-modal-step-wrap"},a("div",{class:"s-rating-modal-rounded-icon"},a("img",{src:t.product.thumbnail,alt:t.product.name,class:"s-rating-modal-product-img"})),a("h3",{class:"s-rating-modal-title"},t.product.name),a("p",{class:"s-rating-modal-subtitle"},salla.lang.get("pages.rating.write_product_rate")),this.renderProductMainRating(t.product.id,0,{fieldPrefix:""})),this.renderProductReviewFactors(t.product.id,0,{fieldPrefix:""}),a("input",{type:"hidden",name:"product_id",value:t.product.id}),a("textarea",{placeholder:salla.lang.get("pages.rating.write_product_rate"),name:"comment",class:"s-rating-modal-comment"}),a("small",{class:"s-rating-modal-validation-msg"}))),this.canAttachMedia()&&a("div",{class:"s-rating-modal-uploader is-opened",ref:t=>{t&&(this.contentRefs[i]=t)}},a("salla-file-upload",{name:"image",enableGallery:!0,maxImagesCount:this.allowAttachImages?this.MAX_IMAGE_UPLOAD_LIMIT:void 0,maxVideosCount:this.allowAttachVideos?this.MAX_VIDEO_UPLOAD_LIMIT:void 0,maxVideoFileSize:this.allowAttachVideos?this.MAX_VIDEO_FILE_SIZE:void 0,maxVideoDuration:this.allowAttachVideos?this.MAX_VIDEO_DURATION:void 0,maxParallelUploads:this.MAX_PARALLEL_UPLOADS,imagePreviewHeight:75,filePosterHeight:75,"instant-upload":!0,type:"feedback",payloadName:"files[]",id:`file-${t.product.id}`,title:t.product.name,allowMultiple:!0,instantUpload:!0,accept:this.getMediaUploadAccept(),url:salla.url.api("upload"),onUploaded:a=>{const s=t.product.id,e=[...this.productImages[s]||[],a.detail];this.productImages={...this.productImages,[s]:e};const r=w(e);this.setUploadCount(s,e.length,r.image,r.video),b(this.hiddenInputs[i],this.hiddenVideoInputs[i],e),this.scheduleUploaderHeightRefresh()},onRemoved:a=>{const s=a.detail,e=t.product.id;if(!s||!this.productImages[e])return;const r=v(this.productImages[e],s);this.productImages={...this.productImages,[e]:r};const o=w(r);this.setUploadCount(e,r.length,o.image,o.video),b(this.hiddenInputs[i],this.hiddenVideoInputs[i],r),this.scheduleUploaderHeightRefresh()},labelIdle:this.getFilepondPlaceholder(),onGalleryUpdated:i=>this.handleGalleryCountUpdate(t.product.id,i.detail)}),this.allowAttachImages&&a("input",{type:"hidden",name:"images",value:u(this.productImages[t.product.id]||[]).images.join(","),ref:t=>{t&&(this.hiddenInputs[i]=t)}}),this.allowAttachVideos&&a("input",{type:"hidden",name:"videos",value:u(this.productImages[t.product.id]||[]).videos.join(","),ref:t=>{t&&(this.hiddenVideoInputs[i]=t)}}),this.renderUploadedImagesCount(t.product.id))))}renderProductMainRating(t,i,s={}){const e=s.fieldPrefix??`products[${i}]`,r=e?`${e}[rating]`:"rating",o=Number(s.mainRating??(this.editMode?this.editMainRating:this.productMainRatings[t])),n=!Number.isNaN(o);return a("div",{class:"s-rating-modal-stars-product s-rating-modal-product-rating-row-main"},a("salla-rating-stars",{size:"large",name:r,key:n?`main-rating-${o}`:"main-rating-empty",value:n?o:void 0,editable:n,withLabel:!0}))}renderProductReviewFactors(t,i,s={}){const e=this.productReviewFactors[t]||[],r=s.fieldPrefix??`products[${i}]`,o={...this.editMode?{}:this.productFactorRatings[t]||{},...s.factorRatings||{}},n=(t,i)=>{const a=void 0!==t.id?o[String(t.id)]:void 0,s=t.name?o[t.name.trim()]:void 0,e=Number(a??s??o[`__index_${i}`]);return Number.isNaN(e)?void 0:e};if(!e.length)return null;const l=e.some((t=>t.required));return a("div",{class:"s-rating-modal-product-factors-card"},a("div",{class:"s-rating-modal-product-factors-heading"},this.rateTheFollowingLabel,l?a("span",{class:"s-rating-modal-product-factor-required"},"*"):""),a("div",{class:"s-rating-modal-product-rating-rows"},e.map(((t,i)=>a("div",{class:"s-rating-modal-product-rating-row s-rating-modal-product-factor-row","data-required":t.required?"true":"false","data-factor-key":this.getFactorKey(t,i)},a("input",{type:"hidden",name:this.getFactorFieldName(r,i,"name"),value:t.name}),!!t.id&&a("input",{type:"hidden",name:this.getFactorFieldName(r,i,"id"),value:String(t.id)}),a("span",{class:"s-rating-modal-product-factor-name"},t.name),a("salla-rating-stars",{size:"medium",name:this.getFactorFieldName(r,i,"rating"),key:`factor-rating-${t.id??i}-${n(t,i)??0}`,value:n(t,i),editable:s.alwaysEditable||"number"==typeof n(t,i),tag:!1}))))))}handleSendEmail(){if(!this.order)return;const t=`${this.contactSubjectLabel} #${this.order.id}`,i=this.contact_body(salla.config.get("store.name"),this.order.id,this.getCustomerName()),a=`mailto:${salla.config.get("store.contacts.email")}?subject=${encodeURIComponent(t)}&body=${encodeURIComponent(i)}`;window.open(a,"_blank")}handleSendWhatsApp(){if(!this.order)return;const t=this.contact_body(salla.config.get("store.name"),this.order.id,this.getCustomerName()),i=`https://wa.me/${salla.config.get("store.contacts.whatsapp")}?text=${encodeURIComponent(t)}`;window.open(i,"_blank")}resetData(t){t.detail||(this.clearThanksCountdown(),this.modal?.close(),this.editItem=null,this.editItemImages=[],this.editFactorRatings={},this.productMainRatings={},this.productFactorRatings={},this.editMainRating=void 0,this.userFilledFactorKeys={},this.uploadingByProductId={},this.hasUploadsInProgress=!1,this.hiddenInputs[1]&&(this.hiddenInputs[1].value=""),this.editHiddenVideosInput&&(this.editHiddenVideosInput.value=""),this.body&&(this.body.style.height="",this.body.style.minHeight=""),this.deleteFeedbackId=void 0,this.editFeedbackId=void 0,this.shouldOpenDeleteModal=!1,this.editMode=!1,this.deleteMode=!1,this.defaultMode=!1,this.currentIndex=0,this.submitted=[],this.scheduleWizardSetup=!1,this.loyaltyImageRatingPoints=0)}getDeleteModal(){return a("salla-modal",{ref:t=>{t&&(this.deleteModal=t)},width:"xs",onModalVisibilityChanged:t=>this.resetData(t)},a("div",{class:"s-rating-modal-delete-wrapper",ref:t=>{t&&(this.body=t)}},a("h3",null,this.confirmDeletionLabel),a("p",null,this.areYouSureLabel),a("div",{class:"s-rating-modal-delete-actions"},a("salla-button",{loaderPosition:"center",onClick:()=>this.deleteReview()},this.confirmDeleteBtn),a("salla-button",{color:"danger",fill:"outline",onClick:()=>this.deleteModal?.close()},this.cancelLabel))))}renderUploadedImagesCount(t){const i=w(this.editMode?this.editItemImages:this.productImages[t]||[]),s=this.uploadImageCounts[t]??i.image,e=this.uploadVideoCounts[t]??i.video;return this.allowAttachImages&&this.allowAttachVideos?a("span",{class:"s-rating-modal-upload-count"},salla.lang.get("pages.rating.media_count",{imageCurrent:s,imageTotal:this.MAX_IMAGE_UPLOAD_LIMIT,videoCurrent:e,videoTotal:this.MAX_VIDEO_UPLOAD_LIMIT})):this.allowAttachImages?a("span",{class:"s-rating-modal-upload-count"},salla.lang.choice("pages.rating.images_count",s,{current:s,total:this.MAX_IMAGE_UPLOAD_LIMIT})):this.allowAttachVideos?a("span",{class:"s-rating-modal-upload-count"},salla.lang.choice("pages.rating.videos_count",e,{current:e,total:this.MAX_VIDEO_UPLOAD_LIMIT})):null}getEditModal(){return a("salla-modal",{ref:t=>{t&&(this.editModal=t)},width:"custom",customWidth:_,onModalVisibilityChanged:t=>this.resetData(t)},a("div",{class:"s-rating-modal-edit-wrapper",ref:t=>{t&&(this.body=t)}},"store"===this.editType&&this.editItem?a("div",{class:"rating-outer-form s-rating-modal-step-wrap s-rating-modal-step","data-type":"store",ref:t=>{t&&(this.currentTab=t)}},a("div",{class:"s-rating-modal-rounded-icon"},a("img",{src:salla.config.get("store.logo","https://assets.salla.sa/cp/assets/images/logo-new.png"),alt:"store name",class:"s-rating-modal-store-logo"})),a("h2",{class:"s-rating-modal-title"},salla.config.get("store.name")),a("p",{class:"s-rating-modal-subtitle"},salla.lang.get("pages.rating.rate_the_store")),a("div",{class:"s-rating-modal-stars-company"},a("salla-rating-stars",{withLabel:!0,size:"large",editable:!0,value:this.editItem.stars})),a("textarea",{name:"content",value:this.editItem.content,class:"s-rating-modal-comment",placeholder:salla.lang.get("pages.rating.write_store_rate")}),a("small",{class:"s-rating-modal-validation-msg"})):null,"shipping"===this.editType&&this.editItem?a("div",{class:"rating-outer-form s-rating-modal-step-wrap s-rating-modal-step","data-type":"shipping",ref:t=>{t&&(this.currentTab=t)}},this.editItem.shipping.logo?a("div",{class:"s-rating-modal-rounded-icon"},a("img",{src:this.editItem.shipping.logo,class:"s-rating-modal-shipping-logo",alt:this.editItem.shipping.name})):a("span",{class:"s-rating-modal-icon",innerHTML:o}),a("div",{class:"s-rating-modal-title"}," ",`${salla.lang.get("pages.rating.rate_shipping")} ${this.editItem.shipping.name}`),a("p",{class:"s-rating-modal-subtitle"},salla.lang.get("pages.rating.write_shipping_rate")),a("div",{class:"s-rating-modal-stars-company"},a("salla-rating-stars",{withLabel:!0,size:"large",editable:!0,value:this.editItem.stars})),a("textarea",{name:"content",class:"s-rating-modal-comment",value:this.editItem.content,placeholder:salla.lang.get("pages.rating.write_shipping_rate")}),a("small",{class:"s-rating-modal-validation-msg"})):null,"product"==this.editType&&this.editItem?a("section",{class:"s-rating-modal-step","data-type":"products",ref:t=>{t&&(this.currentTab=t)}},a("div",{class:"s-rating-modal-product"},this.allowAttachImages&&this.loyaltyPointsNote(),a("div",{class:"rating-outer-form","data-stars-error":salla.lang.get("pages.rating.rate_product_stars")},a("div",{class:"s-rating-modal-product-details",ref:t=>t&&this.setupProductRatingAutofill(t,this.editItem.product.id)},a("div",{class:"s-rating-modal-step-wrap"},a("div",{class:"s-rating-modal-rounded-icon"},a("img",{src:this.editItem.product.image.url,alt:this.editItem.product.name,class:"s-rating-modal-product-img"})),a("h3",{class:"s-rating-modal-title"},this.editItem.product.name),a("p",{class:"s-rating-modal-subtitle"},salla.lang.get("pages.rating.write_product_rate")),this.renderProductMainRating(this.editItem.product.id,0,{fieldPrefix:"",mainRating:this.editMainRating??Number(this.editItem.stars??this.editItem.rating)})),this.renderProductReviewFactors(this.editItem.product.id,0,{fieldPrefix:"",factorRatings:this.editFactorRatings,alwaysEditable:!0}),a("input",{type:"hidden",name:"product_id",value:this.editItem.product.id}),a("textarea",{value:this.editItem.content,placeholder:salla.lang.get("pages.rating.write_product_rate"),name:"comment",class:"s-rating-modal-comment"}),a("small",{class:"s-rating-modal-validation-msg"}))),this.canAttachMedia()&&a("div",{class:"s-rating-modal-uploader is-opened",ref:t=>{t&&(this.contentRefs[1]=t)}},a("salla-file-upload",{name:"images",allowMultiple:!0,enableGallery:!0,maxImagesCount:this.allowAttachImages?this.MAX_IMAGE_UPLOAD_LIMIT:void 0,maxVideosCount:this.allowAttachVideos?this.MAX_VIDEO_UPLOAD_LIMIT:void 0,maxVideoFileSize:this.allowAttachVideos?this.MAX_VIDEO_FILE_SIZE:void 0,maxVideoDuration:this.allowAttachVideos?this.MAX_VIDEO_DURATION:void 0,maxParallelUploads:this.MAX_PARALLEL_UPLOADS,imagePreviewHeight:75,filePosterHeight:75,"instant-upload":!0,type:"feedback",files:JSON.stringify(this.editItemImages),payloadName:"files[]",id:`file-${this.editItem.product.id}`,title:this.editItem.product.name,instantUpload:!0,accept:this.getMediaUploadAccept(),url:salla.url.api("upload"),onUploaded:t=>{this.editItemImages=[...this.editItemImages,t.detail];const i=w(this.editItemImages);this.setUploadCount(this.editItem.product.id,this.editItemImages.length,i.image,i.video),b(this.hiddenInputs[1],this.editHiddenVideosInput,this.editItemImages),this.scheduleUploaderHeightRefresh()},onRemoved:t=>{const i=t.detail;if(!i)return;this.editItemImages=v(this.editItemImages,i);const a=w(this.editItemImages);this.setUploadCount(this.editItem.product.id,this.editItemImages.length,a.image,a.video),b(this.hiddenInputs[1],this.editHiddenVideosInput,this.editItemImages),this.scheduleUploaderHeightRefresh()},labelIdle:this.getFilepondPlaceholder(),onGalleryUpdated:t=>this.handleGalleryCountUpdate(this.editItem.product.id,t.detail)}),this.allowAttachImages&&a("input",{type:"hidden",name:"images",value:u(this.editItemImages).images.join(","),ref:t=>{t&&(this.hiddenInputs[1]=t)}}),this.allowAttachVideos&&a("input",{type:"hidden",name:"videos",value:u(this.editItemImages).videos.join(","),ref:t=>{t&&(this.editHiddenVideosInput=t)}}),this.renderUploadedImagesCount(this.editItem.product.id)))):null,a("div",{class:"s-rating-modal-footer s-rating-modal-footer-end"},a("salla-button",{"loader-position":"center",loading:this.hasUploadsInProgress,disabled:this.hasUploadsInProgress,onClick:()=>this.editReview()},this.editReviewLabel))))}render(){return this.deleteMode?a(s,{class:"s-rating-modal"},this.getDeleteModal()):this.editMode?a(s,{class:"s-rating-modal"},this.getEditModal()):this.defaultMode?a(s,{class:"s-rating-modal"},a("salla-modal",{class:"s-rating-modal-wrap",onModalVisibilityChanged:t=>this.resetData(t),isLoading:!0,width:"custom",customWidth:_,ref:t=>{t&&(this.modal=t)}},a("div",{slot:"loading"},a("div",{class:"s-rating-modal-skeleton"},a("salla-skeleton",{type:"circle",height:"80px",width:"80px"}),a("salla-skeleton",{height:"15px",width:"60%"}),a("salla-skeleton",{height:"10px",width:"30%"}),a("div",{class:"s-rating-modal-skeleton-stars"},[...Array(5)].map((t=>a("div",{key:t,innerHTML:r})))),a("salla-skeleton",{height:"100px",width:"100%"}),a("div",{class:"s-rating-modal-skeleton-footer"},a("salla-skeleton",{height:"40px",width:"30%"})))),!this.hasError&&this.order?[a("div",{class:"s-rating-modal-wrapper",ref:t=>{t&&(this.body=t)}},this.isTestimonialsEnabled()?a("div",{class:"rating-outer-form s-rating-modal-step-wrap s-rating-modal-step s-rating-modal-hidden","data-type":"store"},a("div",{class:"s-rating-modal-rounded-icon"},a("img",{src:salla.config.get("store.logo","https://assets.salla.sa/cp/assets/images/logo-new.png"),alt:"store name",class:"s-rating-modal-store-logo"})),a("h2",{class:"s-rating-modal-title"},salla.config.get("store.name")),a("p",{class:"s-rating-modal-subtitle"},salla.lang.get("pages.rating.rate_the_store")),a("div",{class:"s-rating-modal-stars-company"},a("salla-rating-stars",{withLabel:!0,size:"large"})),a("textarea",{name:"comment",class:"s-rating-modal-comment",placeholder:salla.lang.get("pages.rating.write_store_rate")}),a("small",{class:"s-rating-modal-validation-msg"})):"",this.isProductsEnabled()&&this.getRateableProducts().map(((t,i)=>this.renderProductStep(t,i))),this.isShippingEnabled()&&this.order.shipping?.company?a("div",{class:"rating-outer-form s-rating-modal-step-wrap s-rating-modal-step s-rating-modal-hidden","data-type":"shipping"},a("input",{type:"hidden",name:"shipping_company_id",value:this.order.shipping.company.id}),this.order.shipping.company.logo?a("div",{class:"s-rating-modal-rounded-icon"},a("img",{src:this.order.shipping.company.logo,class:"s-rating-modal-shipping-logo",alt:this.order.shipping.company.name})):a("span",{class:"s-rating-modal-icon",innerHTML:o}),a("div",{class:"s-rating-modal-title"}," ",`${salla.lang.get("pages.rating.rate_shipping")} ${this.order.shipping.company.name}`),a("p",{class:"s-rating-modal-subtitle"},salla.lang.get("pages.rating.write_shipping_rate")),a("div",{class:"s-rating-modal-stars-company"},a("salla-rating-stars",{withLabel:!0,size:"large"})),a("textarea",{name:"comment",class:"s-rating-modal-comment",placeholder:salla.lang.get("pages.rating.write_shipping_rate")}),a("small",{class:"s-rating-modal-validation-msg"})):"",a("div",{class:"s-rating-modal-thanks s-rating-modal-hidden",ref:t=>{t&&(this.thanksTab=t)}},a("span",{class:"s-rating-modal-icon",innerHTML:n}),a("h3",{class:"s-rating-modal-thanks-title"},salla.lang.get("pages.rating.thanks")),a("div",{class:"s-rating-modal-thanks-msg",innerHTML:this.order.thanks_message}),a("time",{class:"s-rating-modal-thanks-time",ref:t=>{t&&(this.thanksTime=t)}}))),this.allowContactSupport&&this.showContactWidget&&(salla.config.get("store.contacts.whatsapp")||salla.config.get("store.contacts.email"))?a("div",{class:"s-rating-modal-contact"},a("p",null,this.contactUsLabel),a("div",{class:"s-rating-modal-contact-icons"},salla.config.get("store.contacts.whatsapp")&&a("span",{onClick:()=>this.handleSendWhatsApp(),innerHTML:h}),salla.config.get("store.contacts.email")&&a("span",{onClick:()=>this.handleSendEmail(),innerHTML:m}))):"",a("div",{class:"s-rating-modal-footer"},a("button",{ref:t=>{t&&(this.backBtn=t)},onClick:()=>this.previousTab(),class:"s-rating-modal-btn s-rating-modal-unvisiable"},salla.lang.get("common.elements.back")),this.stepsCount>1?a("ul",{class:"s-rating-modal-dots"},[...Array(this.stepsCount)].map(((t,i)=>a("li",{key:i,class:"s-rating-modal-bg-gray s-rating-modal-step-dot"})))):"",a("salla-button",{"loader-position":"center",loading:this.hasUploadsInProgress,disabled:this.hasUploadsInProgress,ref:t=>{t&&(this.nextBtn=t)},onClick:()=>this.submit()},salla.lang.get("common.elements.next")))]:a("salla-placeholder",{alignment:"center"}))):void 0}async componentWillLoad(){await salla.onReady(),await salla.lang.onLoaded(),this.registerTranslations(),this.syncStoreSettings()}registerTranslations(){salla.lang.addBulk({"common.uploader.drag_and_drop_files":{ar:"اسحب الملفات وأفلتها هنا",en:"Drag and drop files here"},"common.uploader.allowed_images_types":{ar:" .jpg أو jpeg أو png يُسمح بإضافة صور بصيغة",en:"Images in jpg, jpeg, or png format are allowed."},"pages.rating.add_images":{ar:"اضافة صور",en:"Add Images"},"pages.rating.edit_images":{ar:"تعديل الصور",en:"Edit Images"},"pages.rating.edit_review":{ar:"تعديل التقييم",en:"Edit review"},"pages.rating.confirm_deletion":{ar:"تأكيد حذف التقييم",en:"Confirm review deletion"},"pages.rating.are_you_sure_you_want_to_delete_review":{ar:"هل أنت متأكد من حذف تقييمك؟",en:"Are you sure you want to delete your review?"},"pages.rating.review_updated_successfully":{ar:"تم تعديل التقييم بنجاح",en:"The review has been successfully updated."},"pages.rating.review_deleted_successfully":{ar:"تم حذف التقييم بنجاح",en:"The review has been successfully deleted."},"pages.rating.images_count":{ar:"الصور ( :current من أصل :total )",en:"Images ( :current of :total )"},"pages.rating.media_count":{ar:"الصور (:imageCurrent/:imageTotal) · الفيديو (:videoCurrent/:videoTotal)",en:"Images (:imageCurrent/:imageTotal) · Videos (:videoCurrent/:videoTotal)"},"common.uploader.allowed_videos_types":{ar:"يُسمح بفيديوهات mp4 أو mov أو avi أو mkv",en:"Videos in mp4, mov, avi, or mkv format are allowed."},"pages.rating.videos_count":{ar:"الفيديو ( :current من أصل :total )",en:"Videos ( :current of :total )"},"common.uploader.allowed_media_types":{ar:"يُسمح بصور jpg أو jpeg أو png وفيديوهات mp4 أو mov أو avi أو mkv",en:"Images in jpg, jpeg, or png and videos in mp4, mov, avi, or mkv are allowed."},"common.uploader.max_three_images":{ar:"أضف حتى 10 صور و 5 فيديوهات كحد أقصى",en:"Add up to 10 images and 5 videos maximum."},"common.uploader.max_images_count":{ar:"أضف :count صور كحد أقصى",en:"Add up to :count images maximum."},"common.uploader.max_videos_count":{ar:"أضف :count فيديوهات كحد أقصى",en:"Add up to :count videos maximum."},"common.elements.confirm_delete":{ar:"تأكيد الحذف",en:"Confirm deletion"},"pages.rating.rate_required_factors":{ar:"يرجى تقييم جميع المعايير لإتمام مراجعتك.",en:"Please rate all required factors to complete your review."},"pages.rating.overall_product_rating":{ar:"التقييم العام للمنتج",en:"Overall product rating"},"pages.rating.rate_the_following_factors":{ar:"كيف تقيِّم التالي؟",en:"How would you rate the following?"},"pages.rating.loyalty_points_for_images":{ar:"شاركنا صورة مع تقييمك للطلب واكسب :points نقطة ولاء",en:"Share a photo with your order review and earn :points loyalty points"}}),this.contactUsLabel=salla.lang.get("blocks.footer.social"),this.dragAndDropFilesLabel=salla.lang.get("common.uploader.drag_and_drop_files"),this.allowedImagesTypesLabel=this.getAllowedMediaTypesLabel(),this.threeImagesMax=this.getMaxUploadHintLabel(),this.contactSubjectLabel=salla.lang.get("pages.rating.contact_subject"),this.editReviewLabel=salla.lang.get("pages.rating.edit_review"),this.areYouSureLabel=salla.lang.get("pages.rating.are_you_sure_you_want_to_delete_review"),this.confirmDeletionLabel=salla.lang.get("pages.rating.confirm_deletion"),this.cancelLabel=salla.lang.get("common.elements.cancel"),this.updatedSuccessfullyLabel=salla.lang.get("pages.rating.review_updated_successfully"),this.deletedSuccessfullyLabel=salla.lang.get("pages.rating.review_deleted_successfully"),this.confirmDeleteBtn=salla.lang.get("common.elements.confirm_delete"),this.requiredFactorsLabel=salla.lang.get("pages.rating.rate_required_factors"),this.rateTheFollowingLabel=salla.lang.get("pages.rating.rate_the_following_factors"),this.loyaltyPointsForImagesLabel=salla.lang.get("pages.rating.loyalty_points_for_images",{points:":points"}),this.contact_body=(t,i,a)=>salla.lang.get("pages.rating.contact_body",{store:t,id:i,customer:a})}componentDidRender(){this.scheduleWizardSetup&&this.defaultMode&&this.order&&(this.scheduleWizardSetup=!1,requestAnimationFrame((()=>this.handleWizard())))}disconnectedCallback(){this.clearThanksCountdown()}get host(){return e(this)}};x.style='/*!twlt*/.s-rating-modal-uploader{overflow:visible}.s-rating-modal-uploader.is-opened{height:auto !important;opacity:1 !important;overflow:visible;pointer-events:auto !important;margin-bottom:1rem}.s-rating-modal-uploader .s-file-upload-gallery{overflow:visible}.s-rating-modal-edit-wrapper,.s-rating-modal-wrapper{transition:height 0.15s ease}.s-rating-modal-product-details{padding-bottom:0.5rem}.s-rating-modal-comment{margin-top:0.35rem}.s-rating-modal-product{margin-bottom:1rem}.s-rating-modal-product-img{position:absolute !important;inset:0;display:block;width:100% !important;max-width:100% !important;height:100% !important;object-fit:cover}.s-rating-modal-product-title{font-size:0.95rem;font-weight:600;line-height:1.5;margin:0}.s-rating-modal-stars-product{margin-top:0.5rem}.s-rating-modal-loyalty-points-note-container{display:flex;align-items:center;gap:0.625rem;width:100%;margin-top:1.5rem;margin-bottom:0.75rem;padding:0.75rem;border-radius:0.5rem;background-color:#E6F4EA}.s-rating-modal-loyalty-points-note-icon{display:flex;flex-shrink:0;align-items:center;justify-content:center;width:1.25rem;height:1.25rem;color:#1B7F5C}.s-rating-modal-loyalty-points-note-icon svg{width:1.5rem;height:1.5rem;fill:currentColor}.s-rating-modal-loyalty-points-note-text{flex:1;margin:0;font-size:0.875rem;line-height:1.25rem;color:#1f2937}.s-rating-modal-product-details-main{display:flex;align-items:center;margin-bottom:0.5rem;padding-bottom:0;border-bottom:0}.s-rating-modal-product-info-row{display:flex;align-items:center;gap:0.6rem;margin-bottom:0.5rem;padding-bottom:0;border-bottom:0}.s-rating-modal-product-main-review{width:100%;text-align:right}.s-rating-modal-product-rating-rows{display:grid;gap:0.45rem;margin:0.2rem 0 0.7rem}.s-rating-modal-product-rating-row{display:flex;align-items:center;justify-content:space-between;gap:0.75rem;min-height:2rem}.s-rating-modal-product-rating-row salla-rating-stars{flex-shrink:0}.s-rating-modal-product-rating-row .s-rating-stars-wrapper{align-items:center;min-height:1.75rem}.s-rating-modal-product-rating-row .s-rating-stars-label,.s-rating-modal-product-rating-row .s-rating-stars-label-without-tag{min-width:auto;min-height:1.25rem;line-height:1.25rem;font-size:0.8rem;color:#5b6470;white-space:nowrap;text-align:end;transition:opacity 0.15s ease}.s-rating-modal-product-rating-row .s-rating-stars-label--empty,.s-rating-modal-product-rating-row .s-rating-stars-label-without-tag--empty{opacity:0}.s-rating-modal-product-factor-name{color:#5b6470;font-size:0.9rem;line-height:1.25}.s-rating-modal-product-factor-required{color:#f87171;margin-inline-start:0.2rem}.s-rating-modal-product-img-wrap{position:relative;width:5rem !important;min-width:5rem !important;max-width:5rem !important;height:3.5rem !important;flex-shrink:0 !important;overflow:hidden;border-radius:0.375rem;background:#f3f4f6}.mt-0{margin-top:0px}.block{display:block}.hidden{display:none}.shadow{--tw-shadow:0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}.outline{outline-style:solid}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.s-comments-item-like-btn{margin-top:0.5rem}.s-comments-item-like-btn .s-button-text{display:flex;flex-direction:row-reverse;gap:0.5rem}.s-comments-item-like-btn span svg{height:0.75rem;width:0.75rem}.s-rating-modal-wrapper{margin-bottom:1.5rem;transition-property:all;transition-duration:100ms;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1)}.s-rating-modal-edit-wrapper{margin-top:0.625rem}.s-rating-modal-footer{position:relative;display:flex;align-items:center;justify-content:space-between}.s-rating-modal-footer salla-button button{padding-left:1rem !important;padding-right:1rem !important;font-size:0.75rem !important}.s-rating-modal-btn{height:2.5rem;padding-left:1rem;padding-right:1rem;font-size:0.875rem;line-height:1.25rem;font-weight:700;color:var(--color-primary);transition-property:all;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:300ms}.s-rating-modal-btn:hover{color:var(--color-primary-dark)}.s-rating-modal-dots{display:flex;flex-shrink:0;flex-grow:1;justify-content:center}.s-rating-modal-dots>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-right:calc(0.375rem * var(--tw-space-x-reverse));margin-left:calc(0.375rem * calc(1 - var(--tw-space-x-reverse)))}.s-rating-modal-dots{text-align:center}.s-rating-modal-dots:where([dir="rtl"],[dir="rtl"] *)>:not([hidden])~:not([hidden]){--tw-space-x-reverse:1}.s-rating-modal-step-dot{height:0.625rem;width:0.625rem;border-radius:9999px;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:300ms}.s-rating-modal-step{transition-property:all;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:500ms}.s-rating-modal-active{--tw-translate-x:0px;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));opacity:1}.s-rating-modal-unactive{--tw-translate-x:0.75rem;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));opacity:0}.s-rating-modal-hidden{display:none !important}.s-rating-modal-unvisiable{pointer-events:none;opacity:0}.s-rating-modal-step-wrap{position:relative;display:flex;flex-direction:column;align-items:center;padding-bottom:1rem}.s-rating-modal-product-details{position:relative;display:flex;flex:1 1 0%;flex-direction:column;padding-bottom:1rem}.s-rating-modal-product-details-main{display:flex;align-items:flex-start;justify-content:space-between}.s-rating-modal-product-details-main .s-rating-stars-wrapper{margin-bottom:0.375rem;flex-direction:column;align-items:center}@media (min-width: 640px){.s-rating-modal-product-details-main .s-rating-stars-wrapper{margin-bottom:0px;flex-direction:row;gap:0px}}.s-rating-modal-rounded-icon{position:relative;margin-bottom:0.25rem;display:flex;height:6rem;width:6rem;align-items:center;justify-content:center;overflow:hidden;border-radius:9999px;border-width:1px;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1))}.s-rating-modal-title{margin-bottom:0.25rem;font-size:1.125rem;line-height:1.75rem;font-weight:700}.s-rating-modal-subtitle{margin-bottom:0.25rem;padding-left:0.5rem;padding-right:0.5rem;text-align:center;font-size:0.875rem;line-height:1.25rem;--tw-text-opacity:1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.s-rating-modal-store-logo{width:4rem;object-fit:contain}.s-rating-modal-shipping-logo{height:100%;width:100%;object-fit:contain}.s-rating-modal-shipping-icon{font-size:3rem;line-height:1;color:var(--color-primary)}.s-rating-modal-comment{margin-bottom:0.5rem;height:5rem !important;width:100%;border-radius:0.375rem;border-width:1px;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1));padding:0.75rem;font-size:0.875rem;line-height:1.25rem;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms}.s-rating-modal-comment:focus{border-color:var(--color-primary)}.s-rating-modal-comment:is(.dark *){--tw-border-opacity:1;border-color:rgb(75 85 99 / var(--tw-border-opacity, 1));--tw-bg-opacity:1;background-color:rgb(75 85 99 / var(--tw-bg-opacity, 1))}.s-rating-modal-validation-msg{margin-top:-3px;line-height:1rem;--tw-text-opacity:1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.s-rating-modal-product{margin-bottom:1.5rem}.s-rating-modal-product:last-child{margin-bottom:0px}.s-rating-modal-product .rating-outer-form{display:flex}.s-rating-modal-product .rating-outer-form>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-right:calc(0.5rem * var(--tw-space-x-reverse));margin-left:calc(0.5rem * calc(1 - var(--tw-space-x-reverse)))}@media (min-width: 640px){.s-rating-modal-product .rating-outer-form>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-right:calc(1.25rem * var(--tw-space-x-reverse));margin-left:calc(1.25rem * calc(1 - var(--tw-space-x-reverse)))}}.s-rating-modal-product .rating-outer-form:where([dir="rtl"],[dir="rtl"] *)>:not([hidden])~:not([hidden]){--tw-space-x-reverse:1}.s-rating-modal-product-img-wrap{height:3.5rem;width:auto;overflow:hidden;border-radius:0.375rem;--tw-bg-opacity:1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}@media (min-width: 640px){.s-rating-modal-product-img-wrap{width:5rem}}.s-rating-modal-product-img{position:relative;height:100%;width:100%;object-fit:cover;font-size:0px}.s-rating-modal-product-img::before{position:absolute;top:0px;left:0px;height:100%;width:100%;--tw-bg-opacity:1;background-color:rgb(229 231 235 / var(--tw-bg-opacity, 1));--tw-content:\'\';content:var(--tw-content)}.s-rating-modal-product-title{margin-bottom:0.375rem;font-size:0.875rem;font-weight:700;line-height:1.25rem}.s-rating-modal-thanks{padding-left:2rem;padding-right:2rem;text-align:center;transition-property:all;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:500ms}.s-rating-modal-icon{display:inline-flex;height:5rem;width:5rem;align-items:center;justify-content:center;border-radius:9999px;--tw-bg-opacity:1;background-color:rgb(249 250 251 / var(--tw-bg-opacity, 1));color:var(--color-primary)}.s-rating-modal-icon svg{height:1.75rem;width:1.75rem;fill:var(--color-primary)}.s-rating-modal-thanks-title{margin-top:1rem;font-weight:700}.s-rating-modal-thanks-msg{margin-bottom:1.5rem;font-size:0.875rem;line-height:1.25rem;--tw-text-opacity:1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.s-rating-modal-thanks-btn{height:2.5rem;flex:none;display:inline-flex;flex:1 1 0%;align-items:center;justify-content:center;white-space:nowrap;border-radius:0.375rem;padding-left:1.5rem;padding-right:1.5rem;padding-bottom:0.625rem;padding-top:0.5rem;font-size:0.875rem;line-height:1.25rem;font-weight:700;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:300ms}.s-rating-modal-thanks-btn:hover{opacity:0.8}.s-rating-modal-thanks-btn{border-width:1px;border-color:var(--color-primary);background-color:var(--color-primary);color:var(--color-primary-reverse)}.s-rating-modal-thanks-time{margin-top:0.75rem;display:block;height:1.5rem;font-size:0.875rem;line-height:1.25rem;--tw-text-opacity:1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.s-rating-modal-product-factors-card{margin-bottom:1rem;border-radius:0.5rem;--tw-bg-opacity:1;background-color:rgb(249 250 251 / var(--tw-bg-opacity, 1));padding:1rem}.s-rating-modal-product-factors-heading{margin-bottom:0.75rem;font-size:0.875rem;line-height:1.25rem;font-weight:700;--tw-text-opacity:1;color:rgb(31 41 55 / var(--tw-text-opacity, 1))}.s-rating-modal-stars-company{margin-bottom:1.25rem}.s-rating-modal-stars-company .s-rating-stars-wrapper{flex-direction:column;align-items:center;justify-content:center;gap:0.5rem}.s-rating-modal-stars-product .s-rating-stars-wrapper{flex-direction:column;align-items:center;justify-content:center}.s-rating-modal-upload-count{font-size:0.875rem;line-height:1.25rem;font-weight:500}.s-rating-modal-bg-gray{--tw-bg-opacity:1;background-color:rgb(229 231 235 / var(--tw-bg-opacity, 1))}.s-rating-modal-bg-primary{background-color:var(--color-primary)}unicode{unicode-bidi:plaintext}.s-rating-modal-wrap .s-modal-body{position:relative !important}.s-rating-modal-skeleton{display:flex;flex-direction:column;align-items:center;justify-content:center}.s-rating-modal-skeleton salla-skeleton:nth-child(1){margin-bottom:1.25rem}.s-rating-modal-skeleton salla-skeleton:nth-child(2){margin-bottom:0.75rem}.s-rating-modal-skeleton salla-skeleton:nth-child(3){margin-bottom:1.25rem}.s-rating-modal-skeleton salla-skeleton:nth-child(4){margin-bottom:2rem}.s-rating-modal-skeleton-footer{margin-top:1.5rem;display:flex;width:100%;justify-content:flex-end}.s-rating-modal-skeleton-footer salla-skeleton{margin-bottom:0px !important}.s-rating-modal-skeleton-stars{margin-bottom:0.75rem;display:flex;align-items:center}.s-rating-modal-skeleton-stars>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-right:calc(0.5rem * var(--tw-space-x-reverse));margin-left:calc(0.5rem * calc(1 - var(--tw-space-x-reverse)))}.s-rating-modal-skeleton-stars:where([dir="rtl"],[dir="rtl"] *)>:not([hidden])~:not([hidden]){--tw-space-x-reverse:1}.s-rating-modal-skeleton-stars div svg{width:25px;fill:currentColor;--tw-text-opacity:1;color:rgb(209 213 219 / var(--tw-text-opacity, 1))}.s-rating-modal-uploader{height:0px;opacity:0;transition-property:all;transition-duration:100ms;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1)}.s-rating-modal-uploader.is-opened{margin-bottom:1.5rem;overflow:visible}.s-rating-modal-uploader.is-closed{pointer-events:none;z-index:0}.s-rating-modal-uploader .filepond--drop-label{--tw-bg-opacity:1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.s-rating-modal-uploader .filepond--file-status .filepond--file-status-main{font-size:11px}.s-rating-modal-uploader .filepond--file-info-main{font-size:11px}.s-rating-modal-uploader li[data-filepond-item-state=\'load-invalid\'] .filepond--file-info{display:none}.s-rating-modal-filepond-placeholder-text{font-size:0.75rem !important;line-height:1rem !important}.s-rating-modal-filepond-placeholder{display:flex;flex-direction:column;align-items:center;justify-content:center}.s-rating-modal-filepond-placeholder-icon{margin-bottom:0.25rem}.s-rating-modal-filepond-placeholder-icon svg{height:1.5rem;width:1.5rem;fill:#7c8082}.s-rating-modal-contact{margin-bottom:1rem;display:flex;align-items:center;justify-content:space-between;border-radius:0.375rem;--tw-bg-opacity:1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1));padding:0.5rem}.s-rating-modal-contact p{font-size:1rem;line-height:1.5rem;--tw-text-opacity:1;color:rgb(31 41 55 / var(--tw-text-opacity, 1))}.s-rating-modal-contact-icons{display:flex;align-items:center;gap:0.5rem}.s-rating-modal-contact-icons span{display:flex;cursor:pointer;align-items:center;justify-content:center;border-radius:0.375rem;border-width:1px;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1));--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1));padding:0.375rem}.s-rating-modal-contact-icons span svg{height:1rem;width:1rem;fill:var(--color-primary)}.s-rating-modal-footer-end{justify-content:flex-end}.s-rating-modal-delete-wrapper{text-align:center}.s-rating-modal-delete-wrapper h3{margin-top:1.25rem;font-size:1.125rem;line-height:1.75rem;--tw-text-opacity:1;color:rgb(31 41 55 / var(--tw-text-opacity, 1))}.s-rating-modal-delete-wrapper p{margin-top:1.25rem;font-size:0.875rem;line-height:1.25rem;--tw-text-opacity:1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.s-rating-modal-delete-actions{margin-top:1.25rem;display:flex;align-items:center;gap:0.625rem}.s-rating-modal-delete-actions salla-button{width:100%}.s-rating-modal-delete-actions salla-button button{width:100%}';export{x as salla_rating_modal_v2}
|
|
4
|
+
import{r as t,f as i,h as a,H as s,a as e}from"./p-BsIeN-bg.js";import{S as r}from"./p-CeFAfcTv.js";import{S as o}from"./p-lMgMt31Q.js";import{C as n}from"./p-BV4kqbdL.js";import{H as l}from"./p-D6rFREuQ.js";import{I as d}from"./p-C-tzSDxw.js";import{W as h}from"./p-CgR-T_ZS.js";import{M as m}from"./p-DmgxDvXL.js";import{b as c}from"./p-DrXX8XG8.js";import"./p-CgtvEd63.js";function g(t){const i=t.split(/[?#]/,1)[0];return/\.(mp4|webm|mov|avi|mkv)$/i.test(i)}function p(t){return t.reduce(((t,i)=>i?(g(i)?t.videos.push(i):t.images.push(i),t):t),{images:[],videos:[]})}function u(t){return p(t.map((t=>t?.url||"")).filter(Boolean))}function f(t){return t?Array.isArray(t)?t.filter(Boolean):t.split(",").map((t=>t.trim())).filter(Boolean):[]}function w(t){return t.reduce(((t,i)=>(g(i?.url||"")?t.video+=1:t.image+=1,t)),{image:0,video:0})}function v(t,i){const a=String(i);let s=!1;return t.filter((t=>{const i=null!=t?.id?String(t.id):"",e=String(t?.url??"");return!(i===a||e===a)||!!s||(s=!0,!1)}))}function b(t,i,a){const{images:s,videos:e}=u(a);t&&(t.value=s.join(",")),i&&(i.value=e.join(","))}function y(t,i,a){i||delete t.images,a||delete t.videos}const _="600px",x=class{constructor(i){t(this,i),this.hasError=!1,this.showContactWidget=!0,this.errorMessage="",this.images=[],this.productImages={},this.editItemImages=[],this.productReviewFactors={},this.editFactorRatings={},this.productMainRatings={},this.productFactorRatings={},this.contact_body=(t,i,a)=>salla.lang.get("pages.rating.contact_subject",{store:t,id:i,customer:a}),this.editMode=!1,this.defaultMode=!1,this.deleteMode=!1,this.shouldOpenDeleteModal=!1,this.editItem=null,this.allowAttachImages=!1,this.allowAttachVideos=!1,this.allowContactSupport=!1,this.uploadCounts={},this.uploadImageCounts={},this.uploadVideoCounts={},this.hasUploadsInProgress=!1,this.loyaltyImageRatingPoints=0,this.dragAndDropFilesLabel=salla.lang.get("common.uploader.drag_and_drop_files"),this.contactSubjectLabel=salla.lang.get("pages.rating.contact_subject"),this.editReviewLabel=salla.lang.get("pages.rating.edit_review"),this.allowedImagesTypesLabel=salla.lang.get("common.uploader.allowed_images_types"),this.threeImagesMax=salla.lang.get("common.uploader.max_three_images"),this.areYouSureLabel=salla.lang.get("pages.rating.are_you_sure_you_want_to_delete_review"),this.confirmDeletionLabel=salla.lang.get("pages.rating.confirm_deletion"),this.cancelLabel=salla.lang.get("common.elements.cancel"),this.confirmDeleteBtn=salla.lang.get("common.elements.confirm_delete"),this.updatedSuccessfullyLabel=salla.lang.get("pages.rating.review_updated_successfully"),this.deletedSuccessfullyLabel=salla.lang.get("pages.rating.review_deleted_successfully"),this.contactUsLabel=salla.lang.get("blocks.footer.social"),this.requiredFactorsLabel=salla.lang.get("pages.rating.rate_required_factors"),this.rateTheFollowingLabel=salla.lang.get("pages.rating.rate_the_following_factors"),this.loyaltyPointsForImagesLabel=salla.lang.get("pages.rating.loyalty_points_for_images",{points:":points"}),this.contentRefs=[],this.hiddenInputs=[],this.hiddenVideoInputs=[],this.uploadingByProductId={},this.userFilledFactorKeys={},this.boundRatingRows=new WeakSet,this.stepsCount=0,this.currentIndex=0,this.submitted=[],this.thanksCountdownInterval=null,this.MAX_IMAGE_UPLOAD_LIMIT=10,this.MAX_VIDEO_UPLOAD_LIMIT=5,this.MAX_VIDEO_FILE_SIZE="100MB",this.MAX_VIDEO_DURATION=60,this.MAX_PARALLEL_UPLOADS=10,this.scheduleWizardSetup=!1}syncStoreSettings(){void 0===this.orderId&&(this.orderId=salla.config.get("page.id")),this.allowAttachImages=!!salla.config.get("store.settings.rating.allow_attach_images"),this.allowAttachVideos=!!salla.config.get("store.settings.rating.allow_attach_videos"),this.allowContactSupport=!!salla.config.get("store.settings.rating.allow_contact_support"),this.refreshMediaLabels()}canAttachMedia(){return this.allowAttachImages||this.allowAttachVideos}getMediaUploadAccept(){return c(this.allowAttachImages,this.allowAttachVideos)}refreshMediaLabels(){this.allowedImagesTypesLabel=this.getAllowedMediaTypesLabel(),this.threeImagesMax=this.getMaxUploadHintLabel()}getAllowedMediaTypesLabel(){return this.allowAttachImages&&this.allowAttachVideos?salla.lang.get("common.uploader.allowed_media_types"):this.allowAttachImages?salla.lang.get("common.uploader.allowed_images_types"):this.allowAttachVideos?salla.lang.get("common.uploader.allowed_videos_types"):""}getMaxUploadHintLabel(){return this.allowAttachImages&&this.allowAttachVideos?salla.lang.get("common.uploader.max_three_images"):this.allowAttachImages?salla.lang.get("common.uploader.max_images_count",{count:this.MAX_IMAGE_UPLOAD_LIMIT}):this.allowAttachVideos?salla.lang.get("common.uploader.max_videos_count",{count:this.MAX_VIDEO_UPLOAD_LIMIT}):""}setUploadCount(t,i,a,s){this.uploadCounts={...this.uploadCounts,[t]:i},null!=a&&(this.uploadImageCounts={...this.uploadImageCounts,[t]:a}),null!=s&&(this.uploadVideoCounts={...this.uploadVideoCounts,[t]:s})}setUploaderProcessing(t,i){this.uploadingByProductId={...this.uploadingByProductId,[t]:i},this.hasUploadsInProgress=Object.values(this.uploadingByProductId).some(Boolean)}scheduleUploaderHeightRefresh(){[50,150,350].forEach((t=>{setTimeout((()=>this.updateBodyHeight()),t)}))}handleGalleryCountUpdate(t,i){this.setUploadCount(t,i.count,i.imageCount,i.videoCount),this.setUploaderProcessing(t,!!i.uploading),this.scheduleUploaderHeightRefresh()}isUnverifiedReview(){return null===this.orderId&&!!this.productId}getRatingOrderId(){return this.orderId||salla.config.get("page.id")}getSubmitOrderId(){return this.orderId}isCustomerOrderShape(t){if(!t||"object"!=typeof t)return!1;const i=t;return!!i.rating&&(Array.isArray(i.items)||Array.isArray(i.products)||Array.isArray(i.rating?.product)||Array.isArray(i.rating?.products))}getBootstrapOrder(){const t=salla.config.get("page");if(this.isCustomerOrderShape(t))return t;if(t&&"object"==typeof t){const i=t;if(Array.isArray(i.products))return t;const a=i.order;if(this.isCustomerOrderShape(a))return a}}async loadCustomerOrderForEdit(){const t=this.getBootstrapOrder();if(t?.rating?.product||t?.rating?.products)this.order=t;else try{const t=await salla.api.withoutNotifier((()=>salla.order.api.getDetails(this.getRatingOrderId())));t?.data&&(this.order=t.data)}catch(t){if(!this.order){const t=await salla.api.withoutNotifier((()=>salla.rating.api.order(this.getRatingOrderId())));this.order=t.data}}}getOrderProductRatings(t=this.order){return t?.rating?[...this.normalizeToArray(t.rating.product),...this.normalizeToArray(t.rating.products)]:[]}getMatchedProductRating(t=this.order,i,a){return this.getOrderProductRatings(t).find((t=>Number(t?.id??t?.feedback_id)===Number(a)||Number(t?.product_id??t?.product?.id)===Number(i)))}hasRatingFeedback(t){const i=t?.rating;return null!=i&&""!==i&&Number(i)>0}isTestimonialsEnabled(t=this.order){return!(this.productId||!1===t?.testimonials_enabled||this.hasRatingFeedback(t?.store?.feedback)||!0!==t?.testimonials_enabled&&!t?.allowed_ratings?.testimonials_enabled)}isProductsEnabled(t=this.order){return!1!==t?.products_enabled&&this.getRateableProducts(t).length>0}isShippingEnabled(t=this.order){return!(this.productId||!1===t?.shipping_enabled||this.hasRatingFeedback(t?.shipping?.feedback)||!t?.shipping?.company||!0!==t?.shipping_enabled&&!t?.allowed_ratings?.shipping_enabled)}getOrderProducts(t=this.order){return Array.isArray(t?.products)?t.products.filter((t=>t?.product?.id)):[]}getRateableProducts(t=this.order){return this.getOrderProducts(t).filter((t=>!(this.hasRatingFeedback(t?.feedback)||this.productId&&String(t.product.id)!==String(this.productId))))}getStepsCount(t=this.order){if(!t)return 0;let i=0;return this.isTestimonialsEnabled(t)&&i++,this.isProductsEnabled(t)&&(i+=this.getRateableProducts(t).length),this.isShippingEnabled(t)&&t.shipping?.company&&i++,i}afterOrderLoaded(){this.stepsCount=this.getStepsCount(),this.scheduleWizardSetup=!0,i(this)}async setOrder(t,i){this.orderId=t,this.productId=i,this.order=void 0,this.hasError=!1,this.errorMessage=void 0,this.showContactWidget=!0}async loadUnverifiedProductOrder(){const t=await salla.api.withoutNotifier((()=>salla.product.api.getDetails(this.productId))).catch((()=>null)),i=t?.data;this.order={products:[{feedback:void 0,product:{id:Number(this.productId),name:i?.name||"",thumbnail:i?.image?.url||salla.url.cdn("images/s-empty.png")}}],products_enabled:!0,testimonials_enabled:!1,shipping_enabled:!1,thanks_message:""},this.productReviewFactors=await this.fetchAllProductReviewFactors(this.order)}escapeHtml(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}getModalTitle(){if(this.isUnverifiedReview()){const t=this.escapeHtml(this.getRateableProducts()[0]?.product?.name||"");return`${salla.lang.get("pages.rating.rate")} ${t}`.trim()}return`${salla.lang.get("pages.rating.rate_order")} <span class="unicode">(#${this.order?.id})</span>`}async open(){return await salla.onReady(),this.syncStoreSettings(),this.defaultMode=!0,this.currentIndex=0,this.submitted=[],new Promise((t=>{setTimeout((()=>{this.modal?.open().then((()=>this.order||(this.isUnverifiedReview()?this.loadUnverifiedProductOrder():salla.api.withoutNotifier((()=>salla.rating.api.order(this.getRatingOrderId()))).then((async t=>{this.order=t.data,this.productReviewFactors=await this.fetchAllProductReviewFactors(t.data)}))))).then((()=>this.readyUpLoyaltyPoints())).then((()=>this.modal?.setTitle(this.getModalTitle()))).then((()=>{const t={};for(const i of this.getRateableProducts())t[i.product.id]=[];this.productImages=t,this.uploadCounts=Object.fromEntries(Object.keys(t).map((t=>[Number(t),0])))})).then((()=>this.modal?.stopLoading())).then((()=>this.afterOrderLoaded())).catch((i=>{t(!1),this.hasError=!0,this.errorMessage=i.response?.data?.error?.message||i.response?.data,this.modal?.stopLoading()})),t(!0)}),50)}))}async openEditModal(t){await salla.onReady(),this.syncStoreSettings(),this.defaultMode=!1,this.editMode=!0,this.editType=t.type,this.editFeedbackId=t.feedback_id;try{await this.fetchEditItem(t.feedback_id),await this.readyUpLoyaltyPoints(),"product"===this.editType&&this.editItem?.product?.id&&(await this.loadCustomerOrderForEdit(),await this.ensureProductFactorsLoaded(this.editItem.product.id),this.editFactorRatings={...this.buildEditFactorRatings(this.editItem.product.id)},this.markExistingFactorRatingsAsUserFilled(this.editItem.product.id,this.editFactorRatings)),this.editModal?.open(),"product"===this.editType&&this.canAttachMedia()&&this.scheduleUploaderHeightRefresh()}catch(t){this.hasError=!0,this.errorMessage=t.response?.data?.error?.message||t.response?.data}}async fetchEditItem(t){const i=`rating/${t}/show`,a=await salla.api.request(i);if(this.editItem=a.data,this.canAttachMedia()&&"product"==this.editType){const t=(this.editItem.images||[]).filter(Boolean),i=(this.editItem.videos||[]).filter(Boolean);let a=[...t,...i];if(!i.length&&t.length){const i=p(t);a=[...i.images,...i.videos]}if(a=a.filter((t=>g(t)?this.allowAttachVideos:this.allowAttachImages)),a.length){this.editItemImages=a.map((t=>function(t){return{id:t,url:t}}(t)));const t=w(this.editItemImages);this.setUploadCount(this.editItem.product.id,this.editItemImages.length,t.image,t.video)}}}async editReview(){if(this.hasUploadsInProgress)return;const t=`rating/${this.editFeedbackId}`;let i;if("product"===this.editType){const t=this.editModal?.querySelector('[data-type="products"]')||this.currentTab;if(i=this.buildProductRatingPayload(this.collectFormData(t),t),!i.product_id&&this.editItem?.product?.id&&(i.product_id=String(this.editItem.product.id)),this.canAttachMedia()){const{images:t,videos:a}=u(this.editItemImages);this.allowAttachImages&&(i.images=t),this.allowAttachVideos&&(i.videos=a)}y(i,this.allowAttachImages,this.allowAttachVideos)}else i=this.collectFormData(this.editModal),i.images&&(i.images=f(i.images)),i.videos&&(i.videos=f(i.videos)),y(i,this.allowAttachImages,this.allowAttachVideos);await salla.api.request(t,i,"put").then((t=>{this.editModal?.close(),salla.notify.success(t.message||this.updatedSuccessfullyLabel),setTimeout((()=>{window.location.reload()}),500)}))}async openDeleteModal(t){return this.defaultMode=!1,this.deleteMode=!0,this.deleteFeedbackId=t.feedback_id,this.shouldOpenDeleteModal=!0,new Promise((t=>{setTimeout((()=>{this.deleteModal?.open().then((()=>t(!0)))}),50)}))}async deleteReview(){const t=`rating/${this.deleteFeedbackId}`;await salla.api.request(t,null,"delete").then((()=>{this.deleteModal?.close(),salla.notify.success(this.deletedSuccessfullyLabel),setTimeout((()=>{window.location.reload()}),500)}))}async close(){return this.modal?.close()}handleWizard(){this.steps=this.modal?.querySelectorAll(".s-rating-modal-step"),this.dots=this.modal?.querySelectorAll(".s-rating-modal-step-dot"),0!==this.stepsCount?this.showActiveStep():this.showThankYou()}refreshWizardRefs(){this.modal&&(this.steps=this.modal.querySelectorAll(".s-rating-modal-step"),this.dots=this.modal.querySelectorAll(".s-rating-modal-step-dot"))}showActiveStep(t=null){if(this.refreshWizardRefs(),this.currentTab=t||this.steps?.[this.currentIndex],!this.currentTab)return;l.toggleClassIf(".s-rating-modal-step-dot","s-rating-modal-bg-gray","s-rating-modal-bg-primary",(t=>t!=this.dots?.[this.currentIndex])).toggleClassIf(".s-rating-modal-step","s-rating-modal-active","s-rating-modal-hidden",(t=>t==this.currentTab)),0!==this.currentIndex&&(l.toggleElementClassIf(this.currentTab,"s-rating-modal-unactive","s-rating-modal-hidden",(()=>!0)),setTimeout((()=>l.toggleElementClassIf(this.currentTab,"s-rating-modal-active","s-rating-modal-unactive",(()=>!0))),300));const i=this.steps?.[this.currentIndex+1]?.dataset.type;this.nextBtn?.setText(i?`${salla.lang.get("pages.rating.rate")} ${salla.lang.get(`pages.rating.${i}`)}`:salla.lang.get("pages.rating.send_ratings")),setTimeout((()=>this.updateBodyHeight()),0),setTimeout((()=>this.updateBodyHeight()),150)}updateBodyHeight(){this.body&&this.currentTab&&(this.body.style.height="products"!==this.currentTab.dataset.type?`${this.currentTab.offsetHeight+(this.editMode?60:0)}px`:"auto")}previousTab(){this.currentIndex>0&&this.currentIndex--,l.toggleElementClassIf(this.backBtn,"s-rating-modal-unvisiable","block",(()=>0==this.currentIndex)),this.showActiveStep()}async submit(){if(!this.hasUploadsInProgress){this.refreshWizardRefs();try{this.submittedBefore()||this.validate(),salla.config.canLeave=!1,await(this.nextBtn?.load()),this.submittedBefore()||await this.sendFeedback(),this.currentTab?.querySelectorAll("[name],.s-rating-modal-btn-star").forEach((t=>t.setAttribute("disabled",""))),this.currentIndex<this.stepsCount&&this.currentIndex++,this.showActiveStep(),l.toggleClassIf("#prev-btn","block","s-rating-modal-unvisiable",(()=>!0)),this.currentIndex===this.stepsCount&&(this.showThankYou(),this.showContactWidget=!1)}finally{this.nextBtn?.stop(),salla.config.canLeave=!0}}}submittedBefore(){return this.submitted.includes(this.currentIndex)}getRatingHiddenInput(t){const i=t,a=i.querySelector?.(".rating_hidden_input");if(a?.name)return a;const s=i.querySelector?.("salla-rating-stars");return s?.shadowRoot?.querySelector(".rating_hidden_input")||null}collectNamedInputs(t){const i=new Set,a=[],s=t=>{t?.name&&!i.has(t)&&(i.add(t),a.push(t))};return t.querySelectorAll("[name]").forEach((t=>{t.closest("salla-file-upload")||s(t)})),t.querySelectorAll("salla-rating-stars").forEach((t=>{s(this.getRatingHiddenInput(t))})),a}normalizeFactorsList(t){return t?Array.isArray(t)?t:"object"==typeof t?Object.values(t).filter((t=>t&&"object"==typeof t)):[]:[]}validate(t=null,i=null){if(!t&&"products"===this.currentTab?.dataset?.type)return void this.currentTab.querySelectorAll(".rating-outer-form").forEach((t=>this.validate(t,"product")));const a=t??this.currentTab;if(!a)return;const s=a.querySelector(".s-rating-modal-product-rating-row-main"),e=this.getRatingHiddenInput(s||a),r=e?.value,o=a.querySelector(".s-rating-modal-validation-msg"),n=i||a.getAttribute("data-type");if(!r)throw o.innerHTML=salla.lang.get(`pages.rating.rate_${n}_stars`).replace(" (:item)",""),new Error(o.innerHTML);if("product"===n&&Array.from(a.querySelectorAll('.s-rating-modal-product-factor-row[data-required="true"]')).some((t=>{const i=this.getRatingHiddenInput(t);return!i?.value})))throw o.innerHTML=this.requiredFactorsLabel,new Error(o.innerHTML);o&&(o.innerHTML="")}collectFormData(t=this.currentTab){if(!t)return{};const i={};return this.collectNamedInputs(t).forEach((t=>{const a=salla.helpers.inputData(t.name,t.value,i);i[a.name]=a.value})),i}buildProductRatingPayload(t,i=this.currentTab){if(!i)return{};if(!t.rating){const a=i.querySelector(".s-rating-modal-product-rating-row-main"),s=this.getRatingHiddenInput(a||i);s?.value&&(t.rating=s.value)}const a=Number(t.product_id);let s=[],e=[];t.images?s=f(t.images):this.editMode&&this.canAttachMedia()&&a?s=u(this.editItemImages).images:this.canAttachMedia()&&a&&(s=u(this.productImages[a]||[]).images),t.videos?e=f(t.videos):this.editMode&&this.canAttachMedia()&&a?e=u(this.editItemImages).videos:this.canAttachMedia()&&a&&(e=u(this.productImages[a]||[]).videos);const r=this.normalizeFactorsList(t.factors).filter((t=>t?.id&&t?.rating)).map((t=>({id:String(t.id),rating:String(t.rating)}))),o={order_id:this.getSubmitOrderId(),product_id:String(t.product_id),rating:String(t.rating),comment:t.comment||t.content||"",factors:r,type:"products"};return this.allowAttachImages&&(o.images=s),this.allowAttachVideos&&(o.videos=e),o}async sendFeedback(){this.refreshWizardRefs();const t=this.currentTab?.dataset?.type;if("products"===t){const t=this.collectFormData(this.currentTab),i=this.buildProductRatingPayload(t,this.currentTab);if(!i.product_id||!i.rating)throw new Error("Missing product rating data");const a=await salla.rating.api.products(i);return this.submitted.push(this.currentIndex),a}const i=this.collectFormData(this.currentTab);if(0===Object.keys(i).length)return;if(i.order_id=this.getSubmitOrderId(),i.type=t,!t)return;const a=await salla.rating.api[t](i);return this.submitted.push(this.currentIndex),a}clearThanksCountdown(){null!==this.thanksCountdownInterval&&(clearInterval(this.thanksCountdownInterval),this.thanksCountdownInterval=null)}showThankYou(){let t=10;this.clearThanksCountdown(),this.thanksCountdownInterval=setInterval((()=>{this.thanksTime&&(this.thanksTime.innerHTML="00:0"+t--,t>0||(this.clearThanksCountdown(),this.thanksTime.remove(),this.close().then((()=>window.location.reload()))))}),1e3),this.modal?.querySelector(".s-rating-modal-footer")?.classList.add("s-rating-modal-unvisiable"),this.showActiveStep(this.thanksTab)}getFilepondPlaceholder(){return`<div class="s-rating-modal-filepond-placeholder"><span class="s-rating-modal-filepond-placeholder-icon">${d}</span><p class="s-rating-modal-filepond-placeholder-text">${this.dragAndDropFilesLabel}<br>\n <span> ${this.allowedImagesTypesLabel} <br> ${this.threeImagesMax} </span></p></div>`}getCustomerName(){return`${salla.config.get("user.first_name")||salla.storage.get("user.first_name")||""} ${salla.config.get("user.last_name")||salla.storage.get("user.last_name")||""}`}async readyUpLoyaltyPoints(){const t=salla.loyalty?.isFeatureEnabled?.();if(!t)return void(this.loyaltyImageRatingPoints=0);const i=salla.config.get("store.settings.rating.rating_product_points")||0,a=salla.config.get("store.settings.rating.rating_product_with_image_points")||0;this.loyaltyImageRatingPoints=Number(a)+Number(i)}loyaltyPointsNote(){if(!this.loyaltyImageRatingPoints||!this.loyaltyPointsForImagesLabel||this.isUnverifiedReview())return null;const t=a("svg",{width:"17",height:"17",viewBox:"0 0 17 17",fill:"none",xmlns:"http://www.w3.org/2000/svg"},a("path",{d:"M10 0C13.6819 0 16.6667 2.98477 16.6667 6.66664C16.6667 9.37047 15.057 11.6984 12.7437 12.7444C11.6978 15.0575 9.3701 16.6666 6.66668 16.6666C2.98477 16.6666 0 13.6819 0 9.99998C0 7.29656 1.60918 4.96894 3.92195 3.92276C4.96827 1.60964 7.29618 0 10 0ZM6.66668 5C3.90524 5 1.66667 7.23856 1.66667 9.99998C1.66667 12.7614 3.90524 15 6.66668 15C9.4281 15 11.6667 12.7614 11.6667 9.99998C11.6667 7.23856 9.4281 5 6.66668 5ZM7.50002 5.83333V6.66664H9.16668V8.33331H5.83333C5.60322 8.33331 5.41667 8.51989 5.41667 8.74998C5.41667 8.95456 5.56407 9.12464 5.75844 9.15998L5.83333 9.16664H7.50002C8.6506 9.16664 9.58335 10.0994 9.58335 11.25C9.58335 12.4006 8.6506 13.3333 7.50002 13.3333V14.1666H5.83333V13.3333H4.16667V11.6666H7.50002C7.7301 11.6666 7.91668 11.4801 7.91668 11.25C7.91668 11.0455 7.76927 10.8753 7.57493 10.8401L7.50002 10.8333H5.83333C4.68274 10.8333 3.75 9.90056 3.75 8.74998C3.75 7.59939 4.68274 6.66664 5.83333 6.66664V5.83333H7.50002ZM10 1.66667C8.51377 1.66667 7.17893 2.31513 6.26313 3.34457C6.39704 3.33736 6.53138 3.33333 6.66668 3.33333C10.3486 3.33333 13.3333 6.3181 13.3333 9.99998C13.3333 10.1356 13.3293 10.2702 13.3213 10.4037C14.3513 9.48814 15 8.15314 15 6.66664C15 3.90524 12.7614 1.66667 10 1.66667Z",fill:"#008C56"}));return a("div",{class:"s-rating-modal-loyalty-points-note-container"},a("span",{class:"s-rating-modal-loyalty-points-note-icon"},t),a("p",{class:"s-rating-modal-loyalty-points-note-text"},this.loyaltyPointsForImagesLabel.replace(":points",String(this.loyaltyImageRatingPoints))))}normalizeReviewFactorsPayload(t){const i=t?.data??t?.factors;return Array.isArray(i)?i.flatMap((t=>{const i=Array.isArray(t?.items)?[...t.items]:null;if(i?.length){i.sort(((t,i)=>(Number(t?.sort)||0)-(Number(i?.sort)||0)));const a=!!t?.is_required;return i.filter((t=>null!=t?.id&&""!==t?.id)).map((t=>({id:t.id,name:t?.name,required:a})))}return null==t?.id||""===t?.id?[]:[{id:t.id,name:t?.name,required:t?.required??t?.is_required??!1}]})):[]}async fetchProductReviewFactors(t){try{const i=await salla.api.request(`review/factors/${t}/form`);return this.normalizeReviewFactorsPayload(i)}catch(t){return[]}}async fetchAllProductReviewFactors(t){const i=this.getRateableProducts(t);if(!i.length)return{};const a=await Promise.all(i.map((async t=>{const i=await this.fetchProductReviewFactors(t.product.id);return[t.product.id,i]})));return Object.fromEntries(a)}async ensureProductFactorsLoaded(t){if(!t||this.productReviewFactors[t])return;const i=await this.fetchProductReviewFactors(t);this.productReviewFactors={...this.productReviewFactors,[t]:i}}getFactorFieldName(t,i,a){return t?`${t}[factors][${i}][${a}]`:`factors[${i}][${a}]`}normalizeToArray(t){return null==t?[]:Array.isArray(t)?t:[t]}isFactorReviewsList(t){return Array.isArray(t)&&t.length>0&&t.every((t=>t&&"object"==typeof t&&(void 0!==t.rating||void 0!==t.stars||void 0!==t.value)))}getFactorReviewsFromRecord(t){if(!t)return[];for(const i of["factor_reviews","review_factors","factors"]){const a=t[i];if(this.isFactorReviewsList(a))return a}return[]}getEditFactorReviewsList(t){const i=[this.order,this.getBootstrapOrder()].filter(Boolean);for(const a of i){const i=this.getMatchedProductRating(a,t,this.editFeedbackId),s=this.getFactorReviewsFromRecord(i);if(s.length)return s}const a=this.getOrderProducts(this.order).find((i=>Number(i.product?.id)===Number(t))),s=[this.editItem?.factor_reviews,this.editItem?.review_factors,this.editItem?.product?.review_factors,this.editItem?.product?.factor_reviews,this.editItem?.factors,a?.factor_reviews,a?.review_factors,a?.feedback?.factor_reviews];for(const t of s)if(Array.isArray(t)&&t.length>0)return t;return[]}getFactorKey(t,i){return null!=t.id&&""!==t.id?`id:${t.id}`:t.name?`name:${t.name.trim()}`:`index:${i}`}getFactorRatingsForProduct(t){return this.editMode?this.editFactorRatings:this.productFactorRatings[t]||{}}setFactorRatingsForProduct(t,i){this.editMode?this.editFactorRatings=i:this.productFactorRatings={...this.productFactorRatings,[t]:i}}markExistingFactorRatingsAsUserFilled(t,i){const a=this.productReviewFactors[t]||[],s=new Set;a.forEach(((t,a)=>{const e=this.getFactorKey(t,a),r=void 0!==t.id?i[String(t.id)]:void 0,o=t.name?i[t.name.trim()]:void 0;void 0===r&&void 0===o&&void 0===i[`__index_${a}`]||s.add(e)})),this.userFilledFactorKeys[t]=s}shouldAutofillFactors(t){return t>=4}autofillUnfilledFactors(t,i){const a=this.productReviewFactors[t]||[];if(!a.length)return;const s=this.userFilledFactorKeys[t]||new Set,e={...this.getFactorRatingsForProduct(t)},r=this.shouldAutofillFactors(i);let o=!1;a.forEach(((t,a)=>{const n=this.getFactorKey(t,a);if(!s.has(n)){if(r)return void 0!==t.id&&(e[String(t.id)]=i),t.name&&(e[t.name.trim()]=i),e[`__index_${a}`]=i,void(o=!0);void 0!==t.id&&void 0!==e[String(t.id)]&&(delete e[String(t.id)],o=!0),t.name&&void 0!==e[t.name.trim()]&&(delete e[t.name.trim()],o=!0),void 0!==e[`__index_${a}`]&&(delete e[`__index_${a}`],o=!0)}})),o&&this.setFactorRatingsForProduct(t,e)}handleMainRatingChange(t,i){this.editMode?this.editMainRating=i:this.productMainRatings={...this.productMainRatings,[t]:i},this.autofillUnfilledFactors(t,i)}handleFactorRatingChange(t,i,a){this.userFilledFactorKeys[t]||(this.userFilledFactorKeys[t]=new Set),this.userFilledFactorKeys[t].add(i);const s=this.productReviewFactors[t]||[],e=s.findIndex(((t,a)=>this.getFactorKey(t,a)===i));if(e<0)return;const r=s[e],o={...this.getFactorRatingsForProduct(t)};void 0!==r.id&&(o[String(r.id)]=a),r.name&&(o[r.name.trim()]=a),o[`__index_${e}`]=a,this.setFactorRatingsForProduct(t,o)}setupProductRatingAutofill(t,i){t&&!this.boundRatingRows.has(t)&&(this.boundRatingRows.add(t),t.addEventListener("click",(a=>{const s=a.target;if(!s.closest(".s-rating-stars-btn-star"))return;const e=s.closest(".s-rating-modal-product-rating-row-main"),r=s.closest(".s-rating-modal-product-factor-row");requestAnimationFrame((()=>{if(e&&t.contains(e)){const t=Number(this.getRatingHiddenInput(e)?.value);t>0&&this.handleMainRatingChange(i,t)}else if(r&&t.contains(r)){const t=r.getAttribute("data-factor-key"),a=Number(this.getRatingHiddenInput(r)?.value);t&&a>0&&this.handleFactorRatingChange(i,t,a)}}))})))}buildEditFactorRatings(t){return this.getEditFactorReviewsList(t).reduce(((t,i,a)=>{const s=Number(i?.rating??i?.stars??i?.value);if(Number.isNaN(s))return t;const e=i?.id??i?.factor_id;return null!=e&&""!==e&&(t[String(e)]=s),i?.name&&(t[i.name.trim()]=s),t[`__index_${a}`]=s,t}),{})}renderProductStep(t,i){return a("section",{class:"s-rating-modal-step s-rating-modal-hidden","data-type":"products","data-product-id":t.product.id,key:t.product.id},a("div",{class:"s-rating-modal-product"},this.allowAttachImages&&this.loyaltyPointsNote(),a("div",{class:"rating-outer-form","data-stars-error":salla.lang.get("pages.rating.rate_product_stars")},a("div",{class:"s-rating-modal-product-details",ref:i=>i&&this.setupProductRatingAutofill(i,t.product.id)},a("div",{class:"s-rating-modal-step-wrap"},a("div",{class:"s-rating-modal-rounded-icon"},a("img",{src:t.product.thumbnail,alt:t.product.name,class:"s-rating-modal-product-img"})),a("h3",{class:"s-rating-modal-title"},t.product.name),a("p",{class:"s-rating-modal-subtitle"},salla.lang.get("pages.rating.write_product_rate")),this.renderProductMainRating(t.product.id,0,{fieldPrefix:""})),this.renderProductReviewFactors(t.product.id,0,{fieldPrefix:""}),a("input",{type:"hidden",name:"product_id",value:t.product.id}),a("textarea",{placeholder:salla.lang.get("pages.rating.write_product_rate"),name:"comment",class:"s-rating-modal-comment"}),a("small",{class:"s-rating-modal-validation-msg"}))),this.canAttachMedia()&&a("div",{class:"s-rating-modal-uploader is-opened",ref:t=>{t&&(this.contentRefs[i]=t)}},a("salla-file-upload",{name:"image",enableGallery:!0,maxImagesCount:this.allowAttachImages?this.MAX_IMAGE_UPLOAD_LIMIT:void 0,maxVideosCount:this.allowAttachVideos?this.MAX_VIDEO_UPLOAD_LIMIT:void 0,maxVideoFileSize:this.allowAttachVideos?this.MAX_VIDEO_FILE_SIZE:void 0,maxVideoDuration:this.allowAttachVideos?this.MAX_VIDEO_DURATION:void 0,maxParallelUploads:this.MAX_PARALLEL_UPLOADS,imagePreviewHeight:75,filePosterHeight:75,"instant-upload":!0,type:"feedback",payloadName:"files[]",id:`file-${t.product.id}`,title:t.product.name,allowMultiple:!0,instantUpload:!0,accept:this.getMediaUploadAccept(),url:salla.url.api("upload"),onUploaded:a=>{const s=t.product.id,e=[...this.productImages[s]||[],a.detail];this.productImages={...this.productImages,[s]:e};const r=w(e);this.setUploadCount(s,e.length,r.image,r.video),b(this.hiddenInputs[i],this.hiddenVideoInputs[i],e),this.scheduleUploaderHeightRefresh()},onRemoved:a=>{const s=a.detail,e=t.product.id;if(!s||!this.productImages[e])return;const r=v(this.productImages[e],s);this.productImages={...this.productImages,[e]:r};const o=w(r);this.setUploadCount(e,r.length,o.image,o.video),b(this.hiddenInputs[i],this.hiddenVideoInputs[i],r),this.scheduleUploaderHeightRefresh()},labelIdle:this.getFilepondPlaceholder(),onGalleryUpdated:i=>this.handleGalleryCountUpdate(t.product.id,i.detail)}),this.allowAttachImages&&a("input",{type:"hidden",name:"images",value:u(this.productImages[t.product.id]||[]).images.join(","),ref:t=>{t&&(this.hiddenInputs[i]=t)}}),this.allowAttachVideos&&a("input",{type:"hidden",name:"videos",value:u(this.productImages[t.product.id]||[]).videos.join(","),ref:t=>{t&&(this.hiddenVideoInputs[i]=t)}}),this.renderUploadedImagesCount(t.product.id))))}renderProductMainRating(t,i,s={}){const e=s.fieldPrefix??`products[${i}]`,r=e?`${e}[rating]`:"rating",o=Number(s.mainRating??(this.editMode?this.editMainRating:this.productMainRatings[t])),n=!Number.isNaN(o);return a("div",{class:"s-rating-modal-stars-product s-rating-modal-product-rating-row-main"},a("salla-rating-stars",{size:"large",name:r,key:n?`main-rating-${o}`:"main-rating-empty",value:n?o:void 0,editable:n,withLabel:!0}))}renderProductReviewFactors(t,i,s={}){const e=this.productReviewFactors[t]||[],r=s.fieldPrefix??`products[${i}]`,o={...this.editMode?{}:this.productFactorRatings[t]||{},...s.factorRatings||{}},n=(t,i)=>{const a=void 0!==t.id?o[String(t.id)]:void 0,s=t.name?o[t.name.trim()]:void 0,e=Number(a??s??o[`__index_${i}`]);return Number.isNaN(e)?void 0:e};if(!e.length)return null;const l=e.some((t=>t.required));return a("div",{class:"s-rating-modal-product-factors-card"},a("div",{class:"s-rating-modal-product-factors-heading"},this.rateTheFollowingLabel,l?a("span",{class:"s-rating-modal-product-factor-required"},"*"):""),a("div",{class:"s-rating-modal-product-rating-rows"},e.map(((t,i)=>a("div",{class:"s-rating-modal-product-rating-row s-rating-modal-product-factor-row","data-required":t.required?"true":"false","data-factor-key":this.getFactorKey(t,i)},a("input",{type:"hidden",name:this.getFactorFieldName(r,i,"name"),value:t.name}),!!t.id&&a("input",{type:"hidden",name:this.getFactorFieldName(r,i,"id"),value:String(t.id)}),a("span",{class:"s-rating-modal-product-factor-name"},t.name),a("salla-rating-stars",{size:"medium",name:this.getFactorFieldName(r,i,"rating"),key:`factor-rating-${t.id??i}-${n(t,i)??0}`,value:n(t,i),editable:s.alwaysEditable||"number"==typeof n(t,i),tag:!1}))))))}handleSendEmail(){if(!this.order)return;const t=`${this.contactSubjectLabel} #${this.order.id}`,i=this.contact_body(salla.config.get("store.name"),this.order.id,this.getCustomerName()),a=`mailto:${salla.config.get("store.contacts.email")}?subject=${encodeURIComponent(t)}&body=${encodeURIComponent(i)}`;window.open(a,"_blank")}handleSendWhatsApp(){if(!this.order)return;const t=this.contact_body(salla.config.get("store.name"),this.order.id,this.getCustomerName()),i=`https://wa.me/${salla.config.get("store.contacts.whatsapp")}?text=${encodeURIComponent(t)}`;window.open(i,"_blank")}resetData(t){t.detail||(this.clearThanksCountdown(),this.modal?.close(),this.editItem=null,this.editItemImages=[],this.editFactorRatings={},this.productMainRatings={},this.productFactorRatings={},this.editMainRating=void 0,this.userFilledFactorKeys={},this.uploadingByProductId={},this.hasUploadsInProgress=!1,this.hiddenInputs[1]&&(this.hiddenInputs[1].value=""),this.editHiddenVideosInput&&(this.editHiddenVideosInput.value=""),this.body&&(this.body.style.height="",this.body.style.minHeight=""),this.deleteFeedbackId=void 0,this.editFeedbackId=void 0,this.shouldOpenDeleteModal=!1,this.editMode=!1,this.deleteMode=!1,this.defaultMode=!1,this.currentIndex=0,this.submitted=[],this.scheduleWizardSetup=!1,this.loyaltyImageRatingPoints=0)}getDeleteModal(){return a("salla-modal",{ref:t=>{t&&(this.deleteModal=t)},width:"xs",onModalVisibilityChanged:t=>this.resetData(t)},a("div",{class:"s-rating-modal-delete-wrapper",ref:t=>{t&&(this.body=t)}},a("h3",null,this.confirmDeletionLabel),a("p",null,this.areYouSureLabel),a("div",{class:"s-rating-modal-delete-actions"},a("salla-button",{loaderPosition:"center",onClick:()=>this.deleteReview()},this.confirmDeleteBtn),a("salla-button",{color:"danger",fill:"outline",onClick:()=>this.deleteModal?.close()},this.cancelLabel))))}renderUploadedImagesCount(t){const i=w(this.editMode?this.editItemImages:this.productImages[t]||[]),s=this.uploadImageCounts[t]??i.image,e=this.uploadVideoCounts[t]??i.video;return this.allowAttachImages&&this.allowAttachVideos?a("span",{class:"s-rating-modal-upload-count"},salla.lang.get("pages.rating.media_count",{imageCurrent:s,imageTotal:this.MAX_IMAGE_UPLOAD_LIMIT,videoCurrent:e,videoTotal:this.MAX_VIDEO_UPLOAD_LIMIT})):this.allowAttachImages?a("span",{class:"s-rating-modal-upload-count"},salla.lang.choice("pages.rating.images_count",s,{current:s,total:this.MAX_IMAGE_UPLOAD_LIMIT})):this.allowAttachVideos?a("span",{class:"s-rating-modal-upload-count"},salla.lang.choice("pages.rating.videos_count",e,{current:e,total:this.MAX_VIDEO_UPLOAD_LIMIT})):null}getEditModal(){return a("salla-modal",{ref:t=>{t&&(this.editModal=t)},width:"custom",customWidth:_,onModalVisibilityChanged:t=>this.resetData(t)},a("div",{class:"s-rating-modal-edit-wrapper",ref:t=>{t&&(this.body=t)}},"store"===this.editType&&this.editItem?a("div",{class:"rating-outer-form s-rating-modal-step-wrap s-rating-modal-step","data-type":"store",ref:t=>{t&&(this.currentTab=t)}},a("div",{class:"s-rating-modal-rounded-icon"},a("img",{src:salla.config.get("store.logo","https://assets.salla.sa/cp/assets/images/logo-new.png"),alt:"store name",class:"s-rating-modal-store-logo"})),a("h2",{class:"s-rating-modal-title"},salla.config.get("store.name")),a("p",{class:"s-rating-modal-subtitle"},salla.lang.get("pages.rating.rate_the_store")),a("div",{class:"s-rating-modal-stars-company"},a("salla-rating-stars",{withLabel:!0,size:"large",editable:!0,value:this.editItem.stars})),a("textarea",{name:"content",value:this.editItem.content,class:"s-rating-modal-comment",placeholder:salla.lang.get("pages.rating.write_store_rate")}),a("small",{class:"s-rating-modal-validation-msg"})):null,"shipping"===this.editType&&this.editItem?a("div",{class:"rating-outer-form s-rating-modal-step-wrap s-rating-modal-step","data-type":"shipping",ref:t=>{t&&(this.currentTab=t)}},this.editItem.shipping.logo?a("div",{class:"s-rating-modal-rounded-icon"},a("img",{src:this.editItem.shipping.logo,class:"s-rating-modal-shipping-logo",alt:this.editItem.shipping.name})):a("span",{class:"s-rating-modal-icon",innerHTML:o}),a("div",{class:"s-rating-modal-title"}," ",`${salla.lang.get("pages.rating.rate_shipping")} ${this.editItem.shipping.name}`),a("p",{class:"s-rating-modal-subtitle"},salla.lang.get("pages.rating.write_shipping_rate")),a("div",{class:"s-rating-modal-stars-company"},a("salla-rating-stars",{withLabel:!0,size:"large",editable:!0,value:this.editItem.stars})),a("textarea",{name:"content",class:"s-rating-modal-comment",value:this.editItem.content,placeholder:salla.lang.get("pages.rating.write_shipping_rate")}),a("small",{class:"s-rating-modal-validation-msg"})):null,"product"==this.editType&&this.editItem?a("section",{class:"s-rating-modal-step","data-type":"products",ref:t=>{t&&(this.currentTab=t)}},a("div",{class:"s-rating-modal-product"},this.allowAttachImages&&this.loyaltyPointsNote(),a("div",{class:"rating-outer-form","data-stars-error":salla.lang.get("pages.rating.rate_product_stars")},a("div",{class:"s-rating-modal-product-details",ref:t=>t&&this.setupProductRatingAutofill(t,this.editItem.product.id)},a("div",{class:"s-rating-modal-step-wrap"},a("div",{class:"s-rating-modal-rounded-icon"},a("img",{src:this.editItem.product.image.url,alt:this.editItem.product.name,class:"s-rating-modal-product-img"})),a("h3",{class:"s-rating-modal-title"},this.editItem.product.name),a("p",{class:"s-rating-modal-subtitle"},salla.lang.get("pages.rating.write_product_rate")),this.renderProductMainRating(this.editItem.product.id,0,{fieldPrefix:"",mainRating:this.editMainRating??Number(this.editItem.stars??this.editItem.rating)})),this.renderProductReviewFactors(this.editItem.product.id,0,{fieldPrefix:"",factorRatings:this.editFactorRatings,alwaysEditable:!0}),a("input",{type:"hidden",name:"product_id",value:this.editItem.product.id}),a("textarea",{value:this.editItem.content,placeholder:salla.lang.get("pages.rating.write_product_rate"),name:"comment",class:"s-rating-modal-comment"}),a("small",{class:"s-rating-modal-validation-msg"}))),this.canAttachMedia()&&a("div",{class:"s-rating-modal-uploader is-opened",ref:t=>{t&&(this.contentRefs[1]=t)}},a("salla-file-upload",{name:"images",allowMultiple:!0,enableGallery:!0,maxImagesCount:this.allowAttachImages?this.MAX_IMAGE_UPLOAD_LIMIT:void 0,maxVideosCount:this.allowAttachVideos?this.MAX_VIDEO_UPLOAD_LIMIT:void 0,maxVideoFileSize:this.allowAttachVideos?this.MAX_VIDEO_FILE_SIZE:void 0,maxVideoDuration:this.allowAttachVideos?this.MAX_VIDEO_DURATION:void 0,maxParallelUploads:this.MAX_PARALLEL_UPLOADS,imagePreviewHeight:75,filePosterHeight:75,"instant-upload":!0,type:"feedback",files:JSON.stringify(this.editItemImages),payloadName:"files[]",id:`file-${this.editItem.product.id}`,title:this.editItem.product.name,instantUpload:!0,accept:this.getMediaUploadAccept(),url:salla.url.api("upload"),onUploaded:t=>{this.editItemImages=[...this.editItemImages,t.detail];const i=w(this.editItemImages);this.setUploadCount(this.editItem.product.id,this.editItemImages.length,i.image,i.video),b(this.hiddenInputs[1],this.editHiddenVideosInput,this.editItemImages),this.scheduleUploaderHeightRefresh()},onRemoved:t=>{const i=t.detail;if(!i)return;this.editItemImages=v(this.editItemImages,i);const a=w(this.editItemImages);this.setUploadCount(this.editItem.product.id,this.editItemImages.length,a.image,a.video),b(this.hiddenInputs[1],this.editHiddenVideosInput,this.editItemImages),this.scheduleUploaderHeightRefresh()},labelIdle:this.getFilepondPlaceholder(),onGalleryUpdated:t=>this.handleGalleryCountUpdate(this.editItem.product.id,t.detail)}),this.allowAttachImages&&a("input",{type:"hidden",name:"images",value:u(this.editItemImages).images.join(","),ref:t=>{t&&(this.hiddenInputs[1]=t)}}),this.allowAttachVideos&&a("input",{type:"hidden",name:"videos",value:u(this.editItemImages).videos.join(","),ref:t=>{t&&(this.editHiddenVideosInput=t)}}),this.renderUploadedImagesCount(this.editItem.product.id)))):null,a("div",{class:"s-rating-modal-footer s-rating-modal-footer-end"},a("salla-button",{"loader-position":"center",loading:this.hasUploadsInProgress,disabled:this.hasUploadsInProgress,onClick:()=>this.editReview()},this.editReviewLabel))))}render(){return this.deleteMode?a(s,{class:"s-rating-modal"},this.getDeleteModal()):this.editMode?a(s,{class:"s-rating-modal"},this.getEditModal()):this.defaultMode?a(s,{class:"s-rating-modal"},a("salla-modal",{class:"s-rating-modal-wrap",onModalVisibilityChanged:t=>this.resetData(t),isLoading:!0,width:"custom",customWidth:_,ref:t=>{t&&(this.modal=t)}},a("div",{slot:"loading"},a("div",{class:"s-rating-modal-skeleton"},a("salla-skeleton",{type:"circle",height:"80px",width:"80px"}),a("salla-skeleton",{height:"15px",width:"60%"}),a("salla-skeleton",{height:"10px",width:"30%"}),a("div",{class:"s-rating-modal-skeleton-stars"},[...Array(5)].map((t=>a("div",{key:t,innerHTML:r})))),a("salla-skeleton",{height:"100px",width:"100%"}),a("div",{class:"s-rating-modal-skeleton-footer"},a("salla-skeleton",{height:"40px",width:"30%"})))),!this.hasError&&this.order?[a("div",{class:"s-rating-modal-wrapper",ref:t=>{t&&(this.body=t)}},this.isTestimonialsEnabled()?a("div",{class:"rating-outer-form s-rating-modal-step-wrap s-rating-modal-step s-rating-modal-hidden","data-type":"store"},a("div",{class:"s-rating-modal-rounded-icon"},a("img",{src:salla.config.get("store.logo","https://assets.salla.sa/cp/assets/images/logo-new.png"),alt:"store name",class:"s-rating-modal-store-logo"})),a("h2",{class:"s-rating-modal-title"},salla.config.get("store.name")),a("p",{class:"s-rating-modal-subtitle"},salla.lang.get("pages.rating.rate_the_store")),a("div",{class:"s-rating-modal-stars-company"},a("salla-rating-stars",{withLabel:!0,size:"large"})),a("textarea",{name:"comment",class:"s-rating-modal-comment",placeholder:salla.lang.get("pages.rating.write_store_rate")}),a("small",{class:"s-rating-modal-validation-msg"})):"",this.isProductsEnabled()&&this.getRateableProducts().map(((t,i)=>this.renderProductStep(t,i))),this.isShippingEnabled()&&this.order.shipping?.company?a("div",{class:"rating-outer-form s-rating-modal-step-wrap s-rating-modal-step s-rating-modal-hidden","data-type":"shipping"},a("input",{type:"hidden",name:"shipping_company_id",value:this.order.shipping.company.id}),this.order.shipping.company.logo?a("div",{class:"s-rating-modal-rounded-icon"},a("img",{src:this.order.shipping.company.logo,class:"s-rating-modal-shipping-logo",alt:this.order.shipping.company.name})):a("span",{class:"s-rating-modal-icon",innerHTML:o}),a("div",{class:"s-rating-modal-title"}," ",`${salla.lang.get("pages.rating.rate_shipping")} ${this.order.shipping.company.name}`),a("p",{class:"s-rating-modal-subtitle"},salla.lang.get("pages.rating.write_shipping_rate")),a("div",{class:"s-rating-modal-stars-company"},a("salla-rating-stars",{withLabel:!0,size:"large"})),a("textarea",{name:"comment",class:"s-rating-modal-comment",placeholder:salla.lang.get("pages.rating.write_shipping_rate")}),a("small",{class:"s-rating-modal-validation-msg"})):"",a("div",{class:"s-rating-modal-thanks s-rating-modal-hidden",ref:t=>{t&&(this.thanksTab=t)}},a("span",{class:"s-rating-modal-icon",innerHTML:n}),a("h3",{class:"s-rating-modal-thanks-title"},salla.lang.get("pages.rating.thanks")),a("div",{class:"s-rating-modal-thanks-msg",innerHTML:this.order.thanks_message}),a("time",{class:"s-rating-modal-thanks-time",ref:t=>{t&&(this.thanksTime=t)}}))),this.allowContactSupport&&this.showContactWidget&&(salla.config.get("store.contacts.whatsapp")||salla.config.get("store.contacts.email"))?a("div",{class:"s-rating-modal-contact"},a("p",null,this.contactUsLabel),a("div",{class:"s-rating-modal-contact-icons"},salla.config.get("store.contacts.whatsapp")&&a("span",{onClick:()=>this.handleSendWhatsApp(),innerHTML:h}),salla.config.get("store.contacts.email")&&a("span",{onClick:()=>this.handleSendEmail(),innerHTML:m}))):"",a("div",{class:"s-rating-modal-footer"},a("button",{ref:t=>{t&&(this.backBtn=t)},onClick:()=>this.previousTab(),class:"s-rating-modal-btn s-rating-modal-unvisiable"},salla.lang.get("common.elements.back")),this.stepsCount>1?a("ul",{class:"s-rating-modal-dots"},[...Array(this.stepsCount)].map(((t,i)=>a("li",{key:i,class:"s-rating-modal-bg-gray s-rating-modal-step-dot"})))):"",a("salla-button",{"loader-position":"center",loading:this.hasUploadsInProgress,disabled:this.hasUploadsInProgress,ref:t=>{t&&(this.nextBtn=t)},onClick:()=>this.submit()},salla.lang.get("common.elements.next")))]:a("salla-placeholder",{alignment:"center"}))):void 0}async componentWillLoad(){await salla.onReady(),await salla.lang.onLoaded(),this.registerTranslations(),this.syncStoreSettings()}registerTranslations(){salla.lang.addBulk({"common.uploader.drag_and_drop_files":{ar:"اسحب الملفات وأفلتها هنا",en:"Drag and drop files here"},"common.uploader.allowed_images_types":{ar:" .jpg أو jpeg أو png يُسمح بإضافة صور بصيغة",en:"Images in jpg, jpeg, or png format are allowed."},"pages.rating.add_images":{ar:"اضافة صور",en:"Add Images"},"pages.rating.edit_images":{ar:"تعديل الصور",en:"Edit Images"},"pages.rating.edit_review":{ar:"تعديل التقييم",en:"Edit review"},"pages.rating.confirm_deletion":{ar:"تأكيد حذف التقييم",en:"Confirm review deletion"},"pages.rating.are_you_sure_you_want_to_delete_review":{ar:"هل أنت متأكد من حذف تقييمك؟",en:"Are you sure you want to delete your review?"},"pages.rating.review_updated_successfully":{ar:"تم تعديل التقييم بنجاح",en:"The review has been successfully updated."},"pages.rating.review_deleted_successfully":{ar:"تم حذف التقييم بنجاح",en:"The review has been successfully deleted."},"pages.rating.images_count":{ar:"الصور ( :current من أصل :total )",en:"Images ( :current of :total )"},"pages.rating.media_count":{ar:"الصور (:imageCurrent/:imageTotal) · الفيديو (:videoCurrent/:videoTotal)",en:"Images (:imageCurrent/:imageTotal) · Videos (:videoCurrent/:videoTotal)"},"common.uploader.allowed_videos_types":{ar:"يُسمح بفيديوهات mp4 أو mov أو avi أو mkv",en:"Videos in mp4, mov, avi, or mkv format are allowed."},"pages.rating.videos_count":{ar:"الفيديو ( :current من أصل :total )",en:"Videos ( :current of :total )"},"common.uploader.allowed_media_types":{ar:"يُسمح بصور jpg أو jpeg أو png وفيديوهات mp4 أو mov أو avi أو mkv",en:"Images in jpg, jpeg, or png and videos in mp4, mov, avi, or mkv are allowed."},"common.uploader.max_three_images":{ar:"أضف حتى 10 صور و 5 فيديوهات كحد أقصى",en:"Add up to 10 images and 5 videos maximum."},"common.uploader.max_images_count":{ar:"أضف :count صور كحد أقصى",en:"Add up to :count images maximum."},"common.uploader.max_videos_count":{ar:"أضف :count فيديوهات كحد أقصى",en:"Add up to :count videos maximum."},"common.elements.confirm_delete":{ar:"تأكيد الحذف",en:"Confirm deletion"},"pages.rating.rate_required_factors":{ar:"يرجى تقييم جميع المعايير لإتمام مراجعتك.",en:"Please rate all required factors to complete your review."},"pages.rating.overall_product_rating":{ar:"التقييم العام للمنتج",en:"Overall product rating"},"pages.rating.rate_the_following_factors":{ar:"كيف تقيِّم التالي؟",en:"How would you rate the following?"},"pages.rating.loyalty_points_for_images":{ar:"شاركنا صورة مع تقييمك للطلب واكسب :points نقطة ولاء",en:"Share a photo with your order review and earn :points loyalty points"}}),this.contactUsLabel=salla.lang.get("blocks.footer.social"),this.dragAndDropFilesLabel=salla.lang.get("common.uploader.drag_and_drop_files"),this.allowedImagesTypesLabel=this.getAllowedMediaTypesLabel(),this.threeImagesMax=this.getMaxUploadHintLabel(),this.contactSubjectLabel=salla.lang.get("pages.rating.contact_subject"),this.editReviewLabel=salla.lang.get("pages.rating.edit_review"),this.areYouSureLabel=salla.lang.get("pages.rating.are_you_sure_you_want_to_delete_review"),this.confirmDeletionLabel=salla.lang.get("pages.rating.confirm_deletion"),this.cancelLabel=salla.lang.get("common.elements.cancel"),this.updatedSuccessfullyLabel=salla.lang.get("pages.rating.review_updated_successfully"),this.deletedSuccessfullyLabel=salla.lang.get("pages.rating.review_deleted_successfully"),this.confirmDeleteBtn=salla.lang.get("common.elements.confirm_delete"),this.requiredFactorsLabel=salla.lang.get("pages.rating.rate_required_factors"),this.rateTheFollowingLabel=salla.lang.get("pages.rating.rate_the_following_factors"),this.loyaltyPointsForImagesLabel=salla.lang.get("pages.rating.loyalty_points_for_images",{points:":points"}),this.contact_body=(t,i,a)=>salla.lang.get("pages.rating.contact_body",{store:t,id:i,customer:a})}componentDidRender(){this.scheduleWizardSetup&&this.defaultMode&&this.order&&(this.scheduleWizardSetup=!1,requestAnimationFrame((()=>this.handleWizard())))}disconnectedCallback(){this.clearThanksCountdown()}get host(){return e(this)}};x.style='/*!twlt*/.s-rating-modal-uploader{overflow:visible}.s-rating-modal-uploader.is-opened{height:auto !important;opacity:1 !important;overflow:visible;pointer-events:auto !important;margin-bottom:1rem}.s-rating-modal-uploader .s-file-upload-gallery{overflow:visible}.s-rating-modal-edit-wrapper,.s-rating-modal-wrapper{transition:height 0.15s ease}.s-rating-modal-product-details{padding-bottom:0.5rem}.s-rating-modal-comment{margin-top:0.35rem}.s-rating-modal-product{margin-bottom:1rem}.s-rating-modal-product-img{position:absolute !important;inset:0;display:block;width:100% !important;max-width:100% !important;height:100% !important;object-fit:cover}.s-rating-modal-product-title{font-size:0.95rem;font-weight:600;line-height:1.5;margin:0}.s-rating-modal-stars-product{margin-top:0.5rem}.s-rating-modal-loyalty-points-note-container{display:flex;align-items:center;gap:0.625rem;width:100%;margin-top:1.5rem;margin-bottom:0.75rem;padding:0.75rem;border-radius:0.5rem;background-color:#E6F4EA}.s-rating-modal-loyalty-points-note-icon{display:flex;flex-shrink:0;align-items:center;justify-content:center;width:1.25rem;height:1.25rem;color:#1B7F5C}.s-rating-modal-loyalty-points-note-icon svg{width:1.5rem;height:1.5rem;fill:currentColor}.s-rating-modal-loyalty-points-note-text{flex:1;margin:0;font-size:0.875rem;line-height:1.25rem;color:#1f2937}.s-rating-modal-product-details-main{display:flex;align-items:center;margin-bottom:0.5rem;padding-bottom:0;border-bottom:0}.s-rating-modal-product-info-row{display:flex;align-items:center;gap:0.6rem;margin-bottom:0.5rem;padding-bottom:0;border-bottom:0}.s-rating-modal-product-main-review{width:100%;text-align:right}.s-rating-modal-product-rating-rows{display:grid;gap:0.45rem;margin:0.2rem 0 0.7rem}.s-rating-modal-product-rating-row{display:flex;align-items:center;justify-content:space-between;gap:0.75rem;min-height:2rem}.s-rating-modal-product-rating-row salla-rating-stars{flex-shrink:0}.s-rating-modal-product-rating-row .s-rating-stars-wrapper{align-items:center;min-height:1.75rem}.s-rating-modal-product-rating-row .s-rating-stars-label,.s-rating-modal-product-rating-row .s-rating-stars-label-without-tag{min-width:auto;min-height:1.25rem;line-height:1.25rem;font-size:0.8rem;color:#5b6470;white-space:nowrap;text-align:end;transition:opacity 0.15s ease}.s-rating-modal-product-rating-row .s-rating-stars-label--empty,.s-rating-modal-product-rating-row .s-rating-stars-label-without-tag--empty{opacity:0}.s-rating-modal-product-factor-name{color:#5b6470;font-size:0.9rem;line-height:1.25}.s-rating-modal-product-factor-required{color:#f87171;margin-inline-start:0.2rem}.s-rating-modal-product-img-wrap{position:relative;width:5rem !important;min-width:5rem !important;max-width:5rem !important;height:3.5rem !important;flex-shrink:0 !important;overflow:hidden;border-radius:0.375rem;background:#f3f4f6}.mt-0{margin-top:0px}.block{display:block}.hidden{display:none}.shadow{--tw-shadow:0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}.outline{outline-style:solid}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.s-comments-item-like-btn{margin-top:0.5rem}.s-comments-item-like-btn .s-button-text{display:flex;flex-direction:row-reverse;gap:0.5rem}.s-comments-item-like-btn span svg{height:0.75rem;width:0.75rem}.s-rating-modal-wrapper{margin-bottom:1.5rem;transition-property:all;transition-duration:100ms;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1)}.s-rating-modal-edit-wrapper{margin-top:0.625rem}.s-rating-modal-footer{position:relative;display:flex;align-items:center;justify-content:space-between}.s-rating-modal-footer salla-button button{padding-left:1rem !important;padding-right:1rem !important;font-size:0.75rem !important}.s-rating-modal-btn{height:2.5rem;padding-left:1rem;padding-right:1rem;font-size:0.875rem;line-height:1.25rem;font-weight:700;color:var(--color-primary);transition-property:all;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:300ms}.s-rating-modal-btn:hover{color:var(--color-primary-dark)}.s-rating-modal-dots{display:flex;flex-shrink:0;flex-grow:1;justify-content:center}.s-rating-modal-dots>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-right:calc(0.375rem * var(--tw-space-x-reverse));margin-left:calc(0.375rem * calc(1 - var(--tw-space-x-reverse)))}.s-rating-modal-dots{text-align:center}.s-rating-modal-dots:where([dir="rtl"],[dir="rtl"] *)>:not([hidden])~:not([hidden]){--tw-space-x-reverse:1}.s-rating-modal-step-dot{height:0.625rem;width:0.625rem;border-radius:9999px;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:300ms}.s-rating-modal-step{transition-property:all;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:500ms}.s-rating-modal-active{--tw-translate-x:0px;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));opacity:1}.s-rating-modal-unactive{--tw-translate-x:0.75rem;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));opacity:0}.s-rating-modal-hidden{display:none !important}.s-rating-modal-unvisiable{pointer-events:none;opacity:0}.s-rating-modal-step-wrap{position:relative;display:flex;flex-direction:column;align-items:center;padding-bottom:1rem}.s-rating-modal-product-details{position:relative;display:flex;flex:1 1 0%;flex-direction:column;padding-bottom:1rem}.s-rating-modal-product-details-main{display:flex;align-items:flex-start;justify-content:space-between}.s-rating-modal-product-details-main .s-rating-stars-wrapper{margin-bottom:0.375rem;flex-direction:column;align-items:center}@media (min-width: 640px){.s-rating-modal-product-details-main .s-rating-stars-wrapper{margin-bottom:0px;flex-direction:row;gap:0px}}.s-rating-modal-rounded-icon{position:relative;margin-bottom:0.25rem;display:flex;height:6rem;width:6rem;align-items:center;justify-content:center;overflow:hidden;border-radius:9999px;border-width:1px;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1))}.s-rating-modal-title{margin-bottom:0.25rem;font-size:1.125rem;line-height:1.75rem;font-weight:700}.s-rating-modal-subtitle{margin-bottom:0.25rem;padding-left:0.5rem;padding-right:0.5rem;text-align:center;font-size:0.875rem;line-height:1.25rem;--tw-text-opacity:1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.s-rating-modal-store-logo{width:4rem;object-fit:contain}.s-rating-modal-shipping-logo{height:100%;width:100%;object-fit:contain}.s-rating-modal-shipping-icon{font-size:3rem;line-height:1;color:var(--color-primary)}.s-rating-modal-comment{margin-bottom:0.5rem;height:5rem !important;width:100%;border-radius:0.375rem;border-width:1px;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1));padding:0.75rem;font-size:0.875rem;line-height:1.25rem;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms}.s-rating-modal-comment:focus{border-color:var(--color-primary)}.s-rating-modal-comment:is(.dark *){--tw-border-opacity:1;border-color:rgb(75 85 99 / var(--tw-border-opacity, 1));--tw-bg-opacity:1;background-color:rgb(75 85 99 / var(--tw-bg-opacity, 1))}.s-rating-modal-validation-msg{margin-top:-3px;line-height:1rem;--tw-text-opacity:1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.s-rating-modal-product{margin-bottom:1.5rem}.s-rating-modal-product:last-child{margin-bottom:0px}.s-rating-modal-product .rating-outer-form{display:flex}.s-rating-modal-product .rating-outer-form>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-right:calc(0.5rem * var(--tw-space-x-reverse));margin-left:calc(0.5rem * calc(1 - var(--tw-space-x-reverse)))}@media (min-width: 640px){.s-rating-modal-product .rating-outer-form>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-right:calc(1.25rem * var(--tw-space-x-reverse));margin-left:calc(1.25rem * calc(1 - var(--tw-space-x-reverse)))}}.s-rating-modal-product .rating-outer-form:where([dir="rtl"],[dir="rtl"] *)>:not([hidden])~:not([hidden]){--tw-space-x-reverse:1}.s-rating-modal-product-img-wrap{height:3.5rem;width:auto;overflow:hidden;border-radius:0.375rem;--tw-bg-opacity:1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}@media (min-width: 640px){.s-rating-modal-product-img-wrap{width:5rem}}.s-rating-modal-product-img{position:relative;height:100%;width:100%;object-fit:cover;font-size:0px}.s-rating-modal-product-img::before{position:absolute;top:0px;left:0px;height:100%;width:100%;--tw-bg-opacity:1;background-color:rgb(229 231 235 / var(--tw-bg-opacity, 1));--tw-content:\'\';content:var(--tw-content)}.s-rating-modal-product-title{margin-bottom:0.375rem;font-size:0.875rem;font-weight:700;line-height:1.25rem}.s-rating-modal-thanks{padding-left:2rem;padding-right:2rem;text-align:center;transition-property:all;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:500ms}.s-rating-modal-icon{display:inline-flex;height:5rem;width:5rem;align-items:center;justify-content:center;border-radius:9999px;--tw-bg-opacity:1;background-color:rgb(249 250 251 / var(--tw-bg-opacity, 1));color:var(--color-primary)}.s-rating-modal-icon svg{height:1.75rem;width:1.75rem;fill:var(--color-primary)}.s-rating-modal-thanks-title{margin-top:1rem;font-weight:700}.s-rating-modal-thanks-msg{margin-bottom:1.5rem;font-size:0.875rem;line-height:1.25rem;--tw-text-opacity:1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.s-rating-modal-thanks-btn{height:2.5rem;flex:none;display:inline-flex;flex:1 1 0%;align-items:center;justify-content:center;white-space:nowrap;border-radius:0.375rem;padding-left:1.5rem;padding-right:1.5rem;padding-bottom:0.625rem;padding-top:0.5rem;font-size:0.875rem;line-height:1.25rem;font-weight:700;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:300ms}.s-rating-modal-thanks-btn:hover{opacity:0.8}.s-rating-modal-thanks-btn{border-width:1px;border-color:var(--color-primary);background-color:var(--color-primary);color:var(--color-primary-reverse)}.s-rating-modal-thanks-time{margin-top:0.75rem;display:block;height:1.5rem;font-size:0.875rem;line-height:1.25rem;--tw-text-opacity:1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.s-rating-modal-product-factors-card{margin-bottom:1rem;border-radius:0.5rem;--tw-bg-opacity:1;background-color:rgb(249 250 251 / var(--tw-bg-opacity, 1));padding:1rem}.s-rating-modal-product-factors-heading{margin-bottom:0.75rem;font-size:0.875rem;line-height:1.25rem;font-weight:700;--tw-text-opacity:1;color:rgb(31 41 55 / var(--tw-text-opacity, 1))}.s-rating-modal-stars-company{margin-bottom:1.25rem}.s-rating-modal-stars-company .s-rating-stars-wrapper{flex-direction:column;align-items:center;justify-content:center;gap:0.5rem}.s-rating-modal-stars-product .s-rating-stars-wrapper{flex-direction:column;align-items:center;justify-content:center}.s-rating-modal-upload-count{font-size:0.875rem;line-height:1.25rem;font-weight:500}.s-rating-modal-bg-gray{--tw-bg-opacity:1;background-color:rgb(229 231 235 / var(--tw-bg-opacity, 1))}.s-rating-modal-bg-primary{background-color:var(--color-primary)}unicode{unicode-bidi:plaintext}.s-rating-modal-wrap .s-modal-body{position:relative !important}.s-rating-modal-skeleton{display:flex;flex-direction:column;align-items:center;justify-content:center}.s-rating-modal-skeleton salla-skeleton:nth-child(1){margin-bottom:1.25rem}.s-rating-modal-skeleton salla-skeleton:nth-child(2){margin-bottom:0.75rem}.s-rating-modal-skeleton salla-skeleton:nth-child(3){margin-bottom:1.25rem}.s-rating-modal-skeleton salla-skeleton:nth-child(4){margin-bottom:2rem}.s-rating-modal-skeleton-footer{margin-top:1.5rem;display:flex;width:100%;justify-content:flex-end}.s-rating-modal-skeleton-footer salla-skeleton{margin-bottom:0px !important}.s-rating-modal-skeleton-stars{margin-bottom:0.75rem;display:flex;align-items:center}.s-rating-modal-skeleton-stars>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-right:calc(0.5rem * var(--tw-space-x-reverse));margin-left:calc(0.5rem * calc(1 - var(--tw-space-x-reverse)))}.s-rating-modal-skeleton-stars:where([dir="rtl"],[dir="rtl"] *)>:not([hidden])~:not([hidden]){--tw-space-x-reverse:1}.s-rating-modal-skeleton-stars div svg{width:25px;fill:currentColor;--tw-text-opacity:1;color:rgb(209 213 219 / var(--tw-text-opacity, 1))}.s-rating-modal-uploader{height:0px;opacity:0;transition-property:all;transition-duration:100ms;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1)}.s-rating-modal-uploader.is-opened{margin-bottom:1.5rem;overflow:visible}.s-rating-modal-uploader.is-closed{pointer-events:none;z-index:0}.s-rating-modal-uploader .filepond--drop-label{--tw-bg-opacity:1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.s-rating-modal-uploader .filepond--file-status .filepond--file-status-main{font-size:11px}.s-rating-modal-uploader .filepond--file-info-main{font-size:11px}.s-rating-modal-uploader li[data-filepond-item-state=\'load-invalid\'] .filepond--file-info{display:none}.s-rating-modal-filepond-placeholder-text{font-size:0.75rem !important;line-height:1rem !important}.s-rating-modal-filepond-placeholder{display:flex;flex-direction:column;align-items:center;justify-content:center}.s-rating-modal-filepond-placeholder-icon{margin-bottom:0.25rem}.s-rating-modal-filepond-placeholder-icon svg{height:1.5rem;width:1.5rem;fill:#7c8082}.s-rating-modal-contact{margin-bottom:1rem;display:flex;align-items:center;justify-content:space-between;border-radius:0.375rem;--tw-bg-opacity:1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1));padding:0.5rem}.s-rating-modal-contact p{font-size:1rem;line-height:1.5rem;--tw-text-opacity:1;color:rgb(31 41 55 / var(--tw-text-opacity, 1))}.s-rating-modal-contact-icons{display:flex;align-items:center;gap:0.5rem}.s-rating-modal-contact-icons span{display:flex;cursor:pointer;align-items:center;justify-content:center;border-radius:0.375rem;border-width:1px;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1));--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1));padding:0.375rem}.s-rating-modal-contact-icons span svg{height:1rem;width:1rem;fill:var(--color-primary)}.s-rating-modal-footer-end{justify-content:flex-end}.s-rating-modal-delete-wrapper{text-align:center}.s-rating-modal-delete-wrapper h3{margin-top:1.25rem;font-size:1.125rem;line-height:1.75rem;--tw-text-opacity:1;color:rgb(31 41 55 / var(--tw-text-opacity, 1))}.s-rating-modal-delete-wrapper p{margin-top:1.25rem;font-size:0.875rem;line-height:1.25rem;--tw-text-opacity:1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.s-rating-modal-delete-actions{margin-top:1.25rem;display:flex;align-items:center;gap:0.625rem}.s-rating-modal-delete-actions salla-button{width:100%}.s-rating-modal-delete-actions salla-button button{width:100%}';export{x as salla_rating_modal_v2}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as t,h as a,H as e,a as r}from"./p-
|
|
4
|
+
import{r as t,h as a,H as e,a as r}from"./p-BsIeN-bg.js";const s=class{constructor(a){if(t(this,a),this.entity="product",this.specs=[],this.download=salla.lang.get("pages.thank_you.download"),this.entityId)try{return void(this.entityId=Array.isArray(this.entityId)?this.entityId:JSON.parse(this.entityId))}catch(t){salla.log("Bad json passed via entityId prop")}}getValue(t){if("file"===t.type)return`<a href="${t.value}" class="text-primary" target="_blank"><span class="sicon-download"></span> ${this.download}</a>`;if("url"===t.type)return`<a href="${t.value}" class="text-blue-700 underline" target="_blank">${t.value}</a>`;if("date"===t.type){const a=new Date(t.value);return`${String(a.getDate()).padStart(2,"0")}/${String(a.getMonth()+1).padStart(2,"0")}/${a.getFullYear()}`}return t.value}async componentWillLoad(){if(await salla.onReady(),!salla.config.get("store.features")?.includes("custom-fields"))return salla.logger.error("feature custom-fields is not activated");if(this.entityId||!salla.url.is_page("product.single")&&!salla.url.is_page("product.showNewUrls")||(this.entityId=salla.config.get("page.id")),!this.entityId)return salla.logger.error("can't render salla-metadata without enity-id prop!");await salla.lang.onLoaded(),this.download=salla.lang.get("pages.thank_you.download");const t=await Salla.api.metadata.fetchValues(this.entity,this.entityId);this.specs=t.data[0]?.sections}render(){if(this.specs.length)return a(e,{class:"s-metadata-wrapper"},this.specs.map((t=>a("div",{class:"s-metadata-box"},a("div",{class:"s-metadata-box-header"},a("i",{class:"sicon-list"}),t.name),t.fields.map((t=>a("div",{class:"s-metadata-row"},a("p",{class:"s-metadata-row-name"},t.name),a("p",{class:"s-metadata-row-value",innerHTML:this.getValue(t)}))))))))}get host(){return r(this)}};s.style="/*!twlt*/.text-blue-700{--tw-text-opacity:1;color:rgb(29 78 216 / var(--tw-text-opacity, 1))}.text-primary{color:var(--color-primary)}.underline{text-decoration-line:underline}.s-metadata-box{margin-bottom:1.25rem;display:block;border-radius:0.375rem;--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1));padding:1.25rem}.s-metadata-box-header{margin-bottom:0.75rem;display:flex;align-items:center;column-gap:0.5rem;border-bottom-width:1px;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1));padding-bottom:0.75rem;font-size:1rem;line-height:1.5rem;font-weight:700}.s-metadata-row{margin-bottom:0.75rem;display:flex;flex-direction:row;justify-content:space-between;gap:0.5rem;line-height:1.25rem}.s-metadata-row:last-child{margin-bottom:0px}.s-metadata-row-name{font-size:0.875rem;line-height:1.25rem;font-weight:700;--tw-text-opacity:1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}";export{s as salla_metadata}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r,h as e,H as n,F as t}from"./p-C0qiFNJn.js";function i(r,e){if("string"!=typeof r)return r??e;const n=r.trim();if(!n)return e;try{return JSON.parse(n)}catch{return e}}function o(r){if(r)return"string"==typeof r?i(r,void 0):r}function a(r,e="ar"){const[n,t]=String(r).trim().split(":").map(Number);if(!Number.isFinite(n)||!Number.isFinite(t))return r;const i=new Date(2e3,0,1,n,t),o={hour:"numeric",minute:"2-digit",hour12:!0};try{return i.toLocaleTimeString(e,o)}catch{return i.toLocaleTimeString("ar",o)}}const s=class{constructor(e){r(this,e),this.stackCards=!1,this.isLoading=!1}componentWillLoad(){return this.getBranchData()}async getBranchData(){const r=salla.config.get("page.id");if(r){this.isLoading=!0;try{const e=await salla.order.api.getBranchDetails(r);this.branchData=this.parseBranchResponse(e)}catch(r){this.notifyApiError(r)}finally{this.isLoading=!1}}}parseBranchResponse(r){const e=r?.data?.data||r?.data||r;return e&&"object"==typeof e&&Object.prototype.hasOwnProperty.call(e,"branch")?e.branch?o(e.branch):void 0:o(e)}getApiErrorMessage(r){return r?.response?.data?.error?.message||r?.response?.data?.message}notifyApiError(r){const e=this.getApiErrorMessage(r);e&&salla.notify.error(e)}label(r,e){return salla.lang.getWithDefault(r,e)}get preparationText(){const r=this.branchData?.preparation_time_range;if(!r?.from||!r?.to)return"";const e=salla.helpers.number(r.from.value),n=salla.helpers.number(r.to.value),t=this.unitLabel(r.to.unit),i=e===n?e:`${e}-${n}`;return this.label("pages.orders.pickup_ready_after","جاهز للاستلام بعد :time").replace(":time",`${i} ${t}`)}unitLabel(r){const e=function(r){const e=String(r||"hour").toLowerCase();return e.startsWith("min")?"minute":e.startsWith("day")?"day":"hour"}(r);return"minute"===e?this.label("pages.checkout.minute","دقيقة"):"day"===e?this.label("pages.checkout.day","يوم"):this.label("pages.checkout.hour","ساعة")}get workingHoursItems(){const r=this.branchData;if(!r)return[];if(!0===r.always_open||1===r.always_open||"1"===r.always_open)return[this.label("pages.orders.branch_always_open","مفتوح على مدار الساعة")];const e=salla.lang.locale||"ar";return(r.working_hours||[]).filter((r=>r?.name&&r.times?.length)).map((r=>{const n=r.times[0];return`${r.name}: ${a(n.from,e)} - ${a(n.to,e)}`}))}get branchAddress(){return this.branchData?.address||""}get mapUrl(){const r=this.branchData?.location;if(null!=r?.lat&&null!=r?.lng)return`https://www.google.com/maps?q=${r.lat},${r.lng}`}get phone(){return function(r){const e=i(r,null),n=e&&"object"==typeof e?e.phone:"";return"string"==typeof n?n.trim():""}(this.branchData?.contacts)}renderDetailsColumn(){const r=this.phone;return r?e("div",{class:"s-order-branch-details"},e("div",{class:"s-order-branch-info-card"},e("span",{class:"s-order-branch-info-icon",innerHTML:'\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>phone-talking</title>\n<path d="M18.667 8c2.941 0 5.333 2.392 5.333 5.333 0 0.737 0.596 1.333 1.333 1.333s1.333-0.596 1.333-1.333c0-4.412-3.588-8-8-8-0.737 0-1.333 0.596-1.333 1.333s0.596 1.333 1.333 1.333zM18.667 2.667c5.881 0 10.667 4.785 10.667 10.667 0 0.737 0.596 1.333 1.333 1.333s1.333-0.596 1.333-1.333c0-7.352-5.981-13.333-13.333-13.333-0.737 0-1.333 0.596-1.333 1.333s0.596 1.333 1.333 1.333zM26.939 17.831c-1.568-1.568-4.119-1.568-5.689 0l-2.567 2.568c-3.064-1.499-5.584-4.019-7.083-7.083l2.569-2.567c1.567-1.569 1.567-4.121-0.001-5.689l-3.88-3.881c-1.521-1.521-4.169-1.521-5.691 0l-1.847 1.847c-2.22 2.22-3.183 5.408-2.573 8.527 1.979 10.144 10.127 18.292 20.271 20.271 0.617 0.121 1.236 0.18 1.851 0.18 2.491 0 4.895-0.972 6.676-2.752l1.847-1.847c1.569-1.569 1.569-4.12 0-5.689zM28.936 25.517l-1.847 1.847c-1.591 1.591-3.876 2.281-6.131 1.841-9.089-1.776-16.388-9.075-18.163-18.165-0.439-2.247 0.249-4.539 1.841-6.129l1.847-1.847c0.256-0.257 0.597-0.397 0.959-0.397s0.701 0.14 0.959 0.397l3.883 3.883c0.528 0.528 0.528 1.389 0 1.917l-3.22 3.219c-0.383 0.384-0.496 0.959-0.288 1.457 1.815 4.34 5.344 7.868 9.684 9.684 0.5 0.205 1.075 0.095 1.457-0.288l3.219-3.219c0.528-0.531 1.389-0.529 1.917-0.001l3.883 3.883c0.529 0.529 0.529 1.389 0 1.919z"></path>\n</svg>\n'}),e("div",{class:"s-order-branch-info-text"},e("span",{class:"s-order-branch-info-label"},this.label("pages.orders.branch_contacts","ارقام التواصل")),e("span",{class:"s-order-branch-info-value",dir:"ltr"},r)))):null}renderWorkingHoursCard(){const r=this.workingHoursItems;return r.length?e("div",{class:"s-order-branch-info-card s-order-branch-hours-card"},e("span",{class:"s-order-branch-info-icon","aria-hidden":"true"},e("i",{class:"sicon-calendar-alt"})),e("div",{class:"s-order-branch-info-text"},e("span",{class:"s-order-branch-info-label"},this.label("pages.checkout.working_hours","ساعات العمل")),e("div",{class:"s-order-branch-hours-list"},r.map((r=>e("span",{class:"s-order-branch-hours-item"},r)))))):null}renderBranchIdentityCard(){const r=this.branchData,n=this.branchAddress,t=this.preparationText;return e("section",{class:"s-order-branch-card"},e("div",{class:"s-order-branch-location"},e("div",{class:"s-order-branch-identity"},e("span",{class:"s-order-branch-store-icon"},e("i",{class:"sicon-store","aria-hidden":"true"})),e("div",{class:"s-order-branch-text"},e("div",{class:"s-order-branch-name-row"},r?.name?e("span",{class:"s-order-branch-name"},r.name):null,t?e("span",{class:"s-order-branch-ready"},t):null),n?e("span",{class:"s-order-branch-address"},n):null)),this.mapUrl?e("div",{class:"s-order-branch-actions"},e("a",{href:this.mapUrl,target:"_blank",rel:"noopener noreferrer",class:"s-order-branch-map-link"},e("span",null,this.label("pages.orders.branch_map","موقع الفرع علي الخريطة")),e("span",{class:"s-order-branch-action-icon",innerHTML:'<svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M6.95448 2.79419C9.7395 1.84477 11.132 1.37005 11.881 2.11902C12.6299 2.86799 12.1552 4.2605 11.2058 7.04551L10.5593 8.94203C9.83014 11.0809 9.46556 12.1503 8.8646 12.2388C8.70303 12.2626 8.53577 12.2483 8.37592 12.197C7.78135 12.0061 7.46705 10.8785 6.83846 8.62339C6.69903 8.12319 6.62932 7.87308 6.47057 7.68206C6.4245 7.62662 6.37338 7.5755 6.31794 7.52943C6.12692 7.37068 5.87681 7.30097 5.37661 7.16154C3.12148 6.53295 1.99391 6.21865 1.80302 5.62408C1.7517 5.46423 1.73738 5.29698 1.76117 5.1354C1.84968 4.53444 2.91911 4.16986 5.05797 3.44072L6.95448 2.79419Z" stroke="currentColor" stroke-width="1.5"/>\n</svg>\n'}))):null))}render(){return this.isLoading||!this.branchData?e(n,{class:"s-order-branch-wrapper"}):e(n,{class:"s-order-branch-wrapper"},this.stackCards?e(t,null,this.renderBranchIdentityCard(),this.renderDetailsColumn()):e("div",{class:"s-order-branch-container"},this.renderBranchIdentityCard(),this.renderDetailsColumn()),this.renderWorkingHoursCard())}};s.style="/*!twlt*/:host{display:block}.s-order-branch-ready{background-color:color-mix(in srgb, var(--color-primary) 30%, transparent)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.s-order-branch-wrapper{margin-bottom:1.5rem;display:flex;flex-direction:column;gap:1rem;font-family:inherit}.s-order-branch-container{display:grid;grid-template-columns:repeat(1, minmax(0, 1fr));align-items:stretch;gap:1rem}@media (min-width: 768px){.s-order-branch-container{grid-template-columns:repeat(2, minmax(0, 1fr))}}.s-order-branch-details{display:grid;align-content:stretch;gap:1rem}.s-order-branch-info-card{display:flex;min-height:68px;align-items:center;justify-content:space-between;gap:0.75rem;border-radius:0.5rem;border-width:1px;border-color:var(--color-border,#eee);background-color:var(--color-surface,#fff);padding:0.75rem}.s-order-branch-info-text{display:flex;min-width:0px;flex:1 1 0%;flex-direction:column;gap:3px;text-align:start}.s-order-branch-info-label{font-size:0.75rem;line-height:1rem;line-height:1.35;color:var(--color-text-secondary,#666)}.s-order-branch-info-value{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:0.875rem;line-height:1.25rem;font-weight:500;line-height:1.45;color:var(--color-text-primary,#1d1d1d)}.s-order-branch-hours-card .s-order-branch-info-text{gap:0.5rem}.s-order-branch-hours-list{display:flex;flex-wrap:wrap;align-items:center;gap:0.5rem}.s-order-branch-hours-item{display:inline-flex;align-items:center;white-space:nowrap;border-radius:0.375rem;border-width:1px;border-color:var(--color-border,#eee);padding-left:0.625rem;padding-right:0.625rem;padding-top:0.25rem;padding-bottom:0.25rem;font-size:0.75rem;line-height:1rem;font-weight:500;line-height:1.45;color:var(--color-text-primary,#1d1d1d)}.s-order-branch-info-action{display:inline-flex;height:3rem;width:3rem;flex-shrink:0;align-items:center;justify-content:center;border-radius:0.5rem;background-color:var(--color-surface-secondary,#f6f6f6);color:var(--color-text-primary,#2b2d34);text-decoration-line:none}.s-order-branch-info-icon{display:inline-flex;height:3rem;width:3rem;align-items:center;justify-content:center;border-radius:0.375rem;--tw-bg-opacity:1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1));font-size:22px;color:currentColor}.s-order-branch-info-icon svg{height:1.5rem;width:1.5rem;fill:currentColor}.s-order-branch-card{display:flex;flex-direction:column;gap:0.75rem;border-radius:0.5rem;border-width:1px;border-color:var(--color-border,#eee);background-color:var(--color-surface,#fff);padding:1rem}@media (min-width: 768px){.s-order-branch-card{padding:1.25rem}}.s-order-branch-ready{display:inline-flex;flex-shrink:0;align-items:center;white-space:nowrap;border-radius:9999px;border-width:1px;border-color:var(--color-primary,#236e4c);padding-left:0.75rem;padding-right:0.75rem;padding-top:0.25rem;padding-bottom:0.25rem;font-size:0.75rem;line-height:1rem;font-weight:500;color:var(--color-primary-dark,#0c2519)}.s-order-branch-location{display:flex;min-height:52px;flex-direction:column;align-items:stretch;justify-content:space-between;gap:1.5rem}@media (min-width: 768px){.s-order-branch-location{flex-direction:row;align-items:center}}.s-order-branch-identity{display:flex;min-width:0px;flex:1 1 0%;align-items:center;gap:0.75rem}.s-order-branch-store-icon{display:inline-flex;height:3rem;width:3rem;flex-shrink:0;align-items:center;justify-content:center;--tw-bg-opacity:1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1));font-size:1.5rem;line-height:2rem;color:var(--color-text-primary,#2b2d34)}.s-order-branch-store-icon svg{height:1em;width:1em;fill:currentColor}.s-order-branch-text{display:flex;min-width:0px;flex-direction:column;gap:0.25rem;text-align:start}.s-order-branch-name-row{display:flex;flex-wrap:wrap;align-items:center;gap:0.5rem}.s-order-branch-name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:1rem;line-height:1.5rem;font-weight:500;line-height:1.45;color:var(--color-text-primary,#2b2d34)}.s-order-branch-address{overflow-wrap:break-word;font-size:0.75rem;line-height:1rem;line-height:1.45;color:var(--color-text-secondary,#666)}.s-order-branch-actions{display:flex;flex-shrink:0;flex-wrap:wrap;align-items:center;gap:0.75rem}@media (min-width: 768px){.s-order-branch-actions{flex-wrap:nowrap}}.s-order-branch-map-link{display:inline-flex;min-height:2.25rem;align-items:center;justify-content:center;gap:0.5rem;white-space:nowrap;border-radius:0.375rem;border-width:1px;border-color:var(--color-primary,#236e4c);padding-left:0.875rem;padding-right:0.875rem;padding-top:0.5rem;padding-bottom:0.5rem;font-size:0.875rem;line-height:1.25rem;font-weight:700;line-height:1.2;color:var(--color-primary,#236e4c);text-decoration-line:none}.s-order-branch-action-icon{display:inline-flex;align-items:center;justify-content:center;font-size:0.875rem;line-height:1.25rem;color:currentColor}.s-order-branch-action-icon svg{height:1em;width:1em}";export{s as salla_order_branch}
|
|
4
|
+
import{r,h as e,H as n,F as t}from"./p-BsIeN-bg.js";function i(r,e){if("string"!=typeof r)return r??e;const n=r.trim();if(!n)return e;try{return JSON.parse(n)}catch{return e}}function o(r){if(r)return"string"==typeof r?i(r,void 0):r}function a(r,e="ar"){const[n,t]=String(r).trim().split(":").map(Number);if(!Number.isFinite(n)||!Number.isFinite(t))return r;const i=new Date(2e3,0,1,n,t),o={hour:"numeric",minute:"2-digit",hour12:!0};try{return i.toLocaleTimeString(e,o)}catch{return i.toLocaleTimeString("ar",o)}}const s=class{constructor(e){r(this,e),this.stackCards=!1,this.isLoading=!1}componentWillLoad(){return this.getBranchData()}async getBranchData(){const r=salla.config.get("page.id");if(r){this.isLoading=!0;try{const e=await salla.order.api.getBranchDetails(r);this.branchData=this.parseBranchResponse(e)}catch(r){this.notifyApiError(r)}finally{this.isLoading=!1}}}parseBranchResponse(r){const e=r?.data?.data||r?.data||r;return e&&"object"==typeof e&&Object.prototype.hasOwnProperty.call(e,"branch")?e.branch?o(e.branch):void 0:o(e)}getApiErrorMessage(r){return r?.response?.data?.error?.message||r?.response?.data?.message}notifyApiError(r){const e=this.getApiErrorMessage(r);e&&salla.notify.error(e)}label(r,e){return salla.lang.getWithDefault(r,e)}get preparationText(){const r=this.branchData?.preparation_time_range;if(!r?.from||!r?.to)return"";const e=salla.helpers.number(r.from.value),n=salla.helpers.number(r.to.value),t=this.unitLabel(r.to.unit),i=e===n?e:`${e}-${n}`;return this.label("pages.orders.pickup_ready_after","جاهز للاستلام بعد :time").replace(":time",`${i} ${t}`)}unitLabel(r){const e=function(r){const e=String(r||"hour").toLowerCase();return e.startsWith("min")?"minute":e.startsWith("day")?"day":"hour"}(r);return"minute"===e?this.label("pages.checkout.minute","دقيقة"):"day"===e?this.label("pages.checkout.day","يوم"):this.label("pages.checkout.hour","ساعة")}get workingHoursItems(){const r=this.branchData;if(!r)return[];if(!0===r.always_open||1===r.always_open||"1"===r.always_open)return[this.label("pages.orders.branch_always_open","مفتوح على مدار الساعة")];const e=salla.lang.locale||"ar";return(r.working_hours||[]).filter((r=>r?.name&&r.times?.length)).map((r=>{const n=r.times[0];return`${r.name}: ${a(n.from,e)} - ${a(n.to,e)}`}))}get branchAddress(){return this.branchData?.address||""}get mapUrl(){const r=this.branchData?.location;if(null!=r?.lat&&null!=r?.lng)return`https://www.google.com/maps?q=${r.lat},${r.lng}`}get phone(){return function(r){const e=i(r,null),n=e&&"object"==typeof e?e.phone:"";return"string"==typeof n?n.trim():""}(this.branchData?.contacts)}renderDetailsColumn(){const r=this.phone;return r?e("div",{class:"s-order-branch-details"},e("div",{class:"s-order-branch-info-card"},e("span",{class:"s-order-branch-info-icon",innerHTML:'\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>phone-talking</title>\n<path d="M18.667 8c2.941 0 5.333 2.392 5.333 5.333 0 0.737 0.596 1.333 1.333 1.333s1.333-0.596 1.333-1.333c0-4.412-3.588-8-8-8-0.737 0-1.333 0.596-1.333 1.333s0.596 1.333 1.333 1.333zM18.667 2.667c5.881 0 10.667 4.785 10.667 10.667 0 0.737 0.596 1.333 1.333 1.333s1.333-0.596 1.333-1.333c0-7.352-5.981-13.333-13.333-13.333-0.737 0-1.333 0.596-1.333 1.333s0.596 1.333 1.333 1.333zM26.939 17.831c-1.568-1.568-4.119-1.568-5.689 0l-2.567 2.568c-3.064-1.499-5.584-4.019-7.083-7.083l2.569-2.567c1.567-1.569 1.567-4.121-0.001-5.689l-3.88-3.881c-1.521-1.521-4.169-1.521-5.691 0l-1.847 1.847c-2.22 2.22-3.183 5.408-2.573 8.527 1.979 10.144 10.127 18.292 20.271 20.271 0.617 0.121 1.236 0.18 1.851 0.18 2.491 0 4.895-0.972 6.676-2.752l1.847-1.847c1.569-1.569 1.569-4.12 0-5.689zM28.936 25.517l-1.847 1.847c-1.591 1.591-3.876 2.281-6.131 1.841-9.089-1.776-16.388-9.075-18.163-18.165-0.439-2.247 0.249-4.539 1.841-6.129l1.847-1.847c0.256-0.257 0.597-0.397 0.959-0.397s0.701 0.14 0.959 0.397l3.883 3.883c0.528 0.528 0.528 1.389 0 1.917l-3.22 3.219c-0.383 0.384-0.496 0.959-0.288 1.457 1.815 4.34 5.344 7.868 9.684 9.684 0.5 0.205 1.075 0.095 1.457-0.288l3.219-3.219c0.528-0.531 1.389-0.529 1.917-0.001l3.883 3.883c0.529 0.529 0.529 1.389 0 1.919z"></path>\n</svg>\n'}),e("div",{class:"s-order-branch-info-text"},e("span",{class:"s-order-branch-info-label"},this.label("pages.orders.branch_contacts","ارقام التواصل")),e("span",{class:"s-order-branch-info-value",dir:"ltr"},r)))):null}renderWorkingHoursCard(){const r=this.workingHoursItems;return r.length?e("div",{class:"s-order-branch-info-card s-order-branch-hours-card"},e("span",{class:"s-order-branch-info-icon","aria-hidden":"true"},e("i",{class:"sicon-calendar-alt"})),e("div",{class:"s-order-branch-info-text"},e("span",{class:"s-order-branch-info-label"},this.label("pages.checkout.working_hours","ساعات العمل")),e("div",{class:"s-order-branch-hours-list"},r.map((r=>e("span",{class:"s-order-branch-hours-item"},r)))))):null}renderBranchIdentityCard(){const r=this.branchData,n=this.branchAddress,t=this.preparationText;return e("section",{class:"s-order-branch-card"},e("div",{class:"s-order-branch-location"},e("div",{class:"s-order-branch-identity"},e("span",{class:"s-order-branch-store-icon"},e("i",{class:"sicon-store","aria-hidden":"true"})),e("div",{class:"s-order-branch-text"},e("div",{class:"s-order-branch-name-row"},r?.name?e("span",{class:"s-order-branch-name"},r.name):null,t?e("span",{class:"s-order-branch-ready"},t):null),n?e("span",{class:"s-order-branch-address"},n):null)),this.mapUrl?e("div",{class:"s-order-branch-actions"},e("a",{href:this.mapUrl,target:"_blank",rel:"noopener noreferrer",class:"s-order-branch-map-link"},e("span",null,this.label("pages.orders.branch_map","موقع الفرع علي الخريطة")),e("span",{class:"s-order-branch-action-icon",innerHTML:'<svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M6.95448 2.79419C9.7395 1.84477 11.132 1.37005 11.881 2.11902C12.6299 2.86799 12.1552 4.2605 11.2058 7.04551L10.5593 8.94203C9.83014 11.0809 9.46556 12.1503 8.8646 12.2388C8.70303 12.2626 8.53577 12.2483 8.37592 12.197C7.78135 12.0061 7.46705 10.8785 6.83846 8.62339C6.69903 8.12319 6.62932 7.87308 6.47057 7.68206C6.4245 7.62662 6.37338 7.5755 6.31794 7.52943C6.12692 7.37068 5.87681 7.30097 5.37661 7.16154C3.12148 6.53295 1.99391 6.21865 1.80302 5.62408C1.7517 5.46423 1.73738 5.29698 1.76117 5.1354C1.84968 4.53444 2.91911 4.16986 5.05797 3.44072L6.95448 2.79419Z" stroke="currentColor" stroke-width="1.5"/>\n</svg>\n'}))):null))}render(){return this.isLoading||!this.branchData?e(n,{class:"s-order-branch-wrapper"}):e(n,{class:"s-order-branch-wrapper"},this.stackCards?e(t,null,this.renderBranchIdentityCard(),this.renderDetailsColumn()):e("div",{class:"s-order-branch-container"},this.renderBranchIdentityCard(),this.renderDetailsColumn()),this.renderWorkingHoursCard())}};s.style="/*!twlt*/:host{display:block}.s-order-branch-ready{background-color:color-mix(in srgb, var(--color-primary) 30%, transparent)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.s-order-branch-wrapper{margin-bottom:1.5rem;display:flex;flex-direction:column;gap:1rem;font-family:inherit}.s-order-branch-container{display:grid;grid-template-columns:repeat(1, minmax(0, 1fr));align-items:stretch;gap:1rem}@media (min-width: 768px){.s-order-branch-container{grid-template-columns:repeat(2, minmax(0, 1fr))}}.s-order-branch-details{display:grid;align-content:stretch;gap:1rem}.s-order-branch-info-card{display:flex;min-height:68px;align-items:center;justify-content:space-between;gap:0.75rem;border-radius:0.5rem;border-width:1px;border-color:var(--color-border,#eee);background-color:var(--color-surface,#fff);padding:0.75rem}.s-order-branch-info-text{display:flex;min-width:0px;flex:1 1 0%;flex-direction:column;gap:3px;text-align:start}.s-order-branch-info-label{font-size:0.75rem;line-height:1rem;line-height:1.35;color:var(--color-text-secondary,#666)}.s-order-branch-info-value{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:0.875rem;line-height:1.25rem;font-weight:500;line-height:1.45;color:var(--color-text-primary,#1d1d1d)}.s-order-branch-hours-card .s-order-branch-info-text{gap:0.5rem}.s-order-branch-hours-list{display:flex;flex-wrap:wrap;align-items:center;gap:0.5rem}.s-order-branch-hours-item{display:inline-flex;align-items:center;white-space:nowrap;border-radius:0.375rem;border-width:1px;border-color:var(--color-border,#eee);padding-left:0.625rem;padding-right:0.625rem;padding-top:0.25rem;padding-bottom:0.25rem;font-size:0.75rem;line-height:1rem;font-weight:500;line-height:1.45;color:var(--color-text-primary,#1d1d1d)}.s-order-branch-info-action{display:inline-flex;height:3rem;width:3rem;flex-shrink:0;align-items:center;justify-content:center;border-radius:0.5rem;background-color:var(--color-surface-secondary,#f6f6f6);color:var(--color-text-primary,#2b2d34);text-decoration-line:none}.s-order-branch-info-icon{display:inline-flex;height:3rem;width:3rem;align-items:center;justify-content:center;border-radius:0.375rem;--tw-bg-opacity:1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1));font-size:22px;color:currentColor}.s-order-branch-info-icon svg{height:1.5rem;width:1.5rem;fill:currentColor}.s-order-branch-card{display:flex;flex-direction:column;gap:0.75rem;border-radius:0.5rem;border-width:1px;border-color:var(--color-border,#eee);background-color:var(--color-surface,#fff);padding:1rem}@media (min-width: 768px){.s-order-branch-card{padding:1.25rem}}.s-order-branch-ready{display:inline-flex;flex-shrink:0;align-items:center;white-space:nowrap;border-radius:9999px;border-width:1px;border-color:var(--color-primary,#236e4c);padding-left:0.75rem;padding-right:0.75rem;padding-top:0.25rem;padding-bottom:0.25rem;font-size:0.75rem;line-height:1rem;font-weight:500;color:var(--color-primary-dark,#0c2519)}.s-order-branch-location{display:flex;min-height:52px;flex-direction:column;align-items:stretch;justify-content:space-between;gap:1.5rem}@media (min-width: 768px){.s-order-branch-location{flex-direction:row;align-items:center}}.s-order-branch-identity{display:flex;min-width:0px;flex:1 1 0%;align-items:center;gap:0.75rem}.s-order-branch-store-icon{display:inline-flex;height:3rem;width:3rem;flex-shrink:0;align-items:center;justify-content:center;--tw-bg-opacity:1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1));font-size:1.5rem;line-height:2rem;color:var(--color-text-primary,#2b2d34)}.s-order-branch-store-icon svg{height:1em;width:1em;fill:currentColor}.s-order-branch-text{display:flex;min-width:0px;flex-direction:column;gap:0.25rem;text-align:start}.s-order-branch-name-row{display:flex;flex-wrap:wrap;align-items:center;gap:0.5rem}.s-order-branch-name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:1rem;line-height:1.5rem;font-weight:500;line-height:1.45;color:var(--color-text-primary,#2b2d34)}.s-order-branch-address{overflow-wrap:break-word;font-size:0.75rem;line-height:1rem;line-height:1.45;color:var(--color-text-secondary,#666)}.s-order-branch-actions{display:flex;flex-shrink:0;flex-wrap:wrap;align-items:center;gap:0.75rem}@media (min-width: 768px){.s-order-branch-actions{flex-wrap:nowrap}}.s-order-branch-map-link{display:inline-flex;min-height:2.25rem;align-items:center;justify-content:center;gap:0.5rem;white-space:nowrap;border-radius:0.375rem;border-width:1px;border-color:var(--color-primary,#236e4c);padding-left:0.875rem;padding-right:0.875rem;padding-top:0.5rem;padding-bottom:0.5rem;font-size:0.875rem;line-height:1.25rem;font-weight:700;line-height:1.2;color:var(--color-primary,#236e4c);text-decoration-line:none}.s-order-branch-action-icon{display:inline-flex;align-items:center;justify-content:center;font-size:0.875rem;line-height:1.25rem;color:currentColor}.s-order-branch-action-icon svg{height:1em;width:1em}";export{s as salla_order_branch}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as t,h as i,H as e}from"./p-C0qiFNJn.js";var r,n;!function(t){t.PERCENTAGE="percentage",t.FIXED="fixed",t.FREE_PRODUCT="free_product"}(r||(r={})),function(t){t.PRODUCT_COUNT="products_count",t.PRODUCT_PURCHASE="order_amount"}(n||(n={}));const o=class{constructor(i){t(this,i),this.offer=null,this.products={},this.isLoading=!1,this.canRender=!0}componentWillLoad(){salla.onReady().then((()=>{if(!salla.config.get("store.features")?.includes("conditional-offer")||""!==salla.storage.get("cart")&&!salla.storage.get("cart")?.summary?.count)throw new Error("feature or cart object does not existed")})).then((()=>salla.api.cart.offers())).then((({data:t})=>{if(this.offer=t.find((t=>"conditional"===t.type)),this.offer)return this.isLoading=!0,this.offer.details.discounts.unshift({value:0,min_spend:0}),this.updateInitialOfferValue();this.canRender=!1})).then((()=>{if(this.offer)return this.getProducts()})).then((()=>{this.offer&&salla.event.on("cart::updated",(t=>this.updateOfferValues(t)))})).catch((t=>{this.canRender=!1,salla.logger.warn("salla-conditional-offer:: ",t)})).finally((()=>{this.isLoading=!1}))}getProducts(){const t=this.offer.details.discounts.filter((({type:t})=>t===r.FREE_PRODUCT)).map((({value:t})=>t)).filter(Boolean);if(t.length>0)return salla.product.fetch({source:"selected",source_value:t}).then((t=>{const i=t?.data;if(i&&Array.isArray(i)){const t={...this.products};i.forEach((({id:i,url:e,image:r,name:n,price:o})=>{i&&n&&r?.url&&e&&void 0!==o&&(t[i]={url:e,image:r,name:n,price:o})})),this.products=t}}))}updateInitialOfferValue(){return salla.api.cart.details().then((({data:{cart:t}})=>this.updateOfferValues(t)))}updateOfferValues({items:t,sub_total:i}){const e=this.offer.details.based_on===n.PRODUCT_COUNT?t?.reduce(((t,{quantity:i})=>t+i),0)??0:i;return this.offer={...this.offer,details:{...this.offer?.details,current_value:e}},this.offer}renderTooltip(t){const e=t.value,r=this.products[e];return r?i("salla-tooltip",{class:"absolute left-0 -top-2",targetId:`avatar-product-${e}`,theme:"dark"},i("div",{class:"flex gap-3 text-start"},r?.image?.url&&i("img",{src:r.image.url,alt:r?.image?.alt||r.name||"",class:"w-12 h-12 object-cover rounded-lg flex-shrink-0",loading:"lazy",decoding:"async"}),i("div",{class:"flex-1"},i("div",{class:"leading-tight mb-1"},r.name),i("div",{class:"text-xs text-gray-300",innerHTML:salla.money(r.price)})))):(salla.logger.error(`salla-conditional-offer:: there is no product with id (${t.value})!`),null)}getCheckpointContent(t){if(t.type===r.PERCENTAGE)return`${t.value}%`;if(t.type===r.FIXED)return i("span",{innerHTML:salla.money(t.value)});if(t.type!==r.FREE_PRODUCT)return salla.logger.error(`salla-conditional-offer:: unexpected type (${t.type})!`),"";const e=this.products[t.value];return e?i("a",{class:"s-conditional-offer-product-link",href:e.url},i("img",{class:"s-conditional-offer-checkpoint-image-content",loading:"lazy",decoding:"async",alt:e?.image?.alt||"",src:e?.image?.url})):(salla.logger.error(`salla-conditional-offer:: there is no product with id (${t.value})!`),"")}getOfferType(t){const i=this.offer.details?.based_on;if(i===n.PRODUCT_COUNT)try{return salla.lang.choice("blocks.header.products_count",t.min_spend)}catch(i){return salla.logger.warn("salla-conditional-offer:: invalid products_count interval",i),`${t.min_spend}`}return i===n.PRODUCT_PURCHASE?salla.money(t.min_spend):(salla.logger.warn(`salla-conditional-offer:: Unexpected offer detail's based_on value: ${i}`),`${t.min_spend}`)}clamp(t,i,e){return Math.max(i,Math.min(t,e))}mapValueRanges(t,i,e,r,n){const o=(t-i)*(n-r)/(e-i)+r;return o===Number.POSITIVE_INFINITY?100:o===Number.NEGATIVE_INFINITY?0:this.clamp(o,0,100)}getCheckPointView(t,e){const n=this.offer.details.discounts.findIndex((({min_spend:i})=>i===t.min_spend)),o=this.mapValueRanges(this.offer.details.current_value,this.offer.details.discounts[n-1]?.min_spend??0,t.min_spend,0,100),a=t.min_spend<=this.offer.details.current_value;return i("div",{class:"s-conditional-offer-checkpoint-container"},e>0?[i("div",{key:"progress-line",class:"s-conditional-offer-progress-line-container"},i("div",{class:"s-conditional-offer-progress-line-inactive"}),i("div",{class:"s-conditional-offer-progress-line-active",style:{width:`${o}%`}})),i("div",{key:"checkpoint",class:"s-conditional-offer-checkpoint "+(a?"s-conditional-offer-active-checkpoint":"")},i("div",{class:"s-conditional-offer-item-avatar-content "+(a?"active":""),id:t.type===r.FREE_PRODUCT?`avatar-product-${t.value}`:`avatar-${t.value??e}`},this.products&&this.getCheckpointContent(t)),this.products&&t.type===r.FREE_PRODUCT&&this.renderTooltip(t),i("div",{class:"s-conditional-offer-checkpoint-label "+(a?"active":""),innerHTML:this.getOfferType(t)}))]:i("div",{key:"label",class:{"s-conditional-offer-checkpoint-label":!0,"first-checkpoint":0===e,active:a,hidden:0===e,"sm:block":0===e},innerHTML:this.getOfferType(t)}))}getLoadingSkeletonView(){return i(e,{class:"s-conditional-offer-container"},i("div",{class:"s-conditional-offer-skeleton-inner-container"},i("div",{class:"s-conditional-offer-skeleton-subtitle"},i("salla-skeleton",{height:"16px",width:"30%"})),i("div",{class:"s-conditional-offer-skeleton-subtitle"},i("salla-skeleton",{height:"16px",width:"35%"})),i("div",{class:"s-conditional-offer-skeleton-checkpoints-wrapper"},Array(3).fill(null).map((()=>[i("salla-skeleton",{key:"checkpoint-line",height:"8px"}),i("div",{key:"checkpoint"},i("salla-skeleton",{height:"60px",width:"60px",type:"circle"}))])))))}render(){return this.canRender?this.isLoading?this.getLoadingSkeletonView():this.offer?i(e,{class:"s-conditional-offer-container"},i("div",{class:"s-conditional-offer-title-wrapper"},i("div",{class:"s-conditional-offer-title"},this.offer.title),this.offer.description?i("div",{class:"s-conditional-offer-subtitle"},this.offer.description," ",i("i",{class:"sicon-information"})):null),i("div",{class:"s-conditional-offer-progress-container"},this.offer.details.discounts.map(((t,e)=>i("div",{class:{"flex-1":e>0},key:t.min_spend},this.getCheckPointView(t,e)))))):null:null}};o.style='/*!twlt*/:host{display:block}.fixed{position:fixed}.absolute{position:absolute}.-top-2{top:-0.5rem}.left-0{left:0px}.mb-1{margin-bottom:0.25rem}.block{display:block}.flex{display:flex}.hidden{display:none}.h-12{height:3rem}.w-12{width:3rem}.flex-1{flex:1 1 0%}.flex-shrink-0{flex-shrink:0}.gap-3{gap:0.75rem}.rounded-lg{border-radius:0.5rem}.object-cover{object-fit:cover}.text-start{text-align:start}.text-xs{font-size:0.75rem;line-height:1rem}.leading-tight{line-height:1.25}.text-gray-300{--tw-text-opacity:1;color:rgb(209 213 219 / var(--tw-text-opacity, 1))}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.s-conditional-offer-container{position:relative;display:inline-flex;width:100%;flex-direction:column;align-items:center;justify-content:flex-start;gap:1.25rem;border-radius:0.375rem;--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1));padding-left:1.25rem;padding-right:1.25rem;padding-top:1rem;padding-bottom:4rem}@media (min-width: 768px){.s-conditional-offer-container{padding-left:2.5rem;padding-right:2.5rem;padding-top:2rem;padding-bottom:2rem}}.s-conditional-offer-title-wrapper{display:flex;flex-direction:column;align-items:center;justify-content:flex-start;align-self:stretch}.s-conditional-offer-title{text-align:center;font-size:1.25rem;line-height:1.75rem;font-weight:700;color:var(--color-primary-dark)}.s-conditional-offer-subtitle{display:inline-flex;align-items:center;justify-content:center;gap:0.25rem;align-self:stretch;text-align:center;font-size:0.75rem;line-height:1rem;font-weight:400;--tw-text-opacity:1;color:rgb(64 64 64 / var(--tw-text-opacity, 1))}.s-conditional-offer-subtitle i{position:relative}.s-conditional-offer-progress-line{height:1px;align-self:stretch;background-color:var(--color-primary)}.s-conditional-offer-checkpoint-border{display:flex;height:60px;min-width:60px;flex-direction:column;align-items:center;justify-content:center;border-radius:9999px;border-width:1px;--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.s-conditional-offer-checkpoint-border-colored{border-color:var(--color-primary);color:var(--color-primary-dark)}.s-conditional-offer-product-link{display:grid;aspect-ratio:1 / 1;height:58px;place-content:center;overflow:hidden;border-radius:9999px}.s-conditional-offer-checkpoint-image-content{height:58px;width:58px;object-fit:cover}.s-conditional-offer-progress-container{position:relative;margin-bottom:2rem;display:flex;height:8rem;width:100%;flex-wrap:wrap;align-items:center;justify-content:center}@media (min-width: 768px){.s-conditional-offer-progress-container{height:4rem}}.s-conditional-offer-item-avatar-content{text-align:center;font-size:0.875rem;font-weight:700;line-height:1.25rem}.s-conditional-offer-item-avatar-content.active{color:var(--color-primary-dark);transition-property:all;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:500ms;transition-timing-function:cubic-bezier(0, 0, 0.2, 1)}.s-conditional-offer-checkpoint{position:relative;display:flex;height:60px;width:60px;flex-shrink:0;flex-direction:column;align-items:center;justify-content:center;border-radius:9999px;border-width:1px}.s-conditional-offer-progress-line-container{display:grid;width:100%;overflow:hidden;grid-template-areas:\'progress-line\'}.s-conditional-offer-progress-line-inactive{height:1.5px;width:100%;--tw-bg-opacity:1;background-color:rgb(209 213 219 / var(--tw-bg-opacity, 1));transition-property:all;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:500ms;transition-timing-function:cubic-bezier(0, 0, 0.2, 1);grid-area:progress-line}.s-conditional-offer-progress-line-active{height:1.5px;width:0%;background-color:var(--color-primary);transition-property:all;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:500ms;transition-timing-function:cubic-bezier(0, 0, 0.2, 1);grid-area:progress-line}.s-conditional-offer-checkpoint-label{position:absolute;top:100%;left:50%;width:max-content;--tw-translate-x:-50%;--tw-translate-y:20%;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));transition-property:all;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:500ms;transition-timing-function:cubic-bezier(0, 0, 0.2, 1)}.s-conditional-offer-checkpoint-label.active{color:var(--color-primary-dark);transition-property:all;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:500ms;transition-timing-function:cubic-bezier(0, 0, 0.2, 1)}.s-conditional-offer-checkpoint-label.first-checkpoint{--tw-translate-y:132%;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.s-conditional-offer-checkpoint-label.first-checkpoint:where([dir="ltr"],[dir="ltr"] *){--tw-translate-x:0%;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.s-conditional-offer-checkpoint-label.first-checkpoint:where([dir="rtl"],[dir="rtl"] *){--tw-translate-x:-100%;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.s-conditional-offer-checkpoint-container{position:relative;display:flex;align-items:center}.s-conditional-offer-active-checkpoint{display:flex;justify-content:center;border-color:var(--color-primary);transition-property:all;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:500ms;transition-timing-function:cubic-bezier(0, 0, 0.2, 1)}.s-conditional-offer-skeleton-inner-container{margin-bottom:2rem;width:100%}@media (min-width: 768px){.s-conditional-offer-skeleton-inner-container{margin-bottom:0px}}.s-conditional-offer-skeleton-title{margin-bottom:1rem;display:flex;justify-content:center}.s-conditional-offer-skeleton-subtitle{margin-bottom:1.5rem;display:flex;justify-content:center}.s-conditional-offer-skeleton-checkpoints-wrapper{display:flex;align-items:center}@media (min-width: 640px){.sm\\:block{display:block}}';export{o as salla_conditional_offer}
|
|
4
|
+
import{r as t,h as i,H as e}from"./p-BsIeN-bg.js";var r,n;!function(t){t.PERCENTAGE="percentage",t.FIXED="fixed",t.FREE_PRODUCT="free_product"}(r||(r={})),function(t){t.PRODUCT_COUNT="products_count",t.PRODUCT_PURCHASE="order_amount"}(n||(n={}));const o=class{constructor(i){t(this,i),this.offer=null,this.products={},this.isLoading=!1,this.canRender=!0}componentWillLoad(){salla.onReady().then((()=>{if(!salla.config.get("store.features")?.includes("conditional-offer")||""!==salla.storage.get("cart")&&!salla.storage.get("cart")?.summary?.count)throw new Error("feature or cart object does not existed")})).then((()=>salla.api.cart.offers())).then((({data:t})=>{if(this.offer=t.find((t=>"conditional"===t.type)),this.offer)return this.isLoading=!0,this.offer.details.discounts.unshift({value:0,min_spend:0}),this.updateInitialOfferValue();this.canRender=!1})).then((()=>{if(this.offer)return this.getProducts()})).then((()=>{this.offer&&salla.event.on("cart::updated",(t=>this.updateOfferValues(t)))})).catch((t=>{this.canRender=!1,salla.logger.warn("salla-conditional-offer:: ",t)})).finally((()=>{this.isLoading=!1}))}getProducts(){const t=this.offer.details.discounts.filter((({type:t})=>t===r.FREE_PRODUCT)).map((({value:t})=>t)).filter(Boolean);if(t.length>0)return salla.product.fetch({source:"selected",source_value:t}).then((t=>{const i=t?.data;if(i&&Array.isArray(i)){const t={...this.products};i.forEach((({id:i,url:e,image:r,name:n,price:o})=>{i&&n&&r?.url&&e&&void 0!==o&&(t[i]={url:e,image:r,name:n,price:o})})),this.products=t}}))}updateInitialOfferValue(){return salla.api.cart.details().then((({data:{cart:t}})=>this.updateOfferValues(t)))}updateOfferValues({items:t,sub_total:i}){const e=this.offer.details.based_on===n.PRODUCT_COUNT?t?.reduce(((t,{quantity:i})=>t+i),0)??0:i;return this.offer={...this.offer,details:{...this.offer?.details,current_value:e}},this.offer}renderTooltip(t){const e=t.value,r=this.products[e];return r?i("salla-tooltip",{class:"absolute left-0 -top-2",targetId:`avatar-product-${e}`,theme:"dark"},i("div",{class:"flex gap-3 text-start"},r?.image?.url&&i("img",{src:r.image.url,alt:r?.image?.alt||r.name||"",class:"w-12 h-12 object-cover rounded-lg flex-shrink-0",loading:"lazy",decoding:"async"}),i("div",{class:"flex-1"},i("div",{class:"leading-tight mb-1"},r.name),i("div",{class:"text-xs text-gray-300",innerHTML:salla.money(r.price)})))):(salla.logger.error(`salla-conditional-offer:: there is no product with id (${t.value})!`),null)}getCheckpointContent(t){if(t.type===r.PERCENTAGE)return`${t.value}%`;if(t.type===r.FIXED)return i("span",{innerHTML:salla.money(t.value)});if(t.type!==r.FREE_PRODUCT)return salla.logger.error(`salla-conditional-offer:: unexpected type (${t.type})!`),"";const e=this.products[t.value];return e?i("a",{class:"s-conditional-offer-product-link",href:e.url},i("img",{class:"s-conditional-offer-checkpoint-image-content",loading:"lazy",decoding:"async",alt:e?.image?.alt||"",src:e?.image?.url})):(salla.logger.error(`salla-conditional-offer:: there is no product with id (${t.value})!`),"")}getOfferType(t){const i=this.offer.details?.based_on;if(i===n.PRODUCT_COUNT)try{return salla.lang.choice("blocks.header.products_count",t.min_spend)}catch(i){return salla.logger.warn("salla-conditional-offer:: invalid products_count interval",i),`${t.min_spend}`}return i===n.PRODUCT_PURCHASE?salla.money(t.min_spend):(salla.logger.warn(`salla-conditional-offer:: Unexpected offer detail's based_on value: ${i}`),`${t.min_spend}`)}clamp(t,i,e){return Math.max(i,Math.min(t,e))}mapValueRanges(t,i,e,r,n){const o=(t-i)*(n-r)/(e-i)+r;return o===Number.POSITIVE_INFINITY?100:o===Number.NEGATIVE_INFINITY?0:this.clamp(o,0,100)}getCheckPointView(t,e){const n=this.offer.details.discounts.findIndex((({min_spend:i})=>i===t.min_spend)),o=this.mapValueRanges(this.offer.details.current_value,this.offer.details.discounts[n-1]?.min_spend??0,t.min_spend,0,100),a=t.min_spend<=this.offer.details.current_value;return i("div",{class:"s-conditional-offer-checkpoint-container"},e>0?[i("div",{key:"progress-line",class:"s-conditional-offer-progress-line-container"},i("div",{class:"s-conditional-offer-progress-line-inactive"}),i("div",{class:"s-conditional-offer-progress-line-active",style:{width:`${o}%`}})),i("div",{key:"checkpoint",class:"s-conditional-offer-checkpoint "+(a?"s-conditional-offer-active-checkpoint":"")},i("div",{class:"s-conditional-offer-item-avatar-content "+(a?"active":""),id:t.type===r.FREE_PRODUCT?`avatar-product-${t.value}`:`avatar-${t.value??e}`},this.products&&this.getCheckpointContent(t)),this.products&&t.type===r.FREE_PRODUCT&&this.renderTooltip(t),i("div",{class:"s-conditional-offer-checkpoint-label "+(a?"active":""),innerHTML:this.getOfferType(t)}))]:i("div",{key:"label",class:{"s-conditional-offer-checkpoint-label":!0,"first-checkpoint":0===e,active:a,hidden:0===e,"sm:block":0===e},innerHTML:this.getOfferType(t)}))}getLoadingSkeletonView(){return i(e,{class:"s-conditional-offer-container"},i("div",{class:"s-conditional-offer-skeleton-inner-container"},i("div",{class:"s-conditional-offer-skeleton-subtitle"},i("salla-skeleton",{height:"16px",width:"30%"})),i("div",{class:"s-conditional-offer-skeleton-subtitle"},i("salla-skeleton",{height:"16px",width:"35%"})),i("div",{class:"s-conditional-offer-skeleton-checkpoints-wrapper"},Array(3).fill(null).map((()=>[i("salla-skeleton",{key:"checkpoint-line",height:"8px"}),i("div",{key:"checkpoint"},i("salla-skeleton",{height:"60px",width:"60px",type:"circle"}))])))))}render(){return this.canRender?this.isLoading?this.getLoadingSkeletonView():this.offer?i(e,{class:"s-conditional-offer-container"},i("div",{class:"s-conditional-offer-title-wrapper"},i("div",{class:"s-conditional-offer-title"},this.offer.title),this.offer.description?i("div",{class:"s-conditional-offer-subtitle"},this.offer.description," ",i("i",{class:"sicon-information"})):null),i("div",{class:"s-conditional-offer-progress-container"},this.offer.details.discounts.map(((t,e)=>i("div",{class:{"flex-1":e>0},key:t.min_spend},this.getCheckPointView(t,e)))))):null:null}};o.style='/*!twlt*/:host{display:block}.fixed{position:fixed}.absolute{position:absolute}.-top-2{top:-0.5rem}.left-0{left:0px}.mb-1{margin-bottom:0.25rem}.block{display:block}.flex{display:flex}.hidden{display:none}.h-12{height:3rem}.w-12{width:3rem}.flex-1{flex:1 1 0%}.flex-shrink-0{flex-shrink:0}.gap-3{gap:0.75rem}.rounded-lg{border-radius:0.5rem}.object-cover{object-fit:cover}.text-start{text-align:start}.text-xs{font-size:0.75rem;line-height:1rem}.leading-tight{line-height:1.25}.text-gray-300{--tw-text-opacity:1;color:rgb(209 213 219 / var(--tw-text-opacity, 1))}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.s-conditional-offer-container{position:relative;display:inline-flex;width:100%;flex-direction:column;align-items:center;justify-content:flex-start;gap:1.25rem;border-radius:0.375rem;--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1));padding-left:1.25rem;padding-right:1.25rem;padding-top:1rem;padding-bottom:4rem}@media (min-width: 768px){.s-conditional-offer-container{padding-left:2.5rem;padding-right:2.5rem;padding-top:2rem;padding-bottom:2rem}}.s-conditional-offer-title-wrapper{display:flex;flex-direction:column;align-items:center;justify-content:flex-start;align-self:stretch}.s-conditional-offer-title{text-align:center;font-size:1.25rem;line-height:1.75rem;font-weight:700;color:var(--color-primary-dark)}.s-conditional-offer-subtitle{display:inline-flex;align-items:center;justify-content:center;gap:0.25rem;align-self:stretch;text-align:center;font-size:0.75rem;line-height:1rem;font-weight:400;--tw-text-opacity:1;color:rgb(64 64 64 / var(--tw-text-opacity, 1))}.s-conditional-offer-subtitle i{position:relative}.s-conditional-offer-progress-line{height:1px;align-self:stretch;background-color:var(--color-primary)}.s-conditional-offer-checkpoint-border{display:flex;height:60px;min-width:60px;flex-direction:column;align-items:center;justify-content:center;border-radius:9999px;border-width:1px;--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.s-conditional-offer-checkpoint-border-colored{border-color:var(--color-primary);color:var(--color-primary-dark)}.s-conditional-offer-product-link{display:grid;aspect-ratio:1 / 1;height:58px;place-content:center;overflow:hidden;border-radius:9999px}.s-conditional-offer-checkpoint-image-content{height:58px;width:58px;object-fit:cover}.s-conditional-offer-progress-container{position:relative;margin-bottom:2rem;display:flex;height:8rem;width:100%;flex-wrap:wrap;align-items:center;justify-content:center}@media (min-width: 768px){.s-conditional-offer-progress-container{height:4rem}}.s-conditional-offer-item-avatar-content{text-align:center;font-size:0.875rem;font-weight:700;line-height:1.25rem}.s-conditional-offer-item-avatar-content.active{color:var(--color-primary-dark);transition-property:all;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:500ms;transition-timing-function:cubic-bezier(0, 0, 0.2, 1)}.s-conditional-offer-checkpoint{position:relative;display:flex;height:60px;width:60px;flex-shrink:0;flex-direction:column;align-items:center;justify-content:center;border-radius:9999px;border-width:1px}.s-conditional-offer-progress-line-container{display:grid;width:100%;overflow:hidden;grid-template-areas:\'progress-line\'}.s-conditional-offer-progress-line-inactive{height:1.5px;width:100%;--tw-bg-opacity:1;background-color:rgb(209 213 219 / var(--tw-bg-opacity, 1));transition-property:all;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:500ms;transition-timing-function:cubic-bezier(0, 0, 0.2, 1);grid-area:progress-line}.s-conditional-offer-progress-line-active{height:1.5px;width:0%;background-color:var(--color-primary);transition-property:all;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:500ms;transition-timing-function:cubic-bezier(0, 0, 0.2, 1);grid-area:progress-line}.s-conditional-offer-checkpoint-label{position:absolute;top:100%;left:50%;width:max-content;--tw-translate-x:-50%;--tw-translate-y:20%;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));transition-property:all;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:500ms;transition-timing-function:cubic-bezier(0, 0, 0.2, 1)}.s-conditional-offer-checkpoint-label.active{color:var(--color-primary-dark);transition-property:all;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:500ms;transition-timing-function:cubic-bezier(0, 0, 0.2, 1)}.s-conditional-offer-checkpoint-label.first-checkpoint{--tw-translate-y:132%;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.s-conditional-offer-checkpoint-label.first-checkpoint:where([dir="ltr"],[dir="ltr"] *){--tw-translate-x:0%;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.s-conditional-offer-checkpoint-label.first-checkpoint:where([dir="rtl"],[dir="rtl"] *){--tw-translate-x:-100%;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.s-conditional-offer-checkpoint-container{position:relative;display:flex;align-items:center}.s-conditional-offer-active-checkpoint{display:flex;justify-content:center;border-color:var(--color-primary);transition-property:all;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:500ms;transition-timing-function:cubic-bezier(0, 0, 0.2, 1)}.s-conditional-offer-skeleton-inner-container{margin-bottom:2rem;width:100%}@media (min-width: 768px){.s-conditional-offer-skeleton-inner-container{margin-bottom:0px}}.s-conditional-offer-skeleton-title{margin-bottom:1rem;display:flex;justify-content:center}.s-conditional-offer-skeleton-subtitle{margin-bottom:1.5rem;display:flex;justify-content:center}.s-conditional-offer-skeleton-checkpoints-wrapper{display:flex;align-items:center}@media (min-width: 640px){.sm\\:block{display:block}}';export{o as salla_conditional_offer}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r,h as e,H as s}from"./p-
|
|
4
|
+
import{r,h as e,H as s}from"./p-BsIeN-bg.js";import{i as t}from"./p-DqDX5na4.js";class i{async run(r){this.abort();const{signal:e}=this.controller=new AbortController;try{const s=await r(e);return e.aborted?{aborted:!0}:{aborted:!1,result:s}}catch(r){if(e.aborted)return{aborted:!0};throw r}}abort(){this.controller?.abort()}}const o=class{constructor(e){r(this,e),this.shipments=[],this.request=new i}async componentWillLoad(){return await salla.onReady(),this.fetchShipments()}async onOrderIdChange(){this.shipments=[],await this.fetchShipments()}disconnectedCallback(){this.request.abort()}async fetchShipments(){if(this.request.abort(),!salla.config.get("store.features",[]).includes("thankyou-page-multi-shipments"))return;const r=this.orderId||salla.config.get("page.id");if(r)try{const{aborted:e,result:s}=await this.request.run((e=>salla.order.api.getShipments(r,e)));if(e)return;const t=s?.data;this.shipments=Array.isArray(t)?t:Array.isArray(t?.data)?t.data:[]}catch(r){const e=r?.response?.data?.error?.message||r?.response?.data?.message;e&&salla.notify.error(e)}}label(r,e){return salla.lang.getWithDefault(r,e)}async copyTracking(r){try{await navigator.clipboard.writeText(r),salla.notify.success(this.label("common.elements.copied","تم النسخ"))}catch{}}renderTracking(r){const s=r.number;return s&&0!==Number(s)?e("span",{class:"s-order-shipments-tracking"},this.label("pages.thank_you.tracking_no","رقم تتبع الشحنة"),e("b",{dir:"ltr"},"#",s),e("button",{type:"button",class:"s-order-shipments-copy",title:this.label("common.elements.copy","نسخ"),onClick:()=>this.copyTracking(String(s))},e("span",{innerHTML:t}))):e("span",{class:"s-order-shipments-placeholder"},this.label("pages.thank_you.tracking_placeholder","سيتم تعيين رقم تتبع بمجرد تجهيز الشحنة"))}renderShipment(r,s){return e("div",{class:"s-order-shipments-card"},e("div",{class:"s-order-shipments-header"},r.logo?e("img",{src:r.logo,class:"s-order-shipments-logo",alt:r.name||"",width:"56",height:"32"}):null,e("span",{class:"s-order-shipments-title"},this.label("pages.thank_you.shipment","الشحنة")," (",s+1,")")),e("div",{class:"s-order-shipments-info"},this.renderTracking(r)),e("div",{class:"s-order-shipments-items"},(r.products||[]).map((r=>e("span",{class:"s-order-shipments-item",title:r.name},r.image?e("img",{src:r.image,alt:r.name,width:"56",height:"56"}):e("span",{class:"s-order-shipments-item-name"},r.name))))))}render(){return this.shipments.length<2?e(s,{class:"s-order-shipments-empty"}):e(s,{class:"s-order-shipments-wrapper"},e("div",{class:"s-order-shipments-list"},this.shipments.map(((r,e)=>this.renderShipment(r,e)))))}static get watchers(){return{orderId:["onOrderIdChange"]}}};o.style="/*!twlt*/:host{display:block}.s-order-shipments-wrapper{display:block}.s-order-shipments-empty{display:none}.s-order-shipments-list{display:flex;flex-wrap:wrap;gap:1rem}.s-order-shipments-card{display:flex;min-width:16rem;flex:1 1 0%;flex-basis:25%;flex-direction:column;gap:0.75rem;border-radius:1rem;background-color:var(--color-surface);padding:1rem;--tw-shadow:0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);--tw-shadow-colored:0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}.s-order-shipments-header{display:flex;gap:0.5rem}.s-order-shipments-title{font-size:15px;font-weight:700;color:var(--color-text-primary)}.s-order-shipments-logo{height:3rem;width:3rem;flex-shrink:0;border-radius:9999px;object-fit:cover}.s-order-shipments-info{display:flex;flex-wrap:wrap;align-items:center;column-gap:0.75rem;row-gap:0.5rem;font-size:13px;color:var(--color-text-secondary)}.s-order-shipments-tracking{display:inline-flex;align-items:center;gap:0.25rem}.s-order-shipments-placeholder{color:var(--color-text-secondary)}.s-order-shipments-copy{display:inline-flex;cursor:pointer;align-items:center;border-width:0px;background-color:transparent;padding:0px;color:currentColor}.s-order-shipments-copy svg{height:0.875rem;width:0.875rem;fill:currentColor}.s-order-shipments-items{display:flex;gap:0.5rem;overflow-x:auto}.s-order-shipments-item{display:inline-flex;height:4.5rem;width:4.5rem;flex-shrink:0;align-items:center;justify-content:center;overflow:hidden;border-radius:0.75rem;border-width:1px;border-color:var(--color-border);padding:0.375rem}.s-order-shipments-item img{display:block;height:100%;width:100%;object-fit:contain}.s-order-shipments-item-name{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:3;padding-left:0.25rem;padding-right:0.25rem;text-align:center;font-size:10px;line-height:1.25;color:var(--color-text-secondary)}";export{o as salla_order_shipments}
|