@salla.sa/twilight-components 2.14.542 → 2.14.544
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-B0aAvhFd.js → filepond-D2YavdCs.js} +1 -1
- package/dist/cjs/{filepond-plugin-file-poster-BFqqCNYU.js → filepond-plugin-file-poster-1wvhm3fc.js} +1 -1
- package/dist/cjs/{filepond-plugin-file-validate-size-BNcTcX1x.js → filepond-plugin-file-validate-size-BJQGWxdQ.js} +1 -1
- package/dist/cjs/{filepond-plugin-file-validate-type-DAWd81u4.js → filepond-plugin-file-validate-type-Cj_4I_GJ.js} +1 -1
- package/dist/cjs/{filepond-plugin-image-edit-CIg9FEsX.js → filepond-plugin-image-edit-wf7RYTkL.js} +1 -1
- package/dist/cjs/{filepond-plugin-image-exif-orientation--VivPhX_.js → filepond-plugin-image-exif-orientation-BPs9o0xx.js} +1 -1
- package/dist/cjs/{filepond-plugin-image-preview-apJ7tv7p.js → filepond-plugin-image-preview-fGpSUIm-.js} +1 -1
- package/dist/cjs/helpers-DHdDjm5V.js +340 -0
- package/dist/cjs/{index-ufJ3UmgO.js → index-CvqLEBf0.js} +2 -2
- package/dist/cjs/{intlTelInput-1mNNQjMC.js → intlTelInput-C1wAR7s0.js} +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/salla-accordion-body_2.cjs.entry.js +1 -1
- package/dist/cjs/salla-accordion_6.cjs.entry.js +1 -1
- package/dist/cjs/salla-add-product-button_5.cjs.entry.js +1 -1
- package/dist/cjs/salla-advertisement.cjs.entry.js +1 -1
- package/dist/cjs/salla-alert_2.cjs.entry.js +1 -1
- package/dist/cjs/salla-app-install-alert.cjs.entry.js +1 -1
- package/dist/cjs/salla-apps-icons.cjs.entry.js +1 -1
- package/dist/cjs/salla-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 +156 -401
- package/dist/cjs/salla-cart-coupons.cjs.entry.js +1 -1
- package/dist/cjs/salla-cart-item-offers_2.cjs.entry.js +1 -1
- package/dist/cjs/salla-cart-summary-card.cjs.entry.js +1 -1
- package/dist/cjs/salla-cashback-banner.cjs.entry.js +1 -1
- package/dist/cjs/salla-comment-factors.cjs.entry.js +1 -1
- package/dist/cjs/salla-comment-form_8.cjs.entry.js +1 -1
- package/dist/cjs/salla-conditional-offer.cjs.entry.js +1 -1
- package/dist/cjs/salla-contacts.cjs.entry.js +1 -1
- package/dist/cjs/salla-cookies-bar.cjs.entry.js +1 -1
- package/dist/cjs/salla-count-down.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 +21 -5
- 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 +1 -1
- 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 +1 -1
- package/dist/cjs/salla-rating-modal-v2.cjs.entry.js +1 -1
- package/dist/cjs/salla-rating-modal.cjs.entry.js +1 -1
- package/dist/cjs/salla-review-factors-tags.cjs.entry.js +1 -1
- package/dist/cjs/salla-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 +1 -1
- package/dist/cjs/salla-social.cjs.entry.js +1 -1
- package/dist/cjs/salla-tab-content_3.cjs.entry.js +1 -1
- package/dist/cjs/salla-tiered-offer.cjs.entry.js +1 -1
- package/dist/cjs/salla-tooltip.cjs.entry.js +1 -1
- package/dist/cjs/salla-trust-badges.cjs.entry.js +1 -1
- package/dist/cjs/salla-user-menu.cjs.entry.js +1 -1
- package/dist/cjs/salla-user-profile.cjs.entry.js +1 -1
- package/dist/cjs/salla-user-settings.cjs.entry.js +1 -1
- package/dist/cjs/salla-verify.cjs.entry.js +1 -1
- package/dist/cjs/salla-wallet.cjs.entry.js +1 -1
- package/dist/cjs/salla-wishlist-actions.cjs.entry.js +1 -1
- package/dist/cjs/twilight.cjs.js +1 -1
- package/dist/cjs/{vanilla-picker-DvN9odkn.js → vanilla-picker-BzqeTGIZ.js} +1 -1
- package/dist/collection/components/salla-bullet-delivery/helpers.js +3 -0
- package/dist/collection/components/salla-bullet-delivery/salla-bullet-delivery.js +82 -16
- package/dist/collection/components/salla-delivery-promise/delivery-promise-api.js +1 -1
- package/dist/collection/components/salla-delivery-promise/delivery-promise-intent.js +9 -0
- package/dist/collection/components/salla-delivery-promise/salla-delivery-promise.js +10 -3
- package/dist/components/helpers.js +319 -0
- package/dist/components/index.js +2 -2
- package/dist/components/salla-bullet-delivery.js +82 -327
- package/dist/components/salla-delivery-promise.js +20 -4
- package/dist/esm/{filepond-BJvckaDn.js → filepond-XV8z8Gy4.js} +1 -1
- package/dist/esm/{filepond-plugin-file-poster-BJGjo9nD.js → filepond-plugin-file-poster-Ck2HvsnC.js} +1 -1
- package/dist/esm/{filepond-plugin-file-validate-size-DLFBVAw5.js → filepond-plugin-file-validate-size-f2fJ8Xjg.js} +1 -1
- package/dist/esm/{filepond-plugin-file-validate-type-Cl7gFtPR.js → filepond-plugin-file-validate-type-BsyQIuBO.js} +1 -1
- package/dist/esm/{filepond-plugin-image-edit-P-yC8gQP.js → filepond-plugin-image-edit-C9m-0BT7.js} +1 -1
- package/dist/esm/{filepond-plugin-image-exif-orientation-Ck7hEAD_.js → filepond-plugin-image-exif-orientation-BM1BifD4.js} +1 -1
- package/dist/esm/{filepond-plugin-image-preview-BSCNg5pC.js → filepond-plugin-image-preview-CfJu8_cN.js} +1 -1
- package/dist/esm/helpers-BDChq2t4.js +319 -0
- package/dist/esm/{index-DaGqpYdk.js → index-Dcu3dMye.js} +2 -2
- package/dist/esm/{intlTelInput-CFalf-QE.js → intlTelInput-jRi7Hmv8.js} +1 -1
- package/dist/esm/loader.js +2 -2
- package/dist/esm/salla-accordion-body_2.entry.js +1 -1
- package/dist/esm/salla-accordion_6.entry.js +1 -1
- package/dist/esm/salla-add-product-button_5.entry.js +1 -1
- package/dist/esm/salla-advertisement.entry.js +1 -1
- package/dist/esm/salla-alert_2.entry.js +1 -1
- package/dist/esm/salla-app-install-alert.entry.js +1 -1
- package/dist/esm/salla-apps-icons.entry.js +1 -1
- package/dist/esm/salla-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 +83 -328
- package/dist/esm/salla-cart-coupons.entry.js +1 -1
- package/dist/esm/salla-cart-item-offers_2.entry.js +1 -1
- package/dist/esm/salla-cart-summary-card.entry.js +1 -1
- package/dist/esm/salla-cashback-banner.entry.js +1 -1
- package/dist/esm/salla-comment-factors.entry.js +1 -1
- package/dist/esm/salla-comment-form_8.entry.js +1 -1
- package/dist/esm/salla-conditional-offer.entry.js +1 -1
- package/dist/esm/salla-contacts.entry.js +1 -1
- package/dist/esm/salla-cookies-bar.entry.js +1 -1
- package/dist/esm/salla-count-down.entry.js +1 -1
- package/dist/esm/salla-custom-fields.entry.js +1 -1
- package/dist/esm/salla-delivery-promise.entry.js +21 -5
- 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 +1 -1
- 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 +1 -1
- package/dist/esm/salla-rating-modal-v2.entry.js +1 -1
- package/dist/esm/salla-rating-modal.entry.js +1 -1
- package/dist/esm/salla-review-factors-tags.entry.js +1 -1
- package/dist/esm/salla-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 +1 -1
- package/dist/esm/salla-social.entry.js +1 -1
- package/dist/esm/salla-tab-content_3.entry.js +1 -1
- package/dist/esm/salla-tiered-offer.entry.js +1 -1
- package/dist/esm/salla-tooltip.entry.js +1 -1
- package/dist/esm/salla-trust-badges.entry.js +1 -1
- package/dist/esm/salla-user-menu.entry.js +1 -1
- package/dist/esm/salla-user-profile.entry.js +1 -1
- package/dist/esm/salla-user-settings.entry.js +1 -1
- package/dist/esm/salla-verify.entry.js +1 -1
- package/dist/esm/salla-wallet.entry.js +1 -1
- package/dist/esm/salla-wishlist-actions.entry.js +1 -1
- package/dist/esm/twilight.js +2 -2
- package/dist/esm/{vanilla-picker-BPvYmRRu.js → vanilla-picker-DjLezF11.js} +1 -1
- package/dist/twilight/{p-32ceb30c.entry.js → p-059aee01.entry.js} +1 -1
- package/dist/twilight/{p-7bcd6e69.entry.js → p-073a7157.entry.js} +1 -1
- package/dist/twilight/{p-11347c90.entry.js → p-08a1a73f.entry.js} +1 -1
- package/dist/twilight/{p-25b45505.entry.js → p-0a3643ff.entry.js} +1 -1
- package/dist/twilight/{p-e6090253.entry.js → p-0b692ff6.entry.js} +1 -1
- package/dist/twilight/{p-a49c78f0.entry.js → p-1cdc7df7.entry.js} +1 -1
- package/dist/twilight/{p-58d25433.entry.js → p-215b7413.entry.js} +1 -1
- package/dist/twilight/{p-8d8fe545.entry.js → p-22d83109.entry.js} +1 -1
- package/dist/twilight/{p-8d4fe636.entry.js → p-238159b4.entry.js} +1 -1
- package/dist/twilight/{p-72000ddb.entry.js → p-24c4551f.entry.js} +1 -1
- package/dist/twilight/{p-d16998b0.entry.js → p-2794bed4.entry.js} +1 -1
- package/dist/twilight/{p-17d19645.entry.js → p-2ab14328.entry.js} +1 -1
- package/dist/twilight/{p-1f63a8a3.entry.js → p-2c4142b6.entry.js} +1 -1
- package/dist/twilight/{p-8a12cb3e.entry.js → p-2c9492d1.entry.js} +1 -1
- package/dist/twilight/{p-b13f73f7.entry.js → p-2df9a0f0.entry.js} +1 -1
- package/dist/twilight/{p-7a321b1c.entry.js → p-3296a02a.entry.js} +1 -1
- package/dist/twilight/{p-77391513.entry.js → p-34012a2c.entry.js} +1 -1
- package/dist/twilight/{p-a77540ee.entry.js → p-34a1a53d.entry.js} +1 -1
- package/dist/twilight/{p-8e288b57.entry.js → p-38711460.entry.js} +1 -1
- package/dist/twilight/{p-16c80467.entry.js → p-3a44eb5e.entry.js} +1 -1
- package/dist/twilight/{p-390d4d73.entry.js → p-3cead23a.entry.js} +1 -1
- package/dist/twilight/{p-3282b3a6.entry.js → p-55b6fa95.entry.js} +1 -1
- package/dist/twilight/{p-0df4b2e1.entry.js → p-56582f0b.entry.js} +1 -1
- package/dist/twilight/{p-f1077a6e.entry.js → p-5924286a.entry.js} +1 -1
- package/dist/twilight/{p-21ca76cd.entry.js → p-5b7c6098.entry.js} +1 -1
- package/dist/twilight/{p-b948c4e7.entry.js → p-5cb5b3fd.entry.js} +1 -1
- package/dist/twilight/{p-d9ff0ef8.entry.js → p-5e3b238a.entry.js} +1 -1
- package/dist/twilight/{p-26a4ab4b.entry.js → p-5f369929.entry.js} +1 -1
- package/dist/twilight/{p-ed7597fe.entry.js → p-5f710118.entry.js} +1 -1
- package/dist/twilight/{p-30201fb9.entry.js → p-623a21b4.entry.js} +1 -1
- package/dist/twilight/{p-a89ae474.entry.js → p-625d6454.entry.js} +1 -1
- package/dist/twilight/{p-e6e778d0.entry.js → p-67abcd3f.entry.js} +1 -1
- package/dist/twilight/{p-096b05e7.entry.js → p-6c05a804.entry.js} +1 -1
- package/dist/twilight/{p-4860edc2.entry.js → p-6c44c16d.entry.js} +1 -1
- package/dist/twilight/{p-97ce9cb0.entry.js → p-6e5164d8.entry.js} +1 -1
- package/dist/twilight/{p-dd2f9c7d.entry.js → p-70c4d653.entry.js} +1 -1
- package/dist/twilight/{p-c55ce57e.entry.js → p-71c08a0a.entry.js} +1 -1
- package/dist/twilight/{p-243dc280.entry.js → p-74108ca1.entry.js} +1 -1
- package/dist/twilight/{p-684d6eb1.entry.js → p-75f0e895.entry.js} +1 -1
- package/dist/twilight/{p-b4db2812.entry.js → p-80e5c12c.entry.js} +1 -1
- package/dist/twilight/{p-ac7422d5.entry.js → p-87250079.entry.js} +1 -1
- package/dist/twilight/{p-59c4876b.entry.js → p-88bf1650.entry.js} +1 -1
- package/dist/twilight/{p-42dccb9d.entry.js → p-8b07421d.entry.js} +1 -1
- package/dist/twilight/{p-96f7014a.entry.js → p-8d92b009.entry.js} +1 -1
- package/dist/twilight/{p-4f59ac12.entry.js → p-8fb64951.entry.js} +1 -1
- package/dist/twilight/{p-494948d0.entry.js → p-90bd015d.entry.js} +1 -1
- package/dist/twilight/{p-f1d5bc83.entry.js → p-9223db5a.entry.js} +1 -1
- package/dist/twilight/{p-505ff5ef.entry.js → p-93cd4a1f.entry.js} +1 -1
- package/dist/twilight/{p-06558ec3.entry.js → p-969fbe80.entry.js} +1 -1
- package/dist/twilight/{p-73edafaa.entry.js → p-9748360e.entry.js} +1 -1
- package/dist/twilight/{p-e088823b.entry.js → p-9829a35d.entry.js} +1 -1
- package/dist/twilight/{p-c7f384ba.entry.js → p-993363c6.entry.js} +1 -1
- package/dist/twilight/{p-d4ba3882.entry.js → p-99cc7bc5.entry.js} +1 -1
- package/dist/twilight/{p-82fb654b.entry.js → p-9b9aebca.entry.js} +1 -1
- package/dist/twilight/{p-46e413e3.entry.js → p-9ddd0fac.entry.js} +1 -1
- package/dist/twilight/{p-2996d4b7.entry.js → p-9ec8f2e5.entry.js} +1 -1
- package/dist/twilight/{p-1cfd78ce.entry.js → p-9f595ce2.entry.js} +1 -1
- package/dist/twilight/{p-BQK0M8C7.js → p-B93RJ_yi.js} +1 -1
- package/dist/twilight/p-BDChq2t4.js +4 -0
- package/dist/twilight/{p-BG6uSDFf.js → p-BrGtlWws.js} +1 -1
- package/dist/twilight/{p-B-gnDFoe.js → p-Bt8nb1uS.js} +1 -1
- package/dist/twilight/{p-DXvNz88d.js → p-BtKdrYj5.js} +1 -1
- package/dist/twilight/{p-WLC9KdSz.js → p-CBemP5xi.js} +1 -1
- package/dist/twilight/{p-BimR7cIN.js → p-CJfJMerR.js} +1 -1
- package/dist/twilight/{p-DaGqpYdk.js → p-Dcu3dMye.js} +1 -1
- package/dist/twilight/{p-BqpEp7-e.js → p-DmjaYLNC.js} +1 -1
- package/dist/twilight/{p-B0zeNMnk.js → p-TGGC4EhK.js} +1 -1
- package/dist/twilight/{p-e5f6f36a.entry.js → p-a4c3d3e7.entry.js} +1 -1
- package/dist/twilight/{p-ea05a3b9.entry.js → p-a78ffd28.entry.js} +1 -1
- package/dist/twilight/{p-cdaafc9b.entry.js → p-ace973fb.entry.js} +1 -1
- package/dist/twilight/{p-c2b80e5c.entry.js → p-b4aea704.entry.js} +1 -1
- package/dist/twilight/{p-77ba1fda.entry.js → p-b5db2536.entry.js} +1 -1
- package/dist/twilight/{p-72ae244c.entry.js → p-b61b9a75.entry.js} +1 -1
- package/dist/twilight/{p-930f7101.entry.js → p-b7d98778.entry.js} +1 -1
- package/dist/twilight/p-b8323755.entry.js +4 -0
- package/dist/twilight/{p-4c30313e.entry.js → p-bb9a2f4e.entry.js} +1 -1
- package/dist/twilight/{p-71ced4b7.entry.js → p-bc370fba.entry.js} +1 -1
- package/dist/twilight/{p-c34bf692.entry.js → p-bf0a3c8c.entry.js} +1 -1
- package/dist/twilight/{p-d3ab94f2.entry.js → p-c33a1072.entry.js} +1 -1
- package/dist/twilight/{p-29cddb02.entry.js → p-c897cbe7.entry.js} +1 -1
- package/dist/twilight/{p-7763e0be.entry.js → p-cce7acc0.entry.js} +1 -1
- package/dist/twilight/{p-a08fb92b.entry.js → p-cec395cd.entry.js} +1 -1
- package/dist/twilight/{p-e50e92d4.entry.js → p-d0f0f19a.entry.js} +1 -1
- package/dist/twilight/{p-495b632f.entry.js → p-d1fccce6.entry.js} +1 -1
- package/dist/twilight/{p-5c51b1a6.entry.js → p-d3e729ab.entry.js} +1 -1
- package/dist/twilight/{p-6413aff2.entry.js → p-d6d94ebb.entry.js} +1 -1
- package/dist/twilight/{p-c21a156c.entry.js → p-d72c765c.entry.js} +1 -1
- package/dist/twilight/{p-53735832.entry.js → p-dac4fe78.entry.js} +1 -1
- package/dist/twilight/{p-09848b04.entry.js → p-ddecbb55.entry.js} +1 -1
- package/dist/twilight/{p-61eeadbb.entry.js → p-df6ce40c.entry.js} +1 -1
- package/dist/twilight/{p-de002b09.entry.js → p-e33bfb84.entry.js} +1 -1
- package/dist/twilight/{p-6794c97c.entry.js → p-e3923ba1.entry.js} +1 -1
- package/dist/twilight/{p-cc80d691.entry.js → p-eac3ee6a.entry.js} +1 -1
- package/dist/twilight/p-ec7efed0.entry.js +1024 -0
- package/dist/twilight/{p-7bb14e7b.entry.js → p-ef5bacc9.entry.js} +1 -1
- package/dist/twilight/{p-7d24fc33.entry.js → p-ef6b8ec8.entry.js} +1 -1
- package/dist/twilight/{p-268a3562.entry.js → p-eff31185.entry.js} +1 -1
- package/dist/twilight/{p-a9db1142.entry.js → p-f41a7693.entry.js} +1 -1
- package/dist/twilight/{p-ca56bdf4.entry.js → p-f5ea8c80.entry.js} +1 -1
- package/dist/twilight/{p-ce868465.entry.js → p-f929dfb2.entry.js} +1 -1
- package/dist/twilight/{p-6972d948.entry.js → p-fae07fdb.entry.js} +1 -1
- package/dist/twilight/{p-33a9c78a.entry.js → p-fe1c9edd.entry.js} +1 -1
- package/dist/twilight/{p-Cv-hXjUb.js → p-iAQXgb97.js} +1 -1
- package/dist/twilight/twilight.esm.js +1 -1
- package/dist/types/components/salla-bullet-delivery/helpers.d.ts +1 -0
- package/dist/types/components/salla-bullet-delivery/interfaces.d.ts +14 -4
- package/dist/types/components/salla-bullet-delivery/salla-bullet-delivery.d.ts +2 -0
- package/dist/types/components/salla-delivery-promise/delivery-promise-intent.d.ts +0 -4
- package/dist/types/components/salla-delivery-promise/interfaces.d.ts +2 -1
- package/package.json +5 -5
- package/dist/twilight/p-7c61baf1.entry.js +0 -4
- package/dist/twilight/p-ec0d05d5.entry.js +0 -1019
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
4
|
import { proxyCustomElement, HTMLElement as HTMLElement$1, createEvent, h as h$4, Host } from '@stencil/core/internal/client';
|
|
5
|
+
import { i as isSaudiArabia, b as bulletDeliveryAPI, r as requireRegionAndDistrictForSA, g as getIntentLatitude, a as getIntentLongitude, h as hasSessionAddressIntent, c as getIntentCityId, d as getIntentCountryId, e as getIntentRegionId, f as getIntentDistrictId, j as filterBranches, k as findNearestBranch, l as getGeolocationErrorMessage, m as buildAddressLocationPayloadFromSelection, n as clearApiCache, o as getIntentSubtitle, p as getIntentBranchId, q as isMapOriginIntent, s as isBranchSelectable, t as getIntentCountryCode } from './helpers.js';
|
|
5
6
|
import { S as SILocation } from './location.js';
|
|
6
7
|
import { S as Search } from './search.js';
|
|
7
8
|
import { d as defineCustomElement$7 } from './salla-button2.js';
|
|
@@ -11,318 +12,6 @@ import { d as defineCustomElement$4 } from './salla-placeholder2.js';
|
|
|
11
12
|
import { d as defineCustomElement$3 } from './salla-searchable-dropdown2.js';
|
|
12
13
|
import { d as defineCustomElement$2 } from './salla-skeleton2.js';
|
|
13
14
|
|
|
14
|
-
/**
|
|
15
|
-
* API Service for salla-bullet-delivery component
|
|
16
|
-
* Uses Salla's shipping API and scope API for delivery location management
|
|
17
|
-
*/
|
|
18
|
-
const API_LOG_PREFIX = 'BulletDeliveryAPI';
|
|
19
|
-
const validId = (id) => {
|
|
20
|
-
const n = id == null ? Number.NaN : Number(id);
|
|
21
|
-
return !Number.isNaN(n) && n !== 0;
|
|
22
|
-
};
|
|
23
|
-
async function withApiErrorHandling(fn, fallback, logLabel) {
|
|
24
|
-
try {
|
|
25
|
-
return await fn();
|
|
26
|
-
}
|
|
27
|
-
catch (error) {
|
|
28
|
-
console.error(`${API_LOG_PREFIX}: ${logLabel}`, error);
|
|
29
|
-
return fallback;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
const apiCache = new Map();
|
|
33
|
-
const CACHE_TTL = 5 * 60 * 1000;
|
|
34
|
-
function getCached(key) {
|
|
35
|
-
const entry = apiCache.get(key);
|
|
36
|
-
if (!entry || Date.now() - entry.timestamp > CACHE_TTL) {
|
|
37
|
-
apiCache.delete(key);
|
|
38
|
-
return null;
|
|
39
|
-
}
|
|
40
|
-
return entry.data;
|
|
41
|
-
}
|
|
42
|
-
function setCache(key, data) {
|
|
43
|
-
apiCache.set(key, { data, timestamp: Date.now() });
|
|
44
|
-
}
|
|
45
|
-
/** Uses country code from API (e.g. 'SA'). */
|
|
46
|
-
const isSaudiArabia = (countryCode) => String(countryCode).toUpperCase() === 'SA';
|
|
47
|
-
/**
|
|
48
|
-
* Fast Delivery API Service
|
|
49
|
-
* Uses Salla's shipping API and scopes API. Branch and address data are used as returned by the API (no mapping).
|
|
50
|
-
*/
|
|
51
|
-
const bulletDeliveryAPI = {
|
|
52
|
-
/**
|
|
53
|
-
* Get available countries from Salla shipping API
|
|
54
|
-
* @param forBranch - when true, use for_branch=1 (e.g. for pickup/branches tab)
|
|
55
|
-
*/
|
|
56
|
-
async getCountries(forBranch = false, query) {
|
|
57
|
-
const cacheKey = !query?.trim() ? `countries_${forBranch ? 1 : 0}` : null;
|
|
58
|
-
if (cacheKey) {
|
|
59
|
-
const cached = getCached(cacheKey);
|
|
60
|
-
if (cached)
|
|
61
|
-
return cached;
|
|
62
|
-
}
|
|
63
|
-
const result = await withApiErrorHandling(async () => {
|
|
64
|
-
const params = { for_branch: forBranch ? 1 : 0 };
|
|
65
|
-
if (forBranch) {
|
|
66
|
-
params.for_allocation = 1;
|
|
67
|
-
}
|
|
68
|
-
if (query?.trim())
|
|
69
|
-
params.query = query.trim();
|
|
70
|
-
const data = (await salla.api.request("shipping/countries", { params }))?.data ?? [];
|
|
71
|
-
return data.map((c) => ({ id: c.id, code: c.code, name: c.name, has_regions: isSaudiArabia(c.code) }));
|
|
72
|
-
}, [], 'Error getting countries');
|
|
73
|
-
if (cacheKey && result.length > 0)
|
|
74
|
-
setCache(cacheKey, result);
|
|
75
|
-
return result;
|
|
76
|
-
},
|
|
77
|
-
/**
|
|
78
|
-
* Get regions for a country from Salla shipping API
|
|
79
|
-
* Endpoint: GET /shipping/countries/<COUNTRY_ID>/region
|
|
80
|
-
*/
|
|
81
|
-
async getRegions(countryId, query) {
|
|
82
|
-
if (!validId(countryId)) {
|
|
83
|
-
console.warn(`${API_LOG_PREFIX}: getRegions called without valid country_id`);
|
|
84
|
-
return [];
|
|
85
|
-
}
|
|
86
|
-
const cacheKey = !query?.trim() ? `regions_${countryId}` : null;
|
|
87
|
-
if (cacheKey) {
|
|
88
|
-
const cached = getCached(cacheKey);
|
|
89
|
-
if (cached)
|
|
90
|
-
return cached;
|
|
91
|
-
}
|
|
92
|
-
const result = await withApiErrorHandling(async () => {
|
|
93
|
-
const params = {};
|
|
94
|
-
if (query?.trim())
|
|
95
|
-
params.query = query.trim();
|
|
96
|
-
const data = (await salla.api.request(`shipping/countries/${countryId}/regions`, { params }))?.data ?? [];
|
|
97
|
-
return data.map((r) => ({ id: r.id, name: r.name, code: r.code, country_id: Number(countryId) }));
|
|
98
|
-
}, [], 'Error fetching regions');
|
|
99
|
-
if (cacheKey && result.length > 0)
|
|
100
|
-
setCache(cacheKey, result);
|
|
101
|
-
return result;
|
|
102
|
-
},
|
|
103
|
-
/**
|
|
104
|
-
* Get cities from Salla shipping API
|
|
105
|
-
* @param regionId - Optional; when provided (e.g. for SA), cities are filtered by region
|
|
106
|
-
*/
|
|
107
|
-
async getCities(countryId, regionId, query) {
|
|
108
|
-
if (!validId(countryId)) {
|
|
109
|
-
console.warn(`${API_LOG_PREFIX}: getCities called without valid country_id`);
|
|
110
|
-
return [];
|
|
111
|
-
}
|
|
112
|
-
const cacheKey = !query?.trim() ? `cities_${countryId}_${regionId || 'all'}` : null;
|
|
113
|
-
if (cacheKey) {
|
|
114
|
-
const cached = getCached(cacheKey);
|
|
115
|
-
if (cached)
|
|
116
|
-
return cached;
|
|
117
|
-
}
|
|
118
|
-
const result = await withApiErrorHandling(async () => {
|
|
119
|
-
const params = { for_branch: 0, country_id: countryId };
|
|
120
|
-
if (regionId)
|
|
121
|
-
params.region_id = regionId;
|
|
122
|
-
if (query?.trim())
|
|
123
|
-
params.query = query.trim();
|
|
124
|
-
const data = (await salla.api.request("shipping/cities", { params }))?.data ?? [];
|
|
125
|
-
return data.map((c) => ({ id: c.id, name: c.name, country_id: countryId, ...(c.region_id != null && { region_id: c.region_id }) }));
|
|
126
|
-
}, [], 'Error fetching cities');
|
|
127
|
-
if (cacheKey && result.length > 0)
|
|
128
|
-
setCache(cacheKey, result);
|
|
129
|
-
return result;
|
|
130
|
-
},
|
|
131
|
-
/**
|
|
132
|
-
* Get districts from Salla shipping API
|
|
133
|
-
*/
|
|
134
|
-
async getDistricts(cityId, query) {
|
|
135
|
-
if (!validId(cityId)) {
|
|
136
|
-
console.warn(`${API_LOG_PREFIX}: getDistricts called without valid city_id`);
|
|
137
|
-
return [];
|
|
138
|
-
}
|
|
139
|
-
return withApiErrorHandling(async () => {
|
|
140
|
-
const params = { for_branch: 0, city_id: cityId };
|
|
141
|
-
if (query?.trim())
|
|
142
|
-
params.query = query.trim();
|
|
143
|
-
const raw = (await salla.api.request("shipping/districts", { params }))?.data;
|
|
144
|
-
const list = Array.isArray(raw) ? raw : (Array.isArray(raw?.districts) ? raw.districts : []);
|
|
145
|
-
return list.map((d) => ({ id: d.id, name: d.name, name_en: d.name_en, city_id: cityId }));
|
|
146
|
-
}, [], 'Error fetching districts');
|
|
147
|
-
},
|
|
148
|
-
async getSavedAddresses() {
|
|
149
|
-
return withApiErrorHandling(async () => {
|
|
150
|
-
const data = (await salla.api.request("address"))?.data;
|
|
151
|
-
return Array.isArray(data) ? data : [];
|
|
152
|
-
}, [], 'Error fetching user addresses');
|
|
153
|
-
},
|
|
154
|
-
async getBranches({ query, lat, lng, country_id, per_page = 20 } = {}) {
|
|
155
|
-
const hasSearchParams = query?.trim()?.length >= 2 || lat || lng;
|
|
156
|
-
const cacheKey = !hasSearchParams && country_id ? `branches_${country_id}` : null;
|
|
157
|
-
if (cacheKey) {
|
|
158
|
-
const cached = getCached(cacheKey);
|
|
159
|
-
if (cached)
|
|
160
|
-
return cached;
|
|
161
|
-
}
|
|
162
|
-
const result = await withApiErrorHandling(async () => {
|
|
163
|
-
const params = { per_page };
|
|
164
|
-
if (query?.trim().length >= 2)
|
|
165
|
-
params.query = query;
|
|
166
|
-
if (lat)
|
|
167
|
-
params.lat = lat;
|
|
168
|
-
if (lng)
|
|
169
|
-
params.lng = lng;
|
|
170
|
-
if (country_id)
|
|
171
|
-
params.country_id = country_id;
|
|
172
|
-
const res = await salla.api.request("branches", { params });
|
|
173
|
-
return (Array.isArray(res?.data) ? res.data : []);
|
|
174
|
-
}, [], 'Error fetching branches');
|
|
175
|
-
if (cacheKey && result.length > 0)
|
|
176
|
-
setCache(cacheKey, result);
|
|
177
|
-
return result;
|
|
178
|
-
},
|
|
179
|
-
async saveAddressLocation(payload) {
|
|
180
|
-
return withApiErrorHandling(async () => {
|
|
181
|
-
const res = await salla.api.request('address/location', { ...payload, for_allocation: true }, 'post');
|
|
182
|
-
const data = res?.data ?? res;
|
|
183
|
-
const address = typeof data === 'object' && data != null && 'id' in data ? data : undefined;
|
|
184
|
-
return { success: true, address };
|
|
185
|
-
}, { success: false }, 'Error saving address/location');
|
|
186
|
-
},
|
|
187
|
-
async setDeliveryScope(scopeId) {
|
|
188
|
-
return withApiErrorHandling(async () => {
|
|
189
|
-
await salla.api.withoutNotifier(() => salla.scope.change({ id: scopeId }));
|
|
190
|
-
salla.storage.set("scope", { ...(salla.storage.get("scope") || {}), id: scopeId });
|
|
191
|
-
return true;
|
|
192
|
-
}, false, 'Error setting delivery scope');
|
|
193
|
-
},
|
|
194
|
-
async allocateScope(payload) {
|
|
195
|
-
const errMsg = (d) => d?.error?.message ?? d?.message ?? 'Failed to allocate scope';
|
|
196
|
-
try {
|
|
197
|
-
const response = await salla.api.withoutNotifier(() => salla.api.request("scopes/allocation", payload, 'post'));
|
|
198
|
-
// SDK resolves with { data } and throws on non-2xx; any resolved value is success
|
|
199
|
-
const data = response?.data ?? response;
|
|
200
|
-
return { success: true, data: data };
|
|
201
|
-
}
|
|
202
|
-
catch (error) {
|
|
203
|
-
console.error(`${API_LOG_PREFIX}: Error allocating scope`, error);
|
|
204
|
-
const err = error;
|
|
205
|
-
return { success: false, error: err?.response?.data != null ? errMsg(err.response.data) : (err?.message ?? 'Unknown error') };
|
|
206
|
-
}
|
|
207
|
-
},
|
|
208
|
-
async getAddressToken() {
|
|
209
|
-
return withApiErrorHandling(async () => {
|
|
210
|
-
const res = await salla.api.request('address/autocomplete-token');
|
|
211
|
-
return res?.data?.token ?? null;
|
|
212
|
-
}, null, 'Error fetching address autocomplete token');
|
|
213
|
-
},
|
|
214
|
-
};
|
|
215
|
-
function clearApiCache() {
|
|
216
|
-
apiCache.clear();
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
/**
|
|
220
|
-
* Helper functions for salla-bullet-delivery component
|
|
221
|
-
*/
|
|
222
|
-
const EARTH_RADIUS_KM = 6371;
|
|
223
|
-
const deg2rad = (deg) => deg * (Math.PI / 180);
|
|
224
|
-
/** Haversine distance in km */
|
|
225
|
-
function calculateDistance(lat1, lon1, lat2, lon2) {
|
|
226
|
-
const dLat = deg2rad(lat2 - lat1);
|
|
227
|
-
const dLon = deg2rad(lon2 - lon1);
|
|
228
|
-
const a = Math.sin(dLat / 2) ** 2 +
|
|
229
|
-
Math.cos(deg2rad(lat1)) * Math.cos(deg2rad(lat2)) * Math.sin(dLon / 2) ** 2;
|
|
230
|
-
return EARTH_RADIUS_KM * 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
|
|
231
|
-
}
|
|
232
|
-
/**
|
|
233
|
-
* Whether a pickup branch can be selected.
|
|
234
|
-
*
|
|
235
|
-
* `pickup_readiness` is the richer, backend-computed verdict (INV-357) and wins whenever the API
|
|
236
|
-
* sends it. Not every store's `GET /branches` returns it though, so we fall back to the original
|
|
237
|
-
* `is_open` rule instead of treating a missing object as "not selectable" — otherwise every branch
|
|
238
|
-
* in the list renders disabled and pickup cannot be chosen at all (SP-22202).
|
|
239
|
-
*/
|
|
240
|
-
const isBranchSelectable = (branch) => {
|
|
241
|
-
if (!branch)
|
|
242
|
-
return false;
|
|
243
|
-
const selectable = branch.pickup_readiness?.selectable;
|
|
244
|
-
return typeof selectable === 'boolean' ? selectable : branch.is_open !== false;
|
|
245
|
-
};
|
|
246
|
-
/** Nearest available branch by distance; single pass O(n). */
|
|
247
|
-
function findNearestBranch(branches, userLat, userLon) {
|
|
248
|
-
let nearest = null;
|
|
249
|
-
let minD = Number.POSITIVE_INFINITY;
|
|
250
|
-
for (const b of branches) {
|
|
251
|
-
const lat = b.location?.lat != null ? Number(b.location.lat) : Number.NaN;
|
|
252
|
-
const lng = b.location?.lng != null ? Number(b.location.lng) : Number.NaN;
|
|
253
|
-
if (Number.isNaN(lat) || Number.isNaN(lng) || b.is_open === false)
|
|
254
|
-
continue;
|
|
255
|
-
const d = calculateDistance(userLat, userLon, lat, lng);
|
|
256
|
-
if (d < minD) {
|
|
257
|
-
minD = d;
|
|
258
|
-
nearest = b;
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
return nearest;
|
|
262
|
-
}
|
|
263
|
-
const filterBranches = (branches, searchQuery) => {
|
|
264
|
-
if (!searchQuery)
|
|
265
|
-
return branches;
|
|
266
|
-
const q = searchQuery.toLowerCase();
|
|
267
|
-
return branches.filter((b) => b.name.toLowerCase().includes(q) || b.city?.name?.toLowerCase().includes(q));
|
|
268
|
-
};
|
|
269
|
-
const getIntentSubtitle = (intent, toAddress, fromBranch) => {
|
|
270
|
-
if (intent.type === 'branch') {
|
|
271
|
-
const loc = intent.branch_details?.city ?? intent.branch_details?.name;
|
|
272
|
-
return loc ? `${fromBranch} ${loc}`.trim() : '';
|
|
273
|
-
}
|
|
274
|
-
if (intent.type === 'address' && intent.address_details) {
|
|
275
|
-
const addr = [intent.address_details.district?.name, intent.address_details.city?.name, intent.address_details.country?.name].filter(Boolean).join('، ') || intent.address_details.short_address || '';
|
|
276
|
-
return addr ? `${toAddress} ${addr}`.trim() : '';
|
|
277
|
-
}
|
|
278
|
-
return '';
|
|
279
|
-
};
|
|
280
|
-
const idFrom = (val) => (val != null ? Number(val) : undefined);
|
|
281
|
-
const getIntentCountryId = (i) => idFrom(i?.address_details?.country?.id);
|
|
282
|
-
const getIntentCountryCode = (i) => i?.country_code ?? i?.address_details?.country?.code ?? '';
|
|
283
|
-
const getIntentRegionId = (i) => idFrom(i?.address_details?.region?.id);
|
|
284
|
-
const getIntentCityId = (i) => idFrom(i?.address_details?.city?.id);
|
|
285
|
-
const getIntentDistrictId = (i) => idFrom(i?.address_details?.district?.id);
|
|
286
|
-
const getIntentBranchId = (i) => i?.branch_details?.id;
|
|
287
|
-
/** Intent coordinates (branch tab only; address flow no longer uses coordinates). */
|
|
288
|
-
const getIntentLatitude = (i) => i?.branch_details?.latitude;
|
|
289
|
-
const getIntentLongitude = (i) => i?.branch_details?.longitude;
|
|
290
|
-
const hasSessionAddressIntent = (intent) => {
|
|
291
|
-
if (!intent || intent.type !== 'address' || intent.address_id)
|
|
292
|
-
return false;
|
|
293
|
-
const c = getIntentCountryId(intent);
|
|
294
|
-
const city = getIntentCityId(intent);
|
|
295
|
-
const d = getIntentDistrictId(intent);
|
|
296
|
-
const code = getIntentCountryCode(intent);
|
|
297
|
-
const hasDistrictId = d != null && Number(d) !== 0;
|
|
298
|
-
const hasDistrictName = Boolean(intent.address_details?.district?.name?.trim());
|
|
299
|
-
const districtOk = !isSaudiArabia(code) || hasDistrictId || hasDistrictName;
|
|
300
|
-
return !!(c && city && districtOk);
|
|
301
|
-
};
|
|
302
|
-
const requireRegionAndDistrictForSA = (countryCode, regionId, districtIdOrName) => !countryCode || !isSaudiArabia(countryCode)
|
|
303
|
-
? true
|
|
304
|
-
: (regionId != null && Number(regionId) !== 0) && (districtIdOrName != null && (typeof districtIdOrName === 'number' ? districtIdOrName !== 0 : String(districtIdOrName).trim().length > 0));
|
|
305
|
-
function buildAddressLocationPayloadFromSelection(options) {
|
|
306
|
-
const { countryId, countryCode, regionId, cityId, districtId, description = '', lat, lng, shortAddress } = options;
|
|
307
|
-
const desc = description || '';
|
|
308
|
-
return {
|
|
309
|
-
country_id: Number(countryId) || undefined,
|
|
310
|
-
region_id: regionId != null ? Number(regionId) : undefined,
|
|
311
|
-
city_id: cityId != null ? Number(cityId) : undefined,
|
|
312
|
-
district_id: districtId != null ? Number(districtId) : undefined,
|
|
313
|
-
description: desc,
|
|
314
|
-
...(countryCode && isSaudiArabia(countryCode) && { local: desc }),
|
|
315
|
-
...(lat != null && lng != null && { lat, lng }),
|
|
316
|
-
...(shortAddress && { short_address: shortAddress }),
|
|
317
|
-
};
|
|
318
|
-
}
|
|
319
|
-
const GEO_ERROR_MESSAGES = {
|
|
320
|
-
[GeolocationPositionError.PERMISSION_DENIED]: 'Location permission denied',
|
|
321
|
-
[GeolocationPositionError.POSITION_UNAVAILABLE]: 'Location unavailable',
|
|
322
|
-
[GeolocationPositionError.TIMEOUT]: 'Location timeout',
|
|
323
|
-
};
|
|
324
|
-
const getGeolocationErrorMessage = (errorCode) => GEO_ERROR_MESSAGES[errorCode] ?? 'An error occurred while detecting location';
|
|
325
|
-
|
|
326
15
|
/**
|
|
327
16
|
* @license
|
|
328
17
|
* Copyright 2019 Google LLC
|
|
@@ -5816,6 +5505,9 @@ const SallaBulletDelivery$1 = /*@__PURE__*/ proxyCustomElement(class SallaBullet
|
|
|
5816
5505
|
? `${address.district.name}، ${address.city.name}`
|
|
5817
5506
|
: (address.city?.name ?? "");
|
|
5818
5507
|
}
|
|
5508
|
+
else if (this.isGuestMapPick) {
|
|
5509
|
+
locationText = result.address_details?.formatted_address ?? "";
|
|
5510
|
+
}
|
|
5819
5511
|
else if (this.selectedCity) {
|
|
5820
5512
|
locationText = this.selectedDistrict
|
|
5821
5513
|
? `${this.selectedDistrict.name}، ${this.selectedCity.name}`
|
|
@@ -5824,11 +5516,14 @@ const SallaBulletDelivery$1 = /*@__PURE__*/ proxyCustomElement(class SallaBullet
|
|
|
5824
5516
|
else if (result.address_details) {
|
|
5825
5517
|
const parts = [
|
|
5826
5518
|
result.address_details.district?.name,
|
|
5827
|
-
result.address_details.city
|
|
5828
|
-
result.address_details.country
|
|
5519
|
+
result.address_details.city?.name,
|
|
5520
|
+
result.address_details.country?.name,
|
|
5829
5521
|
].filter(Boolean);
|
|
5830
5522
|
locationText =
|
|
5831
|
-
parts.join("، ") ||
|
|
5523
|
+
parts.join("، ") ||
|
|
5524
|
+
result.address_details.formatted_address ||
|
|
5525
|
+
result.address_details.short_address ||
|
|
5526
|
+
"";
|
|
5832
5527
|
}
|
|
5833
5528
|
}
|
|
5834
5529
|
else if (branch) {
|
|
@@ -6104,6 +5799,10 @@ const SallaBulletDelivery$1 = /*@__PURE__*/ proxyCustomElement(class SallaBullet
|
|
|
6104
5799
|
get isMapModeAvailable() {
|
|
6105
5800
|
return this.isMapSettingEnabled && !!salla.config.get('store.settings.keys.maps') && !!this.addressToken;
|
|
6106
5801
|
}
|
|
5802
|
+
/** Guest is in map mode and has already dropped a pin (as opposed to still using the dropdowns). */
|
|
5803
|
+
get isGuestMapPick() {
|
|
5804
|
+
return !this.isLoggedIn && this.isMapModeAvailable && this.hasMapLocation();
|
|
5805
|
+
}
|
|
6107
5806
|
/** Center shown before geolocation resolves — the customer's IP-based default (falls back to Riyadh). */
|
|
6108
5807
|
get mapInitialCenter() {
|
|
6109
5808
|
const geo = salla.config.get('user.default_geo_location');
|
|
@@ -6244,6 +5943,10 @@ const SallaBulletDelivery$1 = /*@__PURE__*/ proxyCustomElement(class SallaBullet
|
|
|
6244
5943
|
if (this.isLoggedIn && this.selectedSavedAddress) {
|
|
6245
5944
|
return this.selectedSavedAddress.is_in_coverage === false;
|
|
6246
5945
|
}
|
|
5946
|
+
// Guest map pick: a pin is the only requirement, independent of any incidental dropdown state.
|
|
5947
|
+
if (!this.isLoggedIn && this.isMapModeAvailable) {
|
|
5948
|
+
return !this.isGuestMapPick;
|
|
5949
|
+
}
|
|
6247
5950
|
// Guest: require country + city; for SA require region + district
|
|
6248
5951
|
if (!this.selectedCountry || !this.selectedCity)
|
|
6249
5952
|
return true;
|
|
@@ -6269,9 +5972,26 @@ const SallaBulletDelivery$1 = /*@__PURE__*/ proxyCustomElement(class SallaBullet
|
|
|
6269
5972
|
resolve();
|
|
6270
5973
|
}
|
|
6271
5974
|
buildIntentAddress() {
|
|
6272
|
-
if (this.activeTab !== "address"
|
|
6273
|
-
|
|
6274
|
-
|
|
5975
|
+
if (this.activeTab !== "address")
|
|
5976
|
+
return undefined;
|
|
5977
|
+
if (this.isGuestMapPick && this.mapLocationData) {
|
|
5978
|
+
const { lat, lng, formattedAddress, shortAddress } = this.mapLocationData;
|
|
5979
|
+
return {
|
|
5980
|
+
country: this.selectedCountry
|
|
5981
|
+
? {
|
|
5982
|
+
id: this.selectedCountry.id,
|
|
5983
|
+
name: this.selectedCountry.name,
|
|
5984
|
+
code: this.selectedCountry.code,
|
|
5985
|
+
}
|
|
5986
|
+
: undefined,
|
|
5987
|
+
lat,
|
|
5988
|
+
lng,
|
|
5989
|
+
formatted_address: formattedAddress,
|
|
5990
|
+
place_id: shortAddress,
|
|
5991
|
+
description: this.addressDescription?.trim() || undefined,
|
|
5992
|
+
};
|
|
5993
|
+
}
|
|
5994
|
+
if (!this.selectedCountry || !this.selectedCity) {
|
|
6275
5995
|
return undefined;
|
|
6276
5996
|
}
|
|
6277
5997
|
const country = {
|
|
@@ -6350,6 +6070,9 @@ const SallaBulletDelivery$1 = /*@__PURE__*/ proxyCustomElement(class SallaBullet
|
|
|
6350
6070
|
district_name: this.districtName?.trim() || undefined,
|
|
6351
6071
|
short_address: selectedAddress?.short_address ?? this.selectedSavedAddress?.short_address,
|
|
6352
6072
|
form_data: { ...this.newAddressForm },
|
|
6073
|
+
lat: this.mapLocationData?.lat,
|
|
6074
|
+
lng: this.mapLocationData?.lng,
|
|
6075
|
+
formatted_address: this.mapLocationData?.formattedAddress,
|
|
6353
6076
|
};
|
|
6354
6077
|
}
|
|
6355
6078
|
/**
|
|
@@ -6557,6 +6280,13 @@ const SallaBulletDelivery$1 = /*@__PURE__*/ proxyCustomElement(class SallaBullet
|
|
|
6557
6280
|
}
|
|
6558
6281
|
else {
|
|
6559
6282
|
result.address_details = this.buildIntentAddress();
|
|
6283
|
+
if (this.isGuestMapPick) {
|
|
6284
|
+
// Guest + map pin: defer to login instead of the blocked guest allocation (422, SHPD-9558).
|
|
6285
|
+
this.setStoredIntent(result);
|
|
6286
|
+
this.confirmBtn?.stop();
|
|
6287
|
+
this.handleLogin();
|
|
6288
|
+
return;
|
|
6289
|
+
}
|
|
6560
6290
|
}
|
|
6561
6291
|
}
|
|
6562
6292
|
else {
|
|
@@ -6575,7 +6305,7 @@ const SallaBulletDelivery$1 = /*@__PURE__*/ proxyCustomElement(class SallaBullet
|
|
|
6575
6305
|
};
|
|
6576
6306
|
}
|
|
6577
6307
|
else {
|
|
6578
|
-
// Case 1: Guest user or logged-in user without saved address
|
|
6308
|
+
// Case 1: Guest user (dropdown selection) or logged-in user without saved address
|
|
6579
6309
|
allocationPayload = {
|
|
6580
6310
|
type: "address",
|
|
6581
6311
|
country_id: String(this.selectedCountry?.id || 0),
|
|
@@ -6812,6 +6542,28 @@ const SallaBulletDelivery$1 = /*@__PURE__*/ proxyCustomElement(class SallaBullet
|
|
|
6812
6542
|
*/
|
|
6813
6543
|
async saveSessionAddressToProfile() {
|
|
6814
6544
|
const intent = this.getStoredIntent();
|
|
6545
|
+
if (isMapOriginIntent(intent)) {
|
|
6546
|
+
const details = intent.address_details;
|
|
6547
|
+
const payload = {
|
|
6548
|
+
lat: details.lat,
|
|
6549
|
+
lng: details.lng,
|
|
6550
|
+
...(details.place_id && { short_address: details.place_id }),
|
|
6551
|
+
...(details.description && { description: details.description }),
|
|
6552
|
+
};
|
|
6553
|
+
try {
|
|
6554
|
+
const { success, address } = await bulletDeliveryAPI.saveAddressLocation(payload);
|
|
6555
|
+
if (!success || !address)
|
|
6556
|
+
return null;
|
|
6557
|
+
// Persist address_id immediately to avoid duplicate creation on retry.
|
|
6558
|
+
this.setStoredIntent({ ...intent, address_id: address.id });
|
|
6559
|
+
this.addressCreated.emit({ address });
|
|
6560
|
+
return address;
|
|
6561
|
+
}
|
|
6562
|
+
catch (error) {
|
|
6563
|
+
console.error("SallaBulletDelivery: Error saving session address (map)", error);
|
|
6564
|
+
return null;
|
|
6565
|
+
}
|
|
6566
|
+
}
|
|
6815
6567
|
const countryId = getIntentCountryId(intent);
|
|
6816
6568
|
const cityId = getIntentCityId(intent);
|
|
6817
6569
|
const districtId = getIntentDistrictId(intent);
|
|
@@ -6855,12 +6607,15 @@ const SallaBulletDelivery$1 = /*@__PURE__*/ proxyCustomElement(class SallaBullet
|
|
|
6855
6607
|
}
|
|
6856
6608
|
const intent = this.getStoredIntent();
|
|
6857
6609
|
const hasSessionAddress = hasSessionAddressIntent(intent);
|
|
6610
|
+
const isMapSession = isMapOriginIntent(intent);
|
|
6858
6611
|
const sessionLine1 = hasSessionAddress && intent?.address_details
|
|
6859
|
-
?
|
|
6860
|
-
.
|
|
6861
|
-
.
|
|
6612
|
+
? isMapSession
|
|
6613
|
+
? (intent.address_details.formatted_address ?? "")
|
|
6614
|
+
: [intent.address_details.city?.name, intent.address_details.country?.name]
|
|
6615
|
+
.filter(Boolean)
|
|
6616
|
+
.join("، ") || ""
|
|
6862
6617
|
: "";
|
|
6863
|
-
const sessionLine2 = hasSessionAddress && intent?.address_details
|
|
6618
|
+
const sessionLine2 = hasSessionAddress && intent?.address_details && !isMapSession
|
|
6864
6619
|
? (intent.address_details.district?.name ?? "").trim()
|
|
6865
6620
|
: "";
|
|
6866
6621
|
if (this.savedAddresses.length === 0 && !hasSessionAddress) {
|
|
@@ -6956,7 +6711,7 @@ const SallaBulletDelivery$1 = /*@__PURE__*/ proxyCustomElement(class SallaBullet
|
|
|
6956
6711
|
const isConfirmStep = this.mapStep === 'confirm' && hasMapLoc;
|
|
6957
6712
|
const canAdvanceToConfirm = this.canConfirmMapLocation();
|
|
6958
6713
|
const submitLabel = isConfirmStep
|
|
6959
|
-
? (this.
|
|
6714
|
+
? (this.confirming
|
|
6960
6715
|
? Salla.lang.get("pages.checkout.loading")
|
|
6961
6716
|
: Salla.lang.get("pages.checkout.confirm_address"))
|
|
6962
6717
|
: Salla.lang.get('pages.checkout.confirm_location');
|
|
@@ -6966,9 +6721,9 @@ const SallaBulletDelivery$1 = /*@__PURE__*/ proxyCustomElement(class SallaBullet
|
|
|
6966
6721
|
this.mapStep = 'confirm';
|
|
6967
6722
|
return;
|
|
6968
6723
|
}
|
|
6969
|
-
this.
|
|
6724
|
+
this.handleConfirm();
|
|
6970
6725
|
};
|
|
6971
|
-
return (h$4("form", { onSubmit: handleSubmit }, this.renderGuestDeliveryForm(), h$4("div", { class: "s-bullet-delivery-form-actions s-bullet-delivery-form-actions--single", style: { padding: '24px' } }, h$4("salla-button", { type: "submit", loading: this.
|
|
6726
|
+
return (h$4("form", { onSubmit: handleSubmit }, this.renderGuestDeliveryForm(), h$4("div", { class: "s-bullet-delivery-form-actions s-bullet-delivery-form-actions--single", style: { padding: '24px' } }, h$4("salla-button", { type: "submit", loading: this.confirming, disabled: isConfirmStep ? this.confirming : !canAdvanceToConfirm, width: "wide" }, submitLabel), !this.isLoggedIn && (h$4("button", { type: "button", class: "s-bullet-delivery-login-prompt", onClick: () => this.handleLogin() }, Salla.lang.get('pages.checkout.login_to_use_saved_addresses'))))));
|
|
6972
6727
|
}
|
|
6973
6728
|
renderBranchSearch() {
|
|
6974
6729
|
return (h$4("div", { class: "s-bullet-delivery-branch-search" }, h$4("div", { class: "s-bullet-delivery-search-row" }, h$4("div", { class: "s-bullet-delivery-search s-bullet-delivery-branch-search-wrap" }, h$4("span", { class: "s-bullet-delivery-search-icon s-bullet-delivery-branch-search-icon", innerHTML: Search, "aria-hidden": "true" }), h$4("input", { type: "text", class: "s-bullet-delivery-branch-search-input form-input", placeholder: Salla.lang.get("pages.checkout.search_for_city_or_branch"), value: this.branchSearchQuery, onInput: (e) => this.handleBranchSearch(e), autocomplete: "off" })), h$4("button", { type: "button", class: {
|
|
@@ -7063,7 +6818,7 @@ const SallaBulletDelivery$1 = /*@__PURE__*/ proxyCustomElement(class SallaBullet
|
|
|
7063
6818
|
this.confirmBtn = btn;
|
|
7064
6819
|
}, disabled: this.isConfirmDisabled(), onClick: () => this.handleConfirm(), "loader-position": "center", width: "wide" }, this.activeTab === "branch"
|
|
7065
6820
|
? Salla.lang.get("pages.checkout.confirm_receipt_from_the_branch")
|
|
7066
|
-
: Salla.lang.get("pages.checkout.confirm_address")), showAddAddressInFooter && (h$4("salla-button", { onClick: () => this.handleAddNewAddress(), width: "wide", shape: "link" }, Salla.lang.get("pages.checkout.add_new_address"))), !this.isLoggedIn && (h$4("salla-button", { shape: "link", onClick: this.handleLogin }, Salla.lang.get("pages.checkout.login_to_use_saved_addresses")))));
|
|
6821
|
+
: Salla.lang.get("pages.checkout.confirm_address")), showAddAddressInFooter && (h$4("salla-button", { onClick: () => this.handleAddNewAddress(), width: "wide", shape: "link" }, Salla.lang.get("pages.checkout.add_new_address"))), !this.isLoggedIn && (h$4("salla-button", { shape: "link", onClick: () => this.handleLogin() }, Salla.lang.get("pages.checkout.login_to_use_saved_addresses")))));
|
|
7067
6822
|
}
|
|
7068
6823
|
renderMainView() {
|
|
7069
6824
|
const isAddressEmptyState = this.isLoggedIn &&
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
4
|
import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
|
|
5
|
+
import { q as isMapOriginIntent } from './helpers.js';
|
|
5
6
|
import { d as defineCustomElement$6 } from './salla-button2.js';
|
|
6
7
|
import { d as defineCustomElement$5 } from './salla-loading2.js';
|
|
7
8
|
import { d as defineCustomElement$4 } from './salla-modal2.js';
|
|
@@ -39,13 +40,17 @@ async function fetchDeliveryMessage(productId, id, optionType, isLoginCycleEnabl
|
|
|
39
40
|
const response = (await salla.api.withoutNotifier(() => salla.api.request(salla.url.api(`products/${productId}/delivery-promises${queryString}`))));
|
|
40
41
|
if (!response.success) {
|
|
41
42
|
log('fetchDeliveryMessage error', { response });
|
|
42
|
-
|
|
43
|
+
return null;
|
|
43
44
|
}
|
|
44
45
|
const message = response.data?.message?.trim();
|
|
45
46
|
log('fetchDeliveryMessage success', { message });
|
|
46
47
|
return message || null;
|
|
47
48
|
}
|
|
48
49
|
|
|
50
|
+
/**
|
|
51
|
+
* Bullet delivery intent helpers.
|
|
52
|
+
* Reads/writes the same storage key as salla-bullet-delivery so both components stay in sync.
|
|
53
|
+
*/
|
|
49
54
|
const INTENT_KEY = 'bullet_delivery_intent';
|
|
50
55
|
function getIntentStorage() {
|
|
51
56
|
const rememberLastSession = Boolean(salla.config.get('store.settings.bullet_delivery.settings.remember_last_session'));
|
|
@@ -67,6 +72,10 @@ function resolveIntent() {
|
|
|
67
72
|
if (cityId != null) {
|
|
68
73
|
return { type: 'address', option: { id: cityId, name: cityName } };
|
|
69
74
|
}
|
|
75
|
+
// Map-origin pick: no city id to query a delivery estimate by, but still show the address.
|
|
76
|
+
if (isMapOriginIntent(intent) && intent.address_details?.formatted_address) {
|
|
77
|
+
return { type: 'address', option: { name: intent.address_details.formatted_address } };
|
|
78
|
+
}
|
|
70
79
|
return null;
|
|
71
80
|
}
|
|
72
81
|
if (intent.type === 'branch') {
|
|
@@ -252,12 +261,19 @@ const SallaDeliveryPromise$1 = /*@__PURE__*/ proxyCustomElement(class SallaDeliv
|
|
|
252
261
|
this.selectedCityLoginCycle = resolved.option;
|
|
253
262
|
this.selectedBranchLoginCycle = null;
|
|
254
263
|
this.selectedLabel = `${this.labels.deliveryTo} ${resolved.option.name || this.labels.selectCity}`;
|
|
255
|
-
|
|
264
|
+
// Map-origin picks have no resolved city id — nothing to query a delivery estimate by.
|
|
265
|
+
if (resolved.option.id != null) {
|
|
266
|
+
void this.loadDeliveryMessage(resolved.option.id, 'city');
|
|
267
|
+
}
|
|
268
|
+
else {
|
|
269
|
+
this.deliveryMessage = null;
|
|
270
|
+
}
|
|
256
271
|
}
|
|
257
272
|
else {
|
|
258
273
|
this.selectedBranchLoginCycle = resolved.option;
|
|
259
274
|
this.selectedCityLoginCycle = null;
|
|
260
275
|
this.selectedLabel = `${this.labels.pickupFromBranch} ${resolved.option.name}`;
|
|
276
|
+
// Branch resolution in resolveIntent() always sets an id.
|
|
261
277
|
void this.loadDeliveryMessage(resolved.option.id, 'branch');
|
|
262
278
|
}
|
|
263
279
|
return true;
|
|
@@ -312,8 +328,8 @@ const SallaDeliveryPromise$1 = /*@__PURE__*/ proxyCustomElement(class SallaDeliv
|
|
|
312
328
|
this.deliveryMessage = await fetchDeliveryMessage(this.productId, id, optionType, this.isLoginCycleEnabled);
|
|
313
329
|
}
|
|
314
330
|
catch (error) {
|
|
315
|
-
|
|
316
|
-
this.
|
|
331
|
+
log('loadDeliveryMessage failed', { id, optionType, error });
|
|
332
|
+
this.deliveryMessage = null;
|
|
317
333
|
}
|
|
318
334
|
finally {
|
|
319
335
|
this.isLoadingPromises = false;
|