@salla.sa/twilight-components 2.14.480 → 2.14.481
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-kIwfFiY4.js → filepond-BU-jXTBl.js} +1 -1
- package/dist/cjs/{filepond-plugin-file-poster-CbAmZLgn.js → filepond-plugin-file-poster-RwughT8q.js} +1 -1
- package/dist/cjs/{filepond-plugin-file-validate-size-iH_0ezqS.js → filepond-plugin-file-validate-size-0cnmN22U.js} +1 -1
- package/dist/cjs/{filepond-plugin-file-validate-type-B2YOvyGf.js → filepond-plugin-file-validate-type-CO8O6m_X.js} +1 -1
- package/dist/cjs/{filepond-plugin-image-edit-C5N-16uI.js → filepond-plugin-image-edit-D6jx4Pjj.js} +1 -1
- package/dist/cjs/{filepond-plugin-image-exif-orientation-aEzbNMDw.js → filepond-plugin-image-exif-orientation-axIyzrDe.js} +1 -1
- package/dist/cjs/{filepond-plugin-image-preview-RLbA7gqX.js → filepond-plugin-image-preview-BMgsi5If.js} +1 -1
- package/dist/cjs/{functions-BVKjPPbN.js → functions-Dtg2mNd5.js} +1 -1
- package/dist/cjs/{index-DjrWrGKt.js → index-BDebUujt.js} +1 -1
- package/dist/cjs/{index-RKu7wZSM.js → index-DUmFkKsZ.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-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-cashback-banner.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.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-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-details-multiple-bundle-product.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-details-options.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-details.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-edit-item.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-edit-product-card.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-edit.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-options-modal_3.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-size-guide.cjs.entry.js +1 -1
- package/dist/cjs/salla-products-list.cjs.entry.js +1 -1
- package/dist/cjs/salla-quick-order.cjs.entry.js +1 -1
- package/dist/cjs/salla-rating-modal.cjs.entry.js +1 -1
- package/dist/cjs/salla-reward-action_4.cjs.entry.js +3 -3
- 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-B8pdpxb2.js → tracked-promise-DQbPZz8j.js} +1 -1
- package/dist/cjs/twilight.cjs.js +1 -1
- package/dist/cjs/{vanilla-picker-B6Vd66w8.js → vanilla-picker-Cf0IEAxU.js} +1 -1
- package/dist/components/index.js +2 -2
- package/dist/esm/{filepond-BUxO340w.js → filepond-DEIVYCk8.js} +1 -1
- package/dist/esm/{filepond-plugin-file-poster-DPDWNTQe.js → filepond-plugin-file-poster-DDPFacpf.js} +1 -1
- package/dist/esm/{filepond-plugin-file-validate-size-DrF6W6HS.js → filepond-plugin-file-validate-size-BK6TTAk0.js} +1 -1
- package/dist/esm/{filepond-plugin-file-validate-type-ByNgdCcv.js → filepond-plugin-file-validate-type-BeLdDHir.js} +1 -1
- package/dist/esm/{filepond-plugin-image-edit-D6lcie1e.js → filepond-plugin-image-edit-BdSsbhWf.js} +1 -1
- package/dist/esm/{filepond-plugin-image-exif-orientation-CEGVilMd.js → filepond-plugin-image-exif-orientation-CspYVPJR.js} +1 -1
- package/dist/esm/{filepond-plugin-image-preview-BInmqvtQ.js → filepond-plugin-image-preview-B1Rdh0IW.js} +1 -1
- package/dist/esm/{functions-CwbqVd0b.js → functions-C_5-G0lf.js} +1 -1
- package/dist/esm/{index-BqFb60iF.js → index-BFfD9GlY.js} +2 -2
- package/dist/esm/{index-BrHfsf3-.js → index-DLNCyofS.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-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-cashback-banner.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.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-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-details-multiple-bundle-product.entry.js +1 -1
- package/dist/esm/salla-order-details-options.entry.js +1 -1
- package/dist/esm/salla-order-details.entry.js +1 -1
- package/dist/esm/salla-order-edit-item.entry.js +1 -1
- package/dist/esm/salla-order-edit-product-card.entry.js +1 -1
- package/dist/esm/salla-order-edit.entry.js +1 -1
- package/dist/esm/salla-order-options-modal_3.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-size-guide.entry.js +1 -1
- package/dist/esm/salla-products-list.entry.js +1 -1
- package/dist/esm/salla-quick-order.entry.js +1 -1
- package/dist/esm/salla-rating-modal.entry.js +1 -1
- package/dist/esm/salla-reward-action_4.entry.js +3 -3
- 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-DXr0erHx.js → tracked-promise-BFrCUkRf.js} +1 -1
- package/dist/esm/twilight.js +2 -2
- package/dist/esm/{vanilla-picker-5UIlzk8V.js → vanilla-picker-k4dXuf_r.js} +1 -1
- package/dist/twilight/{p-2d5469e5.entry.js → p-05573ec1.entry.js} +1 -1
- package/dist/twilight/{p-026f2d7b.entry.js → p-09d4cdc7.entry.js} +1 -1
- package/dist/twilight/{p-b8812978.entry.js → p-0e21c689.entry.js} +1 -1
- package/dist/twilight/{p-328689cc.entry.js → p-10deb584.entry.js} +1 -1
- package/dist/twilight/{p-fbd4f619.entry.js → p-10ef7d8a.entry.js} +1 -1
- package/dist/twilight/{p-e7c12354.entry.js → p-15c2aded.entry.js} +1 -1
- package/dist/twilight/{p-f4531bfe.entry.js → p-15f58bea.entry.js} +1 -1
- package/dist/twilight/{p-dfd88e06.entry.js → p-18ba0468.entry.js} +1 -1
- package/dist/twilight/{p-07ab0bf0.entry.js → p-18d3976e.entry.js} +1 -1
- package/dist/twilight/{p-c45ce221.entry.js → p-190339c7.entry.js} +1 -1
- package/dist/twilight/{p-67e934a3.entry.js → p-1bcb6681.entry.js} +1 -1
- package/dist/twilight/{p-96d7b307.entry.js → p-1be97b58.entry.js} +1 -1
- package/dist/twilight/{p-5083bfcd.entry.js → p-1c1aab79.entry.js} +1 -1
- package/dist/twilight/{p-92b0481d.entry.js → p-1ea3e01d.entry.js} +1 -1
- package/dist/twilight/{p-f5d7430f.entry.js → p-2565dc64.entry.js} +1 -1
- package/dist/twilight/{p-1c834218.entry.js → p-2765e4ec.entry.js} +1 -1
- package/dist/twilight/{p-778a42dc.entry.js → p-2ae4c174.entry.js} +1 -1
- package/dist/twilight/{p-b4301ee3.entry.js → p-2fda9f30.entry.js} +1 -1
- package/dist/twilight/{p-7cec181e.entry.js → p-319983e1.entry.js} +1 -1
- package/dist/twilight/p-3445cd8c.entry.js +4 -0
- package/dist/twilight/{p-9f5105fc.entry.js → p-34860b2b.entry.js} +1 -1
- package/dist/twilight/{p-2dbbfde8.entry.js → p-36242efb.entry.js} +1 -1
- package/dist/twilight/{p-97f56b3e.entry.js → p-364661cc.entry.js} +1 -1
- package/dist/twilight/{p-334df31d.entry.js → p-3c16c6b8.entry.js} +1 -1
- package/dist/twilight/{p-013dfb33.entry.js → p-3d0cf0b3.entry.js} +1 -1
- package/dist/twilight/{p-fd9754f2.entry.js → p-473c6e01.entry.js} +1 -1
- package/dist/twilight/{p-3592fb4b.entry.js → p-4763b0d3.entry.js} +1 -1
- package/dist/twilight/{p-d0bb3653.entry.js → p-4f1f71c6.entry.js} +1 -1
- package/dist/twilight/{p-7c95a27d.entry.js → p-55fc6c69.entry.js} +1 -1
- package/dist/twilight/{p-0f975c51.entry.js → p-56419305.entry.js} +1 -1
- package/dist/twilight/{p-53ce66a7.entry.js → p-56b806ac.entry.js} +1 -1
- package/dist/twilight/{p-767822b5.entry.js → p-58d198ed.entry.js} +1 -1
- package/dist/twilight/{p-315593b0.entry.js → p-5bd5b1db.entry.js} +1 -1
- package/dist/twilight/{p-248d1538.entry.js → p-697792ed.entry.js} +1 -1
- package/dist/twilight/{p-ec1fc331.entry.js → p-6978b18f.entry.js} +1 -1
- package/dist/twilight/{p-95643680.entry.js → p-6a9062fe.entry.js} +1 -1
- package/dist/twilight/{p-57d40198.entry.js → p-6c7e6d1e.entry.js} +1 -1
- package/dist/twilight/{p-a0855c31.entry.js → p-6e352c13.entry.js} +1 -1
- package/dist/twilight/{p-0c77267c.entry.js → p-6e5e98d4.entry.js} +1 -1
- package/dist/twilight/{p-fe86430c.entry.js → p-764fbd77.entry.js} +1 -1
- package/dist/twilight/{p-d9b7a9d1.entry.js → p-7b125382.entry.js} +1 -1
- package/dist/twilight/{p-f13103c6.entry.js → p-80a0774d.entry.js} +1 -1
- package/dist/twilight/{p-ff1c723f.entry.js → p-89c54a03.entry.js} +1 -1
- package/dist/twilight/{p-61e9018a.entry.js → p-8d963f16.entry.js} +1 -1
- package/dist/twilight/{p-c5662aa2.entry.js → p-942a93e8.entry.js} +1 -1
- package/dist/twilight/{p-3d68c74d.entry.js → p-97d0a70f.entry.js} +1 -1
- package/dist/twilight/{p-0b9b72c0.entry.js → p-9a9e8efe.entry.js} +1 -1
- package/dist/twilight/{p-43474ee2.entry.js → p-9b53b934.entry.js} +1 -1
- package/dist/twilight/{p-b3f07535.entry.js → p-9db3081f.entry.js} +1 -1
- package/dist/twilight/{p-0fd430cd.entry.js → p-9f32f1f0.entry.js} +1 -1
- package/dist/twilight/{p-CsHEfbM_.js → p-AuwIE7o-.js} +1 -1
- package/dist/twilight/{p-tJElNMug.js → p-BAyOlChZ.js} +1 -1
- package/dist/twilight/{p-BqFb60iF.js → p-BFfD9GlY.js} +1 -1
- package/dist/twilight/{p-DYL8LNIs.js → p-C5ES8RmQ.js} +1 -1
- package/dist/twilight/{p-DsKnWz05.js → p-CTlsIWU4.js} +1 -1
- package/dist/twilight/{p-BbiGVDjx.js → p-CYUz6ssw.js} +1 -1
- package/dist/twilight/{p-Bw6Lg6Nq.js → p-CgPACEOg.js} +1 -1
- package/dist/twilight/{p-DsHyM0bg.js → p-CsdaeDEP.js} +1 -1
- package/dist/twilight/{p-BRP9wXBV.js → p-CvPfojZm.js} +1 -1
- package/dist/twilight/{p-Kk0reIVI.js → p-DZapUZRi.js} +1 -1
- package/dist/twilight/{p-BnXdxK21.js → p-DlqVqj-B.js} +1 -1
- package/dist/twilight/{p-DlEXuybu.js → p-N2hoIVEP.js} +1 -1
- package/dist/twilight/{p-5a57d395.entry.js → p-a49b621f.entry.js} +1 -1
- package/dist/twilight/{p-8b366181.entry.js → p-a53b463a.entry.js} +1 -1
- package/dist/twilight/{p-e839d889.entry.js → p-a61c84d6.entry.js} +1 -1
- package/dist/twilight/{p-dec1388b.entry.js → p-a6aa3a35.entry.js} +1 -1
- package/dist/twilight/{p-cd3e9b52.entry.js → p-a7333036.entry.js} +1 -1
- package/dist/twilight/{p-dbd2a0de.entry.js → p-ab284e93.entry.js} +1 -1
- package/dist/twilight/{p-3e263ad6.entry.js → p-aedee164.entry.js} +1 -1
- package/dist/twilight/{p-d652aaf4.entry.js → p-af139470.entry.js} +1 -1
- package/dist/twilight/{p-46b9277f.entry.js → p-b05efe57.entry.js} +1 -1
- package/dist/twilight/{p-91dc3de7.entry.js → p-b071c543.entry.js} +1 -1
- package/dist/twilight/{p-a0ba26aa.entry.js → p-b0b9de4f.entry.js} +1 -1
- package/dist/twilight/{p-fd4989e9.entry.js → p-b401a024.entry.js} +1 -1
- package/dist/twilight/{p-7b8f78d8.entry.js → p-b47bbfd3.entry.js} +1 -1
- package/dist/twilight/{p-6c4ab4ae.entry.js → p-b4d80c1d.entry.js} +1 -1
- package/dist/twilight/{p-09373418.entry.js → p-b51ba869.entry.js} +1 -1
- package/dist/twilight/{p-23fb752f.entry.js → p-b5a4b20a.entry.js} +1 -1
- package/dist/twilight/{p-2a8797f7.entry.js → p-c34719c9.entry.js} +1 -1
- package/dist/twilight/{p-ac45f19d.entry.js → p-c50e24d7.entry.js} +1 -1
- package/dist/twilight/{p-63f568ad.entry.js → p-c97836ec.entry.js} +1 -1
- package/dist/twilight/{p-cd40e650.entry.js → p-cbf1c2e1.entry.js} +1 -1
- package/dist/twilight/{p-431fac85.entry.js → p-ce86f94a.entry.js} +1 -1
- package/dist/twilight/{p-2e5bb4f4.entry.js → p-d1d6ba0d.entry.js} +1 -1
- package/dist/twilight/{p-3fc7dfa2.entry.js → p-d2486369.entry.js} +1 -1
- package/dist/twilight/{p-ee0e575e.entry.js → p-d7f1567d.entry.js} +1 -1
- package/dist/twilight/{p-12eef889.entry.js → p-db0c8a1e.entry.js} +1 -1
- package/dist/twilight/{p-1f7b2325.entry.js → p-dc0d8c24.entry.js} +1 -1
- package/dist/twilight/{p-29b491ae.entry.js → p-e461afb0.entry.js} +1 -1
- package/dist/twilight/{p-ea9159eb.entry.js → p-e51e3e84.entry.js} +1 -1
- package/dist/twilight/{p-e23d218e.entry.js → p-e5d5414e.entry.js} +1 -1
- package/dist/twilight/{p-3889f710.entry.js → p-e806cb75.entry.js} +1 -1
- package/dist/twilight/{p-1a719573.entry.js → p-e9db8f68.entry.js} +1 -1
- package/dist/twilight/{p-d66338e0.entry.js → p-edb9b391.entry.js} +1 -1
- package/dist/twilight/{p-f9142099.entry.js → p-edea7fcd.entry.js} +1 -1
- package/dist/twilight/{p-81fc08bc.entry.js → p-ef35051f.entry.js} +1 -1
- package/dist/twilight/{p-9dc040ac.entry.js → p-f0aece35.entry.js} +1 -1
- package/dist/twilight/{p-535aff1f.entry.js → p-f1e59473.entry.js} +1 -1
- package/dist/twilight/{p-76196f47.entry.js → p-fcebdd50.entry.js} +1 -1
- package/dist/twilight/{p-daed6c53.entry.js → p-fd373a93.entry.js} +1 -1
- package/dist/twilight/twilight.esm.js +1 -1
- package/package.json +5 -5
- package/dist/twilight/p-fc337ff0.entry.js +0 -4
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as s,c as t,h as i,H as e,a as h}from"./p-
|
|
4
|
+
import{r as s,c as t,h as i,H as e,a as h}from"./p-BFfD9GlY.js";import{e as r}from"./p-DzAIgzdz.js";const l=class{constructor(i){s(this,i),this.verified=t(this,"verified"),this.translationLoaded=!1,this.display="modal",this.type="mobile",this.autoReload=!0,this.supportWebAuth=!0,this.resendAfter=30,this.isProfileVerify=!1,salla.lang.onLoaded((()=>{this.translationLoaded=!0,this.title=salla.lang.get("pages.profile.verify_title")+salla.lang.get("common.elements."+this.type),this.modal?.setTitle(this.title)})),"inline"!=this.display?(salla.event.on("profile::verification",(s=>{let t=Array.isArray(s)?s[0]:s;this.isProfileVerify=!0,this.open(t),this.title=salla.lang.get("pages.profile.verify_title")+salla.lang.get("common.elements."+t.type),this.modal?.setTitle(this.title)})),salla.event.on("modalClosed",(()=>{this.resendAfter=0,this.timer.innerHTML="30 : 00"}))):this.modal={open:()=>"",close:()=>"",setTitle:()=>""}}splitNumber(s){this.resetError();let t=s.data||s.target.value;t&&1!==t.length&&this.modifyNext(s.target,t)}modifyNext(s,t){s.value=t[0],t=t.substring(1),s.nextElementSibling&&t.length?this.modifyNext(s.nextElementSibling,t):s.nextElementSibling||0!==t.length?s.nextElementSibling&&0===t.length&&s.nextElementSibling.focus():s.focus()}checkAllInputs(){let s=!0;for(let t=0;t<this.otpInputs.length;t++)""===this.otpInputs[t].value&&(s=!1);return s}handleKeyUp(s){if(this.resetError(),["Alt","Shift","Control","AltGraph","Ctrl"].includes(s.key))return;let t=s.keyCode||s.charCode;s.target.value?(s.target.nextElementSibling?.focus(),s.target.nextElementSibling?.select()):[8,46].includes(t)&&(s.target.previousElementSibling?.focus(),s.target.previousElementSibling?.select()),s.target.value.length>1&&this.splitNumber(s)}handlePaste(s){this.resetError();let t=(salla.helpers.number(s.clipboardData.getData("text"))||"").replace(/[^0-9]/g,"");t=t.substring(0,this.otpInputs.length),this.otpInputs.forEach((s=>s.value="")),this.modifyNext(this.otpInputs[0],t)}handleInput(s){this.resetError(),salla.helpers.inputDigitsOnly(s.target),this.checkAllInputs()&&setTimeout((()=>{this.toggleOTPSubmit()}),100)}resetError(){this.hasError=!1,this.errorMessage=""}handleFocus(s){s.target!==this.firstOtpInput&&(""==this.firstOtpInput?.value&&this.firstOtpInput.focus(),""==s.target.previousElementSibling.value&&s.target.previousElementSibling.focus())}async getCode(){return this.code.value}async open(s){this.data=s,this.data.type=this.data.type||this.type,this.type=this.data.type,this.resendTimer(),this.otpInputs=this.body.querySelectorAll(".s-verify-input"),this.firstOtpInput=this.body.querySelector("#otp-1"),this.reset(),this.resetError(),"modal"==this.display&&this.modal?.setTitle(this.title),this.modal.open(),this.firstOtpInput?.addEventListener("input",(s=>this.splitNumber(s))),setTimeout((()=>this.otpInputs[0].focus()),100)}toggleOTPSubmit(){let s=[];if(this.otpInputs.forEach((t=>t.value&&s.push(t.value))),this.code.value=s.join(""),4===s.length)return this.btn.disable(),void this.btn.click();this.btn.enable()}reset(){this.otpInputs.forEach((s=>s.value="")),this.code.value="",this.otpInputs[0].focus()}resendTimer(){this.resendMessage.style.display="block",this.resend.style.display="none",this.resendAfter=30;let s=setInterval((()=>{this.resendAfter<=0?(clearInterval(s),this.resend.style.display="block",this.resendMessage.style.display="none"):(this.timer.innerHTML=`${this.resendAfter>=10?this.resendAfter:"0"+this.resendAfter} : 00`,this.resendAfter--)}),1e3)}resendCode(){return this.btn.stop().then((()=>this.btn.disable())).then((()=>{this.otpInputs.forEach((s=>s.value="")),this.otpInputs[0].focus()})).then((()=>salla.api.auth.resend(this.data))).finally((()=>this.resendTimer()))}submit(){if(this.code.value.length<4)return this.otpInputs[this.code.value.length].focus(),void salla.log("Trying to submit without 4 digits!");let s={code:this.code.value,...this.data};return this.btn.load().then((()=>this.btn.disable())).then((()=>this.isProfileVerify?salla.profile.verify(s):salla.auth.verify(s,this.supportWebAuth))).then((s=>this.verified.emit(s))).then((()=>this.btn.stop()&&this.btn.disable())).then((()=>this.modal.close())).then((()=>this.autoReload&&window.location.reload())).catch((s=>{this.hasError=!0,this.errorMessage=s.response?.data?.error?.message||salla.lang.get("common.errors.error_occurred"),s.response?salla.logger.error(s):console.log("Unexpected error",s),this.btn.stop()&&this.btn.enable()&&this.reset()}))}render(){return"inline"==this.display?i(e,null,this.myBody()):i("salla-modal",{width:"xs",class:"s-verify",ref:s=>this.modal=s,"modal-title":this.title},i("span",{slot:"icon",class:"s-verify-header-icon",innerHTML:"mobile"==this.type?'\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>android-phone</title>\n<path d="M22.667 0h-13.333c-2.941 0-5.333 2.392-5.333 5.333v21.333c0 2.941 2.392 5.333 5.333 5.333h13.333c2.941 0 5.333-2.392 5.333-5.333v-21.333c0-2.941-2.392-5.333-5.333-5.333zM25.333 26.667c0 1.471-1.196 2.667-2.667 2.667h-13.333c-1.471 0-2.667-1.196-2.667-2.667v-2.667h18.667zM25.333 21.333h-18.667v-16c0-1.471 1.196-2.667 2.667-2.667h13.333c1.471 0 2.667 1.196 2.667 2.667zM13.333 28h5.333c0.736 0 1.333-0.597 1.333-1.333s-0.597-1.333-1.333-1.333h-5.333c-0.736 0-1.333 0.597-1.333 1.333s0.597 1.333 1.333 1.333z"></path>\n</svg>\n':r}),this.myBody())}myBody(){return i("div",{class:"s-verify-body",ref:s=>this.body=s},i("div",{class:"s-verify-message",innerHTML:salla.lang.get("pages.profile.verify_message")}),i("slot",{name:"mobile"}),i("slot",{name:"email"}),i("input",{type:"hidden",name:"code",maxlength:"4",required:!0,ref:s=>this.code=s}),i("div",{class:{"s-verify-codes":!0,"has-error":this.hasError},dir:"ltr"},[1,2,3,4].map((s=>i("input",{type:"number",autocomplete:"one-time-code",pattern:"[0-9]*",inputmode:"numeric",maxlength:"1",value:"",id:`otp-${s}`,class:{"s-verify-input":!0,"s-has-error":this.hasError},onInput:s=>this.handleInput(s),onPaste:s=>this.handlePaste(s),onKeyUp:s=>this.handleKeyUp(s),onFocus:s=>this.handleFocus(s),required:!0})))),this.hasError&&this.errorMessage?i("span",{class:"s-verify-error-message"},this.errorMessage):"",i("div",{slot:"footer",class:"s-verify-footer"},i("salla-button",{class:"s-verify-submit","loader-position":"center",disabled:!0,onClick:()=>this.submit(),ref:s=>this.btn=s},salla.lang.get("pages.profile.verify")),i("p",{class:"s-verify-resend-message",ref:s=>this.resendMessage=s},salla.lang.get("blocks.header.resend_after"),i("b",{class:"s-verify-timer",ref:s=>this.timer=s})),i("a",{href:"#",class:"s-verify-resend",onClick:()=>this.resendCode(),ref:s=>this.resend=s},salla.lang.get("blocks.comments.submit"))),i("slot",{name:"after-footer"}))}get host(){return h(this)}};l.style="salla-verify{display:block}.s-verify-input{}.s-verify-input::-webkit-outer-spin-button,.s-verify-input::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}.s-verify-input[type=number]{-moz-appearance:textfield}";export{l as salla_verify}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as a,h as t,H as l}from"./p-
|
|
4
|
+
import{r as a,h as t,H as l}from"./p-BFfD9GlY.js";const s=class{constructor(t){a(this,t),this.isLoading=!1,this.nextPageUrl="",this.handleClick=()=>{this.loadMoreTransactions()}}componentWillLoad(){return salla.onReady().then((()=>this.loadTransactions()))}async loadTransactions(){this.isLoading=!0;try{let a="/balance/wallet?per_page=10&page=1",t=await salla.api.request(a);this.nextPageUrl=t.data.transactions.next_page_url,this.transactionsArray=t.data.transactions,this.balance=t.data.balance}catch(a){console.error("Error loading wallet transactions",a)}finally{this.isLoading=!1}}async loadMoreTransactions(){this.isLoading=!0;try{let a=this.nextPageUrl||"/balance/wallet?page=2&per_page=10",t=await salla.api.request(a);this.nextPageUrl=t.data.transactions.next_page_url,this.transactionsArray.push(...t.data.transactions.data),this.balance=t.data.balance}catch(a){console.error("Error loading wallet transactions",a)}finally{this.isLoading=!1}}render(){return this.transactionsArray.length>0?t(l,null,t("table",{class:"s-wallet-table"},t("tbody",{class:"s-wallet-table-tbody"},t("tr",{class:"s-table__tr"},t("td",null,t("div",{class:"s-wallet-table-balance-container"},t("i",{class:"s-wallet-table-balance-icon sicon-wallet"}),t("div",null,t("div",{innerHTML:salla.money(this.balance)}),t("div",{class:"font-normal text-gray-400"}," ",salla.lang.get("pages.wallet.balance")))))))),t("h2",{style:{"margin-top":"32px"}},salla.lang.get("pages.wallet.title")),t("table",{class:"s-wallet-table"},t("thead",{class:"s-wallet-table-head"},t("tr",{class:"s-wallet-table-head-tr"},t("th",{scope:"col"},salla.lang.get("pages.wallet.transaction_number")),t("th",{scope:"col",class:"s-wallet-table-head-tr-th"},salla.lang.get("pages.wallet.amount")),t("th",{scope:"col",class:"s-wallet-table-head-tr-th"},salla.lang.get("pages.wallet.date")),t("th",{scope:"col",class:"s-wallet-table-head-tr-th"},salla.lang.get("pages.wallet.order_no")),t("th",{scope:"col",class:"s-wallet-table-head-tr-th"},salla.lang.get("pages.wallet.expiry_date")),t("th",{scope:"col",class:"s-wallet-table-head-tr-th"},salla.lang.get("pages.wallet.transaction_type")," "))),t("tbody",{class:"s-wallet-table-tbody"},this.transactionsArray.map((a=>t("tr",{class:"s-wallet-table-tbody-tr s-wallet-table-tbody-tr-shadow animated"},t("td",{class:"s-wallet-table-tbody-tr-td"},t("div",{class:"s-wallet-table-tbody-tr-td-content"},t("span",{class:"s-wallet-mobile-title"},salla.lang.get("pages.wallet.transaction_number"),":"),a.id&&t("span",{class:"hidden md:inline-block"},"#",a.id),t("div",{class:"flex items-center md:hidden"},t("salla-button",{class:"relative",color:"dark",shape:"link","data-content":a.order_id},a.order_id&&t("span",null,"#",a.order_id))))),t("td",{id:"main123",class:"s-wallet-table-tbody-tr-td"},t("div",{id:"main124",class:"s-wallet-table-tbody-tr-td-content"},t("span",{id:"main125",class:"s-wallet-mobile-title"},salla.lang.get("pages.wallet.amount"),":"),t("div",{innerHTML:salla.money(a.amount)}))),t("td",{class:"s-wallet-table-tbody-tr-td"},t("div",{class:"s-wallet-table-tbody-tr-td-content"},t("span",{class:"s-wallet-mobile-title"},salla.lang.get("pages.wallet.date"),":"),a.created_at&&new Date(1e3*a.created_at).toLocaleDateString(salla.lang.locale,{weekday:"long",year:"numeric",month:"long",day:"numeric",hour:"numeric"}))),t("td",{id:"main133",class:"s-wallet-table-tbody-tr-td"},t("div",{id:"main134",class:"s-wallet-table-tbody-tr-td-content"},t("span",{id:"main135",class:"s-wallet-mobile-title"},salla.lang.get("pages.wallet.order_no"),":"),t("span",{class:"rtl:mr-auto ltr:ml-auto md:mx-0"},a.order_id&&t("span",null,"#",a.order_id)))),t("td",{id:"main143",class:"s-wallet-table-tbody-tr-td"},t("div",{id:"main144",class:"s-wallet-table-tbody-tr-td-content"},t("span",{id:"main145",class:"s-wallet-mobile-title"},salla.lang.get("pages.wallet.expiry_date"),":"),t("span",null,a.expired_at&&new Date(1e3*a.expired_at).toLocaleDateString(salla.lang.locale,{weekday:"long",year:"numeric",month:"long",day:"numeric",hour:"numeric"})))),t("td",{class:"s-wallet-table-tbody-tr-td"},t("div",{class:"s-wallet-table-tbody-tr-td-content"},t("div",null,t("span",{class:"s-wallet-mobile-title"},salla.lang.get("pages.wallet.transaction_type"),":")),t("div",{class:{"s-wallet-table-transaction-status-default":!0,"s-wallet-table-transaction-status-cashback":"cashback"===a.action_type,"s-wallet-table-transaction-status-refund":"refund"===a.action_type,"s-wallet-table-transaction-status-purchase":"purchase_by_wallet"===a.action_type}},!!a.description&&t("i",{id:a.id.toString(),class:"sicon-information text-lg rtl:ml-4 ltr:mr-4 s-wallet-table-transaction-status-icon-success"}),!!a.description&&t("salla-tooltip",{text:a.description,targetId:a.id.toString()}),t("span",null,a.title))))))))),t("div",{class:"s-infinite-scroll-wrapper"},!!this.nextPageUrl&&t("salla-button",{onClick:this.handleClick,loading:this.isLoading},salla.lang.get("common.elements.load_more")))):t(l,null,t("h2",{style:{"margin-top":"32px"}},salla.lang.get("pages.wallet.title")),t("div",{class:"s-wallet-table-empty-state"},t("i",{class:"sicon-full-wallet"}),t("div",{class:"text-center p-3 text-xl font-bold "},salla.lang.get("pages.wallet.no_transactions")),t("div",{class:"text-center text-gray-400 text-sm font-normal "},salla.lang.get("pages.wallet.zero_balance")," ")))}};s.style=".s-wallet-table{min-width:100%}.s-wallet-table-balance-container{display:flex !important;align-items:center !important;justify-content:flex-start !important;gap:1rem}.s-wallet-table-balance-icon{border-radius:50%;width:52px;height:52px;font-size:25px;padding:16px 13px;background:var(--color-primary-reverse);color:var(--color-primary)}.s-wallet-table-empty-state{display:flex;flex-direction:column;align-items:center}.s-wallet-table-empty-state i{font-size:80px;margin:4rem 0 2rem;color:var(--infinte-color)}.s-wallet-table-transaction-status{padding:6px 19px !important;border-radius:20px;width:max-content;display:flex;align-items:center}.s-wallet-table-transaction-status-default{background:#fff6eb;color:#a46f29}.s-wallet-table-transaction-status-cashback{background:#effbf6;color:#00af6c}.s-wallet-table-transaction-status-refund{background:#ecf3fe;color:#5196f3}.s-wallet-table-transaction-status-purchase{background:#feecec;color:#f55157}.s-wallet-table-transaction-status-icons-success{color:#00af6c}";export{s as salla_wallet}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as s,h as e,a as t}from"./p-BqFb60iF.js";var o,i;!function(s){s.ProductDetail="product.single",s.Cart="cart"}(o||(o={})),function(s){s.Conditional="conditional",s.PercentageOrFixed="fixed",s.DiscountsTable="discounts_table",s.Bank="bank",s.BuyXGetY="buy_x_get_y",s.SpecialPrice="special_price",s.Percentage="percentage",s.FixedAmount="fixed_amount"}(i||(i={}));const r=class{constructor(e){s(this,e),this.productCardComponent="salla-product-card",this.offersList=[],this.canRender=!1,this.showOffer=salla.config.get("store.settings.product.show_special_offers"),this.showAllOffersModal=!1,this.showProductsModal=!1,this.selectedOfferProducts=[],this.collapsedOffers={},this.expandedCategories={},this.productsLoaded=!1,this.offer_with_price_text=salla.lang.get("pages.offer.with_price",{price:""}),this.with_discount_text=salla.lang.get("pages.products.with_a_discount"),this.product_discount_text=salla.lang.get("pages.products.discount"),this.special_offer_text=salla.lang.get("pages.products.special_offer"),this.buy_quantity_text=s=>salla.lang.get("pages.offer.buy_quantity",{quantity:s}),this.products_link_text=salla.lang.get("pages.offer.included_products","المنتجات المشمولة"),this.min_spend_text=(s,e)=>salla.lang.get("pages.offer.min_spend_amount",{amount:s,currency:e},`بحد أدنى ${s} ${e} من مبلغ الشراء`),this.min_items_text=s=>salla.lang.get("pages.offer.min_items",{items:s},`بحد أدنى ${s} منتجات`),this.product_text=salla.lang.get("common.elements.product","منتج"),salla.lang.onLoaded((()=>{this.offer_with_price_text=salla.lang.get("pages.offer.with_price"),this.with_discount_text=salla.lang.get("pages.products.with_a_discount"),this.product_discount_text=salla.lang.get("pages.products.discount"),this.special_offer_text=salla.lang.get("pages.products.special_offer"),this.buy_quantity_text(0),this.products_link_text=salla.lang.get("pages.offer.included_products","المنتجات المشمولة"),this.min_spend_text=(s,e)=>salla.lang.get("pages.offer.min_spend_amount",{amount:s,currency:e},`بحد أدنى ${s} ${e} من مبلغ الشراء`),this.min_items_text=s=>salla.lang.get("pages.offer.min_items",{items:s},`بحد أدنى ${s} منتجات`),this.product_text=salla.lang.get("common.elements.product","منتج")})),salla.onReady((()=>{this.currentPage=salla.config.get("page.slug");const s=salla.config.get("currencies")||{},e=salla.config.get("user.currency_code");this.userCurrency=s[e]||{symbol:"",code:e||"SAR",name:""}}))}async getEndpointByPageName(){return this.currentPage==o.Cart?`offers/cart/${await Salla.cart.getCurrentCartId()}`:this.currentPage==o.ProductDetail?`offers/product/${salla.config.get("page.id")}`:"offers"}emitPromotionViewed(){if(!(this.offersList.length&&this.canRender&&this.showOffer))return;const s=this.offersList.slice(0,5).map(((s,e)=>({id:s.id,name:s.title,creative:s.description||"",position:e+1})));salla.event.emit("salla::offer.promotion.viewed",s)}emitPromotionClicked(s,e=1){if(!(this.offersList.length&&this.canRender&&this.showOffer))return;const t=s||this.offersList[0];salla.event.emit("salla::offer.promotion.clicked",[{id:t.id,name:t.title,creative:t.description||"",position:e}])}componentWillLoad(){return this.hasCustomComponent=!!customElements.get(this.productCardComponent),new Promise((s=>salla.onReady(s))).then((()=>{if(this.showOffer=!salla.url.is_page("product.single")||salla.config.get("store.settings.product.show_special_offers"),!this.showOffer)throw new Error("Merchant disabled showing the offers on product page")})).then((async()=>this.currentPage==o.Cart?salla.api.cart.offers():salla.api.request(await this.getEndpointByPageName()))).then((async s=>{if(!(this.offersList=s.data).length)throw new Error("salla-offers:: There is no offers!");if(this.offersList=this.offersList.filter((s=>[i.SpecialPrice,i.Bank,i.BuyXGetY,i.DiscountsTable,i.PercentageOrFixed,i.Percentage,i.FixedAmount].includes(s.type))),!this.offersList.length)throw new Error("salla-offers:: No supported offer types found!");let e=null;this.offersList.some((s=>{const e=s.details;return"category"===e.apply_to&&e.targets||"categories"===e.apply_to&&e.targets||s.type===i.BuyXGetY&&("categories"===e.get?.source||"category"===e.get?.source)}))&&(e=(await salla.product.api.categories()).data);const t=new Set;for(const s of this.offersList){const e=s.details;"product"!==e.apply_to&&"products"!==e.apply_to||!e.targets||e.targets.forEach((s=>t.add(s))),s.type===i.BuyXGetY&&"products"===e.get?.source&&e.get?.source_value&&e.get.source_value.forEach((s=>t.add(s))),s.type!==i.BuyXGetY||"products"!==e.buy?.source&&"product"!==e.buy?.source||!e.buy?.source_value||e.buy.source_value.forEach((s=>t.add(s)))}let o={};if(t.size>0)try{const s=await salla.product.api.fetch({source:"selected",source_value:Array.from(t)});o=Object.fromEntries(s.data.map((s=>[s.id,s])))}catch(s){o={}}for(const s of this.offersList){const t=s.details;if(("category"===t.apply_to&&t.targets||"categories"===t.apply_to&&t.targets)&&e&&(t.categories=this.findCategories(e,t.targets)),"product"!==t.apply_to&&"products"!==t.apply_to||!t.targets||(t.products=t.targets.map((s=>o[s])).filter(Boolean)),"brand"===t.apply_to&&t.targets&&(t.brands=t.targets),"tag"===t.apply_to&&t.targets&&(t.tags=t.targets),s.type===i.BuyXGetY&&t.get){const s=t.get;"products"===s.source&&s.source_value?s.products=s.source_value.map((s=>o[s])).filter(Boolean):("categories"===s.source||"category"===s.source)&&e&&s.source_value&&(s.categories=this.findCategories(e,s.source_value),t.categories=s.categories)}if(s.type===i.BuyXGetY&&t.buy){const s=t.buy;"products"!==s.source&&"product"!==s.source||!s.source_value||(s.products=s.source_value.map((s=>o[s])).filter(Boolean))}}return this.offersList})).then((()=>{this.canRender=!0})).catch((s=>{salla.logger.warn(s)}))}componentDidLoad(){let s=this.host.querySelector(".s-slider-block__title-nav");s?.classList.add("s-offer-bank-payment-nav"),this.emitPromotionViewed()}findCategories(s,e){let t=[];for(const o of s)e.includes(o.id_||o.id)&&t.push(o),o.sub_categories?.length>0&&(t=t.concat(this.findCategories(o.sub_categories,e)));return t}render(){if(!this.offersList.length||!this.canRender||!this.showOffer)return null;const s=salla.lang.get("pages.offer.offers_title","عروض المنتج"),t=salla.lang.get("pages.offer.offers_subtitle","احصل على المنتج بسعر مخفض مع أفضل العروض");return[e("div",{class:"s-offer-wrapper"},e("salla-slider",{type:"carousel",id:"offers-slider","block-title":s,"block-subTitle":t,"show-controls":this.offersList.length>1},e("div",{slot:"items"},this.offersList.slice(0,5).map(((s,e)=>this.renderOfferCard(s,e+1))),this.offersList.length>5&&this.renderShowMoreCard()))),this.renderAllOffersModal(),this.renderProductsModal()]}renderShowMoreCard(){return e("div",{class:"s-offer-slide-one-fourth swiper-slide",onClick:s=>{s.preventDefault(),s.stopPropagation(),this.openAllOffersModal()}},e("div",{class:"s-offer-card s-offer-show-more-card"},e("i",{class:"sicon-add s-offer-show-more-icon"}),e("h3",{class:"s-offer-show-more-title"},salla.lang.get("pages.offer.show_more_offers","عرض المزيد من العروض"))))}openAllOffersModal(){this.showAllOffersModal=!0}closeAllOffersModal(){this.showAllOffersModal=!1}closeProductsModal(){this.showProductsModal=!1,this.selectedOfferProducts=[],this.productsLoaded=!1}handleAccordionToggle(s,e){this.collapsedOffers={...this.collapsedOffers,[s]:e}}getOfferProducts(s){const e=s.details;return e.products&&e.products.length>0?e.products:s.type===i.BuyXGetY&&e.get?.products?e.get.products:[]}renderProductsLinkForModalCard(s,t){const o=this.getOfferProducts(s);return o&&0!==o.length?e("div",{class:"s-offer-products-link",onClick:s=>{s.stopPropagation(),this.selectedOfferProducts=o,this.showProductsModal=!0}},e("span",{class:"s-offer-products-link-text"},this.products_link_text),t&&e("i",{class:"sicon-keyboard_arrow_down s-offer-products-link-icon"})):null}renderAllOffersModal(){return e("salla-drawer",{visible:this.showAllOffersModal,position:"right",width:"md","no-padding":!0,"drawer-title":salla.lang.get("pages.offer.all_offers_title","جميع العروض"),onDrawerVisibilityChanged:s=>!s.detail&&this.closeAllOffersModal()},e("div",{class:"s-offer-drawer-content"},this.offersList.map(((s,e)=>this.renderModalOfferCard(s,e+1)))))}renderProductsModal(){return e("salla-drawer",{visible:this.showProductsModal,width:"md",position:"right","no-padding":!0,"drawer-title":this.products_link_text,onDrawerVisibilityChanged:s=>!s.detail&&this.closeProductsModal()},e("div",{class:"s-offer-products-drawer-content"},this.selectedOfferProducts?.length>0?e("div",null,!this.productsLoaded&&e("div",{class:"flex items-center justify-center p-8"},e("salla-loading",{size:"24"})),e("salla-products-list",{source:"selected","source-value":JSON.stringify(this.selectedOfferProducts.map((s=>s.id))),"product-card-component":this.productCardComponent,"horizontal-cards":!0,"compact-cards":!0,includes:["images"],onProductsFetched:()=>this.productsLoaded=!0})):e("div",{class:"p-4 text-center text-gray-500"},salla.lang.get("blocks.products.no_products_found","لا توجد منتجات"))))}renderModalOfferCard(s,t=1){const o=this.getOfferProducts(s),r=o&&o.length>0,a=!1!==this.collapsedOffers[s.id];return e("div",{class:"s-offer-drawer-card"},e("div",{class:"s-offer-card-main",onClick:()=>this.emitPromotionClicked(s,t)},e("div",{class:"s-offer-card-icon"},this.getOfferIcon(s.type)),e("div",{class:"s-offer-card-content"},e("h3",{class:"s-offer-card-title",title:s.title},s.title),s.description&&e("p",{class:"s-offer-card-description"},s.description),s.type===i.DiscountsTable?e("div",{class:"s-offer-card-details"},this.renderDiscountTableOfferContent(s)):s.type===i.PercentageOrFixed||s.type===i.Percentage||s.type===i.FixedAmount?e("div",{class:"s-offer-card-details"},this.renderPercentageOrFixedOfferContent(s),this.renderOfferCategories(s),this.renderOfferBrands(s),this.renderOfferTags(s)):e("div",{class:"s-offer-card-details"},this.renderOfferCategories(s),this.renderOfferBrands(s),this.renderOfferTags(s)))),r&&e("salla-accordion",{collapsed:a,collapsible:!0,size:"sm",onClick:s=>s.stopPropagation(),onAccordionToggle:e=>this.handleAccordionToggle(s.id,e.detail.payload.collapsed)},e("salla-accordion-head",{collapsible:!0,collapsed:a},e("div",{slot:"title",class:"s-offer-products-thumbnails"},e("span",{class:"s-offer-products-title"},this.products_link_text,e("i",{class:`sicon-keyboard_arrow_${a?"down":"up"} s-offer-products-link-icon`})),e("div",{class:"s-offer-products-thumbnails-stack"},o.slice(0,3).map(((s,t)=>e("div",{class:"s-offer-product-thumbnail",style:{zIndex:`${t+1}`}},e("img",{src:s.thumbnail||s.image?.url||salla.url.cdn("images/s-empty.png"),alt:s.name})))),o.length>3&&e("div",{class:"s-offer-products-more-count",style:{zIndex:"7"}},"+",o.length-3)))),e("salla-accordion-body",null,e("div",{class:"s-offer-products-content"},e("salla-products-list",{source:"selected","source-value":JSON.stringify(o.map((s=>s.id))),"product-card-component":this.productCardComponent,"horizontal-cards":!0,"compact-cards":!0,includes:["images"]})))))}renderOfferCard(s,t=1){return e("div",{class:"s-offer-slide-one-fourth swiper-slide",onClick:()=>this.emitPromotionClicked(s,t)},e("div",{class:"s-offer-card"},e("div",{class:"s-offer-card-icon"},this.getOfferIcon(s.type)),e("div",{class:"s-offer-card-content"},e("h3",{class:"s-offer-card-title",title:s.title},s.title),s.description&&e("p",{class:"s-offer-card-description"},s.description),e("div",{class:"s-offer-card-details"},s.type===i.DiscountsTable?this.renderDiscountTableOfferContent(s):s.type===i.PercentageOrFixed||s.type===i.Percentage||s.type===i.FixedAmount?[this.renderPercentageOrFixedOfferContent(s),this.renderOfferCategories(s),this.renderOfferBrands(s),this.renderOfferTags(s)]:[this.renderOfferCategories(s),this.renderOfferBrands(s),this.renderOfferTags(s)],this.renderProductsLinkForModalCard(s,!1)))))}getOfferIcon(s){return e("i",{class:{[i.DiscountsTable]:"sicon-discount-calculator",[i.Bank]:"sicon-bank",[i.SpecialPrice]:"sicon-fire",[i.BuyXGetY]:"sicon-gift",[i.PercentageOrFixed]:"sicon-special-discount",[i.Percentage]:"sicon-special-discount",[i.FixedAmount]:"sicon-special-discount"}[s]||"sicon-discount"})}renderDiscountTableOfferContent(s){const t=s.details.discounts||[];return t.length?e("div",null,e("div",{class:"s-offer-card-description"},salla.lang.get("pages.offer.discount_table_subtitle","وفر اكتر بشراء منتجات أكثر")),e("table",{class:"s-offer-discount-table"},e("tbody",null,this.groupDiscountsByRows(t,3).map(((s,t)=>e("tr",{key:t},s.map(((s,t)=>e("td",{key:t},e("div",{class:"s-offer-discount-percentage"},s.percentage,"%"),e("div",{class:"s-offer-discount-condition"},this.formatDiscountCondition(s))))))))))):null}renderPercentageOrFixedOfferContent(s){const t=s.details;return t.discount_value||t.min_spend>0||t.min_items>0?e("div",{class:"s-offer-percentage-fixed-content"},t.min_spend>0&&e("div",{class:"s-offer-min-spend"},this.min_spend_text(t.min_spend,this.userCurrency?.symbol||"")),t.min_items>0&&e("div",{class:"s-offer-min-items"},this.min_items_text(t.min_items))):null}groupDiscountsByRows(s,e){const t=[];for(let o=0;o<s.length;o+=e)t.push(s.slice(o,o+e));return t}formatDiscountCondition(s){return s.discounted_amount?`${s.discounted_amount} ${this.userCurrency?.symbol||""}`:null!=s.quantity?this.buy_quantity_text(s.quantity):`1 ${this.product_text}`}renderOfferCategories(s){const t=s.details;let o=t.categories||[];if(s.type===i.BuyXGetY&&t.get?.categories&&(o=t.get.categories),!o.length)return null;const r=this.expandedCategories[s.id],a=o.length>3,l=r?o:o.slice(0,3);return e("div",{class:"s-offer-categories"},e("div",{class:"s-offer-categories-list"},l.map(((s,t)=>e("a",{key:t,class:"s-offer-category-item",href:s.url||salla.url.create("categories",s.id||s.id_)},s.name))),a&&e("span",{class:"s-offer-categories-toggle",onClick:e=>{e.preventDefault(),e.stopPropagation(),this.toggleCategoryExpansion(s.id)}},r?e("span",null,e("i",{class:"sicon-keyboard_arrow_up"})," ",salla.lang.get("common.elements.hide","إخفاء")):e("span",null,salla.lang.get("common.elements.show","عرض")," ","+"+(o.length-3)," ",e("i",{class:"sicon-keyboard_arrow_down"})))))}renderOfferBrands(s){const t=s.details.brands||[];if(!t.length)return null;const o=this.expandedCategories[s.id],i=t.length>3,r=o?t:t.slice(0,3);return e("div",{class:"s-offer-categories"},e("div",{class:"s-offer-categories-list"},r.map(((s,t)=>e("a",{key:t,class:"s-offer-category-item",href:s.url},s.name))),i&&e("span",{class:"s-offer-categories-toggle",onClick:e=>{e.preventDefault(),e.stopPropagation(),this.toggleCategoryExpansion(s.id)}},o?e("span",null,e("i",{class:"sicon-keyboard_arrow_up"})," ",salla.lang.get("common.elements.hide","إخفاء")):e("span",null,salla.lang.get("common.elements.show","عرض")," ","+"+(t.length-3)," ",e("i",{class:"sicon-keyboard_arrow_down"})))))}renderOfferTags(s){const t=s.details.tags||[];if(!t.length)return null;const o=this.expandedCategories[s.id],i=t.length>3,r=o?t:t.slice(0,3);return e("div",{class:"s-offer-categories"},e("div",{class:"s-offer-categories-list"},r.map(((s,t)=>e("a",{key:t,class:"s-offer-category-item",href:s.url||salla.url.create("tags",s.id)},s.name))),i&&e("span",{class:"s-offer-categories-toggle",onClick:e=>{e.preventDefault(),e.stopPropagation(),this.toggleCategoryExpansion(s.id)}},o?e("span",null,e("i",{class:"sicon-keyboard_arrow_up"})," ",salla.lang.get("common.elements.hide","إخفاء")):e("span",null,salla.lang.get("common.elements.show","عرض")," ","+"+(t.length-3)," ",e("i",{class:"sicon-keyboard_arrow_down"})))))}toggleCategoryExpansion(s){this.expandedCategories={...this.expandedCategories,[s]:!this.expandedCategories[s]}}get host(){return t(this)}};r.style=":host .s-drawer-close:where([dir=rtl],[dir=rtl] *){left:0}";export{r as salla_offer}
|
|
4
|
+
import{r as s,h as e,a as t}from"./p-BFfD9GlY.js";var o,i;!function(s){s.ProductDetail="product.single",s.Cart="cart"}(o||(o={})),function(s){s.Conditional="conditional",s.PercentageOrFixed="fixed",s.DiscountsTable="discounts_table",s.Bank="bank",s.BuyXGetY="buy_x_get_y",s.SpecialPrice="special_price",s.Percentage="percentage",s.FixedAmount="fixed_amount"}(i||(i={}));const r=class{constructor(e){s(this,e),this.productCardComponent="salla-product-card",this.offersList=[],this.canRender=!1,this.showOffer=salla.config.get("store.settings.product.show_special_offers"),this.showAllOffersModal=!1,this.showProductsModal=!1,this.selectedOfferProducts=[],this.collapsedOffers={},this.expandedCategories={},this.productsLoaded=!1,this.offer_with_price_text=salla.lang.get("pages.offer.with_price",{price:""}),this.with_discount_text=salla.lang.get("pages.products.with_a_discount"),this.product_discount_text=salla.lang.get("pages.products.discount"),this.special_offer_text=salla.lang.get("pages.products.special_offer"),this.buy_quantity_text=s=>salla.lang.get("pages.offer.buy_quantity",{quantity:s}),this.products_link_text=salla.lang.get("pages.offer.included_products","المنتجات المشمولة"),this.min_spend_text=(s,e)=>salla.lang.get("pages.offer.min_spend_amount",{amount:s,currency:e},`بحد أدنى ${s} ${e} من مبلغ الشراء`),this.min_items_text=s=>salla.lang.get("pages.offer.min_items",{items:s},`بحد أدنى ${s} منتجات`),this.product_text=salla.lang.get("common.elements.product","منتج"),salla.lang.onLoaded((()=>{this.offer_with_price_text=salla.lang.get("pages.offer.with_price"),this.with_discount_text=salla.lang.get("pages.products.with_a_discount"),this.product_discount_text=salla.lang.get("pages.products.discount"),this.special_offer_text=salla.lang.get("pages.products.special_offer"),this.buy_quantity_text(0),this.products_link_text=salla.lang.get("pages.offer.included_products","المنتجات المشمولة"),this.min_spend_text=(s,e)=>salla.lang.get("pages.offer.min_spend_amount",{amount:s,currency:e},`بحد أدنى ${s} ${e} من مبلغ الشراء`),this.min_items_text=s=>salla.lang.get("pages.offer.min_items",{items:s},`بحد أدنى ${s} منتجات`),this.product_text=salla.lang.get("common.elements.product","منتج")})),salla.onReady((()=>{this.currentPage=salla.config.get("page.slug");const s=salla.config.get("currencies")||{},e=salla.config.get("user.currency_code");this.userCurrency=s[e]||{symbol:"",code:e||"SAR",name:""}}))}async getEndpointByPageName(){return this.currentPage==o.Cart?`offers/cart/${await Salla.cart.getCurrentCartId()}`:this.currentPage==o.ProductDetail?`offers/product/${salla.config.get("page.id")}`:"offers"}emitPromotionViewed(){if(!(this.offersList.length&&this.canRender&&this.showOffer))return;const s=this.offersList.slice(0,5).map(((s,e)=>({id:s.id,name:s.title,creative:s.description||"",position:e+1})));salla.event.emit("salla::offer.promotion.viewed",s)}emitPromotionClicked(s,e=1){if(!(this.offersList.length&&this.canRender&&this.showOffer))return;const t=s||this.offersList[0];salla.event.emit("salla::offer.promotion.clicked",[{id:t.id,name:t.title,creative:t.description||"",position:e}])}componentWillLoad(){return this.hasCustomComponent=!!customElements.get(this.productCardComponent),new Promise((s=>salla.onReady(s))).then((()=>{if(this.showOffer=!salla.url.is_page("product.single")||salla.config.get("store.settings.product.show_special_offers"),!this.showOffer)throw new Error("Merchant disabled showing the offers on product page")})).then((async()=>this.currentPage==o.Cart?salla.api.cart.offers():salla.api.request(await this.getEndpointByPageName()))).then((async s=>{if(!(this.offersList=s.data).length)throw new Error("salla-offers:: There is no offers!");if(this.offersList=this.offersList.filter((s=>[i.SpecialPrice,i.Bank,i.BuyXGetY,i.DiscountsTable,i.PercentageOrFixed,i.Percentage,i.FixedAmount].includes(s.type))),!this.offersList.length)throw new Error("salla-offers:: No supported offer types found!");let e=null;this.offersList.some((s=>{const e=s.details;return"category"===e.apply_to&&e.targets||"categories"===e.apply_to&&e.targets||s.type===i.BuyXGetY&&("categories"===e.get?.source||"category"===e.get?.source)}))&&(e=(await salla.product.api.categories()).data);const t=new Set;for(const s of this.offersList){const e=s.details;"product"!==e.apply_to&&"products"!==e.apply_to||!e.targets||e.targets.forEach((s=>t.add(s))),s.type===i.BuyXGetY&&"products"===e.get?.source&&e.get?.source_value&&e.get.source_value.forEach((s=>t.add(s))),s.type!==i.BuyXGetY||"products"!==e.buy?.source&&"product"!==e.buy?.source||!e.buy?.source_value||e.buy.source_value.forEach((s=>t.add(s)))}let o={};if(t.size>0)try{const s=await salla.product.api.fetch({source:"selected",source_value:Array.from(t)});o=Object.fromEntries(s.data.map((s=>[s.id,s])))}catch(s){o={}}for(const s of this.offersList){const t=s.details;if(("category"===t.apply_to&&t.targets||"categories"===t.apply_to&&t.targets)&&e&&(t.categories=this.findCategories(e,t.targets)),"product"!==t.apply_to&&"products"!==t.apply_to||!t.targets||(t.products=t.targets.map((s=>o[s])).filter(Boolean)),"brand"===t.apply_to&&t.targets&&(t.brands=t.targets),"tag"===t.apply_to&&t.targets&&(t.tags=t.targets),s.type===i.BuyXGetY&&t.get){const s=t.get;"products"===s.source&&s.source_value?s.products=s.source_value.map((s=>o[s])).filter(Boolean):("categories"===s.source||"category"===s.source)&&e&&s.source_value&&(s.categories=this.findCategories(e,s.source_value),t.categories=s.categories)}if(s.type===i.BuyXGetY&&t.buy){const s=t.buy;"products"!==s.source&&"product"!==s.source||!s.source_value||(s.products=s.source_value.map((s=>o[s])).filter(Boolean))}}return this.offersList})).then((()=>{this.canRender=!0})).catch((s=>{salla.logger.warn(s)}))}componentDidLoad(){let s=this.host.querySelector(".s-slider-block__title-nav");s?.classList.add("s-offer-bank-payment-nav"),this.emitPromotionViewed()}findCategories(s,e){let t=[];for(const o of s)e.includes(o.id_||o.id)&&t.push(o),o.sub_categories?.length>0&&(t=t.concat(this.findCategories(o.sub_categories,e)));return t}render(){if(!this.offersList.length||!this.canRender||!this.showOffer)return null;const s=salla.lang.get("pages.offer.offers_title","عروض المنتج"),t=salla.lang.get("pages.offer.offers_subtitle","احصل على المنتج بسعر مخفض مع أفضل العروض");return[e("div",{class:"s-offer-wrapper"},e("salla-slider",{type:"carousel",id:"offers-slider","block-title":s,"block-subTitle":t,"show-controls":this.offersList.length>1},e("div",{slot:"items"},this.offersList.slice(0,5).map(((s,e)=>this.renderOfferCard(s,e+1))),this.offersList.length>5&&this.renderShowMoreCard()))),this.renderAllOffersModal(),this.renderProductsModal()]}renderShowMoreCard(){return e("div",{class:"s-offer-slide-one-fourth swiper-slide",onClick:s=>{s.preventDefault(),s.stopPropagation(),this.openAllOffersModal()}},e("div",{class:"s-offer-card s-offer-show-more-card"},e("i",{class:"sicon-add s-offer-show-more-icon"}),e("h3",{class:"s-offer-show-more-title"},salla.lang.get("pages.offer.show_more_offers","عرض المزيد من العروض"))))}openAllOffersModal(){this.showAllOffersModal=!0}closeAllOffersModal(){this.showAllOffersModal=!1}closeProductsModal(){this.showProductsModal=!1,this.selectedOfferProducts=[],this.productsLoaded=!1}handleAccordionToggle(s,e){this.collapsedOffers={...this.collapsedOffers,[s]:e}}getOfferProducts(s){const e=s.details;return e.products&&e.products.length>0?e.products:s.type===i.BuyXGetY&&e.get?.products?e.get.products:[]}renderProductsLinkForModalCard(s,t){const o=this.getOfferProducts(s);return o&&0!==o.length?e("div",{class:"s-offer-products-link",onClick:s=>{s.stopPropagation(),this.selectedOfferProducts=o,this.showProductsModal=!0}},e("span",{class:"s-offer-products-link-text"},this.products_link_text),t&&e("i",{class:"sicon-keyboard_arrow_down s-offer-products-link-icon"})):null}renderAllOffersModal(){return e("salla-drawer",{visible:this.showAllOffersModal,position:"right",width:"md","no-padding":!0,"drawer-title":salla.lang.get("pages.offer.all_offers_title","جميع العروض"),onDrawerVisibilityChanged:s=>!s.detail&&this.closeAllOffersModal()},e("div",{class:"s-offer-drawer-content"},this.offersList.map(((s,e)=>this.renderModalOfferCard(s,e+1)))))}renderProductsModal(){return e("salla-drawer",{visible:this.showProductsModal,width:"md",position:"right","no-padding":!0,"drawer-title":this.products_link_text,onDrawerVisibilityChanged:s=>!s.detail&&this.closeProductsModal()},e("div",{class:"s-offer-products-drawer-content"},this.selectedOfferProducts?.length>0?e("div",null,!this.productsLoaded&&e("div",{class:"flex items-center justify-center p-8"},e("salla-loading",{size:"24"})),e("salla-products-list",{source:"selected","source-value":JSON.stringify(this.selectedOfferProducts.map((s=>s.id))),"product-card-component":this.productCardComponent,"horizontal-cards":!0,"compact-cards":!0,includes:["images"],onProductsFetched:()=>this.productsLoaded=!0})):e("div",{class:"p-4 text-center text-gray-500"},salla.lang.get("blocks.products.no_products_found","لا توجد منتجات"))))}renderModalOfferCard(s,t=1){const o=this.getOfferProducts(s),r=o&&o.length>0,a=!1!==this.collapsedOffers[s.id];return e("div",{class:"s-offer-drawer-card"},e("div",{class:"s-offer-card-main",onClick:()=>this.emitPromotionClicked(s,t)},e("div",{class:"s-offer-card-icon"},this.getOfferIcon(s.type)),e("div",{class:"s-offer-card-content"},e("h3",{class:"s-offer-card-title",title:s.title},s.title),s.description&&e("p",{class:"s-offer-card-description"},s.description),s.type===i.DiscountsTable?e("div",{class:"s-offer-card-details"},this.renderDiscountTableOfferContent(s)):s.type===i.PercentageOrFixed||s.type===i.Percentage||s.type===i.FixedAmount?e("div",{class:"s-offer-card-details"},this.renderPercentageOrFixedOfferContent(s),this.renderOfferCategories(s),this.renderOfferBrands(s),this.renderOfferTags(s)):e("div",{class:"s-offer-card-details"},this.renderOfferCategories(s),this.renderOfferBrands(s),this.renderOfferTags(s)))),r&&e("salla-accordion",{collapsed:a,collapsible:!0,size:"sm",onClick:s=>s.stopPropagation(),onAccordionToggle:e=>this.handleAccordionToggle(s.id,e.detail.payload.collapsed)},e("salla-accordion-head",{collapsible:!0,collapsed:a},e("div",{slot:"title",class:"s-offer-products-thumbnails"},e("span",{class:"s-offer-products-title"},this.products_link_text,e("i",{class:`sicon-keyboard_arrow_${a?"down":"up"} s-offer-products-link-icon`})),e("div",{class:"s-offer-products-thumbnails-stack"},o.slice(0,3).map(((s,t)=>e("div",{class:"s-offer-product-thumbnail",style:{zIndex:`${t+1}`}},e("img",{src:s.thumbnail||s.image?.url||salla.url.cdn("images/s-empty.png"),alt:s.name})))),o.length>3&&e("div",{class:"s-offer-products-more-count",style:{zIndex:"7"}},"+",o.length-3)))),e("salla-accordion-body",null,e("div",{class:"s-offer-products-content"},e("salla-products-list",{source:"selected","source-value":JSON.stringify(o.map((s=>s.id))),"product-card-component":this.productCardComponent,"horizontal-cards":!0,"compact-cards":!0,includes:["images"]})))))}renderOfferCard(s,t=1){return e("div",{class:"s-offer-slide-one-fourth swiper-slide",onClick:()=>this.emitPromotionClicked(s,t)},e("div",{class:"s-offer-card"},e("div",{class:"s-offer-card-icon"},this.getOfferIcon(s.type)),e("div",{class:"s-offer-card-content"},e("h3",{class:"s-offer-card-title",title:s.title},s.title),s.description&&e("p",{class:"s-offer-card-description"},s.description),e("div",{class:"s-offer-card-details"},s.type===i.DiscountsTable?this.renderDiscountTableOfferContent(s):s.type===i.PercentageOrFixed||s.type===i.Percentage||s.type===i.FixedAmount?[this.renderPercentageOrFixedOfferContent(s),this.renderOfferCategories(s),this.renderOfferBrands(s),this.renderOfferTags(s)]:[this.renderOfferCategories(s),this.renderOfferBrands(s),this.renderOfferTags(s)],this.renderProductsLinkForModalCard(s,!1)))))}getOfferIcon(s){return e("i",{class:{[i.DiscountsTable]:"sicon-discount-calculator",[i.Bank]:"sicon-bank",[i.SpecialPrice]:"sicon-fire",[i.BuyXGetY]:"sicon-gift",[i.PercentageOrFixed]:"sicon-special-discount",[i.Percentage]:"sicon-special-discount",[i.FixedAmount]:"sicon-special-discount"}[s]||"sicon-discount"})}renderDiscountTableOfferContent(s){const t=s.details.discounts||[];return t.length?e("div",null,e("div",{class:"s-offer-card-description"},salla.lang.get("pages.offer.discount_table_subtitle","وفر اكتر بشراء منتجات أكثر")),e("table",{class:"s-offer-discount-table"},e("tbody",null,this.groupDiscountsByRows(t,3).map(((s,t)=>e("tr",{key:t},s.map(((s,t)=>e("td",{key:t},e("div",{class:"s-offer-discount-percentage"},s.percentage,"%"),e("div",{class:"s-offer-discount-condition"},this.formatDiscountCondition(s))))))))))):null}renderPercentageOrFixedOfferContent(s){const t=s.details;return t.discount_value||t.min_spend>0||t.min_items>0?e("div",{class:"s-offer-percentage-fixed-content"},t.min_spend>0&&e("div",{class:"s-offer-min-spend"},this.min_spend_text(t.min_spend,this.userCurrency?.symbol||"")),t.min_items>0&&e("div",{class:"s-offer-min-items"},this.min_items_text(t.min_items))):null}groupDiscountsByRows(s,e){const t=[];for(let o=0;o<s.length;o+=e)t.push(s.slice(o,o+e));return t}formatDiscountCondition(s){return s.discounted_amount?`${s.discounted_amount} ${this.userCurrency?.symbol||""}`:null!=s.quantity?this.buy_quantity_text(s.quantity):`1 ${this.product_text}`}renderOfferCategories(s){const t=s.details;let o=t.categories||[];if(s.type===i.BuyXGetY&&t.get?.categories&&(o=t.get.categories),!o.length)return null;const r=this.expandedCategories[s.id],a=o.length>3,l=r?o:o.slice(0,3);return e("div",{class:"s-offer-categories"},e("div",{class:"s-offer-categories-list"},l.map(((s,t)=>e("a",{key:t,class:"s-offer-category-item",href:s.url||salla.url.create("categories",s.id||s.id_)},s.name))),a&&e("span",{class:"s-offer-categories-toggle",onClick:e=>{e.preventDefault(),e.stopPropagation(),this.toggleCategoryExpansion(s.id)}},r?e("span",null,e("i",{class:"sicon-keyboard_arrow_up"})," ",salla.lang.get("common.elements.hide","إخفاء")):e("span",null,salla.lang.get("common.elements.show","عرض")," ","+"+(o.length-3)," ",e("i",{class:"sicon-keyboard_arrow_down"})))))}renderOfferBrands(s){const t=s.details.brands||[];if(!t.length)return null;const o=this.expandedCategories[s.id],i=t.length>3,r=o?t:t.slice(0,3);return e("div",{class:"s-offer-categories"},e("div",{class:"s-offer-categories-list"},r.map(((s,t)=>e("a",{key:t,class:"s-offer-category-item",href:s.url},s.name))),i&&e("span",{class:"s-offer-categories-toggle",onClick:e=>{e.preventDefault(),e.stopPropagation(),this.toggleCategoryExpansion(s.id)}},o?e("span",null,e("i",{class:"sicon-keyboard_arrow_up"})," ",salla.lang.get("common.elements.hide","إخفاء")):e("span",null,salla.lang.get("common.elements.show","عرض")," ","+"+(t.length-3)," ",e("i",{class:"sicon-keyboard_arrow_down"})))))}renderOfferTags(s){const t=s.details.tags||[];if(!t.length)return null;const o=this.expandedCategories[s.id],i=t.length>3,r=o?t:t.slice(0,3);return e("div",{class:"s-offer-categories"},e("div",{class:"s-offer-categories-list"},r.map(((s,t)=>e("a",{key:t,class:"s-offer-category-item",href:s.url||salla.url.create("tags",s.id)},s.name))),i&&e("span",{class:"s-offer-categories-toggle",onClick:e=>{e.preventDefault(),e.stopPropagation(),this.toggleCategoryExpansion(s.id)}},o?e("span",null,e("i",{class:"sicon-keyboard_arrow_up"})," ",salla.lang.get("common.elements.hide","إخفاء")):e("span",null,salla.lang.get("common.elements.show","عرض")," ","+"+(t.length-3)," ",e("i",{class:"sicon-keyboard_arrow_down"})))))}toggleCategoryExpansion(s){this.expandedCategories={...this.expandedCategories,[s]:!this.expandedCategories[s]}}get host(){return t(this)}};r.style=":host .s-drawer-close:where([dir=rtl],[dir=rtl] *){left:0}";export{r as salla_offer}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as e,h as a,H as s}from"./p-
|
|
4
|
+
import{r as e,h as a,H as s}from"./p-BFfD9GlY.js";const c=class{constructor(a){e(this,a),this.translationLoaded=!1,this.icon='\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>inbox</title>\n<path d="M31.984 19.797l-2.667-17.333c-0.1-0.651-0.659-1.131-1.317-1.131h-24c-0.659 0-1.217 0.48-1.317 1.131l-2.667 17.333c-0.011 0.067-0.016 0.135-0.016 0.203v6.667c0 2.205 1.795 4 4 4h24c2.205 0 4-1.795 4-4v-6.667c0-0.068-0.005-0.136-0.016-0.203zM5.144 4h21.712l2.256 14.667h-9.112c-0.736 0-1.333 0.596-1.333 1.333 0 1.471-1.196 2.667-2.667 2.667s-2.667-1.196-2.667-2.667c0-0.737-0.597-1.333-1.333-1.333h-9.112zM29.333 26.667c0 0.736-0.599 1.333-1.333 1.333h-24c-0.735 0-1.333-0.597-1.333-1.333v-5.333h8.168c0.593 2.299 2.684 4 5.165 4s4.571-1.701 5.165-4h8.168z"></path>\n</svg>\n',this.alignment="left",this.iconSize="md",salla.lang.onLoaded((()=>{this.translationLoaded=!0}))}alignmentClass(){return{"s-placeholder-wrapper":!0,"s-placeholder-align-left":"left"==this.alignment,"s-placeholder-align-center":"center"==this.alignment,"s-placeholder-align-right":"right"==this.alignment}}render(){return a(s,{key:"f2fb77ca80d28fcc5f5505f4588bef72a4a26690",class:this.alignmentClass()},a("div",{key:"b2a1b41baf2a78087fd1f41f2f7244a36eb20846",class:`s-placeholder-icon s-placeholder-icon-${this.iconSize}`,innerHTML:this.icon}),a("div",{key:"65d106c0700890b7033ffb17ad7497db11cbdc65",class:"s-placeholder-title"},a("slot",{key:"aaa421d74b1c1c7e506adaee5efd6e7e1fe367e9",name:"title"},a("span",{key:"5e8232ebceffa33a1a997faf302e66f7f7d6112d"},salla.lang.get("common.elements.no_options")))),a("div",{key:"47f7267ff9aef10baff8a5d555cd116c569790c9",class:"s-placeholder-description"},a("slot",{key:"8f54838b8258e2f2a42a0da120186a9a7b71503f",name:"description"},a("span",{key:"6a5b79c1a69449ea4cd20d96f6149dfe89425ec3"},salla.lang.get("common.errors.empty_results")))))}};c.style="";export{c as salla_placeholder}
|
|
@@ -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-BFfD9GlY.js";import{H as n}from"./p-BcbKK1Xp.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,c as s,h as i,H as e}from"./p-
|
|
4
|
+
import{r as t,c as s,h as i,H as e}from"./p-BFfD9GlY.js";import{a}from"./p-C8xwacGT.js";import"./p-CoQJOPRz.js";const r=class{constructor(i){t(this,i),this.orderItemUpdated=s(this,"orderItemUpdated"),this.orderItemRemoved=s(this,"orderItemRemoved"),this.quantityInput=null,this.productOptions=null,this.handleQuantityChange=t=>{const s=t.detail,i=s?.quantity??parseInt(t.target.value,10);isNaN(i)||i<1||i!==this.quantity&&(this.quantity=i,this.emitUpdate(i))},this.handleOptionsChange=()=>{this.emitUpdate(this.quantity)}}componentWillLoad(){this.quantity=this.item?.quantity||1}handleItemChange(t){const s=t?.quantity||1;s!==this.quantity&&(this.quantity=s,this.quantityInput?.setValue?.(s,!1))}get hasOptions(){return(this.item.product?.options?.length||0)>0}async getSelectedOptions(){return await(this.productOptions?.getSelectedOptionsData?.())||{}}async getOptionsData(){return await(this.productOptions?.getOptionsData?.())||this.item.product?.options||[]}async emitUpdate(t){const s=this.item?.id;if(null==s)return;const i={itemId:s,quantity:t};this.hasOptions&&(i.options=await this.getSelectedOptions(),i.optionDefinitions=await this.getOptionsData()),this.orderItemUpdated.emit(i)}removeItem(){const t=this.item?.id;null!=t&&this.orderItemRemoved.emit({itemId:t})}render(){if(!this.item)return null;const t=this.item.product,s=this.item.name||t?.name||"",r=t?.image?.url||"",n=t?.image?.alt||s,l=t?.url||"#",o=t?.price,h=a(t),d=t?.weight_label,c=this.item.product?.options,m=`order-edit-item-${this.item.id}-${t?.id}`,u={value:this.quantity};return h&&(u.max=h),i(e,null,i("div",null,i("div",{class:"s-order-edit-item-header"},i("div",{class:"s-order-edit-item-media"},r&&i("a",{href:l},i("img",{src:r,alt:n,class:"s-order-edit-item-image"})),i("div",{class:"s-order-edit-item-details"},i("h2",{class:"s-order-edit-item-name"},i("a",{href:l,class:"s-order-edit-item-link"},s)),null!=o&&i("span",{class:"s-order-edit-item-price",innerHTML:salla.money(o)}),d&&i("p",{class:"s-order-edit-item-weight"},salla.lang.getWithDefault("pages.products.weight","الوزن")," ",d))),i("salla-button",{type:"button",shape:"icon",size:"small",color:"danger","aria-label":salla.lang.getWithDefault("common.elements.delete","حذف"),onClick:()=>this.removeItem()},i("i",{class:"sicon-cancel"}))),i("div",{class:"s-order-edit-item-quantity"},i("h3",{class:"s-order-edit-item-quantity-label"},salla.lang.getWithDefault("common.elements.quantity","الكمية")),i("div",{class:"s-order-edit-item-quantity-input"},i("salla-quantity-input",{ref:t=>this.quantityInput=t,...u,onChange:this.handleQuantityChange}))),this.hasOptions&&i("form",{class:"s-order-edit-item-options",onSubmit:t=>t.preventDefault()},i("salla-product-options",{ref:t=>this.productOptions=t,onChange:this.handleOptionsChange,"product-id":t.id,"unique-key":m,options:JSON.stringify(c),key:`${m}-options`}))))}static get watchers(){return{item:["handleItemChange"]}}};r.style=":host{display:block}";export{r as salla_order_edit_item}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as t,h as s,a as o}from"./p-
|
|
4
|
+
import{r as t,h as s,a as o}from"./p-BFfD9GlY.js";import{H as e}from"./p-BcbKK1Xp.js";import"./p-CgtvEd63.js";const a=class{constructor(s){t(this,s),this.orderNumberText=salla.lang.get("pages.thank_you.order_id"),this.totalOrderText=salla.lang.get("pages.orders.total"),this.orderDateText=salla.lang.get("pages.orders.date"),this.orderStatusText=salla.lang.get("pages.orders.status"),this.noOrderText=salla.lang.get("pages.orders.non_orders"),this.load_more_text_trans=salla.lang.get("common.elements.load_more"),this.languageCode=salla.lang.locale,this.orders=[],salla.lang.onLoaded((()=>{this.languageCode=salla.lang.locale,this.orderNumberText=salla.lang.get("pages.thank_you.order_id"),this.totalOrderText=salla.lang.get("pages.orders.total"),this.orderDateText=salla.lang.get("pages.orders.date"),this.orderStatusText=salla.lang.get("pages.orders.status"),this.noOrderText=salla.lang.get("pages.orders.non_orders"),this.load_more_text_trans=salla.lang.get("common.elements.load_more")}))}loading(t=!0){let s=this.status?.querySelector(".s-button-text");s&&(e.toggleElementClassIf(s,"s-button-hide","s-button-show",(()=>t)),this.btnLoader.style.display=t?"inherit":"none")}initiateInfiniteScroll(){this.hasInfiniteScroll&&(this.wrapper?(this.infiniteScroll=salla.infiniteScroll.initiate(this.wrapper,this.wrapper,{path:()=>this.nextPage,history:!1,nextPage:this.nextPage,scrollThreshold:!1},!0),this.infiniteScroll?.on("request",(()=>{this.loading()})),this.infiniteScroll?.on("load",(t=>{this.loading(!1),this.pagination=t.pagination,this.nextPage=t.pagination?.links?.next||null,this.handleResponse(t.data).forEach((t=>{this.wrapper.append(t)}));let s=this.host.querySelectorAll(".s-orders-table-tbody-tr:not(.animated)");e.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 loadMore(){this.infiniteScroll.loadNextPage()}handleResponse(t){return t.map((t=>this.getSingleOrderItem(t)))}async loadInitialData(){const t=new URL(window.location.href);await salla.order.api.fetch({...this.params,types:[""],feedback_status:t.searchParams.get("feedback_status")}).then((t=>{if(this.orders=t.data,this.hasInfiniteScroll=!!t.pagination?.links.next,this.pagination=t.pagination,this.total=t.pagination?.total,this.nextPage=t.pagination?.links?.next||null,!this.orders.length)return this.showPlaceholder=!0,this.loading(!1);setTimeout((()=>{this.handleResponse(t.data).forEach((t=>{this.wrapper.append(t)})),this.initiateInfiniteScroll();let s=this.wrapper.querySelectorAll(".s-orders-table-tbody-tr:not(.animated)");e.animateItems(s)}),100)})).catch((t=>{this.showPlaceholder=!0,this.loading(!1),salla.logger.error(t)}))}getSingleOrderItem(t){const s=document.createElement("tr");s.classList.add("s-orders-table-tbody-tr","s-orders-table-tbody-tr-shadow");const o=document.createElement("td");o.classList.add("s-orders-table-tbody-tr-td");const a=document.createElement("div");a.classList.add("s-orders-table-tbody-tr-td-content");const r=document.createElement("span");r.classList.add("s-orders-mobile-title"),r.textContent=this.orderNumberText+":";const n=document.createElement("span");if(n.classList.add("s-orders-reference-id"),n.textContent="#"+t.reference_id,a.appendChild(r),a.appendChild(n),"buy_as_gift"==t.source){const t=document.createElement("i");t.classList.add("sicon-gift-sharing","s-orders-buy-as-gift-icon"),a.appendChild(t)}const i=document.createElement("a");i.href=t.url,a.appendChild(i);const d=document.createElement("div");d.classList.add("s-orders-copy-to-clipboard-button");const l=document.createElement("salla-button");l.classList.add("relative"),l.setAttribute("color","dark"),l.setAttribute("shape","link"),l.dataset.content=t.reference_id.toString(),l.addEventListener("click",(t=>{e.copyToClipboard(t),e.toggleElementClassIf(l,"copied","code-to-copy",(()=>!0)),setTimeout((()=>{e.toggleElementClassIf(l,"code-to-copy","copied",(()=>!0))}),1e3)}));const c=document.createElement("span");c.textContent="#"+t.reference_id;const h=document.createElement("i");h.classList.add("sicon-swap-stroke","s-orders-copy-to-clipboard-button-icon"),salla.config.get("theme.is_rtl",!0)?(l.appendChild(h),l.appendChild(c)):(l.appendChild(c),l.appendChild(h)),d.appendChild(l),a.appendChild(d),o.appendChild(a),s.appendChild(o);const u=document.createElement("td");u.classList.add("s-orders-table-tbody-tr-td");const b=document.createElement("div");b.classList.add("s-orders-table-tbody-tr-td-content");const m=document.createElement("span");m.classList.add("s-orders-mobile-title"),m.textContent=this.totalOrderText+":";const p=document.createElement("div");p.innerHTML=salla.money(t.total);const y=document.createElement("a");y.href=t.url,b.appendChild(m),b.appendChild(p),b.appendChild(y),u.appendChild(b),s.appendChild(u);const f=document.createElement("td");f.classList.add("s-orders-table-tbody-tr-td");const g=document.createElement("div");g.classList.add("s-orders-table-tbody-tr-td-content");const _=document.createElement("span");_.classList.add("s-orders-mobile-title"),_.textContent=this.orderDateText+":";const v=document.createElement("div");v.textContent=e.formatDateFromString(t.created_at.date,salla.helpers.number,this.languageCode);const k=document.createElement("a");k.href=t.url,g.appendChild(_),g.appendChild(v),g.appendChild(k),f.appendChild(g),s.appendChild(f);const w=document.createElement("td");w.classList.add("s-orders-table-tbody-tr-td");const x=document.createElement("div");x.classList.add("s-orders-table-tbody-tr-td-content");const j=document.createElement("span");j.classList.add("s-orders-mobile-title"),j.textContent=this.orderStatusText+":";const C=document.createElement("span");C.classList.add("s-orders-status-container"),C.style.color=t.status.color;const I=document.createElement("i");I.classList.add(t.status.icon);const T=document.createElement("span");T.textContent=t.status.name,C.appendChild(I),C.appendChild(T),x.appendChild(j),x.appendChild(C);const B=document.createElement("i");B.classList.add("sicon-star2","s-orders-status-rated",t.is_rated?"s-orders-rated-text":"s-orders-unrated-text"),x.appendChild(B);const D=document.createElement("a");return D.href=t.url,x.appendChild(D),w.appendChild(x),s.appendChild(w),s}render(){return this.showPlaceholder?s("div",{class:"s-orders-no-content"},s("i",{class:"sicon-packed-box icon"}),s("p",null,this.noOrderText)):s("div",{class:"s-orders-wrapper"},s("table",{class:"s-orders-table"},s("thead",{class:"s-orders-table-head"},s("tr",{class:"s-orders-table-head-tr"},s("th",{class:"s-orders-table-head-tr-th",scope:"col"},this.orderNumberText),s("th",{class:"s-orders-table-head-tr-th",scope:"col"},this.totalOrderText),s("th",{class:"s-orders-table-head-tr-th",scope:"col"},this.orderDateText),s("th",{class:"s-orders-table-head-tr-th",scope:"col"},this.orderStatusText))),s("tbody",{class:"s-orders-table-tbody",ref:t=>this.wrapper=t})),this.nextPage&&s("div",{class:"s-infinite-scroll-wrapper",ref:t=>this.status=t},s("button",{onClick:()=>this.loadMore(),class:"s-infinite-scroll-btn s-button-btn s-button-primary"},s("span",{class:"s-button-text s-infinite-scroll-btn-text"},this.loadMoreText??this.load_more_text_trans),s("span",{class:"s-button-loader s-button-loader-center s-infinite-scroll-btn-loader",ref:t=>this.btnLoader=t,style:{display:"none"}}))))}componentWillLoad(){return salla.onReady().then((()=>this.loadInitialData())).then((()=>this.initiateInfiniteScroll()))}get host(){return o(this)}};a.style=":host{display:block}";export{a as salla_orders}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as s,h as l,H as t}from"./p-
|
|
4
|
+
import{r as s,h as l,H as t}from"./p-BFfD9GlY.js";const i=class{constructor(l){s(this,l),this.methods=[],this.shouldRender=!1}async componentDidLoad(){await Salla.onReady(),await Salla.lang.onLoaded(),Salla.config.get("store.shipping.support_pickup")&&(this.shouldRender=!0,this.setLabels())}setLabels(){this.methods=[{id:"delivery",title:Salla.lang.getWithDefault("pages.products.promise_delivery_title","متاح للتوصيل"),subtitle:Salla.lang.getWithDefault("pages.products.promise_delivery_subtitle","طلبك يوصلك لباب البيت بسهولة."),iconClass:"sicon-location"},{id:"pickup",title:Salla.lang.getWithDefault("pages.products.promise_pickup_title","متاح للاستلام"),subtitle:Salla.lang.getWithDefault("pages.products.promise_pickup_subtitle","استلام فوري من أقرب فرع."),iconClass:"sicon-store"}]}render(){return this.shouldRender?l(t,{class:"s-fulfillment-methods"},l("div",{class:"s-fulfillment-methods-list"},this.methods.map((s=>l("div",{key:s.id,class:"s-fulfillment-methods-card"},l("div",{class:"s-fulfillment-methods-content"},l("div",{class:"s-fulfillment-methods-icon-wrap"},l("i",{class:`${s.iconClass} s-fulfillment-methods-icon`})),l("div",{class:"s-fulfillment-methods-text"},l("span",{class:"s-fulfillment-methods-title"},s.title),l("span",{class:"s-fulfillment-methods-subtitle"},s.subtitle)))))))):null}};export{i as salla_fulfillment_methods}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as t,h as s}from"./p-BqFb60iF.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.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}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:"a2798e968c7311c99560db0710559f8f518031fa"},s("salla-list-tile",{key:"5621984db45065e919fc647bf973b5fdb42e7c3f",class:this.generateClass()},s("div",{key:"3fea9220af764f5675b17005169ec5398fb0a1d3",slot:"title"},this.vertical?s("span",{innerHTML:h}):"",s("h3",{key:"6984f88fa5675edfddbc67d87fa69ee26ee40b98"},this.widgetTitle?this.widgetTitle:this.sectionTitle)),s("div",{key:"64cb13fac30d6613af2c278593e45d59f2f8e791",slot:"subtitle"},s("div",{key:"578f47b7cc8242bbf6872cc670c37beeb7197c0e"},this.widgetSubtitle?this.widgetSubtitle:this.sectionSubtitle)),s("div",{key:"54e56e74fcc1e3266395ad003369e47ea0b0c27b",slot:"action"},s("salla-button",{key:"7687a680041c1e5b431eb56d94262fb2defe0664",color:"primary",fill:"outline",width:"wide",class:"s-gifting-widget-action",onClick:()=>this.handleGiftButtonClick()},s("slot",{key:"9e466071aa0bf882962931f029e32d567390d9f2",name:"widget-btn-content"},s("div",{key:"f5b8a796dc3b7bb4e1094a7741944673e1ec6477",class:"s-gifting-widget-action-content"},s("span",{key:"037ea375a6904bf51d15c8d76f8b650031526a59",innerHTML:h})," ",s("span",{key:"490dceeaf5a7e0ec38dabd49182f74d4ea07d597"},this.sectionBtnText)))))),s("salla-modal",{key:"2914d9a5a0ae7fe555a73f993553165e4fb91b02",id:this.hostId,isLoading:!0,class:"s-gifting-modal",width:"sm",ref:t=>this.modal=t},s("div",{key:"6d70fa91062f55adb3d0a6371ccb8afc271e949e",slot:"loading"},s("div",{key:"82a690b756eb1179c325416a33f66b9d726eb336",class:"s-gifting-skeleton"},s("div",{key:"8cedf269ee0caf39cbd9f39ab80e7dd3d65b7fde",class:"s-gifting-modal-header"},s("salla-skeleton",{key:"7cb2bfb3198c3096efa147348b2a6cdec21eb3d3",type:"circle",height:"5rem",width:"5rem"}),s("h2",{key:"36cb724cfe2f39a7eb94b779a67520a3bff75389",class:"s-gifting-modal-title"},s("div",{key:"2ef3bcb26f31cdc34725e9a87849a426bd9dfc72",class:"s-gifting-modal-badge-wrapper"},s("salla-skeleton",{key:"66f4148f367bc687982a06975e41c6865a530e88",height:"15px",width:"150px"})))),s("div",{key:"fda2fdc549cc6dfcb5f4cc9bfafe5dc686464e4c",class:"s-gifting-skeleton-content"},s("salla-skeleton",{key:"f0f64ab8b9d467c2cbe4707154a21bb952f45831",height:"10px",width:"150px"}),s("salla-skeleton",{key:"1b1950d9d333b4249aab267fdbb90ac380ac6175",height:"230px"}),s("salla-skeleton",{key:"3b3a2472851e63754804ceb68401bb56a9900061",height:"10px",width:"150px"}),s("salla-skeleton",{key:"d3f9ace5c8b12061ac94d929d926e8458fb66411",height:"30px"}),s("salla-skeleton",{key:"d0be03fc578e2559c0a5251875bac01519beb18f",height:"40px"})))),s("slot",{key:"86757c4d648dd818857aaee41c6df568724cbd1b",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()&&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.selectCityInfo)),!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:"052bb080776d8d874da570b643345b95a40cd985",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-BFfD9GlY.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 l}from"./p-0-eTJXSD.js";const h=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)}}),h.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.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}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 l=()=>{this.stepsWrapper.style.height=e?`${e}px`:a.offsetHeight+i+"px"};this.step2Animated&&2===t?requestAnimationFrame(l):setTimeout(l,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>=h.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 l;this.productId&&this.formSelector&&(l=this.getFormDataFromForm()||new FormData,l=this.mergeObjectToFormData(a,l));const h=this.productId?()=>salla.product.addProductGiftToCart(this.productId,l,!0):()=>salla.cart.addCartGiftToCart(a,!0);return await h().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:"a2798e968c7311c99560db0710559f8f518031fa"},s("salla-list-tile",{key:"5621984db45065e919fc647bf973b5fdb42e7c3f",class:this.generateClass()},s("div",{key:"3fea9220af764f5675b17005169ec5398fb0a1d3",slot:"title"},this.vertical?s("span",{innerHTML:l}):"",s("h3",{key:"6984f88fa5675edfddbc67d87fa69ee26ee40b98"},this.widgetTitle?this.widgetTitle:this.sectionTitle)),s("div",{key:"64cb13fac30d6613af2c278593e45d59f2f8e791",slot:"subtitle"},s("div",{key:"578f47b7cc8242bbf6872cc670c37beeb7197c0e"},this.widgetSubtitle?this.widgetSubtitle:this.sectionSubtitle)),s("div",{key:"54e56e74fcc1e3266395ad003369e47ea0b0c27b",slot:"action"},s("salla-button",{key:"7687a680041c1e5b431eb56d94262fb2defe0664",color:"primary",fill:"outline",width:"wide",class:"s-gifting-widget-action",onClick:()=>this.handleGiftButtonClick()},s("slot",{key:"9e466071aa0bf882962931f029e32d567390d9f2",name:"widget-btn-content"},s("div",{key:"f5b8a796dc3b7bb4e1094a7741944673e1ec6477",class:"s-gifting-widget-action-content"},s("span",{key:"037ea375a6904bf51d15c8d76f8b650031526a59",innerHTML:l})," ",s("span",{key:"490dceeaf5a7e0ec38dabd49182f74d4ea07d597"},this.sectionBtnText)))))),s("salla-modal",{key:"2914d9a5a0ae7fe555a73f993553165e4fb91b02",id:this.hostId,isLoading:!0,class:"s-gifting-modal",width:"sm",ref:t=>this.modal=t},s("div",{key:"6d70fa91062f55adb3d0a6371ccb8afc271e949e",slot:"loading"},s("div",{key:"82a690b756eb1179c325416a33f66b9d726eb336",class:"s-gifting-skeleton"},s("div",{key:"8cedf269ee0caf39cbd9f39ab80e7dd3d65b7fde",class:"s-gifting-modal-header"},s("salla-skeleton",{key:"7cb2bfb3198c3096efa147348b2a6cdec21eb3d3",type:"circle",height:"5rem",width:"5rem"}),s("h2",{key:"36cb724cfe2f39a7eb94b779a67520a3bff75389",class:"s-gifting-modal-title"},s("div",{key:"2ef3bcb26f31cdc34725e9a87849a426bd9dfc72",class:"s-gifting-modal-badge-wrapper"},s("salla-skeleton",{key:"66f4148f367bc687982a06975e41c6865a530e88",height:"15px",width:"150px"})))),s("div",{key:"fda2fdc549cc6dfcb5f4cc9bfafe5dc686464e4c",class:"s-gifting-skeleton-content"},s("salla-skeleton",{key:"f0f64ab8b9d467c2cbe4707154a21bb952f45831",height:"10px",width:"150px"}),s("salla-skeleton",{key:"1b1950d9d333b4249aab267fdbb90ac380ac6175",height:"230px"}),s("salla-skeleton",{key:"3b3a2472851e63754804ceb68401bb56a9900061",height:"10px",width:"150px"}),s("salla-skeleton",{key:"d3f9ace5c8b12061ac94d929d926e8458fb66411",height:"30px"}),s("salla-skeleton",{key:"d0be03fc578e2559c0a5251875bac01519beb18f",height:"40px"})))),s("slot",{key:"86757c4d648dd818857aaee41c6df568724cbd1b",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:l})),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()&&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.selectCityInfo)),!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:"052bb080776d8d874da570b643345b95a40cd985",name:"footer"})))]}};h.CITY_AJAX_THRESHOLD=400,h.CITY_SEARCH_DEBOUNCE_MS=100,h.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{h as salla_gifting}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as t,h as a,F as s,a as e}from"./p-
|
|
4
|
+
import{r as t,h as a,F as s,a as e}from"./p-BFfD9GlY.js";const i=class{constructor(a){t(this,a),this.isMobileAllowed=!0,this.isEmailRequired=!1,this.supportWebAuth=!0,this.withoutReload=!1,this.source="",this.htmlElement=document.documentElement,this.messages=[],this.isClosable=!0,this.iframeLoaded=!1,this.scrolling="no",this.direction=document.dir,this.canRenderIframe=!1,salla.event.on("login::open",(t=>{this.isEmailAllowed||this.isMobileAllowed?(this.source=t?.source??!1,this.withoutReload=t?.withoutReload??this.withoutReload,this.open(t),this.openModal()):salla.logger.warn("Please enable atleast one login type to use this component.")})),salla.event.on("modal::close",(t=>{this.iframe&&this.sendMessageToIframe({source:"login",type:"modal_closed",data:t})})),salla.onReady((()=>{this.api=salla.config.get("store.api"),this.storeId=salla.config.get("store.id")}))}componentDidLoad(){window.addEventListener("message",(t=>{if(!this.isTrustedMessage(t)||"login"!=t.data?.source)return;if(!this.inline&&!this.canRenderIframe)return;salla.log("salla-account:: recived an event",t.data);let a=t.data?.type?.replace("iframe::",""),s=t.data.message;if("ready"==a)return s.isPasskeyPage?void this.createPassKey.postMessage({source:"login",type:"init_passkey_page",data:{token:salla.storage.get("token"),store_id:salla.config.get("store.id"),locale:salla.config.get("user.language_code"),redirect:salla.config.get("store.url")}},salla.config.get("login.url")):void this.handleIframeReadyAction();if("height"==a)return this.iframe.height=s?.height+"px";if("storage"==a)return this.handleIframeStorageAction(s);if("scrolling"==a)return this.scrolling=s,void(this.isClosable=!1);if("direction"==a)return document.dir=this.direction=s?"rtl":"ltr";if("notify"==a)return salla.notify[s.type](s.message);if("authenticated"==a||"authenticated_web_auth"==a)return!s?.withoutClose&&this.close(),salla.auth.api.handlAfterAuthenticatedResponse(s,this.supportWebAuth).then((()=>!(s?.withoutReload||this.withoutReload)&&setTimeout((()=>window.location.reload()),1e3)));if("dispatchEvent"!=a||"auth::verified"!=s.event){if("dispatchEvent"==a)return salla.event.emit(s.event,...s.payload);if("reload"==a)return s?.withClose&&this.modal.close(),window.location.reload();if("open_page"===a){if(!this.isSafeUrl(s?.url))return;return window.location.href=s.url}if("open_passkey_page"!==a)return"guest-checkout"===a?this.handleGuestCheckout():void("close"==a&&this.close());this.createPassKey=window.open(`${salla.config.get("login.url")}/create-passkey`)}else salla.log("Ignored dispatchEvent `auth::verified` from iframe")})),this.observeDarkModeChanges(),setTimeout((()=>Salla.event.emit("salla-login::ready")),1)}async open(t=null){return Salla.config.isGuest()?this.modal.open():this.withoutReload?void 0:location.reload()}close(){Salla.event.emit("salla-login::closing"),this.modal.close(),this.iframeLoaded=!1,this.canRenderIframe=!1,this.host.dispatchEvent(new CustomEvent("salla-login:closed",{cancelable:!0,bubbles:!0,detail:null})),Salla.event.emit("salla-login::closed")}handleIframeReadyAction(){this.sendInitMessage(),this.sendMessageToIframe({source:"login",type:"width",data:document.body.clientWidth})}observeDarkModeChanges(){new MutationObserver((t=>{t.forEach((t=>{"class"===t.attributeName&&this.sendMessageToIframe({source:"login",type:"darkMode",data:{isDark:!!this.htmlElement.classList.contains("dark")}})}))})).observe(this.htmlElement,{attributes:!0})}async handleIframeStorageAction(t){let a,s=salla.storage.get("cart.user_id"),e=!1;if(Object.entries(t).filter((t=>!Salla.storage.get(t[0]))).forEach((([t,i])=>{salla.log("Shared storage from accounts domain",t,i);let l="string"==typeof i?i?.replace(/^"|"$/g,""):i;salla.storage.set(t,l),"token"===t&&(a=l),"user"===t&&s&&l.id!==s&&(e=!0)})),a){this.modal.close(),Salla.auth.event.tokenFetched(a);try{await Salla.api.cart.assign()}catch(t){Salla.log("Error on assign after handle iframe",t)}e&&Salla.cart.reset();try{!Salla.auth.api.isSessionless()&&await Salla.auth.api.request("auth/jwt"),Salla.auth.api.canRedirect()?setTimeout((()=>window.location.reload()),100):await Salla.auth.event.loggedIn({data:{token:a}}).then((()=>Salla.auth.api.afterUserLogin()))}catch(t){this.modal.open(),Salla.log("Error on request auth/jwt after handle iframe",t)}}else e&&Salla.cart.reset()}isTrustedMessage(t){if(!(this.iframe&&t.source===this.iframe.contentWindow||this.createPassKey&&t.source===this.createPassKey))return!1;let a;try{a=new URL(salla.config.get("login.url","https://accounts.salla.com")).origin}catch(t){a="https://accounts.salla.com"}return t.origin===a}isSafeUrl(t){if("string"!=typeof t||!t)return!1;try{const{protocol:a}=new URL(t,location.href);return"https:"===a||"http:"===a}catch(t){return!1}}sendMessageToIframe(t){if(this.iframe)return this.iframe.contentWindow.postMessage(t,"*")}sendInitMessage(){let t=this.headers;try{t="string"==typeof t?JSON.parse(t):t}catch(a){console.error("Failed to parse headers!",this.headers,a),t=void 0}const a={user:salla.storage.get("user"),s_translations:salla.storage.get("s_translations"),token:salla.storage.get("token")};a.user||delete a.user,a.s_translations||delete a.s_translations,a.token||delete a.token,this.sendMessageToIframe({source:"login",type:"init",data:{id:this.storeId,lang:salla.lang.locale,isDark:!!this.htmlElement.classList.contains("dark"),apiUrl:this.api?.replace(/\/+$/,""),supportWebAuth:this.supportWebAuth,withoutReload:this.withoutReload,inline:this.inline,settings:salla.config.all(),headers:t,storage:a}})}async handleGuestCheckout(){if(this.modal.close(),salla.config.isGuest())return salla.cart.submit(!1,!0)}openModal(){this.canRenderIframe||(this.canRenderIframe=!0),this.modal.open()}render(){if(!Salla.config.isUser())return this.inline?this.getLoginDom():a("salla-modal",{class:"s-login-modal",ref:t=>this.modal=t,width:"xs"},this.getLoginDom())}getLoginDom(){if(this.canRenderIframe)return a(s,null,a("iframe",{src:`${salla.config.get("login.url","https://accounts.salla.com")}?src=${this.source}`,title:"Salla Login",class:"hide-scroll",loading:"lazy",ref:t=>{this.iframe=t},allow:"publickey-credentials-get; publickey-credentials-create",scrolling:this.scrolling,frameborder:"0",width:"100%"}))}get host(){return e(this)}};i.style="iframe{-moz-transition:height 0.3s;-ms-transition:height 0.3s;-o-transition:height 0.3s;-webkit-transition:height 0.3s;transition:height 0.3s;width:100%}";export{i as salla_login_modal}
|
|
@@ -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-BFfD9GlY.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}
|