@salla.sa/twilight-components 2.14.523 → 2.14.524
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{filepond-DCHVhc44.js → filepond-BVaAyFoF.js} +1 -1
- package/dist/cjs/{filepond-plugin-file-poster-CfA-n2Oh.js → filepond-plugin-file-poster-D_7P3fIq.js} +1 -1
- package/dist/cjs/{filepond-plugin-file-validate-size-DZQkwEKK.js → filepond-plugin-file-validate-size-wpUbEEJQ.js} +1 -1
- package/dist/cjs/{filepond-plugin-file-validate-type-Dl8je2Fu.js → filepond-plugin-file-validate-type-DnsofxYi.js} +1 -1
- package/dist/cjs/{filepond-plugin-image-edit-BzYslA6t.js → filepond-plugin-image-edit-BN8NNj8r.js} +1 -1
- package/dist/cjs/{filepond-plugin-image-exif-orientation-D856YsXh.js → filepond-plugin-image-exif-orientation-Bh2lasm5.js} +1 -1
- package/dist/cjs/{filepond-plugin-image-preview-CYa8C4oD.js → filepond-plugin-image-preview-CEuvK6zb.js} +1 -1
- package/dist/cjs/{functions-DG_jVKBR.js → functions-BsqbMNo6.js} +1 -1
- package/dist/cjs/{index-EWm59_5l.js → index-B2m0lkUU.js} +6 -6
- package/dist/cjs/{index-D-YSscuC.js → index-D5DmfeX9.js} +1 -1
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/salla-accordion-body_2.cjs.entry.js +1 -1
- package/dist/cjs/salla-accordion_6.cjs.entry.js +1 -1
- package/dist/cjs/salla-add-product-button_5.cjs.entry.js +1 -1
- package/dist/cjs/salla-advertisement.cjs.entry.js +1 -1
- package/dist/cjs/salla-alert_2.cjs.entry.js +1 -1
- package/dist/cjs/salla-app-install-alert.cjs.entry.js +1 -1
- package/dist/cjs/salla-apps-icons.cjs.entry.js +1 -1
- package/dist/cjs/salla-badge.cjs.entry.js +1 -1
- package/dist/cjs/salla-basket-gap.cjs.entry.js +1 -1
- package/dist/cjs/salla-booking-field_7.cjs.entry.js +10 -10
- package/dist/cjs/salla-bullet-delivery_2.cjs.entry.js +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_8.cjs.entry.js +1 -1
- package/dist/cjs/salla-conditional-offer.cjs.entry.js +1 -1
- package/dist/cjs/salla-contacts.cjs.entry.js +1 -1
- package/dist/cjs/salla-cookies-bar.cjs.entry.js +1 -1
- package/dist/cjs/salla-count-down_2.cjs.entry.js +1 -1
- package/dist/cjs/salla-custom-fields.cjs.entry.js +1 -1
- package/dist/cjs/salla-delivery-promise.cjs.entry.js +1 -1
- package/dist/cjs/salla-edit-order-button.cjs.entry.js +1 -1
- package/dist/cjs/salla-filters-widget.cjs.entry.js +1 -1
- package/dist/cjs/salla-filters.cjs.entry.js +1 -1
- package/dist/cjs/salla-fulfillment-methods.cjs.entry.js +1 -1
- package/dist/cjs/salla-gifting.cjs.entry.js +1 -1
- package/dist/cjs/salla-hook.cjs.entry.js +1 -1
- package/dist/cjs/salla-infinite-scroll.cjs.entry.js +1 -1
- package/dist/cjs/salla-installment.cjs.entry.js +1 -1
- package/dist/cjs/salla-list-tile.cjs.entry.js +1 -1
- package/dist/cjs/salla-localization-modal.cjs.entry.js +1 -1
- package/dist/cjs/salla-login-modal.cjs.entry.js +1 -1
- package/dist/cjs/salla-loyalty-banner.cjs.entry.js +2 -2
- package/dist/cjs/salla-loyalty-exchange-product-card_5.cjs.entry.js +3 -3
- package/dist/cjs/salla-loyalty-hero_2.cjs.entry.js +2 -2
- package/dist/cjs/salla-loyalty-panel.cjs.entry.js +3 -3
- package/dist/cjs/salla-loyalty-points-banner.cjs.entry.js +1 -1
- package/dist/cjs/salla-loyalty-points-history.cjs.entry.js +1 -1
- package/dist/cjs/salla-loyalty-prize-item.cjs.entry.js +1 -1
- package/dist/cjs/salla-loyalty-program.cjs.entry.js +3 -3
- package/dist/cjs/salla-loyalty-reward.cjs.entry.js +2 -2
- package/dist/cjs/salla-loyalty.cjs.entry.js +1 -1
- package/dist/cjs/salla-maintenance-alert.cjs.entry.js +1 -1
- package/dist/cjs/salla-map_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.cjs.entry.js +1 -1
- package/dist/cjs/salla-notifications.cjs.entry.js +1 -1
- package/dist/cjs/salla-offer-modal.cjs.entry.js +1 -1
- package/dist/cjs/salla-offer.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-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-shipments.cjs.entry.js +41 -4
- package/dist/cjs/salla-order-summary.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-totals-card.cjs.entry.js +1 -1
- package/dist/cjs/salla-orders.cjs.entry.js +1 -1
- package/dist/cjs/salla-payments.cjs.entry.js +1 -1
- package/dist/cjs/salla-placeholder.cjs.entry.js +1 -1
- package/dist/cjs/salla-price-range.cjs.entry.js +1 -1
- package/dist/cjs/salla-product-card-embed.cjs.entry.js +1 -1
- package/dist/cjs/salla-product-card_2.cjs.entry.js +1 -1
- package/dist/cjs/salla-product-size-guide.cjs.entry.js +1 -1
- package/dist/cjs/salla-products-list.cjs.entry.js +1 -1
- package/dist/cjs/salla-quick-order.cjs.entry.js +1 -1
- package/dist/cjs/salla-rating-modal-v2.cjs.entry.js +1 -1
- package/dist/cjs/salla-rating-modal.cjs.entry.js +1 -1
- package/dist/cjs/salla-review-factors-tags.cjs.entry.js +1 -1
- package/dist/cjs/salla-scopes.cjs.entry.js +1 -1
- package/dist/cjs/salla-search.cjs.entry.js +1 -1
- package/dist/cjs/salla-skeleton.cjs.entry.js +1 -1
- package/dist/cjs/salla-slider.cjs.entry.js +1 -1
- package/dist/cjs/salla-social-share.cjs.entry.js +1 -1
- package/dist/cjs/salla-social.cjs.entry.js +1 -1
- package/dist/cjs/salla-tab-content_3.cjs.entry.js +1 -1
- package/dist/cjs/salla-tiered-offer.cjs.entry.js +1 -1
- package/dist/cjs/salla-tooltip.cjs.entry.js +1 -1
- package/dist/cjs/salla-trust-badges.cjs.entry.js +1 -1
- package/dist/cjs/salla-user-menu.cjs.entry.js +1 -1
- package/dist/cjs/salla-user-profile.cjs.entry.js +1 -1
- package/dist/cjs/salla-user-settings.cjs.entry.js +1 -1
- package/dist/cjs/salla-verify.cjs.entry.js +1 -1
- package/dist/cjs/salla-wallet.cjs.entry.js +1 -1
- package/dist/cjs/salla-wishlist-actions.cjs.entry.js +1 -1
- package/dist/cjs/{tracked-promise-C2tbWLf_.js → tracked-promise-DV7LEYsU.js} +1 -1
- package/dist/cjs/twilight.cjs.js +2 -2
- package/dist/cjs/{vanilla-picker-BXezTQQL.js → vanilla-picker-CXvH2EWT.js} +1 -1
- package/dist/collection/Helpers/latest-request.js +31 -0
- package/dist/collection/components/salla-order-shipments/salla-order-shipments.js +12 -3
- package/dist/components/index.js +2 -2
- package/dist/components/salla-order-shipments.js +40 -3
- package/dist/esm/{filepond-DQ6pHM8K.js → filepond-DTzVnm2p.js} +1 -1
- package/dist/esm/{filepond-plugin-file-poster-Cin3Drv6.js → filepond-plugin-file-poster-Bgus9Ofh.js} +1 -1
- package/dist/esm/{filepond-plugin-file-validate-size-Bo-SgRcF.js → filepond-plugin-file-validate-size-B8PRvgIP.js} +1 -1
- package/dist/esm/{filepond-plugin-file-validate-type-DvBZJiZ0.js → filepond-plugin-file-validate-type-CAs60OfK.js} +1 -1
- package/dist/esm/{filepond-plugin-image-edit-DTVE32mN.js → filepond-plugin-image-edit-5pQX-bqs.js} +1 -1
- package/dist/esm/{filepond-plugin-image-exif-orientation-W7UUFbyD.js → filepond-plugin-image-exif-orientation-CQmP0y_L.js} +1 -1
- package/dist/esm/{filepond-plugin-image-preview-DGuRiudm.js → filepond-plugin-image-preview-DdIiCGg1.js} +1 -1
- package/dist/esm/{functions-D7FvvD3w.js → functions-DpljrYCU.js} +1 -1
- package/dist/esm/{index-Bg8UYNC5.js → index-DPAGXd41.js} +1 -1
- package/dist/esm/{index-BM5d07q2.js → index-Dm54yhRt.js} +6 -6
- package/dist/esm/loader.js +3 -3
- package/dist/esm/salla-accordion-body_2.entry.js +1 -1
- package/dist/esm/salla-accordion_6.entry.js +1 -1
- package/dist/esm/salla-add-product-button_5.entry.js +1 -1
- package/dist/esm/salla-advertisement.entry.js +1 -1
- package/dist/esm/salla-alert_2.entry.js +1 -1
- package/dist/esm/salla-app-install-alert.entry.js +1 -1
- package/dist/esm/salla-apps-icons.entry.js +1 -1
- package/dist/esm/salla-badge.entry.js +1 -1
- package/dist/esm/salla-basket-gap.entry.js +1 -1
- package/dist/esm/salla-booking-field_7.entry.js +10 -10
- package/dist/esm/salla-bullet-delivery_2.entry.js +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_8.entry.js +1 -1
- package/dist/esm/salla-conditional-offer.entry.js +1 -1
- package/dist/esm/salla-contacts.entry.js +1 -1
- package/dist/esm/salla-cookies-bar.entry.js +1 -1
- package/dist/esm/salla-count-down_2.entry.js +1 -1
- package/dist/esm/salla-custom-fields.entry.js +1 -1
- package/dist/esm/salla-delivery-promise.entry.js +1 -1
- package/dist/esm/salla-edit-order-button.entry.js +1 -1
- package/dist/esm/salla-filters-widget.entry.js +1 -1
- package/dist/esm/salla-filters.entry.js +1 -1
- package/dist/esm/salla-fulfillment-methods.entry.js +1 -1
- package/dist/esm/salla-gifting.entry.js +1 -1
- package/dist/esm/salla-hook.entry.js +1 -1
- package/dist/esm/salla-infinite-scroll.entry.js +1 -1
- package/dist/esm/salla-installment.entry.js +1 -1
- package/dist/esm/salla-list-tile.entry.js +1 -1
- package/dist/esm/salla-localization-modal.entry.js +1 -1
- package/dist/esm/salla-login-modal.entry.js +1 -1
- package/dist/esm/salla-loyalty-banner.entry.js +2 -2
- package/dist/esm/salla-loyalty-exchange-product-card_5.entry.js +3 -3
- package/dist/esm/salla-loyalty-hero_2.entry.js +2 -2
- package/dist/esm/salla-loyalty-panel.entry.js +3 -3
- package/dist/esm/salla-loyalty-points-banner.entry.js +1 -1
- package/dist/esm/salla-loyalty-points-history.entry.js +1 -1
- package/dist/esm/salla-loyalty-prize-item.entry.js +1 -1
- package/dist/esm/salla-loyalty-program.entry.js +3 -3
- package/dist/esm/salla-loyalty-reward.entry.js +2 -2
- package/dist/esm/salla-loyalty.entry.js +1 -1
- package/dist/esm/salla-maintenance-alert.entry.js +1 -1
- package/dist/esm/salla-map_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.entry.js +1 -1
- package/dist/esm/salla-notifications.entry.js +1 -1
- package/dist/esm/salla-offer-modal.entry.js +1 -1
- package/dist/esm/salla-offer.entry.js +1 -1
- package/dist/esm/salla-order-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-shipments.entry.js +41 -4
- package/dist/esm/salla-order-summary.entry.js +1 -1
- package/dist/esm/salla-order-totals-card.entry.js +1 -1
- package/dist/esm/salla-orders.entry.js +1 -1
- package/dist/esm/salla-payments.entry.js +1 -1
- package/dist/esm/salla-placeholder.entry.js +1 -1
- package/dist/esm/salla-price-range.entry.js +1 -1
- package/dist/esm/salla-product-card-embed.entry.js +1 -1
- package/dist/esm/salla-product-card_2.entry.js +1 -1
- package/dist/esm/salla-product-size-guide.entry.js +1 -1
- package/dist/esm/salla-products-list.entry.js +1 -1
- package/dist/esm/salla-quick-order.entry.js +1 -1
- package/dist/esm/salla-rating-modal-v2.entry.js +1 -1
- package/dist/esm/salla-rating-modal.entry.js +1 -1
- package/dist/esm/salla-review-factors-tags.entry.js +1 -1
- package/dist/esm/salla-scopes.entry.js +1 -1
- package/dist/esm/salla-search.entry.js +1 -1
- package/dist/esm/salla-skeleton.entry.js +1 -1
- package/dist/esm/salla-slider.entry.js +1 -1
- package/dist/esm/salla-social-share.entry.js +1 -1
- package/dist/esm/salla-social.entry.js +1 -1
- package/dist/esm/salla-tab-content_3.entry.js +1 -1
- package/dist/esm/salla-tiered-offer.entry.js +1 -1
- package/dist/esm/salla-tooltip.entry.js +1 -1
- package/dist/esm/salla-trust-badges.entry.js +1 -1
- package/dist/esm/salla-user-menu.entry.js +1 -1
- package/dist/esm/salla-user-profile.entry.js +1 -1
- package/dist/esm/salla-user-settings.entry.js +1 -1
- package/dist/esm/salla-verify.entry.js +1 -1
- package/dist/esm/salla-wallet.entry.js +1 -1
- package/dist/esm/salla-wishlist-actions.entry.js +1 -1
- package/dist/esm/{tracked-promise-C6Ob-qmO.js → tracked-promise-B8yCrzxY.js} +1 -1
- package/dist/esm/twilight.js +3 -3
- package/dist/esm/{vanilla-picker-DgInak8N.js → vanilla-picker-DFISd8Ab.js} +1 -1
- package/dist/twilight/{p-7b0fd2d3.entry.js → p-00d22240.entry.js} +1 -1
- package/dist/twilight/{p-8bcbf94b.entry.js → p-01277c1f.entry.js} +1 -1
- package/dist/twilight/{p-29396bf6.entry.js → p-042fe473.entry.js} +1 -1
- package/dist/twilight/{p-1eb9b42d.entry.js → p-066b78d8.entry.js} +1 -1
- package/dist/twilight/{p-d5d107ea.entry.js → p-074f8d80.entry.js} +1 -1
- package/dist/twilight/{p-7741fc5c.entry.js → p-083bc1c5.entry.js} +1 -1
- package/dist/twilight/{p-2562e44b.entry.js → p-08c61694.entry.js} +1 -1
- package/dist/twilight/{p-55d1c6c9.entry.js → p-0b74b865.entry.js} +1 -1
- package/dist/twilight/{p-abc35ead.entry.js → p-0e24390e.entry.js} +1 -1
- package/dist/twilight/{p-c16c5ef5.entry.js → p-18dc5f4f.entry.js} +1 -1
- package/dist/twilight/{p-a560ee5f.entry.js → p-1ca4cb0a.entry.js} +1 -1
- package/dist/twilight/{p-2ac41a04.entry.js → p-1daa6531.entry.js} +1 -1
- package/dist/twilight/{p-8db3e0c5.entry.js → p-24901c56.entry.js} +1 -1
- package/dist/twilight/{p-1062425d.entry.js → p-2798756b.entry.js} +1 -1
- package/dist/twilight/{p-e45ead59.entry.js → p-282d3b67.entry.js} +1 -1
- package/dist/twilight/{p-af6f8519.entry.js → p-2b52c465.entry.js} +1 -1
- package/dist/twilight/{p-e99c1765.entry.js → p-2ca2dc2a.entry.js} +1 -1
- package/dist/twilight/{p-1de72efd.entry.js → p-2db47792.entry.js} +1 -1
- package/dist/twilight/{p-abf4c948.entry.js → p-2dbea343.entry.js} +1 -1
- package/dist/twilight/{p-6dcd7b46.entry.js → p-2e9f26cf.entry.js} +1 -1
- package/dist/twilight/{p-a3aef8bb.entry.js → p-31d66e74.entry.js} +1 -1
- package/dist/twilight/{p-9b28408b.entry.js → p-32f66a87.entry.js} +1 -1
- package/dist/twilight/{p-b8e31d81.entry.js → p-34bb17c9.entry.js} +1 -1
- package/dist/twilight/{p-DnmPgY_G.js → p-3Tx29o41.js} +1 -1
- package/dist/twilight/{p-ac6abf15.entry.js → p-4364da4b.entry.js} +1 -1
- package/dist/twilight/{p-bfc96cf2.entry.js → p-4467ceb0.entry.js} +1 -1
- package/dist/twilight/{p-b2a4ebbb.entry.js → p-44ce2c67.entry.js} +1 -1
- package/dist/twilight/{p-3e3b4ace.entry.js → p-453ac18c.entry.js} +1 -1
- package/dist/twilight/{p-d1b29d76.entry.js → p-4c3b7f11.entry.js} +1 -1
- package/dist/twilight/{p-bad00f10.entry.js → p-4f5916dd.entry.js} +1 -1
- package/dist/twilight/{p-45f5fa27.entry.js → p-5acbcd72.entry.js} +1 -1
- package/dist/twilight/{p-0a1790b8.entry.js → p-6417da90.entry.js} +1 -1
- package/dist/twilight/{p-a43ce575.entry.js → p-6aa57467.entry.js} +1 -1
- package/dist/twilight/{p-23dc064a.entry.js → p-6c0de09b.entry.js} +1 -1
- package/dist/twilight/{p-65dd99ed.entry.js → p-6d989923.entry.js} +1 -1
- package/dist/twilight/{p-45729b8e.entry.js → p-6f20f79a.entry.js} +1 -1
- package/dist/twilight/{p-ce653f7c.entry.js → p-6fe98a4d.entry.js} +1 -1
- package/dist/twilight/{p-1966d0ca.entry.js → p-70e2d99d.entry.js} +1 -1
- package/dist/twilight/{p-ee69544b.entry.js → p-71aeefcf.entry.js} +1 -1
- package/dist/twilight/{p-66312912.entry.js → p-7622f77e.entry.js} +1 -1
- package/dist/twilight/{p-70d1e905.entry.js → p-764b05c3.entry.js} +1 -1
- package/dist/twilight/{p-ace9d8f0.entry.js → p-811d6f89.entry.js} +1 -1
- package/dist/twilight/{p-aba9e8c2.entry.js → p-82e55dfd.entry.js} +1 -1
- package/dist/twilight/{p-bc0558d2.entry.js → p-8493acd8.entry.js} +1 -1
- package/dist/twilight/{p-afe7c1ba.entry.js → p-85ffcb0d.entry.js} +1 -1
- package/dist/twilight/{p-6f0215ec.entry.js → p-865393ae.entry.js} +1 -1
- package/dist/twilight/{p-42fc5f2f.entry.js → p-879904a5.entry.js} +1 -1
- package/dist/twilight/p-8a789d76.entry.js +4 -0
- package/dist/twilight/{p-9fdbb0fe.entry.js → p-8d2a1e57.entry.js} +1 -1
- package/dist/twilight/{p-42551c8c.entry.js → p-8e05dbd7.entry.js} +1 -1
- package/dist/twilight/{p-e060ee6b.entry.js → p-90929ee0.entry.js} +1 -1
- package/dist/twilight/{p-afe2670a.entry.js → p-92cf1e0d.entry.js} +1 -1
- package/dist/twilight/{p-719cd9a6.entry.js → p-96d471a9.entry.js} +1 -1
- package/dist/twilight/{p-7dd8a87f.entry.js → p-9f88fd32.entry.js} +1 -1
- package/dist/twilight/{p-CHQutKQ7.js → p-BdU8gNuL.js} +1 -1
- package/dist/twilight/{p-kYkXTeTb.js → p-Bmtik9Kw.js} +1 -1
- package/dist/twilight/{p-Cvx2P5Pg.js → p-Bsy6Ioog.js} +1 -1
- package/dist/twilight/{p-Cc9owUMd.js → p-CK_JEpA3.js} +1 -1
- package/dist/twilight/{p-JQryHMzJ.js → p-CQ_QHwLy.js} +1 -1
- package/dist/twilight/{p-lri6csDE.js → p-C_YmM4Ke.js} +1 -1
- package/dist/twilight/{p-BbNEoGml.js → p-CfrlyZxh.js} +1 -1
- package/dist/twilight/{p-DaCdMnag.js → p-D6U543Hv.js} +1 -1
- package/dist/twilight/{p-CyUI27N5.js → p-DOQPe4jW.js} +1 -1
- package/dist/twilight/{p-BM5d07q2.js → p-Dm54yhRt.js} +1 -1
- package/dist/twilight/{p-e-mxvhkF.js → p-N0-g_Ku2.js} +2 -2
- package/dist/twilight/{p-26cac2a2.entry.js → p-a26fb2b5.entry.js} +1 -1
- package/dist/twilight/p-a307c408.entry.js +4 -0
- package/dist/twilight/{p-e9259ff2.entry.js → p-a5070e48.entry.js} +1 -1
- package/dist/twilight/{p-e0a0653e.entry.js → p-a7643570.entry.js} +1 -1
- package/dist/twilight/{p-9c1e5214.entry.js → p-acfc17d6.entry.js} +1 -1
- package/dist/twilight/{p-1865bb17.entry.js → p-b089053b.entry.js} +1 -1
- package/dist/twilight/{p-3f1b74c4.entry.js → p-b53f24e0.entry.js} +1 -1
- package/dist/twilight/{p-ff5fc7fa.entry.js → p-b775c3a7.entry.js} +1 -1
- package/dist/twilight/{p-d23989f3.entry.js → p-b9228f9e.entry.js} +1 -1
- package/dist/twilight/{p-80bdb370.entry.js → p-bbad7f4d.entry.js} +1 -1
- package/dist/twilight/{p-a4d7223f.entry.js → p-bc633deb.entry.js} +1 -1
- package/dist/twilight/{p-5c5f6ad3.entry.js → p-bd31410b.entry.js} +1 -1
- package/dist/twilight/{p-9fb0a8ad.entry.js → p-be71261f.entry.js} +1 -1
- package/dist/twilight/{p-b3f60292.entry.js → p-bf7b92c5.entry.js} +1 -1
- package/dist/twilight/p-c38bfc00.entry.js +4 -0
- package/dist/twilight/{p-5ce9e4e4.entry.js → p-c55ed08e.entry.js} +1 -1
- package/dist/twilight/{p-30089930.entry.js → p-c88af64d.entry.js} +1 -1
- package/dist/twilight/{p-8b16e8b8.entry.js → p-cd0f27b8.entry.js} +1 -1
- package/dist/twilight/{p-82384661.entry.js → p-ce888cc2.entry.js} +1 -1
- package/dist/twilight/{p-04756108.entry.js → p-d171016f.entry.js} +1 -1
- package/dist/twilight/{p-b827f3d2.entry.js → p-d34ee17e.entry.js} +1 -1
- package/dist/twilight/{p-5aa658d1.entry.js → p-d5262ac3.entry.js} +1 -1
- package/dist/twilight/{p-b5203de2.entry.js → p-d594a28c.entry.js} +1 -1
- package/dist/twilight/{p-90ea6647.entry.js → p-d6146737.entry.js} +1 -1
- package/dist/twilight/{p-beb0a808.entry.js → p-d8909798.entry.js} +1 -1
- package/dist/twilight/{p-3c5c8040.entry.js → p-d8d26e4b.entry.js} +1 -1
- package/dist/twilight/{p-9e1645b7.entry.js → p-d9a53204.entry.js} +1 -1
- package/dist/twilight/{p-dec7ad63.entry.js → p-df1badad.entry.js} +1 -1
- package/dist/twilight/{p-fdfa010d.entry.js → p-e14dc1a9.entry.js} +1 -1
- package/dist/twilight/{p-78ed3c14.entry.js → p-e4c40a79.entry.js} +1 -1
- package/dist/twilight/{p-7cdfa2ed.entry.js → p-e6255c72.entry.js} +1 -1
- package/dist/twilight/{p-c82feb7c.entry.js → p-e775748f.entry.js} +1 -1
- package/dist/twilight/{p-01f81bed.entry.js → p-e8cc3acd.entry.js} +1 -1
- package/dist/twilight/{p-f443ae10.entry.js → p-eb1e775a.entry.js} +1 -1
- package/dist/twilight/{p-c98be632.entry.js → p-edae5524.entry.js} +1 -1
- package/dist/twilight/{p-698f2e97.entry.js → p-f1639848.entry.js} +1 -1
- package/dist/twilight/{p-62ff80dc.entry.js → p-f351fca5.entry.js} +1 -1
- package/dist/twilight/{p-0e4332c5.entry.js → p-f6b097ee.entry.js} +1 -1
- package/dist/twilight/{p-2aa80a12.entry.js → p-f9f3639d.entry.js} +1 -1
- package/dist/twilight/{p-a6a1affc.entry.js → p-fcc76e96.entry.js} +1 -1
- package/dist/twilight/{p-66714663.entry.js → p-fcfd176b.entry.js} +1 -1
- package/dist/twilight/{p-f72a852a.entry.js → p-ff58cb8e.entry.js} +1 -1
- package/dist/twilight/twilight.esm.js +1 -1
- package/dist/types/Helpers/latest-request.d.ts +18 -0
- package/dist/types/components/salla-order-shipments/interfaces.d.ts +6 -0
- package/dist/types/components/salla-order-shipments/salla-order-shipments.d.ts +2 -0
- package/package.json +5 -5
- package/dist/twilight/p-3fb2daff.entry.js +0 -4
- package/dist/twilight/p-d97d37ec.entry.js +0 -4
- package/dist/twilight/p-e2e84b7e.entry.js +0 -4
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as s,h as t,H as a,a as i}from"./p-BM5d07q2.js";const r=[{label:"100px",value:"56px"},{label:"72px",value:"64px"},{label:"96px",value:"48px"}],h=class{constructor(t){s(this,t),this.validateForms=!0,this.cartCount=0,this.cartTotal=0,this.cartTotalDiscount=0,this.cartSubTotal=0,this.cartOptionsTotal=0,this.cartShippingCost=0,this.cartTaxAmount=0,this.cartHasShipping=!1,this.isOpen=!1,this.isDesktop=!1,this.isLoading=!0,this.originalParent=null,this.originalNextSibling=null,this.bodyObserver=null,this.mediaQueryList=null,this.submitObserver=null,this.isSubmitting=!1,this.mqlChangeHandler=s=>{this.isDesktop=s.matches,this.applyMode()},this.cartEventNames=["cart::details.fetched","cart::updated","cart::latest.fetched","cart::coupon.added","cart::coupon.deleted"],this.cartEventHandler=s=>this.applyCartData(this.extractCart(s)),this.releaseSubmitLoading=()=>{this.submitObserver?.disconnect(),this.submitObserver=null,this.submitObserverTimeout&&(clearTimeout(this.submitObserverTimeout),this.submitObserverTimeout=void 0),this.host.querySelector("#s-cart-summary-card-submit")?.removeAttribute?.("loading")},this.toggleSheet=()=>{this.isDesktop||(this.isOpen=!this.isOpen)},this.handleSubmit=async s=>{if(this.isSubmitting)return void s.preventDefault();if(this.isSubmitting=!0,this.validateForms&&!await this.validateCartForms())return s.preventDefault(),salla.notify?.error?.(salla.lang?.get?.("common.messages.required_fields")),void(this.isSubmitting=!1);const t=this.host.querySelector("#s-cart-summary-card-submit");t&&(t.load?.(),this.submitObserver?.disconnect(),this.submitObserverTimeout&&clearTimeout(this.submitObserverTimeout),this.submitObserver=new MutationObserver((()=>{t.hasAttribute("loading")||t.setAttribute("loading","")})),this.submitObserver.observe(t,{attributes:!0,attributeFilter:["loading"]}),this.submitObserverTimeout=window.setTimeout((()=>{this.submitObserver?.disconnect(),this.submitObserver=null,t.removeAttribute?.("loading")}),1e4)),salla.cart?.submit?.(),window.setTimeout((()=>{this.isSubmitting=!1}),1500)}}componentWillLoad(){this.mediaQueryList=window.matchMedia(this.desktopMediaQuery()),this.isDesktop=this.mediaQueryList.matches,this.isDesktop&&(this.isOpen=!0),this.init()}async init(){await salla.onReady(),await salla.lang.onLoaded(),this.loadTranslations(),this.cartEventNames.forEach((s=>salla.event.on(s,this.cartEventHandler))),salla.event.on("cart::submit.failed",this.releaseSubmitLoading),this.fetchCart()}loadTranslations(){this.summaryLabel=salla.lang.get("pages.cart.summary"),this.itemsTotalLabel=salla.lang.get("pages.cart.items_total"),this.itemsTotalNoTaxLabel=salla.lang.get("pages.cart.items_total_without_tax"),this.optionsTotalLabel=salla.lang.get("pages.cart.order_options_total"),this.shippingCostLabel=salla.lang.get("pages.cart.shipping_cost"),this.vatTaxLabel=salla.lang.get("pages.cart.VAT_tax_amount"),this.savedLabel=salla.lang.get("pages.cart.discount"),this.discountBadge=salla.lang.get("pages.cart.saved"),this.finalTotalLabel=salla.lang.get("pages.cart.final_total"),this.pricesTaxedLabel=salla.lang.get("pages.cart.prices_taxed"),this.completeOrderLabel=salla.lang.get("pages.cart.complete_order"),this.openSummaryLabel=salla.lang.get("pages.cart.open_summary"),this.closeSummaryLabel=salla.lang.get("pages.cart.close_summary"),this.itemsCountTemplate=salla.lang.get("pages.cart.items_with_count")}num(s){if(null==s)return 0;if("number"==typeof s)return isFinite(s)?s:0;if("string"==typeof s)return parseFloat(s)||0;if("object"==typeof s){if("amount"in s)return this.num(s.amount);if("value"in s)return this.num(s.value);if("formatted"in s)return this.num(s.formatted)}return 0}breakpointPx(){return 1024}desktopMediaQuery(){return`(min-width: ${this.breakpointPx()}px)`}componentDidLoad(){this.originalParent=this.host.parentElement,this.originalNextSibling=this.host.nextSibling,this.mediaQueryList||(this.mediaQueryList=window.matchMedia(this.desktopMediaQuery()),this.isDesktop=this.mediaQueryList.matches),this.applyMode(),this.mediaQueryList.addEventListener?this.mediaQueryList.addEventListener("change",this.mqlChangeHandler):this.mediaQueryList.addListener(this.mqlChangeHandler)}applyMode(){this.isDesktop?(this.isOpen=!0,this.bodyObserver?.disconnect(),this.bodyObserver=null,this.originalParent&&this.host.parentElement!==this.originalParent&&this.originalParent.insertBefore(this.host,this.originalNextSibling?.parentNode===this.originalParent?this.originalNextSibling:null)):this.pinToBodyEnd()}pinToBodyEnd(){this.host.parentElement===document.body&&document.body.lastElementChild===this.host||document.body.appendChild(this.host),this.bodyObserver||(this.bodyObserver=new MutationObserver((()=>{this.isDesktop||document.body.lastElementChild===this.host||document.body.appendChild(this.host)})),this.bodyObserver.observe(document.body,{childList:!0}))}disconnectedCallback(){Promise.resolve().then((()=>{this.host.isConnected||(this.bodyObserver?.disconnect(),this.submitObserver?.disconnect(),this.submitObserverTimeout&&(clearTimeout(this.submitObserverTimeout),this.submitObserverTimeout=void 0),this.mediaQueryList?.removeEventListener?this.mediaQueryList.removeEventListener("change",this.mqlChangeHandler):this.mediaQueryList?.removeListener(this.mqlChangeHandler),this.mediaQueryList=null,this.cartEventNames.forEach((s=>salla.event.off(s,this.cartEventHandler))),salla.event.off("cart::submit.failed",this.releaseSubmitLoading))}))}fetchCart(){const s=salla.config?.get?.("page.id"),t=salla.cart?.api?.details?.(s);t&&"function"==typeof t.then?t.then((s=>this.applyCartData(this.extractCart(s)))).catch((()=>this.applyCachedSummary())):this.applyCachedSummary()}applyCachedSummary(){const s=salla.storage?.get?.("cart.summary");s&&"object"==typeof s&&this.applyCartData(s),this.isLoading=!1}extractCart(s){return s?s.data?.cart?s.data.cart:s.cart?s.cart:s:null}applyCartData(s){if(!s)return;this.isLoading=!1,void 0!==s.count&&(this.cartCount=this.num(s.count)),void 0!==s.total&&(this.cartTotal=this.num(s.total));const t=s.total_discount??s.discount;void 0!==t&&(this.cartTotalDiscount=this.num(t)),void 0!==s.sub_total&&(this.cartSubTotal=this.num(s.sub_total)),void 0!==s.options_total&&(this.cartOptionsTotal=this.num(s.options_total)),void 0!==s.tax_amount&&(this.cartTaxAmount=this.num(s.tax_amount));const a=!!s.free_shipping_bar?.has_free_shipping;void 0!==s.shipping_cost?this.cartShippingCost=this.num(s.shipping_cost):void 0!==s.real_shipping_cost&&(this.cartShippingCost=a?0:this.num(s.real_shipping_cost)),this.cartHasShipping=this.cartShippingCost>0||!!s.has_shipping}async validateCartForms(){let s=!0;document.querySelectorAll('form[id^="item-"]').forEach((t=>{t.reportValidity()||(s=!1)}));const t=Array.from(document.querySelectorAll('form[id^="item-"] salla-product-options'));for(const a of t)"function"!=typeof a.reportValidity||await a.reportValidity()||(s=!1);return s}decimalPlaces(s){const t=String(s),a=t.indexOf(".");return-1===a||t.includes("e")?0:t.length-a-1}roundToCurrency(s){const t=Math.min(Math.max(2,this.decimalPlaces(this.cartTotal),this.decimalPlaces(this.cartTotalDiscount)),4),a=Math.pow(10,t);return Math.round(s*a)/a}money(s){try{if("undefined"!=typeof salla&&"function"==typeof salla.money)return salla.money(s)}catch(s){}return String(s??0)}getItemsLabel(){return this.itemsCountTemplate?.replace(":count",String(this.cartCount))??""}renderSkeleton(){return t(a,{class:{"s-cart-summary-card":!0,"s-cart-summary-card--loading":!0,"s-cart-summary-card--desktop":this.isDesktop,"s-cart-summary-card--mobile":!this.isDesktop}},this.isDesktop&&t("div",{class:"s-cart-summary-card-sheet-wrap s-cart-summary-card-sheet-wrap--open"},t("div",{class:"s-cart-summary-card-sheet"},t("header",{class:"s-cart-summary-card-sheet-header"},t("h3",{class:"s-cart-summary-card-sheet-title"},t("salla-skeleton",{width:"140px",height:"16px"}))),r.map((({label:s,value:a},i)=>t("div",{class:"s-cart-summary-card-line",key:i},t("salla-skeleton",{width:s,height:"16px"}),t("salla-skeleton",{width:a,height:"16px"})))))),t("div",{class:"s-cart-summary-card-bar"},t("div",{class:"s-cart-summary-card-bar-label"},t("div",{class:"s-cart-summary-card-bar-label-main"},t("salla-skeleton",{width:"90px",height:"16px"}),t("salla-skeleton",{width:"48px",height:"12px"}))),t("div",{class:"s-cart-summary-card-bar-totals"},t("div",{class:"s-cart-summary-card-bar-totals-row"},t("salla-skeleton",{width:"80px",height:"20px"})))),t("div",{class:"s-cart-summary-card-action"},t("salla-skeleton",{width:"100%",height:"44px"})))}render(){if(this.isLoading)return this.renderSkeleton();const s=this.cartTotalDiscount>0,i=this.cartTaxAmount?this.itemsTotalNoTaxLabel:this.itemsTotalLabel;return t(a,{class:{"s-cart-summary-card":!0,"s-cart-summary-card--open":this.isOpen,"s-cart-summary-card--desktop":this.isDesktop,"s-cart-summary-card--mobile":!this.isDesktop}},t("div",{class:{"s-cart-summary-card-sheet-wrap":!0,"s-cart-summary-card-sheet-wrap--open":this.isOpen},"aria-hidden":this.isOpen?"false":"true"},t("div",{class:"s-cart-summary-card-sheet",style:this.isDesktop?{}:{transform:this.isOpen?"translateY(0)":"translateY(100%)",transition:"transform 0.4s cubic-bezier(0.32, 0.72, 0, 1)"}},t("header",{class:"s-cart-summary-card-sheet-header"},t("h3",{class:"s-cart-summary-card-sheet-title"},this.summaryLabel)),t("div",{class:"s-cart-summary-card-line"},t("span",null,i),t("b",{innerHTML:this.money(this.cartSubTotal)})),this.cartOptionsTotal>0&&t("div",{class:"s-cart-summary-card-line"},t("span",null,this.optionsTotalLabel),t("b",{innerHTML:this.money(this.cartOptionsTotal)})),this.cartHasShipping&&t("div",{class:"s-cart-summary-card-line"},t("span",null,this.shippingCostLabel),t("b",{innerHTML:this.money(this.cartShippingCost)})),this.cartTaxAmount>0&&t("div",{class:"s-cart-summary-card-line"},t("span",null,this.vatTaxLabel),t("b",{innerHTML:this.money(this.cartTaxAmount)})),s&&t("div",{class:"s-cart-summary-card-line s-cart-summary-card-line--discount"},t("span",null,this.savedLabel),t("b",null,"− ",t("span",{innerHTML:this.money(this.cartTotalDiscount)}))))),t("div",{class:"s-cart-summary-card-bar"},t("div",{class:"s-cart-summary-card-bar-label"},t("div",{class:"s-cart-summary-card-bar-label-main"},t("span",{class:"s-cart-summary-card-bar-label-text"},this.finalTotalLabel),t("span",{class:"s-cart-summary-card-bar-count"},this.getItemsLabel())),this.cartTaxAmount>0&&t("div",{class:"s-cart-summary-card-bar-label-sub"},this.pricesTaxedLabel)),t("div",{class:"s-cart-summary-card-bar-totals"},t("div",{class:"s-cart-summary-card-bar-totals-row"},s&&t("s",{class:"s-cart-summary-card-bar-original"},salla.helpers.number(this.roundToCurrency(this.cartTotal+this.cartTotalDiscount))),t("b",{class:"s-cart-summary-card-bar-total",innerHTML:this.money(this.cartTotal)}),!this.isDesktop&&t("button",{type:"button",class:"s-cart-summary-card-chevron","aria-label":this.isOpen?this.closeSummaryLabel:this.openSummaryLabel,"aria-expanded":this.isOpen?"true":"false",onClick:this.toggleSheet},t("i",{class:"sicon-keyboard_arrow_up s-cart-summary-card-chevron-icon"}))),s&&t("div",{class:"s-cart-summary-card-bar-savings-badge"},t("span",{"aria-hidden":"true"},"🎉"),t("span",null,this.discountBadge," ",t("span",{innerHTML:this.money(this.cartTotalDiscount)}))))),t("div",{class:"s-cart-summary-card-action"},t("salla-button",{id:"s-cart-summary-card-submit",width:"wide","loader-position":"center",onClick:this.handleSubmit},this.completeOrderLabel)))}get host(){return i(this)}};export{h as salla_cart_summary_card}
|
|
4
|
+
import{r as s,h as t,H as a,a as i}from"./p-Dm54yhRt.js";const r=[{label:"100px",value:"56px"},{label:"72px",value:"64px"},{label:"96px",value:"48px"}],h=class{constructor(t){s(this,t),this.validateForms=!0,this.cartCount=0,this.cartTotal=0,this.cartTotalDiscount=0,this.cartSubTotal=0,this.cartOptionsTotal=0,this.cartShippingCost=0,this.cartTaxAmount=0,this.cartHasShipping=!1,this.isOpen=!1,this.isDesktop=!1,this.isLoading=!0,this.originalParent=null,this.originalNextSibling=null,this.bodyObserver=null,this.mediaQueryList=null,this.submitObserver=null,this.isSubmitting=!1,this.mqlChangeHandler=s=>{this.isDesktop=s.matches,this.applyMode()},this.cartEventNames=["cart::details.fetched","cart::updated","cart::latest.fetched","cart::coupon.added","cart::coupon.deleted"],this.cartEventHandler=s=>this.applyCartData(this.extractCart(s)),this.releaseSubmitLoading=()=>{this.submitObserver?.disconnect(),this.submitObserver=null,this.submitObserverTimeout&&(clearTimeout(this.submitObserverTimeout),this.submitObserverTimeout=void 0),this.host.querySelector("#s-cart-summary-card-submit")?.removeAttribute?.("loading")},this.toggleSheet=()=>{this.isDesktop||(this.isOpen=!this.isOpen)},this.handleSubmit=async s=>{if(this.isSubmitting)return void s.preventDefault();if(this.isSubmitting=!0,this.validateForms&&!await this.validateCartForms())return s.preventDefault(),salla.notify?.error?.(salla.lang?.get?.("common.messages.required_fields")),void(this.isSubmitting=!1);const t=this.host.querySelector("#s-cart-summary-card-submit");t&&(t.load?.(),this.submitObserver?.disconnect(),this.submitObserverTimeout&&clearTimeout(this.submitObserverTimeout),this.submitObserver=new MutationObserver((()=>{t.hasAttribute("loading")||t.setAttribute("loading","")})),this.submitObserver.observe(t,{attributes:!0,attributeFilter:["loading"]}),this.submitObserverTimeout=window.setTimeout((()=>{this.submitObserver?.disconnect(),this.submitObserver=null,t.removeAttribute?.("loading")}),1e4)),salla.cart?.submit?.(),window.setTimeout((()=>{this.isSubmitting=!1}),1500)}}componentWillLoad(){this.mediaQueryList=window.matchMedia(this.desktopMediaQuery()),this.isDesktop=this.mediaQueryList.matches,this.isDesktop&&(this.isOpen=!0),this.init()}async init(){await salla.onReady(),await salla.lang.onLoaded(),this.loadTranslations(),this.cartEventNames.forEach((s=>salla.event.on(s,this.cartEventHandler))),salla.event.on("cart::submit.failed",this.releaseSubmitLoading),this.fetchCart()}loadTranslations(){this.summaryLabel=salla.lang.get("pages.cart.summary"),this.itemsTotalLabel=salla.lang.get("pages.cart.items_total"),this.itemsTotalNoTaxLabel=salla.lang.get("pages.cart.items_total_without_tax"),this.optionsTotalLabel=salla.lang.get("pages.cart.order_options_total"),this.shippingCostLabel=salla.lang.get("pages.cart.shipping_cost"),this.vatTaxLabel=salla.lang.get("pages.cart.VAT_tax_amount"),this.savedLabel=salla.lang.get("pages.cart.discount"),this.discountBadge=salla.lang.get("pages.cart.saved"),this.finalTotalLabel=salla.lang.get("pages.cart.final_total"),this.pricesTaxedLabel=salla.lang.get("pages.cart.prices_taxed"),this.completeOrderLabel=salla.lang.get("pages.cart.complete_order"),this.openSummaryLabel=salla.lang.get("pages.cart.open_summary"),this.closeSummaryLabel=salla.lang.get("pages.cart.close_summary"),this.itemsCountTemplate=salla.lang.get("pages.cart.items_with_count")}num(s){if(null==s)return 0;if("number"==typeof s)return isFinite(s)?s:0;if("string"==typeof s)return parseFloat(s)||0;if("object"==typeof s){if("amount"in s)return this.num(s.amount);if("value"in s)return this.num(s.value);if("formatted"in s)return this.num(s.formatted)}return 0}breakpointPx(){return 1024}desktopMediaQuery(){return`(min-width: ${this.breakpointPx()}px)`}componentDidLoad(){this.originalParent=this.host.parentElement,this.originalNextSibling=this.host.nextSibling,this.mediaQueryList||(this.mediaQueryList=window.matchMedia(this.desktopMediaQuery()),this.isDesktop=this.mediaQueryList.matches),this.applyMode(),this.mediaQueryList.addEventListener?this.mediaQueryList.addEventListener("change",this.mqlChangeHandler):this.mediaQueryList.addListener(this.mqlChangeHandler)}applyMode(){this.isDesktop?(this.isOpen=!0,this.bodyObserver?.disconnect(),this.bodyObserver=null,this.originalParent&&this.host.parentElement!==this.originalParent&&this.originalParent.insertBefore(this.host,this.originalNextSibling?.parentNode===this.originalParent?this.originalNextSibling:null)):this.pinToBodyEnd()}pinToBodyEnd(){this.host.parentElement===document.body&&document.body.lastElementChild===this.host||document.body.appendChild(this.host),this.bodyObserver||(this.bodyObserver=new MutationObserver((()=>{this.isDesktop||document.body.lastElementChild===this.host||document.body.appendChild(this.host)})),this.bodyObserver.observe(document.body,{childList:!0}))}disconnectedCallback(){Promise.resolve().then((()=>{this.host.isConnected||(this.bodyObserver?.disconnect(),this.submitObserver?.disconnect(),this.submitObserverTimeout&&(clearTimeout(this.submitObserverTimeout),this.submitObserverTimeout=void 0),this.mediaQueryList?.removeEventListener?this.mediaQueryList.removeEventListener("change",this.mqlChangeHandler):this.mediaQueryList?.removeListener(this.mqlChangeHandler),this.mediaQueryList=null,this.cartEventNames.forEach((s=>salla.event.off(s,this.cartEventHandler))),salla.event.off("cart::submit.failed",this.releaseSubmitLoading))}))}fetchCart(){const s=salla.config?.get?.("page.id"),t=salla.cart?.api?.details?.(s);t&&"function"==typeof t.then?t.then((s=>this.applyCartData(this.extractCart(s)))).catch((()=>this.applyCachedSummary())):this.applyCachedSummary()}applyCachedSummary(){const s=salla.storage?.get?.("cart.summary");s&&"object"==typeof s&&this.applyCartData(s),this.isLoading=!1}extractCart(s){return s?s.data?.cart?s.data.cart:s.cart?s.cart:s:null}applyCartData(s){if(!s)return;this.isLoading=!1,void 0!==s.count&&(this.cartCount=this.num(s.count)),void 0!==s.total&&(this.cartTotal=this.num(s.total));const t=s.total_discount??s.discount;void 0!==t&&(this.cartTotalDiscount=this.num(t)),void 0!==s.sub_total&&(this.cartSubTotal=this.num(s.sub_total)),void 0!==s.options_total&&(this.cartOptionsTotal=this.num(s.options_total)),void 0!==s.tax_amount&&(this.cartTaxAmount=this.num(s.tax_amount));const a=!!s.free_shipping_bar?.has_free_shipping;void 0!==s.shipping_cost?this.cartShippingCost=this.num(s.shipping_cost):void 0!==s.real_shipping_cost&&(this.cartShippingCost=a?0:this.num(s.real_shipping_cost)),this.cartHasShipping=this.cartShippingCost>0||!!s.has_shipping}async validateCartForms(){let s=!0;document.querySelectorAll('form[id^="item-"]').forEach((t=>{t.reportValidity()||(s=!1)}));const t=Array.from(document.querySelectorAll('form[id^="item-"] salla-product-options'));for(const a of t)"function"!=typeof a.reportValidity||await a.reportValidity()||(s=!1);return s}decimalPlaces(s){const t=String(s),a=t.indexOf(".");return-1===a||t.includes("e")?0:t.length-a-1}roundToCurrency(s){const t=Math.min(Math.max(2,this.decimalPlaces(this.cartTotal),this.decimalPlaces(this.cartTotalDiscount)),4),a=Math.pow(10,t);return Math.round(s*a)/a}money(s){try{if("undefined"!=typeof salla&&"function"==typeof salla.money)return salla.money(s)}catch(s){}return String(s??0)}getItemsLabel(){return this.itemsCountTemplate?.replace(":count",String(this.cartCount))??""}renderSkeleton(){return t(a,{class:{"s-cart-summary-card":!0,"s-cart-summary-card--loading":!0,"s-cart-summary-card--desktop":this.isDesktop,"s-cart-summary-card--mobile":!this.isDesktop}},this.isDesktop&&t("div",{class:"s-cart-summary-card-sheet-wrap s-cart-summary-card-sheet-wrap--open"},t("div",{class:"s-cart-summary-card-sheet"},t("header",{class:"s-cart-summary-card-sheet-header"},t("h3",{class:"s-cart-summary-card-sheet-title"},t("salla-skeleton",{width:"140px",height:"16px"}))),r.map((({label:s,value:a},i)=>t("div",{class:"s-cart-summary-card-line",key:i},t("salla-skeleton",{width:s,height:"16px"}),t("salla-skeleton",{width:a,height:"16px"})))))),t("div",{class:"s-cart-summary-card-bar"},t("div",{class:"s-cart-summary-card-bar-label"},t("div",{class:"s-cart-summary-card-bar-label-main"},t("salla-skeleton",{width:"90px",height:"16px"}),t("salla-skeleton",{width:"48px",height:"12px"}))),t("div",{class:"s-cart-summary-card-bar-totals"},t("div",{class:"s-cart-summary-card-bar-totals-row"},t("salla-skeleton",{width:"80px",height:"20px"})))),t("div",{class:"s-cart-summary-card-action"},t("salla-skeleton",{width:"100%",height:"44px"})))}render(){if(this.isLoading)return this.renderSkeleton();const s=this.cartTotalDiscount>0,i=this.cartTaxAmount?this.itemsTotalNoTaxLabel:this.itemsTotalLabel;return t(a,{class:{"s-cart-summary-card":!0,"s-cart-summary-card--open":this.isOpen,"s-cart-summary-card--desktop":this.isDesktop,"s-cart-summary-card--mobile":!this.isDesktop}},t("div",{class:{"s-cart-summary-card-sheet-wrap":!0,"s-cart-summary-card-sheet-wrap--open":this.isOpen},"aria-hidden":this.isOpen?"false":"true"},t("div",{class:"s-cart-summary-card-sheet",style:this.isDesktop?{}:{transform:this.isOpen?"translateY(0)":"translateY(100%)",transition:"transform 0.4s cubic-bezier(0.32, 0.72, 0, 1)"}},t("header",{class:"s-cart-summary-card-sheet-header"},t("h3",{class:"s-cart-summary-card-sheet-title"},this.summaryLabel)),t("div",{class:"s-cart-summary-card-line"},t("span",null,i),t("b",{innerHTML:this.money(this.cartSubTotal)})),this.cartOptionsTotal>0&&t("div",{class:"s-cart-summary-card-line"},t("span",null,this.optionsTotalLabel),t("b",{innerHTML:this.money(this.cartOptionsTotal)})),this.cartHasShipping&&t("div",{class:"s-cart-summary-card-line"},t("span",null,this.shippingCostLabel),t("b",{innerHTML:this.money(this.cartShippingCost)})),this.cartTaxAmount>0&&t("div",{class:"s-cart-summary-card-line"},t("span",null,this.vatTaxLabel),t("b",{innerHTML:this.money(this.cartTaxAmount)})),s&&t("div",{class:"s-cart-summary-card-line s-cart-summary-card-line--discount"},t("span",null,this.savedLabel),t("b",null,"− ",t("span",{innerHTML:this.money(this.cartTotalDiscount)}))))),t("div",{class:"s-cart-summary-card-bar"},t("div",{class:"s-cart-summary-card-bar-label"},t("div",{class:"s-cart-summary-card-bar-label-main"},t("span",{class:"s-cart-summary-card-bar-label-text"},this.finalTotalLabel),t("span",{class:"s-cart-summary-card-bar-count"},this.getItemsLabel())),this.cartTaxAmount>0&&t("div",{class:"s-cart-summary-card-bar-label-sub"},this.pricesTaxedLabel)),t("div",{class:"s-cart-summary-card-bar-totals"},t("div",{class:"s-cart-summary-card-bar-totals-row"},s&&t("s",{class:"s-cart-summary-card-bar-original"},salla.helpers.number(this.roundToCurrency(this.cartTotal+this.cartTotalDiscount))),t("b",{class:"s-cart-summary-card-bar-total",innerHTML:this.money(this.cartTotal)}),!this.isDesktop&&t("button",{type:"button",class:"s-cart-summary-card-chevron","aria-label":this.isOpen?this.closeSummaryLabel:this.openSummaryLabel,"aria-expanded":this.isOpen?"true":"false",onClick:this.toggleSheet},t("i",{class:"sicon-keyboard_arrow_up s-cart-summary-card-chevron-icon"}))),s&&t("div",{class:"s-cart-summary-card-bar-savings-badge"},t("span",{"aria-hidden":"true"},"🎉"),t("span",null,this.discountBadge," ",t("span",{innerHTML:this.money(this.cartTotalDiscount)}))))),t("div",{class:"s-cart-summary-card-action"},t("salla-button",{id:"s-cart-summary-card-submit",width:"wide","loader-position":"center",onClick:this.handleSubmit},this.completeOrderLabel)))}get host(){return i(this)}};export{h as salla_cart_summary_card}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as t,f as a,h as s,H as i,a as e}from"./p-BM5d07q2.js";import{S as r}from"./p-CeFAfcTv.js";import{S as n}from"./p-lMgMt31Q.js";import{C as o}from"./p-BV4kqbdL.js";import{H as l}from"./p-XnA1YTjA.js";import{I as d}from"./p-C-tzSDxw.js";import{W as h}from"./p-CgR-T_ZS.js";import{e as g}from"./p-DzAIgzdz.js";import"./p-CgtvEd63.js";const m=class{constructor(a){t(this,a),this.hasError=!1,this.showContactWidget=!0,this.images=[],this.productImages={},this.editItemImages=[],this.productReviewFactors={},this.editFactorRatings={},this.productMainRatings={},this.productFactorRatings={},this.contact_body=(t,a,s)=>salla.lang.get("pages.rating.contact_subject",{store:t,id:a,customer:s}),this.editMode=!1,this.defaultMode=!1,this.deleteMode=!1,this.shouldOpenDeleteModal=!1,this.editItem=null,this.allowAttachImages=!1,this.allowContactSupport=!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.overallProductRatingLabel=salla.lang.get("pages.rating.overall_product_rating"),this.loyaltyPointsForImagesLabel=salla.lang.get("pages.rating.loyalty_points_for_images",{points:":points"}),this.contentRefs=[],this.hiddenInputs=[],this.userFilledFactorKeys={},this.boundRatingRows=new WeakSet,this.stepsCount=0,this.currentIndex=0,this.submitted=[],this.MAX_UPLOAD_LIMIT=3,this.thanksCountdownInterval=null,this.scheduleWizardSetup=!1,salla.lang.onLoaded((()=>{this.contactUsLabel=salla.lang.get("blocks.footer.social");const t=(t,a,s)=>new Promise((i=>{salla.helpers.setNested(salla.lang.messages[t],a,s),i(!0)}));(async()=>{await t("ar.trans","common.uploader.drag_and_drop_files","اسحب الملفات وأفلتها هنا"),await t("en.trans","common.uploader.drag_and_drop_files","Drag and drop files here"),await t("ar.trans","common.uploader.allowed_images_types"," .jpg أو jpeg أو png يُسمح بإضافة صور بصيغة"),await t("en.trans","common.uploader.allowed_images_types","Images in jpg, jpeg, or png format are allowed."),await t("ar.trans","pages.rating.add_images","اضافة صور"),await t("en.trans","pages.rating.add_images","Add Images"),await t("ar.trans","pages.rating.edit_images","تعديل الصور"),await t("en.trans","pages.rating.edit_images","Edit Images"),await t("ar.trans","pages.rating.edit_review","تعديل التقييم"),await t("en.trans","pages.rating.edit_review","Edit review"),await t("ar.trans","pages.rating.confirm_deletion","تأكيد حذف التقييم"),await t("en.trans","pages.rating.confirm_deletion","Confirm review deletion"),await t("ar.trans","pages.rating.are_you_sure_you_want_to_delete_review","هل أنت متأكد من حذف تقييمك؟"),await t("en.trans","pages.rating.are_you_sure_you_want_to_delete_review","Are you sure you want to delete your review?"),await t("ar.trans","pages.rating.review_updated_successfully","تم تعديل التقييم بنجاح"),await t("en.trans","pages.rating.review_updated_successfully","The review has been successfully updated."),await t("ar.trans","pages.rating.review_deleted_successfully","تم حذف التقييم بنجاح"),await t("en.trans","pages.rating.review_deleted_successfully","The review has been successfully deleted."),await t("ar.trans","pages.rating.images_count","الصور ( :current من أصل :total )"),await t("en.trans","pages.rating.images_count","Images ( :current of :total )"),await t("ar.trans","common.uploader.max_three_images",`.أضف ${this.MAX_UPLOAD_LIMIT} صور كحد أقصى`),await t("en.trans","common.uploader.max_three_images",`Add up to ${this.MAX_UPLOAD_LIMIT} images maximum.`),await t("ar.trans","common.elements.confirm_delete","تأكيد الحذف"),await t("en.trans","common.elements.confirm_delete","Confirm deletion"),await t("ar.trans","pages.rating.rate_required_factors","يرجى تقييم جميع المعايير لإتمام مراجعتك."),await t("en.trans","pages.rating.rate_required_factors","Please rate all required factors to complete your review."),await t("ar.trans","pages.rating.overall_product_rating","التقييم العام للمنتج"),await t("en.trans","pages.rating.overall_product_rating","Overall product rating"),await t("ar.trans","pages.rating.loyalty_points_for_images","اكسب :points نقطة ولاء عند إضافة صور لتقييمك!"),await t("en.trans","pages.rating.loyalty_points_for_images","Earn :points loyalty points when adding photos to your review!"),this.dragAndDropFilesLabel=salla.lang.get("common.uploader.drag_and_drop_files"),this.allowedImagesTypesLabel=salla.lang.get("common.uploader.allowed_images_types"),this.threeImagesMax=salla.lang.get("common.uploader.max_three_images"),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.overallProductRatingLabel=salla.lang.get("pages.rating.overall_product_rating"),this.loyaltyPointsForImagesLabel=salla.lang.get("pages.rating.loyalty_points_for_images",{points:":points"}),this.contact_body=(t,a,s)=>salla.lang.get("pages.rating.contact_body",{store:t,id:a,customer:s})})()}))}syncStoreSettings(){this.orderId||(this.orderId=salla.config.get("page.id")),this.allowAttachImages=!!salla.config.get("store.settings.rating.allow_attach_images"),this.allowContactSupport=!!salla.config.get("store.settings.rating.allow_contact_support")}getRatingOrderId(){return this.orderId||salla.config.get("page.id")}getSubmitOrderId(){return this.orderId}isCustomerOrderShape(t){if(!t||"object"!=typeof t)return!1;const a=t;return!!a.rating&&(Array.isArray(a.items)||Array.isArray(a.products)||Array.isArray(a.rating?.product)||Array.isArray(a.rating?.products))}getBootstrapOrder(){const t=salla.config.get("page");if(this.isCustomerOrderShape(t))return t;if(t&&"object"==typeof t){const a=t;if(Array.isArray(a.products))return t;const s=a.order;if(this.isCustomerOrderShape(s))return s}}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,a,s){return this.getOrderProductRatings(t).find((t=>Number(t?.id??t?.feedback_id)===Number(s)||Number(t?.product_id??t?.product?.id)===Number(a)))}hasRatingFeedback(t){const a=t?.rating;return null!=a&&""!==a&&Number(a)>0}isTestimonialsEnabled(t=this.order){return!(!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!(!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)))}getStepsCount(t=this.order){if(!t)return 0;let a=0;return this.isTestimonialsEnabled(t)&&a++,this.isProductsEnabled(t)&&(a+=this.getRateableProducts(t).length),this.isShippingEnabled(t)&&t.shipping?.company&&a++,a}afterOrderLoaded(){this.stepsCount=this.getStepsCount(),this.scheduleWizardSetup=!0,a(this)}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||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(`${salla.lang.get("pages.rating.rate_order")} <span class="unicode">(#${this.order.id})</span>`))).then((()=>{const t={};for(const a of this.getRateableProducts())t[a.product.id]=[];this.productImages=t})).then((()=>this.modal.stopLoading())).then((()=>this.afterOrderLoaded())).catch((a=>{t(!1),this.hasError=!0,this.errorMessage=a.response?.data?.error?.message||a.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()}catch(t){this.hasError=!0,this.errorMessage=t.response?.data?.error?.message||t.response?.data}}async fetchEditItem(t){const a=`rating/${t}/show`,s=await salla.api.request(a);this.editItem=s.data,this.allowAttachImages&&"product"==this.editType&&this.editItem.images.length&&(this.editItemImages=this.editItem.images.map((t=>({id:`${Math.floor(100+900*Math.random())}`,url:t}))))}async editReview(){const t=`rating/${this.editFeedbackId}`;let a;if("product"===this.editType){const t=this.editModal.querySelector('[data-type="products"]')||this.currentTab;a=this.buildProductRatingPayload(this.collectFormData(t),t),!a.product_id&&this.editItem?.product?.id&&(a.product_id=String(this.editItem.product.id))}else a=this.collectFormData(this.editModal),a.images&&(a.images=a.images.split(","));await salla.api.request(t,a,"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 a=this.steps[this.currentIndex+1]?.dataset.type;this.nextBtn?.setText(a?`${salla.lang.get("pages.rating.rate")} ${salla.lang.get(`pages.rating.${a}`)}`: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(){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 a=t,s=a.querySelector?.(".rating_hidden_input");if(s?.name)return s;const i=a.querySelector?.("salla-rating-stars");return i?.shadowRoot?.querySelector(".rating_hidden_input")||null}collectNamedInputs(t){const a=new Set,s=[],i=t=>{t?.name&&!a.has(t)&&(a.add(t),s.push(t))};return t.querySelectorAll("[name]").forEach((t=>{i(t)})),t.querySelectorAll("salla-rating-stars").forEach((t=>{i(this.getRatingHiddenInput(t))})),s}normalizeFactorsList(t){return t?Array.isArray(t)?t:"object"==typeof t?Object.values(t).filter((t=>t&&"object"==typeof t)):[]:[]}validate(t=null,a=null){if(!t&&"products"===this.currentTab.dataset.type)return void this.currentTab.querySelectorAll(".rating-outer-form").forEach((t=>this.validate(t,"product")));const s=(t=t||this.currentTab).querySelector(".s-rating-modal-product-rating-row-main"),i=this.getRatingHiddenInput(s||t),e=i?.value,r=t.querySelector(".s-rating-modal-validation-msg");if(a=a||t.dataset.type,!e)throw r.innerHTML=salla.lang.get(`pages.rating.rate_${a}_stars`).replace(" (:item)",""),new Error(r.innerHTML);if("product"===a&&Array.from(t.querySelectorAll('.s-rating-modal-product-factor-row[data-required="true"]')).some((t=>{const a=this.getRatingHiddenInput(t);return!a?.value})))throw r.innerHTML=this.requiredFactorsLabel,new Error(r.innerHTML);r.innerHTML=""}collectFormData(t=this.currentTab){const a={};return this.collectNamedInputs(t).forEach((t=>{const s=salla.helpers.inputData(t.name,t.value,a);a[s.name]=s.value})),a}buildProductRatingPayload(t,a=this.currentTab){if(!t.rating){const s=a.querySelector(".s-rating-modal-product-rating-row-main"),i=this.getRatingHiddenInput(s||a);i?.value&&(t.rating=i.value)}const s=Number(t.product_id);let i=[];t.images?i="string"==typeof t.images?t.images.split(",").filter(Boolean):t.images:this.editMode&&this.allowAttachImages&&s?i=this.editItemImages.map((t=>t.url)):this.allowAttachImages&&s&&(i=(this.productImages[s]||[]).map((t=>t.url)));const e=this.normalizeFactorsList(t.factors).filter((t=>t?.id&&t?.rating)).map((t=>({id:String(t.id),rating:String(t.rating)})));return{order_id:this.getSubmitOrderId(),product_id:String(t.product_id),rating:String(t.rating),comment:t.comment||t.content||"",images:i,factors:e,type:"products"}}async sendFeedback(){this.refreshWizardRefs();const t=this.currentTab?.dataset?.type;if("products"===t){const t=this.collectFormData(this.currentTab),a=this.buildProductRatingPayload(t,this.currentTab);if(!a.product_id||!a.rating)throw new Error("Missing product rating data");const s=await salla.rating.api.products(a);return this.submitted.push(this.currentIndex),s}const a=this.collectFormData(this.currentTab);if(0===Object.keys(a).length)return;a.order_id=this.getSubmitOrderId(),a.type=t;const s=await salla.rating.api[t](a);return this.submitted.push(this.currentIndex),s}clearThanksCountdown(){null!==this.thanksCountdownInterval&&(clearInterval(this.thanksCountdownInterval),this.thanksCountdownInterval=null)}showThankYou(){let t=10;this.clearThanksCountdown(),this.thanksCountdownInterval=setInterval((()=>{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 a=salla.config.get("store.settings.rating.rating_product_points")||0,s=salla.config.get("store.settings.rating.rating_product_with_image_points")||0;this.loyaltyImageRatingPoints=Number(s)+Number(a)}loyaltyPointsNote(){if(!this.loyaltyImageRatingPoints||!this.loyaltyPointsForImagesLabel)return null;const t=s("svg",{width:"17",height:"17",viewBox:"0 0 17 17",fill:"none",xmlns:"http://www.w3.org/2000/svg"},s("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 s("div",{class:"s-rating-modal-loyalty-points-note-container"},s("span",{class:"s-rating-modal-loyalty-points-note-icon"},t),s("p",{class:"s-rating-modal-loyalty-points-note-text"},this.loyaltyPointsForImagesLabel.replace(":points",String(this.loyaltyImageRatingPoints))))}normalizeReviewFactorsPayload(t){const a=t?.data??t?.factors;return Array.isArray(a)?a.flatMap((t=>{const a=Array.isArray(t?.items)?[...t.items]:null;if(a?.length){a.sort(((t,a)=>(Number(t?.sort)||0)-(Number(a?.sort)||0)));const s=!!t?.is_required;return a.filter((t=>null!=t?.id&&""!==t?.id)).map((t=>({id:t.id,name:t?.name,required:s})))}return null==t?.id||""===t?.id?[]:[{id:t.id,name:t?.name,required:t?.required??t?.is_required??!1}]})):[]}async fetchProductReviewFactors(t){try{const a=await salla.api.request(`review/factors/${t}/form`);return this.normalizeReviewFactorsPayload(a)}catch(t){return[]}}async fetchAllProductReviewFactors(t){const a=this.getRateableProducts(t);if(!a.length)return{};const s=await Promise.all(a.map((async t=>{const a=await this.fetchProductReviewFactors(t.product.id);return[t.product.id,a]})));return Object.fromEntries(s)}async ensureProductFactorsLoaded(t){if(!t||this.productReviewFactors[t])return;const a=await this.fetchProductReviewFactors(t);this.productReviewFactors={...this.productReviewFactors,[t]:a}}getFactorFieldName(t,a,s){return t?`${t}[factors][${a}][${s}]`:`factors[${a}][${s}]`}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 a of["factor_reviews","review_factors","factors"]){const s=t[a];if(this.isFactorReviewsList(s))return s}return[]}getEditFactorReviewsList(t){const a=[this.order,this.getBootstrapOrder()].filter(Boolean);for(const s of a){const a=this.getMatchedProductRating(s,t,this.editFeedbackId),i=this.getFactorReviewsFromRecord(a);if(i.length)return i}const s=this.getOrderProducts(this.order).find((a=>Number(a.product?.id)===Number(t))),i=[this.editItem?.factor_reviews,this.editItem?.review_factors,this.editItem?.product?.review_factors,this.editItem?.product?.factor_reviews,this.editItem?.factors,s?.factor_reviews,s?.review_factors,s?.feedback?.factor_reviews];for(const t of i)if(Array.isArray(t)&&t.length>0)return t;return[]}getFactorKey(t,a){return null!=t.id&&""!==t.id?`id:${t.id}`:t.name?`name:${t.name.trim()}`:`index:${a}`}getFactorRatingsForProduct(t){return this.editMode?this.editFactorRatings:this.productFactorRatings[t]||{}}setFactorRatingsForProduct(t,a){this.editMode?this.editFactorRatings=a:this.productFactorRatings={...this.productFactorRatings,[t]:a}}markExistingFactorRatingsAsUserFilled(t,a){const s=this.productReviewFactors[t]||[],i=new Set;s.forEach(((t,s)=>{const e=this.getFactorKey(t,s),r=void 0!==t.id?a[String(t.id)]:void 0,n=t.name?a[t.name.trim()]:void 0;void 0===r&&void 0===n&&void 0===a[`__index_${s}`]||i.add(e)})),this.userFilledFactorKeys[t]=i}shouldAutofillFactors(t){return 4===t||5===t}autofillUnfilledFactors(t,a){const s=this.productReviewFactors[t]||[];if(!s.length)return;const i=this.userFilledFactorKeys[t]||new Set,e={...this.getFactorRatingsForProduct(t)},r=this.shouldAutofillFactors(a);let n=!1;s.forEach(((t,s)=>{const o=this.getFactorKey(t,s);if(!i.has(o)){if(r)return void 0!==t.id&&(e[String(t.id)]=a),t.name&&(e[t.name.trim()]=a),e[`__index_${s}`]=a,void(n=!0);void 0!==t.id&&void 0!==e[String(t.id)]&&(delete e[String(t.id)],n=!0),t.name&&void 0!==e[t.name.trim()]&&(delete e[t.name.trim()],n=!0),void 0!==e[`__index_${s}`]&&(delete e[`__index_${s}`],n=!0)}})),n&&this.setFactorRatingsForProduct(t,e)}handleMainRatingChange(t,a){this.editMode?this.editMainRating=a:this.productMainRatings={...this.productMainRatings,[t]:a},this.autofillUnfilledFactors(t,a)}handleFactorRatingChange(t,a,s){this.userFilledFactorKeys[t]||(this.userFilledFactorKeys[t]=new Set),this.userFilledFactorKeys[t].add(a);const i=this.productReviewFactors[t]||[],e=i.findIndex(((t,s)=>this.getFactorKey(t,s)===a));if(e<0)return;const r=i[e],n={...this.getFactorRatingsForProduct(t)};void 0!==r.id&&(n[String(r.id)]=s),r.name&&(n[r.name.trim()]=s),n[`__index_${e}`]=s,this.setFactorRatingsForProduct(t,n)}setupProductRatingAutofill(t,a){t&&!this.boundRatingRows.has(t)&&(this.boundRatingRows.add(t),t.addEventListener("click",(s=>{const i=s.target;if(!i.closest(".s-rating-stars-btn-star"))return;const e=i.closest(".s-rating-modal-product-rating-row-main"),r=i.closest(".s-rating-modal-product-factor-row");requestAnimationFrame((()=>{if(e&&t.contains(e)){const t=Number(this.getRatingHiddenInput(e)?.value);t>0&&this.handleMainRatingChange(a,t)}else if(r&&t.contains(r)){const t=r.getAttribute("data-factor-key"),s=Number(this.getRatingHiddenInput(r)?.value);t&&s>0&&this.handleFactorRatingChange(a,t,s)}}))})))}buildEditFactorRatings(t){return this.getEditFactorReviewsList(t).reduce(((t,a,s)=>{const i=Number(a?.rating??a?.stars??a?.value);if(Number.isNaN(i))return t;const e=a?.id??a?.factor_id;return null!=e&&""!==e&&(t[String(e)]=i),a?.name&&(t[a.name.trim()]=i),t[`__index_${s}`]=i,t}),{})}renderProductStep(t,a){return s("section",{class:"s-rating-modal-step s-rating-modal-hidden","data-type":"products","data-product-id":t.product.id,key:t.product.id},s("div",{class:"s-rating-modal-product"},this.allowAttachImages&&this.loyaltyPointsNote(),s("div",{class:"rating-outer-form","data-stars-error":salla.lang.get("pages.rating.rate_product_stars")},s("div",{class:"s-rating-modal-product-details"},s("div",{class:"s-rating-modal-product-info-row"},s("div",{class:"s-rating-modal-product-img-wrap"},s("img",{src:t.product.thumbnail,alt:t.product.name,class:"s-rating-modal-product-img"})),s("h3",{class:"s-rating-modal-product-title"},t.product.name)),this.renderProductReviewFactors(t.product.id,0,{fieldPrefix:""}),s("input",{type:"hidden",name:"product_id",value:t.product.id}),s("textarea",{placeholder:salla.lang.get("pages.rating.write_product_rate"),name:"comment",class:"s-rating-modal-comment"}),s("small",{class:"s-rating-modal-validation-msg"}))),this.allowAttachImages&&s("div",{class:"s-rating-modal-uploader is-opened",ref:t=>this.contentRefs[a]=t},s("salla-file-upload",{name:"image",maxFilesCount:this.MAX_UPLOAD_LIMIT,imagePreviewHeight:117,"instant-upload":!0,type:"feedback",payloadName:"files[]",id:`file-${t.product.id}`,title:t.product.name,allowMultiple:!0,instantUpload:!0,accept:"image/png, image/jpeg, image/jpg",url:salla.url.api("upload"),onUploaded:s=>{this.productImages={...this.productImages,[t.product.id]:[...this.productImages[t.product.id]||[],s.detail]},this.hiddenInputs[a].value=this.productImages[t.product.id].map((t=>t.url)).join(",")},onRemoved:s=>{const i=s.detail;i&&this.productImages[t.product.id]&&(this.productImages={...this.productImages,[t.product.id]:this.productImages[t.product.id].filter((t=>t.id!==i))},this.hiddenInputs[a].value=this.productImages[t.product.id].map((t=>t.url)).join(","))},labelIdle:this.getFilepondPlaceholder()}),s("input",{type:"hidden",name:"images",value:(this.productImages[t.product.id]||[]).map((t=>t.url)).join(","),ref:t=>this.hiddenInputs[a]=t}),this.renderUploadedImagesCount(t.product.id))))}renderProductReviewFactors(t,a,i={}){const e=this.productReviewFactors[t]||[],r=i.fieldPrefix??`products[${a}]`,n=r?`${r}[rating]`:"rating",o={...this.editMode?{}:this.productFactorRatings[t]||{},...i.factorRatings||{}},l=Number(i.mainRating??(this.editMode?this.editMainRating:this.productMainRatings[t])),d=!Number.isNaN(l),h=(t,a)=>{const s=void 0!==t.id?o[String(t.id)]:void 0,i=t.name?o[t.name.trim()]:void 0,e=Number(s??i??o[`__index_${a}`]);return Number.isNaN(e)?void 0:e};return s("div",{class:"s-rating-modal-product-rating-rows",ref:a=>this.setupProductRatingAutofill(a,t)},s("div",{class:"s-rating-modal-product-rating-row s-rating-modal-product-rating-row-main"},s("span",{class:"s-rating-modal-product-factor-name"},this.overallProductRatingLabel,s("span",{class:"s-rating-modal-product-factor-required"},"*")),s("salla-rating-stars",{size:"medium",name:n,key:d?`main-rating-${l}`:"main-rating-empty",value:d?l:void 0,editable:d,withLabel:!0,labelBeforeStars:!0,tag:!1})),e.map(((t,a)=>s("div",{class:"s-rating-modal-product-rating-row s-rating-modal-product-factor-row px-3","data-required":t.required?"true":"false","data-factor-key":this.getFactorKey(t,a)},s("input",{type:"hidden",name:this.getFactorFieldName(r,a,"name"),value:t.name}),!!t.id&&s("input",{type:"hidden",name:this.getFactorFieldName(r,a,"id"),value:String(t.id)}),s("span",{class:"s-rating-modal-product-factor-name"},t.name,t.required?s("span",{class:"s-rating-modal-product-factor-required"},"*"):""),s("salla-rating-stars",{size:"medium",name:this.getFactorFieldName(r,a,"rating"),key:`factor-rating-${t.id??a}-${h(t,a)??0}`,value:h(t,a),editable:i.alwaysEditable||"number"==typeof h(t,a),withLabel:!0,labelBeforeStars:!0,tag:!1})))))}handleSendEmail(){const t=`${this.contactSubjectLabel} #${this.order.id}`,a=this.contact_body(salla.config.get("store.name"),this.order.id,this.getCustomerName()),s=`mailto:${salla.config.get("store.contacts.email")}?subject=${encodeURIComponent(t)}&body=${encodeURIComponent(a)}`;window.open(s,"_blank")}handleSendWhatsApp(){const t=this.contact_body(salla.config.get("store.name"),this.order.id,this.getCustomerName()),a=`https://wa.me/${salla.config.get("store.contacts.whatsapp")}?text=${encodeURIComponent(t)}`;window.open(a,"_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.hiddenInputs[1]&&(this.hiddenInputs[1].value=""),this.deleteFeedbackId=null,this.editFeedbackId=null,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 s("salla-modal",{ref:t=>this.deleteModal=t,width:"xs",onModalVisibilityChanged:t=>this.resetData(t)},s("div",{class:"s-rating-modal-delete-wrapper",ref:t=>this.body=t},s("h3",null,this.confirmDeletionLabel),s("p",null,this.areYouSureLabel),s("div",{class:"s-rating-modal-delete-actions"},s("salla-button",{loaderPosition:"center",onClick:()=>this.deleteReview()},this.confirmDeleteBtn),s("salla-button",{color:"danger",fill:"outline",onClick:()=>this.deleteModal.close()},this.cancelLabel))))}renderUploadedImagesCount(t){const a=this.editMode?this.editItemImages.length:(this.productImages[t]||[]).length;return s("span",{class:"s-rating-modal-upload-count"},salla.lang.choice("pages.rating.images_count",a,{current:a,total:this.MAX_UPLOAD_LIMIT}))}getEditModal(){return s("salla-modal",{ref:t=>this.editModal=t,width:"md",onModalVisibilityChanged:t=>this.resetData(t)},s("div",{class:"s-rating-modal-edit-wrapper",ref:t=>this.body=t},"store"===this.editType&&this.editItem?s("div",{class:"rating-outer-form s-rating-modal-step-wrap s-rating-modal-step","data-type":"store",ref:t=>this.currentTab=t},s("div",{class:"s-rating-modal-rounded-icon"},s("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"})),s("h2",{class:"s-rating-modal-title"},salla.lang.get("pages.rating.rate_the_store")),s("div",{class:"s-rating-modal-stars-company"},s("salla-rating-stars",{withLabel:!0,size:"large",editable:!0,value:this.editItem.stars})),s("textarea",{name:"content",value:this.editItem.content,class:"s-rating-modal-comment",placeholder:salla.lang.get("pages.rating.write_store_rate")}),s("small",{class:"s-rating-modal-validation-msg"})):null,"shipping"===this.editType&&this.editItem?s("div",{class:"rating-outer-form s-rating-modal-step-wrap s-rating-modal-step","data-type":"shipping",ref:t=>this.currentTab=t},this.editItem.shipping.logo?s("div",{class:"s-rating-modal-rounded-icon"},s("img",{src:this.editItem.shipping.logo,class:"s-rating-modal-shipping-logo",alt:this.editItem.shipping.name})):s("span",{class:"s-rating-modal-icon",innerHTML:n}),s("div",{class:"s-rating-modal-title"}," ",`${salla.lang.get("pages.rating.rate_shipping")} ${this.editItem.shipping.name}`),s("div",{class:"s-rating-modal-stars-company"},s("salla-rating-stars",{withLabel:!0,size:"large",editable:!0,value:this.editItem.stars})),s("textarea",{name:"content",class:"s-rating-modal-comment",value:this.editItem.content,placeholder:salla.lang.get("pages.rating.write_shipping_rate")}),s("small",{class:"s-rating-modal-validation-msg"})):null,"product"==this.editType&&this.editItem?s("section",{class:"s-rating-modal-step","data-type":"products",ref:t=>this.currentTab=t},s("div",{class:"s-rating-modal-product"},this.allowAttachImages&&this.loyaltyPointsNote(),s("div",{class:"rating-outer-form","data-stars-error":salla.lang.get("pages.rating.rate_product_stars")},s("div",{class:"s-rating-modal-product-details"},s("div",{class:"s-rating-modal-product-info-row"},s("div",{class:"s-rating-modal-product-img-wrap"},s("img",{src:this.editItem.product.image.url,alt:this.editItem.product.name,class:"s-rating-modal-product-img"})),s("h3",{class:"s-rating-modal-product-title"},this.editItem.product.name)),this.renderProductReviewFactors(this.editItem.product.id,0,{fieldPrefix:"",mainRating:this.editMainRating??Number(this.editItem.stars??this.editItem.rating),factorRatings:this.editFactorRatings,alwaysEditable:!0}),s("input",{type:"hidden",name:"product_id",value:this.editItem.product.id}),s("textarea",{value:this.editItem.content,placeholder:salla.lang.get("pages.rating.write_product_rate"),name:"comment",class:"s-rating-modal-comment"}),s("small",{class:"s-rating-modal-validation-msg"}))),this.allowAttachImages&&s("div",{class:"s-rating-modal-uploader is-opened",ref:t=>this.contentRefs[1]=t},s("salla-file-upload",{name:"images",allowMultiple:!0,maxFilesCount:this.MAX_UPLOAD_LIMIT,imagePreviewHeight:117,filePosterHeight:117,"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:"image/png, image/jpeg, image/jpg",url:salla.url.api("upload"),onUploaded:t=>{this.editItemImages=[...this.editItemImages,t.detail],this.hiddenInputs[1].value=this.editItemImages.map((t=>t.url)).join()},onRemoved:t=>{const a=t.detail;a&&(this.editItemImages=this.editItemImages.filter((t=>t.id!==a)),this.hiddenInputs[1].value=this.editItemImages.map((t=>t.url)).join())},labelIdle:this.getFilepondPlaceholder()}),s("input",{type:"hidden",name:"images",value:this.editItemImages.map((t=>t.url)).join(","),ref:t=>this.hiddenInputs[1]=t}),this.renderUploadedImagesCount(this.editItem.product.id)))):null,s("div",{class:"s-rating-modal-footer s-rating-modal-footer-end"},s("salla-button",{"loader-position":"center",onClick:()=>this.editReview()},this.editReviewLabel))))}render(){return this.deleteMode?s(i,{class:"s-rating-modal"},this.getDeleteModal()):this.editMode?s(i,{class:"s-rating-modal"},this.getEditModal()):this.defaultMode?s(i,{class:"s-rating-modal"},s("salla-modal",{class:"s-rating-modal-wrap",onModalVisibilityChanged:t=>this.resetData(t),isLoading:!0,width:"md",ref:t=>this.modal=t},s("div",{slot:"loading"},s("div",{class:"s-rating-modal-skeleton"},s("salla-skeleton",{type:"circle",height:"80px",width:"80px"}),s("salla-skeleton",{height:"15px",width:"60%"}),s("salla-skeleton",{height:"10px",width:"30%"}),s("div",{class:"s-rating-modal-skeleton-stars"},[...Array(5)].map((t=>s("div",{key:t,innerHTML:r})))),s("salla-skeleton",{height:"100px",width:"100%"}),s("div",{class:"s-rating-modal-skeleton-footer"},s("salla-skeleton",{height:"40px",width:"30%"})))),!this.hasError&&this.order?[s("div",{class:"s-rating-modal-wrapper",ref:t=>this.body=t},this.isTestimonialsEnabled()?s("div",{class:"rating-outer-form s-rating-modal-step-wrap s-rating-modal-step s-rating-modal-hidden","data-type":"store"},s("div",{class:"s-rating-modal-rounded-icon"},s("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"})),s("h2",{class:"s-rating-modal-title"},salla.lang.get("pages.rating.rate_the_store")),s("div",{class:"s-rating-modal-stars-company"},s("salla-rating-stars",{withLabel:!0,size:"large"})),s("textarea",{name:"comment",class:"s-rating-modal-comment",placeholder:salla.lang.get("pages.rating.write_store_rate")}),s("small",{class:"s-rating-modal-validation-msg"})):"",this.isProductsEnabled()&&this.getRateableProducts().map(((t,a)=>this.renderProductStep(t,a))),this.isShippingEnabled()&&this.order.shipping?.company?s("div",{class:"rating-outer-form s-rating-modal-step-wrap s-rating-modal-step s-rating-modal-hidden","data-type":"shipping"},s("input",{type:"hidden",name:"shipping_company_id",value:this.order.shipping.company.id}),this.order.shipping.company.logo?s("div",{class:"s-rating-modal-rounded-icon"},s("img",{src:this.order.shipping.company.logo,class:"s-rating-modal-shipping-logo",alt:this.order.shipping.company.name})):s("span",{class:"s-rating-modal-icon",innerHTML:n}),s("div",{class:"s-rating-modal-title"}," ",`${salla.lang.get("pages.rating.rate_shipping")} ${this.order.shipping.company.name}`),s("div",{class:"s-rating-modal-stars-company"},s("salla-rating-stars",{withLabel:!0,size:"large"})),s("textarea",{name:"comment",class:"s-rating-modal-comment",placeholder:salla.lang.get("pages.rating.write_shipping_rate")}),s("small",{class:"s-rating-modal-validation-msg"})):"",s("div",{class:"s-rating-modal-thanks s-rating-modal-hidden",ref:t=>this.thanksTab=t},s("span",{class:"s-rating-modal-icon",innerHTML:o}),s("h3",{class:"s-rating-modal-thanks-title"},salla.lang.get("pages.rating.thanks")),s("div",{class:"s-rating-modal-thanks-msg",innerHTML:this.order.thanks_message}),s("time",{class:"s-rating-modal-thanks-time",ref:t=>this.thanksTime=t}))),this.allowContactSupport&&this.showContactWidget&&(salla.config.get("store.contacts.whatsapp")||salla.config.get("store.contacts.email"))?s("div",{class:"s-rating-modal-contact"},s("p",null,this.contactUsLabel),s("div",{class:"s-rating-modal-contact-icons"},salla.config.get("store.contacts.whatsapp")&&s("span",{onClick:()=>this.handleSendWhatsApp(),innerHTML:h}),salla.config.get("store.contacts.email")&&s("span",{onClick:()=>this.handleSendEmail(),innerHTML:g}))):"",s("div",{class:"s-rating-modal-footer"},s("button",{ref: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?s("ul",{class:"s-rating-modal-dots"},[...Array(this.stepsCount)].map(((t,a)=>s("li",{key:a,class:"s-rating-modal-bg-gray s-rating-modal-step-dot"})))):"",s("salla-button",{"loader-position":"center",ref:t=>this.nextBtn=t,onClick:()=>this.submit()},salla.lang.get("common.elements.next")))]:s("salla-placeholder",{alignment:"center"}))):void 0}async componentWillLoad(){await salla.onReady(),this.syncStoreSettings()}componentDidRender(){this.scheduleWizardSetup&&this.defaultMode&&this.order&&(this.scheduleWizardSetup=!1,requestAnimationFrame((()=>this.handleWizard())))}disconnectedCallback(){this.clearThanksCountdown()}get host(){return e(this)}};m.style=".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-rating-row-main{margin-bottom:0.35rem;padding:0.5rem 0.6rem;border:1px solid #d1d5db;border-radius:0.45rem;background:transparent}.s-rating-modal-product-factor-name{color:#5b6470;font-size:0.9rem;line-height:1.25}.s-rating-modal-product-rating-row-main .s-rating-modal-product-factor-name{font-size:1rem;color:#5b6470}.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}.s-rating-modal-uploader.is-opened{height:auto !important;opacity:1 !important;overflow:visible !important;pointer-events:auto !important;margin-bottom:1rem}";export{m as salla_rating_modal_v2}
|
|
4
|
+
import{r as t,f as a,h as s,H as i,a as e}from"./p-Dm54yhRt.js";import{S as r}from"./p-CeFAfcTv.js";import{S as n}from"./p-lMgMt31Q.js";import{C as o}from"./p-BV4kqbdL.js";import{H as l}from"./p-XnA1YTjA.js";import{I as d}from"./p-C-tzSDxw.js";import{W as h}from"./p-CgR-T_ZS.js";import{e as g}from"./p-DzAIgzdz.js";import"./p-CgtvEd63.js";const m=class{constructor(a){t(this,a),this.hasError=!1,this.showContactWidget=!0,this.images=[],this.productImages={},this.editItemImages=[],this.productReviewFactors={},this.editFactorRatings={},this.productMainRatings={},this.productFactorRatings={},this.contact_body=(t,a,s)=>salla.lang.get("pages.rating.contact_subject",{store:t,id:a,customer:s}),this.editMode=!1,this.defaultMode=!1,this.deleteMode=!1,this.shouldOpenDeleteModal=!1,this.editItem=null,this.allowAttachImages=!1,this.allowContactSupport=!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.overallProductRatingLabel=salla.lang.get("pages.rating.overall_product_rating"),this.loyaltyPointsForImagesLabel=salla.lang.get("pages.rating.loyalty_points_for_images",{points:":points"}),this.contentRefs=[],this.hiddenInputs=[],this.userFilledFactorKeys={},this.boundRatingRows=new WeakSet,this.stepsCount=0,this.currentIndex=0,this.submitted=[],this.MAX_UPLOAD_LIMIT=3,this.thanksCountdownInterval=null,this.scheduleWizardSetup=!1,salla.lang.onLoaded((()=>{this.contactUsLabel=salla.lang.get("blocks.footer.social");const t=(t,a,s)=>new Promise((i=>{salla.helpers.setNested(salla.lang.messages[t],a,s),i(!0)}));(async()=>{await t("ar.trans","common.uploader.drag_and_drop_files","اسحب الملفات وأفلتها هنا"),await t("en.trans","common.uploader.drag_and_drop_files","Drag and drop files here"),await t("ar.trans","common.uploader.allowed_images_types"," .jpg أو jpeg أو png يُسمح بإضافة صور بصيغة"),await t("en.trans","common.uploader.allowed_images_types","Images in jpg, jpeg, or png format are allowed."),await t("ar.trans","pages.rating.add_images","اضافة صور"),await t("en.trans","pages.rating.add_images","Add Images"),await t("ar.trans","pages.rating.edit_images","تعديل الصور"),await t("en.trans","pages.rating.edit_images","Edit Images"),await t("ar.trans","pages.rating.edit_review","تعديل التقييم"),await t("en.trans","pages.rating.edit_review","Edit review"),await t("ar.trans","pages.rating.confirm_deletion","تأكيد حذف التقييم"),await t("en.trans","pages.rating.confirm_deletion","Confirm review deletion"),await t("ar.trans","pages.rating.are_you_sure_you_want_to_delete_review","هل أنت متأكد من حذف تقييمك؟"),await t("en.trans","pages.rating.are_you_sure_you_want_to_delete_review","Are you sure you want to delete your review?"),await t("ar.trans","pages.rating.review_updated_successfully","تم تعديل التقييم بنجاح"),await t("en.trans","pages.rating.review_updated_successfully","The review has been successfully updated."),await t("ar.trans","pages.rating.review_deleted_successfully","تم حذف التقييم بنجاح"),await t("en.trans","pages.rating.review_deleted_successfully","The review has been successfully deleted."),await t("ar.trans","pages.rating.images_count","الصور ( :current من أصل :total )"),await t("en.trans","pages.rating.images_count","Images ( :current of :total )"),await t("ar.trans","common.uploader.max_three_images",`.أضف ${this.MAX_UPLOAD_LIMIT} صور كحد أقصى`),await t("en.trans","common.uploader.max_three_images",`Add up to ${this.MAX_UPLOAD_LIMIT} images maximum.`),await t("ar.trans","common.elements.confirm_delete","تأكيد الحذف"),await t("en.trans","common.elements.confirm_delete","Confirm deletion"),await t("ar.trans","pages.rating.rate_required_factors","يرجى تقييم جميع المعايير لإتمام مراجعتك."),await t("en.trans","pages.rating.rate_required_factors","Please rate all required factors to complete your review."),await t("ar.trans","pages.rating.overall_product_rating","التقييم العام للمنتج"),await t("en.trans","pages.rating.overall_product_rating","Overall product rating"),await t("ar.trans","pages.rating.loyalty_points_for_images","اكسب :points نقطة ولاء عند إضافة صور لتقييمك!"),await t("en.trans","pages.rating.loyalty_points_for_images","Earn :points loyalty points when adding photos to your review!"),this.dragAndDropFilesLabel=salla.lang.get("common.uploader.drag_and_drop_files"),this.allowedImagesTypesLabel=salla.lang.get("common.uploader.allowed_images_types"),this.threeImagesMax=salla.lang.get("common.uploader.max_three_images"),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.overallProductRatingLabel=salla.lang.get("pages.rating.overall_product_rating"),this.loyaltyPointsForImagesLabel=salla.lang.get("pages.rating.loyalty_points_for_images",{points:":points"}),this.contact_body=(t,a,s)=>salla.lang.get("pages.rating.contact_body",{store:t,id:a,customer:s})})()}))}syncStoreSettings(){this.orderId||(this.orderId=salla.config.get("page.id")),this.allowAttachImages=!!salla.config.get("store.settings.rating.allow_attach_images"),this.allowContactSupport=!!salla.config.get("store.settings.rating.allow_contact_support")}getRatingOrderId(){return this.orderId||salla.config.get("page.id")}getSubmitOrderId(){return this.orderId}isCustomerOrderShape(t){if(!t||"object"!=typeof t)return!1;const a=t;return!!a.rating&&(Array.isArray(a.items)||Array.isArray(a.products)||Array.isArray(a.rating?.product)||Array.isArray(a.rating?.products))}getBootstrapOrder(){const t=salla.config.get("page");if(this.isCustomerOrderShape(t))return t;if(t&&"object"==typeof t){const a=t;if(Array.isArray(a.products))return t;const s=a.order;if(this.isCustomerOrderShape(s))return s}}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,a,s){return this.getOrderProductRatings(t).find((t=>Number(t?.id??t?.feedback_id)===Number(s)||Number(t?.product_id??t?.product?.id)===Number(a)))}hasRatingFeedback(t){const a=t?.rating;return null!=a&&""!==a&&Number(a)>0}isTestimonialsEnabled(t=this.order){return!(!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!(!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)))}getStepsCount(t=this.order){if(!t)return 0;let a=0;return this.isTestimonialsEnabled(t)&&a++,this.isProductsEnabled(t)&&(a+=this.getRateableProducts(t).length),this.isShippingEnabled(t)&&t.shipping?.company&&a++,a}afterOrderLoaded(){this.stepsCount=this.getStepsCount(),this.scheduleWizardSetup=!0,a(this)}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||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(`${salla.lang.get("pages.rating.rate_order")} <span class="unicode">(#${this.order.id})</span>`))).then((()=>{const t={};for(const a of this.getRateableProducts())t[a.product.id]=[];this.productImages=t})).then((()=>this.modal.stopLoading())).then((()=>this.afterOrderLoaded())).catch((a=>{t(!1),this.hasError=!0,this.errorMessage=a.response?.data?.error?.message||a.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()}catch(t){this.hasError=!0,this.errorMessage=t.response?.data?.error?.message||t.response?.data}}async fetchEditItem(t){const a=`rating/${t}/show`,s=await salla.api.request(a);this.editItem=s.data,this.allowAttachImages&&"product"==this.editType&&this.editItem.images.length&&(this.editItemImages=this.editItem.images.map((t=>({id:`${Math.floor(100+900*Math.random())}`,url:t}))))}async editReview(){const t=`rating/${this.editFeedbackId}`;let a;if("product"===this.editType){const t=this.editModal.querySelector('[data-type="products"]')||this.currentTab;a=this.buildProductRatingPayload(this.collectFormData(t),t),!a.product_id&&this.editItem?.product?.id&&(a.product_id=String(this.editItem.product.id))}else a=this.collectFormData(this.editModal),a.images&&(a.images=a.images.split(","));await salla.api.request(t,a,"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 a=this.steps[this.currentIndex+1]?.dataset.type;this.nextBtn?.setText(a?`${salla.lang.get("pages.rating.rate")} ${salla.lang.get(`pages.rating.${a}`)}`: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(){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 a=t,s=a.querySelector?.(".rating_hidden_input");if(s?.name)return s;const i=a.querySelector?.("salla-rating-stars");return i?.shadowRoot?.querySelector(".rating_hidden_input")||null}collectNamedInputs(t){const a=new Set,s=[],i=t=>{t?.name&&!a.has(t)&&(a.add(t),s.push(t))};return t.querySelectorAll("[name]").forEach((t=>{i(t)})),t.querySelectorAll("salla-rating-stars").forEach((t=>{i(this.getRatingHiddenInput(t))})),s}normalizeFactorsList(t){return t?Array.isArray(t)?t:"object"==typeof t?Object.values(t).filter((t=>t&&"object"==typeof t)):[]:[]}validate(t=null,a=null){if(!t&&"products"===this.currentTab.dataset.type)return void this.currentTab.querySelectorAll(".rating-outer-form").forEach((t=>this.validate(t,"product")));const s=(t=t||this.currentTab).querySelector(".s-rating-modal-product-rating-row-main"),i=this.getRatingHiddenInput(s||t),e=i?.value,r=t.querySelector(".s-rating-modal-validation-msg");if(a=a||t.dataset.type,!e)throw r.innerHTML=salla.lang.get(`pages.rating.rate_${a}_stars`).replace(" (:item)",""),new Error(r.innerHTML);if("product"===a&&Array.from(t.querySelectorAll('.s-rating-modal-product-factor-row[data-required="true"]')).some((t=>{const a=this.getRatingHiddenInput(t);return!a?.value})))throw r.innerHTML=this.requiredFactorsLabel,new Error(r.innerHTML);r.innerHTML=""}collectFormData(t=this.currentTab){const a={};return this.collectNamedInputs(t).forEach((t=>{const s=salla.helpers.inputData(t.name,t.value,a);a[s.name]=s.value})),a}buildProductRatingPayload(t,a=this.currentTab){if(!t.rating){const s=a.querySelector(".s-rating-modal-product-rating-row-main"),i=this.getRatingHiddenInput(s||a);i?.value&&(t.rating=i.value)}const s=Number(t.product_id);let i=[];t.images?i="string"==typeof t.images?t.images.split(",").filter(Boolean):t.images:this.editMode&&this.allowAttachImages&&s?i=this.editItemImages.map((t=>t.url)):this.allowAttachImages&&s&&(i=(this.productImages[s]||[]).map((t=>t.url)));const e=this.normalizeFactorsList(t.factors).filter((t=>t?.id&&t?.rating)).map((t=>({id:String(t.id),rating:String(t.rating)})));return{order_id:this.getSubmitOrderId(),product_id:String(t.product_id),rating:String(t.rating),comment:t.comment||t.content||"",images:i,factors:e,type:"products"}}async sendFeedback(){this.refreshWizardRefs();const t=this.currentTab?.dataset?.type;if("products"===t){const t=this.collectFormData(this.currentTab),a=this.buildProductRatingPayload(t,this.currentTab);if(!a.product_id||!a.rating)throw new Error("Missing product rating data");const s=await salla.rating.api.products(a);return this.submitted.push(this.currentIndex),s}const a=this.collectFormData(this.currentTab);if(0===Object.keys(a).length)return;a.order_id=this.getSubmitOrderId(),a.type=t;const s=await salla.rating.api[t](a);return this.submitted.push(this.currentIndex),s}clearThanksCountdown(){null!==this.thanksCountdownInterval&&(clearInterval(this.thanksCountdownInterval),this.thanksCountdownInterval=null)}showThankYou(){let t=10;this.clearThanksCountdown(),this.thanksCountdownInterval=setInterval((()=>{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 a=salla.config.get("store.settings.rating.rating_product_points")||0,s=salla.config.get("store.settings.rating.rating_product_with_image_points")||0;this.loyaltyImageRatingPoints=Number(s)+Number(a)}loyaltyPointsNote(){if(!this.loyaltyImageRatingPoints||!this.loyaltyPointsForImagesLabel)return null;const t=s("svg",{width:"17",height:"17",viewBox:"0 0 17 17",fill:"none",xmlns:"http://www.w3.org/2000/svg"},s("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 s("div",{class:"s-rating-modal-loyalty-points-note-container"},s("span",{class:"s-rating-modal-loyalty-points-note-icon"},t),s("p",{class:"s-rating-modal-loyalty-points-note-text"},this.loyaltyPointsForImagesLabel.replace(":points",String(this.loyaltyImageRatingPoints))))}normalizeReviewFactorsPayload(t){const a=t?.data??t?.factors;return Array.isArray(a)?a.flatMap((t=>{const a=Array.isArray(t?.items)?[...t.items]:null;if(a?.length){a.sort(((t,a)=>(Number(t?.sort)||0)-(Number(a?.sort)||0)));const s=!!t?.is_required;return a.filter((t=>null!=t?.id&&""!==t?.id)).map((t=>({id:t.id,name:t?.name,required:s})))}return null==t?.id||""===t?.id?[]:[{id:t.id,name:t?.name,required:t?.required??t?.is_required??!1}]})):[]}async fetchProductReviewFactors(t){try{const a=await salla.api.request(`review/factors/${t}/form`);return this.normalizeReviewFactorsPayload(a)}catch(t){return[]}}async fetchAllProductReviewFactors(t){const a=this.getRateableProducts(t);if(!a.length)return{};const s=await Promise.all(a.map((async t=>{const a=await this.fetchProductReviewFactors(t.product.id);return[t.product.id,a]})));return Object.fromEntries(s)}async ensureProductFactorsLoaded(t){if(!t||this.productReviewFactors[t])return;const a=await this.fetchProductReviewFactors(t);this.productReviewFactors={...this.productReviewFactors,[t]:a}}getFactorFieldName(t,a,s){return t?`${t}[factors][${a}][${s}]`:`factors[${a}][${s}]`}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 a of["factor_reviews","review_factors","factors"]){const s=t[a];if(this.isFactorReviewsList(s))return s}return[]}getEditFactorReviewsList(t){const a=[this.order,this.getBootstrapOrder()].filter(Boolean);for(const s of a){const a=this.getMatchedProductRating(s,t,this.editFeedbackId),i=this.getFactorReviewsFromRecord(a);if(i.length)return i}const s=this.getOrderProducts(this.order).find((a=>Number(a.product?.id)===Number(t))),i=[this.editItem?.factor_reviews,this.editItem?.review_factors,this.editItem?.product?.review_factors,this.editItem?.product?.factor_reviews,this.editItem?.factors,s?.factor_reviews,s?.review_factors,s?.feedback?.factor_reviews];for(const t of i)if(Array.isArray(t)&&t.length>0)return t;return[]}getFactorKey(t,a){return null!=t.id&&""!==t.id?`id:${t.id}`:t.name?`name:${t.name.trim()}`:`index:${a}`}getFactorRatingsForProduct(t){return this.editMode?this.editFactorRatings:this.productFactorRatings[t]||{}}setFactorRatingsForProduct(t,a){this.editMode?this.editFactorRatings=a:this.productFactorRatings={...this.productFactorRatings,[t]:a}}markExistingFactorRatingsAsUserFilled(t,a){const s=this.productReviewFactors[t]||[],i=new Set;s.forEach(((t,s)=>{const e=this.getFactorKey(t,s),r=void 0!==t.id?a[String(t.id)]:void 0,n=t.name?a[t.name.trim()]:void 0;void 0===r&&void 0===n&&void 0===a[`__index_${s}`]||i.add(e)})),this.userFilledFactorKeys[t]=i}shouldAutofillFactors(t){return 4===t||5===t}autofillUnfilledFactors(t,a){const s=this.productReviewFactors[t]||[];if(!s.length)return;const i=this.userFilledFactorKeys[t]||new Set,e={...this.getFactorRatingsForProduct(t)},r=this.shouldAutofillFactors(a);let n=!1;s.forEach(((t,s)=>{const o=this.getFactorKey(t,s);if(!i.has(o)){if(r)return void 0!==t.id&&(e[String(t.id)]=a),t.name&&(e[t.name.trim()]=a),e[`__index_${s}`]=a,void(n=!0);void 0!==t.id&&void 0!==e[String(t.id)]&&(delete e[String(t.id)],n=!0),t.name&&void 0!==e[t.name.trim()]&&(delete e[t.name.trim()],n=!0),void 0!==e[`__index_${s}`]&&(delete e[`__index_${s}`],n=!0)}})),n&&this.setFactorRatingsForProduct(t,e)}handleMainRatingChange(t,a){this.editMode?this.editMainRating=a:this.productMainRatings={...this.productMainRatings,[t]:a},this.autofillUnfilledFactors(t,a)}handleFactorRatingChange(t,a,s){this.userFilledFactorKeys[t]||(this.userFilledFactorKeys[t]=new Set),this.userFilledFactorKeys[t].add(a);const i=this.productReviewFactors[t]||[],e=i.findIndex(((t,s)=>this.getFactorKey(t,s)===a));if(e<0)return;const r=i[e],n={...this.getFactorRatingsForProduct(t)};void 0!==r.id&&(n[String(r.id)]=s),r.name&&(n[r.name.trim()]=s),n[`__index_${e}`]=s,this.setFactorRatingsForProduct(t,n)}setupProductRatingAutofill(t,a){t&&!this.boundRatingRows.has(t)&&(this.boundRatingRows.add(t),t.addEventListener("click",(s=>{const i=s.target;if(!i.closest(".s-rating-stars-btn-star"))return;const e=i.closest(".s-rating-modal-product-rating-row-main"),r=i.closest(".s-rating-modal-product-factor-row");requestAnimationFrame((()=>{if(e&&t.contains(e)){const t=Number(this.getRatingHiddenInput(e)?.value);t>0&&this.handleMainRatingChange(a,t)}else if(r&&t.contains(r)){const t=r.getAttribute("data-factor-key"),s=Number(this.getRatingHiddenInput(r)?.value);t&&s>0&&this.handleFactorRatingChange(a,t,s)}}))})))}buildEditFactorRatings(t){return this.getEditFactorReviewsList(t).reduce(((t,a,s)=>{const i=Number(a?.rating??a?.stars??a?.value);if(Number.isNaN(i))return t;const e=a?.id??a?.factor_id;return null!=e&&""!==e&&(t[String(e)]=i),a?.name&&(t[a.name.trim()]=i),t[`__index_${s}`]=i,t}),{})}renderProductStep(t,a){return s("section",{class:"s-rating-modal-step s-rating-modal-hidden","data-type":"products","data-product-id":t.product.id,key:t.product.id},s("div",{class:"s-rating-modal-product"},this.allowAttachImages&&this.loyaltyPointsNote(),s("div",{class:"rating-outer-form","data-stars-error":salla.lang.get("pages.rating.rate_product_stars")},s("div",{class:"s-rating-modal-product-details"},s("div",{class:"s-rating-modal-product-info-row"},s("div",{class:"s-rating-modal-product-img-wrap"},s("img",{src:t.product.thumbnail,alt:t.product.name,class:"s-rating-modal-product-img"})),s("h3",{class:"s-rating-modal-product-title"},t.product.name)),this.renderProductReviewFactors(t.product.id,0,{fieldPrefix:""}),s("input",{type:"hidden",name:"product_id",value:t.product.id}),s("textarea",{placeholder:salla.lang.get("pages.rating.write_product_rate"),name:"comment",class:"s-rating-modal-comment"}),s("small",{class:"s-rating-modal-validation-msg"}))),this.allowAttachImages&&s("div",{class:"s-rating-modal-uploader is-opened",ref:t=>this.contentRefs[a]=t},s("salla-file-upload",{name:"image",maxFilesCount:this.MAX_UPLOAD_LIMIT,imagePreviewHeight:117,"instant-upload":!0,type:"feedback",payloadName:"files[]",id:`file-${t.product.id}`,title:t.product.name,allowMultiple:!0,instantUpload:!0,accept:"image/png, image/jpeg, image/jpg",url:salla.url.api("upload"),onUploaded:s=>{this.productImages={...this.productImages,[t.product.id]:[...this.productImages[t.product.id]||[],s.detail]},this.hiddenInputs[a].value=this.productImages[t.product.id].map((t=>t.url)).join(",")},onRemoved:s=>{const i=s.detail;i&&this.productImages[t.product.id]&&(this.productImages={...this.productImages,[t.product.id]:this.productImages[t.product.id].filter((t=>t.id!==i))},this.hiddenInputs[a].value=this.productImages[t.product.id].map((t=>t.url)).join(","))},labelIdle:this.getFilepondPlaceholder()}),s("input",{type:"hidden",name:"images",value:(this.productImages[t.product.id]||[]).map((t=>t.url)).join(","),ref:t=>this.hiddenInputs[a]=t}),this.renderUploadedImagesCount(t.product.id))))}renderProductReviewFactors(t,a,i={}){const e=this.productReviewFactors[t]||[],r=i.fieldPrefix??`products[${a}]`,n=r?`${r}[rating]`:"rating",o={...this.editMode?{}:this.productFactorRatings[t]||{},...i.factorRatings||{}},l=Number(i.mainRating??(this.editMode?this.editMainRating:this.productMainRatings[t])),d=!Number.isNaN(l),h=(t,a)=>{const s=void 0!==t.id?o[String(t.id)]:void 0,i=t.name?o[t.name.trim()]:void 0,e=Number(s??i??o[`__index_${a}`]);return Number.isNaN(e)?void 0:e};return s("div",{class:"s-rating-modal-product-rating-rows",ref:a=>this.setupProductRatingAutofill(a,t)},s("div",{class:"s-rating-modal-product-rating-row s-rating-modal-product-rating-row-main"},s("span",{class:"s-rating-modal-product-factor-name"},this.overallProductRatingLabel,s("span",{class:"s-rating-modal-product-factor-required"},"*")),s("salla-rating-stars",{size:"medium",name:n,key:d?`main-rating-${l}`:"main-rating-empty",value:d?l:void 0,editable:d,withLabel:!0,labelBeforeStars:!0,tag:!1})),e.map(((t,a)=>s("div",{class:"s-rating-modal-product-rating-row s-rating-modal-product-factor-row px-3","data-required":t.required?"true":"false","data-factor-key":this.getFactorKey(t,a)},s("input",{type:"hidden",name:this.getFactorFieldName(r,a,"name"),value:t.name}),!!t.id&&s("input",{type:"hidden",name:this.getFactorFieldName(r,a,"id"),value:String(t.id)}),s("span",{class:"s-rating-modal-product-factor-name"},t.name,t.required?s("span",{class:"s-rating-modal-product-factor-required"},"*"):""),s("salla-rating-stars",{size:"medium",name:this.getFactorFieldName(r,a,"rating"),key:`factor-rating-${t.id??a}-${h(t,a)??0}`,value:h(t,a),editable:i.alwaysEditable||"number"==typeof h(t,a),withLabel:!0,labelBeforeStars:!0,tag:!1})))))}handleSendEmail(){const t=`${this.contactSubjectLabel} #${this.order.id}`,a=this.contact_body(salla.config.get("store.name"),this.order.id,this.getCustomerName()),s=`mailto:${salla.config.get("store.contacts.email")}?subject=${encodeURIComponent(t)}&body=${encodeURIComponent(a)}`;window.open(s,"_blank")}handleSendWhatsApp(){const t=this.contact_body(salla.config.get("store.name"),this.order.id,this.getCustomerName()),a=`https://wa.me/${salla.config.get("store.contacts.whatsapp")}?text=${encodeURIComponent(t)}`;window.open(a,"_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.hiddenInputs[1]&&(this.hiddenInputs[1].value=""),this.deleteFeedbackId=null,this.editFeedbackId=null,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 s("salla-modal",{ref:t=>this.deleteModal=t,width:"xs",onModalVisibilityChanged:t=>this.resetData(t)},s("div",{class:"s-rating-modal-delete-wrapper",ref:t=>this.body=t},s("h3",null,this.confirmDeletionLabel),s("p",null,this.areYouSureLabel),s("div",{class:"s-rating-modal-delete-actions"},s("salla-button",{loaderPosition:"center",onClick:()=>this.deleteReview()},this.confirmDeleteBtn),s("salla-button",{color:"danger",fill:"outline",onClick:()=>this.deleteModal.close()},this.cancelLabel))))}renderUploadedImagesCount(t){const a=this.editMode?this.editItemImages.length:(this.productImages[t]||[]).length;return s("span",{class:"s-rating-modal-upload-count"},salla.lang.choice("pages.rating.images_count",a,{current:a,total:this.MAX_UPLOAD_LIMIT}))}getEditModal(){return s("salla-modal",{ref:t=>this.editModal=t,width:"md",onModalVisibilityChanged:t=>this.resetData(t)},s("div",{class:"s-rating-modal-edit-wrapper",ref:t=>this.body=t},"store"===this.editType&&this.editItem?s("div",{class:"rating-outer-form s-rating-modal-step-wrap s-rating-modal-step","data-type":"store",ref:t=>this.currentTab=t},s("div",{class:"s-rating-modal-rounded-icon"},s("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"})),s("h2",{class:"s-rating-modal-title"},salla.lang.get("pages.rating.rate_the_store")),s("div",{class:"s-rating-modal-stars-company"},s("salla-rating-stars",{withLabel:!0,size:"large",editable:!0,value:this.editItem.stars})),s("textarea",{name:"content",value:this.editItem.content,class:"s-rating-modal-comment",placeholder:salla.lang.get("pages.rating.write_store_rate")}),s("small",{class:"s-rating-modal-validation-msg"})):null,"shipping"===this.editType&&this.editItem?s("div",{class:"rating-outer-form s-rating-modal-step-wrap s-rating-modal-step","data-type":"shipping",ref:t=>this.currentTab=t},this.editItem.shipping.logo?s("div",{class:"s-rating-modal-rounded-icon"},s("img",{src:this.editItem.shipping.logo,class:"s-rating-modal-shipping-logo",alt:this.editItem.shipping.name})):s("span",{class:"s-rating-modal-icon",innerHTML:n}),s("div",{class:"s-rating-modal-title"}," ",`${salla.lang.get("pages.rating.rate_shipping")} ${this.editItem.shipping.name}`),s("div",{class:"s-rating-modal-stars-company"},s("salla-rating-stars",{withLabel:!0,size:"large",editable:!0,value:this.editItem.stars})),s("textarea",{name:"content",class:"s-rating-modal-comment",value:this.editItem.content,placeholder:salla.lang.get("pages.rating.write_shipping_rate")}),s("small",{class:"s-rating-modal-validation-msg"})):null,"product"==this.editType&&this.editItem?s("section",{class:"s-rating-modal-step","data-type":"products",ref:t=>this.currentTab=t},s("div",{class:"s-rating-modal-product"},this.allowAttachImages&&this.loyaltyPointsNote(),s("div",{class:"rating-outer-form","data-stars-error":salla.lang.get("pages.rating.rate_product_stars")},s("div",{class:"s-rating-modal-product-details"},s("div",{class:"s-rating-modal-product-info-row"},s("div",{class:"s-rating-modal-product-img-wrap"},s("img",{src:this.editItem.product.image.url,alt:this.editItem.product.name,class:"s-rating-modal-product-img"})),s("h3",{class:"s-rating-modal-product-title"},this.editItem.product.name)),this.renderProductReviewFactors(this.editItem.product.id,0,{fieldPrefix:"",mainRating:this.editMainRating??Number(this.editItem.stars??this.editItem.rating),factorRatings:this.editFactorRatings,alwaysEditable:!0}),s("input",{type:"hidden",name:"product_id",value:this.editItem.product.id}),s("textarea",{value:this.editItem.content,placeholder:salla.lang.get("pages.rating.write_product_rate"),name:"comment",class:"s-rating-modal-comment"}),s("small",{class:"s-rating-modal-validation-msg"}))),this.allowAttachImages&&s("div",{class:"s-rating-modal-uploader is-opened",ref:t=>this.contentRefs[1]=t},s("salla-file-upload",{name:"images",allowMultiple:!0,maxFilesCount:this.MAX_UPLOAD_LIMIT,imagePreviewHeight:117,filePosterHeight:117,"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:"image/png, image/jpeg, image/jpg",url:salla.url.api("upload"),onUploaded:t=>{this.editItemImages=[...this.editItemImages,t.detail],this.hiddenInputs[1].value=this.editItemImages.map((t=>t.url)).join()},onRemoved:t=>{const a=t.detail;a&&(this.editItemImages=this.editItemImages.filter((t=>t.id!==a)),this.hiddenInputs[1].value=this.editItemImages.map((t=>t.url)).join())},labelIdle:this.getFilepondPlaceholder()}),s("input",{type:"hidden",name:"images",value:this.editItemImages.map((t=>t.url)).join(","),ref:t=>this.hiddenInputs[1]=t}),this.renderUploadedImagesCount(this.editItem.product.id)))):null,s("div",{class:"s-rating-modal-footer s-rating-modal-footer-end"},s("salla-button",{"loader-position":"center",onClick:()=>this.editReview()},this.editReviewLabel))))}render(){return this.deleteMode?s(i,{class:"s-rating-modal"},this.getDeleteModal()):this.editMode?s(i,{class:"s-rating-modal"},this.getEditModal()):this.defaultMode?s(i,{class:"s-rating-modal"},s("salla-modal",{class:"s-rating-modal-wrap",onModalVisibilityChanged:t=>this.resetData(t),isLoading:!0,width:"md",ref:t=>this.modal=t},s("div",{slot:"loading"},s("div",{class:"s-rating-modal-skeleton"},s("salla-skeleton",{type:"circle",height:"80px",width:"80px"}),s("salla-skeleton",{height:"15px",width:"60%"}),s("salla-skeleton",{height:"10px",width:"30%"}),s("div",{class:"s-rating-modal-skeleton-stars"},[...Array(5)].map((t=>s("div",{key:t,innerHTML:r})))),s("salla-skeleton",{height:"100px",width:"100%"}),s("div",{class:"s-rating-modal-skeleton-footer"},s("salla-skeleton",{height:"40px",width:"30%"})))),!this.hasError&&this.order?[s("div",{class:"s-rating-modal-wrapper",ref:t=>this.body=t},this.isTestimonialsEnabled()?s("div",{class:"rating-outer-form s-rating-modal-step-wrap s-rating-modal-step s-rating-modal-hidden","data-type":"store"},s("div",{class:"s-rating-modal-rounded-icon"},s("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"})),s("h2",{class:"s-rating-modal-title"},salla.lang.get("pages.rating.rate_the_store")),s("div",{class:"s-rating-modal-stars-company"},s("salla-rating-stars",{withLabel:!0,size:"large"})),s("textarea",{name:"comment",class:"s-rating-modal-comment",placeholder:salla.lang.get("pages.rating.write_store_rate")}),s("small",{class:"s-rating-modal-validation-msg"})):"",this.isProductsEnabled()&&this.getRateableProducts().map(((t,a)=>this.renderProductStep(t,a))),this.isShippingEnabled()&&this.order.shipping?.company?s("div",{class:"rating-outer-form s-rating-modal-step-wrap s-rating-modal-step s-rating-modal-hidden","data-type":"shipping"},s("input",{type:"hidden",name:"shipping_company_id",value:this.order.shipping.company.id}),this.order.shipping.company.logo?s("div",{class:"s-rating-modal-rounded-icon"},s("img",{src:this.order.shipping.company.logo,class:"s-rating-modal-shipping-logo",alt:this.order.shipping.company.name})):s("span",{class:"s-rating-modal-icon",innerHTML:n}),s("div",{class:"s-rating-modal-title"}," ",`${salla.lang.get("pages.rating.rate_shipping")} ${this.order.shipping.company.name}`),s("div",{class:"s-rating-modal-stars-company"},s("salla-rating-stars",{withLabel:!0,size:"large"})),s("textarea",{name:"comment",class:"s-rating-modal-comment",placeholder:salla.lang.get("pages.rating.write_shipping_rate")}),s("small",{class:"s-rating-modal-validation-msg"})):"",s("div",{class:"s-rating-modal-thanks s-rating-modal-hidden",ref:t=>this.thanksTab=t},s("span",{class:"s-rating-modal-icon",innerHTML:o}),s("h3",{class:"s-rating-modal-thanks-title"},salla.lang.get("pages.rating.thanks")),s("div",{class:"s-rating-modal-thanks-msg",innerHTML:this.order.thanks_message}),s("time",{class:"s-rating-modal-thanks-time",ref:t=>this.thanksTime=t}))),this.allowContactSupport&&this.showContactWidget&&(salla.config.get("store.contacts.whatsapp")||salla.config.get("store.contacts.email"))?s("div",{class:"s-rating-modal-contact"},s("p",null,this.contactUsLabel),s("div",{class:"s-rating-modal-contact-icons"},salla.config.get("store.contacts.whatsapp")&&s("span",{onClick:()=>this.handleSendWhatsApp(),innerHTML:h}),salla.config.get("store.contacts.email")&&s("span",{onClick:()=>this.handleSendEmail(),innerHTML:g}))):"",s("div",{class:"s-rating-modal-footer"},s("button",{ref: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?s("ul",{class:"s-rating-modal-dots"},[...Array(this.stepsCount)].map(((t,a)=>s("li",{key:a,class:"s-rating-modal-bg-gray s-rating-modal-step-dot"})))):"",s("salla-button",{"loader-position":"center",ref:t=>this.nextBtn=t,onClick:()=>this.submit()},salla.lang.get("common.elements.next")))]:s("salla-placeholder",{alignment:"center"}))):void 0}async componentWillLoad(){await salla.onReady(),this.syncStoreSettings()}componentDidRender(){this.scheduleWizardSetup&&this.defaultMode&&this.order&&(this.scheduleWizardSetup=!1,requestAnimationFrame((()=>this.handleWizard())))}disconnectedCallback(){this.clearThanksCountdown()}get host(){return e(this)}};m.style=".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-rating-row-main{margin-bottom:0.35rem;padding:0.5rem 0.6rem;border:1px solid #d1d5db;border-radius:0.45rem;background:transparent}.s-rating-modal-product-factor-name{color:#5b6470;font-size:0.9rem;line-height:1.25}.s-rating-modal-product-rating-row-main .s-rating-modal-product-factor-name{font-size:1rem;color:#5b6470}.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}.s-rating-modal-uploader.is-opened{height:auto !important;opacity:1 !important;overflow:visible !important;pointer-events:auto !important;margin-bottom:1rem}";export{m 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 s,H as a,a as i}from"./p-BM5d07q2.js";import{S as r}from"./p-D4oPi1Ov.js";import{H as e}from"./p-XnA1YTjA.js";import"./p-CgtvEd63.js";var c='\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>heart</title>\n<path d="M23.333 2.267c-3.547 0-5.779 1.605-7.333 3.061-1.555-1.456-3.787-3.061-7.333-3.061-5.955 0-8.667 5.045-8.667 9.733 0 8.503 10.147 14.735 15.513 16.841 0.156 0.061 0.321 0.092 0.487 0.092s0.331-0.031 0.487-0.092c5.367-2.107 15.513-8.339 15.513-16.841 0-4.688-2.712-9.733-8.667-9.733zM16 26.161c-5.537-2.309-13.333-7.799-13.333-14.161 0-3.517 1.856-7.067 6-7.067 2.983 0 4.656 1.451 6.384 3.203 0.5 0.508 1.399 0.508 1.899 0 1.728-1.752 3.401-3.203 6.384-3.203 4.144 0 6 3.549 6 7.067 0 6.363-7.796 11.852-13.333 14.161z"></path>\n</svg>\n';const o=class{constructor(s){if(t(this,s),salla.onReady((()=>{this.fitImageHeight=salla.config.get("store.settings.product.fit_type"),salla.wishlist.event.onAdded(((t,s)=>this.toggleFavoriteIcon(!0,s))),salla.wishlist.event.onRemoved(((t,s)=>this.toggleFavoriteIcon(!1,s))),this.placeholder=salla.url.asset(salla.config.get("theme.settings.placeholder"))})),salla.lang.onLoaded((()=>{this.remained=salla.lang.get("pages.products.remained"),this.donationAmount=salla.lang.get("pages.products.donation_amount"),this.startingPrice=salla.lang.get("pages.products.starting_price"),this.addToCart=salla.lang.get("pages.cart.add_to_cart"),this.outOfStock=salla.lang.get("pages.products.out_of_stock")})),this.product)try{this.productData="object"==typeof this.product?this.product:JSON.parse(this.product)}catch(t){salla.log("Bad json passed via product prop")}}initCircleBar(){let t=this.productData.quantity/(this.productData.quantity>100?2*this.productData.quantity:100)*100;this.pie.querySelector(".s-product-card-content-pie-svg-bar").style.strokeDashoffset=100-t}toggleFavoriteIcon(t=!0,s=null){s&&s!==this.productData.id||this.wishlistBtn?.classList.toggle("s-product-card-wishlist-added",t)}isInWishlist(){return salla.storage.get("salla::wishlist",[]).includes(this.productData?.id)}async handleWishlistClick(){const t=this.isInWishlist();this.toggleFavoriteIcon(!t);try{await salla.wishlist.toggle(this.productData.id)}catch{this.toggleFavoriteIcon(t)}}formatDate(t){let s=new Date(t);return`${s.getFullYear()}-${s.getMonth()+1}-${s.getDate()}`}getProductBadge(){return this.productData.promotion_title?s("div",{class:"s-product-card-promotion-title"},this.productData.promotion_title):this.showQuantity&&this.productData?.quantity?s("div",{class:"s-product-card-quantity"},this.remained," ",salla.helpers.number(this.productData?.quantity)):this.showQuantity&&this.productData?.is_out_of_stock?s("div",{class:"s-product-card-out-badge"},this.outOfStock):""}getPriceFormat(t){return t&&0!=t?salla.money(t):salla.config.get("store.settings.product.show_price_as_dash")?"-":""}getProductPrice(){return this.productData.is_on_sale?s("div",{class:"s-product-card-sale-price"},s("h4",{innerHTML:this.getPriceFormat(this.productData.sale_price)}),s("span",{innerHTML:this.getPriceFormat(this.productData?.regular_price)})):this.productData.starting_price?s("div",{class:"s-product-card-starting-price"},s("p",null,this.startingPrice),s("h4",{innerHTML:this.getPriceFormat(this.productData?.starting_price)})):s("h4",{class:"s-product-card-price",innerHTML:this.getPriceFormat(this.productData?.price)})}render(){const t={"s-product-card-entry":!0,"s-product-card-vertical":!this.horizontal&&!this.fullImage&&!this.minimal,"s-product-card-horizontal":this.horizontal&&!this.fullImage&&!this.minimal,"s-product-card-fit-height":this.fitImageHeight&&!this.isSpecial&&!this.fullImage&&!this.minimal,"s-product-card-special":this.isSpecial,"s-product-card-full-image":this.fullImage,"s-product-card-minimal":this.minimal,"s-product-card-compact":this.compact,"s-product-card-donation":this.productData?.donation,"s-product-card-shadow":this.shadowOnHover,"s-product-card-out-of-stock":this.productData?.is_out_of_stock},i=this.productData?.url?{href:this.productData.url,title:`Learn more about ${this.productData?.name}`}:{};return s(a,{key:"c5a6d2bc2fcf23da1a41ab8b19b2e981fb111e30",id:`product-${this.productData?.id}`,class:t},s("div",{key:"e8d5105e4dbe367c612d62ef1dd6c95d04f440b0",class:this.fullImage?"s-product-card-image-full":"s-product-card-image"},s("a",{key:"8714997fcb48ef0eaabdf0a52cb775514e53db56",...i},s("img",{key:"eebd3c1dde0894037a7723c46e2f07f6a5aef939",class:`s-product-card-image-${salla.url.is_placeholder(this.productData?.image?.url)?"contain":this.fitImageHeight?this.fitImageHeight:"cover"} lazy`,src:this.placeholder,alt:this.productData?.image?.alt||this.productData?.name,"data-src":this.productData?.image?.url||this.productData?.thumbnail}),this.fullImage||this.minimal?"":this.getProductBadge()),this.fullImage&&s("a",{key:"72e240315320e976dcad8d3f027711b9c1d7bcf1",...i,class:"s-product-card-overlay"}),this.horizontal||this.fullImage?"":s("salla-button",{shape:"icon",fill:"none",color:"light",loading:!1,"aria-label":"Add or remove to wishlist",ref:t=>this.wishlistBtn=t,class:"s-product-card-wishlist-btn animated",onClick:()=>this.handleWishlistClick()},s("span",{innerHTML:c}))),s("div",{key:"2f0186ffc102488824cd7c346f4e07439474fc26",class:"s-product-card-content"},this.isSpecial&&this.productData?.quantity?s("div",{class:"s-product-card-content-pie",ref:t=>this.pie=t},s("span",null,s("b",null,salla.helpers.number(this.productData?.quantity)),this.remained),s("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"-2 -1 36 34",class:"s-product-card-content-pie-svg"},s("circle",{cx:"16",cy:"16",r:"15.9155",class:"s-product-card-content-pie-svg-base"}),s("circle",{cx:"16",cy:"16",r:"15.9155",class:"s-product-card-content-pie-svg-bar"}))):"",s("div",{key:"d50ea0726d25bf3b551050e906fc615bc682e694",class:{"s-product-card-content-main":!0,"s-product-card-content-extra-padding":this.isSpecial}},s("h3",{key:"e4f39676d661a01d1aa6352cac7be6e764fa8687",class:"s-product-card-content-title"},s("a",{key:"0aacc2e00a0db730d1e803da34336085082df75d",...i},this.productData?.name)),this.productData?.subtitle&&!this.minimal?s("p",{class:"s-product-card-content-subtitle"},this.productData?.subtitle):""),!this.productData?.donation||this.minimal||this.fullImage?"":[s("salla-progress-bar",{donation:this.productData?.donation}),s("div",{class:"s-product-card-donation-input"},this.productData?.donation?.can_donate?[s("label",{htmlFor:"donation-amount"},this.donationAmount," ",s("span",null,"*")),s("input",{type:"text",onInput:t=>{salla.helpers.inputDigitsOnly(t.target),this.addBtn.donatingAmount=t.target.value},id:"donation-amount",name:"donating_amount",class:"s-form-control",placeholder:this.donationAmount})]:"")],s("div",{key:"445a1e16fee6ebb6ab5012aca324d3845991d13e",class:{"s-product-card-content-sub":!0,"s-product-card-content-extra-padding":this.isSpecial}},this.getProductPrice(),this.productData?.rating?.stars&&!this.minimal?s("div",{class:"s-product-card-rating"},s("span",{innerHTML:r}),s("span",null,this.productData.rating.stars)):""),this.isSpecial&&this.productData.discount_ends?s("salla-count-down",{date:this.formatDate(this.productData.discount_ends),"end-of-day":!0,boxed:!0,labeled:!0}):"",this.hideAddBtn||this.compact?"":s("div",{class:"s-product-card-content-footer"},s("salla-add-product-button",{fill:"outline",width:"wide",ref:t=>this.addBtn=t,"product-id":this.productData.id,"product-status":this.productData.status,"product-type":this.productData.type},s("slot",{name:"add-to-cart-label"},this.productData.add_to_cart_label)),this.horizontal||this.fullImage?s("salla-button",{shape:"icon",fill:"none",color:"light",loading:!1,ref:t=>this.wishlistBtn=t,"aria-label":"Add or remove to wishlist",class:"s-product-card-wishlist-btn animated",onClick:()=>this.handleWishlistClick(),"data-id":"{{ product.id }}"},s("span",{class:"text-xl",innerHTML:c})):"")),!this.hideAddBtn&&this.compact?s("div",{class:"s-product-card-content-footer"},s("salla-add-product-button",{ref:t=>this.addBtn=t,"product-id":this.productData.id,"product-status":this.productData.status,"product-type":this.productData.type,class:"s-add-product-button-compact"},s("slot",{name:"add-to-cart-label"},this.productData.add_to_cart_label))):"")}componentDidLoad(){document.lazyLoadInstance?.update(this.host.querySelectorAll(".lazy")),this.productData?.quantity&&this.isSpecial&&this.initCircleBar(),!salla.config.isGuest()&&salla.storage.get("salla::wishlist",[]).includes(this.productData?.id)&&this.toggleFavoriteIcon()}static get assetsDirs(){return["assets"]}get host(){return i(this)}};o.style='.s-product-card-image::before{font-family:"sallaicons";content:"\\ec1f" !important}.s-product-card-content-pie-svg circle{transition:stroke-dashoffset 1s linear;-webkit-transition:stroke-dashoffset 1s linear;-moz-transition:stroke-dashoffset 1s linear;-ms-transition:stroke-dashoffset 1s linear;-o-transition:stroke-dashoffset 1s linear;stroke:#E8EDF2;stroke-width:2px;stroke-linecap:round;fill:none}.s-product-card-content-pie-svg-bar{stroke:var(--color-primary) !important;stroke-dasharray:100 100;stroke-dashoffset:100}';const d=class{constructor(s){t(this,s),this.productCardComponent="custom-salla-product-card",this.apiUrl="",this.onWishlistStorageSynced=()=>e.syncWishlistIcons(this.host,`${this.productCardComponent}, salla-product-card`)}componentWillLoad(){return salla.onReady().then((async()=>{if(this.includes=e.parseJson(this.includes||this.host.getAttribute("includes")),Array.isArray(this.includes)||(this.includes=null),e.setIncludes(this.includes),this.sourceValueIsValid=!(!this.getSourceValue()&&!this.isSourceWithoutValue()),this.sourceValueIsValid){if(this.hasCustomComponent=!!customElements.get(this.productCardComponent),"json"===this.source)return this.productsData=await this.applyBeforeAppendItems(this.getSourceValue()),void(this.isReady=!0);if("related"!=this.getSource()||salla.config.get("store.settings.product.related_products_enabled"))return"related"===this.getSource()&&salla.config.get("store.settings.product.related_products_enabled")&&"random"===salla.config.get("store.settings.product.product-recommendation-type")&&salla.config.get("store.features")?.includes("ai-driven-personalized-product")&&(this.sourceValue=await salla.recommendations.similarProducts(this.sourceValue,{limit:this.limit||12}).extractProductIds(),this.source="selected"),salla.api.withoutNotifier((()=>salla.product.api.fetch({source:e.getApiSource(this.getSource()),source_value:this.getSourceValue(),limit:this.limit}))).then((t=>e.injectExtraFieldsToResponse(t))).then((async t=>{this.productsData=await this.applyBeforeAppendItems(t.data),this.isReady=!0,t.source=this.getSource(),t.sourceValue=this.getSourceValue(),salla.event.emit("salla-products-slider::products.fetched",this.productsData)}));this.isReady=!1}else salla.logger.warn(`source-value prop is required for source [${this.getSource()}]`)}))}componentDidRender(){let t=0;const s=setInterval((()=>{this.host.querySelectorAll('[loading="lazy"]')?.forEach((t=>t.removeAttribute("loading"))),t++,t>=10&&clearInterval(s)}),1e3)}connectedCallback(){salla.event.on("wishlist::storage.synced",this.onWishlistStorageSynced)}disconnectedCallback(){salla.event.off("wishlist::storage.synced",this.onWishlistStorageSynced)}async componentDidLoad(){await Salla.hooks.registerComponent("salla-products-slider",this)}onReadyChanged(t){t&&salla.wishlist.api.syncStorageFromServer()}isSourceWithoutValue(){return["offers","latest","sales","top-rated"].includes(this.getSource())}getItemHTML(t){const a="landing-page"===this.getSource();a&&(t.url="");const i=a?void 0:()=>{e.saveProductSource(this.getSource())};if(this.hasCustomComponent&&"custom-salla-product-card"==this.productCardComponent.toLowerCase())return s("div",{class:"s-products-slider-card",onClick:i},s("custom-salla-product-card",{product:t,source:this.getSource(),"source-value":this.getSourceValue()}));if(this.hasCustomComponent){const a=document.createElement(this.productCardComponent);return a.setAttribute("product",JSON.stringify(t)),a.setAttribute("source",this.getSource()),a.setAttribute("source-value",this.getSourceValue()),s("div",{class:"s-products-slider-card",onClick:i,innerHTML:a.outerHTML})}return s("div",{class:"s-products-slider-card",onClick:i},s("salla-product-card",{"show-quantity":a,"hide-add-btn":a,"shadow-on-hover":!0,product:t}))}canRender(){return this.sourceValueIsValid&&this.isReady}getSource(){return e.getProductsSource(this.source)}getSourceValue(){return e.getProductsSourceValue(this.source,this.sourceValue)}async applyBeforeAppendItems(t){const s=Array.isArray(t)?t:[],a={component:this,items:s};try{return await salla.hooks.call("salla-products-slider","beforeAppendItems",a),Array.isArray(a.items)?a.items:s}catch{return s}}render(){if(this.canRender())return s(a,{class:"s-products-slider-wrapper"},s("salla-slider",{class:"s-products-slider-slider",id:this.sliderId||`s-products-slider-${Math.random().toString(36).substr(2,9)}`,...this.sliderProps||{},"auto-play":this.autoplay,type:"carousel","block-title":this.blockTitle,"block-subTitle":this.subTitle,"display-all-url":this.displayAllUrl,sliderConfig:this.sliderConfig?this.sliderConfig:null},s("div",{slot:"items"},this.productsData?.map((t=>this.getItemHTML(t))))))}get host(){return i(this)}static get watchers(){return{isReady:["onReadyChanged"]}}};d.style="";export{o as salla_product_card,d as salla_products_slider}
|
|
4
|
+
import{r as t,h as s,H as a,a as i}from"./p-Dm54yhRt.js";import{S as r}from"./p-D4oPi1Ov.js";import{H as e}from"./p-XnA1YTjA.js";import"./p-CgtvEd63.js";var c='\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>heart</title>\n<path d="M23.333 2.267c-3.547 0-5.779 1.605-7.333 3.061-1.555-1.456-3.787-3.061-7.333-3.061-5.955 0-8.667 5.045-8.667 9.733 0 8.503 10.147 14.735 15.513 16.841 0.156 0.061 0.321 0.092 0.487 0.092s0.331-0.031 0.487-0.092c5.367-2.107 15.513-8.339 15.513-16.841 0-4.688-2.712-9.733-8.667-9.733zM16 26.161c-5.537-2.309-13.333-7.799-13.333-14.161 0-3.517 1.856-7.067 6-7.067 2.983 0 4.656 1.451 6.384 3.203 0.5 0.508 1.399 0.508 1.899 0 1.728-1.752 3.401-3.203 6.384-3.203 4.144 0 6 3.549 6 7.067 0 6.363-7.796 11.852-13.333 14.161z"></path>\n</svg>\n';const o=class{constructor(s){if(t(this,s),salla.onReady((()=>{this.fitImageHeight=salla.config.get("store.settings.product.fit_type"),salla.wishlist.event.onAdded(((t,s)=>this.toggleFavoriteIcon(!0,s))),salla.wishlist.event.onRemoved(((t,s)=>this.toggleFavoriteIcon(!1,s))),this.placeholder=salla.url.asset(salla.config.get("theme.settings.placeholder"))})),salla.lang.onLoaded((()=>{this.remained=salla.lang.get("pages.products.remained"),this.donationAmount=salla.lang.get("pages.products.donation_amount"),this.startingPrice=salla.lang.get("pages.products.starting_price"),this.addToCart=salla.lang.get("pages.cart.add_to_cart"),this.outOfStock=salla.lang.get("pages.products.out_of_stock")})),this.product)try{this.productData="object"==typeof this.product?this.product:JSON.parse(this.product)}catch(t){salla.log("Bad json passed via product prop")}}initCircleBar(){let t=this.productData.quantity/(this.productData.quantity>100?2*this.productData.quantity:100)*100;this.pie.querySelector(".s-product-card-content-pie-svg-bar").style.strokeDashoffset=100-t}toggleFavoriteIcon(t=!0,s=null){s&&s!==this.productData.id||this.wishlistBtn?.classList.toggle("s-product-card-wishlist-added",t)}isInWishlist(){return salla.storage.get("salla::wishlist",[]).includes(this.productData?.id)}async handleWishlistClick(){const t=this.isInWishlist();this.toggleFavoriteIcon(!t);try{await salla.wishlist.toggle(this.productData.id)}catch{this.toggleFavoriteIcon(t)}}formatDate(t){let s=new Date(t);return`${s.getFullYear()}-${s.getMonth()+1}-${s.getDate()}`}getProductBadge(){return this.productData.promotion_title?s("div",{class:"s-product-card-promotion-title"},this.productData.promotion_title):this.showQuantity&&this.productData?.quantity?s("div",{class:"s-product-card-quantity"},this.remained," ",salla.helpers.number(this.productData?.quantity)):this.showQuantity&&this.productData?.is_out_of_stock?s("div",{class:"s-product-card-out-badge"},this.outOfStock):""}getPriceFormat(t){return t&&0!=t?salla.money(t):salla.config.get("store.settings.product.show_price_as_dash")?"-":""}getProductPrice(){return this.productData.is_on_sale?s("div",{class:"s-product-card-sale-price"},s("h4",{innerHTML:this.getPriceFormat(this.productData.sale_price)}),s("span",{innerHTML:this.getPriceFormat(this.productData?.regular_price)})):this.productData.starting_price?s("div",{class:"s-product-card-starting-price"},s("p",null,this.startingPrice),s("h4",{innerHTML:this.getPriceFormat(this.productData?.starting_price)})):s("h4",{class:"s-product-card-price",innerHTML:this.getPriceFormat(this.productData?.price)})}render(){const t={"s-product-card-entry":!0,"s-product-card-vertical":!this.horizontal&&!this.fullImage&&!this.minimal,"s-product-card-horizontal":this.horizontal&&!this.fullImage&&!this.minimal,"s-product-card-fit-height":this.fitImageHeight&&!this.isSpecial&&!this.fullImage&&!this.minimal,"s-product-card-special":this.isSpecial,"s-product-card-full-image":this.fullImage,"s-product-card-minimal":this.minimal,"s-product-card-compact":this.compact,"s-product-card-donation":this.productData?.donation,"s-product-card-shadow":this.shadowOnHover,"s-product-card-out-of-stock":this.productData?.is_out_of_stock},i=this.productData?.url?{href:this.productData.url,title:`Learn more about ${this.productData?.name}`}:{};return s(a,{key:"c5a6d2bc2fcf23da1a41ab8b19b2e981fb111e30",id:`product-${this.productData?.id}`,class:t},s("div",{key:"e8d5105e4dbe367c612d62ef1dd6c95d04f440b0",class:this.fullImage?"s-product-card-image-full":"s-product-card-image"},s("a",{key:"8714997fcb48ef0eaabdf0a52cb775514e53db56",...i},s("img",{key:"eebd3c1dde0894037a7723c46e2f07f6a5aef939",class:`s-product-card-image-${salla.url.is_placeholder(this.productData?.image?.url)?"contain":this.fitImageHeight?this.fitImageHeight:"cover"} lazy`,src:this.placeholder,alt:this.productData?.image?.alt||this.productData?.name,"data-src":this.productData?.image?.url||this.productData?.thumbnail}),this.fullImage||this.minimal?"":this.getProductBadge()),this.fullImage&&s("a",{key:"72e240315320e976dcad8d3f027711b9c1d7bcf1",...i,class:"s-product-card-overlay"}),this.horizontal||this.fullImage?"":s("salla-button",{shape:"icon",fill:"none",color:"light",loading:!1,"aria-label":"Add or remove to wishlist",ref:t=>this.wishlistBtn=t,class:"s-product-card-wishlist-btn animated",onClick:()=>this.handleWishlistClick()},s("span",{innerHTML:c}))),s("div",{key:"2f0186ffc102488824cd7c346f4e07439474fc26",class:"s-product-card-content"},this.isSpecial&&this.productData?.quantity?s("div",{class:"s-product-card-content-pie",ref:t=>this.pie=t},s("span",null,s("b",null,salla.helpers.number(this.productData?.quantity)),this.remained),s("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"-2 -1 36 34",class:"s-product-card-content-pie-svg"},s("circle",{cx:"16",cy:"16",r:"15.9155",class:"s-product-card-content-pie-svg-base"}),s("circle",{cx:"16",cy:"16",r:"15.9155",class:"s-product-card-content-pie-svg-bar"}))):"",s("div",{key:"d50ea0726d25bf3b551050e906fc615bc682e694",class:{"s-product-card-content-main":!0,"s-product-card-content-extra-padding":this.isSpecial}},s("h3",{key:"e4f39676d661a01d1aa6352cac7be6e764fa8687",class:"s-product-card-content-title"},s("a",{key:"0aacc2e00a0db730d1e803da34336085082df75d",...i},this.productData?.name)),this.productData?.subtitle&&!this.minimal?s("p",{class:"s-product-card-content-subtitle"},this.productData?.subtitle):""),!this.productData?.donation||this.minimal||this.fullImage?"":[s("salla-progress-bar",{donation:this.productData?.donation}),s("div",{class:"s-product-card-donation-input"},this.productData?.donation?.can_donate?[s("label",{htmlFor:"donation-amount"},this.donationAmount," ",s("span",null,"*")),s("input",{type:"text",onInput:t=>{salla.helpers.inputDigitsOnly(t.target),this.addBtn.donatingAmount=t.target.value},id:"donation-amount",name:"donating_amount",class:"s-form-control",placeholder:this.donationAmount})]:"")],s("div",{key:"445a1e16fee6ebb6ab5012aca324d3845991d13e",class:{"s-product-card-content-sub":!0,"s-product-card-content-extra-padding":this.isSpecial}},this.getProductPrice(),this.productData?.rating?.stars&&!this.minimal?s("div",{class:"s-product-card-rating"},s("span",{innerHTML:r}),s("span",null,this.productData.rating.stars)):""),this.isSpecial&&this.productData.discount_ends?s("salla-count-down",{date:this.formatDate(this.productData.discount_ends),"end-of-day":!0,boxed:!0,labeled:!0}):"",this.hideAddBtn||this.compact?"":s("div",{class:"s-product-card-content-footer"},s("salla-add-product-button",{fill:"outline",width:"wide",ref:t=>this.addBtn=t,"product-id":this.productData.id,"product-status":this.productData.status,"product-type":this.productData.type},s("slot",{name:"add-to-cart-label"},this.productData.add_to_cart_label)),this.horizontal||this.fullImage?s("salla-button",{shape:"icon",fill:"none",color:"light",loading:!1,ref:t=>this.wishlistBtn=t,"aria-label":"Add or remove to wishlist",class:"s-product-card-wishlist-btn animated",onClick:()=>this.handleWishlistClick(),"data-id":"{{ product.id }}"},s("span",{class:"text-xl",innerHTML:c})):"")),!this.hideAddBtn&&this.compact?s("div",{class:"s-product-card-content-footer"},s("salla-add-product-button",{ref:t=>this.addBtn=t,"product-id":this.productData.id,"product-status":this.productData.status,"product-type":this.productData.type,class:"s-add-product-button-compact"},s("slot",{name:"add-to-cart-label"},this.productData.add_to_cart_label))):"")}componentDidLoad(){document.lazyLoadInstance?.update(this.host.querySelectorAll(".lazy")),this.productData?.quantity&&this.isSpecial&&this.initCircleBar(),!salla.config.isGuest()&&salla.storage.get("salla::wishlist",[]).includes(this.productData?.id)&&this.toggleFavoriteIcon()}static get assetsDirs(){return["assets"]}get host(){return i(this)}};o.style='.s-product-card-image::before{font-family:"sallaicons";content:"\\ec1f" !important}.s-product-card-content-pie-svg circle{transition:stroke-dashoffset 1s linear;-webkit-transition:stroke-dashoffset 1s linear;-moz-transition:stroke-dashoffset 1s linear;-ms-transition:stroke-dashoffset 1s linear;-o-transition:stroke-dashoffset 1s linear;stroke:#E8EDF2;stroke-width:2px;stroke-linecap:round;fill:none}.s-product-card-content-pie-svg-bar{stroke:var(--color-primary) !important;stroke-dasharray:100 100;stroke-dashoffset:100}';const d=class{constructor(s){t(this,s),this.productCardComponent="custom-salla-product-card",this.apiUrl="",this.onWishlistStorageSynced=()=>e.syncWishlistIcons(this.host,`${this.productCardComponent}, salla-product-card`)}componentWillLoad(){return salla.onReady().then((async()=>{if(this.includes=e.parseJson(this.includes||this.host.getAttribute("includes")),Array.isArray(this.includes)||(this.includes=null),e.setIncludes(this.includes),this.sourceValueIsValid=!(!this.getSourceValue()&&!this.isSourceWithoutValue()),this.sourceValueIsValid){if(this.hasCustomComponent=!!customElements.get(this.productCardComponent),"json"===this.source)return this.productsData=await this.applyBeforeAppendItems(this.getSourceValue()),void(this.isReady=!0);if("related"!=this.getSource()||salla.config.get("store.settings.product.related_products_enabled"))return"related"===this.getSource()&&salla.config.get("store.settings.product.related_products_enabled")&&"random"===salla.config.get("store.settings.product.product-recommendation-type")&&salla.config.get("store.features")?.includes("ai-driven-personalized-product")&&(this.sourceValue=await salla.recommendations.similarProducts(this.sourceValue,{limit:this.limit||12}).extractProductIds(),this.source="selected"),salla.api.withoutNotifier((()=>salla.product.api.fetch({source:e.getApiSource(this.getSource()),source_value:this.getSourceValue(),limit:this.limit}))).then((t=>e.injectExtraFieldsToResponse(t))).then((async t=>{this.productsData=await this.applyBeforeAppendItems(t.data),this.isReady=!0,t.source=this.getSource(),t.sourceValue=this.getSourceValue(),salla.event.emit("salla-products-slider::products.fetched",this.productsData)}));this.isReady=!1}else salla.logger.warn(`source-value prop is required for source [${this.getSource()}]`)}))}componentDidRender(){let t=0;const s=setInterval((()=>{this.host.querySelectorAll('[loading="lazy"]')?.forEach((t=>t.removeAttribute("loading"))),t++,t>=10&&clearInterval(s)}),1e3)}connectedCallback(){salla.event.on("wishlist::storage.synced",this.onWishlistStorageSynced)}disconnectedCallback(){salla.event.off("wishlist::storage.synced",this.onWishlistStorageSynced)}async componentDidLoad(){await Salla.hooks.registerComponent("salla-products-slider",this)}onReadyChanged(t){t&&salla.wishlist.api.syncStorageFromServer()}isSourceWithoutValue(){return["offers","latest","sales","top-rated"].includes(this.getSource())}getItemHTML(t){const a="landing-page"===this.getSource();a&&(t.url="");const i=a?void 0:()=>{e.saveProductSource(this.getSource())};if(this.hasCustomComponent&&"custom-salla-product-card"==this.productCardComponent.toLowerCase())return s("div",{class:"s-products-slider-card",onClick:i},s("custom-salla-product-card",{product:t,source:this.getSource(),"source-value":this.getSourceValue()}));if(this.hasCustomComponent){const a=document.createElement(this.productCardComponent);return a.setAttribute("product",JSON.stringify(t)),a.setAttribute("source",this.getSource()),a.setAttribute("source-value",this.getSourceValue()),s("div",{class:"s-products-slider-card",onClick:i,innerHTML:a.outerHTML})}return s("div",{class:"s-products-slider-card",onClick:i},s("salla-product-card",{"show-quantity":a,"hide-add-btn":a,"shadow-on-hover":!0,product:t}))}canRender(){return this.sourceValueIsValid&&this.isReady}getSource(){return e.getProductsSource(this.source)}getSourceValue(){return e.getProductsSourceValue(this.source,this.sourceValue)}async applyBeforeAppendItems(t){const s=Array.isArray(t)?t:[],a={component:this,items:s};try{return await salla.hooks.call("salla-products-slider","beforeAppendItems",a),Array.isArray(a.items)?a.items:s}catch{return s}}render(){if(this.canRender())return s(a,{class:"s-products-slider-wrapper"},s("salla-slider",{class:"s-products-slider-slider",id:this.sliderId||`s-products-slider-${Math.random().toString(36).substr(2,9)}`,...this.sliderProps||{},"auto-play":this.autoplay,type:"carousel","block-title":this.blockTitle,"block-subTitle":this.subTitle,"display-all-url":this.displayAllUrl,sliderConfig:this.sliderConfig?this.sliderConfig:null},s("div",{slot:"items"},this.productsData?.map((t=>this.getItemHTML(t))))))}get host(){return i(this)}static get watchers(){return{isReady:["onReadyChanged"]}}};d.style="";export{o as salla_product_card,d as salla_products_slider}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as e,c as t,h as s,H as i}from"./p-
|
|
4
|
+
import{r as e,c as t,h as s,H as i}from"./p-Dm54yhRt.js";import{a}from"./p-BedNk7k1.js";import{a as l}from"./p-B9q7ymSg.js";const r=class{constructor(s){e(this,s),this.changed=t(this,"changed"),this.min=0,this.max=1e4,this.moreThanLabel="أكثر من",this.lessThanLabel="أقل من",this.toLabel="الى",this.fromLabel="من",this.typing=!1,this.isMin=!1,this.isRTL=salla.config.get("theme.is_rtl",!0),this.filterValues=[]}connectedCallback(){if(this.filtersData&&this.filtersData?.price&&(this.minPrice=this.filtersData.price.min,this.maxPrice=this.filtersData.price.max),salla.lang.onLoaded((()=>{this.moreThanLabel=salla.lang.getWithDefault("common.elements.more_than",this.moreThanLabel),this.lessThanLabel=salla.lang.getWithDefault("common.elements.less_than",this.lessThanLabel),this.toLabel=salla.lang.getWithDefault("common.elements.to",this.toLabel),this.fromLabel=salla.lang.getWithDefault("common.elements.from",this.fromLabel)})),1==this.option.values.length)return;if(this.option.values.length<=5)return void(this.filterValues=this.option.values);const e=Math.ceil(this.option.values.length/5);for(let t=0;t<this.option.values.length;t+=e)this.filterValues.push(this.option.values.slice(t,t+e).reduce(((e,t)=>(e.to=t.to,e.count+=t.count,e))))}async reset(){this.minInput.value=null,this.maxInput.value=null,this.minPrice=null,this.maxPrice=null}getPriceLabel(e){return isNaN(e.from)||e.from<1?`${this.lessThanLabel} ${salla.money(e.to)}`:isNaN(e.to)||e.to<1?`${this.moreThanLabel} ${salla.money(e.from)}`:`${salla.money(e.from)} ${this.toLabel} ${salla.money(e.to)}`}minInputValidation(e){e&&(e>this.max||this.maxPrice&&e>this.maxPrice)||(e<this.min?this.minPrice=this.min:e&&(this.minPrice=e))}maxInputValidation(e){e&&(e<this.min||this.minPrice&&e<this.minPrice)||e>this.max&&(this.maxPrice=this.max)}async changedEventHandler(e){salla.helpers.inputDigitsOnly(this.minInput),salla.helpers.inputDigitsOnly(this.maxInput);const t=this.minPrice?1*+this.minPrice:null,s=this.maxPrice?1*+this.maxPrice:null;this.maxPrice||(this.maxPrice=""),this.isMin?this.minInputValidation(t):(this.minPrice||(this.minPrice=0),this.maxInputValidation(s)),this.isReady&&this.changed.emit({event:e,option:this.option,value:{max:this.maxPrice,min:this.minPrice}})}handleMinMaxPrice(e,t){this.minPrice=t.from,this.maxPrice="*"!==t.to?t.to:"",this.changedEventHandler(e)}isChecked(e){return!(!this.minPrice&&!this.maxPrice)&&(((e.from<1||"*"==e.from)&&0==this.minPrice||e.from==this.minPrice)&&("*"==e.to||!e.to||e.to==this.maxPrice))}handleMinPrice(e){this.isMin=!0;const t=e.target.value;this.minPrice=""===t?0:t}handleMaxPrice(e){this.isMin=!1;const t=e.target.value;this.maxPrice=void 0===t?"":t}render(){return s(i,{key:"dc74966c1d2d9e5626b23db0a80b693fef047f41"},this.filterValues.map(((e,t)=>s("label",{class:"s-filters-label",htmlFor:`${this.option.key}-${t}`,key:t},s("input",{id:`${this.option.key}-${t}`,name:"price",type:"radio",checked:this.isChecked(e),class:"s-filters-radio",onChange:t=>this.handleMinMaxPrice(t,e)}),s("span",{innerHTML:this.getPriceLabel(e)})))),s("div",{key:"b12dad0c27f3fbe9ad8a9c98b9bd1302388b35ef",class:"flex justify-center items-center"},s("div",{key:"e034058e195a94c2434e99c5b30b2e5909daff87",class:"relative max-w-xl w-full"},s("div",{key:"4c59f5a3c8249717c4c6decbcdb63d97343bd871",class:"s-price-range-inputs"},s("div",{key:"65de0733e3ce1ea7b37976f1d077d1f3192056c5",class:"s-price-range-relative"},s("div",{key:"ed842802aff5cd874e708c062aa79e8185d330f3",class:"s-price-range-currency"}," ",salla.config.currency().symbol),s("input",{key:"78d020948e3edc4e53fff976fa8e00b2e6ac6868",type:"number",maxlength:"5",ref:e=>this.minInput=e,onBlur:e=>this.handleMinPrice(e),value:this.minPrice,placeholder:this.fromLabel,class:"s-price-range-number-input"})),s("div",{key:"edfb3dd62b7898d4493a1adefeee20bdb305c89a",class:"s-price-range-gray-text"}," -"),s("div",{key:"f2227f09a344b8cc8c1160c23a6dbc9cd96cb260",class:"s-price-range-relative"},s("div",{key:"e528e7766eb7f6b9e0791116c87374441c73afe6",class:"s-price-range-currency"}," ",salla.config.currency().symbol),s("input",{key:"6dda7a17097ae51c50c3d4aae290ce1b0369dcfa",type:"number",maxlength:"5",ref:e=>this.maxInput=e,onBlur:e=>this.handleMaxPrice(e),value:this.maxPrice,placeholder:this.toLabel,class:"s-price-range-number-input","aria-describedby":"price-currency"})),s("salla-button",{key:"970d39060c565e7dc18e6a2039452a3b3df04082",color:"gray",shape:"icon",size:"small",fill:"outline",onClick:e=>this.changedEventHandler(e)},s("span",{key:"da9b6ed688a64d624eedc3834ad3be47533c9dd5",innerHTML:this.isRTL?a:l}))))))}componentDidLoad(){this.isReady=!0}};r.style=":host{display:block}.rtl .rtl-range-slider,[dir=rtl] .rtl-range-slider{transform:rotateY(180deg)}.rtl .rtl-range-numbers,[dir=rtl] .rtl-range-numbers{flex-direction:row-reverse}.rtl .form-select,.rtl select,[dir=rtl] .form-select,[dir=rtl] select{background-position:left 0.5rem center;padding-right:12px}.rtl .menu-divide li:not(:last-child):after,[dir=rtl] .menu-divide li:not(:last-child):after{left:0;right:auto}input[type=range]::-webkit-slider-thumb{pointer-events:all;width:24px;height:24px;-webkit-appearance:none}[type=checkbox]:checked{background-size:80%}";export{r as salla_price_range}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as t,h as r,H as a}from"./p-
|
|
4
|
+
import{r as t,h as r,H as a}from"./p-Dm54yhRt.js";import{S as s}from"./p-D4oPi1Ov.js";const e=new Map,o=new Map;function i(t){return t?Array.isArray(t)?t:Object.values(t):[]}const n=class{constructor(r){t(this,r),this.loadedFactors=[]}async componentWillLoad(){await salla.onReady(),await this.loadFactors()}async onPropsChange(){await this.loadFactors()}getDisplayFactors(){return this.factors?.length?this.factors:this.loadedFactors}async loadFactors(){if(this.factors?.length)this.loadedFactors=[];else if(this.orderId)try{const t=await async function(t){if(!t)return null;const r=e.get(t);if(r&&Date.now()-r.timestamp<=3e5)return r.data;const a=o.get(t);if(a)return a;const s=(async()=>{try{const r=await salla.api.request(`orders/${t}`,"","get"),a=r?.data??r;return e.set(t,{data:a,timestamp:Date.now()}),a}catch(r){throw e.delete(t),r}finally{o.delete(t)}})();return o.set(t,s),s}(this.orderId);this.loadedFactors=function(t,r,a,s){var e;const o=function(t,r,a,s){return t.find((t=>!(!r||Number(t.id??t.feedback_id)!==Number(r))||!(!s||Number(t.order_item_id)!==Number(s))||!(!a||Number(t.product_id??t.product?.id)!==Number(a))))}((e=t?.rating,e?[...i(e.product),...i(e.products)]:[]),r,a,s);return function(t){if(!t)return[];for(const r of["factor_reviews","review_factors","factors"]){const a=t[r];if(Array.isArray(a)&&a.length)return a}return[]}(o)}(t,this.ratingId,this.productId,this.itemId)}catch(t){console.error("[salla-review-factors-tags] failed to load order rating factors",t),this.loadedFactors=[]}else this.loadedFactors=[]}renderFactorTags(){const t=this.getDisplayFactors();return t.length?r("div",{class:"s-review-factors-tags-factors"},t.map((t=>r("div",{class:"s-review-factors-tags-factor-tag"},r("span",{class:"s-review-factors-tags-factor-name"},t.name),r("span",{class:"s-review-factors-tags-factor-star",innerHTML:s}),r("span",{class:"s-review-factors-tags-factor-rating"},t.rating||""))))):null}render(){return r(a,{key:"b9df42d369cd5a7c66d1275202a883f6dc8ac594",class:"s-review-factors-tags-wrapper"},this.renderFactorTags())}static get watchers(){return{factors:["onPropsChange"],orderId:["onPropsChange"],ratingId:["onPropsChange"],productId:["onPropsChange"],itemId:["onPropsChange"]}}};n.style=":host{display:inline-flex}.s-review-factors-tags-factors{display:flex;flex-wrap:wrap;gap:0.5rem;justify-content:flex-start;margin-bottom:0.6rem}.s-review-factors-tags-factor-tag{display:inline-flex;align-items:center;gap:0.25rem;border-radius:999px;border:1px solid #e8e8e8;background:rgba(255, 255, 255, 0.3);font-size:0.85rem;line-height:1;padding:0.4rem 0.65rem}.s-review-factors-tags-factor-rating{font-weight:600;color:var(--color-primary) !important}.s-review-factors-tags-factor-star{display:inline-flex;width:0.8rem;height:0.8rem;fill:var(--color-primary) !important}.s-review-factors-tags-factor-star svg{width:100%;height:100%}.s-review-factors-tags-factor-name{color:var(--main-text-color) !important;font-weight:unset !important}";export{n as salla_review_factors_tags}
|