@salla.sa/twilight-components 2.14.585 → 2.14.587
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{filepond-CEJhKIt0.js → filepond-BF8Q2gfH.js} +1 -1
- package/dist/cjs/{filepond-plugin-file-poster--o39rSi6.js → filepond-plugin-file-poster-CDZXoVge.js} +1 -1
- package/dist/cjs/{filepond-plugin-file-validate-size-BaE73veC.js → filepond-plugin-file-validate-size-M6dKiRMH.js} +1 -1
- package/dist/cjs/{filepond-plugin-file-validate-type-A3B81gzI.js → filepond-plugin-file-validate-type-BSTQI9uG.js} +1 -1
- package/dist/cjs/{filepond-plugin-image-edit-CtzQ8SoY.js → filepond-plugin-image-edit-h3hJm3qv.js} +1 -1
- package/dist/cjs/{filepond-plugin-image-exif-orientation-DCSIkiBY.js → filepond-plugin-image-exif-orientation-CXkq3_oT.js} +1 -1
- package/dist/cjs/{filepond-plugin-image-preview-BkOXIK9J.js → filepond-plugin-image-preview-BP4-WdE7.js} +1 -1
- package/dist/cjs/{index-C1lKW2pp.js → index-DN51eLtp.js} +3 -3
- package/dist/cjs/{intlTelInput-C2sAClFU.js → intlTelInput-Cgao3Jc8.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 +1 -1
- package/dist/cjs/salla-add-product-button_5.cjs.entry.js +99 -22
- package/dist/cjs/salla-advertisement.cjs.entry.js +1 -1
- package/dist/cjs/salla-alert_2.cjs.entry.js +1 -1
- package/dist/cjs/salla-app-install-alert.cjs.entry.js +1 -1
- package/dist/cjs/salla-applied-filters.cjs.entry.js +1 -1
- package/dist/cjs/salla-apps-icons.cjs.entry.js +1 -1
- package/dist/cjs/salla-attachment-view_9.cjs.entry.js +12 -12
- 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 +5 -5
- 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 +3 -3
- package/dist/cjs/salla-conditional-offer.cjs.entry.js +1 -1
- package/dist/cjs/salla-contacts.cjs.entry.js +2 -2
- package/dist/cjs/salla-cookies-bar.cjs.entry.js +1 -1
- package/dist/cjs/salla-count-down.cjs.entry.js +1 -1
- package/dist/cjs/salla-custom-fields.cjs.entry.js +1 -1
- package/dist/cjs/salla-delivery-promise.cjs.entry.js +1 -1
- package/dist/cjs/salla-edit-order-button.cjs.entry.js +1 -1
- package/dist/cjs/salla-filters-widget.cjs.entry.js +1 -1
- package/dist/cjs/salla-filters.cjs.entry.js +1 -1
- package/dist/cjs/salla-fulfillment-methods.cjs.entry.js +1 -1
- package/dist/cjs/salla-gift-card-redeem.cjs.entry.js +1 -1
- package/dist/cjs/salla-gifting.cjs.entry.js +1 -1
- package/dist/cjs/salla-hook.cjs.entry.js +1 -1
- package/dist/cjs/salla-infinite-scroll.cjs.entry.js +1 -1
- package/dist/cjs/salla-installment.cjs.entry.js +1 -1
- package/dist/cjs/salla-list-tile.cjs.entry.js +1 -1
- package/dist/cjs/salla-localization-modal.cjs.entry.js +1 -1
- package/dist/cjs/salla-login-modal.cjs.entry.js +1 -1
- package/dist/cjs/salla-loyalty-banner_10.cjs.entry.js +1 -1
- package/dist/cjs/salla-loyalty-exchange-product-card.cjs.entry.js +1 -1
- package/dist/cjs/salla-loyalty-points-banner.cjs.entry.js +1 -1
- package/dist/cjs/salla-loyalty-points-history.cjs.entry.js +1 -1
- package/dist/cjs/salla-loyalty-prize-item.cjs.entry.js +1 -1
- package/dist/cjs/salla-loyalty.cjs.entry.js +1 -1
- package/dist/cjs/salla-maintenance-alert.cjs.entry.js +1 -1
- package/dist/cjs/salla-map_3.cjs.entry.js +1 -1
- package/dist/cjs/salla-menu.cjs.entry.js +1 -1
- package/dist/cjs/salla-metadata.cjs.entry.js +1 -1
- package/dist/cjs/salla-multiple-bundle-product-cart_2.cjs.entry.js +1 -1
- package/dist/cjs/salla-multiple-bundle-product-options-modal_2.cjs.entry.js +1 -1
- package/dist/cjs/salla-multiple-bundle-product.cjs.entry.js +1 -1
- package/dist/cjs/salla-next-order-coupon.cjs.entry.js +1 -1
- package/dist/cjs/salla-notification-item_2.cjs.entry.js +1 -1
- package/dist/cjs/salla-offer-modal.cjs.entry.js +1 -1
- package/dist/cjs/salla-offer.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-branch.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-cancel.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-details-multiple-bundle-product.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-details-options.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-details.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-edit-item.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-edit-product-card.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-edit.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-options-modal.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-shipments.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-summary.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-totals-card.cjs.entry.js +1 -1
- package/dist/cjs/salla-orders.cjs.entry.js +1 -1
- package/dist/cjs/salla-payments.cjs.entry.js +24 -3
- 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 +2 -2
- package/dist/cjs/salla-product-card.cjs.entry.js +14 -6
- package/dist/cjs/salla-product-size-guide.cjs.entry.js +3 -3
- package/dist/cjs/salla-products-list.cjs.entry.js +19 -4
- package/dist/cjs/salla-products-slider.cjs.entry.js +1 -1
- package/dist/cjs/salla-quick-order.cjs.entry.js +1 -1
- package/dist/cjs/salla-rating-modal-v2.cjs.entry.js +1 -1
- package/dist/cjs/salla-rating-modal.cjs.entry.js +1 -1
- package/dist/cjs/salla-review-factors-tags.cjs.entry.js +2 -2
- 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 +3 -3
- package/dist/cjs/salla-search.cjs.entry.js +1 -1
- package/dist/cjs/salla-skeleton.cjs.entry.js +2 -2
- package/dist/cjs/salla-social-share.cjs.entry.js +2 -2
- package/dist/cjs/salla-social.cjs.entry.js +2 -2
- package/dist/cjs/salla-tab-content_3.cjs.entry.js +4 -4
- package/dist/cjs/salla-tiered-offer.cjs.entry.js +13 -2
- package/dist/cjs/salla-tooltip.cjs.entry.js +2 -2
- package/dist/cjs/salla-trust-badges.cjs.entry.js +1 -1
- package/dist/cjs/salla-user-menu.cjs.entry.js +1 -1
- package/dist/cjs/salla-user-profile.cjs.entry.js +1 -1
- package/dist/cjs/salla-user-settings.cjs.entry.js +2 -2
- 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 +2 -2
- package/dist/cjs/salla-wishlist-summary.cjs.entry.js +1 -1
- package/dist/cjs/twilight.cjs.js +1 -1
- package/dist/cjs/{vanilla-picker-Dlx0WMya.js → vanilla-picker-BAqDsAyV.js} +1 -1
- package/dist/collection/components/salla-contacts/salla-contacts.js +1 -1
- package/dist/collection/components/salla-payments/salla-payments.css +3 -0
- package/dist/collection/components/salla-payments/salla-payments.js +22 -1
- package/dist/collection/components/salla-product-card/salla-product-card.js +13 -5
- package/dist/collection/components/salla-product-card-embed/salla-product-card-embed.js +1 -1
- package/dist/collection/components/salla-product-size-guide/salla-product-size-guide.js +2 -2
- package/dist/collection/components/salla-products-list/salla-products-list.css +3 -0
- package/dist/collection/components/salla-products-list/salla-products-list.js +17 -2
- package/dist/collection/components/salla-quantity-input/salla-quantity-input.js +1 -1
- package/dist/collection/components/salla-quick-buy/salla-quick-buy.js +20 -6
- package/dist/collection/components/salla-review-card/salla-review-card.js +1 -1
- package/dist/collection/components/salla-review-factors-tags/salla-review-factors-tags.js +1 -1
- package/dist/collection/components/salla-reviews-page/salla-reviews-page.js +1 -1
- package/dist/collection/components/salla-search-product-card/salla-search-product-card.js +2 -2
- package/dist/collection/components/salla-searchable-dropdown/salla-searchable-dropdown.js +4 -4
- package/dist/collection/components/salla-skeleton/salla-skeleton.js +1 -1
- package/dist/collection/components/salla-social/salla-social.js +1 -1
- package/dist/collection/components/salla-social-share/salla-social-share.js +1 -1
- package/dist/collection/components/salla-tabs/salla-tab-content.js +1 -1
- package/dist/collection/components/salla-tabs/salla-tab-header.js +1 -1
- package/dist/collection/components/salla-tabs/salla-tabs.js +1 -1
- package/dist/collection/components/salla-tel-input/salla-tel-input.js +1 -1
- package/dist/collection/components/salla-tiered-offer/salla-tiered-offer.js +12 -1
- package/dist/collection/components/salla-tooltip/salla-tooltip.js +1 -1
- package/dist/collection/components/salla-user-settings/salla-user-settings.js +1 -1
- package/dist/collection/components/salla-wishlist-actions/salla-wishlist-actions.js +1 -1
- package/dist/components/index.js +3 -3
- package/dist/components/salla-contacts.js +1 -1
- package/dist/components/salla-payments.js +23 -2
- package/dist/components/salla-product-card-embed.js +1 -1
- package/dist/components/salla-product-card2.js +13 -5
- package/dist/components/salla-product-size-guide.js +2 -2
- package/dist/components/salla-products-list2.js +18 -3
- package/dist/components/salla-quantity-input2.js +1 -1
- package/dist/components/salla-quick-buy2.js +98 -21
- package/dist/components/salla-review-card2.js +1 -1
- package/dist/components/salla-review-factors-tags2.js +1 -1
- package/dist/components/salla-reviews-page.js +1 -1
- package/dist/components/salla-search-product-card2.js +2 -2
- package/dist/components/salla-searchable-dropdown2.js +4 -4
- package/dist/components/salla-skeleton2.js +1 -1
- package/dist/components/salla-social-share2.js +1 -1
- package/dist/components/salla-social.js +1 -1
- package/dist/components/salla-tab-content2.js +1 -1
- package/dist/components/salla-tab-header2.js +1 -1
- package/dist/components/salla-tabs2.js +1 -1
- package/dist/components/salla-tel-input2.js +1 -1
- package/dist/components/salla-tiered-offer.js +12 -1
- package/dist/components/salla-tooltip2.js +1 -1
- package/dist/components/salla-user-settings.js +1 -1
- package/dist/components/salla-wishlist-actions.js +1 -1
- package/dist/docs.d.ts +443 -0
- package/dist/docs.json +29077 -0
- package/dist/esm/{filepond-DO_tVx7Z.js → filepond-Xi2-pJA0.js} +1 -1
- package/dist/esm/{filepond-plugin-file-poster-CLUYF4ow.js → filepond-plugin-file-poster-DduYF-sA.js} +1 -1
- package/dist/esm/{filepond-plugin-file-validate-size-2uJOz1fq.js → filepond-plugin-file-validate-size-BkPirl0j.js} +1 -1
- package/dist/esm/{filepond-plugin-file-validate-type-QZ36jPaD.js → filepond-plugin-file-validate-type-BIX8_1CI.js} +1 -1
- package/dist/esm/{filepond-plugin-image-edit-Oyjbx1VR.js → filepond-plugin-image-edit--1Sv5xxH.js} +1 -1
- package/dist/esm/{filepond-plugin-image-exif-orientation-CZZUTjbL.js → filepond-plugin-image-exif-orientation-Dss_DgF7.js} +1 -1
- package/dist/esm/{filepond-plugin-image-preview-B4ob6BCt.js → filepond-plugin-image-preview-CaA89Pn1.js} +1 -1
- package/dist/esm/{index-AYwDRYpw.js → index-BtdIfJF8.js} +3 -3
- package/dist/esm/{intlTelInput-DTDyxq7t.js → intlTelInput-DxHIK3cL.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 +1 -1
- package/dist/esm/salla-add-product-button_5.entry.js +99 -22
- package/dist/esm/salla-advertisement.entry.js +1 -1
- package/dist/esm/salla-alert_2.entry.js +1 -1
- package/dist/esm/salla-app-install-alert.entry.js +1 -1
- package/dist/esm/salla-applied-filters.entry.js +1 -1
- package/dist/esm/salla-apps-icons.entry.js +1 -1
- package/dist/esm/salla-attachment-view_9.entry.js +12 -12
- 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 +5 -5
- 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 +3 -3
- package/dist/esm/salla-conditional-offer.entry.js +1 -1
- package/dist/esm/salla-contacts.entry.js +2 -2
- package/dist/esm/salla-cookies-bar.entry.js +1 -1
- package/dist/esm/salla-count-down.entry.js +1 -1
- package/dist/esm/salla-custom-fields.entry.js +1 -1
- package/dist/esm/salla-delivery-promise.entry.js +1 -1
- package/dist/esm/salla-edit-order-button.entry.js +1 -1
- package/dist/esm/salla-filters-widget.entry.js +1 -1
- package/dist/esm/salla-filters.entry.js +1 -1
- package/dist/esm/salla-fulfillment-methods.entry.js +1 -1
- package/dist/esm/salla-gift-card-redeem.entry.js +1 -1
- package/dist/esm/salla-gifting.entry.js +1 -1
- package/dist/esm/salla-hook.entry.js +1 -1
- package/dist/esm/salla-infinite-scroll.entry.js +1 -1
- package/dist/esm/salla-installment.entry.js +1 -1
- package/dist/esm/salla-list-tile.entry.js +1 -1
- package/dist/esm/salla-localization-modal.entry.js +1 -1
- package/dist/esm/salla-login-modal.entry.js +1 -1
- package/dist/esm/salla-loyalty-banner_10.entry.js +1 -1
- package/dist/esm/salla-loyalty-exchange-product-card.entry.js +1 -1
- package/dist/esm/salla-loyalty-points-banner.entry.js +1 -1
- package/dist/esm/salla-loyalty-points-history.entry.js +1 -1
- package/dist/esm/salla-loyalty-prize-item.entry.js +1 -1
- package/dist/esm/salla-loyalty.entry.js +1 -1
- package/dist/esm/salla-maintenance-alert.entry.js +1 -1
- package/dist/esm/salla-map_3.entry.js +1 -1
- package/dist/esm/salla-menu.entry.js +1 -1
- package/dist/esm/salla-metadata.entry.js +1 -1
- package/dist/esm/salla-multiple-bundle-product-cart_2.entry.js +1 -1
- package/dist/esm/salla-multiple-bundle-product-options-modal_2.entry.js +1 -1
- package/dist/esm/salla-multiple-bundle-product.entry.js +1 -1
- package/dist/esm/salla-next-order-coupon.entry.js +1 -1
- package/dist/esm/salla-notification-item_2.entry.js +1 -1
- package/dist/esm/salla-offer-modal.entry.js +1 -1
- package/dist/esm/salla-offer.entry.js +1 -1
- package/dist/esm/salla-order-branch.entry.js +1 -1
- package/dist/esm/salla-order-cancel.entry.js +1 -1
- package/dist/esm/salla-order-details-multiple-bundle-product.entry.js +1 -1
- package/dist/esm/salla-order-details-options.entry.js +1 -1
- package/dist/esm/salla-order-details.entry.js +1 -1
- package/dist/esm/salla-order-edit-item.entry.js +1 -1
- package/dist/esm/salla-order-edit-product-card.entry.js +1 -1
- package/dist/esm/salla-order-edit.entry.js +1 -1
- package/dist/esm/salla-order-options-modal.entry.js +1 -1
- package/dist/esm/salla-order-shipments.entry.js +1 -1
- package/dist/esm/salla-order-summary.entry.js +1 -1
- package/dist/esm/salla-order-totals-card.entry.js +1 -1
- package/dist/esm/salla-orders.entry.js +1 -1
- package/dist/esm/salla-payments.entry.js +24 -3
- 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 +2 -2
- package/dist/esm/salla-product-card.entry.js +14 -6
- package/dist/esm/salla-product-size-guide.entry.js +3 -3
- package/dist/esm/salla-products-list.entry.js +19 -4
- package/dist/esm/salla-products-slider.entry.js +1 -1
- package/dist/esm/salla-quick-order.entry.js +1 -1
- package/dist/esm/salla-rating-modal-v2.entry.js +1 -1
- package/dist/esm/salla-rating-modal.entry.js +1 -1
- package/dist/esm/salla-review-factors-tags.entry.js +2 -2
- 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 +3 -3
- package/dist/esm/salla-search.entry.js +1 -1
- package/dist/esm/salla-skeleton.entry.js +2 -2
- package/dist/esm/salla-social-share.entry.js +2 -2
- package/dist/esm/salla-social.entry.js +2 -2
- package/dist/esm/salla-tab-content_3.entry.js +4 -4
- package/dist/esm/salla-tiered-offer.entry.js +13 -2
- package/dist/esm/salla-tooltip.entry.js +2 -2
- package/dist/esm/salla-trust-badges.entry.js +1 -1
- package/dist/esm/salla-user-menu.entry.js +1 -1
- package/dist/esm/salla-user-profile.entry.js +1 -1
- package/dist/esm/salla-user-settings.entry.js +2 -2
- 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 +2 -2
- package/dist/esm/salla-wishlist-summary.entry.js +1 -1
- package/dist/esm/twilight.js +2 -2
- package/dist/esm/{vanilla-picker-Cgkc0m_N.js → vanilla-picker-CdDrNNAM.js} +1 -1
- package/dist/twilight/{p-8bb23a72.entry.js → p-072455fd.entry.js} +1 -1
- package/dist/twilight/{p-bdde64af.entry.js → p-09f65942.entry.js} +1 -1
- package/dist/twilight/{p-194bee78.entry.js → p-0b975744.entry.js} +1 -1
- package/dist/twilight/{p-d85bd672.entry.js → p-0d58eb8e.entry.js} +1 -1
- package/dist/twilight/{p-a45b7ab9.entry.js → p-14545c2e.entry.js} +1 -1
- package/dist/twilight/{p-3f45c1ad.entry.js → p-15b4d61d.entry.js} +1 -1
- package/dist/twilight/{p-54761c87.entry.js → p-1f48b187.entry.js} +1 -1
- package/dist/twilight/{p-2800db73.entry.js → p-20b122f5.entry.js} +1 -1
- package/dist/twilight/{p-687e1957.entry.js → p-20edfe7d.entry.js} +1 -1
- package/dist/twilight/{p-b2cd85be.entry.js → p-22bf309f.entry.js} +1 -1
- package/dist/twilight/p-24ebf9d6.entry.js +4 -0
- package/dist/twilight/{p-59dba4cc.entry.js → p-26479dee.entry.js} +1 -1
- package/dist/twilight/{p-03240694.entry.js → p-2a5844fa.entry.js} +1 -1
- package/dist/twilight/{p-b2518289.entry.js → p-3212b345.entry.js} +1 -1
- package/dist/twilight/{p-f1b5e1d0.entry.js → p-32f6ea11.entry.js} +1 -1
- package/dist/twilight/{p-22d8c66b.entry.js → p-340621ed.entry.js} +1 -1
- package/dist/twilight/{p-39cbfcc1.entry.js → p-344e9465.entry.js} +1 -1
- package/dist/twilight/{p-fa25c093.entry.js → p-357c7c69.entry.js} +1 -1
- package/dist/twilight/{p-79f7c717.entry.js → p-3b37eccc.entry.js} +1 -1
- package/dist/twilight/{p-f4e97600.entry.js → p-3b566d5d.entry.js} +1 -1
- package/dist/twilight/{p-1608ca3d.entry.js → p-410af88a.entry.js} +1 -1
- package/dist/twilight/{p-1cdabb19.entry.js → p-41b0367e.entry.js} +1 -1
- package/dist/twilight/{p-0a134a2b.entry.js → p-49d4a3c2.entry.js} +1 -1
- package/dist/twilight/{p-b6745060.entry.js → p-4e5bde43.entry.js} +1 -1
- package/dist/twilight/{p-2a586909.entry.js → p-506f1716.entry.js} +1 -1
- package/dist/twilight/{p-4139eb21.entry.js → p-565f74fe.entry.js} +1 -1
- package/dist/twilight/{p-fe698953.entry.js → p-56b50c65.entry.js} +1 -1
- package/dist/twilight/{p-946fa2c6.entry.js → p-56f3be75.entry.js} +1 -1
- package/dist/twilight/{p-a5dcd24a.entry.js → p-5710d065.entry.js} +1 -1
- package/dist/twilight/p-573899dc.entry.js +4 -0
- package/dist/twilight/{p-1d8c5d8f.entry.js → p-58a66109.entry.js} +1 -1
- package/dist/twilight/{p-35e3328a.entry.js → p-5afc95a7.entry.js} +1 -1
- package/dist/twilight/{p-01f636b2.entry.js → p-5d8cc35c.entry.js} +1 -1
- package/dist/twilight/{p-6b7d42a4.entry.js → p-5f7532b3.entry.js} +1 -1
- package/dist/twilight/{p-14439a37.entry.js → p-60a35744.entry.js} +1 -1
- package/dist/twilight/{p-807683b2.entry.js → p-646d3f8f.entry.js} +1 -1
- package/dist/twilight/{p-bbb3afc2.entry.js → p-67a08021.entry.js} +1 -1
- package/dist/twilight/{p-303da6f8.entry.js → p-6b9c1c5d.entry.js} +1 -1
- package/dist/twilight/{p-e94ca368.entry.js → p-6de41bdc.entry.js} +1 -1
- package/dist/twilight/{p-a4c24c91.entry.js → p-6ed2c97c.entry.js} +1 -1
- package/dist/twilight/{p-0abbef90.entry.js → p-773de9cc.entry.js} +1 -1
- package/dist/twilight/{p-f4e13356.entry.js → p-7944abc5.entry.js} +1 -1
- package/dist/twilight/{p-52901f3d.entry.js → p-799027c5.entry.js} +1 -1
- package/dist/twilight/{p-CPZ9Cyjs.js → p-7Z5IAwod.js} +1 -1
- package/dist/twilight/{p-42b362f0.entry.js → p-7c1d3130.entry.js} +1 -1
- package/dist/twilight/{p-b9941cd1.entry.js → p-80818114.entry.js} +1 -1
- package/dist/twilight/{p-05d07114.entry.js → p-80a7d4af.entry.js} +1 -1
- package/dist/twilight/{p-c04d0a0c.entry.js → p-84588994.entry.js} +1 -1
- package/dist/twilight/{p-dd51fb5e.entry.js → p-89cbcd3c.entry.js} +1 -1
- package/dist/twilight/{p-fdc4d86e.entry.js → p-8bf2a280.entry.js} +1 -1
- package/dist/twilight/{p-3444f32b.entry.js → p-8dac352c.entry.js} +1 -1
- package/dist/twilight/{p-99d94c03.entry.js → p-93064a1f.entry.js} +1 -1
- package/dist/twilight/{p-1704f9f1.entry.js → p-9661b909.entry.js} +1 -1
- package/dist/twilight/{p-c62884b5.entry.js → p-97ead14b.entry.js} +1 -1
- package/dist/twilight/{p-a7d41221.entry.js → p-98c519f7.entry.js} +1 -1
- package/dist/twilight/{p-f359ca64.entry.js → p-9d3d89f8.entry.js} +1 -1
- package/dist/twilight/{p-DDUkN0Su.js → p-Bc26pjHG.js} +1 -1
- package/dist/twilight/{p-CV6u89f0.js → p-BiGEqBIB.js} +1 -1
- package/dist/twilight/{p-CSUtBvKU.js → p-BjKw2hiE.js} +1 -1
- package/dist/twilight/{p-AYwDRYpw.js → p-BtdIfJF8.js} +2 -2
- package/dist/twilight/{p-CaLozk__.js → p-CKp7_rq_.js} +1 -1
- package/dist/twilight/p-D9PZqqzV.js +9 -0
- package/dist/twilight/{p-rSl3OdaO.js → p-DetotZcx.js} +1 -1
- package/dist/twilight/{p-DoXzH35M.js → p-DwNLIufU.js} +1 -1
- package/dist/twilight/{p-De55WukT.js → p-ShShhGeu.js} +1 -1
- package/dist/twilight/{p-b09ef1a0.entry.js → p-a0ad482e.entry.js} +1 -1
- package/dist/twilight/{p-1a0dada8.entry.js → p-a244a4f2.entry.js} +1 -1
- package/dist/twilight/p-a6c0154a.entry.js +4 -0
- package/dist/twilight/{p-e2d8071a.entry.js → p-a71b30fa.entry.js} +1 -1
- package/dist/twilight/{p-c0f29c04.entry.js → p-a9857ca3.entry.js} +1 -1
- package/dist/twilight/{p-161eebfe.entry.js → p-ae543e87.entry.js} +1 -1
- package/dist/twilight/{p-b61296d3.entry.js → p-af6932b0.entry.js} +1 -1
- package/dist/twilight/{p-1ef3f26c.entry.js → p-b199478b.entry.js} +1 -1
- package/dist/twilight/{p-7d36b069.entry.js → p-b1f146d6.entry.js} +1 -1
- package/dist/twilight/{p-7b339d4b.entry.js → p-b492dd6a.entry.js} +1 -1
- package/dist/twilight/{p-0cb8bc93.entry.js → p-b5b70b36.entry.js} +1 -1
- package/dist/twilight/{p-c05c4720.entry.js → p-b677ddca.entry.js} +1 -1
- package/dist/twilight/{p-e3974b7c.entry.js → p-bbfa65b5.entry.js} +1 -1
- package/dist/twilight/{p-07f3d023.entry.js → p-bce91b93.entry.js} +1 -1
- package/dist/twilight/{p-564426a3.entry.js → p-bd84e964.entry.js} +1 -1
- package/dist/twilight/{p-78b4744b.entry.js → p-be824cd2.entry.js} +1 -1
- package/dist/twilight/{p-a85d05d9.entry.js → p-c1caf8cb.entry.js} +1 -1
- package/dist/twilight/{p-0d2ac4d7.entry.js → p-c317b529.entry.js} +1 -1
- package/dist/twilight/{p-84f586c6.entry.js → p-c3d67706.entry.js} +1 -1
- package/dist/twilight/{p-9e37bac0.entry.js → p-c495c15f.entry.js} +1 -1
- package/dist/twilight/{p-85c488d1.entry.js → p-c571954d.entry.js} +1 -1
- package/dist/twilight/{p-31e2773a.entry.js → p-c61fce7a.entry.js} +1 -1
- package/dist/twilight/p-c64aaef9.entry.js +4 -0
- package/dist/twilight/{p-4d69e279.entry.js → p-cbe828f7.entry.js} +1 -1
- package/dist/twilight/{p-acda0c48.entry.js → p-cec14ad5.entry.js} +1 -1
- package/dist/twilight/{p-1d93f3b3.entry.js → p-cf1ea038.entry.js} +1 -1
- package/dist/twilight/{p-4500d73c.entry.js → p-d3a3216f.entry.js} +1 -1
- package/dist/twilight/p-d46adde4.entry.js +4 -0
- package/dist/twilight/{p-74f26eba.entry.js → p-d720d65e.entry.js} +1 -1
- package/dist/twilight/{p-8a1b1124.entry.js → p-df4e13e9.entry.js} +1 -1
- package/dist/twilight/{p-178ee77e.entry.js → p-e3a2bf70.entry.js} +1 -1
- package/dist/twilight/{p-93cd8edf.entry.js → p-e519da79.entry.js} +1 -1
- package/dist/twilight/{p-763c484c.entry.js → p-e583bb7d.entry.js} +1 -1
- package/dist/twilight/{p-59182ad3.entry.js → p-e9174da7.entry.js} +1 -1
- package/dist/twilight/{p-f1f648fd.entry.js → p-e9ab3ead.entry.js} +1 -1
- package/dist/twilight/{p-f2f9583c.entry.js → p-f318c73c.entry.js} +1 -1
- package/dist/twilight/{p-4a75e76d.entry.js → p-f32f8e51.entry.js} +1 -1
- package/dist/twilight/{p-b441862b.entry.js → p-f3cd8cf5.entry.js} +1 -1
- package/dist/twilight/{p-65e644bd.entry.js → p-f4d02219.entry.js} +1 -1
- package/dist/twilight/{p-60cd4998.entry.js → p-f97885ed.entry.js} +1 -1
- package/dist/twilight/{p-79283712.entry.js → p-fcbd0395.entry.js} +1 -1
- package/dist/twilight/twilight.esm.js +1 -1
- package/dist/types/components/salla-products-list/salla-products-list.d.ts +11 -0
- package/dist/types/components/salla-quick-buy/salla-quick-buy.d.ts +9 -0
- package/package.json +5 -5
- package/dist/twilight/p-54483689.entry.js +0 -4
- package/dist/twilight/p-54a63d62.entry.js +0 -4
- package/dist/twilight/p-5acc1781.entry.js +0 -4
- package/dist/twilight/p-DTRk8sgv.js +0 -9
- package/dist/twilight/p-a93e543a.entry.js +0 -4
- package/dist/twilight/p-d3e8c9d3.entry.js +0 -4
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as t,h as o,H as r,a}from"./p-AYwDRYpw.js";const s=class{constructor(o){t(this,o),this.availableCoupons=[],this.cartTotal=0,this.cartTotalReady=!1,this.currentCoupon="",this.couponInputValue="",this.couponError="",this.isApplying=!1,this.appliedCoupons=[],this.mergedCoupons=[],this.appliedCouponCards=[],this.orderLocked=!1,this.multiCoupon=!1,this.isHandlingInternalError=!1,this.cartUpdatedHandler=t=>{this.syncCartTotal(t),(this.multiCoupon?Array.isArray(t?.coupons):t&&"coupon"in t)&&this.syncAppliedFromCart(t),this.couponError=""},this.couponAddedHandler=()=>{this.isApplying||this.isHandlingInternalError||this.refreshFromServer()},this.couponAdditionFailedHandler=t=>{this.isApplying||this.isHandlingInternalError||this.showCouponError(t?.message||salla.lang.get("pages.cart.coupon_application_error"))},this.couponDeletedHandler=()=>{this.isApplying||this.isHandlingInternalError||this.refreshFromServer()},this.onKeyUp=t=>{"Enter"===t.key&&this.couponButtonRef?.click(),this.couponError=""},this.onInput=t=>{this.couponInputValue=t.target.value}}async componentWillLoad(){await Salla.onReady(),await Salla.lang.onLoaded(),this.multiCoupon=!!salla.config.get("store.settings.cart.multi_coupon"),this.loadCouponsData(),this.seedFromStorage(),this.loadCartTotal(),this.setupCartEventListeners()}setupCartEventListeners(){salla.event.on("cart::updated",this.cartUpdatedHandler),salla.event.on("cart::coupon.added",this.couponAddedHandler),salla.event.on("cart::coupon.addition.failed",this.couponAdditionFailedHandler),salla.event.on("cart::coupon.deleted",this.couponDeletedHandler)}disconnectedCallback(){salla.event.off("cart::updated",this.cartUpdatedHandler),salla.event.off("cart::coupon.added",this.couponAddedHandler),salla.event.off("cart::coupon.addition.failed",this.couponAdditionFailedHandler),salla.event.off("cart::coupon.deleted",this.couponDeletedHandler)}async selectCoupon(t){const o=this.availableCoupons.find((o=>o.code===t));if(o){if(!this.isEligible(o))throw new Error("Coupon not eligible: minimum cart amount not met");try{await this.applyCoupon(t),this.host.dispatchEvent(new CustomEvent("salla::cart-coupons.coupon.selected",{detail:o,bubbles:!0}))}catch(t){throw t}}return o}async loadCouponsData(){try{const t=await salla.api.request("coupons"),o=t?.data,r=Array.isArray(o)?o:Array.isArray(o?.data)?o.data:[];this.availableCoupons=r}catch(t){console.warn("Failed to load coupons:",t),this.availableCoupons=[]}this.buildMergedCoupons()}async loadCartTotal(){await this.refreshFromServer()}seedFromStorage(){if(this.multiCoupon)return;const t=salla.storage.get("cart");t&&"object"==typeof t&&"coupon"in t&&this.applyCart(t),this.seedTotalsFromSummaryStorage()}seedTotalsFromSummaryStorage(){const t=salla.storage.get("cart.summary");t&&"object"==typeof t&&null!=t.sub_total&&(this.cartTotal=Number(t.sub_total),this.cartTotalReady=!0)}syncCartTotal(t){const o=t?.summary?.sub_total??t?.sub_total??t?.total;null!=o&&(this.cartTotal=Number(o),this.cartTotalReady=!0)}async refreshFromServer(){try{const t=await salla.cart.details(),o=t?.data?.cart??t?.data??t;if(o&&"object"==typeof o&&(Array.isArray(o.coupons)||"coupon"in o))return void this.applyCart(o)}catch(t){}const t=salla.storage.get("cart");t&&this.applyCart(t),this.seedTotalsFromSummaryStorage()}applyCart(t){this.syncCartTotal(t),this.syncAppliedFromCart(t)}syncAppliedFromCart(t){if(this.currentCoupon=t?.coupon||"",this.multiCoupon){this.appliedCoupons=Array.isArray(t?.coupons)?t.coupons.filter(Boolean):this.currentCoupon?[this.currentCoupon]:[];const o=t?.applied_coupons;return this.appliedCouponCards=Array.isArray(o)?o.filter(Boolean):o&&"object"==typeof o?Object.values(o).filter(Boolean):[],void this.buildMergedCoupons()}this.couponInputValue=this.currentCoupon,this.appliedCoupons=this.currentCoupon?[this.currentCoupon]:[],this.buildMergedCoupons()}buildMergedCoupons(){if(!this.multiCoupon)return void(this.mergedCoupons=[]);const t=this.appliedCoupons.filter(Boolean),o=new Set(t),r=new Map(this.availableCoupons.map((t=>[t.code,t]))),a=new Map(r);this.appliedCouponCards.forEach((t=>{t?.code&&!a.has(t.code)&&a.set(t.code,t)}));const s=this.orderLocked?this.mergeIntoLockedOrder(t,r,(t=>o.has(t)||r.has(t))):[...t,...this.availableCoupons.map((t=>t.code)).filter((t=>!o.has(t)))];this.mergedCoupons=s.map((t=>({code:t,coupon:a.get(t)??null,applied:o.has(t)})))}mergeIntoLockedOrder(t,o,r){const a=this.mergedCoupons.map((t=>t.code)).filter(r),s=new Set(a),i=t.filter((t=>!s.has(t)));i.forEach((t=>s.add(t)));const e=[...o.keys()].filter((t=>!s.has(t)));return[...i,...a,...e]}lockOrder(){this.orderLocked=!0}async handleApplyClick(){if(this.isApplying)return;const t=this.couponInputValue.trim();if(t){this.lockOrder(),this.isApplying=!0,this.isHandlingInternalError=!0;try{await salla.cart.addCoupon(t),await this.refreshFromServer(),this.couponInputValue=""}catch(t){this.showCouponError(t.response?.data?.error?.message||salla.lang.get("pages.cart.coupon_application_error"))}finally{this.isApplying=!1,setTimeout((()=>{this.isHandlingInternalError=!1}),100)}}else this.showCouponError(salla.lang.get("pages.cart.enter_coupon_code"))}async handleCouponButtonClick(){if(this.isApplying)return;const t=!!this.currentCoupon;if(t||this.couponInputValue.trim()){this.isApplying=!0,this.isHandlingInternalError=!0;try{t?await salla.cart.deleteCoupon():await salla.cart.addCoupon(this.couponInputValue.trim()),await this.refreshFromServer()}catch(t){this.showCouponError(t.response?.data?.error?.message||salla.lang.get("pages.cart.coupon_application_error"))}finally{this.isApplying=!1,setTimeout((()=>{this.isHandlingInternalError=!1}),100)}}else this.showCouponError(salla.lang.get("pages.cart.enter_coupon_code"))}async removeCoupon(t){if(!this.isApplying){this.lockOrder(),this.isApplying=!0,this.isHandlingInternalError=!0;try{this.multiCoupon?await salla.cart.deleteCoupon(t):await salla.cart.deleteCoupon(),await this.refreshFromServer()}catch(t){this.showCouponError(t.response?.data?.error?.message||salla.lang.get("pages.cart.coupon_application_error"))}finally{this.isApplying=!1,setTimeout((()=>{this.isHandlingInternalError=!1}),100)}}}showCouponError(t){this.couponError=t}handleCouponClick(t){this.applyCoupon(t.code,!1).catch((()=>{}))}async applyCoupon(t,o=!0){if(this.isApplying){if(o)throw new Error("Coupon application already in progress")}else{this.lockOrder(),this.couponInputValue=t,this.couponError="",this.isApplying=!0,this.isHandlingInternalError=!0;try{await salla.cart.addCoupon(t.trim()),await this.refreshFromServer(),this.multiCoupon&&(this.couponInputValue="")}catch(t){if(this.showCouponError(t.response?.data?.error?.message||salla.lang.get("pages.cart.coupon_application_error")),o)throw t}finally{this.isApplying=!1,setTimeout((()=>{this.isHandlingInternalError=!1}),100)}}}formatMainAmount(t){if("percentage"===t.type)return`${salla.helpers.number("object"==typeof t.amount?t.amount.amount:t.amount)}%`;{const r="object"==typeof t.amount?t.amount:{amount:t.amount,currency:t.minimum_amount?.currency||salla.config.get("store.currency.code","SAR")};return o("span",{innerHTML:salla.money(r.amount,r.currency)})}}isEligible(t){return!this.cartTotalReady||!t.minimum_amount||this.cartTotal>=parseFloat(t.minimum_amount.amount)}renderCouponCard(t){const{coupon:r,applied:a,code:s}=t;if(!r)return this.renderMinimalCard(s);const i=this.isEligible(r);return o("div",{class:"s-cart-coupons-slide-one-fourth swiper-slide"},o("div",{class:`s-cart-coupons-card ${a?"s-cart-coupons-card--applied":""} ${a||i&&!this.isApplying?"":"s-cart-coupons-disabled"}`,onClick:()=>!a&&i&&!this.isApplying&&this.handleCouponClick(r)},o("div",{class:"s-cart-coupons-top-section"},o("div",{class:"s-cart-coupons-discount-values"},o("div",{class:"s-cart-coupons-main-amount"},this.formatMainAmount(r)),r.free_shipping?o("div",{class:"s-cart-coupons-secondary-info"},"+ ",salla.lang.get("pages.cart.free_shipping")):r.maximum_amount&&o("div",{class:"s-cart-coupons-secondary-info"},salla.lang.get("pages.cart.up_to")," ",o("span",{innerHTML:salla.money(r.maximum_amount.amount,r.maximum_amount.currency)}))),o("div",{class:"s-cart-coupons-code"},r.code)),o("div",{class:"s-cart-coupons-divider"}),o("div",{class:"s-cart-coupons-bottom-section"},o("div",{class:"s-cart-coupons-terms"},null!=r.remaining_days&&o("div",{class:"s-cart-coupons-expiry "+(r.remaining_days<=3?"s-cart-coupons-expiry-warning":"")},0===r.remaining_days?salla.lang.get("pages.cart.expires_today"):`${salla.lang.get("pages.cart.expires_after")} ${r.remaining_days} ${salla.lang.get("pages.cart.day")}`),r.minimum_amount&&parseFloat(r.minimum_amount.amount)>0&&o("div",{class:"s-cart-coupons-minimum"},salla.lang.get("pages.cart.minimum")," ",o("span",{innerHTML:salla.money(r.minimum_amount.amount,r.minimum_amount.currency)}))),o("div",{class:"s-cart-coupons-action"},a?this.renderAppliedAction(s):i?salla.lang.get("pages.cart.save_coupon"):salla.lang.get("pages.cart.coupon_not_compatible")))))}renderAppliedAction(t){return[o("span",{class:"s-cart-coupons-card-applied-label"},salla.lang.get("pages.cart.coupon_applied")),o("button",{type:"button",class:"s-cart-coupons-card-remove","aria-label":`${salla.lang.get("pages.cart.delete_coupon")} ${t}`,disabled:this.isApplying,onClick:o=>{o.stopPropagation(),this.removeCoupon(t)}},salla.lang.get("pages.cart.cancel"))]}renderMinimalCard(t){return o("div",{class:"s-cart-coupons-slide-one-fourth swiper-slide"},o("div",{class:"s-cart-coupons-card s-cart-coupons-card--applied s-cart-coupons-card--minimal"},o("div",{class:"s-cart-coupons-top-section"},o("div",{class:"s-cart-coupons-code s-cart-coupons-code--only"},t)),o("div",{class:"s-cart-coupons-divider"}),o("div",{class:"s-cart-coupons-bottom-section"},o("div",{class:"s-cart-coupons-action"},this.renderAppliedAction(t)))))}couponRow(){return this.multiCoupon?this.mergedCoupons:(this.availableCoupons||[]).map((t=>({code:t.code,coupon:t,applied:!1})))}render(){const t=this.couponRow();return o(r,{key:"e756434a2f77235e870891ce7e0b672a69429e49"},o("div",{key:"ca86866dc7275c98f72c2bc4c95684826e2a94d0",class:"s-cart-coupons-wrapper"},o("div",{key:"8c37273ea0e40cad320ac148d82eeea2774ba18d",class:"s-cart-coupons-input-section"},o("label",{key:"8495bff14cae70f530c648e49cac76bd57ec4429",htmlFor:"coupon-input",class:"s-cart-coupons-coupon-label"},salla.lang.get("pages.cart.have_coupon")),o("div",{key:"5e6d10ab653561c33e73829f9259fe3037eab8e7",class:"s-cart-coupons-coupon-input-container"},this.multiCoupon?[o("input",{type:"text",id:"coupon-input",name:"coupon",class:"form-input "+(this.couponError?"s-coupon-input-error":""),placeholder:salla.lang.get("pages.cart.coupon_placeholder"),value:this.couponInputValue,disabled:this.isApplying,onInput:this.onInput,onKeyUp:this.onKeyUp,"aria-label":salla.lang.get("pages.cart.apply_coupon"),key:"coupon-input"}),o("salla-button",{ref:t=>this.couponButtonRef=t,class:"s-cart-coupons-coupon-button s-cart-coupons-coupon-button-apply",color:"primary",loading:this.isApplying,"loader-position":"center",onClick:()=>this.handleApplyClick(),key:"apply-button"},o("span",null,salla.lang.get("pages.cart.save_coupon")))]:[o("input",{type:"text",id:"coupon-input",name:"coupon",class:"form-input "+(this.couponError?"s-coupon-input-error":""),placeholder:salla.lang.get("pages.cart.coupon_placeholder"),value:this.couponInputValue,disabled:!!this.currentCoupon||this.isApplying,onInput:this.onInput,onKeyUp:this.onKeyUp,"aria-label":salla.lang.get("pages.cart.apply_coupon"),key:"coupon-input"}),o("salla-button",{ref:t=>this.couponButtonRef=t,class:"s-cart-coupons-coupon-button "+(this.currentCoupon?"s-cart-coupons-coupon-button-remove":"s-cart-coupons-coupon-button-apply"),color:this.currentCoupon?"danger":"primary",loading:this.isApplying,"loader-position":"center",onClick:()=>this.handleCouponButtonClick(),key:"apply-button"},this.currentCoupon?o("i",{class:"sicon-cancel"}):o("span",null,salla.lang.get("pages.cart.save_coupon")))]),this.couponError&&o("span",{key:"5f7ff489d561f440e643c62c0d238a059f94ff2e",class:"s-cart-coupons-coupon-error"},this.couponError)),t.length>0&&o("salla-slider",{type:"carousel",showControls:!1,class:"s-cart-coupons-slider",key:t.map((t=>t.code)).join("|")},o("div",{key:"5b811515254595fcde9a364b113b60d38048e2c0",slot:"items"},t.map((t=>this.renderCouponCard(t)))))))}get host(){return a(this)}};s.style='/*!twlt*/@charset "UTF-8";.s-cart-coupons-card--applied{cursor:default}.s-cart-coupons-card--applied:hover{transform:none}.s-cart-coupons-card--applied .s-cart-coupons-top-section,.s-cart-coupons-card--applied .s-cart-coupons-bottom-section,.s-cart-coupons-card--applied .s-cart-coupons-divider{border-color:#d1d5db;border-color:color-mix(in srgb, var(--color-primary, #004d5a) 40%, transparent)}.s-cart-coupons-card--applied .s-cart-coupons-bottom-section{background:rgba(0, 0, 0, 0.04);background:color-mix(in srgb, var(--color-primary, #004d5a) 8%, transparent)}.s-cart-coupons-card--applied::before,.s-cart-coupons-card--applied::after{border-color:#d1d5db;border-color:color-mix(in srgb, var(--color-primary, #004d5a) 40%, transparent)}.s-cart-coupons-card--applied .s-cart-coupons-action{display:inline-flex;align-items:center;gap:10px}.s-cart-coupons-card--applied .s-cart-coupons-action{font-size:10px;font-weight:600;color:#4b5563}.s-cart-coupons-card-applied-label{color:#4b5563;color:var(--color-primary-dark, var(--color-primary, #4b5563))}.s-cart-coupons-card--applied .s-cart-coupons-action{min-width:0;max-width:100%}.s-cart-coupons-card-applied-label,.s-cart-coupons-card-remove{overflow:hidden;text-overflow:ellipsis}.s-cart-coupons-card--applied .s-cart-coupons-action,.s-cart-coupons-card--applied .s-cart-coupons-card-remove{pointer-events:auto}.s-cart-coupons-card-remove{flex:none;font-size:inherit;font-weight:inherit;color:#6b7280;background:transparent;border:0;padding:0;cursor:pointer;transition:color 0.15s ease}.s-cart-coupons-card-remove:hover{color:var(--color-danger, #ef4444)}.s-cart-coupons-card-remove:disabled{opacity:0.5;cursor:not-allowed}.s-cart-coupons-card--minimal .s-cart-coupons-bottom-section{justify-content:flex-end}.visible{visibility:visible}.fixed{position:fixed}.shrink{flex-shrink:1}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.form-input{height:2.5rem;width:100%;border-radius:0.375rem;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1));transition-property:color, background-color, border-color, text-decoration-color, fill, stroke;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:300ms}.form-input:focus{border-color:var(--color-primary);--tw-ring-color:transparent}.form-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))}.form-input:focus:is(.dark *){border-color:var(--color-primary)}@media (min-width: 640px){.form-input{font-size:0.875rem;line-height:1.25rem}}.s-cart-coupons-wrapper{display:block;width:100%;padding-top:1.25rem;padding-bottom:1.25rem}.s-cart-coupons-input-section{margin-bottom:0.625rem}.s-cart-coupons-coupon-label{margin-bottom:0.625rem;display:block;font-size:0.875rem;line-height:1.25rem;--tw-text-opacity:1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.s-cart-coupons-coupon-input-container{position:relative;display:flex;align-items:stretch}.s-cart-coupons-coupon-input-container .form-input{height:auto;flex:1 1 0%}.s-cart-coupons-coupon-input-container .form-input:where([dir="ltr"],[dir="ltr"] *){border-top-left-radius:0.5rem;border-bottom-left-radius:0.5rem;border-top-right-radius:0px !important;border-bottom-right-radius:0px !important;border-right-width:0px}.s-cart-coupons-coupon-input-container .form-input:where([dir="rtl"],[dir="rtl"] *){border-top-right-radius:0.5rem;border-bottom-right-radius:0.5rem;border-top-left-radius:0px !important;border-bottom-left-radius:0px !important;border-left-width:0px}.s-cart-coupons-coupon-input-container .form-input:focus{position:relative;z-index:10}.s-cart-coupons-coupon-button:where([dir="ltr"],[dir="ltr"] *){border-top-right-radius:0.5rem;border-bottom-right-radius:0.5rem;border-top-left-radius:0px;border-bottom-left-radius:0px}.s-cart-coupons-coupon-button:where([dir="rtl"],[dir="rtl"] *){border-top-left-radius:0.5rem;border-bottom-left-radius:0.5rem;border-top-right-radius:0px;border-bottom-right-radius:0px}.s-cart-coupons-coupon-button-remove:where([dir="ltr"],[dir="ltr"] *){border-top-right-radius:0.5rem;border-bottom-right-radius:0.5rem;border-top-left-radius:0px !important;border-bottom-left-radius:0px !important}.s-cart-coupons-coupon-button-remove:where([dir="rtl"],[dir="rtl"] *){border-top-left-radius:0.5rem;border-bottom-left-radius:0.5rem;border-top-right-radius:0px !important;border-bottom-right-radius:0px !important}.s-cart-coupons-coupon-button-apply:where([dir="ltr"],[dir="ltr"] *){border-top-right-radius:0.5rem !important;border-bottom-right-radius:0.5rem !important;border-top-left-radius:0px !important;border-bottom-left-radius:0px !important}.s-cart-coupons-coupon-button-apply:where([dir="rtl"],[dir="rtl"] *){border-top-left-radius:0.5rem !important;border-bottom-left-radius:0.5rem !important;border-top-right-radius:0px !important;border-bottom-right-radius:0px !important}.s-cart-coupons-coupon-error{margin-top:0.5rem;display:block;font-size:10px;line-height:1rem;--tw-text-opacity:1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.s-cart-coupons-slider{width:100%;overflow:hidden;padding-left:0.375rem;padding-right:0.375rem}.s-cart-coupons-card{position:relative;cursor:pointer;overflow:hidden;--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1));transition-property:all;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:300ms}.s-cart-coupons-card:is(.dark *){--tw-bg-opacity:1;background-color:rgb(31 41 55 / var(--tw-bg-opacity, 1))}.s-cart-coupons-card:hover{--tw-translate-y:-0.125rem;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.s-cart-coupons-disabled{cursor:not-allowed;opacity:0.5}.s-cart-coupons-disabled:hover{transform:none;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1));--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}.s-cart-coupons-top-section{display:flex;height:60px;flex-direction:row;align-items:center;justify-content:space-between;border-top-left-radius:0.75rem;border-top-right-radius:0.75rem;border-width:1px;border-bottom-width:0px;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1));padding-top:1rem;padding-bottom:1rem;padding-left:0.75rem;padding-right:0.75rem}.s-cart-coupons-discount-values{display:flex;flex-direction:column;align-items:flex-start}.s-cart-coupons-discount-values .s-cart-coupons-main-amount{display:flex;align-items:center;gap:0.25rem;white-space:nowrap;font-size:1.25rem;line-height:1.75rem;font-weight:900;line-height:1;--tw-text-opacity:1;color:rgb(0 0 0 / var(--tw-text-opacity, 1))}.s-cart-coupons-discount-values .s-cart-coupons-secondary-info{margin:0px;font-size:10px;line-height:1rem}.s-cart-coupons-code{font-size:10px;font-weight:700;--tw-text-opacity:1;color:rgb(17 24 39 / var(--tw-text-opacity, 1))}.s-cart-coupons-divider{position:relative;z-index:10;margin:0px;border-bottom-width:1px;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1))}.s-cart-coupons-bottom-section{display:flex;min-height:44px;flex-direction:row;align-items:center;justify-content:space-between;border-bottom-right-radius:0.75rem;border-bottom-left-radius:0.75rem;border-width:1px;border-top-width:0px;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1));--tw-bg-opacity:1;background-color:rgb(249 250 251 / var(--tw-bg-opacity, 1));padding-top:0.25rem;padding-bottom:0.25rem;padding-left:0.75rem;padding-right:0.75rem}.s-cart-coupons-terms{display:flex;flex-direction:column;align-items:flex-start}.s-cart-coupons-terms .s-cart-coupons-expiry{margin:0px;font-size:10px;line-height:16px;--tw-text-opacity:1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.s-cart-coupons-terms .s-cart-coupons-minimum{margin:0px;font-size:10px;line-height:16px;--tw-text-opacity:1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.s-cart-coupons-terms .s-cart-coupons-expiry.s-cart-coupons-expiry-warning{font-weight:500;--tw-text-opacity:1;color:rgb(220 38 38 / var(--tw-text-opacity, 1))}.s-cart-coupons-action{cursor:pointer;white-space:nowrap;border-width:0px;background-color:transparent;padding:0px;font-size:9px;font-weight:700;--tw-text-opacity:1;color:rgb(17 24 39 / var(--tw-text-opacity, 1));transition-property:color, background-color, border-color, text-decoration-color, fill, stroke;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms}.s-cart-coupons-action:hover{--tw-text-opacity:1;color:rgb(59 130 246 / var(--tw-text-opacity, 1))}.s-cart-coupons-slide-one-fourth{width:calc(75% - 10px);min-width:200px !important;padding-left:5px !important;padding-right:5px !important;padding-top:2px !important}@media (min-width: 1024px){.s-cart-coupons-slide-one-fourth{width:calc(40% - 10px) !important}}.s-cart-coupons-card:before{pointer-events:none;position:absolute;right:-10px;top:60px;z-index:20;height:1.25rem;width:1.25rem;--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));border-radius:9999px;border-width:1px;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1));--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1));--tw-content:\'\';content:var(--tw-content)}.s-cart-coupons-card:is(.dark *):before{--tw-bg-opacity:1;background-color:rgb(31 41 55 / var(--tw-bg-opacity, 1))}.s-cart-coupons-card:after{pointer-events:none;position:absolute;left:-10px;top:60px;z-index:20;height:1.25rem;width:1.25rem;--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));border-radius:9999px;border-width:1px;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1));--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1));--tw-content:\'\';content:var(--tw-content)}.s-cart-coupons-card:is(.dark *):after{--tw-bg-opacity:1;background-color:rgb(31 41 55 / var(--tw-bg-opacity, 1))}.s-cart-coupons-coupon-input-container .form-input.s-coupon-input-error{--tw-shadow:0 0 0 3px rgba(239,68,68,0.1) !important;--tw-shadow-colored:0 0 0 3px var(--tw-shadow-color) !important;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow) !important}';export{s as salla_cart_coupons}
|
|
4
|
+
import{r as t,h as o,H as r,a}from"./p-BtdIfJF8.js";const s=class{constructor(o){t(this,o),this.availableCoupons=[],this.cartTotal=0,this.cartTotalReady=!1,this.currentCoupon="",this.couponInputValue="",this.couponError="",this.isApplying=!1,this.appliedCoupons=[],this.mergedCoupons=[],this.appliedCouponCards=[],this.orderLocked=!1,this.multiCoupon=!1,this.isHandlingInternalError=!1,this.cartUpdatedHandler=t=>{this.syncCartTotal(t),(this.multiCoupon?Array.isArray(t?.coupons):t&&"coupon"in t)&&this.syncAppliedFromCart(t),this.couponError=""},this.couponAddedHandler=()=>{this.isApplying||this.isHandlingInternalError||this.refreshFromServer()},this.couponAdditionFailedHandler=t=>{this.isApplying||this.isHandlingInternalError||this.showCouponError(t?.message||salla.lang.get("pages.cart.coupon_application_error"))},this.couponDeletedHandler=()=>{this.isApplying||this.isHandlingInternalError||this.refreshFromServer()},this.onKeyUp=t=>{"Enter"===t.key&&this.couponButtonRef?.click(),this.couponError=""},this.onInput=t=>{this.couponInputValue=t.target.value}}async componentWillLoad(){await Salla.onReady(),await Salla.lang.onLoaded(),this.multiCoupon=!!salla.config.get("store.settings.cart.multi_coupon"),this.loadCouponsData(),this.seedFromStorage(),this.loadCartTotal(),this.setupCartEventListeners()}setupCartEventListeners(){salla.event.on("cart::updated",this.cartUpdatedHandler),salla.event.on("cart::coupon.added",this.couponAddedHandler),salla.event.on("cart::coupon.addition.failed",this.couponAdditionFailedHandler),salla.event.on("cart::coupon.deleted",this.couponDeletedHandler)}disconnectedCallback(){salla.event.off("cart::updated",this.cartUpdatedHandler),salla.event.off("cart::coupon.added",this.couponAddedHandler),salla.event.off("cart::coupon.addition.failed",this.couponAdditionFailedHandler),salla.event.off("cart::coupon.deleted",this.couponDeletedHandler)}async selectCoupon(t){const o=this.availableCoupons.find((o=>o.code===t));if(o){if(!this.isEligible(o))throw new Error("Coupon not eligible: minimum cart amount not met");try{await this.applyCoupon(t),this.host.dispatchEvent(new CustomEvent("salla::cart-coupons.coupon.selected",{detail:o,bubbles:!0}))}catch(t){throw t}}return o}async loadCouponsData(){try{const t=await salla.api.request("coupons"),o=t?.data,r=Array.isArray(o)?o:Array.isArray(o?.data)?o.data:[];this.availableCoupons=r}catch(t){console.warn("Failed to load coupons:",t),this.availableCoupons=[]}this.buildMergedCoupons()}async loadCartTotal(){await this.refreshFromServer()}seedFromStorage(){if(this.multiCoupon)return;const t=salla.storage.get("cart");t&&"object"==typeof t&&"coupon"in t&&this.applyCart(t),this.seedTotalsFromSummaryStorage()}seedTotalsFromSummaryStorage(){const t=salla.storage.get("cart.summary");t&&"object"==typeof t&&null!=t.sub_total&&(this.cartTotal=Number(t.sub_total),this.cartTotalReady=!0)}syncCartTotal(t){const o=t?.summary?.sub_total??t?.sub_total??t?.total;null!=o&&(this.cartTotal=Number(o),this.cartTotalReady=!0)}async refreshFromServer(){try{const t=await salla.cart.details(),o=t?.data?.cart??t?.data??t;if(o&&"object"==typeof o&&(Array.isArray(o.coupons)||"coupon"in o))return void this.applyCart(o)}catch(t){}const t=salla.storage.get("cart");t&&this.applyCart(t),this.seedTotalsFromSummaryStorage()}applyCart(t){this.syncCartTotal(t),this.syncAppliedFromCart(t)}syncAppliedFromCart(t){if(this.currentCoupon=t?.coupon||"",this.multiCoupon){this.appliedCoupons=Array.isArray(t?.coupons)?t.coupons.filter(Boolean):this.currentCoupon?[this.currentCoupon]:[];const o=t?.applied_coupons;return this.appliedCouponCards=Array.isArray(o)?o.filter(Boolean):o&&"object"==typeof o?Object.values(o).filter(Boolean):[],void this.buildMergedCoupons()}this.couponInputValue=this.currentCoupon,this.appliedCoupons=this.currentCoupon?[this.currentCoupon]:[],this.buildMergedCoupons()}buildMergedCoupons(){if(!this.multiCoupon)return void(this.mergedCoupons=[]);const t=this.appliedCoupons.filter(Boolean),o=new Set(t),r=new Map(this.availableCoupons.map((t=>[t.code,t]))),a=new Map(r);this.appliedCouponCards.forEach((t=>{t?.code&&!a.has(t.code)&&a.set(t.code,t)}));const s=this.orderLocked?this.mergeIntoLockedOrder(t,r,(t=>o.has(t)||r.has(t))):[...t,...this.availableCoupons.map((t=>t.code)).filter((t=>!o.has(t)))];this.mergedCoupons=s.map((t=>({code:t,coupon:a.get(t)??null,applied:o.has(t)})))}mergeIntoLockedOrder(t,o,r){const a=this.mergedCoupons.map((t=>t.code)).filter(r),s=new Set(a),i=t.filter((t=>!s.has(t)));i.forEach((t=>s.add(t)));const e=[...o.keys()].filter((t=>!s.has(t)));return[...i,...a,...e]}lockOrder(){this.orderLocked=!0}async handleApplyClick(){if(this.isApplying)return;const t=this.couponInputValue.trim();if(t){this.lockOrder(),this.isApplying=!0,this.isHandlingInternalError=!0;try{await salla.cart.addCoupon(t),await this.refreshFromServer(),this.couponInputValue=""}catch(t){this.showCouponError(t.response?.data?.error?.message||salla.lang.get("pages.cart.coupon_application_error"))}finally{this.isApplying=!1,setTimeout((()=>{this.isHandlingInternalError=!1}),100)}}else this.showCouponError(salla.lang.get("pages.cart.enter_coupon_code"))}async handleCouponButtonClick(){if(this.isApplying)return;const t=!!this.currentCoupon;if(t||this.couponInputValue.trim()){this.isApplying=!0,this.isHandlingInternalError=!0;try{t?await salla.cart.deleteCoupon():await salla.cart.addCoupon(this.couponInputValue.trim()),await this.refreshFromServer()}catch(t){this.showCouponError(t.response?.data?.error?.message||salla.lang.get("pages.cart.coupon_application_error"))}finally{this.isApplying=!1,setTimeout((()=>{this.isHandlingInternalError=!1}),100)}}else this.showCouponError(salla.lang.get("pages.cart.enter_coupon_code"))}async removeCoupon(t){if(!this.isApplying){this.lockOrder(),this.isApplying=!0,this.isHandlingInternalError=!0;try{this.multiCoupon?await salla.cart.deleteCoupon(t):await salla.cart.deleteCoupon(),await this.refreshFromServer()}catch(t){this.showCouponError(t.response?.data?.error?.message||salla.lang.get("pages.cart.coupon_application_error"))}finally{this.isApplying=!1,setTimeout((()=>{this.isHandlingInternalError=!1}),100)}}}showCouponError(t){this.couponError=t}handleCouponClick(t){this.applyCoupon(t.code,!1).catch((()=>{}))}async applyCoupon(t,o=!0){if(this.isApplying){if(o)throw new Error("Coupon application already in progress")}else{this.lockOrder(),this.couponInputValue=t,this.couponError="",this.isApplying=!0,this.isHandlingInternalError=!0;try{await salla.cart.addCoupon(t.trim()),await this.refreshFromServer(),this.multiCoupon&&(this.couponInputValue="")}catch(t){if(this.showCouponError(t.response?.data?.error?.message||salla.lang.get("pages.cart.coupon_application_error")),o)throw t}finally{this.isApplying=!1,setTimeout((()=>{this.isHandlingInternalError=!1}),100)}}}formatMainAmount(t){if("percentage"===t.type)return`${salla.helpers.number("object"==typeof t.amount?t.amount.amount:t.amount)}%`;{const r="object"==typeof t.amount?t.amount:{amount:t.amount,currency:t.minimum_amount?.currency||salla.config.get("store.currency.code","SAR")};return o("span",{innerHTML:salla.money(r.amount,r.currency)})}}isEligible(t){return!this.cartTotalReady||!t.minimum_amount||this.cartTotal>=parseFloat(t.minimum_amount.amount)}renderCouponCard(t){const{coupon:r,applied:a,code:s}=t;if(!r)return this.renderMinimalCard(s);const i=this.isEligible(r);return o("div",{class:"s-cart-coupons-slide-one-fourth swiper-slide"},o("div",{class:`s-cart-coupons-card ${a?"s-cart-coupons-card--applied":""} ${a||i&&!this.isApplying?"":"s-cart-coupons-disabled"}`,onClick:()=>!a&&i&&!this.isApplying&&this.handleCouponClick(r)},o("div",{class:"s-cart-coupons-top-section"},o("div",{class:"s-cart-coupons-discount-values"},o("div",{class:"s-cart-coupons-main-amount"},this.formatMainAmount(r)),r.free_shipping?o("div",{class:"s-cart-coupons-secondary-info"},"+ ",salla.lang.get("pages.cart.free_shipping")):r.maximum_amount&&o("div",{class:"s-cart-coupons-secondary-info"},salla.lang.get("pages.cart.up_to")," ",o("span",{innerHTML:salla.money(r.maximum_amount.amount,r.maximum_amount.currency)}))),o("div",{class:"s-cart-coupons-code"},r.code)),o("div",{class:"s-cart-coupons-divider"}),o("div",{class:"s-cart-coupons-bottom-section"},o("div",{class:"s-cart-coupons-terms"},null!=r.remaining_days&&o("div",{class:"s-cart-coupons-expiry "+(r.remaining_days<=3?"s-cart-coupons-expiry-warning":"")},0===r.remaining_days?salla.lang.get("pages.cart.expires_today"):`${salla.lang.get("pages.cart.expires_after")} ${r.remaining_days} ${salla.lang.get("pages.cart.day")}`),r.minimum_amount&&parseFloat(r.minimum_amount.amount)>0&&o("div",{class:"s-cart-coupons-minimum"},salla.lang.get("pages.cart.minimum")," ",o("span",{innerHTML:salla.money(r.minimum_amount.amount,r.minimum_amount.currency)}))),o("div",{class:"s-cart-coupons-action"},a?this.renderAppliedAction(s):i?salla.lang.get("pages.cart.save_coupon"):salla.lang.get("pages.cart.coupon_not_compatible")))))}renderAppliedAction(t){return[o("span",{class:"s-cart-coupons-card-applied-label"},salla.lang.get("pages.cart.coupon_applied")),o("button",{type:"button",class:"s-cart-coupons-card-remove","aria-label":`${salla.lang.get("pages.cart.delete_coupon")} ${t}`,disabled:this.isApplying,onClick:o=>{o.stopPropagation(),this.removeCoupon(t)}},salla.lang.get("pages.cart.cancel"))]}renderMinimalCard(t){return o("div",{class:"s-cart-coupons-slide-one-fourth swiper-slide"},o("div",{class:"s-cart-coupons-card s-cart-coupons-card--applied s-cart-coupons-card--minimal"},o("div",{class:"s-cart-coupons-top-section"},o("div",{class:"s-cart-coupons-code s-cart-coupons-code--only"},t)),o("div",{class:"s-cart-coupons-divider"}),o("div",{class:"s-cart-coupons-bottom-section"},o("div",{class:"s-cart-coupons-action"},this.renderAppliedAction(t)))))}couponRow(){return this.multiCoupon?this.mergedCoupons:(this.availableCoupons||[]).map((t=>({code:t.code,coupon:t,applied:!1})))}render(){const t=this.couponRow();return o(r,{key:"e756434a2f77235e870891ce7e0b672a69429e49"},o("div",{key:"ca86866dc7275c98f72c2bc4c95684826e2a94d0",class:"s-cart-coupons-wrapper"},o("div",{key:"8c37273ea0e40cad320ac148d82eeea2774ba18d",class:"s-cart-coupons-input-section"},o("label",{key:"8495bff14cae70f530c648e49cac76bd57ec4429",htmlFor:"coupon-input",class:"s-cart-coupons-coupon-label"},salla.lang.get("pages.cart.have_coupon")),o("div",{key:"5e6d10ab653561c33e73829f9259fe3037eab8e7",class:"s-cart-coupons-coupon-input-container"},this.multiCoupon?[o("input",{type:"text",id:"coupon-input",name:"coupon",class:"form-input "+(this.couponError?"s-coupon-input-error":""),placeholder:salla.lang.get("pages.cart.coupon_placeholder"),value:this.couponInputValue,disabled:this.isApplying,onInput:this.onInput,onKeyUp:this.onKeyUp,"aria-label":salla.lang.get("pages.cart.apply_coupon"),key:"coupon-input"}),o("salla-button",{ref:t=>this.couponButtonRef=t,class:"s-cart-coupons-coupon-button s-cart-coupons-coupon-button-apply",color:"primary",loading:this.isApplying,"loader-position":"center",onClick:()=>this.handleApplyClick(),key:"apply-button"},o("span",null,salla.lang.get("pages.cart.save_coupon")))]:[o("input",{type:"text",id:"coupon-input",name:"coupon",class:"form-input "+(this.couponError?"s-coupon-input-error":""),placeholder:salla.lang.get("pages.cart.coupon_placeholder"),value:this.couponInputValue,disabled:!!this.currentCoupon||this.isApplying,onInput:this.onInput,onKeyUp:this.onKeyUp,"aria-label":salla.lang.get("pages.cart.apply_coupon"),key:"coupon-input"}),o("salla-button",{ref:t=>this.couponButtonRef=t,class:"s-cart-coupons-coupon-button "+(this.currentCoupon?"s-cart-coupons-coupon-button-remove":"s-cart-coupons-coupon-button-apply"),color:this.currentCoupon?"danger":"primary",loading:this.isApplying,"loader-position":"center",onClick:()=>this.handleCouponButtonClick(),key:"apply-button"},this.currentCoupon?o("i",{class:"sicon-cancel"}):o("span",null,salla.lang.get("pages.cart.save_coupon")))]),this.couponError&&o("span",{key:"5f7ff489d561f440e643c62c0d238a059f94ff2e",class:"s-cart-coupons-coupon-error"},this.couponError)),t.length>0&&o("salla-slider",{type:"carousel",showControls:!1,class:"s-cart-coupons-slider",key:t.map((t=>t.code)).join("|")},o("div",{key:"5b811515254595fcde9a364b113b60d38048e2c0",slot:"items"},t.map((t=>this.renderCouponCard(t)))))))}get host(){return a(this)}};s.style='/*!twlt*/@charset "UTF-8";.s-cart-coupons-card--applied{cursor:default}.s-cart-coupons-card--applied:hover{transform:none}.s-cart-coupons-card--applied .s-cart-coupons-top-section,.s-cart-coupons-card--applied .s-cart-coupons-bottom-section,.s-cart-coupons-card--applied .s-cart-coupons-divider{border-color:#d1d5db;border-color:color-mix(in srgb, var(--color-primary, #004d5a) 40%, transparent)}.s-cart-coupons-card--applied .s-cart-coupons-bottom-section{background:rgba(0, 0, 0, 0.04);background:color-mix(in srgb, var(--color-primary, #004d5a) 8%, transparent)}.s-cart-coupons-card--applied::before,.s-cart-coupons-card--applied::after{border-color:#d1d5db;border-color:color-mix(in srgb, var(--color-primary, #004d5a) 40%, transparent)}.s-cart-coupons-card--applied .s-cart-coupons-action{display:inline-flex;align-items:center;gap:10px}.s-cart-coupons-card--applied .s-cart-coupons-action{font-size:10px;font-weight:600;color:#4b5563}.s-cart-coupons-card-applied-label{color:#4b5563;color:var(--color-primary-dark, var(--color-primary, #4b5563))}.s-cart-coupons-card--applied .s-cart-coupons-action{min-width:0;max-width:100%}.s-cart-coupons-card-applied-label,.s-cart-coupons-card-remove{overflow:hidden;text-overflow:ellipsis}.s-cart-coupons-card--applied .s-cart-coupons-action,.s-cart-coupons-card--applied .s-cart-coupons-card-remove{pointer-events:auto}.s-cart-coupons-card-remove{flex:none;font-size:inherit;font-weight:inherit;color:#6b7280;background:transparent;border:0;padding:0;cursor:pointer;transition:color 0.15s ease}.s-cart-coupons-card-remove:hover{color:var(--color-danger, #ef4444)}.s-cart-coupons-card-remove:disabled{opacity:0.5;cursor:not-allowed}.s-cart-coupons-card--minimal .s-cart-coupons-bottom-section{justify-content:flex-end}.visible{visibility:visible}.fixed{position:fixed}.shrink{flex-shrink:1}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.form-input{height:2.5rem;width:100%;border-radius:0.375rem;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1));transition-property:color, background-color, border-color, text-decoration-color, fill, stroke;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:300ms}.form-input:focus{border-color:var(--color-primary);--tw-ring-color:transparent}.form-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))}.form-input:focus:is(.dark *){border-color:var(--color-primary)}@media (min-width: 640px){.form-input{font-size:0.875rem;line-height:1.25rem}}.s-cart-coupons-wrapper{display:block;width:100%;padding-top:1.25rem;padding-bottom:1.25rem}.s-cart-coupons-input-section{margin-bottom:0.625rem}.s-cart-coupons-coupon-label{margin-bottom:0.625rem;display:block;font-size:0.875rem;line-height:1.25rem;--tw-text-opacity:1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.s-cart-coupons-coupon-input-container{position:relative;display:flex;align-items:stretch}.s-cart-coupons-coupon-input-container .form-input{height:auto;flex:1 1 0%}.s-cart-coupons-coupon-input-container .form-input:where([dir="ltr"],[dir="ltr"] *){border-top-left-radius:0.5rem;border-bottom-left-radius:0.5rem;border-top-right-radius:0px !important;border-bottom-right-radius:0px !important;border-right-width:0px}.s-cart-coupons-coupon-input-container .form-input:where([dir="rtl"],[dir="rtl"] *){border-top-right-radius:0.5rem;border-bottom-right-radius:0.5rem;border-top-left-radius:0px !important;border-bottom-left-radius:0px !important;border-left-width:0px}.s-cart-coupons-coupon-input-container .form-input:focus{position:relative;z-index:10}.s-cart-coupons-coupon-button:where([dir="ltr"],[dir="ltr"] *){border-top-right-radius:0.5rem;border-bottom-right-radius:0.5rem;border-top-left-radius:0px;border-bottom-left-radius:0px}.s-cart-coupons-coupon-button:where([dir="rtl"],[dir="rtl"] *){border-top-left-radius:0.5rem;border-bottom-left-radius:0.5rem;border-top-right-radius:0px;border-bottom-right-radius:0px}.s-cart-coupons-coupon-button-remove:where([dir="ltr"],[dir="ltr"] *){border-top-right-radius:0.5rem;border-bottom-right-radius:0.5rem;border-top-left-radius:0px !important;border-bottom-left-radius:0px !important}.s-cart-coupons-coupon-button-remove:where([dir="rtl"],[dir="rtl"] *){border-top-left-radius:0.5rem;border-bottom-left-radius:0.5rem;border-top-right-radius:0px !important;border-bottom-right-radius:0px !important}.s-cart-coupons-coupon-button-apply:where([dir="ltr"],[dir="ltr"] *){border-top-right-radius:0.5rem !important;border-bottom-right-radius:0.5rem !important;border-top-left-radius:0px !important;border-bottom-left-radius:0px !important}.s-cart-coupons-coupon-button-apply:where([dir="rtl"],[dir="rtl"] *){border-top-left-radius:0.5rem !important;border-bottom-left-radius:0.5rem !important;border-top-right-radius:0px !important;border-bottom-right-radius:0px !important}.s-cart-coupons-coupon-error{margin-top:0.5rem;display:block;font-size:10px;line-height:1rem;--tw-text-opacity:1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.s-cart-coupons-slider{width:100%;overflow:hidden;padding-left:0.375rem;padding-right:0.375rem}.s-cart-coupons-card{position:relative;cursor:pointer;overflow:hidden;--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1));transition-property:all;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:300ms}.s-cart-coupons-card:is(.dark *){--tw-bg-opacity:1;background-color:rgb(31 41 55 / var(--tw-bg-opacity, 1))}.s-cart-coupons-card:hover{--tw-translate-y:-0.125rem;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.s-cart-coupons-disabled{cursor:not-allowed;opacity:0.5}.s-cart-coupons-disabled:hover{transform:none;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1));--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}.s-cart-coupons-top-section{display:flex;height:60px;flex-direction:row;align-items:center;justify-content:space-between;border-top-left-radius:0.75rem;border-top-right-radius:0.75rem;border-width:1px;border-bottom-width:0px;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1));padding-top:1rem;padding-bottom:1rem;padding-left:0.75rem;padding-right:0.75rem}.s-cart-coupons-discount-values{display:flex;flex-direction:column;align-items:flex-start}.s-cart-coupons-discount-values .s-cart-coupons-main-amount{display:flex;align-items:center;gap:0.25rem;white-space:nowrap;font-size:1.25rem;line-height:1.75rem;font-weight:900;line-height:1;--tw-text-opacity:1;color:rgb(0 0 0 / var(--tw-text-opacity, 1))}.s-cart-coupons-discount-values .s-cart-coupons-secondary-info{margin:0px;font-size:10px;line-height:1rem}.s-cart-coupons-code{font-size:10px;font-weight:700;--tw-text-opacity:1;color:rgb(17 24 39 / var(--tw-text-opacity, 1))}.s-cart-coupons-divider{position:relative;z-index:10;margin:0px;border-bottom-width:1px;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1))}.s-cart-coupons-bottom-section{display:flex;min-height:44px;flex-direction:row;align-items:center;justify-content:space-between;border-bottom-right-radius:0.75rem;border-bottom-left-radius:0.75rem;border-width:1px;border-top-width:0px;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1));--tw-bg-opacity:1;background-color:rgb(249 250 251 / var(--tw-bg-opacity, 1));padding-top:0.25rem;padding-bottom:0.25rem;padding-left:0.75rem;padding-right:0.75rem}.s-cart-coupons-terms{display:flex;flex-direction:column;align-items:flex-start}.s-cart-coupons-terms .s-cart-coupons-expiry{margin:0px;font-size:10px;line-height:16px;--tw-text-opacity:1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.s-cart-coupons-terms .s-cart-coupons-minimum{margin:0px;font-size:10px;line-height:16px;--tw-text-opacity:1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.s-cart-coupons-terms .s-cart-coupons-expiry.s-cart-coupons-expiry-warning{font-weight:500;--tw-text-opacity:1;color:rgb(220 38 38 / var(--tw-text-opacity, 1))}.s-cart-coupons-action{cursor:pointer;white-space:nowrap;border-width:0px;background-color:transparent;padding:0px;font-size:9px;font-weight:700;--tw-text-opacity:1;color:rgb(17 24 39 / var(--tw-text-opacity, 1));transition-property:color, background-color, border-color, text-decoration-color, fill, stroke;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms}.s-cart-coupons-action:hover{--tw-text-opacity:1;color:rgb(59 130 246 / var(--tw-text-opacity, 1))}.s-cart-coupons-slide-one-fourth{width:calc(75% - 10px);min-width:200px !important;padding-left:5px !important;padding-right:5px !important;padding-top:2px !important}@media (min-width: 1024px){.s-cart-coupons-slide-one-fourth{width:calc(40% - 10px) !important}}.s-cart-coupons-card:before{pointer-events:none;position:absolute;right:-10px;top:60px;z-index:20;height:1.25rem;width:1.25rem;--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));border-radius:9999px;border-width:1px;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1));--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1));--tw-content:\'\';content:var(--tw-content)}.s-cart-coupons-card:is(.dark *):before{--tw-bg-opacity:1;background-color:rgb(31 41 55 / var(--tw-bg-opacity, 1))}.s-cart-coupons-card:after{pointer-events:none;position:absolute;left:-10px;top:60px;z-index:20;height:1.25rem;width:1.25rem;--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));border-radius:9999px;border-width:1px;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1));--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1));--tw-content:\'\';content:var(--tw-content)}.s-cart-coupons-card:is(.dark *):after{--tw-bg-opacity:1;background-color:rgb(31 41 55 / var(--tw-bg-opacity, 1))}.s-cart-coupons-coupon-input-container .form-input.s-coupon-input-error{--tw-shadow:0 0 0 3px rgba(239,68,68,0.1) !important;--tw-shadow-colored:0 0 0 3px var(--tw-shadow-color) !important;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow) !important}';export{s as salla_cart_coupons}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as a,h as e,H as s,c,a as t}from"./p-
|
|
4
|
+
import{r as a,h as e,H as s,c,a as t}from"./p-BtdIfJF8.js";import{p as d,m as o}from"./p-DfeagqF1.js";const i=class{constructor(e){a(this,e)}render(){return e(s,{key:"cc83d228977d0e4049466fb8aa38b9709fbcf9e5",class:"s-accordion-body-wrapper"},e("slot",{key:"c8ca6d7d1512f8e32bbb7ef0785949d655ff3619"}))}};i.style="";const r=class{constructor(e){a(this,e),this.accordionToggle=c(this,"accordionToggle"),this.collapsible=!1,this.collapsed=!0}emitCollapsePanel(){this.accordionToggle.emit({payload:{collapsed:this.collapsed}})}toggleCollapse(){this.collapsible&&(this.collapsed=!this.collapsed,this.host.parentElement?.setAttribute("data-collapsed",this.collapsed.toString()),this.host.parentElement?.querySelector("salla-accordion-body")?.setAttribute("data-collapsed",this.collapsed.toString()),this.emitCollapsePanel())}render(){return e(s,{key:"066294cd654d22b5cbe483dc34932b8132dda4c4","data-collapsed":this.collapsed.toString(),onClick:()=>this.toggleCollapse(),class:"s-accordion-head-wrapper"},e("div",{key:"f235f06aa9bdb59d500148acf4477445bf2f1673",class:"s-accordion-head-wrapper-start"},e("slot",{key:"25797156b79f88ae61f53397b71b35a79ca62908",name:"title"}),e("slot",{key:"76a66a77b082b5fc18c3ac844a294e2fde113151",name:"progress"}),e("slot",{key:"d20c4aacfe72c0f15dd8034c43d2bb4e8e0921df",name:"html"})),(this.collapsible||this.host.querySelector('[slot="note"]'))&&e("div",{key:"1a6ae8bebe03ad6c02d69a3c3b3dab425dbec0ea",class:"s-accordion-head-wrapper-end"},e("slot",{key:"db284dd1fb40cd1520c225e0c7416b2ea71b8c33",name:"note"}),this.collapsible&&e("button",{key:"378c70a472ed11df058aa32e42ab94de68f214b9",type:"button",class:{"s-accordion-head-wrapper-toggle":!0,active:!this.collapsed},onClick:a=>{a.stopPropagation(),this.toggleCollapse()}},e("span",{key:"1b4a583b66ed1f332d01ebd15c0c77a231e4e197",class:"s-accordion-head-wrapper-toggle-icon",innerHTML:this.collapsed?d:o}))))}get host(){return t(this)}};r.style="";export{i as salla_accordion_body,r as salla_accordion_head}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as t,h as e,H as o,a}from"./p-AYwDRYpw.js";import{C as r}from"./p-gFG8By9O.js";import{I as s}from"./p-C-tzSDxw.js";const i=class{constructor(e){t(this,e),this.variant="info"}renderIcon(){const t=this.icon||this.variant;if("none"===t)return null;switch(t){case"success":return e("svg",{viewBox:"0 0 24 24",width:"20",height:"20",fill:"currentColor"},e("path",{d:"M9 16.2l-3.5-3.5L4 14.2l5 5 11-11-1.5-1.5z"}));case"warning":return e("svg",{viewBox:"0 0 24 24",width:"20",height:"20",fill:"currentColor"},e("path",{d:"M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z"}));case"error":return e("svg",{viewBox:"0 0 24 24",width:"20",height:"20",fill:"currentColor"},e("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 \n 10 10 10-4.48 10-10S17.52 2 12 2zm5 \n 13.59L15.59 17 12 13.41 8.41 17 \n 7 15.59 10.59 12 7 8.41 8.41 7 \n 12 10.59 15.59 7 17 8.41 13.41 \n 12 17 15.59z"}));default:return e("span",{innerHTML:'<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M9.99935 18.3332C5.39697 18.3332 1.66602 14.6022 1.66602 9.99984C1.66602 5.39746 5.39697 1.6665 9.99935 1.6665C14.6017 1.6665 18.3327 5.39746 18.3327 9.99984C18.3327 14.6022 14.6017 18.3332 9.99935 18.3332ZM9.99935 16.6665C13.6813 16.6665 16.666 13.6818 16.666 9.99984C16.666 6.31794 13.6813 3.33317 9.99935 3.33317C6.31745 3.33317 3.33268 6.31794 3.33268 9.99984C3.33268 13.6818 6.31745 16.6665 9.99935 16.6665ZM9.16602 5.83317H10.8327V7.49984H9.16602V5.83317ZM9.16602 9.1665H10.8327V14.1665H9.16602V9.1665Z" fill="#417AC8"/>\n</svg>\n'})}}render(){return e(o,{key:"053085e619a62bc641cf05e5fab4c3d601560d4b",class:`s-alert-wrapper s-alert-${this.variant}`},e("span",{key:"8c9b20d9382b0e9eaec53b769c98c73df01043b6",class:"s-alert-icon"},this.renderIcon()),e("span",{key:"0ab4176e253bfe191c4115c6d4bcdf815895e746",class:"s-alert-text"},this.message,e("slot",{key:"d4f428d1d47ddf977d0363c0476e7190ef680857"})))}};i.style="/*!twlt*/:host{display:block}.s-alert-wrapper{display:flex;align-items:center;justify-content:flex-end;border-radius:0.375rem;border-width:1px;border-color:transparent;padding-left:1rem;padding-right:1rem;padding-top:0.75rem;padding-bottom:0.75rem;font-size:0.75rem;line-height:1.5rem}.s-alert-info{--tw-border-opacity:1;border-color:rgb(191 219 254 / var(--tw-border-opacity, 1));--tw-bg-opacity:1;background-color:rgb(219 234 254 / var(--tw-bg-opacity, 1));--tw-text-opacity:1;color:rgb(29 78 216 / var(--tw-text-opacity, 1))}.s-alert-success{--tw-border-opacity:1;border-color:rgb(187 247 208 / var(--tw-border-opacity, 1));--tw-bg-opacity:1;background-color:rgb(220 252 231 / var(--tw-bg-opacity, 1));--tw-text-opacity:1;color:rgb(21 128 61 / var(--tw-text-opacity, 1))}.s-alert-warning{--tw-border-opacity:1;border-color:rgb(253 230 138 / var(--tw-border-opacity, 1));--tw-bg-opacity:1;background-color:rgb(254 243 199 / var(--tw-bg-opacity, 1));--tw-text-opacity:1;color:rgb(180 83 9 / var(--tw-text-opacity, 1))}.s-alert-error{--tw-border-opacity:1;border-color:rgb(254 202 202 / var(--tw-border-opacity, 1));--tw-bg-opacity:1;background-color:rgb(254 226 226 / var(--tw-bg-opacity, 1));--tw-text-opacity:1;color:rgb(185 28 28 / var(--tw-text-opacity, 1))}.s-alert-icon{margin-left:0.5rem;display:flex;align-items:center}.s-alert-text{flex:1 1 0%;text-align:start}";const l=class{constructor(e){t(this,e),this.storeId=salla.config.get("store.id"),this.template=salla.config.get("store.template"),this.loading=!1,this.templateData={},this.defaultMessage=salla.lang.getWithDefault("common.elements.store_is_available_for_purchase","هذا المتجر تطويري ومتاح للشراء من"),this.defaultActionLabel=salla.lang.get("common.elements.know_more"),this.storeFeatures=salla.lang.get("common.elements.store_features"),this.storeDetails=salla.lang.get("common.elements.store_details"),this.storePrice=salla.lang.getWithDefault("common.elements.store_price","سعر المتجر"),this.storePriceDetails=salla.lang.getWithDefault("common.elements.store_price_details","السعر يشمل"),this.theDeveloper=salla.lang.get("common.elements.the_developer"),this.templateInformation=salla.lang.get("common.elements.template_information"),this.buyTheTemplate=salla.lang.get("common.elements.buy_the_template"),this.isRtl=salla.config.get("theme.is_rtl",!0),this.storeName=salla.config.get("store.name"),this.salla=salla.lang.getWithDefault("common.elements.salla","سلة"),this.readyStores=salla.lang.getWithDefault("common.elements.ready_stores","المتاجر الجاهزة"),this.moreDetailsLabel=salla.lang.getWithDefault("common.elements.more_details","تفاصيل أكثر"),this.type="popup",salla.lang.onLoaded((()=>{this.defaultMessage=salla.lang.get("common.elements.experimental_and_available_store"),this.defaultActionLabel=salla.lang.get("common.elements.know_more"),this.storeFeatures=salla.lang.get("common.elements.store_features"),this.storeDetails=salla.lang.get("common.elements.store_details"),this.templateInformation=salla.lang.get("common.elements.template_information"),this.buyTheTemplate=salla.lang.get("common.elements.buy_the_template");const t=salla.lang.messages?.["ar.trans"],e=salla.lang.messages?.["en.trans"];t&&e&&(salla.helpers.setNested(t,"common.elements.more_details","تفاصيل أكثر"),salla.helpers.setNested(e,"common.elements.more_details","More Details"),salla.helpers.setNested(t,"common.elements.store_price","سعر المتجر"),salla.helpers.setNested(e,"common.elements.store_price","Store Price"),salla.helpers.setNested(t,"common.elements.the_developer","المطور"),salla.helpers.setNested(e,"common.elements.the_developer","the developer"),salla.helpers.setNested(t,"common.elements.store_price_details","السعر يشمل"),salla.helpers.setNested(e,"common.elements.store_price_details","Price Includes"),salla.helpers.setNested(t,"common.elements.salla","سلة"),salla.helpers.setNested(e,"common.elements.salla","Salla"),salla.helpers.setNested(t,"common.elements.store_is_available_for_purchase","هذا المتجر تطويري ومتاح للشراء من"),salla.helpers.setNested(e,"common.elements.store_is_available_for_purchase","This ready store is available for purchase from"),salla.helpers.setNested(t,"common.elements.ready_stores","المتاجر الجاهزة"),salla.helpers.setNested(e,"common.elements.ready_stores","Ready Stores"),setTimeout((()=>{this.storePrice=salla.lang.get("common.elements.store_price"),this.theDeveloper=salla.lang.get("common.elements.the_developer"),this.storePriceDetails=salla.lang.getWithDefault("common.elements.store_price_details","السعر يشمل"),this.salla=salla.lang.getWithDefault("common.elements.salla","سلة"),this.defaultMessage=salla.lang.getWithDefault("common.elements.store_is_available_for_purchase","هذا المتجر تطويري ومتاح للشراء من"),this.readyStores=salla.lang.getWithDefault("common.elements.ready_stores","المتاجر الجاهزة"),this.moreDetailsLabel=salla.lang.getWithDefault("common.elements.more_details","More Details")}),100))}))}componentDidLoad(){this.template&&"object"==typeof this.template&&Object.keys(this.template).length>0&&this.fetchTemplateData()}open(){return this.drawer.open()}fetchTemplateData(){if(!Object.keys(this.templateData).length)return this.loading=!0,salla.api.request("/store/template",{},"get",{"Store-Identifier":this.storeId}).then((t=>{this.templateData=t.data,this.loading=!1})).catch((()=>{this.loading=!1}))}handleAction(){"link"===this.type&&(window.location.href=this.actionUrl),"popup"===this.type&&this.open()}popup(){return e("salla-drawer",{class:"s-bottom-alert-modal",ref:t=>this.drawer=t,"no-padding":!0,onLoad:()=>{this.drawer&&Object.keys(this.templateData).length&&this.drawer.setTitle(this.storeDetails+" "+this.storeName)}},Object.keys(this.templateData).length?[e("div",{class:"s-bottom-alert-modal-inner s-scrollbar"},e("div",{class:{"s-bottom-alert-modal-content":!0}},this.templateData?.features?[e("div",{class:"s-bottom-alert-modal-content-title"},e("i",{innerHTML:s,class:"s-bottom-alert-modal-content-icon"}),e("span",null,this.storeFeatures)),e("div",{class:"s-bottom-alert-modal-content-features",innerHTML:this.templateData?.features})]:""),e("div",{class:{"s-bottom-alert-modal-content":!0,"s-bottom-alert-modal-content-extra-padding":this.templateData?.price}},this.templateData?.features?[e("div",{class:"s-bottom-alert-modal-content-title"},e("i",{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>money-card</title>\n<path d="M17.333 14.667h-2.667c-0.736 0-1.333-0.599-1.333-1.333s0.597-1.333 1.333-1.333h4c0.737 0 1.333-0.597 1.333-1.333s-0.596-1.333-1.333-1.333h-1.333v-1.333c0-0.736-0.596-1.333-1.333-1.333s-1.333 0.597-1.333 1.333v1.333c-2.205 0-4 1.795-4 4s1.795 4 4 4h2.667c0.736 0 1.333 0.597 1.333 1.333s-0.597 1.333-1.333 1.333h-4c-0.737 0-1.333 0.596-1.333 1.333s0.596 1.333 1.333 1.333h1.333v1.333c0 0.737 0.596 1.333 1.333 1.333s1.333-0.596 1.333-1.333v-1.333c2.205 0 4-1.795 4-4s-1.795-4-4-4zM28 2.667h-24c-2.205 0-4 1.795-4 4v18.667c0 2.205 1.795 4 4 4h24c2.205 0 4-1.795 4-4v-18.667c0-2.205-1.795-4-4-4zM29.333 25.333c0 0.736-0.597 1.333-1.333 1.333h-24c-0.736 0-1.333-0.597-1.333-1.333v-18.667c0-0.735 0.597-1.333 1.333-1.333h24c0.736 0 1.333 0.599 1.333 1.333z"></path>\n</svg>\n',class:"s-bottom-alert-modal-content-icon"}),e("span",null,this.storePriceDetails)),e("div",{class:"s-bottom-alert-modal-content-price-details"},this.templateData?.price_details?.items.map((t=>e("div",{class:"s-bottom-alert-modal-content-price-details-item"},e("i",{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>check-circle</title>\n<path d="M19.557 11.26l-4.593 6.891-2.891-1.927c-0.616-0.411-1.441-0.243-1.849 0.369-0.409 0.612-0.244 1.441 0.369 1.849l4 2.667c0.228 0.152 0.485 0.224 0.739 0.224 0.431 0 0.855-0.208 1.111-0.593l5.333-8c0.409-0.612 0.244-1.441-0.369-1.849-0.616-0.411-1.443-0.243-1.849 0.369zM16 0c-8.823 0-16 7.177-16 16s7.177 16 16 16 16-7.177 16-16-7.177-16-16-16zM16 29.333c-7.352 0-13.333-5.981-13.333-13.333s5.981-13.333 13.333-13.333 13.333 5.981 13.333 13.333-5.981 13.333-13.333 13.333z"></path>\n</svg>\n',class:"s-bottom-alert-modal-content-price-details-item-icon"}),e("span",{class:"s-bottom-alert-modal-content-price-details-item-name"},t.name),e("span",{class:"s-bottom-alert-modal-content-price-details-item-price",innerHTML:salla.money(t.price)})))))]:""),this.templateData?.link?e("div",{class:"s-bottom-alert-modal-content-footer"},e("salla-button",{color:"primary",size:"medium",width:"wide",href:this.templateData?.link},e("i",{innerHTML:r}),this.buyTheTemplate)):"")]:"")}render(){const t=this.template&&"object"==typeof this.template&&Object.keys(this.template).length>0;return e(o,{key:"00d1b1e0b98318096f366dfa13c43df13d95df1c",class:"s-bottom-alert-wrapper "+(t?"s-bottom-alert-wrapper-with-template":"")},t&&e("div",{key:"01079527fba6e46eb5e893e64b68e66f35f12c2f",class:"s-bottom-alert-logo-section"},e("img",{key:"49fd2f67e97ded7ff6240573b825dcea349e47f8",src:"https://cdn.salla.network/images/logo/logo-light.svg",alt:"Salla",class:"s-bottom-alert-logo"}),e("span",{key:"998216dbcfb5381c94ef3b94ddfa2334ccfd24ac",class:"s-bottom-alert-logo-text"},this.readyStores)),e("div",{key:"68bd744c9b41847ca757f1127610c84e3eededf6",class:"s-bottom-alert-content"},e("div",{key:"2dd6195b822a6e076fffddc8fb851292f97e8074",class:"flex items-center gap-2"},e("div",{key:"67ea932ac092fa207b1888f7641d8733c5109f01",class:"s-bottom-alert-icon"},e("i",this.icon?{class:this.icon}:{innerHTML:'\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>info</title>\n<path d="M16 13.333c-0.737 0-1.333 0.596-1.333 1.333v9.333c0 0.737 0.596 1.333 1.333 1.333s1.333-0.596 1.333-1.333v-9.333c0-0.737-0.596-1.333-1.333-1.333zM16 7.987c-0.737 0-1.333 0.596-1.333 1.333v0.013c0 0.737 0.596 1.327 1.333 1.327s1.333-0.603 1.333-1.34-0.596-1.333-1.333-1.333zM16 0c-8.823 0-16 7.177-16 16s7.177 16 16 16 16-7.177 16-16-7.177-16-16-16zM16 29.333c-7.352 0-13.333-5.981-13.333-13.333s5.981-13.333 13.333-13.333 13.333 5.981 13.333 13.333-5.981 13.333-13.333 13.333z"></path>\n</svg>\n'})),e("div",{key:"5ea417ca4e00f9a3e19902d84192a9f788c1e75b",class:"s-bottom-alert-message"},this.message?this.message:t?e("span",{class:"flex flex-wrap items-center gap-1"},this.defaultMessage,e("span",{class:{"s-bottom-alert-message-highlight":!0},"aria-label":"Developer"},this.salla),e("span",{innerHTML:salla.money(this.template.price)})):this.defaultMessage)),"banner"!==this.type&&e("div",{key:"06f2d2949b3a5864151eb96378fc8f82373397a7",class:t?"s-bottom-alert-actions-group":"s-bottom-alert-action"},t?this.loading?e("salla-loading",{size:"20"}):e("div",{class:"s-bottom-alert-actions-group-container"},e("a",{class:"s-bottom-alert-action-link",onClick:()=>this.handleAction()},this.actionLabel||this.moreDetailsLabel),this.templateData?.link?e("button",{type:"button",class:"s-bottom-alert-action-purchase-button",onClick:()=>window.open(this.templateData?.link,"_blank")},this.buyTheTemplate):null):e("salla-button",{href:this.actionUrl,size:"medium",onClick:()=>this.handleAction(),width:"normal"},this.actionLabel||this.defaultActionLabel)),"popup"===this.type&&this.popup()))}get host(){return a(this)}};l.style="/*!twlt*/:host{display:block}.flex{display:flex}.flex-wrap{flex-wrap:wrap}.items-center{align-items:center}.gap-1{gap:0.25rem}.gap-2{gap:0.5rem}.s-scrollbar::-webkit-scrollbar{width:5px}.s-scrollbar::-webkit-scrollbar-track{background-color:#eee}.s-scrollbar::-webkit-scrollbar-thumb{background-color:var(--color-primary);border-radius:10px;-webkit-border-radius:10px;-moz-border-radius:10px;-ms-border-radius:10px;-o-border-radius:10px}.s-bottom-alert-wrapper{position:fixed;bottom:0px;z-index:50;display:flex;min-height:4rem;width:100%;flex-direction:column;align-items:center;justify-content:center;background-color:var(--color-primary);padding-left:0.625rem;padding-right:0.625rem;padding-top:0.625rem;padding-bottom:0.625rem}@media (min-width: 768px){.s-bottom-alert-wrapper{padding-left:2.5rem;padding-right:2.5rem}}.s-bottom-alert-wrapper-with-template{flex-direction:column;align-items:center;justify-content:space-between;--tw-bg-opacity:1;background-color:rgb(0 73 86 / var(--tw-bg-opacity, 1));font-family:PingARLT,system-ui;--tw-text-opacity:1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}@media (min-width: 768px){.s-bottom-alert-wrapper-with-template{flex-direction:row}}.s-bottom-alert-logo-section{display:flex;align-items:center;gap:0.5rem;padding-left:1rem;padding-right:1rem;padding-top:0.5rem;padding-bottom:0.5rem}.s-bottom-alert-logo{height:auto;width:3rem}.s-bottom-alert-logo-text{font-size:1.25rem;line-height:1.75rem;font-weight:700;--tw-text-opacity:1;color:rgb(186 243 230 / var(--tw-text-opacity, 1))}.s-bottom-alert-icon svg{height:1rem;width:1rem;fill:#fff}.s-bottom-alert-message{font-size:0.875rem;line-height:1.25rem;font-weight:700;--tw-text-opacity:1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.s-bottom-alert-message-highlight{cursor:default;font-size:1rem;line-height:1.5rem;font-weight:700}.s-bottom-alert-message-splitter{margin-left:0.5rem;margin-right:0.5rem}.s-bottom-alert-message-link{cursor:pointer;text-decoration-line:underline}.s-bottom-alert-content{display:flex;height:100%;flex-direction:column;align-items:center;justify-content:center;gap:1rem}@media (min-width: 768px){.s-bottom-alert-content{flex-direction:row}}.s-bottom-alert-action button{background-color:var(--color-primary-reverse);font-size:0.875rem;line-height:1.25rem;color:var(--color-primary)}.s-bottom-alert-actions-group{display:flex;align-items:center;gap:1rem}.s-bottom-alert-action-link{cursor:pointer;font-size:0.875rem;line-height:1.25rem;font-weight:700;--tw-text-opacity:1;color:rgb(186 243 230 / var(--tw-text-opacity, 1));text-decoration-line:underline;transition-property:opacity;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms}.s-bottom-alert-action-link:hover{opacity:0.8}.s-bottom-alert-action-purchase-button{border-radius:0.375rem;--tw-bg-opacity:1;background-color:rgb(186 243 230 / var(--tw-bg-opacity, 1));padding-left:1rem;padding-right:1rem;padding-top:0.5rem;padding-bottom:0.5rem;--tw-text-opacity:1;color:rgb(0 73 86 / var(--tw-text-opacity, 1))}.s-bottom-alert-actions-group-container{display:flex;align-items:center;gap:1rem}.s-bottom-alert-modal .s-modal-body{padding-top:1rem;padding-bottom:1rem}.s-bottom-alert-modal-cover img{height:300px;width:100%;object-fit:cover}.s-bottom-alert-modal-inner{max-height:80vh;overflow-y:auto;overflow-x:hidden;padding-left:1rem;padding-right:1rem}.s-bottom-alert-modal-content-title{margin-top:1rem;margin-bottom:1rem;display:flex;align-items:center;gap:0.5rem;font-size:1.125rem;line-height:1.75rem;font-weight:700;color:var(--color-primary-dark)}.s-bottom-alert-modal-content-icon svg{height:1.25rem;width:1.25rem;fill:var(--color-primary-dark)}.s-bottom-alert-modal-content-extra-padding{padding-bottom:100px}.s-bottom-alert-modal-content hr{margin-top:1rem}.s-bottom-alert-modal-content-screenshots{margin-top:1rem;margin-bottom:1rem}.s-bottom-alert-modal-content-screenshot.swiper-slide{height:200px !important;width:370px !important}.s-bottom-alert-modal-content-screenshot img{height:100%;width:100%;object-fit:cover}.s-bottom-alert-modal-content-footer button .s-button-text{display:flex;align-items:center;gap:0.5rem}.s-bottom-alert-modal-content-footer{position:fixed;left:0px;right:0px;bottom:0px;z-index:2;width:100%;--tw-bg-opacity:1;background-color:rgb(252 252 252 / var(--tw-bg-opacity, 1));padding:0.625rem}.s-bottom-alert-modal-content-price-details{display:flex;flex-direction:column;gap:0.5rem}.s-bottom-alert-modal-content-price-details-item{display:flex;align-items:center;gap:0.375rem}.s-bottom-alert-modal-content-price-details-item-icon svg{height:1rem;width:1rem;fill:var(--color-primary-dark)}.s-bottom-alert-modal-content-price-details-item-name{--tw-text-opacity:1;color:rgb(68 68 68 / var(--tw-text-opacity, 1))}.s-bottom-alert-modal-content-price-details-item-price{font-weight:500;--tw-text-opacity:1;color:rgb(102 102 102 / var(--tw-text-opacity, 1))}.s-bottom-alert-modal-price-wrapper{margin-bottom:0.625rem;display:flex;align-items:center;justify-content:space-between;font-size:1rem;line-height:1.5rem}.s-bottom-alert-modal-price-wrapper-amount{font-size:1.125rem;line-height:1.75rem;font-weight:700}";export{i as salla_alert,l as salla_bottom_alert}
|
|
4
|
+
import{r as t,h as e,H as o,a}from"./p-BtdIfJF8.js";import{C as r}from"./p-gFG8By9O.js";import{I as s}from"./p-C-tzSDxw.js";const i=class{constructor(e){t(this,e),this.variant="info"}renderIcon(){const t=this.icon||this.variant;if("none"===t)return null;switch(t){case"success":return e("svg",{viewBox:"0 0 24 24",width:"20",height:"20",fill:"currentColor"},e("path",{d:"M9 16.2l-3.5-3.5L4 14.2l5 5 11-11-1.5-1.5z"}));case"warning":return e("svg",{viewBox:"0 0 24 24",width:"20",height:"20",fill:"currentColor"},e("path",{d:"M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z"}));case"error":return e("svg",{viewBox:"0 0 24 24",width:"20",height:"20",fill:"currentColor"},e("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 \n 10 10 10-4.48 10-10S17.52 2 12 2zm5 \n 13.59L15.59 17 12 13.41 8.41 17 \n 7 15.59 10.59 12 7 8.41 8.41 7 \n 12 10.59 15.59 7 17 8.41 13.41 \n 12 17 15.59z"}));default:return e("span",{innerHTML:'<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M9.99935 18.3332C5.39697 18.3332 1.66602 14.6022 1.66602 9.99984C1.66602 5.39746 5.39697 1.6665 9.99935 1.6665C14.6017 1.6665 18.3327 5.39746 18.3327 9.99984C18.3327 14.6022 14.6017 18.3332 9.99935 18.3332ZM9.99935 16.6665C13.6813 16.6665 16.666 13.6818 16.666 9.99984C16.666 6.31794 13.6813 3.33317 9.99935 3.33317C6.31745 3.33317 3.33268 6.31794 3.33268 9.99984C3.33268 13.6818 6.31745 16.6665 9.99935 16.6665ZM9.16602 5.83317H10.8327V7.49984H9.16602V5.83317ZM9.16602 9.1665H10.8327V14.1665H9.16602V9.1665Z" fill="#417AC8"/>\n</svg>\n'})}}render(){return e(o,{key:"053085e619a62bc641cf05e5fab4c3d601560d4b",class:`s-alert-wrapper s-alert-${this.variant}`},e("span",{key:"8c9b20d9382b0e9eaec53b769c98c73df01043b6",class:"s-alert-icon"},this.renderIcon()),e("span",{key:"0ab4176e253bfe191c4115c6d4bcdf815895e746",class:"s-alert-text"},this.message,e("slot",{key:"d4f428d1d47ddf977d0363c0476e7190ef680857"})))}};i.style="/*!twlt*/:host{display:block}.s-alert-wrapper{display:flex;align-items:center;justify-content:flex-end;border-radius:0.375rem;border-width:1px;border-color:transparent;padding-left:1rem;padding-right:1rem;padding-top:0.75rem;padding-bottom:0.75rem;font-size:0.75rem;line-height:1.5rem}.s-alert-info{--tw-border-opacity:1;border-color:rgb(191 219 254 / var(--tw-border-opacity, 1));--tw-bg-opacity:1;background-color:rgb(219 234 254 / var(--tw-bg-opacity, 1));--tw-text-opacity:1;color:rgb(29 78 216 / var(--tw-text-opacity, 1))}.s-alert-success{--tw-border-opacity:1;border-color:rgb(187 247 208 / var(--tw-border-opacity, 1));--tw-bg-opacity:1;background-color:rgb(220 252 231 / var(--tw-bg-opacity, 1));--tw-text-opacity:1;color:rgb(21 128 61 / var(--tw-text-opacity, 1))}.s-alert-warning{--tw-border-opacity:1;border-color:rgb(253 230 138 / var(--tw-border-opacity, 1));--tw-bg-opacity:1;background-color:rgb(254 243 199 / var(--tw-bg-opacity, 1));--tw-text-opacity:1;color:rgb(180 83 9 / var(--tw-text-opacity, 1))}.s-alert-error{--tw-border-opacity:1;border-color:rgb(254 202 202 / var(--tw-border-opacity, 1));--tw-bg-opacity:1;background-color:rgb(254 226 226 / var(--tw-bg-opacity, 1));--tw-text-opacity:1;color:rgb(185 28 28 / var(--tw-text-opacity, 1))}.s-alert-icon{margin-left:0.5rem;display:flex;align-items:center}.s-alert-text{flex:1 1 0%;text-align:start}";const l=class{constructor(e){t(this,e),this.storeId=salla.config.get("store.id"),this.template=salla.config.get("store.template"),this.loading=!1,this.templateData={},this.defaultMessage=salla.lang.getWithDefault("common.elements.store_is_available_for_purchase","هذا المتجر تطويري ومتاح للشراء من"),this.defaultActionLabel=salla.lang.get("common.elements.know_more"),this.storeFeatures=salla.lang.get("common.elements.store_features"),this.storeDetails=salla.lang.get("common.elements.store_details"),this.storePrice=salla.lang.getWithDefault("common.elements.store_price","سعر المتجر"),this.storePriceDetails=salla.lang.getWithDefault("common.elements.store_price_details","السعر يشمل"),this.theDeveloper=salla.lang.get("common.elements.the_developer"),this.templateInformation=salla.lang.get("common.elements.template_information"),this.buyTheTemplate=salla.lang.get("common.elements.buy_the_template"),this.isRtl=salla.config.get("theme.is_rtl",!0),this.storeName=salla.config.get("store.name"),this.salla=salla.lang.getWithDefault("common.elements.salla","سلة"),this.readyStores=salla.lang.getWithDefault("common.elements.ready_stores","المتاجر الجاهزة"),this.moreDetailsLabel=salla.lang.getWithDefault("common.elements.more_details","تفاصيل أكثر"),this.type="popup",salla.lang.onLoaded((()=>{this.defaultMessage=salla.lang.get("common.elements.experimental_and_available_store"),this.defaultActionLabel=salla.lang.get("common.elements.know_more"),this.storeFeatures=salla.lang.get("common.elements.store_features"),this.storeDetails=salla.lang.get("common.elements.store_details"),this.templateInformation=salla.lang.get("common.elements.template_information"),this.buyTheTemplate=salla.lang.get("common.elements.buy_the_template");const t=salla.lang.messages?.["ar.trans"],e=salla.lang.messages?.["en.trans"];t&&e&&(salla.helpers.setNested(t,"common.elements.more_details","تفاصيل أكثر"),salla.helpers.setNested(e,"common.elements.more_details","More Details"),salla.helpers.setNested(t,"common.elements.store_price","سعر المتجر"),salla.helpers.setNested(e,"common.elements.store_price","Store Price"),salla.helpers.setNested(t,"common.elements.the_developer","المطور"),salla.helpers.setNested(e,"common.elements.the_developer","the developer"),salla.helpers.setNested(t,"common.elements.store_price_details","السعر يشمل"),salla.helpers.setNested(e,"common.elements.store_price_details","Price Includes"),salla.helpers.setNested(t,"common.elements.salla","سلة"),salla.helpers.setNested(e,"common.elements.salla","Salla"),salla.helpers.setNested(t,"common.elements.store_is_available_for_purchase","هذا المتجر تطويري ومتاح للشراء من"),salla.helpers.setNested(e,"common.elements.store_is_available_for_purchase","This ready store is available for purchase from"),salla.helpers.setNested(t,"common.elements.ready_stores","المتاجر الجاهزة"),salla.helpers.setNested(e,"common.elements.ready_stores","Ready Stores"),setTimeout((()=>{this.storePrice=salla.lang.get("common.elements.store_price"),this.theDeveloper=salla.lang.get("common.elements.the_developer"),this.storePriceDetails=salla.lang.getWithDefault("common.elements.store_price_details","السعر يشمل"),this.salla=salla.lang.getWithDefault("common.elements.salla","سلة"),this.defaultMessage=salla.lang.getWithDefault("common.elements.store_is_available_for_purchase","هذا المتجر تطويري ومتاح للشراء من"),this.readyStores=salla.lang.getWithDefault("common.elements.ready_stores","المتاجر الجاهزة"),this.moreDetailsLabel=salla.lang.getWithDefault("common.elements.more_details","More Details")}),100))}))}componentDidLoad(){this.template&&"object"==typeof this.template&&Object.keys(this.template).length>0&&this.fetchTemplateData()}open(){return this.drawer.open()}fetchTemplateData(){if(!Object.keys(this.templateData).length)return this.loading=!0,salla.api.request("/store/template",{},"get",{"Store-Identifier":this.storeId}).then((t=>{this.templateData=t.data,this.loading=!1})).catch((()=>{this.loading=!1}))}handleAction(){"link"===this.type&&(window.location.href=this.actionUrl),"popup"===this.type&&this.open()}popup(){return e("salla-drawer",{class:"s-bottom-alert-modal",ref:t=>this.drawer=t,"no-padding":!0,onLoad:()=>{this.drawer&&Object.keys(this.templateData).length&&this.drawer.setTitle(this.storeDetails+" "+this.storeName)}},Object.keys(this.templateData).length?[e("div",{class:"s-bottom-alert-modal-inner s-scrollbar"},e("div",{class:{"s-bottom-alert-modal-content":!0}},this.templateData?.features?[e("div",{class:"s-bottom-alert-modal-content-title"},e("i",{innerHTML:s,class:"s-bottom-alert-modal-content-icon"}),e("span",null,this.storeFeatures)),e("div",{class:"s-bottom-alert-modal-content-features",innerHTML:this.templateData?.features})]:""),e("div",{class:{"s-bottom-alert-modal-content":!0,"s-bottom-alert-modal-content-extra-padding":this.templateData?.price}},this.templateData?.features?[e("div",{class:"s-bottom-alert-modal-content-title"},e("i",{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>money-card</title>\n<path d="M17.333 14.667h-2.667c-0.736 0-1.333-0.599-1.333-1.333s0.597-1.333 1.333-1.333h4c0.737 0 1.333-0.597 1.333-1.333s-0.596-1.333-1.333-1.333h-1.333v-1.333c0-0.736-0.596-1.333-1.333-1.333s-1.333 0.597-1.333 1.333v1.333c-2.205 0-4 1.795-4 4s1.795 4 4 4h2.667c0.736 0 1.333 0.597 1.333 1.333s-0.597 1.333-1.333 1.333h-4c-0.737 0-1.333 0.596-1.333 1.333s0.596 1.333 1.333 1.333h1.333v1.333c0 0.737 0.596 1.333 1.333 1.333s1.333-0.596 1.333-1.333v-1.333c2.205 0 4-1.795 4-4s-1.795-4-4-4zM28 2.667h-24c-2.205 0-4 1.795-4 4v18.667c0 2.205 1.795 4 4 4h24c2.205 0 4-1.795 4-4v-18.667c0-2.205-1.795-4-4-4zM29.333 25.333c0 0.736-0.597 1.333-1.333 1.333h-24c-0.736 0-1.333-0.597-1.333-1.333v-18.667c0-0.735 0.597-1.333 1.333-1.333h24c0.736 0 1.333 0.599 1.333 1.333z"></path>\n</svg>\n',class:"s-bottom-alert-modal-content-icon"}),e("span",null,this.storePriceDetails)),e("div",{class:"s-bottom-alert-modal-content-price-details"},this.templateData?.price_details?.items.map((t=>e("div",{class:"s-bottom-alert-modal-content-price-details-item"},e("i",{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>check-circle</title>\n<path d="M19.557 11.26l-4.593 6.891-2.891-1.927c-0.616-0.411-1.441-0.243-1.849 0.369-0.409 0.612-0.244 1.441 0.369 1.849l4 2.667c0.228 0.152 0.485 0.224 0.739 0.224 0.431 0 0.855-0.208 1.111-0.593l5.333-8c0.409-0.612 0.244-1.441-0.369-1.849-0.616-0.411-1.443-0.243-1.849 0.369zM16 0c-8.823 0-16 7.177-16 16s7.177 16 16 16 16-7.177 16-16-7.177-16-16-16zM16 29.333c-7.352 0-13.333-5.981-13.333-13.333s5.981-13.333 13.333-13.333 13.333 5.981 13.333 13.333-5.981 13.333-13.333 13.333z"></path>\n</svg>\n',class:"s-bottom-alert-modal-content-price-details-item-icon"}),e("span",{class:"s-bottom-alert-modal-content-price-details-item-name"},t.name),e("span",{class:"s-bottom-alert-modal-content-price-details-item-price",innerHTML:salla.money(t.price)})))))]:""),this.templateData?.link?e("div",{class:"s-bottom-alert-modal-content-footer"},e("salla-button",{color:"primary",size:"medium",width:"wide",href:this.templateData?.link},e("i",{innerHTML:r}),this.buyTheTemplate)):"")]:"")}render(){const t=this.template&&"object"==typeof this.template&&Object.keys(this.template).length>0;return e(o,{key:"00d1b1e0b98318096f366dfa13c43df13d95df1c",class:"s-bottom-alert-wrapper "+(t?"s-bottom-alert-wrapper-with-template":"")},t&&e("div",{key:"01079527fba6e46eb5e893e64b68e66f35f12c2f",class:"s-bottom-alert-logo-section"},e("img",{key:"49fd2f67e97ded7ff6240573b825dcea349e47f8",src:"https://cdn.salla.network/images/logo/logo-light.svg",alt:"Salla",class:"s-bottom-alert-logo"}),e("span",{key:"998216dbcfb5381c94ef3b94ddfa2334ccfd24ac",class:"s-bottom-alert-logo-text"},this.readyStores)),e("div",{key:"68bd744c9b41847ca757f1127610c84e3eededf6",class:"s-bottom-alert-content"},e("div",{key:"2dd6195b822a6e076fffddc8fb851292f97e8074",class:"flex items-center gap-2"},e("div",{key:"67ea932ac092fa207b1888f7641d8733c5109f01",class:"s-bottom-alert-icon"},e("i",this.icon?{class:this.icon}:{innerHTML:'\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>info</title>\n<path d="M16 13.333c-0.737 0-1.333 0.596-1.333 1.333v9.333c0 0.737 0.596 1.333 1.333 1.333s1.333-0.596 1.333-1.333v-9.333c0-0.737-0.596-1.333-1.333-1.333zM16 7.987c-0.737 0-1.333 0.596-1.333 1.333v0.013c0 0.737 0.596 1.327 1.333 1.327s1.333-0.603 1.333-1.34-0.596-1.333-1.333-1.333zM16 0c-8.823 0-16 7.177-16 16s7.177 16 16 16 16-7.177 16-16-7.177-16-16-16zM16 29.333c-7.352 0-13.333-5.981-13.333-13.333s5.981-13.333 13.333-13.333 13.333 5.981 13.333 13.333-5.981 13.333-13.333 13.333z"></path>\n</svg>\n'})),e("div",{key:"5ea417ca4e00f9a3e19902d84192a9f788c1e75b",class:"s-bottom-alert-message"},this.message?this.message:t?e("span",{class:"flex flex-wrap items-center gap-1"},this.defaultMessage,e("span",{class:{"s-bottom-alert-message-highlight":!0},"aria-label":"Developer"},this.salla),e("span",{innerHTML:salla.money(this.template.price)})):this.defaultMessage)),"banner"!==this.type&&e("div",{key:"06f2d2949b3a5864151eb96378fc8f82373397a7",class:t?"s-bottom-alert-actions-group":"s-bottom-alert-action"},t?this.loading?e("salla-loading",{size:"20"}):e("div",{class:"s-bottom-alert-actions-group-container"},e("a",{class:"s-bottom-alert-action-link",onClick:()=>this.handleAction()},this.actionLabel||this.moreDetailsLabel),this.templateData?.link?e("button",{type:"button",class:"s-bottom-alert-action-purchase-button",onClick:()=>window.open(this.templateData?.link,"_blank")},this.buyTheTemplate):null):e("salla-button",{href:this.actionUrl,size:"medium",onClick:()=>this.handleAction(),width:"normal"},this.actionLabel||this.defaultActionLabel)),"popup"===this.type&&this.popup()))}get host(){return a(this)}};l.style="/*!twlt*/:host{display:block}.flex{display:flex}.flex-wrap{flex-wrap:wrap}.items-center{align-items:center}.gap-1{gap:0.25rem}.gap-2{gap:0.5rem}.s-scrollbar::-webkit-scrollbar{width:5px}.s-scrollbar::-webkit-scrollbar-track{background-color:#eee}.s-scrollbar::-webkit-scrollbar-thumb{background-color:var(--color-primary);border-radius:10px;-webkit-border-radius:10px;-moz-border-radius:10px;-ms-border-radius:10px;-o-border-radius:10px}.s-bottom-alert-wrapper{position:fixed;bottom:0px;z-index:50;display:flex;min-height:4rem;width:100%;flex-direction:column;align-items:center;justify-content:center;background-color:var(--color-primary);padding-left:0.625rem;padding-right:0.625rem;padding-top:0.625rem;padding-bottom:0.625rem}@media (min-width: 768px){.s-bottom-alert-wrapper{padding-left:2.5rem;padding-right:2.5rem}}.s-bottom-alert-wrapper-with-template{flex-direction:column;align-items:center;justify-content:space-between;--tw-bg-opacity:1;background-color:rgb(0 73 86 / var(--tw-bg-opacity, 1));font-family:PingARLT,system-ui;--tw-text-opacity:1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}@media (min-width: 768px){.s-bottom-alert-wrapper-with-template{flex-direction:row}}.s-bottom-alert-logo-section{display:flex;align-items:center;gap:0.5rem;padding-left:1rem;padding-right:1rem;padding-top:0.5rem;padding-bottom:0.5rem}.s-bottom-alert-logo{height:auto;width:3rem}.s-bottom-alert-logo-text{font-size:1.25rem;line-height:1.75rem;font-weight:700;--tw-text-opacity:1;color:rgb(186 243 230 / var(--tw-text-opacity, 1))}.s-bottom-alert-icon svg{height:1rem;width:1rem;fill:#fff}.s-bottom-alert-message{font-size:0.875rem;line-height:1.25rem;font-weight:700;--tw-text-opacity:1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.s-bottom-alert-message-highlight{cursor:default;font-size:1rem;line-height:1.5rem;font-weight:700}.s-bottom-alert-message-splitter{margin-left:0.5rem;margin-right:0.5rem}.s-bottom-alert-message-link{cursor:pointer;text-decoration-line:underline}.s-bottom-alert-content{display:flex;height:100%;flex-direction:column;align-items:center;justify-content:center;gap:1rem}@media (min-width: 768px){.s-bottom-alert-content{flex-direction:row}}.s-bottom-alert-action button{background-color:var(--color-primary-reverse);font-size:0.875rem;line-height:1.25rem;color:var(--color-primary)}.s-bottom-alert-actions-group{display:flex;align-items:center;gap:1rem}.s-bottom-alert-action-link{cursor:pointer;font-size:0.875rem;line-height:1.25rem;font-weight:700;--tw-text-opacity:1;color:rgb(186 243 230 / var(--tw-text-opacity, 1));text-decoration-line:underline;transition-property:opacity;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms}.s-bottom-alert-action-link:hover{opacity:0.8}.s-bottom-alert-action-purchase-button{border-radius:0.375rem;--tw-bg-opacity:1;background-color:rgb(186 243 230 / var(--tw-bg-opacity, 1));padding-left:1rem;padding-right:1rem;padding-top:0.5rem;padding-bottom:0.5rem;--tw-text-opacity:1;color:rgb(0 73 86 / var(--tw-text-opacity, 1))}.s-bottom-alert-actions-group-container{display:flex;align-items:center;gap:1rem}.s-bottom-alert-modal .s-modal-body{padding-top:1rem;padding-bottom:1rem}.s-bottom-alert-modal-cover img{height:300px;width:100%;object-fit:cover}.s-bottom-alert-modal-inner{max-height:80vh;overflow-y:auto;overflow-x:hidden;padding-left:1rem;padding-right:1rem}.s-bottom-alert-modal-content-title{margin-top:1rem;margin-bottom:1rem;display:flex;align-items:center;gap:0.5rem;font-size:1.125rem;line-height:1.75rem;font-weight:700;color:var(--color-primary-dark)}.s-bottom-alert-modal-content-icon svg{height:1.25rem;width:1.25rem;fill:var(--color-primary-dark)}.s-bottom-alert-modal-content-extra-padding{padding-bottom:100px}.s-bottom-alert-modal-content hr{margin-top:1rem}.s-bottom-alert-modal-content-screenshots{margin-top:1rem;margin-bottom:1rem}.s-bottom-alert-modal-content-screenshot.swiper-slide{height:200px !important;width:370px !important}.s-bottom-alert-modal-content-screenshot img{height:100%;width:100%;object-fit:cover}.s-bottom-alert-modal-content-footer button .s-button-text{display:flex;align-items:center;gap:0.5rem}.s-bottom-alert-modal-content-footer{position:fixed;left:0px;right:0px;bottom:0px;z-index:2;width:100%;--tw-bg-opacity:1;background-color:rgb(252 252 252 / var(--tw-bg-opacity, 1));padding:0.625rem}.s-bottom-alert-modal-content-price-details{display:flex;flex-direction:column;gap:0.5rem}.s-bottom-alert-modal-content-price-details-item{display:flex;align-items:center;gap:0.375rem}.s-bottom-alert-modal-content-price-details-item-icon svg{height:1rem;width:1rem;fill:var(--color-primary-dark)}.s-bottom-alert-modal-content-price-details-item-name{--tw-text-opacity:1;color:rgb(68 68 68 / var(--tw-text-opacity, 1))}.s-bottom-alert-modal-content-price-details-item-price{font-weight:500;--tw-text-opacity:1;color:rgb(102 102 102 / var(--tw-text-opacity, 1))}.s-bottom-alert-modal-price-wrapper{margin-bottom:0.625rem;display:flex;align-items:center;justify-content:space-between;font-size:1rem;line-height:1.5rem}.s-bottom-alert-modal-price-wrapper-amount{font-size:1.125rem;line-height:1.75rem;font-weight:700}";export{i as salla_alert,l as salla_bottom_alert}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as a,h as t,H as l,a as n}from"./p-
|
|
4
|
+
import{r as a,h as t,H as l,a as n}from"./p-BtdIfJF8.js";const s=class{constructor(t){a(this,t),this.pointsData=null,this.productId=null}async componentWillLoad(){try{if(await salla.onReady(),await salla.lang.onLoaded(),this.productId=this.host.dataset.productId||salla.config.get("page.id"),!this.productId)return;const a=await salla.api.request(`/loyalty/products/${this.productId}/points`).catch((()=>null));this.pointsData=a?.data||null}catch(a){salla?.logger?.warn?.("salla-loyalty-points-banner: init failed",a)}}render(){return this.productId&&this.pointsData?.points?t(l,null,t("div",{class:"s-loyalty-points-banner-container"},t("div",{class:"s-loyalty-points-banner-icon"},t("span",{class:"s-loyalty-points-banner-inner-icon",innerHTML:'<svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M8.76604 2.86201C9.31804 2.61001 9.93304 2.41501 10.611 2.27701C11.289 2.13901 12 2.07001 12.744 2.07001C13.572 2.07001 14.364 2.15401 15.12 2.32201C15.84 2.49001 16.356 2.81401 16.668 3.29401C16.932 3.70201 17.064 4.26001 17.064 4.96801V13.032C17.064 13.416 16.95 13.752 16.722 14.04C16.506 14.304 16.227 14.493 15.885 14.607C15.543 14.721 15.204 14.742 14.868 14.67C14.196 14.514 13.488 14.436 12.744 14.436C12.084 14.436 11.442 14.502 10.818 14.634C10.23 14.754 9.70204 14.922 9.23404 15.138C8.68204 15.39 8.06704 15.585 7.38904 15.723C6.71104 15.861 6.00004 15.93 5.25604 15.93C4.42804 15.93 3.63604 15.846 2.88004 15.678C2.18404 15.522 1.68004 15.21 1.36804 14.742C1.08004 14.322 0.936035 13.752 0.936035 13.032V4.96801C0.936035 4.58401 1.05004 4.24801 1.27804 3.96001C1.49404 3.69601 1.77304 3.50701 2.11504 3.39301C2.45704 3.27901 2.79604 3.25801 3.13204 3.33001C3.80404 3.48601 4.51204 3.56401 5.25604 3.56401C5.91604 3.56401 6.55804 3.49801 7.18204 3.36601C7.77004 3.24601 8.29804 3.07801 8.76604 2.86201ZM11.25 9.00001C11.25 8.59201 11.148 8.21701 10.944 7.87501C10.74 7.53301 10.467 7.26001 10.125 7.05601C9.78304 6.85201 9.40804 6.75001 9.00004 6.75001C8.59204 6.75001 8.21704 6.85201 7.87504 7.05601C7.53304 7.26001 7.26004 7.53301 7.05604 7.87501C6.85204 8.21701 6.75004 8.59201 6.75004 9.00001C6.75004 9.40801 6.85204 9.78301 7.05604 10.125C7.26004 10.467 7.53304 10.74 7.87504 10.944C8.21704 11.148 8.59204 11.25 9.00004 11.25C9.40804 11.25 9.78304 11.148 10.125 10.944C10.467 10.74 10.74 10.467 10.944 10.125C11.148 9.78301 11.25 9.40801 11.25 9.00001ZM14.328 7.79401C14.076 7.75801 13.812 7.73401 13.536 7.72201C13.38 7.71001 13.245 7.75501 13.131 7.85701C13.017 7.95901 12.954 8.08801 12.942 8.24401C12.93 8.40001 12.975 8.53501 13.077 8.64901C13.179 8.76301 13.308 8.82601 13.464 8.83801C13.704 8.85001 13.938 8.87401 14.166 8.91001C14.322 8.93401 14.463 8.90101 14.589 8.81101C14.715 8.72101 14.787 8.59801 14.805 8.44201C14.823 8.28601 14.787 8.14501 14.697 8.01901C14.607 7.89301 14.484 7.81801 14.328 7.79401ZM4.53604 9.16201C4.29604 9.15001 4.06204 9.12601 3.83404 9.09001C3.67804 9.06601 3.53704 9.09901 3.41104 9.18901C3.28504 9.27901 3.21304 9.40201 3.19504 9.55801C3.17704 9.71401 3.21304 9.85501 3.30304 9.98101C3.39304 10.107 3.51604 10.182 3.67204 10.206C3.92404 10.242 4.18804 10.266 4.46404 10.278C4.62004 10.29 4.75504 10.245 4.86904 10.143C4.98304 10.041 5.04604 9.91201 5.05804 9.75601C5.07004 9.60001 5.02504 9.46501 4.92304 9.35101C4.82104 9.23701 4.69204 9.17401 4.53604 9.16201Z" fill="white"/>\n</svg>\n'})),t("p",null,t("span",{class:"s-loyalty-points-banner-label"},salla.lang.get("pages.loyalty_program.earn")," "),t("span",{class:"s-loyalty-points-banner-label"},`+${this.pointsData.points}`," "),t("span",{class:"s-loyalty-points-banner-label"},salla.lang.get("pages.loyalty_program.loyalty_point")," "),t("span",{class:"s-loyalty-points-banner-description"},salla.lang.get("pages.loyalty_program.on_order_total_when_purchase"))))):null}get host(){return n(this)}};s.style="/*!twlt*/.s-loyalty-points-banner-container{margin-bottom:0.75rem;display:flex;width:100%;align-items:center;gap:0.5rem;border-radius:0.5rem;background-color:rgb(209 180 76 / var(--tw-bg-opacity, 1));--tw-bg-opacity:0.1;padding-left:0.75rem;padding-right:0.75rem;padding-top:0.5rem;padding-bottom:0.5rem}.s-loyalty-points-banner-icon{display:flex;height:2rem;width:2rem;flex-shrink:0;align-items:center;justify-content:center;border-radius:9999px;--tw-bg-opacity:1;background-color:rgb(209 180 76 / var(--tw-bg-opacity, 1))}.s-loyalty-points-banner-label{font-size:0.875rem;line-height:1.25rem;font-weight:700;--tw-text-opacity:1;color:rgb(209 180 76 / var(--tw-text-opacity, 1))}.s-loyalty-points-banner-description{font-size:0.875rem;line-height:1.25rem}";export{s as salla_loyalty_points_banner}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as e,h as r,H as t}from"./p-AYwDRYpw.js";const a=250,o={customer:"أُلغي الطلب من قِبل العميل",merchant:"أُلغي الطلب من قِبل المتجر"},l=[["pages.orders.cancel_modal_title","إلغاء الطلب","Cancel order"],["pages.orders.cancel_reason_title","لماذا ترغب في إلغاء الطلب؟","Why do you want to cancel this order?"],["pages.orders.cancel_reason_subtitle","ساعدنا نعرف السبب لتحسين تجربتك.","Help us understand why to improve your experience."],["pages.orders.cancel_reason_confirm","تأكيد إلغاء الطلب","Confirm order cancellation"],["pages.orders.cancel_reason_back","تراجع","Go back"],["pages.orders.cancel_reason_note_placeholder","اذكر السبب","Mention the reason"],["pages.orders.cancelled_by_customer",o.customer,"Order cancelled by the customer"],["pages.orders.cancelled_by_merchant",o.merchant,"Order cancelled by the merchant"],["pages.orders.cancel_reason_char_limit","يتجاوز النص حد الأحرف المسموح","Text exceeds the allowed character limit"]],s=e=>{if(!e)return null;try{const r="string"==typeof e?JSON.parse(e):e;return r&&"object"==typeof r?r:null}catch{return null}},i=e=>e.filter((e=>!1!==e.is_active)).sort(((e,r)=>(e.sort??0)-(r.sort??0))),n=class{constructor(r){e(this,r),this.reasons=[],this.selectedReasonId=null,this.reasonNote="",this.confirmLoading=!1,this.loading=!0,this.modalTitleLabel="",this.questionLabel="",this.subtitleLabel="",this.confirmLabel="",this.backLabel="",this.notePlaceholder="",this.charLimitLabel="",salla.lang.onLoaded((()=>{const e=salla.lang.messages?.["ar.trans"],r=salla.lang.messages?.["en.trans"];if(e&&r&&salla.helpers?.setNested)for(const[t,a,o]of l)salla.helpers.setNested(e,t,a),salla.helpers.setNested(r,t,o);this.refreshLabels()}))}onCancellationReasonsChange(){this.load()}async componentWillLoad(){await salla.onReady(),this.refreshLabels(),await this.load()}refreshLabels(){const e=(e,r)=>salla.lang.getWithDefault(e,r);this.modalTitleLabel=e("pages.orders.cancel_modal_title","إلغاء الطلب"),this.questionLabel=e("pages.orders.cancel_reason_title","لماذا ترغب في إلغاء الطلب؟"),this.subtitleLabel=e("pages.orders.cancel_reason_subtitle","ساعدنا نعرف السبب لتحسين تجربتك."),this.confirmLabel=e("pages.orders.cancel_reason_confirm","تأكيد إلغاء الطلب"),this.backLabel=e("pages.orders.cancel_reason_back","تراجع"),this.notePlaceholder=e("pages.orders.cancel_reason_note_placeholder","اذكر السبب"),this.charLimitLabel=e("pages.orders.cancel_reason_char_limit","يتجاوز النص حد الأحرف المسموح")}get resolvedOrderId(){const e=this.orderId??this.pageOrder?.id??salla.config.get("page.id"),r=Number(e);return Number.isFinite(r)?r:e}readPageOrder(){const e=document.querySelector("salla-order-totals-card");return e?s(e.order??e.getAttribute("order")):null}waitForPageOrder(){const e=this.readPageOrder();return e?Promise.resolve(e):"undefined"==typeof MutationObserver?Promise.resolve().then((()=>this.readPageOrder())):new Promise((e=>{let r=!1;const t=()=>{r||(r=!0,o.disconnect(),clearTimeout(l),e(this.readPageOrder()))},a=document.querySelector("salla-order-totals-card"),o=new MutationObserver(t);o.observe(a??document.documentElement,a?{attributes:!0,attributeFilter:["order"]}:{childList:!0,subtree:!0,attributes:!0,attributeFilter:["order"]});const l=setTimeout(t,2500)}))}cancelledByLabel(e){return salla.lang.getWithDefault(`pages.orders.cancelled_by_${e}`,o[e])}mountCancelledHeader(e=0){const r=this.orderCancelledReason,t=r?.reasons[0];if(!t||document.querySelector("[data-salla-order-cancelled-reason]"))return;const a=document.querySelector("td.single-order-header-item:not(.flex)");if(!a)return void(e<20&&requestAnimationFrame((()=>this.mountCancelledHeader(e+1))));const o=document.createElement("td");o.className="s-order-cancel-cancelled-header-item",o.setAttribute("data-salla-order-cancelled-reason","");const l=document.createElement("div");l.className="s-order-cancel-cancelled-header-label",l.textContent=this.cancelledByLabel(r.cancelled_by);const s=document.createElement("b");s.className="s-order-cancel-cancelled-header-reason",s.textContent=t,s.title=t,o.append(l,s),a.insertAdjacentElement("afterend",o)}purgeLegacyModal(){if(this.reasons.length)for(const e of document.querySelectorAll("salla-modal#modal-order-cancel:not([data-salla-order-cancel])"))e.remove()}applyPageOrder(e){this.pageOrder=e,this.orderCancelledReason=(e=>{const r=s(e),t=Array.isArray(r?.reasons)?r.reasons.filter((e=>"string"==typeof e&&e.length>0)):[];return t.length?{cancelled_by:"merchant"===r?.cancelled_by?"merchant":"customer",reasons:t}:null})(e.order_cancelled_reason)??void 0}async load(){this.loading=!0;try{const e=(e=>{if(null==e||""===e)return null;const r="string"==typeof e?s(e):e;return Array.isArray(r)&&r.length?r:null})(this.cancellationReasons);if(!this.pageOrder){const e=this.readPageOrder();e&&this.applyPageOrder(e)}if(this.pageOrder||e)this.pageOrder||this.waitForPageOrder().then((e=>{e&&(this.applyPageOrder(e),this.mountCancelledHeader())}));else{const e=await this.waitForPageOrder();e&&this.applyPageOrder(e)}const r=this.pageOrder;this.reasons=e?i(e):r?i(Array.isArray(r.cancellation_reasons)?r.cancellation_reasons:[]):[]}finally{this.loading=!1,this.purgeLegacyModal(),this.mountCancelledHeader()}}reasonLabel(e){const r=salla.lang.getLocale?.()||"ar";return e.translations?.[r]?.name||e.name}get hasOtherSelected(){return null!==this.selectedReasonId&&this.reasons.some((e=>e.id===this.selectedReasonId&&"other"===e.slug))}get canConfirm(){if(null===this.selectedReasonId)return!1;if(!this.hasOtherSelected)return!0;const e=this.reasonNote.trim().length;return e>0&&e<=a}selectReason(e){if(this.selectedReasonId===e)return"other"===this.reasons.find((r=>r.id===e))?.slug&&(this.reasonNote=""),void(this.selectedReasonId=null);if("other"===this.reasons.find((e=>e.id===this.selectedReasonId))?.slug&&(this.reasonNote=""),this.selectedReasonId=e,this.reasons.length&&this.reasons[this.reasons.length-1].id===e){const r=setTimeout((()=>{requestAnimationFrame((()=>{document.getElementById(`s-order-cancel-reason-${e}`)?.scrollIntoView({block:"start",behavior:"smooth"});const t=document.querySelector(".s-order-cancel-textarea");t?.focus(),clearTimeout(r)}))}),200)}}resetForm(){this.selectedReasonId=null,this.reasonNote="",this.confirmLoading=!1}setReasonNote(e){this.reasonNote=e.target.value}onKeyActivate(e,r){"Enter"!==e.key&&" "!==e.key||r()}async confirmCancel(){if(this.canConfirm&&!this.confirmLoading){this.confirmLoading=!0;try{const e=this.hasOtherSelected?this.reasonNote.trim():"",r={reasons:[String(this.selectedReasonId)],...e&&{reason_note:e}};await salla.order.api.cancel(this.resolvedOrderId,r),window.location.reload()}catch{this.confirmLoading=!1}}}render(){return this.loading||!this.reasons.length?r(t,{class:"s-order-cancel-wrapper"}):r(t,{class:"s-order-cancel-wrapper"},r("salla-modal",{id:"modal-order-cancel",class:"s-order-cancel-modal","data-salla-order-cancel":"",ref:e=>{this.modal=e,e?.setTitle?.(this.modalTitleLabel)},width:"sm",onModalVisibilityChanged:e=>!e.detail&&this.resetForm()},r("div",{class:"s-order-cancel-content"},r("div",{class:"s-order-cancel-intro"},r("p",{class:"s-order-cancel-heading"},this.questionLabel),r("p",{class:"s-order-cancel-subtitle"},this.subtitleLabel)),r("div",{class:"s-order-cancel-reasons s-scrollbar"},this.reasons.map((e=>{const t=`s-order-cancel-reason-${e.id}`;return r("label",{key:e.id,class:"s-order-cancel-reason",htmlFor:t},r("input",{type:"radio",name:"cancellation_reason",id:t,class:"s-order-cancel-radio s-radio",checked:this.selectedReasonId===e.id,onChange:()=>this.selectReason(e.id)}),r("span",{class:"s-order-cancel-reason-label"},this.reasonLabel(e)))}))),this.hasOtherSelected&&r("div",{class:"s-order-cancel-other-field"},r("textarea",{class:"s-order-cancel-textarea",placeholder:this.notePlaceholder,value:this.reasonNote,onInput:e=>this.setReasonNote(e)}),r("p",{class:{"s-order-cancel-counter":!0,"s-order-cancel-counter--limit":this.reasonNote.length>=a}},this.reasonNote.length>=a&&`${this.charLimitLabel} `,a,"/",this.reasonNote.length)),r("div",{class:"s-order-cancel-actions"},r("salla-button",{color:"primary",class:"w-full",width:"wide",disabled:!this.canConfirm,loading:this.confirmLoading,onClick:()=>this.confirmCancel(),onKeyDown:e=>this.onKeyActivate(e,(()=>this.confirmCancel()))},this.confirmLabel),r("salla-button",{class:"w-full",width:"wide",fill:"outline",color:"gray",onClick:()=>this.modal?.close(),onKeyDown:e=>this.onKeyActivate(e,(()=>this.modal?.close()))},this.backLabel)))))}static get watchers(){return{cancellationReasons:["onCancellationReasonsChange"]}}};n.style='/*!twlt*/.s-order-cancel-reason .s-order-cancel-radio::before,.s-order-cancel-reason .s-radio::before{content:"";width:10px;height:10px;border-radius:50%;transform:scale(0);transition:120ms transform ease-in-out;background-color:#fff;box-shadow:inset 1em 1em #fff}.s-order-cancel-reason .s-order-cancel-radio:checked::before,.s-order-cancel-reason .s-radio:checked::before{transform:scale(1);background-color:var(--color-primary);box-shadow:inset 1em 1em var(--color-primary)}.block{display:block}.flex{display:flex}.table{display:table}.w-full{width:100%}.outline{outline-style:solid}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.s-scrollbar::-webkit-scrollbar{width:5px}.s-scrollbar::-webkit-scrollbar-track{background-color:#eee}.s-scrollbar::-webkit-scrollbar-thumb{background-color:var(--color-primary);border-radius:10px;-webkit-border-radius:10px;-moz-border-radius:10px;-ms-border-radius:10px;-o-border-radius:10px}salla-modal.s-order-cancel-modal .s-modal-body{display:inline-flex;max-height:100svh;flex-direction:column;overflow:hidden;text-align:start}@media (min-width: 768px){salla-modal.s-order-cancel-modal .s-modal-body{max-height:92svh}}salla-modal.s-order-cancel-modal .s-modal-header{width:100%;flex-shrink:0;align-items:flex-start;text-align:start}salla-modal.s-order-cancel-modal .s-modal-header-inner{margin-bottom:1.25rem;display:block !important;width:100%;padding-inline-end:2.5rem;padding-inline-start:0px;text-align:start}@media (min-width: 768px){salla-modal.s-order-cancel-modal .s-modal-header-inner{padding:0px}}salla-modal.s-order-cancel-modal .s-modal-header-inner:where([dir="rtl"],[dir="rtl"] *){padding-inline-start:2.5rem;padding-inline-end:0px}salla-modal.s-order-cancel-modal .s-modal-header-content{width:100%;align-items:flex-start;text-align:start}salla-modal.s-order-cancel-modal .s-modal-title{margin-bottom:0px;width:100%;text-align:start;font-size:1.125rem;line-height:1.75rem;font-weight:700;--tw-text-opacity:1;color:rgb(31 41 55 / var(--tw-text-opacity, 1))}.s-order-cancel-cancelled-header-item{display:flex;width:100%;min-width:0px;align-items:center;justify-content:space-between;padding-left:0.75rem;padding-right:0.75rem;padding-top:0.5rem;padding-bottom:0.5rem;font-size:0.875rem;line-height:1.25rem}@media (min-width: 768px){.s-order-cancel-cancelled-header-item{display:table-cell;width:auto;max-width:14rem;padding-left:1.5rem;padding-right:1.5rem;padding-top:1rem;padding-bottom:1rem}}.s-order-cancel-cancelled-header-label{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;font-weight:400;--tw-text-opacity:1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.s-order-cancel-cancelled-header-label:where([dir="ltr"],[dir="ltr"] *){margin-right:0.5rem}.s-order-cancel-cancelled-header-label:where([dir="rtl"],[dir="rtl"] *){margin-left:0.5rem}.s-order-cancel-cancelled-header-reason{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;display:block;overflow-wrap:break-word;font-weight:700}.s-order-cancel-wrapper{display:block}.s-order-cancel-content{display:flex;min-height:0px;width:100%;flex:1 1 0%;flex-direction:column;gap:1.5rem;overflow:hidden;text-align:start}.s-order-cancel-intro{display:flex;width:100%;flex-shrink:0;flex-direction:column;gap:0.5rem}.s-order-cancel-heading{font-size:1rem;font-weight:700;line-height:1.5rem;--tw-text-opacity:1;color:rgb(31 41 55 / var(--tw-text-opacity, 1))}.s-order-cancel-subtitle{font-size:0.875rem;line-height:1.25rem;font-weight:400;line-height:1.5;--tw-text-opacity:1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.s-order-cancel-reasons{display:flex;min-height:0px;width:100%;flex:1 1 0%;flex-direction:column;gap:1rem;overflow-y:auto;padding-left:0.25rem;padding-right:0.25rem;padding-top:0.5rem;padding-bottom:0.5rem}.s-order-cancel-reason{display:flex;width:100%;cursor:pointer;align-items:center;gap:0.5rem;accent-color:var(--color-primary)}.s-order-cancel-reason-label{flex:1 1 0%;text-align:start;font-size:0.875rem;font-weight:500;line-height:1.25rem;--tw-text-opacity:1;color:rgb(31 41 55 / var(--tw-text-opacity, 1))}.s-order-cancel-radio{margin:0px;display:grid;height:1.25rem;width:1.25rem;min-width:1.25rem;flex-shrink:0;cursor:pointer;appearance:none;place-content:center;border-radius:9999px;border-width:1px;border-color:var(--color-primary);--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.s-order-cancel-radio:checked{border-color:var(--color-primary);--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.s-order-cancel-radio:focus-visible{border-color:var(--color-primary);outline-color:var(--color-primary)}.s-order-cancel-radio:focus-visible:checked{border-color:var(--color-primary);outline-color:var(--color-primary)}.s-order-cancel-other-field{display:flex;width:100%;flex-shrink:0;flex-direction:column;gap:0.25rem}.s-order-cancel-textarea{min-height:6rem;width:100%;resize:none;text-align:start}.has-error .s-order-cancel-textarea{border-color:#ff443a;color:#ff443a}.s-order-cancel-textarea{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-order-cancel-textarea: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-order-cancel-counter{text-align:end;font-size:0.75rem;line-height:1rem;--tw-text-opacity:1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.s-order-cancel-counter--limit{--tw-text-opacity:1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.s-order-cancel-actions{display:flex;width:100%;flex-shrink:0;flex-direction:column;gap:1rem;padding-top:0px}';export{n as salla_order_cancel}
|
|
4
|
+
import{r as e,h as r,H as t}from"./p-BtdIfJF8.js";const a=250,o={customer:"أُلغي الطلب من قِبل العميل",merchant:"أُلغي الطلب من قِبل المتجر"},l=[["pages.orders.cancel_modal_title","إلغاء الطلب","Cancel order"],["pages.orders.cancel_reason_title","لماذا ترغب في إلغاء الطلب؟","Why do you want to cancel this order?"],["pages.orders.cancel_reason_subtitle","ساعدنا نعرف السبب لتحسين تجربتك.","Help us understand why to improve your experience."],["pages.orders.cancel_reason_confirm","تأكيد إلغاء الطلب","Confirm order cancellation"],["pages.orders.cancel_reason_back","تراجع","Go back"],["pages.orders.cancel_reason_note_placeholder","اذكر السبب","Mention the reason"],["pages.orders.cancelled_by_customer",o.customer,"Order cancelled by the customer"],["pages.orders.cancelled_by_merchant",o.merchant,"Order cancelled by the merchant"],["pages.orders.cancel_reason_char_limit","يتجاوز النص حد الأحرف المسموح","Text exceeds the allowed character limit"]],s=e=>{if(!e)return null;try{const r="string"==typeof e?JSON.parse(e):e;return r&&"object"==typeof r?r:null}catch{return null}},i=e=>e.filter((e=>!1!==e.is_active)).sort(((e,r)=>(e.sort??0)-(r.sort??0))),n=class{constructor(r){e(this,r),this.reasons=[],this.selectedReasonId=null,this.reasonNote="",this.confirmLoading=!1,this.loading=!0,this.modalTitleLabel="",this.questionLabel="",this.subtitleLabel="",this.confirmLabel="",this.backLabel="",this.notePlaceholder="",this.charLimitLabel="",salla.lang.onLoaded((()=>{const e=salla.lang.messages?.["ar.trans"],r=salla.lang.messages?.["en.trans"];if(e&&r&&salla.helpers?.setNested)for(const[t,a,o]of l)salla.helpers.setNested(e,t,a),salla.helpers.setNested(r,t,o);this.refreshLabels()}))}onCancellationReasonsChange(){this.load()}async componentWillLoad(){await salla.onReady(),this.refreshLabels(),await this.load()}refreshLabels(){const e=(e,r)=>salla.lang.getWithDefault(e,r);this.modalTitleLabel=e("pages.orders.cancel_modal_title","إلغاء الطلب"),this.questionLabel=e("pages.orders.cancel_reason_title","لماذا ترغب في إلغاء الطلب؟"),this.subtitleLabel=e("pages.orders.cancel_reason_subtitle","ساعدنا نعرف السبب لتحسين تجربتك."),this.confirmLabel=e("pages.orders.cancel_reason_confirm","تأكيد إلغاء الطلب"),this.backLabel=e("pages.orders.cancel_reason_back","تراجع"),this.notePlaceholder=e("pages.orders.cancel_reason_note_placeholder","اذكر السبب"),this.charLimitLabel=e("pages.orders.cancel_reason_char_limit","يتجاوز النص حد الأحرف المسموح")}get resolvedOrderId(){const e=this.orderId??this.pageOrder?.id??salla.config.get("page.id"),r=Number(e);return Number.isFinite(r)?r:e}readPageOrder(){const e=document.querySelector("salla-order-totals-card");return e?s(e.order??e.getAttribute("order")):null}waitForPageOrder(){const e=this.readPageOrder();return e?Promise.resolve(e):"undefined"==typeof MutationObserver?Promise.resolve().then((()=>this.readPageOrder())):new Promise((e=>{let r=!1;const t=()=>{r||(r=!0,o.disconnect(),clearTimeout(l),e(this.readPageOrder()))},a=document.querySelector("salla-order-totals-card"),o=new MutationObserver(t);o.observe(a??document.documentElement,a?{attributes:!0,attributeFilter:["order"]}:{childList:!0,subtree:!0,attributes:!0,attributeFilter:["order"]});const l=setTimeout(t,2500)}))}cancelledByLabel(e){return salla.lang.getWithDefault(`pages.orders.cancelled_by_${e}`,o[e])}mountCancelledHeader(e=0){const r=this.orderCancelledReason,t=r?.reasons[0];if(!t||document.querySelector("[data-salla-order-cancelled-reason]"))return;const a=document.querySelector("td.single-order-header-item:not(.flex)");if(!a)return void(e<20&&requestAnimationFrame((()=>this.mountCancelledHeader(e+1))));const o=document.createElement("td");o.className="s-order-cancel-cancelled-header-item",o.setAttribute("data-salla-order-cancelled-reason","");const l=document.createElement("div");l.className="s-order-cancel-cancelled-header-label",l.textContent=this.cancelledByLabel(r.cancelled_by);const s=document.createElement("b");s.className="s-order-cancel-cancelled-header-reason",s.textContent=t,s.title=t,o.append(l,s),a.insertAdjacentElement("afterend",o)}purgeLegacyModal(){if(this.reasons.length)for(const e of document.querySelectorAll("salla-modal#modal-order-cancel:not([data-salla-order-cancel])"))e.remove()}applyPageOrder(e){this.pageOrder=e,this.orderCancelledReason=(e=>{const r=s(e),t=Array.isArray(r?.reasons)?r.reasons.filter((e=>"string"==typeof e&&e.length>0)):[];return t.length?{cancelled_by:"merchant"===r?.cancelled_by?"merchant":"customer",reasons:t}:null})(e.order_cancelled_reason)??void 0}async load(){this.loading=!0;try{const e=(e=>{if(null==e||""===e)return null;const r="string"==typeof e?s(e):e;return Array.isArray(r)&&r.length?r:null})(this.cancellationReasons);if(!this.pageOrder){const e=this.readPageOrder();e&&this.applyPageOrder(e)}if(this.pageOrder||e)this.pageOrder||this.waitForPageOrder().then((e=>{e&&(this.applyPageOrder(e),this.mountCancelledHeader())}));else{const e=await this.waitForPageOrder();e&&this.applyPageOrder(e)}const r=this.pageOrder;this.reasons=e?i(e):r?i(Array.isArray(r.cancellation_reasons)?r.cancellation_reasons:[]):[]}finally{this.loading=!1,this.purgeLegacyModal(),this.mountCancelledHeader()}}reasonLabel(e){const r=salla.lang.getLocale?.()||"ar";return e.translations?.[r]?.name||e.name}get hasOtherSelected(){return null!==this.selectedReasonId&&this.reasons.some((e=>e.id===this.selectedReasonId&&"other"===e.slug))}get canConfirm(){if(null===this.selectedReasonId)return!1;if(!this.hasOtherSelected)return!0;const e=this.reasonNote.trim().length;return e>0&&e<=a}selectReason(e){if(this.selectedReasonId===e)return"other"===this.reasons.find((r=>r.id===e))?.slug&&(this.reasonNote=""),void(this.selectedReasonId=null);if("other"===this.reasons.find((e=>e.id===this.selectedReasonId))?.slug&&(this.reasonNote=""),this.selectedReasonId=e,this.reasons.length&&this.reasons[this.reasons.length-1].id===e){const r=setTimeout((()=>{requestAnimationFrame((()=>{document.getElementById(`s-order-cancel-reason-${e}`)?.scrollIntoView({block:"start",behavior:"smooth"});const t=document.querySelector(".s-order-cancel-textarea");t?.focus(),clearTimeout(r)}))}),200)}}resetForm(){this.selectedReasonId=null,this.reasonNote="",this.confirmLoading=!1}setReasonNote(e){this.reasonNote=e.target.value}onKeyActivate(e,r){"Enter"!==e.key&&" "!==e.key||r()}async confirmCancel(){if(this.canConfirm&&!this.confirmLoading){this.confirmLoading=!0;try{const e=this.hasOtherSelected?this.reasonNote.trim():"",r={reasons:[String(this.selectedReasonId)],...e&&{reason_note:e}};await salla.order.api.cancel(this.resolvedOrderId,r),window.location.reload()}catch{this.confirmLoading=!1}}}render(){return this.loading||!this.reasons.length?r(t,{class:"s-order-cancel-wrapper"}):r(t,{class:"s-order-cancel-wrapper"},r("salla-modal",{id:"modal-order-cancel",class:"s-order-cancel-modal","data-salla-order-cancel":"",ref:e=>{this.modal=e,e?.setTitle?.(this.modalTitleLabel)},width:"sm",onModalVisibilityChanged:e=>!e.detail&&this.resetForm()},r("div",{class:"s-order-cancel-content"},r("div",{class:"s-order-cancel-intro"},r("p",{class:"s-order-cancel-heading"},this.questionLabel),r("p",{class:"s-order-cancel-subtitle"},this.subtitleLabel)),r("div",{class:"s-order-cancel-reasons s-scrollbar"},this.reasons.map((e=>{const t=`s-order-cancel-reason-${e.id}`;return r("label",{key:e.id,class:"s-order-cancel-reason",htmlFor:t},r("input",{type:"radio",name:"cancellation_reason",id:t,class:"s-order-cancel-radio s-radio",checked:this.selectedReasonId===e.id,onChange:()=>this.selectReason(e.id)}),r("span",{class:"s-order-cancel-reason-label"},this.reasonLabel(e)))}))),this.hasOtherSelected&&r("div",{class:"s-order-cancel-other-field"},r("textarea",{class:"s-order-cancel-textarea",placeholder:this.notePlaceholder,value:this.reasonNote,onInput:e=>this.setReasonNote(e)}),r("p",{class:{"s-order-cancel-counter":!0,"s-order-cancel-counter--limit":this.reasonNote.length>=a}},this.reasonNote.length>=a&&`${this.charLimitLabel} `,a,"/",this.reasonNote.length)),r("div",{class:"s-order-cancel-actions"},r("salla-button",{color:"primary",class:"w-full",width:"wide",disabled:!this.canConfirm,loading:this.confirmLoading,onClick:()=>this.confirmCancel(),onKeyDown:e=>this.onKeyActivate(e,(()=>this.confirmCancel()))},this.confirmLabel),r("salla-button",{class:"w-full",width:"wide",fill:"outline",color:"gray",onClick:()=>this.modal?.close(),onKeyDown:e=>this.onKeyActivate(e,(()=>this.modal?.close()))},this.backLabel)))))}static get watchers(){return{cancellationReasons:["onCancellationReasonsChange"]}}};n.style='/*!twlt*/.s-order-cancel-reason .s-order-cancel-radio::before,.s-order-cancel-reason .s-radio::before{content:"";width:10px;height:10px;border-radius:50%;transform:scale(0);transition:120ms transform ease-in-out;background-color:#fff;box-shadow:inset 1em 1em #fff}.s-order-cancel-reason .s-order-cancel-radio:checked::before,.s-order-cancel-reason .s-radio:checked::before{transform:scale(1);background-color:var(--color-primary);box-shadow:inset 1em 1em var(--color-primary)}.block{display:block}.flex{display:flex}.table{display:table}.w-full{width:100%}.outline{outline-style:solid}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.s-scrollbar::-webkit-scrollbar{width:5px}.s-scrollbar::-webkit-scrollbar-track{background-color:#eee}.s-scrollbar::-webkit-scrollbar-thumb{background-color:var(--color-primary);border-radius:10px;-webkit-border-radius:10px;-moz-border-radius:10px;-ms-border-radius:10px;-o-border-radius:10px}salla-modal.s-order-cancel-modal .s-modal-body{display:inline-flex;max-height:100svh;flex-direction:column;overflow:hidden;text-align:start}@media (min-width: 768px){salla-modal.s-order-cancel-modal .s-modal-body{max-height:92svh}}salla-modal.s-order-cancel-modal .s-modal-header{width:100%;flex-shrink:0;align-items:flex-start;text-align:start}salla-modal.s-order-cancel-modal .s-modal-header-inner{margin-bottom:1.25rem;display:block !important;width:100%;padding-inline-end:2.5rem;padding-inline-start:0px;text-align:start}@media (min-width: 768px){salla-modal.s-order-cancel-modal .s-modal-header-inner{padding:0px}}salla-modal.s-order-cancel-modal .s-modal-header-inner:where([dir="rtl"],[dir="rtl"] *){padding-inline-start:2.5rem;padding-inline-end:0px}salla-modal.s-order-cancel-modal .s-modal-header-content{width:100%;align-items:flex-start;text-align:start}salla-modal.s-order-cancel-modal .s-modal-title{margin-bottom:0px;width:100%;text-align:start;font-size:1.125rem;line-height:1.75rem;font-weight:700;--tw-text-opacity:1;color:rgb(31 41 55 / var(--tw-text-opacity, 1))}.s-order-cancel-cancelled-header-item{display:flex;width:100%;min-width:0px;align-items:center;justify-content:space-between;padding-left:0.75rem;padding-right:0.75rem;padding-top:0.5rem;padding-bottom:0.5rem;font-size:0.875rem;line-height:1.25rem}@media (min-width: 768px){.s-order-cancel-cancelled-header-item{display:table-cell;width:auto;max-width:14rem;padding-left:1.5rem;padding-right:1.5rem;padding-top:1rem;padding-bottom:1rem}}.s-order-cancel-cancelled-header-label{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;font-weight:400;--tw-text-opacity:1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.s-order-cancel-cancelled-header-label:where([dir="ltr"],[dir="ltr"] *){margin-right:0.5rem}.s-order-cancel-cancelled-header-label:where([dir="rtl"],[dir="rtl"] *){margin-left:0.5rem}.s-order-cancel-cancelled-header-reason{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;display:block;overflow-wrap:break-word;font-weight:700}.s-order-cancel-wrapper{display:block}.s-order-cancel-content{display:flex;min-height:0px;width:100%;flex:1 1 0%;flex-direction:column;gap:1.5rem;overflow:hidden;text-align:start}.s-order-cancel-intro{display:flex;width:100%;flex-shrink:0;flex-direction:column;gap:0.5rem}.s-order-cancel-heading{font-size:1rem;font-weight:700;line-height:1.5rem;--tw-text-opacity:1;color:rgb(31 41 55 / var(--tw-text-opacity, 1))}.s-order-cancel-subtitle{font-size:0.875rem;line-height:1.25rem;font-weight:400;line-height:1.5;--tw-text-opacity:1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.s-order-cancel-reasons{display:flex;min-height:0px;width:100%;flex:1 1 0%;flex-direction:column;gap:1rem;overflow-y:auto;padding-left:0.25rem;padding-right:0.25rem;padding-top:0.5rem;padding-bottom:0.5rem}.s-order-cancel-reason{display:flex;width:100%;cursor:pointer;align-items:center;gap:0.5rem;accent-color:var(--color-primary)}.s-order-cancel-reason-label{flex:1 1 0%;text-align:start;font-size:0.875rem;font-weight:500;line-height:1.25rem;--tw-text-opacity:1;color:rgb(31 41 55 / var(--tw-text-opacity, 1))}.s-order-cancel-radio{margin:0px;display:grid;height:1.25rem;width:1.25rem;min-width:1.25rem;flex-shrink:0;cursor:pointer;appearance:none;place-content:center;border-radius:9999px;border-width:1px;border-color:var(--color-primary);--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.s-order-cancel-radio:checked{border-color:var(--color-primary);--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.s-order-cancel-radio:focus-visible{border-color:var(--color-primary);outline-color:var(--color-primary)}.s-order-cancel-radio:focus-visible:checked{border-color:var(--color-primary);outline-color:var(--color-primary)}.s-order-cancel-other-field{display:flex;width:100%;flex-shrink:0;flex-direction:column;gap:0.25rem}.s-order-cancel-textarea{min-height:6rem;width:100%;resize:none;text-align:start}.has-error .s-order-cancel-textarea{border-color:#ff443a;color:#ff443a}.s-order-cancel-textarea{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-order-cancel-textarea: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-order-cancel-counter{text-align:end;font-size:0.75rem;line-height:1rem;--tw-text-opacity:1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.s-order-cancel-counter--limit{--tw-text-opacity:1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.s-order-cancel-actions{display:flex;width:100%;flex-shrink:0;flex-direction:column;gap:1rem;padding-top:0px}';export{n as salla_order_cancel}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as a,h as s,H as
|
|
4
|
+
import{r as a,h as s,H as t,a as o}from"./p-BtdIfJF8.js";const n=class{constructor(s){a(this,s)}async mount(a){this.host.before(a)}render(){return s(t,{key:"579b0abf0784c9396f636da50b1fed156e5a0600"})}async componentDidLoad(){await Salla.hooks.registerComponent("salla-hook",this)}get host(){return o(this)}};n.style=":host {\n all: unset;\n display: none; /* marker only */\n }";export{n as salla_hook}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as s,h as e,H as t,a as i}from"./p-AYwDRYpw.js";import{C as o}from"./p-BsLF_HK7.js";const a=class{constructor(e){s(this,e),this.isVisible=!0,this.step="consent",this.isMobile=!1,this.mobileBreakpoint=768,this.mobileQueryHandler=s=>this.isMobile=s.matches,this.openRequestedHandler=()=>this.open(),this.authLoggedInHandler=()=>this.syncConsentAfterLogin(),this.authLoggedOutHandler=()=>this.clearLocalConsent(),this.necessaryCookieKey="necessary_cookies",this.performanceCookieKey="performance_cookies",this.functionalCookieKey="functional_cookies",this.advertisingCookieKey="advertising_cookies",this.consentCookieDays=365,this.trackingCookiesByCategory={performance_cookies:["_ga","_ga_*","_gid","_gat","_gat_gtag_*","_hjSessionUser_*","_hjSession_*","_hjIncludedInSessionSample_*","_hjAbsoluteSessionInProgress","_hjFirstSeen","_clck","_clsk","MUID","MR","ANONCHK","_ym_uid","_ym_d","_ym_isad"],advertising_cookies:["_gcl_au","_gcl_aw","_gcl_dc","IDE","test_cookie","1P_JAR","NID","_fbp","_fbc","fr","_ttp","_scid","sc_at","personalization_id","guest_id","muc_ads","_pin_unauth","_pinterest_ct_ua","li_sugr","bcookie","lidc","UserMatchHistory","AnalyticsSyncHistory"],functional_cookies:["intercom-id-*","intercom-session-*","__zlcmid","crisp-client%2Fsession%2F*","YSC","VISITOR_INFO1_LIVE","PREF"]},this.performanceEnabled=!1,this.functionsEnabled=!1,this.adsEnabled=!1}async componentWillLoad(){await Salla.onReady(),await Salla.lang.onLoaded(),this.loadTranslations(),Salla.event.on("salla-cookies-bar::open",this.openRequestedHandler),Salla.event.on("auth::logged.in",this.authLoggedInHandler),Salla.event.on("auth::logged.out",this.authLoggedOutHandler),this.unregisterAfterFetchMenuItemsHook=Salla.hooks.registerHook("salla-menu","afterFetchMenuItems",(s=>this.appendCookiesSettingsLink(s))),this.hydrateToggleState(),Salla.storage.get("cookies-consent")&&(this.isVisible=!1),this.enforceCurrentConsent()}isArabicLocale(){return(Salla.lang.getLocale?.()??document.documentElement.lang??"ar").toLowerCase().startsWith("ar")}translate(s,e,t){const i=Salla.lang.get(s);return i&&i!==s?i:this.isArabicLocale()?e:t}loadTranslations(){this.titleLabel=this.translate("common.cookies.settings_title","تخصيص إعدادات ملفات تعريف الارتباط","Customize Cookie Preferences Settings"),this.saveLabel=this.translate("common.cookies.save","حفظ الخيارات","Save Options"),this.messageLabel=Salla.lang.get("common.cookies.message"),this.linkLabel=Salla.lang.get("common.cookies.link"),this.acceptLabel=this.translate("common.cookies.accept","قبول","Accept"),this.acceptAllLabel=this.translate("common.cookies.accept_all","قبول الكل","Accept All"),this.customizeLabel=this.translate("common.cookies.customize","تخصيص","Customize"),this.essentialTitleLabel=this.translate("common.cookies.categories.essential.title","ملفات تعريف الارتباط الضرورية","Essential Cookies"),this.essentialDescriptionLabel=this.translate("common.cookies.categories.essential.description","ضروريه لتشغيل الوظائف الأساسية للموقع الإلكتروني.","Required for the website's basic functions."),this.essentialBadgeLabel=this.translate("common.cookies.categories.essential.badge","إجباري","Required"),this.performanceTitleLabel=this.translate("common.cookies.categories.performance.title","ملفات تعريف الارتباط الخاصة بالأداء","Performance Cookies"),this.performanceDescriptionLabel=this.translate("common.cookies.categories.performance.description","تساعدنا في تحليل كيفية استخدامك للموقع وتحسين أدائه.","Help us analyze site usage and improve performance."),this.functionsTitleLabel=this.translate("common.cookies.categories.functions.title","ملفات تعريف الارتباط الوظيفية","Functional Cookies"),this.functionsDescriptionLabel=this.translate("common.cookies.categories.functions.description","تُتيح لك تجربة مخصصة وتفعيل ميزات متقدمة داخل الموقع.","Enable enhanced functionality and personalization."),this.adsTitleLabel=this.translate("common.cookies.categories.ads.title","ملفات تعريف الارتباط الإعلانية","Advertising Cookies"),this.adsDescriptionLabel=this.translate("common.cookies.categories.ads.description","تُستخدم لعرض محتوى تسويقي مخصص يناسب اهتماماتك.","Allow personalized content.")}componentDidLoad(){this.mobileQuery=window.matchMedia(`(max-width: ${this.mobileBreakpoint-1}px)`),this.isMobile=this.mobileQuery.matches,this.mobileQuery.addEventListener("change",this.mobileQueryHandler)}disconnectedCallback(){this.mobileQuery?.removeEventListener("change",this.mobileQueryHandler),Salla.event.off("salla-cookies-bar::open",this.openRequestedHandler),Salla.event.off("auth::logged.in",this.authLoggedInHandler),Salla.event.off("auth::logged.out",this.authLoggedOutHandler),this.unregisterAfterFetchMenuItemsHook?.(),this.unregisterAfterFetchMenuItemsHook=void 0}allCategoryKeys(){return[this.necessaryCookieKey,this.performanceCookieKey,this.functionalCookieKey,this.advertisingCookieKey]}writeLocalConsentCookies(s){for(const e of this.allCategoryKeys())Salla.cookie.set(e,String(e===this.necessaryCookieKey||s.includes(e)),this.consentCookieDays)}applyConsent(s){this.writeLocalConsentCookies(s),this.sweepDisabledCategoryCookies(s),Salla.config.isGuest()||Salla.api.request("account/data-privacy",{points:s},"post").catch((()=>{}))}currentConsentPoints(){return Salla.storage.get("cookies-consent")?this.allCategoryKeys().filter((s=>s===this.necessaryCookieKey||"true"===Salla.cookie.get(s))):null}enforceCurrentConsent(){const s=this.currentConsentPoints();s&&this.sweepDisabledCategoryCookies(s)}hydrateToggleState(){const s=this.currentConsentPoints();s&&(this.performanceEnabled=s.includes(this.performanceCookieKey),this.functionsEnabled=s.includes(this.functionalCookieKey),this.adsEnabled=s.includes(this.advertisingCookieKey))}clearLocalConsent(){for(const s of this.allCategoryKeys())Salla.cookie.remove(s);Salla.storage.remove("cookies-consent"),this.isVisible=!0}syncConsentAfterLogin(){const s=this.currentConsentPoints();s&&Salla.api.request("account/data-privacy",{points:s},"post").catch((()=>{}))}cookieNameMatchesPattern(s,e){return e.endsWith("*")?s.startsWith(e.slice(0,-1)):s===e}sweepDisabledCategoryCookies(s){const e=Object.keys(this.trackingCookiesByCategory).filter((e=>!s.includes(e)));if(!e.length)return;const t=e.flatMap((s=>this.trackingCookiesByCategory[s]));document.cookie.split(";").map((s=>s.split("=")[0].trim())).filter((s=>t.some((e=>this.cookieNameMatchesPattern(s,e))))).forEach((s=>Salla.cookie.remove(s)))}dismiss(s){this.isVisible=!1,Salla.event.emit(`salla-cookies-bar::${s}`),Salla.storage.set("cookies-consent",s)}savePreferences(){const s=[this.necessaryCookieKey];this.performanceEnabled&&s.push(this.performanceCookieKey),this.functionsEnabled&&s.push(this.functionalCookieKey),this.adsEnabled&&s.push(this.advertisingCookieKey),this.applyConsent(s),this.dismiss("accepted")}async accept(){return this.applyConsent(this.allCategoryKeys()),this.dismiss("accepted"),this.host}async reject(){return this.applyConsent([this.necessaryCookieKey]),this.dismiss("rejected"),this.host}async open(){return this.hydrateToggleState(),this.step="consent",this.isVisible=!0,this.host}openPreferences(){this.hydrateToggleState(),this.step="preferences"}isRtl(){return Salla.config.get("theme.is_rtl",!0)}appendCookiesSettingsLink(s){const e=Salla.config.get("store.features")?.includes("website-cookies");if(!e||!s?.withCookiePreferences||"footer"!==s?.source)return;const t="#cookies-settings",i=s?.menus.some((s=>s?.url===t));i||(s.menus=[...s.menus,{id:"cookies-settings",order:null,title:Salla.lang.get("common.cookies.settings"),url:t,target:"_self",is_by_form_builder:!1,children:[],image:null,callback:()=>Salla.event.emit("salla-cookies-bar::open")}])}renderToggle(s,t,i,o){return e("label",{class:{"s-toggle":!0,"s-toggle--disabled":t}},e("input",{class:"s-toggle-input",type:"checkbox",checked:s,disabled:t,"aria-label":i,onChange:()=>o?.()}),e("div",{class:"s-toggle-switcher"}))}renderCategory(s,t,i,o){return e("div",{class:"s-cookies-bar-category"},e("div",{class:"s-cookies-bar-category-content"},e("div",{class:"s-cookies-bar-category-title-row"},e("span",{class:"s-cookies-bar-category-title"},s),o&&e("span",{class:"s-cookies-bar-badge"},o)),e("p",{class:"s-cookies-bar-category-description m-0"},t)),i)}renderMessage(){return e("p",{class:"s-cookies-bar-message m-0"},this.messageLabel,Salla.config.get("policy_url")&&e("a",{href:Salla.config.get("policy_url"),target:"_blank",class:"s-cookies-bar-link text-primary ms-1"}," ",this.linkLabel))}renderConsentStep(){return e("div",{class:"s-cookies-bar-consent"},this.renderMessage(),e("div",{class:"s-cookies-bar-consent-actions"},e("salla-button",{class:"s-cookies-bar-btn--customize",color:"primary",fill:"outline",type:"button",size:this.isMobile?"small":"medium",onClick:()=>this.openPreferences()},this.customizeLabel),e("salla-button",{class:"s-cookies-bar-btn--accept",color:"primary",fill:"solid",type:"button",size:this.isMobile?"small":"medium",onClick:()=>this.accept()},this.acceptAllLabel)))}renderPreferencesStep(){return e("div",null,e("div",{class:"s-cookies-bar-header"},e("h3",{class:"s-cookies-bar-title m-0"},this.titleLabel),e("button",{type:"button",class:"s-cookies-bar-close","aria-label":this.titleLabel,onClick:()=>this.reject()},e("span",{innerHTML:o}))),e("div",{class:"s-cookies-bar-categories"},this.renderCategory(this.essentialTitleLabel,this.essentialDescriptionLabel,this.renderToggle(!0,!0,this.essentialTitleLabel),this.essentialBadgeLabel),this.renderCategory(this.performanceTitleLabel,this.performanceDescriptionLabel,this.renderToggle(this.performanceEnabled,!1,this.performanceTitleLabel,(()=>this.performanceEnabled=!this.performanceEnabled))),this.renderCategory(this.functionsTitleLabel,this.functionsDescriptionLabel,this.renderToggle(this.functionsEnabled,!1,this.functionsTitleLabel,(()=>this.functionsEnabled=!this.functionsEnabled))),this.renderCategory(this.adsTitleLabel,this.adsDescriptionLabel,this.renderToggle(this.adsEnabled,!1,this.adsTitleLabel,(()=>this.adsEnabled=!this.adsEnabled)))),e("div",{class:"s-cookies-bar-footer"},this.renderMessage(),e("salla-button",{class:"s-cookies-bar-btn--save",color:"primary",fill:"solid",type:"button",size:this.isMobile?"small":"medium",onClick:()=>this.savePreferences()},this.saveLabel)))}render(){return this.isVisible?e(t,null,e("div",{dir:this.isRtl()?"rtl":"ltr",class:"s-cookies-bar"},"consent"===this.step?this.renderConsentStep():this.renderPreferencesStep())):e(t,null)}get host(){return i(this)}};a.style='/*!twlt*/:host{display:block;overflow:visible}.s-cookies-bar{position:fixed;bottom:1rem;left:50%;transform:translateX(-50%);z-index:100;background-color:#fff;border-radius:1rem;padding:1.25rem;width:calc(100% - 2rem);max-width:48rem;box-shadow:0 10px 30px -5px rgba(0, 0, 0, 0.2)}.s-cookies-bar-consent{display:flex;flex-direction:row;align-items:center;gap:1rem;flex-wrap:wrap}@media (max-width: 640px){.s-cookies-bar-consent{flex-direction:column;align-items:end}}.s-cookies-bar-consent-actions{display:flex;align-items:center;gap:0.75rem;flex-shrink:0}.s-cookies-bar-header{display:flex;align-items:center;justify-content:space-between;gap:1rem;margin-bottom:1.25rem}.s-cookies-bar-title{font-size:1rem;font-weight:bold;color:#1f2937}.s-cookies-bar-close{display:inline-flex;align-items:center;justify-content:center;width:2rem;height:2rem;padding:0;border:none;background:transparent;cursor:pointer;flex-shrink:0}.s-cookies-bar-close svg{width:1.125rem;height:1.125rem;fill:currentColor}.s-cookies-bar-close:hover{color:#4b5563}.s-cookies-bar-categories{display:flex;flex-direction:column;gap:1rem}.s-cookies-bar-category{display:flex;align-items:flex-start;justify-content:space-between;gap:1rem}.s-cookies-bar-category .s-toggle{flex-shrink:0}.s-cookies-bar-category .s-toggle--disabled{cursor:not-allowed}.s-cookies-bar-category-title-row{display:flex;align-items:center;gap:0.5rem}.s-cookies-bar-category-title{font-size:0.875rem;font-weight:500;color:#1f2937}.s-cookies-bar-category-description{font-size:0.75rem;color:#9ca3af;margin-top:0.25rem}.s-cookies-bar-badge{display:inline-flex;align-items:center;padding:0.0625rem 0.5rem;border-radius:9999px;background-color:#f3f4f6;color:#6b7280;font-size:0.6875rem;font-weight:500;white-space:nowrap}.s-cookies-bar-footer{display:flex;align-items:center;gap:0.75rem;margin-top:1.25rem;padding-top:1.25rem;border-top:1px solid #e5e7eb}.s-cookies-bar-message{flex:1;font-size:0.75rem;line-height:1.625;font-weight:700}.s-cookies-bar-btn--save{flex-shrink:0}.visible{visibility:visible}.invisible{visibility:hidden}.m-0{margin:0px}.ms-1{margin-inline-start:0.25rem}.resize{resize:both}.text-primary{color:var(--color-primary)}.shadow{--tw-shadow:0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}.outline{outline-style:solid}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.toggle-checkbox .s-toggle-input{position:absolute;visibility:hidden}.toggle-checkbox .s-toggle-switcher{display:inline-block;background:#ccc;border-radius:16px;width:40px;height:25px;position:relative;vertical-align:middle;transition:background 0.25s}.toggle-checkbox .s-toggle-switcher:before,.toggle-checkbox .s-toggle-switcher:after{content:""}.toggle-checkbox .s-toggle-switcher:before{display:block;background:#fff;border-radius:50%;box-shadow:0 0 0 1px rgba(0,0,0,0.25);width:20px;height:21px;position:absolute;top:2.2px;left:1px;transition:left 0.25s}.toggle-checkbox .s-toggle-input:checked+div{background:#30D158}.toggle-checkbox .s-toggle-input:checked+div:before{left:18px}.s-toggle{cursor:pointer;display:inline-block}.s-toggle .s-toggle-input{position:absolute;visibility:hidden}.s-toggle .s-toggle-label{margin-left:5px;position:relative;top:2px}.s-toggle .s-toggle-switcher{display:inline-block;background:#ccc;border-radius:16px;width:40px;height:25px;position:relative;vertical-align:middle;transition:background 0.25s}.s-toggle .s-toggle-switcher:before,.s-toggle .s-toggle-switcher:after{content:""}.s-toggle .s-toggle-switcher:before{display:block;background:#fff;border-radius:50%;box-shadow:0 0 0 1px rgba(0,0,0,0.25);width:20px;height:21px;position:absolute;top:2.2px;left:1px;transition:left 0.25s}.s-toggle .s-toggle-input:checked+div{background:#30D158}.s-toggle .s-toggle-input:checked+div:before{left:18px}';export{a as salla_cookies_bar}
|
|
4
|
+
import{r as s,h as e,H as t,a as i}from"./p-BtdIfJF8.js";import{C as o}from"./p-BsLF_HK7.js";const a=class{constructor(e){s(this,e),this.isVisible=!0,this.step="consent",this.isMobile=!1,this.mobileBreakpoint=768,this.mobileQueryHandler=s=>this.isMobile=s.matches,this.openRequestedHandler=()=>this.open(),this.authLoggedInHandler=()=>this.syncConsentAfterLogin(),this.authLoggedOutHandler=()=>this.clearLocalConsent(),this.necessaryCookieKey="necessary_cookies",this.performanceCookieKey="performance_cookies",this.functionalCookieKey="functional_cookies",this.advertisingCookieKey="advertising_cookies",this.consentCookieDays=365,this.trackingCookiesByCategory={performance_cookies:["_ga","_ga_*","_gid","_gat","_gat_gtag_*","_hjSessionUser_*","_hjSession_*","_hjIncludedInSessionSample_*","_hjAbsoluteSessionInProgress","_hjFirstSeen","_clck","_clsk","MUID","MR","ANONCHK","_ym_uid","_ym_d","_ym_isad"],advertising_cookies:["_gcl_au","_gcl_aw","_gcl_dc","IDE","test_cookie","1P_JAR","NID","_fbp","_fbc","fr","_ttp","_scid","sc_at","personalization_id","guest_id","muc_ads","_pin_unauth","_pinterest_ct_ua","li_sugr","bcookie","lidc","UserMatchHistory","AnalyticsSyncHistory"],functional_cookies:["intercom-id-*","intercom-session-*","__zlcmid","crisp-client%2Fsession%2F*","YSC","VISITOR_INFO1_LIVE","PREF"]},this.performanceEnabled=!1,this.functionsEnabled=!1,this.adsEnabled=!1}async componentWillLoad(){await Salla.onReady(),await Salla.lang.onLoaded(),this.loadTranslations(),Salla.event.on("salla-cookies-bar::open",this.openRequestedHandler),Salla.event.on("auth::logged.in",this.authLoggedInHandler),Salla.event.on("auth::logged.out",this.authLoggedOutHandler),this.unregisterAfterFetchMenuItemsHook=Salla.hooks.registerHook("salla-menu","afterFetchMenuItems",(s=>this.appendCookiesSettingsLink(s))),this.hydrateToggleState(),Salla.storage.get("cookies-consent")&&(this.isVisible=!1),this.enforceCurrentConsent()}isArabicLocale(){return(Salla.lang.getLocale?.()??document.documentElement.lang??"ar").toLowerCase().startsWith("ar")}translate(s,e,t){const i=Salla.lang.get(s);return i&&i!==s?i:this.isArabicLocale()?e:t}loadTranslations(){this.titleLabel=this.translate("common.cookies.settings_title","تخصيص إعدادات ملفات تعريف الارتباط","Customize Cookie Preferences Settings"),this.saveLabel=this.translate("common.cookies.save","حفظ الخيارات","Save Options"),this.messageLabel=Salla.lang.get("common.cookies.message"),this.linkLabel=Salla.lang.get("common.cookies.link"),this.acceptLabel=this.translate("common.cookies.accept","قبول","Accept"),this.acceptAllLabel=this.translate("common.cookies.accept_all","قبول الكل","Accept All"),this.customizeLabel=this.translate("common.cookies.customize","تخصيص","Customize"),this.essentialTitleLabel=this.translate("common.cookies.categories.essential.title","ملفات تعريف الارتباط الضرورية","Essential Cookies"),this.essentialDescriptionLabel=this.translate("common.cookies.categories.essential.description","ضروريه لتشغيل الوظائف الأساسية للموقع الإلكتروني.","Required for the website's basic functions."),this.essentialBadgeLabel=this.translate("common.cookies.categories.essential.badge","إجباري","Required"),this.performanceTitleLabel=this.translate("common.cookies.categories.performance.title","ملفات تعريف الارتباط الخاصة بالأداء","Performance Cookies"),this.performanceDescriptionLabel=this.translate("common.cookies.categories.performance.description","تساعدنا في تحليل كيفية استخدامك للموقع وتحسين أدائه.","Help us analyze site usage and improve performance."),this.functionsTitleLabel=this.translate("common.cookies.categories.functions.title","ملفات تعريف الارتباط الوظيفية","Functional Cookies"),this.functionsDescriptionLabel=this.translate("common.cookies.categories.functions.description","تُتيح لك تجربة مخصصة وتفعيل ميزات متقدمة داخل الموقع.","Enable enhanced functionality and personalization."),this.adsTitleLabel=this.translate("common.cookies.categories.ads.title","ملفات تعريف الارتباط الإعلانية","Advertising Cookies"),this.adsDescriptionLabel=this.translate("common.cookies.categories.ads.description","تُستخدم لعرض محتوى تسويقي مخصص يناسب اهتماماتك.","Allow personalized content.")}componentDidLoad(){this.mobileQuery=window.matchMedia(`(max-width: ${this.mobileBreakpoint-1}px)`),this.isMobile=this.mobileQuery.matches,this.mobileQuery.addEventListener("change",this.mobileQueryHandler)}disconnectedCallback(){this.mobileQuery?.removeEventListener("change",this.mobileQueryHandler),Salla.event.off("salla-cookies-bar::open",this.openRequestedHandler),Salla.event.off("auth::logged.in",this.authLoggedInHandler),Salla.event.off("auth::logged.out",this.authLoggedOutHandler),this.unregisterAfterFetchMenuItemsHook?.(),this.unregisterAfterFetchMenuItemsHook=void 0}allCategoryKeys(){return[this.necessaryCookieKey,this.performanceCookieKey,this.functionalCookieKey,this.advertisingCookieKey]}writeLocalConsentCookies(s){for(const e of this.allCategoryKeys())Salla.cookie.set(e,String(e===this.necessaryCookieKey||s.includes(e)),this.consentCookieDays)}applyConsent(s){this.writeLocalConsentCookies(s),this.sweepDisabledCategoryCookies(s),Salla.config.isGuest()||Salla.api.request("account/data-privacy",{points:s},"post").catch((()=>{}))}currentConsentPoints(){return Salla.storage.get("cookies-consent")?this.allCategoryKeys().filter((s=>s===this.necessaryCookieKey||"true"===Salla.cookie.get(s))):null}enforceCurrentConsent(){const s=this.currentConsentPoints();s&&this.sweepDisabledCategoryCookies(s)}hydrateToggleState(){const s=this.currentConsentPoints();s&&(this.performanceEnabled=s.includes(this.performanceCookieKey),this.functionsEnabled=s.includes(this.functionalCookieKey),this.adsEnabled=s.includes(this.advertisingCookieKey))}clearLocalConsent(){for(const s of this.allCategoryKeys())Salla.cookie.remove(s);Salla.storage.remove("cookies-consent"),this.isVisible=!0}syncConsentAfterLogin(){const s=this.currentConsentPoints();s&&Salla.api.request("account/data-privacy",{points:s},"post").catch((()=>{}))}cookieNameMatchesPattern(s,e){return e.endsWith("*")?s.startsWith(e.slice(0,-1)):s===e}sweepDisabledCategoryCookies(s){const e=Object.keys(this.trackingCookiesByCategory).filter((e=>!s.includes(e)));if(!e.length)return;const t=e.flatMap((s=>this.trackingCookiesByCategory[s]));document.cookie.split(";").map((s=>s.split("=")[0].trim())).filter((s=>t.some((e=>this.cookieNameMatchesPattern(s,e))))).forEach((s=>Salla.cookie.remove(s)))}dismiss(s){this.isVisible=!1,Salla.event.emit(`salla-cookies-bar::${s}`),Salla.storage.set("cookies-consent",s)}savePreferences(){const s=[this.necessaryCookieKey];this.performanceEnabled&&s.push(this.performanceCookieKey),this.functionsEnabled&&s.push(this.functionalCookieKey),this.adsEnabled&&s.push(this.advertisingCookieKey),this.applyConsent(s),this.dismiss("accepted")}async accept(){return this.applyConsent(this.allCategoryKeys()),this.dismiss("accepted"),this.host}async reject(){return this.applyConsent([this.necessaryCookieKey]),this.dismiss("rejected"),this.host}async open(){return this.hydrateToggleState(),this.step="consent",this.isVisible=!0,this.host}openPreferences(){this.hydrateToggleState(),this.step="preferences"}isRtl(){return Salla.config.get("theme.is_rtl",!0)}appendCookiesSettingsLink(s){const e=Salla.config.get("store.features")?.includes("website-cookies");if(!e||!s?.withCookiePreferences||"footer"!==s?.source)return;const t="#cookies-settings",i=s?.menus.some((s=>s?.url===t));i||(s.menus=[...s.menus,{id:"cookies-settings",order:null,title:Salla.lang.get("common.cookies.settings"),url:t,target:"_self",is_by_form_builder:!1,children:[],image:null,callback:()=>Salla.event.emit("salla-cookies-bar::open")}])}renderToggle(s,t,i,o){return e("label",{class:{"s-toggle":!0,"s-toggle--disabled":t}},e("input",{class:"s-toggle-input",type:"checkbox",checked:s,disabled:t,"aria-label":i,onChange:()=>o?.()}),e("div",{class:"s-toggle-switcher"}))}renderCategory(s,t,i,o){return e("div",{class:"s-cookies-bar-category"},e("div",{class:"s-cookies-bar-category-content"},e("div",{class:"s-cookies-bar-category-title-row"},e("span",{class:"s-cookies-bar-category-title"},s),o&&e("span",{class:"s-cookies-bar-badge"},o)),e("p",{class:"s-cookies-bar-category-description m-0"},t)),i)}renderMessage(){return e("p",{class:"s-cookies-bar-message m-0"},this.messageLabel,Salla.config.get("policy_url")&&e("a",{href:Salla.config.get("policy_url"),target:"_blank",class:"s-cookies-bar-link text-primary ms-1"}," ",this.linkLabel))}renderConsentStep(){return e("div",{class:"s-cookies-bar-consent"},this.renderMessage(),e("div",{class:"s-cookies-bar-consent-actions"},e("salla-button",{class:"s-cookies-bar-btn--customize",color:"primary",fill:"outline",type:"button",size:this.isMobile?"small":"medium",onClick:()=>this.openPreferences()},this.customizeLabel),e("salla-button",{class:"s-cookies-bar-btn--accept",color:"primary",fill:"solid",type:"button",size:this.isMobile?"small":"medium",onClick:()=>this.accept()},this.acceptAllLabel)))}renderPreferencesStep(){return e("div",null,e("div",{class:"s-cookies-bar-header"},e("h3",{class:"s-cookies-bar-title m-0"},this.titleLabel),e("button",{type:"button",class:"s-cookies-bar-close","aria-label":this.titleLabel,onClick:()=>this.reject()},e("span",{innerHTML:o}))),e("div",{class:"s-cookies-bar-categories"},this.renderCategory(this.essentialTitleLabel,this.essentialDescriptionLabel,this.renderToggle(!0,!0,this.essentialTitleLabel),this.essentialBadgeLabel),this.renderCategory(this.performanceTitleLabel,this.performanceDescriptionLabel,this.renderToggle(this.performanceEnabled,!1,this.performanceTitleLabel,(()=>this.performanceEnabled=!this.performanceEnabled))),this.renderCategory(this.functionsTitleLabel,this.functionsDescriptionLabel,this.renderToggle(this.functionsEnabled,!1,this.functionsTitleLabel,(()=>this.functionsEnabled=!this.functionsEnabled))),this.renderCategory(this.adsTitleLabel,this.adsDescriptionLabel,this.renderToggle(this.adsEnabled,!1,this.adsTitleLabel,(()=>this.adsEnabled=!this.adsEnabled)))),e("div",{class:"s-cookies-bar-footer"},this.renderMessage(),e("salla-button",{class:"s-cookies-bar-btn--save",color:"primary",fill:"solid",type:"button",size:this.isMobile?"small":"medium",onClick:()=>this.savePreferences()},this.saveLabel)))}render(){return this.isVisible?e(t,null,e("div",{dir:this.isRtl()?"rtl":"ltr",class:"s-cookies-bar"},"consent"===this.step?this.renderConsentStep():this.renderPreferencesStep())):e(t,null)}get host(){return i(this)}};a.style='/*!twlt*/:host{display:block;overflow:visible}.s-cookies-bar{position:fixed;bottom:1rem;left:50%;transform:translateX(-50%);z-index:100;background-color:#fff;border-radius:1rem;padding:1.25rem;width:calc(100% - 2rem);max-width:48rem;box-shadow:0 10px 30px -5px rgba(0, 0, 0, 0.2)}.s-cookies-bar-consent{display:flex;flex-direction:row;align-items:center;gap:1rem;flex-wrap:wrap}@media (max-width: 640px){.s-cookies-bar-consent{flex-direction:column;align-items:end}}.s-cookies-bar-consent-actions{display:flex;align-items:center;gap:0.75rem;flex-shrink:0}.s-cookies-bar-header{display:flex;align-items:center;justify-content:space-between;gap:1rem;margin-bottom:1.25rem}.s-cookies-bar-title{font-size:1rem;font-weight:bold;color:#1f2937}.s-cookies-bar-close{display:inline-flex;align-items:center;justify-content:center;width:2rem;height:2rem;padding:0;border:none;background:transparent;cursor:pointer;flex-shrink:0}.s-cookies-bar-close svg{width:1.125rem;height:1.125rem;fill:currentColor}.s-cookies-bar-close:hover{color:#4b5563}.s-cookies-bar-categories{display:flex;flex-direction:column;gap:1rem}.s-cookies-bar-category{display:flex;align-items:flex-start;justify-content:space-between;gap:1rem}.s-cookies-bar-category .s-toggle{flex-shrink:0}.s-cookies-bar-category .s-toggle--disabled{cursor:not-allowed}.s-cookies-bar-category-title-row{display:flex;align-items:center;gap:0.5rem}.s-cookies-bar-category-title{font-size:0.875rem;font-weight:500;color:#1f2937}.s-cookies-bar-category-description{font-size:0.75rem;color:#9ca3af;margin-top:0.25rem}.s-cookies-bar-badge{display:inline-flex;align-items:center;padding:0.0625rem 0.5rem;border-radius:9999px;background-color:#f3f4f6;color:#6b7280;font-size:0.6875rem;font-weight:500;white-space:nowrap}.s-cookies-bar-footer{display:flex;align-items:center;gap:0.75rem;margin-top:1.25rem;padding-top:1.25rem;border-top:1px solid #e5e7eb}.s-cookies-bar-message{flex:1;font-size:0.75rem;line-height:1.625;font-weight:700}.s-cookies-bar-btn--save{flex-shrink:0}.visible{visibility:visible}.invisible{visibility:hidden}.m-0{margin:0px}.ms-1{margin-inline-start:0.25rem}.resize{resize:both}.text-primary{color:var(--color-primary)}.shadow{--tw-shadow:0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}.outline{outline-style:solid}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.toggle-checkbox .s-toggle-input{position:absolute;visibility:hidden}.toggle-checkbox .s-toggle-switcher{display:inline-block;background:#ccc;border-radius:16px;width:40px;height:25px;position:relative;vertical-align:middle;transition:background 0.25s}.toggle-checkbox .s-toggle-switcher:before,.toggle-checkbox .s-toggle-switcher:after{content:""}.toggle-checkbox .s-toggle-switcher:before{display:block;background:#fff;border-radius:50%;box-shadow:0 0 0 1px rgba(0,0,0,0.25);width:20px;height:21px;position:absolute;top:2.2px;left:1px;transition:left 0.25s}.toggle-checkbox .s-toggle-input:checked+div{background:#30D158}.toggle-checkbox .s-toggle-input:checked+div:before{left:18px}.s-toggle{cursor:pointer;display:inline-block}.s-toggle .s-toggle-input{position:absolute;visibility:hidden}.s-toggle .s-toggle-label{margin-left:5px;position:relative;top:2px}.s-toggle .s-toggle-switcher{display:inline-block;background:#ccc;border-radius:16px;width:40px;height:25px;position:relative;vertical-align:middle;transition:background 0.25s}.s-toggle .s-toggle-switcher:before,.s-toggle .s-toggle-switcher:after{content:""}.s-toggle .s-toggle-switcher:before{display:block;background:#fff;border-radius:50%;box-shadow:0 0 0 1px rgba(0,0,0,0.25);width:20px;height:21px;position:absolute;top:2.2px;left:1px;transition:left 0.25s}.s-toggle .s-toggle-input:checked+div{background:#30D158}.s-toggle .s-toggle-input:checked+div:before{left:18px}';export{a as salla_cookies_bar}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as e,h as t,a as o}from"./p-AYwDRYpw.js";import{t as r}from"./p-CrSV-tno.js";import{S as i}from"./p-Ctkfc4K-.js";import{T as a,C as l}from"./p-DRvZV5oe.js";const s=class{constructor(t){e(this,t),this.offer=null,this.hasError=!1,this.translationLoaded=!1,this.addToCartLabel=salla.lang.get("pages.cart.add_to_cart"),salla.event.on("offer-modal::open",(e=>this.open(e))),salla.lang.onLoaded((()=>{this.addToCartLabel=salla.lang.get("pages.cart.add_to_cart"),this.translationLoaded=!0})),this.categorySlot=this.host.querySelector('[slot="category"]')?.innerHTML||'<span class="s-offer-modal-badge-icon">{tagIcon}</span><span class="s-offer-modal-badge-text">{name}</span>',salla.event.on("offer-modal::open",(e=>this.open(e))),salla.product.event.onOfferExisted((e=>{salla.storage.get("remember-offer-"+e.id)?salla.log("User selected to don't show this offer again."):this.open(e.product_id)}))}emitPromotionViewed(e){e&&salla.event.emit("promotion::viewed",[{id:e.id?.toString(),creative:e.message,name:e.name,position:`${this.offer_type}_offer_modal`}])}emitPromotionClicked(e){e&&salla.event.emit("promotion::clicked",[{id:e.id?.toString(),creative:e.message,name:e.name,position:`${this.offer_type}_offer_modal`}])}async open(e){return this.productID=e,this.hasError=!1,this.modal.loading(),await salla.api.withoutNotifier((()=>salla.product.offers(e))).then((e=>{e.data&&e.data.length&&(this.modal.open(),this.showOffer(e.data[0]))})).catch((e=>{this.hasError=!0,this.errorMessage=e.response?.data?.error?.message||e.response?.data,this.modal.open()})).finally((()=>{this.modal.visible&&setTimeout((()=>this.modal.stopLoading()),1e3)}))}async showOffer(e){this.offer=e,this.offer_name=e.name,this.offer_message=e.message,this.offer.get.discounts_table?this.offer_type="discounts-table":this.offer.get.products?.length?this.offer_type="products":this.offer.get.categories?.length?this.offer_type="categories":this.offer.get.brands?.length?this.offer_type="brands":this.offer.get.tags?.length&&(this.offer_type="tags"),this.modal.setTitle(this.offer_name),this.emitPromotionViewed(this.offer)}rememberMe(e){salla.storage.set("remember-offer-"+this.offer.id,e.target.checked)}addToCart(e){this.emitPromotionClicked(this.offer),salla.api.withoutNotifier((()=>salla.cart.quickAdd(this.productID,e,this.offer_type))).then((()=>this.modal.close()))}getOfferConditions(){const e=this.offer.buy||{},o=this.offer.get||{},i=this.offer.branches||[],a=e.payment_methods||[],l=e.min_amount>0,s=e.min_items>0,d=o.max_discount_amount>0;return l||s||d||a.length||i.length?t("div",{class:"s-offer-modal-conditions"},l&&t("p",{class:"s-offer-modal-condition",innerHTML:r("pages.offer.min_spend_amount",{amount:salla.money(e.min_amount),currency:""},`بحد أدنى ${salla.money(e.min_amount)} من مبلغ الشراء`)}),s&&t("p",{class:"s-offer-modal-condition"},r("pages.offer.min_items",{items:e.min_items},`بحد أدنى ${e.min_items} منتجات`)),d&&t("p",{class:"s-offer-modal-condition",innerHTML:r("pages.offer.max_discount_amount",{amount:salla.money(o.max_discount_amount),currency:""},`بحد أقصى ${salla.money(o.max_discount_amount)} للخصم`)}),!!a.length&&t("div",{class:"s-offer-modal-condition-group"},t("span",{class:"s-offer-modal-condition-label"},r("pages.offer.payment_methods",{},"طرق الدفع")),t("div",{class:"s-offer-modal-condition-items"},a.map((e=>t("span",{class:"s-offer-modal-badge-text"},e.name))))),!!i.length&&t("div",{class:"s-offer-modal-condition-group"},t("span",{class:"s-offer-modal-condition-label"},r("pages.offer.available_branches",{},"الفروع المتاحة")),t("div",{class:"s-offer-modal-condition-items"},i.map((e=>t("span",{class:"s-offer-modal-badge-text"},e.name)))))):null}getOfferContent(){if(this.offer.get.discounts_table)return t("div",{class:"s-offer-modal-discount-table"},t("table",null,t("tbody",null,this.offer.get.discounts_table?.map((e=>t("tr",null,t("td",null,e.text),t("td",{class:"s-offer-modal-discount-table-cell"},t("salla-button",{fill:"outline",shape:"btn",color:"primary",size:"medium",width:"normal",onClick:()=>this.addToCart(e.quantity)},this.addToCartLabel))))))));if(this.offer.get.products?.length){const e=this.offer.get.products?.length||0,o={slidesPerView:"auto",spaceBetween:16,breakpoints:{768:{slidesPerView:Math.min(2,e),spaceBetween:16},1024:{slidesPerView:Math.min(3,e),spaceBetween:16}}};return t("salla-products-slider",{key:(this.offer.get.products?.map((e=>e.id))||[]).join(","),source:"selected","source-value":`[${(this.offer.get.products?.map((e=>e.id))||[]).join(",")}]`,"slider-config":JSON.stringify(o)})}return this.offer.get.categories?.length?t("salla-slider",{type:"carousel",class:{"s-offer-modal-slider-centered":this.offer.get.categories?.length<=2,"s-offer-modal-slider":!0},id:"offer-modal-slider","controls-outer":!0,"show-controls":this.offer.get.categories?.length<=2?"false":"true"},t("div",{slot:"items"},this.offer.get.categories.map((e=>t("a",{href:e.urls.customer,class:"s-offer-modal-badge s-offer-modal-slider-item s-offer-modal-cat-item",innerHTML:this.categorySlot.replace(/\{tagIcon\}/g,a).replace(/\{name\}/g,e.name).replace(/\{url\}/g,e.urls.customer)}))))):this.offer.get.brands?.length?t("salla-slider",{type:"carousel",class:{"s-offer-modal-slider-centered":this.offer.get.brands?.length<=2,"s-offer-modal-slider":!0},id:"offer-modal-slider","controls-outer":!0,"show-controls":this.offer.get.brands?.length<=2?"false":"true"},t("div",{slot:"items"},this.offer.get.brands.map((e=>t("a",{href:e.url||salla.url.create("brands",e.id),class:"s-offer-modal-badge s-offer-modal-slider-item s-offer-modal-brand-item"},t("div",{class:"s-offer-modal-brand-logo"},t("img",{src:e.logo,alt:e.name})),t("span",{class:"s-offer-modal-badge-text"},e.name)))))):this.offer.get.tags?.length?t("salla-slider",{type:"carousel",class:{"s-offer-modal-slider-centered":this.offer.get.tags?.length<=2,"s-offer-modal-slider":!0},id:"offer-modal-slider","controls-outer":!0,"show-controls":this.offer.get.tags?.length<=2?"false":"true"},t("div",{slot:"items"},this.offer.get.tags.map((e=>t("a",{href:e.url||salla.url.create("tags",e.id),class:"s-offer-modal-badge s-offer-modal-slider-item s-offer-modal-tag-item"},t("span",{class:"s-offer-modal-badge-icon",innerHTML:a}),t("span",{class:"s-offer-modal-badge-text"},e.name)))))):void 0}render(){return t("salla-modal",{key:"b41e4389d7bd3ba89f7cfd10d9e2e7a8ddafbb3d","has-skeleton":!0,"sub-title":this.offer_message,ref:e=>this.modal=e,isLoading:!0,class:`s-offer-modal-type-${this.offer_type?this.offer_type:""}`},t("div",{key:"2beaa53d150ba7d17e1d66d6f5a5619ff03dd7f8",slot:"loading"},t("div",{key:"6a35aa5676449dd74ed50e48ee62fe3dc604eb82",class:"s-offer-modal-skeleton"},t("div",{key:"eb0458bbe6bef1c7931ef1b29c7831b6fdd8cf94",class:"s-offer-modal-skeleton-header"},t("salla-skeleton",{key:"ba0dfd74e0e279633fbfa1536a1232f7b88d09c4",type:"circle",height:"80px",width:"80px"}),t("salla-skeleton",{key:"41a501b4179488e1346a12aaf76407dfeeaa233b",height:"15px",width:"50%"}),t("salla-skeleton",{key:"60e56666921a9a1e28d070ee26864c3df488cdfb",height:"10px",width:"30%"})),t("div",{key:"7079a1b0d16c373004fc2abd7e3240349061975f",class:"s-offer-modal-skeleton-items"},[...Array(3)].map((()=>t("div",{class:"s-offer-modal-skeleton-item"},t("salla-skeleton",{height:"9rem"}),t("div",{class:"s-offer-modal-skeleton-item-title"},t("salla-skeleton",{height:"15px",width:"100%"})),t("div",{class:"s-offer-modal-skeleton-item-subtitle"},t("salla-skeleton",{height:"9px",width:"50%"}),t("div",{innerHTML:l})))))),t("div",{key:"63dda9415de1c0eacced5a1135bc6193290106c7",class:"s-offer-modal-skeleton-footer"},t("salla-skeleton",{key:"4e39d82ff6e2145f5a651747423c86929b703f6f",height:"15px",width:"50%"}),t("salla-skeleton",{key:"55115403e6710254d6f8637f05ce3f8733f7101b",height:"15px",width:"30%"})))),this.hasError||null===this.offer?t("salla-placeholder",{class:"s-loyalty-placeholder",alignment:"center"},this.errorMessage?t("span",{slot:"description"},this.errorMessage):""):[t("span",{slot:"icon",class:"s-offer-modal-header-icon",innerHTML:i}),this.getOfferContent(),this.getOfferConditions(),t("div",{class:"s-offer-modal-footer",slot:"footer"},this.offer.formatted_date?t("p",{class:"s-offer-modal-expiry"},salla.lang.get("pages.products.offer_expires_in")," ",this.offer.formatted_date):"",t("label",{class:"s-offer-modal-remember-label"},t("input",{type:"checkbox",onChange:e=>this.rememberMe(e),class:"s-offer-modal-remember-input"})," ",salla.lang.get("common.elements.remember_my_choice")))])}get host(){return o(this)}};s.style='/*!twlt*/.s-offer-modal-type-products .s-modal-body{min-height:690px;position:relative}.visible{visibility:visible}.table{display:table}.outline{outline-style:solid}.s-loyalty-placeholder{display:flex;align-items:center;justify-content:center}.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}.s-modal-header{flex-direction:column}.s-offer-modal-body{display:flex;overflow-x:auto;margin-left:-32px;margin-right:-32px;padding-left:32px;padding-right:32px;gap:24px;padding-bottom:32px;-webkit-overflow-scrolling:touch}.s-offer-modal-body::-webkit-scrollbar{display:none}.s-offer-modal-badge{margin-bottom:0.625rem;display:inline-flex;align-items:center;justify-content:center;border-radius:1.5rem;--tw-bg-opacity:1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1));padding-top:0.625rem;padding-bottom:0.625rem;padding-left:1rem;padding-right:1rem;font-size:0.875rem;line-height:1.25rem;--tw-text-opacity:1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.s-offer-modal-badge:where([dir="ltr"],[dir="ltr"] *){margin-left:0.625rem}.s-offer-modal-badge:where([dir="rtl"],[dir="rtl"] *){margin-left:0.625rem}.s-offer-modal-badge-icon:where([dir="ltr"],[dir="ltr"] *){margin-left:0.375rem}.s-offer-modal-badge-icon:where([dir="rtl"],[dir="rtl"] *){margin-left:0.375rem}.s-offer-modal-badge-icon svg{margin-bottom:1rem;display:inline-block;height:1.5rem;width:1.5rem;fill:var(--color-primary)}.s-offer-modal-badge-text{font-size:0.875rem;line-height:1.25rem;font-weight:700}.s-offer-modal-cat-item.swiper-slide{margin-top:1rem;margin-bottom:1rem;display:flex;height:9rem;max-width:180px;flex-direction:column;align-items:center;justify-content:center;border-radius:0.375rem;border-width:1px;--tw-border-opacity:1;border-color:rgb(243 244 246 / var(--tw-border-opacity, 1));--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1));padding:0.75rem;text-align:center;--tw-text-opacity:1;color:rgb(156 163 175 / 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:500ms}.s-offer-modal-cat-item.swiper-slide:hover{--tw-text-opacity:1;color:rgb(107 114 128 / var(--tw-text-opacity, 1));--tw-shadow:0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);--tw-shadow-colored:0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}.s-offer-modal-brand-item.swiper-slide{margin-top:1rem;margin-bottom:1rem;display:flex;height:9rem;max-width:180px;flex-direction:column;align-items:center;justify-content:center;border-radius:0.375rem;border-width:1px;--tw-border-opacity:1;border-color:rgb(243 244 246 / var(--tw-border-opacity, 1));--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1));padding:0.75rem;text-align:center;--tw-text-opacity:1;color:rgb(156 163 175 / 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:500ms}.s-offer-modal-brand-item.swiper-slide:hover{--tw-text-opacity:1;color:rgb(107 114 128 / var(--tw-text-opacity, 1));--tw-shadow:0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);--tw-shadow-colored:0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}.s-offer-modal-brand-logo{margin-bottom:0.75rem;height:4rem;width:4rem;object-fit:contain}.s-offer-modal-brand-logo img{height:100%;width:100%;object-fit:contain}.s-offer-modal-tag-item.swiper-slide{margin-top:1rem;margin-bottom:1rem;display:flex;height:9rem;max-width:180px;flex-direction:column;align-items:center;justify-content:center;border-radius:0.375rem;border-width:1px;--tw-border-opacity:1;border-color:rgb(243 244 246 / var(--tw-border-opacity, 1));--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1));padding:0.75rem;text-align:center;--tw-text-opacity:1;color:rgb(156 163 175 / 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:500ms}.s-offer-modal-tag-item.swiper-slide:hover{--tw-text-opacity:1;color:rgb(107 114 128 / var(--tw-text-opacity, 1));--tw-shadow:0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);--tw-shadow-colored:0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}.s-offer-modal-product.swiper-slide{display:flex;width:70%;flex-shrink:0;flex-grow:1;flex-direction:column}@media (min-width: 640px){.s-offer-modal-product.swiper-slide{width:40%}}@media (min-width: 1024px){.s-offer-modal-product.swiper-slide{width:28%}}.s-offer-modal-product-image-wrap{position:relative;margin-bottom:1rem;display:block;height:8rem;overflow:hidden;border-radius:0.375rem;--tw-bg-opacity:1;background-color:rgb(249 250 251 / var(--tw-bg-opacity, 1))}.s-offer-modal-product-image{height:100%;width:100%;object-fit:cover}.s-offer-modal-not-available{--tw-grayscale:grayscale(100%);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.s-offer-modal-product-info{margin-bottom:1rem}.s-offer-modal-product-name{margin-bottom:0.375rem;display:inline-block;width:11rem;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:1rem;line-height:1.5rem;--tw-text-opacity:1;color:rgb(31 41 55 / var(--tw-text-opacity, 1));transition-property:color, background-color, border-color, text-decoration-color, fill, stroke;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms}.s-offer-modal-product-name:hover{color:var(--color-primary)}.s-offer-modal-product-price{margin-bottom:1.25rem;display:flex;width:100%;align-items:center;font-size:0.875rem;line-height:1.25rem;font-weight:700}@media (min-width: 768px){.s-offer-modal-product-price{margin-bottom:0px}}@media (min-width: 640px){.s-offer-modal-product-price:where([dir="ltr"],[dir="ltr"] *){margin-left:0.5rem}.s-offer-modal-product-price:where([dir="rtl"],[dir="rtl"] *){margin-right:0.5rem}}.s-offer-modal-product-sale-price{--tw-text-opacity:1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.s-offer-modal-product-old-price{margin-left:0.25rem;margin-right:0.25rem;font-size:0.75rem;line-height:1rem;--tw-text-opacity:1;color:rgb(156 163 175 / var(--tw-text-opacity, 1));text-decoration-line:line-through}.s-offer-modal-btn-wrap{margin-top:auto}.s-offer-modal-header-icon{display:inline-flex;height:4rem;width:4rem;flex-shrink:0;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-offer-modal-header-icon{margin-left:auto;margin-right:auto;margin-bottom:1rem;height:5rem;width:5rem}}.s-offer-modal-header-icon:where([dir="ltr"],[dir="ltr"] *){margin-right:0.5rem}@media (min-width: 640px){.s-offer-modal-header-icon:where([dir="ltr"],[dir="ltr"] *){margin-right:0px}}.s-offer-modal-header-icon:where([dir="rtl"],[dir="rtl"] *){margin-left:0.5rem}@media (min-width: 640px){.s-offer-modal-header-icon:where([dir="rtl"],[dir="rtl"] *){margin-left:0px}}.s-offer-modal-header-icon svg{height:1.75rem;width:1.75rem;flex-shrink:0;fill:#9ca3af}.s-offer-modal-footer{margin-top:1rem;display:flex;flex-direction:column;justify-content:space-between;font-size:0.875rem;line-height:1.25rem;--tw-text-opacity:1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}@media (min-width: 640px){.s-offer-modal-footer{margin-top:2rem;flex-direction:row}}.s-offer-modal-expiry{margin-bottom:1.25rem}@media (min-width: 768px){.s-offer-modal-expiry{margin-bottom:0px}}.s-offer-modal-remember-label{display:flex;cursor:pointer;font-size:0.875rem;line-height:1.25rem;font-weight:500;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-offer-modal-remember-label:hover{--tw-text-opacity:1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}@media (min-width: 640px){.s-offer-modal-remember-label:where([dir="ltr"],[dir="ltr"] *){margin-left:0.5rem}.s-offer-modal-remember-label:where([dir="rtl"],[dir="rtl"] *){margin-right:0.5rem}}.s-offer-modal-remember-input{height:1.5rem;width:1.5rem;border-radius:0.375rem;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1));color:var(--color-primary)}.s-offer-modal-remember-input:focus{--tw-ring-color:transparent}.s-offer-modal-slider-centered .swiper-wrapper{justify-content:center}.s-offer-modal-slider-centered .s-offer-modal-slider-item{display:flex;max-width:28%;flex-shrink:0;flex-grow:1;flex-direction:column}.s-offer-modal-skeleton{display:flex;flex-direction:column;align-items:center;justify-content:center}.s-offer-modal-skeleton-items{margin-top:1.5rem;margin-bottom:1.5rem;display:flex;width:100%;align-items:center}.s-offer-modal-skeleton-item{position:relative;margin-right:1.25rem;width:33.333333%;cursor:unset !important;text-align:center}.s-offer-modal-skeleton-item:last-child{margin-right:0px}.s-offer-modal-skeleton-item:where([dir="rtl"],[dir="rtl"] *){margin-right:0px;margin-left:1.25rem}.s-offer-modal-skeleton-item:last-child:where([dir="rtl"],[dir="rtl"] *){margin-left:0px}.s-offer-modal-skeleton-header{width:100%}.s-offer-modal-skeleton-header salla-skeleton{margin-left:auto;margin-right:auto}.s-offer-modal-skeleton-header salla-skeleton:nth-child(1){margin-bottom:1.25rem}.s-offer-modal-skeleton-header salla-skeleton:nth-child(2){margin-bottom:0.75rem}.s-offer-modal-skeleton-header salla-skeleton:nth-child(3){margin-bottom:1.25rem}.s-offer-modal-skeleton-item-subtitle{display:flex;width:100%;align-items:center;justify-content:space-between}.s-offer-modal-skeleton-item-subtitle div svg{height:1rem;width:1rem;fill:currentColor;--tw-text-opacity:1;color:rgb(209 213 219 / var(--tw-text-opacity, 1))}.s-offer-modal-skeleton-item-title{margin-top:0.75rem;margin-bottom:0.75rem}.s-offer-modal-skeleton-footer{margin-top:1.5rem;display:flex;width:100%;align-items:center;justify-content:space-between}.s-offer-modal-discount-table{width:100%;border-width:1px;--tw-border-opacity:1;border-color:rgb(238 238 238 / var(--tw-border-opacity, 1))}.s-offer-modal-discount-table table{width:100%;text-align:left;font-size:0.875rem;line-height:1.25rem;--tw-text-opacity:1;color:rgb(119 119 119 / var(--tw-text-opacity, 1))}.s-offer-modal-discount-table tr{border-bottom-width:1px;--tw-border-opacity:1;border-color:rgb(238 238 238 / var(--tw-border-opacity, 1));--tw-bg-opacity:1;background-color:rgb(252 252 252 / var(--tw-bg-opacity, 1))}.s-offer-modal-discount-table tr:last-child{border-bottom-width:0px}.s-offer-modal-discount-table tr td{padding-top:1rem;padding-bottom:1rem;padding-left:1.5rem;padding-right:1.5rem}.s-offer-modal-discount-table tr td:where([dir="rtl"],[dir="rtl"] *){text-align:right}.s-offer-modal-discount-table-cell{text-align:right}.s-offer-modal-discount-table-cell:where([dir="rtl"],[dir="rtl"] *){text-align:left !important}.s-offer-modal-type-discounts-table .s-modal-body{position:relative !important}.s-offer-modal-conditions{margin-top:1rem;display:flex;flex-direction:column;gap:0.5rem;text-align:center}.s-offer-modal-condition{font-size:13px;line-height:17px;--tw-text-opacity:1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.s-offer-modal-condition-group{display:flex;flex-direction:column;align-items:center;gap:0.25rem}.s-offer-modal-condition-label{font-size:13px;font-weight:700;--tw-text-opacity:1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.s-offer-modal-condition-items{display:flex;flex-wrap:wrap;justify-content:center;column-gap:0.75rem;row-gap:0.25rem}';export{s as salla_offer_modal}
|
|
4
|
+
import{r as e,h as t,a as o}from"./p-BtdIfJF8.js";import{t as r}from"./p-CrSV-tno.js";import{S as i}from"./p-Ctkfc4K-.js";import{T as a,C as l}from"./p-DRvZV5oe.js";const s=class{constructor(t){e(this,t),this.offer=null,this.hasError=!1,this.translationLoaded=!1,this.addToCartLabel=salla.lang.get("pages.cart.add_to_cart"),salla.event.on("offer-modal::open",(e=>this.open(e))),salla.lang.onLoaded((()=>{this.addToCartLabel=salla.lang.get("pages.cart.add_to_cart"),this.translationLoaded=!0})),this.categorySlot=this.host.querySelector('[slot="category"]')?.innerHTML||'<span class="s-offer-modal-badge-icon">{tagIcon}</span><span class="s-offer-modal-badge-text">{name}</span>',salla.event.on("offer-modal::open",(e=>this.open(e))),salla.product.event.onOfferExisted((e=>{salla.storage.get("remember-offer-"+e.id)?salla.log("User selected to don't show this offer again."):this.open(e.product_id)}))}emitPromotionViewed(e){e&&salla.event.emit("promotion::viewed",[{id:e.id?.toString(),creative:e.message,name:e.name,position:`${this.offer_type}_offer_modal`}])}emitPromotionClicked(e){e&&salla.event.emit("promotion::clicked",[{id:e.id?.toString(),creative:e.message,name:e.name,position:`${this.offer_type}_offer_modal`}])}async open(e){return this.productID=e,this.hasError=!1,this.modal.loading(),await salla.api.withoutNotifier((()=>salla.product.offers(e))).then((e=>{e.data&&e.data.length&&(this.modal.open(),this.showOffer(e.data[0]))})).catch((e=>{this.hasError=!0,this.errorMessage=e.response?.data?.error?.message||e.response?.data,this.modal.open()})).finally((()=>{this.modal.visible&&setTimeout((()=>this.modal.stopLoading()),1e3)}))}async showOffer(e){this.offer=e,this.offer_name=e.name,this.offer_message=e.message,this.offer.get.discounts_table?this.offer_type="discounts-table":this.offer.get.products?.length?this.offer_type="products":this.offer.get.categories?.length?this.offer_type="categories":this.offer.get.brands?.length?this.offer_type="brands":this.offer.get.tags?.length&&(this.offer_type="tags"),this.modal.setTitle(this.offer_name),this.emitPromotionViewed(this.offer)}rememberMe(e){salla.storage.set("remember-offer-"+this.offer.id,e.target.checked)}addToCart(e){this.emitPromotionClicked(this.offer),salla.api.withoutNotifier((()=>salla.cart.quickAdd(this.productID,e,this.offer_type))).then((()=>this.modal.close()))}getOfferConditions(){const e=this.offer.buy||{},o=this.offer.get||{},i=this.offer.branches||[],a=e.payment_methods||[],l=e.min_amount>0,s=e.min_items>0,d=o.max_discount_amount>0;return l||s||d||a.length||i.length?t("div",{class:"s-offer-modal-conditions"},l&&t("p",{class:"s-offer-modal-condition",innerHTML:r("pages.offer.min_spend_amount",{amount:salla.money(e.min_amount),currency:""},`بحد أدنى ${salla.money(e.min_amount)} من مبلغ الشراء`)}),s&&t("p",{class:"s-offer-modal-condition"},r("pages.offer.min_items",{items:e.min_items},`بحد أدنى ${e.min_items} منتجات`)),d&&t("p",{class:"s-offer-modal-condition",innerHTML:r("pages.offer.max_discount_amount",{amount:salla.money(o.max_discount_amount),currency:""},`بحد أقصى ${salla.money(o.max_discount_amount)} للخصم`)}),!!a.length&&t("div",{class:"s-offer-modal-condition-group"},t("span",{class:"s-offer-modal-condition-label"},r("pages.offer.payment_methods",{},"طرق الدفع")),t("div",{class:"s-offer-modal-condition-items"},a.map((e=>t("span",{class:"s-offer-modal-badge-text"},e.name))))),!!i.length&&t("div",{class:"s-offer-modal-condition-group"},t("span",{class:"s-offer-modal-condition-label"},r("pages.offer.available_branches",{},"الفروع المتاحة")),t("div",{class:"s-offer-modal-condition-items"},i.map((e=>t("span",{class:"s-offer-modal-badge-text"},e.name)))))):null}getOfferContent(){if(this.offer.get.discounts_table)return t("div",{class:"s-offer-modal-discount-table"},t("table",null,t("tbody",null,this.offer.get.discounts_table?.map((e=>t("tr",null,t("td",null,e.text),t("td",{class:"s-offer-modal-discount-table-cell"},t("salla-button",{fill:"outline",shape:"btn",color:"primary",size:"medium",width:"normal",onClick:()=>this.addToCart(e.quantity)},this.addToCartLabel))))))));if(this.offer.get.products?.length){const e=this.offer.get.products?.length||0,o={slidesPerView:"auto",spaceBetween:16,breakpoints:{768:{slidesPerView:Math.min(2,e),spaceBetween:16},1024:{slidesPerView:Math.min(3,e),spaceBetween:16}}};return t("salla-products-slider",{key:(this.offer.get.products?.map((e=>e.id))||[]).join(","),source:"selected","source-value":`[${(this.offer.get.products?.map((e=>e.id))||[]).join(",")}]`,"slider-config":JSON.stringify(o)})}return this.offer.get.categories?.length?t("salla-slider",{type:"carousel",class:{"s-offer-modal-slider-centered":this.offer.get.categories?.length<=2,"s-offer-modal-slider":!0},id:"offer-modal-slider","controls-outer":!0,"show-controls":this.offer.get.categories?.length<=2?"false":"true"},t("div",{slot:"items"},this.offer.get.categories.map((e=>t("a",{href:e.urls.customer,class:"s-offer-modal-badge s-offer-modal-slider-item s-offer-modal-cat-item",innerHTML:this.categorySlot.replace(/\{tagIcon\}/g,a).replace(/\{name\}/g,e.name).replace(/\{url\}/g,e.urls.customer)}))))):this.offer.get.brands?.length?t("salla-slider",{type:"carousel",class:{"s-offer-modal-slider-centered":this.offer.get.brands?.length<=2,"s-offer-modal-slider":!0},id:"offer-modal-slider","controls-outer":!0,"show-controls":this.offer.get.brands?.length<=2?"false":"true"},t("div",{slot:"items"},this.offer.get.brands.map((e=>t("a",{href:e.url||salla.url.create("brands",e.id),class:"s-offer-modal-badge s-offer-modal-slider-item s-offer-modal-brand-item"},t("div",{class:"s-offer-modal-brand-logo"},t("img",{src:e.logo,alt:e.name})),t("span",{class:"s-offer-modal-badge-text"},e.name)))))):this.offer.get.tags?.length?t("salla-slider",{type:"carousel",class:{"s-offer-modal-slider-centered":this.offer.get.tags?.length<=2,"s-offer-modal-slider":!0},id:"offer-modal-slider","controls-outer":!0,"show-controls":this.offer.get.tags?.length<=2?"false":"true"},t("div",{slot:"items"},this.offer.get.tags.map((e=>t("a",{href:e.url||salla.url.create("tags",e.id),class:"s-offer-modal-badge s-offer-modal-slider-item s-offer-modal-tag-item"},t("span",{class:"s-offer-modal-badge-icon",innerHTML:a}),t("span",{class:"s-offer-modal-badge-text"},e.name)))))):void 0}render(){return t("salla-modal",{key:"b41e4389d7bd3ba89f7cfd10d9e2e7a8ddafbb3d","has-skeleton":!0,"sub-title":this.offer_message,ref:e=>this.modal=e,isLoading:!0,class:`s-offer-modal-type-${this.offer_type?this.offer_type:""}`},t("div",{key:"2beaa53d150ba7d17e1d66d6f5a5619ff03dd7f8",slot:"loading"},t("div",{key:"6a35aa5676449dd74ed50e48ee62fe3dc604eb82",class:"s-offer-modal-skeleton"},t("div",{key:"eb0458bbe6bef1c7931ef1b29c7831b6fdd8cf94",class:"s-offer-modal-skeleton-header"},t("salla-skeleton",{key:"ba0dfd74e0e279633fbfa1536a1232f7b88d09c4",type:"circle",height:"80px",width:"80px"}),t("salla-skeleton",{key:"41a501b4179488e1346a12aaf76407dfeeaa233b",height:"15px",width:"50%"}),t("salla-skeleton",{key:"60e56666921a9a1e28d070ee26864c3df488cdfb",height:"10px",width:"30%"})),t("div",{key:"7079a1b0d16c373004fc2abd7e3240349061975f",class:"s-offer-modal-skeleton-items"},[...Array(3)].map((()=>t("div",{class:"s-offer-modal-skeleton-item"},t("salla-skeleton",{height:"9rem"}),t("div",{class:"s-offer-modal-skeleton-item-title"},t("salla-skeleton",{height:"15px",width:"100%"})),t("div",{class:"s-offer-modal-skeleton-item-subtitle"},t("salla-skeleton",{height:"9px",width:"50%"}),t("div",{innerHTML:l})))))),t("div",{key:"63dda9415de1c0eacced5a1135bc6193290106c7",class:"s-offer-modal-skeleton-footer"},t("salla-skeleton",{key:"4e39d82ff6e2145f5a651747423c86929b703f6f",height:"15px",width:"50%"}),t("salla-skeleton",{key:"55115403e6710254d6f8637f05ce3f8733f7101b",height:"15px",width:"30%"})))),this.hasError||null===this.offer?t("salla-placeholder",{class:"s-loyalty-placeholder",alignment:"center"},this.errorMessage?t("span",{slot:"description"},this.errorMessage):""):[t("span",{slot:"icon",class:"s-offer-modal-header-icon",innerHTML:i}),this.getOfferContent(),this.getOfferConditions(),t("div",{class:"s-offer-modal-footer",slot:"footer"},this.offer.formatted_date?t("p",{class:"s-offer-modal-expiry"},salla.lang.get("pages.products.offer_expires_in")," ",this.offer.formatted_date):"",t("label",{class:"s-offer-modal-remember-label"},t("input",{type:"checkbox",onChange:e=>this.rememberMe(e),class:"s-offer-modal-remember-input"})," ",salla.lang.get("common.elements.remember_my_choice")))])}get host(){return o(this)}};s.style='/*!twlt*/.s-offer-modal-type-products .s-modal-body{min-height:690px;position:relative}.visible{visibility:visible}.table{display:table}.outline{outline-style:solid}.s-loyalty-placeholder{display:flex;align-items:center;justify-content:center}.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}.s-modal-header{flex-direction:column}.s-offer-modal-body{display:flex;overflow-x:auto;margin-left:-32px;margin-right:-32px;padding-left:32px;padding-right:32px;gap:24px;padding-bottom:32px;-webkit-overflow-scrolling:touch}.s-offer-modal-body::-webkit-scrollbar{display:none}.s-offer-modal-badge{margin-bottom:0.625rem;display:inline-flex;align-items:center;justify-content:center;border-radius:1.5rem;--tw-bg-opacity:1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1));padding-top:0.625rem;padding-bottom:0.625rem;padding-left:1rem;padding-right:1rem;font-size:0.875rem;line-height:1.25rem;--tw-text-opacity:1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.s-offer-modal-badge:where([dir="ltr"],[dir="ltr"] *){margin-left:0.625rem}.s-offer-modal-badge:where([dir="rtl"],[dir="rtl"] *){margin-left:0.625rem}.s-offer-modal-badge-icon:where([dir="ltr"],[dir="ltr"] *){margin-left:0.375rem}.s-offer-modal-badge-icon:where([dir="rtl"],[dir="rtl"] *){margin-left:0.375rem}.s-offer-modal-badge-icon svg{margin-bottom:1rem;display:inline-block;height:1.5rem;width:1.5rem;fill:var(--color-primary)}.s-offer-modal-badge-text{font-size:0.875rem;line-height:1.25rem;font-weight:700}.s-offer-modal-cat-item.swiper-slide{margin-top:1rem;margin-bottom:1rem;display:flex;height:9rem;max-width:180px;flex-direction:column;align-items:center;justify-content:center;border-radius:0.375rem;border-width:1px;--tw-border-opacity:1;border-color:rgb(243 244 246 / var(--tw-border-opacity, 1));--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1));padding:0.75rem;text-align:center;--tw-text-opacity:1;color:rgb(156 163 175 / 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:500ms}.s-offer-modal-cat-item.swiper-slide:hover{--tw-text-opacity:1;color:rgb(107 114 128 / var(--tw-text-opacity, 1));--tw-shadow:0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);--tw-shadow-colored:0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}.s-offer-modal-brand-item.swiper-slide{margin-top:1rem;margin-bottom:1rem;display:flex;height:9rem;max-width:180px;flex-direction:column;align-items:center;justify-content:center;border-radius:0.375rem;border-width:1px;--tw-border-opacity:1;border-color:rgb(243 244 246 / var(--tw-border-opacity, 1));--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1));padding:0.75rem;text-align:center;--tw-text-opacity:1;color:rgb(156 163 175 / 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:500ms}.s-offer-modal-brand-item.swiper-slide:hover{--tw-text-opacity:1;color:rgb(107 114 128 / var(--tw-text-opacity, 1));--tw-shadow:0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);--tw-shadow-colored:0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}.s-offer-modal-brand-logo{margin-bottom:0.75rem;height:4rem;width:4rem;object-fit:contain}.s-offer-modal-brand-logo img{height:100%;width:100%;object-fit:contain}.s-offer-modal-tag-item.swiper-slide{margin-top:1rem;margin-bottom:1rem;display:flex;height:9rem;max-width:180px;flex-direction:column;align-items:center;justify-content:center;border-radius:0.375rem;border-width:1px;--tw-border-opacity:1;border-color:rgb(243 244 246 / var(--tw-border-opacity, 1));--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1));padding:0.75rem;text-align:center;--tw-text-opacity:1;color:rgb(156 163 175 / 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:500ms}.s-offer-modal-tag-item.swiper-slide:hover{--tw-text-opacity:1;color:rgb(107 114 128 / var(--tw-text-opacity, 1));--tw-shadow:0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);--tw-shadow-colored:0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}.s-offer-modal-product.swiper-slide{display:flex;width:70%;flex-shrink:0;flex-grow:1;flex-direction:column}@media (min-width: 640px){.s-offer-modal-product.swiper-slide{width:40%}}@media (min-width: 1024px){.s-offer-modal-product.swiper-slide{width:28%}}.s-offer-modal-product-image-wrap{position:relative;margin-bottom:1rem;display:block;height:8rem;overflow:hidden;border-radius:0.375rem;--tw-bg-opacity:1;background-color:rgb(249 250 251 / var(--tw-bg-opacity, 1))}.s-offer-modal-product-image{height:100%;width:100%;object-fit:cover}.s-offer-modal-not-available{--tw-grayscale:grayscale(100%);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.s-offer-modal-product-info{margin-bottom:1rem}.s-offer-modal-product-name{margin-bottom:0.375rem;display:inline-block;width:11rem;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:1rem;line-height:1.5rem;--tw-text-opacity:1;color:rgb(31 41 55 / var(--tw-text-opacity, 1));transition-property:color, background-color, border-color, text-decoration-color, fill, stroke;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms}.s-offer-modal-product-name:hover{color:var(--color-primary)}.s-offer-modal-product-price{margin-bottom:1.25rem;display:flex;width:100%;align-items:center;font-size:0.875rem;line-height:1.25rem;font-weight:700}@media (min-width: 768px){.s-offer-modal-product-price{margin-bottom:0px}}@media (min-width: 640px){.s-offer-modal-product-price:where([dir="ltr"],[dir="ltr"] *){margin-left:0.5rem}.s-offer-modal-product-price:where([dir="rtl"],[dir="rtl"] *){margin-right:0.5rem}}.s-offer-modal-product-sale-price{--tw-text-opacity:1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.s-offer-modal-product-old-price{margin-left:0.25rem;margin-right:0.25rem;font-size:0.75rem;line-height:1rem;--tw-text-opacity:1;color:rgb(156 163 175 / var(--tw-text-opacity, 1));text-decoration-line:line-through}.s-offer-modal-btn-wrap{margin-top:auto}.s-offer-modal-header-icon{display:inline-flex;height:4rem;width:4rem;flex-shrink:0;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-offer-modal-header-icon{margin-left:auto;margin-right:auto;margin-bottom:1rem;height:5rem;width:5rem}}.s-offer-modal-header-icon:where([dir="ltr"],[dir="ltr"] *){margin-right:0.5rem}@media (min-width: 640px){.s-offer-modal-header-icon:where([dir="ltr"],[dir="ltr"] *){margin-right:0px}}.s-offer-modal-header-icon:where([dir="rtl"],[dir="rtl"] *){margin-left:0.5rem}@media (min-width: 640px){.s-offer-modal-header-icon:where([dir="rtl"],[dir="rtl"] *){margin-left:0px}}.s-offer-modal-header-icon svg{height:1.75rem;width:1.75rem;flex-shrink:0;fill:#9ca3af}.s-offer-modal-footer{margin-top:1rem;display:flex;flex-direction:column;justify-content:space-between;font-size:0.875rem;line-height:1.25rem;--tw-text-opacity:1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}@media (min-width: 640px){.s-offer-modal-footer{margin-top:2rem;flex-direction:row}}.s-offer-modal-expiry{margin-bottom:1.25rem}@media (min-width: 768px){.s-offer-modal-expiry{margin-bottom:0px}}.s-offer-modal-remember-label{display:flex;cursor:pointer;font-size:0.875rem;line-height:1.25rem;font-weight:500;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-offer-modal-remember-label:hover{--tw-text-opacity:1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}@media (min-width: 640px){.s-offer-modal-remember-label:where([dir="ltr"],[dir="ltr"] *){margin-left:0.5rem}.s-offer-modal-remember-label:where([dir="rtl"],[dir="rtl"] *){margin-right:0.5rem}}.s-offer-modal-remember-input{height:1.5rem;width:1.5rem;border-radius:0.375rem;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1));color:var(--color-primary)}.s-offer-modal-remember-input:focus{--tw-ring-color:transparent}.s-offer-modal-slider-centered .swiper-wrapper{justify-content:center}.s-offer-modal-slider-centered .s-offer-modal-slider-item{display:flex;max-width:28%;flex-shrink:0;flex-grow:1;flex-direction:column}.s-offer-modal-skeleton{display:flex;flex-direction:column;align-items:center;justify-content:center}.s-offer-modal-skeleton-items{margin-top:1.5rem;margin-bottom:1.5rem;display:flex;width:100%;align-items:center}.s-offer-modal-skeleton-item{position:relative;margin-right:1.25rem;width:33.333333%;cursor:unset !important;text-align:center}.s-offer-modal-skeleton-item:last-child{margin-right:0px}.s-offer-modal-skeleton-item:where([dir="rtl"],[dir="rtl"] *){margin-right:0px;margin-left:1.25rem}.s-offer-modal-skeleton-item:last-child:where([dir="rtl"],[dir="rtl"] *){margin-left:0px}.s-offer-modal-skeleton-header{width:100%}.s-offer-modal-skeleton-header salla-skeleton{margin-left:auto;margin-right:auto}.s-offer-modal-skeleton-header salla-skeleton:nth-child(1){margin-bottom:1.25rem}.s-offer-modal-skeleton-header salla-skeleton:nth-child(2){margin-bottom:0.75rem}.s-offer-modal-skeleton-header salla-skeleton:nth-child(3){margin-bottom:1.25rem}.s-offer-modal-skeleton-item-subtitle{display:flex;width:100%;align-items:center;justify-content:space-between}.s-offer-modal-skeleton-item-subtitle div svg{height:1rem;width:1rem;fill:currentColor;--tw-text-opacity:1;color:rgb(209 213 219 / var(--tw-text-opacity, 1))}.s-offer-modal-skeleton-item-title{margin-top:0.75rem;margin-bottom:0.75rem}.s-offer-modal-skeleton-footer{margin-top:1.5rem;display:flex;width:100%;align-items:center;justify-content:space-between}.s-offer-modal-discount-table{width:100%;border-width:1px;--tw-border-opacity:1;border-color:rgb(238 238 238 / var(--tw-border-opacity, 1))}.s-offer-modal-discount-table table{width:100%;text-align:left;font-size:0.875rem;line-height:1.25rem;--tw-text-opacity:1;color:rgb(119 119 119 / var(--tw-text-opacity, 1))}.s-offer-modal-discount-table tr{border-bottom-width:1px;--tw-border-opacity:1;border-color:rgb(238 238 238 / var(--tw-border-opacity, 1));--tw-bg-opacity:1;background-color:rgb(252 252 252 / var(--tw-bg-opacity, 1))}.s-offer-modal-discount-table tr:last-child{border-bottom-width:0px}.s-offer-modal-discount-table tr td{padding-top:1rem;padding-bottom:1rem;padding-left:1.5rem;padding-right:1.5rem}.s-offer-modal-discount-table tr td:where([dir="rtl"],[dir="rtl"] *){text-align:right}.s-offer-modal-discount-table-cell{text-align:right}.s-offer-modal-discount-table-cell:where([dir="rtl"],[dir="rtl"] *){text-align:left !important}.s-offer-modal-type-discounts-table .s-modal-body{position:relative !important}.s-offer-modal-conditions{margin-top:1rem;display:flex;flex-direction:column;gap:0.5rem;text-align:center}.s-offer-modal-condition{font-size:13px;line-height:17px;--tw-text-opacity:1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.s-offer-modal-condition-group{display:flex;flex-direction:column;align-items:center;gap:0.25rem}.s-offer-modal-condition-label{font-size:13px;font-weight:700;--tw-text-opacity:1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.s-offer-modal-condition-items{display:flex;flex-wrap:wrap;justify-content:center;column-gap:0.75rem;row-gap:0.25rem}';export{s as salla_offer_modal}
|