@salla.sa/twilight-components 2.14.502 → 2.14.503
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-CIptScDL.js → filepond-4EL7Y6dJ.js} +1 -1
- package/dist/cjs/{filepond-plugin-file-poster-DwHNuiWd.js → filepond-plugin-file-poster-DpfDCEfm.js} +1 -1
- package/dist/cjs/{filepond-plugin-file-validate-size-BMLUB-u0.js → filepond-plugin-file-validate-size-C_vWwsvD.js} +1 -1
- package/dist/cjs/{filepond-plugin-file-validate-type-DiRunNiR.js → filepond-plugin-file-validate-type-BsPU4Pri.js} +1 -1
- package/dist/cjs/{filepond-plugin-image-edit-DujWvbF5.js → filepond-plugin-image-edit-CQUu_uxt.js} +1 -1
- package/dist/cjs/{filepond-plugin-image-exif-orientation-CzdpRTlH.js → filepond-plugin-image-exif-orientation-DS_esf9h.js} +1 -1
- package/dist/cjs/{filepond-plugin-image-preview-CpEEysug.js → filepond-plugin-image-preview-MQ9XW9EF.js} +1 -1
- package/dist/cjs/{functions-DL46a-BT.js → functions-lIj44Kzp.js} +1 -1
- package/dist/cjs/{index-D7i3cgiE.js → index-BNkAXOaT.js} +1 -1
- package/dist/cjs/{index-CeCWRg4V.js → index-r130kUIm.js} +2 -2
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/salla-accordion-body_2.cjs.entry.js +1 -1
- package/dist/cjs/salla-accordion_6.cjs.entry.js +1 -1
- package/dist/cjs/salla-add-product-button_5.cjs.entry.js +1 -1
- package/dist/cjs/salla-advertisement.cjs.entry.js +1 -1
- package/dist/cjs/salla-alert_2.cjs.entry.js +1 -1
- package/dist/cjs/salla-app-install-alert.cjs.entry.js +1 -1
- package/dist/cjs/salla-apps-icons.cjs.entry.js +1 -1
- package/dist/cjs/salla-badge.cjs.entry.js +1 -1
- package/dist/cjs/salla-basket-gap.cjs.entry.js +1 -1
- package/dist/cjs/salla-booking-field_7.cjs.entry.js +10 -10
- package/dist/cjs/salla-bullet-delivery_2.cjs.entry.js +1 -1
- package/dist/cjs/salla-cart-coupons.cjs.entry.js +1 -1
- package/dist/cjs/salla-cart-item-offers_2.cjs.entry.js +1 -1
- package/dist/cjs/salla-cart-summary-card.cjs.entry.js +1 -1
- package/dist/cjs/salla-cashback-banner.cjs.entry.js +1 -1
- package/dist/cjs/salla-comment-factors.cjs.entry.js +1 -1
- package/dist/cjs/salla-comment-form_8.cjs.entry.js +1 -1
- package/dist/cjs/salla-conditional-offer.cjs.entry.js +1 -1
- package/dist/cjs/salla-contacts.cjs.entry.js +1 -1
- package/dist/cjs/salla-cookies-bar.cjs.entry.js +1 -1
- package/dist/cjs/salla-count-down_2.cjs.entry.js +1 -1
- package/dist/cjs/salla-custom-fields.cjs.entry.js +1 -1
- package/dist/cjs/salla-delivery-promise.cjs.entry.js +1 -1
- package/dist/cjs/salla-edit-order-button.cjs.entry.js +1 -1
- package/dist/cjs/salla-filters-widget.cjs.entry.js +1 -1
- package/dist/cjs/salla-filters.cjs.entry.js +1 -1
- package/dist/cjs/salla-fulfillment-methods.cjs.entry.js +1 -1
- package/dist/cjs/salla-gifting.cjs.entry.js +1 -1
- package/dist/cjs/salla-hook.cjs.entry.js +1 -1
- package/dist/cjs/salla-infinite-scroll.cjs.entry.js +1 -1
- package/dist/cjs/salla-installment.cjs.entry.js +1 -1
- package/dist/cjs/salla-list-tile.cjs.entry.js +1 -1
- package/dist/cjs/salla-localization-modal.cjs.entry.js +1 -1
- package/dist/cjs/salla-login-modal.cjs.entry.js +1 -1
- package/dist/cjs/salla-loyalty-banner.cjs.entry.js +2 -2
- package/dist/cjs/salla-loyalty-exchange-product-card_5.cjs.entry.js +3 -3
- package/dist/cjs/salla-loyalty-hero_2.cjs.entry.js +2 -2
- package/dist/cjs/salla-loyalty-panel.cjs.entry.js +3 -3
- package/dist/cjs/salla-loyalty-points-banner.cjs.entry.js +1 -1
- package/dist/cjs/salla-loyalty-points-history.cjs.entry.js +1 -1
- package/dist/cjs/salla-loyalty-prize-item.cjs.entry.js +1 -1
- package/dist/cjs/salla-loyalty-program.cjs.entry.js +3 -3
- package/dist/cjs/salla-loyalty-reward.cjs.entry.js +2 -2
- package/dist/cjs/salla-loyalty.cjs.entry.js +1 -1
- package/dist/cjs/salla-maintenance-alert.cjs.entry.js +1 -1
- package/dist/cjs/salla-map_2.cjs.entry.js +1 -1
- package/dist/cjs/salla-menu.cjs.entry.js +1 -1
- package/dist/cjs/salla-metadata.cjs.entry.js +1 -1
- package/dist/cjs/salla-multiple-bundle-product-cart_2.cjs.entry.js +1 -1
- package/dist/cjs/salla-multiple-bundle-product-options-modal_2.cjs.entry.js +1 -1
- package/dist/cjs/salla-multiple-bundle-product.cjs.entry.js +1 -1
- package/dist/cjs/salla-next-order-coupon.cjs.entry.js +1 -1
- package/dist/cjs/salla-notification-item.cjs.entry.js +1 -1
- package/dist/cjs/salla-notifications.cjs.entry.js +1 -1
- package/dist/cjs/salla-offer-modal.cjs.entry.js +1 -1
- package/dist/cjs/salla-offer.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-branch.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-cancel.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-details-multiple-bundle-product.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-details-options.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-details.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-edit-item.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-edit-product-card.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-edit.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-summary.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-totals-card.cjs.entry.js +1 -1
- package/dist/cjs/salla-orders.cjs.entry.js +1 -1
- package/dist/cjs/salla-payments.cjs.entry.js +1 -1
- package/dist/cjs/salla-placeholder.cjs.entry.js +1 -1
- package/dist/cjs/salla-price-range.cjs.entry.js +1 -1
- package/dist/cjs/salla-product-card-embed.cjs.entry.js +1 -1
- package/dist/cjs/salla-product-card_2.cjs.entry.js +1 -1
- package/dist/cjs/salla-product-size-guide.cjs.entry.js +1 -1
- package/dist/cjs/salla-products-list.cjs.entry.js +1 -1
- package/dist/cjs/salla-quick-order.cjs.entry.js +1 -1
- package/dist/cjs/salla-rating-modal-v2.cjs.entry.js +2 -2
- package/dist/cjs/salla-rating-modal.cjs.entry.js +2 -2
- package/dist/cjs/salla-review-factors-tags.cjs.entry.js +1 -1
- package/dist/cjs/salla-scopes.cjs.entry.js +1 -1
- package/dist/cjs/salla-search.cjs.entry.js +1 -1
- package/dist/cjs/salla-skeleton.cjs.entry.js +1 -1
- package/dist/cjs/salla-slider.cjs.entry.js +1 -1
- package/dist/cjs/salla-social-share.cjs.entry.js +1 -1
- package/dist/cjs/salla-social.cjs.entry.js +1 -1
- package/dist/cjs/salla-tab-content_3.cjs.entry.js +1 -1
- package/dist/cjs/salla-tiered-offer.cjs.entry.js +1 -1
- package/dist/cjs/salla-tooltip.cjs.entry.js +1 -1
- package/dist/cjs/salla-trust-badges.cjs.entry.js +1 -1
- package/dist/cjs/salla-user-menu.cjs.entry.js +1 -1
- package/dist/cjs/salla-user-profile.cjs.entry.js +1 -1
- package/dist/cjs/salla-user-settings.cjs.entry.js +1 -1
- package/dist/cjs/salla-verify.cjs.entry.js +1 -1
- package/dist/cjs/salla-wallet.cjs.entry.js +1 -1
- package/dist/cjs/salla-wishlist-actions.cjs.entry.js +1 -1
- package/dist/cjs/{tracked-promise-DQhIwhjv.js → tracked-promise-B5M6XIJs.js} +1 -1
- package/dist/cjs/twilight.cjs.js +1 -1
- package/dist/cjs/{vanilla-picker-DlMSPnXD.js → vanilla-picker-CccSuwv_.js} +1 -1
- package/dist/collection/components/salla-rating-modal/salla-rating-modal.css +11 -6
- package/dist/components/index.js +2 -2
- package/dist/components/salla-rating-modal-v22.js +1 -1
- package/dist/components/salla-rating-modal.js +1 -1
- package/dist/esm/{filepond--jRYda4S.js → filepond-XsQHT8SM.js} +1 -1
- package/dist/esm/{filepond-plugin-file-poster-CckDj7tB.js → filepond-plugin-file-poster-Bm4O3j9p.js} +1 -1
- package/dist/esm/{filepond-plugin-file-validate-size-9b6v_l6Z.js → filepond-plugin-file-validate-size-UhmECxYX.js} +1 -1
- package/dist/esm/{filepond-plugin-file-validate-type-CjGNB5Pv.js → filepond-plugin-file-validate-type-Dh3jaIG2.js} +1 -1
- package/dist/esm/{filepond-plugin-image-edit-UIthhs_A.js → filepond-plugin-image-edit-CeOXp2ae.js} +1 -1
- package/dist/esm/{filepond-plugin-image-exif-orientation-DPcDqfwl.js → filepond-plugin-image-exif-orientation-BsjFZBW3.js} +1 -1
- package/dist/esm/{filepond-plugin-image-preview-BWlnovlW.js → filepond-plugin-image-preview-BqeINcJC.js} +1 -1
- package/dist/esm/{functions-Vnk4zyHS.js → functions-DC6kKxwl.js} +1 -1
- package/dist/esm/{index-BOjfFBGe.js → index-BDAOgcq0.js} +2 -2
- package/dist/esm/{index-D8XjJYaY.js → index-Ds_VsqAB.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 +1 -1
- package/dist/esm/salla-advertisement.entry.js +1 -1
- package/dist/esm/salla-alert_2.entry.js +1 -1
- package/dist/esm/salla-app-install-alert.entry.js +1 -1
- package/dist/esm/salla-apps-icons.entry.js +1 -1
- package/dist/esm/salla-badge.entry.js +1 -1
- package/dist/esm/salla-basket-gap.entry.js +1 -1
- package/dist/esm/salla-booking-field_7.entry.js +10 -10
- package/dist/esm/salla-bullet-delivery_2.entry.js +1 -1
- package/dist/esm/salla-cart-coupons.entry.js +1 -1
- package/dist/esm/salla-cart-item-offers_2.entry.js +1 -1
- package/dist/esm/salla-cart-summary-card.entry.js +1 -1
- package/dist/esm/salla-cashback-banner.entry.js +1 -1
- package/dist/esm/salla-comment-factors.entry.js +1 -1
- package/dist/esm/salla-comment-form_8.entry.js +1 -1
- package/dist/esm/salla-conditional-offer.entry.js +1 -1
- package/dist/esm/salla-contacts.entry.js +1 -1
- package/dist/esm/salla-cookies-bar.entry.js +1 -1
- package/dist/esm/salla-count-down_2.entry.js +1 -1
- package/dist/esm/salla-custom-fields.entry.js +1 -1
- package/dist/esm/salla-delivery-promise.entry.js +1 -1
- package/dist/esm/salla-edit-order-button.entry.js +1 -1
- package/dist/esm/salla-filters-widget.entry.js +1 -1
- package/dist/esm/salla-filters.entry.js +1 -1
- package/dist/esm/salla-fulfillment-methods.entry.js +1 -1
- package/dist/esm/salla-gifting.entry.js +1 -1
- package/dist/esm/salla-hook.entry.js +1 -1
- package/dist/esm/salla-infinite-scroll.entry.js +1 -1
- package/dist/esm/salla-installment.entry.js +1 -1
- package/dist/esm/salla-list-tile.entry.js +1 -1
- package/dist/esm/salla-localization-modal.entry.js +1 -1
- package/dist/esm/salla-login-modal.entry.js +1 -1
- package/dist/esm/salla-loyalty-banner.entry.js +2 -2
- package/dist/esm/salla-loyalty-exchange-product-card_5.entry.js +3 -3
- package/dist/esm/salla-loyalty-hero_2.entry.js +2 -2
- package/dist/esm/salla-loyalty-panel.entry.js +3 -3
- package/dist/esm/salla-loyalty-points-banner.entry.js +1 -1
- package/dist/esm/salla-loyalty-points-history.entry.js +1 -1
- package/dist/esm/salla-loyalty-prize-item.entry.js +1 -1
- package/dist/esm/salla-loyalty-program.entry.js +3 -3
- package/dist/esm/salla-loyalty-reward.entry.js +2 -2
- package/dist/esm/salla-loyalty.entry.js +1 -1
- package/dist/esm/salla-maintenance-alert.entry.js +1 -1
- package/dist/esm/salla-map_2.entry.js +1 -1
- package/dist/esm/salla-menu.entry.js +1 -1
- package/dist/esm/salla-metadata.entry.js +1 -1
- package/dist/esm/salla-multiple-bundle-product-cart_2.entry.js +1 -1
- package/dist/esm/salla-multiple-bundle-product-options-modal_2.entry.js +1 -1
- package/dist/esm/salla-multiple-bundle-product.entry.js +1 -1
- package/dist/esm/salla-next-order-coupon.entry.js +1 -1
- package/dist/esm/salla-notification-item.entry.js +1 -1
- package/dist/esm/salla-notifications.entry.js +1 -1
- package/dist/esm/salla-offer-modal.entry.js +1 -1
- package/dist/esm/salla-offer.entry.js +1 -1
- package/dist/esm/salla-order-branch.entry.js +1 -1
- package/dist/esm/salla-order-cancel.entry.js +1 -1
- package/dist/esm/salla-order-details-multiple-bundle-product.entry.js +1 -1
- package/dist/esm/salla-order-details-options.entry.js +1 -1
- package/dist/esm/salla-order-details.entry.js +1 -1
- package/dist/esm/salla-order-edit-item.entry.js +1 -1
- package/dist/esm/salla-order-edit-product-card.entry.js +1 -1
- package/dist/esm/salla-order-edit.entry.js +1 -1
- package/dist/esm/salla-order-summary.entry.js +1 -1
- package/dist/esm/salla-order-totals-card.entry.js +1 -1
- package/dist/esm/salla-orders.entry.js +1 -1
- package/dist/esm/salla-payments.entry.js +1 -1
- package/dist/esm/salla-placeholder.entry.js +1 -1
- package/dist/esm/salla-price-range.entry.js +1 -1
- package/dist/esm/salla-product-card-embed.entry.js +1 -1
- package/dist/esm/salla-product-card_2.entry.js +1 -1
- package/dist/esm/salla-product-size-guide.entry.js +1 -1
- package/dist/esm/salla-products-list.entry.js +1 -1
- package/dist/esm/salla-quick-order.entry.js +1 -1
- package/dist/esm/salla-rating-modal-v2.entry.js +2 -2
- package/dist/esm/salla-rating-modal.entry.js +2 -2
- package/dist/esm/salla-review-factors-tags.entry.js +1 -1
- package/dist/esm/salla-scopes.entry.js +1 -1
- package/dist/esm/salla-search.entry.js +1 -1
- package/dist/esm/salla-skeleton.entry.js +1 -1
- package/dist/esm/salla-slider.entry.js +1 -1
- package/dist/esm/salla-social-share.entry.js +1 -1
- package/dist/esm/salla-social.entry.js +1 -1
- package/dist/esm/salla-tab-content_3.entry.js +1 -1
- package/dist/esm/salla-tiered-offer.entry.js +1 -1
- package/dist/esm/salla-tooltip.entry.js +1 -1
- package/dist/esm/salla-trust-badges.entry.js +1 -1
- package/dist/esm/salla-user-menu.entry.js +1 -1
- package/dist/esm/salla-user-profile.entry.js +1 -1
- package/dist/esm/salla-user-settings.entry.js +1 -1
- package/dist/esm/salla-verify.entry.js +1 -1
- package/dist/esm/salla-wallet.entry.js +1 -1
- package/dist/esm/salla-wishlist-actions.entry.js +1 -1
- package/dist/esm/{tracked-promise-DPZbMaax.js → tracked-promise-B9jBidlY.js} +1 -1
- package/dist/esm/twilight.js +2 -2
- package/dist/esm/{vanilla-picker-Db2JkkPK.js → vanilla-picker-WYx5-zNH.js} +1 -1
- package/dist/twilight/{p-bf22b091.entry.js → p-00e00a1a.entry.js} +1 -1
- package/dist/twilight/{p-62d4e685.entry.js → p-029b107b.entry.js} +1 -1
- package/dist/twilight/{p-628fb2e7.entry.js → p-0c0e06ef.entry.js} +1 -1
- package/dist/twilight/{p-c3598ac9.entry.js → p-0e3daf3b.entry.js} +1 -1
- package/dist/twilight/{p-e033c3ad.entry.js → p-1072712c.entry.js} +1 -1
- package/dist/twilight/{p-7460706e.entry.js → p-11b1f479.entry.js} +1 -1
- package/dist/twilight/{p-cdc167c6.entry.js → p-13411f43.entry.js} +1 -1
- package/dist/twilight/{p-3f137515.entry.js → p-145321f6.entry.js} +1 -1
- package/dist/twilight/{p-5cbeee21.entry.js → p-1822d3e1.entry.js} +1 -1
- package/dist/twilight/{p-7ab7f179.entry.js → p-199e8ce2.entry.js} +1 -1
- package/dist/twilight/{p-490e83b7.entry.js → p-1a348bbc.entry.js} +1 -1
- package/dist/twilight/{p-4d32ef06.entry.js → p-1d4df9b9.entry.js} +1 -1
- package/dist/twilight/{p-a38b58ca.entry.js → p-20fa61e5.entry.js} +1 -1
- package/dist/twilight/{p-591dc47b.entry.js → p-23efc7b2.entry.js} +1 -1
- package/dist/twilight/{p-5259181e.entry.js → p-242c9aab.entry.js} +1 -1
- package/dist/twilight/{p-36d820e1.entry.js → p-28f1d6d3.entry.js} +1 -1
- package/dist/twilight/{p-c2fd3800.entry.js → p-2beb2187.entry.js} +1 -1
- package/dist/twilight/{p-5f3b36fe.entry.js → p-2defa519.entry.js} +1 -1
- package/dist/twilight/{p-aec3c134.entry.js → p-339d0e20.entry.js} +1 -1
- package/dist/twilight/{p-05533207.entry.js → p-34779788.entry.js} +1 -1
- package/dist/twilight/{p-d454c6ac.entry.js → p-3718a5ca.entry.js} +1 -1
- package/dist/twilight/{p-d4242231.entry.js → p-389ee38e.entry.js} +1 -1
- package/dist/twilight/{p-980deae9.entry.js → p-3b28110b.entry.js} +1 -1
- package/dist/twilight/{p-24cdca69.entry.js → p-3f6af2a4.entry.js} +1 -1
- package/dist/twilight/{p-b9d30af2.entry.js → p-3fd91874.entry.js} +1 -1
- package/dist/twilight/{p-f00e25a1.entry.js → p-41fbfac6.entry.js} +1 -1
- package/dist/twilight/{p-b8875211.entry.js → p-42f6c2a9.entry.js} +1 -1
- package/dist/twilight/{p-f6623828.entry.js → p-45b5af6c.entry.js} +1 -1
- package/dist/twilight/{p-24af33da.entry.js → p-4add663c.entry.js} +1 -1
- package/dist/twilight/{p-5492fef2.entry.js → p-4d50512c.entry.js} +1 -1
- package/dist/twilight/{p-cbe499ec.entry.js → p-54078768.entry.js} +1 -1
- package/dist/twilight/{p-404e7d5b.entry.js → p-560dd097.entry.js} +1 -1
- package/dist/twilight/{p-a6a3a2af.entry.js → p-58d35d9b.entry.js} +1 -1
- package/dist/twilight/{p-dfc06251.entry.js → p-58e8f293.entry.js} +1 -1
- package/dist/twilight/p-5cdbbf4b.entry.js +4 -0
- package/dist/twilight/{p-d3a91c42.entry.js → p-60a8176c.entry.js} +1 -1
- package/dist/twilight/{p-f5a960be.entry.js → p-62c90e02.entry.js} +1 -1
- package/dist/twilight/{p-0809ec4c.entry.js → p-648a3962.entry.js} +1 -1
- package/dist/twilight/{p-7ef4cd2e.entry.js → p-66a4a0c6.entry.js} +1 -1
- package/dist/twilight/{p-2495ba63.entry.js → p-66bad139.entry.js} +1 -1
- package/dist/twilight/{p-1ad1e565.entry.js → p-69b72bf4.entry.js} +1 -1
- package/dist/twilight/{p-a60c4d82.entry.js → p-70827676.entry.js} +1 -1
- package/dist/twilight/{p-27ed0bb7.entry.js → p-739eb0c7.entry.js} +1 -1
- package/dist/twilight/{p-0245e2c0.entry.js → p-74a6a2eb.entry.js} +1 -1
- package/dist/twilight/{p-b879c791.entry.js → p-766c0d0e.entry.js} +1 -1
- package/dist/twilight/{p-0a36a8df.entry.js → p-7766fa26.entry.js} +1 -1
- package/dist/twilight/{p-25be867c.entry.js → p-7bb98247.entry.js} +1 -1
- package/dist/twilight/{p-7d10ae17.entry.js → p-7c74ae05.entry.js} +1 -1
- package/dist/twilight/{p-3075687f.entry.js → p-7e48a21d.entry.js} +1 -1
- package/dist/twilight/{p-0076e440.entry.js → p-7e5146b6.entry.js} +1 -1
- package/dist/twilight/{p-4a9fbb6e.entry.js → p-7ead012e.entry.js} +1 -1
- package/dist/twilight/{p-5804914e.entry.js → p-7f51644d.entry.js} +1 -1
- package/dist/twilight/{p-c23d9868.entry.js → p-833d5b2c.entry.js} +1 -1
- package/dist/twilight/{p-0846a39c.entry.js → p-84b575c9.entry.js} +1 -1
- package/dist/twilight/{p-558eef65.entry.js → p-8767b2c9.entry.js} +1 -1
- package/dist/twilight/{p-56c55c15.entry.js → p-8829803d.entry.js} +1 -1
- package/dist/twilight/{p-bb4774ef.entry.js → p-892fe0dc.entry.js} +1 -1
- package/dist/twilight/{p-3431ad47.entry.js → p-895cb2a3.entry.js} +1 -1
- package/dist/twilight/{p-16060f64.entry.js → p-9387d8f6.entry.js} +1 -1
- package/dist/twilight/{p-648704dc.entry.js → p-93e1fce9.entry.js} +1 -1
- package/dist/twilight/{p-fb8e031a.entry.js → p-9e1d9a17.entry.js} +1 -1
- package/dist/twilight/{p-ef0ff326.entry.js → p-9fe5b58d.entry.js} +1 -1
- package/dist/twilight/{p-BOjfFBGe.js → p-BDAOgcq0.js} +1 -1
- package/dist/twilight/{p-CkIv9zJH.js → p-BVdpiUHg.js} +1 -1
- package/dist/twilight/{p-Bdy-19kn.js → p-BZEaULfj.js} +1 -1
- package/dist/twilight/{p-B-m0e6tL.js → p-BqhIuaLC.js} +1 -1
- package/dist/twilight/{p-B93EBMau.js → p-Brrm0j4S.js} +1 -1
- package/dist/twilight/{p-BsrZms1J.js → p-CFesXKV4.js} +1 -1
- package/dist/twilight/{p-CZFiZZq_.js → p-Cjy9wz83.js} +1 -1
- package/dist/twilight/{p-BeJV4WrP.js → p-DH0mPIPC.js} +1 -1
- package/dist/twilight/{p-Be0gsl2J.js → p-DzjKtVuN.js} +1 -1
- package/dist/twilight/{p-e416ee2b.entry.js → p-a0159981.entry.js} +1 -1
- package/dist/twilight/{p-95e6774b.entry.js → p-a38c8a50.entry.js} +1 -1
- package/dist/twilight/{p-145f51a4.entry.js → p-a3bf7378.entry.js} +1 -1
- package/dist/twilight/{p-d86136e7.entry.js → p-a4200654.entry.js} +1 -1
- package/dist/twilight/{p-3ed4357e.entry.js → p-a7ad3bc8.entry.js} +1 -1
- package/dist/twilight/{p-4cf257b2.entry.js → p-ac754175.entry.js} +1 -1
- package/dist/twilight/{p-166287b8.entry.js → p-adb61085.entry.js} +1 -1
- package/dist/twilight/{p-73acf48f.entry.js → p-b25a5f02.entry.js} +1 -1
- package/dist/twilight/{p-9018a13b.entry.js → p-b5d9bb84.entry.js} +1 -1
- package/dist/twilight/{p-BTd4Mp32.js → p-bJmdZHN0.js} +1 -1
- package/dist/twilight/{p-5f0565be.entry.js → p-bb8cf342.entry.js} +1 -1
- package/dist/twilight/{p-ae1d9d25.entry.js → p-bcd09500.entry.js} +1 -1
- package/dist/twilight/{p-540b7c0c.entry.js → p-bcdf496c.entry.js} +1 -1
- package/dist/twilight/{p-0c4b50a8.entry.js → p-bd548fb9.entry.js} +1 -1
- package/dist/twilight/{p-bd3b3b56.entry.js → p-c09f54a6.entry.js} +1 -1
- package/dist/twilight/{p-1d7a5517.entry.js → p-c53d5de4.entry.js} +1 -1
- package/dist/twilight/{p-9b9eb649.entry.js → p-c7bc0e89.entry.js} +1 -1
- package/dist/twilight/{p-6bdbd0f3.entry.js → p-c86304f5.entry.js} +1 -1
- package/dist/twilight/{p-3330e9b1.entry.js → p-ca9efb06.entry.js} +1 -1
- package/dist/twilight/{p-a8683925.entry.js → p-da12a9a4.entry.js} +1 -1
- package/dist/twilight/{p-534c5ce0.entry.js → p-dd37e07e.entry.js} +1 -1
- package/dist/twilight/{p-67d5bded.entry.js → p-dde417c0.entry.js} +1 -1
- package/dist/twilight/{p-d3807e1d.entry.js → p-df1a9f37.entry.js} +1 -1
- package/dist/twilight/{p-8e298b27.entry.js → p-df2851e1.entry.js} +1 -1
- package/dist/twilight/{p-7be94cc2.entry.js → p-df8d8064.entry.js} +1 -1
- package/dist/twilight/{p-91853c93.entry.js → p-e0b3dc35.entry.js} +1 -1
- package/dist/twilight/{p-a9dd59e6.entry.js → p-e1f2e830.entry.js} +1 -1
- package/dist/twilight/{p-fb79a1b4.entry.js → p-e3248ff0.entry.js} +1 -1
- package/dist/twilight/{p-71d90a27.entry.js → p-eabe5998.entry.js} +1 -1
- package/dist/twilight/{p-fd53f57a.entry.js → p-f046adac.entry.js} +1 -1
- package/dist/twilight/{p-2f0b08a4.entry.js → p-f5d6e487.entry.js} +1 -1
- package/dist/twilight/{p-16407a84.entry.js → p-f885ceed.entry.js} +1 -1
- package/dist/twilight/{p-85333282.entry.js → p-fa751c55.entry.js} +1 -1
- package/dist/twilight/{p-CIW_DqnB.js → p-iGz7tppc.js} +1 -1
- package/dist/twilight/{p-BI-CCdbp.js → p-x5XPo1DG.js} +1 -1
- package/dist/twilight/twilight.esm.js +1 -1
- package/package.json +5 -5
- package/dist/twilight/p-45b6ec5f.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 s,H as l}from"./p-
|
|
4
|
+
import{r as t,h as s,H as l}from"./p-BDAOgcq0.js";import{S as a}from"./p-CXRKXFgT.js";const o=t=>t?new Date(Number(t)).toLocaleDateString(salla.lang.locale,{weekday:"long",year:"numeric",month:"long",day:"numeric",hour:"numeric"}):"",i=class{constructor(s){t(this,s),this.loyaltyPointsArray=[],this.balance=0,this.isLoadingLoyalty=!1,this.nextPageUrlLoyalty="",this.handleClick=()=>{this.loadMoreLoyaltyPoints()}}async componentWillLoad(){try{await salla.onReady(),await salla.lang.onLoaded(),await this.loadLoyaltyPoints()}catch(t){salla?.logger?.warn?.("salla-loyalty-points-history: init failed",t)}}async loadLoyaltyPoints(){this.isLoadingLoyalty=!0;try{let t="/balance/points?page=1",s=await salla.api.request(t);this.loyaltyPointsArray=s.data,this.balance=s.balance,this.nextPageUrlLoyalty=s.cursor.next}catch(t){console.error("Error loading loyalty points transactions",t)}finally{this.isLoadingLoyalty=!1}}async loadMoreLoyaltyPoints(){if(this.nextPageUrlLoyalty){this.isLoadingLoyalty=!0;try{let t=await salla.api.request(this.nextPageUrlLoyalty);this.loyaltyPointsArray=[...this.loyaltyPointsArray,...t.data],this.nextPageUrlLoyalty=t.cursor?.next||""}catch(t){console.error("Error loading more loyalty points",t)}finally{this.isLoadingLoyalty=!1}}}render(){return s(l,{key:"2d1ecb37f0cc74c3d6c3c29bc95d6043b373155f"},s("div",{key:"2c1a3e6af83fde1f55f6d5b5bed246a3206673c4"},this.isLoadingLoyalty?s("salla-loading",null):s("div",null,s("table",{class:"s-loyalty-points-history-table"},s("tbody",null,s("tr",null,s("td",null,s("div",{class:"s-loyalty-points-history-balance-container"},s("i",{class:"s-loyalty-points-history-balance-icon sicon-gift"}),s("div",null,s("div",{class:"s-loyalty-points-history-balance-value"},this.balance," ",salla.lang.get("pages.loyalty_program.point")),s("div",{class:"s-loyalty-points-history-balance-label"},salla.lang.get("pages.loyalty_program.your_points")))))))),this.loyaltyPointsArray.length>0?s("div",null,s("table",{class:"s-loyalty-points-history-table"},s("thead",{class:"s-loyalty-points-history-table-head"},s("tr",null,s("th",{scope:"col",class:"s-loyalty-points-history-table-head-tr-th"},salla.lang.get("pages.wallet.points")),s("th",{scope:"col",class:"s-loyalty-points-history-table-head-tr-th"},salla.lang.get("pages.wallet.date")),s("th",{scope:"col",class:"s-loyalty-points-history-table-head-tr-th"},salla.lang.get("pages.wallet.expiry_date")),s("th",{scope:"col",class:"s-loyalty-points-history-table-head-tr-th"},salla.lang.get("common.elements.note")),s("th",{scope:"col",class:"s-loyalty-points-history-table-head-tr-th"},salla.lang.get("common.elements.status")))),s("tbody",null,this.loyaltyPointsArray.map((t=>s("tr",{class:"s-loyalty-points-history-table-tbody-tr"},s("td",{class:"s-loyalty-points-history-table-tbody-tr-td"},s("div",{class:"s-loyalty-points-history-table-tbody-tr-td-content"},s("span",{class:"s-loyalty-points-history-mobile-title"},salla.lang.get("pages.wallet.points"),":"),s("span",null,"plus"===t?.type?"+":"",t?.amount||""," ",salla.lang.get("pages.loyalty_program.point")))),s("td",{class:"s-loyalty-points-history-table-tbody-tr-td"},s("div",{class:"s-loyalty-points-history-table-tbody-tr-td-content"},s("span",{class:"s-loyalty-points-history-mobile-title"},salla.lang.get("pages.wallet.date"),":"),s("span",null,o(t?.created_at?1e3*Number(t.created_at):void 0)))),s("td",{class:"s-loyalty-points-history-table-tbody-tr-td"},s("div",{class:"s-loyalty-points-history-table-tbody-tr-td-content"},s("span",{class:"s-loyalty-points-history-mobile-title"},salla.lang.get("pages.wallet.expiry_date"),":"),s("span",null,o(t?.expires_at?1e3*Number(t.expires_at):void 0)))),s("td",{class:"s-loyalty-points-history-table-tbody-tr-td"},s("div",{class:"s-loyalty-points-history-table-tbody-tr-td-content"},s("span",{class:"s-loyalty-points-history-mobile-title"},salla.lang.get("common.elements.note"),":"),s("span",null,(t=>{if(!t)return"";try{const s=t.toLowerCase(),l=salla.lang.get(`pages.loyalty_program.${s}`);return l===`pages.loyalty_program.${s}`?t:l}catch{return t}})(t?.key)))),s("td",{class:"s-loyalty-points-history-table-tbody-tr-td"},s("div",{class:"s-loyalty-points-history-table-tbody-tr-td-content"},s("span",{class:"s-loyalty-points-history-mobile-title"},salla.lang.get("common.elements.status"),":"),s("div",{class:{"s-loyalty-points-history-table-transaction-status":!0,"s-loyalty-points-history-table-transaction-status-pending":"pending"===t?.status_key,"s-loyalty-points-history-table-transaction-status-revoked":"revoked"===t?.status_key,"s-loyalty-points-history-table-transaction-status-used":"used"===t?.status_key,"s-loyalty-points-history-table-transaction-status-expired":"expired"===t?.status_key}},t?.status)))))))),s("div",{class:"s-loyalty-points-history-load-more"},!!this.nextPageUrlLoyalty&&s("salla-button",{onClick:this.handleClick,loading:this.isLoadingLoyalty},salla.lang.get("common.elements.load_more")))):s("div",{class:"s-loyalty-points-history-table-empty-state"},s("span",{innerHTML:a}),s("div",{class:"s-loyalty-points-history-table-placeholder-title"},salla.lang.get("pages.loyalty_program.no_loyality_points_title")),s("div",{class:"s-loyalty-points-history-table-placeholder-sub-title"},salla.lang.get("pages.loyalty_program.no_loyality_points_sub_title"))))))}};export{i as salla_loyalty_points_history}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as t,c as e,h as s,H as i,a as l}from"./p-
|
|
4
|
+
import{r as t,c as e,h as s,H as i,a as l}from"./p-BDAOgcq0.js";import{F as a}from"./p-DL4h2bc3.js";import{H as r}from"./p-XnA1YTjA.js";import"./p-CgtvEd63.js";const o=class{constructor(s){t(this,s),this.changed=e(this,"changed"),this.isReady=!1,this.isInitialFetch=!0,this.filtersData={},this.appliedOpen=!0,salla.event.on("filters::hidden",(()=>this.host.style.display="none")),salla.lang.onLoaded((()=>{this.apply=salla.lang.get("pages.checkout.apply"),this.reset=salla.lang.get("pages.categories.filters_reset"),this.selectedTitle=salla.lang.getWithDefault("pages.categories.selected_filters","لقد اخترت")})),salla.event.on("filters::fetched",(({filters:t})=>{this.host.style.display="";let e={};this.filters=t.map((t=>{if(t.label={category_id:salla.lang.get("common.titles.categories"),brand_id:salla.lang.get("common.titles.brands"),rating:salla.lang.get("pages.categories.filter_rating"),price:salla.lang.get("pages.categories.filter_price")}[t.key]||t.label,"rating"==t.key){t.type=a.VALUES;let{max:e,min:s}=t.values;t.values=[5,4,3,2,1].filter((t=>t>=s||t<=e))}this.filtersData.variants&&t.type==a.VARIANTS&&(e.variants=this.filtersData.variants),this.filtersData[t.key]&&t.type!==a.VARIANTS&&(e[t.key]=this.filtersData[t.key]);let s=new URLSearchParams(window.location.search),i=!1;for(let t of s.keys())if(t.includes("filters")){i=!0;break}if(this.isInitialFetch&&"product.index"==salla.config.get("page.slug")&&0==Object.keys(e).length&&!i){let t=window.location.href,s=salla.config.get("page.id"),i=-1!==t.indexOf("?")?"&":"?",l=t+i+"filters[category_id]="+s;e.category_id=s,window.history.pushState({path:l},"",l)}return t})),this.isInitialFetch=!1,this.filtersData=e,this.host.childNodes.forEach((async t=>t.setWidgetHeight&&await t.setWidgetHeight()))}))}async componentWillLoad(){try{const t=new URLSearchParams(window.location.search);this.filtersData=await r.extractFiltersFromUrl(t)}catch(t){console.warn("failed to get filters from URL",t.message)}}async getFilters(){return this.filtersData}async applyFilters(){if(!this.isReady)return;let t=Object.keys(this.filtersData).length>0;setTimeout((()=>{if(t){let t=new URL(window.location.href);for(const[e]of t.searchParams.entries())e.startsWith("filters")&&t.searchParams.delete(e);let e=this.encodeFilters(this.filtersData),s=t.search.split("&").filter((t=>!t.includes("filters"))).join("&");t.search=s?t.search.split("&filters")[0]+"&"+e:`?${e}`,window.history.pushState({},"",t.href)}else{let t=new URL(window.location.href);t.searchParams?.delete("filters"),window.history.pushState({},"",t.toString())}salla.event.emit("salla-filters::changed",this.filtersData),this.changed.emit(this.filtersData)}),300)}encodeFilters(t,e="filters"){const s=[];for(const i in t)if(Object.prototype.hasOwnProperty.call(t,i)){const l=t[i],a=e?`${e}[${i}]`:i;Array.isArray(l)?l.forEach((t=>s.push(`${a}[]=${t}`))):s.push("object"==typeof l&&null!==l?this.encodeFilters(l,a):`${a}=${l}`)}return s.join("&")}async resetFilters(){return this.removeFiltersQueryParams(),this.filtersData={},this.host.childNodes.forEach((t=>t.reset&&t.reset())),salla.event.emit("salla-filters::reset"),this.applyFilters()}removeFiltersQueryParams(){const t=new URLSearchParams(window.location.search),e=Array.from(t.keys()).filter((t=>!t.startsWith("filters["))).map((e=>`${encodeURIComponent(e)}=${encodeURIComponent(t.get(e))}`)).join("&"),s=e?`${window.location.pathname}?${e}`:window.location.pathname;window.history.pushState({},"",s)}handleOptionChange(t,e,s){e.type===a.RANGE&&(this.filtersData[e.key]=s);let i=t.target.checked;if(e.type===a.VARIANTS)this.filtersData.variants=this.filtersData.variants||{},i&&(this.filtersData.variants[e.key]=s),i||delete this.filtersData.variants[e.key];else if("radio"==t.target.type)i&&(this.filtersData[e.key]=s),i||delete this.filtersData[e.key];else if("checkbox"==t.target.type){const t=this.filtersData[e.key];this.filtersData[e.key]=Array.isArray(t)?t:null!=t?[t]:[],i?this.filtersData[e.key].push(s):this.filtersData[e.key]=this.filtersData[e.key].filter((t=>t!=s)),this.filtersData[e.key].length||delete this.filtersData[e.key]}this.filtersData={...this.filtersData},this.applyFilters()}getAppliedFilters(){const t=[],e=this.filtersData||{};for(const s of Object.keys(e)){if("variants"===s){const i=this.filters?.find((t=>t.type===a.VARIANTS));for(const l of Object.keys(e.variants||{})){const r=e.variants[l],o=i?.values?.find((t=>(t.key||t.value)==r));o&&t.push({key:s,variantKey:l,value:r,type:a.VARIANTS,groupLabel:i?.label,optionLabel:o.value})}continue}const i=this.filters?.find((t=>t.key===s));if(!i)continue;const l=e[s];if(i.type===a.RANGE||l&&"object"==typeof l&&!Array.isArray(l)){t.push({key:s,value:l,type:a.RANGE,groupLabel:i.label,optionLabel:`${l.min} - ${l.max}`});continue}if("category_id"===s&&!Array.isArray(l)&&"product.index"==salla.config.get("page.slug")&&l==salla.config.get("page.id"))continue;const r=Array.isArray(l)?l:[l];for(const e of r){const l=i.values?.find((t=>("number"==typeof t?t:t.key||t.value)==e)),a="rating"===i.key?`${e}`:l&&"number"!=typeof l?l.value:void 0;null!=a&&t.push({key:s,value:e,type:i.type,groupLabel:i.label,optionLabel:a})}}return t}removeFilter(t){if(t.type===a.VARIANTS)this.filtersData.variants&&(delete this.filtersData.variants[t.variantKey],Object.keys(this.filtersData.variants).length||delete this.filtersData.variants);else if(t.type===a.RANGE)delete this.filtersData[t.key];else{const e=this.filtersData[t.key];Array.isArray(e)?(this.filtersData[t.key]=e.filter((e=>e!=t.value)),this.filtersData[t.key].length||delete this.filtersData[t.key]):delete this.filtersData[t.key]}this.filtersData={...this.filtersData},this.applyFilters()}render(){const t=this.getAppliedFilters(),e=salla.lang.getWithDefault("common.elements.delete","Remove");return s(i,{key:"f0493d0e85ebb9e6612a1edc6cd7f45e7473017e"},t.length?s("div",{class:"s-filters-applied s-filters-widget-container"},s("h3",{class:"s-filters-widget-title",onClick:()=>this.appliedOpen=!this.appliedOpen},s("span",null,this.selectedTitle),s("span",{class:"s-filters-widget-plusminus "+(this.appliedOpen?"s-filters-widget-plusminus-active":"")})),s("div",{class:"s-filters-widget-content "+(this.appliedOpen?"s-filters-widget-opened":"s-filters-widget-closed")},s("div",{class:"s-filters-widget-values"},t.map((t=>s("div",{class:"s-filters-label s-filters-applied-item"},s("span",{class:"s-filters-option-name"},t.groupLabel,": ",t.optionLabel),s("button",{type:"button",class:"s-filters-applied-remove","aria-label":`${e} ${t.groupLabel}: ${t.optionLabel}`,onClick:()=>this.removeFilter(t)},s("i",{class:"sicon-cancel","aria-hidden":"true"})))))),s("div",{class:"s-filters-footer"},s("salla-button",{color:"gray",fill:"outline",onClick:()=>this.resetFilters()},this.reset)))):"",this.filters?.map((t=>s("salla-filters-widget",{option:t,filtersData:this.filtersData,onChanged:({detail:{event:t,option:e,value:s}})=>{this.handleOptionChange(t,e,s)}}))))}componentDidLoad(){this.isReady=!0}get host(){return l(this)}};o.style=":host{display:block}.s-rating-stars-small{line-height:12px}.s-filters-radio{background-image:none !important}.s-filters-applied-remove{pointer-events:auto !important;cursor:pointer}";export{o as salla_filters}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as s,h as e,a as t}from"./p-BOjfFBGe.js";var o,i;!function(s){s.ProductDetail="product.single",s.Cart="cart"}(o||(o={})),function(s){s.Conditional="conditional",s.PercentageOrFixed="fixed",s.DiscountsTable="discounts_table",s.Bank="bank",s.BuyXGetY="buy_x_get_y",s.SpecialPrice="special_price",s.Percentage="percentage",s.FixedAmount="fixed_amount"}(i||(i={}));const r=class{constructor(e){s(this,e),this.productCardComponent="salla-product-card",this.offersList=[],this.canRender=!1,this.showOffer=salla.config.get("store.settings.product.show_special_offers"),this.showAllOffersModal=!1,this.showProductsModal=!1,this.selectedOfferProducts=[],this.collapsedOffers={},this.expandedCategories={},this.productsLoaded=!1,this.offer_with_price_text=salla.lang.get("pages.offer.with_price",{price:""}),this.with_discount_text=salla.lang.get("pages.products.with_a_discount"),this.product_discount_text=salla.lang.get("pages.products.discount"),this.special_offer_text=salla.lang.get("pages.products.special_offer"),this.buy_quantity_text=s=>salla.lang.get("pages.offer.buy_quantity",{quantity:s}),this.products_link_text=salla.lang.get("pages.offer.included_products","المنتجات المشمولة"),this.min_spend_text=(s,e)=>salla.lang.get("pages.offer.min_spend_amount",{amount:s,currency:e},`بحد أدنى ${s} ${e} من مبلغ الشراء`),this.min_items_text=s=>salla.lang.get("pages.offer.min_items",{items:s},`بحد أدنى ${s} منتجات`),this.product_text=salla.lang.get("common.elements.product","منتج"),salla.lang.onLoaded((()=>{this.offer_with_price_text=salla.lang.get("pages.offer.with_price"),this.with_discount_text=salla.lang.get("pages.products.with_a_discount"),this.product_discount_text=salla.lang.get("pages.products.discount"),this.special_offer_text=salla.lang.get("pages.products.special_offer"),this.buy_quantity_text(0),this.products_link_text=salla.lang.get("pages.offer.included_products","المنتجات المشمولة"),this.min_spend_text=(s,e)=>salla.lang.get("pages.offer.min_spend_amount",{amount:s,currency:e},`بحد أدنى ${s} ${e} من مبلغ الشراء`),this.min_items_text=s=>salla.lang.get("pages.offer.min_items",{items:s},`بحد أدنى ${s} منتجات`),this.product_text=salla.lang.get("common.elements.product","منتج")})),salla.onReady((()=>{this.currentPage=salla.config.get("page.slug");const s=salla.config.get("currencies")||{},e=salla.config.get("user.currency_code");this.userCurrency=s[e]||{symbol:"",code:e||"SAR",name:""}}))}async getEndpointByPageName(){return this.currentPage==o.Cart?`offers/cart/${await Salla.cart.getCurrentCartId()}`:this.currentPage==o.ProductDetail?`offers/product/${salla.config.get("page.id")}`:"offers"}emitPromotionViewed(){if(!(this.offersList.length&&this.canRender&&this.showOffer))return;const s=this.offersList.slice(0,5).map(((s,e)=>({id:s.id,name:s.title,creative:s.description||"",position:e+1})));salla.event.emit("salla::offer.promotion.viewed",s)}emitPromotionClicked(s,e=1){if(!(this.offersList.length&&this.canRender&&this.showOffer))return;const t=s||this.offersList[0];salla.event.emit("salla::offer.promotion.clicked",[{id:t.id,name:t.title,creative:t.description||"",position:e}])}componentWillLoad(){return this.hasCustomComponent=!!customElements.get(this.productCardComponent),new Promise((s=>salla.onReady(s))).then((()=>{if(this.showOffer=!salla.url.is_page("product.single")||salla.config.get("store.settings.product.show_special_offers"),!this.showOffer)throw new Error("Merchant disabled showing the offers on product page")})).then((async()=>this.currentPage==o.Cart?salla.api.cart.offers():salla.api.request(await this.getEndpointByPageName()))).then((async s=>{if(!(this.offersList=s.data).length)throw new Error("salla-offers:: There is no offers!");if(this.offersList=this.offersList.filter((s=>[i.SpecialPrice,i.Bank,i.BuyXGetY,i.DiscountsTable,i.PercentageOrFixed,i.Percentage,i.FixedAmount].includes(s.type))),!this.offersList.length)throw new Error("salla-offers:: No supported offer types found!");let e=null;this.offersList.some((s=>{const e=s.details;return"category"===e.apply_to&&e.targets||"categories"===e.apply_to&&e.targets||s.type===i.BuyXGetY&&("categories"===e.get?.source||"category"===e.get?.source)}))&&(e=(await salla.product.api.categories()).data);const t=new Set;for(const s of this.offersList){const e=s.details;"product"!==e.apply_to&&"products"!==e.apply_to||!e.targets||e.targets.forEach((s=>t.add(s))),s.type===i.BuyXGetY&&"products"===e.get?.source&&e.get?.source_value&&e.get.source_value.forEach((s=>t.add(s))),s.type!==i.BuyXGetY||"products"!==e.buy?.source&&"product"!==e.buy?.source||!e.buy?.source_value||e.buy.source_value.forEach((s=>t.add(s)))}let o={};if(t.size>0)try{const s=await salla.product.api.fetch({source:"selected",source_value:Array.from(t)});o=Object.fromEntries(s.data.map((s=>[s.id,s])))}catch(s){o={}}for(const s of this.offersList){const t=s.details;if(("category"===t.apply_to&&t.targets||"categories"===t.apply_to&&t.targets)&&e&&(t.categories=this.findCategories(e,t.targets)),"product"!==t.apply_to&&"products"!==t.apply_to||!t.targets||(t.products=t.targets.map((s=>o[s])).filter(Boolean)),"brand"===t.apply_to&&t.targets&&(t.brands=t.targets),"tag"===t.apply_to&&t.targets&&(t.tags=t.targets),s.type===i.BuyXGetY&&t.get){const s=t.get;"products"===s.source&&s.source_value?s.products=s.source_value.map((s=>o[s])).filter(Boolean):("categories"===s.source||"category"===s.source)&&e&&s.source_value&&(s.categories=this.findCategories(e,s.source_value),t.categories=s.categories)}if(s.type===i.BuyXGetY&&t.buy){const s=t.buy;"products"!==s.source&&"product"!==s.source||!s.source_value||(s.products=s.source_value.map((s=>o[s])).filter(Boolean))}}return this.offersList})).then((()=>{this.canRender=!0})).catch((s=>{salla.logger.warn(s)}))}componentDidLoad(){let s=this.host.querySelector(".s-slider-block__title-nav");s?.classList.add("s-offer-bank-payment-nav"),this.emitPromotionViewed()}findCategories(s,e){let t=[];for(const o of s)e.includes(o.id_||o.id)&&t.push(o),o.sub_categories?.length>0&&(t=t.concat(this.findCategories(o.sub_categories,e)));return t}render(){if(!this.offersList.length||!this.canRender||!this.showOffer)return null;const s=salla.lang.get("pages.offer.offers_title","عروض المنتج"),t=salla.lang.get("pages.offer.offers_subtitle","احصل على المنتج بسعر مخفض مع أفضل العروض");return[e("div",{class:"s-offer-wrapper"},e("salla-slider",{type:"carousel",id:"offers-slider","block-title":s,"block-subTitle":t,"show-controls":this.offersList.length>1},e("div",{slot:"items"},this.offersList.slice(0,5).map(((s,e)=>this.renderOfferCard(s,e+1))),this.offersList.length>5&&this.renderShowMoreCard()))),this.renderAllOffersModal(),this.renderProductsModal()]}renderShowMoreCard(){return e("div",{class:"s-offer-slide-one-fourth swiper-slide",onClick:s=>{s.preventDefault(),s.stopPropagation(),this.openAllOffersModal()}},e("div",{class:"s-offer-card s-offer-show-more-card"},e("i",{class:"sicon-add s-offer-show-more-icon"}),e("h3",{class:"s-offer-show-more-title"},salla.lang.get("pages.offer.show_more_offers","عرض المزيد من العروض"))))}openAllOffersModal(){this.showAllOffersModal=!0}closeAllOffersModal(){this.showAllOffersModal=!1}closeProductsModal(){this.showProductsModal=!1,this.selectedOfferProducts=[],this.productsLoaded=!1}handleAccordionToggle(s,e){this.collapsedOffers={...this.collapsedOffers,[s]:e}}getOfferProducts(s){const e=s.details;return e.products&&e.products.length>0?e.products:s.type===i.BuyXGetY&&e.get?.products?e.get.products:[]}renderProductsLinkForModalCard(s,t){const o=this.getOfferProducts(s);return o&&0!==o.length?e("div",{class:"s-offer-products-link",onClick:s=>{s.stopPropagation(),this.selectedOfferProducts=o,this.showProductsModal=!0}},e("span",{class:"s-offer-products-link-text"},this.products_link_text),t&&e("i",{class:"sicon-keyboard_arrow_down s-offer-products-link-icon"})):null}renderAllOffersModal(){return e("salla-drawer",{visible:this.showAllOffersModal,position:"right",width:"md","no-padding":!0,"drawer-title":salla.lang.get("pages.offer.all_offers_title","جميع العروض"),onDrawerVisibilityChanged:s=>!s.detail&&this.closeAllOffersModal()},e("div",{class:"s-offer-drawer-content"},this.offersList.map(((s,e)=>this.renderModalOfferCard(s,e+1)))))}renderProductsModal(){return e("salla-drawer",{visible:this.showProductsModal,width:"md",position:"right","no-padding":!0,"drawer-title":this.products_link_text,onDrawerVisibilityChanged:s=>!s.detail&&this.closeProductsModal()},e("div",{class:"s-offer-products-drawer-content"},this.selectedOfferProducts?.length>0?e("div",null,!this.productsLoaded&&e("div",{class:"flex items-center justify-center p-8"},e("salla-loading",{size:"24"})),e("salla-products-list",{source:"selected","source-value":JSON.stringify(this.selectedOfferProducts.map((s=>s.id))),"product-card-component":this.productCardComponent,"horizontal-cards":!0,"compact-cards":!0,includes:["images"],onProductsFetched:()=>this.productsLoaded=!0})):e("div",{class:"p-4 text-center text-gray-500"},salla.lang.get("blocks.products.no_products_found","لا توجد منتجات"))))}renderModalOfferCard(s,t=1){const o=this.getOfferProducts(s),r=o&&o.length>0,a=!1!==this.collapsedOffers[s.id];return e("div",{class:"s-offer-drawer-card"},e("div",{class:"s-offer-card-main",onClick:()=>this.emitPromotionClicked(s,t)},e("div",{class:"s-offer-card-icon"},this.getOfferIcon(s.type)),e("div",{class:"s-offer-card-content"},e("h3",{class:"s-offer-card-title",title:s.title},s.title),s.description&&e("p",{class:"s-offer-card-description"},s.description),s.type===i.DiscountsTable?e("div",{class:"s-offer-card-details"},this.renderDiscountTableOfferContent(s)):s.type===i.PercentageOrFixed||s.type===i.Percentage||s.type===i.FixedAmount?e("div",{class:"s-offer-card-details"},this.renderPercentageOrFixedOfferContent(s),this.renderOfferCategories(s),this.renderOfferBrands(s),this.renderOfferTags(s)):e("div",{class:"s-offer-card-details"},this.renderOfferCategories(s),this.renderOfferBrands(s),this.renderOfferTags(s)))),r&&e("salla-accordion",{collapsed:a,collapsible:!0,size:"sm",onClick:s=>s.stopPropagation(),onAccordionToggle:e=>this.handleAccordionToggle(s.id,e.detail.payload.collapsed)},e("salla-accordion-head",{collapsible:!0,collapsed:a},e("div",{slot:"title",class:"s-offer-products-thumbnails"},e("span",{class:"s-offer-products-title"},this.products_link_text,e("i",{class:`sicon-keyboard_arrow_${a?"down":"up"} s-offer-products-link-icon`})),e("div",{class:"s-offer-products-thumbnails-stack"},o.slice(0,3).map(((s,t)=>e("div",{class:"s-offer-product-thumbnail",style:{zIndex:`${t+1}`}},e("img",{src:s.thumbnail||s.image?.url||salla.url.cdn("images/s-empty.png"),alt:s.name})))),o.length>3&&e("div",{class:"s-offer-products-more-count",style:{zIndex:"7"}},"+",o.length-3)))),e("salla-accordion-body",null,e("div",{class:"s-offer-products-content"},e("salla-products-list",{source:"selected","source-value":JSON.stringify(o.map((s=>s.id))),"product-card-component":this.productCardComponent,"horizontal-cards":!0,"compact-cards":!0,includes:["images"]})))))}renderOfferCard(s,t=1){return e("div",{class:"s-offer-slide-one-fourth swiper-slide",onClick:()=>this.emitPromotionClicked(s,t)},e("div",{class:"s-offer-card"},e("div",{class:"s-offer-card-icon"},this.getOfferIcon(s.type)),e("div",{class:"s-offer-card-content"},e("h3",{class:"s-offer-card-title",title:s.title},s.title),s.description&&e("p",{class:"s-offer-card-description"},s.description),e("div",{class:"s-offer-card-details"},s.type===i.DiscountsTable?this.renderDiscountTableOfferContent(s):s.type===i.PercentageOrFixed||s.type===i.Percentage||s.type===i.FixedAmount?[this.renderPercentageOrFixedOfferContent(s),this.renderOfferCategories(s),this.renderOfferBrands(s),this.renderOfferTags(s)]:[this.renderOfferCategories(s),this.renderOfferBrands(s),this.renderOfferTags(s)],this.renderProductsLinkForModalCard(s,!1)))))}getOfferIcon(s){return e("i",{class:{[i.DiscountsTable]:"sicon-discount-calculator",[i.Bank]:"sicon-bank",[i.SpecialPrice]:"sicon-fire",[i.BuyXGetY]:"sicon-gift",[i.PercentageOrFixed]:"sicon-special-discount",[i.Percentage]:"sicon-special-discount",[i.FixedAmount]:"sicon-special-discount"}[s]||"sicon-discount"})}renderDiscountTableOfferContent(s){const t=s.details.discounts||[];return t.length?e("div",null,e("div",{class:"s-offer-card-description"},salla.lang.get("pages.offer.discount_table_subtitle","وفر اكتر بشراء منتجات أكثر")),e("table",{class:"s-offer-discount-table"},e("tbody",null,this.groupDiscountsByRows(t,3).map(((s,t)=>e("tr",{key:t},s.map(((s,t)=>e("td",{key:t},e("div",{class:"s-offer-discount-percentage"},s.percentage,"%"),e("div",{class:"s-offer-discount-condition"},this.formatDiscountCondition(s))))))))))):null}renderPercentageOrFixedOfferContent(s){const t=s.details;return t.discount_value||t.min_spend>0||t.min_items>0?e("div",{class:"s-offer-percentage-fixed-content"},t.min_spend>0&&e("div",{class:"s-offer-min-spend"},this.min_spend_text(t.min_spend,this.userCurrency?.symbol||"")),t.min_items>0&&e("div",{class:"s-offer-min-items"},this.min_items_text(t.min_items))):null}groupDiscountsByRows(s,e){const t=[];for(let o=0;o<s.length;o+=e)t.push(s.slice(o,o+e));return t}formatDiscountCondition(s){return s.discounted_amount?`${s.discounted_amount} ${this.userCurrency?.symbol||""}`:null!=s.quantity?this.buy_quantity_text(s.quantity):`1 ${this.product_text}`}renderOfferCategories(s){const t=s.details;let o=t.categories||[];if(s.type===i.BuyXGetY&&t.get?.categories&&(o=t.get.categories),!o.length)return null;const r=this.expandedCategories[s.id],a=o.length>3,l=r?o:o.slice(0,3);return e("div",{class:"s-offer-categories"},e("div",{class:"s-offer-categories-list"},l.map(((s,t)=>e("a",{key:t,class:"s-offer-category-item",href:s.url||salla.url.create("categories",s.id||s.id_)},s.name))),a&&e("span",{class:"s-offer-categories-toggle",onClick:e=>{e.preventDefault(),e.stopPropagation(),this.toggleCategoryExpansion(s.id)}},r?e("span",null,e("i",{class:"sicon-keyboard_arrow_up"})," ",salla.lang.get("common.elements.hide","إخفاء")):e("span",null,salla.lang.get("common.elements.show","عرض")," ","+"+(o.length-3)," ",e("i",{class:"sicon-keyboard_arrow_down"})))))}renderOfferBrands(s){const t=s.details.brands||[];if(!t.length)return null;const o=this.expandedCategories[s.id],i=t.length>3,r=o?t:t.slice(0,3);return e("div",{class:"s-offer-categories"},e("div",{class:"s-offer-categories-list"},r.map(((s,t)=>e("a",{key:t,class:"s-offer-category-item",href:s.url},s.name))),i&&e("span",{class:"s-offer-categories-toggle",onClick:e=>{e.preventDefault(),e.stopPropagation(),this.toggleCategoryExpansion(s.id)}},o?e("span",null,e("i",{class:"sicon-keyboard_arrow_up"})," ",salla.lang.get("common.elements.hide","إخفاء")):e("span",null,salla.lang.get("common.elements.show","عرض")," ","+"+(t.length-3)," ",e("i",{class:"sicon-keyboard_arrow_down"})))))}renderOfferTags(s){const t=s.details.tags||[];if(!t.length)return null;const o=this.expandedCategories[s.id],i=t.length>3,r=o?t:t.slice(0,3);return e("div",{class:"s-offer-categories"},e("div",{class:"s-offer-categories-list"},r.map(((s,t)=>e("a",{key:t,class:"s-offer-category-item",href:s.url||salla.url.create("tags",s.id)},s.name))),i&&e("span",{class:"s-offer-categories-toggle",onClick:e=>{e.preventDefault(),e.stopPropagation(),this.toggleCategoryExpansion(s.id)}},o?e("span",null,e("i",{class:"sicon-keyboard_arrow_up"})," ",salla.lang.get("common.elements.hide","إخفاء")):e("span",null,salla.lang.get("common.elements.show","عرض")," ","+"+(t.length-3)," ",e("i",{class:"sicon-keyboard_arrow_down"})))))}toggleCategoryExpansion(s){this.expandedCategories={...this.expandedCategories,[s]:!this.expandedCategories[s]}}get host(){return t(this)}};r.style=":host .s-drawer-close:where([dir=rtl],[dir=rtl] *){left:0}";export{r as salla_offer}
|
|
4
|
+
import{r as s,h as e,a as t}from"./p-BDAOgcq0.js";var o,i;!function(s){s.ProductDetail="product.single",s.Cart="cart"}(o||(o={})),function(s){s.Conditional="conditional",s.PercentageOrFixed="fixed",s.DiscountsTable="discounts_table",s.Bank="bank",s.BuyXGetY="buy_x_get_y",s.SpecialPrice="special_price",s.Percentage="percentage",s.FixedAmount="fixed_amount"}(i||(i={}));const r=class{constructor(e){s(this,e),this.productCardComponent="salla-product-card",this.offersList=[],this.canRender=!1,this.showOffer=salla.config.get("store.settings.product.show_special_offers"),this.showAllOffersModal=!1,this.showProductsModal=!1,this.selectedOfferProducts=[],this.collapsedOffers={},this.expandedCategories={},this.productsLoaded=!1,this.offer_with_price_text=salla.lang.get("pages.offer.with_price",{price:""}),this.with_discount_text=salla.lang.get("pages.products.with_a_discount"),this.product_discount_text=salla.lang.get("pages.products.discount"),this.special_offer_text=salla.lang.get("pages.products.special_offer"),this.buy_quantity_text=s=>salla.lang.get("pages.offer.buy_quantity",{quantity:s}),this.products_link_text=salla.lang.get("pages.offer.included_products","المنتجات المشمولة"),this.min_spend_text=(s,e)=>salla.lang.get("pages.offer.min_spend_amount",{amount:s,currency:e},`بحد أدنى ${s} ${e} من مبلغ الشراء`),this.min_items_text=s=>salla.lang.get("pages.offer.min_items",{items:s},`بحد أدنى ${s} منتجات`),this.product_text=salla.lang.get("common.elements.product","منتج"),salla.lang.onLoaded((()=>{this.offer_with_price_text=salla.lang.get("pages.offer.with_price"),this.with_discount_text=salla.lang.get("pages.products.with_a_discount"),this.product_discount_text=salla.lang.get("pages.products.discount"),this.special_offer_text=salla.lang.get("pages.products.special_offer"),this.buy_quantity_text(0),this.products_link_text=salla.lang.get("pages.offer.included_products","المنتجات المشمولة"),this.min_spend_text=(s,e)=>salla.lang.get("pages.offer.min_spend_amount",{amount:s,currency:e},`بحد أدنى ${s} ${e} من مبلغ الشراء`),this.min_items_text=s=>salla.lang.get("pages.offer.min_items",{items:s},`بحد أدنى ${s} منتجات`),this.product_text=salla.lang.get("common.elements.product","منتج")})),salla.onReady((()=>{this.currentPage=salla.config.get("page.slug");const s=salla.config.get("currencies")||{},e=salla.config.get("user.currency_code");this.userCurrency=s[e]||{symbol:"",code:e||"SAR",name:""}}))}async getEndpointByPageName(){return this.currentPage==o.Cart?`offers/cart/${await Salla.cart.getCurrentCartId()}`:this.currentPage==o.ProductDetail?`offers/product/${salla.config.get("page.id")}`:"offers"}emitPromotionViewed(){if(!(this.offersList.length&&this.canRender&&this.showOffer))return;const s=this.offersList.slice(0,5).map(((s,e)=>({id:s.id,name:s.title,creative:s.description||"",position:e+1})));salla.event.emit("salla::offer.promotion.viewed",s)}emitPromotionClicked(s,e=1){if(!(this.offersList.length&&this.canRender&&this.showOffer))return;const t=s||this.offersList[0];salla.event.emit("salla::offer.promotion.clicked",[{id:t.id,name:t.title,creative:t.description||"",position:e}])}componentWillLoad(){return this.hasCustomComponent=!!customElements.get(this.productCardComponent),new Promise((s=>salla.onReady(s))).then((()=>{if(this.showOffer=!salla.url.is_page("product.single")||salla.config.get("store.settings.product.show_special_offers"),!this.showOffer)throw new Error("Merchant disabled showing the offers on product page")})).then((async()=>this.currentPage==o.Cart?salla.api.cart.offers():salla.api.request(await this.getEndpointByPageName()))).then((async s=>{if(!(this.offersList=s.data).length)throw new Error("salla-offers:: There is no offers!");if(this.offersList=this.offersList.filter((s=>[i.SpecialPrice,i.Bank,i.BuyXGetY,i.DiscountsTable,i.PercentageOrFixed,i.Percentage,i.FixedAmount].includes(s.type))),!this.offersList.length)throw new Error("salla-offers:: No supported offer types found!");let e=null;this.offersList.some((s=>{const e=s.details;return"category"===e.apply_to&&e.targets||"categories"===e.apply_to&&e.targets||s.type===i.BuyXGetY&&("categories"===e.get?.source||"category"===e.get?.source)}))&&(e=(await salla.product.api.categories()).data);const t=new Set;for(const s of this.offersList){const e=s.details;"product"!==e.apply_to&&"products"!==e.apply_to||!e.targets||e.targets.forEach((s=>t.add(s))),s.type===i.BuyXGetY&&"products"===e.get?.source&&e.get?.source_value&&e.get.source_value.forEach((s=>t.add(s))),s.type!==i.BuyXGetY||"products"!==e.buy?.source&&"product"!==e.buy?.source||!e.buy?.source_value||e.buy.source_value.forEach((s=>t.add(s)))}let o={};if(t.size>0)try{const s=await salla.product.api.fetch({source:"selected",source_value:Array.from(t)});o=Object.fromEntries(s.data.map((s=>[s.id,s])))}catch(s){o={}}for(const s of this.offersList){const t=s.details;if(("category"===t.apply_to&&t.targets||"categories"===t.apply_to&&t.targets)&&e&&(t.categories=this.findCategories(e,t.targets)),"product"!==t.apply_to&&"products"!==t.apply_to||!t.targets||(t.products=t.targets.map((s=>o[s])).filter(Boolean)),"brand"===t.apply_to&&t.targets&&(t.brands=t.targets),"tag"===t.apply_to&&t.targets&&(t.tags=t.targets),s.type===i.BuyXGetY&&t.get){const s=t.get;"products"===s.source&&s.source_value?s.products=s.source_value.map((s=>o[s])).filter(Boolean):("categories"===s.source||"category"===s.source)&&e&&s.source_value&&(s.categories=this.findCategories(e,s.source_value),t.categories=s.categories)}if(s.type===i.BuyXGetY&&t.buy){const s=t.buy;"products"!==s.source&&"product"!==s.source||!s.source_value||(s.products=s.source_value.map((s=>o[s])).filter(Boolean))}}return this.offersList})).then((()=>{this.canRender=!0})).catch((s=>{salla.logger.warn(s)}))}componentDidLoad(){let s=this.host.querySelector(".s-slider-block__title-nav");s?.classList.add("s-offer-bank-payment-nav"),this.emitPromotionViewed()}findCategories(s,e){let t=[];for(const o of s)e.includes(o.id_||o.id)&&t.push(o),o.sub_categories?.length>0&&(t=t.concat(this.findCategories(o.sub_categories,e)));return t}render(){if(!this.offersList.length||!this.canRender||!this.showOffer)return null;const s=salla.lang.get("pages.offer.offers_title","عروض المنتج"),t=salla.lang.get("pages.offer.offers_subtitle","احصل على المنتج بسعر مخفض مع أفضل العروض");return[e("div",{class:"s-offer-wrapper"},e("salla-slider",{type:"carousel",id:"offers-slider","block-title":s,"block-subTitle":t,"show-controls":this.offersList.length>1},e("div",{slot:"items"},this.offersList.slice(0,5).map(((s,e)=>this.renderOfferCard(s,e+1))),this.offersList.length>5&&this.renderShowMoreCard()))),this.renderAllOffersModal(),this.renderProductsModal()]}renderShowMoreCard(){return e("div",{class:"s-offer-slide-one-fourth swiper-slide",onClick:s=>{s.preventDefault(),s.stopPropagation(),this.openAllOffersModal()}},e("div",{class:"s-offer-card s-offer-show-more-card"},e("i",{class:"sicon-add s-offer-show-more-icon"}),e("h3",{class:"s-offer-show-more-title"},salla.lang.get("pages.offer.show_more_offers","عرض المزيد من العروض"))))}openAllOffersModal(){this.showAllOffersModal=!0}closeAllOffersModal(){this.showAllOffersModal=!1}closeProductsModal(){this.showProductsModal=!1,this.selectedOfferProducts=[],this.productsLoaded=!1}handleAccordionToggle(s,e){this.collapsedOffers={...this.collapsedOffers,[s]:e}}getOfferProducts(s){const e=s.details;return e.products&&e.products.length>0?e.products:s.type===i.BuyXGetY&&e.get?.products?e.get.products:[]}renderProductsLinkForModalCard(s,t){const o=this.getOfferProducts(s);return o&&0!==o.length?e("div",{class:"s-offer-products-link",onClick:s=>{s.stopPropagation(),this.selectedOfferProducts=o,this.showProductsModal=!0}},e("span",{class:"s-offer-products-link-text"},this.products_link_text),t&&e("i",{class:"sicon-keyboard_arrow_down s-offer-products-link-icon"})):null}renderAllOffersModal(){return e("salla-drawer",{visible:this.showAllOffersModal,position:"right",width:"md","no-padding":!0,"drawer-title":salla.lang.get("pages.offer.all_offers_title","جميع العروض"),onDrawerVisibilityChanged:s=>!s.detail&&this.closeAllOffersModal()},e("div",{class:"s-offer-drawer-content"},this.offersList.map(((s,e)=>this.renderModalOfferCard(s,e+1)))))}renderProductsModal(){return e("salla-drawer",{visible:this.showProductsModal,width:"md",position:"right","no-padding":!0,"drawer-title":this.products_link_text,onDrawerVisibilityChanged:s=>!s.detail&&this.closeProductsModal()},e("div",{class:"s-offer-products-drawer-content"},this.selectedOfferProducts?.length>0?e("div",null,!this.productsLoaded&&e("div",{class:"flex items-center justify-center p-8"},e("salla-loading",{size:"24"})),e("salla-products-list",{source:"selected","source-value":JSON.stringify(this.selectedOfferProducts.map((s=>s.id))),"product-card-component":this.productCardComponent,"horizontal-cards":!0,"compact-cards":!0,includes:["images"],onProductsFetched:()=>this.productsLoaded=!0})):e("div",{class:"p-4 text-center text-gray-500"},salla.lang.get("blocks.products.no_products_found","لا توجد منتجات"))))}renderModalOfferCard(s,t=1){const o=this.getOfferProducts(s),r=o&&o.length>0,a=!1!==this.collapsedOffers[s.id];return e("div",{class:"s-offer-drawer-card"},e("div",{class:"s-offer-card-main",onClick:()=>this.emitPromotionClicked(s,t)},e("div",{class:"s-offer-card-icon"},this.getOfferIcon(s.type)),e("div",{class:"s-offer-card-content"},e("h3",{class:"s-offer-card-title",title:s.title},s.title),s.description&&e("p",{class:"s-offer-card-description"},s.description),s.type===i.DiscountsTable?e("div",{class:"s-offer-card-details"},this.renderDiscountTableOfferContent(s)):s.type===i.PercentageOrFixed||s.type===i.Percentage||s.type===i.FixedAmount?e("div",{class:"s-offer-card-details"},this.renderPercentageOrFixedOfferContent(s),this.renderOfferCategories(s),this.renderOfferBrands(s),this.renderOfferTags(s)):e("div",{class:"s-offer-card-details"},this.renderOfferCategories(s),this.renderOfferBrands(s),this.renderOfferTags(s)))),r&&e("salla-accordion",{collapsed:a,collapsible:!0,size:"sm",onClick:s=>s.stopPropagation(),onAccordionToggle:e=>this.handleAccordionToggle(s.id,e.detail.payload.collapsed)},e("salla-accordion-head",{collapsible:!0,collapsed:a},e("div",{slot:"title",class:"s-offer-products-thumbnails"},e("span",{class:"s-offer-products-title"},this.products_link_text,e("i",{class:`sicon-keyboard_arrow_${a?"down":"up"} s-offer-products-link-icon`})),e("div",{class:"s-offer-products-thumbnails-stack"},o.slice(0,3).map(((s,t)=>e("div",{class:"s-offer-product-thumbnail",style:{zIndex:`${t+1}`}},e("img",{src:s.thumbnail||s.image?.url||salla.url.cdn("images/s-empty.png"),alt:s.name})))),o.length>3&&e("div",{class:"s-offer-products-more-count",style:{zIndex:"7"}},"+",o.length-3)))),e("salla-accordion-body",null,e("div",{class:"s-offer-products-content"},e("salla-products-list",{source:"selected","source-value":JSON.stringify(o.map((s=>s.id))),"product-card-component":this.productCardComponent,"horizontal-cards":!0,"compact-cards":!0,includes:["images"]})))))}renderOfferCard(s,t=1){return e("div",{class:"s-offer-slide-one-fourth swiper-slide",onClick:()=>this.emitPromotionClicked(s,t)},e("div",{class:"s-offer-card"},e("div",{class:"s-offer-card-icon"},this.getOfferIcon(s.type)),e("div",{class:"s-offer-card-content"},e("h3",{class:"s-offer-card-title",title:s.title},s.title),s.description&&e("p",{class:"s-offer-card-description"},s.description),e("div",{class:"s-offer-card-details"},s.type===i.DiscountsTable?this.renderDiscountTableOfferContent(s):s.type===i.PercentageOrFixed||s.type===i.Percentage||s.type===i.FixedAmount?[this.renderPercentageOrFixedOfferContent(s),this.renderOfferCategories(s),this.renderOfferBrands(s),this.renderOfferTags(s)]:[this.renderOfferCategories(s),this.renderOfferBrands(s),this.renderOfferTags(s)],this.renderProductsLinkForModalCard(s,!1)))))}getOfferIcon(s){return e("i",{class:{[i.DiscountsTable]:"sicon-discount-calculator",[i.Bank]:"sicon-bank",[i.SpecialPrice]:"sicon-fire",[i.BuyXGetY]:"sicon-gift",[i.PercentageOrFixed]:"sicon-special-discount",[i.Percentage]:"sicon-special-discount",[i.FixedAmount]:"sicon-special-discount"}[s]||"sicon-discount"})}renderDiscountTableOfferContent(s){const t=s.details.discounts||[];return t.length?e("div",null,e("div",{class:"s-offer-card-description"},salla.lang.get("pages.offer.discount_table_subtitle","وفر اكتر بشراء منتجات أكثر")),e("table",{class:"s-offer-discount-table"},e("tbody",null,this.groupDiscountsByRows(t,3).map(((s,t)=>e("tr",{key:t},s.map(((s,t)=>e("td",{key:t},e("div",{class:"s-offer-discount-percentage"},s.percentage,"%"),e("div",{class:"s-offer-discount-condition"},this.formatDiscountCondition(s))))))))))):null}renderPercentageOrFixedOfferContent(s){const t=s.details;return t.discount_value||t.min_spend>0||t.min_items>0?e("div",{class:"s-offer-percentage-fixed-content"},t.min_spend>0&&e("div",{class:"s-offer-min-spend"},this.min_spend_text(t.min_spend,this.userCurrency?.symbol||"")),t.min_items>0&&e("div",{class:"s-offer-min-items"},this.min_items_text(t.min_items))):null}groupDiscountsByRows(s,e){const t=[];for(let o=0;o<s.length;o+=e)t.push(s.slice(o,o+e));return t}formatDiscountCondition(s){return s.discounted_amount?`${s.discounted_amount} ${this.userCurrency?.symbol||""}`:null!=s.quantity?this.buy_quantity_text(s.quantity):`1 ${this.product_text}`}renderOfferCategories(s){const t=s.details;let o=t.categories||[];if(s.type===i.BuyXGetY&&t.get?.categories&&(o=t.get.categories),!o.length)return null;const r=this.expandedCategories[s.id],a=o.length>3,l=r?o:o.slice(0,3);return e("div",{class:"s-offer-categories"},e("div",{class:"s-offer-categories-list"},l.map(((s,t)=>e("a",{key:t,class:"s-offer-category-item",href:s.url||salla.url.create("categories",s.id||s.id_)},s.name))),a&&e("span",{class:"s-offer-categories-toggle",onClick:e=>{e.preventDefault(),e.stopPropagation(),this.toggleCategoryExpansion(s.id)}},r?e("span",null,e("i",{class:"sicon-keyboard_arrow_up"})," ",salla.lang.get("common.elements.hide","إخفاء")):e("span",null,salla.lang.get("common.elements.show","عرض")," ","+"+(o.length-3)," ",e("i",{class:"sicon-keyboard_arrow_down"})))))}renderOfferBrands(s){const t=s.details.brands||[];if(!t.length)return null;const o=this.expandedCategories[s.id],i=t.length>3,r=o?t:t.slice(0,3);return e("div",{class:"s-offer-categories"},e("div",{class:"s-offer-categories-list"},r.map(((s,t)=>e("a",{key:t,class:"s-offer-category-item",href:s.url},s.name))),i&&e("span",{class:"s-offer-categories-toggle",onClick:e=>{e.preventDefault(),e.stopPropagation(),this.toggleCategoryExpansion(s.id)}},o?e("span",null,e("i",{class:"sicon-keyboard_arrow_up"})," ",salla.lang.get("common.elements.hide","إخفاء")):e("span",null,salla.lang.get("common.elements.show","عرض")," ","+"+(t.length-3)," ",e("i",{class:"sicon-keyboard_arrow_down"})))))}renderOfferTags(s){const t=s.details.tags||[];if(!t.length)return null;const o=this.expandedCategories[s.id],i=t.length>3,r=o?t:t.slice(0,3);return e("div",{class:"s-offer-categories"},e("div",{class:"s-offer-categories-list"},r.map(((s,t)=>e("a",{key:t,class:"s-offer-category-item",href:s.url||salla.url.create("tags",s.id)},s.name))),i&&e("span",{class:"s-offer-categories-toggle",onClick:e=>{e.preventDefault(),e.stopPropagation(),this.toggleCategoryExpansion(s.id)}},o?e("span",null,e("i",{class:"sicon-keyboard_arrow_up"})," ",salla.lang.get("common.elements.hide","إخفاء")):e("span",null,salla.lang.get("common.elements.show","عرض")," ","+"+(t.length-3)," ",e("i",{class:"sicon-keyboard_arrow_down"})))))}toggleCategoryExpansion(s){this.expandedCategories={...this.expandedCategories,[s]:!this.expandedCategories[s]}}get host(){return t(this)}};r.style=":host .s-drawer-close:where([dir=rtl],[dir=rtl] *){left:0}";export{r as salla_offer}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as a,c as e,h as r,H as s}from"./p-BOjfFBGe.js";import{c as t,b as l,f as o}from"./p-Be0gsl2J.js";import{S as d}from"./p-CXRKXFgT.js";import{S as i}from"./p-cgSL_BIo.js";import{S as c}from"./p-BZp0rKEO.js";import{S as n}from"./p-8Tsmrwno.js";import{T as p}from"./p-B-m0e6tL.js";const m=class{constructor(r){a(this,r),this.loyaltyProductExchange=e(this,"loyaltyProductExchange")}componentWillLoad(){this.hasCustomCard=!!customElements.get("custom-salla-product-card")}render(){const a="string"==typeof this.product?JSON.parse(this.product):this.product;return r("div",{key:"1a430e79a1b3099353f4e9905930f083ff889def",class:"s-loyalty-exchange-card"},this.hasCustomCard?r("custom-salla-product-card",{product:a,hideAddBtn:!0}):r("salla-product-card",{"hide-add-btn":!0,product:a}),r("div",{key:"8b75d06c112af988c149b374fdd3592cd27cb490",class:"s-loyalty-exchange-card-btn"},r("salla-button",{key:"b04dc80d5af75461a5d1f938c45bf156e4592e1e",fill:"outline",width:"wide",onClick:()=>this.loyaltyProductExchange.emit({productId:a.id})},salla.lang.get("pages.loyalty_program.redeem_reward"))))}};m.style="@media (max-width: 639px){.s-loyalty-program-modal .s-modal-body{position:relative !important;left:unset !important;bottom:unset !important;max-height:100dvh;overflow-y:auto !important}}.s-loyalty-exchange-card salla-product-card .s-product-card-image,.s-loyalty-exchange-card custom-salla-product-card .s-product-card-image{flex:none;aspect-ratio:1;overflow:hidden}.s-loyalty-exchange-card-btn{padding:0 1.25rem 1.25rem;margin-top:0.75rem}.s-loyalty-program-reward-details-products-grid{display:flex;flex-wrap:wrap;gap:1rem;margin-top:0.75rem}.s-loyalty-program-reward-details-products-grid>*{flex:1 1 100%;min-width:0;touch-action:pan-y}@media (min-width: 640px){.s-loyalty-program-reward-details-products-grid>*{flex-basis:calc((100% - 1rem) / 2)}}@media (min-width: 768px){.s-loyalty-program-reward-details-products-grid>*{flex-basis:calc((100% - 2rem) / 3)}}.s-loyalty-program-reward-details-products-grid>*:only-child{max-width:320px;margin-inline:auto}.s-loyalty-program-reward-details-products-grid:has(>*:nth-child(3))>*{flex-grow:0}";const y=class{constructor(r){a(this,r),this.actionClick=e(this,"actionClick"),this.isClickable=()=>!0,this.isShopNow=a=>!!(salla.config.get("store.features")||[]).includes("loyalty-system-v2")&&"free_product"===a.key?.toLowerCase(),this.handleClick=a=>{salla.config.isGuest()?t((()=>salla.event.dispatch("login::open"))):this.actionClick.emit(a)}}render(){return this.isClickable(this.prize)?r("div",{class:"s-loyalty-program-rewards-modal-action"},this.isShopNow(this.prize)?r("salla-button",{fill:"outline",color:"light",class:"s-loyalty-program-rewards-action-base",onClick:()=>t()},salla.lang.get("common.elements.cancel")):r("button",{onClick:this.handleClick,class:{"s-loyalty-program-rewards-action-base":!0,"s-loyalty-program-rewards-action-on":!0}},salla.lang.get("pages.loyalty_program.redeem_reward"))):null}};y.style="@media (max-width: 639px){.s-loyalty-program-modal .s-modal-body{position:relative !important;left:unset !important;bottom:unset !important;max-height:100dvh;overflow-y:auto !important}}.s-loyalty-exchange-card salla-product-card .s-product-card-image,.s-loyalty-exchange-card custom-salla-product-card .s-product-card-image{flex:none;aspect-ratio:1;overflow:hidden}.s-loyalty-exchange-card-btn{padding:0 1.25rem 1.25rem;margin-top:0.75rem}.s-loyalty-program-reward-details-products-grid{display:flex;flex-wrap:wrap;gap:1rem;margin-top:0.75rem}.s-loyalty-program-reward-details-products-grid>*{flex:1 1 100%;min-width:0;touch-action:pan-y}@media (min-width: 640px){.s-loyalty-program-reward-details-products-grid>*{flex-basis:calc((100% - 1rem) / 2)}}@media (min-width: 768px){.s-loyalty-program-reward-details-products-grid>*{flex-basis:calc((100% - 2rem) / 3)}}.s-loyalty-program-reward-details-products-grid>*:only-child{max-width:320px;margin-inline:auto}.s-loyalty-program-reward-details-products-grid:has(>*:nth-child(3))>*{flex-grow:0}";const g=class{constructor(r){a(this,r),this.areaClick=e(this,"areaClick"),this.actionClick=e(this,"actionClick")}render(){return r(s,{key:"b63690e8c960ef4c33cd2510775e80fa06a39b82",class:"s-loyalty-program-reward-host"},r("div",{key:"1b5b2a02f13b30e70c38323328cf8862f0f4ba8f",class:"s-loyalty-program-reward-container"},r("div",{key:"0a35ac9e2d87f2d6c228fbb547e1842bd2243512",onClick:a=>this.areaClick.emit(a),role:"button"},r("div",{key:"aa2e1b5ce4e4fd186df5ad3fc25dc3fa3ccbb0fd",class:"s-loyalty-program-reward-img"},r("img",{key:"ecff4f5c86db5742910eaf402768422b93c001c3",alt:"",src:this.prize.image||salla.url.cdn("images/s-empty.png"),class:"s-loyalty-program-rewards-img"})),r("div",{key:"39216ef7e75a83770ba883e03aa26b39912292f6",class:"s-loyalty-program-reward-content"},r("div",{key:"047544aeaac2ac45e8782d11e6f08691f10864da",class:"s-loyalty-program-reward-points"},r("salla-badge",{key:"9564bdd0494ccb1812d30518384ede3b914edce4",size:"xs"},r("span",{key:"2a3ecf06e9475b0a2d6bff174b46ee15646312d5",innerHTML:d}),r("span",{key:"776d694e330d57366c084aa321845e964825cfe9",class:"s-loyalty-program-rewards-points",innerHTML:salla.lang.choice("pages.loyalty_program.points",this.prize.cost_points)}))),r("div",{key:"05e322f1a272ca223d431905c9566cc57af9e8b4",class:"s-loyalty-program-reward-title"},r("span",{key:"b3699e555190bb1c45c14a46c2c16a620ebcd9af"},this.prize.group_title)),r("div",{key:"fbdac88e90edf90ee1c6d7c66add35d28141ad36",class:"s-loyalty-program-reward-name"},r("div",{key:"5f2b92831df7628b390921098cd84849b9f13a4d",class:"s-loyalty-program-rewards-name",id:`prize-${this.prize.id}`},this.prize.name,this.prize.description?`: ${this.prize.description}`:"")))),r("div",{key:"f0f23a84cd12ba830212df2bee319f1e05bc5752",class:"p-4"},r("slot",{key:"33e3a2e4fe99e3db9300b69b14cba240e1c9b4de",name:"action"},r("button",{key:"70f128d1ebaba775b9cd5848f043abf9f5f8163f",onClick:a=>this.actionClick.emit(a.detail),class:"s-loyalty-program-rewards-action-base s-loyalty-program-rewards-action-on"},salla.lang.get("pages.loyalty_program.show_reward"))))))}};g.style="@media (max-width: 639px){.s-loyalty-program-modal .s-modal-body{position:relative !important;left:unset !important;bottom:unset !important;max-height:100dvh;overflow-y:auto !important}}.s-loyalty-exchange-card salla-product-card .s-product-card-image,.s-loyalty-exchange-card custom-salla-product-card .s-product-card-image{flex:none;aspect-ratio:1;overflow:hidden}.s-loyalty-exchange-card-btn{padding:0 1.25rem 1.25rem;margin-top:0.75rem}.s-loyalty-program-reward-details-products-grid{display:flex;flex-wrap:wrap;gap:1rem;margin-top:0.75rem}.s-loyalty-program-reward-details-products-grid>*{flex:1 1 100%;min-width:0;touch-action:pan-y}@media (min-width: 640px){.s-loyalty-program-reward-details-products-grid>*{flex-basis:calc((100% - 1rem) / 2)}}@media (min-width: 768px){.s-loyalty-program-reward-details-products-grid>*{flex-basis:calc((100% - 2rem) / 3)}}.s-loyalty-program-reward-details-products-grid>*:only-child{max-width:320px;margin-inline:auto}.s-loyalty-program-reward-details-products-grid:has(>*:nth-child(3))>*{flex-grow:0}";var h=function(a,e,r,s){var t,l=arguments.length,o=l<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,r):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(a,e,r,s);else for(var d=a.length-1;d>=0;d--)(t=a[d])&&(o=(l<3?t(o):l>3?t(e,r,o):t(e,r))||o);return l>3&&o&&Object.defineProperty(e,r,o),o};const f=(...a)=>a.map((a=>"s-loyalty-program-"+a)).join(" "),u=class{constructor(r){a(this,r),this.actionClick=e(this,"actionClick"),this.productActionClick=e(this,"productActionClick"),this.refreshKey=Date.now(),this.includedProductsData=[]}handleProductExchange(a){this.productActionClick.emit({productId:a.detail.productId})}handlePrizeChange(){this.refreshKey=Date.now(),this.fetchIncludedProducts()}componentWillLoad(){"idle"===this.category.status&&this.category(),"idle"===this.brand.status&&this.brand(),this.fetchIncludedProducts()}async fetchIncludedProducts(){this.includedProductsData=[];const a=this.prize?.included_product_ids;if(!a?.length)return;const e=this.prize;try{const r=await salla.api.withoutNotifier((()=>salla.product.api.fetch({source:"selected",source_value:a})));this.prize===e&&(this.includedProductsData=r.data||[])}catch{this.includedProductsData=[]}}getTermsAndConditions(){const a=Number((this.prize.order_minimum_amount||"0").split(".")[0])||0,e=Number((this.prize.coupon_maximum_amount||"0").split(".")[0])||0,r=[];return a&&r.push([salla.lang.get("pages.loyalty_program.order_minimum_amount"),`${a} ${salla.lang.get(`currency.${(salla.config.get("user.currency_code")||"").toLowerCase()}`)}`]),e&&r.push([salla.lang.get("pages.loyalty_program.coupon_maximum_amount"),`${e} ${salla.lang.get(`currency.${(salla.config.get("user.currency_code")||"").toLowerCase()}`)}`]),r}findItems(a){return a?.length?this.brand.data.concat(this.category.data).filter((e=>a.includes(e.id_))):[]}getIncludedItems(a,e){return a?.length?a:e?.length?this.findItems(e):[]}getProductIds(a){return a||[]}getItemsMarkers(a){return"both"===a?this.getItemsMarkers("included")+this.getItemsMarkers("excluded"):[this.prize[`${a}_product_ids`]?.length||0,this.prize[`${a}_brand_ids`]?.length||0,this.prize[`${a}_category_ids`]?.length||0].map(Boolean).map(Number).join("")}getItemsMarkersText(){if("FREE_SHIPPING"===this.prize.key)return salla.lang.get("pages.loyalty_program.redeem_for_free_shipping");switch(this.getItemsMarkers("included")){case"001":default:return salla.lang.get("pages.loyalty_program.redeem_on_specific_products");case"010":return salla.lang.get("pages.loyalty_program.redeem_on_specific_brands");case"100":return salla.lang.get("pages.loyalty_program.redeem_on_specific_categories");case"000":return salla.lang.get("pages.loyalty_program.redeem_on_all_products")}}getCategoriesJsx(a,e){return a.length?r("div",{class:f("reward-details-categories-wrapper")},r("div",{class:f("reward-details-categories")},r("h2",{class:f("reward-details-categories-heading")},e),r("ul",{class:f("reward-details-categories-list")},a.map((a=>r("li",null,r("a",{href:a.urls?.customer||a.url||a.lingual_urls?.[0],class:f("reward-details-categories-item")},r("span",{innerHTML:i}),r("span",{class:f("reward-details-categories-item-content")},a.name)))))))):""}getBrandsJsx(a,e){return a.length?r("div",{class:f("reward-details-items-brands","slider-arrows-edges")},r("div",null,r("h2",null,e),r("salla-slider",{id:`brands-${a.map((({id:a})=>a)).join("-")}`,"slider-config":'{"loop":false,"slidesPerView":"auto","spaceBetween":10}'},r("div",{slot:"items"},a.map((a=>r("a",{href:salla.url.get(l(a)),class:f("reward-brand-item")},r("img",{src:a.logo||salla.url.cdn("images/s-empty.png"),alt:""})))))))):""}getProductsJsx(a,e){return a?.length?r("div",{class:"s-loyalty-program-reward-details-items-products s-loyalty-program-slider-arrows-edges"},r("h2",null,e),r("salla-products-slider",{source:"selected",sourceValue:JSON.stringify(a),"slider-config":'{"loop":false,"slidesPerView":"auto","freeMode":true,"spaceBetween":0,"breakpoints":{"768":{"slidesPerView":3,"freeMode":false,"speed":300}}}'})):""}getIncludedProductsJsx(a){const e=this.includedProductsData;return e?.length?r("div",{class:f("reward-details-items-products")},r("h2",null,a),r("div",{class:f("reward-details-products-grid")},e.map((a=>r("salla-loyalty-exchange-product-card",{product:a}))))):""}render(){const a=this.getTermsAndConditions();return r("div",{key:"08f402196aa5268a8bbf1dba1e037c45c33ae8a5",class:"s-loyalty-program-reward-modal"},r("div",{key:"75ae87a6055125371003a6bfd4e3f94c4a462c08",class:"s-loyalty-program-points-modal-header"},r("h1",{key:"4296046ef1409ec92c95e37fbea65506fb37929c",class:"s-loyalty-program-points-modal-info"},salla.url.is_page("cart")?r("button",{class:"s-loyalty-program-back-btn",onClick:()=>t((()=>salla.event.dispatch("modal::open","loyalty-rewards-modal")))},r("span",{class:{"sicon-arrow-right":"rtl"===document.documentElement.getAttribute("dir"),"sicon-arrow-left":"ltr"===document.documentElement.getAttribute("dir")}})):"",this.prize.name)),r("div",{key:"b6fd9d5a010059e928321acf5b6e904044b20513",class:"s-loyalty-program-modal-scrollable-content"},r("div",{key:"ed9572e46bb3d0ebd71a7b8eeb363433024cefbd",class:"s-loyalty-program-reward-details-header"},r("div",{key:"016fa0be4fd911293dc5a9f9f239398eae863c3f",class:"s-loyalty-program-aspect-container"},r("img",{key:"365a070a815b146dd92e2f6ca163d240c48ea862",src:this.prize.image,alt:this.prize.name})),r("salla-badge",{key:"510102d16996e3e0da9daaf6da2ab219c05e3978",size:"sm",bg:"light"},r("span",{key:"2179f7c46fadf1b5f0c030439347714a689781a4",innerHTML:d}),r("span",{key:"99a756bc4f7c6e03207a1c0d3364814c036e284b",class:"s-loyalty-program-points-badge-points"},o(this.prize.cost_points)))),a.length?r("div",{class:"s-loyalty-program-terms-and-conditions"},r("h1",{class:"s-loyalty-program-terms-and-conditions-heading"},salla.lang.get("pages.loyalty_program.terms_and_conditions")),r("ul",{class:"s-loyalty-program-terms-and-conditions-list"},a.map((([a,e])=>r("li",{class:"s-loyalty-program-terms-and-conditions-item"},r("span",{class:"s-loyalty-program-terms-and-conditions-content"},a),r("span",{class:"s-loyalty-program-terms-and-conditions-content"},e)))))):"",r("div",{key:"a4e7a863b7b7f9fad0c98a0ed0882bd5db4081c3",class:"s-loyalty-program-reward-info-message"},r("h1",{key:"ef8b9e64808bdf59f8bedf74f912ef07a92c3318",class:"s-loyalty-program-reward-info-message-heading"},salla.lang.get("pages.loyalty_program.how_to_benefit_from_this_reward")),r("p",{key:"8777469b48d9c65b33d73d3dc510397f7255641e",class:"s-loyalty-program-reward-info-message-content"},this.getItemsMarkersText())),"FREE_SHIPPING"===this.prize.key||"000000"===this.getItemsMarkers("both")?"":r("div",{class:"s-loyalty-program-reward-details"},r("salla-tabs",{key:this.refreshKey},"000"===this.getItemsMarkers("included")?"":[r("salla-tab-header",{slot:"header",name:"included",style:{display:"000"===this.getItemsMarkers("excluded")?"none":"block"}},r("span",{class:"s-loyalty-program-reward-details-tab-icon",innerHTML:c}),r("span",null,salla.lang.get("pages.loyalty_program.included"))),r("salla-tab-content",{slot:"content",name:"included"},r("div",{class:"s-loyalty-program-reward-details-items-wrapper"},this.getCategoriesJsx(this.getIncludedItems(this.prize.categories,this.prize.included_category_ids),salla.lang.get("pages.loyalty_program.included_categories")),this.getBrandsJsx(this.getIncludedItems(this.prize.brands,this.prize.included_brand_ids),salla.lang.get("pages.loyalty_program.included_brands")),this.getIncludedProductsJsx(salla.lang.get("pages.loyalty_program.included_products"))))],"000"===this.getItemsMarkers("excluded")?"":[r("salla-tab-header",{slot:"header",name:"excluded",style:{display:"000"===this.getItemsMarkers("included")?"none":"block"}},r("span",{class:"s-loyalty-program-reward-details-tab-icon",innerHTML:n}),r("span",null,salla.lang.get("pages.loyalty_program.excluded"))),r("salla-tab-content",{slot:"content",name:"excluded"},r("div",{class:"s-loyalty-program-reward-details-items-wrapper"},this.getCategoriesJsx(this.getIncludedItems(this.prize.excludedCategories,this.prize.excluded_category_ids),salla.lang.get("pages.loyalty_program.excluded_categories")),this.getBrandsJsx(this.getIncludedItems(this.prize.excludedBrands,this.prize.excluded_brand_ids),salla.lang.get("pages.loyalty_program.excluded_brands")),this.getProductsJsx(this.getProductIds(this.prize.excluded_product_ids),salla.lang.get("pages.loyalty_program.excluded_products"))))]))),r("salla-reward-action",{key:"aaad339124dd3e8fcac568540d627d6105712d2f",onActionClick:a=>this.actionClick.emit(a.detail),prize:this.prize}))}static get watchers(){return{prize:["handlePrizeChange"]}}};h([p((async()=>(await salla.product.api.categories()).data),{initialData:[]})],u.prototype,"category",void 0),h([p((async()=>(await salla.api.request("/brands")).data),{initialData:[]})],u.prototype,"brand",void 0),u.style="@media (max-width: 639px){.s-loyalty-program-modal .s-modal-body{position:relative !important;left:unset !important;bottom:unset !important;max-height:100dvh;overflow-y:auto !important}}.s-loyalty-exchange-card salla-product-card .s-product-card-image,.s-loyalty-exchange-card custom-salla-product-card .s-product-card-image{flex:none;aspect-ratio:1;overflow:hidden}.s-loyalty-exchange-card-btn{padding:0 1.25rem 1.25rem;margin-top:0.75rem}.s-loyalty-program-reward-details-products-grid{display:flex;flex-wrap:wrap;gap:1rem;margin-top:0.75rem}.s-loyalty-program-reward-details-products-grid>*{flex:1 1 100%;min-width:0;touch-action:pan-y}@media (min-width: 640px){.s-loyalty-program-reward-details-products-grid>*{flex-basis:calc((100% - 1rem) / 2)}}@media (min-width: 768px){.s-loyalty-program-reward-details-products-grid>*{flex-basis:calc((100% - 2rem) / 3)}}.s-loyalty-program-reward-details-products-grid>*:only-child{max-width:320px;margin-inline:auto}.s-loyalty-program-reward-details-products-grid:has(>*:nth-child(3))>*{flex-grow:0}";const b=class{constructor(e){a(this,e),this.productId=null}reset(a=0){setTimeout((()=>{t()}),a)}getApiErrorMessage(a){return a?.response?.data?.error?.message||a?.response?.data?.message||("string"==typeof a?a:null)||salla.lang.get("common.errors.error_occurred")}async handleConfirm(){try{await this.exchange(this.prize.id,null,this.productId),this.reset(300)}catch(a){salla.notify.error(this.getApiErrorMessage(a))}}handleCancel(){this.reset(0)}render(){return r(s,{key:"98f0ce7506f94fc6c9c5dd881791d7298daa0e0b"},r("div",{key:"72661d140a8dd7b6fe8b68a120ba00f951aeb6e4",class:"s-loyalty-program-exchange-heading"},r("div",{key:"dfad67d7df6e3fde30c463791eb45ae5b356fc96",class:"s-loyalty-program-circle-base s-loyalty-program-circle-size-xl s-loyalty-program-circle-variant-fill"},r("span",{key:"04d0832e50209a87605cf016d0a462640d6379ed",innerHTML:d})),r("h2",{key:"bf7282fbb2cfb9675c0c219d65c090a95e0177f3"},salla.lang.get("pages.loyalty_program.redeem_reward")),r("p",{key:"551233696f0b1a5b8d233bcbd618e8c6f65e9bf6"},salla.lang.get("pages.loyalty_program.redeem_confirmation")," ",r("span",{key:"780e095949141888f02d165c44a648d6569ee56a"},"(",this.prize.cost_points," ",salla.lang.get("pages.loyalty_program.point"),")")," ",salla.lang.get("pages.loyalty_program.for")," ",r("span",{key:"fac6c243a373833091bbd276d7f416c04f89abb7"},"(",this.prize.name,")"))),r("div",{key:"f806352839b2914570ee4331d3412224533cc1ca",class:"s-loyalty-program-exchange-btns"},r("salla-button",{key:"12a4c1d19a6f1ad7ac5acf09a4861b708f25fa42",width:"wide",loading:"pending"===this.exchange.status,onClick:()=>this.handleConfirm()},salla.lang.get("common.elements.confirm")),r("salla-button",{key:"5caa8e6cec4b4fc8f4968742d7de26282cb26c35",width:"wide",fill:"outline",color:"danger",onClick:()=>this.handleCancel()},salla.lang.get("common.elements.cancel"))))}};(function(a,e,r,s){var t,l=arguments.length,o=l<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,r):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(a,e,r,s);else for(var d=a.length-1;d>=0;d--)(t=a[d])&&(o=(l<3?t(o):l>3?t(e,r,o):t(e,r))||o);l>3&&o&&Object.defineProperty(e,r,o)})([p((async(...a)=>await salla.loyalty.exchange(...a)))],b.prototype,"exchange",void 0),b.style="@media (max-width: 639px){.s-loyalty-program-modal .s-modal-body{position:relative !important;left:unset !important;bottom:unset !important;max-height:100dvh;overflow-y:auto !important}}.s-loyalty-exchange-card salla-product-card .s-product-card-image,.s-loyalty-exchange-card custom-salla-product-card .s-product-card-image{flex:none;aspect-ratio:1;overflow:hidden}.s-loyalty-exchange-card-btn{padding:0 1.25rem 1.25rem;margin-top:0.75rem}.s-loyalty-program-reward-details-products-grid{display:flex;flex-wrap:wrap;gap:1rem;margin-top:0.75rem}.s-loyalty-program-reward-details-products-grid>*{flex:1 1 100%;min-width:0;touch-action:pan-y}@media (min-width: 640px){.s-loyalty-program-reward-details-products-grid>*{flex-basis:calc((100% - 1rem) / 2)}}@media (min-width: 768px){.s-loyalty-program-reward-details-products-grid>*{flex-basis:calc((100% - 2rem) / 3)}}.s-loyalty-program-reward-details-products-grid>*:only-child{max-width:320px;margin-inline:auto}.s-loyalty-program-reward-details-products-grid:has(>*:nth-child(3))>*{flex-grow:0}";export{m as salla_loyalty_exchange_product_card,y as salla_reward_action,g as salla_reward_card,u as salla_reward_details,b as salla_reward_exchange}
|
|
4
|
+
import{r as a,c as e,h as r,H as s}from"./p-BDAOgcq0.js";import{c as t,b as l,f as o}from"./p-DzjKtVuN.js";import{S as d}from"./p-CXRKXFgT.js";import{S as i}from"./p-cgSL_BIo.js";import{S as c}from"./p-BZp0rKEO.js";import{S as n}from"./p-8Tsmrwno.js";import{T as p}from"./p-BqhIuaLC.js";const m=class{constructor(r){a(this,r),this.loyaltyProductExchange=e(this,"loyaltyProductExchange")}componentWillLoad(){this.hasCustomCard=!!customElements.get("custom-salla-product-card")}render(){const a="string"==typeof this.product?JSON.parse(this.product):this.product;return r("div",{key:"1a430e79a1b3099353f4e9905930f083ff889def",class:"s-loyalty-exchange-card"},this.hasCustomCard?r("custom-salla-product-card",{product:a,hideAddBtn:!0}):r("salla-product-card",{"hide-add-btn":!0,product:a}),r("div",{key:"8b75d06c112af988c149b374fdd3592cd27cb490",class:"s-loyalty-exchange-card-btn"},r("salla-button",{key:"b04dc80d5af75461a5d1f938c45bf156e4592e1e",fill:"outline",width:"wide",onClick:()=>this.loyaltyProductExchange.emit({productId:a.id})},salla.lang.get("pages.loyalty_program.redeem_reward"))))}};m.style="@media (max-width: 639px){.s-loyalty-program-modal .s-modal-body{position:relative !important;left:unset !important;bottom:unset !important;max-height:100dvh;overflow-y:auto !important}}.s-loyalty-exchange-card salla-product-card .s-product-card-image,.s-loyalty-exchange-card custom-salla-product-card .s-product-card-image{flex:none;aspect-ratio:1;overflow:hidden}.s-loyalty-exchange-card-btn{padding:0 1.25rem 1.25rem;margin-top:0.75rem}.s-loyalty-program-reward-details-products-grid{display:flex;flex-wrap:wrap;gap:1rem;margin-top:0.75rem}.s-loyalty-program-reward-details-products-grid>*{flex:1 1 100%;min-width:0;touch-action:pan-y}@media (min-width: 640px){.s-loyalty-program-reward-details-products-grid>*{flex-basis:calc((100% - 1rem) / 2)}}@media (min-width: 768px){.s-loyalty-program-reward-details-products-grid>*{flex-basis:calc((100% - 2rem) / 3)}}.s-loyalty-program-reward-details-products-grid>*:only-child{max-width:320px;margin-inline:auto}.s-loyalty-program-reward-details-products-grid:has(>*:nth-child(3))>*{flex-grow:0}";const y=class{constructor(r){a(this,r),this.actionClick=e(this,"actionClick"),this.isClickable=()=>!0,this.isShopNow=a=>!!(salla.config.get("store.features")||[]).includes("loyalty-system-v2")&&"free_product"===a.key?.toLowerCase(),this.handleClick=a=>{salla.config.isGuest()?t((()=>salla.event.dispatch("login::open"))):this.actionClick.emit(a)}}render(){return this.isClickable(this.prize)?r("div",{class:"s-loyalty-program-rewards-modal-action"},this.isShopNow(this.prize)?r("salla-button",{fill:"outline",color:"light",class:"s-loyalty-program-rewards-action-base",onClick:()=>t()},salla.lang.get("common.elements.cancel")):r("button",{onClick:this.handleClick,class:{"s-loyalty-program-rewards-action-base":!0,"s-loyalty-program-rewards-action-on":!0}},salla.lang.get("pages.loyalty_program.redeem_reward"))):null}};y.style="@media (max-width: 639px){.s-loyalty-program-modal .s-modal-body{position:relative !important;left:unset !important;bottom:unset !important;max-height:100dvh;overflow-y:auto !important}}.s-loyalty-exchange-card salla-product-card .s-product-card-image,.s-loyalty-exchange-card custom-salla-product-card .s-product-card-image{flex:none;aspect-ratio:1;overflow:hidden}.s-loyalty-exchange-card-btn{padding:0 1.25rem 1.25rem;margin-top:0.75rem}.s-loyalty-program-reward-details-products-grid{display:flex;flex-wrap:wrap;gap:1rem;margin-top:0.75rem}.s-loyalty-program-reward-details-products-grid>*{flex:1 1 100%;min-width:0;touch-action:pan-y}@media (min-width: 640px){.s-loyalty-program-reward-details-products-grid>*{flex-basis:calc((100% - 1rem) / 2)}}@media (min-width: 768px){.s-loyalty-program-reward-details-products-grid>*{flex-basis:calc((100% - 2rem) / 3)}}.s-loyalty-program-reward-details-products-grid>*:only-child{max-width:320px;margin-inline:auto}.s-loyalty-program-reward-details-products-grid:has(>*:nth-child(3))>*{flex-grow:0}";const g=class{constructor(r){a(this,r),this.areaClick=e(this,"areaClick"),this.actionClick=e(this,"actionClick")}render(){return r(s,{key:"b63690e8c960ef4c33cd2510775e80fa06a39b82",class:"s-loyalty-program-reward-host"},r("div",{key:"1b5b2a02f13b30e70c38323328cf8862f0f4ba8f",class:"s-loyalty-program-reward-container"},r("div",{key:"0a35ac9e2d87f2d6c228fbb547e1842bd2243512",onClick:a=>this.areaClick.emit(a),role:"button"},r("div",{key:"aa2e1b5ce4e4fd186df5ad3fc25dc3fa3ccbb0fd",class:"s-loyalty-program-reward-img"},r("img",{key:"ecff4f5c86db5742910eaf402768422b93c001c3",alt:"",src:this.prize.image||salla.url.cdn("images/s-empty.png"),class:"s-loyalty-program-rewards-img"})),r("div",{key:"39216ef7e75a83770ba883e03aa26b39912292f6",class:"s-loyalty-program-reward-content"},r("div",{key:"047544aeaac2ac45e8782d11e6f08691f10864da",class:"s-loyalty-program-reward-points"},r("salla-badge",{key:"9564bdd0494ccb1812d30518384ede3b914edce4",size:"xs"},r("span",{key:"2a3ecf06e9475b0a2d6bff174b46ee15646312d5",innerHTML:d}),r("span",{key:"776d694e330d57366c084aa321845e964825cfe9",class:"s-loyalty-program-rewards-points",innerHTML:salla.lang.choice("pages.loyalty_program.points",this.prize.cost_points)}))),r("div",{key:"05e322f1a272ca223d431905c9566cc57af9e8b4",class:"s-loyalty-program-reward-title"},r("span",{key:"b3699e555190bb1c45c14a46c2c16a620ebcd9af"},this.prize.group_title)),r("div",{key:"fbdac88e90edf90ee1c6d7c66add35d28141ad36",class:"s-loyalty-program-reward-name"},r("div",{key:"5f2b92831df7628b390921098cd84849b9f13a4d",class:"s-loyalty-program-rewards-name",id:`prize-${this.prize.id}`},this.prize.name,this.prize.description?`: ${this.prize.description}`:"")))),r("div",{key:"f0f23a84cd12ba830212df2bee319f1e05bc5752",class:"p-4"},r("slot",{key:"33e3a2e4fe99e3db9300b69b14cba240e1c9b4de",name:"action"},r("button",{key:"70f128d1ebaba775b9cd5848f043abf9f5f8163f",onClick:a=>this.actionClick.emit(a.detail),class:"s-loyalty-program-rewards-action-base s-loyalty-program-rewards-action-on"},salla.lang.get("pages.loyalty_program.show_reward"))))))}};g.style="@media (max-width: 639px){.s-loyalty-program-modal .s-modal-body{position:relative !important;left:unset !important;bottom:unset !important;max-height:100dvh;overflow-y:auto !important}}.s-loyalty-exchange-card salla-product-card .s-product-card-image,.s-loyalty-exchange-card custom-salla-product-card .s-product-card-image{flex:none;aspect-ratio:1;overflow:hidden}.s-loyalty-exchange-card-btn{padding:0 1.25rem 1.25rem;margin-top:0.75rem}.s-loyalty-program-reward-details-products-grid{display:flex;flex-wrap:wrap;gap:1rem;margin-top:0.75rem}.s-loyalty-program-reward-details-products-grid>*{flex:1 1 100%;min-width:0;touch-action:pan-y}@media (min-width: 640px){.s-loyalty-program-reward-details-products-grid>*{flex-basis:calc((100% - 1rem) / 2)}}@media (min-width: 768px){.s-loyalty-program-reward-details-products-grid>*{flex-basis:calc((100% - 2rem) / 3)}}.s-loyalty-program-reward-details-products-grid>*:only-child{max-width:320px;margin-inline:auto}.s-loyalty-program-reward-details-products-grid:has(>*:nth-child(3))>*{flex-grow:0}";var h=function(a,e,r,s){var t,l=arguments.length,o=l<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,r):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(a,e,r,s);else for(var d=a.length-1;d>=0;d--)(t=a[d])&&(o=(l<3?t(o):l>3?t(e,r,o):t(e,r))||o);return l>3&&o&&Object.defineProperty(e,r,o),o};const f=(...a)=>a.map((a=>"s-loyalty-program-"+a)).join(" "),u=class{constructor(r){a(this,r),this.actionClick=e(this,"actionClick"),this.productActionClick=e(this,"productActionClick"),this.refreshKey=Date.now(),this.includedProductsData=[]}handleProductExchange(a){this.productActionClick.emit({productId:a.detail.productId})}handlePrizeChange(){this.refreshKey=Date.now(),this.fetchIncludedProducts()}componentWillLoad(){"idle"===this.category.status&&this.category(),"idle"===this.brand.status&&this.brand(),this.fetchIncludedProducts()}async fetchIncludedProducts(){this.includedProductsData=[];const a=this.prize?.included_product_ids;if(!a?.length)return;const e=this.prize;try{const r=await salla.api.withoutNotifier((()=>salla.product.api.fetch({source:"selected",source_value:a})));this.prize===e&&(this.includedProductsData=r.data||[])}catch{this.includedProductsData=[]}}getTermsAndConditions(){const a=Number((this.prize.order_minimum_amount||"0").split(".")[0])||0,e=Number((this.prize.coupon_maximum_amount||"0").split(".")[0])||0,r=[];return a&&r.push([salla.lang.get("pages.loyalty_program.order_minimum_amount"),`${a} ${salla.lang.get(`currency.${(salla.config.get("user.currency_code")||"").toLowerCase()}`)}`]),e&&r.push([salla.lang.get("pages.loyalty_program.coupon_maximum_amount"),`${e} ${salla.lang.get(`currency.${(salla.config.get("user.currency_code")||"").toLowerCase()}`)}`]),r}findItems(a){return a?.length?this.brand.data.concat(this.category.data).filter((e=>a.includes(e.id_))):[]}getIncludedItems(a,e){return a?.length?a:e?.length?this.findItems(e):[]}getProductIds(a){return a||[]}getItemsMarkers(a){return"both"===a?this.getItemsMarkers("included")+this.getItemsMarkers("excluded"):[this.prize[`${a}_product_ids`]?.length||0,this.prize[`${a}_brand_ids`]?.length||0,this.prize[`${a}_category_ids`]?.length||0].map(Boolean).map(Number).join("")}getItemsMarkersText(){if("FREE_SHIPPING"===this.prize.key)return salla.lang.get("pages.loyalty_program.redeem_for_free_shipping");switch(this.getItemsMarkers("included")){case"001":default:return salla.lang.get("pages.loyalty_program.redeem_on_specific_products");case"010":return salla.lang.get("pages.loyalty_program.redeem_on_specific_brands");case"100":return salla.lang.get("pages.loyalty_program.redeem_on_specific_categories");case"000":return salla.lang.get("pages.loyalty_program.redeem_on_all_products")}}getCategoriesJsx(a,e){return a.length?r("div",{class:f("reward-details-categories-wrapper")},r("div",{class:f("reward-details-categories")},r("h2",{class:f("reward-details-categories-heading")},e),r("ul",{class:f("reward-details-categories-list")},a.map((a=>r("li",null,r("a",{href:a.urls?.customer||a.url||a.lingual_urls?.[0],class:f("reward-details-categories-item")},r("span",{innerHTML:i}),r("span",{class:f("reward-details-categories-item-content")},a.name)))))))):""}getBrandsJsx(a,e){return a.length?r("div",{class:f("reward-details-items-brands","slider-arrows-edges")},r("div",null,r("h2",null,e),r("salla-slider",{id:`brands-${a.map((({id:a})=>a)).join("-")}`,"slider-config":'{"loop":false,"slidesPerView":"auto","spaceBetween":10}'},r("div",{slot:"items"},a.map((a=>r("a",{href:salla.url.get(l(a)),class:f("reward-brand-item")},r("img",{src:a.logo||salla.url.cdn("images/s-empty.png"),alt:""})))))))):""}getProductsJsx(a,e){return a?.length?r("div",{class:"s-loyalty-program-reward-details-items-products s-loyalty-program-slider-arrows-edges"},r("h2",null,e),r("salla-products-slider",{source:"selected",sourceValue:JSON.stringify(a),"slider-config":'{"loop":false,"slidesPerView":"auto","freeMode":true,"spaceBetween":0,"breakpoints":{"768":{"slidesPerView":3,"freeMode":false,"speed":300}}}'})):""}getIncludedProductsJsx(a){const e=this.includedProductsData;return e?.length?r("div",{class:f("reward-details-items-products")},r("h2",null,a),r("div",{class:f("reward-details-products-grid")},e.map((a=>r("salla-loyalty-exchange-product-card",{product:a}))))):""}render(){const a=this.getTermsAndConditions();return r("div",{key:"08f402196aa5268a8bbf1dba1e037c45c33ae8a5",class:"s-loyalty-program-reward-modal"},r("div",{key:"75ae87a6055125371003a6bfd4e3f94c4a462c08",class:"s-loyalty-program-points-modal-header"},r("h1",{key:"4296046ef1409ec92c95e37fbea65506fb37929c",class:"s-loyalty-program-points-modal-info"},salla.url.is_page("cart")?r("button",{class:"s-loyalty-program-back-btn",onClick:()=>t((()=>salla.event.dispatch("modal::open","loyalty-rewards-modal")))},r("span",{class:{"sicon-arrow-right":"rtl"===document.documentElement.getAttribute("dir"),"sicon-arrow-left":"ltr"===document.documentElement.getAttribute("dir")}})):"",this.prize.name)),r("div",{key:"b6fd9d5a010059e928321acf5b6e904044b20513",class:"s-loyalty-program-modal-scrollable-content"},r("div",{key:"ed9572e46bb3d0ebd71a7b8eeb363433024cefbd",class:"s-loyalty-program-reward-details-header"},r("div",{key:"016fa0be4fd911293dc5a9f9f239398eae863c3f",class:"s-loyalty-program-aspect-container"},r("img",{key:"365a070a815b146dd92e2f6ca163d240c48ea862",src:this.prize.image,alt:this.prize.name})),r("salla-badge",{key:"510102d16996e3e0da9daaf6da2ab219c05e3978",size:"sm",bg:"light"},r("span",{key:"2179f7c46fadf1b5f0c030439347714a689781a4",innerHTML:d}),r("span",{key:"99a756bc4f7c6e03207a1c0d3364814c036e284b",class:"s-loyalty-program-points-badge-points"},o(this.prize.cost_points)))),a.length?r("div",{class:"s-loyalty-program-terms-and-conditions"},r("h1",{class:"s-loyalty-program-terms-and-conditions-heading"},salla.lang.get("pages.loyalty_program.terms_and_conditions")),r("ul",{class:"s-loyalty-program-terms-and-conditions-list"},a.map((([a,e])=>r("li",{class:"s-loyalty-program-terms-and-conditions-item"},r("span",{class:"s-loyalty-program-terms-and-conditions-content"},a),r("span",{class:"s-loyalty-program-terms-and-conditions-content"},e)))))):"",r("div",{key:"a4e7a863b7b7f9fad0c98a0ed0882bd5db4081c3",class:"s-loyalty-program-reward-info-message"},r("h1",{key:"ef8b9e64808bdf59f8bedf74f912ef07a92c3318",class:"s-loyalty-program-reward-info-message-heading"},salla.lang.get("pages.loyalty_program.how_to_benefit_from_this_reward")),r("p",{key:"8777469b48d9c65b33d73d3dc510397f7255641e",class:"s-loyalty-program-reward-info-message-content"},this.getItemsMarkersText())),"FREE_SHIPPING"===this.prize.key||"000000"===this.getItemsMarkers("both")?"":r("div",{class:"s-loyalty-program-reward-details"},r("salla-tabs",{key:this.refreshKey},"000"===this.getItemsMarkers("included")?"":[r("salla-tab-header",{slot:"header",name:"included",style:{display:"000"===this.getItemsMarkers("excluded")?"none":"block"}},r("span",{class:"s-loyalty-program-reward-details-tab-icon",innerHTML:c}),r("span",null,salla.lang.get("pages.loyalty_program.included"))),r("salla-tab-content",{slot:"content",name:"included"},r("div",{class:"s-loyalty-program-reward-details-items-wrapper"},this.getCategoriesJsx(this.getIncludedItems(this.prize.categories,this.prize.included_category_ids),salla.lang.get("pages.loyalty_program.included_categories")),this.getBrandsJsx(this.getIncludedItems(this.prize.brands,this.prize.included_brand_ids),salla.lang.get("pages.loyalty_program.included_brands")),this.getIncludedProductsJsx(salla.lang.get("pages.loyalty_program.included_products"))))],"000"===this.getItemsMarkers("excluded")?"":[r("salla-tab-header",{slot:"header",name:"excluded",style:{display:"000"===this.getItemsMarkers("included")?"none":"block"}},r("span",{class:"s-loyalty-program-reward-details-tab-icon",innerHTML:n}),r("span",null,salla.lang.get("pages.loyalty_program.excluded"))),r("salla-tab-content",{slot:"content",name:"excluded"},r("div",{class:"s-loyalty-program-reward-details-items-wrapper"},this.getCategoriesJsx(this.getIncludedItems(this.prize.excludedCategories,this.prize.excluded_category_ids),salla.lang.get("pages.loyalty_program.excluded_categories")),this.getBrandsJsx(this.getIncludedItems(this.prize.excludedBrands,this.prize.excluded_brand_ids),salla.lang.get("pages.loyalty_program.excluded_brands")),this.getProductsJsx(this.getProductIds(this.prize.excluded_product_ids),salla.lang.get("pages.loyalty_program.excluded_products"))))]))),r("salla-reward-action",{key:"aaad339124dd3e8fcac568540d627d6105712d2f",onActionClick:a=>this.actionClick.emit(a.detail),prize:this.prize}))}static get watchers(){return{prize:["handlePrizeChange"]}}};h([p((async()=>(await salla.product.api.categories()).data),{initialData:[]})],u.prototype,"category",void 0),h([p((async()=>(await salla.api.request("/brands")).data),{initialData:[]})],u.prototype,"brand",void 0),u.style="@media (max-width: 639px){.s-loyalty-program-modal .s-modal-body{position:relative !important;left:unset !important;bottom:unset !important;max-height:100dvh;overflow-y:auto !important}}.s-loyalty-exchange-card salla-product-card .s-product-card-image,.s-loyalty-exchange-card custom-salla-product-card .s-product-card-image{flex:none;aspect-ratio:1;overflow:hidden}.s-loyalty-exchange-card-btn{padding:0 1.25rem 1.25rem;margin-top:0.75rem}.s-loyalty-program-reward-details-products-grid{display:flex;flex-wrap:wrap;gap:1rem;margin-top:0.75rem}.s-loyalty-program-reward-details-products-grid>*{flex:1 1 100%;min-width:0;touch-action:pan-y}@media (min-width: 640px){.s-loyalty-program-reward-details-products-grid>*{flex-basis:calc((100% - 1rem) / 2)}}@media (min-width: 768px){.s-loyalty-program-reward-details-products-grid>*{flex-basis:calc((100% - 2rem) / 3)}}.s-loyalty-program-reward-details-products-grid>*:only-child{max-width:320px;margin-inline:auto}.s-loyalty-program-reward-details-products-grid:has(>*:nth-child(3))>*{flex-grow:0}";const b=class{constructor(e){a(this,e),this.productId=null}reset(a=0){setTimeout((()=>{t()}),a)}getApiErrorMessage(a){return a?.response?.data?.error?.message||a?.response?.data?.message||("string"==typeof a?a:null)||salla.lang.get("common.errors.error_occurred")}async handleConfirm(){try{await this.exchange(this.prize.id,null,this.productId),this.reset(300)}catch(a){salla.notify.error(this.getApiErrorMessage(a))}}handleCancel(){this.reset(0)}render(){return r(s,{key:"98f0ce7506f94fc6c9c5dd881791d7298daa0e0b"},r("div",{key:"72661d140a8dd7b6fe8b68a120ba00f951aeb6e4",class:"s-loyalty-program-exchange-heading"},r("div",{key:"dfad67d7df6e3fde30c463791eb45ae5b356fc96",class:"s-loyalty-program-circle-base s-loyalty-program-circle-size-xl s-loyalty-program-circle-variant-fill"},r("span",{key:"04d0832e50209a87605cf016d0a462640d6379ed",innerHTML:d})),r("h2",{key:"bf7282fbb2cfb9675c0c219d65c090a95e0177f3"},salla.lang.get("pages.loyalty_program.redeem_reward")),r("p",{key:"551233696f0b1a5b8d233bcbd618e8c6f65e9bf6"},salla.lang.get("pages.loyalty_program.redeem_confirmation")," ",r("span",{key:"780e095949141888f02d165c44a648d6569ee56a"},"(",this.prize.cost_points," ",salla.lang.get("pages.loyalty_program.point"),")")," ",salla.lang.get("pages.loyalty_program.for")," ",r("span",{key:"fac6c243a373833091bbd276d7f416c04f89abb7"},"(",this.prize.name,")"))),r("div",{key:"f806352839b2914570ee4331d3412224533cc1ca",class:"s-loyalty-program-exchange-btns"},r("salla-button",{key:"12a4c1d19a6f1ad7ac5acf09a4861b708f25fa42",width:"wide",loading:"pending"===this.exchange.status,onClick:()=>this.handleConfirm()},salla.lang.get("common.elements.confirm")),r("salla-button",{key:"5caa8e6cec4b4fc8f4968742d7de26282cb26c35",width:"wide",fill:"outline",color:"danger",onClick:()=>this.handleCancel()},salla.lang.get("common.elements.cancel"))))}};(function(a,e,r,s){var t,l=arguments.length,o=l<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,r):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(a,e,r,s);else for(var d=a.length-1;d>=0;d--)(t=a[d])&&(o=(l<3?t(o):l>3?t(e,r,o):t(e,r))||o);l>3&&o&&Object.defineProperty(e,r,o)})([p((async(...a)=>await salla.loyalty.exchange(...a)))],b.prototype,"exchange",void 0),b.style="@media (max-width: 639px){.s-loyalty-program-modal .s-modal-body{position:relative !important;left:unset !important;bottom:unset !important;max-height:100dvh;overflow-y:auto !important}}.s-loyalty-exchange-card salla-product-card .s-product-card-image,.s-loyalty-exchange-card custom-salla-product-card .s-product-card-image{flex:none;aspect-ratio:1;overflow:hidden}.s-loyalty-exchange-card-btn{padding:0 1.25rem 1.25rem;margin-top:0.75rem}.s-loyalty-program-reward-details-products-grid{display:flex;flex-wrap:wrap;gap:1rem;margin-top:0.75rem}.s-loyalty-program-reward-details-products-grid>*{flex:1 1 100%;min-width:0;touch-action:pan-y}@media (min-width: 640px){.s-loyalty-program-reward-details-products-grid>*{flex-basis:calc((100% - 1rem) / 2)}}@media (min-width: 768px){.s-loyalty-program-reward-details-products-grid>*{flex-basis:calc((100% - 2rem) / 3)}}.s-loyalty-program-reward-details-products-grid>*:only-child{max-width:320px;margin-inline:auto}.s-loyalty-program-reward-details-products-grid:has(>*:nth-child(3))>*{flex-grow:0}";export{m as salla_loyalty_exchange_product_card,y as salla_reward_action,g as salla_reward_card,u as salla_reward_details,b as salla_reward_exchange}
|