@salla.sa/twilight-components 3.0.28 → 3.0.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{Helper-D5nuQnlA.js → Helper-CigI49vP.js} +1 -1
- package/dist/cjs/{filepond-C4YwUSjY.js → filepond-BiMGitQY.js} +1 -1
- package/dist/cjs/{filepond-plugin-file-poster-B-m6bwrO.js → filepond-plugin-file-poster-Ck74ON7P.js} +1 -1
- package/dist/cjs/{filepond-plugin-file-validate-size-CmLAuKK8.js → filepond-plugin-file-validate-size-CVhF1tOl.js} +1 -1
- package/dist/cjs/{filepond-plugin-file-validate-type-HAq2ahg2.js → filepond-plugin-file-validate-type-Dl1QbcFU.js} +1 -1
- package/dist/cjs/{filepond-plugin-image-edit-WPZzSlfF.js → filepond-plugin-image-edit-fNw4v5VI.js} +1 -1
- package/dist/cjs/{filepond-plugin-image-exif-orientation-DwRyC-Iy.js → filepond-plugin-image-exif-orientation-K26RIxgg.js} +1 -1
- package/dist/cjs/{filepond-plugin-image-preview-Bva7TPZg.js → filepond-plugin-image-preview-DUPpLMnJ.js} +1 -1
- package/dist/cjs/{index-CpC602lV.js → index-BC6gcbLd.js} +2 -2
- package/dist/cjs/{intlTelInput-xxeZCkBx.js → intlTelInput-PXq8m_uI.js} +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/salla-accordion-body_2.cjs.entry.js +1 -1
- package/dist/cjs/salla-accordion_6.cjs.entry.js +2 -2
- package/dist/cjs/salla-add-product-button_5.cjs.entry.js +2 -2
- package/dist/cjs/salla-advertisement.cjs.entry.js +1 -1
- package/dist/cjs/salla-alert_2.cjs.entry.js +1 -1
- package/dist/cjs/salla-app-install-alert.cjs.entry.js +1 -1
- package/dist/cjs/salla-applied-filters.cjs.entry.js +2 -2
- package/dist/cjs/salla-apps-icons.cjs.entry.js +1 -1
- package/dist/cjs/salla-attachment-view_9.cjs.entry.js +11 -11
- package/dist/cjs/salla-badge.cjs.entry.js +1 -1
- package/dist/cjs/salla-basket-gap.cjs.entry.js +1 -1
- package/dist/cjs/salla-bullet-delivery_3.cjs.entry.js +1 -1
- package/dist/cjs/salla-cart-coupons.cjs.entry.js +1 -1
- package/dist/cjs/salla-cart-item-offers_2.cjs.entry.js +1 -1
- package/dist/cjs/salla-cart-summary-card.cjs.entry.js +1 -1
- package/dist/cjs/salla-cashback-banner.cjs.entry.js +1 -1
- package/dist/cjs/salla-comment-factors.cjs.entry.js +1 -1
- package/dist/cjs/salla-comment-form_9.cjs.entry.js +2 -2
- package/dist/cjs/salla-conditional-offer.cjs.entry.js +1 -1
- package/dist/cjs/salla-contacts.cjs.entry.js +1 -1
- package/dist/cjs/salla-cookies-bar.cjs.entry.js +1 -1
- package/dist/cjs/salla-count-down.cjs.entry.js +1 -1
- package/dist/cjs/salla-custom-fields.cjs.entry.js +1 -1
- package/dist/cjs/salla-delivery-promise.cjs.entry.js +1 -1
- package/dist/cjs/salla-edit-order-button.cjs.entry.js +1 -1
- package/dist/cjs/salla-filters-widget.cjs.entry.js +2 -2
- package/dist/cjs/salla-filters.cjs.entry.js +2 -2
- package/dist/cjs/salla-free-shipping-banner.cjs.entry.js +1 -1
- package/dist/cjs/salla-free-shipping-tag.cjs.entry.js +1 -1
- package/dist/cjs/salla-fulfillment-methods.cjs.entry.js +1 -1
- package/dist/cjs/salla-gift-card-redeem_2.cjs.entry.js +1 -1
- package/dist/cjs/salla-gifting.cjs.entry.js +1 -1
- package/dist/cjs/salla-hook.cjs.entry.js +1 -1
- package/dist/cjs/salla-infinite-scroll.cjs.entry.js +2 -2
- package/dist/cjs/salla-installment.cjs.entry.js +1 -1
- package/dist/cjs/salla-list-tile.cjs.entry.js +1 -1
- package/dist/cjs/salla-localization-modal.cjs.entry.js +1 -1
- package/dist/cjs/salla-login-modal.cjs.entry.js +1 -1
- package/dist/cjs/salla-loyalty-banner_10.cjs.entry.js +1 -1
- package/dist/cjs/salla-loyalty-exchange-product-card.cjs.entry.js +1 -1
- package/dist/cjs/salla-loyalty-points-banner.cjs.entry.js +1 -1
- package/dist/cjs/salla-loyalty-points-history.cjs.entry.js +1 -1
- package/dist/cjs/salla-loyalty-prize-item.cjs.entry.js +1 -1
- package/dist/cjs/salla-loyalty.cjs.entry.js +1 -1
- package/dist/cjs/salla-maintenance-alert.cjs.entry.js +1 -1
- package/dist/cjs/salla-map_3.cjs.entry.js +1 -1
- package/dist/cjs/salla-menu.cjs.entry.js +1 -1
- package/dist/cjs/salla-metadata.cjs.entry.js +1 -1
- package/dist/cjs/salla-mobile-update-modal.cjs.entry.js +1 -1
- package/dist/cjs/salla-multiple-bundle-product-cart_2.cjs.entry.js +1 -1
- package/dist/cjs/salla-multiple-bundle-product-options-modal_2.cjs.entry.js +1 -1
- package/dist/cjs/salla-multiple-bundle-product.cjs.entry.js +1 -1
- package/dist/cjs/salla-next-order-coupon.cjs.entry.js +1 -1
- package/dist/cjs/salla-notification-item_2.cjs.entry.js +2 -2
- package/dist/cjs/salla-offer-modal.cjs.entry.js +1 -1
- package/dist/cjs/salla-offer.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-branch.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-cancel.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-details-multiple-bundle-product.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-details-options.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-details.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-edit-item.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-edit-product-card.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-edit.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-items.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-options-modal.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-payment.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-rewards.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-shipments.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-summary.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-totals-card.cjs.entry.js +1 -1
- package/dist/cjs/salla-orders.cjs.entry.js +2 -2
- package/dist/cjs/salla-payments.cjs.entry.js +1 -1
- package/dist/cjs/salla-placeholder.cjs.entry.js +1 -1
- package/dist/cjs/salla-price-range.cjs.entry.js +1 -1
- package/dist/cjs/salla-product-card-embed.cjs.entry.js +1 -1
- package/dist/cjs/salla-product-card.cjs.entry.js +1 -1
- package/dist/cjs/salla-product-size-guide.cjs.entry.js +1 -1
- package/dist/cjs/salla-products-list.cjs.entry.js +2 -2
- package/dist/cjs/salla-products-slider.cjs.entry.js +2 -2
- package/dist/cjs/salla-quick-order.cjs.entry.js +1 -1
- package/dist/cjs/salla-rating-modal-v2.cjs.entry.js +2 -2
- package/dist/cjs/salla-rating-modal.cjs.entry.js +2 -2
- package/dist/cjs/salla-review-factors-tags.cjs.entry.js +1 -1
- package/dist/cjs/salla-review-order-item.cjs.entry.js +1 -1
- package/dist/cjs/salla-scopes.cjs.entry.js +1 -1
- package/dist/cjs/salla-search-product-card.cjs.entry.js +1 -1
- package/dist/cjs/salla-search.cjs.entry.js +2 -2
- package/dist/cjs/salla-skeleton.cjs.entry.js +1 -1
- package/dist/cjs/salla-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-thank-you-header.cjs.entry.js +1 -1
- package/dist/cjs/salla-thank-you-page.cjs.entry.js +1 -1
- package/dist/cjs/salla-tiered-offer.cjs.entry.js +1 -1
- package/dist/cjs/salla-trust-badges.cjs.entry.js +1 -1
- package/dist/cjs/salla-user-menu.cjs.entry.js +2 -2
- package/dist/cjs/salla-user-profile.cjs.entry.js +1 -1
- package/dist/cjs/salla-user-settings.cjs.entry.js +1 -1
- package/dist/cjs/salla-verify.cjs.entry.js +1 -1
- package/dist/cjs/salla-wallet.cjs.entry.js +1 -1
- package/dist/cjs/salla-wishlist-actions.cjs.entry.js +1 -1
- package/dist/cjs/salla-wishlist-summary.cjs.entry.js +2 -2
- package/dist/cjs/twilight.cjs.js +1 -1
- package/dist/cjs/{vanilla-picker-B4ryCcaf.js → vanilla-picker-BtI42wjx.js} +1 -1
- package/dist/collection/components/salla-user-menu/salla-user-menu.css +2 -0
- package/dist/components/index.js +2 -2
- package/dist/components/salla-user-menu.js +1 -1
- package/dist/docs.json +1 -1
- package/dist/esm/{Helper-qEdrYF7X.js → Helper-Xo2bQXZz.js} +1 -1
- package/dist/esm/{filepond-CpWsO7Mv.js → filepond-CnC-Gw5u.js} +1 -1
- package/dist/esm/{filepond-plugin-file-poster-BA_cB5e8.js → filepond-plugin-file-poster-Tq5buhXU.js} +1 -1
- package/dist/esm/{filepond-plugin-file-validate-size-7bfJMSeh.js → filepond-plugin-file-validate-size-Fvp89fAI.js} +1 -1
- package/dist/esm/{filepond-plugin-file-validate-type-y8X7We_2.js → filepond-plugin-file-validate-type-0J-wZKP5.js} +1 -1
- package/dist/esm/{filepond-plugin-image-edit-D_eWaz3f.js → filepond-plugin-image-edit-BGdpmDUz.js} +1 -1
- package/dist/esm/{filepond-plugin-image-exif-orientation-DHbfnm0Z.js → filepond-plugin-image-exif-orientation-gP2ZIc0I.js} +1 -1
- package/dist/esm/{filepond-plugin-image-preview-D47iLjXV.js → filepond-plugin-image-preview-DEn_x6Op.js} +1 -1
- package/dist/esm/{index-DRvWpd5P.js → index-BXSGktmF.js} +2 -2
- package/dist/esm/{intlTelInput-CmiKdRvm.js → intlTelInput-D7f8BwQF.js} +1 -1
- package/dist/esm/loader.js +2 -2
- package/dist/esm/salla-accordion-body_2.entry.js +1 -1
- package/dist/esm/salla-accordion_6.entry.js +2 -2
- package/dist/esm/salla-add-product-button_5.entry.js +2 -2
- package/dist/esm/salla-advertisement.entry.js +1 -1
- package/dist/esm/salla-alert_2.entry.js +1 -1
- package/dist/esm/salla-app-install-alert.entry.js +1 -1
- package/dist/esm/salla-applied-filters.entry.js +2 -2
- package/dist/esm/salla-apps-icons.entry.js +1 -1
- package/dist/esm/salla-attachment-view_9.entry.js +11 -11
- package/dist/esm/salla-badge.entry.js +1 -1
- package/dist/esm/salla-basket-gap.entry.js +1 -1
- package/dist/esm/salla-bullet-delivery_3.entry.js +1 -1
- package/dist/esm/salla-cart-coupons.entry.js +1 -1
- package/dist/esm/salla-cart-item-offers_2.entry.js +1 -1
- package/dist/esm/salla-cart-summary-card.entry.js +1 -1
- package/dist/esm/salla-cashback-banner.entry.js +1 -1
- package/dist/esm/salla-comment-factors.entry.js +1 -1
- package/dist/esm/salla-comment-form_9.entry.js +2 -2
- package/dist/esm/salla-conditional-offer.entry.js +1 -1
- package/dist/esm/salla-contacts.entry.js +1 -1
- package/dist/esm/salla-cookies-bar.entry.js +1 -1
- package/dist/esm/salla-count-down.entry.js +1 -1
- package/dist/esm/salla-custom-fields.entry.js +1 -1
- package/dist/esm/salla-delivery-promise.entry.js +1 -1
- package/dist/esm/salla-edit-order-button.entry.js +1 -1
- package/dist/esm/salla-filters-widget.entry.js +2 -2
- package/dist/esm/salla-filters.entry.js +2 -2
- package/dist/esm/salla-free-shipping-banner.entry.js +1 -1
- package/dist/esm/salla-free-shipping-tag.entry.js +1 -1
- package/dist/esm/salla-fulfillment-methods.entry.js +1 -1
- package/dist/esm/salla-gift-card-redeem_2.entry.js +1 -1
- package/dist/esm/salla-gifting.entry.js +1 -1
- package/dist/esm/salla-hook.entry.js +1 -1
- package/dist/esm/salla-infinite-scroll.entry.js +2 -2
- package/dist/esm/salla-installment.entry.js +1 -1
- package/dist/esm/salla-list-tile.entry.js +1 -1
- package/dist/esm/salla-localization-modal.entry.js +1 -1
- package/dist/esm/salla-login-modal.entry.js +1 -1
- package/dist/esm/salla-loyalty-banner_10.entry.js +1 -1
- package/dist/esm/salla-loyalty-exchange-product-card.entry.js +1 -1
- package/dist/esm/salla-loyalty-points-banner.entry.js +1 -1
- package/dist/esm/salla-loyalty-points-history.entry.js +1 -1
- package/dist/esm/salla-loyalty-prize-item.entry.js +1 -1
- package/dist/esm/salla-loyalty.entry.js +1 -1
- package/dist/esm/salla-maintenance-alert.entry.js +1 -1
- package/dist/esm/salla-map_3.entry.js +1 -1
- package/dist/esm/salla-menu.entry.js +1 -1
- package/dist/esm/salla-metadata.entry.js +1 -1
- package/dist/esm/salla-mobile-update-modal.entry.js +1 -1
- package/dist/esm/salla-multiple-bundle-product-cart_2.entry.js +1 -1
- package/dist/esm/salla-multiple-bundle-product-options-modal_2.entry.js +1 -1
- package/dist/esm/salla-multiple-bundle-product.entry.js +1 -1
- package/dist/esm/salla-next-order-coupon.entry.js +1 -1
- package/dist/esm/salla-notification-item_2.entry.js +2 -2
- package/dist/esm/salla-offer-modal.entry.js +1 -1
- package/dist/esm/salla-offer.entry.js +1 -1
- package/dist/esm/salla-order-branch.entry.js +1 -1
- package/dist/esm/salla-order-cancel.entry.js +1 -1
- package/dist/esm/salla-order-details-multiple-bundle-product.entry.js +1 -1
- package/dist/esm/salla-order-details-options.entry.js +1 -1
- package/dist/esm/salla-order-details.entry.js +1 -1
- package/dist/esm/salla-order-edit-item.entry.js +1 -1
- package/dist/esm/salla-order-edit-product-card.entry.js +1 -1
- package/dist/esm/salla-order-edit.entry.js +1 -1
- package/dist/esm/salla-order-items.entry.js +1 -1
- package/dist/esm/salla-order-options-modal.entry.js +1 -1
- package/dist/esm/salla-order-payment.entry.js +1 -1
- package/dist/esm/salla-order-rewards.entry.js +1 -1
- package/dist/esm/salla-order-shipments.entry.js +1 -1
- package/dist/esm/salla-order-summary.entry.js +1 -1
- package/dist/esm/salla-order-totals-card.entry.js +1 -1
- package/dist/esm/salla-orders.entry.js +2 -2
- package/dist/esm/salla-payments.entry.js +1 -1
- package/dist/esm/salla-placeholder.entry.js +1 -1
- package/dist/esm/salla-price-range.entry.js +1 -1
- package/dist/esm/salla-product-card-embed.entry.js +1 -1
- package/dist/esm/salla-product-card.entry.js +1 -1
- package/dist/esm/salla-product-size-guide.entry.js +1 -1
- package/dist/esm/salla-products-list.entry.js +2 -2
- package/dist/esm/salla-products-slider.entry.js +2 -2
- package/dist/esm/salla-quick-order.entry.js +1 -1
- package/dist/esm/salla-rating-modal-v2.entry.js +2 -2
- package/dist/esm/salla-rating-modal.entry.js +2 -2
- package/dist/esm/salla-review-factors-tags.entry.js +1 -1
- package/dist/esm/salla-review-order-item.entry.js +1 -1
- package/dist/esm/salla-scopes.entry.js +1 -1
- package/dist/esm/salla-search-product-card.entry.js +1 -1
- package/dist/esm/salla-search.entry.js +2 -2
- package/dist/esm/salla-skeleton.entry.js +1 -1
- package/dist/esm/salla-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-thank-you-header.entry.js +1 -1
- package/dist/esm/salla-thank-you-page.entry.js +1 -1
- package/dist/esm/salla-tiered-offer.entry.js +1 -1
- package/dist/esm/salla-trust-badges.entry.js +1 -1
- package/dist/esm/salla-user-menu.entry.js +2 -2
- package/dist/esm/salla-user-profile.entry.js +1 -1
- package/dist/esm/salla-user-settings.entry.js +1 -1
- package/dist/esm/salla-verify.entry.js +1 -1
- package/dist/esm/salla-wallet.entry.js +1 -1
- package/dist/esm/salla-wishlist-actions.entry.js +1 -1
- package/dist/esm/salla-wishlist-summary.entry.js +2 -2
- package/dist/esm/twilight.js +2 -2
- package/dist/esm/{vanilla-picker-Ci35-SnN.js → vanilla-picker-Dwx-r_Pm.js} +1 -1
- package/dist/twilight/{p-1b1cde5a.entry.js → p-0686190e.entry.js} +1 -1
- package/dist/twilight/{p-740a85ac.entry.js → p-0ce60a63.entry.js} +1 -1
- package/dist/twilight/{p-9512fe0d.entry.js → p-0f97e754.entry.js} +1 -1
- package/dist/twilight/{p-Caey3A5m.js → p-0rlOrj5t.js} +1 -1
- package/dist/twilight/{p-4301f0ae.entry.js → p-11edbe40.entry.js} +1 -1
- package/dist/twilight/{p-40aa0ef0.entry.js → p-130ab6b5.entry.js} +1 -1
- package/dist/twilight/{p-5c5cee6e.entry.js → p-13c2fb33.entry.js} +1 -1
- package/dist/twilight/{p-0d61b6c5.entry.js → p-14c163a9.entry.js} +1 -1
- package/dist/twilight/{p-c98da1d6.entry.js → p-17763ef6.entry.js} +1 -1
- package/dist/twilight/{p-8d80b93c.entry.js → p-1a64c3d0.entry.js} +1 -1
- package/dist/twilight/{p-bb5e4345.entry.js → p-1ab12ccb.entry.js} +1 -1
- package/dist/twilight/{p-48bd10f2.entry.js → p-1c973898.entry.js} +1 -1
- package/dist/twilight/{p-daa00d46.entry.js → p-207e7fdf.entry.js} +1 -1
- package/dist/twilight/{p-8d940345.entry.js → p-223c2dc0.entry.js} +1 -1
- package/dist/twilight/{p-30a6af2b.entry.js → p-22f0669b.entry.js} +1 -1
- package/dist/twilight/{p-472e79db.entry.js → p-2304639e.entry.js} +1 -1
- package/dist/twilight/{p-38619d31.entry.js → p-23a82841.entry.js} +1 -1
- package/dist/twilight/{p-f4ca4be7.entry.js → p-2610f6a3.entry.js} +1 -1
- package/dist/twilight/{p-b1c2df04.entry.js → p-267851e6.entry.js} +1 -1
- package/dist/twilight/{p-bdb8e50b.entry.js → p-28bc42d1.entry.js} +1 -1
- package/dist/twilight/{p-2a4e490f.entry.js → p-2b7c3785.entry.js} +1 -1
- package/dist/twilight/{p-fb621cbb.entry.js → p-2bb3157d.entry.js} +1 -1
- package/dist/twilight/{p-943ed402.entry.js → p-3032896e.entry.js} +1 -1
- package/dist/twilight/{p-2453c50b.entry.js → p-324b7ff8.entry.js} +1 -1
- package/dist/twilight/{p-b20bdd64.entry.js → p-32f4944b.entry.js} +1 -1
- package/dist/twilight/{p-eb1bea38.entry.js → p-356e8a56.entry.js} +1 -1
- package/dist/twilight/{p-c5cb3d2c.entry.js → p-361aeb38.entry.js} +1 -1
- package/dist/twilight/{p-823148d1.entry.js → p-3c9c7b93.entry.js} +1 -1
- package/dist/twilight/{p-8e43d05b.entry.js → p-3d9cb623.entry.js} +1 -1
- package/dist/twilight/{p-a3e6a85b.entry.js → p-3fd0fe12.entry.js} +1 -1
- package/dist/twilight/{p-000493f6.entry.js → p-44bc082c.entry.js} +1 -1
- package/dist/twilight/{p-5039a05c.entry.js → p-459ae423.entry.js} +1 -1
- package/dist/twilight/{p-f9dc67d8.entry.js → p-46a2c78f.entry.js} +1 -1
- package/dist/twilight/{p-8b97ac4e.entry.js → p-47a90994.entry.js} +1 -1
- package/dist/twilight/{p-1aaa095a.entry.js → p-48873da8.entry.js} +1 -1
- package/dist/twilight/{p-8d055316.entry.js → p-49336e4b.entry.js} +1 -1
- package/dist/twilight/{p-bacbb6e6.entry.js → p-4966b0e8.entry.js} +1 -1
- package/dist/twilight/{p-609ab0f6.entry.js → p-4ac770ba.entry.js} +1 -1
- package/dist/twilight/{p-c66e49f8.entry.js → p-4db163a5.entry.js} +1 -1
- package/dist/twilight/{p-43b5e25d.entry.js → p-4e22341d.entry.js} +1 -1
- package/dist/twilight/{p-370d884d.entry.js → p-50c14a2f.entry.js} +1 -1
- package/dist/twilight/{p-762b0a48.entry.js → p-51fa9d4b.entry.js} +1 -1
- package/dist/twilight/{p-41b8775c.entry.js → p-557ab2fd.entry.js} +1 -1
- package/dist/twilight/{p-179bd9bf.entry.js → p-5a030d37.entry.js} +1 -1
- package/dist/twilight/{p-b08ad979.entry.js → p-5c4dc8c2.entry.js} +1 -1
- package/dist/twilight/{p-a77645a3.entry.js → p-5d9e112e.entry.js} +1 -1
- package/dist/twilight/{p-b01c8601.entry.js → p-5df145be.entry.js} +1 -1
- package/dist/twilight/{p-e662da2a.entry.js → p-6905f49b.entry.js} +1 -1
- package/dist/twilight/{p-8f212f33.entry.js → p-6f203973.entry.js} +1 -1
- package/dist/twilight/{p-184d6532.entry.js → p-708b76ba.entry.js} +1 -1
- package/dist/twilight/{p-e4f7ad14.entry.js → p-710e2dd0.entry.js} +1 -1
- package/dist/twilight/{p-09b9bdd3.entry.js → p-72af03a1.entry.js} +1 -1
- package/dist/twilight/{p-3cd1ae8c.entry.js → p-74c07d23.entry.js} +1 -1
- package/dist/twilight/{p-429fbb5c.entry.js → p-74e9cd11.entry.js} +1 -1
- package/dist/twilight/{p-18758910.entry.js → p-8a74ba4a.entry.js} +1 -1
- package/dist/twilight/{p-132b1d58.entry.js → p-8b8bf23b.entry.js} +1 -1
- package/dist/twilight/{p-47038481.entry.js → p-8c89eb67.entry.js} +1 -1
- package/dist/twilight/{p-9ad1c68e.entry.js → p-8dfb9637.entry.js} +1 -1
- package/dist/twilight/{p-e322b07f.entry.js → p-8eeed35f.entry.js} +1 -1
- package/dist/twilight/{p-9d665017.entry.js → p-90417d6e.entry.js} +1 -1
- package/dist/twilight/{p-47947478.entry.js → p-98944116.entry.js} +1 -1
- package/dist/twilight/{p-07ecd9d8.entry.js → p-9979137b.entry.js} +1 -1
- package/dist/twilight/{p-67e91147.entry.js → p-9ae7c9de.entry.js} +1 -1
- package/dist/twilight/{p-d7615756.entry.js → p-9bda3abb.entry.js} +1 -1
- package/dist/twilight/{p-1d13928b.entry.js → p-9d157683.entry.js} +1 -1
- package/dist/twilight/{p-2c1078ae.entry.js → p-9ef88bed.entry.js} +1 -1
- package/dist/twilight/{p-DRvWpd5P.js → p-BXSGktmF.js} +1 -1
- package/dist/twilight/{p-D7SrsZe-.js → p-Bd5XukuC.js} +1 -1
- package/dist/twilight/{p-CiicuNzl.js → p-BpnQsIO1.js} +1 -1
- package/dist/twilight/{p-C7lKOlTc.js → p-C-sZpMJx.js} +1 -1
- package/dist/twilight/{p-BPhzgwOk.js → p-CFVeu87-.js} +2 -2
- package/dist/twilight/{p-DAvwtq5S.js → p-C_MosVdY.js} +1 -1
- package/dist/twilight/{p-I3Sp2yk-.js → p-CgL66erE.js} +1 -1
- package/dist/twilight/{p-C_5zZPrL.js → p-DdOkxzC4.js} +1 -1
- package/dist/twilight/{p-Bj0PA-Xf.js → p-DjKYLHWC.js} +1 -1
- package/dist/twilight/{p-65817439.entry.js → p-a1b41729.entry.js} +1 -1
- package/dist/twilight/{p-d0453b1b.entry.js → p-a29b3ad6.entry.js} +1 -1
- package/dist/twilight/{p-c807b4ba.entry.js → p-a2dd20a2.entry.js} +1 -1
- package/dist/twilight/{p-96a7975e.entry.js → p-a63881bf.entry.js} +1 -1
- package/dist/twilight/{p-72869219.entry.js → p-a7fa4a38.entry.js} +1 -1
- package/dist/twilight/{p-34054859.entry.js → p-adf98025.entry.js} +1 -1
- package/dist/twilight/{p-353e0af4.entry.js → p-aeb7635f.entry.js} +1 -1
- package/dist/twilight/{p-a10a389c.entry.js → p-b37da44e.entry.js} +1 -1
- package/dist/twilight/{p-6547d545.entry.js → p-b638254e.entry.js} +1 -1
- package/dist/twilight/{p-448ead38.entry.js → p-bd7d60a4.entry.js} +1 -1
- package/dist/twilight/{p-a5c0b2b3.entry.js → p-bda3eb32.entry.js} +1 -1
- package/dist/twilight/{p-d2aaa905.entry.js → p-be1ab62d.entry.js} +1 -1
- package/dist/twilight/{p-457cc3d1.entry.js → p-c3704c29.entry.js} +1 -1
- package/dist/twilight/p-c969af19.entry.js +4 -0
- package/dist/twilight/{p-aa52b7c9.entry.js → p-c97764b4.entry.js} +1 -1
- package/dist/twilight/{p-c71bc218.entry.js → p-ca065012.entry.js} +1 -1
- package/dist/twilight/{p-c4e61610.entry.js → p-cb9e72a0.entry.js} +1 -1
- package/dist/twilight/{p-983926d2.entry.js → p-cfdf4aa0.entry.js} +1 -1
- package/dist/twilight/{p-3737ffc8.entry.js → p-d2cf3929.entry.js} +1 -1
- package/dist/twilight/{p-a0311373.entry.js → p-d3865329.entry.js} +1 -1
- package/dist/twilight/{p-7016175e.entry.js → p-d4a3cf3e.entry.js} +1 -1
- package/dist/twilight/{p-cb14daa7.entry.js → p-d4b86e14.entry.js} +1 -1
- package/dist/twilight/{p-59c7175c.entry.js → p-d7a2b55c.entry.js} +1 -1
- package/dist/twilight/{p-d42fcaaa.entry.js → p-d95b2d33.entry.js} +1 -1
- package/dist/twilight/{p-93dff336.entry.js → p-db5139a3.entry.js} +1 -1
- package/dist/twilight/{p-f1d8d7eb.entry.js → p-dca2fdae.entry.js} +1 -1
- package/dist/twilight/{p-f88ada3f.entry.js → p-deca2029.entry.js} +1 -1
- package/dist/twilight/{p-6e778277.entry.js → p-e080de31.entry.js} +1 -1
- package/dist/twilight/{p-4d710e55.entry.js → p-e3dd1bd6.entry.js} +1 -1
- package/dist/twilight/{p-c1827b4d.entry.js → p-e40876ba.entry.js} +1 -1
- package/dist/twilight/{p-cdb5fe5d.entry.js → p-eb407211.entry.js} +1 -1
- package/dist/twilight/{p-75ae36b8.entry.js → p-f39f2210.entry.js} +1 -1
- package/dist/twilight/{p-181e17fe.entry.js → p-f3ebe745.entry.js} +1 -1
- package/dist/twilight/{p-b34f97bf.entry.js → p-f7da9b5a.entry.js} +1 -1
- package/dist/twilight/{p-d839e68a.entry.js → p-fa94864c.entry.js} +1 -1
- package/dist/twilight/{p-f9e2522e.entry.js → p-fb9a843b.entry.js} +1 -1
- package/dist/twilight/{p-2a124554.entry.js → p-fd7c9983.entry.js} +1 -1
- package/dist/twilight/{p-f31d8513.entry.js → p-fd9b2c38.entry.js} +1 -1
- package/dist/twilight/{p-BerWJEF6.js → p-qWzMt6Cu.js} +1 -1
- package/dist/twilight/twilight.esm.js +1 -1
- package/package.json +5 -5
- package/dist/twilight/p-ebe11191.entry.js +0 -4
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as e,h as r}from"./p-
|
|
4
|
+
import{r as e,h as r}from"./p-BXSGktmF.js";import{s as t}from"./p-BQHBj1u_.js";import{m as a,a as i}from"./p-DfHdQUMm.js";const o=class{constructor(r){e(this,r),this.logoFailed=!1}resetLogo(){this.logoFailed=!1}async componentWillLoad(){await salla.onReady(),await salla.lang.onLoaded()}charged(e){return null!=e&&/[1-9١-٩۱-۹]/.test(String(e))}row(e,t,o=!1,s=""){if(null==t||""===t)return null;const n=Number(t);return r("div",{class:{"s-order-payment-row":!0,"s-order-payment-total":o}},r("dt",null,e),Number.isFinite(n)?r("dd",{innerHTML:s+a(n,this.currency)}):r("dd",{innerHTML:i(String(t))}))}get discountList(){try{const e="string"==typeof this.discounts?JSON.parse(this.discounts):this.discounts;return Array.isArray(e)?e.map((e=>{const r=Math.abs(Number(e?.amount??e?.discount)),t="string"==typeof e?.discount?e.discount:"",a=Number.isFinite(r)&&r>0&&(!t||this.currency);return{name:e?.name,amount:a?r:t}})).filter((e=>"string"==typeof e.amount||e.amount>0)):[]}catch{return[]}}render(){const e=t(this.invoiceUrl);return r("section",{key:"a11d82b09c38a1f2b8085bcd62e3ba988aff1d30",class:"s-order-payment-wrapper"},r("dl",{key:"fdd189e43387e43cc9a2f78416ff6c0463a0fd5c",class:"s-order-payment-list"},r("div",{key:"27362be4b928815f2b6d2320bb9aada1344c7654",class:"s-order-payment-row"},r("dt",{key:"dec8b18118b8629a083720b9242d8b897f92722c"},salla.lang.get("pages.cart.payment_way")),r("dd",{key:"85d6532a1abe13b7204e16b9e90a88d0958a7e89"},this.paymentLogo&&!this.logoFailed?r("span",{class:"s-order-payment-logo"},r("img",{src:this.paymentLogo,alt:this.paymentMethod||"",loading:"lazy",onError:()=>{this.logoFailed=!0}})):this.paymentMethod)),this.row(salla.lang.get("pages.thank_you.sub_total"),this.subTotal),this.discountList.map((e=>this.row(e.name,e.amount,!1,"string"==typeof e.amount?"":"-"))),this.charged(this.taxAmount)?this.row(salla.lang.get("pages.cart.tax"),this.taxAmount):null,this.charged(this.shippingCost)?this.row(salla.lang.get("pages.orders.shipping_cost"),this.shippingCost):null,this.charged(this.codCost)?this.row(salla.lang.get("pages.cart.cash_on_delivery"),this.codCost):null,this.row(salla.lang.get("pages.orders.final_total"),this.total,!0)),e?r("a",{href:e,target:"_blank",rel:"noopener","data-testid":"store-thankyou-payment-view-invoice",class:"s-order-payment-invoice"},r("span",{"aria-hidden":"true",innerHTML:'\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>receipt</title>\n<path d="M21.333 18.667h-10.667c-0.736 0-1.333 0.596-1.333 1.333s0.597 1.333 1.333 1.333h10.667c0.736 0 1.333-0.596 1.333-1.333s-0.597-1.333-1.333-1.333zM21.333 10.667h-10.667c-0.736 0-1.333 0.597-1.333 1.333s0.597 1.333 1.333 1.333h10.667c0.736 0 1.333-0.597 1.333-1.333s-0.597-1.333-1.333-1.333zM27.263 1.473c-0.453-0.225-0.993-0.176-1.396 0.127l-2.66 1.995-2.739-2.568c-0.513-0.48-1.311-0.48-1.824 0l-2.644 2.479-2.643-2.479c-0.513-0.48-1.311-0.48-1.824 0l-2.74 2.568-2.66-1.995c-0.407-0.303-0.945-0.352-1.396-0.127-0.452 0.227-0.737 0.688-0.737 1.193v26.667c0 0.505 0.285 0.967 0.737 1.193 0.451 0.223 0.992 0.176 1.396-0.127l2.66-1.995 2.739 2.568c0.513 0.481 1.311 0.481 1.824 0l2.644-2.479 2.643 2.477c0.256 0.241 0.584 0.361 0.912 0.361s0.656-0.12 0.912-0.361l2.739-2.568 2.661 1.996c0.404 0.304 0.944 0.351 1.396 0.127 0.452-0.227 0.737-0.688 0.737-1.193v-26.667c0-0.505-0.285-0.967-0.737-1.193zM25.333 26.667l-1.421-1.067c-0.519-0.388-1.239-0.352-1.712 0.093l-2.644 2.477-2.643-2.477c-0.257-0.24-0.585-0.36-0.913-0.36s-0.656 0.12-0.912 0.361l-2.643 2.477-2.644-2.477c-0.473-0.445-1.195-0.481-1.712-0.093l-1.423 1.065v-21.333l1.421 1.067c0.517 0.388 1.237 0.348 1.712-0.093l2.644-2.479 2.643 2.479c0.513 0.48 1.311 0.48 1.824 0l2.643-2.479 2.644 2.479c0.473 0.443 1.195 0.483 1.712 0.093l1.424-1.067z"></path>\n</svg>\n'}),salla.lang.get("pages.thank_you.view_invoice")):null)}static get watchers(){return{paymentLogo:["resetLogo"]}}};o.style='/*!twlt*/:host{display:block}.-my-1{margin-top:-0.25rem;margin-bottom:-0.25rem}.-my-1\\.5{margin-top:-0.375rem;margin-bottom:-0.375rem}.hidden{display:none}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.s-order-payment-wrapper{display:flex;width:100%;flex-direction:column;align-items:flex-end;gap:1rem;border-radius:0.5rem;border-width:1px;border-color:var(--color-border-light,#f4f4f4);background-color:var(--color-surface,#fff);padding:1rem}@media (min-width: 640px){.s-order-payment-wrapper{padding:1.5rem}}.s-order-payment-list{margin:0px;display:flex;width:100%;flex-direction:column;gap:0.75rem}.s-order-payment-row{display:flex;width:100%;align-items:center;gap:1rem;font-size:0.875rem;line-height:1.25rem;color:var(--color-text-secondary,#666)}.s-order-payment-row dt{flex:1 1 0%;text-align:start}.s-order-payment-row dd{margin:0px;display:flex;align-items:center;gap:0.25rem}.s-order-payment-logo{margin-top:-0.375rem;margin-bottom:-0.375rem;display:inline-flex;height:1.75rem;width:3.5rem;flex-shrink:0}.s-order-payment-logo img{height:100%;width:100%;object-fit:contain}.s-order-payment-logo img:where([dir="ltr"],[dir="ltr"] *){object-position:right}.s-order-payment-logo img:where([dir="rtl"],[dir="rtl"] *){object-position:left}.s-order-payment-total{font-size:1rem;font-weight:700;line-height:1.5rem;color:var(--color-text-primary,#333)}.s-order-payment-invoice{display:flex;min-height:3rem;width:100%;align-items:center;justify-content:center;gap:0.5rem;border-radius:0.5rem;border-width:1px;border-color:var(--color-border,#eee);font-size:1rem;line-height:1.5rem;font-weight:500;color:var(--color-text-primary,#333);text-decoration-line:none}.s-order-payment-invoice svg{height:1.25rem;width:1.25rem;fill:currentColor}';export{o as salla_order_payment}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as t,h as s,a as o}from"./p-DRvWpd5P.js";const e=class{constructor(s){t(this,s),this.resolveFn=null,this.rejectFn=null,this.optionsRefs=new Map,this.changeHandler=null,this.submitCallback=null,this._realOrderOptions=[],this._collectedFreeOptions=[],this._isWizard=!1,this._freeQueue=[],this._freeIndex=0,this._collectedFreeProducts=[],this._orderBasePrice=0,this._accumulatedExtra=0,this.orderOptions=[],this.basePrice=0,this.liveTotal=0,this.isSubmitting=!1,this.sessionId=0,this.paymentMode="default",this.freeProduct=null,this.inFreeStep=!1,this.title="",this.subtitle="",this.submitLabel="",this.totalLabel="",this.requiredMessage="",this.freeProductTitle="خيارات المنتج المجاني",this.freeProductSubtitle="اختر ما يناسبك من خيارات المنتج",this.freeProductContinueLabel="تابع واحصل على هديتك الان",this.handleClose=()=>{this.isSubmitting||(this.rejectFn?.({reason:"dismissed"}),this.resolveFn=null,this.rejectFn=null,this.detachChangeListener(),this.reset())},salla.lang.onLoaded((()=>this.loadTranslations()))}componentWillLoad(){this.loadTranslations()}isRtl(){return"rtl"===document?.documentElement?.getAttribute("dir")}t(t,s){const o=salla.lang.get(t);return o&&o!==t?o:s}loadTranslations(){this.title=salla.lang.get("blocks.order_options.title"),this.subtitle=salla.lang.get("blocks.order_options.subtitle"),this.submitLabel=salla.lang.get("blocks.order_options.continue"),this.totalLabel=salla.lang.get("blocks.order_options.total"),this.requiredMessage=salla.lang.get("blocks.order_options.required_message"),this.freeProductTitle=this.t("pages.products.free_product_options_title","خيارات المنتج المجاني"),this.freeProductSubtitle=this.t("pages.products.free_product_options_subtitle","اختر ما يناسبك من خيارات المنتج"),this.freeProductContinueLabel=this.t("pages.products.free_product_cta","تابع واحصل على هديتك الان")}async open(t){const s=t=>(Array.isArray(t)?t:[]).map((t=>({...t,details:t.details??[]}))),o=s(t.orderOptions),e=this.buildFreeQueue(t,s);return this._realOrderOptions=o,this._collectedFreeOptions=[],this._collectedFreeProducts=[],this._freeQueue=e,this._freeIndex=0,this._orderBasePrice=Number(t.basePrice)||0,this._accumulatedExtra=0,this._isWizard=e.length+(o.length>0?1:0)>1,this.isSubmitting=!1,this.optionsRefs.clear(),this.submitCallback=t.onSubmit??null,this.paymentMode=t.paymentMode??"default",e.length>0?this.loadFreeStep(0):(this.sessionId++,this.inFreeStep=!1,this.orderOptions=o,this.freeProduct=null,this.basePrice=Number(t.basePrice)||0,this.liveTotal=this.basePrice+this.seedOptionsPrice(this.orderOptions)),await(this.modal?.open()),this.modal?.setTitle(this.inFreeStep?this.freeProductTitle:this.title),this.attachChangeListener(),new Promise(((t,s)=>{this.resolveFn=t,this.rejectFn=s}))}buildFreeQueue(t,s){const o=[];if((Array.isArray(t.freeProducts)?t.freeProducts:[]).forEach((t=>{const e=s(t?.options);e.length&&o.push({product:t?.product?{...t.product,offer_name:t.offer_name??t.product.offer_name??null}:null,options:e,quantity:Number(t?.quantity)>0?Number(t.quantity):1})})),o.length)return o;const e=s(t.freeProductOptions);return e.length&&o.push({product:t.freeProduct??null,options:e,quantity:1}),o}loadFreeStep(t){const s=this._freeQueue[t];this._freeIndex=t,this.optionsRefs.clear(),this.inFreeStep=!0,this.orderOptions=s.options,this.freeProduct=s.product,this.basePrice=0,this.liveTotal=this.seedOptionsPrice(s.options),this.sessionId++}async close(){await(this.modal?.close())}collectOrderOptionsSync(){const t=[];for(const[,s]of this.optionsRefs)s&&s.querySelectorAll('[name^="options["],[name*="[options]["]').forEach((s=>{if(s instanceof HTMLInputElement&&("radio"===s.type||"checkbox"===s.type)&&!s.checked)return;const o=s.name.match(/(?:^|\[)options\]?\[(\d+)\]/);if(!o)return;const e=s.value;if(""===e||null==e)return;const i=Number(e);t.push({id:Number(o[1]),value:Number.isFinite(i)&&e===String(i)?i:e})}));return t}validateSync(){let t=!0;for(const[,s]of this.optionsRefs)s&&s.querySelectorAll("[required]").forEach((s=>{s.disabled||s.closest(".hidden")||"reportValidity"in s&&!s.reportValidity()&&(t=!1)}));return t}seedOptionsPrice(t){let s=0;return t.forEach((t=>{(t.details||[]).forEach((t=>{t.is_selected&&(s+=Number(t.total_price??t.additional_price)||0)}))})),s}attachChangeListener(){this.detachChangeListener(),this.changeHandler=()=>this.recomputeTotal(),salla.event.on("product-options::change",this.changeHandler)}detachChangeListener(){this.changeHandler&&(salla.event.off("product-options::change",this.changeHandler),this.changeHandler=null)}async recomputeTotal(){let t=0;for(const[,s]of this.optionsRefs)s&&(("function"==typeof s.getSelectedOptions?await s.getSelectedOptions():[])||[]).forEach((s=>{t+=Number(s.total_price??s.additional_price)||0}));this.liveTotal=this.basePrice+t}handleSubmit(){if(this.isSubmitting)return;if(!this.validateSync())return void salla.notify?.error?.(this.requiredMessage);if(this.inFreeStep){const t=this._freeQueue[this._freeIndex],s=this.collectOrderOptionsSync();if(0===this._freeIndex&&(this._collectedFreeOptions=s),s.length&&t?.product?.id){const o={};s.forEach((({id:t,value:s})=>{o[t]=s})),this._collectedFreeProducts.push({productId:t.product.id,quantity:t.quantity,options:o})}this._accumulatedExtra+=Math.max(0,this.liveTotal-this.basePrice);const o=this._freeIndex+1;return o<this._freeQueue.length?(this.loadFreeStep(o),void this.modal?.setTitle(this.freeProductTitle)):this._realOrderOptions.length?(this.optionsRefs.clear(),this.inFreeStep=!1,this.freeProduct=null,this.orderOptions=this._realOrderOptions,this.basePrice=this._orderBasePrice,this.liveTotal=this._orderBasePrice+this.seedOptionsPrice(this._realOrderOptions),this.sessionId++,void this.modal?.setTitle(this.title)):(this.isSubmitting=!0,this.liveTotal=this._orderBasePrice,this.fireSubmitCallback([]),this.resolveAndClose([]),void(this.isSubmitting=!1))}this.isSubmitting=!0;const t=this.collectOrderOptionsSync();this.fireSubmitCallback(t),this.resolveAndClose(t),this.isSubmitting=!1}finalTotal(){return Math.round(100*(this.liveTotal+this._accumulatedExtra))/100}fireSubmitCallback(t){try{this.submitCallback?.(t,this.finalTotal(),this._collectedFreeProducts)}catch(t){salla?.logger?.warn?.("order-options modal onSubmit threw",t)}}resolveAndClose(t){this.resolveFn?.({orderOptions:t,freeProductOptions:this._collectedFreeOptions,freeProducts:this._collectedFreeProducts}),this.resolveFn=null,this.rejectFn=null,this.submitCallback=null,this.detachChangeListener(),this.modal?.close().then((()=>this.reset()))}reset(){this.orderOptions=[],this.freeProduct=null,this.inFreeStep=!1,this.optionsRefs.clear(),this.liveTotal=0,this._realOrderOptions=[],this._collectedFreeOptions=[],this._collectedFreeProducts=[],this._freeQueue=[],this._freeIndex=0,this._isWizard=!1}render(){const t=salla.money(Math.round(100*this.liveTotal)/100),o=this.inFreeStep,e=o?String(this.freeProduct?.id||`free-prod-${this.orderOptions[0]?.id}`):`order-options-${this.orderOptions[0]?.id}`,i=o?`free-product-options-${this._freeIndex}`:"order-options",r=[...this._freeQueue.map((()=>this.freeProductTitle)),...this._realOrderOptions.length?[this.title]:[]],a=o?this._freeIndex:this._freeQueue.length,l=a===Math.max(0,r.length-1),d="apple-pay"===this.paymentMode&&l;return s("salla-modal",{key:"60e626bb49f8592c952182c182e6d73ddcaadeed",ref:t=>this.modal=t,class:"s-order-options-modal-host"+(this._isWizard?" s-oom-wizard-modal":""),width:"md","modal-title":this._isWizard?" ":o?this.freeProductTitle:this.title,onModalVisibilityChanged:t=>{t.detail||this.handleClose()}},this._isWizard&&s("div",{key:"a842b5d1566c8bb0bd68d5986fb092c14f8a01d6",slot:"icon",class:"s-oom-steps"},r.map(((t,o)=>[o>0&&s("div",{class:"s-oom-connector"}),s("div",{class:"s-oom-step "+(o===a?"active":o<a?"done":"")},s("span",{class:"s-oom-step-num"},o+1),s("span",{class:"s-oom-step-label"},t))]))),s("div",{key:"1f61a756dcf824bf4d8be71ccbd9a0c2742851d2",class:"s-order-options-modal-body"},o&&this.freeProduct&&s("div",{key:"667841475dff0deda06d8d04e0a2841f33ec54b6",class:"s-oom-free-product-card"},this.freeProduct.thumbnail&&s("img",{key:"129b99226216f0c1ca59fccbc0ba35d5af8cdee7",class:"s-oom-free-product-thumb",src:this.freeProduct.thumbnail,alt:this.freeProduct.name}),s("div",{key:"ae385e2d4fb967144743d67eadd50f31c23332ec",class:"s-oom-free-product-info"},s("span",{key:"4f48a3fd0af91435060a0d303a6d0f77f5afd1bc",class:"s-oom-free-product-name"},this.freeProduct.name),s("div",{key:"de62961aba2246c1d52d411461d6a45aed620eab",class:"s-oom-free-product-tags"},s("span",{key:"db1af48cc1a7583a7f2d026159ff01f03ad216bf",class:"s-oom-free-badge"},this.t("common.elements.free","مجاني")),this.freeProduct.offer_name&&s("span",{key:"ce595bccd755e908deb1c566758ca3629171962b",class:"s-oom-free-offer-name"},this.freeProduct.offer_name)))),s("p",{key:"161740bddbf25369392f362f9613f2e9c6a94fc1",class:"s-order-options-modal-subtitle"},o?this.freeProductSubtitle:this.subtitle),s("div",{key:"20d3f92f0f3782d599ec5ce923c2dad93f7c7608",class:"s-order-options-modal-fields"},this.orderOptions.length>0&&s("salla-product-options",{key:this.sessionId,ref:t=>{t&&(this.optionsRefs.set(i,t),t.seedSelectedOptions?.())},"product-id":e,"unique-key":i,options:JSON.stringify(this.orderOptions),"hide-out-label":"1","no-padding":!0}))),s("div",{key:"c80a0c1f1b32e5396483171196879bc43713c2f4",slot:"footer",class:"s-order-options-modal-footer"},d?s("div",{class:"s-order-options-modal-apple-pay-wrap"},s("div",{class:"s-order-options-modal-apple-pay-total"},s("span",{class:"s-order-options-modal-apple-pay-label"},this.totalLabel),s("span",{class:"s-order-options-modal-apple-pay-amount",innerHTML:t})),s("apple-pay-button",{locale:salla?.config?.get?.("user.language_code")||"ar",buttonstyle:"black",type:"buy",class:"s-order-options-modal-apple-pay",onClick:()=>this.handleSubmit()})):s("salla-button",{type:"button",color:"primary",fill:"solid",width:"wide",loading:this.isSubmitting,onClick:()=>this.handleSubmit()},s("span",{class:"s-order-options-modal-cta-content"},s("span",{class:"s-order-options-modal-cta-text"},o?this.freeProductContinueLabel:this.submitLabel),o?s("i",{class:{"s-oom-cta-arrow":!0,"sicon-arrow-left":this.isRtl(),"sicon-arrow-right":!this.isRtl()}}):s("span",{class:"s-order-options-modal-cta-total",innerHTML:t})))))}get host(){return o(this)}};e.style='/*!twlt*/@charset "UTF-8";.s-order-options-modal-host .s-modal-header-inner,.s-order-options-modal-host .s-modal-header-content,.s-order-options-modal-host .s-modal-title{text-align:start !important}.s-order-options-modal-host.s-oom-wizard-modal .s-modal-title{display:none}.s-order-options-modal-host.s-oom-wizard-modal .s-modal-header-inner{flex:1;min-width:0}.s-order-options-modal-host.s-oom-wizard-modal .s-modal-header-content{display:none}.s-oom-steps{display:flex;align-items:center;justify-content:flex-start;gap:0.5rem;width:100%;padding:0}.s-oom-step{display:inline-flex;align-items:center;gap:0.375rem;padding:0.375rem 0.75rem 0.375rem 0.625rem;border-radius:9999px;font-size:0.8125rem;font-weight:600;line-height:1;white-space:nowrap;color:#9ca3af;background:transparent;border:1.5px solid #e5e7eb;transition:background 0.2s, color 0.2s, border-color 0.2s}.s-oom-step.active{background:#1a2533;color:#ffffff;border-color:#1a2533}.s-oom-step.active .s-oom-step-num{background:rgba(255, 255, 255, 0.2);color:#ffffff}.s-oom-step.done{color:#6b7280;border-color:#d1d5db}.s-oom-step-num{display:inline-flex;align-items:center;justify-content:center;width:1.25rem;height:1.25rem;border-radius:50%;font-size:0.6875rem;font-weight:700;background:#e5e7eb;color:#6b7280;flex-shrink:0}.s-oom-step-label{font-size:0.8125rem}.s-oom-connector{flex:1;max-width:3rem;height:0;border-top:1.5px dashed #d1d5db}.s-oom-free-product-card{display:flex;align-items:center;gap:0.75rem;padding:0.75rem 1rem;margin-bottom:1rem;border:1px solid #e5e7eb;border-radius:0.75rem;background:#f9fafb;}.s-oom-free-product-info{display:flex;flex-direction:column;gap:0.25rem;min-width:0;flex:1}.s-oom-free-product-tags{display:flex;flex-wrap:wrap;align-items:center;gap:0.375rem}.s-oom-free-product-name{font-size:0.9375rem;font-weight:700;color:#111827;line-height:1.4;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.s-oom-free-badge{display:inline-block;padding:0.125rem 0.5rem;border-radius:9999px;font-size:0.6875rem;font-weight:600;color:#059669;background:#d1fae5;align-self:flex-start}.s-oom-free-offer-name{display:inline-block;padding:0.125rem 0.5rem;border-radius:9999px;font-size:0.6875rem;font-weight:500;color:#6b7280;background:#f3f4f6;align-self:flex-start}.s-oom-free-product-thumb{width:3.5rem;height:3.5rem;object-fit:cover;border-radius:0.5rem;flex-shrink:0;border:1px solid #e5e7eb}.s-order-options-modal-body{padding-top:0.25rem;max-height:60vh;overflow-y:auto;overscroll-behavior:contain}.s-order-options-modal-subtitle{font-size:0.875rem;color:#6b7280;margin-bottom:1rem;text-align:start}.s-order-options-modal-cta-content{display:flex;align-items:center;justify-content:center;gap:0.5rem;width:100%}.s-order-options-modal-cta-text{flex:1;text-align:center}.s-order-options-modal-apple-pay{display:block;width:100%;--apple-pay-button-width:100%;--apple-pay-button-height:44px;--apple-pay-button-border-radius:0.75rem}.s-order-options-modal-apple-pay-wrap{display:flex;flex-direction:column;gap:0.75rem;width:100%}.s-order-options-modal-apple-pay-total{display:flex;align-items:center;justify-content:space-between;gap:0.5rem}.s-order-options-modal-apple-pay-label,.s-order-options-modal-apple-pay-amount{font-size:1.125rem;line-height:1.5rem;font-weight:700;color:#111827}.s-oom-cta-arrow{font-size:0.875rem;flex-shrink:0}.static{position:static}.hidden{display:none}.shadow{--tw-shadow:0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.s-order-options-modal-body{display:block;max-height:60vh;overflow-y:auto;overscroll-behavior:contain}.s-order-options-modal-subtitle{margin-bottom:1rem;font-size:0.875rem;line-height:1.5rem;--tw-text-opacity:1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.s-order-options-modal-fields{display:flex;flex-direction:column;gap:1rem}.s-order-options-modal-item{display:block}.s-order-options-modal-footer{display:flex;width:100%;align-items:center}.s-order-options-modal-cta-content{display:flex;align-items:center;gap:0.25rem}.s-order-options-modal-cta-text{font-weight:700}.s-order-options-modal-cta-total{font-weight:700}';export{e as salla_order_options_modal}
|
|
4
|
+
import{r as t,h as s,a as o}from"./p-BXSGktmF.js";const e=class{constructor(s){t(this,s),this.resolveFn=null,this.rejectFn=null,this.optionsRefs=new Map,this.changeHandler=null,this.submitCallback=null,this._realOrderOptions=[],this._collectedFreeOptions=[],this._isWizard=!1,this._freeQueue=[],this._freeIndex=0,this._collectedFreeProducts=[],this._orderBasePrice=0,this._accumulatedExtra=0,this.orderOptions=[],this.basePrice=0,this.liveTotal=0,this.isSubmitting=!1,this.sessionId=0,this.paymentMode="default",this.freeProduct=null,this.inFreeStep=!1,this.title="",this.subtitle="",this.submitLabel="",this.totalLabel="",this.requiredMessage="",this.freeProductTitle="خيارات المنتج المجاني",this.freeProductSubtitle="اختر ما يناسبك من خيارات المنتج",this.freeProductContinueLabel="تابع واحصل على هديتك الان",this.handleClose=()=>{this.isSubmitting||(this.rejectFn?.({reason:"dismissed"}),this.resolveFn=null,this.rejectFn=null,this.detachChangeListener(),this.reset())},salla.lang.onLoaded((()=>this.loadTranslations()))}componentWillLoad(){this.loadTranslations()}isRtl(){return"rtl"===document?.documentElement?.getAttribute("dir")}t(t,s){const o=salla.lang.get(t);return o&&o!==t?o:s}loadTranslations(){this.title=salla.lang.get("blocks.order_options.title"),this.subtitle=salla.lang.get("blocks.order_options.subtitle"),this.submitLabel=salla.lang.get("blocks.order_options.continue"),this.totalLabel=salla.lang.get("blocks.order_options.total"),this.requiredMessage=salla.lang.get("blocks.order_options.required_message"),this.freeProductTitle=this.t("pages.products.free_product_options_title","خيارات المنتج المجاني"),this.freeProductSubtitle=this.t("pages.products.free_product_options_subtitle","اختر ما يناسبك من خيارات المنتج"),this.freeProductContinueLabel=this.t("pages.products.free_product_cta","تابع واحصل على هديتك الان")}async open(t){const s=t=>(Array.isArray(t)?t:[]).map((t=>({...t,details:t.details??[]}))),o=s(t.orderOptions),e=this.buildFreeQueue(t,s);return this._realOrderOptions=o,this._collectedFreeOptions=[],this._collectedFreeProducts=[],this._freeQueue=e,this._freeIndex=0,this._orderBasePrice=Number(t.basePrice)||0,this._accumulatedExtra=0,this._isWizard=e.length+(o.length>0?1:0)>1,this.isSubmitting=!1,this.optionsRefs.clear(),this.submitCallback=t.onSubmit??null,this.paymentMode=t.paymentMode??"default",e.length>0?this.loadFreeStep(0):(this.sessionId++,this.inFreeStep=!1,this.orderOptions=o,this.freeProduct=null,this.basePrice=Number(t.basePrice)||0,this.liveTotal=this.basePrice+this.seedOptionsPrice(this.orderOptions)),await(this.modal?.open()),this.modal?.setTitle(this.inFreeStep?this.freeProductTitle:this.title),this.attachChangeListener(),new Promise(((t,s)=>{this.resolveFn=t,this.rejectFn=s}))}buildFreeQueue(t,s){const o=[];if((Array.isArray(t.freeProducts)?t.freeProducts:[]).forEach((t=>{const e=s(t?.options);e.length&&o.push({product:t?.product?{...t.product,offer_name:t.offer_name??t.product.offer_name??null}:null,options:e,quantity:Number(t?.quantity)>0?Number(t.quantity):1})})),o.length)return o;const e=s(t.freeProductOptions);return e.length&&o.push({product:t.freeProduct??null,options:e,quantity:1}),o}loadFreeStep(t){const s=this._freeQueue[t];this._freeIndex=t,this.optionsRefs.clear(),this.inFreeStep=!0,this.orderOptions=s.options,this.freeProduct=s.product,this.basePrice=0,this.liveTotal=this.seedOptionsPrice(s.options),this.sessionId++}async close(){await(this.modal?.close())}collectOrderOptionsSync(){const t=[];for(const[,s]of this.optionsRefs)s&&s.querySelectorAll('[name^="options["],[name*="[options]["]').forEach((s=>{if(s instanceof HTMLInputElement&&("radio"===s.type||"checkbox"===s.type)&&!s.checked)return;const o=s.name.match(/(?:^|\[)options\]?\[(\d+)\]/);if(!o)return;const e=s.value;if(""===e||null==e)return;const i=Number(e);t.push({id:Number(o[1]),value:Number.isFinite(i)&&e===String(i)?i:e})}));return t}validateSync(){let t=!0;for(const[,s]of this.optionsRefs)s&&s.querySelectorAll("[required]").forEach((s=>{s.disabled||s.closest(".hidden")||"reportValidity"in s&&!s.reportValidity()&&(t=!1)}));return t}seedOptionsPrice(t){let s=0;return t.forEach((t=>{(t.details||[]).forEach((t=>{t.is_selected&&(s+=Number(t.total_price??t.additional_price)||0)}))})),s}attachChangeListener(){this.detachChangeListener(),this.changeHandler=()=>this.recomputeTotal(),salla.event.on("product-options::change",this.changeHandler)}detachChangeListener(){this.changeHandler&&(salla.event.off("product-options::change",this.changeHandler),this.changeHandler=null)}async recomputeTotal(){let t=0;for(const[,s]of this.optionsRefs)s&&(("function"==typeof s.getSelectedOptions?await s.getSelectedOptions():[])||[]).forEach((s=>{t+=Number(s.total_price??s.additional_price)||0}));this.liveTotal=this.basePrice+t}handleSubmit(){if(this.isSubmitting)return;if(!this.validateSync())return void salla.notify?.error?.(this.requiredMessage);if(this.inFreeStep){const t=this._freeQueue[this._freeIndex],s=this.collectOrderOptionsSync();if(0===this._freeIndex&&(this._collectedFreeOptions=s),s.length&&t?.product?.id){const o={};s.forEach((({id:t,value:s})=>{o[t]=s})),this._collectedFreeProducts.push({productId:t.product.id,quantity:t.quantity,options:o})}this._accumulatedExtra+=Math.max(0,this.liveTotal-this.basePrice);const o=this._freeIndex+1;return o<this._freeQueue.length?(this.loadFreeStep(o),void this.modal?.setTitle(this.freeProductTitle)):this._realOrderOptions.length?(this.optionsRefs.clear(),this.inFreeStep=!1,this.freeProduct=null,this.orderOptions=this._realOrderOptions,this.basePrice=this._orderBasePrice,this.liveTotal=this._orderBasePrice+this.seedOptionsPrice(this._realOrderOptions),this.sessionId++,void this.modal?.setTitle(this.title)):(this.isSubmitting=!0,this.liveTotal=this._orderBasePrice,this.fireSubmitCallback([]),this.resolveAndClose([]),void(this.isSubmitting=!1))}this.isSubmitting=!0;const t=this.collectOrderOptionsSync();this.fireSubmitCallback(t),this.resolveAndClose(t),this.isSubmitting=!1}finalTotal(){return Math.round(100*(this.liveTotal+this._accumulatedExtra))/100}fireSubmitCallback(t){try{this.submitCallback?.(t,this.finalTotal(),this._collectedFreeProducts)}catch(t){salla?.logger?.warn?.("order-options modal onSubmit threw",t)}}resolveAndClose(t){this.resolveFn?.({orderOptions:t,freeProductOptions:this._collectedFreeOptions,freeProducts:this._collectedFreeProducts}),this.resolveFn=null,this.rejectFn=null,this.submitCallback=null,this.detachChangeListener(),this.modal?.close().then((()=>this.reset()))}reset(){this.orderOptions=[],this.freeProduct=null,this.inFreeStep=!1,this.optionsRefs.clear(),this.liveTotal=0,this._realOrderOptions=[],this._collectedFreeOptions=[],this._collectedFreeProducts=[],this._freeQueue=[],this._freeIndex=0,this._isWizard=!1}render(){const t=salla.money(Math.round(100*this.liveTotal)/100),o=this.inFreeStep,e=o?String(this.freeProduct?.id||`free-prod-${this.orderOptions[0]?.id}`):`order-options-${this.orderOptions[0]?.id}`,i=o?`free-product-options-${this._freeIndex}`:"order-options",r=[...this._freeQueue.map((()=>this.freeProductTitle)),...this._realOrderOptions.length?[this.title]:[]],a=o?this._freeIndex:this._freeQueue.length,l=a===Math.max(0,r.length-1),d="apple-pay"===this.paymentMode&&l;return s("salla-modal",{key:"60e626bb49f8592c952182c182e6d73ddcaadeed",ref:t=>this.modal=t,class:"s-order-options-modal-host"+(this._isWizard?" s-oom-wizard-modal":""),width:"md","modal-title":this._isWizard?" ":o?this.freeProductTitle:this.title,onModalVisibilityChanged:t=>{t.detail||this.handleClose()}},this._isWizard&&s("div",{key:"a842b5d1566c8bb0bd68d5986fb092c14f8a01d6",slot:"icon",class:"s-oom-steps"},r.map(((t,o)=>[o>0&&s("div",{class:"s-oom-connector"}),s("div",{class:"s-oom-step "+(o===a?"active":o<a?"done":"")},s("span",{class:"s-oom-step-num"},o+1),s("span",{class:"s-oom-step-label"},t))]))),s("div",{key:"1f61a756dcf824bf4d8be71ccbd9a0c2742851d2",class:"s-order-options-modal-body"},o&&this.freeProduct&&s("div",{key:"667841475dff0deda06d8d04e0a2841f33ec54b6",class:"s-oom-free-product-card"},this.freeProduct.thumbnail&&s("img",{key:"129b99226216f0c1ca59fccbc0ba35d5af8cdee7",class:"s-oom-free-product-thumb",src:this.freeProduct.thumbnail,alt:this.freeProduct.name}),s("div",{key:"ae385e2d4fb967144743d67eadd50f31c23332ec",class:"s-oom-free-product-info"},s("span",{key:"4f48a3fd0af91435060a0d303a6d0f77f5afd1bc",class:"s-oom-free-product-name"},this.freeProduct.name),s("div",{key:"de62961aba2246c1d52d411461d6a45aed620eab",class:"s-oom-free-product-tags"},s("span",{key:"db1af48cc1a7583a7f2d026159ff01f03ad216bf",class:"s-oom-free-badge"},this.t("common.elements.free","مجاني")),this.freeProduct.offer_name&&s("span",{key:"ce595bccd755e908deb1c566758ca3629171962b",class:"s-oom-free-offer-name"},this.freeProduct.offer_name)))),s("p",{key:"161740bddbf25369392f362f9613f2e9c6a94fc1",class:"s-order-options-modal-subtitle"},o?this.freeProductSubtitle:this.subtitle),s("div",{key:"20d3f92f0f3782d599ec5ce923c2dad93f7c7608",class:"s-order-options-modal-fields"},this.orderOptions.length>0&&s("salla-product-options",{key:this.sessionId,ref:t=>{t&&(this.optionsRefs.set(i,t),t.seedSelectedOptions?.())},"product-id":e,"unique-key":i,options:JSON.stringify(this.orderOptions),"hide-out-label":"1","no-padding":!0}))),s("div",{key:"c80a0c1f1b32e5396483171196879bc43713c2f4",slot:"footer",class:"s-order-options-modal-footer"},d?s("div",{class:"s-order-options-modal-apple-pay-wrap"},s("div",{class:"s-order-options-modal-apple-pay-total"},s("span",{class:"s-order-options-modal-apple-pay-label"},this.totalLabel),s("span",{class:"s-order-options-modal-apple-pay-amount",innerHTML:t})),s("apple-pay-button",{locale:salla?.config?.get?.("user.language_code")||"ar",buttonstyle:"black",type:"buy",class:"s-order-options-modal-apple-pay",onClick:()=>this.handleSubmit()})):s("salla-button",{type:"button",color:"primary",fill:"solid",width:"wide",loading:this.isSubmitting,onClick:()=>this.handleSubmit()},s("span",{class:"s-order-options-modal-cta-content"},s("span",{class:"s-order-options-modal-cta-text"},o?this.freeProductContinueLabel:this.submitLabel),o?s("i",{class:{"s-oom-cta-arrow":!0,"sicon-arrow-left":this.isRtl(),"sicon-arrow-right":!this.isRtl()}}):s("span",{class:"s-order-options-modal-cta-total",innerHTML:t})))))}get host(){return o(this)}};e.style='/*!twlt*/@charset "UTF-8";.s-order-options-modal-host .s-modal-header-inner,.s-order-options-modal-host .s-modal-header-content,.s-order-options-modal-host .s-modal-title{text-align:start !important}.s-order-options-modal-host.s-oom-wizard-modal .s-modal-title{display:none}.s-order-options-modal-host.s-oom-wizard-modal .s-modal-header-inner{flex:1;min-width:0}.s-order-options-modal-host.s-oom-wizard-modal .s-modal-header-content{display:none}.s-oom-steps{display:flex;align-items:center;justify-content:flex-start;gap:0.5rem;width:100%;padding:0}.s-oom-step{display:inline-flex;align-items:center;gap:0.375rem;padding:0.375rem 0.75rem 0.375rem 0.625rem;border-radius:9999px;font-size:0.8125rem;font-weight:600;line-height:1;white-space:nowrap;color:#9ca3af;background:transparent;border:1.5px solid #e5e7eb;transition:background 0.2s, color 0.2s, border-color 0.2s}.s-oom-step.active{background:#1a2533;color:#ffffff;border-color:#1a2533}.s-oom-step.active .s-oom-step-num{background:rgba(255, 255, 255, 0.2);color:#ffffff}.s-oom-step.done{color:#6b7280;border-color:#d1d5db}.s-oom-step-num{display:inline-flex;align-items:center;justify-content:center;width:1.25rem;height:1.25rem;border-radius:50%;font-size:0.6875rem;font-weight:700;background:#e5e7eb;color:#6b7280;flex-shrink:0}.s-oom-step-label{font-size:0.8125rem}.s-oom-connector{flex:1;max-width:3rem;height:0;border-top:1.5px dashed #d1d5db}.s-oom-free-product-card{display:flex;align-items:center;gap:0.75rem;padding:0.75rem 1rem;margin-bottom:1rem;border:1px solid #e5e7eb;border-radius:0.75rem;background:#f9fafb;}.s-oom-free-product-info{display:flex;flex-direction:column;gap:0.25rem;min-width:0;flex:1}.s-oom-free-product-tags{display:flex;flex-wrap:wrap;align-items:center;gap:0.375rem}.s-oom-free-product-name{font-size:0.9375rem;font-weight:700;color:#111827;line-height:1.4;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.s-oom-free-badge{display:inline-block;padding:0.125rem 0.5rem;border-radius:9999px;font-size:0.6875rem;font-weight:600;color:#059669;background:#d1fae5;align-self:flex-start}.s-oom-free-offer-name{display:inline-block;padding:0.125rem 0.5rem;border-radius:9999px;font-size:0.6875rem;font-weight:500;color:#6b7280;background:#f3f4f6;align-self:flex-start}.s-oom-free-product-thumb{width:3.5rem;height:3.5rem;object-fit:cover;border-radius:0.5rem;flex-shrink:0;border:1px solid #e5e7eb}.s-order-options-modal-body{padding-top:0.25rem;max-height:60vh;overflow-y:auto;overscroll-behavior:contain}.s-order-options-modal-subtitle{font-size:0.875rem;color:#6b7280;margin-bottom:1rem;text-align:start}.s-order-options-modal-cta-content{display:flex;align-items:center;justify-content:center;gap:0.5rem;width:100%}.s-order-options-modal-cta-text{flex:1;text-align:center}.s-order-options-modal-apple-pay{display:block;width:100%;--apple-pay-button-width:100%;--apple-pay-button-height:44px;--apple-pay-button-border-radius:0.75rem}.s-order-options-modal-apple-pay-wrap{display:flex;flex-direction:column;gap:0.75rem;width:100%}.s-order-options-modal-apple-pay-total{display:flex;align-items:center;justify-content:space-between;gap:0.5rem}.s-order-options-modal-apple-pay-label,.s-order-options-modal-apple-pay-amount{font-size:1.125rem;line-height:1.5rem;font-weight:700;color:#111827}.s-oom-cta-arrow{font-size:0.875rem;flex-shrink:0}.static{position:static}.hidden{display:none}.shadow{--tw-shadow:0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.s-order-options-modal-body{display:block;max-height:60vh;overflow-y:auto;overscroll-behavior:contain}.s-order-options-modal-subtitle{margin-bottom:1rem;font-size:0.875rem;line-height:1.5rem;--tw-text-opacity:1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.s-order-options-modal-fields{display:flex;flex-direction:column;gap:1rem}.s-order-options-modal-item{display:block}.s-order-options-modal-footer{display:flex;width:100%;align-items:center}.s-order-options-modal-cta-content{display:flex;align-items:center;gap:0.25rem}.s-order-options-modal-cta-text{font-weight:700}.s-order-options-modal-cta-total{font-weight:700}';export{e as salla_order_options_modal}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{d as t}from"./p-
|
|
4
|
+
import{d as t}from"./p-BXSGktmF.js";function n(t,n){return n.forEach((function(n){n&&"string"!=typeof n&&!Array.isArray(n)&&Object.keys(n).forEach((function(e){if("default"!==e&&!(e in t)){var r=Object.getOwnPropertyDescriptor(n,e);Object.defineProperty(t,e,r.get?r:{enumerable:!0,get:function(){return n[e]}})}}))})),Object.freeze(t)}var e,r={exports:{}},i=(e||(e=1,r.exports=function(){var t={type:"spring",stiffness:.5,damping:.45,mass:10},n=function(t){return-.5*(Math.cos(Math.PI*t)-1)},e=function(t){var n=Math.min(10/t.width,10/t.height),e=document.createElement("canvas"),i=e.getContext("2d"),o=e.width=Math.ceil(t.width*n),a=e.height=Math.ceil(t.height*n);i.drawImage(t,0,0,o,a);var _=null;try{_=i.getImageData(0,0,o,a).data}catch(t){return null}for(var E=_.length,u=0,I=0,c=0,T=0;T<E;T+=4)u+=_[T]*_[T],I+=_[T+1]*_[T+1],c+=_[T+2]*_[T+2];return{r:u=r(u,E),g:I=r(I,E),b:c=r(c,E)}},r=function(t,n){return Math.floor(Math.sqrt(t/(n/4)))},i=function(t,e,r,i,o){t.width=e,t.height=r;var a=t.getContext("2d"),_=.5*e,E=a.createRadialGradient(_,r+110,r-100,_,r+110,r+100);(function(t,e){for(var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:n,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:10,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,_=1-a,E=e.join(","),u=0;u<=o;u++){var I=u/o;t.addColorStop(a+_*I,"rgba(".concat(E,", ").concat(i(I)*r,")"))}})(E,i,o,void 0,8,.4),a.save(),a.translate(-250,0),a.scale(2,1),a.fillStyle=E,a.fillRect(0,0,e,r),a.restore()},o="undefined"!=typeof navigator,a="undefined"!=typeof document,_=500,E=200,u=o&&a&&document.createElement("canvas"),I=o&&a&&document.createElement("canvas"),c=o&&a&&document.createElement("canvas"),T=[40,40,40],f=[196,78,71],l=[54,151,99];o&&a&&(i(u,_,E,T,.85),i(I,_,E,f,1),i(c,_,E,l,1));var s=function(n){var r=n.utils.createView({name:"file-poster-overlay",tag:"canvas",ignoreRect:!0,create:function(t){var n,e;(e=t.root.element).width=(n=t.props.template).width,e.height=n.height,e.getContext("2d").drawImage(n,0,0)},mixins:{styles:["opacity"],animations:{opacity:{type:"spring",mass:25}}}}),o=function(t){var n=t.root;n.ref.overlayShadow.opacity=1,n.ref.overlayError.opacity=0,n.ref.overlaySuccess.opacity=0},a=function(t){var n=t.root;n.ref.overlayShadow.opacity=.25,n.ref.overlayError.opacity=1};return n.utils.createView({name:"file-poster-wrapper",create:function(e){var o=e.root,a=e.props,s=o.query("GET_FILE_POSTER_ITEM_OVERLAY_SHADOW_COLOR"),O=o.query("GET_FILE_POSTER_ITEM_OVERLAY_ERROR_COLOR"),R=o.query("GET_FILE_POSTER_ITEM_OVERLAY_SUCCESS_COLOR");s&&s!==T&&i(u,_,E,T=s,.85),O&&O!==f&&i(I,_,E,f=O,1),R&&R!==l&&i(c,_,E,l=R,1);var v=function(n){return n.utils.createView({name:"file-poster",tag:"div",ignoreRect:!0,create:function(t){var n=t.root;n.ref.image=document.createElement("img"),n.element.appendChild(n.ref.image)},write:n.utils.createRoute({DID_FILE_POSTER_LOAD:function(t){var n=t.root,e=t.props,r=e.id,i=n.query("GET_ITEM",{id:e.id});if(i){var o=i.getMetadata("poster");n.ref.image.src=o,n.dispatch("DID_FILE_POSTER_DRAW",{id:r})}}}),mixins:{styles:["scaleX","scaleY","opacity"],animations:{scaleX:t,scaleY:t,opacity:{type:"tween",duration:750}}}})}(n);o.ref.image=o.appendChildView(o.createChildView(v,{id:a.id,scaleX:1.25,scaleY:1.25,opacity:0})),o.ref.overlayShadow=o.appendChildView(o.createChildView(r,{template:u,opacity:0})),o.ref.overlaySuccess=o.appendChildView(o.createChildView(r,{template:c,opacity:0})),o.ref.overlayError=o.appendChildView(o.createChildView(r,{template:I,opacity:0}))},write:n.utils.createRoute({DID_FILE_POSTER_LOAD:function(t){t.root.ref.overlayShadow.opacity=1},DID_FILE_POSTER_DRAW:function(t){var n=t.root.ref.image;n.scaleX=1,n.scaleY=1,n.opacity=1},DID_FILE_POSTER_CONTAINER_CREATE:function(t){var n,r,i,o=t.root,a=t.props.id,_=o.query("GET_ITEM",a);if(_){var E=_.getMetadata("poster"),u=function(t){var n=o.query("GET_FILE_POSTER_CALCULATE_AVERAGE_IMAGE_COLOR")?e(t):null;_.setMetadata("color",n,!0),o.dispatch("DID_FILE_POSTER_LOAD",{id:a,data:t})};n=E,r=function(t,n){var e,r;o.dispatch("DID_FILE_POSTER_CALCULATE_SIZE",{id:a,width:t,height:n}),(e=E,r=o.query("GET_FILE_POSTER_CROSS_ORIGIN_ATTRIBUTE_VALUE"),new Promise((function(t,n){var i=new Image;"string"==typeof crossOrigin&&(i.crossOrigin=r),i.onload=function(){t(i)},i.onerror=function(t){n(t)},i.src=e}))).then(u)},(i=new Image).onload=function(){var t=i.naturalWidth,n=i.naturalHeight;i=null,r(t,n)},i.src=n}},DID_THROW_ITEM_LOAD_ERROR:a,DID_THROW_ITEM_PROCESSING_ERROR:a,DID_THROW_ITEM_INVALID:a,DID_COMPLETE_ITEM_PROCESSING:function(t){var n=t.root;n.ref.overlayShadow.opacity=.25,n.ref.overlaySuccess.opacity=1},DID_START_ITEM_PROCESSING:o,DID_REVERT_ITEM_PROCESSING:o})})},O=function(t){var n=t.addFilter,e=t.utils,r=e.Type,i=e.createRoute,o=s(t);return n("CREATE_VIEW",(function(t){var n=t.view,e=t.query;if((0,t.is)("file")&&e("GET_ALLOW_FILE_POSTER")){var r=function(t,r){var i=r.id,a=e("GET_ITEM",i);a&&a.getMetadata("poster")&&!a.archived&&t.ref.previousPoster!==a.getMetadata("poster")&&(t.ref.previousPoster=a.getMetadata("poster"),e("GET_FILE_POSTER_FILTER_ITEM")(a)&&(t.ref.filePoster&&n.removeChildView(t.ref.filePoster),t.ref.filePoster=n.appendChildView(n.createChildView(o,{id:i})),t.dispatch("DID_FILE_POSTER_CONTAINER_CREATE",{id:i})))},a=function(t){var n=t.root,e=n.query("GET_FILE_POSTER_HEIGHT");if(e)return e;var r=n.query("GET_FILE_POSTER_MIN_HEIGHT"),i=n.query("GET_FILE_POSTER_MAX_HEIGHT");if(r&&n.ref.imageHeight<r)return r;var o=n.rect.element.width*(n.ref.imageHeight/n.ref.imageWidth);return r&&o<r?r:i&&o>i?i:o};n.registerWriter(i({DID_LOAD_ITEM:function(t){r(t.root,t.props)},DID_FILE_POSTER_CALCULATE_SIZE:function(t){var n=t.root,e=t.action;n.ref.filePoster&&(n.ref.imageWidth=e.width,n.ref.imageHeight=e.height,n.ref.shouldUpdatePanelHeight=!0,n.dispatch("KICK"))},DID_UPDATE_ITEM_METADATA:function(t){var n=t.root,e=t.props;/poster/.test(t.action.change.key)&&r(n,e)}},(function(t){var n=t.root;n.ref.filePoster&&(n.rect.element.hidden||n.ref.shouldUpdatePanelHeight&&(n.dispatch("DID_UPDATE_PANEL_HEIGHT",{id:t.props.id,height:a({root:n})}),n.ref.shouldUpdatePanelHeight=!1))})))}})),{options:{allowFilePoster:[!0,r.BOOLEAN],filePosterHeight:[null,r.INT],filePosterMinHeight:[null,r.INT],filePosterMaxHeight:[null,r.INT],filePosterFilterItem:[function(){return!0},r.FUNCTION],filePosterCalculateAverageImageColor:[!1,r.BOOLEAN],filePosterCrossOriginAttributeValue:["Anonymous",r.STRING],filePosterItemOverlayShadowColor:[null,r.ARRAY],filePosterItemOverlayErrorColor:[null,r.ARRAY],filePosterItemOverlaySuccessColor:[null,r.ARRAY]}}};return"undefined"!=typeof window&&void 0!==window.document&&document.dispatchEvent(new CustomEvent("FilePond:pluginloaded",{detail:O})),O}()),r.exports),o=n({__proto__:null,default:t(i)},[i]);
|
|
5
5
|
/*!
|
|
6
6
|
* FilePondPluginFilePoster 2.5.2
|
|
7
7
|
* Licensed under MIT, https://opensource.org/licenses/MIT/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as e,h as r}from"./p-
|
|
4
|
+
import{r as e,h as r}from"./p-BXSGktmF.js";import{C as o}from"./p-CTtM5VoO.js";const t=class{constructor(r){e(this,r),this.coupons=[],this.isLoading=!0,this.giftsTitle="",this.titlePercentTpl="",this.titleFixedTpl="",this.badgeLabel="",this.copyLabel="",this.copiedLabel="",this.minSpendTpl="",this.expiresTpl=""}componentWillLoad(){Salla.onReady().then((()=>Salla.lang.onLoaded())).then((()=>(this.loadTranslations(),this.loadCoupons()))).catch((()=>{this.isLoading=!1}))}loadTranslations(){this.giftsTitle=Salla.lang.get("pages.thank_you.gifts_title"),this.titlePercentTpl=Salla.lang.get("pages.thank_you.next_order_coupon_title_percent")||"",this.titleFixedTpl=Salla.lang.get("pages.thank_you.next_order_coupon_title_fixed")||"",this.badgeLabel=Salla.lang.get("pages.thank_you.next_order_coupon_badge"),this.copyLabel=Salla.lang.get("common.elements.copy")||"",this.copiedLabel=Salla.lang.get("pages.thank_you.next_order_coupon_copied")||"",this.minSpendTpl=Salla.lang.get("pages.thank_you.next_order_coupon_min_spend")||"",this.expiresTpl=Salla.lang.get("pages.thank_you.next_order_coupon_expires")||""}async loadCoupons(){if(document.getElementById("theme-editor-script"))return this.coupons=[{code:"PREVIEW15",type:"P",amount:15}],void(this.isLoading=!1);try{const e=await salla.api.request("coupons",{params:{type:"thankyou"}}),r=e?.data,o=Array.isArray(r)?r:Array.isArray(r?.data)?r.data:[];this.coupons=o}catch{this.coupons=[]}finally{this.isLoading=!1}}async copyCode(e){try{await navigator.clipboard.writeText(e),salla.notify.success(this.copiedLabel),salla.event.dispatch("salla::next-order-coupon.code.copied",{code:e})}catch{}}isPercentage(e){return"P"===e.type||"percentage"===e.type}formatAmount(e){if(this.isPercentage(e))return`${salla.helpers.number(e.amount)}%`;const r=e.amount;return"object"==typeof r&&r.amount?salla.money({amount:r.amount,currency:r.currency}):salla.money(r)}amountDescription(e){const r=this.isPercentage(e)?this.titlePercentTpl:this.titleFixedTpl,o=this.isPercentage(e)?":amount%":":amount";return r.replace(o,this.formatAmount(e))}minSpend(e){const r=e.minimum_amount;return r?"string"==typeof r?r.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,"""):r.amount?salla.money({amount:r.amount,currency:r.currency}):"":""}expiry(e){if(!e.expiry_date)return"";const r=new Date(e.expiry_date);return Number.isNaN(r.getTime())?"":r.toLocaleDateString(Salla.lang.locale||"en-GB")}renderTerms(e){const o=this.minSpend(e),t=this.expiry(e);return o||t?r("span",{class:"s-next-order-coupon-meta"},o&&this.minSpendTpl?r("span",{innerHTML:this.minSpendTpl.replace(":amount",o)}):null,t&&this.expiresTpl?r("span",null,this.expiresTpl.replace(":date",t)):null):null}renderCard(e){return r("div",{class:"s-next-order-coupon-card"},r("div",{class:"s-next-order-coupon-details"},r("span",{class:"s-next-order-coupon-title"},r("span",{"aria-hidden":"true"},"🎁"),r("span",null,e.title||this.badgeLabel)),e.description?r("span",{class:"s-next-order-coupon-desc"},e.description):r("span",{class:"s-next-order-coupon-desc",innerHTML:this.amountDescription(e)}),this.renderTerms(e)),r("button",{type:"button",class:"s-next-order-coupon-code",title:this.copyLabel,onClick:()=>this.copyCode(e.code)},r("span",{dir:"ltr"},e.code),r("span",{innerHTML:o})))}renderSkeleton(){return r("div",{class:"s-next-order-coupon-wrapper s-next-order-coupon-skeleton"},r("salla-skeleton",{height:"20px",width:"120px"}),r("div",{class:"s-next-order-coupon-list"},r("div",{class:"s-next-order-coupon-card"},r("salla-skeleton",{height:"36px"})),r("div",{class:"s-next-order-coupon-card"},r("salla-skeleton",{height:"36px"}))))}render(){return this.isLoading?this.renderSkeleton():this.coupons.length?r("div",{class:"s-next-order-coupon-wrapper"},r("div",{class:"s-next-order-coupon-heading"},this.giftsTitle),r("div",{class:"s-next-order-coupon-list"},this.coupons.map((e=>this.renderCard(e))))):null}};t.style="/*!twlt*/:host{display:block}.fixed{position:fixed}.block{display:block}.s-next-order-coupon-wrapper{display:flex;flex-direction:column;gap:0.25rem;overflow:hidden;border-radius:0.75rem;background-color:color-mix(in srgb,var(--color-primary) 8%,var(--color-surface,#fff));padding-left:0.125rem;padding-right:0.125rem;padding-bottom:0.125rem;padding-top:0.25rem}.s-next-order-coupon-heading{padding-left:0.75rem;padding-right:0.75rem;font-size:0.875rem;font-weight:700;line-height:1.25rem;color:var(--color-text-primary,#333)}.s-next-order-coupon-list{display:flex;flex-wrap:wrap;align-items:stretch;gap:0.125rem}.s-next-order-coupon-card{display:flex;min-width:14rem;flex:1 1 0%;align-items:flex-start;justify-content:space-between;gap:0.25rem;border-radius:0.75rem;background-color:var(--color-surface,#fff);padding:0.75rem}.s-next-order-coupon-details{display:flex;min-width:0px;flex:1 1 0%;flex-direction:column;gap:0.25rem;font-size:0.75rem;line-height:1rem}.s-next-order-coupon-title{display:flex;align-items:flex-start;gap:0.25rem;font-weight:700;color:var(--color-text-primary,#333)}.s-next-order-coupon-desc{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--color-text-secondary,#666)}.s-next-order-coupon-meta{display:flex;flex-wrap:wrap;column-gap:0.5rem;font-size:0.75rem;line-height:1rem;color:var(--color-text-secondary,#666)}.s-next-order-coupon-code{display:inline-flex;flex-shrink:0;cursor:pointer;align-items:center;gap:0.25rem;border-width:0px;background-color:transparent;padding:0px;font-size:0.75rem;font-weight:700;line-height:1rem;color:var(--color-text-primary,#333)}.s-next-order-coupon-code svg{height:0.875rem;width:0.875rem;fill:currentColor}@keyframes pulse{50%{opacity:.5}}.s-next-order-coupon-skeleton{animation:pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite}.s-thank-you-page-wrapper .s-next-order-coupon-heading{font-size:1rem;line-height:1.5rem}.s-thank-you-page-wrapper .s-next-order-coupon-details,.s-thank-you-page-wrapper .s-next-order-coupon-code{font-size:0.875rem;line-height:1.25rem}.s-thank-you-page-wrapper .s-next-order-coupon-code svg{height:1.25rem;width:1.25rem}.s-thank-you-page-wrapper .s-next-order-coupon-card{min-width:0px;flex-direction:column;gap:0.5rem;padding:0.75rem}@media (min-width: 640px){.s-thank-you-page-wrapper .s-next-order-coupon-card{flex-direction:row;padding:1.25rem}}.s-thank-you-page-wrapper .s-next-order-coupon-details{width:100%;gap:0.5rem}.s-thank-you-page-wrapper .s-next-order-coupon-list{display:grid;grid-template-columns:repeat(2, minmax(0, 1fr));gap:0.125rem}.s-thank-you-page-wrapper .s-next-order-coupon-card:only-child{grid-column:span 2 / span 2}.s-thank-you-page-wrapper .s-next-order-coupon-desc{white-space:normal;overflow-wrap:break-word}.s-thank-you-page-wrapper .s-next-order-coupon-code{max-width:100%;flex-wrap:wrap;text-align:start}.s-thank-you-page-wrapper .s-next-order-coupon-code>span{min-width:0px;word-break:break-all}";export{t as salla_next_order_coupon}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as t,c as i,f as r,h as e,H as s,a as o}from"./p-DRvWpd5P.js";import{M as a}from"./p-DmgxDvXL.js";const n=class{constructor(r){t(this,r),this.verified=i(this,"verified"),this.translationLoaded=!1,this.display="modal",this.type="mobile",this.autoReload=!0,this.supportWebAuth=!0,this.resendAfter=30,this.isProfileVerify=!1,"inline"!=this.display?(this.profileVerificationListener=t=>{let i=Array.isArray(t)?t[0]:t;"delete_account"===i?.request_type||document.getElementById("salla-user-settings-delete-modal")?.hasAttribute("visible")||(this.isProfileVerify=!0,this.open(i),this.title=salla.lang.get("pages.profile.verify_title")+salla.lang.get("common.elements."+i.type),this.modal?.setTitle(this.title))},this.modalClosedListener=()=>{this.resendAfter=0,this.timer.innerHTML="30 : 00"}):this.modal={open:()=>"",close:()=>"",setTitle:()=>""}}connectedCallback(){this.profileVerificationListener&&(salla.event.on("profile::verification",this.profileVerificationListener),salla.event.on("modalClosed",this.modalClosedListener)),this.langUnsubscribe=salla.lang.subscribe((()=>{this.translationLoaded=!0,this.title=salla.lang.get("pages.profile.verify_title")+salla.lang.get("common.elements."+this.type),this.modal?.setTitle(this.title),r(this)}))}disconnectedCallback(){this.profileVerificationListener&&(salla.event.off("profile::verification",this.profileVerificationListener),salla.event.off("modalClosed",this.modalClosedListener)),this.langUnsubscribe?.()}splitNumber(t){this.resetError();let i=t.data||t.target.value;i&&1!==i.length&&this.modifyNext(t.target,i)}modifyNext(t,i){t.value=i[0],i=i.substring(1),t.nextElementSibling&&i.length?this.modifyNext(t.nextElementSibling,i):t.nextElementSibling||0!==i.length?t.nextElementSibling&&0===i.length&&t.nextElementSibling.focus():t.focus()}checkAllInputs(){let t=!0;for(let i=0;i<this.otpInputs.length;i++)""===this.otpInputs[i].value&&(t=!1);return t}handleKeyUp(t){if(this.resetError(),["Alt","Shift","Control","AltGraph","Ctrl"].includes(t.key))return;let i=t.keyCode||t.charCode;t.target.value?(t.target.nextElementSibling?.focus(),t.target.nextElementSibling?.select()):[8,46].includes(i)&&(t.target.previousElementSibling?.focus(),t.target.previousElementSibling?.select()),t.target.value.length>1&&this.splitNumber(t)}handlePaste(t){this.resetError();let i=(salla.helpers.number(t.clipboardData.getData("text"))||"").replace(/[^0-9]/g,"");i=i.substring(0,this.otpInputs.length),this.otpInputs.forEach((t=>t.value="")),this.modifyNext(this.otpInputs[0],i)}handleInput(t){this.resetError(),salla.helpers.inputDigitsOnly(t.target),this.checkAllInputs()&&setTimeout((()=>{this.toggleOTPSubmit()}),100)}resetError(){this.hasError=!1,this.errorMessage=""}handleFocus(t){t.target!==this.firstOtpInput&&(""==this.firstOtpInput?.value&&this.firstOtpInput.focus(),""==t.target.previousElementSibling.value&&t.target.previousElementSibling.focus())}async getCode(){return this.code.value}async open(t){this.data=t,this.data.type=this.data.type||this.type,this.type=this.data.type,this.resendTimer(),this.otpInputs=this.body.querySelectorAll(".s-verify-input"),this.firstOtpInput=this.body.querySelector("#otp-1"),this.reset(),this.resetError(),"modal"==this.display&&this.modal?.setTitle(this.title),this.modal.open(),this.firstOtpInput?.addEventListener("input",(t=>this.splitNumber(t))),setTimeout((()=>this.otpInputs[0].focus()),100)}toggleOTPSubmit(){let t=[];if(this.otpInputs.forEach((i=>i.value&&t.push(i.value))),this.code.value=t.join(""),4===t.length)return this.btn.disable(),void this.btn.click();this.btn.enable()}reset(){this.otpInputs.forEach((t=>t.value="")),this.code.value="",this.otpInputs[0].focus()}resendTimer(){this.resendMessage.style.display="block",this.resend.style.display="none",this.resendAfter=30;let t=setInterval((()=>{this.resendAfter<=0?(clearInterval(t),this.resend.style.display="block",this.resendMessage.style.display="none"):(this.timer.innerHTML=`${this.resendAfter>=10?this.resendAfter:"0"+this.resendAfter} : 00`,this.resendAfter--)}),1e3)}resendCode(){return this.btn.stop().then((()=>this.btn.disable())).then((()=>{this.otpInputs.forEach((t=>t.value="")),this.otpInputs[0].focus()})).then((()=>this.resendHandler?this.resendHandler(this.data):salla.api.auth.resend(this.data))).finally((()=>this.resendTimer()))}submit(){if(this.code.value.length<4)return this.otpInputs[this.code.value.length].focus(),void salla.log("Trying to submit without 4 digits!");let t={code:this.code.value,...this.data};return this.btn.load().then((()=>this.btn.disable())).then((()=>this.verifyHandler?this.verifyHandler(t):this.isProfileVerify?salla.profile.verify(t):salla.auth.verify(t,this.supportWebAuth))).then((t=>this.verified.emit(t))).then((()=>this.btn.stop()&&this.btn.disable())).then((()=>this.modal.close())).then((()=>this.autoReload&&window.location.reload())).catch((t=>{this.hasError=!0,this.errorMessage=t.response?.data?.error?.message||salla.lang.get("common.errors.error_occurred"),t.response?salla.logger.error(t):console.log("Unexpected error",t),this.btn.stop()&&this.btn.enable()&&this.reset()}))}render(){return"inline"==this.display?e(s,null,this.myBody()):e("salla-modal",{width:"xs",class:"s-verify",ref:t=>this.modal=t,"modal-title":this.title},e("span",{slot:"icon",class:"s-verify-header-icon",innerHTML:"mobile"==this.type?'\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>android-phone</title>\n<path d="M22.667 0h-13.333c-2.941 0-5.333 2.392-5.333 5.333v21.333c0 2.941 2.392 5.333 5.333 5.333h13.333c2.941 0 5.333-2.392 5.333-5.333v-21.333c0-2.941-2.392-5.333-5.333-5.333zM25.333 26.667c0 1.471-1.196 2.667-2.667 2.667h-13.333c-1.471 0-2.667-1.196-2.667-2.667v-2.667h18.667zM25.333 21.333h-18.667v-16c0-1.471 1.196-2.667 2.667-2.667h13.333c1.471 0 2.667 1.196 2.667 2.667zM13.333 28h5.333c0.736 0 1.333-0.597 1.333-1.333s-0.597-1.333-1.333-1.333h-5.333c-0.736 0-1.333 0.597-1.333 1.333s0.597 1.333 1.333 1.333z"></path>\n</svg>\n':a}),this.myBody())}myBody(){return e("div",{class:"s-verify-body",ref:t=>this.body=t},e("div",{class:"s-verify-message",innerHTML:salla.lang.get("pages.profile.verify_message")}),e("slot",{name:"mobile"}),e("slot",{name:"email"}),e("input",{type:"hidden",name:"code",maxlength:"4",required:!0,ref:t=>this.code=t}),e("div",{class:{"s-verify-codes":!0,"has-error":this.hasError},dir:"ltr"},[1,2,3,4].map((t=>e("input",{type:"number",autocomplete:"one-time-code",pattern:"[0-9]*",inputmode:"numeric",maxlength:"1",value:"",id:`otp-${t}`,class:{"s-verify-input":!0,"s-has-error":this.hasError},onInput:t=>this.handleInput(t),onPaste:t=>this.handlePaste(t),onKeyUp:t=>this.handleKeyUp(t),onFocus:t=>this.handleFocus(t),required:!0})))),this.hasError&&this.errorMessage?e("span",{class:"s-verify-error-message"},this.errorMessage):"",e("div",{slot:"footer",class:"s-verify-footer"},e("salla-button",{class:"s-verify-submit","loader-position":"center",disabled:!0,onClick:()=>this.submit(),ref:t=>this.btn=t},salla.lang.get("pages.profile.verify")),e("p",{class:"s-verify-resend-message",ref:t=>this.resendMessage=t},salla.lang.get("blocks.header.resend_after"),e("b",{class:"s-verify-timer",ref:t=>this.timer=t})),e("a",{href:"#",class:"s-verify-resend",onClick:()=>this.resendCode(),ref:t=>this.resend=t},salla.lang.get("blocks.comments.submit"))),e("slot",{name:"after-footer"}))}get host(){return o(this)}};n.style='/*!twlt*/salla-verify{display:block}.s-verify-input{}.s-verify-input::-webkit-outer-spin-button,.s-verify-input::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}.s-verify-input[type=number]{-moz-appearance:textfield}.visible{visibility:visible}.block{display:block}.inline{display:inline}.hidden{display:none}.s-has-error{--tw-border-opacity:1;border-color:rgb(248 113 113 / var(--tw-border-opacity, 1))}.s-has-error:focus{--tw-border-opacity:1;border-color:rgb(239 68 68 / var(--tw-border-opacity, 1))}.btn{display:inline-flex;flex:1 1 0%;align-items:center;justify-content:center;white-space:nowrap;border-radius:0.375rem;padding-left:1.5rem;padding-right:1.5rem;padding-bottom:0.625rem;padding-top:0.5rem;font-size:0.875rem;line-height:1.25rem;font-weight:700;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:300ms}.btn:hover{opacity:0.8}.has-error .s-form-label{color:#ff443a}.has-error .s-form-control,.has-error .s-tel-input-control,.has-error .s-datetime-picker-input{border-color:#ff443a;color:#ff443a}.s-has-error{--tw-border-opacity:1 !important;border-color:rgb(239 68 68 / var(--tw-border-opacity, 1)) !important;--tw-text-opacity:1 !important;color:rgb(239 68 68 / var(--tw-text-opacity, 1)) !important}.s-verify-message{text-align:center;font-size:0.875rem;line-height:1.25rem;--tw-text-opacity:1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.s-verify-label{margin-bottom:1rem;display:block;text-align:center;font-size:0.875rem;line-height:1.25rem}.s-verify-codes{margin-left:-0.25rem;margin-right:-0.25rem;margin-bottom:1.25rem;display:flex;justify-content:space-between}.s-verify-codes.has-error{margin-bottom:0px}.s-verify-input{margin-left:0.25rem;margin-right:0.25rem;height:2.5rem;width:100%;border-radius:var(--s-radius, 0.25rem);border-width:1px;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1));padding-left:0.5rem;padding-right:0.5rem;text-align:center;font-size:1.125rem;line-height:1.75rem;font-weight:700;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms}.s-verify-input:focus{border-color:var(--color-primary)}.s-verify-input:is(.dark *){--tw-border-opacity:1;border-color:rgb(75 85 99 / var(--tw-border-opacity, 1));--tw-bg-opacity:1;background-color:rgb(75 85 99 / var(--tw-bg-opacity, 1))}.s-verify-footer{text-align:center}.s-verify-submit{margin-bottom:1.25rem;width:100%}.s-verify-header-icon{display:inline-flex;height:3rem;width:3rem;align-items:center;justify-content:center;border-radius:9999px;border-width:1px;border-style:solid;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1))}@media (min-width: 640px){.s-verify-header-icon{margin-left:auto;margin-right:auto;margin-bottom:1rem;height:5rem;width:5rem}}.s-verify-header-icon:where([dir="ltr"],[dir="ltr"] *){margin-right:0.5rem}@media (min-width: 640px){.s-verify-header-icon:where([dir="ltr"],[dir="ltr"] *){margin-right:0px}}.s-verify-header-icon:where([dir="rtl"],[dir="rtl"] *){margin-left:0.5rem}@media (min-width: 640px){.s-verify-header-icon:where([dir="rtl"],[dir="rtl"] *){margin-left:0px}}.s-verify-resend-message{font-size:0.875rem;line-height:1.25rem;--tw-text-opacity:1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.s-verify-error-message{margin-bottom:1.25rem;display:block;height:1.75rem;padding-top:0.75rem;text-align:center;font-size:0.75rem;line-height:1rem;--tw-border-opacity:1;border-color:rgb(248 113 113 / var(--tw-border-opacity, 1))}.s-verify-error-message:focus{--tw-border-opacity:1;border-color:rgb(239 68 68 / var(--tw-border-opacity, 1))}.s-verify-error-message{--tw-border-opacity:1 !important;border-color:rgb(239 68 68 / var(--tw-border-opacity, 1)) !important;--tw-text-opacity:1 !important;color:rgb(239 68 68 / var(--tw-text-opacity, 1)) !important}.s-verify-timer{margin-left:0.25rem;margin-right:0.25rem;--tw-text-opacity:1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.s-verify-resend{text-align:center;font-size:0.875rem;line-height:1.25rem;color:var(--color-primary)}.s-verify-back{position:absolute;left:10px;top:10px;display:flex;height:2rem;width:2rem;align-items:center;justify-content:center;border-radius:9999px;--tw-bg-opacity:1;background-color:rgb(249 250 251 / var(--tw-bg-opacity, 1));font-size:1.125rem;line-height:1.75rem;--tw-text-opacity:1;color:rgb(75 85 99 / var(--tw-text-opacity, 1));transition-property:color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms}.s-verify-back:hover{--tw-bg-opacity:1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.s-verify-back:where([dir="rtl"],[dir="rtl"] *){left:unset;right:10px}.s-verify-back svg{height:18px;width:18px}[dir=\'ltr\'] .s-verify-back{transform:scale(-1)}';export{n as salla_verify}
|
|
4
|
+
import{r as t,c as i,f as r,h as e,H as s,a as o}from"./p-BXSGktmF.js";import{M as a}from"./p-DmgxDvXL.js";const n=class{constructor(r){t(this,r),this.verified=i(this,"verified"),this.translationLoaded=!1,this.display="modal",this.type="mobile",this.autoReload=!0,this.supportWebAuth=!0,this.resendAfter=30,this.isProfileVerify=!1,"inline"!=this.display?(this.profileVerificationListener=t=>{let i=Array.isArray(t)?t[0]:t;"delete_account"===i?.request_type||document.getElementById("salla-user-settings-delete-modal")?.hasAttribute("visible")||(this.isProfileVerify=!0,this.open(i),this.title=salla.lang.get("pages.profile.verify_title")+salla.lang.get("common.elements."+i.type),this.modal?.setTitle(this.title))},this.modalClosedListener=()=>{this.resendAfter=0,this.timer.innerHTML="30 : 00"}):this.modal={open:()=>"",close:()=>"",setTitle:()=>""}}connectedCallback(){this.profileVerificationListener&&(salla.event.on("profile::verification",this.profileVerificationListener),salla.event.on("modalClosed",this.modalClosedListener)),this.langUnsubscribe=salla.lang.subscribe((()=>{this.translationLoaded=!0,this.title=salla.lang.get("pages.profile.verify_title")+salla.lang.get("common.elements."+this.type),this.modal?.setTitle(this.title),r(this)}))}disconnectedCallback(){this.profileVerificationListener&&(salla.event.off("profile::verification",this.profileVerificationListener),salla.event.off("modalClosed",this.modalClosedListener)),this.langUnsubscribe?.()}splitNumber(t){this.resetError();let i=t.data||t.target.value;i&&1!==i.length&&this.modifyNext(t.target,i)}modifyNext(t,i){t.value=i[0],i=i.substring(1),t.nextElementSibling&&i.length?this.modifyNext(t.nextElementSibling,i):t.nextElementSibling||0!==i.length?t.nextElementSibling&&0===i.length&&t.nextElementSibling.focus():t.focus()}checkAllInputs(){let t=!0;for(let i=0;i<this.otpInputs.length;i++)""===this.otpInputs[i].value&&(t=!1);return t}handleKeyUp(t){if(this.resetError(),["Alt","Shift","Control","AltGraph","Ctrl"].includes(t.key))return;let i=t.keyCode||t.charCode;t.target.value?(t.target.nextElementSibling?.focus(),t.target.nextElementSibling?.select()):[8,46].includes(i)&&(t.target.previousElementSibling?.focus(),t.target.previousElementSibling?.select()),t.target.value.length>1&&this.splitNumber(t)}handlePaste(t){this.resetError();let i=(salla.helpers.number(t.clipboardData.getData("text"))||"").replace(/[^0-9]/g,"");i=i.substring(0,this.otpInputs.length),this.otpInputs.forEach((t=>t.value="")),this.modifyNext(this.otpInputs[0],i)}handleInput(t){this.resetError(),salla.helpers.inputDigitsOnly(t.target),this.checkAllInputs()&&setTimeout((()=>{this.toggleOTPSubmit()}),100)}resetError(){this.hasError=!1,this.errorMessage=""}handleFocus(t){t.target!==this.firstOtpInput&&(""==this.firstOtpInput?.value&&this.firstOtpInput.focus(),""==t.target.previousElementSibling.value&&t.target.previousElementSibling.focus())}async getCode(){return this.code.value}async open(t){this.data=t,this.data.type=this.data.type||this.type,this.type=this.data.type,this.resendTimer(),this.otpInputs=this.body.querySelectorAll(".s-verify-input"),this.firstOtpInput=this.body.querySelector("#otp-1"),this.reset(),this.resetError(),"modal"==this.display&&this.modal?.setTitle(this.title),this.modal.open(),this.firstOtpInput?.addEventListener("input",(t=>this.splitNumber(t))),setTimeout((()=>this.otpInputs[0].focus()),100)}toggleOTPSubmit(){let t=[];if(this.otpInputs.forEach((i=>i.value&&t.push(i.value))),this.code.value=t.join(""),4===t.length)return this.btn.disable(),void this.btn.click();this.btn.enable()}reset(){this.otpInputs.forEach((t=>t.value="")),this.code.value="",this.otpInputs[0].focus()}resendTimer(){this.resendMessage.style.display="block",this.resend.style.display="none",this.resendAfter=30;let t=setInterval((()=>{this.resendAfter<=0?(clearInterval(t),this.resend.style.display="block",this.resendMessage.style.display="none"):(this.timer.innerHTML=`${this.resendAfter>=10?this.resendAfter:"0"+this.resendAfter} : 00`,this.resendAfter--)}),1e3)}resendCode(){return this.btn.stop().then((()=>this.btn.disable())).then((()=>{this.otpInputs.forEach((t=>t.value="")),this.otpInputs[0].focus()})).then((()=>this.resendHandler?this.resendHandler(this.data):salla.api.auth.resend(this.data))).finally((()=>this.resendTimer()))}submit(){if(this.code.value.length<4)return this.otpInputs[this.code.value.length].focus(),void salla.log("Trying to submit without 4 digits!");let t={code:this.code.value,...this.data};return this.btn.load().then((()=>this.btn.disable())).then((()=>this.verifyHandler?this.verifyHandler(t):this.isProfileVerify?salla.profile.verify(t):salla.auth.verify(t,this.supportWebAuth))).then((t=>this.verified.emit(t))).then((()=>this.btn.stop()&&this.btn.disable())).then((()=>this.modal.close())).then((()=>this.autoReload&&window.location.reload())).catch((t=>{this.hasError=!0,this.errorMessage=t.response?.data?.error?.message||salla.lang.get("common.errors.error_occurred"),t.response?salla.logger.error(t):console.log("Unexpected error",t),this.btn.stop()&&this.btn.enable()&&this.reset()}))}render(){return"inline"==this.display?e(s,null,this.myBody()):e("salla-modal",{width:"xs",class:"s-verify",ref:t=>this.modal=t,"modal-title":this.title},e("span",{slot:"icon",class:"s-verify-header-icon",innerHTML:"mobile"==this.type?'\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>android-phone</title>\n<path d="M22.667 0h-13.333c-2.941 0-5.333 2.392-5.333 5.333v21.333c0 2.941 2.392 5.333 5.333 5.333h13.333c2.941 0 5.333-2.392 5.333-5.333v-21.333c0-2.941-2.392-5.333-5.333-5.333zM25.333 26.667c0 1.471-1.196 2.667-2.667 2.667h-13.333c-1.471 0-2.667-1.196-2.667-2.667v-2.667h18.667zM25.333 21.333h-18.667v-16c0-1.471 1.196-2.667 2.667-2.667h13.333c1.471 0 2.667 1.196 2.667 2.667zM13.333 28h5.333c0.736 0 1.333-0.597 1.333-1.333s-0.597-1.333-1.333-1.333h-5.333c-0.736 0-1.333 0.597-1.333 1.333s0.597 1.333 1.333 1.333z"></path>\n</svg>\n':a}),this.myBody())}myBody(){return e("div",{class:"s-verify-body",ref:t=>this.body=t},e("div",{class:"s-verify-message",innerHTML:salla.lang.get("pages.profile.verify_message")}),e("slot",{name:"mobile"}),e("slot",{name:"email"}),e("input",{type:"hidden",name:"code",maxlength:"4",required:!0,ref:t=>this.code=t}),e("div",{class:{"s-verify-codes":!0,"has-error":this.hasError},dir:"ltr"},[1,2,3,4].map((t=>e("input",{type:"number",autocomplete:"one-time-code",pattern:"[0-9]*",inputmode:"numeric",maxlength:"1",value:"",id:`otp-${t}`,class:{"s-verify-input":!0,"s-has-error":this.hasError},onInput:t=>this.handleInput(t),onPaste:t=>this.handlePaste(t),onKeyUp:t=>this.handleKeyUp(t),onFocus:t=>this.handleFocus(t),required:!0})))),this.hasError&&this.errorMessage?e("span",{class:"s-verify-error-message"},this.errorMessage):"",e("div",{slot:"footer",class:"s-verify-footer"},e("salla-button",{class:"s-verify-submit","loader-position":"center",disabled:!0,onClick:()=>this.submit(),ref:t=>this.btn=t},salla.lang.get("pages.profile.verify")),e("p",{class:"s-verify-resend-message",ref:t=>this.resendMessage=t},salla.lang.get("blocks.header.resend_after"),e("b",{class:"s-verify-timer",ref:t=>this.timer=t})),e("a",{href:"#",class:"s-verify-resend",onClick:()=>this.resendCode(),ref:t=>this.resend=t},salla.lang.get("blocks.comments.submit"))),e("slot",{name:"after-footer"}))}get host(){return o(this)}};n.style='/*!twlt*/salla-verify{display:block}.s-verify-input{}.s-verify-input::-webkit-outer-spin-button,.s-verify-input::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}.s-verify-input[type=number]{-moz-appearance:textfield}.visible{visibility:visible}.block{display:block}.inline{display:inline}.hidden{display:none}.s-has-error{--tw-border-opacity:1;border-color:rgb(248 113 113 / var(--tw-border-opacity, 1))}.s-has-error:focus{--tw-border-opacity:1;border-color:rgb(239 68 68 / var(--tw-border-opacity, 1))}.btn{display:inline-flex;flex:1 1 0%;align-items:center;justify-content:center;white-space:nowrap;border-radius:0.375rem;padding-left:1.5rem;padding-right:1.5rem;padding-bottom:0.625rem;padding-top:0.5rem;font-size:0.875rem;line-height:1.25rem;font-weight:700;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:300ms}.btn:hover{opacity:0.8}.has-error .s-form-label{color:#ff443a}.has-error .s-form-control,.has-error .s-tel-input-control,.has-error .s-datetime-picker-input{border-color:#ff443a;color:#ff443a}.s-has-error{--tw-border-opacity:1 !important;border-color:rgb(239 68 68 / var(--tw-border-opacity, 1)) !important;--tw-text-opacity:1 !important;color:rgb(239 68 68 / var(--tw-text-opacity, 1)) !important}.s-verify-message{text-align:center;font-size:0.875rem;line-height:1.25rem;--tw-text-opacity:1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.s-verify-label{margin-bottom:1rem;display:block;text-align:center;font-size:0.875rem;line-height:1.25rem}.s-verify-codes{margin-left:-0.25rem;margin-right:-0.25rem;margin-bottom:1.25rem;display:flex;justify-content:space-between}.s-verify-codes.has-error{margin-bottom:0px}.s-verify-input{margin-left:0.25rem;margin-right:0.25rem;height:2.5rem;width:100%;border-radius:var(--s-radius, 0.25rem);border-width:1px;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1));padding-left:0.5rem;padding-right:0.5rem;text-align:center;font-size:1.125rem;line-height:1.75rem;font-weight:700;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms}.s-verify-input:focus{border-color:var(--color-primary)}.s-verify-input:is(.dark *){--tw-border-opacity:1;border-color:rgb(75 85 99 / var(--tw-border-opacity, 1));--tw-bg-opacity:1;background-color:rgb(75 85 99 / var(--tw-bg-opacity, 1))}.s-verify-footer{text-align:center}.s-verify-submit{margin-bottom:1.25rem;width:100%}.s-verify-header-icon{display:inline-flex;height:3rem;width:3rem;align-items:center;justify-content:center;border-radius:9999px;border-width:1px;border-style:solid;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1))}@media (min-width: 640px){.s-verify-header-icon{margin-left:auto;margin-right:auto;margin-bottom:1rem;height:5rem;width:5rem}}.s-verify-header-icon:where([dir="ltr"],[dir="ltr"] *){margin-right:0.5rem}@media (min-width: 640px){.s-verify-header-icon:where([dir="ltr"],[dir="ltr"] *){margin-right:0px}}.s-verify-header-icon:where([dir="rtl"],[dir="rtl"] *){margin-left:0.5rem}@media (min-width: 640px){.s-verify-header-icon:where([dir="rtl"],[dir="rtl"] *){margin-left:0px}}.s-verify-resend-message{font-size:0.875rem;line-height:1.25rem;--tw-text-opacity:1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.s-verify-error-message{margin-bottom:1.25rem;display:block;height:1.75rem;padding-top:0.75rem;text-align:center;font-size:0.75rem;line-height:1rem;--tw-border-opacity:1;border-color:rgb(248 113 113 / var(--tw-border-opacity, 1))}.s-verify-error-message:focus{--tw-border-opacity:1;border-color:rgb(239 68 68 / var(--tw-border-opacity, 1))}.s-verify-error-message{--tw-border-opacity:1 !important;border-color:rgb(239 68 68 / var(--tw-border-opacity, 1)) !important;--tw-text-opacity:1 !important;color:rgb(239 68 68 / var(--tw-text-opacity, 1)) !important}.s-verify-timer{margin-left:0.25rem;margin-right:0.25rem;--tw-text-opacity:1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.s-verify-resend{text-align:center;font-size:0.875rem;line-height:1.25rem;color:var(--color-primary)}.s-verify-back{position:absolute;left:10px;top:10px;display:flex;height:2rem;width:2rem;align-items:center;justify-content:center;border-radius:9999px;--tw-bg-opacity:1;background-color:rgb(249 250 251 / var(--tw-bg-opacity, 1));font-size:1.125rem;line-height:1.75rem;--tw-text-opacity:1;color:rgb(75 85 99 / var(--tw-text-opacity, 1));transition-property:color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms}.s-verify-back:hover{--tw-bg-opacity:1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.s-verify-back:where([dir="rtl"],[dir="rtl"] *){left:unset;right:10px}.s-verify-back svg{height:18px;width:18px}[dir=\'ltr\'] .s-verify-back{transform:scale(-1)}';export{n as salla_verify}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as t,h as s,H as a}from"./p-
|
|
4
|
+
import{r as t,h as s,H as a}from"./p-BXSGktmF.js";const l=class{constructor(s){t(this,s),this.order=null,this.loading=!0}async componentWillLoad(){await salla.onReady(),await this.loadOrder()}async onOrderIdChange(){this.loading=!0,this.order=null,await this.loadOrder()}get paymentUrl(){return this.order?.customer_editing?.payment_url}async loadOrder(){const t=this.orderId||salla.config.get("page.id");if(t)try{const s=await salla.order.api.getDetails(t);this.order=s?.data??s??null}catch(t){salla.logger?.warn?.("[salla-edit-order-button] failed to fetch order details",t),this.order=null}finally{this.loading=!1}else this.loading=!1}renderEditButton(){return s("salla-count-down",{prefixText:salla.lang.getWithDefault("pages.orders.edit_within","يمكنك التعديل خلال"),buttonHref:this.order?.edit_url,buttonText:salla.lang.getWithDefault("pages.orders.edit_order","تعديل الطلب"),buttonIcon:"sicon-edit",date:this.order?.editable_until,horizontal:!0,autoSegments:!0,withButton:!0,labeled:!1,size:"sm",color:"primary"})}render(){return this.loading||!this.order?null:this.order?.is_editable?s(a,null,this.renderEditButton()):this.paymentUrl?s(a,null,s("salla-button",{href:this.paymentUrl,color:"primary",size:"small"},s("i",{class:"sicon-wallet"}),salla.lang.getWithDefault("pages.orders.pay_difference","دفع فارق المبلغ"))):null}static get watchers(){return{orderId:["onOrderIdChange"]}}};l.style="/*!twlt*/:host{display:block}";export{l as salla_edit_order_button}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r,h as t,H as a}from"./p-
|
|
4
|
+
import{r,h as t,H as a}from"./p-BXSGktmF.js";const s=class{constructor(t){r(this,t)}refreshSummary(){this.amounts?this.setSummaryFromAmounts(this.amounts):this.order?this.setSummaryFromOrder(this.order):this.summary=void 0}handleAmountsChange(){this.refreshSummary()}handleOrderChange(){this.refreshSummary()}async componentWillLoad(){await Salla.onReady(),this.refreshSummary()}normalizeAmounts(r){const t="string"==typeof r?JSON.parse(r):r;return{sub_total:t.sub_total,total:t.total,shipping_cost:t.shipping_cost,cod_cost:t.cash_on_delivery,paid_amount:t.paid_amount,remaining_amount:t.remaining_amount,refund_amount:t.refund_amount,options:t.options,options_total:t.options_total,service_fees:Array.isArray(t.service_fees)?t.service_fees:void 0,tax:t.tax?{percent:"string"==typeof t.tax.percent?parseFloat(t.tax.percent):t.tax.percent,amount:t.tax.amount}:void 0,discounts:t.discounts?.map((r=>({name:r.title,discount:"string"==typeof r.discount?parseFloat(r.discount):r.discount})))}}setSummaryFromAmounts(r){try{this.summary=this.normalizeAmounts(r)}catch(r){salla.logger.error("Failed to parse amounts data",r),this.summary=void 0}}setSummaryFromOrder(r){try{const t="string"==typeof r?JSON.parse(r):{...r};Array.isArray(t.service_fees)||delete t.service_fees,this.summary=t}catch(r){salla.logger.error("Failed to parse order summary data",r),this.summary=void 0}}renderTotalRow(r,a,s,o,e){return t("div",{class:"s-order-totals-card-row"},t("div",{class:"s-order-totals-card-row-inner"},t("dt",{class:s||"s-order-totals-card-label"},r),t("dd",{class:o||"s-order-totals-card-value"},t(e?"b":"span",{innerHTML:salla.money(a)}))))}renderDiscountRow(){return this.summary?.discounts?.map((r=>t("div",{class:"s-order-totals-card-row",key:r.name},t("div",{class:"s-order-totals-card-row-inner"},t("dt",{class:"s-order-totals-card-discount"},r.name),t("dd",{class:"s-order-totals-card-value"},r.discount)))))}renderRefundRow(r){return t("div",{class:"s-order-totals-card-row"},t("div",{class:"s-order-totals-card-row-inner"},t("dt",{class:"s-order-totals-card-refund-label"},t("span",{class:"s-order-totals-card-refund-icon"},t("i",{class:"sicon-info"})),t("span",null," ",salla.lang.get("pages.orders.refund_amount"))),t("dd",{class:"s-order-totals-card-refund-value"},t("b",{innerHTML:salla.money(r)}))))}toAmount(r){return null==r?0:"number"==typeof r?Number.isFinite(r)?r:0:"string"==typeof r?parseFloat(r)||0:this.toAmount(r.amount)}isChargeableServiceFee(r){return String(r?.title??"").trim().length>0&&this.toAmount(r?.amount)>0}renderServiceFeeRows(){const r=this.summary?.service_fees;return Array.isArray(r)?r.filter((r=>this.isChargeableServiceFee(r))).map((r=>this.renderTotalRow(String(r.title).trim(),r.amount))):null}render(){if(!this.summary)return t(a,{class:"s-order-totals-card-wrapper"});const{summary:r}=this,s=!!Array.isArray(r.options)&&r.options.length>0,o=this.toAmount(r.refund_amount),e=r.has_remaining_amount??this.toAmount(r.remaining_amount)>0;return t(a,{class:"s-order-totals-card-wrapper"},t("div",{class:"s-order-totals-card-panel"},t("h2",{id:"summary-heading",class:"s-order-totals-card-heading"},salla.lang.get("pages.orders.summary")),t("div",{class:"s-order-totals-card-flow"},t("dl",{class:"s-order-totals-card-list"},this.renderTotalRow(salla.lang.get("pages.cart.items_total"),r.sub_total),s&&this.renderTotalRow(salla.lang.get("pages.cart.order_options_total"),r.options_total),this.renderServiceFeeRows(),r.discounts&&this.renderDiscountRow(),r.cod_cost&&this.renderTotalRow(salla.lang.get("pages.orders.cod_cost"),r.cod_cost,""),r.shipping_cost&&this.renderTotalRow(salla.lang.get("pages.orders.shipping_cost"),r.shipping_cost,"s-order-totals-card-shipping"),r.tax&&this.renderTotalRow(`${salla.lang.get("pages.cart.tax")} ${r.tax.percent}%`,r.tax.amount,""),e&&null!=r.paid_amount?this.renderTotalRow(salla.lang.get("pages.orders.partially_paid"),r.paid_amount,""):null,e?this.renderTotalRow(salla.lang.get("pages.orders.remaining_amount"),r.remaining_amount,""):null,t("div",{class:"s-order-totals-card-total"},this.renderTotalRow(salla.lang.get("pages.orders.final_total"),r.total,"s-order-totals-card-total-label","s-order-totals-card-total-value",!0)),o>0?t("div",{class:"s-order-totals-card-refund"},this.renderRefundRow(r.refund_amount)):null))))}static get watchers(){return{amounts:["handleAmountsChange"],order:["handleOrderChange"]}}};s.style='/*!twlt*/:host{display:block}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.s-order-totals-card-wrapper{display:block}.s-order-totals-card-panel{border-radius:0.375rem;--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1));padding-left:1.5rem;padding-right:1.5rem}.s-order-totals-card-heading{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0, 0, 0, 0);white-space:nowrap;border-width:0}.s-order-totals-card-flow{display:flow-root}.s-order-totals-card-list{font-size:0.875rem;line-height:1.25rem;--tw-text-opacity:1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.s-order-totals-card-list>.s-order-totals-card-row{border-bottom-width:1px}.s-order-totals-card-list>.s-order-totals-card-row:last-child{border-bottom-width:0px}.s-order-totals-card-row{display:block}.s-order-totals-card-row-inner{display:flex;align-items:center;justify-content:space-between;gap:1rem;padding-top:1.25rem;padding-bottom:1.25rem}.s-order-totals-card-label{--tw-text-opacity:1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.s-order-totals-card-value{font-weight:500}.s-order-totals-card-discount{--tw-text-opacity:1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.s-order-totals-card-tax-value{font-weight:500;--tw-text-opacity:1;color:rgb(17 24 39 / var(--tw-text-opacity, 1))}.s-order-totals-card-total{margin-left:-1.5rem;margin-right:-1.5rem;border-radius:0.375rem;background-color:var(--color-border);padding-left:1.5rem;padding-right:1.5rem}.s-order-totals-card-total-label{font-size:1rem;line-height:1.5rem;font-weight:500}.s-order-totals-card-total-value{font-size:1rem;line-height:1.5rem;font-weight:500}.s-order-totals-card-refund{margin-left:-1.5rem;margin-right:-1.5rem;border-left-width:4px;--tw-border-opacity:1;border-color:rgb(254 202 202 / var(--tw-border-opacity, 1));--tw-bg-opacity:1;background-color:rgb(254 242 242 / var(--tw-bg-opacity, 1));padding-left:1.5rem;padding-right:1.5rem}.s-order-totals-card-refund:where([dir="rtl"],[dir="rtl"] *){border-left-width:0px;border-right-width:4px}.s-order-totals-card-refund-label{display:flex;align-items:center;gap:0.5rem;--tw-text-opacity:1;color:rgb(220 38 38 / var(--tw-text-opacity, 1))}.s-order-totals-card-refund-icon{font-size:0.875rem;line-height:1.25rem;--tw-text-opacity:1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.s-order-totals-card-refund-value{font-weight:500;--tw-text-opacity:1;color:rgb(220 38 38 / var(--tw-text-opacity, 1))}';export{s as salla_order_totals_card}
|
|
@@ -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,a as i}from"./p-DRvWpd5P.js";import{H as o}from"./p-00vBRoH3.js";import{S as e}from"./p-D4oPi1Ov.js";import{C as s}from"./p-gFG8By9O.js";const c=class{constructor(r){if(t(this,r),this.forceShowWishlistButton=!1,this.compactAddToCart=!1,this.showOutOfStockBesidePrice=!1,this.COMPACT_TITLE_MAX_LENGTH=60,salla.onReady((()=>{this.fitImageHeight=salla.config.get("store.settings.product.fit_type"),salla.wishlist.event.onAdded(((t,r)=>this.toggleFavoriteIcon(!0,r))),salla.wishlist.event.onRemoved(((t,r)=>this.toggleFavoriteIcon(!1,r))),salla.event.on("wishlist::storage.synced",(()=>this.productData&&this.toggleFavoriteIcon(this.isInWishlist()))),this.placeholder=salla.url.asset(salla.config.get("theme.settings.placeholder"))})),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")}}connectedCallback(){this.langUnsubscribe=salla.lang.subscribe((()=>{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")}))}disconnectedCallback(){this.langUnsubscribe?.()}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,r=null){r&&r!==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 r=new Date(t);return`${r.getFullYear()}-${r.getMonth()+1}-${r.getDate()}`}getDisplayTitle(){const t=this.productData?.name||"";return!this.compact||t.length<=this.COMPACT_TITLE_MAX_LENGTH?t:t.slice(0,this.COMPACT_TITLE_MAX_LENGTH).trimEnd()+"…"}getProductBadge(){return this.productData?.is_out_of_stock&&!this.showOutOfStockBesidePrice?r("div",{class:"s-product-card-out-badge"},this.outOfStock):this.showQuantity&&this.productData?.quantity?r("div",{class:"s-product-card-quantity"},this.remained," ",salla.helpers.number(this.productData?.quantity)):this.productData.promotion_title?r("div",{class:"s-product-card-promotion-title"},this.productData.promotion_title):""}renderAddToCartLabel(){return r("slot",{name:"add-to-cart-label"},this.compactAddToCart?r("span",{class:"s-product-card-add-to-cart-icon",innerHTML:s}):this.productData.add_to_cart_label)}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?r("div",{class:"s-product-card-sale-price"},r("p",{class:"s-product-card-price-value",innerHTML:this.getPriceFormat(this.productData.sale_price)}),r("span",{innerHTML:this.getPriceFormat(this.productData?.regular_price)})):this.productData.starting_price?r("div",{class:"s-product-card-starting-price"},r("p",null,this.startingPrice),r("h4",{innerHTML:this.getPriceFormat(this.productData?.starting_price)})):r("p",{class:"s-product-card-price-value",innerHTML:this.getPriceFormat(this.productData?.price)})}render(){if(!this.productData)return null;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 r(a,{id:`product-${this.productData?.id}`,class:t},r("div",{class:this.fullImage?"s-product-card-image-full":"s-product-card-image"},r("a",{...i},r("img",{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&&r("a",{...i,class:"s-product-card-overlay"}),this.horizontal||this.fullImage?"":r("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()},r("span",{innerHTML:o}))),r("div",{class:"s-product-card-content"},this.isSpecial&&this.productData?.quantity?r("div",{class:"s-product-card-content-pie",ref:t=>this.pie=t},r("span",null,r("b",null,salla.helpers.number(this.productData?.quantity)),this.remained),r("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"-2 -1 36 34",class:"s-product-card-content-pie-svg"},r("circle",{cx:"16",cy:"16",r:"15.9155",class:"s-product-card-content-pie-svg-base"}),r("circle",{cx:"16",cy:"16",r:"15.9155",class:"s-product-card-content-pie-svg-bar"}))):"",r("div",{class:{"s-product-card-content-main":!0,"s-product-card-content-extra-padding":this.isSpecial}},r("h3",{class:"s-product-card-content-title"},r("a",{...i},this.getDisplayTitle())),this.productData?.subtitle&&!this.minimal?r("p",{class:"s-product-card-content-subtitle"},this.productData?.subtitle):""),!this.productData?.donation||this.minimal||this.fullImage?"":[r("salla-progress-bar",{donation:this.productData?.donation}),r("div",{class:"s-product-card-donation-input"},this.productData?.donation?.can_donate?[r("label",{htmlFor:"donation-amount"},this.donationAmount," ",r("span",null,"*")),r("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})]:"")],r("div",{class:{"s-product-card-content-sub":!0,"s-product-card-content-extra-padding":this.isSpecial}},this.getProductPrice(),this.showOutOfStockBesidePrice&&this.productData?.is_out_of_stock?r("span",{class:"s-product-card-out-of-stock-label"},this.outOfStock):"",this.productData?.rating?.stars&&!this.minimal?r("div",{class:"s-product-card-rating"},r("span",{innerHTML:e}),r("span",null,this.productData.rating.stars)):""),this.isSpecial&&this.productData.discount_ends?r("salla-count-down",{date:this.formatDate(this.productData.discount_ends),"end-of-day":!0,boxed:!0,labeled:!0}):"",this.hideAddBtn||this.compact?"":r("div",{class:"s-product-card-content-footer"},r("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},this.renderAddToCartLabel()),this.horizontal||this.fullImage?r("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 }}"},r("span",{class:"text-xl",innerHTML:o})):"")),!this.hideAddBtn&&this.compact?r("div",{class:"s-product-card-content-footer"},r("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"},this.renderAddToCartLabel()),this.forceShowWishlistButton?r("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()},r("span",{innerHTML:o})):""):"")}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)}};c.style='/*!twlt*/.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}.text-xl{font-size:1.25rem;line-height:1.75rem}.shadow{--tw-shadow:0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}.outline{outline-style:solid}.has-error .s-form-control,.has-error .s-tel-input-control,.has-error .s-datetime-picker-input{border-color:#ff443a;color:#ff443a}.s-form-control{display:block;width:100%;border-radius:var(--s-radius, 0.25rem);border-width:1px;--tw-border-opacity:1;border-color:rgb(209 213 219 / var(--tw-border-opacity, 1));--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1));padding:0.5rem;font-size:0.875rem;line-height:1.25rem;--tw-text-opacity:1;color:rgb(17 24 39 / var(--tw-text-opacity, 1))}.s-form-control:focus{border-color:var(--color-primary);--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000)}.s-product-card-entry{position:relative;display:flex;height:100%;justify-content:space-between;border-radius:var(--s-radius, 0.25rem);--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1));transition-property:box-shadow;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:300ms}.s-product-card-shadow:hover{box-shadow:5px 10px 30px #2b2d340d}.s-product-card-out-of-stock img.loaded{--tw-grayscale:grayscale(100%);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.s-product-card-overlay{position:absolute;top:0px;bottom:0px;left:0px;right:0px;--tw-bg-opacity:1;background-color:rgb(0 0 0 / var(--tw-bg-opacity, 1));opacity:0.5;transition-property:opacity;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:700ms}.s-product-card-overlay:hover{opacity:0.4}.s-product-card-vertical{flex-direction:column}.s-product-card-vertical .s-product-card-image{flex:1 1 0%;border-top-left-radius:var(--s-radius, 0.25rem);border-top-right-radius:var(--s-radius, 0.25rem)}.s-product-card-vertical .s-product-card-wishlist-btn{position:absolute;top:0.5rem;right:0.5rem;opacity:0.75}.s-product-card-vertical .s-product-card-wishlist-btn:hover{opacity:1}@media (min-width: 768px){.s-product-card-vertical .s-product-card-wishlist-btn{right:0.5rem}}.s-product-card-vertical .s-product-card-wishlist-btn:where([dir="rtl"],[dir="rtl"] *){left:0.5rem;right:unset}@media (min-width: 768px){.s-product-card-vertical .s-product-card-wishlist-btn:where([dir="rtl"],[dir="rtl"] *){left:0.5rem;right:unset}}.s-product-card-minimal .s-product-card-wishlist-btn{position:absolute;top:0px;right:0px;opacity:0.75}.s-product-card-minimal .s-product-card-wishlist-btn:hover{opacity:1}@media (min-width: 768px){.s-product-card-minimal .s-product-card-wishlist-btn{right:0px}}.s-product-card-minimal .s-product-card-wishlist-btn:where([dir="rtl"],[dir="rtl"] *){left:0px;right:unset}@media (min-width: 768px){.s-product-card-minimal .s-product-card-wishlist-btn:where([dir="rtl"],[dir="rtl"] *){left:0px;right:unset}}.s-product-card-minimal .s-product-card-image{width:8rem}@media (min-width: 640px){.s-product-card-minimal .s-product-card-image{width:14rem}}@media (min-width: 1024px){.s-product-card-minimal .s-product-card-image{width:7rem}}.s-product-card-minimal .s-product-card-content-title a{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2}.s-product-card-minimal .s-product-card-content{display:flex;flex:1 1 0%;flex-direction:column;overflow:hidden;padding:1.25rem}.s-product-card-minimal .s-product-card-wishlist-btn button{margin:0px;background-color:transparent}.s-product-card-minimal .s-product-card-wishlist-btn button svg,.s-product-card-full-image .s-product-card-wishlist-btn button svg{height:1rem;width:1rem;fill:#fff}.s-product-card-vertical .s-product-card-wishlist-btn button{margin:0px;--tw-bg-opacity:1 !important;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1)) !important}.s-product-card-wishlist-btn button:hover svg{fill:#4b5563}.s-product-card-fit-height .s-product-card-image{height:11rem;max-height:15rem}.s-product-card-quantity{position:absolute;bottom:0.25rem;left:50%;z-index:1;max-width:calc(100% - 60px);--tw-translate-x:-50%;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));border-radius:var(--s-radius, 0.25rem);--tw-bg-opacity:1;background-color:rgb(248 113 113 / var(--tw-bg-opacity, 1));padding-left:0.625rem;padding-right:0.625rem;padding-top:0.375rem;padding-bottom:0.375rem;font-size:0.75rem;line-height:1rem;font-weight:700;--tw-text-opacity:1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}@media (min-width: 768px){.s-product-card-quantity{padding-top:0.5rem;padding-bottom:0.5rem}}.s-product-card-promotion-title{position:absolute;top:1rem;left:0px;z-index:1;max-width:calc(100% - 60px);border-top-right-radius:var(--s-radius, 0.25rem);border-bottom-right-radius:var(--s-radius, 0.25rem);--tw-bg-opacity:1;background-color:rgb(248 113 113 / var(--tw-bg-opacity, 1));padding-left:0.625rem;padding-right:0.625rem;padding-top:0.375rem;padding-bottom:0.375rem;font-size:0.75rem;line-height:1rem;font-weight:700;--tw-text-opacity:1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}@media (min-width: 768px){.s-product-card-promotion-title{padding-top:0.5rem;padding-bottom:0.5rem}}.s-product-card-promotion-title:where([dir="rtl"],[dir="rtl"] *){right:0px;left:unset;border-top-left-radius:var(--s-radius, 0.25rem);border-bottom-left-radius:var(--s-radius, 0.25rem);border-top-right-radius:0px;border-bottom-right-radius:0px}.s-product-card-out-badge{position:absolute;bottom:0.5rem;left:50%;z-index:1;max-width:calc(100% - 60px);--tw-translate-x:-50%;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));border-radius:0.375rem;--tw-bg-opacity:1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1));padding-left:0.625rem;padding-right:0.625rem;padding-top:0.375rem;padding-bottom:0.375rem;font-size:0.75rem;line-height:1rem;font-weight:700;--tw-text-opacity:1;color:rgb(153 153 153 / var(--tw-text-opacity, 1))}@media (min-width: 768px){.s-product-card-out-badge{padding-top:0.5rem;padding-bottom:0.5rem}}.s-product-card-image{position:relative;height:100%;width:100%;flex-shrink:0;overflow:hidden;--tw-bg-opacity:1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.s-product-card-image::before{position:absolute;top:50%;left:50%;display:inline-block;--tw-translate-x:-50%;--tw-translate-y:-50%;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));font-size:1.875rem;line-height:2.25rem;content:var(--tw-content);--tw-text-opacity:1;color:rgb(229 231 235 / var(--tw-text-opacity, 1))}.s-product-card-image:hover{opacity:0.9}.s-product-card-image img{height:100%;width:100%;transition-property:opacity;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:500ms}.s-product-card-image img.lazy{opacity:0}.s-product-card-image img.loaded{position:relative;opacity:1}.s-product-card-content{position:relative;display:flex;flex-direction:column;padding:0.75rem}@media (min-width: 640px){.s-product-card-content{padding:1.25rem}}.s-product-card-content-title{margin-bottom:0.625rem;max-width:100%;line-height:1.5rem}.s-product-card-content-subtitle{margin-bottom:0.625rem;font-size:0.875rem;line-height:1.5rem;--tw-text-opacity:1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.s-product-card-special .s-product-card-content-main,special .s-product-card-content-sub{padding-right:6rem}.s-product-card-special .s-product-card-content-main:where([dir="rtl"],[dir="rtl"] *),special .s-product-card-content-sub:where([dir="rtl"],[dir="rtl"] *){padding-left:6rem;padding-right:0px}.s-product-card-donation-input{flex:1 1 0%}.s-product-card-donation-input label{margin-bottom:0.625rem;display:block;font-size:0.875rem;line-height:1.25rem}.s-product-card-donation-input label span{--tw-text-opacity:1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.s-product-card-content-title a{display:block;text-align:start;font-size:0.875rem;line-height:1.25rem;font-weight:700;--tw-text-opacity:1;color:rgb(31 41 55 / var(--tw-text-opacity, 1))}.s-product-card-content-title a:hover{color:var(--color-primary)}.s-product-card-content-sub{margin-bottom:1.25rem;display:flex;width:100%;align-items:center;justify-content:space-between}.s-product-card-out-of-stock-label{font-size:0.75rem;line-height:1rem;font-weight:700;--tw-text-opacity:1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.s-product-card-rating{display:flex;align-items:center}.s-product-card-rating>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-right:calc(0.25rem * var(--tw-space-x-reverse));margin-left:calc(0.25rem * calc(1 - var(--tw-space-x-reverse)))}.s-product-card-rating{font-size:0.875rem;line-height:1.25rem;--tw-text-opacity:1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.s-product-card-rating:where([dir="rtl"],[dir="rtl"] *)>:not([hidden])~:not([hidden]){--tw-space-x-reverse:1}.s-product-card-rating span svg{margin-bottom:3px;height:1rem;width:1rem;fill:#fbbf24}.s-product-card-content-footer{margin-top:auto;display:flex;align-items:center}.s-product-card-sale-price>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-right:calc(0.25rem * var(--tw-space-x-reverse));margin-left:calc(0.25rem * calc(1 - var(--tw-space-x-reverse)))}.s-product-card-sale-price:where([dir="rtl"],[dir="rtl"] *)>:not([hidden])~:not([hidden]){--tw-space-x-reverse:1}.s-product-card-sale-price span{font-size:0.875rem;line-height:1.25rem;--tw-text-opacity:1;color:rgb(156 163 175 / var(--tw-text-opacity, 1));text-decoration-line:line-through}.s-product-card-starting-price{display:flex;width:100%;align-items:center;justify-content:space-between}.s-product-card-starting-price h4{display:inline-block;font-size:0.875rem;line-height:1.25rem;font-weight:700;--tw-text-opacity:1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.s-product-card-price-value{display:inline-block;font-size:0.875rem;line-height:1.25rem;font-weight:700;--tw-text-opacity:1;color:rgb(31 41 55 / var(--tw-text-opacity, 1))}.s-product-card-image-cover{object-fit:cover}.s-product-card-image-contain{object-fit:contain}.s-product-card-content-pie{position:absolute;top:0.625rem;right:1.25rem;display:flex;height:72px;width:72px;align-items:center;justify-content:center;color:var(--color-primary)}.s-product-card-content-pie:where([dir="rtl"],[dir="rtl"] *){left:1.25rem;right:unset}.s-product-card-content-pie span{position:absolute;top:43%;left:50%;display:flex;--tw-translate-y:-50%;--tw-translate-x:-50%;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));flex-direction:column;align-items:center;justify-content:center;text-align:center;font-size:0.75rem;line-height:1rem;line-height:1;--tw-text-opacity:1;color:rgb(124 128 130 / var(--tw-text-opacity, 1))}.s-product-card-content-pie span b{font-size:1.25rem;line-height:1.75rem;font-weight:700;color:var(--color-primary)}.s-product-card-content-extra-padding{padding-right:6rem}.s-product-card-content-extra-padding:where([dir="rtl"],[dir="rtl"] *){padding-left:6rem;padding-right:0px}.s-product-card-wishlist-added svg{fill:#ef4444}.s-product-card-horizontal .s-product-card-image{height:auto;width:8rem}@media (min-width: 640px){.s-product-card-horizontal .s-product-card-image{width:14rem}}.s-product-card-horizontal .s-product-card-image:where([dir="ltr"],[dir="ltr"] *){border-top-left-radius:var(--s-radius, 0.25rem);border-bottom-left-radius:var(--s-radius, 0.25rem)}.s-product-card-horizontal .s-product-card-image:where([dir="rtl"],[dir="rtl"] *){border-top-right-radius:var(--s-radius, 0.25rem);border-bottom-right-radius:var(--s-radius, 0.25rem)}.s-product-card-horizontal .s-product-card-quantity{max-width:unset}.s-product-card-horizontal .s-product-card-content-title a{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2}.s-product-card-horizontal .s-product-card-promotion-title{max-width:unset}.s-product-card-horizontal .s-product-card-out-badge{max-width:unset}.s-product-card-horizontal .s-product-card-content{margin-bottom:0.625rem;width:100%}.s-product-card-full-image{height:20rem;overflow:hidden}@media (min-width: 768px){.s-product-card-full-image{height:auto}}.s-product-card-full-image .s-product-card-content{position:absolute;bottom:0px;z-index:10;width:100%;padding-left:2.5rem;padding-right:2.5rem;padding-top:1.25rem;padding-bottom:1.75rem}.s-product-card-full-image img{position:relative;height:100%;width:100%;overflow:hidden;border-radius:var(--s-radius, 0.25rem)}.s-product-card-full-image img:hover{opacity:0.9}.s-product-card-full-image .s-product-card-image a{height:100%;width:100%}.s-product-card-full-image .s-product-card-content-title a{--tw-text-opacity:1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.s-product-card-full-image .s-product-card-content-title a:hover{color:var(--color-primary)}.s-product-card-full-image .s-product-card-content-subtitle{--tw-text-opacity:1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.s-product-card-full-image .s-product-card-price-value{--tw-text-opacity:1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.s-product-card-full-image .s-product-card-sale-price{--tw-text-opacity:1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.s-product-card-full-image .s-product-card-sale-price span{--tw-text-opacity:1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.s-product-card-image-full{width:100%}.s-product-card-compact{display:flex;cursor:pointer;flex-direction:row;align-items:center;gap:0.75rem;--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1));padding-top:0.75rem;padding-bottom:0.75rem;padding-left:0px;padding-right:0px;transition-property:all;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:200ms}.s-product-card-compact .s-product-card-content-footer{margin-top:0px;flex-shrink:0;gap:0.5rem}.s-product-card-add-to-cart-icon svg{height:1rem;width:1rem;fill:currentColor}.s-product-card-compact .s-add-product-button-compact salla-button .s-button-btn{height:2rem;border-radius:0.375rem;border-width:1px;border-color:var(--color-primary);background-color:transparent;padding-left:0.75rem;padding-right:0.75rem;font-size:0.75rem;line-height:1rem;font-weight:500;color:var(--color-primary);transition-property:all;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:200ms}.s-product-card-compact .s-add-product-button-compact salla-button .s-button-btn:hover{border-color:var(--color-primary);background-color:var(--color-primary);--tw-bg-opacity:0.1;--tw-text-opacity:1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.s-product-card-compact .s-product-card-content{min-width:0px;flex:1 1 0%;padding:0px;text-align:right}.s-product-card-compact .s-product-card-content-main{margin-bottom:0.25rem}.s-product-card-compact .s-product-card-content-title{font-size:0.875rem;line-height:1.25rem;font-weight:500;line-height:1.25;--tw-text-opacity:1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.s-product-card-compact .s-product-card-content-title a{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;font-weight:500}.s-product-card-compact .s-product-card-content-subtitle{margin-top:0.25rem;display:none;font-size:0.75rem;line-height:1rem;--tw-text-opacity:1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.s-product-card-compact .s-product-card-content-sub{display:flex;align-items:center;justify-content:flex-start;gap:0.5rem;font-size:0.75rem;line-height:1rem;--tw-text-opacity:1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.s-product-card-compact .s-product-card-content-sub h4{margin:0px}.s-product-card-compact .s-product-card-starting-price h4{font-weight:700}.s-product-card-compact .s-product-card-starting-price{justify-content:flex-start;gap:0.25rem}.s-product-card-compact .s-product-card-image{height:5rem;width:5rem;flex-shrink:0;border-radius:0.375rem}.s-product-card-compact .s-product-card-image img{height:100%;width:100%;border-radius:0.375rem;object-fit:cover}.s-product-card-compact .s-product-card-promotion-title{display:none}.s-search-grid-item .s-product-card-out-badge{--tw-bg-opacity:1;background-color:rgb(254 226 226 / var(--tw-bg-opacity, 1));--tw-text-opacity:1;color:rgb(220 38 38 / var(--tw-text-opacity, 1))}';export{c as salla_product_card}
|
|
4
|
+
import{r as t,h as r,H as a,a as i}from"./p-BXSGktmF.js";import{H as o}from"./p-00vBRoH3.js";import{S as e}from"./p-D4oPi1Ov.js";import{C as s}from"./p-gFG8By9O.js";const c=class{constructor(r){if(t(this,r),this.forceShowWishlistButton=!1,this.compactAddToCart=!1,this.showOutOfStockBesidePrice=!1,this.COMPACT_TITLE_MAX_LENGTH=60,salla.onReady((()=>{this.fitImageHeight=salla.config.get("store.settings.product.fit_type"),salla.wishlist.event.onAdded(((t,r)=>this.toggleFavoriteIcon(!0,r))),salla.wishlist.event.onRemoved(((t,r)=>this.toggleFavoriteIcon(!1,r))),salla.event.on("wishlist::storage.synced",(()=>this.productData&&this.toggleFavoriteIcon(this.isInWishlist()))),this.placeholder=salla.url.asset(salla.config.get("theme.settings.placeholder"))})),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")}}connectedCallback(){this.langUnsubscribe=salla.lang.subscribe((()=>{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")}))}disconnectedCallback(){this.langUnsubscribe?.()}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,r=null){r&&r!==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 r=new Date(t);return`${r.getFullYear()}-${r.getMonth()+1}-${r.getDate()}`}getDisplayTitle(){const t=this.productData?.name||"";return!this.compact||t.length<=this.COMPACT_TITLE_MAX_LENGTH?t:t.slice(0,this.COMPACT_TITLE_MAX_LENGTH).trimEnd()+"…"}getProductBadge(){return this.productData?.is_out_of_stock&&!this.showOutOfStockBesidePrice?r("div",{class:"s-product-card-out-badge"},this.outOfStock):this.showQuantity&&this.productData?.quantity?r("div",{class:"s-product-card-quantity"},this.remained," ",salla.helpers.number(this.productData?.quantity)):this.productData.promotion_title?r("div",{class:"s-product-card-promotion-title"},this.productData.promotion_title):""}renderAddToCartLabel(){return r("slot",{name:"add-to-cart-label"},this.compactAddToCart?r("span",{class:"s-product-card-add-to-cart-icon",innerHTML:s}):this.productData.add_to_cart_label)}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?r("div",{class:"s-product-card-sale-price"},r("p",{class:"s-product-card-price-value",innerHTML:this.getPriceFormat(this.productData.sale_price)}),r("span",{innerHTML:this.getPriceFormat(this.productData?.regular_price)})):this.productData.starting_price?r("div",{class:"s-product-card-starting-price"},r("p",null,this.startingPrice),r("h4",{innerHTML:this.getPriceFormat(this.productData?.starting_price)})):r("p",{class:"s-product-card-price-value",innerHTML:this.getPriceFormat(this.productData?.price)})}render(){if(!this.productData)return null;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 r(a,{id:`product-${this.productData?.id}`,class:t},r("div",{class:this.fullImage?"s-product-card-image-full":"s-product-card-image"},r("a",{...i},r("img",{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&&r("a",{...i,class:"s-product-card-overlay"}),this.horizontal||this.fullImage?"":r("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()},r("span",{innerHTML:o}))),r("div",{class:"s-product-card-content"},this.isSpecial&&this.productData?.quantity?r("div",{class:"s-product-card-content-pie",ref:t=>this.pie=t},r("span",null,r("b",null,salla.helpers.number(this.productData?.quantity)),this.remained),r("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"-2 -1 36 34",class:"s-product-card-content-pie-svg"},r("circle",{cx:"16",cy:"16",r:"15.9155",class:"s-product-card-content-pie-svg-base"}),r("circle",{cx:"16",cy:"16",r:"15.9155",class:"s-product-card-content-pie-svg-bar"}))):"",r("div",{class:{"s-product-card-content-main":!0,"s-product-card-content-extra-padding":this.isSpecial}},r("h3",{class:"s-product-card-content-title"},r("a",{...i},this.getDisplayTitle())),this.productData?.subtitle&&!this.minimal?r("p",{class:"s-product-card-content-subtitle"},this.productData?.subtitle):""),!this.productData?.donation||this.minimal||this.fullImage?"":[r("salla-progress-bar",{donation:this.productData?.donation}),r("div",{class:"s-product-card-donation-input"},this.productData?.donation?.can_donate?[r("label",{htmlFor:"donation-amount"},this.donationAmount," ",r("span",null,"*")),r("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})]:"")],r("div",{class:{"s-product-card-content-sub":!0,"s-product-card-content-extra-padding":this.isSpecial}},this.getProductPrice(),this.showOutOfStockBesidePrice&&this.productData?.is_out_of_stock?r("span",{class:"s-product-card-out-of-stock-label"},this.outOfStock):"",this.productData?.rating?.stars&&!this.minimal?r("div",{class:"s-product-card-rating"},r("span",{innerHTML:e}),r("span",null,this.productData.rating.stars)):""),this.isSpecial&&this.productData.discount_ends?r("salla-count-down",{date:this.formatDate(this.productData.discount_ends),"end-of-day":!0,boxed:!0,labeled:!0}):"",this.hideAddBtn||this.compact?"":r("div",{class:"s-product-card-content-footer"},r("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},this.renderAddToCartLabel()),this.horizontal||this.fullImage?r("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 }}"},r("span",{class:"text-xl",innerHTML:o})):"")),!this.hideAddBtn&&this.compact?r("div",{class:"s-product-card-content-footer"},r("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"},this.renderAddToCartLabel()),this.forceShowWishlistButton?r("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()},r("span",{innerHTML:o})):""):"")}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)}};c.style='/*!twlt*/.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}.text-xl{font-size:1.25rem;line-height:1.75rem}.shadow{--tw-shadow:0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}.outline{outline-style:solid}.has-error .s-form-control,.has-error .s-tel-input-control,.has-error .s-datetime-picker-input{border-color:#ff443a;color:#ff443a}.s-form-control{display:block;width:100%;border-radius:var(--s-radius, 0.25rem);border-width:1px;--tw-border-opacity:1;border-color:rgb(209 213 219 / var(--tw-border-opacity, 1));--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1));padding:0.5rem;font-size:0.875rem;line-height:1.25rem;--tw-text-opacity:1;color:rgb(17 24 39 / var(--tw-text-opacity, 1))}.s-form-control:focus{border-color:var(--color-primary);--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000)}.s-product-card-entry{position:relative;display:flex;height:100%;justify-content:space-between;border-radius:var(--s-radius, 0.25rem);--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1));transition-property:box-shadow;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:300ms}.s-product-card-shadow:hover{box-shadow:5px 10px 30px #2b2d340d}.s-product-card-out-of-stock img.loaded{--tw-grayscale:grayscale(100%);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.s-product-card-overlay{position:absolute;top:0px;bottom:0px;left:0px;right:0px;--tw-bg-opacity:1;background-color:rgb(0 0 0 / var(--tw-bg-opacity, 1));opacity:0.5;transition-property:opacity;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:700ms}.s-product-card-overlay:hover{opacity:0.4}.s-product-card-vertical{flex-direction:column}.s-product-card-vertical .s-product-card-image{flex:1 1 0%;border-top-left-radius:var(--s-radius, 0.25rem);border-top-right-radius:var(--s-radius, 0.25rem)}.s-product-card-vertical .s-product-card-wishlist-btn{position:absolute;top:0.5rem;right:0.5rem;opacity:0.75}.s-product-card-vertical .s-product-card-wishlist-btn:hover{opacity:1}@media (min-width: 768px){.s-product-card-vertical .s-product-card-wishlist-btn{right:0.5rem}}.s-product-card-vertical .s-product-card-wishlist-btn:where([dir="rtl"],[dir="rtl"] *){left:0.5rem;right:unset}@media (min-width: 768px){.s-product-card-vertical .s-product-card-wishlist-btn:where([dir="rtl"],[dir="rtl"] *){left:0.5rem;right:unset}}.s-product-card-minimal .s-product-card-wishlist-btn{position:absolute;top:0px;right:0px;opacity:0.75}.s-product-card-minimal .s-product-card-wishlist-btn:hover{opacity:1}@media (min-width: 768px){.s-product-card-minimal .s-product-card-wishlist-btn{right:0px}}.s-product-card-minimal .s-product-card-wishlist-btn:where([dir="rtl"],[dir="rtl"] *){left:0px;right:unset}@media (min-width: 768px){.s-product-card-minimal .s-product-card-wishlist-btn:where([dir="rtl"],[dir="rtl"] *){left:0px;right:unset}}.s-product-card-minimal .s-product-card-image{width:8rem}@media (min-width: 640px){.s-product-card-minimal .s-product-card-image{width:14rem}}@media (min-width: 1024px){.s-product-card-minimal .s-product-card-image{width:7rem}}.s-product-card-minimal .s-product-card-content-title a{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2}.s-product-card-minimal .s-product-card-content{display:flex;flex:1 1 0%;flex-direction:column;overflow:hidden;padding:1.25rem}.s-product-card-minimal .s-product-card-wishlist-btn button{margin:0px;background-color:transparent}.s-product-card-minimal .s-product-card-wishlist-btn button svg,.s-product-card-full-image .s-product-card-wishlist-btn button svg{height:1rem;width:1rem;fill:#fff}.s-product-card-vertical .s-product-card-wishlist-btn button{margin:0px;--tw-bg-opacity:1 !important;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1)) !important}.s-product-card-wishlist-btn button:hover svg{fill:#4b5563}.s-product-card-fit-height .s-product-card-image{height:11rem;max-height:15rem}.s-product-card-quantity{position:absolute;bottom:0.25rem;left:50%;z-index:1;max-width:calc(100% - 60px);--tw-translate-x:-50%;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));border-radius:var(--s-radius, 0.25rem);--tw-bg-opacity:1;background-color:rgb(248 113 113 / var(--tw-bg-opacity, 1));padding-left:0.625rem;padding-right:0.625rem;padding-top:0.375rem;padding-bottom:0.375rem;font-size:0.75rem;line-height:1rem;font-weight:700;--tw-text-opacity:1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}@media (min-width: 768px){.s-product-card-quantity{padding-top:0.5rem;padding-bottom:0.5rem}}.s-product-card-promotion-title{position:absolute;top:1rem;left:0px;z-index:1;max-width:calc(100% - 60px);border-top-right-radius:var(--s-radius, 0.25rem);border-bottom-right-radius:var(--s-radius, 0.25rem);--tw-bg-opacity:1;background-color:rgb(248 113 113 / var(--tw-bg-opacity, 1));padding-left:0.625rem;padding-right:0.625rem;padding-top:0.375rem;padding-bottom:0.375rem;font-size:0.75rem;line-height:1rem;font-weight:700;--tw-text-opacity:1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}@media (min-width: 768px){.s-product-card-promotion-title{padding-top:0.5rem;padding-bottom:0.5rem}}.s-product-card-promotion-title:where([dir="rtl"],[dir="rtl"] *){right:0px;left:unset;border-top-left-radius:var(--s-radius, 0.25rem);border-bottom-left-radius:var(--s-radius, 0.25rem);border-top-right-radius:0px;border-bottom-right-radius:0px}.s-product-card-out-badge{position:absolute;bottom:0.5rem;left:50%;z-index:1;max-width:calc(100% - 60px);--tw-translate-x:-50%;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));border-radius:0.375rem;--tw-bg-opacity:1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1));padding-left:0.625rem;padding-right:0.625rem;padding-top:0.375rem;padding-bottom:0.375rem;font-size:0.75rem;line-height:1rem;font-weight:700;--tw-text-opacity:1;color:rgb(153 153 153 / var(--tw-text-opacity, 1))}@media (min-width: 768px){.s-product-card-out-badge{padding-top:0.5rem;padding-bottom:0.5rem}}.s-product-card-image{position:relative;height:100%;width:100%;flex-shrink:0;overflow:hidden;--tw-bg-opacity:1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.s-product-card-image::before{position:absolute;top:50%;left:50%;display:inline-block;--tw-translate-x:-50%;--tw-translate-y:-50%;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));font-size:1.875rem;line-height:2.25rem;content:var(--tw-content);--tw-text-opacity:1;color:rgb(229 231 235 / var(--tw-text-opacity, 1))}.s-product-card-image:hover{opacity:0.9}.s-product-card-image img{height:100%;width:100%;transition-property:opacity;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:500ms}.s-product-card-image img.lazy{opacity:0}.s-product-card-image img.loaded{position:relative;opacity:1}.s-product-card-content{position:relative;display:flex;flex-direction:column;padding:0.75rem}@media (min-width: 640px){.s-product-card-content{padding:1.25rem}}.s-product-card-content-title{margin-bottom:0.625rem;max-width:100%;line-height:1.5rem}.s-product-card-content-subtitle{margin-bottom:0.625rem;font-size:0.875rem;line-height:1.5rem;--tw-text-opacity:1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.s-product-card-special .s-product-card-content-main,special .s-product-card-content-sub{padding-right:6rem}.s-product-card-special .s-product-card-content-main:where([dir="rtl"],[dir="rtl"] *),special .s-product-card-content-sub:where([dir="rtl"],[dir="rtl"] *){padding-left:6rem;padding-right:0px}.s-product-card-donation-input{flex:1 1 0%}.s-product-card-donation-input label{margin-bottom:0.625rem;display:block;font-size:0.875rem;line-height:1.25rem}.s-product-card-donation-input label span{--tw-text-opacity:1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.s-product-card-content-title a{display:block;text-align:start;font-size:0.875rem;line-height:1.25rem;font-weight:700;--tw-text-opacity:1;color:rgb(31 41 55 / var(--tw-text-opacity, 1))}.s-product-card-content-title a:hover{color:var(--color-primary)}.s-product-card-content-sub{margin-bottom:1.25rem;display:flex;width:100%;align-items:center;justify-content:space-between}.s-product-card-out-of-stock-label{font-size:0.75rem;line-height:1rem;font-weight:700;--tw-text-opacity:1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.s-product-card-rating{display:flex;align-items:center}.s-product-card-rating>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-right:calc(0.25rem * var(--tw-space-x-reverse));margin-left:calc(0.25rem * calc(1 - var(--tw-space-x-reverse)))}.s-product-card-rating{font-size:0.875rem;line-height:1.25rem;--tw-text-opacity:1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.s-product-card-rating:where([dir="rtl"],[dir="rtl"] *)>:not([hidden])~:not([hidden]){--tw-space-x-reverse:1}.s-product-card-rating span svg{margin-bottom:3px;height:1rem;width:1rem;fill:#fbbf24}.s-product-card-content-footer{margin-top:auto;display:flex;align-items:center}.s-product-card-sale-price>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-right:calc(0.25rem * var(--tw-space-x-reverse));margin-left:calc(0.25rem * calc(1 - var(--tw-space-x-reverse)))}.s-product-card-sale-price:where([dir="rtl"],[dir="rtl"] *)>:not([hidden])~:not([hidden]){--tw-space-x-reverse:1}.s-product-card-sale-price span{font-size:0.875rem;line-height:1.25rem;--tw-text-opacity:1;color:rgb(156 163 175 / var(--tw-text-opacity, 1));text-decoration-line:line-through}.s-product-card-starting-price{display:flex;width:100%;align-items:center;justify-content:space-between}.s-product-card-starting-price h4{display:inline-block;font-size:0.875rem;line-height:1.25rem;font-weight:700;--tw-text-opacity:1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.s-product-card-price-value{display:inline-block;font-size:0.875rem;line-height:1.25rem;font-weight:700;--tw-text-opacity:1;color:rgb(31 41 55 / var(--tw-text-opacity, 1))}.s-product-card-image-cover{object-fit:cover}.s-product-card-image-contain{object-fit:contain}.s-product-card-content-pie{position:absolute;top:0.625rem;right:1.25rem;display:flex;height:72px;width:72px;align-items:center;justify-content:center;color:var(--color-primary)}.s-product-card-content-pie:where([dir="rtl"],[dir="rtl"] *){left:1.25rem;right:unset}.s-product-card-content-pie span{position:absolute;top:43%;left:50%;display:flex;--tw-translate-y:-50%;--tw-translate-x:-50%;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));flex-direction:column;align-items:center;justify-content:center;text-align:center;font-size:0.75rem;line-height:1rem;line-height:1;--tw-text-opacity:1;color:rgb(124 128 130 / var(--tw-text-opacity, 1))}.s-product-card-content-pie span b{font-size:1.25rem;line-height:1.75rem;font-weight:700;color:var(--color-primary)}.s-product-card-content-extra-padding{padding-right:6rem}.s-product-card-content-extra-padding:where([dir="rtl"],[dir="rtl"] *){padding-left:6rem;padding-right:0px}.s-product-card-wishlist-added svg{fill:#ef4444}.s-product-card-horizontal .s-product-card-image{height:auto;width:8rem}@media (min-width: 640px){.s-product-card-horizontal .s-product-card-image{width:14rem}}.s-product-card-horizontal .s-product-card-image:where([dir="ltr"],[dir="ltr"] *){border-top-left-radius:var(--s-radius, 0.25rem);border-bottom-left-radius:var(--s-radius, 0.25rem)}.s-product-card-horizontal .s-product-card-image:where([dir="rtl"],[dir="rtl"] *){border-top-right-radius:var(--s-radius, 0.25rem);border-bottom-right-radius:var(--s-radius, 0.25rem)}.s-product-card-horizontal .s-product-card-quantity{max-width:unset}.s-product-card-horizontal .s-product-card-content-title a{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2}.s-product-card-horizontal .s-product-card-promotion-title{max-width:unset}.s-product-card-horizontal .s-product-card-out-badge{max-width:unset}.s-product-card-horizontal .s-product-card-content{margin-bottom:0.625rem;width:100%}.s-product-card-full-image{height:20rem;overflow:hidden}@media (min-width: 768px){.s-product-card-full-image{height:auto}}.s-product-card-full-image .s-product-card-content{position:absolute;bottom:0px;z-index:10;width:100%;padding-left:2.5rem;padding-right:2.5rem;padding-top:1.25rem;padding-bottom:1.75rem}.s-product-card-full-image img{position:relative;height:100%;width:100%;overflow:hidden;border-radius:var(--s-radius, 0.25rem)}.s-product-card-full-image img:hover{opacity:0.9}.s-product-card-full-image .s-product-card-image a{height:100%;width:100%}.s-product-card-full-image .s-product-card-content-title a{--tw-text-opacity:1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.s-product-card-full-image .s-product-card-content-title a:hover{color:var(--color-primary)}.s-product-card-full-image .s-product-card-content-subtitle{--tw-text-opacity:1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.s-product-card-full-image .s-product-card-price-value{--tw-text-opacity:1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.s-product-card-full-image .s-product-card-sale-price{--tw-text-opacity:1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.s-product-card-full-image .s-product-card-sale-price span{--tw-text-opacity:1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.s-product-card-image-full{width:100%}.s-product-card-compact{display:flex;cursor:pointer;flex-direction:row;align-items:center;gap:0.75rem;--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1));padding-top:0.75rem;padding-bottom:0.75rem;padding-left:0px;padding-right:0px;transition-property:all;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:200ms}.s-product-card-compact .s-product-card-content-footer{margin-top:0px;flex-shrink:0;gap:0.5rem}.s-product-card-add-to-cart-icon svg{height:1rem;width:1rem;fill:currentColor}.s-product-card-compact .s-add-product-button-compact salla-button .s-button-btn{height:2rem;border-radius:0.375rem;border-width:1px;border-color:var(--color-primary);background-color:transparent;padding-left:0.75rem;padding-right:0.75rem;font-size:0.75rem;line-height:1rem;font-weight:500;color:var(--color-primary);transition-property:all;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:200ms}.s-product-card-compact .s-add-product-button-compact salla-button .s-button-btn:hover{border-color:var(--color-primary);background-color:var(--color-primary);--tw-bg-opacity:0.1;--tw-text-opacity:1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.s-product-card-compact .s-product-card-content{min-width:0px;flex:1 1 0%;padding:0px;text-align:right}.s-product-card-compact .s-product-card-content-main{margin-bottom:0.25rem}.s-product-card-compact .s-product-card-content-title{font-size:0.875rem;line-height:1.25rem;font-weight:500;line-height:1.25;--tw-text-opacity:1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.s-product-card-compact .s-product-card-content-title a{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;font-weight:500}.s-product-card-compact .s-product-card-content-subtitle{margin-top:0.25rem;display:none;font-size:0.75rem;line-height:1rem;--tw-text-opacity:1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.s-product-card-compact .s-product-card-content-sub{display:flex;align-items:center;justify-content:flex-start;gap:0.5rem;font-size:0.75rem;line-height:1rem;--tw-text-opacity:1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.s-product-card-compact .s-product-card-content-sub h4{margin:0px}.s-product-card-compact .s-product-card-starting-price h4{font-weight:700}.s-product-card-compact .s-product-card-starting-price{justify-content:flex-start;gap:0.25rem}.s-product-card-compact .s-product-card-image{height:5rem;width:5rem;flex-shrink:0;border-radius:0.375rem}.s-product-card-compact .s-product-card-image img{height:100%;width:100%;border-radius:0.375rem;object-fit:cover}.s-product-card-compact .s-product-card-promotion-title{display:none}.s-search-grid-item .s-product-card-out-badge{--tw-bg-opacity:1;background-color:rgb(254 226 226 / var(--tw-bg-opacity, 1));--tw-text-opacity:1;color:rgb(220 38 38 / var(--tw-text-opacity, 1))}';export{c as salla_product_card}
|