@salla.sa/twilight-components 3.0.18 → 3.0.19
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/{Helper-D2VNt6eb.js → Helper-DqKJCL8G.js} +1 -1
- package/dist/cjs/{filepond-DkCudLhG.js → filepond-Byu0lc8z.js} +1 -1
- package/dist/cjs/{filepond-plugin-file-poster-C-uxFWfW.js → filepond-plugin-file-poster-qwx7lYZ-.js} +1 -1
- package/dist/cjs/{filepond-plugin-file-validate-size-BikXTQW2.js → filepond-plugin-file-validate-size-C-n0P4TT.js} +1 -1
- package/dist/cjs/{filepond-plugin-file-validate-type-Drs7PouU.js → filepond-plugin-file-validate-type-C8VOOXdT.js} +1 -1
- package/dist/cjs/{filepond-plugin-image-edit-hxr0h9kt.js → filepond-plugin-image-edit-B9KG763Y.js} +1 -1
- package/dist/cjs/{filepond-plugin-image-exif-orientation-CVZmWU_4.js → filepond-plugin-image-exif-orientation-Czt4pYzU.js} +1 -1
- package/dist/cjs/{filepond-plugin-image-preview-CBjPKx-d.js → filepond-plugin-image-preview-BFm1Zl0o.js} +1 -1
- package/dist/cjs/helpers-NV7wgP50.js +602 -0
- package/dist/cjs/{index-CTYg2zC6.js → index-CFW798jX.js} +2 -2
- package/dist/cjs/{intlTelInput-C9X0hKXV.js → intlTelInput-CLa2B89b.js} +1 -1
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/salla-accordion-body_2.cjs.entry.js +1 -1
- package/dist/cjs/salla-accordion_6.cjs.entry.js +2 -2
- package/dist/cjs/salla-add-product-button_5.cjs.entry.js +46 -3
- 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-applied-filters.cjs.entry.js +2 -2
- package/dist/cjs/salla-apps-icons.cjs.entry.js +1 -1
- package/dist/cjs/salla-attachment-view_9.cjs.entry.js +11 -11
- 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_3.cjs.entry.js +425 -119
- 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_9.cjs.entry.js +2 -2
- 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 +2 -2
- package/dist/cjs/salla-edit-order-button.cjs.entry.js +1 -1
- package/dist/cjs/salla-filters-widget.cjs.entry.js +2 -2
- package/dist/cjs/salla-filters.cjs.entry.js +2 -2
- package/dist/cjs/salla-free-shipping-banner.cjs.entry.js +1 -1
- package/dist/cjs/salla-free-shipping-tag.cjs.entry.js +1 -1
- package/dist/cjs/salla-fulfillment-methods.cjs.entry.js +1 -1
- package/dist/cjs/salla-gift-card-redeem_2.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 +2 -2
- 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 +7 -2
- 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_3.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 +2 -2
- 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-items.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-options-modal.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-payment.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-rewards.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 +2 -2
- package/dist/cjs/salla-payments.cjs.entry.js +1 -1
- package/dist/cjs/salla-placeholder.cjs.entry.js +1 -1
- package/dist/cjs/salla-price-range.cjs.entry.js +1 -1
- package/dist/cjs/salla-product-card-embed.cjs.entry.js +1 -1
- package/dist/cjs/salla-product-card.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 +9 -2
- package/dist/cjs/salla-products-slider.cjs.entry.js +2 -2
- package/dist/cjs/salla-quick-order.cjs.entry.js +1 -1
- package/dist/cjs/salla-rating-modal-v2.cjs.entry.js +2 -2
- package/dist/cjs/salla-rating-modal.cjs.entry.js +2 -2
- 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-product-card.cjs.entry.js +1 -1
- package/dist/cjs/salla-search.cjs.entry.js +2 -2
- package/dist/cjs/salla-skeleton.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-thank-you-header.cjs.entry.js +1 -1
- package/dist/cjs/salla-thank-you-page.cjs.entry.js +1 -1
- package/dist/cjs/salla-tiered-offer.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/salla-wishlist-summary.cjs.entry.js +2 -2
- package/dist/cjs/twilight.cjs.js +2 -2
- package/dist/cjs/{vanilla-picker-BsLm8rHT.js → vanilla-picker-Vx_7G7bs.js} +1 -1
- package/dist/collection/components/salla-bullet-delivery/api-service.js +156 -25
- package/dist/collection/components/salla-bullet-delivery/helpers.js +143 -15
- package/dist/collection/components/salla-bullet-delivery/icons.js +17 -0
- package/dist/collection/components/salla-bullet-delivery/salla-bullet-delivery.css +490 -52
- package/dist/collection/components/salla-bullet-delivery/salla-bullet-delivery.js +417 -90
- package/dist/collection/components/salla-login-modal/salla-login-modal.js +6 -1
- package/dist/collection/components/salla-products-list/salla-products-list.js +7 -0
- package/dist/collection/components/salla-quick-buy/salla-quick-buy.js +44 -1
- package/dist/components/helpers.js +299 -40
- package/dist/components/index.js +2 -2
- package/dist/components/salla-bullet-delivery.js +430 -118
- package/dist/components/salla-login-modal2.js +6 -1
- package/dist/components/salla-products-list2.js +7 -0
- package/dist/components/salla-quick-buy2.js +44 -1
- package/dist/docs.json +1 -1
- package/dist/esm/{Helper-C1T-oD4J.js → Helper-I0CAizv1.js} +1 -1
- package/dist/esm/{filepond-BoWJzHeN.js → filepond-DTUYXV0J.js} +1 -1
- package/dist/esm/{filepond-plugin-file-poster-B6MkMtuC.js → filepond-plugin-file-poster-DydZjneT.js} +1 -1
- package/dist/esm/{filepond-plugin-file-validate-size-Dds_462B.js → filepond-plugin-file-validate-size-nbsCU2t9.js} +1 -1
- package/dist/esm/{filepond-plugin-file-validate-type-DrfGXNay.js → filepond-plugin-file-validate-type-Cl5B_DIy.js} +1 -1
- package/dist/esm/{filepond-plugin-image-edit-CN7eGg-7.js → filepond-plugin-image-edit-bzskFyFR.js} +1 -1
- package/dist/esm/{filepond-plugin-image-exif-orientation-CyhxK_6R.js → filepond-plugin-image-exif-orientation-MBDuxLaX.js} +1 -1
- package/dist/esm/{filepond-plugin-image-preview-DdKqAzT9.js → filepond-plugin-image-preview-N6wzEryW.js} +1 -1
- package/dist/esm/helpers-Cnh7Qptl.js +568 -0
- package/dist/esm/{index-DgUQRYr2.js → index-C9zdeQFI.js} +2 -2
- package/dist/esm/{intlTelInput-SwlavcFB.js → intlTelInput-B5L9nYtO.js} +1 -1
- package/dist/esm/loader.js +3 -3
- package/dist/esm/salla-accordion-body_2.entry.js +1 -1
- package/dist/esm/salla-accordion_6.entry.js +2 -2
- package/dist/esm/salla-add-product-button_5.entry.js +46 -3
- 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-applied-filters.entry.js +2 -2
- package/dist/esm/salla-apps-icons.entry.js +1 -1
- package/dist/esm/salla-attachment-view_9.entry.js +11 -11
- 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_3.entry.js +425 -119
- 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_9.entry.js +2 -2
- 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 +2 -2
- package/dist/esm/salla-edit-order-button.entry.js +1 -1
- package/dist/esm/salla-filters-widget.entry.js +2 -2
- package/dist/esm/salla-filters.entry.js +2 -2
- package/dist/esm/salla-free-shipping-banner.entry.js +1 -1
- package/dist/esm/salla-free-shipping-tag.entry.js +1 -1
- package/dist/esm/salla-fulfillment-methods.entry.js +1 -1
- package/dist/esm/salla-gift-card-redeem_2.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 +2 -2
- 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 +7 -2
- 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_3.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 +2 -2
- 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-items.entry.js +1 -1
- package/dist/esm/salla-order-options-modal.entry.js +1 -1
- package/dist/esm/salla-order-payment.entry.js +1 -1
- package/dist/esm/salla-order-rewards.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 +2 -2
- package/dist/esm/salla-payments.entry.js +1 -1
- package/dist/esm/salla-placeholder.entry.js +1 -1
- package/dist/esm/salla-price-range.entry.js +1 -1
- package/dist/esm/salla-product-card-embed.entry.js +1 -1
- package/dist/esm/salla-product-card.entry.js +1 -1
- package/dist/esm/salla-product-size-guide.entry.js +1 -1
- package/dist/esm/salla-products-list.entry.js +9 -2
- package/dist/esm/salla-products-slider.entry.js +2 -2
- package/dist/esm/salla-quick-order.entry.js +1 -1
- package/dist/esm/salla-rating-modal-v2.entry.js +2 -2
- package/dist/esm/salla-rating-modal.entry.js +2 -2
- 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-product-card.entry.js +1 -1
- package/dist/esm/salla-search.entry.js +2 -2
- package/dist/esm/salla-skeleton.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-thank-you-header.entry.js +1 -1
- package/dist/esm/salla-thank-you-page.entry.js +1 -1
- package/dist/esm/salla-tiered-offer.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/salla-wishlist-summary.entry.js +2 -2
- package/dist/esm/twilight.js +3 -3
- package/dist/esm/{vanilla-picker-Buy50D7t.js → vanilla-picker-CAeu4f87.js} +1 -1
- package/dist/twilight/{p-bed54154.entry.js → p-01d5cd61.entry.js} +1 -1
- package/dist/twilight/{p-b3ada3d0.entry.js → p-0213fde4.entry.js} +1 -1
- package/dist/twilight/{p-d0ff9a3e.entry.js → p-036fbfc0.entry.js} +1 -1
- package/dist/twilight/{p-53735934.entry.js → p-0add41ce.entry.js} +1 -1
- package/dist/twilight/{p-bb8b2c85.entry.js → p-0b0d4942.entry.js} +1 -1
- package/dist/twilight/{p-d1121b3f.entry.js → p-17bcbf9b.entry.js} +1 -1
- package/dist/twilight/{p-6b5de500.entry.js → p-1867f7d4.entry.js} +1 -1
- package/dist/twilight/{p-ee65c489.entry.js → p-194ff38c.entry.js} +1 -1
- package/dist/twilight/{p-4ab5ee99.entry.js → p-20f9c62f.entry.js} +1 -1
- package/dist/twilight/{p-5e8d019e.entry.js → p-252748d9.entry.js} +1 -1
- package/dist/twilight/{p-6c3084c9.entry.js → p-290ce0bc.entry.js} +1 -1
- package/dist/twilight/{p-5694edf1.entry.js → p-2b930157.entry.js} +1 -1
- package/dist/twilight/{p-7fd9dc36.entry.js → p-2e4e15c5.entry.js} +1 -1
- package/dist/twilight/{p-b9d67694.entry.js → p-2e6537a3.entry.js} +1 -1
- package/dist/twilight/{p-7f97335a.entry.js → p-30d64bd1.entry.js} +1 -1
- package/dist/twilight/{p-516e4edc.entry.js → p-32495dd2.entry.js} +1 -1
- package/dist/twilight/{p-e9b03e9c.entry.js → p-32d9da31.entry.js} +1 -1
- package/dist/twilight/{p-9d15f22d.entry.js → p-32f100f8.entry.js} +1 -1
- package/dist/twilight/{p-6dccd40f.entry.js → p-386b3dcd.entry.js} +1 -1
- package/dist/twilight/{p-d1093a59.entry.js → p-3a4e86d1.entry.js} +1 -1
- package/dist/twilight/{p-f7a58656.entry.js → p-3b766a79.entry.js} +1 -1
- package/dist/twilight/{p-361f6033.entry.js → p-3b7a45ec.entry.js} +1 -1
- package/dist/twilight/{p-9cf1cfd4.entry.js → p-3bb0e184.entry.js} +1 -1
- package/dist/twilight/{p-b0d2e31f.entry.js → p-3cc6ca6c.entry.js} +1 -1
- package/dist/twilight/{p-d4fb9921.entry.js → p-4070f808.entry.js} +1 -1
- package/dist/twilight/{p-af49191f.entry.js → p-412fb721.entry.js} +1 -1
- package/dist/twilight/{p-5f6fee0e.entry.js → p-427c13b6.entry.js} +1 -1
- package/dist/twilight/{p-be6f8551.entry.js → p-45e0a5d0.entry.js} +1 -1
- package/dist/twilight/{p-c4cf0b4d.entry.js → p-4d615f9f.entry.js} +1 -1
- package/dist/twilight/{p-fddf1997.entry.js → p-4d7fc363.entry.js} +1 -1
- package/dist/twilight/{p-9e042cce.entry.js → p-5009f654.entry.js} +1 -1
- package/dist/twilight/{p-d9a1bf08.entry.js → p-50853b76.entry.js} +1 -1
- package/dist/twilight/{p-eaf0c514.entry.js → p-550ad1a6.entry.js} +1 -1
- package/dist/twilight/{p-3f842f32.entry.js → p-575014c4.entry.js} +1 -1
- package/dist/twilight/{p-66ad7a30.entry.js → p-5aee5e44.entry.js} +1 -1
- package/dist/twilight/{p-8c1d14f0.entry.js → p-619c709c.entry.js} +1 -1
- package/dist/twilight/{p-cdeb9bcc.entry.js → p-6d572fe0.entry.js} +1 -1
- package/dist/twilight/{p-12a25415.entry.js → p-6f84c662.entry.js} +1 -1
- package/dist/twilight/{p-b5a45f87.entry.js → p-703b9253.entry.js} +1 -1
- package/dist/twilight/{p-a5b732b3.entry.js → p-73dea22d.entry.js} +1 -1
- package/dist/twilight/{p-a44670a9.entry.js → p-74285af9.entry.js} +1 -1
- package/dist/twilight/{p-b1f808f5.entry.js → p-777d28f6.entry.js} +1 -1
- package/dist/twilight/{p-027cbda6.entry.js → p-7db6ccfe.entry.js} +1 -1
- package/dist/twilight/{p-0418c2df.entry.js → p-7db8d545.entry.js} +1 -1
- package/dist/twilight/{p-da0df10b.entry.js → p-7fa4d0b6.entry.js} +1 -1
- package/dist/twilight/{p-78a56dc6.entry.js → p-825c5b73.entry.js} +1 -1
- package/dist/twilight/{p-4b70e6c4.entry.js → p-8262e669.entry.js} +1 -1
- package/dist/twilight/p-86d55a6b.entry.js +4 -0
- package/dist/twilight/{p-259c995a.entry.js → p-8712f7c7.entry.js} +1 -1
- package/dist/twilight/{p-08a15c81.entry.js → p-8948b58c.entry.js} +1 -1
- package/dist/twilight/{p-aa35cf98.entry.js → p-8b8cf457.entry.js} +1 -1
- package/dist/twilight/{p-d0aeeb7f.entry.js → p-8c2992e7.entry.js} +1 -1
- package/dist/twilight/{p-79822d99.entry.js → p-8c548259.entry.js} +1 -1
- package/dist/twilight/{p-6af8a7b6.entry.js → p-8eb3fd92.entry.js} +1 -1
- package/dist/twilight/p-908716fb.entry.js +4 -0
- package/dist/twilight/{p-70dfb2b4.entry.js → p-90a59027.entry.js} +1 -1
- package/dist/twilight/{p-37192614.entry.js → p-9683535f.entry.js} +1 -1
- package/dist/twilight/{p-f9e5ed10.entry.js → p-982e9124.entry.js} +1 -1
- package/dist/twilight/{p-0d795b58.entry.js → p-995b898f.entry.js} +1 -1
- package/dist/twilight/{p-d1204965.entry.js → p-99cb3dba.entry.js} +1 -1
- package/dist/twilight/{p-071aa0e7.entry.js → p-9a0218a6.entry.js} +1 -1
- package/dist/twilight/{p-eefced26.entry.js → p-9cf31ff4.entry.js} +1 -1
- package/dist/twilight/{p-4891c565.entry.js → p-9d1a5007.entry.js} +1 -1
- package/dist/twilight/{p-f9587127.entry.js → p-9e429047.entry.js} +1 -1
- package/dist/twilight/p-9e542951.entry.js +4 -0
- package/dist/twilight/{p-BxQMWsr9.js → p-BcT9tEVW.js} +1 -1
- package/dist/twilight/{p-Y2ZIN9Ok.js → p-Bgu5gtOF.js} +1 -1
- package/dist/twilight/{p-DgUQRYr2.js → p-C9zdeQFI.js} +2 -2
- package/dist/twilight/{p-CCwsxMbZ.js → p-CSGj1pY-.js} +1 -1
- package/dist/twilight/{p-Ca_SZn0u.js → p-CWWgpQ8Q.js} +1 -1
- package/dist/twilight/{p-CgNJWeaK.js → p-Cfz9xit3.js} +1 -1
- package/dist/twilight/{p-BK9YeXWp.js → p-CmYSalnM.js} +1 -1
- package/dist/twilight/p-Cnh7Qptl.js +4 -0
- package/dist/twilight/{p-De1tLqQF.js → p-Dav_R_d2.js} +1 -1
- package/dist/twilight/{p-DMvhNbgN.js → p-JGEddAgs.js} +1 -1
- package/dist/twilight/{p-CBLWEyM9.js → p-RflSBQNB.js} +1 -1
- package/dist/twilight/{p-NqQdbGu6.js → p-Xgbueas7.js} +1 -1
- package/dist/twilight/{p-ba6dd59c.entry.js → p-a070cce0.entry.js} +1 -1
- package/dist/twilight/{p-1960020c.entry.js → p-a0bfedad.entry.js} +1 -1
- package/dist/twilight/{p-f7ab5825.entry.js → p-a22d9931.entry.js} +1 -1
- package/dist/twilight/{p-a95b0dc1.entry.js → p-a3959219.entry.js} +1 -1
- package/dist/twilight/p-a3ca61af.entry.js +4 -0
- package/dist/twilight/{p-e457e68f.entry.js → p-a55b5c44.entry.js} +1 -1
- package/dist/twilight/{p-23772523.entry.js → p-a5fc8358.entry.js} +1 -1
- package/dist/twilight/{p-3a632c69.entry.js → p-aabcd09f.entry.js} +1 -1
- package/dist/twilight/{p-d8955835.entry.js → p-ad00021e.entry.js} +1 -1
- package/dist/twilight/{p-481f52b1.entry.js → p-ade9a68c.entry.js} +1 -1
- package/dist/twilight/{p-4a3fa153.entry.js → p-b5e0065a.entry.js} +1 -1
- package/dist/twilight/{p-bed68e52.entry.js → p-bbb09d92.entry.js} +1 -1
- package/dist/twilight/{p-9e65451e.entry.js → p-c2df20f8.entry.js} +1 -1
- package/dist/twilight/{p-1af9db24.entry.js → p-c4274188.entry.js} +1 -1
- package/dist/twilight/{p-bfd5e263.entry.js → p-c5e2c781.entry.js} +1 -1
- package/dist/twilight/{p-e38a6793.entry.js → p-c64b2b22.entry.js} +1 -1
- package/dist/twilight/{p-3d8b77f7.entry.js → p-c92cc92f.entry.js} +1 -1
- package/dist/twilight/{p-ac736b30.entry.js → p-cb54adac.entry.js} +1 -1
- package/dist/twilight/{p-5bbf17dd.entry.js → p-ce1e45a3.entry.js} +1 -1
- package/dist/twilight/{p-fcb1009f.entry.js → p-d0acd7ff.entry.js} +1 -1
- package/dist/twilight/{p-92fd20a0.entry.js → p-d0f903ac.entry.js} +1 -1
- package/dist/twilight/{p-26d2b28a.entry.js → p-d57b49ff.entry.js} +1 -1
- package/dist/twilight/{p-8766e236.entry.js → p-db3efb27.entry.js} +1 -1
- package/dist/twilight/{p-0f25fedd.entry.js → p-db73d0bf.entry.js} +1 -1
- package/dist/twilight/{p-6e52b649.entry.js → p-e20d5e75.entry.js} +1 -1
- package/dist/twilight/{p-254cff9a.entry.js → p-e223beca.entry.js} +1 -1
- package/dist/twilight/{p-8c40278d.entry.js → p-e37da59f.entry.js} +1 -1
- package/dist/twilight/{p-84b0e7a9.entry.js → p-e3991836.entry.js} +1 -1
- package/dist/twilight/{p-cb48a5ef.entry.js → p-e455709f.entry.js} +1 -1
- package/dist/twilight/{p-9e0a9a5a.entry.js → p-e921b2d1.entry.js} +1 -1
- package/dist/twilight/{p-0ba159db.entry.js → p-ec356e5a.entry.js} +1 -1
- package/dist/twilight/{p-34148827.entry.js → p-eeefc285.entry.js} +1 -1
- package/dist/twilight/{p-6ba3808a.entry.js → p-f3b12754.entry.js} +1 -1
- package/dist/twilight/{p-419d6d71.entry.js → p-f6279a13.entry.js} +1 -1
- package/dist/twilight/{p-487b4411.entry.js → p-f83efc62.entry.js} +1 -1
- package/dist/twilight/{p-7b5f97e7.entry.js → p-fa622715.entry.js} +1 -1
- package/dist/twilight/{p-ee479819.entry.js → p-faf00404.entry.js} +1 -1
- package/dist/twilight/twilight.esm.js +1 -1
- package/dist/types/components/salla-bullet-delivery/api-service.d.ts +23 -7
- package/dist/types/components/salla-bullet-delivery/helpers.d.ts +61 -6
- package/dist/types/components/salla-bullet-delivery/icons.d.ts +14 -0
- package/dist/types/components/salla-bullet-delivery/interfaces.d.ts +36 -1
- package/dist/types/components/salla-bullet-delivery/salla-bullet-delivery.d.ts +73 -2
- package/dist/types/components/salla-quick-buy/salla-quick-buy.d.ts +6 -0
- package/package.json +5 -5
- package/dist/cjs/helpers-8bMfm_mm.js +0 -329
- package/dist/esm/helpers-DqzaeXrL.js +0 -309
- package/dist/twilight/p-76584a5b.entry.js +0 -4
- package/dist/twilight/p-DqzaeXrL.js +0 -4
- package/dist/twilight/p-bac25e34.entry.js +0 -4
- package/dist/twilight/p-d346dabd.entry.js +0 -4
- package/dist/twilight/p-e24fbbb4.entry.js +0 -4
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type EventEmitter } from "../../stencil-public-runtime";
|
|
2
2
|
import { type SelectorTrigger } from "./selector-tracker";
|
|
3
|
+
import type { BranchDiscountRange } from "./helpers";
|
|
3
4
|
import type { AddressCreatedEvent, Branch, BulletDeliveryConfirmedEvent, City, Country, District, HeaderContextUpdateEvent, IntentType, NewAddressFormData, Region, SavedAddress } from "./interfaces";
|
|
4
5
|
import { type LocationPermissionState } from "./location-permission-notice";
|
|
5
6
|
import { type Coordinates } from "./location-distance-warning";
|
|
@@ -13,6 +14,8 @@ export declare class SallaBulletDelivery {
|
|
|
13
14
|
private pendingCartSubmitResolver;
|
|
14
15
|
private pendingCartSubmitPromise;
|
|
15
16
|
private cartSubmitConfirmationPending;
|
|
17
|
+
/** Query the current branch list was searched with server-side; its results are not re-filtered locally. */
|
|
18
|
+
private branchesServerQuery;
|
|
16
19
|
private branchSearchDebounceTimer;
|
|
17
20
|
private countrySearchTimer;
|
|
18
21
|
private regionSearchTimer;
|
|
@@ -53,6 +56,8 @@ export declare class SallaBulletDelivery {
|
|
|
53
56
|
* coordinates re-picked, or the map left) can be told apart from the current one. */
|
|
54
57
|
private geocodeRequestId;
|
|
55
58
|
private isRTL;
|
|
59
|
+
/** Identifies the latest pickup-offer fetch so one from an earlier modal open is dropped. */
|
|
60
|
+
private pickupDiscountRequestId;
|
|
56
61
|
activeTab: IntentType;
|
|
57
62
|
isLoggedIn: boolean;
|
|
58
63
|
viewMode: ViewMode;
|
|
@@ -71,9 +76,33 @@ export declare class SallaBulletDelivery {
|
|
|
71
76
|
/** True when user selected the session address (guest address from before login, not yet saved) */
|
|
72
77
|
selectedSessionAddress: boolean;
|
|
73
78
|
branches: Branch[];
|
|
79
|
+
/** Pickup offer range across the store's branches (INV-1416); null shows the default tab badge. */
|
|
80
|
+
pickupDiscountRange: BranchDiscountRange | null;
|
|
81
|
+
/** False until the offer lookup settles, so the tab never flashes the default badge before an offer. */
|
|
82
|
+
pickupDiscountResolved: boolean;
|
|
74
83
|
filteredBranches: Branch[];
|
|
75
84
|
selectedBranch: Branch | null;
|
|
76
85
|
branchSearchQuery: string;
|
|
86
|
+
/** Cities that have branches in the selected country (from the unfiltered branch list). */
|
|
87
|
+
branchCities: {
|
|
88
|
+
id: number;
|
|
89
|
+
name: string;
|
|
90
|
+
}[];
|
|
91
|
+
selectedBranchCity: {
|
|
92
|
+
id: number;
|
|
93
|
+
name: string;
|
|
94
|
+
} | null;
|
|
95
|
+
branchCitySearchQuery: string;
|
|
96
|
+
/** Branch whose weekly hours are expanded behind the chevron (one at a time). */
|
|
97
|
+
expandedScheduleBranchId: number | null;
|
|
98
|
+
/** Shopper's device location for branch distances (see getGrantedDeviceLocation). */
|
|
99
|
+
private shopperLocation;
|
|
100
|
+
private shopperLocationRequestId;
|
|
101
|
+
private nearestBranchRequestId;
|
|
102
|
+
/** Bumped per branch-list request; overlapping city/search loads only apply the latest one. */
|
|
103
|
+
private branchesRequestId;
|
|
104
|
+
/** Shared country rows and city options expire with the API cache. */
|
|
105
|
+
private allBranchCities;
|
|
77
106
|
loadingCountries: boolean;
|
|
78
107
|
loadingCities: boolean;
|
|
79
108
|
loadingDistricts: boolean;
|
|
@@ -215,6 +244,8 @@ export declare class SallaBulletDelivery {
|
|
|
215
244
|
private loadDistricts;
|
|
216
245
|
private findPrefillDistrict;
|
|
217
246
|
private loadBranches;
|
|
247
|
+
/** Reuse the country's city collection while keeping visible choices usable during loading. */
|
|
248
|
+
private refreshBranchCities;
|
|
218
249
|
/**
|
|
219
250
|
* Store a freshly fetched branch list and reconcile the current selection with it.
|
|
220
251
|
* `selectedBranch` is a snapshot from selection time: when the refreshed list carries the
|
|
@@ -222,6 +253,13 @@ export declare class SallaBulletDelivery {
|
|
|
222
253
|
* A selection missing from the list (e.g. filtered out by a search) is left untouched.
|
|
223
254
|
*/
|
|
224
255
|
private applyLoadedBranches;
|
|
256
|
+
/** Shares a fresh branch collection with the picker on each modal open. */
|
|
257
|
+
private loadPickupDiscountRange;
|
|
258
|
+
/**
|
|
259
|
+
* ar: "خصم 25%" / "خصم 5 – 25%" / "خصم 10 ر.س"; en: "25% discount" / "5 – 25% discount" / "10 SAR discount".
|
|
260
|
+
* Money may carry the riyal-symbol SVG, so it renders as HTML.
|
|
261
|
+
*/
|
|
262
|
+
private getPickupDiscountLabel;
|
|
225
263
|
private filterBranches;
|
|
226
264
|
/**
|
|
227
265
|
* Prefill form fields from session storage
|
|
@@ -247,7 +285,10 @@ export declare class SallaBulletDelivery {
|
|
|
247
285
|
private loadBranchesWithLocation;
|
|
248
286
|
/** Locate nearest branch using device geolocation (branches tab only). */
|
|
249
287
|
private handleFindNearestBranch;
|
|
288
|
+
private geolocationErrorMessage;
|
|
250
289
|
private handleBranchSelect;
|
|
290
|
+
private handleBranchCitySelected;
|
|
291
|
+
private toggleBranchSchedule;
|
|
251
292
|
/**
|
|
252
293
|
* Restore a remembered / event-provided branch — but only one the list renders as selectable,
|
|
253
294
|
* so a branch that has closed since it was remembered is never silently preselected (INV-1407).
|
|
@@ -322,6 +363,17 @@ export declare class SallaBulletDelivery {
|
|
|
322
363
|
private renderMapCountryNotice;
|
|
323
364
|
/** Center shown before geolocation resolves — the customer's IP-based default (falls back to Riyadh). */
|
|
324
365
|
private get mapInitialCenter();
|
|
366
|
+
/** Device location for a branch list request, waiting at most BRANCH_LIST_LOCATION_WAIT. */
|
|
367
|
+
private getListLocation;
|
|
368
|
+
/**
|
|
369
|
+
* Where branch distances (`distance_km`) are measured from: the shopper's real device location
|
|
370
|
+
* only. It comes from "nearest to my location", or is read silently when location permission was
|
|
371
|
+
* already granted (never prompting). Empty otherwise: `user.default_geo_location` and the Riyadh
|
|
372
|
+
* map fallback are not where the shopper is, so they would show wrong distances.
|
|
373
|
+
*/
|
|
374
|
+
private getGrantedDeviceLocation;
|
|
375
|
+
/** The customer's IP-based `user.default_geo_location`, or null when it is missing or invalid. */
|
|
376
|
+
private get defaultGeoLocation();
|
|
325
377
|
/** Parse a config coordinate to a finite number, treating blank/whitespace strings as missing. */
|
|
326
378
|
private toCoordinate;
|
|
327
379
|
/**
|
|
@@ -399,10 +451,16 @@ export declare class SallaBulletDelivery {
|
|
|
399
451
|
private getCartViewConfig;
|
|
400
452
|
/** Creates the cart view DOM for mounting into cart.items.start hook */
|
|
401
453
|
private createCartViewElement;
|
|
454
|
+
/**
|
|
455
|
+
* A branch pickup offer (INV-1416) replaces the default "save delivery fees" badge; only one shows,
|
|
456
|
+
* and neither until the offer lookup settles.
|
|
457
|
+
*/
|
|
458
|
+
private renderPickupTabBadge;
|
|
402
459
|
private renderTabs;
|
|
403
460
|
private renderAlert;
|
|
404
461
|
private renderAllocationOutOfCoverageAlert;
|
|
405
462
|
private handleCountrySelected;
|
|
463
|
+
/** `showLabel` is off in the pickup filter panel, where the selects sit label-less side by side. */
|
|
406
464
|
private renderCountrySelect;
|
|
407
465
|
private handleRegionSelected;
|
|
408
466
|
/** Region select (SA only): shown when SA is selected; city and district disabled until region selected. */
|
|
@@ -426,10 +484,23 @@ export declare class SallaBulletDelivery {
|
|
|
426
484
|
private renderDeliveryTab;
|
|
427
485
|
private renderGuestDeliveryContent;
|
|
428
486
|
private renderBranchSearch;
|
|
429
|
-
/** Renders a branch's `preparation_time_range` as a localized "from - to <unit>" label. */
|
|
430
|
-
private getPreparationTimeLabel;
|
|
431
487
|
private renderBranchList;
|
|
488
|
+
/** "يبعد عنك: ~" stays muted; the distance and its unit read as the value, as in checkout. */
|
|
489
|
+
private renderDistanceLabel;
|
|
490
|
+
private get isArabic();
|
|
491
|
+
private formatClock;
|
|
492
|
+
/** "جاهز اليوم 10:00 ص" for a branch that is closed now and opens later today. */
|
|
493
|
+
private getReadyTodayLabel;
|
|
494
|
+
/** "15-30 د" — compact preparation range for the card's meta row. */
|
|
495
|
+
private getPreparationShortLabel;
|
|
496
|
+
/**
|
|
497
|
+
* Busy, always-open, or the backend's `open_status_line` ("مفتوح - يغلق عند 11:00 م"), which reads
|
|
498
|
+
* the hours on the branch's clock. Without that line, `is_open` gives a bare open/closed label.
|
|
499
|
+
*/
|
|
500
|
+
private renderBranchOpenStatus;
|
|
432
501
|
private renderPickupTab;
|
|
502
|
+
/** City filter for the pickup list; options come from the branches themselves, so none is empty. */
|
|
503
|
+
private renderBranchCitySelect;
|
|
433
504
|
/** Add-address form: map + confirm card in one screen, or dropdown fallback. */
|
|
434
505
|
private renderAddAddressForm;
|
|
435
506
|
private renderFooter;
|
|
@@ -111,6 +111,9 @@ export declare class SallaQuickBuy {
|
|
|
111
111
|
requireLogin: EventEmitter<{
|
|
112
112
|
productId: string;
|
|
113
113
|
}>;
|
|
114
|
+
/** The guest picked "continue as guest" on the login step, so don't ask again. */
|
|
115
|
+
private choseGuest;
|
|
116
|
+
private cancelLoginAsk;
|
|
114
117
|
private quickBuyHandler;
|
|
115
118
|
/** Sync PDP-option validity (preserves the AP gesture); emits + notifies on failure. */
|
|
116
119
|
private validatePdpOptionsSync;
|
|
@@ -135,6 +138,9 @@ export declare class SallaQuickBuy {
|
|
|
135
138
|
private resolveSupportedNetworks;
|
|
136
139
|
private settlePayment;
|
|
137
140
|
private legacyQuickPurchaseFallback;
|
|
141
|
+
/** login-before-checkout variant: offer login or guest before buy now. Not for Apple Pay, which must open on the tap. */
|
|
142
|
+
private shouldAskLoginFirst;
|
|
143
|
+
private askLoginFirst;
|
|
138
144
|
private isGuestCheckout;
|
|
139
145
|
private isGuestCheckoutAllowed;
|
|
140
146
|
private getRequiredShippingContactFields;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salla.sa/twilight-components",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.19",
|
|
4
4
|
"license": "GPL-3.0",
|
|
5
5
|
"author": "Salla Team <support@salla.dev> (https://salla.dev)",
|
|
6
6
|
"bugs": {
|
|
@@ -82,9 +82,9 @@
|
|
|
82
82
|
},
|
|
83
83
|
"dependencies": {
|
|
84
84
|
"@googlemaps/markerclusterer": "2.6.2",
|
|
85
|
-
"@salla.sa/applepay": "3.0.
|
|
86
|
-
"@salla.sa/twilight": "3.0.
|
|
87
|
-
"@salla.sa/twilight-tailwind-theme": "3.0.
|
|
85
|
+
"@salla.sa/applepay": "3.0.19",
|
|
86
|
+
"@salla.sa/twilight": "3.0.19",
|
|
87
|
+
"@salla.sa/twilight-tailwind-theme": "3.0.19",
|
|
88
88
|
"@salla.sa/ui-address-autocomplete-widget": "1.2.1",
|
|
89
89
|
"@salla.sa/ui-google-map-render": "1.2.1",
|
|
90
90
|
"@types/node": "^20.4.8",
|
|
@@ -104,5 +104,5 @@
|
|
|
104
104
|
"vanilla-lazyload": "^17.9.0",
|
|
105
105
|
"vanilla-picker": "^2.12.3"
|
|
106
106
|
},
|
|
107
|
-
"gitHead": "
|
|
107
|
+
"gitHead": "7668f911e50da28e3b118964ad95591db283bf40"
|
|
108
108
|
}
|
|
@@ -1,329 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Crafted with ❤ by Salla
|
|
3
|
-
*/
|
|
4
|
-
'use strict';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* API Service for salla-bullet-delivery component
|
|
8
|
-
* Uses Salla's shipping API and scope API for delivery location management
|
|
9
|
-
*/
|
|
10
|
-
const API_LOG_PREFIX = 'BulletDeliveryAPI';
|
|
11
|
-
const validId = (id) => {
|
|
12
|
-
const n = id == null ? Number.NaN : Number(id);
|
|
13
|
-
return !Number.isNaN(n) && n !== 0;
|
|
14
|
-
};
|
|
15
|
-
async function withApiErrorHandling(fn, fallback, logLabel) {
|
|
16
|
-
try {
|
|
17
|
-
return await fn();
|
|
18
|
-
}
|
|
19
|
-
catch (error) {
|
|
20
|
-
console.error(`${API_LOG_PREFIX}: ${logLabel}`, error);
|
|
21
|
-
return fallback;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
const apiCache = new Map();
|
|
25
|
-
const CACHE_TTL = 5 * 60 * 1000;
|
|
26
|
-
function getCached(key) {
|
|
27
|
-
const entry = apiCache.get(key);
|
|
28
|
-
if (!entry || Date.now() - entry.timestamp > CACHE_TTL) {
|
|
29
|
-
apiCache.delete(key);
|
|
30
|
-
return null;
|
|
31
|
-
}
|
|
32
|
-
return entry.data;
|
|
33
|
-
}
|
|
34
|
-
function setCache(key, data) {
|
|
35
|
-
apiCache.set(key, { data, timestamp: Date.now() });
|
|
36
|
-
}
|
|
37
|
-
/** Uses country code from API (e.g. 'SA'). */
|
|
38
|
-
const isSaudiArabia = (countryCode) => String(countryCode).toUpperCase() === 'SA';
|
|
39
|
-
/**
|
|
40
|
-
* Fast Delivery API Service
|
|
41
|
-
* Uses Salla's shipping API and scopes API. Branch and address data are used as returned by the API (no mapping).
|
|
42
|
-
*/
|
|
43
|
-
const bulletDeliveryAPI = {
|
|
44
|
-
/**
|
|
45
|
-
* Get available countries from Salla shipping API
|
|
46
|
-
* @param forBranch - when true, use for_branch=1 (e.g. for pickup/branches tab)
|
|
47
|
-
*/
|
|
48
|
-
async getCountries(forBranch = false, query) {
|
|
49
|
-
const cacheKey = !query?.trim() ? `countries_${forBranch ? 1 : 0}` : null;
|
|
50
|
-
if (cacheKey) {
|
|
51
|
-
const cached = getCached(cacheKey);
|
|
52
|
-
if (cached)
|
|
53
|
-
return cached;
|
|
54
|
-
}
|
|
55
|
-
const result = await withApiErrorHandling(async () => {
|
|
56
|
-
const params = { for_branch: forBranch ? 1 : 0 };
|
|
57
|
-
if (forBranch) {
|
|
58
|
-
params.for_allocation = 1;
|
|
59
|
-
}
|
|
60
|
-
if (query?.trim())
|
|
61
|
-
params.query = query.trim();
|
|
62
|
-
const data = (await salla.api.request("shipping/countries", { params }))?.data ?? [];
|
|
63
|
-
return data.map((c) => ({ id: c.id, code: c.code, name: c.name, has_regions: isSaudiArabia(c.code) }));
|
|
64
|
-
}, [], 'Error getting countries');
|
|
65
|
-
if (cacheKey && result.length > 0)
|
|
66
|
-
setCache(cacheKey, result);
|
|
67
|
-
return result;
|
|
68
|
-
},
|
|
69
|
-
/**
|
|
70
|
-
* Get regions for a country from Salla shipping API
|
|
71
|
-
* Endpoint: GET /shipping/countries/<COUNTRY_ID>/region
|
|
72
|
-
*/
|
|
73
|
-
async getRegions(countryId, query) {
|
|
74
|
-
if (!validId(countryId)) {
|
|
75
|
-
console.warn(`${API_LOG_PREFIX}: getRegions called without valid country_id`);
|
|
76
|
-
return [];
|
|
77
|
-
}
|
|
78
|
-
const cacheKey = !query?.trim() ? `regions_${countryId}` : null;
|
|
79
|
-
if (cacheKey) {
|
|
80
|
-
const cached = getCached(cacheKey);
|
|
81
|
-
if (cached)
|
|
82
|
-
return cached;
|
|
83
|
-
}
|
|
84
|
-
const result = await withApiErrorHandling(async () => {
|
|
85
|
-
const params = {};
|
|
86
|
-
if (query?.trim())
|
|
87
|
-
params.query = query.trim();
|
|
88
|
-
const data = (await salla.api.request(`shipping/countries/${countryId}/regions`, { params }))?.data ?? [];
|
|
89
|
-
return data.map((r) => ({ id: r.id, name: r.name, code: r.code, country_id: Number(countryId) }));
|
|
90
|
-
}, [], 'Error fetching regions');
|
|
91
|
-
if (cacheKey && result.length > 0)
|
|
92
|
-
setCache(cacheKey, result);
|
|
93
|
-
return result;
|
|
94
|
-
},
|
|
95
|
-
/**
|
|
96
|
-
* Get cities from Salla shipping API
|
|
97
|
-
* @param regionId - Optional; when provided (e.g. for SA), cities are filtered by region
|
|
98
|
-
*/
|
|
99
|
-
async getCities(countryId, regionId, query) {
|
|
100
|
-
if (!validId(countryId)) {
|
|
101
|
-
console.warn(`${API_LOG_PREFIX}: getCities called without valid country_id`);
|
|
102
|
-
return [];
|
|
103
|
-
}
|
|
104
|
-
const cacheKey = !query?.trim() ? `cities_${countryId}_${regionId || 'all'}` : null;
|
|
105
|
-
if (cacheKey) {
|
|
106
|
-
const cached = getCached(cacheKey);
|
|
107
|
-
if (cached)
|
|
108
|
-
return cached;
|
|
109
|
-
}
|
|
110
|
-
const result = await withApiErrorHandling(async () => {
|
|
111
|
-
const params = { for_branch: 0, country_id: countryId };
|
|
112
|
-
if (regionId)
|
|
113
|
-
params.region_id = regionId;
|
|
114
|
-
if (query?.trim())
|
|
115
|
-
params.query = query.trim();
|
|
116
|
-
const data = (await salla.api.request("shipping/cities", { params }))?.data ?? [];
|
|
117
|
-
return data.map((c) => ({ id: c.id, name: c.name, country_id: countryId, ...(c.region_id != null && { region_id: c.region_id }) }));
|
|
118
|
-
}, [], 'Error fetching cities');
|
|
119
|
-
if (cacheKey && result.length > 0)
|
|
120
|
-
setCache(cacheKey, result);
|
|
121
|
-
return result;
|
|
122
|
-
},
|
|
123
|
-
/**
|
|
124
|
-
* Get districts from Salla shipping API
|
|
125
|
-
*/
|
|
126
|
-
async getDistricts(cityId, query) {
|
|
127
|
-
if (!validId(cityId)) {
|
|
128
|
-
console.warn(`${API_LOG_PREFIX}: getDistricts called without valid city_id`);
|
|
129
|
-
return [];
|
|
130
|
-
}
|
|
131
|
-
return withApiErrorHandling(async () => {
|
|
132
|
-
const params = { for_branch: 0, city_id: cityId };
|
|
133
|
-
if (query?.trim())
|
|
134
|
-
params.query = query.trim();
|
|
135
|
-
const raw = (await salla.api.request("shipping/districts", { params }))?.data;
|
|
136
|
-
const list = Array.isArray(raw) ? raw : (Array.isArray(raw?.districts) ? raw.districts : []);
|
|
137
|
-
return list.map((d) => ({ id: d.id, name: d.name, name_en: d.name_en, city_id: cityId }));
|
|
138
|
-
}, [], 'Error fetching districts');
|
|
139
|
-
},
|
|
140
|
-
async getSavedAddresses() {
|
|
141
|
-
return withApiErrorHandling(async () => {
|
|
142
|
-
const data = (await salla.api.request("address"))?.data;
|
|
143
|
-
return Array.isArray(data) ? data : [];
|
|
144
|
-
}, [], 'Error fetching user addresses');
|
|
145
|
-
},
|
|
146
|
-
async getBranches({ query, lat, lng, country_id, per_page = 20 } = {}) {
|
|
147
|
-
const hasSearchParams = query?.trim()?.length >= 2 || lat || lng;
|
|
148
|
-
const cacheKey = !hasSearchParams && country_id ? `branches_${country_id}` : null;
|
|
149
|
-
if (cacheKey) {
|
|
150
|
-
const cached = getCached(cacheKey);
|
|
151
|
-
if (cached)
|
|
152
|
-
return cached;
|
|
153
|
-
}
|
|
154
|
-
const result = await withApiErrorHandling(async () => {
|
|
155
|
-
const params = { per_page };
|
|
156
|
-
if (query?.trim().length >= 2)
|
|
157
|
-
params.query = query;
|
|
158
|
-
if (lat)
|
|
159
|
-
params.lat = lat;
|
|
160
|
-
if (lng)
|
|
161
|
-
params.lng = lng;
|
|
162
|
-
if (country_id)
|
|
163
|
-
params.country_id = country_id;
|
|
164
|
-
const res = await salla.api.request("branches", { params });
|
|
165
|
-
return (Array.isArray(res?.data) ? res.data : []);
|
|
166
|
-
}, [], 'Error fetching branches');
|
|
167
|
-
if (cacheKey && result.length > 0)
|
|
168
|
-
setCache(cacheKey, result);
|
|
169
|
-
return result;
|
|
170
|
-
},
|
|
171
|
-
async saveAddressLocation(payload) {
|
|
172
|
-
return withApiErrorHandling(async () => {
|
|
173
|
-
const res = await salla.api.request('address/location', { ...payload, for_allocation: true }, 'post');
|
|
174
|
-
const data = res?.data ?? res;
|
|
175
|
-
const address = typeof data === 'object' && data != null && 'id' in data ? data : undefined;
|
|
176
|
-
return { success: true, address };
|
|
177
|
-
}, { success: false }, 'Error saving address/location');
|
|
178
|
-
},
|
|
179
|
-
async setDeliveryScope(scopeId) {
|
|
180
|
-
return withApiErrorHandling(async () => {
|
|
181
|
-
await salla.api.withoutNotifier(() => salla.scope.change({ id: scopeId }));
|
|
182
|
-
salla.storage.set("scope", { ...(salla.storage.get("scope") || {}), id: scopeId });
|
|
183
|
-
return true;
|
|
184
|
-
}, false, 'Error setting delivery scope');
|
|
185
|
-
},
|
|
186
|
-
async allocateScope(payload) {
|
|
187
|
-
const errMsg = (d) => d?.error?.message ?? d?.message ?? 'Failed to allocate scope';
|
|
188
|
-
try {
|
|
189
|
-
const response = await salla.api.withoutNotifier(() => salla.api.request("scopes/allocation", payload, 'post'));
|
|
190
|
-
// SDK resolves with { data } and throws on non-2xx; any resolved value is success
|
|
191
|
-
const data = response?.data ?? response;
|
|
192
|
-
return { success: true, data: data };
|
|
193
|
-
}
|
|
194
|
-
catch (error) {
|
|
195
|
-
console.error(`${API_LOG_PREFIX}: Error allocating scope`, error);
|
|
196
|
-
const err = error;
|
|
197
|
-
return { success: false, error: err?.response?.data != null ? errMsg(err.response.data) : (err?.message ?? 'Unknown error') };
|
|
198
|
-
}
|
|
199
|
-
},
|
|
200
|
-
async getAddressToken() {
|
|
201
|
-
return withApiErrorHandling(async () => {
|
|
202
|
-
const res = await salla.api.request('address/autocomplete-token');
|
|
203
|
-
return res?.data?.token ?? null;
|
|
204
|
-
}, null, 'Error fetching address autocomplete token');
|
|
205
|
-
},
|
|
206
|
-
};
|
|
207
|
-
function clearApiCache() {
|
|
208
|
-
apiCache.clear();
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
/**
|
|
212
|
-
* Helper functions for salla-bullet-delivery component
|
|
213
|
-
*/
|
|
214
|
-
const EARTH_RADIUS_KM = 6371;
|
|
215
|
-
const deg2rad = (deg) => deg * (Math.PI / 180);
|
|
216
|
-
/** Haversine distance in km */
|
|
217
|
-
function calculateDistance(lat1, lon1, lat2, lon2) {
|
|
218
|
-
const dLat = deg2rad(lat2 - lat1);
|
|
219
|
-
const dLon = deg2rad(lon2 - lon1);
|
|
220
|
-
const a = Math.sin(dLat / 2) ** 2 +
|
|
221
|
-
Math.cos(deg2rad(lat1)) * Math.cos(deg2rad(lat2)) * Math.sin(dLon / 2) ** 2;
|
|
222
|
-
return EARTH_RADIUS_KM * 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
|
|
223
|
-
}
|
|
224
|
-
/**
|
|
225
|
-
* Whether a pickup branch can be selected.
|
|
226
|
-
*
|
|
227
|
-
* `pickup_readiness` is the richer, backend-computed verdict (INV-357) and wins whenever the API
|
|
228
|
-
* sends it. Not every store's `GET /branches` returns it though, so we fall back to the original
|
|
229
|
-
* `is_open` rule instead of treating a missing object as "not selectable" — otherwise every branch
|
|
230
|
-
* in the list renders disabled and pickup cannot be chosen at all (SP-22202).
|
|
231
|
-
*/
|
|
232
|
-
const isBranchSelectable = (branch) => {
|
|
233
|
-
if (!branch)
|
|
234
|
-
return false;
|
|
235
|
-
const selectable = branch.pickup_readiness?.selectable;
|
|
236
|
-
return typeof selectable === 'boolean' ? selectable : branch.is_open !== false;
|
|
237
|
-
};
|
|
238
|
-
/** Nearest available branch by distance; single pass O(n). */
|
|
239
|
-
function findNearestBranch(branches, userLat, userLon) {
|
|
240
|
-
let nearest = null;
|
|
241
|
-
let minD = Number.POSITIVE_INFINITY;
|
|
242
|
-
for (const b of branches) {
|
|
243
|
-
const lat = b.location?.lat != null ? Number(b.location.lat) : Number.NaN;
|
|
244
|
-
const lng = b.location?.lng != null ? Number(b.location.lng) : Number.NaN;
|
|
245
|
-
if (Number.isNaN(lat) || Number.isNaN(lng) || !isBranchSelectable(b))
|
|
246
|
-
continue;
|
|
247
|
-
const d = calculateDistance(userLat, userLon, lat, lng);
|
|
248
|
-
if (d < minD) {
|
|
249
|
-
minD = d;
|
|
250
|
-
nearest = b;
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
return nearest;
|
|
254
|
-
}
|
|
255
|
-
const filterBranches = (branches, searchQuery) => {
|
|
256
|
-
if (!searchQuery)
|
|
257
|
-
return branches;
|
|
258
|
-
const q = searchQuery.toLowerCase();
|
|
259
|
-
return branches.filter((b) => b.name.toLowerCase().includes(q) || b.city?.name?.toLowerCase().includes(q));
|
|
260
|
-
};
|
|
261
|
-
const getIntentSubtitle = (intent, toAddress, fromBranch) => {
|
|
262
|
-
if (intent.type === 'branch') {
|
|
263
|
-
const loc = [intent.branch_details?.country, intent.branch_details?.city, intent.branch_details?.district].filter(Boolean).join('، ');
|
|
264
|
-
return loc ? `${fromBranch} ${loc}`.trim() : '';
|
|
265
|
-
}
|
|
266
|
-
if (intent.type === 'address' && intent.address_details) {
|
|
267
|
-
const addr = [intent.address_details.country?.name, intent.address_details.city?.name, intent.address_details.district?.name].filter(Boolean).join('، ') || intent.address_details.short_address || '';
|
|
268
|
-
return addr ? `${toAddress} ${addr}`.trim() : '';
|
|
269
|
-
}
|
|
270
|
-
return '';
|
|
271
|
-
};
|
|
272
|
-
const idFrom = (val) => (val != null ? Number(val) : undefined);
|
|
273
|
-
const getIntentCountryId = (i) => idFrom(i?.address_details?.country?.id);
|
|
274
|
-
const getIntentCountryCode = (i) => i?.country_code ?? i?.address_details?.country?.code ?? '';
|
|
275
|
-
const getIntentRegionId = (i) => idFrom(i?.address_details?.region?.id);
|
|
276
|
-
const getIntentCityId = (i) => idFrom(i?.address_details?.city?.id);
|
|
277
|
-
const getIntentDistrictId = (i) => idFrom(i?.address_details?.district?.id);
|
|
278
|
-
const getIntentBranchId = (i) => i?.branch_details?.id;
|
|
279
|
-
/** Intent coordinates (branch tab only; address flow no longer uses coordinates). */
|
|
280
|
-
const getIntentLatitude = (i) => i?.branch_details?.latitude;
|
|
281
|
-
const getIntentLongitude = (i) => i?.branch_details?.longitude;
|
|
282
|
-
const isMapOriginIntent = (i) => !!i && i.type === 'address' && i.address_details?.lat != null && i.address_details?.lng != null;
|
|
283
|
-
const hasSessionAddressIntent = (intent) => {
|
|
284
|
-
if (!intent || intent.type !== 'address' || intent.address_id)
|
|
285
|
-
return false;
|
|
286
|
-
if (isMapOriginIntent(intent))
|
|
287
|
-
return true;
|
|
288
|
-
const c = getIntentCountryId(intent);
|
|
289
|
-
const city = getIntentCityId(intent);
|
|
290
|
-
const d = getIntentDistrictId(intent);
|
|
291
|
-
const code = getIntentCountryCode(intent);
|
|
292
|
-
const hasDistrictId = d != null && Number(d) !== 0;
|
|
293
|
-
const hasDistrictName = Boolean(intent.address_details?.district?.name?.trim());
|
|
294
|
-
const districtOk = !isSaudiArabia(code) || hasDistrictId || hasDistrictName;
|
|
295
|
-
return !!(c && city && districtOk);
|
|
296
|
-
};
|
|
297
|
-
const requireRegionAndDistrictForSA = (countryCode, regionId, districtIdOrName) => !countryCode || !isSaudiArabia(countryCode)
|
|
298
|
-
? true
|
|
299
|
-
: (regionId != null && Number(regionId) !== 0) && (districtIdOrName != null && (typeof districtIdOrName === 'number' ? districtIdOrName !== 0 : String(districtIdOrName).trim().length > 0));
|
|
300
|
-
// Geolocation error codes - fallback constants for non-browser environments
|
|
301
|
-
const GEO_ERROR_PERMISSION_DENIED = typeof GeolocationPositionError !== 'undefined' ? GeolocationPositionError.PERMISSION_DENIED : 1;
|
|
302
|
-
const GEO_ERROR_POSITION_UNAVAILABLE = typeof GeolocationPositionError !== 'undefined' ? GeolocationPositionError.POSITION_UNAVAILABLE : 2;
|
|
303
|
-
const GEO_ERROR_TIMEOUT = typeof GeolocationPositionError !== 'undefined' ? GeolocationPositionError.TIMEOUT : 3;
|
|
304
|
-
const GEO_ERROR_MESSAGES = {
|
|
305
|
-
[GEO_ERROR_PERMISSION_DENIED]: 'Location permission denied',
|
|
306
|
-
[GEO_ERROR_POSITION_UNAVAILABLE]: 'Location unavailable',
|
|
307
|
-
[GEO_ERROR_TIMEOUT]: 'Location timeout',
|
|
308
|
-
};
|
|
309
|
-
const getGeolocationErrorMessage = (errorCode) => GEO_ERROR_MESSAGES[errorCode] ?? 'An error occurred while detecting location';
|
|
310
|
-
|
|
311
|
-
exports.bulletDeliveryAPI = bulletDeliveryAPI;
|
|
312
|
-
exports.clearApiCache = clearApiCache;
|
|
313
|
-
exports.filterBranches = filterBranches;
|
|
314
|
-
exports.findNearestBranch = findNearestBranch;
|
|
315
|
-
exports.getGeolocationErrorMessage = getGeolocationErrorMessage;
|
|
316
|
-
exports.getIntentBranchId = getIntentBranchId;
|
|
317
|
-
exports.getIntentCityId = getIntentCityId;
|
|
318
|
-
exports.getIntentCountryCode = getIntentCountryCode;
|
|
319
|
-
exports.getIntentCountryId = getIntentCountryId;
|
|
320
|
-
exports.getIntentDistrictId = getIntentDistrictId;
|
|
321
|
-
exports.getIntentLatitude = getIntentLatitude;
|
|
322
|
-
exports.getIntentLongitude = getIntentLongitude;
|
|
323
|
-
exports.getIntentRegionId = getIntentRegionId;
|
|
324
|
-
exports.getIntentSubtitle = getIntentSubtitle;
|
|
325
|
-
exports.hasSessionAddressIntent = hasSessionAddressIntent;
|
|
326
|
-
exports.isBranchSelectable = isBranchSelectable;
|
|
327
|
-
exports.isMapOriginIntent = isMapOriginIntent;
|
|
328
|
-
exports.isSaudiArabia = isSaudiArabia;
|
|
329
|
-
exports.requireRegionAndDistrictForSA = requireRegionAndDistrictForSA;
|