@salla.sa/twilight-components 2.14.520 → 2.14.522
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/arrow-right-Cd6JoegH.js +13 -0
- package/dist/cjs/{filepond-B-CXEiqm.js → filepond-RbRMljF_.js} +1 -1
- package/dist/cjs/{filepond-plugin-file-poster-wldzYT1k.js → filepond-plugin-file-poster-uIFauwzO.js} +1 -1
- package/dist/cjs/{filepond-plugin-file-validate-size-DEKUs2ql.js → filepond-plugin-file-validate-size-Cd_r4359.js} +1 -1
- package/dist/cjs/{filepond-plugin-file-validate-type-V0nWqzLp.js → filepond-plugin-file-validate-type-C5tN0mCB.js} +1 -1
- package/dist/cjs/{filepond-plugin-image-edit-C60jMfjF.js → filepond-plugin-image-edit-Bj-vUOxV.js} +1 -1
- package/dist/cjs/{filepond-plugin-image-exif-orientation-7rjvzakW.js → filepond-plugin-image-exif-orientation-DR6IE-Yk.js} +1 -1
- package/dist/cjs/{filepond-plugin-image-preview-CBjNXDm7.js → filepond-plugin-image-preview-HghuKrCb.js} +1 -1
- package/dist/cjs/{functions-w4n1Dw12.js → functions-C0u_gA0Z.js} +1 -1
- package/dist/cjs/{index-CP4_ZHev.js → index-BJw_NdHc.js} +10 -10
- package/dist/cjs/{index-Dtd8NT7W.js → index-DZPED3mu.js} +1 -1
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/salla-accordion-body_2.cjs.entry.js +1 -1
- package/dist/cjs/salla-accordion_6.cjs.entry.js +18 -3
- package/dist/cjs/salla-add-product-button_5.cjs.entry.js +1 -1
- package/dist/cjs/salla-advertisement.cjs.entry.js +1 -1
- package/dist/cjs/salla-alert_2.cjs.entry.js +1 -1
- package/dist/cjs/salla-app-install-alert.cjs.entry.js +1 -1
- package/dist/cjs/salla-apps-icons.cjs.entry.js +1 -1
- package/dist/cjs/salla-badge.cjs.entry.js +1 -1
- package/dist/cjs/salla-basket-gap.cjs.entry.js +1 -1
- package/dist/cjs/salla-booking-field_7.cjs.entry.js +10 -10
- package/dist/cjs/salla-bullet-delivery_2.cjs.entry.js +1 -1
- package/dist/cjs/salla-cart-coupons.cjs.entry.js +1 -1
- package/dist/cjs/salla-cart-item-offers_2.cjs.entry.js +1 -1
- package/dist/cjs/salla-cart-summary-card.cjs.entry.js +1 -1
- package/dist/cjs/salla-cashback-banner.cjs.entry.js +1 -1
- package/dist/cjs/salla-comment-factors.cjs.entry.js +1 -1
- package/dist/cjs/salla-comment-form_8.cjs.entry.js +1 -1
- package/dist/cjs/salla-conditional-offer.cjs.entry.js +1 -1
- package/dist/cjs/salla-contacts.cjs.entry.js +1 -1
- package/dist/cjs/salla-cookies-bar.cjs.entry.js +1 -1
- package/dist/cjs/salla-count-down_2.cjs.entry.js +12 -7
- package/dist/cjs/salla-custom-fields.cjs.entry.js +1 -1
- package/dist/cjs/salla-delivery-promise.cjs.entry.js +1 -1
- package/dist/cjs/salla-edit-order-button.cjs.entry.js +1 -1
- package/dist/cjs/salla-filters-widget.cjs.entry.js +1 -1
- package/dist/cjs/salla-filters.cjs.entry.js +1 -1
- package/dist/cjs/salla-fulfillment-methods.cjs.entry.js +1 -1
- package/dist/cjs/salla-gifting.cjs.entry.js +1 -1
- package/dist/cjs/salla-hook.cjs.entry.js +1 -1
- package/dist/cjs/salla-infinite-scroll.cjs.entry.js +1 -1
- package/dist/cjs/salla-installment.cjs.entry.js +1 -1
- package/dist/cjs/salla-list-tile.cjs.entry.js +1 -1
- package/dist/cjs/salla-localization-modal.cjs.entry.js +1 -1
- package/dist/cjs/salla-login-modal.cjs.entry.js +1 -1
- package/dist/cjs/salla-loyalty-banner.cjs.entry.js +2 -2
- package/dist/cjs/salla-loyalty-exchange-product-card_5.cjs.entry.js +3 -3
- package/dist/cjs/salla-loyalty-hero_2.cjs.entry.js +2 -2
- package/dist/cjs/salla-loyalty-panel.cjs.entry.js +3 -3
- package/dist/cjs/salla-loyalty-points-banner.cjs.entry.js +1 -1
- package/dist/cjs/salla-loyalty-points-history.cjs.entry.js +1 -1
- package/dist/cjs/salla-loyalty-prize-item.cjs.entry.js +1 -1
- package/dist/cjs/salla-loyalty-program.cjs.entry.js +3 -3
- package/dist/cjs/salla-loyalty-reward.cjs.entry.js +2 -2
- package/dist/cjs/salla-loyalty.cjs.entry.js +1 -1
- package/dist/cjs/salla-maintenance-alert.cjs.entry.js +1 -1
- package/dist/cjs/salla-map_2.cjs.entry.js +1 -1
- package/dist/cjs/salla-menu.cjs.entry.js +1 -1
- package/dist/cjs/salla-metadata.cjs.entry.js +1 -1
- package/dist/cjs/salla-multiple-bundle-product-cart_2.cjs.entry.js +1 -1
- package/dist/cjs/salla-multiple-bundle-product-options-modal_2.cjs.entry.js +1 -1
- package/dist/cjs/salla-multiple-bundle-product.cjs.entry.js +1 -1
- package/dist/cjs/salla-next-order-coupon.cjs.entry.js +1 -1
- package/dist/cjs/salla-notification-item.cjs.entry.js +1 -1
- package/dist/cjs/salla-notifications.cjs.entry.js +1 -1
- package/dist/cjs/salla-offer-modal.cjs.entry.js +1 -1
- package/dist/cjs/salla-offer.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-branch.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-cancel.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-details-multiple-bundle-product.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-details-options.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-details.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-edit-item.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-edit-product-card.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-edit.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-shipments.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-summary.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-totals-card.cjs.entry.js +1 -1
- package/dist/cjs/salla-orders.cjs.entry.js +1 -1
- package/dist/cjs/salla-payments.cjs.entry.js +1 -1
- package/dist/cjs/salla-placeholder.cjs.entry.js +1 -1
- package/dist/cjs/salla-price-range.cjs.entry.js +3 -9
- package/dist/cjs/salla-product-card-embed.cjs.entry.js +1 -1
- package/dist/cjs/salla-product-card_2.cjs.entry.js +1 -1
- package/dist/cjs/salla-product-size-guide.cjs.entry.js +1 -1
- package/dist/cjs/salla-products-list.cjs.entry.js +2 -2
- package/dist/cjs/salla-quick-order.cjs.entry.js +1 -1
- package/dist/cjs/salla-rating-modal-v2.cjs.entry.js +1 -1
- package/dist/cjs/salla-rating-modal.cjs.entry.js +1 -1
- package/dist/cjs/salla-review-factors-tags.cjs.entry.js +1 -1
- package/dist/cjs/salla-scopes.cjs.entry.js +1 -1
- package/dist/cjs/salla-search.cjs.entry.js +1 -1
- package/dist/cjs/salla-skeleton.cjs.entry.js +1 -1
- package/dist/cjs/salla-slider.cjs.entry.js +1 -1
- package/dist/cjs/salla-social-share.cjs.entry.js +1 -1
- package/dist/cjs/salla-social.cjs.entry.js +1 -1
- package/dist/cjs/salla-tab-content_3.cjs.entry.js +1 -1
- package/dist/cjs/salla-tiered-offer.cjs.entry.js +1 -1
- package/dist/cjs/salla-tooltip.cjs.entry.js +1 -1
- package/dist/cjs/salla-trust-badges.cjs.entry.js +1 -1
- package/dist/cjs/salla-user-menu.cjs.entry.js +1 -1
- package/dist/cjs/salla-user-profile.cjs.entry.js +1 -1
- package/dist/cjs/salla-user-settings.cjs.entry.js +471 -34
- package/dist/cjs/salla-verify.cjs.entry.js +9 -1
- package/dist/cjs/salla-wallet.cjs.entry.js +1 -1
- package/dist/cjs/salla-wishlist-actions.cjs.entry.js +2 -2
- package/dist/cjs/{tracked-promise-C8HPKIHB.js → tracked-promise-84l9D1pi.js} +1 -1
- package/dist/cjs/twilight.cjs.js +2 -2
- package/dist/cjs/{vanilla-picker-CfkLDKtB.js → vanilla-picker-C9ruFpIn.js} +1 -1
- package/dist/collection/components/salla-modal/salla-modal.css +12 -0
- package/dist/collection/components/salla-modal/salla-modal.js +50 -1
- package/dist/collection/components/salla-order-options-modal/salla-order-options-modal.js +11 -6
- package/dist/collection/components/salla-products-list/salla-products-list.js +1 -1
- package/dist/collection/components/salla-user-settings/salla-user-settings.css +137 -0
- package/dist/collection/components/salla-user-settings/salla-user-settings.js +497 -32
- package/dist/collection/components/salla-verify/salla-verify.js +8 -0
- package/dist/collection/components/salla-wishlist-actions/salla-wishlist-actions.js +1 -1
- package/dist/components/arrow-right.js +11 -0
- package/dist/components/index.js +2 -2
- package/dist/components/salla-login-modal2.js +7 -1
- package/dist/components/salla-loyalty-point2.js +8 -2
- package/dist/components/salla-modal2.js +25 -3
- package/dist/components/salla-order-options-modal2.js +11 -6
- package/dist/components/salla-price-range2.js +1 -7
- package/dist/components/salla-product-size-guide.js +7 -1
- package/dist/components/salla-products-list2.js +1 -1
- package/dist/components/salla-user-menu.js +7 -1
- package/dist/components/salla-user-settings.js +498 -39
- package/dist/components/salla-verify.js +8 -0
- package/dist/components/salla-wishlist-actions.js +1 -1
- package/dist/esm/arrow-right-B9q7ymSg.js +11 -0
- package/dist/esm/{filepond-B5AhUd5X.js → filepond-DTXpxLd9.js} +1 -1
- package/dist/esm/{filepond-plugin-file-poster-CyUKDIOX.js → filepond-plugin-file-poster-QykV8B8G.js} +1 -1
- package/dist/esm/{filepond-plugin-file-validate-size-oDM0RkiJ.js → filepond-plugin-file-validate-size-Bj5ENC6_.js} +1 -1
- package/dist/esm/{filepond-plugin-file-validate-type-Bgr0PP4V.js → filepond-plugin-file-validate-type-8CnQZmpk.js} +1 -1
- package/dist/esm/{filepond-plugin-image-edit-CQNKQMzk.js → filepond-plugin-image-edit-JxnSBv4V.js} +1 -1
- package/dist/esm/{filepond-plugin-image-exif-orientation-6bqQCmnQ.js → filepond-plugin-image-exif-orientation-P7dHkas0.js} +1 -1
- package/dist/esm/{filepond-plugin-image-preview-BxAmNds6.js → filepond-plugin-image-preview-B6byQaCY.js} +1 -1
- package/dist/esm/{functions-UlRBW71R.js → functions-B-HhhobN.js} +1 -1
- package/dist/esm/{index-CGCbZsu6.js → index-BszjiU3B.js} +1 -1
- package/dist/esm/{index-DjOBdfDM.js → index-CJNSdTHZ.js} +10 -10
- package/dist/esm/loader.js +3 -3
- package/dist/esm/salla-accordion-body_2.entry.js +1 -1
- package/dist/esm/salla-accordion_6.entry.js +18 -3
- package/dist/esm/salla-add-product-button_5.entry.js +1 -1
- package/dist/esm/salla-advertisement.entry.js +1 -1
- package/dist/esm/salla-alert_2.entry.js +1 -1
- package/dist/esm/salla-app-install-alert.entry.js +1 -1
- package/dist/esm/salla-apps-icons.entry.js +1 -1
- package/dist/esm/salla-badge.entry.js +1 -1
- package/dist/esm/salla-basket-gap.entry.js +1 -1
- package/dist/esm/salla-booking-field_7.entry.js +10 -10
- package/dist/esm/salla-bullet-delivery_2.entry.js +1 -1
- package/dist/esm/salla-cart-coupons.entry.js +1 -1
- package/dist/esm/salla-cart-item-offers_2.entry.js +1 -1
- package/dist/esm/salla-cart-summary-card.entry.js +1 -1
- package/dist/esm/salla-cashback-banner.entry.js +1 -1
- package/dist/esm/salla-comment-factors.entry.js +1 -1
- package/dist/esm/salla-comment-form_8.entry.js +1 -1
- package/dist/esm/salla-conditional-offer.entry.js +1 -1
- package/dist/esm/salla-contacts.entry.js +1 -1
- package/dist/esm/salla-cookies-bar.entry.js +1 -1
- package/dist/esm/salla-count-down_2.entry.js +12 -7
- package/dist/esm/salla-custom-fields.entry.js +1 -1
- package/dist/esm/salla-delivery-promise.entry.js +1 -1
- package/dist/esm/salla-edit-order-button.entry.js +1 -1
- package/dist/esm/salla-filters-widget.entry.js +1 -1
- package/dist/esm/salla-filters.entry.js +1 -1
- package/dist/esm/salla-fulfillment-methods.entry.js +1 -1
- package/dist/esm/salla-gifting.entry.js +1 -1
- package/dist/esm/salla-hook.entry.js +1 -1
- package/dist/esm/salla-infinite-scroll.entry.js +1 -1
- package/dist/esm/salla-installment.entry.js +1 -1
- package/dist/esm/salla-list-tile.entry.js +1 -1
- package/dist/esm/salla-localization-modal.entry.js +1 -1
- package/dist/esm/salla-login-modal.entry.js +1 -1
- package/dist/esm/salla-loyalty-banner.entry.js +2 -2
- package/dist/esm/salla-loyalty-exchange-product-card_5.entry.js +3 -3
- package/dist/esm/salla-loyalty-hero_2.entry.js +2 -2
- package/dist/esm/salla-loyalty-panel.entry.js +3 -3
- package/dist/esm/salla-loyalty-points-banner.entry.js +1 -1
- package/dist/esm/salla-loyalty-points-history.entry.js +1 -1
- package/dist/esm/salla-loyalty-prize-item.entry.js +1 -1
- package/dist/esm/salla-loyalty-program.entry.js +3 -3
- package/dist/esm/salla-loyalty-reward.entry.js +2 -2
- package/dist/esm/salla-loyalty.entry.js +1 -1
- package/dist/esm/salla-maintenance-alert.entry.js +1 -1
- package/dist/esm/salla-map_2.entry.js +1 -1
- package/dist/esm/salla-menu.entry.js +1 -1
- package/dist/esm/salla-metadata.entry.js +1 -1
- package/dist/esm/salla-multiple-bundle-product-cart_2.entry.js +1 -1
- package/dist/esm/salla-multiple-bundle-product-options-modal_2.entry.js +1 -1
- package/dist/esm/salla-multiple-bundle-product.entry.js +1 -1
- package/dist/esm/salla-next-order-coupon.entry.js +1 -1
- package/dist/esm/salla-notification-item.entry.js +1 -1
- package/dist/esm/salla-notifications.entry.js +1 -1
- package/dist/esm/salla-offer-modal.entry.js +1 -1
- package/dist/esm/salla-offer.entry.js +1 -1
- package/dist/esm/salla-order-branch.entry.js +1 -1
- package/dist/esm/salla-order-cancel.entry.js +1 -1
- package/dist/esm/salla-order-details-multiple-bundle-product.entry.js +1 -1
- package/dist/esm/salla-order-details-options.entry.js +1 -1
- package/dist/esm/salla-order-details.entry.js +1 -1
- package/dist/esm/salla-order-edit-item.entry.js +1 -1
- package/dist/esm/salla-order-edit-product-card.entry.js +1 -1
- package/dist/esm/salla-order-edit.entry.js +1 -1
- package/dist/esm/salla-order-shipments.entry.js +1 -1
- package/dist/esm/salla-order-summary.entry.js +1 -1
- package/dist/esm/salla-order-totals-card.entry.js +1 -1
- package/dist/esm/salla-orders.entry.js +1 -1
- package/dist/esm/salla-payments.entry.js +1 -1
- package/dist/esm/salla-placeholder.entry.js +1 -1
- package/dist/esm/salla-price-range.entry.js +2 -8
- package/dist/esm/salla-product-card-embed.entry.js +1 -1
- package/dist/esm/salla-product-card_2.entry.js +1 -1
- package/dist/esm/salla-product-size-guide.entry.js +1 -1
- package/dist/esm/salla-products-list.entry.js +2 -2
- package/dist/esm/salla-quick-order.entry.js +1 -1
- package/dist/esm/salla-rating-modal-v2.entry.js +1 -1
- package/dist/esm/salla-rating-modal.entry.js +1 -1
- package/dist/esm/salla-review-factors-tags.entry.js +1 -1
- package/dist/esm/salla-scopes.entry.js +1 -1
- package/dist/esm/salla-search.entry.js +1 -1
- package/dist/esm/salla-skeleton.entry.js +1 -1
- package/dist/esm/salla-slider.entry.js +1 -1
- package/dist/esm/salla-social-share.entry.js +1 -1
- package/dist/esm/salla-social.entry.js +1 -1
- package/dist/esm/salla-tab-content_3.entry.js +1 -1
- package/dist/esm/salla-tiered-offer.entry.js +1 -1
- package/dist/esm/salla-tooltip.entry.js +1 -1
- package/dist/esm/salla-trust-badges.entry.js +1 -1
- package/dist/esm/salla-user-menu.entry.js +1 -1
- package/dist/esm/salla-user-profile.entry.js +1 -1
- package/dist/esm/salla-user-settings.entry.js +471 -34
- package/dist/esm/salla-verify.entry.js +9 -1
- package/dist/esm/salla-wallet.entry.js +1 -1
- package/dist/esm/salla-wishlist-actions.entry.js +2 -2
- package/dist/esm/{tracked-promise-CjzMNHuW.js → tracked-promise-BfoqsGRk.js} +1 -1
- package/dist/esm/twilight.js +3 -3
- package/dist/esm/{vanilla-picker-C0WhEpLR.js → vanilla-picker-BhDt66Uk.js} +1 -1
- package/dist/twilight/{p-1e80102d.entry.js → p-0645933f.entry.js} +1 -1
- package/dist/twilight/{p-9edb33a2.entry.js → p-0a1e4dbe.entry.js} +1 -1
- package/dist/twilight/{p-468d142a.entry.js → p-0c879092.entry.js} +1 -1
- package/dist/twilight/{p-Z5t88y_p.js → p-13LBJtjX.js} +1 -1
- package/dist/twilight/{p-517cdc60.entry.js → p-16cf7eaf.entry.js} +1 -1
- package/dist/twilight/{p-75c5d67c.entry.js → p-186221a2.entry.js} +1 -1
- package/dist/twilight/{p-f5fc1892.entry.js → p-1eb3897d.entry.js} +1 -1
- package/dist/twilight/{p-977d4b62.entry.js → p-211f9589.entry.js} +1 -1
- package/dist/twilight/{p-bf78b156.entry.js → p-22424405.entry.js} +1 -1
- package/dist/twilight/{p-1334a1aa.entry.js → p-22da1d18.entry.js} +1 -1
- package/dist/twilight/{p-9e950969.entry.js → p-247e6bc1.entry.js} +1 -1
- package/dist/twilight/{p-96908e15.entry.js → p-26d4a829.entry.js} +1 -1
- package/dist/twilight/{p-41e66fae.entry.js → p-2b411871.entry.js} +1 -1
- package/dist/twilight/{p-8fba19d5.entry.js → p-2bd6a7ad.entry.js} +1 -1
- package/dist/twilight/{p-a8ccb3b5.entry.js → p-2c9d2ea4.entry.js} +1 -1
- package/dist/twilight/{p-ba2ec852.entry.js → p-30638d38.entry.js} +1 -1
- package/dist/twilight/{p-af88e681.entry.js → p-33a93add.entry.js} +1 -1
- package/dist/twilight/{p-9a259cd4.entry.js → p-34968257.entry.js} +1 -1
- package/dist/twilight/{p-779e8604.entry.js → p-376ca265.entry.js} +1 -1
- package/dist/twilight/{p-7df3873f.entry.js → p-379956ef.entry.js} +1 -1
- package/dist/twilight/{p-aeef91fe.entry.js → p-3b227e0d.entry.js} +1 -1
- package/dist/twilight/{p-f5c7d01f.entry.js → p-3cdf1264.entry.js} +1 -1
- package/dist/twilight/{p-509279da.entry.js → p-3d9d15b0.entry.js} +1 -1
- package/dist/twilight/{p-70416928.entry.js → p-3de8587f.entry.js} +1 -1
- package/dist/twilight/{p-4b764afc.entry.js → p-3e88938d.entry.js} +1 -1
- package/dist/twilight/{p-a539d51c.entry.js → p-40cd342c.entry.js} +1 -1
- package/dist/twilight/{p-395dfda3.entry.js → p-42686603.entry.js} +1 -1
- package/dist/twilight/{p-123bd7f1.entry.js → p-43437311.entry.js} +1 -1
- package/dist/twilight/{p-71b24810.entry.js → p-46d4d4f1.entry.js} +1 -1
- package/dist/twilight/{p-26b01da9.entry.js → p-4947d2c3.entry.js} +1 -1
- package/dist/twilight/{p-6d114c0b.entry.js → p-4d67b437.entry.js} +1 -1
- package/dist/twilight/{p-7ccd3918.entry.js → p-53e8d007.entry.js} +1 -1
- package/dist/twilight/{p-a3e65c78.entry.js → p-56851c9a.entry.js} +1 -1
- package/dist/twilight/{p-97bf34f8.entry.js → p-58969bd2.entry.js} +1 -1
- package/dist/twilight/{p-2bcd9e4b.entry.js → p-58a2b477.entry.js} +1 -1
- package/dist/twilight/{p-12b95fd5.entry.js → p-59500502.entry.js} +1 -1
- package/dist/twilight/{p-04c4ac9d.entry.js → p-597243e9.entry.js} +1 -1
- package/dist/twilight/{p-93f7e2a0.entry.js → p-5c7d194c.entry.js} +1 -1
- package/dist/twilight/{p-15afb5f2.entry.js → p-5c923f3e.entry.js} +1 -1
- package/dist/twilight/{p-877de10b.entry.js → p-5ce7a5f4.entry.js} +1 -1
- package/dist/twilight/{p-7782ef7a.entry.js → p-610cf53f.entry.js} +1 -1
- package/dist/twilight/{p-5cc43d68.entry.js → p-6246f251.entry.js} +1 -1
- package/dist/twilight/{p-af61b17f.entry.js → p-63e4468c.entry.js} +1 -1
- package/dist/twilight/{p-815559c2.entry.js → p-69791429.entry.js} +1 -1
- package/dist/twilight/{p-79994729.entry.js → p-72302934.entry.js} +1 -1
- package/dist/twilight/{p-157963b1.entry.js → p-74000383.entry.js} +1 -1
- package/dist/twilight/{p-56554552.entry.js → p-75ca0611.entry.js} +1 -1
- package/dist/twilight/p-75cd81c8.entry.js +4 -0
- package/dist/twilight/{p-ee8d8338.entry.js → p-782376aa.entry.js} +1 -1
- package/dist/twilight/{p-14ab267b.entry.js → p-78b64ecf.entry.js} +1 -1
- package/dist/twilight/{p-ea68294d.entry.js → p-7ad821d8.entry.js} +1 -1
- package/dist/twilight/{p-c721e1f9.entry.js → p-7c9cee72.entry.js} +1 -1
- package/dist/twilight/{p-d25eaeb2.entry.js → p-8416f053.entry.js} +1 -1
- package/dist/twilight/{p-937f7f9b.entry.js → p-8641e913.entry.js} +1 -1
- package/dist/twilight/{p-c0f2f74c.entry.js → p-87b03980.entry.js} +1 -1
- package/dist/twilight/{p-767fc48b.entry.js → p-87b8805f.entry.js} +1 -1
- package/dist/twilight/{p-0103f018.entry.js → p-88b5f845.entry.js} +1 -1
- package/dist/twilight/{p-a9853194.entry.js → p-8d1a1d2f.entry.js} +1 -1
- package/dist/twilight/{p-1485dba4.entry.js → p-8d8ce19f.entry.js} +1 -1
- package/dist/twilight/{p-9e1fa90c.entry.js → p-8e17a662.entry.js} +1 -1
- package/dist/twilight/{p-4e708377.entry.js → p-926861b0.entry.js} +1 -1
- package/dist/twilight/{p-8d77fc58.entry.js → p-9da90445.entry.js} +1 -1
- package/dist/twilight/{p-9td0x-W4.js → p-B5LlhDea.js} +1 -1
- package/dist/twilight/p-B9q7ymSg.js +4 -0
- package/dist/twilight/{p--ucq83XK.js → p-BNxL6rtA.js} +1 -1
- package/dist/twilight/{p-utw6PQ3w.js → p-BQ7LZ-gv.js} +1 -1
- package/dist/twilight/{p-DjOBdfDM.js → p-CJNSdTHZ.js} +1 -1
- package/dist/twilight/{p-Djm0oxTL.js → p-CKo8lUax.js} +1 -1
- package/dist/twilight/{p-B6g8RXLV.js → p-CdiD-2Z3.js} +1 -1
- package/dist/twilight/{p-CYbUnAsY.js → p-ClsWSoli.js} +1 -1
- package/dist/twilight/{p-D136Y0xG.js → p-D4LxjuhN.js} +1 -1
- package/dist/twilight/{p-n3pMJbfq.js → p-DD48ApDW.js} +2 -2
- package/dist/twilight/{p-DyQCnC43.js → p-DNerctfJ.js} +1 -1
- package/dist/twilight/{p-BXjd-F0j.js → p-DsEuHqot.js} +1 -1
- package/dist/twilight/{p-4705b3ee.entry.js → p-a241a76f.entry.js} +1 -1
- package/dist/twilight/{p-9f384e06.entry.js → p-a3a666c9.entry.js} +1 -1
- package/dist/twilight/{p-0b77c960.entry.js → p-a59e6aa6.entry.js} +1 -1
- package/dist/twilight/{p-359351e3.entry.js → p-ab7940b0.entry.js} +1 -1
- package/dist/twilight/{p-6bc0a7cb.entry.js → p-ac63d3c2.entry.js} +1 -1
- package/dist/twilight/{p-1e1a77d1.entry.js → p-ad96b0eb.entry.js} +1 -1
- package/dist/twilight/{p-8aa94d13.entry.js → p-b1ecd1bb.entry.js} +1 -1
- package/dist/twilight/{p-8633dca6.entry.js → p-b30b0488.entry.js} +1 -1
- package/dist/twilight/{p-1d2bc592.entry.js → p-b5b0ca7c.entry.js} +1 -1
- package/dist/twilight/{p-c4297ff7.entry.js → p-b8815e28.entry.js} +1 -1
- package/dist/twilight/p-b8cfcf08.entry.js +4 -0
- package/dist/twilight/{p-b357f9ea.entry.js → p-b8d5d785.entry.js} +1 -1
- package/dist/twilight/{p-a83693c7.entry.js → p-bae0376c.entry.js} +1 -1
- package/dist/twilight/{p-a4c2aaf4.entry.js → p-bb7f8555.entry.js} +1 -1
- package/dist/twilight/{p-3a3145e4.entry.js → p-bfe4961c.entry.js} +1 -1
- package/dist/twilight/{p-d3e569a0.entry.js → p-c6b90867.entry.js} +1 -1
- package/dist/twilight/{p-53e47f9d.entry.js → p-c8632eac.entry.js} +1 -1
- package/dist/twilight/{p-d90a4f86.entry.js → p-cd5d24ce.entry.js} +1 -1
- package/dist/twilight/{p-6183d223.entry.js → p-cdf7bbdf.entry.js} +1 -1
- package/dist/twilight/{p-259956fe.entry.js → p-cf07ebbf.entry.js} +1 -1
- package/dist/twilight/{p-441fcdb4.entry.js → p-d016060c.entry.js} +1 -1
- package/dist/twilight/{p-7daa82fe.entry.js → p-d51142bc.entry.js} +1 -1
- package/dist/twilight/p-d8bf2907.entry.js +4 -0
- package/dist/twilight/{p-50940460.entry.js → p-d9739d37.entry.js} +1 -1
- package/dist/twilight/{p-d7b6f6d3.entry.js → p-dfc15c20.entry.js} +1 -1
- package/dist/twilight/p-e81e649c.entry.js +4 -0
- package/dist/twilight/{p-d0a173d2.entry.js → p-e85b1ffb.entry.js} +1 -1
- package/dist/twilight/{p-4d650b67.entry.js → p-e98fb647.entry.js} +1 -1
- package/dist/twilight/{p-07f53154.entry.js → p-eaa6a288.entry.js} +1 -1
- package/dist/twilight/{p-fa5c37c2.entry.js → p-f2437a5e.entry.js} +1 -1
- package/dist/twilight/{p-16d00717.entry.js → p-f3d815f9.entry.js} +1 -1
- package/dist/twilight/{p-0697f8d6.entry.js → p-f7ca9b12.entry.js} +1 -1
- package/dist/twilight/{p-d1f54ea9.entry.js → p-fa0363af.entry.js} +1 -1
- package/dist/twilight/{p-5202a5a2.entry.js → p-fa560d9b.entry.js} +1 -1
- package/dist/twilight/twilight.esm.js +1 -1
- package/dist/types/components/salla-modal/salla-modal.d.ts +10 -0
- package/dist/types/components/salla-order-options-modal/salla-order-options-modal.d.ts +5 -1
- package/dist/types/components/salla-user-settings/salla-user-settings.d.ts +84 -9
- package/dist/types/components.d.ts +15 -0
- package/package.json +5 -5
- package/dist/twilight/p-484522bf.entry.js +0 -4
- package/dist/twilight/p-80b34fa0.entry.js +0 -4
- package/dist/twilight/p-a53b3edf.entry.js +0 -4
- package/dist/twilight/p-bbf6ad7e.entry.js +0 -4
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as s,h as a,H as r}from"./p-
|
|
4
|
+
import{r as s,h as a,H as r}from"./p-CJNSdTHZ.js";const t=class{constructor(a){s(this,a)}handleOrderChange(s){s?this.setSummaryFromProp(s):this.summary=void 0}async componentWillLoad(){await Salla.onReady(),this.order&&this.setSummaryFromProp(this.order)}setSummaryFromProp(s){try{const a="string"==typeof s?JSON.parse(s):s;this.summary=a}catch(s){salla.logger.error("Failed to parse order summary data",s),this.summary=void 0}}renderTotalRow(s,r,t,l,o){return a("div",{class:"s-order-totals-card-row"},a("div",{class:"s-order-totals-card-row-inner"},a("dt",{class:t||"s-order-totals-card-label"},s),a("dd",{class:l||"s-order-totals-card-value"},a(o?"b":"span",{innerHTML:salla.money(r)}))))}renderDiscountRow(){return this.summary?.discounts?.map((s=>a("div",{class:"s-order-totals-card-row",key:s.name},a("div",{class:"s-order-totals-card-row-inner"},a("dt",{class:"s-order-totals-card-discount"},s.name),a("dd",{class:"s-order-totals-card-value"},s.discount)))))}renderRefundRow(s){return a("div",{class:"s-order-totals-card-row"},a("div",{class:"s-order-totals-card-row-inner"},a("dt",{class:"s-order-totals-card-refund-label"},a("span",{class:"s-order-totals-card-refund-icon"},a("i",{class:"sicon-info"})),a("span",null," ",salla.lang.get("pages.orders.refund_amount"))),a("dd",{class:"s-order-totals-card-refund-value"},a("b",{innerHTML:salla.money(s)}))))}render(){if(!this.summary)return a(r,{class:"s-order-totals-card-wrapper"});const{summary:s}=this,t=!!Array.isArray(s.options)&&s.options.length>0;return a(r,{class:"s-order-totals-card-wrapper"},a("div",{class:"s-order-totals-card-panel"},a("h2",{id:"summary-heading",class:"s-order-totals-card-heading"},salla.lang.get("pages.orders.summary")),a("div",{class:"s-order-totals-card-flow"},a("dl",{class:"s-order-totals-card-list"},this.renderTotalRow(salla.lang.get("pages.cart.items_total"),s.sub_total),t&&this.renderTotalRow(salla.lang.get("pages.cart.order_options_total"),s.options_total),s.discounts&&this.renderDiscountRow(),s.cod_cost&&this.renderTotalRow(salla.lang.get("pages.orders.cod_cost"),s.cod_cost,""),s.shipping_cost&&this.renderTotalRow(salla.lang.get("pages.orders.shipping_cost"),s.shipping_cost,"s-order-totals-card-shipping"),s.tax&&this.renderTotalRow(`${salla.lang.get("pages.cart.tax")} ${s.tax.percent}%`,s.tax.amount,""),s.paid_amount?this.renderTotalRow(salla.lang.get("pages.orders.partially_paid"),s.paid_amount,""):null,s.remaining_amount?this.renderTotalRow(salla.lang.get("pages.orders.remaining_amount"),s.remaining_amount,""):null,a("div",{class:"s-order-totals-card-total"},this.renderTotalRow(salla.lang.get("pages.orders.final_total"),s.total,"s-order-totals-card-total-label","s-order-totals-card-total-value",!0)),s.refund_amount?a("div",{class:"s-order-totals-card-refund"},this.renderRefundRow(s.refund_amount)):null))))}static get watchers(){return{order:["handleOrderChange"]}}};t.style=":host{display:block}";export{t as salla_order_totals_card}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as s,h as t,H as e}from"./p-
|
|
4
|
+
import{r as s,h as t,H as e}from"./p-CJNSdTHZ.js";import{i as r}from"./p-DqDX5na4.js";const a=class{constructor(t){s(this,t),this.shipments=[]}async componentWillLoad(){return await salla.onReady(),this.fetchShipments()}async onOrderIdChange(){this.shipments=[],await this.fetchShipments()}async fetchShipments(){if(!salla.config.get("store.features",[]).includes("thankyou-page-multi-shipments"))return;const s=this.orderId||salla.config.get("page.id");if(s)try{const t=await salla.order.api.getShipments(s),e=t?.data;this.shipments=Array.isArray(e)?e:Array.isArray(e?.data)?e.data:[]}catch(s){const t=s?.response?.data?.error?.message||s?.response?.data?.message;t&&salla.notify.error(t)}}label(s,t){return salla.lang.getWithDefault(s,t)}async copyTracking(s){try{await navigator.clipboard.writeText(s),salla.notify.success(this.label("common.elements.copied","تم النسخ"))}catch{}}renderTracking(s){const e=s.number;return e?t("span",{class:"s-order-shipments-tracking"},this.label("pages.thank_you.tracking_no","رقم تتبع الشحنة"),t("b",{dir:"ltr"},"#",e),t("button",{type:"button",class:"s-order-shipments-copy",title:this.label("common.elements.copy","نسخ"),onClick:()=>this.copyTracking(String(e))},t("span",{innerHTML:r}))):t("span",{class:"s-order-shipments-placeholder"},this.label("pages.thank_you.tracking_placeholder","سيتم تعيين رقم تتبع بمجرد تجهيز الشحنة"))}renderShipment(s,e){return t("div",{class:"s-order-shipments-card"},t("div",{class:"s-order-shipments-header"},s.logo?t("img",{src:s.logo,class:"s-order-shipments-logo",alt:s.name||"",width:"56",height:"32"}):null,t("span",{class:"s-order-shipments-title"},this.label("pages.thank_you.shipment","الشحنة")," (",e+1,")")),t("div",{class:"s-order-shipments-info"},this.renderTracking(s)),t("div",{class:"s-order-shipments-items"},(s.products||[]).map((s=>t("span",{class:"s-order-shipments-item",title:s.name},s.image?t("img",{src:s.image,alt:s.name,width:"56",height:"56"}):t("span",{class:"s-order-shipments-item-name"},s.name))))))}render(){return this.shipments.length<2?t(e,{class:"s-order-shipments-empty"}):t(e,{class:"s-order-shipments-wrapper"},t("div",{class:"s-order-shipments-list"},this.shipments.map(((s,t)=>this.renderShipment(s,t)))))}static get watchers(){return{orderId:["onOrderIdChange"]}}};a.style=":host{display:block}";export{a as salla_order_shipments}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as s,h as t,H as i}from"./p-
|
|
4
|
+
import{r as s,h as t,H as i}from"./p-CJNSdTHZ.js";const r=class{constructor(t){s(this,t),this.placeholderImage=salla.url.cdn("images/s-empty.png")}getProductImage(){return this.productDetails?.image?"string"==typeof this.productDetails.image?this.productDetails.image:this.productDetails.image.url||this.placeholderImage||salla.url.cdn("images/s-empty.png"):this.placeholderImage}getProductImageAlt(){return this.productDetails?.image&&"string"!=typeof this.productDetails.image?this.productDetails.image.alt||this.productDetails?.name||"":this.productDetails?.name||""}getAccordionId(){return`accordion-${this.productDetails?.id||"default"}`}getAccordionKey(){return this.productDetails?.id||"default"}shouldBeCollapsible(){return void 0!==this.collapsible?this.collapsible:this.productDetails?.options?.length>0}renderOptions(){return this.productDetails?.options?.length?t("salla-accordion-body",null,t("div",{class:"s-order-details-options"},t("salla-order-details-options",{options:this.productDetails.options}))):null}render(){if(!this.productDetails)return null;const s=this.shouldBeCollapsible();return t(i,{class:"s-order-details-bundle-wrapper"},t("salla-accordion",{key:this.getAccordionKey(),collapsed:!1,bordered:!0,collapsible:s,id:this.getAccordionId(),size:"sm"},t("salla-accordion-head",null,t("div",{class:"s-order-details-product"},t("div",{class:"s-order-details-product-content"},t("div",{class:"s-order-details-product-info"},t("div",{class:"s-order-details-product-image"},t("img",{src:this.getProductImage(),alt:this.getProductImageAlt()})),t("div",{class:"s-order-details-product-details"},t("a",{href:this.productDetails?.url||"#",class:"s-order-details-product-name"},this.productDetails?.name||""),this.productDetails?.quantity&&t("span",{class:"s-order-details-product-quantity"},"×",this.productDetails.quantity)))))),this.renderOptions()))}};r.style="";export{r as salla_order_details_multiple_bundle_product}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as s,h as t,c as e,a}from"./p-
|
|
4
|
+
import{r as s,h as t,c as e,a}from"./p-CJNSdTHZ.js";const c=class{constructor(t){s(this,t),this.isSelected=!1}async getChild(){return{selected:this.selected.bind(this),unselect:this.unselect.bind(this),name:this.name}}unselect(){this.isSelected=!1}selected(){this.isSelected=!0}render(){return t("div",{key:"f5cfa9676bc8314149cb78e103b9ef580c0d7559",class:{"s-tabs-content":!0,"s-tabs-content-selected":this.isSelected}},t("slot",{key:"1b86591377c09f1acb25cda20024b3af9c6a874d"}))}};c.style="";const i=class{constructor(t){s(this,t),this.tabSelected=e(this,"tabSelected"),this.id=Math.random().toString(36).slice(2,10),this.activeClass=void 0,this.height=void 0,this.centered=!1,this.isSelected=!1}async getChild(){return{selected:this.selected.bind(this),unselect:this.unselect.bind(this),name:this.name,id:this.id}}unselect(){this.isSelected=!1}selected(){this.isSelected=!0}onClick(){this.getChild().then((s=>{this.tabSelected.emit(s)}))}render(){return[t("div",{key:"a9548ed2a74d30e6fcf365dbe26aa5f7fdab2468",class:{"s-tabs-header-item":!0,"s-tabs-bg-normal":!0,"s-tabs-active":this.isSelected},onClick:this.onClick.bind(this)},t("slot",{key:"547edd40aab5843c6035bd3c36a34d9449dc12d3"}))]}};i.style="";const h=class{constructor(t){s(this,t),this.backgroundColor=void 0,this.vertical=!1}componentWillLoad(){this.createGroup().then((()=>{const[s]=this.tabGroup;this.selectGroup(s)}))}onSelectedTab(s){const t=this.tabGroup.find((t=>t.header.id===s.detail.id));this.selectGroup(t)}async createGroup(){const s=Array.from(this.host.querySelectorAll("salla-tab-header"));this.tabsHeader=await Promise.all(s.map((async s=>await s.getChild())));const t=Array.from(this.host.querySelectorAll("salla-tab-content"));this.tabsContent=await Promise.all(t.map((async s=>await s.getChild()))),this.tabGroup=this.tabsHeader.map((s=>{const t=this.tabsContent.find((t=>t.name===s.name));return{header:s,content:t}}))}selectGroup(s){this.tabGroup.map((s=>{s.header.unselect(),s.content.unselect()})),s.header.selected(),s.content.selected()}render(){return[t("div",{key:"e9054cb114c2bd66940b6afa98d7c7c230353a74",class:"s-tabs"},t("div",{key:"d245f64aef9b7fd77c9c51eb1d86ddfd9202e5fb",class:"s-tabs-header"},t("slot",{key:"f1b9a982cd746d637db5d514cb691f188af0cb7e",name:"header"})),t("div",{key:"0ba8441707b087a8c4d068b1a72bf10c8efb41cc",class:"s-tabs-content-wrapper"},t("slot",{key:"afcee28724a5a9ce263fcc3a38d624a631069945",name:"content"})))]}get host(){return a(this)}};h.style=".s-tabs-header{-ms-overflow-style:none;scrollbar-width:none;}.s-tabs-header::-webkit-scrollbar{display:none}";export{c as salla_tab_content,i as salla_tab_header,h as salla_tabs}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as s,h as a,H as t,a as o}from"./p-DjOBdfDM.js";const i=class{constructor(a){s(this,a),this.availableCoupons=[],this.cartTotal=0,this.cartTotalReady=!1,this.currentCoupon="",this.couponInputValue="",this.couponError="",this.isApplying=!1,this.appliedCoupons=[],this.multiCoupon=!1,this.isHandlingInternalError=!1,this.cartUpdatedHandler=s=>{this.syncCartTotal(s),(this.multiCoupon?Array.isArray(s?.coupons):s&&"coupon"in s)&&this.syncAppliedFromCart(s),this.couponError=""},this.couponAddedHandler=()=>{this.isApplying||this.isHandlingInternalError||this.refreshFromServer()},this.couponAdditionFailedHandler=s=>{this.isApplying||this.isHandlingInternalError||this.showCouponError(s?.message||salla.lang.get("pages.cart.coupon_application_error"))},this.couponDeletedHandler=()=>{this.isApplying||this.isHandlingInternalError||this.refreshFromServer()},this.onKeyUp=s=>{"Enter"===s.key&&this.couponButtonRef?.click(),this.couponError=""},this.onInput=s=>{this.couponInputValue=s.target.value}}async componentWillLoad(){await Salla.onReady(),await Salla.lang.onLoaded(),this.multiCoupon=!!salla.config.get("store.settings.cart.multi_coupon"),this.loadCouponsData(),this.seedFromStorage(),this.loadCartTotal(),this.setupCartEventListeners()}setupCartEventListeners(){salla.event.on("cart::updated",this.cartUpdatedHandler),salla.event.on("cart::coupon.added",this.couponAddedHandler),salla.event.on("cart::coupon.addition.failed",this.couponAdditionFailedHandler),salla.event.on("cart::coupon.deleted",this.couponDeletedHandler)}disconnectedCallback(){salla.event.off("cart::updated",this.cartUpdatedHandler),salla.event.off("cart::coupon.added",this.couponAddedHandler),salla.event.off("cart::coupon.addition.failed",this.couponAdditionFailedHandler),salla.event.off("cart::coupon.deleted",this.couponDeletedHandler)}async selectCoupon(s){const a=this.availableCoupons.find((a=>a.code===s));if(a){if(!this.isEligible(a))throw new Error("Coupon not eligible: minimum cart amount not met");try{await this.applyCoupon(s),this.host.dispatchEvent(new CustomEvent("salla::cart-coupons.coupon.selected",{detail:a,bubbles:!0}))}catch(s){throw s}}return a}async loadCouponsData(){try{const s=await salla.api.request("coupons"),a=s?.data,t=Array.isArray(a)?a:Array.isArray(a?.data)?a.data:[];this.availableCoupons=t}catch(s){console.warn("Failed to load coupons:",s),this.availableCoupons=[]}}async loadCartTotal(){await this.refreshFromServer()}seedFromStorage(){if(this.multiCoupon)return;const s=salla.storage.get("cart");s&&"object"==typeof s&&"coupon"in s&&this.applyCart(s),this.seedTotalsFromSummaryStorage()}seedTotalsFromSummaryStorage(){const s=salla.storage.get("cart.summary");s&&"object"==typeof s&&null!=s.sub_total&&(this.cartTotal=Number(s.sub_total),this.cartTotalReady=!0)}syncCartTotal(s){const a=s?.summary?.sub_total??s?.sub_total??s?.total;null!=a&&(this.cartTotal=Number(a),this.cartTotalReady=!0)}async refreshFromServer(){try{const s=await salla.cart.details(),a=s?.data?.cart??s?.data??s;if(a&&"object"==typeof a&&(Array.isArray(a.coupons)||"coupon"in a))return void this.applyCart(a)}catch(s){}const s=salla.storage.get("cart");s&&this.applyCart(s),this.seedTotalsFromSummaryStorage()}applyCart(s){this.syncCartTotal(s),this.syncAppliedFromCart(s)}syncAppliedFromCart(s){this.currentCoupon=s?.coupon||"",this.multiCoupon?this.appliedCoupons=Array.isArray(s?.coupons)?s.coupons.filter(Boolean):this.currentCoupon?[this.currentCoupon]:[]:(this.couponInputValue=this.currentCoupon,this.appliedCoupons=this.currentCoupon?[this.currentCoupon]:[])}async handleApplyClick(){if(this.isApplying)return;const s=this.couponInputValue.trim();if(s){this.isApplying=!0,this.isHandlingInternalError=!0;try{await salla.cart.addCoupon(s),await this.refreshFromServer(),this.couponInputValue=""}catch(s){this.showCouponError(s.response?.data?.error?.message||salla.lang.get("pages.cart.coupon_application_error"))}finally{this.isApplying=!1,setTimeout((()=>{this.isHandlingInternalError=!1}),100)}}else this.showCouponError(salla.lang.get("pages.cart.enter_coupon_code"))}async handleCouponButtonClick(){if(this.isApplying)return;const s=!!this.currentCoupon;if(s||this.couponInputValue.trim()){this.isApplying=!0,this.isHandlingInternalError=!0;try{s?await salla.cart.deleteCoupon():await salla.cart.addCoupon(this.couponInputValue.trim()),await this.refreshFromServer()}catch(s){this.showCouponError(s.response?.data?.error?.message||salla.lang.get("pages.cart.coupon_application_error"))}finally{this.isApplying=!1,setTimeout((()=>{this.isHandlingInternalError=!1}),100)}}else this.showCouponError(salla.lang.get("pages.cart.enter_coupon_code"))}async removeCoupon(s){if(!this.isApplying){this.isApplying=!0,this.isHandlingInternalError=!0;try{this.multiCoupon?await salla.cart.deleteCoupon(s):await salla.cart.deleteCoupon(),await this.refreshFromServer()}catch(s){this.showCouponError(s.response?.data?.error?.message||salla.lang.get("pages.cart.coupon_application_error"))}finally{this.isApplying=!1,setTimeout((()=>{this.isHandlingInternalError=!1}),100)}}}showCouponError(s){this.couponError=s}handleCouponClick(s){this.applyCoupon(s.code,!1).catch((()=>{}))}async applyCoupon(s,a=!0){if(this.isApplying){if(a)throw new Error("Coupon application already in progress")}else{this.couponInputValue=s,this.couponError="",this.isApplying=!0,this.isHandlingInternalError=!0;try{await salla.cart.addCoupon(s.trim()),await this.refreshFromServer(),this.multiCoupon&&(this.couponInputValue="")}catch(s){if(this.showCouponError(s.response?.data?.error?.message||salla.lang.get("pages.cart.coupon_application_error")),a)throw s}finally{this.isApplying=!1,setTimeout((()=>{this.isHandlingInternalError=!1}),100)}}}formatMainAmount(s){if("percentage"===s.type)return`${salla.helpers.number("object"==typeof s.amount?s.amount.amount:s.amount)}%`;{const t="object"==typeof s.amount?s.amount:{amount:s.amount,currency:s.minimum_amount?.currency||salla.config.get("store.currency.code","SAR")};return a("span",{innerHTML:salla.money(t.amount,t.currency)})}}isEligible(s){return!this.cartTotalReady||!s.minimum_amount||this.cartTotal>=parseFloat(s.minimum_amount.amount)}renderCouponCard(s){const t=this.isEligible(s);return a("div",{class:"s-cart-coupons-slide-one-fourth swiper-slide"},a("div",{class:"s-cart-coupons-card "+(!t||this.isApplying?"s-cart-coupons-disabled":""),onClick:()=>t&&!this.isApplying&&this.handleCouponClick(s)},a("div",{class:"s-cart-coupons-top-section"},a("div",{class:"s-cart-coupons-discount-values"},a("div",{class:"s-cart-coupons-main-amount"},this.formatMainAmount(s)),s.free_shipping?a("div",{class:"s-cart-coupons-secondary-info"},"+ ",salla.lang.get("pages.cart.free_shipping")):s.maximum_amount&&a("div",{class:"s-cart-coupons-secondary-info"},salla.lang.get("pages.cart.up_to")," ",a("span",{innerHTML:salla.money(s.maximum_amount.amount,s.maximum_amount.currency)}))),a("div",{class:"s-cart-coupons-code"},s.code)),a("div",{class:"s-cart-coupons-divider"}),a("div",{class:"s-cart-coupons-bottom-section"},a("div",{class:"s-cart-coupons-terms"},null!=s.remaining_days&&a("div",{class:"s-cart-coupons-expiry "+(s.remaining_days<=3?"s-cart-coupons-expiry-warning":"")},0===s.remaining_days?salla.lang.get("pages.cart.expires_today"):`${salla.lang.get("pages.cart.expires_after")} ${s.remaining_days} ${salla.lang.get("pages.cart.day")}`),s.minimum_amount&&parseFloat(s.minimum_amount.amount)>0&&a("div",{class:"s-cart-coupons-minimum"},salla.lang.get("pages.cart.minimum")," ",a("span",{innerHTML:salla.money(s.minimum_amount.amount,s.minimum_amount.currency)}))),a("div",{class:"s-cart-coupons-action"},t?salla.lang.get("pages.cart.save_coupon"):salla.lang.get("pages.cart.coupon_not_compatible")))))}render(){return a(t,{key:"e3bed8f1f2019db5e1c5ca4280696933913e3081"},a("div",{key:"9c6a7c383394f9bd19107db9b8e76fd9129648e3",class:"s-cart-coupons-wrapper"},a("div",{key:"1e7f74969e709062c36aa19ff4ec27bde0bb10df",class:"s-cart-coupons-input-section"},a("label",{key:"f3bc1f4ffa9c8a64bee8af273597d6f8ff1f8fd0",htmlFor:"coupon-input",class:"s-cart-coupons-coupon-label"},salla.lang.get("pages.cart.have_coupon")),a("div",{key:"7abbdbd41cf6e65b6c08928bb10a68bfb2677d85",class:"s-cart-coupons-coupon-input-container"},this.multiCoupon?[a("input",{type:"text",id:"coupon-input",name:"coupon",class:"form-input "+(this.couponError?"s-coupon-input-error":""),placeholder:salla.lang.get("pages.cart.coupon_placeholder"),value:this.couponInputValue,disabled:this.isApplying,onInput:this.onInput,onKeyUp:this.onKeyUp,"aria-label":salla.lang.get("pages.cart.apply_coupon"),key:"coupon-input"}),a("salla-button",{ref:s=>this.couponButtonRef=s,class:"s-cart-coupons-coupon-button s-cart-coupons-coupon-button-apply",color:"primary",loading:this.isApplying,"loader-position":"center",onClick:()=>this.handleApplyClick(),key:"apply-button"},a("span",null,salla.lang.get("pages.cart.save_coupon")))]:[a("input",{type:"text",id:"coupon-input",name:"coupon",class:"form-input "+(this.couponError?"s-coupon-input-error":""),placeholder:salla.lang.get("pages.cart.coupon_placeholder"),value:this.couponInputValue,disabled:!!this.currentCoupon||this.isApplying,onInput:this.onInput,onKeyUp:this.onKeyUp,"aria-label":salla.lang.get("pages.cart.apply_coupon"),key:"coupon-input"}),a("salla-button",{ref:s=>this.couponButtonRef=s,class:"s-cart-coupons-coupon-button "+(this.currentCoupon?"s-cart-coupons-coupon-button-remove":"s-cart-coupons-coupon-button-apply"),color:this.currentCoupon?"danger":"primary",loading:this.isApplying,"loader-position":"center",onClick:()=>this.handleCouponButtonClick(),key:"apply-button"},this.currentCoupon?a("i",{class:"sicon-cancel"}):a("span",null,salla.lang.get("pages.cart.save_coupon")))]),this.couponError&&a("span",{key:"6c259fbca7a2a3c2ece3d4c335707c833be5f8d6",class:"s-cart-coupons-coupon-error"},this.couponError),this.multiCoupon&&this.appliedCoupons.length>0&&a("div",{key:"87335fd875279e97fc7a02c9f3519af51a953a7b",class:"s-cart-coupons-applied-list"},this.appliedCoupons.map((s=>a("div",{class:"s-cart-coupons-applied-item",key:s},a("span",{class:"s-cart-coupons-applied-code"},s),a("button",{type:"button",class:"s-cart-coupons-applied-remove","aria-label":`${salla.lang.get("pages.cart.delete")} ${s}`,disabled:this.isApplying,onClick:()=>this.removeCoupon(s)},a("i",{class:"sicon-cancel"}))))))),this.availableCoupons&&this.availableCoupons.length>0&&a("salla-slider",{key:"86c665d3135fa8bc393c4b7ad9daca3ce87bed50",type:"carousel",showControls:!1,class:"s-cart-coupons-slider"},a("div",{key:"45ddccd7e0c5d38e9b98f42862a6d64f6040c942",slot:"items"},this.availableCoupons.map((s=>this.renderCouponCard(s)))))))}get host(){return o(this)}};i.style='.s-cart-coupons-applied-list{display:flex;flex-direction:column;gap:8px;margin-top:12px}.s-cart-coupons-applied-item{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:10px 12px;background:#fff;border:1px solid #e5e7eb;border-radius:10px;border-inline-start:3px solid #10b981}.s-cart-coupons-applied-code{display:inline-flex;align-items:center;gap:6px;font-size:13px;font-weight:700;color:#111827}.s-cart-coupons-applied-code::before{content:"";width:7px;height:7px;border-radius:9999px;background:#10b981}.s-cart-coupons-applied-remove{display:inline-flex;align-items:center;justify-content:center;width:26px;height:26px;color:#ef4444;background:transparent;border:0;border-radius:9999px;cursor:pointer;transition:background-color 0.15s ease, color 0.15s ease}.s-cart-coupons-applied-remove:hover{background:#fef2f2}.s-cart-coupons-applied-remove:disabled{opacity:0.5;cursor:not-allowed}';export{i as salla_cart_coupons}
|
|
4
|
+
import{r as s,h as a,H as t,a as o}from"./p-CJNSdTHZ.js";const i=class{constructor(a){s(this,a),this.availableCoupons=[],this.cartTotal=0,this.cartTotalReady=!1,this.currentCoupon="",this.couponInputValue="",this.couponError="",this.isApplying=!1,this.appliedCoupons=[],this.multiCoupon=!1,this.isHandlingInternalError=!1,this.cartUpdatedHandler=s=>{this.syncCartTotal(s),(this.multiCoupon?Array.isArray(s?.coupons):s&&"coupon"in s)&&this.syncAppliedFromCart(s),this.couponError=""},this.couponAddedHandler=()=>{this.isApplying||this.isHandlingInternalError||this.refreshFromServer()},this.couponAdditionFailedHandler=s=>{this.isApplying||this.isHandlingInternalError||this.showCouponError(s?.message||salla.lang.get("pages.cart.coupon_application_error"))},this.couponDeletedHandler=()=>{this.isApplying||this.isHandlingInternalError||this.refreshFromServer()},this.onKeyUp=s=>{"Enter"===s.key&&this.couponButtonRef?.click(),this.couponError=""},this.onInput=s=>{this.couponInputValue=s.target.value}}async componentWillLoad(){await Salla.onReady(),await Salla.lang.onLoaded(),this.multiCoupon=!!salla.config.get("store.settings.cart.multi_coupon"),this.loadCouponsData(),this.seedFromStorage(),this.loadCartTotal(),this.setupCartEventListeners()}setupCartEventListeners(){salla.event.on("cart::updated",this.cartUpdatedHandler),salla.event.on("cart::coupon.added",this.couponAddedHandler),salla.event.on("cart::coupon.addition.failed",this.couponAdditionFailedHandler),salla.event.on("cart::coupon.deleted",this.couponDeletedHandler)}disconnectedCallback(){salla.event.off("cart::updated",this.cartUpdatedHandler),salla.event.off("cart::coupon.added",this.couponAddedHandler),salla.event.off("cart::coupon.addition.failed",this.couponAdditionFailedHandler),salla.event.off("cart::coupon.deleted",this.couponDeletedHandler)}async selectCoupon(s){const a=this.availableCoupons.find((a=>a.code===s));if(a){if(!this.isEligible(a))throw new Error("Coupon not eligible: minimum cart amount not met");try{await this.applyCoupon(s),this.host.dispatchEvent(new CustomEvent("salla::cart-coupons.coupon.selected",{detail:a,bubbles:!0}))}catch(s){throw s}}return a}async loadCouponsData(){try{const s=await salla.api.request("coupons"),a=s?.data,t=Array.isArray(a)?a:Array.isArray(a?.data)?a.data:[];this.availableCoupons=t}catch(s){console.warn("Failed to load coupons:",s),this.availableCoupons=[]}}async loadCartTotal(){await this.refreshFromServer()}seedFromStorage(){if(this.multiCoupon)return;const s=salla.storage.get("cart");s&&"object"==typeof s&&"coupon"in s&&this.applyCart(s),this.seedTotalsFromSummaryStorage()}seedTotalsFromSummaryStorage(){const s=salla.storage.get("cart.summary");s&&"object"==typeof s&&null!=s.sub_total&&(this.cartTotal=Number(s.sub_total),this.cartTotalReady=!0)}syncCartTotal(s){const a=s?.summary?.sub_total??s?.sub_total??s?.total;null!=a&&(this.cartTotal=Number(a),this.cartTotalReady=!0)}async refreshFromServer(){try{const s=await salla.cart.details(),a=s?.data?.cart??s?.data??s;if(a&&"object"==typeof a&&(Array.isArray(a.coupons)||"coupon"in a))return void this.applyCart(a)}catch(s){}const s=salla.storage.get("cart");s&&this.applyCart(s),this.seedTotalsFromSummaryStorage()}applyCart(s){this.syncCartTotal(s),this.syncAppliedFromCart(s)}syncAppliedFromCart(s){this.currentCoupon=s?.coupon||"",this.multiCoupon?this.appliedCoupons=Array.isArray(s?.coupons)?s.coupons.filter(Boolean):this.currentCoupon?[this.currentCoupon]:[]:(this.couponInputValue=this.currentCoupon,this.appliedCoupons=this.currentCoupon?[this.currentCoupon]:[])}async handleApplyClick(){if(this.isApplying)return;const s=this.couponInputValue.trim();if(s){this.isApplying=!0,this.isHandlingInternalError=!0;try{await salla.cart.addCoupon(s),await this.refreshFromServer(),this.couponInputValue=""}catch(s){this.showCouponError(s.response?.data?.error?.message||salla.lang.get("pages.cart.coupon_application_error"))}finally{this.isApplying=!1,setTimeout((()=>{this.isHandlingInternalError=!1}),100)}}else this.showCouponError(salla.lang.get("pages.cart.enter_coupon_code"))}async handleCouponButtonClick(){if(this.isApplying)return;const s=!!this.currentCoupon;if(s||this.couponInputValue.trim()){this.isApplying=!0,this.isHandlingInternalError=!0;try{s?await salla.cart.deleteCoupon():await salla.cart.addCoupon(this.couponInputValue.trim()),await this.refreshFromServer()}catch(s){this.showCouponError(s.response?.data?.error?.message||salla.lang.get("pages.cart.coupon_application_error"))}finally{this.isApplying=!1,setTimeout((()=>{this.isHandlingInternalError=!1}),100)}}else this.showCouponError(salla.lang.get("pages.cart.enter_coupon_code"))}async removeCoupon(s){if(!this.isApplying){this.isApplying=!0,this.isHandlingInternalError=!0;try{this.multiCoupon?await salla.cart.deleteCoupon(s):await salla.cart.deleteCoupon(),await this.refreshFromServer()}catch(s){this.showCouponError(s.response?.data?.error?.message||salla.lang.get("pages.cart.coupon_application_error"))}finally{this.isApplying=!1,setTimeout((()=>{this.isHandlingInternalError=!1}),100)}}}showCouponError(s){this.couponError=s}handleCouponClick(s){this.applyCoupon(s.code,!1).catch((()=>{}))}async applyCoupon(s,a=!0){if(this.isApplying){if(a)throw new Error("Coupon application already in progress")}else{this.couponInputValue=s,this.couponError="",this.isApplying=!0,this.isHandlingInternalError=!0;try{await salla.cart.addCoupon(s.trim()),await this.refreshFromServer(),this.multiCoupon&&(this.couponInputValue="")}catch(s){if(this.showCouponError(s.response?.data?.error?.message||salla.lang.get("pages.cart.coupon_application_error")),a)throw s}finally{this.isApplying=!1,setTimeout((()=>{this.isHandlingInternalError=!1}),100)}}}formatMainAmount(s){if("percentage"===s.type)return`${salla.helpers.number("object"==typeof s.amount?s.amount.amount:s.amount)}%`;{const t="object"==typeof s.amount?s.amount:{amount:s.amount,currency:s.minimum_amount?.currency||salla.config.get("store.currency.code","SAR")};return a("span",{innerHTML:salla.money(t.amount,t.currency)})}}isEligible(s){return!this.cartTotalReady||!s.minimum_amount||this.cartTotal>=parseFloat(s.minimum_amount.amount)}renderCouponCard(s){const t=this.isEligible(s);return a("div",{class:"s-cart-coupons-slide-one-fourth swiper-slide"},a("div",{class:"s-cart-coupons-card "+(!t||this.isApplying?"s-cart-coupons-disabled":""),onClick:()=>t&&!this.isApplying&&this.handleCouponClick(s)},a("div",{class:"s-cart-coupons-top-section"},a("div",{class:"s-cart-coupons-discount-values"},a("div",{class:"s-cart-coupons-main-amount"},this.formatMainAmount(s)),s.free_shipping?a("div",{class:"s-cart-coupons-secondary-info"},"+ ",salla.lang.get("pages.cart.free_shipping")):s.maximum_amount&&a("div",{class:"s-cart-coupons-secondary-info"},salla.lang.get("pages.cart.up_to")," ",a("span",{innerHTML:salla.money(s.maximum_amount.amount,s.maximum_amount.currency)}))),a("div",{class:"s-cart-coupons-code"},s.code)),a("div",{class:"s-cart-coupons-divider"}),a("div",{class:"s-cart-coupons-bottom-section"},a("div",{class:"s-cart-coupons-terms"},null!=s.remaining_days&&a("div",{class:"s-cart-coupons-expiry "+(s.remaining_days<=3?"s-cart-coupons-expiry-warning":"")},0===s.remaining_days?salla.lang.get("pages.cart.expires_today"):`${salla.lang.get("pages.cart.expires_after")} ${s.remaining_days} ${salla.lang.get("pages.cart.day")}`),s.minimum_amount&&parseFloat(s.minimum_amount.amount)>0&&a("div",{class:"s-cart-coupons-minimum"},salla.lang.get("pages.cart.minimum")," ",a("span",{innerHTML:salla.money(s.minimum_amount.amount,s.minimum_amount.currency)}))),a("div",{class:"s-cart-coupons-action"},t?salla.lang.get("pages.cart.save_coupon"):salla.lang.get("pages.cart.coupon_not_compatible")))))}render(){return a(t,{key:"e3bed8f1f2019db5e1c5ca4280696933913e3081"},a("div",{key:"9c6a7c383394f9bd19107db9b8e76fd9129648e3",class:"s-cart-coupons-wrapper"},a("div",{key:"1e7f74969e709062c36aa19ff4ec27bde0bb10df",class:"s-cart-coupons-input-section"},a("label",{key:"f3bc1f4ffa9c8a64bee8af273597d6f8ff1f8fd0",htmlFor:"coupon-input",class:"s-cart-coupons-coupon-label"},salla.lang.get("pages.cart.have_coupon")),a("div",{key:"7abbdbd41cf6e65b6c08928bb10a68bfb2677d85",class:"s-cart-coupons-coupon-input-container"},this.multiCoupon?[a("input",{type:"text",id:"coupon-input",name:"coupon",class:"form-input "+(this.couponError?"s-coupon-input-error":""),placeholder:salla.lang.get("pages.cart.coupon_placeholder"),value:this.couponInputValue,disabled:this.isApplying,onInput:this.onInput,onKeyUp:this.onKeyUp,"aria-label":salla.lang.get("pages.cart.apply_coupon"),key:"coupon-input"}),a("salla-button",{ref:s=>this.couponButtonRef=s,class:"s-cart-coupons-coupon-button s-cart-coupons-coupon-button-apply",color:"primary",loading:this.isApplying,"loader-position":"center",onClick:()=>this.handleApplyClick(),key:"apply-button"},a("span",null,salla.lang.get("pages.cart.save_coupon")))]:[a("input",{type:"text",id:"coupon-input",name:"coupon",class:"form-input "+(this.couponError?"s-coupon-input-error":""),placeholder:salla.lang.get("pages.cart.coupon_placeholder"),value:this.couponInputValue,disabled:!!this.currentCoupon||this.isApplying,onInput:this.onInput,onKeyUp:this.onKeyUp,"aria-label":salla.lang.get("pages.cart.apply_coupon"),key:"coupon-input"}),a("salla-button",{ref:s=>this.couponButtonRef=s,class:"s-cart-coupons-coupon-button "+(this.currentCoupon?"s-cart-coupons-coupon-button-remove":"s-cart-coupons-coupon-button-apply"),color:this.currentCoupon?"danger":"primary",loading:this.isApplying,"loader-position":"center",onClick:()=>this.handleCouponButtonClick(),key:"apply-button"},this.currentCoupon?a("i",{class:"sicon-cancel"}):a("span",null,salla.lang.get("pages.cart.save_coupon")))]),this.couponError&&a("span",{key:"6c259fbca7a2a3c2ece3d4c335707c833be5f8d6",class:"s-cart-coupons-coupon-error"},this.couponError),this.multiCoupon&&this.appliedCoupons.length>0&&a("div",{key:"87335fd875279e97fc7a02c9f3519af51a953a7b",class:"s-cart-coupons-applied-list"},this.appliedCoupons.map((s=>a("div",{class:"s-cart-coupons-applied-item",key:s},a("span",{class:"s-cart-coupons-applied-code"},s),a("button",{type:"button",class:"s-cart-coupons-applied-remove","aria-label":`${salla.lang.get("pages.cart.delete")} ${s}`,disabled:this.isApplying,onClick:()=>this.removeCoupon(s)},a("i",{class:"sicon-cancel"}))))))),this.availableCoupons&&this.availableCoupons.length>0&&a("salla-slider",{key:"86c665d3135fa8bc393c4b7ad9daca3ce87bed50",type:"carousel",showControls:!1,class:"s-cart-coupons-slider"},a("div",{key:"45ddccd7e0c5d38e9b98f42862a6d64f6040c942",slot:"items"},this.availableCoupons.map((s=>this.renderCouponCard(s)))))))}get host(){return o(this)}};i.style='.s-cart-coupons-applied-list{display:flex;flex-direction:column;gap:8px;margin-top:12px}.s-cart-coupons-applied-item{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:10px 12px;background:#fff;border:1px solid #e5e7eb;border-radius:10px;border-inline-start:3px solid #10b981}.s-cart-coupons-applied-code{display:inline-flex;align-items:center;gap:6px;font-size:13px;font-weight:700;color:#111827}.s-cart-coupons-applied-code::before{content:"";width:7px;height:7px;border-radius:9999px;background:#10b981}.s-cart-coupons-applied-remove{display:inline-flex;align-items:center;justify-content:center;width:26px;height:26px;color:#ef4444;background:transparent;border:0;border-radius:9999px;cursor:pointer;transition:background-color 0.15s ease, color 0.15s ease}.s-cart-coupons-applied-remove:hover{background:#fef2f2}.s-cart-coupons-applied-remove:disabled{opacity:0.5;cursor:not-allowed}';export{i as salla_cart_coupons}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Crafted with ❤ by Salla
|
|
3
|
+
*/
|
|
4
|
+
import{r as s,c as t,h as i,H as e,a as h}from"./p-CJNSdTHZ.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;"delete_account"===t?.request_type||document.getElementById("salla-user-settings-delete-modal")?.hasAttribute("visible")||(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 t,c as s,h as i,H as e,a as n}from"./p-DjOBdfDM.js";import{A as o,a as l}from"./p-Vqpj4CWE.js";const d=class{constructor(i){t(this,i),this.optionsSaved=s(this,"optionsSaved"),this.productSelected=s(this,"productSelected"),this.product=null,this.sectionId=null,this.sectionIndex=0,this.productIndex=0,this.selectedOptions={},this.optionsResetTokens={},this.isLoading=!1,this.hasUnsavedChanges=!1,this.validationErrors=[],this.isProductAlreadySelected=!1}generateCacheKey(t,s,i){return`${t||"unknown"}-${s||0}-${i||"unknown"}`}handleProductChange(t){setTimeout((()=>{this.modal&&t&&this.modal.setTitle(t.name||"")}),100),this.validationErrors=[],this.hasUnsavedChanges=!1}async open(){this.modal?(this.isLoading=!0,this.product?.name&&this.modal.setTitle(this.product.name),this.modal.open(),setTimeout((async()=>{this.product?.id&&await this.initializeSelectedOptions(),this.product?.name&&this.modal.setTitle(this.product.name),this.modal.stopLoading(),this.isLoading=!1}),300)):requestAnimationFrame((()=>this.open()))}async close(){this.modal&&this.modal.close()}async refreshOptionsState(){this.selectedOptions={...this.selectedOptions}}componentDidLoad(){this.modalOpenListener=t=>{this.product=t.product,this.sectionId=t.sectionId||null,this.sectionIndex=t.sectionIndex||0,this.productIndex=t.productIndex||0,this.isProductAlreadySelected=!!t.isProductAlreadySelected,this.open()},salla.event.on("multiple-bundle-product-modal::open",this.modalOpenListener),this.clearOptionsListener=t=>{t&&t.productId&&this.clearProductOptions(t.productId,t.sectionId,t.productIndex)},salla.event.on("multiple-bundle-product-modal::clear-options",this.clearOptionsListener),this.optionChangeListener=t=>{const s=t.detail||t,{option:i,detail:e}=s,n=i||s.option_id&&this.product?.options?.find((t=>t.id===s.option_id||String(t.id)===String(s.option_id))),o=e||(s.id?s:null);this.product?.id&&n&&this.handleOptionChange(Number(this.product.id),n,o)},salla.event.on("product-options::change",this.optionChangeListener),this.checkboxChangeListener=t=>{const s=t.target;if(s&&"checkbox"===s.type&&s.name&&s.name.includes("bundle[")&&s.name.includes("][id]")){const t=s.name.match(/^bundle\[([^\]]+)\]\[([^\]]+)\]\[id\]$/);if(t&&!s.checked){if("true"===s.getAttribute("data-selection-locked"))return void(s.checked=!0);const[,i,e]=t,n=s.value,o=this.host.closest("form");this.cleanupProductDeselection({sectionId:i,productIndex:parseInt(e,10),productId:n,form:o,uncheckedInput:s})}}},document.addEventListener("change",this.checkboxChangeListener)}disconnectedCallback(){this.checkboxChangeListener&&document.removeEventListener("change",this.checkboxChangeListener),this.optionChangeListener&&salla.event.off("product-options::change",this.optionChangeListener),this.modalOpenListener&&salla.event.off("multiple-bundle-product-modal::open",this.modalOpenListener),this.clearOptionsListener&&salla.event.off("multiple-bundle-product-modal::clear-options",this.clearOptionsListener)}cleanupProductDeselection(t){const{sectionId:s,productIndex:i,productId:e,form:n,uncheckedInput:o}=t;if(this.clearProductOptions(e,s,i),n){const t=`bundle[${s}][${i}]`;Array.from(n.querySelectorAll(`input[name^="${t}"]`)).forEach((s=>{if(s===o)return;const i="hidden"===s.type,n=s.getAttribute("data-product-id")===String(e)&&s.name?.startsWith(t);(i||n)&&s.remove()})),requestAnimationFrame((()=>{const t=new window.Event("change",{bubbles:!0});n.dispatchEvent(t)}))}}generateFormInputName(t,s,i){return`bundle[${t}][${s}][options][${i}]`}async initializeSelectedOptions(){if(!this.product?.id)return;const t=this.product.id,s=this.generateCacheKey(this.sectionId,this.productIndex,t),i=document.querySelector(`salla-product-options[product-id="${t}"]`);if(i)try{const t=await i.getSelectedOptions();t&&t.length>0&&(this.selectedOptions={...this.selectedOptions,[s]:t})}catch(t){console.warn("Could not initialize selected options:",t)}}clearProductOptions(t,s,i){const e={...this.selectedOptions};if(null==s||null==i||Number.isNaN(i)){const s=`-${String(t)}`,i=[];Object.keys(e).forEach((t=>{t.endsWith(s)&&(delete e[t],i.push(t))})),i.forEach((t=>this.bumpOptionsResetToken(t)))}else{const n=this.generateCacheKey(s,i,t);delete e[n],this.bumpOptionsResetToken(n)}this.selectedOptions=e,this.validationErrors=[],this.hasUnsavedChanges=!1}bumpOptionsResetToken(t){t&&(this.optionsResetTokens={...this.optionsResetTokens,[t]:(this.optionsResetTokens[t]||0)+1})}async handleOptionChange(t,s,i){const e=this.generateCacheKey(this.sectionId,this.productIndex,t),n=document.querySelector(`salla-product-options[product-id="${t}"]`);let o=[];if(n)try{o=await n.getSelectedOptions()||[]}catch(t){console.warn("Could not get current selections from component:",t)}if(o.length>0)this.selectedOptions={...this.selectedOptions,[e]:o};else if(this.selectedOptions[e]&&this.selectedOptions[e].length>0){const t=[...this.selectedOptions[e]||[]],n=t.findIndex((t=>t.option_id===s.id));n>-1?i&&null!=i.id?t[n]={...i,option_id:s.id}:t.splice(n,1):i&&null!=i.id&&t.push({...i,option_id:s.id}),this.selectedOptions={...this.selectedOptions,[e]:t}}else i&&null!=i.id&&(this.selectedOptions={...this.selectedOptions,[e]:[{...i,option_id:s.id}]});this.hasUnsavedChanges=!0,this.validationErrors=[]}async validateOptions(){if(!this.product?.options)return!0;const t=[],s=this.product.id,i=this.generateCacheKey(this.sectionId,this.productIndex,s),e=document.querySelector(`salla-product-options[product-id="${s}"]`);let n=[];if(e)try{n=await e.getSelectedOptions()||[];const t=this.selectedOptions[i]||[];(t.length>n.length||0===n.length&&t.length>0)&&(n=t)}catch(t){n=this.selectedOptions[i]||[]}else n=this.selectedOptions[i]||[];return 0===n.length&&t.push(salla.lang.get("pages.products.no_options_selected")),this.product.options.forEach((s=>{s.required&&(n.some((t=>t.option_id==s.id))||t.push(salla.lang.get("pages.products.required_option_missing",{option:s.name})))})),this.validationErrors=t,0===t.length}async onSave(t){t.preventDefault();const s=this.product?.id;if(!s)return;const i=this.generateCacheKey(this.sectionId,this.productIndex,s);if(await new Promise((t=>setTimeout(t,100))),await this.validateOptions()){if(!this.isProductAlreadySelected&&null!=this.sectionId){const t=this.host.closest("salla-multiple-bundle-product-details");if(!await(t?.canSelectBundleProduct(this.sectionId,s)))return void salla.notify.error(salla.lang.getWithDefault("pages.products.bundle_selection_limit_reached","لا يمكنك اختيار المزيد من المنتجات في هذا القسم"))}this.isLoading=!0;try{const t=document.querySelector(`salla-product-options[product-id="${s}"]`);let e=await(t?.getSelectedOptions());if((!e||0===e.length)&&this.selectedOptions[i]?.length>0&&(e=this.selectedOptions[i]),!e||0===e.length)return void(this.isLoading=!1);this.selectedOptions={...this.selectedOptions,[i]:e};const n=this.host.closest("form");if(!n)return void(this.isLoading=!1);const o=`bundle[${this.sectionId}][${this.productIndex}]`;Array.from(n.querySelectorAll(`input[name^="${o}"][type="hidden"]`)).forEach((t=>t.remove())),Array.from(n.querySelectorAll(`[data-product-id="${s}"][name^="${o}"]`)).forEach((t=>t.remove()));const l=`bundle[${this.sectionId}][${this.productIndex}][id]`,d=document.getElementById(l);if(d)d.checked=!0;else{const t=document.createElement("input");t.type="hidden",t.name=`bundle[${this.sectionId}][${this.productIndex}][id]`,t.value=String(s),t.dataset.productId=String(s),n.appendChild(t)}e.forEach((t=>{const i=t.option_id,e=document.createElement("input");e.type="hidden",e.name=this.generateFormInputName(this.sectionId,this.productIndex??0,i),e.value=String(t.id),e.dataset.productId=String(s),n.appendChild(e)}));const a=new window.Event("change",{bubbles:!0});n.dispatchEvent(a),this.optionsSaved.emit({productId:Number(s),selectedOptions:e,sectionId:this.sectionId,productIndex:this.productIndex}),this.sectionId&&this.productSelected.emit({productId:Number(s),sectionId:this.sectionId,product:this.product,fromModal:!0}),salla.notify.success(salla.lang.get("pages.products.options_saved")),this.hasUnsavedChanges=!1,this.validationErrors=[],this.modal.close()}catch(t){salla.notify.error(salla.lang.get("pages.products.options_save_error"))}finally{this.isLoading=!1}}else salla.notify.error(this.validationErrors.join(", "))}getOptionsWithSelectedState(){if(!this.product?.options)return[];const t=this.generateCacheKey(this.sectionId,this.productIndex,this.product.id),s=this.selectedOptions[t]||[];return this.product.options.map((t=>({...t,details:t.details.map((t=>{const i=s.some((s=>s.id===t.id));return{...t,is_selected:i}}))})))}render(){const t=this.product?.id,s=this.getOptionsWithSelectedState(),n=this.generateCacheKey(this.sectionId,this.productIndex,t),o=this.optionsResetTokens[n]||0,l=this.isLoading||s.some((t=>t.details.some((t=>t.is_selected&&!0===t.is_out))));return i(e,{key:"610ae038d4f9db109e3f25830e82b39a2b07a010"},i("salla-modal",{key:"b06c130448cd1862d2e879a0285fd385395cc11b",isLoading:this.isLoading,ref:t=>this.modal=t,width:"md",centered:!1,id:`s-multiple-bundle-product-options-modal-options-${t}`,class:"s-multiple-bundle-product-options-modal-wrapper"},i("div",{key:"1f8b9ffa80a40f8240ede4b8996943f7eecf4098",slot:"loading"},i("salla-skeleton",{key:"26463b16022e1f66fd66f4e9cd8907521352bac1",height:"100%",width:"100%"})),this.product?.images&&this.product?.images.length>0&&i("salla-slider",{key:"bae60782cbe4ac7dc325fd666258198cd871a52e",id:`details-slider-${this.product?.id}`,type:"thumbs",loop:!1,"auto-height":!0,"listen-to-thumbnails-option":!0,showThumbsControls:!1,controlsOuter:!1,showControls:!1,class:"s-multiple-bundle-product-options-modal-slider",verticalThumbs:!0,thumbsConfig:{centeredSlides:!0,centeredSlidesBounds:!0,slidesPerView:Math.min(5,Math.max(1,this.product?.images.length)),watchOverflow:!0,watchSlidesProgress:!0,direction:"vertical",spaceBetween:10}},i("div",{key:"998afc3297e89df7e0a6b2514a6d5f4f75152492",slot:"items"},this.product?.images&&this.product?.images.map(((t,s)=>i("div",{key:s,class:"swiper-slide"},i("img",{src:t.url,alt:t.alt||`${this.product?.name} - Image ${s+1}`,loading:"lazy",onError:t=>{t.target.style.display="none"}}))))),this.product?.images&&this.product?.images.length>1&&i("div",{key:"935a3d01a417926e904507d0a64da43c84924068",slot:"thumbs"},this.product?.images&&this.product?.images.map(((t,s)=>i("div",{key:s,"data-caption":`${this.product?.name} - Image ${s+1}`},i("img",{src:t.url,loading:"eager",class:"s-multiple-bundle-product-options-modal-slider-thumb",title:`${this.product?.name} - ${s+1}`,alt:t.alt||`${this.product?.name} - ${s+1}`,onError:t=>{t.target.style.display="none"}})))))),i("salla-product-options",{options:JSON.stringify(s),key:`${n}-reset-${o}`,"product-id":t,"unique-key":`${n}-reset-${o}`}),i("div",{key:"eeb710a27917f6134a2595ebb8e4ec485bb26254",slot:"footer"},i("div",{key:"2ae3d47c461b68d61fcaa1d8f279ae6402aedf2e",class:"s-multiple-bundle-product-options-modal-footer"},i("salla-button",{key:"436f64a89183f0e6d56b6800ad031449c49cc751",onClick:t=>this.onSave(t),loading:this.isLoading,disabled:l},this.isLoading?salla.lang.get("common.elements.saving"):salla.lang.get("common.elements.save"))))))}get host(){return n(this)}static get watchers(){return{product:["handleProductChange"]}}};d.style=":host{display:block}";const a=class{constructor(i){t(this,i),this.productSelected=s(this,"productSelected"),this.productOptionsSelected=s(this,"productOptionsSelected"),this.selectedProducts={},this.isSelectionLocked=!1,this.selectionLimit=0,this.savedOptionsByInstance={},this.handleProductClick=(t,s)=>{const i=this.selectedProducts[this.section.id]?.has(t.id)||!1,e=this.getCheckbox(this.section.id,s);if(i&&this.isSelectionLocked)return void(e&&(e.checked=!0));if(!i&&this.isMaxSelectionReached()&&1!==this.selectionLimit)return;if(1===this.selectionLimit&&!i)return void this.productSelected.emit({product:t,sectionId:this.section.id});if(!e)return;const n=!e.checked;n||(this.dispatchClearOptionsEvent(t,s),this.clearSavedOptionsState(this.section.id,s)),e.checked=n,requestAnimationFrame((()=>{const t=new window.Event("change",{bubbles:!0});e.dispatchEvent(t)})),this.productSelected.emit({product:t,sectionId:this.section.id})},this.handleOptionsClick=t=>{!this.selectedProducts[this.section.id]?.has(t.id)&&this.isMaxSelectionReached()&&1!==this.selectionLimit||this.productOptionsSelected.emit({product:t,sectionId:this.section.id})}}getSelectedCount(){return this.selectedProducts[this.section?.id]?.size??0}isMaxSelectionReached(){return this.selectionLimit>1&&this.getSelectedCount()>=this.selectionLimit}isProductSelectionDisabled(t,s){return 0===t.quantity||!s&&this.isMaxSelectionReached()}getProductInstanceKey(t,s){return`${t}::${s}`}dispatchClearOptionsEvent(t,s){salla.event.dispatch("multiple-bundle-product-modal::clear-options",{productId:t.id,sectionId:this.section.id,sectionIndex:this.sectionIndex,productIndex:s})}handleOptionsSaved(t){const s=t.detail;if(!s)return;const{sectionId:i,productIndex:e,selectedOptions:n}=s;if(null==i||i!==this.section?.id)return;if(null==e||Number.isNaN(e))return;const o=this.getProductInstanceKey(i,e);if(n?.length)this.savedOptionsByInstance={...this.savedOptionsByInstance,[o]:!0};else if(this.savedOptionsByInstance[o]){const t={...this.savedOptionsByInstance};delete t[o],this.savedOptionsByInstance=t}}clearSavedOptionsState(t,s){const i=this.getProductInstanceKey(t,s);if(!this.savedOptionsByInstance[i])return;const e={...this.savedOptionsByInstance};delete e[i],this.savedOptionsByInstance=e}generateEventName(t,s){return`bundle[${t}][${s}][id]`}getCheckbox(t,s){const i=this.generateEventName(t,s);return this.host.querySelector(`input.s-multiple-bundle-product-checkbox[name="${i}"]`)}preventLockedDeselect(t,s){if(!this.isSelectionLocked||!s)return;t.preventDefault(),t.stopPropagation();const i=t.target;"checkbox"===i?.type&&(i.checked=!0)}render(){return i(e,{key:"e473b6089ee0e7026dfec042462ed827dabd0083"},i("salla-slider",{key:"492187e1a1c105c21c48543aa227888d122cfa20",type:"carousel",controlsOuter:!1,showControls:!1,id:`accordion-multiple-bundle-product-${this.section.id}`,pagination:!0,class:"s-multiple-bundle-product-wrapper-slider",sliderConfig:{spaceBetween:0}},i("div",{key:"e40e816439f3b3e1bee12ebdcea60438a45fec12",slot:"items"},this?.section?.products?.map(((t,s)=>{const e=this.selectedProducts[this.section.id]?.has(t.id)||!1,n=e&&this.isSelectionLocked,d=this.isProductSelectionDisabled(t,e),a=this.savedOptionsByInstance[this.getProductInstanceKey(this.section.id,s)]?salla.lang.getWithDefault("pages.products.edit_selected_options","تعديل الخيارات"):salla.lang.get("pages.products.choose_from_options");let c=salla.config.get("theme.is_rtl",!0)?o:l;return i("div",{class:"s-multiple-bundle-product-slide-one-third"+(d?" s-multiple-bundle-product-slide-one-third-disabled":""),key:t.id},i("div",{class:"s-multiple-bundle-product-card"},i("div",{class:"s-multiple-bundle-product-image-wrapper",onClick:()=>this.handleProductClick(t,s)},i("input",{id:this.generateEventName(this.section.id,s),type:"checkbox",class:"s-multiple-bundle-product-checkbox",checked:e,"data-selection-locked":n?"true":void 0,name:this.generateEventName(this.section.id,s),value:t.id,onClick:t=>this.preventLockedDeselect(t,e),onChange:t=>this.preventLockedDeselect(t,e)}),i("img",{src:t.image.url||salla.url.cdn("images/s-empty.png"),loading:"lazy",alt:t.image.alt||t.name,class:"s-multiple-bundle-product-image"})),i("div",{class:"s-multiple-bundle-product-content-wrapper"},i("div",{class:"s-multiple-bundle-product-content"},i("div",{class:"s-multiple-bundle-product-details"},i("div",{class:"s-multiple-bundle-product-title-wrapper"},i("h2",{class:"s-multiple-bundle-product-title"},i("a",{href:t?.url||"#",target:"_blank",rel:"noopener noreferrer"},t.name))),i("div",{class:"s-multiple-bundle-product-price-wrapper"},i("span",{class:"s-multiple-bundle-product-price"},i("span",{innerHTML:salla.money(t.price)})),t.sale_price>0&&i("span",{class:"s-multiple-bundle-product-price-discount"},i("span",{innerHTML:salla.money(t.regular_price)})))),t.quantity_in_group>0&&0!==t.quantity&&i("span",{class:"s-multiple-bundle-product-badge"},salla.lang.get("pages.products.pieces"),i("span",null,t.quantity_in_group)),0===t.quantity&&i("span",{class:"s-multiple-bundle-product-badge"},salla.lang.get("pages.products.quantity_in_group_finished"))),t.options?.length>0&&i("button",{class:"s-multiple-bundle-product-button",onClick:()=>this.handleOptionsClick(t),type:"button"},a,i("span",{class:"s-multiple-bundle-product-button-icon",innerHTML:c})))))})))))}get host(){return n(this)}};a.style="";export{d as salla_multiple_bundle_product_options_modal,a as salla_multiple_bundle_product_slider}
|
|
4
|
+
import{r as t,c as s,h as i,H as e,a as n}from"./p-CJNSdTHZ.js";import{A as o,a as l}from"./p-Vqpj4CWE.js";const d=class{constructor(i){t(this,i),this.optionsSaved=s(this,"optionsSaved"),this.productSelected=s(this,"productSelected"),this.product=null,this.sectionId=null,this.sectionIndex=0,this.productIndex=0,this.selectedOptions={},this.optionsResetTokens={},this.isLoading=!1,this.hasUnsavedChanges=!1,this.validationErrors=[],this.isProductAlreadySelected=!1}generateCacheKey(t,s,i){return`${t||"unknown"}-${s||0}-${i||"unknown"}`}handleProductChange(t){setTimeout((()=>{this.modal&&t&&this.modal.setTitle(t.name||"")}),100),this.validationErrors=[],this.hasUnsavedChanges=!1}async open(){this.modal?(this.isLoading=!0,this.product?.name&&this.modal.setTitle(this.product.name),this.modal.open(),setTimeout((async()=>{this.product?.id&&await this.initializeSelectedOptions(),this.product?.name&&this.modal.setTitle(this.product.name),this.modal.stopLoading(),this.isLoading=!1}),300)):requestAnimationFrame((()=>this.open()))}async close(){this.modal&&this.modal.close()}async refreshOptionsState(){this.selectedOptions={...this.selectedOptions}}componentDidLoad(){this.modalOpenListener=t=>{this.product=t.product,this.sectionId=t.sectionId||null,this.sectionIndex=t.sectionIndex||0,this.productIndex=t.productIndex||0,this.isProductAlreadySelected=!!t.isProductAlreadySelected,this.open()},salla.event.on("multiple-bundle-product-modal::open",this.modalOpenListener),this.clearOptionsListener=t=>{t&&t.productId&&this.clearProductOptions(t.productId,t.sectionId,t.productIndex)},salla.event.on("multiple-bundle-product-modal::clear-options",this.clearOptionsListener),this.optionChangeListener=t=>{const s=t.detail||t,{option:i,detail:e}=s,n=i||s.option_id&&this.product?.options?.find((t=>t.id===s.option_id||String(t.id)===String(s.option_id))),o=e||(s.id?s:null);this.product?.id&&n&&this.handleOptionChange(Number(this.product.id),n,o)},salla.event.on("product-options::change",this.optionChangeListener),this.checkboxChangeListener=t=>{const s=t.target;if(s&&"checkbox"===s.type&&s.name&&s.name.includes("bundle[")&&s.name.includes("][id]")){const t=s.name.match(/^bundle\[([^\]]+)\]\[([^\]]+)\]\[id\]$/);if(t&&!s.checked){if("true"===s.getAttribute("data-selection-locked"))return void(s.checked=!0);const[,i,e]=t,n=s.value,o=this.host.closest("form");this.cleanupProductDeselection({sectionId:i,productIndex:parseInt(e,10),productId:n,form:o,uncheckedInput:s})}}},document.addEventListener("change",this.checkboxChangeListener)}disconnectedCallback(){this.checkboxChangeListener&&document.removeEventListener("change",this.checkboxChangeListener),this.optionChangeListener&&salla.event.off("product-options::change",this.optionChangeListener),this.modalOpenListener&&salla.event.off("multiple-bundle-product-modal::open",this.modalOpenListener),this.clearOptionsListener&&salla.event.off("multiple-bundle-product-modal::clear-options",this.clearOptionsListener)}cleanupProductDeselection(t){const{sectionId:s,productIndex:i,productId:e,form:n,uncheckedInput:o}=t;if(this.clearProductOptions(e,s,i),n){const t=`bundle[${s}][${i}]`;Array.from(n.querySelectorAll(`input[name^="${t}"]`)).forEach((s=>{if(s===o)return;const i="hidden"===s.type,n=s.getAttribute("data-product-id")===String(e)&&s.name?.startsWith(t);(i||n)&&s.remove()})),requestAnimationFrame((()=>{const t=new window.Event("change",{bubbles:!0});n.dispatchEvent(t)}))}}generateFormInputName(t,s,i){return`bundle[${t}][${s}][options][${i}]`}async initializeSelectedOptions(){if(!this.product?.id)return;const t=this.product.id,s=this.generateCacheKey(this.sectionId,this.productIndex,t),i=document.querySelector(`salla-product-options[product-id="${t}"]`);if(i)try{const t=await i.getSelectedOptions();t&&t.length>0&&(this.selectedOptions={...this.selectedOptions,[s]:t})}catch(t){console.warn("Could not initialize selected options:",t)}}clearProductOptions(t,s,i){const e={...this.selectedOptions};if(null==s||null==i||Number.isNaN(i)){const s=`-${String(t)}`,i=[];Object.keys(e).forEach((t=>{t.endsWith(s)&&(delete e[t],i.push(t))})),i.forEach((t=>this.bumpOptionsResetToken(t)))}else{const n=this.generateCacheKey(s,i,t);delete e[n],this.bumpOptionsResetToken(n)}this.selectedOptions=e,this.validationErrors=[],this.hasUnsavedChanges=!1}bumpOptionsResetToken(t){t&&(this.optionsResetTokens={...this.optionsResetTokens,[t]:(this.optionsResetTokens[t]||0)+1})}async handleOptionChange(t,s,i){const e=this.generateCacheKey(this.sectionId,this.productIndex,t),n=document.querySelector(`salla-product-options[product-id="${t}"]`);let o=[];if(n)try{o=await n.getSelectedOptions()||[]}catch(t){console.warn("Could not get current selections from component:",t)}if(o.length>0)this.selectedOptions={...this.selectedOptions,[e]:o};else if(this.selectedOptions[e]&&this.selectedOptions[e].length>0){const t=[...this.selectedOptions[e]||[]],n=t.findIndex((t=>t.option_id===s.id));n>-1?i&&null!=i.id?t[n]={...i,option_id:s.id}:t.splice(n,1):i&&null!=i.id&&t.push({...i,option_id:s.id}),this.selectedOptions={...this.selectedOptions,[e]:t}}else i&&null!=i.id&&(this.selectedOptions={...this.selectedOptions,[e]:[{...i,option_id:s.id}]});this.hasUnsavedChanges=!0,this.validationErrors=[]}async validateOptions(){if(!this.product?.options)return!0;const t=[],s=this.product.id,i=this.generateCacheKey(this.sectionId,this.productIndex,s),e=document.querySelector(`salla-product-options[product-id="${s}"]`);let n=[];if(e)try{n=await e.getSelectedOptions()||[];const t=this.selectedOptions[i]||[];(t.length>n.length||0===n.length&&t.length>0)&&(n=t)}catch(t){n=this.selectedOptions[i]||[]}else n=this.selectedOptions[i]||[];return 0===n.length&&t.push(salla.lang.get("pages.products.no_options_selected")),this.product.options.forEach((s=>{s.required&&(n.some((t=>t.option_id==s.id))||t.push(salla.lang.get("pages.products.required_option_missing",{option:s.name})))})),this.validationErrors=t,0===t.length}async onSave(t){t.preventDefault();const s=this.product?.id;if(!s)return;const i=this.generateCacheKey(this.sectionId,this.productIndex,s);if(await new Promise((t=>setTimeout(t,100))),await this.validateOptions()){if(!this.isProductAlreadySelected&&null!=this.sectionId){const t=this.host.closest("salla-multiple-bundle-product-details");if(!await(t?.canSelectBundleProduct(this.sectionId,s)))return void salla.notify.error(salla.lang.getWithDefault("pages.products.bundle_selection_limit_reached","لا يمكنك اختيار المزيد من المنتجات في هذا القسم"))}this.isLoading=!0;try{const t=document.querySelector(`salla-product-options[product-id="${s}"]`);let e=await(t?.getSelectedOptions());if((!e||0===e.length)&&this.selectedOptions[i]?.length>0&&(e=this.selectedOptions[i]),!e||0===e.length)return void(this.isLoading=!1);this.selectedOptions={...this.selectedOptions,[i]:e};const n=this.host.closest("form");if(!n)return void(this.isLoading=!1);const o=`bundle[${this.sectionId}][${this.productIndex}]`;Array.from(n.querySelectorAll(`input[name^="${o}"][type="hidden"]`)).forEach((t=>t.remove())),Array.from(n.querySelectorAll(`[data-product-id="${s}"][name^="${o}"]`)).forEach((t=>t.remove()));const l=`bundle[${this.sectionId}][${this.productIndex}][id]`,d=document.getElementById(l);if(d)d.checked=!0;else{const t=document.createElement("input");t.type="hidden",t.name=`bundle[${this.sectionId}][${this.productIndex}][id]`,t.value=String(s),t.dataset.productId=String(s),n.appendChild(t)}e.forEach((t=>{const i=t.option_id,e=document.createElement("input");e.type="hidden",e.name=this.generateFormInputName(this.sectionId,this.productIndex??0,i),e.value=String(t.id),e.dataset.productId=String(s),n.appendChild(e)}));const a=new window.Event("change",{bubbles:!0});n.dispatchEvent(a),this.optionsSaved.emit({productId:Number(s),selectedOptions:e,sectionId:this.sectionId,productIndex:this.productIndex}),this.sectionId&&this.productSelected.emit({productId:Number(s),sectionId:this.sectionId,product:this.product,fromModal:!0}),salla.notify.success(salla.lang.get("pages.products.options_saved")),this.hasUnsavedChanges=!1,this.validationErrors=[],this.modal.close()}catch(t){salla.notify.error(salla.lang.get("pages.products.options_save_error"))}finally{this.isLoading=!1}}else salla.notify.error(this.validationErrors.join(", "))}getOptionsWithSelectedState(){if(!this.product?.options)return[];const t=this.generateCacheKey(this.sectionId,this.productIndex,this.product.id),s=this.selectedOptions[t]||[];return this.product.options.map((t=>({...t,details:t.details.map((t=>{const i=s.some((s=>s.id===t.id));return{...t,is_selected:i}}))})))}render(){const t=this.product?.id,s=this.getOptionsWithSelectedState(),n=this.generateCacheKey(this.sectionId,this.productIndex,t),o=this.optionsResetTokens[n]||0,l=this.isLoading||s.some((t=>t.details.some((t=>t.is_selected&&!0===t.is_out))));return i(e,{key:"610ae038d4f9db109e3f25830e82b39a2b07a010"},i("salla-modal",{key:"b06c130448cd1862d2e879a0285fd385395cc11b",isLoading:this.isLoading,ref:t=>this.modal=t,width:"md",centered:!1,id:`s-multiple-bundle-product-options-modal-options-${t}`,class:"s-multiple-bundle-product-options-modal-wrapper"},i("div",{key:"1f8b9ffa80a40f8240ede4b8996943f7eecf4098",slot:"loading"},i("salla-skeleton",{key:"26463b16022e1f66fd66f4e9cd8907521352bac1",height:"100%",width:"100%"})),this.product?.images&&this.product?.images.length>0&&i("salla-slider",{key:"bae60782cbe4ac7dc325fd666258198cd871a52e",id:`details-slider-${this.product?.id}`,type:"thumbs",loop:!1,"auto-height":!0,"listen-to-thumbnails-option":!0,showThumbsControls:!1,controlsOuter:!1,showControls:!1,class:"s-multiple-bundle-product-options-modal-slider",verticalThumbs:!0,thumbsConfig:{centeredSlides:!0,centeredSlidesBounds:!0,slidesPerView:Math.min(5,Math.max(1,this.product?.images.length)),watchOverflow:!0,watchSlidesProgress:!0,direction:"vertical",spaceBetween:10}},i("div",{key:"998afc3297e89df7e0a6b2514a6d5f4f75152492",slot:"items"},this.product?.images&&this.product?.images.map(((t,s)=>i("div",{key:s,class:"swiper-slide"},i("img",{src:t.url,alt:t.alt||`${this.product?.name} - Image ${s+1}`,loading:"lazy",onError:t=>{t.target.style.display="none"}}))))),this.product?.images&&this.product?.images.length>1&&i("div",{key:"935a3d01a417926e904507d0a64da43c84924068",slot:"thumbs"},this.product?.images&&this.product?.images.map(((t,s)=>i("div",{key:s,"data-caption":`${this.product?.name} - Image ${s+1}`},i("img",{src:t.url,loading:"eager",class:"s-multiple-bundle-product-options-modal-slider-thumb",title:`${this.product?.name} - ${s+1}`,alt:t.alt||`${this.product?.name} - ${s+1}`,onError:t=>{t.target.style.display="none"}})))))),i("salla-product-options",{options:JSON.stringify(s),key:`${n}-reset-${o}`,"product-id":t,"unique-key":`${n}-reset-${o}`}),i("div",{key:"eeb710a27917f6134a2595ebb8e4ec485bb26254",slot:"footer"},i("div",{key:"2ae3d47c461b68d61fcaa1d8f279ae6402aedf2e",class:"s-multiple-bundle-product-options-modal-footer"},i("salla-button",{key:"436f64a89183f0e6d56b6800ad031449c49cc751",onClick:t=>this.onSave(t),loading:this.isLoading,disabled:l},this.isLoading?salla.lang.get("common.elements.saving"):salla.lang.get("common.elements.save"))))))}get host(){return n(this)}static get watchers(){return{product:["handleProductChange"]}}};d.style=":host{display:block}";const a=class{constructor(i){t(this,i),this.productSelected=s(this,"productSelected"),this.productOptionsSelected=s(this,"productOptionsSelected"),this.selectedProducts={},this.isSelectionLocked=!1,this.selectionLimit=0,this.savedOptionsByInstance={},this.handleProductClick=(t,s)=>{const i=this.selectedProducts[this.section.id]?.has(t.id)||!1,e=this.getCheckbox(this.section.id,s);if(i&&this.isSelectionLocked)return void(e&&(e.checked=!0));if(!i&&this.isMaxSelectionReached()&&1!==this.selectionLimit)return;if(1===this.selectionLimit&&!i)return void this.productSelected.emit({product:t,sectionId:this.section.id});if(!e)return;const n=!e.checked;n||(this.dispatchClearOptionsEvent(t,s),this.clearSavedOptionsState(this.section.id,s)),e.checked=n,requestAnimationFrame((()=>{const t=new window.Event("change",{bubbles:!0});e.dispatchEvent(t)})),this.productSelected.emit({product:t,sectionId:this.section.id})},this.handleOptionsClick=t=>{!this.selectedProducts[this.section.id]?.has(t.id)&&this.isMaxSelectionReached()&&1!==this.selectionLimit||this.productOptionsSelected.emit({product:t,sectionId:this.section.id})}}getSelectedCount(){return this.selectedProducts[this.section?.id]?.size??0}isMaxSelectionReached(){return this.selectionLimit>1&&this.getSelectedCount()>=this.selectionLimit}isProductSelectionDisabled(t,s){return 0===t.quantity||!s&&this.isMaxSelectionReached()}getProductInstanceKey(t,s){return`${t}::${s}`}dispatchClearOptionsEvent(t,s){salla.event.dispatch("multiple-bundle-product-modal::clear-options",{productId:t.id,sectionId:this.section.id,sectionIndex:this.sectionIndex,productIndex:s})}handleOptionsSaved(t){const s=t.detail;if(!s)return;const{sectionId:i,productIndex:e,selectedOptions:n}=s;if(null==i||i!==this.section?.id)return;if(null==e||Number.isNaN(e))return;const o=this.getProductInstanceKey(i,e);if(n?.length)this.savedOptionsByInstance={...this.savedOptionsByInstance,[o]:!0};else if(this.savedOptionsByInstance[o]){const t={...this.savedOptionsByInstance};delete t[o],this.savedOptionsByInstance=t}}clearSavedOptionsState(t,s){const i=this.getProductInstanceKey(t,s);if(!this.savedOptionsByInstance[i])return;const e={...this.savedOptionsByInstance};delete e[i],this.savedOptionsByInstance=e}generateEventName(t,s){return`bundle[${t}][${s}][id]`}getCheckbox(t,s){const i=this.generateEventName(t,s);return this.host.querySelector(`input.s-multiple-bundle-product-checkbox[name="${i}"]`)}preventLockedDeselect(t,s){if(!this.isSelectionLocked||!s)return;t.preventDefault(),t.stopPropagation();const i=t.target;"checkbox"===i?.type&&(i.checked=!0)}render(){return i(e,{key:"e473b6089ee0e7026dfec042462ed827dabd0083"},i("salla-slider",{key:"492187e1a1c105c21c48543aa227888d122cfa20",type:"carousel",controlsOuter:!1,showControls:!1,id:`accordion-multiple-bundle-product-${this.section.id}`,pagination:!0,class:"s-multiple-bundle-product-wrapper-slider",sliderConfig:{spaceBetween:0}},i("div",{key:"e40e816439f3b3e1bee12ebdcea60438a45fec12",slot:"items"},this?.section?.products?.map(((t,s)=>{const e=this.selectedProducts[this.section.id]?.has(t.id)||!1,n=e&&this.isSelectionLocked,d=this.isProductSelectionDisabled(t,e),a=this.savedOptionsByInstance[this.getProductInstanceKey(this.section.id,s)]?salla.lang.getWithDefault("pages.products.edit_selected_options","تعديل الخيارات"):salla.lang.get("pages.products.choose_from_options");let c=salla.config.get("theme.is_rtl",!0)?o:l;return i("div",{class:"s-multiple-bundle-product-slide-one-third"+(d?" s-multiple-bundle-product-slide-one-third-disabled":""),key:t.id},i("div",{class:"s-multiple-bundle-product-card"},i("div",{class:"s-multiple-bundle-product-image-wrapper",onClick:()=>this.handleProductClick(t,s)},i("input",{id:this.generateEventName(this.section.id,s),type:"checkbox",class:"s-multiple-bundle-product-checkbox",checked:e,"data-selection-locked":n?"true":void 0,name:this.generateEventName(this.section.id,s),value:t.id,onClick:t=>this.preventLockedDeselect(t,e),onChange:t=>this.preventLockedDeselect(t,e)}),i("img",{src:t.image.url||salla.url.cdn("images/s-empty.png"),loading:"lazy",alt:t.image.alt||t.name,class:"s-multiple-bundle-product-image"})),i("div",{class:"s-multiple-bundle-product-content-wrapper"},i("div",{class:"s-multiple-bundle-product-content"},i("div",{class:"s-multiple-bundle-product-details"},i("div",{class:"s-multiple-bundle-product-title-wrapper"},i("h2",{class:"s-multiple-bundle-product-title"},i("a",{href:t?.url||"#",target:"_blank",rel:"noopener noreferrer"},t.name))),i("div",{class:"s-multiple-bundle-product-price-wrapper"},i("span",{class:"s-multiple-bundle-product-price"},i("span",{innerHTML:salla.money(t.price)})),t.sale_price>0&&i("span",{class:"s-multiple-bundle-product-price-discount"},i("span",{innerHTML:salla.money(t.regular_price)})))),t.quantity_in_group>0&&0!==t.quantity&&i("span",{class:"s-multiple-bundle-product-badge"},salla.lang.get("pages.products.pieces"),i("span",null,t.quantity_in_group)),0===t.quantity&&i("span",{class:"s-multiple-bundle-product-badge"},salla.lang.get("pages.products.quantity_in_group_finished"))),t.options?.length>0&&i("button",{class:"s-multiple-bundle-product-button",onClick:()=>this.handleOptionsClick(t),type:"button"},a,i("span",{class:"s-multiple-bundle-product-button-icon",innerHTML:c})))))})))))}get host(){return n(this)}};a.style="";export{d as salla_multiple_bundle_product_options_modal,a as salla_multiple_bundle_product_slider}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as a,h as t,H as s,a as e}from"./p-
|
|
4
|
+
import{r as a,h as t,H as s,a as e}from"./p-CJNSdTHZ.js";const i=class{constructor(t){if(a(this,t),this.entity="product",this.specs=[],this.download=salla.lang.get("pages.thank_you.download"),this.entityId)try{return void(this.entityId=Array.isArray(this.entityId)?this.entityId:JSON.parse(this.entityId))}catch(a){salla.log("Bad json passed via entityId prop")}}getValue(a){if("file"===a.type)return`<a href="${a.value}" class="text-primary" target="_blank"><span class="sicon-download"></span> ${this.download}</a>`;if("url"===a.type)return`<a href="${a.value}" class="text-blue-700 underline" target="_blank">${a.value}</a>`;if("date"===a.type){const t=new Date(a.value);return`${String(t.getDate()).padStart(2,"0")}/${String(t.getMonth()+1).padStart(2,"0")}/${t.getFullYear()}`}return a.value}async componentWillLoad(){if(await salla.onReady(),!salla.config.get("store.features")?.includes("custom-fields"))return salla.logger.error("feature custom-fields is not activated");if(this.entityId||!salla.url.is_page("product.single")&&!salla.url.is_page("product.showNewUrls")||(this.entityId=salla.config.get("page.id")),!this.entityId)return salla.logger.error("can't render salla-metadata without enity-id prop!");await salla.lang.onLoaded(),this.download=salla.lang.get("pages.thank_you.download");const a=await Salla.api.metadata.fetchValues(this.entity,this.entityId);this.specs=a.data[0]?.sections}render(){if(this.specs.length)return t(s,{class:"s-metadata-wrapper"},this.specs.map((a=>t("div",{class:"s-metadata-box"},t("div",{class:"s-metadata-box-header"},t("i",{class:"sicon-list"}),a.name),a.fields.map((a=>t("div",{class:"s-metadata-row"},t("p",{class:"s-metadata-row-name"},a.name),t("p",{class:"s-metadata-row-value",innerHTML:this.getValue(a)}))))))))}get host(){return e(this)}};i.style="";export{i as salla_metadata}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Crafted with ❤ by Salla
|
|
3
|
+
*/
|
|
4
|
+
import{r as e,h as t,H as s}from"./p-CJNSdTHZ.js";const i=class{constructor(t){e(this,t),this.otpInputs=[],this.deletePendingDays=null,this.currentStep="confirm",this.isDeletePending=!1,this.otpType="email",this.otpHasError=!1,this.otpErrorMessage="",this.isSubmitting=!1,this.isVerifyingOtp=!1,this.isSwitchingChannel=!1,this.resendAfter=30,this.showResendLink=!1,this.canHideName=salla.config.get("store.settings.rating.can_customer_hide_name"),this.translationDefaults={"pages.profile.delete_account":{ar:"حذف الحساب",en:"Delete account"},"pages.profile.delete_account_description":{ar:"سيُحذف حسابك وبياناتك من المتجر نهائيًا، بما في ذلك سجل طلباتك.",en:"Your account and data will be permanently deleted from the store, including your order history."},"pages.profile.delete_account_confirm_title":{ar:"هل تريد حذف حسابك؟",en:"Do you want to delete your account?"},"pages.profile.delete_account_warning":{ar:"بعد الحذف، ستفقد الوصول إلى بياناتك، بما في ذلك سجل الطلبات، وقائمة الأمنيات، وأي نقاط ولاء أو رصيد متاح في المحفظة.",en:"After deletion, you will lose access to your data, including order history, wishlist, and any loyalty points or wallet balance."},"pages.profile.cancel":{ar:"إلغاء",en:"Cancel"},"pages.profile.delete_account_otp_title":{ar:"تأكيد حذف الحساب",en:"Confirm account deletion"},"pages.profile.delete_account_otp_instruction":{ar:"للمتابعة، أدخل رمز التحقٌّق المرسل إلى:",en:"To continue, enter the verification code sent to:"},"pages.profile.delete_account_confirm_otp":{ar:"تأكيد الحذف",en:"Confirm deletion"},"pages.profile.delete_account_otp_required":{ar:"يرجى إدخال رمز التحقٌّق",en:"Please enter the verification code"},"pages.profile.delete_account_send_via_phone":{ar:"إرسال عبر الهاتف",en:"Send via phone"},"pages.profile.delete_account_send_via_email":{ar:"إرسال عبر البريد الإلكتروني",en:"Send via email"},"pages.profile.delete_account_success_title":{ar:"أُرسل طلب حذف الحساب",en:"Account deletion request submitted"},"pages.profile.delete_account_success_message":{ar:"سيُحذف حسابك خلال 30 يومًا. يمكنك إلغاء الطلب بتسجيل الدخول مرة أخرى قبل اكتمال الحذف.",en:"Your account will be deleted within 30 days. You can cancel the request by signing in again before deletion is complete."},"pages.profile.ok":{ar:"موافق",en:"OK"},"pages.profile.cancel_deletion_request":{ar:"تراجع عن الحذف",en:"Withdraw deletion"},"pages.profile.delete_account_pending":{ar:"حسابك مجدول للحذف نهائيًا من المتجر خلال :days يومًا. يمكنك التراجع عن الحذف قبل انقضاء المدة.",en:"Your account will be deleted permanently from the store within :days days. You can withdraw the deletion before the deadline."},"pages.profile.delete_request_cancelled":{ar:"تم إلغاء طلب الحذف",en:"Deletion request cancelled"}},this.registerTranslationDefaults(),this.loadTranslations(),salla.onReady((()=>{this.isHiddenName=salla.config.get("user.is_hidden_name"),this.isNotifiable=salla.config.get("user.is_notifiable"),this.canHideName=salla.config.get("store.settings.rating.can_customer_hide_name"),this.fetchDeleteRequestStatus(),this.isNotifiable&&this.isHiddenName||salla.event.on("profile::info.fetched",(e=>{this.isHiddenName=e.data.is_hidden_name,this.isNotifiable=e.data.is_notifiable}))})),salla.lang.onLoaded((()=>{this.registerTranslationDefaults(),this.loadTranslations()}))}getDaysUntilExecution(e){return Math.max(0,Math.ceil(((e>1e12?e:1e3*e)-Date.now())/864e5))}applyPendingMessage(){const e=salla.lang.get("pages.profile.delete_account_pending");this.deleteAccountPending=null!=this.deletePendingDays?e.replace(/:days/g,String(salla.helpers.number(this.deletePendingDays))):e}async fetchDeleteRequestStatus(){try{const e=await salla.profile.getDeleteRequest(),t=e?.data??null,s=t?.data_request||t,i=s?.status;this.isDeletePending="pending"===i;const a=s?.execution_at;this.deletePendingDays=null==a||Number.isNaN(Number(a))?null:this.getDaysUntilExecution(Number(a)),this.applyPendingMessage()}catch{}}registerTranslationDefaults(){if(!salla?.lang?.addBulk)return;const e=Object.entries(this.translationDefaults).reduce(((e,[t,s])=>(salla.lang.get(t)===t&&(e[t]=s),e)),{});Object.keys(e).length&&salla.lang.addBulk(e)}loadTranslations(){this.deleteAccount=salla.lang.get("pages.profile.delete_account"),this.deleteAccountDesc=salla.lang.get("pages.profile.delete_account_description"),this.deleteConfirmTitle=salla.lang.get("pages.profile.delete_account_confirm_title"),this.deleteAccountWarning=salla.lang.get("pages.profile.delete_account_warning"),this.cancelLabel=salla.lang.get("pages.profile.cancel"),this.deleteOtpTitle=salla.lang.get("pages.profile.delete_account_otp_title"),this.deleteOtpInstruction=salla.lang.get("pages.profile.delete_account_otp_instruction"),this.deleteConfirmOtp=salla.lang.get("pages.profile.delete_account_confirm_otp"),this.sendViaPhone=salla.lang.get("pages.profile.delete_account_send_via_phone"),this.sendViaEmail=salla.lang.get("pages.profile.delete_account_send_via_email"),this.deleteSuccessTitle=salla.lang.get("pages.profile.delete_account_success_title"),this.deleteSuccessMessage=salla.lang.get("pages.profile.delete_account_success_message"),this.okLabel=salla.lang.get("pages.profile.ok"),this.cancelDeletionRequest=salla.lang.get("pages.profile.cancel_deletion_request"),this.applyPendingMessage(),this.resendAfterLabel=salla.lang.get("blocks.header.resend_after"),this.resendLabel=salla.lang.get("blocks.comments.submit"),this.promotionalMsgs=salla.lang.get("pages.profile.promotional_messages"),this.hideMyName=salla.lang.get("pages.profile.hide_my_name"),this.hideMyNameDesc=salla.lang.get("pages.profile.hide_my_name_desc"),this.promotionalMsgsDesc=salla.lang.get("pages.profile.promotional_messages_description")}toggleSetting(e,t){salla.profile.updateSettings({name:e,value:t.target.checked})}capitalizeText(e){return e?e.charAt(0).toUpperCase()+e.slice(1):""}getOtpTarget(){return"email"===this.otpType?salla.config.get("user.email")||"":salla.config.get("user.mobile")||""}updateModalForStep(){if(this.confirmationModal)switch(this.currentStep){case"confirm":this.confirmationModal.setTitle(this.capitalizeText(this.deleteConfirmTitle));break;case"otp":this.confirmationModal.setTitle(this.capitalizeText(this.deleteOtpTitle));break;case"success":this.confirmationModal.setTitle(this.capitalizeText(this.deleteSuccessTitle))}}openDeleteModal(){this.currentStep="confirm",this.otpType="email",this.resetOtpInputs(),this.clearResendTimer(),this.updateModalForStep(),this.confirmationModal.open()}closeDeleteModal(){this.clearResendTimer(),this.confirmationModal?.close()}goBackFromOtp(){this.clearResendTimer(),this.resetOtpInputs(),this.resetOtpError(),this.currentStep="confirm",this.updateModalForStep()}async handleModalVisibilityChanged(e){if(e.detail)return;this.clearResendTimer();const t="success"===this.currentStep;t&&(this.isDeletePending=!0),this.currentStep="confirm",this.resetOtpInputs(),t&&await this.fetchDeleteRequestStatus()}formatResendTimer(e){return"00 : "+(e>=10?`${e}`:`0${e}`)}updateResendTimerDisplay(){this.timerEl&&(this.timerEl.innerHTML=this.formatResendTimer(this.resendAfter))}isDeleteRequestInFlight(){return this.isSubmitting||this.isSwitchingChannel||this.isVerifyingOtp}async initiateDeleteRequest(e="confirm"){if(!this.isDeleteRequestInFlight()){"switch"===e||"resend"===e?this.isSwitchingChannel=!0:this.isSubmitting=!0;try{await salla.profile.initiateDeleteRequest(this.otpType),this.currentStep="otp",this.updateModalForStep(),this.resetOtpInputs(),this.startResendTimer(),setTimeout((()=>this.otpInputs[0]?.focus()),100)}catch(e){salla.notify?.error?.(e.response?.data?.error?.message||salla.lang.get("common.errors.error_occurred"))}finally{"switch"===e||"resend"===e?this.isSwitchingChannel=!1:this.isSubmitting=!1}}}async switchOtpChannel(){this.isDeleteRequestInFlight()||(this.otpType="email"===this.otpType?"mobile":"email",await this.initiateDeleteRequest("switch"))}async resendOtp(){this.showResendLink&&!this.isDeleteRequestInFlight()&&await this.initiateDeleteRequest("resend")}collectOtpCode(){const e=salla.helpers.number(this.otpInputs.map((e=>e?.value||"")).join(""),!0).replace(/[^0-9]/g,"");return this.hiddenCodeInput&&(this.hiddenCodeInput.value=e),e}resetOtpError(){this.otpHasError=!1,this.otpErrorMessage=""}setOtpError(e){this.otpHasError=!0,this.otpErrorMessage=e}async verifyDeleteOtp(){if(this.isVerifyingOtp||this.isSwitchingChannel)return;const e=this.collectOtpCode();if(e.length<4)return this.setOtpError(salla.lang.get("pages.profile.delete_account_otp_required")),void this.otpInputs[e.length]?.focus();this.resetOtpError(),this.isVerifyingOtp=!0;try{const t=await salla.profile.verifyDeleteRequest({type:this.otpType,code:e});this.deleteSuccessMessage=t?.data?.message||salla.lang.get("pages.profile.delete_account_success_message"),this.clearResendTimer(),this.resetOtpInputs(),this.otpInputs=[],this.currentStep="success",this.updateModalForStep()}catch(e){this.setOtpError(e.response?.data?.error?.message||salla.lang.get("common.errors.error_occurred")),this.resetOtpInputs()}finally{this.isVerifyingOtp=!1}}async confirmSuccess(){this.isDeletePending=!0,this.closeDeleteModal(),this.currentStep="confirm",await this.fetchDeleteRequestStatus()}async cancelDeleteRequest(){if(!this.isSubmitting){this.isSubmitting=!0;try{const e=(await salla.profile.cancelDeleteRequest()).message||salla.lang.get("pages.profile.delete_request_cancelled");this.isDeletePending=!1,salla.notify?.success?.(e)}catch(e){salla.notify?.error?.(e.response?.data?.error?.message||salla.lang.get("common.errors.error_occurred"))}finally{this.isSubmitting=!1}}}resetOtpInputs(){this.otpInputs.forEach((e=>{e&&(e.value="")})),this.hiddenCodeInput&&(this.hiddenCodeInput.value="")}modifyNextOtpInput(e,t){e.value=t[0],t=t.substring(1),e.nextElementSibling&&t.length?this.modifyNextOtpInput(e.nextElementSibling,t):e.nextElementSibling||0!==t.length?e.nextElementSibling&&0===t.length&&e.nextElementSibling.focus():e.focus()}splitOtpNumber(e){const t=salla.helpers.number(e.data||e.target.value||"",!0).replace(/[^0-9]/g,"");t&&1!==t.length&&this.modifyNextOtpInput(e.target,t)}allOtpInputsFilled(){return this.otpInputs.every((e=>e?.value))}handleOtpInput(e){this.resetOtpError(),e.target.value=salla.helpers.number(e.target.value||"",!0),salla.helpers.inputDigitsOnly(e.target),this.allOtpInputsFilled()&&setTimeout((()=>this.verifyDeleteOtp()),100)}handleOtpKeyUp(e){if(this.resetOtpError(),["Alt","Shift","Control","AltGraph","Ctrl"].includes(e.key))return;const t=e.keyCode||e.charCode;e.target.value?(e.target.nextElementSibling?.focus(),e.target.nextElementSibling?.select()):[8,46].includes(t)&&(e.target.previousElementSibling?.focus(),e.target.previousElementSibling?.select()),e.target.value.length>1&&this.splitOtpNumber(e)}handleOtpPaste(e){this.resetOtpError();const t=salla.helpers.number(e.clipboardData.getData("text")||"",!0).replace(/[^0-9]/g,"").substring(0,this.otpInputs.length);this.otpInputs.forEach((e=>e.value="")),this.otpInputs[0]&&this.modifyNextOtpInput(this.otpInputs[0],t)}handleOtpFocus(e){e.target!==this.otpInputs[0]&&(""===this.otpInputs[0]?.value&&this.otpInputs[0].focus(),""===e.target.previousElementSibling?.value&&e.target.previousElementSibling.focus())}startResendTimer(){this.clearResendTimer(),this.resendAfter=30,this.showResendLink=!1,this.updateResendTimerDisplay(),this.resendTimerId=setInterval((()=>{if(this.resendAfter--,this.resendAfter<=0)return this.clearResendTimer(),void(this.showResendLink=!0);this.updateResendTimerDisplay()}),1e3)}clearResendTimer(){this.resendTimerId&&(clearInterval(this.resendTimerId),this.resendTimerId=null),this.showResendLink=!1}renderUserDeleteIcon(){return t("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"24",height:"24",color:"currentColor",fill:"none",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},t("path",{d:"M14.5 8C14.5 5.23858 12.2614 3 9.5 3C6.73858 3 4.5 5.23858 4.5 8C4.5 10.7614 6.73858 13 9.5 13C12.2614 13 14.5 10.7614 14.5 8Z"}),t("path",{d:"M15.5 21L18.5 18M18.5 18L21.5 15M18.5 18L15.5 15M18.5 18L21.5 21"}),t("path",{d:"M2.5 20C2.5 16.134 5.63401 13 9.5 13C10.775 13 11.9704 13.3409 13 13.9365"}))}renderConfirmStep(){return t("div",{class:"s-user-settings-delete-body"},t("p",{class:"s-user-settings-delete-warning"},this.deleteAccountWarning),t("div",{class:"s-user-settings-delete-actions s-user-settings-delete-actions--row"},t("salla-button",{width:"wide",fill:"outline",color:"danger",onClick:()=>this.closeDeleteModal()},this.capitalizeText(this.cancelLabel)),t("salla-button",{width:"wide",color:"primary",loading:this.isSubmitting,onClick:()=>this.initiateDeleteRequest()},this.capitalizeText(this.deleteAccount))))}renderOtpStep(){return t("div",{class:"s-user-settings-delete-body"},t("p",{class:"s-user-settings-delete-otp-instruction"},this.deleteOtpInstruction),t("p",{class:"s-user-settings-delete-otp-target"},this.getOtpTarget()),t("input",{type:"hidden",name:"code",maxlength:"4",ref:e=>this.hiddenCodeInput=e}),t("div",{class:{"s-user-settings-delete-otp-codes":!0,"has-error":this.otpHasError},dir:"ltr"},[1,2,3,4].map((e=>t("input",{type:"text",autocomplete:"one-time-code",pattern:"[0-9]*",inputmode:"numeric",maxlength:"1",id:`delete-otp-${e}`,class:{"s-user-settings-delete-otp-input":!0,"s-has-error":this.otpHasError},onInput:e=>this.handleOtpInput(e),onPaste:e=>this.handleOtpPaste(e),onKeyUp:e=>this.handleOtpKeyUp(e),onFocus:e=>this.handleOtpFocus(e),ref:t=>this.otpInputs[e-1]=t,required:!0})))),this.otpHasError&&this.otpErrorMessage?t("span",{class:"s-user-settings-delete-otp-error"},this.otpErrorMessage):"",t("div",{class:"s-user-settings-delete-actions s-user-settings-delete-actions--stack"},t("salla-button",{width:"wide",color:"primary",disabled:this.isSwitchingChannel,onClick:()=>this.verifyDeleteOtp()},this.capitalizeText(this.deleteConfirmOtp)),t("salla-button",{width:"wide",fill:"outline",color:"primary",disabled:this.isVerifyingOtp,onClick:()=>this.switchOtpChannel()},this.capitalizeText("email"===this.otpType?this.sendViaPhone:this.sendViaEmail))),t("p",{class:"s-user-settings-delete-otp-resend",style:{display:this.showResendLink?"none":"block"}},this.resendAfterLabel,t("b",{class:"s-user-settings-delete-otp-timer mx-1 font-bold",ref:e=>this.timerEl=e})),t("a",{href:"#",class:"s-user-settings-delete-otp-resend-link",style:{display:this.showResendLink?"block":"none"},onClick:e=>{e.preventDefault(),this.resendOtp()}},this.resendLabel))}renderSuccessStep(){return t("div",{class:"s-user-settings-delete-body"},t("p",{class:"s-user-settings-delete-success-body"},this.deleteSuccessMessage),t("div",{class:"s-user-settings-delete-actions s-user-settings-delete-actions--stack"},t("salla-button",{class:"s-user-settings-delete-success-btn",width:"wide",color:"primary",onClick:()=>this.confirmSuccess()},this.capitalizeText(this.okLabel))))}renderDeleteStep(){switch(this.currentStep){case"otp":return this.renderOtpStep();case"success":return this.renderSuccessStep();default:return this.renderConfirmStep()}}renderDeleteSectionAction(){return this.isDeletePending?t("salla-button",{fill:"outline",color:"danger",shape:"btn",size:"medium",width:"normal",loading:this.isSubmitting,onClick:()=>this.cancelDeleteRequest()},this.capitalizeText(this.cancelDeletionRequest)):t("salla-button",{fill:"outline",color:"danger",shape:"btn",size:"medium",width:"normal",onClick:()=>this.openDeleteModal()},this.capitalizeText(this.deleteAccount))}render(){return t(s,{key:"64356c5b57d826fce8c29cc319a9762464c7fe51",class:"s-user-settings-wrapper"},this.canHideName&&t("div",{key:"4f7b3eb703f89e4a758fca54ba1b214f6724aaea",class:"s-user-settings-section"},t("salla-list-tile",{key:"7ad109e36b278fe81a314d51e1ab68030dd96cdc"},t("div",{key:"c789b7e2c541e25aaaf336e052d1986f6429da71",slot:"icon",class:"s-user-settings-section-icon"},t("span",{key:"5d7b377aefb80139527d8814ee2c636fa9c73e0f",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>user-cancel</title>\n<path d="M29.885 16l1.724-1.724c0.521-0.521 0.521-1.364 0-1.885s-1.364-0.521-1.885 0l-1.724 1.724-1.724-1.724c-0.521-0.521-1.364-0.521-1.885 0s-0.521 1.364 0 1.885l1.724 1.724-1.724 1.724c-0.521 0.521-0.521 1.364 0 1.885 0.26 0.26 0.601 0.391 0.943 0.391s0.683-0.131 0.943-0.391l1.724-1.724 1.724 1.724c0.26 0.26 0.601 0.391 0.943 0.391s0.683-0.131 0.943-0.391c0.521-0.521 0.521-1.364 0-1.885zM10.667 16c4.043 0 7.333-3.289 7.333-7.333s-3.291-7.333-7.333-7.333-7.333 3.289-7.333 7.333 3.291 7.333 7.333 7.333zM10.667 4c2.573 0 4.667 2.093 4.667 4.667s-2.093 4.667-4.667 4.667-4.667-2.093-4.667-4.667 2.093-4.667 4.667-4.667zM10.667 18.667c-5.881 0-10.667 3.813-10.667 8.5v2.167c0 0.736 0.596 1.333 1.333 1.333s1.333-0.597 1.333-1.333v-2.167c0-3.217 3.588-5.833 8-5.833s8 2.616 8 5.833v2.167c0 0.736 0.596 1.333 1.333 1.333s1.333-0.597 1.333-1.333v-2.167c0-4.687-4.785-8.5-10.667-8.5z"></path>\n</svg>\n'})),t("div",{key:"fdb9d6130ef27cffbe4e2ef06e7b9155d0d04c2b",slot:"title",class:"s-user-settings-section-title"},this.capitalizeText(this.hideMyName)),t("div",{key:"bd8592a487c79926355eeea25a5e1429bca0fd80",slot:"subtitle",class:"s-user-settings-section-subtitle"},this.capitalizeText(this.hideMyNameDesc)),t("div",{key:"cf21ed12bb38dc3a613efac6d017a72aab38780b",slot:"action",class:"s-user-settings-section-action"},t("label",{key:"160140e25cf8e6c4556e52c0b36ba5769618b419",class:"s-toggle"},t("input",{key:"369a694fabbd42e6c239b23c26d68f858775ffe2",class:"s-toggle-input",checked:this.isHiddenName,onChange:e=>this.toggleSetting("is_hidden_name",e),type:"checkbox"}),t("div",{key:"5952ec01913ef95d888eeb3aace14123ffd3ef6f",class:"s-toggle-switcher"}))))),t("div",{key:"885355f8435759c9359a3d9eb95d5637b1c74751",class:"s-user-settings-section"},t("salla-list-tile",{key:"93b607850b20add5384a3b28e4e58fbfcb181d53"},t("div",{key:"c795aabfdc6df0beb9c0bfcf73ad87625eb7f51b",slot:"icon",class:"s-user-settings-section-icon"},t("span",{key:"a59ede027c4466a1e84e8e8b4c649c7b418dd0a3",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>bullhorn</title>\n<path d="M30.129 0.264c-0.339-0.252-0.776-0.328-1.179-0.208l-24.951 7.485v-0.216c0-0.736-0.597-1.333-1.333-1.333s-1.333 0.597-1.333 1.333v14.667c0 0.736 0.597 1.333 1.333 1.333s1.333-0.597 1.333-1.333v-0.112l3.448 1.207-0.595 1.704c-0.321 1.019-0.227 2.103 0.267 3.051s1.327 1.647 2.345 1.968l6.359 2.004c0.399 0.127 0.804 0.187 1.201 0.187 1.699 0 3.277-1.091 3.812-2.785l0.423-1.295 7.633 2.672c0.143 0.049 0.292 0.075 0.44 0.075 0.273 0 0.543-0.084 0.772-0.247 0.352-0.249 0.561-0.655 0.561-1.087v-28c0-0.421-0.199-0.819-0.537-1.069zM18.297 28.4c-0.221 0.701-0.973 1.089-1.673 0.871l-6.357-2.004c-0.34-0.108-0.617-0.34-0.781-0.656s-0.196-0.676-0.101-0.977l0.581-1.665 8.777 3.072zM28 27.453l-24-8.4v-8.728l24-7.2z"></path>\n</svg>\n'})),t("div",{key:"e7af96b6f919a8be8bb126237cb3977e72a7c089",slot:"title",class:"s-user-settings-section-title"},this.capitalizeText(this.promotionalMsgs)),t("div",{key:"dab7b270443b6eddccd7df739c2bee82eb7706af",slot:"subtitle",class:"s-user-settings-section-subtitle"},this.capitalizeText(this.promotionalMsgsDesc)),t("div",{key:"56a6f18c788891fe9215a57d0fcaa5cf98bd3aa5",slot:"action",class:"s-user-settings-section-action"},t("label",{key:"1fc28780fe779099eaed7916f31cbbb681c10fe9",class:"s-toggle"},t("input",{key:"832edd6e5b806171bb913163b7d5c19dbb0833f5",class:"s-toggle-input",checked:this.isNotifiable,onChange:e=>this.toggleSetting("is_notifiable",e),type:"checkbox"}),t("div",{key:"54260d8cca19ca6914cdd3bf15093b9669fef44a",class:"s-toggle-switcher"}))))),t("div",{key:"549bae1159a55b035952a12c8dc9d2b9d660f5bf",class:"s-user-settings-section s-user-settings-section-delete-user"},t("salla-list-tile",{key:"7969327e863cd998a120f27d61621d83ef8e57d5"},t("div",{key:"acf14b5e6ce76657fe0016aa63e26851e7688cd5",slot:"icon",class:"s-user-settings-section-icon"},this.renderUserDeleteIcon()),t("div",{key:"4a38cf9d0510e784317b0eb4db2fd4589a9f71d4",slot:"title",class:"s-user-settings-section-title"},this.capitalizeText(this.deleteAccount)),t("div",{key:"054f6a6c30f2eb9794f83a0998f20e208c7ed85a",slot:"subtitle",class:"s-user-settings-section-subtitle"},this.capitalizeText(this.isDeletePending?this.deleteAccountPending:this.deleteAccountDesc)),t("div",{key:"00d392a300b986d5d3e6f6711e6996df9731962d",slot:"action",class:"s-user-settings-section-action"},this.renderDeleteSectionAction()))),t("salla-modal",{key:"d4e8006e57d9c35267177f07b60e510ea3e53400",id:"salla-user-settings-delete-modal",width:"xs",centered:!0,showBack:"otp"===this.currentStep,isClosable:"success"!==this.currentStep,iconStyle:"success"===this.currentStep?"success":void 0,onModalVisibilityChanged:e=>this.handleModalVisibilityChanged(e),onModalBack:()=>this.goBackFromOtp(),ref:e=>this.confirmationModal=e},"success"!==this.currentStep?t("span",{slot:"icon",class:"s-user-settings-delete-icon"},this.renderUserDeleteIcon()):null,t("div",{key:this.currentStep,class:"s-user-settings-delete-step"},this.renderDeleteStep())))}};i.style=".s-modal-header-inner{display:flex;flex-direction:column !important;align-items:center !important;justify-content:center !important}.s-modal-header-content{text-align:center !important}.s-user-settings-delete-body{text-align:center}.s-user-settings-delete-icon{display:inline-flex;align-items:center;justify-content:center;width:4rem;height:4rem;border-radius:9999px;border:1px solid var(--infinte-color);color:var(--infinte-color);margin:0 auto 1rem}.s-user-settings-delete-icon svg{width:1.5rem;height:1.5rem}.s-user-settings-delete-warning{color:#6b7280;font-size:0.875rem;line-height:1.625;margin-bottom:1.25rem}.s-user-settings-delete-actions--row{display:flex;gap:0.75rem;justify-content:center}.s-user-settings-delete-actions--row salla-button{flex:1}.s-user-settings-delete-actions--stack{display:flex;flex-direction:column;gap:0.75rem;margin-top:1.25rem}.s-user-settings-delete-otp-instruction{color:#6b7280;font-size:0.875rem}.s-user-settings-delete-otp-target{color:#6b7280;direction:ltr;margin-bottom:1.25rem}.s-user-settings-delete-otp-codes{display:flex;justify-content:stretch;gap:0.75rem;direction:ltr;margin-bottom:0.75rem;width:100%}.s-user-settings-delete-otp-codes.has-error{margin-bottom:0}.s-user-settings-delete-otp-input{flex:1 1 0;min-width:0;width:100%;height:3.5rem;text-align:center;border:1px solid #d1d5db;border-radius:0.5rem;font-size:1.25rem;font-weight:600;color:#111827;outline:none}.s-user-settings-delete-otp-input:focus{border-color:#004956;box-shadow:0 0 0 1px #004956}.s-user-settings-delete-otp-input.s-has-error{border-color:#ef4444 !important}.s-user-settings-delete-otp-input.s-has-error:focus{border-color:#ef4444 !important;box-shadow:0 0 0 1px #ef4444}.s-user-settings-delete-otp-input::-webkit-outer-spin-button,.s-user-settings-delete-otp-input::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}.s-user-settings-delete-otp-input[type=text]{-moz-appearance:textfield}.s-user-settings-delete-otp-error{display:block;color:#ef4444;font-size:0.75rem;text-align:center;padding-top:0.75rem;margin-bottom:1.25rem}.s-user-settings-delete-otp-resend{color:#6b7280;font-size:0.75rem;margin-top:1rem;text-align:center}.s-user-settings-delete-otp-timer{font-weight:600;direction:ltr;display:inline-block}.s-user-settings-delete-otp-resend-link{display:block;color:#004956;font-size:0.875rem;margin-top:1rem;text-align:center;text-decoration:underline;cursor:pointer}.s-user-settings-delete-success-body{color:#6b7280;font-size:0.875rem;line-height:1.625;margin-bottom:1.25rem}.s-user-settings-delete-success-btn{--s-button-color:#004956}";export{i as salla_user_settings}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as s,h as i,H as e,a as t}from"./p-DjOBdfDM.js";function l(s,i){localStorage.getItem("salla-delivery-promise-debug")&&(void 0!==i?console.log(s,i):console.log(s))}async function r(s,i){l("fetchCities start",{productId:s,keyword:i});const e=null!=i?`?keyword=${encodeURIComponent(i)}`:"",t=await salla.api.request(salla.url.api(`products/${s}/delivery-promises/cities${e}`));return t.success&&Array.isArray(t.data)&&0!==t.data.length?(l("fetchCities success",{count:t.data.length}),{cities:t.data}):(l("fetchCities: no data",{response:t}),{cities:[]})}function a(){const s=(Boolean(salla.config.get("store.settings.bullet_delivery.settings.remember_last_session"))?salla.storage.store:salla.storage.session).get("bullet_delivery_intent");return s&&"object"==typeof s?s:null}const o={deliveryTo:"توصيل إلى",pickupFromBranch:"الاستلام من فرع",noResults:"لا توجد نتائج",selectCity:"اختر المدينة",changeCityTitle:"تغيير المدينة",changeCitySubtitle:"",cityFieldLabel:"المدينة",modalSearchPlaceholder:"ابحث عن مدينة",confirmAddress:"تأكيد العنوان",errorDeliveryPromise:"لا يتوفر وعد تسليم لهذه المدينة",errorPickupPromise:"لا يتوفر وعد تسليم لهذا الفرع"},n="salla-bullet-delivery-override-ip",h=class{constructor(i){s(this,i),this.isDeliveryPromiseEnabled=!1,this.isLoginCycleEnabled=!1,this.canRender=!1,this.labels=o,this.selectedLabel=null,this.deliveryMessage=null,this.hasError=!1,this.errorMessage="",this.isLoadingPromises=!1,this.selectedCityLoginCycle=null,this.selectedBranchLoginCycle=null,this.cities=[],this.selectedCity=null,this.isLoadingCities=!1,this.cityPendingSelection=null,this.modalCities=[],this.isSearchingCities=!1,this.citySearchCounter=0,this.onBulletDeliveryConfirmed=()=>{this.applyBulletIntent()},this.handleCitySearch=s=>{if(clearTimeout(this.citySearchTimer),!s.trim())return this.modalCities=[...this.cities],void(this.isSearchingCities=!1);this.citySearchTimer=setTimeout((()=>this.searchCitiesRemote(s)),300)},this.handleHeaderClick=s=>{s.stopPropagation(),this.isLoginCycleEnabled?this.openBulletDeliveryModal():this.openCityChangeModal()}}async componentDidLoad(){await salla.onReady(),await salla.lang.onLoaded(),this.labels={deliveryTo:salla.lang.getWithDefault("pages.products.promise_deliver_to",o.deliveryTo),pickupFromBranch:salla.lang.getWithDefault("pages.products.promise_pickup_from_branch",o.pickupFromBranch),noResults:salla.lang.getWithDefault("common.elements.no_options",o.noResults),selectCity:salla.lang.getWithDefault("common.elements.select_city",o.selectCity),changeCityTitle:salla.lang.getWithDefault("pages.products.promise_change_city_title",o.changeCityTitle),changeCitySubtitle:salla.lang.getWithDefault("pages.products.promise_change_city_subtitle","قد تتغيّر مدة التوصيل حسب المدينة."),cityFieldLabel:salla.lang.getWithDefault("pages.products.promise_city_field",o.cityFieldLabel),modalSearchPlaceholder:salla.lang.getWithDefault("pages.products.promise_search_city",o.modalSearchPlaceholder),confirmAddress:salla.lang.getWithDefault("pages.checkout.confirm_address",o.confirmAddress),errorDeliveryPromise:salla.lang.getWithDefault("pages.products.promise_delivery_not_available",o.errorDeliveryPromise),errorPickupPromise:salla.lang.getWithDefault("pages.products.promise_pickup_not_available",o.errorPickupPromise)},this.isDeliveryPromiseEnabled=salla.config.get("store.features",[]).includes("delivery-promises"),this.isLoginCycleEnabled=salla.config.get("store.features",[]).includes("bullet-delivery-v2")&&Salla.config.get("store.settings.bullet_delivery.enabled"),this.productId=salla.config.get("page.id"),this.isDeliveryPromiseEnabled?this.isLoginCycleEnabled?await this.initLoginCycleFlow():(this.selectedLabel=`${this.labels.deliveryTo} ${this.labels.selectCity}`,await this.loadCities()):this.canRender=!1}disconnectedCallback(){window.removeEventListener("bulletDeliveryConfirmed",this.onBulletDeliveryConfirmed)}getIPDeliveryLocation(){const s="store.shipping.delivery_location",i={cityId:salla.config.get(`${s}.city_id`),cityName:salla.config.get(`${s}.city_name`)};return localStorage.getItem(n)?JSON.parse(localStorage.getItem(n)):i}async initLoginCycleFlow(){const s=this.applyBulletIntent(),{cityId:i,cityName:e}=this.getIPDeliveryLocation();l("delivery promise login cycle flow getIPDeliveryLocation",this.getIPDeliveryLocation()),i&&e&&!s&&(this.selectedLabel=`${this.labels.deliveryTo} ${e}`,await this.loadDeliveryMessage(i,"city")),this.canRender=!0,window.addEventListener("bulletDeliveryConfirmed",this.onBulletDeliveryConfirmed)}applyBulletIntent(){const s=function(){const s=a();if(!s)return null;if("address"===s.type){const i=s.address_details?.city,e=null!=i?.id?Number(i.id):null!=s.city_id?Number(s.city_id):null,t=i?.name?.trim()||"";return null!=e?{type:"address",option:{id:e,name:t}}:null}if("branch"===s.type){const i=null!=s.branch_id?Number(s.branch_id):null!=s.branch_details?.id?Number(s.branch_details.id):null,e=s.branch_details?.name?.trim()||"";return null!=i?{type:"branch",option:{id:i,name:e}}:null}return null}();return s?("address"===s.type?(this.selectedCityLoginCycle=s.option,this.selectedBranchLoginCycle=null,this.selectedLabel=`${this.labels.deliveryTo} ${s.option.name||this.labels.selectCity}`,this.loadDeliveryMessage(s.option.id,"city")):(this.selectedBranchLoginCycle=s.option,this.selectedCityLoginCycle=null,this.selectedLabel=`${this.labels.pickupFromBranch} ${s.option.name}`,this.loadDeliveryMessage(s.option.id,"branch")),!0):(this.selectedLabel=`${this.labels.deliveryTo} ${this.labels.selectCity}`,this.selectedCityLoginCycle=null,this.selectedBranchLoginCycle=null,this.deliveryMessage=null,!1)}openBulletDeliveryModal(){salla.event.emit("salla::bullet-delivery.modal.open.requested",function(){const s=a(),i={};if("address"===s?.type&&null!=s.address_id&&(i.preselected_address_id=Number(s.address_id)),"branch"===s?.type){const e=s.branch_id??s.branch_details?.id;null!=e&&(i.preselected_branch_id=Number(e))}return i}())}async loadCities(){this.isLoadingCities=!0,this.hasError=!1;const{cityId:s,cityName:i}=this.getIPDeliveryLocation();l("delivery promise standard flow getIPDeliveryLocation",this.getIPDeliveryLocation());try{const{cities:e}=await r(this.productId);if(!e.length)return void(this.canRender=!1);if(this.cities=e,this.canRender=!0,s&&i){this.selectedLabel=`${this.labels.deliveryTo} ${i}`;const e=this.cities.find((i=>String(i.id)===String(s)));e&&(l("delivery promise standard flow autoCity found",e),this.selectedCity=e),await this.loadDeliveryMessage(s,"city")}}catch(s){this.hasError=!0,this.errorMessage=s.message||"Failed to load cities",this.canRender=!1}finally{this.isLoadingCities=!1}}async loadDeliveryMessage(s,i){this.isLoadingPromises=!0,this.hasError=!1,this.deliveryMessage=null;try{this.deliveryMessage=await async function(s,i,e,t){l("fetchDeliveryMessage start",{productId:s,id:i,optionType:e});let r="";r="city"!==e||t?`?reference_id=${i}&reference_type=${e}`:`?reference_id=${i}`;const a=await salla.api.withoutNotifier((()=>salla.api.request(salla.url.api(`products/${s}/delivery-promises${r}`))));if(!a.success)throw l("fetchDeliveryMessage error",{response:a}),new Error(a.error?.message||"Failed to fetch delivery promise");const o=a.data?.message?.trim();return l("fetchDeliveryMessage success",{message:o}),o||null}(this.productId,s,i,this.isLoginCycleEnabled)}catch(s){this.hasError=!0,this.errorMessage="city"===i?this.labels.errorDeliveryPromise:this.labels.errorPickupPromise}finally{this.isLoadingPromises=!1}}async openCityChangeModal(){this.cityModalRef&&(this.cityPendingSelection=null,this.modalCities=[...this.cities],await this.cityModalRef.setTitle(this.labels.changeCityTitle),await this.cityModalRef.open())}async searchCitiesRemote(s){const i=++this.citySearchCounter;this.isSearchingCities=!0;try{const{cities:e}=await r(this.productId,s);if(i!==this.citySearchCounter)return;this.modalCities=e}catch{if(i!==this.citySearchCounter)return;this.modalCities=[]}finally{i===this.citySearchCounter&&(this.isSearchingCities=!1)}}async handleConfirmCityModal(){if(!this.cityPendingSelection)return void await(this.cityModalRef?.close());const s=this.cityPendingSelection;this.selectedCity=s,this.selectedLabel=`${this.labels.deliveryTo} ${function(s){const i=salla.config.get("user.language_code");return i&&"ar"!==i&&s.name_en?.trim()?s.name_en.trim():s.name}(s)}`,await this.loadDeliveryMessage(s.id,"city"),await(this.cityModalRef?.close())}renderLoadingSkeleton(){return i(e,{class:"s-delivery-promise-wrapper s-delivery-promise-skeleton"},i("div",{class:"s-delivery-promise-container"},i("div",{class:"s-delivery-promise-header s-delivery-promise-header-skeleton"},i("div",{class:"s-delivery-promise-location"},i("salla-skeleton",{height:"14px",width:"180px"})),i("salla-skeleton",{height:"18px",width:"18px"})),i("div",{class:"s-delivery-promise-loading"},i("salla-skeleton",{height:"20px",width:"80%"}))))}renderDeliveryMessage(){return this.isLoadingPromises?i("div",{class:"s-delivery-promise-loading"},i("salla-skeleton",{height:"20px",width:"80%"})):this.deliveryMessage?i("div",{class:"s-delivery-promise-message"},this.deliveryMessage):null}renderCityModalBody(){return i("div",{class:"s-delivery-promise-modal-body"},i("salla-searchable-dropdown",{label:this.labels.cityFieldLabel,placeholder:this.labels.modalSearchPlaceholder,items:this.modalCities,selectedItem:this.cityPendingSelection,searching:this.isSearchingCities,required:!0,noResultsText:this.labels.noResults,inputId:"s-delivery-promise-modal-search",onItemSelected:s=>{this.cityPendingSelection=s.detail},onSearchInput:s=>{this.handleCitySearch(s.detail)}}))}renderCityChangeModal(){return this.isLoginCycleEnabled?null:i("salla-modal",{id:"s-delivery-promise-city-modal",ref:s=>{this.cityModalRef=s},class:"s-delivery-promise-city-modal",isClosable:!0,width:"md","modal-title":this.labels.changeCityTitle,subTitle:this.labels.changeCitySubtitle},this.renderCityModalBody(),i("salla-button",{slot:"footer",width:"wide",disabled:!this.cityPendingSelection,onClick:()=>this.handleConfirmCityModal()},!this.isLoadingPromises&&this.labels.confirmAddress))}render(){return this.isDeliveryPromiseEnabled?this.isLoadingCities?this.renderLoadingSkeleton():this.canRender?i(e,{class:"s-delivery-promise-wrapper"},i("div",{class:"s-delivery-promise-container"},i("div",{class:"s-delivery-promise-header",onClick:this.handleHeaderClick},i("div",{class:"s-delivery-promise-location"},i("span",{class:"s-delivery-promise-title"},this.selectedLabel)),i("i",{class:"sicon-keyboard_arrow_down s-delivery-promise-arrow"})),this.hasError&&i("div",{class:"s-delivery-promise-error"},this.errorMessage),!this.hasError&&this.renderDeliveryMessage()),this.renderCityChangeModal()):null:null}get host(){return t(this)}};export{h as salla_delivery_promise}
|
|
4
|
+
import{r as s,h as i,H as e,a as t}from"./p-CJNSdTHZ.js";function l(s,i){localStorage.getItem("salla-delivery-promise-debug")&&(void 0!==i?console.log(s,i):console.log(s))}async function r(s,i){l("fetchCities start",{productId:s,keyword:i});const e=null!=i?`?keyword=${encodeURIComponent(i)}`:"",t=await salla.api.request(salla.url.api(`products/${s}/delivery-promises/cities${e}`));return t.success&&Array.isArray(t.data)&&0!==t.data.length?(l("fetchCities success",{count:t.data.length}),{cities:t.data}):(l("fetchCities: no data",{response:t}),{cities:[]})}function a(){const s=(Boolean(salla.config.get("store.settings.bullet_delivery.settings.remember_last_session"))?salla.storage.store:salla.storage.session).get("bullet_delivery_intent");return s&&"object"==typeof s?s:null}const o={deliveryTo:"توصيل إلى",pickupFromBranch:"الاستلام من فرع",noResults:"لا توجد نتائج",selectCity:"اختر المدينة",changeCityTitle:"تغيير المدينة",changeCitySubtitle:"",cityFieldLabel:"المدينة",modalSearchPlaceholder:"ابحث عن مدينة",confirmAddress:"تأكيد العنوان",errorDeliveryPromise:"لا يتوفر وعد تسليم لهذه المدينة",errorPickupPromise:"لا يتوفر وعد تسليم لهذا الفرع"},n="salla-bullet-delivery-override-ip",h=class{constructor(i){s(this,i),this.isDeliveryPromiseEnabled=!1,this.isLoginCycleEnabled=!1,this.canRender=!1,this.labels=o,this.selectedLabel=null,this.deliveryMessage=null,this.hasError=!1,this.errorMessage="",this.isLoadingPromises=!1,this.selectedCityLoginCycle=null,this.selectedBranchLoginCycle=null,this.cities=[],this.selectedCity=null,this.isLoadingCities=!1,this.cityPendingSelection=null,this.modalCities=[],this.isSearchingCities=!1,this.citySearchCounter=0,this.onBulletDeliveryConfirmed=()=>{this.applyBulletIntent()},this.handleCitySearch=s=>{if(clearTimeout(this.citySearchTimer),!s.trim())return this.modalCities=[...this.cities],void(this.isSearchingCities=!1);this.citySearchTimer=setTimeout((()=>this.searchCitiesRemote(s)),300)},this.handleHeaderClick=s=>{s.stopPropagation(),this.isLoginCycleEnabled?this.openBulletDeliveryModal():this.openCityChangeModal()}}async componentDidLoad(){await salla.onReady(),await salla.lang.onLoaded(),this.labels={deliveryTo:salla.lang.getWithDefault("pages.products.promise_deliver_to",o.deliveryTo),pickupFromBranch:salla.lang.getWithDefault("pages.products.promise_pickup_from_branch",o.pickupFromBranch),noResults:salla.lang.getWithDefault("common.elements.no_options",o.noResults),selectCity:salla.lang.getWithDefault("common.elements.select_city",o.selectCity),changeCityTitle:salla.lang.getWithDefault("pages.products.promise_change_city_title",o.changeCityTitle),changeCitySubtitle:salla.lang.getWithDefault("pages.products.promise_change_city_subtitle","قد تتغيّر مدة التوصيل حسب المدينة."),cityFieldLabel:salla.lang.getWithDefault("pages.products.promise_city_field",o.cityFieldLabel),modalSearchPlaceholder:salla.lang.getWithDefault("pages.products.promise_search_city",o.modalSearchPlaceholder),confirmAddress:salla.lang.getWithDefault("pages.checkout.confirm_address",o.confirmAddress),errorDeliveryPromise:salla.lang.getWithDefault("pages.products.promise_delivery_not_available",o.errorDeliveryPromise),errorPickupPromise:salla.lang.getWithDefault("pages.products.promise_pickup_not_available",o.errorPickupPromise)},this.isDeliveryPromiseEnabled=salla.config.get("store.features",[]).includes("delivery-promises"),this.isLoginCycleEnabled=salla.config.get("store.features",[]).includes("bullet-delivery-v2")&&Salla.config.get("store.settings.bullet_delivery.enabled"),this.productId=salla.config.get("page.id"),this.isDeliveryPromiseEnabled?this.isLoginCycleEnabled?await this.initLoginCycleFlow():(this.selectedLabel=`${this.labels.deliveryTo} ${this.labels.selectCity}`,await this.loadCities()):this.canRender=!1}disconnectedCallback(){window.removeEventListener("bulletDeliveryConfirmed",this.onBulletDeliveryConfirmed)}getIPDeliveryLocation(){const s="store.shipping.delivery_location",i={cityId:salla.config.get(`${s}.city_id`),cityName:salla.config.get(`${s}.city_name`)};return localStorage.getItem(n)?JSON.parse(localStorage.getItem(n)):i}async initLoginCycleFlow(){const s=this.applyBulletIntent(),{cityId:i,cityName:e}=this.getIPDeliveryLocation();l("delivery promise login cycle flow getIPDeliveryLocation",this.getIPDeliveryLocation()),i&&e&&!s&&(this.selectedLabel=`${this.labels.deliveryTo} ${e}`,await this.loadDeliveryMessage(i,"city")),this.canRender=!0,window.addEventListener("bulletDeliveryConfirmed",this.onBulletDeliveryConfirmed)}applyBulletIntent(){const s=function(){const s=a();if(!s)return null;if("address"===s.type){const i=s.address_details?.city,e=null!=i?.id?Number(i.id):null!=s.city_id?Number(s.city_id):null,t=i?.name?.trim()||"";return null!=e?{type:"address",option:{id:e,name:t}}:null}if("branch"===s.type){const i=null!=s.branch_id?Number(s.branch_id):null!=s.branch_details?.id?Number(s.branch_details.id):null,e=s.branch_details?.name?.trim()||"";return null!=i?{type:"branch",option:{id:i,name:e}}:null}return null}();return s?("address"===s.type?(this.selectedCityLoginCycle=s.option,this.selectedBranchLoginCycle=null,this.selectedLabel=`${this.labels.deliveryTo} ${s.option.name||this.labels.selectCity}`,this.loadDeliveryMessage(s.option.id,"city")):(this.selectedBranchLoginCycle=s.option,this.selectedCityLoginCycle=null,this.selectedLabel=`${this.labels.pickupFromBranch} ${s.option.name}`,this.loadDeliveryMessage(s.option.id,"branch")),!0):(this.selectedLabel=`${this.labels.deliveryTo} ${this.labels.selectCity}`,this.selectedCityLoginCycle=null,this.selectedBranchLoginCycle=null,this.deliveryMessage=null,!1)}openBulletDeliveryModal(){salla.event.emit("salla::bullet-delivery.modal.open.requested",function(){const s=a(),i={};if("address"===s?.type&&null!=s.address_id&&(i.preselected_address_id=Number(s.address_id)),"branch"===s?.type){const e=s.branch_id??s.branch_details?.id;null!=e&&(i.preselected_branch_id=Number(e))}return i}())}async loadCities(){this.isLoadingCities=!0,this.hasError=!1;const{cityId:s,cityName:i}=this.getIPDeliveryLocation();l("delivery promise standard flow getIPDeliveryLocation",this.getIPDeliveryLocation());try{const{cities:e}=await r(this.productId);if(!e.length)return void(this.canRender=!1);if(this.cities=e,this.canRender=!0,s&&i){this.selectedLabel=`${this.labels.deliveryTo} ${i}`;const e=this.cities.find((i=>String(i.id)===String(s)));e&&(l("delivery promise standard flow autoCity found",e),this.selectedCity=e),await this.loadDeliveryMessage(s,"city")}}catch(s){this.hasError=!0,this.errorMessage=s.message||"Failed to load cities",this.canRender=!1}finally{this.isLoadingCities=!1}}async loadDeliveryMessage(s,i){this.isLoadingPromises=!0,this.hasError=!1,this.deliveryMessage=null;try{this.deliveryMessage=await async function(s,i,e,t){l("fetchDeliveryMessage start",{productId:s,id:i,optionType:e});let r="";r="city"!==e||t?`?reference_id=${i}&reference_type=${e}`:`?reference_id=${i}`;const a=await salla.api.withoutNotifier((()=>salla.api.request(salla.url.api(`products/${s}/delivery-promises${r}`))));if(!a.success)throw l("fetchDeliveryMessage error",{response:a}),new Error(a.error?.message||"Failed to fetch delivery promise");const o=a.data?.message?.trim();return l("fetchDeliveryMessage success",{message:o}),o||null}(this.productId,s,i,this.isLoginCycleEnabled)}catch(s){this.hasError=!0,this.errorMessage="city"===i?this.labels.errorDeliveryPromise:this.labels.errorPickupPromise}finally{this.isLoadingPromises=!1}}async openCityChangeModal(){this.cityModalRef&&(this.cityPendingSelection=null,this.modalCities=[...this.cities],await this.cityModalRef.setTitle(this.labels.changeCityTitle),await this.cityModalRef.open())}async searchCitiesRemote(s){const i=++this.citySearchCounter;this.isSearchingCities=!0;try{const{cities:e}=await r(this.productId,s);if(i!==this.citySearchCounter)return;this.modalCities=e}catch{if(i!==this.citySearchCounter)return;this.modalCities=[]}finally{i===this.citySearchCounter&&(this.isSearchingCities=!1)}}async handleConfirmCityModal(){if(!this.cityPendingSelection)return void await(this.cityModalRef?.close());const s=this.cityPendingSelection;this.selectedCity=s,this.selectedLabel=`${this.labels.deliveryTo} ${function(s){const i=salla.config.get("user.language_code");return i&&"ar"!==i&&s.name_en?.trim()?s.name_en.trim():s.name}(s)}`,await this.loadDeliveryMessage(s.id,"city"),await(this.cityModalRef?.close())}renderLoadingSkeleton(){return i(e,{class:"s-delivery-promise-wrapper s-delivery-promise-skeleton"},i("div",{class:"s-delivery-promise-container"},i("div",{class:"s-delivery-promise-header s-delivery-promise-header-skeleton"},i("div",{class:"s-delivery-promise-location"},i("salla-skeleton",{height:"14px",width:"180px"})),i("salla-skeleton",{height:"18px",width:"18px"})),i("div",{class:"s-delivery-promise-loading"},i("salla-skeleton",{height:"20px",width:"80%"}))))}renderDeliveryMessage(){return this.isLoadingPromises?i("div",{class:"s-delivery-promise-loading"},i("salla-skeleton",{height:"20px",width:"80%"})):this.deliveryMessage?i("div",{class:"s-delivery-promise-message"},this.deliveryMessage):null}renderCityModalBody(){return i("div",{class:"s-delivery-promise-modal-body"},i("salla-searchable-dropdown",{label:this.labels.cityFieldLabel,placeholder:this.labels.modalSearchPlaceholder,items:this.modalCities,selectedItem:this.cityPendingSelection,searching:this.isSearchingCities,required:!0,noResultsText:this.labels.noResults,inputId:"s-delivery-promise-modal-search",onItemSelected:s=>{this.cityPendingSelection=s.detail},onSearchInput:s=>{this.handleCitySearch(s.detail)}}))}renderCityChangeModal(){return this.isLoginCycleEnabled?null:i("salla-modal",{id:"s-delivery-promise-city-modal",ref:s=>{this.cityModalRef=s},class:"s-delivery-promise-city-modal",isClosable:!0,width:"md","modal-title":this.labels.changeCityTitle,subTitle:this.labels.changeCitySubtitle},this.renderCityModalBody(),i("salla-button",{slot:"footer",width:"wide",disabled:!this.cityPendingSelection,onClick:()=>this.handleConfirmCityModal()},!this.isLoadingPromises&&this.labels.confirmAddress))}render(){return this.isDeliveryPromiseEnabled?this.isLoadingCities?this.renderLoadingSkeleton():this.canRender?i(e,{class:"s-delivery-promise-wrapper"},i("div",{class:"s-delivery-promise-container"},i("div",{class:"s-delivery-promise-header",onClick:this.handleHeaderClick},i("div",{class:"s-delivery-promise-location"},i("span",{class:"s-delivery-promise-title"},this.selectedLabel)),i("i",{class:"sicon-keyboard_arrow_down s-delivery-promise-arrow"})),this.hasError&&i("div",{class:"s-delivery-promise-error"},this.errorMessage),!this.hasError&&this.renderDeliveryMessage()),this.renderCityChangeModal()):null:null}get host(){return t(this)}};export{h as salla_delivery_promise}
|