@salla.sa/twilight-components 2.14.520 → 2.14.521
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-B-CXEiqm.js → filepond-BxIqz4X5.js} +1 -1
- package/dist/cjs/{filepond-plugin-file-poster-wldzYT1k.js → filepond-plugin-file-poster-CgcL8KEM.js} +1 -1
- package/dist/cjs/{filepond-plugin-file-validate-size-DEKUs2ql.js → filepond-plugin-file-validate-size-CE5D63gi.js} +1 -1
- package/dist/cjs/{filepond-plugin-file-validate-type-V0nWqzLp.js → filepond-plugin-file-validate-type-CTZlbHeg.js} +1 -1
- package/dist/cjs/{filepond-plugin-image-edit-C60jMfjF.js → filepond-plugin-image-edit-DwwaA0xD.js} +1 -1
- package/dist/cjs/{filepond-plugin-image-exif-orientation-7rjvzakW.js → filepond-plugin-image-exif-orientation-Ds2jzd-0.js} +1 -1
- package/dist/cjs/{filepond-plugin-image-preview-CBjNXDm7.js → filepond-plugin-image-preview-zMIkW3BA.js} +1 -1
- package/dist/cjs/{functions-w4n1Dw12.js → functions-kxrglIIV.js} +1 -1
- package/dist/cjs/{index-Dtd8NT7W.js → index-BqVQnSPs.js} +1 -1
- package/dist/cjs/{index-CP4_ZHev.js → index-D9nhi8-6.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-shipments.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-summary.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-totals-card.cjs.entry.js +1 -1
- package/dist/cjs/salla-orders.cjs.entry.js +1 -1
- package/dist/cjs/salla-payments.cjs.entry.js +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 +2 -2
- package/dist/cjs/salla-quick-order.cjs.entry.js +1 -1
- package/dist/cjs/salla-rating-modal-v2.cjs.entry.js +1 -1
- package/dist/cjs/salla-rating-modal.cjs.entry.js +1 -1
- package/dist/cjs/salla-review-factors-tags.cjs.entry.js +1 -1
- package/dist/cjs/salla-scopes.cjs.entry.js +1 -1
- package/dist/cjs/salla-search.cjs.entry.js +1 -1
- package/dist/cjs/salla-skeleton.cjs.entry.js +1 -1
- package/dist/cjs/salla-slider.cjs.entry.js +1 -1
- package/dist/cjs/salla-social-share.cjs.entry.js +1 -1
- package/dist/cjs/salla-social.cjs.entry.js +1 -1
- package/dist/cjs/salla-tab-content_3.cjs.entry.js +1 -1
- package/dist/cjs/salla-tiered-offer.cjs.entry.js +1 -1
- package/dist/cjs/salla-tooltip.cjs.entry.js +1 -1
- package/dist/cjs/salla-trust-badges.cjs.entry.js +1 -1
- package/dist/cjs/salla-user-menu.cjs.entry.js +1 -1
- package/dist/cjs/salla-user-profile.cjs.entry.js +1 -1
- package/dist/cjs/salla-user-settings.cjs.entry.js +1 -1
- package/dist/cjs/salla-verify.cjs.entry.js +1 -1
- package/dist/cjs/salla-wallet.cjs.entry.js +1 -1
- package/dist/cjs/salla-wishlist-actions.cjs.entry.js +1 -1
- package/dist/cjs/{tracked-promise-C8HPKIHB.js → tracked-promise-I3cWE57r.js} +1 -1
- package/dist/cjs/twilight.cjs.js +1 -1
- package/dist/cjs/{vanilla-picker-CfkLDKtB.js → vanilla-picker-BN2v2WSB.js} +1 -1
- package/dist/collection/components/salla-products-list/salla-products-list.js +1 -1
- package/dist/components/index.js +2 -2
- package/dist/components/salla-products-list2.js +1 -1
- package/dist/esm/{filepond-B5AhUd5X.js → filepond-DiqSFaKJ.js} +1 -1
- package/dist/esm/{filepond-plugin-file-poster-CyUKDIOX.js → filepond-plugin-file-poster-CIhvZWr3.js} +1 -1
- package/dist/esm/{filepond-plugin-file-validate-size-oDM0RkiJ.js → filepond-plugin-file-validate-size-Dh-rJsdI.js} +1 -1
- package/dist/esm/{filepond-plugin-file-validate-type-Bgr0PP4V.js → filepond-plugin-file-validate-type-I9XENo4v.js} +1 -1
- package/dist/esm/{filepond-plugin-image-edit-CQNKQMzk.js → filepond-plugin-image-edit-D7HhgEBr.js} +1 -1
- package/dist/esm/{filepond-plugin-image-exif-orientation-6bqQCmnQ.js → filepond-plugin-image-exif-orientation-CJ6QNX7n.js} +1 -1
- package/dist/esm/{filepond-plugin-image-preview-BxAmNds6.js → filepond-plugin-image-preview-ChlwE2Wy.js} +1 -1
- package/dist/esm/{functions-UlRBW71R.js → functions-DG90cyVT.js} +1 -1
- package/dist/esm/{index-DjOBdfDM.js → index-BmH_SCLp.js} +2 -2
- package/dist/esm/{index-CGCbZsu6.js → index-CceR4m1x.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-shipments.entry.js +1 -1
- package/dist/esm/salla-order-summary.entry.js +1 -1
- package/dist/esm/salla-order-totals-card.entry.js +1 -1
- package/dist/esm/salla-orders.entry.js +1 -1
- package/dist/esm/salla-payments.entry.js +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 +2 -2
- package/dist/esm/salla-quick-order.entry.js +1 -1
- package/dist/esm/salla-rating-modal-v2.entry.js +1 -1
- package/dist/esm/salla-rating-modal.entry.js +1 -1
- package/dist/esm/salla-review-factors-tags.entry.js +1 -1
- package/dist/esm/salla-scopes.entry.js +1 -1
- package/dist/esm/salla-search.entry.js +1 -1
- package/dist/esm/salla-skeleton.entry.js +1 -1
- package/dist/esm/salla-slider.entry.js +1 -1
- package/dist/esm/salla-social-share.entry.js +1 -1
- package/dist/esm/salla-social.entry.js +1 -1
- package/dist/esm/salla-tab-content_3.entry.js +1 -1
- package/dist/esm/salla-tiered-offer.entry.js +1 -1
- package/dist/esm/salla-tooltip.entry.js +1 -1
- package/dist/esm/salla-trust-badges.entry.js +1 -1
- package/dist/esm/salla-user-menu.entry.js +1 -1
- package/dist/esm/salla-user-profile.entry.js +1 -1
- package/dist/esm/salla-user-settings.entry.js +1 -1
- package/dist/esm/salla-verify.entry.js +1 -1
- package/dist/esm/salla-wallet.entry.js +1 -1
- package/dist/esm/salla-wishlist-actions.entry.js +1 -1
- package/dist/esm/{tracked-promise-CjzMNHuW.js → tracked-promise-Ci6ut_FU.js} +1 -1
- package/dist/esm/twilight.js +2 -2
- package/dist/esm/{vanilla-picker-C0WhEpLR.js → vanilla-picker-vyxTZ0dX.js} +1 -1
- package/dist/twilight/{p-7ccd3918.entry.js → p-0043e129.entry.js} +1 -1
- package/dist/twilight/{p-d90a4f86.entry.js → p-00a79225.entry.js} +1 -1
- package/dist/twilight/{p-9e950969.entry.js → p-0331b059.entry.js} +1 -1
- package/dist/twilight/{p-9edb33a2.entry.js → p-050f0c6a.entry.js} +1 -1
- package/dist/twilight/{p-71b24810.entry.js → p-097f2555.entry.js} +1 -1
- package/dist/twilight/{p-937f7f9b.entry.js → p-0bc95bea.entry.js} +1 -1
- package/dist/twilight/{p-977d4b62.entry.js → p-0c59cc4f.entry.js} +1 -1
- package/dist/twilight/{p-0697f8d6.entry.js → p-169ccb83.entry.js} +1 -1
- package/dist/twilight/{p-80b34fa0.entry.js → p-19173dca.entry.js} +1 -1
- package/dist/twilight/{p-Djm0oxTL.js → p-1HIaZAiz.js} +1 -1
- package/dist/twilight/{p-157963b1.entry.js → p-1afaa214.entry.js} +1 -1
- package/dist/twilight/{p-a3e65c78.entry.js → p-1fa3928c.entry.js} +1 -1
- package/dist/twilight/{p-af88e681.entry.js → p-2199c255.entry.js} +1 -1
- package/dist/twilight/{p-441fcdb4.entry.js → p-2235f1f2.entry.js} +1 -1
- package/dist/twilight/{p-0103f018.entry.js → p-22b1d1b5.entry.js} +1 -1
- package/dist/twilight/{p-6183d223.entry.js → p-22b5b7c5.entry.js} +1 -1
- package/dist/twilight/{p-7daa82fe.entry.js → p-258ddfbb.entry.js} +1 -1
- package/dist/twilight/{p-395dfda3.entry.js → p-25a5a6e1.entry.js} +1 -1
- package/dist/twilight/p-26f2eea3.entry.js +4 -0
- package/dist/twilight/{p-93f7e2a0.entry.js → p-28f8858c.entry.js} +1 -1
- package/dist/twilight/{p-8d77fc58.entry.js → p-29d997c7.entry.js} +1 -1
- package/dist/twilight/{p-d3e569a0.entry.js → p-2bdf089c.entry.js} +1 -1
- package/dist/twilight/{p-15afb5f2.entry.js → p-2cb0a5c2.entry.js} +1 -1
- package/dist/twilight/{p-1334a1aa.entry.js → p-2e23d889.entry.js} +1 -1
- package/dist/twilight/{p-7782ef7a.entry.js → p-314e1a7e.entry.js} +1 -1
- package/dist/twilight/{p-a83693c7.entry.js → p-3977e18c.entry.js} +1 -1
- package/dist/twilight/{p-Z5t88y_p.js → p-3JgvsDKa.js} +2 -2
- package/dist/twilight/{p-4d650b67.entry.js → p-3aa708ac.entry.js} +1 -1
- package/dist/twilight/{p-fa5c37c2.entry.js → p-3b4f6d09.entry.js} +1 -1
- package/dist/twilight/{p-c721e1f9.entry.js → p-3b927d75.entry.js} +1 -1
- package/dist/twilight/{p-484522bf.entry.js → p-3d4ea448.entry.js} +1 -1
- package/dist/twilight/{p-877de10b.entry.js → p-42ab7e46.entry.js} +1 -1
- package/dist/twilight/{p-50940460.entry.js → p-456c03b1.entry.js} +1 -1
- package/dist/twilight/{p-468d142a.entry.js → p-4afedde2.entry.js} +1 -1
- package/dist/twilight/{p-9a259cd4.entry.js → p-4b425007.entry.js} +1 -1
- package/dist/twilight/{p-d7b6f6d3.entry.js → p-4db788b8.entry.js} +1 -1
- package/dist/twilight/{p-75c5d67c.entry.js → p-4dcb3f48.entry.js} +1 -1
- package/dist/twilight/{p-6d114c0b.entry.js → p-5245c9fb.entry.js} +1 -1
- package/dist/twilight/{p-07f53154.entry.js → p-5327d518.entry.js} +1 -1
- package/dist/twilight/{p-ee8d8338.entry.js → p-54b18586.entry.js} +1 -1
- package/dist/twilight/{p-41e66fae.entry.js → p-5659163f.entry.js} +1 -1
- package/dist/twilight/{p-ea68294d.entry.js → p-5a17a1ea.entry.js} +1 -1
- package/dist/twilight/{p-d1f54ea9.entry.js → p-5aa54ac9.entry.js} +1 -1
- package/dist/twilight/{p-7df3873f.entry.js → p-5b98f12c.entry.js} +1 -1
- package/dist/twilight/{p--ucq83XK.js → p-5h7fTMtR.js} +1 -1
- package/dist/twilight/{p-a4c2aaf4.entry.js → p-6304507a.entry.js} +1 -1
- package/dist/twilight/{p-aeef91fe.entry.js → p-6481d82b.entry.js} +1 -1
- package/dist/twilight/{p-a53b3edf.entry.js → p-6ce962f1.entry.js} +1 -1
- package/dist/twilight/{p-509279da.entry.js → p-7054391f.entry.js} +1 -1
- package/dist/twilight/{p-9f384e06.entry.js → p-719d5824.entry.js} +1 -1
- package/dist/twilight/{p-53e47f9d.entry.js → p-761f03b0.entry.js} +1 -1
- package/dist/twilight/{p-8fba19d5.entry.js → p-772b2587.entry.js} +1 -1
- package/dist/twilight/{p-f5fc1892.entry.js → p-781d048b.entry.js} +1 -1
- package/dist/twilight/{p-5202a5a2.entry.js → p-7d6d2166.entry.js} +1 -1
- package/dist/twilight/{p-26b01da9.entry.js → p-7dd7b06b.entry.js} +1 -1
- package/dist/twilight/{p-c4297ff7.entry.js → p-849c72c4.entry.js} +1 -1
- package/dist/twilight/{p-4705b3ee.entry.js → p-86509218.entry.js} +1 -1
- package/dist/twilight/{p-a539d51c.entry.js → p-88137e81.entry.js} +1 -1
- package/dist/twilight/{p-9e1fa90c.entry.js → p-8bc95f60.entry.js} +1 -1
- package/dist/twilight/{p-4e708377.entry.js → p-8dd3312e.entry.js} +1 -1
- package/dist/twilight/{p-259956fe.entry.js → p-8ee28c75.entry.js} +1 -1
- package/dist/twilight/{p-af61b17f.entry.js → p-919d1d2f.entry.js} +1 -1
- package/dist/twilight/{p-d0a173d2.entry.js → p-9329c9ae.entry.js} +1 -1
- package/dist/twilight/{p-815559c2.entry.js → p-9338485b.entry.js} +1 -1
- package/dist/twilight/{p-14ab267b.entry.js → p-93b9c55e.entry.js} +1 -1
- package/dist/twilight/{p-56554552.entry.js → p-9c738246.entry.js} +1 -1
- package/dist/twilight/{p-767fc48b.entry.js → p-9e73018d.entry.js} +1 -1
- package/dist/twilight/{p-1e1a77d1.entry.js → p-9eb20b1e.entry.js} +1 -1
- package/dist/twilight/{p-b357f9ea.entry.js → p-9fbf4a49.entry.js} +1 -1
- package/dist/twilight/{p-CYbUnAsY.js → p-BFMG8k2g.js} +1 -1
- package/dist/twilight/{p-DjOBdfDM.js → p-BmH_SCLp.js} +1 -1
- package/dist/twilight/{p-DyQCnC43.js → p-CVQzCtED.js} +1 -1
- package/dist/twilight/{p-B6g8RXLV.js → p-CyJQdnNc.js} +1 -1
- package/dist/twilight/{p-9td0x-W4.js → p-D5XsQ4D9.js} +1 -1
- package/dist/twilight/{p-BXjd-F0j.js → p-DNxVGDCc.js} +1 -1
- package/dist/twilight/{p-D136Y0xG.js → p-DcFiC1dv.js} +1 -1
- package/dist/twilight/{p-n3pMJbfq.js → p-Duga6KlO.js} +1 -1
- package/dist/twilight/{p-utw6PQ3w.js → p-Jgd9UbQM.js} +1 -1
- package/dist/twilight/{p-79994729.entry.js → p-a025825a.entry.js} +1 -1
- package/dist/twilight/{p-bf78b156.entry.js → p-a54f3e4d.entry.js} +1 -1
- package/dist/twilight/{p-16d00717.entry.js → p-a6f1ab9d.entry.js} +1 -1
- package/dist/twilight/{p-f5c7d01f.entry.js → p-aa3de1af.entry.js} +1 -1
- package/dist/twilight/{p-d25eaeb2.entry.js → p-ad95d915.entry.js} +1 -1
- package/dist/twilight/{p-96908e15.entry.js → p-ae2071d6.entry.js} +1 -1
- package/dist/twilight/{p-ba2ec852.entry.js → p-b41da249.entry.js} +1 -1
- package/dist/twilight/{p-1e80102d.entry.js → p-b74d7a0c.entry.js} +1 -1
- package/dist/twilight/{p-c0f2f74c.entry.js → p-bd5baa3a.entry.js} +1 -1
- package/dist/twilight/{p-a9853194.entry.js → p-c32a7b18.entry.js} +1 -1
- package/dist/twilight/{p-8633dca6.entry.js → p-c337127b.entry.js} +1 -1
- package/dist/twilight/{p-8aa94d13.entry.js → p-c8e712e4.entry.js} +1 -1
- package/dist/twilight/{p-779e8604.entry.js → p-c8fa6a7e.entry.js} +1 -1
- package/dist/twilight/{p-1d2bc592.entry.js → p-c9e00ab5.entry.js} +1 -1
- package/dist/twilight/{p-4b764afc.entry.js → p-cdd9e371.entry.js} +1 -1
- package/dist/twilight/{p-1485dba4.entry.js → p-d4b5c142.entry.js} +1 -1
- package/dist/twilight/{p-517cdc60.entry.js → p-da16958f.entry.js} +1 -1
- package/dist/twilight/{p-a8ccb3b5.entry.js → p-dbd42678.entry.js} +1 -1
- package/dist/twilight/{p-04c4ac9d.entry.js → p-e258f515.entry.js} +1 -1
- package/dist/twilight/{p-70416928.entry.js → p-e9fb7554.entry.js} +1 -1
- package/dist/twilight/{p-2bcd9e4b.entry.js → p-eb06c23f.entry.js} +1 -1
- package/dist/twilight/{p-bbf6ad7e.entry.js → p-ec66b2a0.entry.js} +1 -1
- package/dist/twilight/{p-359351e3.entry.js → p-edc7d892.entry.js} +1 -1
- package/dist/twilight/{p-0b77c960.entry.js → p-f639f01e.entry.js} +1 -1
- package/dist/twilight/{p-6bc0a7cb.entry.js → p-f6644651.entry.js} +1 -1
- package/dist/twilight/{p-3a3145e4.entry.js → p-f7e468c7.entry.js} +1 -1
- package/dist/twilight/{p-97bf34f8.entry.js → p-f8b734e1.entry.js} +1 -1
- package/dist/twilight/{p-5cc43d68.entry.js → p-fbbf8d50.entry.js} +1 -1
- package/dist/twilight/{p-123bd7f1.entry.js → p-ff2cf3a4.entry.js} +1 -1
- package/dist/twilight/twilight.esm.js +1 -1
- package/package.json +5 -5
- package/dist/twilight/p-12b95fd5.entry.js +0 -4
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as e,h as s,H as r}from"./p-
|
|
4
|
+
import{r as e,h as s,H as r}from"./p-BmH_SCLp.js";const t=250,a={customer:"أُلغي الطلب من قِبل العميل",merchant:"أُلغي الطلب من قِبل المتجر"},o=[["pages.orders.cancel_modal_title","إلغاء الطلب","Cancel order"],["pages.orders.cancel_reason_title","لماذا ترغب في إلغاء الطلب؟","Why do you want to cancel this order?"],["pages.orders.cancel_reason_subtitle","ساعدنا نعرف السبب لتحسين تجربتك.","Help us understand why to improve your experience."],["pages.orders.cancel_reason_confirm","تأكيد إلغاء الطلب","Confirm order cancellation"],["pages.orders.cancel_reason_back","تراجع","Go back"],["pages.orders.cancel_reason_note_placeholder","اذكر السبب","Mention the reason"],["pages.orders.cancelled_by_customer",a.customer,"Order cancelled by the customer"],["pages.orders.cancelled_by_merchant",a.merchant,"Order cancelled by the merchant"],["pages.orders.cancel_reason_char_limit","يتجاوز النص حد الأحرف المسموح","Text exceeds the allowed character limit"]],n=e=>{if(!e)return null;try{const s="string"==typeof e?JSON.parse(e):e;return s&&"object"==typeof s?s:null}catch{return null}},c=e=>e.filter((e=>!1!==e.is_active)).sort(((e,s)=>(e.sort??0)-(s.sort??0))),l=class{constructor(s){e(this,s),this.reasons=[],this.selectedReasonId=null,this.reasonNote="",this.confirmLoading=!1,this.loading=!0,this.modalTitleLabel="",this.questionLabel="",this.subtitleLabel="",this.confirmLabel="",this.backLabel="",this.notePlaceholder="",this.charLimitLabel="",salla.lang.onLoaded((()=>{const e=salla.lang.messages?.["ar.trans"],s=salla.lang.messages?.["en.trans"];if(e&&s&&salla.helpers?.setNested)for(const[r,t,a]of o)salla.helpers.setNested(e,r,t),salla.helpers.setNested(s,r,a);this.refreshLabels()}))}onCancellationReasonsChange(){this.load()}async componentWillLoad(){await salla.onReady(),this.refreshLabels(),await this.load()}refreshLabels(){const e=(e,s)=>salla.lang.getWithDefault(e,s);this.modalTitleLabel=e("pages.orders.cancel_modal_title","إلغاء الطلب"),this.questionLabel=e("pages.orders.cancel_reason_title","لماذا ترغب في إلغاء الطلب؟"),this.subtitleLabel=e("pages.orders.cancel_reason_subtitle","ساعدنا نعرف السبب لتحسين تجربتك."),this.confirmLabel=e("pages.orders.cancel_reason_confirm","تأكيد إلغاء الطلب"),this.backLabel=e("pages.orders.cancel_reason_back","تراجع"),this.notePlaceholder=e("pages.orders.cancel_reason_note_placeholder","اذكر السبب"),this.charLimitLabel=e("pages.orders.cancel_reason_char_limit","يتجاوز النص حد الأحرف المسموح")}get resolvedOrderId(){const e=this.orderId??this.pageOrder?.id??salla.config.get("page.id"),s=Number(e);return Number.isFinite(s)?s:e}readPageOrder(){const e=document.querySelector("salla-order-totals-card");return e?n(e.order??e.getAttribute("order")):null}waitForPageOrder(){const e=this.readPageOrder();return e?Promise.resolve(e):"undefined"==typeof MutationObserver?Promise.resolve().then((()=>this.readPageOrder())):new Promise((e=>{let s=!1;const r=()=>{s||(s=!0,a.disconnect(),clearTimeout(o),e(this.readPageOrder()))},t=document.querySelector("salla-order-totals-card"),a=new MutationObserver(r);a.observe(t??document.documentElement,t?{attributes:!0,attributeFilter:["order"]}:{childList:!0,subtree:!0,attributes:!0,attributeFilter:["order"]});const o=setTimeout(r,2500)}))}cancelledByLabel(e){return salla.lang.getWithDefault(`pages.orders.cancelled_by_${e}`,a[e])}mountCancelledHeader(e=0){const s=this.orderCancelledReason,r=s?.reasons[0];if(!r||document.querySelector("[data-salla-order-cancelled-reason]"))return;const t=document.querySelector("td.single-order-header-item:not(.flex)");if(!t)return void(e<20&&requestAnimationFrame((()=>this.mountCancelledHeader(e+1))));const a=document.createElement("td");a.className="s-order-cancel-cancelled-header-item",a.setAttribute("data-salla-order-cancelled-reason","");const o=document.createElement("div");o.className="s-order-cancel-cancelled-header-label",o.textContent=this.cancelledByLabel(s.cancelled_by);const n=document.createElement("b");n.className="s-order-cancel-cancelled-header-reason",n.textContent=r,n.title=r,a.append(o,n),t.insertAdjacentElement("afterend",a)}purgeLegacyModal(){if(this.reasons.length)for(const e of document.querySelectorAll("salla-modal#modal-order-cancel:not([data-salla-order-cancel])"))e.remove()}applyPageOrder(e){this.pageOrder=e,this.orderCancelledReason=(e=>{const s=n(e),r=Array.isArray(s?.reasons)?s.reasons.filter((e=>"string"==typeof e&&e.length>0)):[];return r.length?{cancelled_by:"merchant"===s?.cancelled_by?"merchant":"customer",reasons:r}:null})(e.order_cancelled_reason)??void 0}async load(){this.loading=!0;try{const e=(e=>{if(null==e||""===e)return null;const s="string"==typeof e?n(e):e;return Array.isArray(s)&&s.length?s:null})(this.cancellationReasons);if(!this.pageOrder){const e=this.readPageOrder();e&&this.applyPageOrder(e)}if(this.pageOrder||e)this.pageOrder||this.waitForPageOrder().then((e=>{e&&(this.applyPageOrder(e),this.mountCancelledHeader())}));else{const e=await this.waitForPageOrder();e&&this.applyPageOrder(e)}const s=this.pageOrder;this.reasons=e?c(e):s?c(Array.isArray(s.cancellation_reasons)?s.cancellation_reasons:[]):[]}finally{this.loading=!1,this.purgeLegacyModal(),this.mountCancelledHeader()}}reasonLabel(e){const s=salla.lang.getLocale?.()||"ar";return e.translations?.[s]?.name||e.name}get hasOtherSelected(){return null!==this.selectedReasonId&&this.reasons.some((e=>e.id===this.selectedReasonId&&"other"===e.slug))}get canConfirm(){if(null===this.selectedReasonId)return!1;if(!this.hasOtherSelected)return!0;const e=this.reasonNote.trim().length;return e>0&&e<=t}selectReason(e){if(this.selectedReasonId===e)return"other"===this.reasons.find((s=>s.id===e))?.slug&&(this.reasonNote=""),void(this.selectedReasonId=null);if("other"===this.reasons.find((e=>e.id===this.selectedReasonId))?.slug&&(this.reasonNote=""),this.selectedReasonId=e,this.reasons.length&&this.reasons[this.reasons.length-1].id===e){const s=setTimeout((()=>{requestAnimationFrame((()=>{document.getElementById(`s-order-cancel-reason-${e}`)?.scrollIntoView({block:"start",behavior:"smooth"});const r=document.querySelector(".s-order-cancel-textarea");r?.focus(),clearTimeout(s)}))}),200)}}resetForm(){this.selectedReasonId=null,this.reasonNote="",this.confirmLoading=!1}setReasonNote(e){this.reasonNote=e.target.value}onKeyActivate(e,s){"Enter"!==e.key&&" "!==e.key||s()}async confirmCancel(){if(this.canConfirm&&!this.confirmLoading){this.confirmLoading=!0;try{const e=this.hasOtherSelected?this.reasonNote.trim():"",s={reasons:[String(this.selectedReasonId)],...e&&{reason_note:e}};await salla.order.api.cancel(this.resolvedOrderId,s),window.location.reload()}catch{this.confirmLoading=!1}}}render(){return this.loading||!this.reasons.length?s(r,{class:"s-order-cancel-wrapper"}):s(r,{class:"s-order-cancel-wrapper"},s("salla-modal",{id:"modal-order-cancel",class:"s-order-cancel-modal","data-salla-order-cancel":"",ref:e=>{this.modal=e,e?.setTitle?.(this.modalTitleLabel)},width:"sm",onModalVisibilityChanged:e=>!e.detail&&this.resetForm()},s("div",{class:"s-order-cancel-content"},s("div",{class:"s-order-cancel-intro"},s("p",{class:"s-order-cancel-heading"},this.questionLabel),s("p",{class:"s-order-cancel-subtitle"},this.subtitleLabel)),s("div",{class:"s-order-cancel-reasons s-scrollbar"},this.reasons.map((e=>{const r=`s-order-cancel-reason-${e.id}`;return s("label",{key:e.id,class:"s-order-cancel-reason",htmlFor:r},s("input",{type:"radio",name:"cancellation_reason",id:r,class:"s-order-cancel-radio s-radio",checked:this.selectedReasonId===e.id,onChange:()=>this.selectReason(e.id)}),s("span",{class:"s-order-cancel-reason-label"},this.reasonLabel(e)))}))),this.hasOtherSelected&&s("div",{class:"s-order-cancel-other-field"},s("textarea",{class:"s-order-cancel-textarea",placeholder:this.notePlaceholder,value:this.reasonNote,onInput:e=>this.setReasonNote(e)}),s("p",{class:{"s-order-cancel-counter":!0,"s-order-cancel-counter--limit":this.reasonNote.length>=t}},this.reasonNote.length>=t&&`${this.charLimitLabel} `,t,"/",this.reasonNote.length)),s("div",{class:"s-order-cancel-actions"},s("salla-button",{color:"primary",class:"w-full",width:"wide",disabled:!this.canConfirm,loading:this.confirmLoading,onClick:()=>this.confirmCancel(),onKeyDown:e=>this.onKeyActivate(e,(()=>this.confirmCancel()))},this.confirmLabel),s("salla-button",{class:"w-full",width:"wide",fill:"outline",color:"gray",onClick:()=>this.modal?.close(),onKeyDown:e=>this.onKeyActivate(e,(()=>this.modal?.close()))},this.backLabel)))))}static get watchers(){return{cancellationReasons:["onCancellationReasonsChange"]}}};l.style='.s-order-cancel-reason .s-order-cancel-radio::before,.s-order-cancel-reason .s-radio::before{content:"";width:10px;height:10px;border-radius:50%;transform:scale(0);transition:120ms transform ease-in-out;background-color:#fff;box-shadow:inset 1em 1em #fff}.s-order-cancel-reason .s-order-cancel-radio:checked::before,.s-order-cancel-reason .s-radio:checked::before{transform:scale(1);background-color:var(--color-primary);box-shadow:inset 1em 1em var(--color-primary)}';export{l as salla_order_cancel}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as e,h as a,H as t,a as n}from"./p-
|
|
4
|
+
import{r as e,h as a,H as t,a as n}from"./p-BmH_SCLp.js";import{S as i}from"./p-8Tsmrwno.js";const r=class{constructor(a){e(this,a)}componentWillLoad(){this.title=salla.config.get("maintenance_details.title"),this.message=salla.config.get("maintenance_details.message");const e="undefined"!=typeof window&&!window.matchMedia("(min-width: 768px)").matches;this.buttonTitle=e?salla.config.get("maintenance_details.button_title"):salla.config.get("maintenance_details.button_full_title")}closeAlert(){salla.storage.set("hide_salla-maintenance-alert_at",Date.now()),this.host.style.display="none"}render(){return a(t,{key:"e27395e05c81dcaa9c105208997ce5cbf3b8fbb2",class:"s-maintenance-alert-wrapper"},a("button",{key:"278105559b3001246e829d57e13a54ed067e629e",class:"s-maintenance-alert-close",innerHTML:i,onClick:()=>this.closeAlert()}),a("div",{key:"643ab2c22dbfa44f51a267ab098154ea19ffd6b4",class:"s-maintenance-alert-content"},a("div",{key:"15d0f8369577ff359db19ad95adf49df717df960",class:"s-maintenance-alert-container"},a("div",{key:"10839c38008ae904678d3e4e815d669a4112d0ca",class:"s-maintenance-alert-icon"},a("img",{key:"b9853fd903db772180f3bc4435c604dc5640d409",src:salla.url.cdn("images/alert.png"),alt:"Alert"})),a("div",{key:"e7dac10cd9677094ef30708dbb30b94075d13380",class:"s-maintenance-alert-text"},a("h2",{key:"476e13b23928a0633d78a9897d084a95e48085a7"},this.title),a("p",{key:"8d44c1bff80ec334bf3ba8678201630172c0188d"},this.message))),a("div",{key:"958b4fef3310ae507df1871386bfe4e1d464a6b7"},a("a",{key:"c20313b563098396a96aa07e76852cd72662ca71",class:"s-maintenance-alert-btn",href:salla.config.get("maintenance_details.button_url")},this.buttonTitle))))}componentDidLoad(){let e=salla.storage.get("hide_salla-maintenance-alert_at");e&&(Date.now()-e)/1e3/60<60&&this.closeAlert()}get host(){return n(this)}};r.style=".s-maintenance-alert-wrapper{display:flex;min-height:40px;width:100%;flex-direction:row;align-items:center;justify-content:center;--tw-bg-opacity:1;background-color:rgba(26, 38, 61, var(--tw-bg-opacity));padding:0.25rem 0.5rem;--tw-text-opacity:1;color:rgba(255, 255, 255, var(--tw-text-opacity))}.s-maintenance-alert-wrapper a{transition:0.35s cubic-bezier(0.2, 1, 0.3, 1)}.s-maintenance-alert-wrapper *{color:inherit}@media (min-width: 640px){.s-maintenance-alert-wrapper{padding-left:2rem;padding-right:2rem}}.s-maintenance-alert-content{margin-top:1rem;margin-bottom:1rem;display:flex;width:100%;align-items:center;justify-content:space-between}@media (min-width: 640px){.s-maintenance-alert-content{padding-left:2rem;padding-right:2rem}}.s-maintenance-alert-container{display:flex;align-items:center}.s-maintenance-alert-icon{margin-right:1.25rem;display:none}@media (min-width: 640px){.s-maintenance-alert-icon{display:block}}.s-maintenance-alert-text h2{margin-bottom:0.5rem;font-size:0.875rem;font-weight:700;line-height:1.4}@media (min-width: 640px){.s-maintenance-alert-text h2{font-size:1.5rem;line-height:2rem}}.s-maintenance-alert-text p{margin:0px;text-align:right;font-size:10px;line-height:1.2}@media (min-width: 640px){.s-maintenance-alert-text p{text-align:center;font-size:0.75rem;line-height:1}}.s-maintenance-alert-btn{position:relative;margin-left:4px;margin-right:4px;display:inline-block;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;user-select:none;white-space:nowrap;border-radius:0.125rem;border-width:1px;--tw-border-opacity:1;border-color:rgba(93, 213, 196, var(--tw-border-opacity));--tw-bg-opacity:1;background-color:rgba(93, 213, 196, var(--tw-bg-opacity));padding:0.5rem;text-align:center;vertical-align:middle;font-size:0.875rem;font-weight:400;line-height:1.4;--tw-text-opacity:1;color:rgba(255, 255, 255, var(--tw-text-opacity))}.s-maintenance-alert-btn:hover{--tw-bg-opacity:1;background-color:rgba(53, 203, 181, var(--tw-bg-opacity))}.s-maintenance-alert-btn *{pointer-events:none}[dir=rtl] .s-maintenance-alert-btn{margin-left:1.25rem;margin-right:0}@media (min-width: 640px){.s-maintenance-alert-btn{padding:0.5rem 1rem}}";export{r as salla_maintenance_alert}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as s,h as t,c as e,a}from"./p-
|
|
4
|
+
import{r as s,h as t,c as e,a}from"./p-BmH_SCLp.js";const c=class{constructor(t){s(this,t),this.isSelected=!1}async getChild(){return{selected:this.selected.bind(this),unselect:this.unselect.bind(this),name:this.name}}unselect(){this.isSelected=!1}selected(){this.isSelected=!0}render(){return t("div",{key:"f5cfa9676bc8314149cb78e103b9ef580c0d7559",class:{"s-tabs-content":!0,"s-tabs-content-selected":this.isSelected}},t("slot",{key:"1b86591377c09f1acb25cda20024b3af9c6a874d"}))}};c.style="";const i=class{constructor(t){s(this,t),this.tabSelected=e(this,"tabSelected"),this.id=Math.random().toString(36).slice(2,10),this.activeClass=void 0,this.height=void 0,this.centered=!1,this.isSelected=!1}async getChild(){return{selected:this.selected.bind(this),unselect:this.unselect.bind(this),name:this.name,id:this.id}}unselect(){this.isSelected=!1}selected(){this.isSelected=!0}onClick(){this.getChild().then((s=>{this.tabSelected.emit(s)}))}render(){return[t("div",{key:"a9548ed2a74d30e6fcf365dbe26aa5f7fdab2468",class:{"s-tabs-header-item":!0,"s-tabs-bg-normal":!0,"s-tabs-active":this.isSelected},onClick:this.onClick.bind(this)},t("slot",{key:"547edd40aab5843c6035bd3c36a34d9449dc12d3"}))]}};i.style="";const h=class{constructor(t){s(this,t),this.backgroundColor=void 0,this.vertical=!1}componentWillLoad(){this.createGroup().then((()=>{const[s]=this.tabGroup;this.selectGroup(s)}))}onSelectedTab(s){const t=this.tabGroup.find((t=>t.header.id===s.detail.id));this.selectGroup(t)}async createGroup(){const s=Array.from(this.host.querySelectorAll("salla-tab-header"));this.tabsHeader=await Promise.all(s.map((async s=>await s.getChild())));const t=Array.from(this.host.querySelectorAll("salla-tab-content"));this.tabsContent=await Promise.all(t.map((async s=>await s.getChild()))),this.tabGroup=this.tabsHeader.map((s=>{const t=this.tabsContent.find((t=>t.name===s.name));return{header:s,content:t}}))}selectGroup(s){this.tabGroup.map((s=>{s.header.unselect(),s.content.unselect()})),s.header.selected(),s.content.selected()}render(){return[t("div",{key:"e9054cb114c2bd66940b6afa98d7c7c230353a74",class:"s-tabs"},t("div",{key:"d245f64aef9b7fd77c9c51eb1d86ddfd9202e5fb",class:"s-tabs-header"},t("slot",{key:"f1b9a982cd746d637db5d514cb691f188af0cb7e",name:"header"})),t("div",{key:"0ba8441707b087a8c4d068b1a72bf10c8efb41cc",class:"s-tabs-content-wrapper"},t("slot",{key:"afcee28724a5a9ce263fcc3a38d624a631069945",name:"content"})))]}get host(){return a(this)}};h.style=".s-tabs-header{-ms-overflow-style:none;scrollbar-width:none;}.s-tabs-header::-webkit-scrollbar{display:none}";export{c as salla_tab_content,i as salla_tab_header,h as salla_tabs}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as t,h as s,H as a}from"./p-
|
|
4
|
+
import{r as t,h as s,H as a}from"./p-BmH_SCLp.js";const l=class{constructor(s){t(this,s),this.order=null,this.loading=!0}async componentWillLoad(){await salla.onReady(),await this.loadOrder()}async onOrderIdChange(){this.loading=!0,this.order=null,await this.loadOrder()}get paymentUrl(){return this.order?.customer_editing?.payment_url}async loadOrder(){const t=this.orderId||salla.config.get("page.id");if(t)try{const s=await salla.order.api.getDetails(t);this.order=s?.data??s??null}catch(t){salla.logger?.warn?.("[salla-edit-order-button] failed to fetch order details",t),this.order=null}finally{this.loading=!1}else this.loading=!1}renderEditButton(){return s("salla-count-down",{prefixText:salla.lang.getWithDefault("pages.orders.edit_within","يمكنك التعديل خلال"),buttonHref:this.order?.edit_url,buttonText:salla.lang.getWithDefault("pages.orders.edit_order","تعديل الطلب"),buttonIcon:"sicon-edit",date:this.order?.editable_until,horizontal:!0,autoSegments:!0,withButton:!0,labeled:!1,size:"sm",color:"primary"})}render(){return this.loading||!this.order?null:this.order?.is_editable?s(a,null,this.renderEditButton()):this.paymentUrl?s(a,null,s("salla-button",{href:this.paymentUrl,color:"primary",size:"small"},s("i",{class:"sicon-wallet"}),salla.lang.getWithDefault("pages.orders.pay_difference","دفع فارق المبلغ"))):null}static get watchers(){return{orderId:["onOrderIdChange"]}}};l.style=":host{display:block}";export{l as salla_edit_order_button}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as s,h as t,H as e}from"./p-
|
|
4
|
+
import{r as s,h as t,H as e}from"./p-BmH_SCLp.js";import{i as r}from"./p-DqDX5na4.js";const a=class{constructor(t){s(this,t),this.shipments=[]}async componentWillLoad(){return await salla.onReady(),this.fetchShipments()}async onOrderIdChange(){this.shipments=[],await this.fetchShipments()}async fetchShipments(){if(!salla.config.get("store.features",[]).includes("thankyou-page-multi-shipments"))return;const s=this.orderId||salla.config.get("page.id");if(s)try{const t=await salla.order.api.getShipments(s),e=t?.data;this.shipments=Array.isArray(e)?e:Array.isArray(e?.data)?e.data:[]}catch(s){const t=s?.response?.data?.error?.message||s?.response?.data?.message;t&&salla.notify.error(t)}}label(s,t){return salla.lang.getWithDefault(s,t)}async copyTracking(s){try{await navigator.clipboard.writeText(s),salla.notify.success(this.label("common.elements.copied","تم النسخ"))}catch{}}renderTracking(s){const e=s.number;return e?t("span",{class:"s-order-shipments-tracking"},this.label("pages.thank_you.tracking_no","رقم تتبع الشحنة"),t("b",{dir:"ltr"},"#",e),t("button",{type:"button",class:"s-order-shipments-copy",title:this.label("common.elements.copy","نسخ"),onClick:()=>this.copyTracking(String(e))},t("span",{innerHTML:r}))):t("span",{class:"s-order-shipments-placeholder"},this.label("pages.thank_you.tracking_placeholder","سيتم تعيين رقم تتبع بمجرد تجهيز الشحنة"))}renderShipment(s,e){return t("div",{class:"s-order-shipments-card"},t("div",{class:"s-order-shipments-header"},s.logo?t("img",{src:s.logo,class:"s-order-shipments-logo",alt:s.name||"",width:"56",height:"32"}):null,t("span",{class:"s-order-shipments-title"},this.label("pages.thank_you.shipment","الشحنة")," (",e+1,")")),t("div",{class:"s-order-shipments-info"},this.renderTracking(s)),t("div",{class:"s-order-shipments-items"},(s.products||[]).map((s=>t("span",{class:"s-order-shipments-item",title:s.name},s.image?t("img",{src:s.image,alt:s.name,width:"56",height:"56"}):t("span",{class:"s-order-shipments-item-name"},s.name))))))}render(){return this.shipments.length<2?t(e,{class:"s-order-shipments-empty"}):t(e,{class:"s-order-shipments-wrapper"},t("div",{class:"s-order-shipments-list"},this.shipments.map(((s,t)=>this.renderShipment(s,t)))))}static get watchers(){return{orderId:["onOrderIdChange"]}}};a.style=":host{display:block}";export{a as salla_order_shipments}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as s,h as a,H as t,a as o}from"./p-DjOBdfDM.js";const i=class{constructor(a){s(this,a),this.availableCoupons=[],this.cartTotal=0,this.cartTotalReady=!1,this.currentCoupon="",this.couponInputValue="",this.couponError="",this.isApplying=!1,this.appliedCoupons=[],this.multiCoupon=!1,this.isHandlingInternalError=!1,this.cartUpdatedHandler=s=>{this.syncCartTotal(s),(this.multiCoupon?Array.isArray(s?.coupons):s&&"coupon"in s)&&this.syncAppliedFromCart(s),this.couponError=""},this.couponAddedHandler=()=>{this.isApplying||this.isHandlingInternalError||this.refreshFromServer()},this.couponAdditionFailedHandler=s=>{this.isApplying||this.isHandlingInternalError||this.showCouponError(s?.message||salla.lang.get("pages.cart.coupon_application_error"))},this.couponDeletedHandler=()=>{this.isApplying||this.isHandlingInternalError||this.refreshFromServer()},this.onKeyUp=s=>{"Enter"===s.key&&this.couponButtonRef?.click(),this.couponError=""},this.onInput=s=>{this.couponInputValue=s.target.value}}async componentWillLoad(){await Salla.onReady(),await Salla.lang.onLoaded(),this.multiCoupon=!!salla.config.get("store.settings.cart.multi_coupon"),this.loadCouponsData(),this.seedFromStorage(),this.loadCartTotal(),this.setupCartEventListeners()}setupCartEventListeners(){salla.event.on("cart::updated",this.cartUpdatedHandler),salla.event.on("cart::coupon.added",this.couponAddedHandler),salla.event.on("cart::coupon.addition.failed",this.couponAdditionFailedHandler),salla.event.on("cart::coupon.deleted",this.couponDeletedHandler)}disconnectedCallback(){salla.event.off("cart::updated",this.cartUpdatedHandler),salla.event.off("cart::coupon.added",this.couponAddedHandler),salla.event.off("cart::coupon.addition.failed",this.couponAdditionFailedHandler),salla.event.off("cart::coupon.deleted",this.couponDeletedHandler)}async selectCoupon(s){const a=this.availableCoupons.find((a=>a.code===s));if(a){if(!this.isEligible(a))throw new Error("Coupon not eligible: minimum cart amount not met");try{await this.applyCoupon(s),this.host.dispatchEvent(new CustomEvent("salla::cart-coupons.coupon.selected",{detail:a,bubbles:!0}))}catch(s){throw s}}return a}async loadCouponsData(){try{const s=await salla.api.request("coupons"),a=s?.data,t=Array.isArray(a)?a:Array.isArray(a?.data)?a.data:[];this.availableCoupons=t}catch(s){console.warn("Failed to load coupons:",s),this.availableCoupons=[]}}async loadCartTotal(){await this.refreshFromServer()}seedFromStorage(){if(this.multiCoupon)return;const s=salla.storage.get("cart");s&&"object"==typeof s&&"coupon"in s&&this.applyCart(s),this.seedTotalsFromSummaryStorage()}seedTotalsFromSummaryStorage(){const s=salla.storage.get("cart.summary");s&&"object"==typeof s&&null!=s.sub_total&&(this.cartTotal=Number(s.sub_total),this.cartTotalReady=!0)}syncCartTotal(s){const a=s?.summary?.sub_total??s?.sub_total??s?.total;null!=a&&(this.cartTotal=Number(a),this.cartTotalReady=!0)}async refreshFromServer(){try{const s=await salla.cart.details(),a=s?.data?.cart??s?.data??s;if(a&&"object"==typeof a&&(Array.isArray(a.coupons)||"coupon"in a))return void this.applyCart(a)}catch(s){}const s=salla.storage.get("cart");s&&this.applyCart(s),this.seedTotalsFromSummaryStorage()}applyCart(s){this.syncCartTotal(s),this.syncAppliedFromCart(s)}syncAppliedFromCart(s){this.currentCoupon=s?.coupon||"",this.multiCoupon?this.appliedCoupons=Array.isArray(s?.coupons)?s.coupons.filter(Boolean):this.currentCoupon?[this.currentCoupon]:[]:(this.couponInputValue=this.currentCoupon,this.appliedCoupons=this.currentCoupon?[this.currentCoupon]:[])}async handleApplyClick(){if(this.isApplying)return;const s=this.couponInputValue.trim();if(s){this.isApplying=!0,this.isHandlingInternalError=!0;try{await salla.cart.addCoupon(s),await this.refreshFromServer(),this.couponInputValue=""}catch(s){this.showCouponError(s.response?.data?.error?.message||salla.lang.get("pages.cart.coupon_application_error"))}finally{this.isApplying=!1,setTimeout((()=>{this.isHandlingInternalError=!1}),100)}}else this.showCouponError(salla.lang.get("pages.cart.enter_coupon_code"))}async handleCouponButtonClick(){if(this.isApplying)return;const s=!!this.currentCoupon;if(s||this.couponInputValue.trim()){this.isApplying=!0,this.isHandlingInternalError=!0;try{s?await salla.cart.deleteCoupon():await salla.cart.addCoupon(this.couponInputValue.trim()),await this.refreshFromServer()}catch(s){this.showCouponError(s.response?.data?.error?.message||salla.lang.get("pages.cart.coupon_application_error"))}finally{this.isApplying=!1,setTimeout((()=>{this.isHandlingInternalError=!1}),100)}}else this.showCouponError(salla.lang.get("pages.cart.enter_coupon_code"))}async removeCoupon(s){if(!this.isApplying){this.isApplying=!0,this.isHandlingInternalError=!0;try{this.multiCoupon?await salla.cart.deleteCoupon(s):await salla.cart.deleteCoupon(),await this.refreshFromServer()}catch(s){this.showCouponError(s.response?.data?.error?.message||salla.lang.get("pages.cart.coupon_application_error"))}finally{this.isApplying=!1,setTimeout((()=>{this.isHandlingInternalError=!1}),100)}}}showCouponError(s){this.couponError=s}handleCouponClick(s){this.applyCoupon(s.code,!1).catch((()=>{}))}async applyCoupon(s,a=!0){if(this.isApplying){if(a)throw new Error("Coupon application already in progress")}else{this.couponInputValue=s,this.couponError="",this.isApplying=!0,this.isHandlingInternalError=!0;try{await salla.cart.addCoupon(s.trim()),await this.refreshFromServer(),this.multiCoupon&&(this.couponInputValue="")}catch(s){if(this.showCouponError(s.response?.data?.error?.message||salla.lang.get("pages.cart.coupon_application_error")),a)throw s}finally{this.isApplying=!1,setTimeout((()=>{this.isHandlingInternalError=!1}),100)}}}formatMainAmount(s){if("percentage"===s.type)return`${salla.helpers.number("object"==typeof s.amount?s.amount.amount:s.amount)}%`;{const t="object"==typeof s.amount?s.amount:{amount:s.amount,currency:s.minimum_amount?.currency||salla.config.get("store.currency.code","SAR")};return a("span",{innerHTML:salla.money(t.amount,t.currency)})}}isEligible(s){return!this.cartTotalReady||!s.minimum_amount||this.cartTotal>=parseFloat(s.minimum_amount.amount)}renderCouponCard(s){const t=this.isEligible(s);return a("div",{class:"s-cart-coupons-slide-one-fourth swiper-slide"},a("div",{class:"s-cart-coupons-card "+(!t||this.isApplying?"s-cart-coupons-disabled":""),onClick:()=>t&&!this.isApplying&&this.handleCouponClick(s)},a("div",{class:"s-cart-coupons-top-section"},a("div",{class:"s-cart-coupons-discount-values"},a("div",{class:"s-cart-coupons-main-amount"},this.formatMainAmount(s)),s.free_shipping?a("div",{class:"s-cart-coupons-secondary-info"},"+ ",salla.lang.get("pages.cart.free_shipping")):s.maximum_amount&&a("div",{class:"s-cart-coupons-secondary-info"},salla.lang.get("pages.cart.up_to")," ",a("span",{innerHTML:salla.money(s.maximum_amount.amount,s.maximum_amount.currency)}))),a("div",{class:"s-cart-coupons-code"},s.code)),a("div",{class:"s-cart-coupons-divider"}),a("div",{class:"s-cart-coupons-bottom-section"},a("div",{class:"s-cart-coupons-terms"},null!=s.remaining_days&&a("div",{class:"s-cart-coupons-expiry "+(s.remaining_days<=3?"s-cart-coupons-expiry-warning":"")},0===s.remaining_days?salla.lang.get("pages.cart.expires_today"):`${salla.lang.get("pages.cart.expires_after")} ${s.remaining_days} ${salla.lang.get("pages.cart.day")}`),s.minimum_amount&&parseFloat(s.minimum_amount.amount)>0&&a("div",{class:"s-cart-coupons-minimum"},salla.lang.get("pages.cart.minimum")," ",a("span",{innerHTML:salla.money(s.minimum_amount.amount,s.minimum_amount.currency)}))),a("div",{class:"s-cart-coupons-action"},t?salla.lang.get("pages.cart.save_coupon"):salla.lang.get("pages.cart.coupon_not_compatible")))))}render(){return a(t,{key:"e3bed8f1f2019db5e1c5ca4280696933913e3081"},a("div",{key:"9c6a7c383394f9bd19107db9b8e76fd9129648e3",class:"s-cart-coupons-wrapper"},a("div",{key:"1e7f74969e709062c36aa19ff4ec27bde0bb10df",class:"s-cart-coupons-input-section"},a("label",{key:"f3bc1f4ffa9c8a64bee8af273597d6f8ff1f8fd0",htmlFor:"coupon-input",class:"s-cart-coupons-coupon-label"},salla.lang.get("pages.cart.have_coupon")),a("div",{key:"7abbdbd41cf6e65b6c08928bb10a68bfb2677d85",class:"s-cart-coupons-coupon-input-container"},this.multiCoupon?[a("input",{type:"text",id:"coupon-input",name:"coupon",class:"form-input "+(this.couponError?"s-coupon-input-error":""),placeholder:salla.lang.get("pages.cart.coupon_placeholder"),value:this.couponInputValue,disabled:this.isApplying,onInput:this.onInput,onKeyUp:this.onKeyUp,"aria-label":salla.lang.get("pages.cart.apply_coupon"),key:"coupon-input"}),a("salla-button",{ref:s=>this.couponButtonRef=s,class:"s-cart-coupons-coupon-button s-cart-coupons-coupon-button-apply",color:"primary",loading:this.isApplying,"loader-position":"center",onClick:()=>this.handleApplyClick(),key:"apply-button"},a("span",null,salla.lang.get("pages.cart.save_coupon")))]:[a("input",{type:"text",id:"coupon-input",name:"coupon",class:"form-input "+(this.couponError?"s-coupon-input-error":""),placeholder:salla.lang.get("pages.cart.coupon_placeholder"),value:this.couponInputValue,disabled:!!this.currentCoupon||this.isApplying,onInput:this.onInput,onKeyUp:this.onKeyUp,"aria-label":salla.lang.get("pages.cart.apply_coupon"),key:"coupon-input"}),a("salla-button",{ref:s=>this.couponButtonRef=s,class:"s-cart-coupons-coupon-button "+(this.currentCoupon?"s-cart-coupons-coupon-button-remove":"s-cart-coupons-coupon-button-apply"),color:this.currentCoupon?"danger":"primary",loading:this.isApplying,"loader-position":"center",onClick:()=>this.handleCouponButtonClick(),key:"apply-button"},this.currentCoupon?a("i",{class:"sicon-cancel"}):a("span",null,salla.lang.get("pages.cart.save_coupon")))]),this.couponError&&a("span",{key:"6c259fbca7a2a3c2ece3d4c335707c833be5f8d6",class:"s-cart-coupons-coupon-error"},this.couponError),this.multiCoupon&&this.appliedCoupons.length>0&&a("div",{key:"87335fd875279e97fc7a02c9f3519af51a953a7b",class:"s-cart-coupons-applied-list"},this.appliedCoupons.map((s=>a("div",{class:"s-cart-coupons-applied-item",key:s},a("span",{class:"s-cart-coupons-applied-code"},s),a("button",{type:"button",class:"s-cart-coupons-applied-remove","aria-label":`${salla.lang.get("pages.cart.delete")} ${s}`,disabled:this.isApplying,onClick:()=>this.removeCoupon(s)},a("i",{class:"sicon-cancel"}))))))),this.availableCoupons&&this.availableCoupons.length>0&&a("salla-slider",{key:"86c665d3135fa8bc393c4b7ad9daca3ce87bed50",type:"carousel",showControls:!1,class:"s-cart-coupons-slider"},a("div",{key:"45ddccd7e0c5d38e9b98f42862a6d64f6040c942",slot:"items"},this.availableCoupons.map((s=>this.renderCouponCard(s)))))))}get host(){return o(this)}};i.style='.s-cart-coupons-applied-list{display:flex;flex-direction:column;gap:8px;margin-top:12px}.s-cart-coupons-applied-item{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:10px 12px;background:#fff;border:1px solid #e5e7eb;border-radius:10px;border-inline-start:3px solid #10b981}.s-cart-coupons-applied-code{display:inline-flex;align-items:center;gap:6px;font-size:13px;font-weight:700;color:#111827}.s-cart-coupons-applied-code::before{content:"";width:7px;height:7px;border-radius:9999px;background:#10b981}.s-cart-coupons-applied-remove{display:inline-flex;align-items:center;justify-content:center;width:26px;height:26px;color:#ef4444;background:transparent;border:0;border-radius:9999px;cursor:pointer;transition:background-color 0.15s ease, color 0.15s ease}.s-cart-coupons-applied-remove:hover{background:#fef2f2}.s-cart-coupons-applied-remove:disabled{opacity:0.5;cursor:not-allowed}';export{i as salla_cart_coupons}
|
|
4
|
+
import{r as s,h as a,H as t,a as o}from"./p-BmH_SCLp.js";const i=class{constructor(a){s(this,a),this.availableCoupons=[],this.cartTotal=0,this.cartTotalReady=!1,this.currentCoupon="",this.couponInputValue="",this.couponError="",this.isApplying=!1,this.appliedCoupons=[],this.multiCoupon=!1,this.isHandlingInternalError=!1,this.cartUpdatedHandler=s=>{this.syncCartTotal(s),(this.multiCoupon?Array.isArray(s?.coupons):s&&"coupon"in s)&&this.syncAppliedFromCart(s),this.couponError=""},this.couponAddedHandler=()=>{this.isApplying||this.isHandlingInternalError||this.refreshFromServer()},this.couponAdditionFailedHandler=s=>{this.isApplying||this.isHandlingInternalError||this.showCouponError(s?.message||salla.lang.get("pages.cart.coupon_application_error"))},this.couponDeletedHandler=()=>{this.isApplying||this.isHandlingInternalError||this.refreshFromServer()},this.onKeyUp=s=>{"Enter"===s.key&&this.couponButtonRef?.click(),this.couponError=""},this.onInput=s=>{this.couponInputValue=s.target.value}}async componentWillLoad(){await Salla.onReady(),await Salla.lang.onLoaded(),this.multiCoupon=!!salla.config.get("store.settings.cart.multi_coupon"),this.loadCouponsData(),this.seedFromStorage(),this.loadCartTotal(),this.setupCartEventListeners()}setupCartEventListeners(){salla.event.on("cart::updated",this.cartUpdatedHandler),salla.event.on("cart::coupon.added",this.couponAddedHandler),salla.event.on("cart::coupon.addition.failed",this.couponAdditionFailedHandler),salla.event.on("cart::coupon.deleted",this.couponDeletedHandler)}disconnectedCallback(){salla.event.off("cart::updated",this.cartUpdatedHandler),salla.event.off("cart::coupon.added",this.couponAddedHandler),salla.event.off("cart::coupon.addition.failed",this.couponAdditionFailedHandler),salla.event.off("cart::coupon.deleted",this.couponDeletedHandler)}async selectCoupon(s){const a=this.availableCoupons.find((a=>a.code===s));if(a){if(!this.isEligible(a))throw new Error("Coupon not eligible: minimum cart amount not met");try{await this.applyCoupon(s),this.host.dispatchEvent(new CustomEvent("salla::cart-coupons.coupon.selected",{detail:a,bubbles:!0}))}catch(s){throw s}}return a}async loadCouponsData(){try{const s=await salla.api.request("coupons"),a=s?.data,t=Array.isArray(a)?a:Array.isArray(a?.data)?a.data:[];this.availableCoupons=t}catch(s){console.warn("Failed to load coupons:",s),this.availableCoupons=[]}}async loadCartTotal(){await this.refreshFromServer()}seedFromStorage(){if(this.multiCoupon)return;const s=salla.storage.get("cart");s&&"object"==typeof s&&"coupon"in s&&this.applyCart(s),this.seedTotalsFromSummaryStorage()}seedTotalsFromSummaryStorage(){const s=salla.storage.get("cart.summary");s&&"object"==typeof s&&null!=s.sub_total&&(this.cartTotal=Number(s.sub_total),this.cartTotalReady=!0)}syncCartTotal(s){const a=s?.summary?.sub_total??s?.sub_total??s?.total;null!=a&&(this.cartTotal=Number(a),this.cartTotalReady=!0)}async refreshFromServer(){try{const s=await salla.cart.details(),a=s?.data?.cart??s?.data??s;if(a&&"object"==typeof a&&(Array.isArray(a.coupons)||"coupon"in a))return void this.applyCart(a)}catch(s){}const s=salla.storage.get("cart");s&&this.applyCart(s),this.seedTotalsFromSummaryStorage()}applyCart(s){this.syncCartTotal(s),this.syncAppliedFromCart(s)}syncAppliedFromCart(s){this.currentCoupon=s?.coupon||"",this.multiCoupon?this.appliedCoupons=Array.isArray(s?.coupons)?s.coupons.filter(Boolean):this.currentCoupon?[this.currentCoupon]:[]:(this.couponInputValue=this.currentCoupon,this.appliedCoupons=this.currentCoupon?[this.currentCoupon]:[])}async handleApplyClick(){if(this.isApplying)return;const s=this.couponInputValue.trim();if(s){this.isApplying=!0,this.isHandlingInternalError=!0;try{await salla.cart.addCoupon(s),await this.refreshFromServer(),this.couponInputValue=""}catch(s){this.showCouponError(s.response?.data?.error?.message||salla.lang.get("pages.cart.coupon_application_error"))}finally{this.isApplying=!1,setTimeout((()=>{this.isHandlingInternalError=!1}),100)}}else this.showCouponError(salla.lang.get("pages.cart.enter_coupon_code"))}async handleCouponButtonClick(){if(this.isApplying)return;const s=!!this.currentCoupon;if(s||this.couponInputValue.trim()){this.isApplying=!0,this.isHandlingInternalError=!0;try{s?await salla.cart.deleteCoupon():await salla.cart.addCoupon(this.couponInputValue.trim()),await this.refreshFromServer()}catch(s){this.showCouponError(s.response?.data?.error?.message||salla.lang.get("pages.cart.coupon_application_error"))}finally{this.isApplying=!1,setTimeout((()=>{this.isHandlingInternalError=!1}),100)}}else this.showCouponError(salla.lang.get("pages.cart.enter_coupon_code"))}async removeCoupon(s){if(!this.isApplying){this.isApplying=!0,this.isHandlingInternalError=!0;try{this.multiCoupon?await salla.cart.deleteCoupon(s):await salla.cart.deleteCoupon(),await this.refreshFromServer()}catch(s){this.showCouponError(s.response?.data?.error?.message||salla.lang.get("pages.cart.coupon_application_error"))}finally{this.isApplying=!1,setTimeout((()=>{this.isHandlingInternalError=!1}),100)}}}showCouponError(s){this.couponError=s}handleCouponClick(s){this.applyCoupon(s.code,!1).catch((()=>{}))}async applyCoupon(s,a=!0){if(this.isApplying){if(a)throw new Error("Coupon application already in progress")}else{this.couponInputValue=s,this.couponError="",this.isApplying=!0,this.isHandlingInternalError=!0;try{await salla.cart.addCoupon(s.trim()),await this.refreshFromServer(),this.multiCoupon&&(this.couponInputValue="")}catch(s){if(this.showCouponError(s.response?.data?.error?.message||salla.lang.get("pages.cart.coupon_application_error")),a)throw s}finally{this.isApplying=!1,setTimeout((()=>{this.isHandlingInternalError=!1}),100)}}}formatMainAmount(s){if("percentage"===s.type)return`${salla.helpers.number("object"==typeof s.amount?s.amount.amount:s.amount)}%`;{const t="object"==typeof s.amount?s.amount:{amount:s.amount,currency:s.minimum_amount?.currency||salla.config.get("store.currency.code","SAR")};return a("span",{innerHTML:salla.money(t.amount,t.currency)})}}isEligible(s){return!this.cartTotalReady||!s.minimum_amount||this.cartTotal>=parseFloat(s.minimum_amount.amount)}renderCouponCard(s){const t=this.isEligible(s);return a("div",{class:"s-cart-coupons-slide-one-fourth swiper-slide"},a("div",{class:"s-cart-coupons-card "+(!t||this.isApplying?"s-cart-coupons-disabled":""),onClick:()=>t&&!this.isApplying&&this.handleCouponClick(s)},a("div",{class:"s-cart-coupons-top-section"},a("div",{class:"s-cart-coupons-discount-values"},a("div",{class:"s-cart-coupons-main-amount"},this.formatMainAmount(s)),s.free_shipping?a("div",{class:"s-cart-coupons-secondary-info"},"+ ",salla.lang.get("pages.cart.free_shipping")):s.maximum_amount&&a("div",{class:"s-cart-coupons-secondary-info"},salla.lang.get("pages.cart.up_to")," ",a("span",{innerHTML:salla.money(s.maximum_amount.amount,s.maximum_amount.currency)}))),a("div",{class:"s-cart-coupons-code"},s.code)),a("div",{class:"s-cart-coupons-divider"}),a("div",{class:"s-cart-coupons-bottom-section"},a("div",{class:"s-cart-coupons-terms"},null!=s.remaining_days&&a("div",{class:"s-cart-coupons-expiry "+(s.remaining_days<=3?"s-cart-coupons-expiry-warning":"")},0===s.remaining_days?salla.lang.get("pages.cart.expires_today"):`${salla.lang.get("pages.cart.expires_after")} ${s.remaining_days} ${salla.lang.get("pages.cart.day")}`),s.minimum_amount&&parseFloat(s.minimum_amount.amount)>0&&a("div",{class:"s-cart-coupons-minimum"},salla.lang.get("pages.cart.minimum")," ",a("span",{innerHTML:salla.money(s.minimum_amount.amount,s.minimum_amount.currency)}))),a("div",{class:"s-cart-coupons-action"},t?salla.lang.get("pages.cart.save_coupon"):salla.lang.get("pages.cart.coupon_not_compatible")))))}render(){return a(t,{key:"e3bed8f1f2019db5e1c5ca4280696933913e3081"},a("div",{key:"9c6a7c383394f9bd19107db9b8e76fd9129648e3",class:"s-cart-coupons-wrapper"},a("div",{key:"1e7f74969e709062c36aa19ff4ec27bde0bb10df",class:"s-cart-coupons-input-section"},a("label",{key:"f3bc1f4ffa9c8a64bee8af273597d6f8ff1f8fd0",htmlFor:"coupon-input",class:"s-cart-coupons-coupon-label"},salla.lang.get("pages.cart.have_coupon")),a("div",{key:"7abbdbd41cf6e65b6c08928bb10a68bfb2677d85",class:"s-cart-coupons-coupon-input-container"},this.multiCoupon?[a("input",{type:"text",id:"coupon-input",name:"coupon",class:"form-input "+(this.couponError?"s-coupon-input-error":""),placeholder:salla.lang.get("pages.cart.coupon_placeholder"),value:this.couponInputValue,disabled:this.isApplying,onInput:this.onInput,onKeyUp:this.onKeyUp,"aria-label":salla.lang.get("pages.cart.apply_coupon"),key:"coupon-input"}),a("salla-button",{ref:s=>this.couponButtonRef=s,class:"s-cart-coupons-coupon-button s-cart-coupons-coupon-button-apply",color:"primary",loading:this.isApplying,"loader-position":"center",onClick:()=>this.handleApplyClick(),key:"apply-button"},a("span",null,salla.lang.get("pages.cart.save_coupon")))]:[a("input",{type:"text",id:"coupon-input",name:"coupon",class:"form-input "+(this.couponError?"s-coupon-input-error":""),placeholder:salla.lang.get("pages.cart.coupon_placeholder"),value:this.couponInputValue,disabled:!!this.currentCoupon||this.isApplying,onInput:this.onInput,onKeyUp:this.onKeyUp,"aria-label":salla.lang.get("pages.cart.apply_coupon"),key:"coupon-input"}),a("salla-button",{ref:s=>this.couponButtonRef=s,class:"s-cart-coupons-coupon-button "+(this.currentCoupon?"s-cart-coupons-coupon-button-remove":"s-cart-coupons-coupon-button-apply"),color:this.currentCoupon?"danger":"primary",loading:this.isApplying,"loader-position":"center",onClick:()=>this.handleCouponButtonClick(),key:"apply-button"},this.currentCoupon?a("i",{class:"sicon-cancel"}):a("span",null,salla.lang.get("pages.cart.save_coupon")))]),this.couponError&&a("span",{key:"6c259fbca7a2a3c2ece3d4c335707c833be5f8d6",class:"s-cart-coupons-coupon-error"},this.couponError),this.multiCoupon&&this.appliedCoupons.length>0&&a("div",{key:"87335fd875279e97fc7a02c9f3519af51a953a7b",class:"s-cart-coupons-applied-list"},this.appliedCoupons.map((s=>a("div",{class:"s-cart-coupons-applied-item",key:s},a("span",{class:"s-cart-coupons-applied-code"},s),a("button",{type:"button",class:"s-cart-coupons-applied-remove","aria-label":`${salla.lang.get("pages.cart.delete")} ${s}`,disabled:this.isApplying,onClick:()=>this.removeCoupon(s)},a("i",{class:"sicon-cancel"}))))))),this.availableCoupons&&this.availableCoupons.length>0&&a("salla-slider",{key:"86c665d3135fa8bc393c4b7ad9daca3ce87bed50",type:"carousel",showControls:!1,class:"s-cart-coupons-slider"},a("div",{key:"45ddccd7e0c5d38e9b98f42862a6d64f6040c942",slot:"items"},this.availableCoupons.map((s=>this.renderCouponCard(s)))))))}get host(){return o(this)}};i.style='.s-cart-coupons-applied-list{display:flex;flex-direction:column;gap:8px;margin-top:12px}.s-cart-coupons-applied-item{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:10px 12px;background:#fff;border:1px solid #e5e7eb;border-radius:10px;border-inline-start:3px solid #10b981}.s-cart-coupons-applied-code{display:inline-flex;align-items:center;gap:6px;font-size:13px;font-weight:700;color:#111827}.s-cart-coupons-applied-code::before{content:"";width:7px;height:7px;border-radius:9999px;background:#10b981}.s-cart-coupons-applied-remove{display:inline-flex;align-items:center;justify-content:center;width:26px;height:26px;color:#ef4444;background:transparent;border:0;border-radius:9999px;cursor:pointer;transition:background-color 0.15s ease, color 0.15s ease}.s-cart-coupons-applied-remove:hover{background:#fef2f2}.s-cart-coupons-applied-remove:disabled{opacity:0.5;cursor:not-allowed}';export{i as salla_cart_coupons}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as s,h as t,H as a,a as i}from"./p-
|
|
4
|
+
import{r as s,h as t,H as a,a as i}from"./p-BmH_SCLp.js";const e=class{constructor(t){s(this,t),this.exclude=[]}componentWillLoad(){return salla.onReady().then((()=>{if("string"==typeof this.exclude)try{this.exclude=JSON.parse(this.exclude)}catch(s){salla.logger.error("salla-payments:: failed to parse the exclude props!",this.exclude),this.exclude=[]}this.paymentSlot=this.host.querySelector('[slot="payment"]')?.innerHTML||'<li class="s-payments-list-item"><img width="100%" height="100%" decoding="async" loading="lazy" src="{image}" alt="{payment}" /></li>',this.sbcSlot=this.host.querySelector('[slot="sbc"]')?.innerHTML||'<li class="s-payments-list-item"><a target="_blank" href="{link}"><img width="100%" height="100%" decoding="async" loading="lazy" src="{image}" class="s-payments-sbc-image" alt="SBC" /></a></li>',this.codSlot=this.host.querySelector('[slot="cod"]')?.innerHTML||'<li class="s-payments-list-item"><img width="100%" height="100%" decoding="async" loading="lazy" src="{image}" alt="COD" /></li>',this.payments=salla.config.get("store.settings.payments")}))}paymentLogo(s){const t=`images/payment/${s}_mini.png`;return e.NEW_CDN_LOGOS.includes(s)?salla.url.assetsCdn(t,58,58):salla.url.cdn(t,58,58)}render(){const s=!this.exclude.includes("made-in-ksa")&&salla.config.get("store.settings.made_in_ksa"),i=this.exclude.includes("sbc")?null:salla.config.get("store.settings.certificate.id");return t(a,{key:"da9ffad7606b7a1f885df4843612c4221a835c15",class:"s-payments-list-wrap"},t("ul",{key:"9a15cd4328a65261e1137d65600867fd89893892",class:"s-payments-list"},s&&t("li",{key:"17964fbe6a411738ad026cd116e1a67676ae0ab6",class:"s-payments-list-item"},t("img",{key:"36baae3d522f41f1ab07d75328318ee9f9ae3a19",width:58,height:58,decoding:"async",loading:"lazy",src:salla.url.cdn("images/made-in-ksa.svg",58,58),alt:"made in KSA certified"})),this.payments.map((s=>t("div","cod"==s?{id:"cod-slot",innerHTML:this.codSlot.replace(/\{image\}/g,this.paymentLogo("cod"))}:{id:"payment-slot",innerHTML:this.paymentSlot.replace(/\{image\}/g,this.paymentLogo(s)).replace(/\{payment\}/g,s)}))),i&&t("div",{key:"9f6c64efa03905a8584f8732bc7032ae686bef29",id:"sbc-slot",innerHTML:this.sbcSlot.replace(/\{image\}/g,salla.url.cdn("images/sbc.png",58,58)).replace(/\{link\}/g,`https://eauthenticate.saudibusiness.gov.sa/certificate-details/${i}`)})))}componentDidRender(){this.host.querySelectorAll("#payment-slot").forEach((s=>s.replaceWith(s.firstChild))),this.host.querySelectorAll("#sbc-slot").forEach((s=>s.replaceWith(s.firstChild))),this.host.querySelectorAll("#cod-slot").forEach((s=>s.replaceWith(s.firstChild))),this.host.querySelector('[slot="payment"]')?.remove(),this.host.querySelector('[slot="sbc"]')?.remove(),this.host.querySelector('[slot="cod"]')?.remove()}get host(){return i(this)}};e.NEW_CDN_LOGOS=["tabby_installment","emkan_installment"],e.style=":host{display:block}";export{e as salla_payments}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Crafted with ❤ by Salla
|
|
3
|
+
*/
|
|
4
|
+
import{r as e,c as t,h as d,H as r}from"./p-BmH_SCLp.js";const c=class{constructor(d){e(this,d),this.orderEditProductSelected=t(this,"orderEditProductSelected")}get productData(){if(!this.product)return{};if("object"==typeof this.product)return this.product;try{return JSON.parse(this.product)}catch(e){return{}}}handleSelectProduct(){this.orderEditProductSelected.emit({product:this.productData})}render(){const e=this.productData,t=e?.name||salla.lang.getWithDefault("common.elements.product","منتج"),c=e?.price;return d(r,{key:"7669432a4756da446e16d9a3093a067767c5dd9d"},d("button",{key:"d998dde2a1dc4eae7444fd398910c3a0699730f8",type:"button",class:"s-order-edit-product-card",onClick:()=>this.handleSelectProduct()},d("div",{key:"6a0e6eec84de332598d94be87b49564eeb2cfbc2",class:"s-order-edit-product-card-media"},e?.image?.url?d("img",{src:e.image.url,alt:e.image.alt||t,class:"s-order-edit-product-card-image"}):d("div",{class:"s-order-edit-product-card-placeholder"},d("i",{class:"sicon-shopping-bag"}))),d("div",{key:"4eeb9f7430c19f8e792b0f6856fb86a2f265eb95",class:"s-order-edit-product-card-content"},d("h3",{key:"840ae549097a53f1f297673d69e3155792a4097e",class:"s-order-edit-product-card-title"},t),null!=c&&d("p",{key:"32732854ca599fe446d0b47883b892ac17d90cae",class:"s-order-edit-product-card-price",innerHTML:salla.money(c)}))))}};c.style=":host{display:block;min-width:0}";export{c as salla_order_edit_product_card}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as t,h as i,H as e}from"./p-
|
|
4
|
+
import{r as t,h as i,H as e}from"./p-BmH_SCLp.js";var s,a;!function(t){t.PERCENTAGE="percentage",t.FIXED="fixed",t.FREE_PRODUCT="free_product"}(s||(s={})),function(t){t.PRODUCT_COUNT="products_count",t.PRODUCT_PURCHASE="order_amount"}(a||(a={}));const l=class{constructor(i){t(this,i),this.offer=null,this.products={},this.isLoading=!1,this.canRender=!0}componentWillLoad(){salla.onReady().then((()=>{if(!salla.config.get("store.features")?.includes("conditional-offer")||""!==salla.storage.get("cart")&&!salla.storage.get("cart")?.summary?.count)throw new Error("feature or cart object does not existed")})).then((()=>salla.api.cart.offers())).then((({data:t})=>{if(this.offer=t.find((t=>"conditional"===t.type)),this.offer)return this.isLoading=!0,this.offer.details.discounts.unshift({value:0,min_spend:0}),this.updateInitialOfferValue();this.canRender=!1})).then((()=>{if(this.offer)return this.getProducts()})).then((()=>{this.offer&&salla.event.on("cart::updated",(t=>this.updateOfferValues(t)))})).catch((t=>{this.canRender=!1,salla.logger.warn("salla-conditional-offer:: ",t)})).finally((()=>{this.isLoading=!1}))}getProducts(){const t=this.offer.details.discounts.filter((({type:t})=>t===s.FREE_PRODUCT)).map((({value:t})=>t)).filter(Boolean);if(t.length>0)return salla.product.fetch({source:"selected",source_value:t}).then((t=>{const i=t?.data;if(i&&Array.isArray(i)){const t={...this.products};i.forEach((({id:i,url:e,image:s,name:a,price:l})=>{i&&a&&s?.url&&e&&void 0!==l&&(t[i]={url:e,image:s,name:a,price:l})})),this.products=t}}))}updateInitialOfferValue(){return salla.api.cart.details().then((({data:{cart:t}})=>this.updateOfferValues(t)))}updateOfferValues({items:t,sub_total:i}){const e=this.offer.details.based_on===a.PRODUCT_COUNT?t?.reduce(((t,{quantity:i})=>t+i),0)??0:i;return this.offer={...this.offer,details:{...this.offer?.details,current_value:e}},this.offer}renderTooltip(t){const e=t.value,s=this.products[e];return s?i("salla-tooltip",{class:"absolute left-0 -top-2",targetId:`avatar-product-${e}`,theme:"dark"},i("div",{class:"flex gap-3 text-start"},s?.image?.url&&i("img",{src:s.image.url,alt:s?.image?.alt||s.name||"",class:"w-12 h-12 object-cover rounded-lg flex-shrink-0",loading:"lazy",decoding:"async"}),i("div",{class:"flex-1"},i("div",{class:"leading-tight mb-1"},s.name),i("div",{class:"text-xs text-gray-300",innerHTML:salla.money(s.price)})))):(salla.logger.error(`salla-conditional-offer:: there is no product with id (${t.value})!`),null)}getCheckpointContent(t){if(t.type===s.PERCENTAGE)return`${t.value}%`;if(t.type===s.FIXED)return i("span",{innerHTML:salla.money(t.value)});if(t.type!==s.FREE_PRODUCT)return salla.logger.error(`salla-conditional-offer:: unexpected type (${t.type})!`),"";const e=this.products[t.value];return e?i("a",{class:"s-conditional-offer-product-link",href:e.url},i("img",{class:"s-conditional-offer-checkpoint-image-content",loading:"lazy",decoding:"async",alt:e?.image?.alt||"",src:e?.image?.url})):(salla.logger.error(`salla-conditional-offer:: there is no product with id (${t.value})!`),"")}getOfferType(t){const i=this.offer.details?.based_on;if(i===a.PRODUCT_COUNT)try{return salla.lang.choice("blocks.header.products_count",t.min_spend)}catch(i){return salla.logger.warn("salla-conditional-offer:: invalid products_count interval",i),`${t.min_spend}`}return i===a.PRODUCT_PURCHASE?salla.money(t.min_spend):(salla.logger.warn(`salla-conditional-offer:: Unexpected offer detail's based_on value: ${i}`),`${t.min_spend}`)}clamp(t,i,e){return Math.max(i,Math.min(t,e))}mapValueRanges(t,i,e,s,a){const l=(t-i)*(a-s)/(e-i)+s;return l===Number.POSITIVE_INFINITY?100:l===Number.NEGATIVE_INFINITY?0:this.clamp(l,0,100)}getCheckPointView(t,e){const a=this.offer.details.discounts.findIndex((({min_spend:i})=>i===t.min_spend)),l=this.mapValueRanges(this.offer.details.current_value,this.offer.details.discounts[a-1]?.min_spend??0,t.min_spend,0,100),n=t.min_spend<=this.offer.details.current_value;return i("div",{class:"s-conditional-offer-checkpoint-container"},e>0?[i("div",{key:"progress-line",class:"s-conditional-offer-progress-line-container"},i("div",{class:"s-conditional-offer-progress-line-inactive"}),i("div",{class:"s-conditional-offer-progress-line-active",style:{width:`${l}%`}})),i("div",{key:"checkpoint",class:"s-conditional-offer-checkpoint "+(n?"s-conditional-offer-active-checkpoint":"")},i("div",{class:"s-conditional-offer-item-avatar-content "+(n?"active":""),id:t.type===s.FREE_PRODUCT?`avatar-product-${t.value}`:`avatar-${t.value??e}`},this.products&&this.getCheckpointContent(t)),this.products&&t.type===s.FREE_PRODUCT&&this.renderTooltip(t),i("div",{class:"s-conditional-offer-checkpoint-label "+(n?"active":""),innerHTML:this.getOfferType(t)}))]:i("div",{key:"label",class:{"s-conditional-offer-checkpoint-label":!0,"first-checkpoint":0===e,active:n,hidden:0===e,"sm:block":0===e},innerHTML:this.getOfferType(t)}))}getLoadingSkeletonView(){return i(e,{class:"s-conditional-offer-container"},i("div",{class:"s-conditional-offer-skeleton-inner-container"},i("div",{class:"s-conditional-offer-skeleton-subtitle"},i("salla-skeleton",{height:"16px",width:"30%"})),i("div",{class:"s-conditional-offer-skeleton-subtitle"},i("salla-skeleton",{height:"16px",width:"35%"})),i("div",{class:"s-conditional-offer-skeleton-checkpoints-wrapper"},Array(3).fill(null).map((()=>[i("salla-skeleton",{key:"checkpoint-line",height:"8px"}),i("div",{key:"checkpoint"},i("salla-skeleton",{height:"60px",width:"60px",type:"circle"}))])))))}render(){return this.canRender?this.isLoading?this.getLoadingSkeletonView():this.offer?i(e,{class:"s-conditional-offer-container"},i("div",{class:"s-conditional-offer-title-wrapper"},i("div",{class:"s-conditional-offer-title"},this.offer.title),this.offer.description?i("div",{class:"s-conditional-offer-subtitle"},this.offer.description," ",i("i",{class:"sicon-information"})):null),i("div",{class:"s-conditional-offer-progress-container"},this.offer.details.discounts.map(((t,e)=>i("div",{class:{"flex-1":e>0},key:t.min_spend},this.getCheckPointView(t,e)))))):null:null}};l.style=":host{display:block}";export{l as salla_conditional_offer}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as a,h as l,H as s,a as n}from"./p-
|
|
4
|
+
import{r as a,h as l,H as s,a as n}from"./p-BmH_SCLp.js";const t=class{constructor(l){a(this,l),this.pointsData=null,this.productId=null}async componentWillLoad(){try{if(await salla.onReady(),await salla.lang.onLoaded(),this.productId=this.host.dataset.productId||salla.config.get("page.id"),!this.productId)return;const a=await salla.api.request(`/loyalty/products/${this.productId}/points`).catch((()=>null));this.pointsData=a?.data||null}catch(a){salla?.logger?.warn?.("salla-loyalty-points-banner: init failed",a)}}render(){return this.productId&&this.pointsData?.points?l(s,null,l("div",{class:"s-loyalty-points-banner-container"},l("div",{class:"s-loyalty-points-banner-icon"},l("span",{class:"s-loyalty-points-banner-inner-icon",innerHTML:'<svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M8.76604 2.86201C9.31804 2.61001 9.93304 2.41501 10.611 2.27701C11.289 2.13901 12 2.07001 12.744 2.07001C13.572 2.07001 14.364 2.15401 15.12 2.32201C15.84 2.49001 16.356 2.81401 16.668 3.29401C16.932 3.70201 17.064 4.26001 17.064 4.96801V13.032C17.064 13.416 16.95 13.752 16.722 14.04C16.506 14.304 16.227 14.493 15.885 14.607C15.543 14.721 15.204 14.742 14.868 14.67C14.196 14.514 13.488 14.436 12.744 14.436C12.084 14.436 11.442 14.502 10.818 14.634C10.23 14.754 9.70204 14.922 9.23404 15.138C8.68204 15.39 8.06704 15.585 7.38904 15.723C6.71104 15.861 6.00004 15.93 5.25604 15.93C4.42804 15.93 3.63604 15.846 2.88004 15.678C2.18404 15.522 1.68004 15.21 1.36804 14.742C1.08004 14.322 0.936035 13.752 0.936035 13.032V4.96801C0.936035 4.58401 1.05004 4.24801 1.27804 3.96001C1.49404 3.69601 1.77304 3.50701 2.11504 3.39301C2.45704 3.27901 2.79604 3.25801 3.13204 3.33001C3.80404 3.48601 4.51204 3.56401 5.25604 3.56401C5.91604 3.56401 6.55804 3.49801 7.18204 3.36601C7.77004 3.24601 8.29804 3.07801 8.76604 2.86201ZM11.25 9.00001C11.25 8.59201 11.148 8.21701 10.944 7.87501C10.74 7.53301 10.467 7.26001 10.125 7.05601C9.78304 6.85201 9.40804 6.75001 9.00004 6.75001C8.59204 6.75001 8.21704 6.85201 7.87504 7.05601C7.53304 7.26001 7.26004 7.53301 7.05604 7.87501C6.85204 8.21701 6.75004 8.59201 6.75004 9.00001C6.75004 9.40801 6.85204 9.78301 7.05604 10.125C7.26004 10.467 7.53304 10.74 7.87504 10.944C8.21704 11.148 8.59204 11.25 9.00004 11.25C9.40804 11.25 9.78304 11.148 10.125 10.944C10.467 10.74 10.74 10.467 10.944 10.125C11.148 9.78301 11.25 9.40801 11.25 9.00001ZM14.328 7.79401C14.076 7.75801 13.812 7.73401 13.536 7.72201C13.38 7.71001 13.245 7.75501 13.131 7.85701C13.017 7.95901 12.954 8.08801 12.942 8.24401C12.93 8.40001 12.975 8.53501 13.077 8.64901C13.179 8.76301 13.308 8.82601 13.464 8.83801C13.704 8.85001 13.938 8.87401 14.166 8.91001C14.322 8.93401 14.463 8.90101 14.589 8.81101C14.715 8.72101 14.787 8.59801 14.805 8.44201C14.823 8.28601 14.787 8.14501 14.697 8.01901C14.607 7.89301 14.484 7.81801 14.328 7.79401ZM4.53604 9.16201C4.29604 9.15001 4.06204 9.12601 3.83404 9.09001C3.67804 9.06601 3.53704 9.09901 3.41104 9.18901C3.28504 9.27901 3.21304 9.40201 3.19504 9.55801C3.17704 9.71401 3.21304 9.85501 3.30304 9.98101C3.39304 10.107 3.51604 10.182 3.67204 10.206C3.92404 10.242 4.18804 10.266 4.46404 10.278C4.62004 10.29 4.75504 10.245 4.86904 10.143C4.98304 10.041 5.04604 9.91201 5.05804 9.75601C5.07004 9.60001 5.02504 9.46501 4.92304 9.35101C4.82104 9.23701 4.69204 9.17401 4.53604 9.16201Z" fill="white"/>\n</svg>\n'})),l("p",null,l("span",{class:"s-loyalty-points-banner-label"},salla.lang.get("pages.loyalty_program.earn")," "),l("span",{class:"s-loyalty-points-banner-label"},`+${this.pointsData.points}`," "),l("span",{class:"s-loyalty-points-banner-label"},salla.lang.get("pages.loyalty_program.loyalty_point")," "),l("span",{class:"s-loyalty-points-banner-description"},salla.lang.get("pages.loyalty_program.on_order_total_when_purchase"))))):null}get host(){return n(this)}};t.style="";export{t as salla_loyalty_points_banner}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as t,h as i,a as s}from"./p-
|
|
4
|
+
import{r as t,h as i,a as s}from"./p-BmH_SCLp.js";import{H as n}from"./p-XnA1YTjA.js";import"./p-CgtvEd63.js";const a=class{constructor(i){t(this,i),this.itemPerPage=10,this.no_notifications_trans=salla.lang.get("blocks.header.no_notifications"),this.load_more_text_trans=salla.lang.get("common.elements.load_more"),salla.lang.onLoaded((()=>{this.no_notifications_trans=salla.lang.get("blocks.header.no_notifications"),this.load_more_text_trans=salla.lang.get("common.elements.load_more")}))}loading(t=!0){let i=this.status?.querySelector(".s-button-text");i&&(n.toggleElementClassIf(i,"s-button-hide","s-button-show",(()=>t)),this.btnLoader.style.display=t?"inherit":"none")}getNotificationCard(t){const i=document.createElement("salla-notification-item");return i.notification=t,i.classList.add("s-block"),i}render(){return this.showPlaceholder?i("div",{class:"s-notifications-no-content"},i("salla-placeholder",{alignment:"center"},i("span",{slot:"title"},this.no_notifications_trans))):i("div",{class:"s-notifications-wrapper"},i("div",{class:"s-notifications-container",ref:t=>this.wrapper=t}),this.nextPage&&i("div",{class:"s-infinite-scroll-wrapper",ref:t=>this.status=t},i("button",{onClick:()=>this.loadMore(),class:"s-infinite-scroll-btn s-button-btn s-button-primary"},i("span",{class:"s-button-text s-infinite-scroll-btn-text"},this.loadMoreText??this.load_more_text_trans),i("span",{class:"s-button-loader s-button-loader-center s-infinite-scroll-btn-loader",ref:t=>this.btnLoader=t,style:{display:"none"}}))))}isV2Response(t){return!!t.cursor}normalizeNotification(t){return{title:t.title,sub_title:t.body,date:t.time_ago,is_new:!t.is_read,url:t.url}}normalizePagination(t){return{count:t.count,currentPage:t.current,links:{next:null!=t.next?String(t.next):void 0}}}normalizeResponse(t){return this.isV2Response(t)?{data:(t.data||[]).map((t=>this.normalizeNotification(t))),pagination:this.normalizePagination(t.cursor)}:t}handleResponse(t){return t.map((t=>this.getNotificationCard(t)))}initiateInfiniteScroll(){this.wrapper?(this.infiniteScroll=salla.infiniteScroll.initiate(this.wrapper,this.wrapper,{path:()=>this.nextPage,history:!0,nextPage:this.nextPage,scrollThreshold:!1},!0),this.infiniteScroll?.on("request",(()=>{this.loading()})),this.infiniteScroll?.on("load",(t=>{this.loading(!1);const i=this.normalizeResponse(t);this.pagination=i.pagination,this.nextPage=i.pagination.links?.next||null,this.handleResponse(i.data).forEach((t=>this.wrapper.append(t)));let s=this.host.querySelectorAll("salla-notification-item:not(.animated)");n.animateItems(s)})),this.infiniteScroll?.on("error",(t=>{salla.logger.error("Error loading more comments:",t)}))):salla.logger.error("Wrapper is undefined. Cannot initiate infinite scroll.")}async loadInitialData(){await salla.api.notifications.fetch({per_page:this.itemPerPage}).then((t=>{const i=this.normalizeResponse(t);this.pagination=i.pagination,this.total=i.pagination.total,this.nextPage=i.pagination.links?.next||null,setTimeout((()=>{if(!i.data.length)return this.showPlaceholder=!0;this.handleResponse(i.data).forEach((t=>this.wrapper.append(t))),this.initiateInfiniteScroll();let t=this.wrapper.querySelectorAll("salla-notification-item:not(.animated)");n.animateItems(t)}),100)})).catch((t=>{salla.logger.error(t),this.showPlaceholder=!0,this.loading(!1)}))}async loadMore(){this.infiniteScroll?.loadNextPage()}async componentWillLoad(){await this.loadInitialData()}get host(){return s(this)}};a.style="";export{a as salla_notifications}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as t,h as s}from"./p-DjOBdfDM.js";import{a as i}from"./p-CgtvEd63.js";import{a as e}from"./p-BedNk7k1.js";import{S as a}from"./p-8Tsmrwno.js";import{S as h}from"./p-0-eTJXSD.js";const l=class{constructor(s){t(this,s),this.defaultEvent="gifting:open",this.selectImageForYourGift=salla.lang.get("blocks.buy_as_gift.select_image_for_your_gift"),this.currentStep=1,this.showCalendar=!1,this.showGiftText=!1,this.currentLang="",this.parentClass="is-current-step-1",this.errors={},this.gift=void 0,this.selectedGiftTextOption=void 0,this.selectedCountryId=void 0,this.selectedCountryCode=void 0,this.loadingCities=!1,this.loadingRegions=!1,this.regions=[],this.selectedRegionId=void 0,this.isKSA=!1,this.selectedCountry=null,this.selectedRegion=null,this.displayedCities=[],this.selectedCity=null,this.searchingCities=!1,this.enableCityAjaxSearch=!1,this.citySearchQuery="",this.step2Animated=!1,this.citySearchTimer=null,this.citySearchCounter=0,this.locationRequestCounter=0,this.showTextArea=!1,this.selectedImage=void 0,this.uploadedImage=void 0,this.selectedText=void 0,this.hasError=!1,this.timeZone=null,this.receiverCountryCode=salla.config.get("store.scope.countries")?.[0]||salla.config.get("store.store_country")||"SA",this.hostId=`salla-gifting-${Math.random().toString(36).slice(2,10)}`,this.disableClass=this.gift?.show_image_upload?"":"pointer-events-none",this.formSelector="form.product-form, form.form--product-options",this.handleCitySearch=t=>{if(this.citySearchQuery=t,!this.enableCityAjaxSearch)return;this.citySearchTimer&&clearTimeout(this.citySearchTimer);const s=++this.citySearchCounter;this.citySearchTimer=setTimeout((async()=>{this.searchingCities=!0;try{const i=await this.fetchCities(t);s===this.citySearchCounter&&(this.displayedCities=i)}catch(t){s===this.citySearchCounter&&(this.displayedCities=[])}finally{s===this.citySearchCounter&&(this.searchingCities=!1)}}),l.CITY_SEARCH_DEBOUNCE_MS)},this.handleCitySelected=t=>{this.selectedCity=t,this.receiverCity=String(t.id),this.clearError("receiver.city_id")},this.handleCityDropdownClosed=()=>{this.citySearchQuery="",this.citySearchTimer&&(clearTimeout(this.citySearchTimer),this.citySearchTimer=null),++this.citySearchCounter,this.displayedCities=this.gift?.cities??[],this.searchingCities=!1},this.handleCountryDropdownClosed=()=>{},this.handleRegionDropdownClosed=()=>{},salla.lang.onLoaded((()=>{this.selectImageOrUpload=salla.lang.get("blocks.buy_as_gift.select_image_or_upload"),this.selectImageForYourGift=salla.lang.get("blocks.buy_as_gift.select_image_for_your_gift"),this.sectionTitle=salla.lang.get("blocks.buy_as_gift.gift_the_one_you_love"),this.sectionSubtitle=salla.lang.get("blocks.buy_as_gift.gift_the_one_you_love_message"),this.sectionBtnText=salla.lang.get("blocks.buy_as_gift.send_as_a_gift"),this.giftDetails=salla.lang.get("blocks.buy_as_gift.gift_details"),this.selectGiftMessage=salla.lang.get("blocks.buy_as_gift.select_gift_message"),this.giftText=salla.lang.get("blocks.buy_as_gift.gift_text"),this.giftCustomText=salla.lang.get("blocks.buy_as_gift.gift_custom_text"),this.textId=salla.lang.get("blocks.buy_as_gift.text_id"),this.incorrectGiftText=salla.lang.get("blocks.buy_as_gift.incorrect_gift_text"),this.nextStep=salla.lang.get("blocks.buy_as_gift.next_step"),this.senderNameLabel=salla.lang.get("blocks.buy_as_gift.sender_name"),this.receiverNameFieldLabel=salla.lang.get("blocks.buy_as_gift.receiver_name"),this.receiverMobileFieldLabel=salla.lang.get("blocks.buy_as_gift.receiver_mobile"),this.receiverCountryFieldLabel=salla.lang.get("blocks.buy_as_gift.receiver_country"),this.ksa=salla.lang.get("pages.checkout.ksa"),this.selectCity=salla.lang.get("pages.checkout.select_city"),this.selectCountry=salla.lang.get("pages.checkout.select_country"),this.selectCityInfo=salla.lang.get("blocks.buy_as_gift.city_info"),this.cityChangeNotice=salla.lang.get("blocks.buy_as_gift.city_change_notice"),this.receiverCityFieldLabel=salla.lang.get("blocks.buy_as_gift.receiver_city"),this.receiverRegionFieldLabel=salla.lang.get("blocks.buy_as_gift.receiver_region")||salla.lang.get("pages.checkout.region"),this.selectRegion=salla.lang.get("pages.checkout.select_region"),this.receiverEmailFieldLabel=salla.lang.get("blocks.buy_as_gift.receiver_email"),this.emailPlaceholder=salla.lang.get("common.elements.email_placeholder"),this.sendLater=salla.lang.get("blocks.buy_as_gift.send_later"),this.selectSendDateAndTime=salla.lang.get("blocks.buy_as_gift.select_send_date_and_time"),this.canNotEditOrderAfterSelectDate=salla.lang.get("blocks.buy_as_gift.can_not_edit_order_after_select_date"),this.sendGift=salla.lang.get("blocks.buy_as_gift.send_gift"),this.donationRequired=salla.lang.get("pages.products.donation_amount_required"),this.currentLang=salla.lang.locale})),salla.event.on(this.defaultEvent,(()=>{this.open()}))}isPhysical(){return this.physicalProducts||this.physical}cityNoticeText(){return this.gift?.recipient_can_change_address?this.gift?.allows_different_shipping_cost?null:this.cityChangeNotice:this.selectCityInfo}componentDidLoad(){salla.event.product.onPriceUpdated((()=>{const t=document.querySelector(".s-quantity-input-input");this.quantity=t?.value}))}getFormDataFromForm(){if(!this.formSelector)return null;const t=document.querySelector(this.formSelector);return t?new FormData(t):null}mergeObjectToFormData(t,s,i){for(let e in t){if(!t.hasOwnProperty(e)||null==t[e])continue;const a=i?`${i}[${e}]`:e;"object"!=typeof t[e]||null===t[e]||t[e]instanceof File?s.set(a,t[e]):this.mergeObjectToFormData(t[e],s,a)}return s}async open(){if(salla.config.isGuest())return salla.api.auth.setAfterLoginEvent(this.defaultEvent),void salla.event.dispatch("login::open",{withoutReload:!0});this.resetStepsAnimation(),this.currentStep=1,this.parentClass="is-current-step-1",this.step2Animated=!1,this.stepsWrapper?.style.removeProperty("height"),await this.modal.open();const t=this.productId?()=>salla.product.getGiftProductDetails(this.productId):()=>salla.cart.getGiftCartDetails();return await salla.api.withoutNotifier(t).then((t=>{this.gift=t.data,this.senderName=this.gift.sender_name,this.disableClass=this.gift?.show_image_upload?"":"pointer-events-none",this.gift.show_texts||(this.selectedGiftTextOption=void 0,this.selectedText=void 0),this.gift.show_images||(this.selectedImage=void 0,this.uploadedImage=void 0),this.skipStep1()&&(this.currentStep=2,this.parentClass="is-current-step-2",this.step2Animated=!0)})).catch((t=>{this.hasError=!0,this.errorMessage=t.response?.data?.error?.message||t.response?.data})).finally((()=>this.modal.stopLoading()))}skipStep1(){return!!this.gift&&!this.gift.show_images&&!this.gift.show_texts}resetStepsAnimation(){[this.step1Elems,this.step2Elems].forEach((t=>{t?.querySelectorAll(".anime-item").forEach((t=>t.removeAttribute("style")))})),this.step1Elems?.removeAttribute("style"),this.step2Elems&&!this.skipStep1()&&(this.step2Elems.style.removeProperty("opacity"),this.step2Elems.style.removeProperty("transform"))}async close(){return this.modal.close()}async setWrapperHeight(t=1,s=250,i=0,e=0){let a=document.querySelector(`#${this.hostId} .gift-step-${t}`);const h=()=>{this.stepsWrapper.style.height=e?`${e}px`:a.offsetHeight+i+"px"};this.step2Animated&&2===t?requestAnimationFrame(h):setTimeout(h,s)}toggleCalendar(){this.showCalendar=!this.showCalendar,this.setWrapperHeight(2,150,0)}toggleGiftText(t){this.textSelect?.classList.remove("s-form-has-error");let s=t.target.children[t.target.selectedIndex].getAttribute("data-id"),i="custom"==s;const e=this.showGiftText!==i;this.showGiftText=i,s?(this.selectedGiftTextOption=s,this.selectedText=i?void 0:t.target.value):(this.textArea.value="",this.selectedText=void 0,this.selectedGiftTextOption=void 0),e&&this.setWrapperHeight(1,150,5)}async goToStep2(t=!0){this.step1Elems&&(t&&!this.validateStep1()||(this.stepsWrapper&&this.step1Elems&&(this.stepsWrapper.style.height=`${this.step1Elems.offsetHeight}px`),this.setWrapperHeight(2,50,0),(new i.timeline).add({targets:this.step1Elems.querySelectorAll(`#${this.hostId} .anime-item`),opacity:[1,0],translateX:[0,50],delay:i.stagger(70),duration:1200}).add({targets:".gift-step-2",translateX:["-110%",0],opacity:[0,1]},"-=1800").add({targets:this.step2Elems.querySelectorAll(`#${this.hostId} .anime-item`),opacity:[0,1],translateX:[-50,0],delay:i.stagger(70),duration:1200,complete:()=>{this.step2Elems.querySelectorAll(`#${this.hostId} .anime-item`).forEach((t=>{t.classList.remove("opacity-0"),t.removeAttribute("style")})),this.step2Animated=!0}},"-=1200"),this.currentStep=2,this.parentClass=`is-current-step-${this.currentStep}`))}validateStep1(){return!(this.gift?.show_texts&&(this.selectedGiftTextOption?"custom"!=this.selectedGiftTextOption||this.selectedText?(this.textSelect?.classList.remove("s-form-has-error"),this.customTextArea?.classList.remove("s-form-has-error"),0):(this.textSelect?.classList.remove("s-form-has-error"),this.customTextArea?.classList.add("s-form-has-error"),1):(this.textSelect?.classList.add("s-form-has-error"),this.customTextArea?.classList.remove("s-form-has-error"),1)))}goToStep1(t){t.preventDefault();let s=new i.timeline({autoplay:!1});s.add({targets:this.step2Elems.querySelectorAll(`#${this.hostId} .anime-item`),opacity:[1,0],translateX:[0,-50],delay:i.stagger(70),duration:1200}).add({targets:".gift-step-1",translateX:["110%",0],opacity:[0,1]},"-=1800").add({targets:this.step1Elems.querySelectorAll(`#${this.hostId} .anime-item`),opacity:[0,1],translateX:[50,0],delay:i.stagger(70),duration:1200,complete:()=>{this.step1Elems.querySelectorAll(`#${this.hostId} .anime-item`).forEach((t=>{t.classList.remove("opacity-0"),t.removeAttribute("style")}))}},"-=1200"),s.play(),this.step2Animated=!1,this.setWrapperHeight(1,600,0),this.currentStep=1,this.parentClass=`is-current-step-${this.currentStep}`}getFilepondPlaceholder(){return`<div class="s-gifting-filepond-placeholder"><span class="s-gifting-filepond-placeholder-icon"><svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>images</title>\n<path d="M22.667 29.333h-13.333c-3.676 0-6.667-2.991-6.667-6.667v-13.333c0-0.737-0.597-1.333-1.333-1.333s-1.333 0.596-1.333 1.333v13.333c0 5.145 4.187 9.333 9.333 9.333h13.333c0.736 0 1.333-0.596 1.333-1.333s-0.597-1.333-1.333-1.333zM22.667 5.333c-2.205 0-4 1.795-4 4s1.795 4 4 4 4-1.795 4-4-1.795-4-4-4zM22.667 10.667c-0.735 0-1.333-0.597-1.333-1.333s0.599-1.333 1.333-1.333 1.333 0.597 1.333 1.333-0.599 1.333-1.333 1.333zM25.333 0h-13.333c-3.676 0-6.667 2.991-6.667 6.667v13.333c0 1.055 0.268 2.040 0.707 2.927 0.039 0.099 0.088 0.188 0.151 0.277 1.137 2.053 3.301 3.463 5.809 3.463h13.333c3.676 0 6.667-2.991 6.667-6.667v-13.333c0-3.676-2.991-6.667-6.667-6.667zM12 24c-1.244 0-2.344-0.583-3.077-1.476l5.721-7.047 6.629 8.523zM29.333 20c0 2.205-1.795 4-4 4h-0.68l-8.933-11.485c-0.251-0.32-0.633-0.511-1.039-0.515h-0.015c-0.401 0-0.781 0.181-1.035 0.492l-5.632 6.935v-12.76c0-2.205 1.795-4 4-4h13.333c2.205 0 4 1.795 4 4z"></path>\n</svg>\n</span><p class="s-gifting-filepond-placeholder-text">${this.selectImageOrUpload&&this.gift.show_image_upload?this.selectImageOrUpload:this.selectImageForYourGift}</p></div>`}setPreview(t){this.uploader?.classList.add("has-bg");var s=document.querySelector(`#${this.hostId}.filepond-bg`)?document.querySelector(`#${this.hostId} .filepond-bg`):document.createElement("div");s.classList.add("filepond-bg"),s.classList.remove("s-hidden"),s.style.backgroundImage="url('"+t.url+"')",this.uploader?.querySelector(".filepond--root")?.appendChild(s),this.uploadedImage=t.url,this.gift&&this.gift.gift_images?.length&&this.setWrapperHeight(1,150,0)}removePreview(){this.uploader.classList.remove("has-bg");let t=document.querySelector(`#${this.hostId} .filepond-bg`);t.removeAttribute("style"),t.classList.add("s-hidden"),this.handleRemoveImage()}handleTextAreaChange(t){this.selectedText=t.target.value,this.customTextArea?.classList.remove("s-form-has-error")}clearError(t){if(this.errors?.[t]){const{[t]:s,...i}=this.errors;this.errors=i}}handleSenderName(t){this.senderName=t.target.value,this.clearError("sender_name")}handleReceiverName(t){this.receiverName=t.target.value,this.clearError("receiver.name")}resetCityState(){this.citySearchTimer&&(clearTimeout(this.citySearchTimer),this.citySearchTimer=null),++this.citySearchCounter,this.gift={...this.gift,cities:[]},this.displayedCities=[],this.receiverCity=void 0,this.selectedCity=null,this.citySearchQuery="",this.searchingCities=!1,this.enableCityAjaxSearch=!1}setInitialCities(t){this.gift={...this.gift,cities:t},this.displayedCities=t,this.enableCityAjaxSearch=t.length>=l.CITY_AJAX_THRESHOLD}async fetchCities(t=""){if(!this.selectedCountryId)return[];if(this.isKSA&&!this.selectedRegionId)return[];const s=["for_branch=0",`country_id=${this.selectedCountryId}`];this.isKSA&&this.selectedRegionId&&s.push(`region_id=${this.selectedRegionId}`),t?.trim()&&s.push(`query=${encodeURIComponent(t.trim())}`);const i=await salla.api.request(`shipping/cities?${s.join("&")}`);return i?.data??[]}async handleCountrySelected(t){const s=t?.id;this.selectedCountry=t??null,this.selectedCountryId=s,this.selectedCountryCode=t?.country_code,this.isKSA="SA"===t?.country_code,this.clearError("receiver.country"),this.regions=[],this.selectedRegionId=void 0,this.selectedRegion=null,this.resetCityState();const i=++this.locationRequestCounter;if(!s)return this.selectedCountryCode=void 0,this.isKSA=!1,void this.setWrapperHeight(2,0,0);if(this.isKSA){this.loadingRegions=!0,this.setWrapperHeight(2,0,0);try{const t=await salla.api.request(`shipping/countries/${s}/regions`);if(i!==this.locationRequestCounter)return;t&&t.data&&(this.regions=t.data)}catch(t){if(i!==this.locationRequestCounter)return;console.error("Error fetching regions:",t)}finally{i===this.locationRequestCounter&&(this.loadingRegions=!1,this.setWrapperHeight(2,0,0))}}else{this.loadingCities=!0,this.setWrapperHeight(2,0,0);try{const t=await this.fetchCities();if(i!==this.locationRequestCounter)return;this.setInitialCities(t)}catch(t){if(i!==this.locationRequestCounter)return;console.error("Error fetching cities:",t)}finally{i===this.locationRequestCounter&&(this.loadingCities=!1)}}}async handleRegionSelected(t){const s=t?.id;this.selectedRegion=t??null,this.selectedRegionId=s,this.clearError("receiver.region"),this.resetCityState();const i=++this.locationRequestCounter;if(s){this.loadingCities=!0;try{const t=await this.fetchCities();if(i!==this.locationRequestCounter)return;this.setInitialCities(t)}catch(t){if(i!==this.locationRequestCounter)return;console.error("Error fetching cities:",t)}finally{i===this.locationRequestCounter&&(this.loadingCities=!1,this.setWrapperHeight(2,0,0))}}}handleUploadImage(t){this.uploadedImage=t,this.gift&&this.gift.gift_images?.length&&this.setWrapperHeight(1,150,0)}handleRemoveImage(){this.uploadedImage="",this.gift&&this.gift.gift_images?.length&&this.setWrapperHeight(1,150,0)}handlePhoneInputChange(t){let s=t.detail;this.receiverMobile=s.number,this.receiverCountryCode=s.country_code,this.clearError("receiver.mobile")}handleDateTimePicker(t){this.deliveryDate=t.detail}getCalendarClasses(){return{"s-form-group":!0,"anime-item":!0,"s-gifting-calendar":!0,shown:this.showCalendar,hide:!this.showCalendar,"s-form-has-error":!!this.errors&&this.errors.deliver_at}}async submitForm(){const t=document.querySelector("#donating-amount")?.value;if(this.calendarFormGroup.classList.remove("s-form-has-error"),this.errors&&(this.errors={},this.setWrapperHeight(2,150,0)),this.showCalendar&&!this.deliveryDate)return void this.calendarFormGroup.classList.add("s-form-has-error");const s=[{key:"sender_name",value:this.senderName,label:this.senderNameLabel},{key:"receiver.name",value:this.receiverName,label:this.receiverNameFieldLabel},{key:"receiver.mobile",value:this.receiverMobile,label:this.receiverMobileFieldLabel},...this.isPhysical()?[{key:"receiver.country",value:this.selectedCountryId,label:this.receiverCountryFieldLabel},...this.isKSA?[{key:"receiver.region",value:this.selectedRegionId,label:this.receiverRegionFieldLabel}]:[],{key:"receiver.city_id",value:this.receiverCity,label:this.receiverCityFieldLabel}]:[]],i={};if(s.forEach((({key:t,value:s,label:e})=>{s||(i[t]=salla.lang.get("common.errors.field_required",{attribute:e}))})),Object.keys(i).length)return this.errors=i,void this.setWrapperHeight(2,150,0);const e="custom"===this.selectedGiftTextOption,a={text:e?this.selectedText:void 0,text_id:!e&&this.selectedGiftTextOption?Number(this.selectedGiftTextOption):void 0,sender_name:this.senderName,quantity:this.quantity,deliver_at:this.showCalendar?this.deliveryDate:null,image_url:this.uploadedImage??this.selectedImage,donation_amount:t||null,receiver:{name:this.receiverName,mobile_country_code:this.receiverCountryCode,mobile:this.receiverMobile,...this.isPhysical()&&this.selectedCountryCode?{country_code:this.selectedCountryCode}:{},...this.isPhysical()&&this.selectedRegionId?{region_id:this.selectedRegionId}:{},...this.receiverCity&&this.isPhysical()?{city_id:this.receiverCity}:{}},has_apple_pay:salla.helpers.hasApplePay()};let h;this.productId&&this.formSelector&&(h=this.getFormDataFromForm()||new FormData,h=this.mergeObjectToFormData(a,h));const l=this.productId?()=>salla.product.addProductGiftToCart(this.productId,h,!0):()=>salla.cart.addCartGiftToCart(a,!0);return await l().then((()=>this.modal.close())).catch((t=>{t.response&&422==t.response.status?this.errors=t.response.data.error.fields:console.log(t),this.setWrapperHeight(2,150,0)}))}step2ItemClass(t=""){const s="anime-item"+(this.step2Animated?"":" opacity-0");return t?`${t} ${s}`:s}generateClass(){return{"s-gifting-widget":!0,"s-gifting-widget-vertical":!!this.vertical,"s-gifting-widget-horizontal":!this.vertical}}async handleGiftButtonClick(){if(this.productId&&this.formSelector){const t=document.querySelector(this.formSelector);if(!t)return void console.error("SallaGifting:: Form not found in the document!");if(!(t instanceof HTMLFormElement))return void console.error("SallaGifting:: The specified selector does not correspond to a form tag!");if(!t.reportValidity())return console.error("SallaGifting:: Form is not valid!"),void salla.error(salla.lang.get("common.messages.required_fields"))}const t=document.querySelector(`salla-product-options[product-id="${this.productId}"]`);!t||await t.reportValidity()?this.open():salla.error(salla.lang.get("common.messages.required_fields"))}render(){return[s("div",{key:"b4d479166a0a7a8b7bf4d66fd39399eef0bbe1d8"},s("salla-list-tile",{key:"a526748e500753bc4e132b6d8cc5fe56d276378c",class:this.generateClass()},s("div",{key:"3756943a7292552172dfe5fe112a987f9dff2128",slot:"title"},this.vertical?s("span",{innerHTML:h}):"",s("h3",{key:"769df65a33828cdb51270438885bd7554a93b18b"},this.widgetTitle?this.widgetTitle:this.sectionTitle)),s("div",{key:"69c51851715c12002d0d70f936852bf6b6a064a4",slot:"subtitle"},s("div",{key:"ee7979030a5756a4ad74c87cebdb595decc12d48"},this.widgetSubtitle?this.widgetSubtitle:this.sectionSubtitle)),s("div",{key:"374d33078ca9e9f4d26bc801abcb50d8271887bf",slot:"action"},s("salla-button",{key:"f5c53ce21a6e058e484f941d356e1c74bf337b5f",color:"primary",fill:"outline",width:"wide",class:"s-gifting-widget-action",onClick:()=>this.handleGiftButtonClick()},s("slot",{key:"2b57632750b91dc720605c181e19a0329c8db3e9",name:"widget-btn-content"},s("div",{key:"1d43f1351bc3323118c8eace681f382b753d009b",class:"s-gifting-widget-action-content"},s("span",{key:"f62808df38d07bf5db9d54f24a64c103dbcca3c2",innerHTML:h})," ",s("span",{key:"d22429956200e68c8d588d0daddae201963ba47a"},this.sectionBtnText)))))),s("salla-modal",{key:"0e1614ad210647ac77bbeb7e19104f5b9ce3b6b3",id:this.hostId,isLoading:!0,class:"s-gifting-modal",width:"sm",ref:t=>this.modal=t},s("div",{key:"230c00dd750aa31d20e450086b26c11094305e0f",slot:"loading"},s("div",{key:"cb48aec5cf71db50ba003cb3607c27e7a629e9be",class:"s-gifting-skeleton"},s("div",{key:"e7aa596896cb841628bf35b4b5d8c9d22ed84dae",class:"s-gifting-modal-header"},s("salla-skeleton",{key:"8e6dff5462dc1644bd89e56d51b3a353341b1741",type:"circle",height:"5rem",width:"5rem"}),s("h2",{key:"5bdf4f1266938b319a5d4642773cb0e8fa772f88",class:"s-gifting-modal-title"},s("div",{key:"2e3ea0e2589152059ec71f0e0a0b6537b0d32d8f",class:"s-gifting-modal-badge-wrapper"},s("salla-skeleton",{key:"7cf08110d0535ec7b719251cf54f3a83d940772f",height:"15px",width:"150px"})))),s("div",{key:"3e341993dd31be4bfbcc272877c8167f50233dd0",class:"s-gifting-skeleton-content"},s("salla-skeleton",{key:"74b584687ed715146e84a7107fb69f18ea78f31d",height:"10px",width:"150px"}),s("salla-skeleton",{key:"8acfdd240b397ea8e0d6c93c745786c68eb34f25",height:"230px"}),s("salla-skeleton",{key:"c92cef763f9d2857429919434a56bbc9686d6a3a",height:"10px",width:"150px"}),s("salla-skeleton",{key:"22e6c56dbabf3f90fa608dcd42d11b463ae86a1c",height:"30px"}),s("salla-skeleton",{key:"8093fcbc09362879ac5afb38f1910bdddfd41390",height:"40px"})))),s("slot",{key:"10842023d5a5861fa1562784c77f718c8e257d80",name:"header"}),this.hasError?s("salla-placeholder",{alignment:"center"},s("span",{slot:"title"},this.errorMessage||salla.lang.get("common.errors.empty_results")),s("span",{slot:"description"}," ")):[s("div",{class:"s-gifting-modal-header"},s("span",{class:"s-gifting-modal-icon"},s("span",{innerHTML:h})),s("h2",{class:"s-gifting-modal-title"},s("div",{class:"s-gifting-modal-badge-wrapper"},!this.skipStep1()&&s("div",{class:"s-gifting-modal-badge"},s("span",null,s("span",null,this.currentStep),"/2")),s("span",null,this.giftDetails)))),s("div",{class:"s-gifting-steps-wrapper "+this.parentClass,ref:t=>this.stepsWrapper=t},!this.skipStep1()&&s("div",{class:"s-gifting-step-one gift-step-1",ref:t=>this.step1Elems=t},this.gift&&this.gift.show_images&&s("div",{class:"s-gifting-modal-uploader-title anime-item"},this.selectImageForYourGift),this.gift&&this.gift.show_images&&s("div",{class:"s-gifting-image-section"},s("div",{class:`s-gifting-modal-uploader anime-item ${this.disableClass}`,ref:t=>this.uploader=t},s("span",{class:"s-gifting-remove-preview pointer-events-auto",onClick:()=>this.removePreview(),innerHTML:a}),this.selectImageOrUpload&&this.gift&&s("salla-file-upload",{"instant-upload":!0,name:"image_url",url:salla.url.api(salla.product.api.getUrl("giftImage")),onUploaded:t=>this.handleUploadImage(t.detail),labelIdle:this.getFilepondPlaceholder(),onRemoved:()=>this.handleRemoveImage()})),s("div",{class:"anime-item"},!this.uploadedImage&&this.gift&&this.gift.gift_images&&this.gift.gift_images.length>0?s("salla-slider",{id:"gifting-slider",loop:!1,"controls-outer":!0,class:"s-gifting-slider",type:"carousel"},s("div",{slot:"items"},this.gift&&this.gift.gift_images?this.gift?.gift_images.map((t=>s("a",{class:"s-gifting-clickable s-gifting-image",onClick:()=>this.setPreview(t)},s("img",{src:t.url,alt:`${t.id}`})))):"")):"")),this.gift&&this.gift.show_texts?s("div",{class:"anime-item"},s("div",{class:"s-gifting-modal-uploader-title s-gifting-text-title"},this.giftText),s("div",{class:"s-form-group s-gifting-selectText",ref:t=>this.textSelect=t},s("select",{id:"gift-text-selection",name:"gift-text-selection",class:"s-form-control s-gifting-select",onChange:t=>this.toggleGiftText(t)},s("option",{"data-id":null,selected:!this.selectedGiftTextOption},this.selectGiftMessage),this.gift&&this.gift.gift_texts?this.gift?.gift_texts.map((t=>s("option",{"data-id":t.id,value:t.text,key:t.id,selected:String(this.selectedGiftTextOption)===String(t.id)},t.text))):"",this.gift&&this.gift.show_custom_text?s("option",{"data-id":"custom",selected:"custom"===this.selectedGiftTextOption},this.giftCustomText):null)),s("div",{class:this.showGiftText&&this.gift&&this.gift.show_custom_text?"s-form-group s-gifting-textarea shown":"s-form-group s-gifting-textarea hide",ref:t=>this.customTextArea=t},s("label",{htmlFor:"gift-custom-text",class:"s-form-label"},this.giftCustomText),s("div",{class:"mt-1"},s("textarea",{onInput:t=>this.handleTextAreaChange(t),rows:4,ref:t=>this.textArea=t,name:"gift-custom-text",id:"gift-custom-text",class:"s-form-control"})))):null,s("div",{class:"anime-item"},s("salla-button",{color:"primary",width:"wide",onClick:()=>this.goToStep2(!!this.gift?.show_texts)},s("span",null,this.nextStep)))),s("div",{class:"s-gifting-step-two gift-step-2",style:this.skipStep1()?{opacity:"1",transform:"translateX(0)",position:"relative"}:void 0,ref:t=>this.step2Elems=t},s("div",{class:this.step2ItemClass(this.errors?.sender_name?"s-form-group s-form-has-error":"s-form-group")},s("label",{htmlFor:"sender_name",class:"s-form-label"},this.senderNameLabel),s("input",{type:"text",class:"s-form-control",name:"sender_name",id:"sender_name",value:this.senderName,onInput:t=>this.handleSenderName(t),placeholder:""}),this.errors&&this.errors.sender_name?s("span",{class:"s-gifting-error"},this.errors.sender_name):""),s("div",{class:this.step2ItemClass(this.errors?.["receiver.name"]?"s-form-group s-form-has-error":"s-form-group")},s("label",{htmlFor:"receiver_name",class:"s-form-label"},this.receiverNameFieldLabel),s("input",{type:"text",class:"s-form-control",name:"receiver_name",id:"receiver_name",value:"",onInput:t=>this.handleReceiverName(t),placeholder:""}),this.errors&&this.errors["receiver.name"]?s("span",{class:"s-gifting-error"},this.errors["receiver.name"]):""),s("div",{class:this.step2ItemClass(this.errors?.["receiver.mobile"]?"s-form-group s-form-has-error":"s-form-group")},s("label",{class:"s-form-label"},this.receiverMobileFieldLabel),s("salla-tel-input",{class:"s-gifting-tel-input",phone:this.receiverMobile,countryCode:this.receiverCountryCode,onPhoneEntered:t=>this.handlePhoneInputChange(t)}),this.errors&&this.errors["receiver.mobile"]?s("span",{class:"s-gifting-error"},this.errors["receiver.mobile"]):""),this.isPhysical()&&s("div",{class:this.step2ItemClass(this.errors?.["receiver.country"]?"s-form-group s-form-has-error":"s-form-group")},s("label",{class:"s-form-label",htmlFor:`${this.hostId}-country`},this.receiverCountryFieldLabel),s("salla-searchable-dropdown",{placeholder:this.selectCountry,items:this.gift?.countries??[],selectedItem:this.selectedCountry,disabled:!this.gift?.countries?.length,required:!0,inputId:`${this.hostId}-country`,searchable:!1,keepParentScroll:!0,onItemSelected:t=>this.handleCountrySelected(t.detail),onDropdownClosed:()=>this.handleCountryDropdownClosed()}),this.errors&&this.errors["receiver.country"]?s("span",{class:"s-gifting-error"},this.errors["receiver.country"]):""),this.isPhysical()&&this.isKSA&&s("div",{class:this.step2ItemClass(this.errors?.["receiver.region"]?"s-form-group s-form-has-error":"s-form-group")},s("label",{class:"s-form-label",htmlFor:`${this.hostId}-region`},this.receiverRegionFieldLabel),s("salla-searchable-dropdown",{placeholder:this.selectRegion,items:this.regions??[],selectedItem:this.selectedRegion,loading:this.loadingRegions,disabled:this.loadingRegions||!this.regions?.length,required:!0,inputId:`${this.hostId}-region`,searchable:!1,keepParentScroll:!0,onItemSelected:t=>this.handleRegionSelected(t.detail),onDropdownClosed:()=>this.handleRegionDropdownClosed()}),this.errors&&this.errors["receiver.region"]?s("span",{class:"s-gifting-error"},this.errors["receiver.region"]):""),this.isPhysical()&&s("div",{class:this.step2ItemClass(this.errors?.["receiver.city_id"]?"s-form-group s-form-has-error":"s-form-group")},s("label",{class:"s-form-label",htmlFor:`${this.hostId}-city`},this.receiverCityFieldLabel),s("salla-searchable-dropdown",{placeholder:this.selectCity,items:this.displayedCities,selectedItem:this.selectedCity,loading:this.loadingCities,searching:this.searchingCities,disabled:this.loadingCities||this.isKSA&&!this.selectedRegionId,required:!0,inputId:`${this.hostId}-city`,searchQuery:this.citySearchQuery,clientSearch:!this.enableCityAjaxSearch,dropUp:!0,keepParentScroll:!0,onItemSelected:t=>this.handleCitySelected(t.detail),onSearchInput:t=>this.handleCitySearch(t.detail),onDropdownClosed:()=>this.handleCityDropdownClosed()}),this.errors&&this.errors["receiver.city_id"]?s("span",{class:"s-gifting-error"},this.errors["receiver.city_id"]):""),this.isPhysical()&&this.cityNoticeText()&&s("div",{class:this.step2ItemClass("s-gifting-info")},s("span",{innerHTML:'\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>alert</title>\n<path d="M16 13.333c-0.736 0-1.333 0.597-1.333 1.333v8c0 0.736 0.597 1.333 1.333 1.333s1.333-0.597 1.333-1.333v-8c0-0.736-0.597-1.333-1.333-1.333zM16 9.327c-0.736 0-1.333 0.604-1.333 1.34s0.597 1.333 1.333 1.333 1.333-0.597 1.333-1.333v-0.013c0-0.736-0.597-1.327-1.333-1.327zM27.313 4.687c-6.237-6.237-16.389-6.239-22.628 0-6.237 6.239-6.237 16.389 0 22.628 3.119 3.119 7.216 4.679 11.313 4.679s8.195-1.559 11.313-4.679c6.24-6.239 6.24-16.391 0.001-22.628zM25.428 25.428c-5.199 5.197-13.657 5.197-18.857 0-5.197-5.199-5.197-13.659 0-18.857 5.199-5.197 13.659-5.197 18.857 0 5.199 5.2 5.199 13.659 0 18.857z"></path>\n</svg>\n'}),s("span",null,this.cityNoticeText())),!this.isPhysical()&&s("div",{class:this.step2ItemClass()},s("label",{class:"s-gifting-schedule s-gifting-clickable",htmlFor:`schedule-${this.hostId}`},s("input",{type:"checkbox",name:"schedule",id:`schedule-${this.hostId}`,onChange:()=>this.toggleCalendar(),class:"s-checkbox"}),s("span",{class:"s-form-label"}," ",this.sendLater," "))),s("div",{class:this.getCalendarClasses(),ref:t=>this.calendarFormGroup=t},s("label",{class:"s-form-label"},this.selectSendDateAndTime),s("salla-datetime-picker",{value:this.deliveryDate,placeholder:this.selectSendDateAndTime,"enable-time":!0,"date-format":"Y-m-d h:i K",onPicked:t=>this.handleDateTimePicker(t)}),s("span",{class:"s-gifting-calendar-hint"},this.canNotEditOrderAfterSelectDate)),s("div",{class:this.step2ItemClass("s-gifting-step-two-footer")},!this.skipStep1()&&s("a",{href:"#!",innerHTML:e,onClick:t=>this.goToStep1(t)}),s("salla-button",{onClick:()=>this.submitForm(),color:"primary",width:"wide"},s("span",null,this.sendGift)))))],s("slot",{key:"ba5b5cc6e2b20d756ed5149757b23239455939f7",name:"footer"})))]}};l.CITY_AJAX_THRESHOLD=400,l.CITY_SEARCH_DEBOUNCE_MS=100,l.style=".s-gifting-steps-wrapper{transition:height 0.8s cubic-bezier(0.55, 0, 0.1, 1) 0s}.s-gifting-select{background-image:url(\"data:image/svg+xml;utf8,<svg version='1.1' fill='gray' xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'><title>keyboard_arrow_down</title><path d='M9.875 11.104l6.125 6.125 6.125-6.125 1.875 1.875-8 8-8-8z'></path></svg>\");background-size:24px;background-repeat:no-repeat;background-position:99%;appearance:none}[dir=rtl] .s-gifting-select{background-position:5px}.s-gifting-widget-vertical .s-list-tile-item [slot=title]{display:flex;align-items:center;gap:1.5rem}.s-gifting-widget-vertical .s-list-tile-item-content{width:100%}.s-gifting-modal .s-searchable-dropdown-trigger{border-color:#d1d5db}.s-gifting-modal .s-searchable-dropdown-trigger:hover:not(.s-searchable-dropdown-trigger--disabled){border-color:#d1d5db}.s-gifting-modal .s-searchable-dropdown-trigger--open,.s-gifting-modal .s-searchable-dropdown-trigger:focus{border-color:var(--color-primary, #00897b);box-shadow:0 0 0 1px var(--color-primary, #00897b)}.s-gifting-modal .s-searchable-dropdown-trigger-placeholder{color:#000}.s-gifting-modal .s-gifting-image-section{margin-bottom:1.5rem}.s-gifting-modal .s-gifting-slider{margin-bottom:0.5rem}.s-gifting-modal .s-gifting-image{display:block}.s-gifting-modal .s-gifting-image img{display:block;width:auto;height:100px;object-fit:contain}.s-gifting-modal .s-gifting-image-section+.anime-item .s-gifting-text-title{margin-top:1rem}";export{l as salla_gifting}
|
|
4
|
+
import{r as t,h as s}from"./p-BmH_SCLp.js";import{a as i}from"./p-CgtvEd63.js";import{a as e}from"./p-BedNk7k1.js";import{S as a}from"./p-8Tsmrwno.js";import{S as h}from"./p-0-eTJXSD.js";const l=class{constructor(s){t(this,s),this.defaultEvent="gifting:open",this.selectImageForYourGift=salla.lang.get("blocks.buy_as_gift.select_image_for_your_gift"),this.currentStep=1,this.showCalendar=!1,this.showGiftText=!1,this.currentLang="",this.parentClass="is-current-step-1",this.errors={},this.gift=void 0,this.selectedGiftTextOption=void 0,this.selectedCountryId=void 0,this.selectedCountryCode=void 0,this.loadingCities=!1,this.loadingRegions=!1,this.regions=[],this.selectedRegionId=void 0,this.isKSA=!1,this.selectedCountry=null,this.selectedRegion=null,this.displayedCities=[],this.selectedCity=null,this.searchingCities=!1,this.enableCityAjaxSearch=!1,this.citySearchQuery="",this.step2Animated=!1,this.citySearchTimer=null,this.citySearchCounter=0,this.locationRequestCounter=0,this.showTextArea=!1,this.selectedImage=void 0,this.uploadedImage=void 0,this.selectedText=void 0,this.hasError=!1,this.timeZone=null,this.receiverCountryCode=salla.config.get("store.scope.countries")?.[0]||salla.config.get("store.store_country")||"SA",this.hostId=`salla-gifting-${Math.random().toString(36).slice(2,10)}`,this.disableClass=this.gift?.show_image_upload?"":"pointer-events-none",this.formSelector="form.product-form, form.form--product-options",this.handleCitySearch=t=>{if(this.citySearchQuery=t,!this.enableCityAjaxSearch)return;this.citySearchTimer&&clearTimeout(this.citySearchTimer);const s=++this.citySearchCounter;this.citySearchTimer=setTimeout((async()=>{this.searchingCities=!0;try{const i=await this.fetchCities(t);s===this.citySearchCounter&&(this.displayedCities=i)}catch(t){s===this.citySearchCounter&&(this.displayedCities=[])}finally{s===this.citySearchCounter&&(this.searchingCities=!1)}}),l.CITY_SEARCH_DEBOUNCE_MS)},this.handleCitySelected=t=>{this.selectedCity=t,this.receiverCity=String(t.id),this.clearError("receiver.city_id")},this.handleCityDropdownClosed=()=>{this.citySearchQuery="",this.citySearchTimer&&(clearTimeout(this.citySearchTimer),this.citySearchTimer=null),++this.citySearchCounter,this.displayedCities=this.gift?.cities??[],this.searchingCities=!1},this.handleCountryDropdownClosed=()=>{},this.handleRegionDropdownClosed=()=>{},salla.lang.onLoaded((()=>{this.selectImageOrUpload=salla.lang.get("blocks.buy_as_gift.select_image_or_upload"),this.selectImageForYourGift=salla.lang.get("blocks.buy_as_gift.select_image_for_your_gift"),this.sectionTitle=salla.lang.get("blocks.buy_as_gift.gift_the_one_you_love"),this.sectionSubtitle=salla.lang.get("blocks.buy_as_gift.gift_the_one_you_love_message"),this.sectionBtnText=salla.lang.get("blocks.buy_as_gift.send_as_a_gift"),this.giftDetails=salla.lang.get("blocks.buy_as_gift.gift_details"),this.selectGiftMessage=salla.lang.get("blocks.buy_as_gift.select_gift_message"),this.giftText=salla.lang.get("blocks.buy_as_gift.gift_text"),this.giftCustomText=salla.lang.get("blocks.buy_as_gift.gift_custom_text"),this.textId=salla.lang.get("blocks.buy_as_gift.text_id"),this.incorrectGiftText=salla.lang.get("blocks.buy_as_gift.incorrect_gift_text"),this.nextStep=salla.lang.get("blocks.buy_as_gift.next_step"),this.senderNameLabel=salla.lang.get("blocks.buy_as_gift.sender_name"),this.receiverNameFieldLabel=salla.lang.get("blocks.buy_as_gift.receiver_name"),this.receiverMobileFieldLabel=salla.lang.get("blocks.buy_as_gift.receiver_mobile"),this.receiverCountryFieldLabel=salla.lang.get("blocks.buy_as_gift.receiver_country"),this.ksa=salla.lang.get("pages.checkout.ksa"),this.selectCity=salla.lang.get("pages.checkout.select_city"),this.selectCountry=salla.lang.get("pages.checkout.select_country"),this.selectCityInfo=salla.lang.get("blocks.buy_as_gift.city_info"),this.cityChangeNotice=salla.lang.get("blocks.buy_as_gift.city_change_notice"),this.receiverCityFieldLabel=salla.lang.get("blocks.buy_as_gift.receiver_city"),this.receiverRegionFieldLabel=salla.lang.get("blocks.buy_as_gift.receiver_region")||salla.lang.get("pages.checkout.region"),this.selectRegion=salla.lang.get("pages.checkout.select_region"),this.receiverEmailFieldLabel=salla.lang.get("blocks.buy_as_gift.receiver_email"),this.emailPlaceholder=salla.lang.get("common.elements.email_placeholder"),this.sendLater=salla.lang.get("blocks.buy_as_gift.send_later"),this.selectSendDateAndTime=salla.lang.get("blocks.buy_as_gift.select_send_date_and_time"),this.canNotEditOrderAfterSelectDate=salla.lang.get("blocks.buy_as_gift.can_not_edit_order_after_select_date"),this.sendGift=salla.lang.get("blocks.buy_as_gift.send_gift"),this.donationRequired=salla.lang.get("pages.products.donation_amount_required"),this.currentLang=salla.lang.locale})),salla.event.on(this.defaultEvent,(()=>{this.open()}))}isPhysical(){return this.physicalProducts||this.physical}cityNoticeText(){return this.gift?.recipient_can_change_address?this.gift?.allows_different_shipping_cost?null:this.cityChangeNotice:this.selectCityInfo}componentDidLoad(){salla.event.product.onPriceUpdated((()=>{const t=document.querySelector(".s-quantity-input-input");this.quantity=t?.value}))}getFormDataFromForm(){if(!this.formSelector)return null;const t=document.querySelector(this.formSelector);return t?new FormData(t):null}mergeObjectToFormData(t,s,i){for(let e in t){if(!t.hasOwnProperty(e)||null==t[e])continue;const a=i?`${i}[${e}]`:e;"object"!=typeof t[e]||null===t[e]||t[e]instanceof File?s.set(a,t[e]):this.mergeObjectToFormData(t[e],s,a)}return s}async open(){if(salla.config.isGuest())return salla.api.auth.setAfterLoginEvent(this.defaultEvent),void salla.event.dispatch("login::open",{withoutReload:!0});this.resetStepsAnimation(),this.currentStep=1,this.parentClass="is-current-step-1",this.step2Animated=!1,this.stepsWrapper?.style.removeProperty("height"),await this.modal.open();const t=this.productId?()=>salla.product.getGiftProductDetails(this.productId):()=>salla.cart.getGiftCartDetails();return await salla.api.withoutNotifier(t).then((t=>{this.gift=t.data,this.senderName=this.gift.sender_name,this.disableClass=this.gift?.show_image_upload?"":"pointer-events-none",this.gift.show_texts||(this.selectedGiftTextOption=void 0,this.selectedText=void 0),this.gift.show_images||(this.selectedImage=void 0,this.uploadedImage=void 0),this.skipStep1()&&(this.currentStep=2,this.parentClass="is-current-step-2",this.step2Animated=!0)})).catch((t=>{this.hasError=!0,this.errorMessage=t.response?.data?.error?.message||t.response?.data})).finally((()=>this.modal.stopLoading()))}skipStep1(){return!!this.gift&&!this.gift.show_images&&!this.gift.show_texts}resetStepsAnimation(){[this.step1Elems,this.step2Elems].forEach((t=>{t?.querySelectorAll(".anime-item").forEach((t=>t.removeAttribute("style")))})),this.step1Elems?.removeAttribute("style"),this.step2Elems&&!this.skipStep1()&&(this.step2Elems.style.removeProperty("opacity"),this.step2Elems.style.removeProperty("transform"))}async close(){return this.modal.close()}async setWrapperHeight(t=1,s=250,i=0,e=0){let a=document.querySelector(`#${this.hostId} .gift-step-${t}`);const h=()=>{this.stepsWrapper.style.height=e?`${e}px`:a.offsetHeight+i+"px"};this.step2Animated&&2===t?requestAnimationFrame(h):setTimeout(h,s)}toggleCalendar(){this.showCalendar=!this.showCalendar,this.setWrapperHeight(2,150,0)}toggleGiftText(t){this.textSelect?.classList.remove("s-form-has-error");let s=t.target.children[t.target.selectedIndex].getAttribute("data-id"),i="custom"==s;const e=this.showGiftText!==i;this.showGiftText=i,s?(this.selectedGiftTextOption=s,this.selectedText=i?void 0:t.target.value):(this.textArea.value="",this.selectedText=void 0,this.selectedGiftTextOption=void 0),e&&this.setWrapperHeight(1,150,5)}async goToStep2(t=!0){this.step1Elems&&(t&&!this.validateStep1()||(this.stepsWrapper&&this.step1Elems&&(this.stepsWrapper.style.height=`${this.step1Elems.offsetHeight}px`),this.setWrapperHeight(2,50,0),(new i.timeline).add({targets:this.step1Elems.querySelectorAll(`#${this.hostId} .anime-item`),opacity:[1,0],translateX:[0,50],delay:i.stagger(70),duration:1200}).add({targets:".gift-step-2",translateX:["-110%",0],opacity:[0,1]},"-=1800").add({targets:this.step2Elems.querySelectorAll(`#${this.hostId} .anime-item`),opacity:[0,1],translateX:[-50,0],delay:i.stagger(70),duration:1200,complete:()=>{this.step2Elems.querySelectorAll(`#${this.hostId} .anime-item`).forEach((t=>{t.classList.remove("opacity-0"),t.removeAttribute("style")})),this.step2Animated=!0}},"-=1200"),this.currentStep=2,this.parentClass=`is-current-step-${this.currentStep}`))}validateStep1(){return!(this.gift?.show_texts&&(this.selectedGiftTextOption?"custom"!=this.selectedGiftTextOption||this.selectedText?(this.textSelect?.classList.remove("s-form-has-error"),this.customTextArea?.classList.remove("s-form-has-error"),0):(this.textSelect?.classList.remove("s-form-has-error"),this.customTextArea?.classList.add("s-form-has-error"),1):(this.textSelect?.classList.add("s-form-has-error"),this.customTextArea?.classList.remove("s-form-has-error"),1)))}goToStep1(t){t.preventDefault();let s=new i.timeline({autoplay:!1});s.add({targets:this.step2Elems.querySelectorAll(`#${this.hostId} .anime-item`),opacity:[1,0],translateX:[0,-50],delay:i.stagger(70),duration:1200}).add({targets:".gift-step-1",translateX:["110%",0],opacity:[0,1]},"-=1800").add({targets:this.step1Elems.querySelectorAll(`#${this.hostId} .anime-item`),opacity:[0,1],translateX:[50,0],delay:i.stagger(70),duration:1200,complete:()=>{this.step1Elems.querySelectorAll(`#${this.hostId} .anime-item`).forEach((t=>{t.classList.remove("opacity-0"),t.removeAttribute("style")}))}},"-=1200"),s.play(),this.step2Animated=!1,this.setWrapperHeight(1,600,0),this.currentStep=1,this.parentClass=`is-current-step-${this.currentStep}`}getFilepondPlaceholder(){return`<div class="s-gifting-filepond-placeholder"><span class="s-gifting-filepond-placeholder-icon"><svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>images</title>\n<path d="M22.667 29.333h-13.333c-3.676 0-6.667-2.991-6.667-6.667v-13.333c0-0.737-0.597-1.333-1.333-1.333s-1.333 0.596-1.333 1.333v13.333c0 5.145 4.187 9.333 9.333 9.333h13.333c0.736 0 1.333-0.596 1.333-1.333s-0.597-1.333-1.333-1.333zM22.667 5.333c-2.205 0-4 1.795-4 4s1.795 4 4 4 4-1.795 4-4-1.795-4-4-4zM22.667 10.667c-0.735 0-1.333-0.597-1.333-1.333s0.599-1.333 1.333-1.333 1.333 0.597 1.333 1.333-0.599 1.333-1.333 1.333zM25.333 0h-13.333c-3.676 0-6.667 2.991-6.667 6.667v13.333c0 1.055 0.268 2.040 0.707 2.927 0.039 0.099 0.088 0.188 0.151 0.277 1.137 2.053 3.301 3.463 5.809 3.463h13.333c3.676 0 6.667-2.991 6.667-6.667v-13.333c0-3.676-2.991-6.667-6.667-6.667zM12 24c-1.244 0-2.344-0.583-3.077-1.476l5.721-7.047 6.629 8.523zM29.333 20c0 2.205-1.795 4-4 4h-0.68l-8.933-11.485c-0.251-0.32-0.633-0.511-1.039-0.515h-0.015c-0.401 0-0.781 0.181-1.035 0.492l-5.632 6.935v-12.76c0-2.205 1.795-4 4-4h13.333c2.205 0 4 1.795 4 4z"></path>\n</svg>\n</span><p class="s-gifting-filepond-placeholder-text">${this.selectImageOrUpload&&this.gift.show_image_upload?this.selectImageOrUpload:this.selectImageForYourGift}</p></div>`}setPreview(t){this.uploader?.classList.add("has-bg");var s=document.querySelector(`#${this.hostId}.filepond-bg`)?document.querySelector(`#${this.hostId} .filepond-bg`):document.createElement("div");s.classList.add("filepond-bg"),s.classList.remove("s-hidden"),s.style.backgroundImage="url('"+t.url+"')",this.uploader?.querySelector(".filepond--root")?.appendChild(s),this.uploadedImage=t.url,this.gift&&this.gift.gift_images?.length&&this.setWrapperHeight(1,150,0)}removePreview(){this.uploader.classList.remove("has-bg");let t=document.querySelector(`#${this.hostId} .filepond-bg`);t.removeAttribute("style"),t.classList.add("s-hidden"),this.handleRemoveImage()}handleTextAreaChange(t){this.selectedText=t.target.value,this.customTextArea?.classList.remove("s-form-has-error")}clearError(t){if(this.errors?.[t]){const{[t]:s,...i}=this.errors;this.errors=i}}handleSenderName(t){this.senderName=t.target.value,this.clearError("sender_name")}handleReceiverName(t){this.receiverName=t.target.value,this.clearError("receiver.name")}resetCityState(){this.citySearchTimer&&(clearTimeout(this.citySearchTimer),this.citySearchTimer=null),++this.citySearchCounter,this.gift={...this.gift,cities:[]},this.displayedCities=[],this.receiverCity=void 0,this.selectedCity=null,this.citySearchQuery="",this.searchingCities=!1,this.enableCityAjaxSearch=!1}setInitialCities(t){this.gift={...this.gift,cities:t},this.displayedCities=t,this.enableCityAjaxSearch=t.length>=l.CITY_AJAX_THRESHOLD}async fetchCities(t=""){if(!this.selectedCountryId)return[];if(this.isKSA&&!this.selectedRegionId)return[];const s=["for_branch=0",`country_id=${this.selectedCountryId}`];this.isKSA&&this.selectedRegionId&&s.push(`region_id=${this.selectedRegionId}`),t?.trim()&&s.push(`query=${encodeURIComponent(t.trim())}`);const i=await salla.api.request(`shipping/cities?${s.join("&")}`);return i?.data??[]}async handleCountrySelected(t){const s=t?.id;this.selectedCountry=t??null,this.selectedCountryId=s,this.selectedCountryCode=t?.country_code,this.isKSA="SA"===t?.country_code,this.clearError("receiver.country"),this.regions=[],this.selectedRegionId=void 0,this.selectedRegion=null,this.resetCityState();const i=++this.locationRequestCounter;if(!s)return this.selectedCountryCode=void 0,this.isKSA=!1,void this.setWrapperHeight(2,0,0);if(this.isKSA){this.loadingRegions=!0,this.setWrapperHeight(2,0,0);try{const t=await salla.api.request(`shipping/countries/${s}/regions`);if(i!==this.locationRequestCounter)return;t&&t.data&&(this.regions=t.data)}catch(t){if(i!==this.locationRequestCounter)return;console.error("Error fetching regions:",t)}finally{i===this.locationRequestCounter&&(this.loadingRegions=!1,this.setWrapperHeight(2,0,0))}}else{this.loadingCities=!0,this.setWrapperHeight(2,0,0);try{const t=await this.fetchCities();if(i!==this.locationRequestCounter)return;this.setInitialCities(t)}catch(t){if(i!==this.locationRequestCounter)return;console.error("Error fetching cities:",t)}finally{i===this.locationRequestCounter&&(this.loadingCities=!1)}}}async handleRegionSelected(t){const s=t?.id;this.selectedRegion=t??null,this.selectedRegionId=s,this.clearError("receiver.region"),this.resetCityState();const i=++this.locationRequestCounter;if(s){this.loadingCities=!0;try{const t=await this.fetchCities();if(i!==this.locationRequestCounter)return;this.setInitialCities(t)}catch(t){if(i!==this.locationRequestCounter)return;console.error("Error fetching cities:",t)}finally{i===this.locationRequestCounter&&(this.loadingCities=!1,this.setWrapperHeight(2,0,0))}}}handleUploadImage(t){this.uploadedImage=t,this.gift&&this.gift.gift_images?.length&&this.setWrapperHeight(1,150,0)}handleRemoveImage(){this.uploadedImage="",this.gift&&this.gift.gift_images?.length&&this.setWrapperHeight(1,150,0)}handlePhoneInputChange(t){let s=t.detail;this.receiverMobile=s.number,this.receiverCountryCode=s.country_code,this.clearError("receiver.mobile")}handleDateTimePicker(t){this.deliveryDate=t.detail}getCalendarClasses(){return{"s-form-group":!0,"anime-item":!0,"s-gifting-calendar":!0,shown:this.showCalendar,hide:!this.showCalendar,"s-form-has-error":!!this.errors&&this.errors.deliver_at}}async submitForm(){const t=document.querySelector("#donating-amount")?.value;if(this.calendarFormGroup.classList.remove("s-form-has-error"),this.errors&&(this.errors={},this.setWrapperHeight(2,150,0)),this.showCalendar&&!this.deliveryDate)return void this.calendarFormGroup.classList.add("s-form-has-error");const s=[{key:"sender_name",value:this.senderName,label:this.senderNameLabel},{key:"receiver.name",value:this.receiverName,label:this.receiverNameFieldLabel},{key:"receiver.mobile",value:this.receiverMobile,label:this.receiverMobileFieldLabel},...this.isPhysical()?[{key:"receiver.country",value:this.selectedCountryId,label:this.receiverCountryFieldLabel},...this.isKSA?[{key:"receiver.region",value:this.selectedRegionId,label:this.receiverRegionFieldLabel}]:[],{key:"receiver.city_id",value:this.receiverCity,label:this.receiverCityFieldLabel}]:[]],i={};if(s.forEach((({key:t,value:s,label:e})=>{s||(i[t]=salla.lang.get("common.errors.field_required",{attribute:e}))})),Object.keys(i).length)return this.errors=i,void this.setWrapperHeight(2,150,0);const e="custom"===this.selectedGiftTextOption,a={text:e?this.selectedText:void 0,text_id:!e&&this.selectedGiftTextOption?Number(this.selectedGiftTextOption):void 0,sender_name:this.senderName,quantity:this.quantity,deliver_at:this.showCalendar?this.deliveryDate:null,image_url:this.uploadedImage??this.selectedImage,donation_amount:t||null,receiver:{name:this.receiverName,mobile_country_code:this.receiverCountryCode,mobile:this.receiverMobile,...this.isPhysical()&&this.selectedCountryCode?{country_code:this.selectedCountryCode}:{},...this.isPhysical()&&this.selectedRegionId?{region_id:this.selectedRegionId}:{},...this.receiverCity&&this.isPhysical()?{city_id:this.receiverCity}:{}},has_apple_pay:salla.helpers.hasApplePay()};let h;this.productId&&this.formSelector&&(h=this.getFormDataFromForm()||new FormData,h=this.mergeObjectToFormData(a,h));const l=this.productId?()=>salla.product.addProductGiftToCart(this.productId,h,!0):()=>salla.cart.addCartGiftToCart(a,!0);return await l().then((()=>this.modal.close())).catch((t=>{t.response&&422==t.response.status?this.errors=t.response.data.error.fields:console.log(t),this.setWrapperHeight(2,150,0)}))}step2ItemClass(t=""){const s="anime-item"+(this.step2Animated?"":" opacity-0");return t?`${t} ${s}`:s}generateClass(){return{"s-gifting-widget":!0,"s-gifting-widget-vertical":!!this.vertical,"s-gifting-widget-horizontal":!this.vertical}}async handleGiftButtonClick(){if(this.productId&&this.formSelector){const t=document.querySelector(this.formSelector);if(!t)return void console.error("SallaGifting:: Form not found in the document!");if(!(t instanceof HTMLFormElement))return void console.error("SallaGifting:: The specified selector does not correspond to a form tag!");if(!t.reportValidity())return console.error("SallaGifting:: Form is not valid!"),void salla.error(salla.lang.get("common.messages.required_fields"))}const t=document.querySelector(`salla-product-options[product-id="${this.productId}"]`);!t||await t.reportValidity()?this.open():salla.error(salla.lang.get("common.messages.required_fields"))}render(){return[s("div",{key:"b4d479166a0a7a8b7bf4d66fd39399eef0bbe1d8"},s("salla-list-tile",{key:"a526748e500753bc4e132b6d8cc5fe56d276378c",class:this.generateClass()},s("div",{key:"3756943a7292552172dfe5fe112a987f9dff2128",slot:"title"},this.vertical?s("span",{innerHTML:h}):"",s("h3",{key:"769df65a33828cdb51270438885bd7554a93b18b"},this.widgetTitle?this.widgetTitle:this.sectionTitle)),s("div",{key:"69c51851715c12002d0d70f936852bf6b6a064a4",slot:"subtitle"},s("div",{key:"ee7979030a5756a4ad74c87cebdb595decc12d48"},this.widgetSubtitle?this.widgetSubtitle:this.sectionSubtitle)),s("div",{key:"374d33078ca9e9f4d26bc801abcb50d8271887bf",slot:"action"},s("salla-button",{key:"f5c53ce21a6e058e484f941d356e1c74bf337b5f",color:"primary",fill:"outline",width:"wide",class:"s-gifting-widget-action",onClick:()=>this.handleGiftButtonClick()},s("slot",{key:"2b57632750b91dc720605c181e19a0329c8db3e9",name:"widget-btn-content"},s("div",{key:"1d43f1351bc3323118c8eace681f382b753d009b",class:"s-gifting-widget-action-content"},s("span",{key:"f62808df38d07bf5db9d54f24a64c103dbcca3c2",innerHTML:h})," ",s("span",{key:"d22429956200e68c8d588d0daddae201963ba47a"},this.sectionBtnText)))))),s("salla-modal",{key:"0e1614ad210647ac77bbeb7e19104f5b9ce3b6b3",id:this.hostId,isLoading:!0,class:"s-gifting-modal",width:"sm",ref:t=>this.modal=t},s("div",{key:"230c00dd750aa31d20e450086b26c11094305e0f",slot:"loading"},s("div",{key:"cb48aec5cf71db50ba003cb3607c27e7a629e9be",class:"s-gifting-skeleton"},s("div",{key:"e7aa596896cb841628bf35b4b5d8c9d22ed84dae",class:"s-gifting-modal-header"},s("salla-skeleton",{key:"8e6dff5462dc1644bd89e56d51b3a353341b1741",type:"circle",height:"5rem",width:"5rem"}),s("h2",{key:"5bdf4f1266938b319a5d4642773cb0e8fa772f88",class:"s-gifting-modal-title"},s("div",{key:"2e3ea0e2589152059ec71f0e0a0b6537b0d32d8f",class:"s-gifting-modal-badge-wrapper"},s("salla-skeleton",{key:"7cf08110d0535ec7b719251cf54f3a83d940772f",height:"15px",width:"150px"})))),s("div",{key:"3e341993dd31be4bfbcc272877c8167f50233dd0",class:"s-gifting-skeleton-content"},s("salla-skeleton",{key:"74b584687ed715146e84a7107fb69f18ea78f31d",height:"10px",width:"150px"}),s("salla-skeleton",{key:"8acfdd240b397ea8e0d6c93c745786c68eb34f25",height:"230px"}),s("salla-skeleton",{key:"c92cef763f9d2857429919434a56bbc9686d6a3a",height:"10px",width:"150px"}),s("salla-skeleton",{key:"22e6c56dbabf3f90fa608dcd42d11b463ae86a1c",height:"30px"}),s("salla-skeleton",{key:"8093fcbc09362879ac5afb38f1910bdddfd41390",height:"40px"})))),s("slot",{key:"10842023d5a5861fa1562784c77f718c8e257d80",name:"header"}),this.hasError?s("salla-placeholder",{alignment:"center"},s("span",{slot:"title"},this.errorMessage||salla.lang.get("common.errors.empty_results")),s("span",{slot:"description"}," ")):[s("div",{class:"s-gifting-modal-header"},s("span",{class:"s-gifting-modal-icon"},s("span",{innerHTML:h})),s("h2",{class:"s-gifting-modal-title"},s("div",{class:"s-gifting-modal-badge-wrapper"},!this.skipStep1()&&s("div",{class:"s-gifting-modal-badge"},s("span",null,s("span",null,this.currentStep),"/2")),s("span",null,this.giftDetails)))),s("div",{class:"s-gifting-steps-wrapper "+this.parentClass,ref:t=>this.stepsWrapper=t},!this.skipStep1()&&s("div",{class:"s-gifting-step-one gift-step-1",ref:t=>this.step1Elems=t},this.gift&&this.gift.show_images&&s("div",{class:"s-gifting-modal-uploader-title anime-item"},this.selectImageForYourGift),this.gift&&this.gift.show_images&&s("div",{class:"s-gifting-image-section"},s("div",{class:`s-gifting-modal-uploader anime-item ${this.disableClass}`,ref:t=>this.uploader=t},s("span",{class:"s-gifting-remove-preview pointer-events-auto",onClick:()=>this.removePreview(),innerHTML:a}),this.selectImageOrUpload&&this.gift&&s("salla-file-upload",{"instant-upload":!0,name:"image_url",url:salla.url.api(salla.product.api.getUrl("giftImage")),onUploaded:t=>this.handleUploadImage(t.detail),labelIdle:this.getFilepondPlaceholder(),onRemoved:()=>this.handleRemoveImage()})),s("div",{class:"anime-item"},!this.uploadedImage&&this.gift&&this.gift.gift_images&&this.gift.gift_images.length>0?s("salla-slider",{id:"gifting-slider",loop:!1,"controls-outer":!0,class:"s-gifting-slider",type:"carousel"},s("div",{slot:"items"},this.gift&&this.gift.gift_images?this.gift?.gift_images.map((t=>s("a",{class:"s-gifting-clickable s-gifting-image",onClick:()=>this.setPreview(t)},s("img",{src:t.url,alt:`${t.id}`})))):"")):"")),this.gift&&this.gift.show_texts?s("div",{class:"anime-item"},s("div",{class:"s-gifting-modal-uploader-title s-gifting-text-title"},this.giftText),s("div",{class:"s-form-group s-gifting-selectText",ref:t=>this.textSelect=t},s("select",{id:"gift-text-selection",name:"gift-text-selection",class:"s-form-control s-gifting-select",onChange:t=>this.toggleGiftText(t)},s("option",{"data-id":null,selected:!this.selectedGiftTextOption},this.selectGiftMessage),this.gift&&this.gift.gift_texts?this.gift?.gift_texts.map((t=>s("option",{"data-id":t.id,value:t.text,key:t.id,selected:String(this.selectedGiftTextOption)===String(t.id)},t.text))):"",this.gift&&this.gift.show_custom_text?s("option",{"data-id":"custom",selected:"custom"===this.selectedGiftTextOption},this.giftCustomText):null)),s("div",{class:this.showGiftText&&this.gift&&this.gift.show_custom_text?"s-form-group s-gifting-textarea shown":"s-form-group s-gifting-textarea hide",ref:t=>this.customTextArea=t},s("label",{htmlFor:"gift-custom-text",class:"s-form-label"},this.giftCustomText),s("div",{class:"mt-1"},s("textarea",{onInput:t=>this.handleTextAreaChange(t),rows:4,ref:t=>this.textArea=t,name:"gift-custom-text",id:"gift-custom-text",class:"s-form-control"})))):null,s("div",{class:"anime-item"},s("salla-button",{color:"primary",width:"wide",onClick:()=>this.goToStep2(!!this.gift?.show_texts)},s("span",null,this.nextStep)))),s("div",{class:"s-gifting-step-two gift-step-2",style:this.skipStep1()?{opacity:"1",transform:"translateX(0)",position:"relative"}:void 0,ref:t=>this.step2Elems=t},s("div",{class:this.step2ItemClass(this.errors?.sender_name?"s-form-group s-form-has-error":"s-form-group")},s("label",{htmlFor:"sender_name",class:"s-form-label"},this.senderNameLabel),s("input",{type:"text",class:"s-form-control",name:"sender_name",id:"sender_name",value:this.senderName,onInput:t=>this.handleSenderName(t),placeholder:""}),this.errors&&this.errors.sender_name?s("span",{class:"s-gifting-error"},this.errors.sender_name):""),s("div",{class:this.step2ItemClass(this.errors?.["receiver.name"]?"s-form-group s-form-has-error":"s-form-group")},s("label",{htmlFor:"receiver_name",class:"s-form-label"},this.receiverNameFieldLabel),s("input",{type:"text",class:"s-form-control",name:"receiver_name",id:"receiver_name",value:"",onInput:t=>this.handleReceiverName(t),placeholder:""}),this.errors&&this.errors["receiver.name"]?s("span",{class:"s-gifting-error"},this.errors["receiver.name"]):""),s("div",{class:this.step2ItemClass(this.errors?.["receiver.mobile"]?"s-form-group s-form-has-error":"s-form-group")},s("label",{class:"s-form-label"},this.receiverMobileFieldLabel),s("salla-tel-input",{class:"s-gifting-tel-input",phone:this.receiverMobile,countryCode:this.receiverCountryCode,onPhoneEntered:t=>this.handlePhoneInputChange(t)}),this.errors&&this.errors["receiver.mobile"]?s("span",{class:"s-gifting-error"},this.errors["receiver.mobile"]):""),this.isPhysical()&&s("div",{class:this.step2ItemClass(this.errors?.["receiver.country"]?"s-form-group s-form-has-error":"s-form-group")},s("label",{class:"s-form-label",htmlFor:`${this.hostId}-country`},this.receiverCountryFieldLabel),s("salla-searchable-dropdown",{placeholder:this.selectCountry,items:this.gift?.countries??[],selectedItem:this.selectedCountry,disabled:!this.gift?.countries?.length,required:!0,inputId:`${this.hostId}-country`,searchable:!1,keepParentScroll:!0,onItemSelected:t=>this.handleCountrySelected(t.detail),onDropdownClosed:()=>this.handleCountryDropdownClosed()}),this.errors&&this.errors["receiver.country"]?s("span",{class:"s-gifting-error"},this.errors["receiver.country"]):""),this.isPhysical()&&this.isKSA&&s("div",{class:this.step2ItemClass(this.errors?.["receiver.region"]?"s-form-group s-form-has-error":"s-form-group")},s("label",{class:"s-form-label",htmlFor:`${this.hostId}-region`},this.receiverRegionFieldLabel),s("salla-searchable-dropdown",{placeholder:this.selectRegion,items:this.regions??[],selectedItem:this.selectedRegion,loading:this.loadingRegions,disabled:this.loadingRegions||!this.regions?.length,required:!0,inputId:`${this.hostId}-region`,searchable:!1,keepParentScroll:!0,onItemSelected:t=>this.handleRegionSelected(t.detail),onDropdownClosed:()=>this.handleRegionDropdownClosed()}),this.errors&&this.errors["receiver.region"]?s("span",{class:"s-gifting-error"},this.errors["receiver.region"]):""),this.isPhysical()&&s("div",{class:this.step2ItemClass(this.errors?.["receiver.city_id"]?"s-form-group s-form-has-error":"s-form-group")},s("label",{class:"s-form-label",htmlFor:`${this.hostId}-city`},this.receiverCityFieldLabel),s("salla-searchable-dropdown",{placeholder:this.selectCity,items:this.displayedCities,selectedItem:this.selectedCity,loading:this.loadingCities,searching:this.searchingCities,disabled:this.loadingCities||this.isKSA&&!this.selectedRegionId,required:!0,inputId:`${this.hostId}-city`,searchQuery:this.citySearchQuery,clientSearch:!this.enableCityAjaxSearch,dropUp:!0,keepParentScroll:!0,onItemSelected:t=>this.handleCitySelected(t.detail),onSearchInput:t=>this.handleCitySearch(t.detail),onDropdownClosed:()=>this.handleCityDropdownClosed()}),this.errors&&this.errors["receiver.city_id"]?s("span",{class:"s-gifting-error"},this.errors["receiver.city_id"]):""),this.isPhysical()&&this.cityNoticeText()&&s("div",{class:this.step2ItemClass("s-gifting-info")},s("span",{innerHTML:'\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>alert</title>\n<path d="M16 13.333c-0.736 0-1.333 0.597-1.333 1.333v8c0 0.736 0.597 1.333 1.333 1.333s1.333-0.597 1.333-1.333v-8c0-0.736-0.597-1.333-1.333-1.333zM16 9.327c-0.736 0-1.333 0.604-1.333 1.34s0.597 1.333 1.333 1.333 1.333-0.597 1.333-1.333v-0.013c0-0.736-0.597-1.327-1.333-1.327zM27.313 4.687c-6.237-6.237-16.389-6.239-22.628 0-6.237 6.239-6.237 16.389 0 22.628 3.119 3.119 7.216 4.679 11.313 4.679s8.195-1.559 11.313-4.679c6.24-6.239 6.24-16.391 0.001-22.628zM25.428 25.428c-5.199 5.197-13.657 5.197-18.857 0-5.197-5.199-5.197-13.659 0-18.857 5.199-5.197 13.659-5.197 18.857 0 5.199 5.2 5.199 13.659 0 18.857z"></path>\n</svg>\n'}),s("span",null,this.cityNoticeText())),!this.isPhysical()&&s("div",{class:this.step2ItemClass()},s("label",{class:"s-gifting-schedule s-gifting-clickable",htmlFor:`schedule-${this.hostId}`},s("input",{type:"checkbox",name:"schedule",id:`schedule-${this.hostId}`,onChange:()=>this.toggleCalendar(),class:"s-checkbox"}),s("span",{class:"s-form-label"}," ",this.sendLater," "))),s("div",{class:this.getCalendarClasses(),ref:t=>this.calendarFormGroup=t},s("label",{class:"s-form-label"},this.selectSendDateAndTime),s("salla-datetime-picker",{value:this.deliveryDate,placeholder:this.selectSendDateAndTime,"enable-time":!0,"date-format":"Y-m-d h:i K",onPicked:t=>this.handleDateTimePicker(t)}),s("span",{class:"s-gifting-calendar-hint"},this.canNotEditOrderAfterSelectDate)),s("div",{class:this.step2ItemClass("s-gifting-step-two-footer")},!this.skipStep1()&&s("a",{href:"#!",innerHTML:e,onClick:t=>this.goToStep1(t)}),s("salla-button",{onClick:()=>this.submitForm(),color:"primary",width:"wide"},s("span",null,this.sendGift)))))],s("slot",{key:"ba5b5cc6e2b20d756ed5149757b23239455939f7",name:"footer"})))]}};l.CITY_AJAX_THRESHOLD=400,l.CITY_SEARCH_DEBOUNCE_MS=100,l.style=".s-gifting-steps-wrapper{transition:height 0.8s cubic-bezier(0.55, 0, 0.1, 1) 0s}.s-gifting-select{background-image:url(\"data:image/svg+xml;utf8,<svg version='1.1' fill='gray' xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'><title>keyboard_arrow_down</title><path d='M9.875 11.104l6.125 6.125 6.125-6.125 1.875 1.875-8 8-8-8z'></path></svg>\");background-size:24px;background-repeat:no-repeat;background-position:99%;appearance:none}[dir=rtl] .s-gifting-select{background-position:5px}.s-gifting-widget-vertical .s-list-tile-item [slot=title]{display:flex;align-items:center;gap:1.5rem}.s-gifting-widget-vertical .s-list-tile-item-content{width:100%}.s-gifting-modal .s-searchable-dropdown-trigger{border-color:#d1d5db}.s-gifting-modal .s-searchable-dropdown-trigger:hover:not(.s-searchable-dropdown-trigger--disabled){border-color:#d1d5db}.s-gifting-modal .s-searchable-dropdown-trigger--open,.s-gifting-modal .s-searchable-dropdown-trigger:focus{border-color:var(--color-primary, #00897b);box-shadow:0 0 0 1px var(--color-primary, #00897b)}.s-gifting-modal .s-searchable-dropdown-trigger-placeholder{color:#000}.s-gifting-modal .s-gifting-image-section{margin-bottom:1.5rem}.s-gifting-modal .s-gifting-slider{margin-bottom:0.5rem}.s-gifting-modal .s-gifting-image{display:block}.s-gifting-modal .s-gifting-image img{display:block;width:auto;height:100px;object-fit:contain}.s-gifting-modal .s-gifting-image-section+.anime-item .s-gifting-text-title{margin-top:1rem}";export{l as salla_gifting}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as t,h as s,H as a,a as e}from"./p-
|
|
4
|
+
import{r as t,h as s,H as a,a as e}from"./p-BmH_SCLp.js";import{f as i}from"./p-CL7OPpYS.js";const l=class{constructor(s){t(this,s),this.limit=10,this.products=[],this.isLoading=!0,this.canRender=!0,this.title="",this.addToCartLabel="",this.weightLabel="",this.discountLabel="",this.placeholder="",this.fetchGeneration=0,this.isSyncingCart=!1,this.cartItemChangedHandler=t=>{const s=t?.data?.cart?.items??[],a=s.map((t=>String(t.product_id))).filter(Boolean);this.syncCartItemsDom(s),this.fetchRecommendations(a)},this.beforeAddItemHandler=t=>{const s=String(t?.id??"");s&&this.products.some((t=>String(t.id)===s))&&salla.cart?.api&&(salla.cart.api.addToCartSource="basket_gap")},this.addButtonSuccessHandler=t=>{const s=t?.target?.getAttribute?.("product-id");if(!s)return;const a=this.products.find((t=>String(t.id)===String(s)));if(!a)return;const e=t?.detail?.data?.items??[],i=e.find((t=>String(t.product_id)===String(a.id)))??e.slice(-1)[0];salla.event.emit("salla-basket-gap::product.added",[{product:a,position:this.products.indexOf(a)+1,cartItem:i,cartId:t?.detail?.data?.id,source:"basket_gap"}])},salla.lang.onLoaded((()=>{this.title=salla.lang.get("pages.cart.basket_gap_title"),this.addToCartLabel=salla.lang.get("pages.cart.add_to_cart"),this.weightLabel=salla.lang.get("pages.products.weight"),this.discountLabel=salla.lang.get("pages.products.discount")}))}componentWillLoad(){salla.onReady().then((()=>{if(!salla.config.get("store.settings.cart.basket_gap"))return this.canRender=!1,void(this.isLoading=!1);this.title=salla.lang.get("pages.cart.basket_gap_title"),this.addToCartLabel=salla.lang.get("pages.cart.add_to_cart"),this.weightLabel=salla.lang.get("pages.products.weight"),this.discountLabel=salla.lang.get("pages.products.discount"),this.placeholder=salla.url.asset(salla.config.get("theme.settings.placeholder"));const t=salla.storage.get("cart"),s=(t?.items??[]).map((t=>String(t.product_id))).filter(Boolean);return s.length?this.fetchRecommendations(s):salla.api.cart.details().then((({data:{cart:t}})=>{const s=(t?.items??[]).map((t=>String(t.product_id))).filter(Boolean);return this.fetchRecommendations(s)})).catch((()=>{this.canRender=!1,this.isLoading=!1}))}))}componentDidLoad(){this.positionUnderCartItems()}componentDidUpdate(){document.lazyLoadInstance?.update(this.host.querySelectorAll(".lazy")),this.positionUnderCartItems()}getCartItemForms(t=document){return Array.from(t.querySelectorAll('form[id^="item-"]')).filter((t=>!t.closest(".cart-options")))}positionUnderCartItems(){const t=this.getCartItemForms(),s=t[t.length-1];s&&s.nextElementSibling!==this.host&&s.after(this.host)}syncCartItemsDom(t){t?.length&&!this.isSyncingCart&&t.filter((t=>!document.getElementById("item-"+t.id))).length&&(this.isSyncingCart=!0,fetch(window.location.href,{headers:{"X-Requested-With":"XMLHttpRequest"},credentials:"same-origin"}).then((t=>t.text())).then((t=>{const s=(new DOMParser).parseFromString(t,"text/html"),a=this.getCartItemForms(s),e=this.getCartItemForms();if(!a.length||!e.length)return;const i=e[0],l=i.parentElement;l&&(a.forEach((t=>{l.insertBefore(document.importNode(t,!0),i)})),e.forEach((t=>t.remove())),document.lazyLoadInstance?.update?.(),this.positionUnderCartItems())})).catch((()=>{})).finally((()=>{this.isSyncingCart=!1})))}connectedCallback(){salla.event.on("cart::item.added",this.cartItemChangedHandler),salla.event.on("cart::item.deleted",this.cartItemChangedHandler),salla.event.on("cart::before.add.item",this.beforeAddItemHandler),this.host.addEventListener("success",this.addButtonSuccessHandler)}disconnectedCallback(){salla.event.off("cart::item.added",this.cartItemChangedHandler),salla.event.off("cart::item.deleted",this.cartItemChangedHandler),salla.event.off("cart::before.add.item",this.beforeAddItemHandler),this.host.removeEventListener("success",this.addButtonSuccessHandler)}getCartProductIds(t){if(t?.length)return new Set(t);const s=salla.storage.get("cart");return new Set((s?.items??[]).map((t=>String(t.product_id))).filter(Boolean))}fetchRecommendations(t){if(!t.length)return this.canRender=!1,this.isLoading=!1,Promise.resolve();const s=++this.fetchGeneration;return i(t).then((a=>{if(s!==this.fetchGeneration)return;const e=this.getCartProductIds(t),i=a.filter((t=>!e.has(t)));if(i.length)return this.fetchProducts(i.slice(0,this.limit),s);this.canRender=!1})).catch((()=>{s===this.fetchGeneration&&(this.canRender=!1)})).finally((()=>{s===this.fetchGeneration&&(this.isLoading=!1)}))}fetchProducts(t,s){return salla.api.withoutNotifier((()=>salla.product.api.fetch({source:"selected",source_value:t,limit:this.limit}))).then((t=>{s===this.fetchGeneration&&(this.products=t?.data??[],this.canRender=this.products.length>0)})).catch((()=>{s===this.fetchGeneration&&(this.canRender=!1)}))}getDiscountLabel(t){if(t.promotion_title)return t.promotion_title;if(t.is_on_sale&&t.regular_price>0&&t.sale_price>0){const s=Math.round(100*(1-t.sale_price/t.regular_price));return s>0?`${this.discountLabel} ${s}%`:null}return null}formatDate(t){const s=new Date(1e3*t),a=String(s.getMonth()+1).padStart(2,"0"),e=String(s.getDate()).padStart(2,"0");return`${s.getFullYear()}-${a}-${e}`}getSkeletonView(){return s(a,{class:"s-basket-gap-entry"},s("div",{class:"s-basket-gap-skeleton"},s("salla-skeleton",{height:"16px",width:"40%",style:{marginBottom:"16px"}}),Array(3).fill(null).map(((t,a)=>s("div",{key:a,class:"s-basket-gap-skeleton-card"},s("salla-skeleton",{height:"64px",width:"64px",style:{borderRadius:"8px",flexShrink:"0"}}),s("div",{class:"s-basket-gap-skeleton-info"},s("salla-skeleton",{height:"14px",width:"50%"}),s("salla-skeleton",{height:"12px",width:"25%",style:{marginTop:"6px"}}),s("salla-skeleton",{height:"10px",width:"35%",style:{marginTop:"4px"}})),s("salla-skeleton",{height:"36px",width:"100px",style:{borderRadius:"6px",flexShrink:"0",marginInlineStart:"auto"}}))))))}getProductCard(t){const a=this.getDiscountLabel(t);return s("div",{key:t.id,class:"s-basket-gap-card"},s("a",{href:t.url,class:"s-basket-gap-card-image"},s("img",{class:"lazy",src:this.placeholder,"data-src":t.image?.url,alt:t.image?.alt||t.name})),s("div",{class:"s-basket-gap-card-info"},s("h3",{class:"s-basket-gap-card-name"},s("a",{href:t.url},t.name)),t.is_on_sale?s("div",{class:"s-basket-gap-card-sale-price"},s("span",{innerHTML:salla.money(t.sale_price)}),s("del",{innerHTML:salla.money(t.regular_price)})):s("span",{class:"s-basket-gap-card-price",innerHTML:salla.money(t.price)}),t.weight_label&&s("span",{class:"s-basket-gap-card-weight"},this.weightLabel," ",t.weight_label)),(t.promotion_title||t.discount_ends||t.is_on_sale)&&s("div",{class:"s-basket-gap-card-offer"},s("i",{class:"sicon-gift"}),a&&s("span",null,a),t.discount_ends&&[s("salla-count-down",{date:this.formatDate(t.discount_ends),"end-of-day":!0,digits:"en"}),s("i",{class:"sicon-alarm"})]),s("salla-add-product-button",{class:"s-basket-gap-card-btn","product-id":t.id,"product-status":t.status,"product-type":t.type},this.addToCartLabel))}render(){return this.canRender?this.isLoading?this.getSkeletonView():this.products.length?s(a,{class:"s-basket-gap-entry"},this.title&&s("h2",{class:"s-basket-gap-title"},this.title),s("div",{class:"s-basket-gap-list"},this.products.map((t=>this.getProductCard(t))))):null:null}get host(){return e(this)}};l.style=":host{display:block}";export{l as salla_basket_gap}
|