@salla.sa/twilight-components 2.14.546 → 2.14.548
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{filepond-CbpPZZga.js → filepond-CGA4aTUA.js} +1 -1
- package/dist/cjs/{filepond-plugin-file-poster-BmWPw2D9.js → filepond-plugin-file-poster-DyVz7vP9.js} +1 -1
- package/dist/cjs/{filepond-plugin-file-validate-size-De7XZguT.js → filepond-plugin-file-validate-size-CgzYDBcU.js} +1 -1
- package/dist/cjs/{filepond-plugin-file-validate-type-BHdxCuXU.js → filepond-plugin-file-validate-type-Dx2CbMZ9.js} +1 -1
- package/dist/cjs/{filepond-plugin-image-edit-DJZbgt5_.js → filepond-plugin-image-edit-D3aTsFmD.js} +1 -1
- package/dist/cjs/{filepond-plugin-image-exif-orientation-BtLJO8iG.js → filepond-plugin-image-exif-orientation-BW3usWts.js} +1 -1
- package/dist/cjs/{filepond-plugin-image-preview-BRUyTRh3.js → filepond-plugin-image-preview-Bb7_UNPY.js} +1 -1
- package/dist/cjs/{index-EoqYCrI-.js → index-BssNhL-x.js} +30 -26
- package/dist/cjs/{intlTelInput-CxKIlDCD.js → intlTelInput-B7QYiZ0d.js} +1 -1
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/{mail-C9D8MHae.js → mail-CO8cFZH7.js} +2 -2
- package/dist/cjs/salla-accordion-body_2.cjs.entry.js +1 -1
- package/dist/cjs/salla-accordion_6.cjs.entry.js +12 -5
- 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-attachment-view_9.cjs.entry.js +10 -10
- package/dist/cjs/salla-badge.cjs.entry.js +1 -1
- package/dist/cjs/salla-basket-gap.cjs.entry.js +1 -1
- package/dist/cjs/salla-bullet-delivery_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 → salla-comment-form_9.cjs.entry.js} +264 -4
- package/dist/cjs/salla-conditional-offer.cjs.entry.js +1 -1
- package/dist/cjs/salla-contacts.cjs.entry.js +3 -3
- package/dist/cjs/salla-cookies-bar.cjs.entry.js +1 -1
- package/dist/cjs/salla-count-down.cjs.entry.js +1 -1
- package/dist/cjs/salla-custom-fields.cjs.entry.js +1 -1
- package/dist/cjs/salla-delivery-promise.cjs.entry.js +1 -1
- package/dist/cjs/salla-edit-order-button.cjs.entry.js +1 -1
- package/dist/cjs/salla-filters-widget.cjs.entry.js +1 -1
- package/dist/cjs/salla-filters.cjs.entry.js +1 -1
- package/dist/cjs/salla-fulfillment-methods.cjs.entry.js +1 -1
- package/dist/cjs/salla-gifting.cjs.entry.js +1 -1
- package/dist/cjs/salla-hook.cjs.entry.js +1 -1
- package/dist/cjs/salla-infinite-scroll.cjs.entry.js +1 -1
- package/dist/cjs/salla-installment.cjs.entry.js +1 -1
- package/dist/cjs/salla-list-tile.cjs.entry.js +1 -1
- package/dist/cjs/salla-localization-modal.cjs.entry.js +1 -1
- package/dist/cjs/salla-login-modal.cjs.entry.js +1 -1
- package/dist/cjs/salla-loyalty-banner_10.cjs.entry.js +3 -3
- package/dist/cjs/salla-loyalty-exchange-product-card.cjs.entry.js +1 -1
- package/dist/cjs/salla-loyalty-points-banner.cjs.entry.js +1 -1
- package/dist/cjs/salla-loyalty-points-history.cjs.entry.js +1 -1
- package/dist/cjs/salla-loyalty-prize-item.cjs.entry.js +1 -1
- package/dist/cjs/salla-loyalty.cjs.entry.js +1 -1
- package/dist/cjs/salla-maintenance-alert.cjs.entry.js +1 -1
- package/dist/cjs/salla-map_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_2.cjs.entry.js +1 -1
- package/dist/cjs/salla-offer-modal.cjs.entry.js +1 -1
- package/dist/cjs/salla-offer.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-branch.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-cancel.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-details-multiple-bundle-product.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-details-options.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-details.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-edit-item.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-edit-product-card.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-edit.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-options-modal_2.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-shipments.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-summary.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-totals-card.cjs.entry.js +1 -1
- package/dist/cjs/salla-orders.cjs.entry.js +1 -1
- package/dist/cjs/salla-payments.cjs.entry.js +1 -1
- package/dist/cjs/salla-placeholder.cjs.entry.js +1 -1
- package/dist/cjs/salla-price-range.cjs.entry.js +1 -1
- package/dist/cjs/salla-product-card-embed.cjs.entry.js +1 -1
- package/dist/cjs/salla-product-size-guide.cjs.entry.js +1 -1
- package/dist/cjs/salla-products-list.cjs.entry.js +1 -1
- package/dist/cjs/salla-products-slider.cjs.entry.js +1 -1
- package/dist/cjs/salla-quick-order.cjs.entry.js +3 -3
- package/dist/cjs/salla-rating-modal-v2.cjs.entry.js +208 -103
- package/dist/cjs/salla-rating-modal.cjs.entry.js +23 -8
- package/dist/cjs/salla-review-factors-tags.cjs.entry.js +1 -1
- package/dist/cjs/salla-review-order-item.cjs.entry.js +1 -1
- package/dist/cjs/salla-scopes.cjs.entry.js +1 -1
- package/dist/cjs/salla-search.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 +4 -4
- package/dist/cjs/salla-social.cjs.entry.js +1 -1
- package/dist/cjs/salla-tab-content_3.cjs.entry.js +1 -1
- package/dist/cjs/salla-tiered-offer.cjs.entry.js +1 -1
- package/dist/cjs/salla-tooltip.cjs.entry.js +1 -1
- package/dist/cjs/salla-trust-badges.cjs.entry.js +1 -1
- package/dist/cjs/salla-user-menu.cjs.entry.js +1 -1
- package/dist/cjs/salla-user-profile.cjs.entry.js +1 -1
- package/dist/cjs/salla-user-settings.cjs.entry.js +1 -1
- package/dist/cjs/salla-verify.cjs.entry.js +3 -3
- package/dist/cjs/salla-wallet.cjs.entry.js +1 -1
- package/dist/cjs/salla-wishlist-actions.cjs.entry.js +1 -1
- package/dist/cjs/twilight.cjs.js +2 -2
- package/dist/cjs/{vanilla-picker-ClshNzKX.js → vanilla-picker-H1di5S1s.js} +1 -1
- package/dist/collection/collection-manifest.json +14 -12
- package/dist/collection/components/salla-comments/interfaces.js +12 -0
- package/dist/collection/components/salla-comments/salla-comment-item.js +1 -1
- package/dist/collection/components/salla-comments/salla-comments.js +42 -5
- package/dist/collection/components/salla-modal/salla-modal.css +11 -0
- package/dist/collection/components/salla-modal/salla-modal.js +33 -6
- package/dist/collection/components/salla-rating-modal/salla-rating-modal-v2.js +253 -104
- package/dist/collection/components/salla-rating-modal/salla-rating-modal.css +34 -21
- package/dist/collection/components/salla-rating-modal/salla-rating-modal.js +69 -10
- package/dist/collection/components/salla-rating-stars/salla-rating-stars.css +5 -0
- package/dist/collection/components/salla-verified-review/salla-verified-review.css +162 -0
- package/dist/collection/components/salla-verified-review/salla-verified-review.js +264 -0
- package/dist/components/index.js +18 -14
- package/dist/components/salla-comment-item2.js +1 -1
- package/dist/components/salla-comments.js +44 -1
- package/dist/components/salla-modal2.js +12 -4
- package/dist/components/salla-rating-modal-v22.js +208 -101
- package/dist/components/salla-rating-modal.js +1 -591
- package/dist/components/salla-rating-modal2.js +613 -0
- package/dist/components/salla-rating-stars2.js +1 -1
- package/dist/components/salla-verified-review.d.ts +11 -0
- package/dist/components/salla-verified-review.js +325 -0
- package/dist/esm/{filepond-CF5m44bJ.js → filepond-CXmbiROU.js} +1 -1
- package/dist/esm/{filepond-plugin-file-poster-CcB1Ah8E.js → filepond-plugin-file-poster-DrmkMK37.js} +1 -1
- package/dist/esm/{filepond-plugin-file-validate-size-BwVhV38u.js → filepond-plugin-file-validate-size-fRXLDtKY.js} +1 -1
- package/dist/esm/{filepond-plugin-file-validate-type-GBCLCzPk.js → filepond-plugin-file-validate-type-9x4CtZKy.js} +1 -1
- package/dist/esm/{filepond-plugin-image-edit-CrBe3Dh3.js → filepond-plugin-image-edit-BTjvSjn9.js} +1 -1
- package/dist/esm/{filepond-plugin-image-exif-orientation-C2Cj5Jrc.js → filepond-plugin-image-exif-orientation-CnSOx2Lm.js} +1 -1
- package/dist/esm/{filepond-plugin-image-preview-YVKQw3-Q.js → filepond-plugin-image-preview-Cy0Nd8Xr.js} +1 -1
- package/dist/esm/{index-FwRU05yW.js → index-B64o_70M.js} +30 -26
- package/dist/esm/{intlTelInput-B1_kbUW3.js → intlTelInput-FF2eKbuC.js} +1 -1
- package/dist/esm/loader.js +3 -3
- package/dist/esm/{mail-DzAIgzdz.js → mail-DmgxDvXL.js} +2 -2
- package/dist/esm/salla-accordion-body_2.entry.js +1 -1
- package/dist/esm/salla-accordion_6.entry.js +12 -5
- 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-attachment-view_9.entry.js +10 -10
- package/dist/esm/salla-badge.entry.js +1 -1
- package/dist/esm/salla-basket-gap.entry.js +1 -1
- package/dist/esm/salla-bullet-delivery_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 → salla-comment-form_9.entry.js} +264 -5
- package/dist/esm/salla-conditional-offer.entry.js +1 -1
- package/dist/esm/salla-contacts.entry.js +3 -3
- package/dist/esm/salla-cookies-bar.entry.js +1 -1
- package/dist/esm/salla-count-down.entry.js +1 -1
- package/dist/esm/salla-custom-fields.entry.js +1 -1
- package/dist/esm/salla-delivery-promise.entry.js +1 -1
- package/dist/esm/salla-edit-order-button.entry.js +1 -1
- package/dist/esm/salla-filters-widget.entry.js +1 -1
- package/dist/esm/salla-filters.entry.js +1 -1
- package/dist/esm/salla-fulfillment-methods.entry.js +1 -1
- package/dist/esm/salla-gifting.entry.js +1 -1
- package/dist/esm/salla-hook.entry.js +1 -1
- package/dist/esm/salla-infinite-scroll.entry.js +1 -1
- package/dist/esm/salla-installment.entry.js +1 -1
- package/dist/esm/salla-list-tile.entry.js +1 -1
- package/dist/esm/salla-localization-modal.entry.js +1 -1
- package/dist/esm/salla-login-modal.entry.js +1 -1
- package/dist/esm/salla-loyalty-banner_10.entry.js +3 -3
- package/dist/esm/salla-loyalty-exchange-product-card.entry.js +1 -1
- package/dist/esm/salla-loyalty-points-banner.entry.js +1 -1
- package/dist/esm/salla-loyalty-points-history.entry.js +1 -1
- package/dist/esm/salla-loyalty-prize-item.entry.js +1 -1
- package/dist/esm/salla-loyalty.entry.js +1 -1
- package/dist/esm/salla-maintenance-alert.entry.js +1 -1
- package/dist/esm/salla-map_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_2.entry.js +1 -1
- package/dist/esm/salla-offer-modal.entry.js +1 -1
- package/dist/esm/salla-offer.entry.js +1 -1
- package/dist/esm/salla-order-branch.entry.js +1 -1
- package/dist/esm/salla-order-cancel.entry.js +1 -1
- package/dist/esm/salla-order-details-multiple-bundle-product.entry.js +1 -1
- package/dist/esm/salla-order-details-options.entry.js +1 -1
- package/dist/esm/salla-order-details.entry.js +1 -1
- package/dist/esm/salla-order-edit-item.entry.js +1 -1
- package/dist/esm/salla-order-edit-product-card.entry.js +1 -1
- package/dist/esm/salla-order-edit.entry.js +1 -1
- package/dist/esm/salla-order-options-modal_2.entry.js +1 -1
- package/dist/esm/salla-order-shipments.entry.js +1 -1
- package/dist/esm/salla-order-summary.entry.js +1 -1
- package/dist/esm/salla-order-totals-card.entry.js +1 -1
- package/dist/esm/salla-orders.entry.js +1 -1
- package/dist/esm/salla-payments.entry.js +1 -1
- package/dist/esm/salla-placeholder.entry.js +1 -1
- package/dist/esm/salla-price-range.entry.js +1 -1
- package/dist/esm/salla-product-card-embed.entry.js +1 -1
- package/dist/esm/salla-product-size-guide.entry.js +1 -1
- package/dist/esm/salla-products-list.entry.js +1 -1
- package/dist/esm/salla-products-slider.entry.js +1 -1
- package/dist/esm/salla-quick-order.entry.js +3 -3
- package/dist/esm/salla-rating-modal-v2.entry.js +208 -103
- package/dist/esm/salla-rating-modal.entry.js +23 -8
- package/dist/esm/salla-review-factors-tags.entry.js +1 -1
- package/dist/esm/salla-review-order-item.entry.js +1 -1
- package/dist/esm/salla-scopes.entry.js +1 -1
- package/dist/esm/salla-search.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 +4 -4
- package/dist/esm/salla-social.entry.js +1 -1
- package/dist/esm/salla-tab-content_3.entry.js +1 -1
- package/dist/esm/salla-tiered-offer.entry.js +1 -1
- package/dist/esm/salla-tooltip.entry.js +1 -1
- package/dist/esm/salla-trust-badges.entry.js +1 -1
- package/dist/esm/salla-user-menu.entry.js +1 -1
- package/dist/esm/salla-user-profile.entry.js +1 -1
- package/dist/esm/salla-user-settings.entry.js +1 -1
- package/dist/esm/salla-verify.entry.js +3 -3
- package/dist/esm/salla-wallet.entry.js +1 -1
- package/dist/esm/salla-wishlist-actions.entry.js +1 -1
- package/dist/esm/twilight.js +3 -3
- package/dist/esm/{vanilla-picker-oTEQUNmA.js → vanilla-picker-DMNociUd.js} +1 -1
- package/dist/twilight/{p-74bee051.entry.js → p-003648b5.entry.js} +1 -1
- package/dist/twilight/{p-52f4642b.entry.js → p-04cc5898.entry.js} +1 -1
- package/dist/twilight/{p-BcYofOgx.js → p-0MyCcOKI.js} +1 -1
- package/dist/twilight/{p-71ff2062.entry.js → p-0c7bdda5.entry.js} +1 -1
- package/dist/twilight/{p-b389fa5c.entry.js → p-0dfd760b.entry.js} +1 -1
- package/dist/twilight/{p-904ca909.entry.js → p-13978ff2.entry.js} +1 -1
- package/dist/twilight/{p-d11f2263.entry.js → p-1485dedd.entry.js} +1 -1
- package/dist/twilight/{p-c4be5709.entry.js → p-1628c63c.entry.js} +1 -1
- package/dist/twilight/{p-a7346ee5.entry.js → p-177e9071.entry.js} +1 -1
- package/dist/twilight/{p-e7819b7b.entry.js → p-19b03612.entry.js} +1 -1
- package/dist/twilight/{p-df48abfb.entry.js → p-1ad71324.entry.js} +1 -1
- package/dist/twilight/{p-2dd4ddc7.entry.js → p-1ce848ab.entry.js} +1 -1
- package/dist/twilight/{p-3250ee03.entry.js → p-1edbb249.entry.js} +1 -1
- package/dist/twilight/{p-ceceeaed.entry.js → p-233b9115.entry.js} +1 -1
- package/dist/twilight/{p-a3897cf4.entry.js → p-26c750c8.entry.js} +1 -1
- package/dist/twilight/p-2ddabee9.entry.js +4 -0
- package/dist/twilight/{p-b95b3bf0.entry.js → p-2f64c3b3.entry.js} +1 -1
- package/dist/twilight/{p-682f00d1.entry.js → p-309f771b.entry.js} +1 -1
- package/dist/twilight/{p-5df95bdb.entry.js → p-37b73a97.entry.js} +1 -1
- package/dist/twilight/{p-f55eb61c.entry.js → p-3b7cbf05.entry.js} +1 -1
- package/dist/twilight/{p-1286f679.entry.js → p-3eb853f9.entry.js} +1 -1
- package/dist/twilight/{p-5cfc9f8c.entry.js → p-3f460184.entry.js} +1 -1
- package/dist/twilight/{p-e71c064e.entry.js → p-40d4ccbb.entry.js} +1 -1
- package/dist/twilight/{p-34f38efd.entry.js → p-440687a4.entry.js} +1 -1
- package/dist/twilight/{p-d8313f41.entry.js → p-441ee14a.entry.js} +1 -1
- package/dist/twilight/{p-06335f34.entry.js → p-49c7dc56.entry.js} +1 -1
- package/dist/twilight/{p-e7a672b4.entry.js → p-522fb030.entry.js} +1 -1
- package/dist/twilight/{p-b9634ee2.entry.js → p-52607d64.entry.js} +1 -1
- package/dist/twilight/{p-49117243.entry.js → p-5273dbb2.entry.js} +1 -1
- package/dist/twilight/{p-981da139.entry.js → p-55cbacd7.entry.js} +1 -1
- package/dist/twilight/{p-b0730cef.entry.js → p-569ad58b.entry.js} +1 -1
- package/dist/twilight/{p-ad30742f.entry.js → p-56e553e4.entry.js} +1 -1
- package/dist/twilight/p-5ab11313.entry.js +4 -0
- package/dist/twilight/{p-c078fb93.entry.js → p-5c9e4502.entry.js} +1 -1
- package/dist/twilight/{p-13fc84ad.entry.js → p-5f860460.entry.js} +1 -1
- package/dist/twilight/{p-7fafe29c.entry.js → p-5f9b8ada.entry.js} +1 -1
- package/dist/twilight/{p-f7b8430f.entry.js → p-602e632c.entry.js} +1 -1
- package/dist/twilight/{p-d550f1f9.entry.js → p-63a2ee05.entry.js} +1 -1
- package/dist/twilight/{p-26ae2623.entry.js → p-63acbca7.entry.js} +1 -1
- package/dist/twilight/{p-158e1872.entry.js → p-63cebaef.entry.js} +1 -1
- package/dist/twilight/{p-51add824.entry.js → p-6451e759.entry.js} +1 -1
- package/dist/twilight/{p-767d37bb.entry.js → p-647832d9.entry.js} +1 -1
- package/dist/twilight/{p-d76abd6d.entry.js → p-660a552a.entry.js} +1 -1
- package/dist/twilight/{p-6081d494.entry.js → p-66ece3d6.entry.js} +1 -1
- package/dist/twilight/{p-92175855.entry.js → p-6cd863b9.entry.js} +1 -1
- package/dist/twilight/{p-ada73e68.entry.js → p-74a1a32f.entry.js} +1 -1
- package/dist/twilight/{p-1a7b7e21.entry.js → p-74c7cc02.entry.js} +1 -1
- package/dist/twilight/{p-53184934.entry.js → p-77fa0f9f.entry.js} +1 -1
- package/dist/twilight/{p-d295757a.entry.js → p-7c2a0a8b.entry.js} +1 -1
- package/dist/twilight/{p-662a5816.entry.js → p-7ce5c2cd.entry.js} +1 -1
- package/dist/twilight/{p-dfdf96be.entry.js → p-7eca6506.entry.js} +1 -1
- package/dist/twilight/{p-b7ae6c1c.entry.js → p-840dd411.entry.js} +1 -1
- package/dist/twilight/{p-eeb89f05.entry.js → p-87227eb2.entry.js} +1 -1
- package/dist/twilight/{p-79e3d1dd.entry.js → p-897b8824.entry.js} +1 -1
- package/dist/twilight/{p-bc98ccad.entry.js → p-8e293878.entry.js} +1 -1
- package/dist/twilight/{p-87ba263e.entry.js → p-8e631629.entry.js} +1 -1
- package/dist/twilight/{p-b98fb8ae.entry.js → p-923a35da.entry.js} +1 -1
- package/dist/twilight/{p-c3208f6d.entry.js → p-971b8ff5.entry.js} +1 -1
- package/dist/twilight/p-991fa4ad.entry.js +4 -0
- package/dist/twilight/{p-cac60dea.entry.js → p-9a617c41.entry.js} +1 -1
- package/dist/twilight/{p-298b9d8a.entry.js → p-9ae25175.entry.js} +1 -1
- package/dist/twilight/{p-682dc578.entry.js → p-9dbf3ff4.entry.js} +1 -1
- package/dist/twilight/p-B64o_70M.js +5 -0
- package/dist/twilight/{p-DyxHX342.js → p-BK166pHQ.js} +1 -1
- package/dist/twilight/{p-j-4Intu2.js → p-BcGXp0zm.js} +1 -1
- package/dist/twilight/{p-B9dZFOmF.js → p-Bh11vKua.js} +1 -1
- package/dist/twilight/{p-qzPm0si4.js → p-DBnECOny.js} +2 -2
- package/dist/twilight/{p-BxHJHdpj.js → p-DWqu98fW.js} +1 -1
- package/dist/twilight/{p-DzAIgzdz.js → p-DmgxDvXL.js} +1 -1
- package/dist/twilight/{p-CiKg2aqy.js → p-DrJZdc5M.js} +1 -1
- package/dist/twilight/{p-CCPvqpeZ.js → p-GwasjFLA.js} +1 -1
- package/dist/twilight/{p-BLBFg-He.js → p-UxfFm_QX.js} +1 -1
- package/dist/twilight/{p-df069a34.entry.js → p-a0e8ca67.entry.js} +1 -1
- package/dist/twilight/{p-176b9746.entry.js → p-a5199e7d.entry.js} +1 -1
- package/dist/twilight/{p-61953ae7.entry.js → p-a7fccb9c.entry.js} +1 -1
- package/dist/twilight/{p-ae8cbf4f.entry.js → p-a867beee.entry.js} +1 -1
- package/dist/twilight/{p-65be2237.entry.js → p-ace041b9.entry.js} +1 -1
- package/dist/twilight/{p-f6493289.entry.js → p-b0500232.entry.js} +1 -1
- package/dist/twilight/{p-3446e76a.entry.js → p-b0a87a8d.entry.js} +1 -1
- package/dist/twilight/{p-55aa8c39.entry.js → p-b16264a3.entry.js} +1 -1
- package/dist/twilight/{p-718a5f9b.entry.js → p-b17c6f84.entry.js} +1 -1
- package/dist/twilight/{p-75de4995.entry.js → p-b4d47e7c.entry.js} +1 -1
- package/dist/twilight/{p-f63aecb0.entry.js → p-b4f2f280.entry.js} +1 -1
- package/dist/twilight/{p-179625fd.entry.js → p-b4fda5f4.entry.js} +1 -1
- package/dist/twilight/{p-f15f6265.entry.js → p-b8cd26a7.entry.js} +1 -1
- package/dist/twilight/{p-736e9843.entry.js → p-ba32a9d2.entry.js} +1 -1
- package/dist/twilight/{p-61ae00d6.entry.js → p-be916b5f.entry.js} +1 -1
- package/dist/twilight/{p-e2df9129.entry.js → p-c26f1183.entry.js} +1 -1
- package/dist/twilight/{p-7df2c1d5.entry.js → p-c5d1b2e4.entry.js} +1 -1
- package/dist/twilight/{p-bcf3d118.entry.js → p-c8dae54b.entry.js} +1 -1
- package/dist/twilight/{p-0fc9be21.entry.js → p-c9b1ad01.entry.js} +1 -1
- package/dist/twilight/{p-72dba918.entry.js → p-cacf3c75.entry.js} +1 -1
- package/dist/twilight/{p-2862c6bb.entry.js → p-cb02e6db.entry.js} +1 -1
- package/dist/twilight/{p-a32bad0b.entry.js → p-d0847af9.entry.js} +1 -1
- package/dist/twilight/{p-01e01e63.entry.js → p-d7e4f0f8.entry.js} +1 -1
- package/dist/twilight/{p-c2980ef7.entry.js → p-db4dc7cc.entry.js} +1 -1
- package/dist/twilight/{p-a91c674c.entry.js → p-e0f3e985.entry.js} +1 -1
- package/dist/twilight/{p-2dfd3810.entry.js → p-e354292f.entry.js} +1 -1
- package/dist/twilight/{p-110bd105.entry.js → p-e4db462b.entry.js} +1 -1
- package/dist/twilight/{p-2f6ba6f1.entry.js → p-e826d3aa.entry.js} +1 -1
- package/dist/twilight/{p-cb737c93.entry.js → p-f12f8db3.entry.js} +1 -1
- package/dist/twilight/{p-e73bab6b.entry.js → p-f99550d8.entry.js} +1 -1
- package/dist/twilight/{p-46d047ac.entry.js → p-fa0467a7.entry.js} +1 -1
- package/dist/twilight/twilight.esm.js +1 -1
- package/dist/types/components/salla-comments/interfaces.d.ts +15 -0
- package/dist/types/components/salla-comments/salla-comments.d.ts +5 -2
- package/dist/types/components/salla-modal/salla-modal.d.ts +7 -2
- package/dist/types/components/salla-rating-modal/salla-rating-modal-v2.d.ts +20 -5
- package/dist/types/components/salla-rating-modal/salla-rating-modal.d.ts +10 -2
- package/dist/types/components/salla-verified-review/salla-verified-review.d.ts +51 -0
- package/dist/types/components.d.ts +59 -16
- package/package.json +5 -5
- package/dist/twilight/p-96826106.entry.js +0 -4
- package/dist/twilight/p-FwRU05yW.js +0 -5
- package/dist/twilight/p-cc8209fc.entry.js +0 -4
- package/dist/twilight/p-dcf9417c.entry.js +0 -4
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as t,c as r,h as e,H as i,a as s}from"./p-FwRU05yW.js";import{e as o}from"./p-DzAIgzdz.js";const a=class{constructor(e){t(this,e),this.verified=r(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",(t=>{let r=Array.isArray(t)?t[0]:t;"delete_account"===r?.request_type||document.getElementById("salla-user-settings-delete-modal")?.hasAttribute("visible")||(this.isProfileVerify=!0,this.open(r),this.title=salla.lang.get("pages.profile.verify_title")+salla.lang.get("common.elements."+r.type),this.modal?.setTitle(this.title))})),salla.event.on("modalClosed",(()=>{this.resendAfter=0,this.timer.innerHTML="30 : 00"}))):this.modal={open:()=>"",close:()=>"",setTitle:()=>""}}splitNumber(t){this.resetError();let r=t.data||t.target.value;r&&1!==r.length&&this.modifyNext(t.target,r)}modifyNext(t,r){t.value=r[0],r=r.substring(1),t.nextElementSibling&&r.length?this.modifyNext(t.nextElementSibling,r):t.nextElementSibling||0!==r.length?t.nextElementSibling&&0===r.length&&t.nextElementSibling.focus():t.focus()}checkAllInputs(){let t=!0;for(let r=0;r<this.otpInputs.length;r++)""===this.otpInputs[r].value&&(t=!1);return t}handleKeyUp(t){if(this.resetError(),["Alt","Shift","Control","AltGraph","Ctrl"].includes(t.key))return;let r=t.keyCode||t.charCode;t.target.value?(t.target.nextElementSibling?.focus(),t.target.nextElementSibling?.select()):[8,46].includes(r)&&(t.target.previousElementSibling?.focus(),t.target.previousElementSibling?.select()),t.target.value.length>1&&this.splitNumber(t)}handlePaste(t){this.resetError();let r=(salla.helpers.number(t.clipboardData.getData("text"))||"").replace(/[^0-9]/g,"");r=r.substring(0,this.otpInputs.length),this.otpInputs.forEach((t=>t.value="")),this.modifyNext(this.otpInputs[0],r)}handleInput(t){this.resetError(),salla.helpers.inputDigitsOnly(t.target),this.checkAllInputs()&&setTimeout((()=>{this.toggleOTPSubmit()}),100)}resetError(){this.hasError=!1,this.errorMessage=""}handleFocus(t){t.target!==this.firstOtpInput&&(""==this.firstOtpInput?.value&&this.firstOtpInput.focus(),""==t.target.previousElementSibling.value&&t.target.previousElementSibling.focus())}async getCode(){return this.code.value}async open(t){this.data=t,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",(t=>this.splitNumber(t))),setTimeout((()=>this.otpInputs[0].focus()),100)}toggleOTPSubmit(){let t=[];if(this.otpInputs.forEach((r=>r.value&&t.push(r.value))),this.code.value=t.join(""),4===t.length)return this.btn.disable(),void this.btn.click();this.btn.enable()}reset(){this.otpInputs.forEach((t=>t.value="")),this.code.value="",this.otpInputs[0].focus()}resendTimer(){this.resendMessage.style.display="block",this.resend.style.display="none",this.resendAfter=30;let t=setInterval((()=>{this.resendAfter<=0?(clearInterval(t),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((t=>t.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 t={code:this.code.value,...this.data};return this.btn.load().then((()=>this.btn.disable())).then((()=>this.isProfileVerify?salla.profile.verify(t):salla.auth.verify(t,this.supportWebAuth))).then((t=>this.verified.emit(t))).then((()=>this.btn.stop()&&this.btn.disable())).then((()=>this.modal.close())).then((()=>this.autoReload&&window.location.reload())).catch((t=>{this.hasError=!0,this.errorMessage=t.response?.data?.error?.message||salla.lang.get("common.errors.error_occurred"),t.response?salla.logger.error(t):console.log("Unexpected error",t),this.btn.stop()&&this.btn.enable()&&this.reset()}))}render(){return"inline"==this.display?e(i,null,this.myBody()):e("salla-modal",{width:"xs",class:"s-verify",ref:t=>this.modal=t,"modal-title":this.title},e("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':o}),this.myBody())}myBody(){return e("div",{class:"s-verify-body",ref:t=>this.body=t},e("div",{class:"s-verify-message",innerHTML:salla.lang.get("pages.profile.verify_message")}),e("slot",{name:"mobile"}),e("slot",{name:"email"}),e("input",{type:"hidden",name:"code",maxlength:"4",required:!0,ref:t=>this.code=t}),e("div",{class:{"s-verify-codes":!0,"has-error":this.hasError},dir:"ltr"},[1,2,3,4].map((t=>e("input",{type:"number",autocomplete:"one-time-code",pattern:"[0-9]*",inputmode:"numeric",maxlength:"1",value:"",id:`otp-${t}`,class:{"s-verify-input":!0,"s-has-error":this.hasError},onInput:t=>this.handleInput(t),onPaste:t=>this.handlePaste(t),onKeyUp:t=>this.handleKeyUp(t),onFocus:t=>this.handleFocus(t),required:!0})))),this.hasError&&this.errorMessage?e("span",{class:"s-verify-error-message"},this.errorMessage):"",e("div",{slot:"footer",class:"s-verify-footer"},e("salla-button",{class:"s-verify-submit","loader-position":"center",disabled:!0,onClick:()=>this.submit(),ref:t=>this.btn=t},salla.lang.get("pages.profile.verify")),e("p",{class:"s-verify-resend-message",ref:t=>this.resendMessage=t},salla.lang.get("blocks.header.resend_after"),e("b",{class:"s-verify-timer",ref:t=>this.timer=t})),e("a",{href:"#",class:"s-verify-resend",onClick:()=>this.resendCode(),ref:t=>this.resend=t},salla.lang.get("blocks.comments.submit"))),e("slot",{name:"after-footer"}))}get host(){return s(this)}};a.style='/*!twlt*/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}.visible{visibility:visible}.block{display:block}.inline{display:inline}.hidden{display:none}.s-has-error{--tw-border-opacity:1;border-color:rgb(248 113 113 / var(--tw-border-opacity, 1))}.s-has-error:focus{--tw-border-opacity:1;border-color:rgb(239 68 68 / var(--tw-border-opacity, 1))}.btn{display:inline-flex;flex:1 1 0%;align-items:center;justify-content:center;white-space:nowrap;border-radius:0.375rem;padding-left:1.5rem;padding-right:1.5rem;padding-bottom:0.625rem;padding-top:0.5rem;font-size:0.875rem;line-height:1.25rem;font-weight:700;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:300ms}.btn:hover{opacity:0.8}.has-error .s-form-label{color:#ff443a}.has-error .s-form-control,.has-error .s-tel-input-control,.has-error .s-datetime-picker-input{border-color:#ff443a;color:#ff443a}.s-has-error{--tw-border-opacity:1 !important;border-color:rgb(239 68 68 / var(--tw-border-opacity, 1)) !important;--tw-text-opacity:1 !important;color:rgb(239 68 68 / var(--tw-text-opacity, 1)) !important}.s-verify-message{text-align:center;font-size:0.875rem;line-height:1.25rem;--tw-text-opacity:1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.s-verify-label{margin-bottom:1rem;display:block;text-align:center;font-size:0.875rem;line-height:1.25rem}.s-verify-codes{margin-left:-0.25rem;margin-right:-0.25rem;margin-bottom:1.25rem;display:flex;justify-content:space-between}.s-verify-codes.has-error{margin-bottom:0px}.s-verify-input{margin-left:0.25rem;margin-right:0.25rem;height:2.5rem;width:100%;border-radius:var(--s-radius, 0.25rem);border-width:1px;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1));padding-left:0.5rem;padding-right:0.5rem;text-align:center;font-size:1.125rem;line-height:1.75rem;font-weight:700;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms}.s-verify-input:focus{border-color:var(--color-primary)}.s-verify-input:is(.dark *){--tw-border-opacity:1;border-color:rgb(75 85 99 / var(--tw-border-opacity, 1));--tw-bg-opacity:1;background-color:rgb(75 85 99 / var(--tw-bg-opacity, 1))}.s-verify-footer{text-align:center}.s-verify-submit{margin-bottom:1.25rem;width:100%}.s-verify-header-icon{display:inline-flex;height:3rem;width:3rem;align-items:center;justify-content:center;border-radius:9999px;border-width:1px;border-style:solid;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1))}@media (min-width: 640px){.s-verify-header-icon{margin-left:auto;margin-right:auto;margin-bottom:1rem;height:5rem;width:5rem}}.s-verify-header-icon:where([dir="ltr"],[dir="ltr"] *){margin-right:0.5rem}@media (min-width: 640px){.s-verify-header-icon:where([dir="ltr"],[dir="ltr"] *){margin-right:0px}}.s-verify-header-icon:where([dir="rtl"],[dir="rtl"] *){margin-left:0.5rem}@media (min-width: 640px){.s-verify-header-icon:where([dir="rtl"],[dir="rtl"] *){margin-left:0px}}.s-verify-resend-message{font-size:0.875rem;line-height:1.25rem;--tw-text-opacity:1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.s-verify-error-message{margin-bottom:1.25rem;display:block;height:1.75rem;padding-top:0.75rem;text-align:center;font-size:0.75rem;line-height:1rem;--tw-border-opacity:1;border-color:rgb(248 113 113 / var(--tw-border-opacity, 1))}.s-verify-error-message:focus{--tw-border-opacity:1;border-color:rgb(239 68 68 / var(--tw-border-opacity, 1))}.s-verify-error-message{--tw-border-opacity:1 !important;border-color:rgb(239 68 68 / var(--tw-border-opacity, 1)) !important;--tw-text-opacity:1 !important;color:rgb(239 68 68 / var(--tw-text-opacity, 1)) !important}.s-verify-timer{margin-left:0.25rem;margin-right:0.25rem;--tw-text-opacity:1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.s-verify-resend{text-align:center;font-size:0.875rem;line-height:1.25rem;color:var(--color-primary)}.s-verify-back{position:absolute;left:10px;top:10px;display:flex;height:2rem;width:2rem;align-items:center;justify-content:center;border-radius:9999px;--tw-bg-opacity:1;background-color:rgb(249 250 251 / var(--tw-bg-opacity, 1));font-size:1.125rem;line-height:1.75rem;--tw-text-opacity:1;color:rgb(75 85 99 / var(--tw-text-opacity, 1));transition-property:color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms}.s-verify-back:hover{--tw-bg-opacity:1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.s-verify-back:where([dir="rtl"],[dir="rtl"] *){left:unset;right:10px}.s-verify-back svg{height:18px;width:18px}[dir=\'ltr\'] .s-verify-back{transform:scale(-1)}';export{a as salla_verify}
|
|
4
|
+
import{r as t,c as r,h as i,H as e,a as s}from"./p-B64o_70M.js";import{M as o}from"./p-DmgxDvXL.js";const a=class{constructor(i){t(this,i),this.verified=r(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",(t=>{let r=Array.isArray(t)?t[0]:t;"delete_account"===r?.request_type||document.getElementById("salla-user-settings-delete-modal")?.hasAttribute("visible")||(this.isProfileVerify=!0,this.open(r),this.title=salla.lang.get("pages.profile.verify_title")+salla.lang.get("common.elements."+r.type),this.modal?.setTitle(this.title))})),salla.event.on("modalClosed",(()=>{this.resendAfter=0,this.timer.innerHTML="30 : 00"}))):this.modal={open:()=>"",close:()=>"",setTitle:()=>""}}splitNumber(t){this.resetError();let r=t.data||t.target.value;r&&1!==r.length&&this.modifyNext(t.target,r)}modifyNext(t,r){t.value=r[0],r=r.substring(1),t.nextElementSibling&&r.length?this.modifyNext(t.nextElementSibling,r):t.nextElementSibling||0!==r.length?t.nextElementSibling&&0===r.length&&t.nextElementSibling.focus():t.focus()}checkAllInputs(){let t=!0;for(let r=0;r<this.otpInputs.length;r++)""===this.otpInputs[r].value&&(t=!1);return t}handleKeyUp(t){if(this.resetError(),["Alt","Shift","Control","AltGraph","Ctrl"].includes(t.key))return;let r=t.keyCode||t.charCode;t.target.value?(t.target.nextElementSibling?.focus(),t.target.nextElementSibling?.select()):[8,46].includes(r)&&(t.target.previousElementSibling?.focus(),t.target.previousElementSibling?.select()),t.target.value.length>1&&this.splitNumber(t)}handlePaste(t){this.resetError();let r=(salla.helpers.number(t.clipboardData.getData("text"))||"").replace(/[^0-9]/g,"");r=r.substring(0,this.otpInputs.length),this.otpInputs.forEach((t=>t.value="")),this.modifyNext(this.otpInputs[0],r)}handleInput(t){this.resetError(),salla.helpers.inputDigitsOnly(t.target),this.checkAllInputs()&&setTimeout((()=>{this.toggleOTPSubmit()}),100)}resetError(){this.hasError=!1,this.errorMessage=""}handleFocus(t){t.target!==this.firstOtpInput&&(""==this.firstOtpInput?.value&&this.firstOtpInput.focus(),""==t.target.previousElementSibling.value&&t.target.previousElementSibling.focus())}async getCode(){return this.code.value}async open(t){this.data=t,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",(t=>this.splitNumber(t))),setTimeout((()=>this.otpInputs[0].focus()),100)}toggleOTPSubmit(){let t=[];if(this.otpInputs.forEach((r=>r.value&&t.push(r.value))),this.code.value=t.join(""),4===t.length)return this.btn.disable(),void this.btn.click();this.btn.enable()}reset(){this.otpInputs.forEach((t=>t.value="")),this.code.value="",this.otpInputs[0].focus()}resendTimer(){this.resendMessage.style.display="block",this.resend.style.display="none",this.resendAfter=30;let t=setInterval((()=>{this.resendAfter<=0?(clearInterval(t),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((t=>t.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 t={code:this.code.value,...this.data};return this.btn.load().then((()=>this.btn.disable())).then((()=>this.isProfileVerify?salla.profile.verify(t):salla.auth.verify(t,this.supportWebAuth))).then((t=>this.verified.emit(t))).then((()=>this.btn.stop()&&this.btn.disable())).then((()=>this.modal.close())).then((()=>this.autoReload&&window.location.reload())).catch((t=>{this.hasError=!0,this.errorMessage=t.response?.data?.error?.message||salla.lang.get("common.errors.error_occurred"),t.response?salla.logger.error(t):console.log("Unexpected error",t),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:t=>this.modal=t,"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':o}),this.myBody())}myBody(){return i("div",{class:"s-verify-body",ref:t=>this.body=t},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:t=>this.code=t}),i("div",{class:{"s-verify-codes":!0,"has-error":this.hasError},dir:"ltr"},[1,2,3,4].map((t=>i("input",{type:"number",autocomplete:"one-time-code",pattern:"[0-9]*",inputmode:"numeric",maxlength:"1",value:"",id:`otp-${t}`,class:{"s-verify-input":!0,"s-has-error":this.hasError},onInput:t=>this.handleInput(t),onPaste:t=>this.handlePaste(t),onKeyUp:t=>this.handleKeyUp(t),onFocus:t=>this.handleFocus(t),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:t=>this.btn=t},salla.lang.get("pages.profile.verify")),i("p",{class:"s-verify-resend-message",ref:t=>this.resendMessage=t},salla.lang.get("blocks.header.resend_after"),i("b",{class:"s-verify-timer",ref:t=>this.timer=t})),i("a",{href:"#",class:"s-verify-resend",onClick:()=>this.resendCode(),ref:t=>this.resend=t},salla.lang.get("blocks.comments.submit"))),i("slot",{name:"after-footer"}))}get host(){return s(this)}};a.style='/*!twlt*/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}.visible{visibility:visible}.block{display:block}.inline{display:inline}.hidden{display:none}.s-has-error{--tw-border-opacity:1;border-color:rgb(248 113 113 / var(--tw-border-opacity, 1))}.s-has-error:focus{--tw-border-opacity:1;border-color:rgb(239 68 68 / var(--tw-border-opacity, 1))}.btn{display:inline-flex;flex:1 1 0%;align-items:center;justify-content:center;white-space:nowrap;border-radius:0.375rem;padding-left:1.5rem;padding-right:1.5rem;padding-bottom:0.625rem;padding-top:0.5rem;font-size:0.875rem;line-height:1.25rem;font-weight:700;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:300ms}.btn:hover{opacity:0.8}.has-error .s-form-label{color:#ff443a}.has-error .s-form-control,.has-error .s-tel-input-control,.has-error .s-datetime-picker-input{border-color:#ff443a;color:#ff443a}.s-has-error{--tw-border-opacity:1 !important;border-color:rgb(239 68 68 / var(--tw-border-opacity, 1)) !important;--tw-text-opacity:1 !important;color:rgb(239 68 68 / var(--tw-text-opacity, 1)) !important}.s-verify-message{text-align:center;font-size:0.875rem;line-height:1.25rem;--tw-text-opacity:1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.s-verify-label{margin-bottom:1rem;display:block;text-align:center;font-size:0.875rem;line-height:1.25rem}.s-verify-codes{margin-left:-0.25rem;margin-right:-0.25rem;margin-bottom:1.25rem;display:flex;justify-content:space-between}.s-verify-codes.has-error{margin-bottom:0px}.s-verify-input{margin-left:0.25rem;margin-right:0.25rem;height:2.5rem;width:100%;border-radius:var(--s-radius, 0.25rem);border-width:1px;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1));padding-left:0.5rem;padding-right:0.5rem;text-align:center;font-size:1.125rem;line-height:1.75rem;font-weight:700;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms}.s-verify-input:focus{border-color:var(--color-primary)}.s-verify-input:is(.dark *){--tw-border-opacity:1;border-color:rgb(75 85 99 / var(--tw-border-opacity, 1));--tw-bg-opacity:1;background-color:rgb(75 85 99 / var(--tw-bg-opacity, 1))}.s-verify-footer{text-align:center}.s-verify-submit{margin-bottom:1.25rem;width:100%}.s-verify-header-icon{display:inline-flex;height:3rem;width:3rem;align-items:center;justify-content:center;border-radius:9999px;border-width:1px;border-style:solid;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1))}@media (min-width: 640px){.s-verify-header-icon{margin-left:auto;margin-right:auto;margin-bottom:1rem;height:5rem;width:5rem}}.s-verify-header-icon:where([dir="ltr"],[dir="ltr"] *){margin-right:0.5rem}@media (min-width: 640px){.s-verify-header-icon:where([dir="ltr"],[dir="ltr"] *){margin-right:0px}}.s-verify-header-icon:where([dir="rtl"],[dir="rtl"] *){margin-left:0.5rem}@media (min-width: 640px){.s-verify-header-icon:where([dir="rtl"],[dir="rtl"] *){margin-left:0px}}.s-verify-resend-message{font-size:0.875rem;line-height:1.25rem;--tw-text-opacity:1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.s-verify-error-message{margin-bottom:1.25rem;display:block;height:1.75rem;padding-top:0.75rem;text-align:center;font-size:0.75rem;line-height:1rem;--tw-border-opacity:1;border-color:rgb(248 113 113 / var(--tw-border-opacity, 1))}.s-verify-error-message:focus{--tw-border-opacity:1;border-color:rgb(239 68 68 / var(--tw-border-opacity, 1))}.s-verify-error-message{--tw-border-opacity:1 !important;border-color:rgb(239 68 68 / var(--tw-border-opacity, 1)) !important;--tw-text-opacity:1 !important;color:rgb(239 68 68 / var(--tw-text-opacity, 1)) !important}.s-verify-timer{margin-left:0.25rem;margin-right:0.25rem;--tw-text-opacity:1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.s-verify-resend{text-align:center;font-size:0.875rem;line-height:1.25rem;color:var(--color-primary)}.s-verify-back{position:absolute;left:10px;top:10px;display:flex;height:2rem;width:2rem;align-items:center;justify-content:center;border-radius:9999px;--tw-bg-opacity:1;background-color:rgb(249 250 251 / var(--tw-bg-opacity, 1));font-size:1.125rem;line-height:1.75rem;--tw-text-opacity:1;color:rgb(75 85 99 / var(--tw-text-opacity, 1));transition-property:color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms}.s-verify-back:hover{--tw-bg-opacity:1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.s-verify-back:where([dir="rtl"],[dir="rtl"] *){left:unset;right:10px}.s-verify-back svg{height:18px;width:18px}[dir=\'ltr\'] .s-verify-back{transform:scale(-1)}';export{a as salla_verify}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r,h as e,H as n,F as t}from"./p-FwRU05yW.js";function i(r,e){if("string"!=typeof r)return r??e;const n=r.trim();if(!n)return e;try{return JSON.parse(n)}catch{return e}}function o(r){if(r)return"string"==typeof r?i(r,void 0):r}function a(r,e="ar"){const[n,t]=String(r).trim().split(":").map(Number);if(!Number.isFinite(n)||!Number.isFinite(t))return r;const i=new Date(2e3,0,1,n,t),o={hour:"numeric",minute:"2-digit",hour12:!0};try{return i.toLocaleTimeString(e,o)}catch{return i.toLocaleTimeString("ar",o)}}const s=class{constructor(e){r(this,e),this.stackCards=!1,this.isLoading=!1}componentWillLoad(){return this.getBranchData()}async getBranchData(){const r=salla.config.get("page.id");if(r){this.isLoading=!0;try{const e=await salla.order.api.getBranchDetails(r);this.branchData=this.parseBranchResponse(e)}catch(r){this.notifyApiError(r)}finally{this.isLoading=!1}}}parseBranchResponse(r){const e=r?.data?.data||r?.data||r;return e&&"object"==typeof e&&Object.prototype.hasOwnProperty.call(e,"branch")?e.branch?o(e.branch):void 0:o(e)}getApiErrorMessage(r){return r?.response?.data?.error?.message||r?.response?.data?.message}notifyApiError(r){const e=this.getApiErrorMessage(r);e&&salla.notify.error(e)}label(r,e){return salla.lang.getWithDefault(r,e)}get preparationText(){const r=this.branchData?.preparation_time_range;if(!r?.from||!r?.to)return"";const e=salla.helpers.number(r.from.value),n=salla.helpers.number(r.to.value),t=this.unitLabel(r.to.unit),i=e===n?e:`${e}-${n}`;return this.label("pages.orders.pickup_ready_after","جاهز للاستلام بعد :time").replace(":time",`${i} ${t}`)}unitLabel(r){const e=function(r){const e=String(r||"hour").toLowerCase();return e.startsWith("min")?"minute":e.startsWith("day")?"day":"hour"}(r);return"minute"===e?this.label("pages.checkout.minute","دقيقة"):"day"===e?this.label("pages.checkout.day","يوم"):this.label("pages.checkout.hour","ساعة")}get workingHoursItems(){const r=this.branchData;if(!r)return[];if(!0===r.always_open||1===r.always_open||"1"===r.always_open)return[this.label("pages.orders.branch_always_open","مفتوح على مدار الساعة")];const e=salla.lang.locale||"ar";return(r.working_hours||[]).filter((r=>r?.name&&r.times?.length)).map((r=>{const n=r.times[0];return`${r.name}: ${a(n.from,e)} - ${a(n.to,e)}`}))}get branchAddress(){return this.branchData?.address||""}get mapUrl(){const r=this.branchData?.location;if(null!=r?.lat&&null!=r?.lng)return`https://www.google.com/maps?q=${r.lat},${r.lng}`}get phone(){return function(r){const e=i(r,null),n=e&&"object"==typeof e?e.phone:"";return"string"==typeof n?n.trim():""}(this.branchData?.contacts)}renderDetailsColumn(){const r=this.phone;return r?e("div",{class:"s-order-branch-details"},e("div",{class:"s-order-branch-info-card"},e("span",{class:"s-order-branch-info-icon",innerHTML:'\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>phone-talking</title>\n<path d="M18.667 8c2.941 0 5.333 2.392 5.333 5.333 0 0.737 0.596 1.333 1.333 1.333s1.333-0.596 1.333-1.333c0-4.412-3.588-8-8-8-0.737 0-1.333 0.596-1.333 1.333s0.596 1.333 1.333 1.333zM18.667 2.667c5.881 0 10.667 4.785 10.667 10.667 0 0.737 0.596 1.333 1.333 1.333s1.333-0.596 1.333-1.333c0-7.352-5.981-13.333-13.333-13.333-0.737 0-1.333 0.596-1.333 1.333s0.596 1.333 1.333 1.333zM26.939 17.831c-1.568-1.568-4.119-1.568-5.689 0l-2.567 2.568c-3.064-1.499-5.584-4.019-7.083-7.083l2.569-2.567c1.567-1.569 1.567-4.121-0.001-5.689l-3.88-3.881c-1.521-1.521-4.169-1.521-5.691 0l-1.847 1.847c-2.22 2.22-3.183 5.408-2.573 8.527 1.979 10.144 10.127 18.292 20.271 20.271 0.617 0.121 1.236 0.18 1.851 0.18 2.491 0 4.895-0.972 6.676-2.752l1.847-1.847c1.569-1.569 1.569-4.12 0-5.689zM28.936 25.517l-1.847 1.847c-1.591 1.591-3.876 2.281-6.131 1.841-9.089-1.776-16.388-9.075-18.163-18.165-0.439-2.247 0.249-4.539 1.841-6.129l1.847-1.847c0.256-0.257 0.597-0.397 0.959-0.397s0.701 0.14 0.959 0.397l3.883 3.883c0.528 0.528 0.528 1.389 0 1.917l-3.22 3.219c-0.383 0.384-0.496 0.959-0.288 1.457 1.815 4.34 5.344 7.868 9.684 9.684 0.5 0.205 1.075 0.095 1.457-0.288l3.219-3.219c0.528-0.531 1.389-0.529 1.917-0.001l3.883 3.883c0.529 0.529 0.529 1.389 0 1.919z"></path>\n</svg>\n'}),e("div",{class:"s-order-branch-info-text"},e("span",{class:"s-order-branch-info-label"},this.label("pages.orders.branch_contacts","ارقام التواصل")),e("span",{class:"s-order-branch-info-value",dir:"ltr"},r)))):null}renderWorkingHoursCard(){const r=this.workingHoursItems;return r.length?e("div",{class:"s-order-branch-info-card s-order-branch-hours-card"},e("span",{class:"s-order-branch-info-icon","aria-hidden":"true"},e("i",{class:"sicon-calendar-alt"})),e("div",{class:"s-order-branch-info-text"},e("span",{class:"s-order-branch-info-label"},this.label("pages.checkout.working_hours","ساعات العمل")),e("div",{class:"s-order-branch-hours-list"},r.map((r=>e("span",{class:"s-order-branch-hours-item"},r)))))):null}renderBranchIdentityCard(){const r=this.branchData,n=this.branchAddress,t=this.preparationText;return e("section",{class:"s-order-branch-card"},e("div",{class:"s-order-branch-location"},e("div",{class:"s-order-branch-identity"},e("span",{class:"s-order-branch-store-icon"},e("i",{class:"sicon-store","aria-hidden":"true"})),e("div",{class:"s-order-branch-text"},e("div",{class:"s-order-branch-name-row"},r?.name?e("span",{class:"s-order-branch-name"},r.name):null,t?e("span",{class:"s-order-branch-ready"},t):null),n?e("span",{class:"s-order-branch-address"},n):null)),this.mapUrl?e("div",{class:"s-order-branch-actions"},e("a",{href:this.mapUrl,target:"_blank",rel:"noopener noreferrer",class:"s-order-branch-map-link"},e("span",null,this.label("pages.orders.branch_map","موقع الفرع علي الخريطة")),e("span",{class:"s-order-branch-action-icon",innerHTML:'<svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M6.95448 2.79419C9.7395 1.84477 11.132 1.37005 11.881 2.11902C12.6299 2.86799 12.1552 4.2605 11.2058 7.04551L10.5593 8.94203C9.83014 11.0809 9.46556 12.1503 8.8646 12.2388C8.70303 12.2626 8.53577 12.2483 8.37592 12.197C7.78135 12.0061 7.46705 10.8785 6.83846 8.62339C6.69903 8.12319 6.62932 7.87308 6.47057 7.68206C6.4245 7.62662 6.37338 7.5755 6.31794 7.52943C6.12692 7.37068 5.87681 7.30097 5.37661 7.16154C3.12148 6.53295 1.99391 6.21865 1.80302 5.62408C1.7517 5.46423 1.73738 5.29698 1.76117 5.1354C1.84968 4.53444 2.91911 4.16986 5.05797 3.44072L6.95448 2.79419Z" stroke="currentColor" stroke-width="1.5"/>\n</svg>\n'}))):null))}render(){return this.isLoading||!this.branchData?e(n,{class:"s-order-branch-wrapper"}):e(n,{class:"s-order-branch-wrapper"},this.stackCards?e(t,null,this.renderBranchIdentityCard(),this.renderDetailsColumn()):e("div",{class:"s-order-branch-container"},this.renderBranchIdentityCard(),this.renderDetailsColumn()),this.renderWorkingHoursCard())}};s.style="/*!twlt*/:host{display:block}.s-order-branch-ready{background-color:color-mix(in srgb, var(--color-primary) 30%, transparent)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.s-order-branch-wrapper{margin-bottom:1.5rem;display:flex;flex-direction:column;gap:1rem;font-family:inherit}.s-order-branch-container{display:grid;grid-template-columns:repeat(1, minmax(0, 1fr));align-items:stretch;gap:1rem}@media (min-width: 768px){.s-order-branch-container{grid-template-columns:repeat(2, minmax(0, 1fr))}}.s-order-branch-details{display:grid;align-content:stretch;gap:1rem}.s-order-branch-info-card{display:flex;min-height:68px;align-items:center;justify-content:space-between;gap:0.75rem;border-radius:0.5rem;border-width:1px;border-color:var(--color-border,#eee);background-color:var(--color-surface,#fff);padding:0.75rem}.s-order-branch-info-text{display:flex;min-width:0px;flex:1 1 0%;flex-direction:column;gap:3px;text-align:start}.s-order-branch-info-label{font-size:0.75rem;line-height:1rem;line-height:1.35;color:var(--color-text-secondary,#666)}.s-order-branch-info-value{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:0.875rem;line-height:1.25rem;font-weight:500;line-height:1.45;color:var(--color-text-primary,#1d1d1d)}.s-order-branch-hours-card .s-order-branch-info-text{gap:0.5rem}.s-order-branch-hours-list{display:flex;flex-wrap:wrap;align-items:center;gap:0.5rem}.s-order-branch-hours-item{display:inline-flex;align-items:center;white-space:nowrap;border-radius:0.375rem;border-width:1px;border-color:var(--color-border,#eee);padding-left:0.625rem;padding-right:0.625rem;padding-top:0.25rem;padding-bottom:0.25rem;font-size:0.75rem;line-height:1rem;font-weight:500;line-height:1.45;color:var(--color-text-primary,#1d1d1d)}.s-order-branch-info-action{display:inline-flex;height:3rem;width:3rem;flex-shrink:0;align-items:center;justify-content:center;border-radius:0.5rem;background-color:var(--color-surface-secondary,#f6f6f6);color:var(--color-text-primary,#2b2d34);text-decoration-line:none}.s-order-branch-info-icon{display:inline-flex;height:3rem;width:3rem;align-items:center;justify-content:center;border-radius:0.375rem;--tw-bg-opacity:1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1));font-size:22px;color:currentColor}.s-order-branch-info-icon svg{height:1.5rem;width:1.5rem;fill:currentColor}.s-order-branch-card{display:flex;flex-direction:column;gap:0.75rem;border-radius:0.5rem;border-width:1px;border-color:var(--color-border,#eee);background-color:var(--color-surface,#fff);padding:1rem}@media (min-width: 768px){.s-order-branch-card{padding:1.25rem}}.s-order-branch-ready{display:inline-flex;flex-shrink:0;align-items:center;white-space:nowrap;border-radius:9999px;border-width:1px;border-color:var(--color-primary,#236e4c);padding-left:0.75rem;padding-right:0.75rem;padding-top:0.25rem;padding-bottom:0.25rem;font-size:0.75rem;line-height:1rem;font-weight:500;color:var(--color-primary-dark,#0c2519)}.s-order-branch-location{display:flex;min-height:52px;flex-direction:column;align-items:stretch;justify-content:space-between;gap:1.5rem}@media (min-width: 768px){.s-order-branch-location{flex-direction:row;align-items:center}}.s-order-branch-identity{display:flex;min-width:0px;flex:1 1 0%;align-items:center;gap:0.75rem}.s-order-branch-store-icon{display:inline-flex;height:3rem;width:3rem;flex-shrink:0;align-items:center;justify-content:center;--tw-bg-opacity:1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1));font-size:1.5rem;line-height:2rem;color:var(--color-text-primary,#2b2d34)}.s-order-branch-store-icon svg{height:1em;width:1em;fill:currentColor}.s-order-branch-text{display:flex;min-width:0px;flex-direction:column;gap:0.25rem;text-align:start}.s-order-branch-name-row{display:flex;flex-wrap:wrap;align-items:center;gap:0.5rem}.s-order-branch-name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:1rem;line-height:1.5rem;font-weight:500;line-height:1.45;color:var(--color-text-primary,#2b2d34)}.s-order-branch-address{overflow-wrap:break-word;font-size:0.75rem;line-height:1rem;line-height:1.45;color:var(--color-text-secondary,#666)}.s-order-branch-actions{display:flex;flex-shrink:0;flex-wrap:wrap;align-items:center;gap:0.75rem}@media (min-width: 768px){.s-order-branch-actions{flex-wrap:nowrap}}.s-order-branch-map-link{display:inline-flex;min-height:2.25rem;align-items:center;justify-content:center;gap:0.5rem;white-space:nowrap;border-radius:0.375rem;border-width:1px;border-color:var(--color-primary,#236e4c);padding-left:0.875rem;padding-right:0.875rem;padding-top:0.5rem;padding-bottom:0.5rem;font-size:0.875rem;line-height:1.25rem;font-weight:700;line-height:1.2;color:var(--color-primary,#236e4c);text-decoration-line:none}.s-order-branch-action-icon{display:inline-flex;align-items:center;justify-content:center;font-size:0.875rem;line-height:1.25rem;color:currentColor}.s-order-branch-action-icon svg{height:1em;width:1em}";export{s as salla_order_branch}
|
|
4
|
+
import{r,h as e,H as n,F as t}from"./p-B64o_70M.js";function i(r,e){if("string"!=typeof r)return r??e;const n=r.trim();if(!n)return e;try{return JSON.parse(n)}catch{return e}}function o(r){if(r)return"string"==typeof r?i(r,void 0):r}function a(r,e="ar"){const[n,t]=String(r).trim().split(":").map(Number);if(!Number.isFinite(n)||!Number.isFinite(t))return r;const i=new Date(2e3,0,1,n,t),o={hour:"numeric",minute:"2-digit",hour12:!0};try{return i.toLocaleTimeString(e,o)}catch{return i.toLocaleTimeString("ar",o)}}const s=class{constructor(e){r(this,e),this.stackCards=!1,this.isLoading=!1}componentWillLoad(){return this.getBranchData()}async getBranchData(){const r=salla.config.get("page.id");if(r){this.isLoading=!0;try{const e=await salla.order.api.getBranchDetails(r);this.branchData=this.parseBranchResponse(e)}catch(r){this.notifyApiError(r)}finally{this.isLoading=!1}}}parseBranchResponse(r){const e=r?.data?.data||r?.data||r;return e&&"object"==typeof e&&Object.prototype.hasOwnProperty.call(e,"branch")?e.branch?o(e.branch):void 0:o(e)}getApiErrorMessage(r){return r?.response?.data?.error?.message||r?.response?.data?.message}notifyApiError(r){const e=this.getApiErrorMessage(r);e&&salla.notify.error(e)}label(r,e){return salla.lang.getWithDefault(r,e)}get preparationText(){const r=this.branchData?.preparation_time_range;if(!r?.from||!r?.to)return"";const e=salla.helpers.number(r.from.value),n=salla.helpers.number(r.to.value),t=this.unitLabel(r.to.unit),i=e===n?e:`${e}-${n}`;return this.label("pages.orders.pickup_ready_after","جاهز للاستلام بعد :time").replace(":time",`${i} ${t}`)}unitLabel(r){const e=function(r){const e=String(r||"hour").toLowerCase();return e.startsWith("min")?"minute":e.startsWith("day")?"day":"hour"}(r);return"minute"===e?this.label("pages.checkout.minute","دقيقة"):"day"===e?this.label("pages.checkout.day","يوم"):this.label("pages.checkout.hour","ساعة")}get workingHoursItems(){const r=this.branchData;if(!r)return[];if(!0===r.always_open||1===r.always_open||"1"===r.always_open)return[this.label("pages.orders.branch_always_open","مفتوح على مدار الساعة")];const e=salla.lang.locale||"ar";return(r.working_hours||[]).filter((r=>r?.name&&r.times?.length)).map((r=>{const n=r.times[0];return`${r.name}: ${a(n.from,e)} - ${a(n.to,e)}`}))}get branchAddress(){return this.branchData?.address||""}get mapUrl(){const r=this.branchData?.location;if(null!=r?.lat&&null!=r?.lng)return`https://www.google.com/maps?q=${r.lat},${r.lng}`}get phone(){return function(r){const e=i(r,null),n=e&&"object"==typeof e?e.phone:"";return"string"==typeof n?n.trim():""}(this.branchData?.contacts)}renderDetailsColumn(){const r=this.phone;return r?e("div",{class:"s-order-branch-details"},e("div",{class:"s-order-branch-info-card"},e("span",{class:"s-order-branch-info-icon",innerHTML:'\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>phone-talking</title>\n<path d="M18.667 8c2.941 0 5.333 2.392 5.333 5.333 0 0.737 0.596 1.333 1.333 1.333s1.333-0.596 1.333-1.333c0-4.412-3.588-8-8-8-0.737 0-1.333 0.596-1.333 1.333s0.596 1.333 1.333 1.333zM18.667 2.667c5.881 0 10.667 4.785 10.667 10.667 0 0.737 0.596 1.333 1.333 1.333s1.333-0.596 1.333-1.333c0-7.352-5.981-13.333-13.333-13.333-0.737 0-1.333 0.596-1.333 1.333s0.596 1.333 1.333 1.333zM26.939 17.831c-1.568-1.568-4.119-1.568-5.689 0l-2.567 2.568c-3.064-1.499-5.584-4.019-7.083-7.083l2.569-2.567c1.567-1.569 1.567-4.121-0.001-5.689l-3.88-3.881c-1.521-1.521-4.169-1.521-5.691 0l-1.847 1.847c-2.22 2.22-3.183 5.408-2.573 8.527 1.979 10.144 10.127 18.292 20.271 20.271 0.617 0.121 1.236 0.18 1.851 0.18 2.491 0 4.895-0.972 6.676-2.752l1.847-1.847c1.569-1.569 1.569-4.12 0-5.689zM28.936 25.517l-1.847 1.847c-1.591 1.591-3.876 2.281-6.131 1.841-9.089-1.776-16.388-9.075-18.163-18.165-0.439-2.247 0.249-4.539 1.841-6.129l1.847-1.847c0.256-0.257 0.597-0.397 0.959-0.397s0.701 0.14 0.959 0.397l3.883 3.883c0.528 0.528 0.528 1.389 0 1.917l-3.22 3.219c-0.383 0.384-0.496 0.959-0.288 1.457 1.815 4.34 5.344 7.868 9.684 9.684 0.5 0.205 1.075 0.095 1.457-0.288l3.219-3.219c0.528-0.531 1.389-0.529 1.917-0.001l3.883 3.883c0.529 0.529 0.529 1.389 0 1.919z"></path>\n</svg>\n'}),e("div",{class:"s-order-branch-info-text"},e("span",{class:"s-order-branch-info-label"},this.label("pages.orders.branch_contacts","ارقام التواصل")),e("span",{class:"s-order-branch-info-value",dir:"ltr"},r)))):null}renderWorkingHoursCard(){const r=this.workingHoursItems;return r.length?e("div",{class:"s-order-branch-info-card s-order-branch-hours-card"},e("span",{class:"s-order-branch-info-icon","aria-hidden":"true"},e("i",{class:"sicon-calendar-alt"})),e("div",{class:"s-order-branch-info-text"},e("span",{class:"s-order-branch-info-label"},this.label("pages.checkout.working_hours","ساعات العمل")),e("div",{class:"s-order-branch-hours-list"},r.map((r=>e("span",{class:"s-order-branch-hours-item"},r)))))):null}renderBranchIdentityCard(){const r=this.branchData,n=this.branchAddress,t=this.preparationText;return e("section",{class:"s-order-branch-card"},e("div",{class:"s-order-branch-location"},e("div",{class:"s-order-branch-identity"},e("span",{class:"s-order-branch-store-icon"},e("i",{class:"sicon-store","aria-hidden":"true"})),e("div",{class:"s-order-branch-text"},e("div",{class:"s-order-branch-name-row"},r?.name?e("span",{class:"s-order-branch-name"},r.name):null,t?e("span",{class:"s-order-branch-ready"},t):null),n?e("span",{class:"s-order-branch-address"},n):null)),this.mapUrl?e("div",{class:"s-order-branch-actions"},e("a",{href:this.mapUrl,target:"_blank",rel:"noopener noreferrer",class:"s-order-branch-map-link"},e("span",null,this.label("pages.orders.branch_map","موقع الفرع علي الخريطة")),e("span",{class:"s-order-branch-action-icon",innerHTML:'<svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M6.95448 2.79419C9.7395 1.84477 11.132 1.37005 11.881 2.11902C12.6299 2.86799 12.1552 4.2605 11.2058 7.04551L10.5593 8.94203C9.83014 11.0809 9.46556 12.1503 8.8646 12.2388C8.70303 12.2626 8.53577 12.2483 8.37592 12.197C7.78135 12.0061 7.46705 10.8785 6.83846 8.62339C6.69903 8.12319 6.62932 7.87308 6.47057 7.68206C6.4245 7.62662 6.37338 7.5755 6.31794 7.52943C6.12692 7.37068 5.87681 7.30097 5.37661 7.16154C3.12148 6.53295 1.99391 6.21865 1.80302 5.62408C1.7517 5.46423 1.73738 5.29698 1.76117 5.1354C1.84968 4.53444 2.91911 4.16986 5.05797 3.44072L6.95448 2.79419Z" stroke="currentColor" stroke-width="1.5"/>\n</svg>\n'}))):null))}render(){return this.isLoading||!this.branchData?e(n,{class:"s-order-branch-wrapper"}):e(n,{class:"s-order-branch-wrapper"},this.stackCards?e(t,null,this.renderBranchIdentityCard(),this.renderDetailsColumn()):e("div",{class:"s-order-branch-container"},this.renderBranchIdentityCard(),this.renderDetailsColumn()),this.renderWorkingHoursCard())}};s.style="/*!twlt*/:host{display:block}.s-order-branch-ready{background-color:color-mix(in srgb, var(--color-primary) 30%, transparent)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.s-order-branch-wrapper{margin-bottom:1.5rem;display:flex;flex-direction:column;gap:1rem;font-family:inherit}.s-order-branch-container{display:grid;grid-template-columns:repeat(1, minmax(0, 1fr));align-items:stretch;gap:1rem}@media (min-width: 768px){.s-order-branch-container{grid-template-columns:repeat(2, minmax(0, 1fr))}}.s-order-branch-details{display:grid;align-content:stretch;gap:1rem}.s-order-branch-info-card{display:flex;min-height:68px;align-items:center;justify-content:space-between;gap:0.75rem;border-radius:0.5rem;border-width:1px;border-color:var(--color-border,#eee);background-color:var(--color-surface,#fff);padding:0.75rem}.s-order-branch-info-text{display:flex;min-width:0px;flex:1 1 0%;flex-direction:column;gap:3px;text-align:start}.s-order-branch-info-label{font-size:0.75rem;line-height:1rem;line-height:1.35;color:var(--color-text-secondary,#666)}.s-order-branch-info-value{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:0.875rem;line-height:1.25rem;font-weight:500;line-height:1.45;color:var(--color-text-primary,#1d1d1d)}.s-order-branch-hours-card .s-order-branch-info-text{gap:0.5rem}.s-order-branch-hours-list{display:flex;flex-wrap:wrap;align-items:center;gap:0.5rem}.s-order-branch-hours-item{display:inline-flex;align-items:center;white-space:nowrap;border-radius:0.375rem;border-width:1px;border-color:var(--color-border,#eee);padding-left:0.625rem;padding-right:0.625rem;padding-top:0.25rem;padding-bottom:0.25rem;font-size:0.75rem;line-height:1rem;font-weight:500;line-height:1.45;color:var(--color-text-primary,#1d1d1d)}.s-order-branch-info-action{display:inline-flex;height:3rem;width:3rem;flex-shrink:0;align-items:center;justify-content:center;border-radius:0.5rem;background-color:var(--color-surface-secondary,#f6f6f6);color:var(--color-text-primary,#2b2d34);text-decoration-line:none}.s-order-branch-info-icon{display:inline-flex;height:3rem;width:3rem;align-items:center;justify-content:center;border-radius:0.375rem;--tw-bg-opacity:1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1));font-size:22px;color:currentColor}.s-order-branch-info-icon svg{height:1.5rem;width:1.5rem;fill:currentColor}.s-order-branch-card{display:flex;flex-direction:column;gap:0.75rem;border-radius:0.5rem;border-width:1px;border-color:var(--color-border,#eee);background-color:var(--color-surface,#fff);padding:1rem}@media (min-width: 768px){.s-order-branch-card{padding:1.25rem}}.s-order-branch-ready{display:inline-flex;flex-shrink:0;align-items:center;white-space:nowrap;border-radius:9999px;border-width:1px;border-color:var(--color-primary,#236e4c);padding-left:0.75rem;padding-right:0.75rem;padding-top:0.25rem;padding-bottom:0.25rem;font-size:0.75rem;line-height:1rem;font-weight:500;color:var(--color-primary-dark,#0c2519)}.s-order-branch-location{display:flex;min-height:52px;flex-direction:column;align-items:stretch;justify-content:space-between;gap:1.5rem}@media (min-width: 768px){.s-order-branch-location{flex-direction:row;align-items:center}}.s-order-branch-identity{display:flex;min-width:0px;flex:1 1 0%;align-items:center;gap:0.75rem}.s-order-branch-store-icon{display:inline-flex;height:3rem;width:3rem;flex-shrink:0;align-items:center;justify-content:center;--tw-bg-opacity:1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1));font-size:1.5rem;line-height:2rem;color:var(--color-text-primary,#2b2d34)}.s-order-branch-store-icon svg{height:1em;width:1em;fill:currentColor}.s-order-branch-text{display:flex;min-width:0px;flex-direction:column;gap:0.25rem;text-align:start}.s-order-branch-name-row{display:flex;flex-wrap:wrap;align-items:center;gap:0.5rem}.s-order-branch-name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:1rem;line-height:1.5rem;font-weight:500;line-height:1.45;color:var(--color-text-primary,#2b2d34)}.s-order-branch-address{overflow-wrap:break-word;font-size:0.75rem;line-height:1rem;line-height:1.45;color:var(--color-text-secondary,#666)}.s-order-branch-actions{display:flex;flex-shrink:0;flex-wrap:wrap;align-items:center;gap:0.75rem}@media (min-width: 768px){.s-order-branch-actions{flex-wrap:nowrap}}.s-order-branch-map-link{display:inline-flex;min-height:2.25rem;align-items:center;justify-content:center;gap:0.5rem;white-space:nowrap;border-radius:0.375rem;border-width:1px;border-color:var(--color-primary,#236e4c);padding-left:0.875rem;padding-right:0.875rem;padding-top:0.5rem;padding-bottom:0.5rem;font-size:0.875rem;line-height:1.25rem;font-weight:700;line-height:1.2;color:var(--color-primary,#236e4c);text-decoration-line:none}.s-order-branch-action-icon{display:inline-flex;align-items:center;justify-content:center;font-size:0.875rem;line-height:1.25rem;color:currentColor}.s-order-branch-action-icon svg{height:1em;width:1em}";export{s as salla_order_branch}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as t,h as a,H as r,a as e}from"./p-
|
|
4
|
+
import{r as t,h as a,H as r,a as e}from"./p-B64o_70M.js";const i=class{constructor(a){t(this,a),this.loading=!1,this.hasError=!1,this.productData=null}async componentWillLoad(){await salla.onReady(),await this.fetchProduct()}componentDidLoad(){this.ensureParentContainsFloats()}componentDidRender(){this.renderCardNode()}ensureParentContainsFloats(){if("left"!==this.align&&"right"!==this.align)return;const t=this.hostEl?.parentElement;if(!t)return;const a=getComputedStyle(t);"block"===a.display&&"visible"===a.overflow&&"none"===a.float&&(t.style.display="flow-root")}fetchProduct(){return this.productId?(this.loading=!0,this.hasError=!1,salla.api.withoutNotifier((()=>salla.product.api.getDetails(this.productId))).then((t=>{const a=t.data;this.productData=a??null,this.hasError=!a})).catch((()=>{this.productData=null,this.hasError=!0})).finally((()=>{this.loading=!1}))):(this.productData=null,this.loading=!1,void(this.hasError=!1))}renderCardNode(){if(!this.cardContainer)return;if(this.cardContainer.textContent="",!this.productData||this.loading||this.hasError)return;const t=window.customElements.get("custom-salla-product-card")?"custom-salla-product-card":"salla-product-card",a=document.createElement(t),r=this.source||"embed-card";a.setAttribute("source",r),a.product={...this.productData,url:this.withViewedSource(this.productData.url,r)},this.cardContainer.appendChild(a)}withViewedSource(t,a){if(!t)return t;try{const r=new URL(t,window.location.origin);return r.searchParams.set("_svs",a),r.toString()}catch{return t}}render(){const t={"s-product-card-embed-card":!0,"s-product-card-embed-card-align-left":"left"===this.align,"s-product-card-embed-card-align-right":"right"===this.align,"s-product-card-embed-card-align-center":"center"===this.align};return a(r,{key:"3d9fb0dc8473e0959bbe13b4f8c8eea7a51830ea"},this.hasError&&a("span",{key:"25228d6d007d7dcda5e5767e14d2c363abfdab3e",class:"s-product-card-embed-fallback"}),a("div",{key:"d66d592bfad1468b745f3a954c335f72ecda1e08",class:t,ref:t=>{this.cardContainer=t}}))}get hostEl(){return e(this)}};i.style="/*!twlt*/@charset \"UTF-8\";:host{display:inline-block;vertical-align:top;max-width:12rem}:host([align=left]){float:inline-start;margin-block-end:1em;margin-inline-end:1em;shape-outside:margin-box}:host([align=right]){float:inline-end;margin-block-end:1em;margin-inline-start:1em;shape-outside:margin-box}:host([align=center]){display:block;clear:both;margin-block:1em;margin-inline:auto}.s-product-card-embed-card{display:block}.visible{visibility:visible}.block{display:block}.flow-root{display:flow-root}.s-product-card-embed-card{display:block;max-width:12rem;shape-outside:margin-box}.s-product-card-embed-card custom-salla-product-card{--tw-shadow:0 0 28px 0px rgba(0 0 0 / .1);--tw-shadow-colored:0 0 28px 0px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}.s-product-card-embed-card-align-center{margin-left:auto;margin-right:auto}.s-product-card-embed-card-align-left{float:left;margin-right:1ch}.s-product-card-embed-card-align-right{float:right;margin-left:1ch}.s-product-card-embed-fallback{display:block}article:has(salla-product-card-embed)::after{clear:both;display:block;--tw-content:'';content:var(--tw-content)}";export{i as salla_product_card_embed}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as e,h as r}from"./p-
|
|
4
|
+
import{r as e,h as r}from"./p-B64o_70M.js";function t(e){var r,a,s="";if("string"==typeof e||"number"==typeof e)s+=e;else if("object"==typeof e)if(Array.isArray(e))for(r=0;r<e.length;r++)e[r]&&(a=t(e[r]))&&(s&&(s+=" "),s+=a);else for(r in e)e[r]&&(s&&(s+=" "),s+=r);return s}const a=e=>"boolean"==typeof e?"".concat(e):0===e?"0":e,s=function(){for(var e,r,a=0,s="";a<arguments.length;)(e=arguments[a++])&&(r=t(e))&&(s&&(s+=" "),s+=r);return s},i=(o="s-badge-base",l={variants:{size:{xs:"s-badge-xs",sm:"s-badge-sm",md:"s-badge-md"},bg:{transparent:"s-badge-transparent",light:"s-badge-light","primary-100":"s-badge-primary-100"},color:{black:"s-badge-black","primary-900":"s-badge-color-primary-900"}}},e=>{var r;if(null==(null==l?void 0:l.variants))return s(o,null==e?void 0:e.class,null==e?void 0:e.className);const{variants:t,defaultVariants:i}=l,n=Object.keys(t).map((r=>{const s=null==e?void 0:e[r],o=null==i?void 0:i[r];if(null===s)return null;const l=a(s)||a(o);return t[r][l]})),d=e&&Object.entries(e).reduce(((e,r)=>{let[t,a]=r;return void 0===a||(e[t]=a),e}),{}),c=null==l||null===(r=l.compoundVariants)||void 0===r?void 0:r.reduce(((e,r)=>{let{class:t,className:a,...s}=r;return Object.entries(s).every((e=>{let[r,t]=e;return Array.isArray(t)?t.includes({...i,...d}[r]):{...i,...d}[r]===t}))?[...e,t,a]:e}),[]);return s(o,n,c,null==e?void 0:e.class,null==e?void 0:e.className)});var o,l;const n=class{constructor(r){e(this,r),this.size="sm",this.color="black",this.bg="light"}render(){return r("div",{key:"54d35eb76a59251edb581786e5e89a83b6f8fbf0",class:i({size:this.size,bg:this.bg,color:this.color})},r("slot",{key:"4641cb434a2c0a6d7c004e3384848a200cb79dff"}))}};n.style='/*!twlt*/.s-badge-base{display:flex;max-width:max-content;align-items:center}.s-badge-base>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-right:calc(0.5rem * var(--tw-space-x-reverse));margin-left:calc(0.5rem * calc(1 - var(--tw-space-x-reverse)))}.s-badge-base{white-space:nowrap;border-radius:0.375rem;padding-left:0.5rem;padding-right:0.5rem;padding-top:0.25rem;padding-bottom:0.25rem;font-weight:500;--tw-text-opacity:1;color:rgb(31 41 55 / var(--tw-text-opacity, 1))}.s-badge-base:where([dir="rtl"],[dir="rtl"] *)>:not([hidden])~:not([hidden]){--tw-space-x-reverse:1}.s-badge-xs{font-size:0.75rem;line-height:1rem}.s-badge-xs svg{height:0.75rem;width:0.75rem}.s-badge-sm{font-size:0.875rem;line-height:1.25rem}.s-badge-sm svg{height:1rem;width:1rem}.s-badge-md{font-size:1rem;line-height:1.5rem}.s-badge-md svg{height:1.25rem;width:1.25rem}.s-badge-transparent{background-color:transparent}.s-badge-light{--tw-bg-opacity:1;background-color:rgb(249 250 251 / var(--tw-bg-opacity, 1))}.s-badge-primary-100{background-color:color-mix(in srgb,var(--color-primary) 20%,white 80%)}.s-badge-color-black{--tw-text-opacity:1;color:rgb(0 0 0 / var(--tw-text-opacity, 1))}.s-badge-color-primary-900{color:color-mix(in srgb,var(--color-primary) 45%,black 55%)}.s-badge-color-primary-900 svg{fill:currentColor}.s-badge-black{--tw-text-opacity:1;color:rgb(0 0 0 / var(--tw-text-opacity, 1))}';export{n as salla_badge}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as t,h as i,H as e}from"./p-
|
|
4
|
+
import{r as t,h as i,H as e}from"./p-B64o_70M.js";import{f as s,g as a}from"./p-DqXpn47Z.js";const l=class{constructor(i){t(this,i),this.productRatings=[],this.allowUpdate=!1}async componentWillLoad(){await salla.onReady(),await this.loadOrderItem()}async onProductIdChange(){this.orderItem=void 0,this.productRatings=[],await this.loadOrderItem()}resolveFetchOrderId(){return salla.config.get("page.id")}sameId(t,i){return null!=t&&null!=i&&String(t)===String(i)}label(t,i){return"function"==typeof salla?.lang?.getWithDefault?salla.lang.getWithDefault(t,i):salla?.lang?.get?.(t)||i}toOrderItemRating(t){return{id:t.id??t.feedback_id,stars:t.stars??t.rating,content:t.content||"",is_pending:t.is_pending,can_update:t.can_update,images:t.images||[],videos:t.videos||[],product:t.product}}resolveOrderItem(t,i){const e=Array.isArray(t?.items)?t.items:[],s=i.find((t=>this.sameId(t.product?.id,this.productId)));if(!s)return;const a=e.find((t=>this.sameId(t.product?.id,this.productId)))||{product:s.product||{id:this.productId}};return{...a,product:a.product||s.product||{id:this.productId},rating:this.toOrderItemRating(s)}}async loadOrderItem(){const t=this.resolveFetchOrderId();if(t&&null!=this.productId&&""!==this.productId){this.fetchOrderId=t,this.allowUpdate=!!salla.config.get("store.settings.rating.allow_update");try{const i=await s(t);this.productRatings=a(i?.rating),this.orderItem=this.resolveOrderItem(i,this.productRatings)}catch(t){console.error("[salla-review-order-item] failed to load order item review",t)}}}renderActions(t){const e=t.rating;return e&&this.allowUpdate?i("div",{class:"rating-actions"},i("div",{class:"tooltip-toggle tooltip-toggle--hover icon-trigger mobile-shifted"},e.can_update?null:i("div",{class:"tooltip-content shadow-md rounded"},i("small",null,this.label("pages.order.edit_period_ended","انتهت مدة التعديل"),".")),i("salla-button",{"loader-position":"center",disabled:!e.can_update,shape:"icon",fill:"outline",color:"dark",size:"medium",onClick:()=>e.can_update?salla.event.dispatch("rating::edit",{type:"product",feedback_id:e.id}):void 0},i("i",{class:"sicon-format-border-color text-xl"}))),i("div",{class:"tooltip-toggle tooltip-toggle--hover icon-trigger mobile-shifted"},e.can_update?null:i("div",{class:"tooltip-content shadow-md rounded"},i("small",null,this.label("pages.order.delete_period_ended","انتهت مدة الحذف"),".")),i("salla-button",{"loader-position":"center",disabled:!e.can_update,shape:"icon",color:"danger",fill:"outline",size:"medium",onClick:()=>e.can_update?salla.event.dispatch("rating::delete",{feedback_id:e.id}):void 0},i("i",{class:"sicon-trash-2 text-xl"})))):null}serializeRatingMedia(t){return JSON.stringify({images:t.images||[],videos:t.videos||[],product:t.product})}serializeProductRatings(){return JSON.stringify(this.productRatings)}render(){const t=this.orderItem,s=t?.rating;return t&&s&&this.fetchOrderId?i(e,null,i("section",{class:"flex justify-between items-start border-t mt-10 pt-8"},i("div",null,i("p",{innerHTML:s.content||""}),s.is_pending?i("span",null,this.label("pages.rating.pending","قيد المراجعة")):null,i("div",{class:"flex flex-row flex-wrap gap-2"},i("salla-rating-stars",{size:"large",value:s.stars}),i("salla-review-factors-tags",{"order-id":this.fetchOrderId,"rating-id":s.id,"product-id":t.product?.id})),i("div",{class:"mt-2"},i("salla-attachments",{rating:this.serializeRatingMedia(s),"product-ratings":this.serializeProductRatings(),"product-id":t.product?.id??null}))),this.renderActions(t))):i(e,null)}static get watchers(){return{productId:["onProductIdChange"]}}};export{l as salla_review_order_item}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as t,h as s,H as a}from"./p-
|
|
4
|
+
import{r as t,h as s,H as a}from"./p-B64o_70M.js";const l=class{constructor(s){t(this,s),this.order=null,this.loading=!0}async componentWillLoad(){await salla.onReady(),await this.loadOrder()}async onOrderIdChange(){this.loading=!0,this.order=null,await this.loadOrder()}get paymentUrl(){return this.order?.customer_editing?.payment_url}async loadOrder(){const t=this.orderId||salla.config.get("page.id");if(t)try{const s=await salla.order.api.getDetails(t);this.order=s?.data??s??null}catch(t){salla.logger?.warn?.("[salla-edit-order-button] failed to fetch order details",t),this.order=null}finally{this.loading=!1}else this.loading=!1}renderEditButton(){return s("salla-count-down",{prefixText:salla.lang.getWithDefault("pages.orders.edit_within","يمكنك التعديل خلال"),buttonHref:this.order?.edit_url,buttonText:salla.lang.getWithDefault("pages.orders.edit_order","تعديل الطلب"),buttonIcon:"sicon-edit",date:this.order?.editable_until,horizontal:!0,autoSegments:!0,withButton:!0,labeled:!1,size:"sm",color:"primary"})}render(){return this.loading||!this.order?null:this.order?.is_editable?s(a,null,this.renderEditButton()):this.paymentUrl?s(a,null,s("salla-button",{href:this.paymentUrl,color:"primary",size:"small"},s("i",{class:"sicon-wallet"}),salla.lang.getWithDefault("pages.orders.pay_difference","دفع فارق المبلغ"))):null}static get watchers(){return{orderId:["onOrderIdChange"]}}};l.style="/*!twlt*/:host{display:block}";export{l as salla_edit_order_button}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as t,h as e,H as s,a as l,F as i}from"./p-FwRU05yW.js";const n=class{constructor(e){t(this,e),this.sections=[],this.itemNumber=""}deleteItem(t,e){const s=this.host.closest("form");if(s){const l=s.getAttribute("id");if(l&&"string"==typeof l){const s=l.match(/item-(\d+)/)?.[1];this.itemNumber=s||"";const i=this.host.querySelector(`#accordion-${e.id}`);salla.cart.deleteItem(`${this.itemNumber}?product_id=${e.id}§ion_id=${t}`).then((()=>i?.remove()))}}}renderRemoveButton(t,s,l=!1){return e("salla-button",{type:"button",shape:l?"btn":"icon",fill:l?"outline":"solid",size:"small",color:"danger","aria-label":"Remove from the cart",onClick:()=>this.deleteItem(t,s)},l?salla.lang.get("common.elements.delete"):e("i",{class:"sicon-cancel"}))}renderAccordionHeader(t,s){const l=s?.options&&s?.options?.length>0;return e("div",{slot:"html",class:"s-multiple-bundle-product-cart-header-wrapper"},e("div",{class:"s-multiple-bundle-product-cart-header "+(l?"":"s-multiple-bundle-product-cart-header-no-options")},e("div",{class:"s-multiple-bundle-product-cart-header-content"},e("a",{href:s?.url,class:"s-multiple-bundle-product-cart-header-image-wrapper"},e("img",{src:s?.image?.url,alt:s?.image?.alt||s?.name,class:"s-multiple-bundle-product-cart-header-image"})),e("div",{class:"s-multiple-bundle-product-cart-header-content-details"},e("h2",{class:"s-multiple-bundle-product-cart-header-content-details-title"},e("a",{href:s?.url,class:"s-multiple-bundle-product-cart-header-content-details-title-link"},s?.name)),e("div",{class:"s-multiple-bundle-product-cart-header-content-details-price"},e("span",{class:"s-multiple-bundle-product-cart-header-content-details-price-regular"},e("span",{innerHTML:s?.price?salla.money(s?.price):""})),s?.sale_price>0&&e("span",{class:"s-multiple-bundle-product-cart-header-content-details-price-sale"},e("span",{innerHTML:salla.money(s?.sale_price)}))),s?.quantity_in_group>0&&0!==s?.quantity&&e("p",{class:"s-multiple-bundle-product-cart-header-content-details-quantity"},e("span",null,salla.lang.get("pages.products.number_of_pieces")),e("span",null,s?.quantity_in_group)))),!l&&e("div",{class:"s-multiple-bundle-product-cart-header-remove-button"},this.renderRemoveButton(t,s,!1))))}render(){return e(s,{key:"78be7c4a3be811adb01cb1437473fcd9f1c17b41",class:"s-multiple-bundle-product-wrapper"},e("div",{key:"9b0439dffc9a2dd8d31f56dacb5d835cde903e71",class:"s-multiple-bundle-product-wrapper-sections"},this.sections.map(((t,s)=>t.products.map((l=>{const i={sectionId:t.id,sectionIndex:s,productId:l.id};return e("salla-accordion",{key:l.id,collapsed:!1,bordered:!0,collapsible:!!(l.options&&l.options.length>0),size:"sm",id:`accordion-${l.id}`},e("salla-accordion-head",null,this.renderAccordionHeader(String(t.id),l)),l.options&&l.options.length>0&&e("salla-accordion-body",null,e("salla-product-options",{options:JSON.stringify(l.options),key:`${l.id}-persistent`,"product-id":l.id,"bundle-context":JSON.stringify(i)}),e("div",{class:"s-multiple-bundle-product-cart-body-remove-button"},this.renderRemoveButton(String(t.id),l,!0))))}))))))}get host(){return l(this)}};n.style="";const c=class{constructor(e){t(this,e),this.sections=[],this.selectedProducts={},this.productSelectedHandler=null,this.onSelectProduct=(t,e)=>{const s=e.id,l=this.selectedProducts[t]?.has(s)??!1,i=this.sections.find((e=>e.id==t));if(!(l&&i&&this.isProductSelectionLocked(i))){if(!l){if(!i)return;if(1!==this.getEffectiveMax(i)&&this.isAtSelectionLimit(i))return}this.selectedProducts={...this.selectedProducts,[t]:new Set(this.selectedProducts[t]||[])},l?(this.selectedProducts[t].delete(s),this.clearProductFormData(s,t),this.clearProductModalOptions(s,t)):1===this.getEffectiveMax(i)?this.syncSectionSelection(t,s):this.selectedProducts[t].add(s),this.selectedProducts={...this.selectedProducts},salla.event.dispatch("on-bundle-product-selected",{id:e.id,name:e.name,options:e.options,wasSelected:l,isSelected:!l})}},this.ensureProductSelected=(t,e)=>{this.selectedProducts={...this.selectedProducts,[t]:new Set(this.selectedProducts[t]||[])};const s=e.id;if(this.selectedProducts[t].has(s))return;const l=this.sections.find((e=>e.id==t));if(!l)return;const i=this.getEffectiveMax(l);if(1===i)this.syncSectionSelection(t,s);else{if(i>1&&this.isAtSelectionLimit(l))return;this.selectedProducts[t].add(s)}this.selectedProducts={...this.selectedProducts},salla.event.dispatch("on-bundle-product-selected",{id:e.id,name:e.name,options:e.options})},this.onSelectProductOptions=(t,e)=>{const s=this.sections.find((t=>t.id==e));if(!s||!this.canSelectProductInSection(s,t.id))return;const l=this.sections.findIndex((t=>t.id==e)),i=s.products?.findIndex((e=>e.id==t.id))??0,n=this.selectedProducts[e]?.has(t.id)??!1;salla.event.dispatch("multiple-bundle-product-modal::open",{product:t,sectionId:e,sectionIndex:l,productIndex:i,isProductAlreadySelected:n})},this.handleBundleSliderProductSelected=t=>{const{product:e,sectionId:s}=t.detail;this.onSelectProduct(s,e)},this.handleBundleSliderProductOptionsSelected=t=>{const{product:e,sectionId:s}=t.detail;this.onSelectProductOptions(e,s)}}isSingleProductSection(t){return 1===(t.products?.length??0)}getObligatoryMin(t){const e=t.obligatory_products;if(null==e)return 0;const s=Number(e);return Number.isNaN(s)?0:s}isProductSelectionLocked(t){return this.isSingleProductSection(t)&&1===this.getObligatoryMin(t)}getEffectiveMax(t){const e=t.products?.length??0,s=t.max_obligatory_products;return null!=s&&s>0?Math.min(s,e):e}getSelectedCount(t){return this.selectedProducts[t]?.size??0}isAtSelectionLimit(t){return this.getSelectedCount(t.id)>=this.getEffectiveMax(t)}canSelectProductInSection(t,e){return!!this.selectedProducts[t.id]?.has(e)||1===this.getEffectiveMax(t)||!this.isAtSelectionLimit(t)}async canSelectBundleProduct(t,e){const s=this.sections.find((e=>e.id==t));return!!s&&this.canSelectProductInSection(s,e)}queryProductCheckbox(t,e){const s=`input.s-multiple-bundle-product-checkbox[name="bundle[${t}][${e}][id]"]`,l=this.host.closest("form"),i=l?.querySelector(s);if(i)return i;for(const t of this.host.querySelectorAll("salla-multiple-bundle-product-slider")){const e=(t.shadowRoot??t).querySelector(s);if(e)return e}return null}dispatchBubblingChange(t){requestAnimationFrame((()=>{t.dispatchEvent(new window.Event("change",{bubbles:!0}))}))}clearSectionProductSlot(t,e,s){const l=this.queryProductCheckbox(t,s);l&&(l.checked=!1);const i=this.host.closest("form");if(i){const e=`bundle[${t}][${s}]`;Array.from(i.querySelectorAll("input")).forEach((t=>{t.name?.startsWith(e)&&("checkbox"===t.type&&t.name?.endsWith("][id]")?t.checked=!1:t.remove())}))}this.clearProductModalOptions(e,t)}syncSectionSelection(t,e){const s=this.sections.find((e=>e.id==t));s?.products?.forEach(((s,l)=>{s.id!=e&&this.clearSectionProductSlot(t,s.id,l)})),this.selectedProducts[t]=new Set([e]);const l=s?.products?.findIndex((t=>t.id==e))??-1,i=l>=0?this.queryProductCheckbox(t,l):null;i&&(i.checked=!0,this.dispatchBubblingChange(i))}autoSelectSingleProductSections(){if(!this.sections?.length)return;const t={...this.selectedProducts};let e=!1;const s=[];for(const l of this.sections){if(!this.isProductSelectionLocked(l))continue;const i=l.products?.[0];if(!i||!i.unlimited_quantity&&(i.quantity??0)<=0)continue;const n=l.id,c=new Set(t[n]||[]);c.has(i.id)||(c.add(i.id),t[n]=c,e=!0,s.push({product:i}))}e&&(this.selectedProducts=t,s.forEach((({product:t})=>{salla.event.dispatch("on-bundle-product-selected",{id:t.id,name:t.name,options:t.options})})))}clearProductFormData(t,e){if(null!=e){const s=this.sections.find((t=>t.id==e)),l=s?.products?.findIndex((e=>e.id==t))??-1;if(l>=0)return void this.clearSectionProductSlot(e,t,l)}const s=this.host.closest("form");s&&s.querySelectorAll(`[data-product-id="${t}"]`).forEach((t=>t.remove()))}clearProductModalOptions(t,e){let s=null,l=null;if(null!=e&&(s=this.sections.findIndex((t=>t.id==e)),s>-1)){const e=this.sections[s];if(e){const s=e.products?.findIndex((e=>e.id==t));l="number"==typeof s&&s>-1?s:null}}salla.event.dispatch("multiple-bundle-product-modal::clear-options",{productId:t,sectionId:e,sectionIndex:s,productIndex:l})}getProgressStatus(t){const e=this.getSelectedCount(t.id),s=this.getEffectiveMax(t);return s>0?`${e}/${s}`:"0"}getSectionSelectionNote(t){const e=this.getObligatoryMin(t),s=Number(t.max_obligatory_products)||0,l=e>0,i=s>0;return l||i?l&&i?e===s?salla.lang.getWithDefault("pages.products.bundle_select_exact",`اختر ${e} منتجات`,{count:e}):salla.lang.getWithDefault("pages.products.bundle_select_range",`اختر من ${e} إلى ${s} منتجات`,{min:e,max:s}):l?salla.lang.getWithDefault("pages.products.bundle_select_min",`اختر على الأقل ${e} منتجات`,{min:e}):salla.lang.getWithDefault("pages.products.bundle_select_max",`اختر حتى ${s} منتجات`,{max:s}):null}handleSectionsChange(){this.autoSelectSingleProductSections()}componentWillLoad(){this.autoSelectSingleProductSections()}renderAccordionHeader(t){const s=this.getSectionSelectionNote(t);return e(i,null,e("h2",{slot:"title"},t?.name),s?e("span",{slot:"note"},s):null,e("span",{slot:"progress"},this.getProgressStatus(t)))}componentDidLoad(){const t=this.host.querySelector("salla-multiple-bundle-product-options-modal");t&&(this.productSelectedHandler=t=>{const{productId:e,sectionId:s,product:l,fromModal:i}=t.detail;i?this.ensureProductSelected(s,l||{id:e}):this.onSelectProduct(s,l||{id:e})},t.addEventListener("productSelected",this.productSelectedHandler))}disconnectedCallback(){if(this.productSelectedHandler){const t=this.host.querySelector("salla-multiple-bundle-product-options-modal");t&&t.removeEventListener("productSelected",this.productSelectedHandler),this.productSelectedHandler=null}}render(){return e(s,{key:"1ba2cde8fad73b16cfc2ccdd5e68331a9e3fdb7a",class:"s-multiple-bundle-product-wrapper"},e("div",{key:"a72d9fc9f3df30616d3d0696c755db4e76c9a153",class:"s-multiple-bundle-product-wrapper-sections"},this.sections.map(((t,s)=>e("salla-accordion",{key:t.id,collapsed:0!==s},e("salla-accordion-head",null,this.renderAccordionHeader(t)),e("salla-accordion-body",null,e("salla-multiple-bundle-product-slider",{section:t,sectionIndex:s,selectedProducts:this.selectedProducts,selectionLimit:this.getEffectiveMax(t),isSelectionLocked:this.isProductSelectionLocked(t),onProductSelected:this.handleBundleSliderProductSelected,onProductOptionsSelected:this.handleBundleSliderProductOptionsSelected})))))),e("salla-multiple-bundle-product-options-modal",{key:"1e2f996c2d995c62ae29dedc90826a1f1d0a1320"}))}get host(){return l(this)}static get watchers(){return{sections:["handleSectionsChange"]}}};c.style="";export{n as salla_multiple_bundle_product_cart,c as salla_multiple_bundle_product_details}
|
|
4
|
+
import{r as t,h as e,H as s,a as l,F as i}from"./p-B64o_70M.js";const n=class{constructor(e){t(this,e),this.sections=[],this.itemNumber=""}deleteItem(t,e){const s=this.host.closest("form");if(s){const l=s.getAttribute("id");if(l&&"string"==typeof l){const s=l.match(/item-(\d+)/)?.[1];this.itemNumber=s||"";const i=this.host.querySelector(`#accordion-${e.id}`);salla.cart.deleteItem(`${this.itemNumber}?product_id=${e.id}§ion_id=${t}`).then((()=>i?.remove()))}}}renderRemoveButton(t,s,l=!1){return e("salla-button",{type:"button",shape:l?"btn":"icon",fill:l?"outline":"solid",size:"small",color:"danger","aria-label":"Remove from the cart",onClick:()=>this.deleteItem(t,s)},l?salla.lang.get("common.elements.delete"):e("i",{class:"sicon-cancel"}))}renderAccordionHeader(t,s){const l=s?.options&&s?.options?.length>0;return e("div",{slot:"html",class:"s-multiple-bundle-product-cart-header-wrapper"},e("div",{class:"s-multiple-bundle-product-cart-header "+(l?"":"s-multiple-bundle-product-cart-header-no-options")},e("div",{class:"s-multiple-bundle-product-cart-header-content"},e("a",{href:s?.url,class:"s-multiple-bundle-product-cart-header-image-wrapper"},e("img",{src:s?.image?.url,alt:s?.image?.alt||s?.name,class:"s-multiple-bundle-product-cart-header-image"})),e("div",{class:"s-multiple-bundle-product-cart-header-content-details"},e("h2",{class:"s-multiple-bundle-product-cart-header-content-details-title"},e("a",{href:s?.url,class:"s-multiple-bundle-product-cart-header-content-details-title-link"},s?.name)),e("div",{class:"s-multiple-bundle-product-cart-header-content-details-price"},e("span",{class:"s-multiple-bundle-product-cart-header-content-details-price-regular"},e("span",{innerHTML:s?.price?salla.money(s?.price):""})),s?.sale_price>0&&e("span",{class:"s-multiple-bundle-product-cart-header-content-details-price-sale"},e("span",{innerHTML:salla.money(s?.sale_price)}))),s?.quantity_in_group>0&&0!==s?.quantity&&e("p",{class:"s-multiple-bundle-product-cart-header-content-details-quantity"},e("span",null,salla.lang.get("pages.products.number_of_pieces")),e("span",null,s?.quantity_in_group)))),!l&&e("div",{class:"s-multiple-bundle-product-cart-header-remove-button"},this.renderRemoveButton(t,s,!1))))}render(){return e(s,{key:"78be7c4a3be811adb01cb1437473fcd9f1c17b41",class:"s-multiple-bundle-product-wrapper"},e("div",{key:"9b0439dffc9a2dd8d31f56dacb5d835cde903e71",class:"s-multiple-bundle-product-wrapper-sections"},this.sections.map(((t,s)=>t.products.map((l=>{const i={sectionId:t.id,sectionIndex:s,productId:l.id};return e("salla-accordion",{key:l.id,collapsed:!1,bordered:!0,collapsible:!!(l.options&&l.options.length>0),size:"sm",id:`accordion-${l.id}`},e("salla-accordion-head",null,this.renderAccordionHeader(String(t.id),l)),l.options&&l.options.length>0&&e("salla-accordion-body",null,e("salla-product-options",{options:JSON.stringify(l.options),key:`${l.id}-persistent`,"product-id":l.id,"bundle-context":JSON.stringify(i)}),e("div",{class:"s-multiple-bundle-product-cart-body-remove-button"},this.renderRemoveButton(String(t.id),l,!0))))}))))))}get host(){return l(this)}};n.style="";const c=class{constructor(e){t(this,e),this.sections=[],this.selectedProducts={},this.productSelectedHandler=null,this.onSelectProduct=(t,e)=>{const s=e.id,l=this.selectedProducts[t]?.has(s)??!1,i=this.sections.find((e=>e.id==t));if(!(l&&i&&this.isProductSelectionLocked(i))){if(!l){if(!i)return;if(1!==this.getEffectiveMax(i)&&this.isAtSelectionLimit(i))return}this.selectedProducts={...this.selectedProducts,[t]:new Set(this.selectedProducts[t]||[])},l?(this.selectedProducts[t].delete(s),this.clearProductFormData(s,t),this.clearProductModalOptions(s,t)):1===this.getEffectiveMax(i)?this.syncSectionSelection(t,s):this.selectedProducts[t].add(s),this.selectedProducts={...this.selectedProducts},salla.event.dispatch("on-bundle-product-selected",{id:e.id,name:e.name,options:e.options,wasSelected:l,isSelected:!l})}},this.ensureProductSelected=(t,e)=>{this.selectedProducts={...this.selectedProducts,[t]:new Set(this.selectedProducts[t]||[])};const s=e.id;if(this.selectedProducts[t].has(s))return;const l=this.sections.find((e=>e.id==t));if(!l)return;const i=this.getEffectiveMax(l);if(1===i)this.syncSectionSelection(t,s);else{if(i>1&&this.isAtSelectionLimit(l))return;this.selectedProducts[t].add(s)}this.selectedProducts={...this.selectedProducts},salla.event.dispatch("on-bundle-product-selected",{id:e.id,name:e.name,options:e.options})},this.onSelectProductOptions=(t,e)=>{const s=this.sections.find((t=>t.id==e));if(!s||!this.canSelectProductInSection(s,t.id))return;const l=this.sections.findIndex((t=>t.id==e)),i=s.products?.findIndex((e=>e.id==t.id))??0,n=this.selectedProducts[e]?.has(t.id)??!1;salla.event.dispatch("multiple-bundle-product-modal::open",{product:t,sectionId:e,sectionIndex:l,productIndex:i,isProductAlreadySelected:n})},this.handleBundleSliderProductSelected=t=>{const{product:e,sectionId:s}=t.detail;this.onSelectProduct(s,e)},this.handleBundleSliderProductOptionsSelected=t=>{const{product:e,sectionId:s}=t.detail;this.onSelectProductOptions(e,s)}}isSingleProductSection(t){return 1===(t.products?.length??0)}getObligatoryMin(t){const e=t.obligatory_products;if(null==e)return 0;const s=Number(e);return Number.isNaN(s)?0:s}isProductSelectionLocked(t){return this.isSingleProductSection(t)&&1===this.getObligatoryMin(t)}getEffectiveMax(t){const e=t.products?.length??0,s=t.max_obligatory_products;return null!=s&&s>0?Math.min(s,e):e}getSelectedCount(t){return this.selectedProducts[t]?.size??0}isAtSelectionLimit(t){return this.getSelectedCount(t.id)>=this.getEffectiveMax(t)}canSelectProductInSection(t,e){return!!this.selectedProducts[t.id]?.has(e)||1===this.getEffectiveMax(t)||!this.isAtSelectionLimit(t)}async canSelectBundleProduct(t,e){const s=this.sections.find((e=>e.id==t));return!!s&&this.canSelectProductInSection(s,e)}queryProductCheckbox(t,e){const s=`input.s-multiple-bundle-product-checkbox[name="bundle[${t}][${e}][id]"]`,l=this.host.closest("form"),i=l?.querySelector(s);if(i)return i;for(const t of this.host.querySelectorAll("salla-multiple-bundle-product-slider")){const e=(t.shadowRoot??t).querySelector(s);if(e)return e}return null}dispatchBubblingChange(t){requestAnimationFrame((()=>{t.dispatchEvent(new window.Event("change",{bubbles:!0}))}))}clearSectionProductSlot(t,e,s){const l=this.queryProductCheckbox(t,s);l&&(l.checked=!1);const i=this.host.closest("form");if(i){const e=`bundle[${t}][${s}]`;Array.from(i.querySelectorAll("input")).forEach((t=>{t.name?.startsWith(e)&&("checkbox"===t.type&&t.name?.endsWith("][id]")?t.checked=!1:t.remove())}))}this.clearProductModalOptions(e,t)}syncSectionSelection(t,e){const s=this.sections.find((e=>e.id==t));s?.products?.forEach(((s,l)=>{s.id!=e&&this.clearSectionProductSlot(t,s.id,l)})),this.selectedProducts[t]=new Set([e]);const l=s?.products?.findIndex((t=>t.id==e))??-1,i=l>=0?this.queryProductCheckbox(t,l):null;i&&(i.checked=!0,this.dispatchBubblingChange(i))}autoSelectSingleProductSections(){if(!this.sections?.length)return;const t={...this.selectedProducts};let e=!1;const s=[];for(const l of this.sections){if(!this.isProductSelectionLocked(l))continue;const i=l.products?.[0];if(!i||!i.unlimited_quantity&&(i.quantity??0)<=0)continue;const n=l.id,c=new Set(t[n]||[]);c.has(i.id)||(c.add(i.id),t[n]=c,e=!0,s.push({product:i}))}e&&(this.selectedProducts=t,s.forEach((({product:t})=>{salla.event.dispatch("on-bundle-product-selected",{id:t.id,name:t.name,options:t.options})})))}clearProductFormData(t,e){if(null!=e){const s=this.sections.find((t=>t.id==e)),l=s?.products?.findIndex((e=>e.id==t))??-1;if(l>=0)return void this.clearSectionProductSlot(e,t,l)}const s=this.host.closest("form");s&&s.querySelectorAll(`[data-product-id="${t}"]`).forEach((t=>t.remove()))}clearProductModalOptions(t,e){let s=null,l=null;if(null!=e&&(s=this.sections.findIndex((t=>t.id==e)),s>-1)){const e=this.sections[s];if(e){const s=e.products?.findIndex((e=>e.id==t));l="number"==typeof s&&s>-1?s:null}}salla.event.dispatch("multiple-bundle-product-modal::clear-options",{productId:t,sectionId:e,sectionIndex:s,productIndex:l})}getProgressStatus(t){const e=this.getSelectedCount(t.id),s=this.getEffectiveMax(t);return s>0?`${e}/${s}`:"0"}getSectionSelectionNote(t){const e=this.getObligatoryMin(t),s=Number(t.max_obligatory_products)||0,l=e>0,i=s>0;return l||i?l&&i?e===s?salla.lang.getWithDefault("pages.products.bundle_select_exact",`اختر ${e} منتجات`,{count:e}):salla.lang.getWithDefault("pages.products.bundle_select_range",`اختر من ${e} إلى ${s} منتجات`,{min:e,max:s}):l?salla.lang.getWithDefault("pages.products.bundle_select_min",`اختر على الأقل ${e} منتجات`,{min:e}):salla.lang.getWithDefault("pages.products.bundle_select_max",`اختر حتى ${s} منتجات`,{max:s}):null}handleSectionsChange(){this.autoSelectSingleProductSections()}componentWillLoad(){this.autoSelectSingleProductSections()}renderAccordionHeader(t){const s=this.getSectionSelectionNote(t);return e(i,null,e("h2",{slot:"title"},t?.name),s?e("span",{slot:"note"},s):null,e("span",{slot:"progress"},this.getProgressStatus(t)))}componentDidLoad(){const t=this.host.querySelector("salla-multiple-bundle-product-options-modal");t&&(this.productSelectedHandler=t=>{const{productId:e,sectionId:s,product:l,fromModal:i}=t.detail;i?this.ensureProductSelected(s,l||{id:e}):this.onSelectProduct(s,l||{id:e})},t.addEventListener("productSelected",this.productSelectedHandler))}disconnectedCallback(){if(this.productSelectedHandler){const t=this.host.querySelector("salla-multiple-bundle-product-options-modal");t&&t.removeEventListener("productSelected",this.productSelectedHandler),this.productSelectedHandler=null}}render(){return e(s,{key:"1ba2cde8fad73b16cfc2ccdd5e68331a9e3fdb7a",class:"s-multiple-bundle-product-wrapper"},e("div",{key:"a72d9fc9f3df30616d3d0696c755db4e76c9a153",class:"s-multiple-bundle-product-wrapper-sections"},this.sections.map(((t,s)=>e("salla-accordion",{key:t.id,collapsed:0!==s},e("salla-accordion-head",null,this.renderAccordionHeader(t)),e("salla-accordion-body",null,e("salla-multiple-bundle-product-slider",{section:t,sectionIndex:s,selectedProducts:this.selectedProducts,selectionLimit:this.getEffectiveMax(t),isSelectionLocked:this.isProductSelectionLocked(t),onProductSelected:this.handleBundleSliderProductSelected,onProductOptionsSelected:this.handleBundleSliderProductOptionsSelected})))))),e("salla-multiple-bundle-product-options-modal",{key:"1e2f996c2d995c62ae29dedc90826a1f1d0a1320"}))}get host(){return l(this)}static get watchers(){return{sections:["handleSectionsChange"]}}};c.style="";export{n as salla_multiple_bundle_product_cart,c as salla_multiple_bundle_product_details}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as c,h as l,H as t,a as s}from"./p-FwRU05yW.js";import{f as i,t as e}from"./p-CO-PeZ27.js";const a=class{constructor(l){c(this,l),this.links=salla.config.get("store.social"),this.iconsList={instagram:'\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>instagram</title>\n<path d="M23 32h-14c-4.971 0-9-4.029-9-9v0-14c0-4.971 4.029-9 9-9v0h14c4.971 0 9 4.029 9 9v0 14c0 4.971-4.029 9-9 9v0zM9 2c-3.866 0-7 3.134-7 7v0 14c0 3.866 3.134 7 7 7v0h14c3.866 0 7-3.134 7-7v0-14c0-3.866-3.134-7-7-7v0zM16 24c-4.418 0-8-3.582-8-8s3.582-8 8-8c4.418 0 8 3.582 8 8v0c0 4.418-3.582 8-8 8v0zM16 10c-3.314 0-6 2.686-6 6s2.686 6 6 6c3.314 0 6-2.686 6-6v0c0-3.314-2.686-6-6-6v0zM25 9c-1.105 0-2-0.895-2-2s0.895-2 2-2c1.105 0 2 0.895 2 2v0c0 1.105-0.895 2-2 2v0zM25 7v0z"></path>\n</svg>\n',twitter:e,facebook:i,youtube:'\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>youtube</title>\n<path d="M16 28c-3.666 0-8.376-0.056-10.29-0.162-0.113 0.010-0.244 0.016-0.376 0.016-1.676 0-3.139-0.91-3.922-2.264l-0.012-0.022c-0.97-1.6-1.4-4.248-1.4-8.558s0.436-6.962 1.412-8.6c0.782-1.36 2.227-2.262 3.883-2.262 0.148 0 0.293 0.007 0.437 0.021l-0.018-0.001c1.872-0.124 6.544-0.168 10.286-0.168s8.4 0.044 10.292 0.168c0.124-0.012 0.267-0.019 0.412-0.019 1.656 0 3.101 0.905 3.866 2.247l0.012 0.022c0.982 1.624 1.418 4.27 1.418 8.582 0 4.338-0.438 6.982-1.422 8.6-0.789 1.364-2.241 2.268-3.904 2.268-0.133 0-0.265-0.006-0.395-0.017l0.017 0.001c-1.926 0.092-6.632 0.148-10.296 0.148zM16 8c-3.712 0-8.334 0.042-10.168 0.164-1.688 0.094-2.14 0.306-2.702 1.268-0.756 1.81-1.195 3.913-1.195 6.119 0 0.51 0.024 1.015 0.069 1.513l-0.005-0.064c-0.042 0.435-0.065 0.941-0.065 1.453 0 2.198 0.438 4.294 1.231 6.205l-0.039-0.107c0.566 0.968 1.022 1.184 2.708 1.296 3.29 0.184 17.022 0.184 20.34 0 1.678-0.11 2.132-0.326 2.684-1.28 0.764-1.803 1.208-3.899 1.208-6.1 0-0.513-0.024-1.020-0.071-1.52l0.005 0.064c0.042-0.436 0.065-0.943 0.065-1.455 0-2.203-0.439-4.303-1.235-6.218l0.040 0.107v-0.016c-0.554-0.958-1-1.17-2.684-1.264-1.862-0.122-6.644-0.164-10.186-0.164zM13 23c-0.552 0-1-0.448-1-1v0-10c0 0 0 0 0 0 0-0.552 0.448-1 1-1 0.196 0 0.38 0.057 0.534 0.154l-0.004-0.002 8 5c0.284 0.18 0.47 0.492 0.47 0.848s-0.186 0.668-0.466 0.846l-0.004 0.002-8 5c-0.15 0.095-0.334 0.152-0.53 0.152 0 0 0 0 0 0v0zM14 13.8v6.4l5.114-3.2z"></path>\n</svg>\n',snapchat:'\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>snapchat</title>\n<path d="M16.186 30h-0.266c-1.843-0.023-3.525-0.693-4.834-1.792l0.012 0.010c-0.476-0.405-1.043-0.72-1.665-0.909l-0.033-0.009c-0.287-0.044-0.617-0.069-0.954-0.069-0.492 0-0.972 0.053-1.434 0.155l0.044-0.008c-0.261 0.061-0.564 0.102-0.875 0.114l-0.009 0c-0.017 0.001-0.036 0.001-0.056 0.001-0.811 0-1.495-0.545-1.705-1.288l-0.003-0.012c-0.076-0.26-0.132-0.506-0.186-0.746-0.961-0.157-1.822-0.412-2.633-0.76l0.073 0.028c-0.667-0.259-1.199-0.745-1.509-1.362l-0.007-0.016c-0.082-0.189-0.135-0.409-0.146-0.64l-0-0.004c-0.002-0.031-0.003-0.067-0.003-0.103 0-0.841 0.614-1.538 1.417-1.668l0.010-0.001c0.822-0.141 1.555-0.438 2.198-0.859l-0.022 0.013c0.611-0.405 1.138-0.872 1.591-1.404l0.009-0.010c0.526-0.595 0.98-1.273 1.337-2.007l0.023-0.053c0.060-0.102 0.107-0.22 0.135-0.346l0.001-0.008c-0.092-0.020-0.73-0.222-0.972-0.298s-0.374-0.12-0.506-0.17c-0.546-0.205-1.016-0.487-1.424-0.839l0.006 0.005c-0.471-0.388-0.768-0.971-0.768-1.624 0-0.126 0.011-0.249 0.032-0.369l-0.002 0.013c0.143-0.644 0.551-1.172 1.1-1.474l0.011-0.006c0.389-0.241 0.861-0.384 1.366-0.384 0.347 0 0.678 0.067 0.982 0.19l-0.018-0.006c0.128 0.060 0.242 0.106 0.344 0.142-0.082-0.573-0.129-1.235-0.129-1.908 0-1.482 0.227-2.91 0.648-4.253l-0.027 0.101c0.512-1.142 1.207-2.114 2.056-2.925l0.004-0.003c0.7-0.664 1.516-1.214 2.413-1.616l0.055-0.022c1.128-0.5 2.444-0.794 3.828-0.8h0.592c1.386 0.007 2.701 0.301 3.893 0.825l-0.063-0.025c0.956 0.42 1.777 0.967 2.485 1.632l-0.005-0.004c0.855 0.815 1.55 1.789 2.039 2.876l0.023 0.058c0.396 1.237 0.625 2.659 0.625 4.135 0 0.658-0.045 1.304-0.133 1.938l0.008-0.073 0.172-0.076c0.303-0.16 0.661-0.253 1.042-0.253 0.374 0 0.728 0.091 1.039 0.251l-0.013-0.006c0.886 0.274 1.528 1.063 1.582 2.008l0 0.006c-0.001 0.602-0.25 1.146-0.65 1.536l-0 0c-0.429 0.408-0.945 0.73-1.516 0.935l-0.030 0.009c-0.144 0.056-0.316 0.112-0.504 0.17-0.367 0.103-0.686 0.235-0.984 0.398l0.024-0.012c0.018 0.030 0.042 0.094 0.086 0.18 0.963 2.174 2.834 3.796 5.118 4.4l0.054 0.012c0.814 0.133 1.427 0.83 1.427 1.671 0 0.036-0.001 0.072-0.003 0.108l0-0.005c-0.012 0.241-0.070 0.465-0.165 0.669l0.005-0.011c-0.319 0.624-0.847 1.103-1.489 1.352l-0.019 0.006c-0.739 0.323-1.6 0.578-2.497 0.724l-0.063 0.008c-0.056 0.264-0.112 0.496-0.186 0.742-0.215 0.747-0.893 1.284-1.696 1.284-0.011 0-0.021-0-0.032-0l0.002 0c-0.328-0.004-0.644-0.042-0.949-0.11l0.031 0.006c-0.404-0.090-0.869-0.142-1.345-0.142-0.353 0-0.7 0.029-1.038 0.083l0.037-0.005c-0.653 0.195-1.218 0.508-1.699 0.917l0.007-0.005c-1.275 1.065-2.916 1.731-4.71 1.788l-0.012 0zM8.444 25.218c0.457 0.001 0.904 0.041 1.339 0.117l-0.047-0.007c0.966 0.232 1.808 0.664 2.516 1.252l-0.010-0.008c0.96 0.829 2.199 1.357 3.56 1.427l0.014 0.001h0.37c1.373-0.070 2.61-0.597 3.576-1.43l-0.008 0.006c0.701-0.583 1.546-1.016 2.474-1.239l0.042-0.009c0.394-0.063 0.849-0.1 1.312-0.1 0.615 0 1.216 0.064 1.795 0.186l-0.057-0.010c0.105 0.023 0.238 0.045 0.372 0.059l0.016 0.001c0.042-0.162 0.076-0.314 0.11-0.47 0.059-0.339 0.156-0.641 0.287-0.924l-0.009 0.023 0.234-0.44 0.492-0.078c0.99-0.119 1.892-0.359 2.738-0.705l-0.070 0.025c0.086-0.040 0.158-0.076 0.216-0.11-2.748-0.86-4.933-2.816-6.081-5.342l-0.025-0.062c-0.184-0.31-0.294-0.684-0.294-1.083 0-0.27 0.050-0.528 0.14-0.765l-0.005 0.015c0.492-0.783 1.284-1.339 2.212-1.507l0.020-0.003c0.14-0.044 0.27-0.084 0.376-0.126 0.327-0.108 0.609-0.272 0.849-0.482l-0.003 0.002c0.074-0.106 0-0.2-0.216-0.284-0.094-0.041-0.203-0.065-0.318-0.066h-0c-0.529 0.242-1.142 0.411-1.786 0.474l-0.024 0.002c-0.313-0-0.612-0.064-0.883-0.18l0.015 0.006-0.628-0.28 0.072-1.272c0.093-0.623 0.146-1.342 0.146-2.074 0-1.269-0.16-2.501-0.46-3.677l0.022 0.103c-0.396-0.896-0.936-1.659-1.598-2.296l-0.002-0.002c-0.541-0.508-1.172-0.928-1.865-1.233l-0.043-0.017c-0.895-0.396-1.939-0.629-3.036-0.634h-0.002l-0.218-1v1h-0.348c-1.105 0.003-2.155 0.237-3.106 0.656l0.050-0.020c-0.733 0.322-1.361 0.742-1.903 1.253l0.003-0.003c-0.663 0.638-1.203 1.398-1.582 2.247l-0.018 0.045c-0.279 1.065-0.44 2.287-0.44 3.547 0 0.704 0.050 1.395 0.147 2.072l-0.009-0.078 0.080 1.372-0.618 0.284c-0.31 0.108-0.666 0.17-1.038 0.17-0.6 0-1.163-0.163-1.645-0.446l0.015 0.008c-0.019-0.001-0.041-0.002-0.064-0.002-0.154 0-0.299 0.039-0.425 0.109l0.005-0.002c-0.063 0.032-0.115 0.078-0.153 0.135l-0.001 0.001c0.258 0.244 0.567 0.435 0.91 0.556l0.018 0.006c0.094 0.036 0.2 0.070 0.32 0.108 0.971 0.167 1.784 0.732 2.282 1.516l0.008 0.014c0.087 0.225 0.137 0.486 0.137 0.758 0 0.403-0.11 0.781-0.303 1.104l0.005-0.010c-0.459 0.983-1.016 1.829-1.677 2.582l0.011-0.012c-0.588 0.687-1.26 1.279-2.004 1.768l-0.036 0.022c-0.689 0.451-1.49 0.805-2.346 1.017l-0.054 0.011c0.060 0.034 0.132 0.072 0.218 0.112 0.776 0.322 1.678 0.561 2.618 0.675l0.050 0.005 0.498 0.078 0.234 0.446c0.116 0.255 0.209 0.553 0.265 0.863l0.003 0.023c0.038 0.164 0.072 0.328 0.118 0.496 0.12-0.014 0.242-0.042 0.378-0.068 0.528-0.12 1.138-0.192 1.762-0.2l0.006-0zM30.244 22.892v0z"></path>\n</svg>\n',tiktok:'\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>tiktok</title>\n<path d="M29.046 7.029c-3.359 0-6.092-2.733-6.092-6.092 0-0.518-0.42-0.938-0.938-0.938h-5.021c-0.518 0-0.938 0.42-0.938 0.938v20.585c0 1.975-1.606 3.581-3.581 3.581s-3.581-1.606-3.581-3.581c0-1.975 1.606-3.581 3.581-3.581 0.518 0 0.938-0.42 0.938-0.938v-5.021c0-0.518-0.42-0.938-0.938-0.938-5.777 0-10.477 4.7-10.477 10.477s4.7 10.477 10.477 10.477c5.777 0 10.477-4.7 10.477-10.477v-9.112c1.866 0.995 3.942 1.514 6.092 1.514 0.518 0 0.938-0.42 0.938-0.938v-5.021c0-0.518-0.42-0.938-0.938-0.938zM28.108 12.011c-2.001-0.166-3.902-0.866-5.544-2.047-0.285-0.206-0.662-0.234-0.975-0.073s-0.51 0.482-0.51 0.834v10.798c0 4.743-3.859 8.602-8.602 8.602s-8.602-3.859-8.602-8.602c0-4.427 3.361-8.083 7.665-8.552v3.176c-2.563 0.446-4.519 2.687-4.519 5.376 0 3.009 2.447 5.456 5.456 5.456s5.456-2.448 5.456-5.456v-19.648h3.201c0.429 3.645 3.329 6.545 6.974 6.974z"></path>\n</svg>\n'},this.socialSlot=this.host.querySelector('[slot="social-item"]')?.innerHTML||'<a href={link} rel="noopener" target="_blank" title={type} aria-label={type}><span class="s-social-icon">{icon}</span></a>',salla.lang.onLoaded((()=>{this.links=salla.config.get("store.social")}))}getLinksArray(){return this.links?Object.entries(this.links).filter((([c,l])=>!!l&&"whatsapp"!==c)).map((([c,l])=>({type:c,value:l}))):[]}componentWillLoad(){return new Promise((c=>salla.onReady(c)))}render(){const c=this.getLinksArray();return l(t,{key:"e7d69dbae46ef54588471875ada751103d14d393"},l("ul",{key:"ff4b15127e6664cca17fa7f6f49e4cda25829d74",class:"s-social-list"},c.map((c=>l("li",{class:"s-social-link"},l("div",{id:"social-slot",innerHTML:this.socialSlot.replace(/\{icon\}/g,this.iconsList[c.type]).replace(/\{type\}/g,c.type).replace(/\{link\}/g,c.value.toString())}))))))}componentDidRender(){this.host.querySelectorAll("#social-slot").forEach((c=>c.replaceWith(c.firstChild))),this.host.querySelector('[slot="social-item"]')?.remove()}get host(){return s(this)}};a.style="/*!twlt*/:host{display:block}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.s-social-list{display:flex;gap:0.625rem}.s-social-link a{display:flex;height:2rem;width:2rem;align-items:center;justify-content:center;border-radius:9999px;border-width:1px;font-size:0.875rem;line-height:1.25rem;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:300ms}.s-social-link a:hover{opacity:0.75}.s-social-link a svg{height:0.875rem;width:0.875rem;fill:currentColor}";export{a as salla_social}
|
|
4
|
+
import{r as c,h as l,H as t,a as s}from"./p-B64o_70M.js";import{f as i,t as e}from"./p-CO-PeZ27.js";const o=class{constructor(l){c(this,l),this.links=salla.config.get("store.social"),this.iconsList={instagram:'\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>instagram</title>\n<path d="M23 32h-14c-4.971 0-9-4.029-9-9v0-14c0-4.971 4.029-9 9-9v0h14c4.971 0 9 4.029 9 9v0 14c0 4.971-4.029 9-9 9v0zM9 2c-3.866 0-7 3.134-7 7v0 14c0 3.866 3.134 7 7 7v0h14c3.866 0 7-3.134 7-7v0-14c0-3.866-3.134-7-7-7v0zM16 24c-4.418 0-8-3.582-8-8s3.582-8 8-8c4.418 0 8 3.582 8 8v0c0 4.418-3.582 8-8 8v0zM16 10c-3.314 0-6 2.686-6 6s2.686 6 6 6c3.314 0 6-2.686 6-6v0c0-3.314-2.686-6-6-6v0zM25 9c-1.105 0-2-0.895-2-2s0.895-2 2-2c1.105 0 2 0.895 2 2v0c0 1.105-0.895 2-2 2v0zM25 7v0z"></path>\n</svg>\n',twitter:e,facebook:i,youtube:'\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>youtube</title>\n<path d="M16 28c-3.666 0-8.376-0.056-10.29-0.162-0.113 0.010-0.244 0.016-0.376 0.016-1.676 0-3.139-0.91-3.922-2.264l-0.012-0.022c-0.97-1.6-1.4-4.248-1.4-8.558s0.436-6.962 1.412-8.6c0.782-1.36 2.227-2.262 3.883-2.262 0.148 0 0.293 0.007 0.437 0.021l-0.018-0.001c1.872-0.124 6.544-0.168 10.286-0.168s8.4 0.044 10.292 0.168c0.124-0.012 0.267-0.019 0.412-0.019 1.656 0 3.101 0.905 3.866 2.247l0.012 0.022c0.982 1.624 1.418 4.27 1.418 8.582 0 4.338-0.438 6.982-1.422 8.6-0.789 1.364-2.241 2.268-3.904 2.268-0.133 0-0.265-0.006-0.395-0.017l0.017 0.001c-1.926 0.092-6.632 0.148-10.296 0.148zM16 8c-3.712 0-8.334 0.042-10.168 0.164-1.688 0.094-2.14 0.306-2.702 1.268-0.756 1.81-1.195 3.913-1.195 6.119 0 0.51 0.024 1.015 0.069 1.513l-0.005-0.064c-0.042 0.435-0.065 0.941-0.065 1.453 0 2.198 0.438 4.294 1.231 6.205l-0.039-0.107c0.566 0.968 1.022 1.184 2.708 1.296 3.29 0.184 17.022 0.184 20.34 0 1.678-0.11 2.132-0.326 2.684-1.28 0.764-1.803 1.208-3.899 1.208-6.1 0-0.513-0.024-1.020-0.071-1.52l0.005 0.064c0.042-0.436 0.065-0.943 0.065-1.455 0-2.203-0.439-4.303-1.235-6.218l0.040 0.107v-0.016c-0.554-0.958-1-1.17-2.684-1.264-1.862-0.122-6.644-0.164-10.186-0.164zM13 23c-0.552 0-1-0.448-1-1v0-10c0 0 0 0 0 0 0-0.552 0.448-1 1-1 0.196 0 0.38 0.057 0.534 0.154l-0.004-0.002 8 5c0.284 0.18 0.47 0.492 0.47 0.848s-0.186 0.668-0.466 0.846l-0.004 0.002-8 5c-0.15 0.095-0.334 0.152-0.53 0.152 0 0 0 0 0 0v0zM14 13.8v6.4l5.114-3.2z"></path>\n</svg>\n',snapchat:'\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>snapchat</title>\n<path d="M16.186 30h-0.266c-1.843-0.023-3.525-0.693-4.834-1.792l0.012 0.010c-0.476-0.405-1.043-0.72-1.665-0.909l-0.033-0.009c-0.287-0.044-0.617-0.069-0.954-0.069-0.492 0-0.972 0.053-1.434 0.155l0.044-0.008c-0.261 0.061-0.564 0.102-0.875 0.114l-0.009 0c-0.017 0.001-0.036 0.001-0.056 0.001-0.811 0-1.495-0.545-1.705-1.288l-0.003-0.012c-0.076-0.26-0.132-0.506-0.186-0.746-0.961-0.157-1.822-0.412-2.633-0.76l0.073 0.028c-0.667-0.259-1.199-0.745-1.509-1.362l-0.007-0.016c-0.082-0.189-0.135-0.409-0.146-0.64l-0-0.004c-0.002-0.031-0.003-0.067-0.003-0.103 0-0.841 0.614-1.538 1.417-1.668l0.010-0.001c0.822-0.141 1.555-0.438 2.198-0.859l-0.022 0.013c0.611-0.405 1.138-0.872 1.591-1.404l0.009-0.010c0.526-0.595 0.98-1.273 1.337-2.007l0.023-0.053c0.060-0.102 0.107-0.22 0.135-0.346l0.001-0.008c-0.092-0.020-0.73-0.222-0.972-0.298s-0.374-0.12-0.506-0.17c-0.546-0.205-1.016-0.487-1.424-0.839l0.006 0.005c-0.471-0.388-0.768-0.971-0.768-1.624 0-0.126 0.011-0.249 0.032-0.369l-0.002 0.013c0.143-0.644 0.551-1.172 1.1-1.474l0.011-0.006c0.389-0.241 0.861-0.384 1.366-0.384 0.347 0 0.678 0.067 0.982 0.19l-0.018-0.006c0.128 0.060 0.242 0.106 0.344 0.142-0.082-0.573-0.129-1.235-0.129-1.908 0-1.482 0.227-2.91 0.648-4.253l-0.027 0.101c0.512-1.142 1.207-2.114 2.056-2.925l0.004-0.003c0.7-0.664 1.516-1.214 2.413-1.616l0.055-0.022c1.128-0.5 2.444-0.794 3.828-0.8h0.592c1.386 0.007 2.701 0.301 3.893 0.825l-0.063-0.025c0.956 0.42 1.777 0.967 2.485 1.632l-0.005-0.004c0.855 0.815 1.55 1.789 2.039 2.876l0.023 0.058c0.396 1.237 0.625 2.659 0.625 4.135 0 0.658-0.045 1.304-0.133 1.938l0.008-0.073 0.172-0.076c0.303-0.16 0.661-0.253 1.042-0.253 0.374 0 0.728 0.091 1.039 0.251l-0.013-0.006c0.886 0.274 1.528 1.063 1.582 2.008l0 0.006c-0.001 0.602-0.25 1.146-0.65 1.536l-0 0c-0.429 0.408-0.945 0.73-1.516 0.935l-0.030 0.009c-0.144 0.056-0.316 0.112-0.504 0.17-0.367 0.103-0.686 0.235-0.984 0.398l0.024-0.012c0.018 0.030 0.042 0.094 0.086 0.18 0.963 2.174 2.834 3.796 5.118 4.4l0.054 0.012c0.814 0.133 1.427 0.83 1.427 1.671 0 0.036-0.001 0.072-0.003 0.108l0-0.005c-0.012 0.241-0.070 0.465-0.165 0.669l0.005-0.011c-0.319 0.624-0.847 1.103-1.489 1.352l-0.019 0.006c-0.739 0.323-1.6 0.578-2.497 0.724l-0.063 0.008c-0.056 0.264-0.112 0.496-0.186 0.742-0.215 0.747-0.893 1.284-1.696 1.284-0.011 0-0.021-0-0.032-0l0.002 0c-0.328-0.004-0.644-0.042-0.949-0.11l0.031 0.006c-0.404-0.090-0.869-0.142-1.345-0.142-0.353 0-0.7 0.029-1.038 0.083l0.037-0.005c-0.653 0.195-1.218 0.508-1.699 0.917l0.007-0.005c-1.275 1.065-2.916 1.731-4.71 1.788l-0.012 0zM8.444 25.218c0.457 0.001 0.904 0.041 1.339 0.117l-0.047-0.007c0.966 0.232 1.808 0.664 2.516 1.252l-0.010-0.008c0.96 0.829 2.199 1.357 3.56 1.427l0.014 0.001h0.37c1.373-0.070 2.61-0.597 3.576-1.43l-0.008 0.006c0.701-0.583 1.546-1.016 2.474-1.239l0.042-0.009c0.394-0.063 0.849-0.1 1.312-0.1 0.615 0 1.216 0.064 1.795 0.186l-0.057-0.010c0.105 0.023 0.238 0.045 0.372 0.059l0.016 0.001c0.042-0.162 0.076-0.314 0.11-0.47 0.059-0.339 0.156-0.641 0.287-0.924l-0.009 0.023 0.234-0.44 0.492-0.078c0.99-0.119 1.892-0.359 2.738-0.705l-0.070 0.025c0.086-0.040 0.158-0.076 0.216-0.11-2.748-0.86-4.933-2.816-6.081-5.342l-0.025-0.062c-0.184-0.31-0.294-0.684-0.294-1.083 0-0.27 0.050-0.528 0.14-0.765l-0.005 0.015c0.492-0.783 1.284-1.339 2.212-1.507l0.020-0.003c0.14-0.044 0.27-0.084 0.376-0.126 0.327-0.108 0.609-0.272 0.849-0.482l-0.003 0.002c0.074-0.106 0-0.2-0.216-0.284-0.094-0.041-0.203-0.065-0.318-0.066h-0c-0.529 0.242-1.142 0.411-1.786 0.474l-0.024 0.002c-0.313-0-0.612-0.064-0.883-0.18l0.015 0.006-0.628-0.28 0.072-1.272c0.093-0.623 0.146-1.342 0.146-2.074 0-1.269-0.16-2.501-0.46-3.677l0.022 0.103c-0.396-0.896-0.936-1.659-1.598-2.296l-0.002-0.002c-0.541-0.508-1.172-0.928-1.865-1.233l-0.043-0.017c-0.895-0.396-1.939-0.629-3.036-0.634h-0.002l-0.218-1v1h-0.348c-1.105 0.003-2.155 0.237-3.106 0.656l0.050-0.020c-0.733 0.322-1.361 0.742-1.903 1.253l0.003-0.003c-0.663 0.638-1.203 1.398-1.582 2.247l-0.018 0.045c-0.279 1.065-0.44 2.287-0.44 3.547 0 0.704 0.050 1.395 0.147 2.072l-0.009-0.078 0.080 1.372-0.618 0.284c-0.31 0.108-0.666 0.17-1.038 0.17-0.6 0-1.163-0.163-1.645-0.446l0.015 0.008c-0.019-0.001-0.041-0.002-0.064-0.002-0.154 0-0.299 0.039-0.425 0.109l0.005-0.002c-0.063 0.032-0.115 0.078-0.153 0.135l-0.001 0.001c0.258 0.244 0.567 0.435 0.91 0.556l0.018 0.006c0.094 0.036 0.2 0.070 0.32 0.108 0.971 0.167 1.784 0.732 2.282 1.516l0.008 0.014c0.087 0.225 0.137 0.486 0.137 0.758 0 0.403-0.11 0.781-0.303 1.104l0.005-0.010c-0.459 0.983-1.016 1.829-1.677 2.582l0.011-0.012c-0.588 0.687-1.26 1.279-2.004 1.768l-0.036 0.022c-0.689 0.451-1.49 0.805-2.346 1.017l-0.054 0.011c0.060 0.034 0.132 0.072 0.218 0.112 0.776 0.322 1.678 0.561 2.618 0.675l0.050 0.005 0.498 0.078 0.234 0.446c0.116 0.255 0.209 0.553 0.265 0.863l0.003 0.023c0.038 0.164 0.072 0.328 0.118 0.496 0.12-0.014 0.242-0.042 0.378-0.068 0.528-0.12 1.138-0.192 1.762-0.2l0.006-0zM30.244 22.892v0z"></path>\n</svg>\n',tiktok:'\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>tiktok</title>\n<path d="M29.046 7.029c-3.359 0-6.092-2.733-6.092-6.092 0-0.518-0.42-0.938-0.938-0.938h-5.021c-0.518 0-0.938 0.42-0.938 0.938v20.585c0 1.975-1.606 3.581-3.581 3.581s-3.581-1.606-3.581-3.581c0-1.975 1.606-3.581 3.581-3.581 0.518 0 0.938-0.42 0.938-0.938v-5.021c0-0.518-0.42-0.938-0.938-0.938-5.777 0-10.477 4.7-10.477 10.477s4.7 10.477 10.477 10.477c5.777 0 10.477-4.7 10.477-10.477v-9.112c1.866 0.995 3.942 1.514 6.092 1.514 0.518 0 0.938-0.42 0.938-0.938v-5.021c0-0.518-0.42-0.938-0.938-0.938zM28.108 12.011c-2.001-0.166-3.902-0.866-5.544-2.047-0.285-0.206-0.662-0.234-0.975-0.073s-0.51 0.482-0.51 0.834v10.798c0 4.743-3.859 8.602-8.602 8.602s-8.602-3.859-8.602-8.602c0-4.427 3.361-8.083 7.665-8.552v3.176c-2.563 0.446-4.519 2.687-4.519 5.376 0 3.009 2.447 5.456 5.456 5.456s5.456-2.448 5.456-5.456v-19.648h3.201c0.429 3.645 3.329 6.545 6.974 6.974z"></path>\n</svg>\n'},this.socialSlot=this.host.querySelector('[slot="social-item"]')?.innerHTML||'<a href={link} rel="noopener" target="_blank" title={type} aria-label={type}><span class="s-social-icon">{icon}</span></a>',salla.lang.onLoaded((()=>{this.links=salla.config.get("store.social")}))}getLinksArray(){return this.links?Object.entries(this.links).filter((([c,l])=>!!l&&"whatsapp"!==c)).map((([c,l])=>({type:c,value:l}))):[]}componentWillLoad(){return new Promise((c=>salla.onReady(c)))}render(){const c=this.getLinksArray();return l(t,{key:"e7d69dbae46ef54588471875ada751103d14d393"},l("ul",{key:"ff4b15127e6664cca17fa7f6f49e4cda25829d74",class:"s-social-list"},c.map((c=>l("li",{class:"s-social-link"},l("div",{id:"social-slot",innerHTML:this.socialSlot.replace(/\{icon\}/g,this.iconsList[c.type]).replace(/\{type\}/g,c.type).replace(/\{link\}/g,c.value.toString())}))))))}componentDidRender(){this.host.querySelectorAll("#social-slot").forEach((c=>c.replaceWith(c.firstChild))),this.host.querySelector('[slot="social-item"]')?.remove()}get host(){return s(this)}};o.style="/*!twlt*/:host{display:block}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.s-social-list{display:flex;gap:0.625rem}.s-social-link a{display:flex;height:2rem;width:2rem;align-items:center;justify-content:center;border-radius:9999px;border-width:1px;font-size:0.875rem;line-height:1.25rem;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:300ms}.s-social-link a:hover{opacity:0.75}.s-social-link a svg{height:0.875rem;width:0.875rem;fill:currentColor}";export{o as salla_social}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as t,h as i}from"./p-FwRU05yW.js";import{a as e}from"./p-CgtvEd63.js";import{a as s}from"./p-BedNk7k1.js";import{C as r}from"./p-BsLF_HK7.js";import{G as a}from"./p-DxkgAGoT.js";const o=class{constructor(i){t(this,i),this.defaultEvent="gifting:open",this.selectImageForYourGift=salla.lang.get("blocks.buy_as_gift.select_image_for_your_gift"),this.currentStep=1,this.showCalendar=!1,this.showGiftText=!1,this.currentLang="",this.parentClass="is-current-step-1",this.errors={},this.gift=void 0,this.selectedGiftTextOption=void 0,this.selectedCountryId=void 0,this.selectedCountryCode=void 0,this.loadingCities=!1,this.loadingRegions=!1,this.regions=[],this.selectedRegionId=void 0,this.isKSA=!1,this.selectedCountry=null,this.selectedRegion=null,this.displayedCities=[],this.selectedCity=null,this.searchingCities=!1,this.enableCityAjaxSearch=!1,this.citySearchQuery="",this.step2Animated=!1,this.citySearchTimer=null,this.citySearchCounter=0,this.locationRequestCounter=0,this.showTextArea=!1,this.selectedImage=void 0,this.uploadedImage=void 0,this.selectedText=void 0,this.hasError=!1,this.timeZone=null,this.receiverCountryCode=salla.config.get("store.scope.countries")?.[0]||salla.config.get("store.store_country")||"SA",this.hostId=`salla-gifting-${Math.random().toString(36).slice(2,10)}`,this.disableClass=this.gift?.show_image_upload?"":"pointer-events-none",this.formSelector="form.product-form, form.form--product-options",this.handleCitySearch=t=>{if(this.citySearchQuery=t,!this.enableCityAjaxSearch)return;this.citySearchTimer&&clearTimeout(this.citySearchTimer);const i=++this.citySearchCounter;this.citySearchTimer=setTimeout((async()=>{this.searchingCities=!0;try{const e=await this.fetchCities(t);i===this.citySearchCounter&&(this.displayedCities=e)}catch(t){i===this.citySearchCounter&&(this.displayedCities=[])}finally{i===this.citySearchCounter&&(this.searchingCities=!1)}}),o.CITY_SEARCH_DEBOUNCE_MS)},this.handleCitySelected=t=>{this.selectedCity=t,this.receiverCity=String(t.id),this.clearError("receiver.city_id")},this.handleCityDropdownClosed=()=>{this.citySearchQuery="",this.citySearchTimer&&(clearTimeout(this.citySearchTimer),this.citySearchTimer=null),++this.citySearchCounter,this.displayedCities=this.gift?.cities??[],this.searchingCities=!1},this.handleCountryDropdownClosed=()=>{},this.handleRegionDropdownClosed=()=>{},salla.lang.onLoaded((()=>{this.selectImageOrUpload=salla.lang.get("blocks.buy_as_gift.select_image_or_upload"),this.selectImageForYourGift=salla.lang.get("blocks.buy_as_gift.select_image_for_your_gift"),this.sectionTitle=salla.lang.get("blocks.buy_as_gift.gift_the_one_you_love"),this.sectionSubtitle=salla.lang.get("blocks.buy_as_gift.gift_the_one_you_love_message"),this.sectionBtnText=salla.lang.get("blocks.buy_as_gift.send_as_a_gift"),this.giftDetails=salla.lang.get("blocks.buy_as_gift.gift_details"),this.selectGiftMessage=salla.lang.get("blocks.buy_as_gift.select_gift_message"),this.giftText=salla.lang.get("blocks.buy_as_gift.gift_text"),this.giftCustomText=salla.lang.get("blocks.buy_as_gift.gift_custom_text"),this.textId=salla.lang.get("blocks.buy_as_gift.text_id"),this.incorrectGiftText=salla.lang.get("blocks.buy_as_gift.incorrect_gift_text"),this.nextStep=salla.lang.get("blocks.buy_as_gift.next_step"),this.senderNameLabel=salla.lang.get("blocks.buy_as_gift.sender_name"),this.receiverNameFieldLabel=salla.lang.get("blocks.buy_as_gift.receiver_name"),this.receiverMobileFieldLabel=salla.lang.get("blocks.buy_as_gift.receiver_mobile"),this.receiverCountryFieldLabel=salla.lang.get("blocks.buy_as_gift.receiver_country"),this.ksa=salla.lang.get("pages.checkout.ksa"),this.selectCity=salla.lang.get("pages.checkout.select_city"),this.selectCountry=salla.lang.get("pages.checkout.select_country"),this.selectCityInfo=salla.lang.get("blocks.buy_as_gift.city_info"),this.cityChangeNotice=salla.lang.get("blocks.buy_as_gift.city_change_notice"),this.receiverCityFieldLabel=salla.lang.get("blocks.buy_as_gift.receiver_city"),this.receiverRegionFieldLabel=salla.lang.get("blocks.buy_as_gift.receiver_region")||salla.lang.get("pages.checkout.region"),this.selectRegion=salla.lang.get("pages.checkout.select_region"),this.receiverEmailFieldLabel=salla.lang.get("blocks.buy_as_gift.receiver_email"),this.emailPlaceholder=salla.lang.get("common.elements.email_placeholder"),this.sendLater=salla.lang.get("blocks.buy_as_gift.send_later"),this.selectSendDateAndTime=salla.lang.get("blocks.buy_as_gift.select_send_date_and_time"),this.canNotEditOrderAfterSelectDate=salla.lang.get("blocks.buy_as_gift.can_not_edit_order_after_select_date"),this.sendGift=salla.lang.get("blocks.buy_as_gift.send_gift"),this.donationRequired=salla.lang.get("pages.products.donation_amount_required"),this.currentLang=salla.lang.locale})),salla.event.on(this.defaultEvent,(()=>{this.open()}))}isPhysical(){return this.physicalProducts||this.physical}cityNoticeText(){return this.gift?.recipient_can_change_address?this.gift?.allows_different_shipping_cost?null:this.cityChangeNotice:this.selectCityInfo}componentDidLoad(){salla.event.product.onPriceUpdated((()=>{const t=document.querySelector(".s-quantity-input-input");this.quantity=t?.value}))}getFormDataFromForm(){if(!this.formSelector)return null;const t=document.querySelector(this.formSelector);return t?new FormData(t):null}mergeObjectToFormData(t,i,e){for(let s in t){if(!t.hasOwnProperty(s)||null==t[s])continue;const r=e?`${e}[${s}]`:s;"object"!=typeof t[s]||null===t[s]||t[s]instanceof File?i.set(r,t[s]):this.mergeObjectToFormData(t[s],i,r)}return i}async open(){if(salla.config.isGuest())return salla.api.auth.setAfterLoginEvent(this.defaultEvent),void salla.event.dispatch("login::open",{withoutReload:!0});this.resetStepsAnimation(),this.currentStep=1,this.parentClass="is-current-step-1",this.step2Animated=!1,this.stepsWrapper?.style.removeProperty("height"),await this.modal.open();const t=this.productId?()=>salla.product.getGiftProductDetails(this.productId):()=>salla.cart.getGiftCartDetails();return await salla.api.withoutNotifier(t).then((t=>{this.gift=t.data,this.senderName=this.gift.sender_name,this.disableClass=this.gift?.show_image_upload?"":"pointer-events-none",this.gift.show_texts||(this.selectedGiftTextOption=void 0,this.selectedText=void 0),this.gift.show_images||(this.selectedImage=void 0,this.uploadedImage=void 0),this.skipStep1()&&(this.currentStep=2,this.parentClass="is-current-step-2",this.step2Animated=!0)})).catch((t=>{this.hasError=!0,this.errorMessage=t.response?.data?.error?.message||t.response?.data})).finally((()=>this.modal.stopLoading()))}skipStep1(){return!!this.gift&&!this.gift.show_images&&!this.gift.show_texts}resetStepsAnimation(){[this.step1Elems,this.step2Elems].forEach((t=>{t?.querySelectorAll(".anime-item").forEach((t=>t.removeAttribute("style")))})),this.step1Elems?.removeAttribute("style"),this.step2Elems&&!this.skipStep1()&&(this.step2Elems.style.removeProperty("opacity"),this.step2Elems.style.removeProperty("transform"))}async close(){return this.modal.close()}async setWrapperHeight(t=1,i=250,e=0,s=0){let r=document.querySelector(`#${this.hostId} .gift-step-${t}`);const a=()=>{this.stepsWrapper.style.height=s?`${s}px`:r.offsetHeight+e+"px"};this.step2Animated&&2===t?requestAnimationFrame(a):setTimeout(a,i)}toggleCalendar(){this.showCalendar=!this.showCalendar,this.setWrapperHeight(2,150,0)}toggleGiftText(t){this.textSelect?.classList.remove("s-form-has-error");let i=t.target.children[t.target.selectedIndex].getAttribute("data-id"),e="custom"==i;const s=this.showGiftText!==e;this.showGiftText=e,i?(this.selectedGiftTextOption=i,this.selectedText=e?void 0:t.target.value):(this.textArea.value="",this.selectedText=void 0,this.selectedGiftTextOption=void 0),s&&this.setWrapperHeight(1,150,5)}async goToStep2(t=!0){this.step1Elems&&(t&&!this.validateStep1()||(this.stepsWrapper&&this.step1Elems&&(this.stepsWrapper.style.height=`${this.step1Elems.offsetHeight}px`),this.setWrapperHeight(2,50,0),(new e.timeline).add({targets:this.step1Elems.querySelectorAll(`#${this.hostId} .anime-item`),opacity:[1,0],translateX:[0,50],delay:e.stagger(70),duration:1200}).add({targets:".gift-step-2",translateX:["-110%",0],opacity:[0,1]},"-=1800").add({targets:this.step2Elems.querySelectorAll(`#${this.hostId} .anime-item`),opacity:[0,1],translateX:[-50,0],delay:e.stagger(70),duration:1200,complete:()=>{this.step2Elems.querySelectorAll(`#${this.hostId} .anime-item`).forEach((t=>{t.classList.remove("opacity-0"),t.removeAttribute("style")})),this.step2Animated=!0}},"-=1200"),this.currentStep=2,this.parentClass=`is-current-step-${this.currentStep}`))}validateStep1(){return!(this.gift?.show_texts&&(this.selectedGiftTextOption?"custom"!=this.selectedGiftTextOption||this.selectedText?(this.textSelect?.classList.remove("s-form-has-error"),this.customTextArea?.classList.remove("s-form-has-error"),0):(this.textSelect?.classList.remove("s-form-has-error"),this.customTextArea?.classList.add("s-form-has-error"),1):(this.textSelect?.classList.add("s-form-has-error"),this.customTextArea?.classList.remove("s-form-has-error"),1)))}goToStep1(t){t.preventDefault();let i=new e.timeline({autoplay:!1});i.add({targets:this.step2Elems.querySelectorAll(`#${this.hostId} .anime-item`),opacity:[1,0],translateX:[0,-50],delay:e.stagger(70),duration:1200}).add({targets:".gift-step-1",translateX:["110%",0],opacity:[0,1]},"-=1800").add({targets:this.step1Elems.querySelectorAll(`#${this.hostId} .anime-item`),opacity:[0,1],translateX:[50,0],delay:e.stagger(70),duration:1200,complete:()=>{this.step1Elems.querySelectorAll(`#${this.hostId} .anime-item`).forEach((t=>{t.classList.remove("opacity-0"),t.removeAttribute("style")}))}},"-=1200"),i.play(),this.step2Animated=!1,this.setWrapperHeight(1,600,0),this.currentStep=1,this.parentClass=`is-current-step-${this.currentStep}`}getFilepondPlaceholder(){return`<div class="s-gifting-filepond-placeholder"><span class="s-gifting-filepond-placeholder-icon"><svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>images</title>\n<path d="M22.667 29.333h-13.333c-3.676 0-6.667-2.991-6.667-6.667v-13.333c0-0.737-0.597-1.333-1.333-1.333s-1.333 0.596-1.333 1.333v13.333c0 5.145 4.187 9.333 9.333 9.333h13.333c0.736 0 1.333-0.596 1.333-1.333s-0.597-1.333-1.333-1.333zM22.667 5.333c-2.205 0-4 1.795-4 4s1.795 4 4 4 4-1.795 4-4-1.795-4-4-4zM22.667 10.667c-0.735 0-1.333-0.597-1.333-1.333s0.599-1.333 1.333-1.333 1.333 0.597 1.333 1.333-0.599 1.333-1.333 1.333zM25.333 0h-13.333c-3.676 0-6.667 2.991-6.667 6.667v13.333c0 1.055 0.268 2.040 0.707 2.927 0.039 0.099 0.088 0.188 0.151 0.277 1.137 2.053 3.301 3.463 5.809 3.463h13.333c3.676 0 6.667-2.991 6.667-6.667v-13.333c0-3.676-2.991-6.667-6.667-6.667zM12 24c-1.244 0-2.344-0.583-3.077-1.476l5.721-7.047 6.629 8.523zM29.333 20c0 2.205-1.795 4-4 4h-0.68l-8.933-11.485c-0.251-0.32-0.633-0.511-1.039-0.515h-0.015c-0.401 0-0.781 0.181-1.035 0.492l-5.632 6.935v-12.76c0-2.205 1.795-4 4-4h13.333c2.205 0 4 1.795 4 4z"></path>\n</svg>\n</span><p class="s-gifting-filepond-placeholder-text">${this.selectImageOrUpload&&this.gift.show_image_upload?this.selectImageOrUpload:this.selectImageForYourGift}</p></div>`}setPreview(t){this.uploader?.classList.add("has-bg");var i=document.querySelector(`#${this.hostId}.filepond-bg`)?document.querySelector(`#${this.hostId} .filepond-bg`):document.createElement("div");i.classList.add("filepond-bg"),i.classList.remove("s-hidden"),i.style.backgroundImage="url('"+t.url+"')",this.uploader?.querySelector(".filepond--root")?.appendChild(i),this.uploadedImage=t.url,this.gift&&this.gift.gift_images?.length&&this.setWrapperHeight(1,150,0)}removePreview(){this.uploader.classList.remove("has-bg");let t=document.querySelector(`#${this.hostId} .filepond-bg`);t.removeAttribute("style"),t.classList.add("s-hidden"),this.handleRemoveImage()}handleTextAreaChange(t){this.selectedText=t.target.value,this.customTextArea?.classList.remove("s-form-has-error")}clearError(t){if(this.errors?.[t]){const{[t]:i,...e}=this.errors;this.errors=e}}handleSenderName(t){this.senderName=t.target.value,this.clearError("sender_name")}handleReceiverName(t){this.receiverName=t.target.value,this.clearError("receiver.name")}resetCityState(){this.citySearchTimer&&(clearTimeout(this.citySearchTimer),this.citySearchTimer=null),++this.citySearchCounter,this.gift={...this.gift,cities:[]},this.displayedCities=[],this.receiverCity=void 0,this.selectedCity=null,this.citySearchQuery="",this.searchingCities=!1,this.enableCityAjaxSearch=!1}setInitialCities(t){this.gift={...this.gift,cities:t},this.displayedCities=t,this.enableCityAjaxSearch=t.length>=o.CITY_AJAX_THRESHOLD}async fetchCities(t=""){if(!this.selectedCountryId)return[];if(this.isKSA&&!this.selectedRegionId)return[];const i=["for_branch=0",`country_id=${this.selectedCountryId}`];this.isKSA&&this.selectedRegionId&&i.push(`region_id=${this.selectedRegionId}`),t?.trim()&&i.push(`query=${encodeURIComponent(t.trim())}`);const e=await salla.api.request(`shipping/cities?${i.join("&")}`);return e?.data??[]}async handleCountrySelected(t){const i=t?.id;this.selectedCountry=t??null,this.selectedCountryId=i,this.selectedCountryCode=t?.country_code,this.isKSA="SA"===t?.country_code,this.clearError("receiver.country"),this.regions=[],this.selectedRegionId=void 0,this.selectedRegion=null,this.resetCityState();const e=++this.locationRequestCounter;if(!i)return this.selectedCountryCode=void 0,this.isKSA=!1,void this.setWrapperHeight(2,0,0);if(this.isKSA){this.loadingRegions=!0,this.setWrapperHeight(2,0,0);try{const t=await salla.api.request(`shipping/countries/${i}/regions`);if(e!==this.locationRequestCounter)return;t&&t.data&&(this.regions=t.data)}catch(t){if(e!==this.locationRequestCounter)return;console.error("Error fetching regions:",t)}finally{e===this.locationRequestCounter&&(this.loadingRegions=!1,this.setWrapperHeight(2,0,0))}}else{this.loadingCities=!0,this.setWrapperHeight(2,0,0);try{const t=await this.fetchCities();if(e!==this.locationRequestCounter)return;this.setInitialCities(t)}catch(t){if(e!==this.locationRequestCounter)return;console.error("Error fetching cities:",t)}finally{e===this.locationRequestCounter&&(this.loadingCities=!1)}}}async handleRegionSelected(t){const i=t?.id;this.selectedRegion=t??null,this.selectedRegionId=i,this.clearError("receiver.region"),this.resetCityState();const e=++this.locationRequestCounter;if(i){this.loadingCities=!0;try{const t=await this.fetchCities();if(e!==this.locationRequestCounter)return;this.setInitialCities(t)}catch(t){if(e!==this.locationRequestCounter)return;console.error("Error fetching cities:",t)}finally{e===this.locationRequestCounter&&(this.loadingCities=!1,this.setWrapperHeight(2,0,0))}}}handleUploadImage(t){this.uploadedImage="object"!=typeof t?t:t&&t.url,this.gift&&this.gift.gift_images?.length&&this.setWrapperHeight(1,150,0)}handleRemoveImage(){this.uploadedImage="",this.gift&&this.gift.gift_images?.length&&this.setWrapperHeight(1,150,0)}handlePhoneInputChange(t){let i=t.detail;this.receiverMobile=i.number,this.receiverCountryCode=i.country_code,this.clearError("receiver.mobile")}handleDateTimePicker(t){this.deliveryDate=t.detail}getCalendarClasses(){return{"s-form-group":!0,"anime-item":!0,"s-gifting-calendar":!0,shown:this.showCalendar,hide:!this.showCalendar,"s-form-has-error":!!this.errors&&this.errors.deliver_at}}async submitForm(){const t=document.querySelector("#donating-amount")?.value;if(this.calendarFormGroup.classList.remove("s-form-has-error"),this.errors&&(this.errors={},this.setWrapperHeight(2,150,0)),this.showCalendar&&!this.deliveryDate)return void this.calendarFormGroup.classList.add("s-form-has-error");const i=[{key:"sender_name",value:this.senderName,label:this.senderNameLabel},{key:"receiver.name",value:this.receiverName,label:this.receiverNameFieldLabel},{key:"receiver.mobile",value:this.receiverMobile,label:this.receiverMobileFieldLabel},...this.isPhysical()?[{key:"receiver.country",value:this.selectedCountryId,label:this.receiverCountryFieldLabel},...this.isKSA?[{key:"receiver.region",value:this.selectedRegionId,label:this.receiverRegionFieldLabel}]:[],{key:"receiver.city_id",value:this.receiverCity,label:this.receiverCityFieldLabel}]:[]],e={};if(i.forEach((({key:t,value:i,label:s})=>{i||(e[t]=salla.lang.get("common.errors.field_required",{attribute:s}))})),Object.keys(e).length)return this.errors=e,void this.setWrapperHeight(2,150,0);const s="custom"===this.selectedGiftTextOption,r={text:s?this.selectedText:void 0,text_id:!s&&this.selectedGiftTextOption?Number(this.selectedGiftTextOption):void 0,sender_name:this.senderName,quantity:this.quantity,deliver_at:this.showCalendar?this.deliveryDate:null,image_url:this.uploadedImage??this.selectedImage,donation_amount:t||null,receiver:{name:this.receiverName,mobile_country_code:this.receiverCountryCode,mobile:this.receiverMobile,...this.isPhysical()&&this.selectedCountryCode?{country_code:this.selectedCountryCode}:{},...this.isPhysical()&&this.selectedRegionId?{region_id:this.selectedRegionId}:{},...this.receiverCity&&this.isPhysical()?{city_id:this.receiverCity}:{}},has_apple_pay:salla.helpers.hasApplePay()};let a;this.productId&&this.formSelector&&(a=this.getFormDataFromForm()||new FormData,a=this.mergeObjectToFormData(r,a));const o=this.productId?()=>salla.product.addProductGiftToCart(this.productId,a,!0):()=>salla.cart.addCartGiftToCart(r,!0);return await o().then((()=>this.modal.close())).catch((t=>{t.response&&422==t.response.status?this.errors=t.response.data.error.fields:console.log(t),this.setWrapperHeight(2,150,0)}))}step2ItemClass(t=""){const i="anime-item"+(this.step2Animated?"":" opacity-0");return t?`${t} ${i}`:i}generateClass(){return{"s-gifting-widget":!0,"s-gifting-widget-vertical":!!this.vertical,"s-gifting-widget-horizontal":!this.vertical}}async handleGiftButtonClick(){if(this.productId&&this.formSelector){const t=document.querySelector(this.formSelector);if(!t)return void console.error("SallaGifting:: Form not found in the document!");if(!(t instanceof HTMLFormElement))return void console.error("SallaGifting:: The specified selector does not correspond to a form tag!");if(!t.reportValidity())return console.error("SallaGifting:: Form is not valid!"),void salla.error(salla.lang.get("common.messages.required_fields"))}const t=document.querySelector(`salla-product-options[product-id="${this.productId}"]`);!t||await t.reportValidity()?this.open():salla.error(salla.lang.get("common.messages.required_fields"))}render(){return[i("div",{key:"3795180f3f719218220086c66f6bfbe6e57dc1d4"},i("salla-list-tile",{key:"cb9fd3e10b02bb429b25c028fcd2d328e73eab6e",class:this.generateClass()},i("div",{key:"cca448eae1144b0606bf8f07844974cd7f966236",slot:"title"},this.vertical?i("span",{innerHTML:a}):"",i("h3",{key:"c33210bdf1a72cdf0151138ce2949fc462efaf94"},this.widgetTitle?this.widgetTitle:this.sectionTitle)),i("div",{key:"007fc138265e6ab82dbdfab8169baa407b111e60",slot:"subtitle"},i("div",{key:"89de9cc780511609d294f67a3d639a0305300b17"},this.widgetSubtitle?this.widgetSubtitle:this.sectionSubtitle)),i("div",{key:"ea647e47079ab8e57580675f485bc99c2b213cd4",slot:"action"},i("salla-button",{key:"e87bcc03e5ab02204ca9f1d590421cae13282269",color:"primary",fill:"outline",width:"wide",class:"s-gifting-widget-action",onClick:()=>this.handleGiftButtonClick()},i("slot",{key:"ce294391f8c18e345ec2117a15e2942dd00790fc",name:"widget-btn-content"},i("div",{key:"7106257d9f44b869fcd3933ae8a1d2a50f4486dd",class:"s-gifting-widget-action-content"},i("span",{key:"305822ae865b6da9275ced4600933d83d42e54e7",innerHTML:a})," ",i("span",{key:"13f2d03213e1fea9fe9911a94259b89085406ab3"},this.sectionBtnText)))))),i("salla-modal",{key:"b55185fbd34776043661ca6f15a739e34e98e0ef",id:this.hostId,isLoading:!0,class:"s-gifting-modal",width:"sm",ref:t=>this.modal=t},i("div",{key:"9f59cea6e2835d80e24bc269b78a5bc47b354f6a",slot:"loading"},i("div",{key:"3f74f3384be120a0733e921de696d2beeccd49ce",class:"s-gifting-skeleton"},i("div",{key:"e3ffb5b8d712bc391ad6b4190556ac870e37db0c",class:"s-gifting-modal-header"},i("salla-skeleton",{key:"b9b154ab445516fa1fae66cc458dd68114024d9d",type:"circle",height:"5rem",width:"5rem"}),i("h2",{key:"1ecf5c6ea1ebeccbd6ed7f259045647148863826",class:"s-gifting-modal-title"},i("div",{key:"165d927a3bcaf47dd5c7657db8543ad02b47dc44",class:"s-gifting-modal-badge-wrapper"},i("salla-skeleton",{key:"cba1667fa446566c5bc862c206313d8f48a0991e",height:"15px",width:"150px"})))),i("div",{key:"f56f8e8820f789ca117a0e19cf660bc4d836ec6a",class:"s-gifting-skeleton-content"},i("salla-skeleton",{key:"74b8cec4be6e18ec8a1b340d8fed0b2d136bb1d3",height:"10px",width:"150px"}),i("salla-skeleton",{key:"5c615a0c0eb72908e601c2cfd28fe12a6391ef80",height:"230px"}),i("salla-skeleton",{key:"5c432b6e3f8c70574e1d05d26f57443ff5da45fe",height:"10px",width:"150px"}),i("salla-skeleton",{key:"7f5d7ec5cf3ef50f945e2a57363ac215e41f306b",height:"30px"}),i("salla-skeleton",{key:"47c0e823643dc9c2d4908dde353adf5b0e4355ad",height:"40px"})))),i("slot",{key:"3ad3a57a07cb8182e5cd86783ba19c8ae8f34d3b",name:"header"}),this.hasError?i("salla-placeholder",{alignment:"center"},i("span",{slot:"title"},this.errorMessage||salla.lang.get("common.errors.empty_results")),i("span",{slot:"description"}," ")):[i("div",{class:"s-gifting-modal-header"},i("span",{class:"s-gifting-modal-icon"},i("span",{innerHTML:a})),i("h2",{class:"s-gifting-modal-title"},i("div",{class:"s-gifting-modal-badge-wrapper"},!this.skipStep1()&&i("div",{class:"s-gifting-modal-badge"},i("span",null,i("span",null,this.currentStep),"/2")),i("span",null,this.giftDetails)))),i("div",{class:"s-gifting-steps-wrapper "+this.parentClass,ref:t=>this.stepsWrapper=t},!this.skipStep1()&&i("div",{class:"s-gifting-step-one gift-step-1",ref:t=>this.step1Elems=t},this.gift&&this.gift.show_images&&i("div",{class:"s-gifting-modal-uploader-title anime-item"},this.selectImageForYourGift),this.gift&&this.gift.show_images&&i("div",{class:"s-gifting-image-section"},i("div",{class:`s-gifting-modal-uploader anime-item ${this.disableClass}`,ref:t=>this.uploader=t},i("span",{class:"s-gifting-remove-preview pointer-events-auto",onClick:()=>this.removePreview(),innerHTML:r}),this.selectImageOrUpload&&this.gift&&i("salla-file-upload",{"instant-upload":!0,name:"image_url",url:salla.url.api(salla.product.api.getUrl("giftImage")),onUploaded:t=>this.handleUploadImage(t.detail),labelIdle:this.getFilepondPlaceholder(),onRemoved:()=>this.handleRemoveImage()})),i("div",{class:"anime-item"},!this.uploadedImage&&this.gift&&this.gift.gift_images&&this.gift.gift_images.length>0?i("salla-slider",{id:"gifting-slider",loop:!1,"controls-outer":!0,class:"s-gifting-slider",type:"carousel"},i("div",{slot:"items"},this.gift&&this.gift.gift_images?this.gift?.gift_images.map((t=>i("a",{class:"s-gifting-clickable s-gifting-image",onClick:()=>this.setPreview(t)},i("img",{src:t.url,alt:`${t.id}`})))):"")):"")),this.gift&&this.gift.show_texts?i("div",{class:"anime-item"},i("div",{class:"s-gifting-modal-uploader-title s-gifting-text-title"},this.giftText),i("div",{class:"s-form-group s-gifting-selectText",ref:t=>this.textSelect=t},i("select",{id:"gift-text-selection",name:"gift-text-selection",class:"s-form-control s-gifting-select",onChange:t=>this.toggleGiftText(t)},i("option",{"data-id":null,selected:!this.selectedGiftTextOption},this.selectGiftMessage),this.gift&&this.gift.gift_texts?this.gift?.gift_texts.map((t=>i("option",{"data-id":t.id,value:t.text,key:t.id,selected:String(this.selectedGiftTextOption)===String(t.id)},t.text))):"",this.gift&&this.gift.show_custom_text?i("option",{"data-id":"custom",selected:"custom"===this.selectedGiftTextOption},this.giftCustomText):null)),i("div",{class:this.showGiftText&&this.gift&&this.gift.show_custom_text?"s-form-group s-gifting-textarea shown":"s-form-group s-gifting-textarea hide",ref:t=>this.customTextArea=t},i("label",{htmlFor:"gift-custom-text",class:"s-form-label"},this.giftCustomText),i("div",{class:"mt-1"},i("textarea",{onInput:t=>this.handleTextAreaChange(t),rows:4,ref:t=>this.textArea=t,name:"gift-custom-text",id:"gift-custom-text",class:"s-form-control"})))):null,i("div",{class:"anime-item"},i("salla-button",{color:"primary",width:"wide",onClick:()=>this.goToStep2(!!this.gift?.show_texts)},i("span",null,this.nextStep)))),i("div",{class:"s-gifting-step-two gift-step-2",style:this.skipStep1()?{opacity:"1",transform:"translateX(0)",position:"relative"}:void 0,ref:t=>this.step2Elems=t},i("div",{class:this.step2ItemClass(this.errors?.sender_name?"s-form-group s-form-has-error":"s-form-group")},i("label",{htmlFor:"sender_name",class:"s-form-label"},this.senderNameLabel),i("input",{type:"text",class:"s-form-control",name:"sender_name",id:"sender_name",value:this.senderName,onInput:t=>this.handleSenderName(t),placeholder:""}),this.errors&&this.errors.sender_name?i("span",{class:"s-gifting-error"},this.errors.sender_name):""),i("div",{class:this.step2ItemClass(this.errors?.["receiver.name"]?"s-form-group s-form-has-error":"s-form-group")},i("label",{htmlFor:"receiver_name",class:"s-form-label"},this.receiverNameFieldLabel),i("input",{type:"text",class:"s-form-control",name:"receiver_name",id:"receiver_name",value:"",onInput:t=>this.handleReceiverName(t),placeholder:""}),this.errors&&this.errors["receiver.name"]?i("span",{class:"s-gifting-error"},this.errors["receiver.name"]):""),i("div",{class:this.step2ItemClass(this.errors?.["receiver.mobile"]?"s-form-group s-form-has-error":"s-form-group")},i("label",{class:"s-form-label"},this.receiverMobileFieldLabel),i("salla-tel-input",{class:"s-gifting-tel-input",phone:this.receiverMobile,countryCode:this.receiverCountryCode,onPhoneEntered:t=>this.handlePhoneInputChange(t)}),this.errors&&this.errors["receiver.mobile"]?i("span",{class:"s-gifting-error"},this.errors["receiver.mobile"]):""),this.isPhysical()&&i("div",{class:this.step2ItemClass(this.errors?.["receiver.country"]?"s-form-group s-form-has-error":"s-form-group")},i("label",{class:"s-form-label",htmlFor:`${this.hostId}-country`},this.receiverCountryFieldLabel),i("salla-searchable-dropdown",{placeholder:this.selectCountry,items:this.gift?.countries??[],selectedItem:this.selectedCountry,disabled:!this.gift?.countries?.length,required:!0,inputId:`${this.hostId}-country`,searchable:!1,keepParentScroll:!0,onItemSelected:t=>this.handleCountrySelected(t.detail),onDropdownClosed:()=>this.handleCountryDropdownClosed()}),this.errors&&this.errors["receiver.country"]?i("span",{class:"s-gifting-error"},this.errors["receiver.country"]):""),this.isPhysical()&&this.isKSA&&i("div",{class:this.step2ItemClass(this.errors?.["receiver.region"]?"s-form-group s-form-has-error":"s-form-group")},i("label",{class:"s-form-label",htmlFor:`${this.hostId}-region`},this.receiverRegionFieldLabel),i("salla-searchable-dropdown",{placeholder:this.selectRegion,items:this.regions??[],selectedItem:this.selectedRegion,loading:this.loadingRegions,disabled:this.loadingRegions||!this.regions?.length,required:!0,inputId:`${this.hostId}-region`,searchable:!1,keepParentScroll:!0,onItemSelected:t=>this.handleRegionSelected(t.detail),onDropdownClosed:()=>this.handleRegionDropdownClosed()}),this.errors&&this.errors["receiver.region"]?i("span",{class:"s-gifting-error"},this.errors["receiver.region"]):""),this.isPhysical()&&i("div",{class:this.step2ItemClass(this.errors?.["receiver.city_id"]?"s-form-group s-form-has-error":"s-form-group")},i("label",{class:"s-form-label",htmlFor:`${this.hostId}-city`},this.receiverCityFieldLabel),i("salla-searchable-dropdown",{placeholder:this.selectCity,items:this.displayedCities,selectedItem:this.selectedCity,loading:this.loadingCities,searching:this.searchingCities,disabled:this.loadingCities||this.isKSA&&!this.selectedRegionId,required:!0,inputId:`${this.hostId}-city`,searchQuery:this.citySearchQuery,clientSearch:!this.enableCityAjaxSearch,dropUp:!0,keepParentScroll:!0,onItemSelected:t=>this.handleCitySelected(t.detail),onSearchInput:t=>this.handleCitySearch(t.detail),onDropdownClosed:()=>this.handleCityDropdownClosed()}),this.errors&&this.errors["receiver.city_id"]?i("span",{class:"s-gifting-error"},this.errors["receiver.city_id"]):""),this.isPhysical()&&this.cityNoticeText()&&i("div",{class:this.step2ItemClass("s-gifting-info")},i("span",{innerHTML:'\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>alert</title>\n<path d="M16 13.333c-0.736 0-1.333 0.597-1.333 1.333v8c0 0.736 0.597 1.333 1.333 1.333s1.333-0.597 1.333-1.333v-8c0-0.736-0.597-1.333-1.333-1.333zM16 9.327c-0.736 0-1.333 0.604-1.333 1.34s0.597 1.333 1.333 1.333 1.333-0.597 1.333-1.333v-0.013c0-0.736-0.597-1.327-1.333-1.327zM27.313 4.687c-6.237-6.237-16.389-6.239-22.628 0-6.237 6.239-6.237 16.389 0 22.628 3.119 3.119 7.216 4.679 11.313 4.679s8.195-1.559 11.313-4.679c6.24-6.239 6.24-16.391 0.001-22.628zM25.428 25.428c-5.199 5.197-13.657 5.197-18.857 0-5.197-5.199-5.197-13.659 0-18.857 5.199-5.197 13.659-5.197 18.857 0 5.199 5.2 5.199 13.659 0 18.857z"></path>\n</svg>\n'}),i("span",null,this.cityNoticeText())),!this.isPhysical()&&i("div",{class:this.step2ItemClass()},i("label",{class:"s-gifting-schedule s-gifting-clickable",htmlFor:`schedule-${this.hostId}`},i("input",{type:"checkbox",name:"schedule",id:`schedule-${this.hostId}`,onChange:()=>this.toggleCalendar(),class:"s-checkbox"}),i("span",{class:"s-form-label"}," ",this.sendLater," "))),i("div",{class:this.getCalendarClasses(),ref:t=>this.calendarFormGroup=t},i("label",{class:"s-form-label"},this.selectSendDateAndTime),i("salla-datetime-picker",{value:this.deliveryDate,placeholder:this.selectSendDateAndTime,"enable-time":!0,"date-format":"Y-m-d h:i K",onPicked:t=>this.handleDateTimePicker(t)}),i("span",{class:"s-gifting-calendar-hint"},this.canNotEditOrderAfterSelectDate)),i("div",{class:this.step2ItemClass("s-gifting-step-two-footer")},!this.skipStep1()&&i("a",{href:"#!",innerHTML:s,onClick:t=>this.goToStep1(t)}),i("salla-button",{onClick:()=>this.submitForm(),color:"primary",width:"wide"},i("span",null,this.sendGift)))))],i("slot",{key:"4b5e340be26e46c09508d192207fa6af9ec0cc44",name:"footer"})))]}};o.CITY_AJAX_THRESHOLD=400,o.CITY_SEARCH_DEBOUNCE_MS=100,o.style='/*!twlt*/.s-gifting-steps-wrapper{transition:height 0.8s cubic-bezier(0.55, 0, 0.1, 1) 0s}.s-gifting-select{background-image:url("data:image/svg+xml;utf8,<svg version=\'1.1\' fill=\'gray\' xmlns=\'http://www.w3.org/2000/svg\' width=\'32\' height=\'32\' viewBox=\'0 0 32 32\'><title>keyboard_arrow_down</title><path d=\'M9.875 11.104l6.125 6.125 6.125-6.125 1.875 1.875-8 8-8-8z\'></path></svg>");background-size:24px;background-repeat:no-repeat;background-position:99%;appearance:none}[dir=rtl] .s-gifting-select{background-position:5px}.s-gifting-widget-vertical .s-list-tile-item [slot=title]{display:flex;align-items:center;gap:1.5rem}.s-gifting-widget-vertical .s-list-tile-item-content{width:100%}.s-gifting-modal .s-searchable-dropdown-trigger{border-color:#d1d5db}.s-gifting-modal .s-searchable-dropdown-trigger:hover:not(.s-searchable-dropdown-trigger--disabled){border-color:#d1d5db}.s-gifting-modal .s-searchable-dropdown-trigger--open,.s-gifting-modal .s-searchable-dropdown-trigger:focus{border-color:var(--color-primary, #00897b);box-shadow:0 0 0 1px var(--color-primary, #00897b)}.s-gifting-modal .s-searchable-dropdown-trigger-placeholder{color:#000}.s-gifting-modal .s-gifting-image-section{margin-bottom:1.5rem}.s-gifting-modal .s-gifting-slider{margin-bottom:0.5rem}.s-gifting-modal .s-gifting-image{display:block}.s-gifting-modal .s-gifting-image img{display:block;width:auto;height:100px;object-fit:contain}.s-gifting-modal .s-gifting-image-section+.anime-item .s-gifting-text-title{margin-top:1rem}.pointer-events-none{pointer-events:none}.pointer-events-auto{pointer-events:auto}.static{position:static}.fixed{position:fixed}.relative{position:relative}.mt-1{margin-top:0.25rem}.inline{display:inline}.hidden{display:none}.grow{flex-grow:1}.transform{transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.resize{resize:both}.opacity-0{opacity:0}.outline{outline-style:solid}.transition{transition-property:color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms}.s-hidden{display:none}.has-error .s-form-label{color:#ff443a}.has-error .s-form-control,.has-error .s-tel-input-control,.has-error .s-datetime-picker-input{border-color:#ff443a;color:#ff443a}.s-hidden{display:none}.s-form-control{display:block;width:100%;border-radius:var(--s-radius, 0.25rem);border-width:1px;--tw-border-opacity:1;border-color:rgb(209 213 219 / var(--tw-border-opacity, 1));--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1));padding:0.5rem;font-size:0.875rem;line-height:1.25rem;--tw-text-opacity:1;color:rgb(17 24 39 / var(--tw-text-opacity, 1))}.s-form-control:focus{border-color:var(--color-primary);--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000)}.s-form-label{margin-bottom:0.25rem;display:block;font-size:0.875rem;line-height:1.25rem;font-weight:500;--tw-text-opacity:1;color:rgb(17 24 39 / var(--tw-text-opacity, 1))}.s-form-group{margin-top:0.75rem;margin-bottom:0.75rem}.s-checkbox{cursor:pointer;--tw-border-opacity:1;border-color:rgb(209 213 219 / var(--tw-border-opacity, 1));appearance:none;background-color:#fff;margin:0;width:18px;height:18px;border-width:1px;border-radius:4px;display:grid;place-content:center}.s-checkbox:before{width:10px;height:10px;clip-path:polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);transform:scale(0);transform-origin:bottom left;transition:120ms transform ease-in-out;box-shadow:inset 1em 1em #444;background-color:#444}.s-checkbox:checked:before{transform:scale(1)}.s-checkbox::before{--tw-content:\'\';content:var(--tw-content)}.s-form-has-error .s-form-label{color:#ff443a}.s-form-has-error .s-form-control,.s-form-has-error .s-tel-input-control,.s-form-has-error .s-datetime-picker-input{border-color:#ff443a;color:#ff443a}.s-gifting-widget .s-list-tile-item-icon{display:none}.s-gifting-widget-vertical .s-list-tile-item-icon{display:block}.s-gifting-widget-vertical .s-list-tile-item-title svg{fill:var(--color-primary)}.s-gifting-widget-vertical .s-list-tile-item-subtitle{padding-right:3.5rem;font-size:0.75rem;line-height:1rem;--tw-text-opacity:1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.s-gifting-widget-vertical .s-list-tile-item{flex-wrap:wrap;padding:0px}@media (min-width: 1024px){.s-gifting-widget-vertical .s-list-tile-item-action{flex:1 1 0%}}.s-gifting-widget-vertical .widget-icon{--tw-translate-y:0.625rem;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));font-size:1.875rem;line-height:2.25rem;color:var(--color-primary)}.s-gifting-widget .s-button-text{display:flex}.s-gifting-widget .s-list-tile-item{flex-direction:column;justify-content:space-between;gap:1rem;border-radius:0.75rem;border-width:1px;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1));padding:1.25rem;text-align:center}@media (min-width: 768px){.s-gifting-widget .s-list-tile-item{text-align:left}}@media (min-width: 1024px){.s-gifting-widget .s-list-tile-item{flex-direction:row}}@media (min-width: 768px){.s-gifting-widget .s-list-tile-item:where([dir="rtl"],[dir="rtl"] *){text-align:right}}.s-gifting-widget-horizontal .s-gifting-widget-action button{padding-left:2rem;padding-right:2rem;font-weight:400}.s-gifting-info{display:flex;align-items:center;gap:0.5rem;border-radius:0.5rem;--tw-border-opacity:1;border-color:rgb(191 219 254 / var(--tw-border-opacity, 1));--tw-bg-opacity:1;background-color:rgb(219 234 254 / var(--tw-bg-opacity, 1));padding:1rem;font-size:0.875rem;line-height:1.25rem;--tw-text-opacity:1;color:rgb(29 78 216 / var(--tw-text-opacity, 1))}.s-gifting-info svg{height:1.25rem;width:1.25rem;fill:#1d4ed8}.s-gifting-error{font-size:0.75rem;line-height:1rem;--tw-text-opacity:1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.s-gifting-info span{font-size:0.75rem;line-height:1rem}.s-gifting-widget-action-content{display:flex;align-items:center}.s-gifting-widget-action-content svg{margin-left:0.5rem;margin-right:0.5rem}.s-gifting-modal-header{margin-bottom:1.25rem;display:flex;flex-direction:column;align-items:center;justify-content:center}.s-gifting-modal .s-modal-header{display:block}.s-gifting-modal .s-modal-body{position:relative !important;left:unset !important;bottom:unset !important;padding-bottom:2rem}@media (min-width: 640px){.s-gifting-modal .s-modal-body{padding-bottom:1.5rem}}.s-gifting-modal-icon{margin-bottom:1.25rem;display:flex;height:5rem;width:5rem;flex-direction:row;align-items:center;justify-content:center;border-radius:9999px;border-width:1px;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1));font-size:1.875rem;line-height:2.25rem}.s-gifting-modal-title{display:flex;width:100%;align-items:center;justify-content:space-between}.s-gifting-modal-title::before{display:block;height:1px;flex:1 1 auto;--tw-bg-opacity:1;background-color:rgb(229 231 235 / var(--tw-bg-opacity, 1));--tw-content:\'\';content:var(--tw-content)}.s-gifting-modal-title::after{display:block;height:1px;flex:1 1 auto;--tw-bg-opacity:1;background-color:rgb(229 231 235 / var(--tw-bg-opacity, 1));--tw-content:\'\';content:var(--tw-content)}.s-gifting-modal-badge-wrapper{display:flex;align-items:center;padding-left:0.75rem;padding-right:0.75rem}.s-gifting-modal-badge{margin-right:0.5rem;border-radius:0.5rem;--tw-bg-opacity:1;background-color:rgb(229 231 235 / var(--tw-bg-opacity, 1));padding-left:0.5rem;padding-right:0.5rem;padding-top:0.25rem;padding-bottom:0.25rem;font-size:0.875rem;line-height:1.25rem}.s-gifting-modal-badge:where([dir="rtl"],[dir="rtl"] *){margin-right:0px;margin-left:0.5rem}.s-gifting-modal-uploader.has-bg{position:relative}.s-gifting-modal-uploader.has-bg .s-gifting-remove-preview{pointer-events:auto;--tw-scale-x:1;--tw-scale-y:1;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));opacity:1}.s-gifting-modal-uploader-title{margin-bottom:0.5rem;font-size:0.875rem;line-height:1.25rem}.s-gifting-steps-wrapper{position:relative}.s-gifting-steps-wrapper .s-button-wrap{pointer-events:auto !important}.is-current-step-2 .gift-step-1,.is-current-step-1 .gift-step-2{pointer-events:none;z-index:-1}.s-gifting-step-one{padding-top:1.25rem}.s-gifting-step-two{position:absolute;top:0px;left:0px;margin-left:auto;margin-right:auto;display:flex;width:100%;--tw-translate-x:-105%;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));flex-direction:column;opacity:0}.s-gifting-step-one .swiper-wrapper{height:100px}.s-gifting-step-one .swiper-slide{width:auto !important}.s-gifting-step-one .filepond--list-scroller{overflow-y:hidden}.s-gifting-step-one .swiper-wrapper img{border-radius:0.375rem;object-fit:cover}.s-gifting-step-one .filepond--root{height:230px}.s-gifting-step-one .filepond--list{left:0px !important;height:100% !important}.s-gifting-step-one .filepond-bg{position:absolute;top:0px;z-index:10;height:100%;width:100%;border-radius:var(--s-radius, 0.25rem);--tw-bg-opacity:1;background-color:rgb(55 65 81 / var(--tw-bg-opacity, 1));background-size:cover}.s-gifting-step-one .s-slider-button-next{top:35% !important}.s-gifting-step-one .s-slider-button-next button{height:35px;width:35px;--tw-shadow:0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}.s-gifting-step-one .s-slider-button-prev{top:35% !important}.s-gifting-step-one .s-slider-button-prev button{height:35px;width:35px;--tw-shadow:0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}.s-gifting-tel-input .s-tel-input-control{--tw-border-opacity:1;border-color:rgb(209 213 219 / var(--tw-border-opacity, 1))}.s-gifting-tel-input .s-tel-input-error-msg{display:none}.s-gifting-step-two-footer{margin-top:1.25rem;display:flex;flex-direction:row;align-items:center;justify-content:center}.s-gifting-step-two-footer>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-right:calc(0.625rem * var(--tw-space-x-reverse));margin-left:calc(0.625rem * calc(1 - var(--tw-space-x-reverse)))}.s-gifting-step-two-footer:where([dir="rtl"],[dir="rtl"] *){flex-direction:row-reverse}.s-gifting-step-two-footer a{border-radius:0.375rem;border-width:1px;border-color:var(--color-primary);fill:var(--color-primary);padding-top:8px;padding-bottom:8px;padding-left:25px;padding-right:25px}.s-gifting-step-two-footer a svg{height:1.25rem;width:1.25rem}.s-gifting-step-two .s-form-group.s-form-has-error .s-tel-input-control{--tw-border-opacity:1 !important;border-color:rgb(255 68 58 / var(--tw-border-opacity, 1)) !important}.s-gifting-selectText{margin-bottom:20px !important}.s-gifting-schedule .s-form-label{margin-bottom:0px !important}.s-gifting-schedule{margin-bottom:0.5rem;display:flex;align-items:center;justify-content:flex-start}.s-gifting-schedule>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-right:calc(0.375rem * var(--tw-space-x-reverse));margin-left:calc(0.375rem * calc(1 - var(--tw-space-x-reverse)))}.s-gifting-schedule:where([dir="rtl"],[dir="rtl"] *)>:not([hidden])~:not([hidden]){--tw-space-x-reverse:1}.s-gifting-clickable{cursor:pointer}.s-gifting-remove-preview{pointer-events:none;position:absolute;top:-7px;left:-7px;z-index:10;display:flex;height:1.25rem;width:1.25rem;--tw-scale-x:0;--tw-scale-y:0;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));cursor:pointer;align-items:center;justify-content:center;border-radius:9999px;--tw-bg-opacity:1;background-color:rgb(185 28 28 / var(--tw-bg-opacity, 1));text-align:center;font-size:1rem;line-height:1.5rem;--tw-text-opacity:1;color:rgb(255 255 255 / var(--tw-text-opacity, 1));opacity:0;transition-property:all;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:300ms}.s-gifting-remove-preview:where([dir="rtl"],[dir="rtl"] *){left:unset;right:-7px}.s-gifting-remove-preview svg{height:100%;width:15px;fill:#fff}.s-gifting-textarea{transition-property:all;transition-duration:200ms;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1)}.s-gifting-calendar-hint{font-size:0.75rem;line-height:1rem;--tw-text-opacity:1;color:rgb(220 38 38 / var(--tw-text-opacity, 1))}.s-gifting-calendar.shown{margin-top:0.75rem;height:75px;opacity:1}.s-gifting-textarea.shown{height:122px;opacity:1}.s-gifting-calendar.hide{pointer-events:none;visibility:hidden;margin:0px;height:0px;opacity:0}.s-gifting-textarea.hide{pointer-events:none;visibility:hidden;margin:0px;height:0px;opacity:0}.s-gifting-filepond-placeholder-icon svg{margin-top:12px;margin-bottom:12px;margin-left:auto;margin-right:auto;height:4rem;width:3rem;fill:#e5e7eb}.s-gifting-filepond-placeholder-text{margin-left:auto;margin-right:auto;width:65%;min-width:18rem;font-size:0.75rem !important;line-height:1rem !important;--tw-text-opacity:1;color:rgb(107 114 128 / var(--tw-text-opacity, 1));margin-top:0.75rem;margin-bottom:0.75rem;font-family:var(--font-main), -apple-system, BlinkMacSystemFont}.s-gifting-skeleton-content salla-skeleton:nth-child(1){margin-bottom:0.75rem}.s-gifting-skeleton-content salla-skeleton:nth-child(2){margin-bottom:1.25rem}.s-gifting-skeleton-content salla-skeleton:nth-child(3){margin-bottom:0.75rem}.s-gifting-skeleton-content salla-skeleton:nth-child(4){margin-bottom:1.25rem}.s-gifting-skeleton .s-gifting-modal-header salla-skeleton{margin-bottom:1.25rem}.s-gifting-skeleton .s-gifting-modal-title{margin-bottom:1.25rem}.s-gifting-image{margin-left:5px;margin-right:5px}';export{o as salla_gifting}
|
|
4
|
+
import{r as t,h as i}from"./p-B64o_70M.js";import{a as e}from"./p-CgtvEd63.js";import{a as s}from"./p-BedNk7k1.js";import{C as r}from"./p-BsLF_HK7.js";import{G as a}from"./p-DxkgAGoT.js";const o=class{constructor(i){t(this,i),this.defaultEvent="gifting:open",this.selectImageForYourGift=salla.lang.get("blocks.buy_as_gift.select_image_for_your_gift"),this.currentStep=1,this.showCalendar=!1,this.showGiftText=!1,this.currentLang="",this.parentClass="is-current-step-1",this.errors={},this.gift=void 0,this.selectedGiftTextOption=void 0,this.selectedCountryId=void 0,this.selectedCountryCode=void 0,this.loadingCities=!1,this.loadingRegions=!1,this.regions=[],this.selectedRegionId=void 0,this.isKSA=!1,this.selectedCountry=null,this.selectedRegion=null,this.displayedCities=[],this.selectedCity=null,this.searchingCities=!1,this.enableCityAjaxSearch=!1,this.citySearchQuery="",this.step2Animated=!1,this.citySearchTimer=null,this.citySearchCounter=0,this.locationRequestCounter=0,this.showTextArea=!1,this.selectedImage=void 0,this.uploadedImage=void 0,this.selectedText=void 0,this.hasError=!1,this.timeZone=null,this.receiverCountryCode=salla.config.get("store.scope.countries")?.[0]||salla.config.get("store.store_country")||"SA",this.hostId=`salla-gifting-${Math.random().toString(36).slice(2,10)}`,this.disableClass=this.gift?.show_image_upload?"":"pointer-events-none",this.formSelector="form.product-form, form.form--product-options",this.handleCitySearch=t=>{if(this.citySearchQuery=t,!this.enableCityAjaxSearch)return;this.citySearchTimer&&clearTimeout(this.citySearchTimer);const i=++this.citySearchCounter;this.citySearchTimer=setTimeout((async()=>{this.searchingCities=!0;try{const e=await this.fetchCities(t);i===this.citySearchCounter&&(this.displayedCities=e)}catch(t){i===this.citySearchCounter&&(this.displayedCities=[])}finally{i===this.citySearchCounter&&(this.searchingCities=!1)}}),o.CITY_SEARCH_DEBOUNCE_MS)},this.handleCitySelected=t=>{this.selectedCity=t,this.receiverCity=String(t.id),this.clearError("receiver.city_id")},this.handleCityDropdownClosed=()=>{this.citySearchQuery="",this.citySearchTimer&&(clearTimeout(this.citySearchTimer),this.citySearchTimer=null),++this.citySearchCounter,this.displayedCities=this.gift?.cities??[],this.searchingCities=!1},this.handleCountryDropdownClosed=()=>{},this.handleRegionDropdownClosed=()=>{},salla.lang.onLoaded((()=>{this.selectImageOrUpload=salla.lang.get("blocks.buy_as_gift.select_image_or_upload"),this.selectImageForYourGift=salla.lang.get("blocks.buy_as_gift.select_image_for_your_gift"),this.sectionTitle=salla.lang.get("blocks.buy_as_gift.gift_the_one_you_love"),this.sectionSubtitle=salla.lang.get("blocks.buy_as_gift.gift_the_one_you_love_message"),this.sectionBtnText=salla.lang.get("blocks.buy_as_gift.send_as_a_gift"),this.giftDetails=salla.lang.get("blocks.buy_as_gift.gift_details"),this.selectGiftMessage=salla.lang.get("blocks.buy_as_gift.select_gift_message"),this.giftText=salla.lang.get("blocks.buy_as_gift.gift_text"),this.giftCustomText=salla.lang.get("blocks.buy_as_gift.gift_custom_text"),this.textId=salla.lang.get("blocks.buy_as_gift.text_id"),this.incorrectGiftText=salla.lang.get("blocks.buy_as_gift.incorrect_gift_text"),this.nextStep=salla.lang.get("blocks.buy_as_gift.next_step"),this.senderNameLabel=salla.lang.get("blocks.buy_as_gift.sender_name"),this.receiverNameFieldLabel=salla.lang.get("blocks.buy_as_gift.receiver_name"),this.receiverMobileFieldLabel=salla.lang.get("blocks.buy_as_gift.receiver_mobile"),this.receiverCountryFieldLabel=salla.lang.get("blocks.buy_as_gift.receiver_country"),this.ksa=salla.lang.get("pages.checkout.ksa"),this.selectCity=salla.lang.get("pages.checkout.select_city"),this.selectCountry=salla.lang.get("pages.checkout.select_country"),this.selectCityInfo=salla.lang.get("blocks.buy_as_gift.city_info"),this.cityChangeNotice=salla.lang.get("blocks.buy_as_gift.city_change_notice"),this.receiverCityFieldLabel=salla.lang.get("blocks.buy_as_gift.receiver_city"),this.receiverRegionFieldLabel=salla.lang.get("blocks.buy_as_gift.receiver_region")||salla.lang.get("pages.checkout.region"),this.selectRegion=salla.lang.get("pages.checkout.select_region"),this.receiverEmailFieldLabel=salla.lang.get("blocks.buy_as_gift.receiver_email"),this.emailPlaceholder=salla.lang.get("common.elements.email_placeholder"),this.sendLater=salla.lang.get("blocks.buy_as_gift.send_later"),this.selectSendDateAndTime=salla.lang.get("blocks.buy_as_gift.select_send_date_and_time"),this.canNotEditOrderAfterSelectDate=salla.lang.get("blocks.buy_as_gift.can_not_edit_order_after_select_date"),this.sendGift=salla.lang.get("blocks.buy_as_gift.send_gift"),this.donationRequired=salla.lang.get("pages.products.donation_amount_required"),this.currentLang=salla.lang.locale})),salla.event.on(this.defaultEvent,(()=>{this.open()}))}isPhysical(){return this.physicalProducts||this.physical}cityNoticeText(){return this.gift?.recipient_can_change_address?this.gift?.allows_different_shipping_cost?null:this.cityChangeNotice:this.selectCityInfo}componentDidLoad(){salla.event.product.onPriceUpdated((()=>{const t=document.querySelector(".s-quantity-input-input");this.quantity=t?.value}))}getFormDataFromForm(){if(!this.formSelector)return null;const t=document.querySelector(this.formSelector);return t?new FormData(t):null}mergeObjectToFormData(t,i,e){for(let s in t){if(!t.hasOwnProperty(s)||null==t[s])continue;const r=e?`${e}[${s}]`:s;"object"!=typeof t[s]||null===t[s]||t[s]instanceof File?i.set(r,t[s]):this.mergeObjectToFormData(t[s],i,r)}return i}async open(){if(salla.config.isGuest())return salla.api.auth.setAfterLoginEvent(this.defaultEvent),void salla.event.dispatch("login::open",{withoutReload:!0});this.resetStepsAnimation(),this.currentStep=1,this.parentClass="is-current-step-1",this.step2Animated=!1,this.stepsWrapper?.style.removeProperty("height"),await this.modal.open();const t=this.productId?()=>salla.product.getGiftProductDetails(this.productId):()=>salla.cart.getGiftCartDetails();return await salla.api.withoutNotifier(t).then((t=>{this.gift=t.data,this.senderName=this.gift.sender_name,this.disableClass=this.gift?.show_image_upload?"":"pointer-events-none",this.gift.show_texts||(this.selectedGiftTextOption=void 0,this.selectedText=void 0),this.gift.show_images||(this.selectedImage=void 0,this.uploadedImage=void 0),this.skipStep1()&&(this.currentStep=2,this.parentClass="is-current-step-2",this.step2Animated=!0)})).catch((t=>{this.hasError=!0,this.errorMessage=t.response?.data?.error?.message||t.response?.data})).finally((()=>this.modal.stopLoading()))}skipStep1(){return!!this.gift&&!this.gift.show_images&&!this.gift.show_texts}resetStepsAnimation(){[this.step1Elems,this.step2Elems].forEach((t=>{t?.querySelectorAll(".anime-item").forEach((t=>t.removeAttribute("style")))})),this.step1Elems?.removeAttribute("style"),this.step2Elems&&!this.skipStep1()&&(this.step2Elems.style.removeProperty("opacity"),this.step2Elems.style.removeProperty("transform"))}async close(){return this.modal.close()}async setWrapperHeight(t=1,i=250,e=0,s=0){let r=document.querySelector(`#${this.hostId} .gift-step-${t}`);const a=()=>{this.stepsWrapper.style.height=s?`${s}px`:r.offsetHeight+e+"px"};this.step2Animated&&2===t?requestAnimationFrame(a):setTimeout(a,i)}toggleCalendar(){this.showCalendar=!this.showCalendar,this.setWrapperHeight(2,150,0)}toggleGiftText(t){this.textSelect?.classList.remove("s-form-has-error");let i=t.target.children[t.target.selectedIndex].getAttribute("data-id"),e="custom"==i;const s=this.showGiftText!==e;this.showGiftText=e,i?(this.selectedGiftTextOption=i,this.selectedText=e?void 0:t.target.value):(this.textArea.value="",this.selectedText=void 0,this.selectedGiftTextOption=void 0),s&&this.setWrapperHeight(1,150,5)}async goToStep2(t=!0){this.step1Elems&&(t&&!this.validateStep1()||(this.stepsWrapper&&this.step1Elems&&(this.stepsWrapper.style.height=`${this.step1Elems.offsetHeight}px`),this.setWrapperHeight(2,50,0),(new e.timeline).add({targets:this.step1Elems.querySelectorAll(`#${this.hostId} .anime-item`),opacity:[1,0],translateX:[0,50],delay:e.stagger(70),duration:1200}).add({targets:".gift-step-2",translateX:["-110%",0],opacity:[0,1]},"-=1800").add({targets:this.step2Elems.querySelectorAll(`#${this.hostId} .anime-item`),opacity:[0,1],translateX:[-50,0],delay:e.stagger(70),duration:1200,complete:()=>{this.step2Elems.querySelectorAll(`#${this.hostId} .anime-item`).forEach((t=>{t.classList.remove("opacity-0"),t.removeAttribute("style")})),this.step2Animated=!0}},"-=1200"),this.currentStep=2,this.parentClass=`is-current-step-${this.currentStep}`))}validateStep1(){return!(this.gift?.show_texts&&(this.selectedGiftTextOption?"custom"!=this.selectedGiftTextOption||this.selectedText?(this.textSelect?.classList.remove("s-form-has-error"),this.customTextArea?.classList.remove("s-form-has-error"),0):(this.textSelect?.classList.remove("s-form-has-error"),this.customTextArea?.classList.add("s-form-has-error"),1):(this.textSelect?.classList.add("s-form-has-error"),this.customTextArea?.classList.remove("s-form-has-error"),1)))}goToStep1(t){t.preventDefault();let i=new e.timeline({autoplay:!1});i.add({targets:this.step2Elems.querySelectorAll(`#${this.hostId} .anime-item`),opacity:[1,0],translateX:[0,-50],delay:e.stagger(70),duration:1200}).add({targets:".gift-step-1",translateX:["110%",0],opacity:[0,1]},"-=1800").add({targets:this.step1Elems.querySelectorAll(`#${this.hostId} .anime-item`),opacity:[0,1],translateX:[50,0],delay:e.stagger(70),duration:1200,complete:()=>{this.step1Elems.querySelectorAll(`#${this.hostId} .anime-item`).forEach((t=>{t.classList.remove("opacity-0"),t.removeAttribute("style")}))}},"-=1200"),i.play(),this.step2Animated=!1,this.setWrapperHeight(1,600,0),this.currentStep=1,this.parentClass=`is-current-step-${this.currentStep}`}getFilepondPlaceholder(){return`<div class="s-gifting-filepond-placeholder"><span class="s-gifting-filepond-placeholder-icon"><svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>images</title>\n<path d="M22.667 29.333h-13.333c-3.676 0-6.667-2.991-6.667-6.667v-13.333c0-0.737-0.597-1.333-1.333-1.333s-1.333 0.596-1.333 1.333v13.333c0 5.145 4.187 9.333 9.333 9.333h13.333c0.736 0 1.333-0.596 1.333-1.333s-0.597-1.333-1.333-1.333zM22.667 5.333c-2.205 0-4 1.795-4 4s1.795 4 4 4 4-1.795 4-4-1.795-4-4-4zM22.667 10.667c-0.735 0-1.333-0.597-1.333-1.333s0.599-1.333 1.333-1.333 1.333 0.597 1.333 1.333-0.599 1.333-1.333 1.333zM25.333 0h-13.333c-3.676 0-6.667 2.991-6.667 6.667v13.333c0 1.055 0.268 2.040 0.707 2.927 0.039 0.099 0.088 0.188 0.151 0.277 1.137 2.053 3.301 3.463 5.809 3.463h13.333c3.676 0 6.667-2.991 6.667-6.667v-13.333c0-3.676-2.991-6.667-6.667-6.667zM12 24c-1.244 0-2.344-0.583-3.077-1.476l5.721-7.047 6.629 8.523zM29.333 20c0 2.205-1.795 4-4 4h-0.68l-8.933-11.485c-0.251-0.32-0.633-0.511-1.039-0.515h-0.015c-0.401 0-0.781 0.181-1.035 0.492l-5.632 6.935v-12.76c0-2.205 1.795-4 4-4h13.333c2.205 0 4 1.795 4 4z"></path>\n</svg>\n</span><p class="s-gifting-filepond-placeholder-text">${this.selectImageOrUpload&&this.gift.show_image_upload?this.selectImageOrUpload:this.selectImageForYourGift}</p></div>`}setPreview(t){this.uploader?.classList.add("has-bg");var i=document.querySelector(`#${this.hostId}.filepond-bg`)?document.querySelector(`#${this.hostId} .filepond-bg`):document.createElement("div");i.classList.add("filepond-bg"),i.classList.remove("s-hidden"),i.style.backgroundImage="url('"+t.url+"')",this.uploader?.querySelector(".filepond--root")?.appendChild(i),this.uploadedImage=t.url,this.gift&&this.gift.gift_images?.length&&this.setWrapperHeight(1,150,0)}removePreview(){this.uploader.classList.remove("has-bg");let t=document.querySelector(`#${this.hostId} .filepond-bg`);t.removeAttribute("style"),t.classList.add("s-hidden"),this.handleRemoveImage()}handleTextAreaChange(t){this.selectedText=t.target.value,this.customTextArea?.classList.remove("s-form-has-error")}clearError(t){if(this.errors?.[t]){const{[t]:i,...e}=this.errors;this.errors=e}}handleSenderName(t){this.senderName=t.target.value,this.clearError("sender_name")}handleReceiverName(t){this.receiverName=t.target.value,this.clearError("receiver.name")}resetCityState(){this.citySearchTimer&&(clearTimeout(this.citySearchTimer),this.citySearchTimer=null),++this.citySearchCounter,this.gift={...this.gift,cities:[]},this.displayedCities=[],this.receiverCity=void 0,this.selectedCity=null,this.citySearchQuery="",this.searchingCities=!1,this.enableCityAjaxSearch=!1}setInitialCities(t){this.gift={...this.gift,cities:t},this.displayedCities=t,this.enableCityAjaxSearch=t.length>=o.CITY_AJAX_THRESHOLD}async fetchCities(t=""){if(!this.selectedCountryId)return[];if(this.isKSA&&!this.selectedRegionId)return[];const i=["for_branch=0",`country_id=${this.selectedCountryId}`];this.isKSA&&this.selectedRegionId&&i.push(`region_id=${this.selectedRegionId}`),t?.trim()&&i.push(`query=${encodeURIComponent(t.trim())}`);const e=await salla.api.request(`shipping/cities?${i.join("&")}`);return e?.data??[]}async handleCountrySelected(t){const i=t?.id;this.selectedCountry=t??null,this.selectedCountryId=i,this.selectedCountryCode=t?.country_code,this.isKSA="SA"===t?.country_code,this.clearError("receiver.country"),this.regions=[],this.selectedRegionId=void 0,this.selectedRegion=null,this.resetCityState();const e=++this.locationRequestCounter;if(!i)return this.selectedCountryCode=void 0,this.isKSA=!1,void this.setWrapperHeight(2,0,0);if(this.isKSA){this.loadingRegions=!0,this.setWrapperHeight(2,0,0);try{const t=await salla.api.request(`shipping/countries/${i}/regions`);if(e!==this.locationRequestCounter)return;t&&t.data&&(this.regions=t.data)}catch(t){if(e!==this.locationRequestCounter)return;console.error("Error fetching regions:",t)}finally{e===this.locationRequestCounter&&(this.loadingRegions=!1,this.setWrapperHeight(2,0,0))}}else{this.loadingCities=!0,this.setWrapperHeight(2,0,0);try{const t=await this.fetchCities();if(e!==this.locationRequestCounter)return;this.setInitialCities(t)}catch(t){if(e!==this.locationRequestCounter)return;console.error("Error fetching cities:",t)}finally{e===this.locationRequestCounter&&(this.loadingCities=!1)}}}async handleRegionSelected(t){const i=t?.id;this.selectedRegion=t??null,this.selectedRegionId=i,this.clearError("receiver.region"),this.resetCityState();const e=++this.locationRequestCounter;if(i){this.loadingCities=!0;try{const t=await this.fetchCities();if(e!==this.locationRequestCounter)return;this.setInitialCities(t)}catch(t){if(e!==this.locationRequestCounter)return;console.error("Error fetching cities:",t)}finally{e===this.locationRequestCounter&&(this.loadingCities=!1,this.setWrapperHeight(2,0,0))}}}handleUploadImage(t){this.uploadedImage="object"!=typeof t?t:t&&t.url,this.gift&&this.gift.gift_images?.length&&this.setWrapperHeight(1,150,0)}handleRemoveImage(){this.uploadedImage="",this.gift&&this.gift.gift_images?.length&&this.setWrapperHeight(1,150,0)}handlePhoneInputChange(t){let i=t.detail;this.receiverMobile=i.number,this.receiverCountryCode=i.country_code,this.clearError("receiver.mobile")}handleDateTimePicker(t){this.deliveryDate=t.detail}getCalendarClasses(){return{"s-form-group":!0,"anime-item":!0,"s-gifting-calendar":!0,shown:this.showCalendar,hide:!this.showCalendar,"s-form-has-error":!!this.errors&&this.errors.deliver_at}}async submitForm(){const t=document.querySelector("#donating-amount")?.value;if(this.calendarFormGroup.classList.remove("s-form-has-error"),this.errors&&(this.errors={},this.setWrapperHeight(2,150,0)),this.showCalendar&&!this.deliveryDate)return void this.calendarFormGroup.classList.add("s-form-has-error");const i=[{key:"sender_name",value:this.senderName,label:this.senderNameLabel},{key:"receiver.name",value:this.receiverName,label:this.receiverNameFieldLabel},{key:"receiver.mobile",value:this.receiverMobile,label:this.receiverMobileFieldLabel},...this.isPhysical()?[{key:"receiver.country",value:this.selectedCountryId,label:this.receiverCountryFieldLabel},...this.isKSA?[{key:"receiver.region",value:this.selectedRegionId,label:this.receiverRegionFieldLabel}]:[],{key:"receiver.city_id",value:this.receiverCity,label:this.receiverCityFieldLabel}]:[]],e={};if(i.forEach((({key:t,value:i,label:s})=>{i||(e[t]=salla.lang.get("common.errors.field_required",{attribute:s}))})),Object.keys(e).length)return this.errors=e,void this.setWrapperHeight(2,150,0);const s="custom"===this.selectedGiftTextOption,r={text:s?this.selectedText:void 0,text_id:!s&&this.selectedGiftTextOption?Number(this.selectedGiftTextOption):void 0,sender_name:this.senderName,quantity:this.quantity,deliver_at:this.showCalendar?this.deliveryDate:null,image_url:this.uploadedImage??this.selectedImage,donation_amount:t||null,receiver:{name:this.receiverName,mobile_country_code:this.receiverCountryCode,mobile:this.receiverMobile,...this.isPhysical()&&this.selectedCountryCode?{country_code:this.selectedCountryCode}:{},...this.isPhysical()&&this.selectedRegionId?{region_id:this.selectedRegionId}:{},...this.receiverCity&&this.isPhysical()?{city_id:this.receiverCity}:{}},has_apple_pay:salla.helpers.hasApplePay()};let a;this.productId&&this.formSelector&&(a=this.getFormDataFromForm()||new FormData,a=this.mergeObjectToFormData(r,a));const o=this.productId?()=>salla.product.addProductGiftToCart(this.productId,a,!0):()=>salla.cart.addCartGiftToCart(r,!0);return await o().then((()=>this.modal.close())).catch((t=>{t.response&&422==t.response.status?this.errors=t.response.data.error.fields:console.log(t),this.setWrapperHeight(2,150,0)}))}step2ItemClass(t=""){const i="anime-item"+(this.step2Animated?"":" opacity-0");return t?`${t} ${i}`:i}generateClass(){return{"s-gifting-widget":!0,"s-gifting-widget-vertical":!!this.vertical,"s-gifting-widget-horizontal":!this.vertical}}async handleGiftButtonClick(){if(this.productId&&this.formSelector){const t=document.querySelector(this.formSelector);if(!t)return void console.error("SallaGifting:: Form not found in the document!");if(!(t instanceof HTMLFormElement))return void console.error("SallaGifting:: The specified selector does not correspond to a form tag!");if(!t.reportValidity())return console.error("SallaGifting:: Form is not valid!"),void salla.error(salla.lang.get("common.messages.required_fields"))}const t=document.querySelector(`salla-product-options[product-id="${this.productId}"]`);!t||await t.reportValidity()?this.open():salla.error(salla.lang.get("common.messages.required_fields"))}render(){return[i("div",{key:"3795180f3f719218220086c66f6bfbe6e57dc1d4"},i("salla-list-tile",{key:"cb9fd3e10b02bb429b25c028fcd2d328e73eab6e",class:this.generateClass()},i("div",{key:"cca448eae1144b0606bf8f07844974cd7f966236",slot:"title"},this.vertical?i("span",{innerHTML:a}):"",i("h3",{key:"c33210bdf1a72cdf0151138ce2949fc462efaf94"},this.widgetTitle?this.widgetTitle:this.sectionTitle)),i("div",{key:"007fc138265e6ab82dbdfab8169baa407b111e60",slot:"subtitle"},i("div",{key:"89de9cc780511609d294f67a3d639a0305300b17"},this.widgetSubtitle?this.widgetSubtitle:this.sectionSubtitle)),i("div",{key:"ea647e47079ab8e57580675f485bc99c2b213cd4",slot:"action"},i("salla-button",{key:"e87bcc03e5ab02204ca9f1d590421cae13282269",color:"primary",fill:"outline",width:"wide",class:"s-gifting-widget-action",onClick:()=>this.handleGiftButtonClick()},i("slot",{key:"ce294391f8c18e345ec2117a15e2942dd00790fc",name:"widget-btn-content"},i("div",{key:"7106257d9f44b869fcd3933ae8a1d2a50f4486dd",class:"s-gifting-widget-action-content"},i("span",{key:"305822ae865b6da9275ced4600933d83d42e54e7",innerHTML:a})," ",i("span",{key:"13f2d03213e1fea9fe9911a94259b89085406ab3"},this.sectionBtnText)))))),i("salla-modal",{key:"b55185fbd34776043661ca6f15a739e34e98e0ef",id:this.hostId,isLoading:!0,class:"s-gifting-modal",width:"sm",ref:t=>this.modal=t},i("div",{key:"9f59cea6e2835d80e24bc269b78a5bc47b354f6a",slot:"loading"},i("div",{key:"3f74f3384be120a0733e921de696d2beeccd49ce",class:"s-gifting-skeleton"},i("div",{key:"e3ffb5b8d712bc391ad6b4190556ac870e37db0c",class:"s-gifting-modal-header"},i("salla-skeleton",{key:"b9b154ab445516fa1fae66cc458dd68114024d9d",type:"circle",height:"5rem",width:"5rem"}),i("h2",{key:"1ecf5c6ea1ebeccbd6ed7f259045647148863826",class:"s-gifting-modal-title"},i("div",{key:"165d927a3bcaf47dd5c7657db8543ad02b47dc44",class:"s-gifting-modal-badge-wrapper"},i("salla-skeleton",{key:"cba1667fa446566c5bc862c206313d8f48a0991e",height:"15px",width:"150px"})))),i("div",{key:"f56f8e8820f789ca117a0e19cf660bc4d836ec6a",class:"s-gifting-skeleton-content"},i("salla-skeleton",{key:"74b8cec4be6e18ec8a1b340d8fed0b2d136bb1d3",height:"10px",width:"150px"}),i("salla-skeleton",{key:"5c615a0c0eb72908e601c2cfd28fe12a6391ef80",height:"230px"}),i("salla-skeleton",{key:"5c432b6e3f8c70574e1d05d26f57443ff5da45fe",height:"10px",width:"150px"}),i("salla-skeleton",{key:"7f5d7ec5cf3ef50f945e2a57363ac215e41f306b",height:"30px"}),i("salla-skeleton",{key:"47c0e823643dc9c2d4908dde353adf5b0e4355ad",height:"40px"})))),i("slot",{key:"3ad3a57a07cb8182e5cd86783ba19c8ae8f34d3b",name:"header"}),this.hasError?i("salla-placeholder",{alignment:"center"},i("span",{slot:"title"},this.errorMessage||salla.lang.get("common.errors.empty_results")),i("span",{slot:"description"}," ")):[i("div",{class:"s-gifting-modal-header"},i("span",{class:"s-gifting-modal-icon"},i("span",{innerHTML:a})),i("h2",{class:"s-gifting-modal-title"},i("div",{class:"s-gifting-modal-badge-wrapper"},!this.skipStep1()&&i("div",{class:"s-gifting-modal-badge"},i("span",null,i("span",null,this.currentStep),"/2")),i("span",null,this.giftDetails)))),i("div",{class:"s-gifting-steps-wrapper "+this.parentClass,ref:t=>this.stepsWrapper=t},!this.skipStep1()&&i("div",{class:"s-gifting-step-one gift-step-1",ref:t=>this.step1Elems=t},this.gift&&this.gift.show_images&&i("div",{class:"s-gifting-modal-uploader-title anime-item"},this.selectImageForYourGift),this.gift&&this.gift.show_images&&i("div",{class:"s-gifting-image-section"},i("div",{class:`s-gifting-modal-uploader anime-item ${this.disableClass}`,ref:t=>this.uploader=t},i("span",{class:"s-gifting-remove-preview pointer-events-auto",onClick:()=>this.removePreview(),innerHTML:r}),this.selectImageOrUpload&&this.gift&&i("salla-file-upload",{"instant-upload":!0,name:"image_url",url:salla.url.api(salla.product.api.getUrl("giftImage")),onUploaded:t=>this.handleUploadImage(t.detail),labelIdle:this.getFilepondPlaceholder(),onRemoved:()=>this.handleRemoveImage()})),i("div",{class:"anime-item"},!this.uploadedImage&&this.gift&&this.gift.gift_images&&this.gift.gift_images.length>0?i("salla-slider",{id:"gifting-slider",loop:!1,"controls-outer":!0,class:"s-gifting-slider",type:"carousel"},i("div",{slot:"items"},this.gift&&this.gift.gift_images?this.gift?.gift_images.map((t=>i("a",{class:"s-gifting-clickable s-gifting-image",onClick:()=>this.setPreview(t)},i("img",{src:t.url,alt:`${t.id}`})))):"")):"")),this.gift&&this.gift.show_texts?i("div",{class:"anime-item"},i("div",{class:"s-gifting-modal-uploader-title s-gifting-text-title"},this.giftText),i("div",{class:"s-form-group s-gifting-selectText",ref:t=>this.textSelect=t},i("select",{id:"gift-text-selection",name:"gift-text-selection",class:"s-form-control s-gifting-select",onChange:t=>this.toggleGiftText(t)},i("option",{"data-id":null,selected:!this.selectedGiftTextOption},this.selectGiftMessage),this.gift&&this.gift.gift_texts?this.gift?.gift_texts.map((t=>i("option",{"data-id":t.id,value:t.text,key:t.id,selected:String(this.selectedGiftTextOption)===String(t.id)},t.text))):"",this.gift&&this.gift.show_custom_text?i("option",{"data-id":"custom",selected:"custom"===this.selectedGiftTextOption},this.giftCustomText):null)),i("div",{class:this.showGiftText&&this.gift&&this.gift.show_custom_text?"s-form-group s-gifting-textarea shown":"s-form-group s-gifting-textarea hide",ref:t=>this.customTextArea=t},i("label",{htmlFor:"gift-custom-text",class:"s-form-label"},this.giftCustomText),i("div",{class:"mt-1"},i("textarea",{onInput:t=>this.handleTextAreaChange(t),rows:4,ref:t=>this.textArea=t,name:"gift-custom-text",id:"gift-custom-text",class:"s-form-control"})))):null,i("div",{class:"anime-item"},i("salla-button",{color:"primary",width:"wide",onClick:()=>this.goToStep2(!!this.gift?.show_texts)},i("span",null,this.nextStep)))),i("div",{class:"s-gifting-step-two gift-step-2",style:this.skipStep1()?{opacity:"1",transform:"translateX(0)",position:"relative"}:void 0,ref:t=>this.step2Elems=t},i("div",{class:this.step2ItemClass(this.errors?.sender_name?"s-form-group s-form-has-error":"s-form-group")},i("label",{htmlFor:"sender_name",class:"s-form-label"},this.senderNameLabel),i("input",{type:"text",class:"s-form-control",name:"sender_name",id:"sender_name",value:this.senderName,onInput:t=>this.handleSenderName(t),placeholder:""}),this.errors&&this.errors.sender_name?i("span",{class:"s-gifting-error"},this.errors.sender_name):""),i("div",{class:this.step2ItemClass(this.errors?.["receiver.name"]?"s-form-group s-form-has-error":"s-form-group")},i("label",{htmlFor:"receiver_name",class:"s-form-label"},this.receiverNameFieldLabel),i("input",{type:"text",class:"s-form-control",name:"receiver_name",id:"receiver_name",value:"",onInput:t=>this.handleReceiverName(t),placeholder:""}),this.errors&&this.errors["receiver.name"]?i("span",{class:"s-gifting-error"},this.errors["receiver.name"]):""),i("div",{class:this.step2ItemClass(this.errors?.["receiver.mobile"]?"s-form-group s-form-has-error":"s-form-group")},i("label",{class:"s-form-label"},this.receiverMobileFieldLabel),i("salla-tel-input",{class:"s-gifting-tel-input",phone:this.receiverMobile,countryCode:this.receiverCountryCode,onPhoneEntered:t=>this.handlePhoneInputChange(t)}),this.errors&&this.errors["receiver.mobile"]?i("span",{class:"s-gifting-error"},this.errors["receiver.mobile"]):""),this.isPhysical()&&i("div",{class:this.step2ItemClass(this.errors?.["receiver.country"]?"s-form-group s-form-has-error":"s-form-group")},i("label",{class:"s-form-label",htmlFor:`${this.hostId}-country`},this.receiverCountryFieldLabel),i("salla-searchable-dropdown",{placeholder:this.selectCountry,items:this.gift?.countries??[],selectedItem:this.selectedCountry,disabled:!this.gift?.countries?.length,required:!0,inputId:`${this.hostId}-country`,searchable:!1,keepParentScroll:!0,onItemSelected:t=>this.handleCountrySelected(t.detail),onDropdownClosed:()=>this.handleCountryDropdownClosed()}),this.errors&&this.errors["receiver.country"]?i("span",{class:"s-gifting-error"},this.errors["receiver.country"]):""),this.isPhysical()&&this.isKSA&&i("div",{class:this.step2ItemClass(this.errors?.["receiver.region"]?"s-form-group s-form-has-error":"s-form-group")},i("label",{class:"s-form-label",htmlFor:`${this.hostId}-region`},this.receiverRegionFieldLabel),i("salla-searchable-dropdown",{placeholder:this.selectRegion,items:this.regions??[],selectedItem:this.selectedRegion,loading:this.loadingRegions,disabled:this.loadingRegions||!this.regions?.length,required:!0,inputId:`${this.hostId}-region`,searchable:!1,keepParentScroll:!0,onItemSelected:t=>this.handleRegionSelected(t.detail),onDropdownClosed:()=>this.handleRegionDropdownClosed()}),this.errors&&this.errors["receiver.region"]?i("span",{class:"s-gifting-error"},this.errors["receiver.region"]):""),this.isPhysical()&&i("div",{class:this.step2ItemClass(this.errors?.["receiver.city_id"]?"s-form-group s-form-has-error":"s-form-group")},i("label",{class:"s-form-label",htmlFor:`${this.hostId}-city`},this.receiverCityFieldLabel),i("salla-searchable-dropdown",{placeholder:this.selectCity,items:this.displayedCities,selectedItem:this.selectedCity,loading:this.loadingCities,searching:this.searchingCities,disabled:this.loadingCities||this.isKSA&&!this.selectedRegionId,required:!0,inputId:`${this.hostId}-city`,searchQuery:this.citySearchQuery,clientSearch:!this.enableCityAjaxSearch,dropUp:!0,keepParentScroll:!0,onItemSelected:t=>this.handleCitySelected(t.detail),onSearchInput:t=>this.handleCitySearch(t.detail),onDropdownClosed:()=>this.handleCityDropdownClosed()}),this.errors&&this.errors["receiver.city_id"]?i("span",{class:"s-gifting-error"},this.errors["receiver.city_id"]):""),this.isPhysical()&&this.cityNoticeText()&&i("div",{class:this.step2ItemClass("s-gifting-info")},i("span",{innerHTML:'\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>alert</title>\n<path d="M16 13.333c-0.736 0-1.333 0.597-1.333 1.333v8c0 0.736 0.597 1.333 1.333 1.333s1.333-0.597 1.333-1.333v-8c0-0.736-0.597-1.333-1.333-1.333zM16 9.327c-0.736 0-1.333 0.604-1.333 1.34s0.597 1.333 1.333 1.333 1.333-0.597 1.333-1.333v-0.013c0-0.736-0.597-1.327-1.333-1.327zM27.313 4.687c-6.237-6.237-16.389-6.239-22.628 0-6.237 6.239-6.237 16.389 0 22.628 3.119 3.119 7.216 4.679 11.313 4.679s8.195-1.559 11.313-4.679c6.24-6.239 6.24-16.391 0.001-22.628zM25.428 25.428c-5.199 5.197-13.657 5.197-18.857 0-5.197-5.199-5.197-13.659 0-18.857 5.199-5.197 13.659-5.197 18.857 0 5.199 5.2 5.199 13.659 0 18.857z"></path>\n</svg>\n'}),i("span",null,this.cityNoticeText())),!this.isPhysical()&&i("div",{class:this.step2ItemClass()},i("label",{class:"s-gifting-schedule s-gifting-clickable",htmlFor:`schedule-${this.hostId}`},i("input",{type:"checkbox",name:"schedule",id:`schedule-${this.hostId}`,onChange:()=>this.toggleCalendar(),class:"s-checkbox"}),i("span",{class:"s-form-label"}," ",this.sendLater," "))),i("div",{class:this.getCalendarClasses(),ref:t=>this.calendarFormGroup=t},i("label",{class:"s-form-label"},this.selectSendDateAndTime),i("salla-datetime-picker",{value:this.deliveryDate,placeholder:this.selectSendDateAndTime,"enable-time":!0,"date-format":"Y-m-d h:i K",onPicked:t=>this.handleDateTimePicker(t)}),i("span",{class:"s-gifting-calendar-hint"},this.canNotEditOrderAfterSelectDate)),i("div",{class:this.step2ItemClass("s-gifting-step-two-footer")},!this.skipStep1()&&i("a",{href:"#!",innerHTML:s,onClick:t=>this.goToStep1(t)}),i("salla-button",{onClick:()=>this.submitForm(),color:"primary",width:"wide"},i("span",null,this.sendGift)))))],i("slot",{key:"4b5e340be26e46c09508d192207fa6af9ec0cc44",name:"footer"})))]}};o.CITY_AJAX_THRESHOLD=400,o.CITY_SEARCH_DEBOUNCE_MS=100,o.style='/*!twlt*/.s-gifting-steps-wrapper{transition:height 0.8s cubic-bezier(0.55, 0, 0.1, 1) 0s}.s-gifting-select{background-image:url("data:image/svg+xml;utf8,<svg version=\'1.1\' fill=\'gray\' xmlns=\'http://www.w3.org/2000/svg\' width=\'32\' height=\'32\' viewBox=\'0 0 32 32\'><title>keyboard_arrow_down</title><path d=\'M9.875 11.104l6.125 6.125 6.125-6.125 1.875 1.875-8 8-8-8z\'></path></svg>");background-size:24px;background-repeat:no-repeat;background-position:99%;appearance:none}[dir=rtl] .s-gifting-select{background-position:5px}.s-gifting-widget-vertical .s-list-tile-item [slot=title]{display:flex;align-items:center;gap:1.5rem}.s-gifting-widget-vertical .s-list-tile-item-content{width:100%}.s-gifting-modal .s-searchable-dropdown-trigger{border-color:#d1d5db}.s-gifting-modal .s-searchable-dropdown-trigger:hover:not(.s-searchable-dropdown-trigger--disabled){border-color:#d1d5db}.s-gifting-modal .s-searchable-dropdown-trigger--open,.s-gifting-modal .s-searchable-dropdown-trigger:focus{border-color:var(--color-primary, #00897b);box-shadow:0 0 0 1px var(--color-primary, #00897b)}.s-gifting-modal .s-searchable-dropdown-trigger-placeholder{color:#000}.s-gifting-modal .s-gifting-image-section{margin-bottom:1.5rem}.s-gifting-modal .s-gifting-slider{margin-bottom:0.5rem}.s-gifting-modal .s-gifting-image{display:block}.s-gifting-modal .s-gifting-image img{display:block;width:auto;height:100px;object-fit:contain}.s-gifting-modal .s-gifting-image-section+.anime-item .s-gifting-text-title{margin-top:1rem}.pointer-events-none{pointer-events:none}.pointer-events-auto{pointer-events:auto}.static{position:static}.fixed{position:fixed}.relative{position:relative}.mt-1{margin-top:0.25rem}.inline{display:inline}.hidden{display:none}.grow{flex-grow:1}.transform{transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.resize{resize:both}.opacity-0{opacity:0}.outline{outline-style:solid}.transition{transition-property:color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms}.s-hidden{display:none}.has-error .s-form-label{color:#ff443a}.has-error .s-form-control,.has-error .s-tel-input-control,.has-error .s-datetime-picker-input{border-color:#ff443a;color:#ff443a}.s-hidden{display:none}.s-form-control{display:block;width:100%;border-radius:var(--s-radius, 0.25rem);border-width:1px;--tw-border-opacity:1;border-color:rgb(209 213 219 / var(--tw-border-opacity, 1));--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1));padding:0.5rem;font-size:0.875rem;line-height:1.25rem;--tw-text-opacity:1;color:rgb(17 24 39 / var(--tw-text-opacity, 1))}.s-form-control:focus{border-color:var(--color-primary);--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000)}.s-form-label{margin-bottom:0.25rem;display:block;font-size:0.875rem;line-height:1.25rem;font-weight:500;--tw-text-opacity:1;color:rgb(17 24 39 / var(--tw-text-opacity, 1))}.s-form-group{margin-top:0.75rem;margin-bottom:0.75rem}.s-checkbox{cursor:pointer;--tw-border-opacity:1;border-color:rgb(209 213 219 / var(--tw-border-opacity, 1));appearance:none;background-color:#fff;margin:0;width:18px;height:18px;border-width:1px;border-radius:4px;display:grid;place-content:center}.s-checkbox:before{width:10px;height:10px;clip-path:polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);transform:scale(0);transform-origin:bottom left;transition:120ms transform ease-in-out;box-shadow:inset 1em 1em #444;background-color:#444}.s-checkbox:checked:before{transform:scale(1)}.s-checkbox::before{--tw-content:\'\';content:var(--tw-content)}.s-form-has-error .s-form-label{color:#ff443a}.s-form-has-error .s-form-control,.s-form-has-error .s-tel-input-control,.s-form-has-error .s-datetime-picker-input{border-color:#ff443a;color:#ff443a}.s-gifting-widget .s-list-tile-item-icon{display:none}.s-gifting-widget-vertical .s-list-tile-item-icon{display:block}.s-gifting-widget-vertical .s-list-tile-item-title svg{fill:var(--color-primary)}.s-gifting-widget-vertical .s-list-tile-item-subtitle{padding-right:3.5rem;font-size:0.75rem;line-height:1rem;--tw-text-opacity:1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.s-gifting-widget-vertical .s-list-tile-item{flex-wrap:wrap;padding:0px}@media (min-width: 1024px){.s-gifting-widget-vertical .s-list-tile-item-action{flex:1 1 0%}}.s-gifting-widget-vertical .widget-icon{--tw-translate-y:0.625rem;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));font-size:1.875rem;line-height:2.25rem;color:var(--color-primary)}.s-gifting-widget .s-button-text{display:flex}.s-gifting-widget .s-list-tile-item{flex-direction:column;justify-content:space-between;gap:1rem;border-radius:0.75rem;border-width:1px;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1));padding:1.25rem;text-align:center}@media (min-width: 768px){.s-gifting-widget .s-list-tile-item{text-align:left}}@media (min-width: 1024px){.s-gifting-widget .s-list-tile-item{flex-direction:row}}@media (min-width: 768px){.s-gifting-widget .s-list-tile-item:where([dir="rtl"],[dir="rtl"] *){text-align:right}}.s-gifting-widget-horizontal .s-gifting-widget-action button{padding-left:2rem;padding-right:2rem;font-weight:400}.s-gifting-info{display:flex;align-items:center;gap:0.5rem;border-radius:0.5rem;--tw-border-opacity:1;border-color:rgb(191 219 254 / var(--tw-border-opacity, 1));--tw-bg-opacity:1;background-color:rgb(219 234 254 / var(--tw-bg-opacity, 1));padding:1rem;font-size:0.875rem;line-height:1.25rem;--tw-text-opacity:1;color:rgb(29 78 216 / var(--tw-text-opacity, 1))}.s-gifting-info svg{height:1.25rem;width:1.25rem;fill:#1d4ed8}.s-gifting-error{font-size:0.75rem;line-height:1rem;--tw-text-opacity:1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.s-gifting-info span{font-size:0.75rem;line-height:1rem}.s-gifting-widget-action-content{display:flex;align-items:center}.s-gifting-widget-action-content svg{margin-left:0.5rem;margin-right:0.5rem}.s-gifting-modal-header{margin-bottom:1.25rem;display:flex;flex-direction:column;align-items:center;justify-content:center}.s-gifting-modal .s-modal-header{display:block}.s-gifting-modal .s-modal-body{position:relative !important;left:unset !important;bottom:unset !important;padding-bottom:2rem}@media (min-width: 640px){.s-gifting-modal .s-modal-body{padding-bottom:1.5rem}}.s-gifting-modal-icon{margin-bottom:1.25rem;display:flex;height:5rem;width:5rem;flex-direction:row;align-items:center;justify-content:center;border-radius:9999px;border-width:1px;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1));font-size:1.875rem;line-height:2.25rem}.s-gifting-modal-title{display:flex;width:100%;align-items:center;justify-content:space-between}.s-gifting-modal-title::before{display:block;height:1px;flex:1 1 auto;--tw-bg-opacity:1;background-color:rgb(229 231 235 / var(--tw-bg-opacity, 1));--tw-content:\'\';content:var(--tw-content)}.s-gifting-modal-title::after{display:block;height:1px;flex:1 1 auto;--tw-bg-opacity:1;background-color:rgb(229 231 235 / var(--tw-bg-opacity, 1));--tw-content:\'\';content:var(--tw-content)}.s-gifting-modal-badge-wrapper{display:flex;align-items:center;padding-left:0.75rem;padding-right:0.75rem}.s-gifting-modal-badge{margin-right:0.5rem;border-radius:0.5rem;--tw-bg-opacity:1;background-color:rgb(229 231 235 / var(--tw-bg-opacity, 1));padding-left:0.5rem;padding-right:0.5rem;padding-top:0.25rem;padding-bottom:0.25rem;font-size:0.875rem;line-height:1.25rem}.s-gifting-modal-badge:where([dir="rtl"],[dir="rtl"] *){margin-right:0px;margin-left:0.5rem}.s-gifting-modal-uploader.has-bg{position:relative}.s-gifting-modal-uploader.has-bg .s-gifting-remove-preview{pointer-events:auto;--tw-scale-x:1;--tw-scale-y:1;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));opacity:1}.s-gifting-modal-uploader-title{margin-bottom:0.5rem;font-size:0.875rem;line-height:1.25rem}.s-gifting-steps-wrapper{position:relative}.s-gifting-steps-wrapper .s-button-wrap{pointer-events:auto !important}.is-current-step-2 .gift-step-1,.is-current-step-1 .gift-step-2{pointer-events:none;z-index:-1}.s-gifting-step-one{padding-top:1.25rem}.s-gifting-step-two{position:absolute;top:0px;left:0px;margin-left:auto;margin-right:auto;display:flex;width:100%;--tw-translate-x:-105%;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));flex-direction:column;opacity:0}.s-gifting-step-one .swiper-wrapper{height:100px}.s-gifting-step-one .swiper-slide{width:auto !important}.s-gifting-step-one .filepond--list-scroller{overflow-y:hidden}.s-gifting-step-one .swiper-wrapper img{border-radius:0.375rem;object-fit:cover}.s-gifting-step-one .filepond--root{height:230px}.s-gifting-step-one .filepond--list{left:0px !important;height:100% !important}.s-gifting-step-one .filepond-bg{position:absolute;top:0px;z-index:10;height:100%;width:100%;border-radius:var(--s-radius, 0.25rem);--tw-bg-opacity:1;background-color:rgb(55 65 81 / var(--tw-bg-opacity, 1));background-size:cover}.s-gifting-step-one .s-slider-button-next{top:35% !important}.s-gifting-step-one .s-slider-button-next button{height:35px;width:35px;--tw-shadow:0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}.s-gifting-step-one .s-slider-button-prev{top:35% !important}.s-gifting-step-one .s-slider-button-prev button{height:35px;width:35px;--tw-shadow:0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}.s-gifting-tel-input .s-tel-input-control{--tw-border-opacity:1;border-color:rgb(209 213 219 / var(--tw-border-opacity, 1))}.s-gifting-tel-input .s-tel-input-error-msg{display:none}.s-gifting-step-two-footer{margin-top:1.25rem;display:flex;flex-direction:row;align-items:center;justify-content:center}.s-gifting-step-two-footer>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-right:calc(0.625rem * var(--tw-space-x-reverse));margin-left:calc(0.625rem * calc(1 - var(--tw-space-x-reverse)))}.s-gifting-step-two-footer:where([dir="rtl"],[dir="rtl"] *){flex-direction:row-reverse}.s-gifting-step-two-footer a{border-radius:0.375rem;border-width:1px;border-color:var(--color-primary);fill:var(--color-primary);padding-top:8px;padding-bottom:8px;padding-left:25px;padding-right:25px}.s-gifting-step-two-footer a svg{height:1.25rem;width:1.25rem}.s-gifting-step-two .s-form-group.s-form-has-error .s-tel-input-control{--tw-border-opacity:1 !important;border-color:rgb(255 68 58 / var(--tw-border-opacity, 1)) !important}.s-gifting-selectText{margin-bottom:20px !important}.s-gifting-schedule .s-form-label{margin-bottom:0px !important}.s-gifting-schedule{margin-bottom:0.5rem;display:flex;align-items:center;justify-content:flex-start}.s-gifting-schedule>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-right:calc(0.375rem * var(--tw-space-x-reverse));margin-left:calc(0.375rem * calc(1 - var(--tw-space-x-reverse)))}.s-gifting-schedule:where([dir="rtl"],[dir="rtl"] *)>:not([hidden])~:not([hidden]){--tw-space-x-reverse:1}.s-gifting-clickable{cursor:pointer}.s-gifting-remove-preview{pointer-events:none;position:absolute;top:-7px;left:-7px;z-index:10;display:flex;height:1.25rem;width:1.25rem;--tw-scale-x:0;--tw-scale-y:0;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));cursor:pointer;align-items:center;justify-content:center;border-radius:9999px;--tw-bg-opacity:1;background-color:rgb(185 28 28 / var(--tw-bg-opacity, 1));text-align:center;font-size:1rem;line-height:1.5rem;--tw-text-opacity:1;color:rgb(255 255 255 / var(--tw-text-opacity, 1));opacity:0;transition-property:all;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:300ms}.s-gifting-remove-preview:where([dir="rtl"],[dir="rtl"] *){left:unset;right:-7px}.s-gifting-remove-preview svg{height:100%;width:15px;fill:#fff}.s-gifting-textarea{transition-property:all;transition-duration:200ms;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1)}.s-gifting-calendar-hint{font-size:0.75rem;line-height:1rem;--tw-text-opacity:1;color:rgb(220 38 38 / var(--tw-text-opacity, 1))}.s-gifting-calendar.shown{margin-top:0.75rem;height:75px;opacity:1}.s-gifting-textarea.shown{height:122px;opacity:1}.s-gifting-calendar.hide{pointer-events:none;visibility:hidden;margin:0px;height:0px;opacity:0}.s-gifting-textarea.hide{pointer-events:none;visibility:hidden;margin:0px;height:0px;opacity:0}.s-gifting-filepond-placeholder-icon svg{margin-top:12px;margin-bottom:12px;margin-left:auto;margin-right:auto;height:4rem;width:3rem;fill:#e5e7eb}.s-gifting-filepond-placeholder-text{margin-left:auto;margin-right:auto;width:65%;min-width:18rem;font-size:0.75rem !important;line-height:1rem !important;--tw-text-opacity:1;color:rgb(107 114 128 / var(--tw-text-opacity, 1));margin-top:0.75rem;margin-bottom:0.75rem;font-family:var(--font-main), -apple-system, BlinkMacSystemFont}.s-gifting-skeleton-content salla-skeleton:nth-child(1){margin-bottom:0.75rem}.s-gifting-skeleton-content salla-skeleton:nth-child(2){margin-bottom:1.25rem}.s-gifting-skeleton-content salla-skeleton:nth-child(3){margin-bottom:0.75rem}.s-gifting-skeleton-content salla-skeleton:nth-child(4){margin-bottom:1.25rem}.s-gifting-skeleton .s-gifting-modal-header salla-skeleton{margin-bottom:1.25rem}.s-gifting-skeleton .s-gifting-modal-title{margin-bottom:1.25rem}.s-gifting-image{margin-left:5px;margin-right:5px}';export{o as salla_gifting}
|