@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.
Files changed (331) hide show
  1. package/dist/cjs/{filepond-B0aAvhFd.js → filepond-D2YavdCs.js} +1 -1
  2. package/dist/cjs/{filepond-plugin-file-poster-BFqqCNYU.js → filepond-plugin-file-poster-1wvhm3fc.js} +1 -1
  3. package/dist/cjs/{filepond-plugin-file-validate-size-BNcTcX1x.js → filepond-plugin-file-validate-size-BJQGWxdQ.js} +1 -1
  4. package/dist/cjs/{filepond-plugin-file-validate-type-DAWd81u4.js → filepond-plugin-file-validate-type-Cj_4I_GJ.js} +1 -1
  5. package/dist/cjs/{filepond-plugin-image-edit-CIg9FEsX.js → filepond-plugin-image-edit-wf7RYTkL.js} +1 -1
  6. package/dist/cjs/{filepond-plugin-image-exif-orientation--VivPhX_.js → filepond-plugin-image-exif-orientation-BPs9o0xx.js} +1 -1
  7. package/dist/cjs/{filepond-plugin-image-preview-apJ7tv7p.js → filepond-plugin-image-preview-fGpSUIm-.js} +1 -1
  8. package/dist/cjs/helpers-DHdDjm5V.js +340 -0
  9. package/dist/cjs/{index-ufJ3UmgO.js → index-CvqLEBf0.js} +2 -2
  10. package/dist/cjs/{intlTelInput-1mNNQjMC.js → intlTelInput-C1wAR7s0.js} +1 -1
  11. package/dist/cjs/loader.cjs.js +1 -1
  12. package/dist/cjs/salla-accordion-body_2.cjs.entry.js +1 -1
  13. package/dist/cjs/salla-accordion_6.cjs.entry.js +1 -1
  14. package/dist/cjs/salla-add-product-button_5.cjs.entry.js +1 -1
  15. package/dist/cjs/salla-advertisement.cjs.entry.js +1 -1
  16. package/dist/cjs/salla-alert_2.cjs.entry.js +1 -1
  17. package/dist/cjs/salla-app-install-alert.cjs.entry.js +1 -1
  18. package/dist/cjs/salla-apps-icons.cjs.entry.js +1 -1
  19. package/dist/cjs/salla-attachment-view_9.cjs.entry.js +10 -10
  20. package/dist/cjs/salla-badge.cjs.entry.js +1 -1
  21. package/dist/cjs/salla-basket-gap.cjs.entry.js +1 -1
  22. package/dist/cjs/salla-bullet-delivery_2.cjs.entry.js +156 -401
  23. package/dist/cjs/salla-cart-coupons.cjs.entry.js +1 -1
  24. package/dist/cjs/salla-cart-item-offers_2.cjs.entry.js +1 -1
  25. package/dist/cjs/salla-cart-summary-card.cjs.entry.js +1 -1
  26. package/dist/cjs/salla-cashback-banner.cjs.entry.js +1 -1
  27. package/dist/cjs/salla-comment-factors.cjs.entry.js +1 -1
  28. package/dist/cjs/salla-comment-form_8.cjs.entry.js +1 -1
  29. package/dist/cjs/salla-conditional-offer.cjs.entry.js +1 -1
  30. package/dist/cjs/salla-contacts.cjs.entry.js +1 -1
  31. package/dist/cjs/salla-cookies-bar.cjs.entry.js +1 -1
  32. package/dist/cjs/salla-count-down.cjs.entry.js +1 -1
  33. package/dist/cjs/salla-custom-fields.cjs.entry.js +1 -1
  34. package/dist/cjs/salla-delivery-promise.cjs.entry.js +21 -5
  35. package/dist/cjs/salla-edit-order-button.cjs.entry.js +1 -1
  36. package/dist/cjs/salla-filters-widget.cjs.entry.js +1 -1
  37. package/dist/cjs/salla-filters.cjs.entry.js +1 -1
  38. package/dist/cjs/salla-fulfillment-methods.cjs.entry.js +1 -1
  39. package/dist/cjs/salla-gifting.cjs.entry.js +1 -1
  40. package/dist/cjs/salla-hook.cjs.entry.js +1 -1
  41. package/dist/cjs/salla-infinite-scroll.cjs.entry.js +1 -1
  42. package/dist/cjs/salla-installment.cjs.entry.js +1 -1
  43. package/dist/cjs/salla-list-tile.cjs.entry.js +1 -1
  44. package/dist/cjs/salla-localization-modal.cjs.entry.js +1 -1
  45. package/dist/cjs/salla-login-modal.cjs.entry.js +1 -1
  46. package/dist/cjs/salla-loyalty-banner_10.cjs.entry.js +1 -1
  47. package/dist/cjs/salla-loyalty-exchange-product-card.cjs.entry.js +1 -1
  48. package/dist/cjs/salla-loyalty-points-banner.cjs.entry.js +1 -1
  49. package/dist/cjs/salla-loyalty-points-history.cjs.entry.js +1 -1
  50. package/dist/cjs/salla-loyalty-prize-item.cjs.entry.js +1 -1
  51. package/dist/cjs/salla-loyalty.cjs.entry.js +1 -1
  52. package/dist/cjs/salla-maintenance-alert.cjs.entry.js +1 -1
  53. package/dist/cjs/salla-map_2.cjs.entry.js +1 -1
  54. package/dist/cjs/salla-menu.cjs.entry.js +1 -1
  55. package/dist/cjs/salla-metadata.cjs.entry.js +1 -1
  56. package/dist/cjs/salla-multiple-bundle-product-cart_2.cjs.entry.js +1 -1
  57. package/dist/cjs/salla-multiple-bundle-product-options-modal_2.cjs.entry.js +1 -1
  58. package/dist/cjs/salla-multiple-bundle-product.cjs.entry.js +1 -1
  59. package/dist/cjs/salla-next-order-coupon.cjs.entry.js +1 -1
  60. package/dist/cjs/salla-notification-item_2.cjs.entry.js +1 -1
  61. package/dist/cjs/salla-offer-modal.cjs.entry.js +1 -1
  62. package/dist/cjs/salla-offer.cjs.entry.js +1 -1
  63. package/dist/cjs/salla-order-branch.cjs.entry.js +1 -1
  64. package/dist/cjs/salla-order-cancel.cjs.entry.js +1 -1
  65. package/dist/cjs/salla-order-details-multiple-bundle-product.cjs.entry.js +1 -1
  66. package/dist/cjs/salla-order-details-options.cjs.entry.js +1 -1
  67. package/dist/cjs/salla-order-details.cjs.entry.js +1 -1
  68. package/dist/cjs/salla-order-edit-item.cjs.entry.js +1 -1
  69. package/dist/cjs/salla-order-edit-product-card.cjs.entry.js +1 -1
  70. package/dist/cjs/salla-order-edit.cjs.entry.js +1 -1
  71. package/dist/cjs/salla-order-options-modal_2.cjs.entry.js +1 -1
  72. package/dist/cjs/salla-order-shipments.cjs.entry.js +1 -1
  73. package/dist/cjs/salla-order-summary.cjs.entry.js +1 -1
  74. package/dist/cjs/salla-order-totals-card.cjs.entry.js +1 -1
  75. package/dist/cjs/salla-orders.cjs.entry.js +1 -1
  76. package/dist/cjs/salla-payments.cjs.entry.js +1 -1
  77. package/dist/cjs/salla-placeholder.cjs.entry.js +1 -1
  78. package/dist/cjs/salla-price-range.cjs.entry.js +1 -1
  79. package/dist/cjs/salla-product-card-embed.cjs.entry.js +1 -1
  80. package/dist/cjs/salla-product-size-guide.cjs.entry.js +1 -1
  81. package/dist/cjs/salla-products-list.cjs.entry.js +1 -1
  82. package/dist/cjs/salla-products-slider.cjs.entry.js +1 -1
  83. package/dist/cjs/salla-quick-order.cjs.entry.js +1 -1
  84. package/dist/cjs/salla-rating-modal-v2.cjs.entry.js +1 -1
  85. package/dist/cjs/salla-rating-modal.cjs.entry.js +1 -1
  86. package/dist/cjs/salla-review-factors-tags.cjs.entry.js +1 -1
  87. package/dist/cjs/salla-review-order-item.cjs.entry.js +1 -1
  88. package/dist/cjs/salla-scopes.cjs.entry.js +1 -1
  89. package/dist/cjs/salla-search.cjs.entry.js +1 -1
  90. package/dist/cjs/salla-skeleton.cjs.entry.js +1 -1
  91. package/dist/cjs/salla-slider.cjs.entry.js +1 -1
  92. package/dist/cjs/salla-social-share.cjs.entry.js +1 -1
  93. package/dist/cjs/salla-social.cjs.entry.js +1 -1
  94. package/dist/cjs/salla-tab-content_3.cjs.entry.js +1 -1
  95. package/dist/cjs/salla-tiered-offer.cjs.entry.js +1 -1
  96. package/dist/cjs/salla-tooltip.cjs.entry.js +1 -1
  97. package/dist/cjs/salla-trust-badges.cjs.entry.js +1 -1
  98. package/dist/cjs/salla-user-menu.cjs.entry.js +1 -1
  99. package/dist/cjs/salla-user-profile.cjs.entry.js +1 -1
  100. package/dist/cjs/salla-user-settings.cjs.entry.js +1 -1
  101. package/dist/cjs/salla-verify.cjs.entry.js +1 -1
  102. package/dist/cjs/salla-wallet.cjs.entry.js +1 -1
  103. package/dist/cjs/salla-wishlist-actions.cjs.entry.js +1 -1
  104. package/dist/cjs/twilight.cjs.js +1 -1
  105. package/dist/cjs/{vanilla-picker-DvN9odkn.js → vanilla-picker-BzqeTGIZ.js} +1 -1
  106. package/dist/collection/components/salla-bullet-delivery/helpers.js +3 -0
  107. package/dist/collection/components/salla-bullet-delivery/salla-bullet-delivery.js +82 -16
  108. package/dist/collection/components/salla-delivery-promise/delivery-promise-api.js +1 -1
  109. package/dist/collection/components/salla-delivery-promise/delivery-promise-intent.js +9 -0
  110. package/dist/collection/components/salla-delivery-promise/salla-delivery-promise.js +10 -3
  111. package/dist/components/helpers.js +319 -0
  112. package/dist/components/index.js +2 -2
  113. package/dist/components/salla-bullet-delivery.js +82 -327
  114. package/dist/components/salla-delivery-promise.js +20 -4
  115. package/dist/esm/{filepond-BJvckaDn.js → filepond-XV8z8Gy4.js} +1 -1
  116. package/dist/esm/{filepond-plugin-file-poster-BJGjo9nD.js → filepond-plugin-file-poster-Ck2HvsnC.js} +1 -1
  117. package/dist/esm/{filepond-plugin-file-validate-size-DLFBVAw5.js → filepond-plugin-file-validate-size-f2fJ8Xjg.js} +1 -1
  118. package/dist/esm/{filepond-plugin-file-validate-type-Cl7gFtPR.js → filepond-plugin-file-validate-type-BsyQIuBO.js} +1 -1
  119. package/dist/esm/{filepond-plugin-image-edit-P-yC8gQP.js → filepond-plugin-image-edit-C9m-0BT7.js} +1 -1
  120. package/dist/esm/{filepond-plugin-image-exif-orientation-Ck7hEAD_.js → filepond-plugin-image-exif-orientation-BM1BifD4.js} +1 -1
  121. package/dist/esm/{filepond-plugin-image-preview-BSCNg5pC.js → filepond-plugin-image-preview-CfJu8_cN.js} +1 -1
  122. package/dist/esm/helpers-BDChq2t4.js +319 -0
  123. package/dist/esm/{index-DaGqpYdk.js → index-Dcu3dMye.js} +2 -2
  124. package/dist/esm/{intlTelInput-CFalf-QE.js → intlTelInput-jRi7Hmv8.js} +1 -1
  125. package/dist/esm/loader.js +2 -2
  126. package/dist/esm/salla-accordion-body_2.entry.js +1 -1
  127. package/dist/esm/salla-accordion_6.entry.js +1 -1
  128. package/dist/esm/salla-add-product-button_5.entry.js +1 -1
  129. package/dist/esm/salla-advertisement.entry.js +1 -1
  130. package/dist/esm/salla-alert_2.entry.js +1 -1
  131. package/dist/esm/salla-app-install-alert.entry.js +1 -1
  132. package/dist/esm/salla-apps-icons.entry.js +1 -1
  133. package/dist/esm/salla-attachment-view_9.entry.js +10 -10
  134. package/dist/esm/salla-badge.entry.js +1 -1
  135. package/dist/esm/salla-basket-gap.entry.js +1 -1
  136. package/dist/esm/salla-bullet-delivery_2.entry.js +83 -328
  137. package/dist/esm/salla-cart-coupons.entry.js +1 -1
  138. package/dist/esm/salla-cart-item-offers_2.entry.js +1 -1
  139. package/dist/esm/salla-cart-summary-card.entry.js +1 -1
  140. package/dist/esm/salla-cashback-banner.entry.js +1 -1
  141. package/dist/esm/salla-comment-factors.entry.js +1 -1
  142. package/dist/esm/salla-comment-form_8.entry.js +1 -1
  143. package/dist/esm/salla-conditional-offer.entry.js +1 -1
  144. package/dist/esm/salla-contacts.entry.js +1 -1
  145. package/dist/esm/salla-cookies-bar.entry.js +1 -1
  146. package/dist/esm/salla-count-down.entry.js +1 -1
  147. package/dist/esm/salla-custom-fields.entry.js +1 -1
  148. package/dist/esm/salla-delivery-promise.entry.js +21 -5
  149. package/dist/esm/salla-edit-order-button.entry.js +1 -1
  150. package/dist/esm/salla-filters-widget.entry.js +1 -1
  151. package/dist/esm/salla-filters.entry.js +1 -1
  152. package/dist/esm/salla-fulfillment-methods.entry.js +1 -1
  153. package/dist/esm/salla-gifting.entry.js +1 -1
  154. package/dist/esm/salla-hook.entry.js +1 -1
  155. package/dist/esm/salla-infinite-scroll.entry.js +1 -1
  156. package/dist/esm/salla-installment.entry.js +1 -1
  157. package/dist/esm/salla-list-tile.entry.js +1 -1
  158. package/dist/esm/salla-localization-modal.entry.js +1 -1
  159. package/dist/esm/salla-login-modal.entry.js +1 -1
  160. package/dist/esm/salla-loyalty-banner_10.entry.js +1 -1
  161. package/dist/esm/salla-loyalty-exchange-product-card.entry.js +1 -1
  162. package/dist/esm/salla-loyalty-points-banner.entry.js +1 -1
  163. package/dist/esm/salla-loyalty-points-history.entry.js +1 -1
  164. package/dist/esm/salla-loyalty-prize-item.entry.js +1 -1
  165. package/dist/esm/salla-loyalty.entry.js +1 -1
  166. package/dist/esm/salla-maintenance-alert.entry.js +1 -1
  167. package/dist/esm/salla-map_2.entry.js +1 -1
  168. package/dist/esm/salla-menu.entry.js +1 -1
  169. package/dist/esm/salla-metadata.entry.js +1 -1
  170. package/dist/esm/salla-multiple-bundle-product-cart_2.entry.js +1 -1
  171. package/dist/esm/salla-multiple-bundle-product-options-modal_2.entry.js +1 -1
  172. package/dist/esm/salla-multiple-bundle-product.entry.js +1 -1
  173. package/dist/esm/salla-next-order-coupon.entry.js +1 -1
  174. package/dist/esm/salla-notification-item_2.entry.js +1 -1
  175. package/dist/esm/salla-offer-modal.entry.js +1 -1
  176. package/dist/esm/salla-offer.entry.js +1 -1
  177. package/dist/esm/salla-order-branch.entry.js +1 -1
  178. package/dist/esm/salla-order-cancel.entry.js +1 -1
  179. package/dist/esm/salla-order-details-multiple-bundle-product.entry.js +1 -1
  180. package/dist/esm/salla-order-details-options.entry.js +1 -1
  181. package/dist/esm/salla-order-details.entry.js +1 -1
  182. package/dist/esm/salla-order-edit-item.entry.js +1 -1
  183. package/dist/esm/salla-order-edit-product-card.entry.js +1 -1
  184. package/dist/esm/salla-order-edit.entry.js +1 -1
  185. package/dist/esm/salla-order-options-modal_2.entry.js +1 -1
  186. package/dist/esm/salla-order-shipments.entry.js +1 -1
  187. package/dist/esm/salla-order-summary.entry.js +1 -1
  188. package/dist/esm/salla-order-totals-card.entry.js +1 -1
  189. package/dist/esm/salla-orders.entry.js +1 -1
  190. package/dist/esm/salla-payments.entry.js +1 -1
  191. package/dist/esm/salla-placeholder.entry.js +1 -1
  192. package/dist/esm/salla-price-range.entry.js +1 -1
  193. package/dist/esm/salla-product-card-embed.entry.js +1 -1
  194. package/dist/esm/salla-product-size-guide.entry.js +1 -1
  195. package/dist/esm/salla-products-list.entry.js +1 -1
  196. package/dist/esm/salla-products-slider.entry.js +1 -1
  197. package/dist/esm/salla-quick-order.entry.js +1 -1
  198. package/dist/esm/salla-rating-modal-v2.entry.js +1 -1
  199. package/dist/esm/salla-rating-modal.entry.js +1 -1
  200. package/dist/esm/salla-review-factors-tags.entry.js +1 -1
  201. package/dist/esm/salla-review-order-item.entry.js +1 -1
  202. package/dist/esm/salla-scopes.entry.js +1 -1
  203. package/dist/esm/salla-search.entry.js +1 -1
  204. package/dist/esm/salla-skeleton.entry.js +1 -1
  205. package/dist/esm/salla-slider.entry.js +1 -1
  206. package/dist/esm/salla-social-share.entry.js +1 -1
  207. package/dist/esm/salla-social.entry.js +1 -1
  208. package/dist/esm/salla-tab-content_3.entry.js +1 -1
  209. package/dist/esm/salla-tiered-offer.entry.js +1 -1
  210. package/dist/esm/salla-tooltip.entry.js +1 -1
  211. package/dist/esm/salla-trust-badges.entry.js +1 -1
  212. package/dist/esm/salla-user-menu.entry.js +1 -1
  213. package/dist/esm/salla-user-profile.entry.js +1 -1
  214. package/dist/esm/salla-user-settings.entry.js +1 -1
  215. package/dist/esm/salla-verify.entry.js +1 -1
  216. package/dist/esm/salla-wallet.entry.js +1 -1
  217. package/dist/esm/salla-wishlist-actions.entry.js +1 -1
  218. package/dist/esm/twilight.js +2 -2
  219. package/dist/esm/{vanilla-picker-BPvYmRRu.js → vanilla-picker-DjLezF11.js} +1 -1
  220. package/dist/twilight/{p-32ceb30c.entry.js → p-059aee01.entry.js} +1 -1
  221. package/dist/twilight/{p-7bcd6e69.entry.js → p-073a7157.entry.js} +1 -1
  222. package/dist/twilight/{p-11347c90.entry.js → p-08a1a73f.entry.js} +1 -1
  223. package/dist/twilight/{p-25b45505.entry.js → p-0a3643ff.entry.js} +1 -1
  224. package/dist/twilight/{p-e6090253.entry.js → p-0b692ff6.entry.js} +1 -1
  225. package/dist/twilight/{p-a49c78f0.entry.js → p-1cdc7df7.entry.js} +1 -1
  226. package/dist/twilight/{p-58d25433.entry.js → p-215b7413.entry.js} +1 -1
  227. package/dist/twilight/{p-8d8fe545.entry.js → p-22d83109.entry.js} +1 -1
  228. package/dist/twilight/{p-8d4fe636.entry.js → p-238159b4.entry.js} +1 -1
  229. package/dist/twilight/{p-72000ddb.entry.js → p-24c4551f.entry.js} +1 -1
  230. package/dist/twilight/{p-d16998b0.entry.js → p-2794bed4.entry.js} +1 -1
  231. package/dist/twilight/{p-17d19645.entry.js → p-2ab14328.entry.js} +1 -1
  232. package/dist/twilight/{p-1f63a8a3.entry.js → p-2c4142b6.entry.js} +1 -1
  233. package/dist/twilight/{p-8a12cb3e.entry.js → p-2c9492d1.entry.js} +1 -1
  234. package/dist/twilight/{p-b13f73f7.entry.js → p-2df9a0f0.entry.js} +1 -1
  235. package/dist/twilight/{p-7a321b1c.entry.js → p-3296a02a.entry.js} +1 -1
  236. package/dist/twilight/{p-77391513.entry.js → p-34012a2c.entry.js} +1 -1
  237. package/dist/twilight/{p-a77540ee.entry.js → p-34a1a53d.entry.js} +1 -1
  238. package/dist/twilight/{p-8e288b57.entry.js → p-38711460.entry.js} +1 -1
  239. package/dist/twilight/{p-16c80467.entry.js → p-3a44eb5e.entry.js} +1 -1
  240. package/dist/twilight/{p-390d4d73.entry.js → p-3cead23a.entry.js} +1 -1
  241. package/dist/twilight/{p-3282b3a6.entry.js → p-55b6fa95.entry.js} +1 -1
  242. package/dist/twilight/{p-0df4b2e1.entry.js → p-56582f0b.entry.js} +1 -1
  243. package/dist/twilight/{p-f1077a6e.entry.js → p-5924286a.entry.js} +1 -1
  244. package/dist/twilight/{p-21ca76cd.entry.js → p-5b7c6098.entry.js} +1 -1
  245. package/dist/twilight/{p-b948c4e7.entry.js → p-5cb5b3fd.entry.js} +1 -1
  246. package/dist/twilight/{p-d9ff0ef8.entry.js → p-5e3b238a.entry.js} +1 -1
  247. package/dist/twilight/{p-26a4ab4b.entry.js → p-5f369929.entry.js} +1 -1
  248. package/dist/twilight/{p-ed7597fe.entry.js → p-5f710118.entry.js} +1 -1
  249. package/dist/twilight/{p-30201fb9.entry.js → p-623a21b4.entry.js} +1 -1
  250. package/dist/twilight/{p-a89ae474.entry.js → p-625d6454.entry.js} +1 -1
  251. package/dist/twilight/{p-e6e778d0.entry.js → p-67abcd3f.entry.js} +1 -1
  252. package/dist/twilight/{p-096b05e7.entry.js → p-6c05a804.entry.js} +1 -1
  253. package/dist/twilight/{p-4860edc2.entry.js → p-6c44c16d.entry.js} +1 -1
  254. package/dist/twilight/{p-97ce9cb0.entry.js → p-6e5164d8.entry.js} +1 -1
  255. package/dist/twilight/{p-dd2f9c7d.entry.js → p-70c4d653.entry.js} +1 -1
  256. package/dist/twilight/{p-c55ce57e.entry.js → p-71c08a0a.entry.js} +1 -1
  257. package/dist/twilight/{p-243dc280.entry.js → p-74108ca1.entry.js} +1 -1
  258. package/dist/twilight/{p-684d6eb1.entry.js → p-75f0e895.entry.js} +1 -1
  259. package/dist/twilight/{p-b4db2812.entry.js → p-80e5c12c.entry.js} +1 -1
  260. package/dist/twilight/{p-ac7422d5.entry.js → p-87250079.entry.js} +1 -1
  261. package/dist/twilight/{p-59c4876b.entry.js → p-88bf1650.entry.js} +1 -1
  262. package/dist/twilight/{p-42dccb9d.entry.js → p-8b07421d.entry.js} +1 -1
  263. package/dist/twilight/{p-96f7014a.entry.js → p-8d92b009.entry.js} +1 -1
  264. package/dist/twilight/{p-4f59ac12.entry.js → p-8fb64951.entry.js} +1 -1
  265. package/dist/twilight/{p-494948d0.entry.js → p-90bd015d.entry.js} +1 -1
  266. package/dist/twilight/{p-f1d5bc83.entry.js → p-9223db5a.entry.js} +1 -1
  267. package/dist/twilight/{p-505ff5ef.entry.js → p-93cd4a1f.entry.js} +1 -1
  268. package/dist/twilight/{p-06558ec3.entry.js → p-969fbe80.entry.js} +1 -1
  269. package/dist/twilight/{p-73edafaa.entry.js → p-9748360e.entry.js} +1 -1
  270. package/dist/twilight/{p-e088823b.entry.js → p-9829a35d.entry.js} +1 -1
  271. package/dist/twilight/{p-c7f384ba.entry.js → p-993363c6.entry.js} +1 -1
  272. package/dist/twilight/{p-d4ba3882.entry.js → p-99cc7bc5.entry.js} +1 -1
  273. package/dist/twilight/{p-82fb654b.entry.js → p-9b9aebca.entry.js} +1 -1
  274. package/dist/twilight/{p-46e413e3.entry.js → p-9ddd0fac.entry.js} +1 -1
  275. package/dist/twilight/{p-2996d4b7.entry.js → p-9ec8f2e5.entry.js} +1 -1
  276. package/dist/twilight/{p-1cfd78ce.entry.js → p-9f595ce2.entry.js} +1 -1
  277. package/dist/twilight/{p-BQK0M8C7.js → p-B93RJ_yi.js} +1 -1
  278. package/dist/twilight/p-BDChq2t4.js +4 -0
  279. package/dist/twilight/{p-BG6uSDFf.js → p-BrGtlWws.js} +1 -1
  280. package/dist/twilight/{p-B-gnDFoe.js → p-Bt8nb1uS.js} +1 -1
  281. package/dist/twilight/{p-DXvNz88d.js → p-BtKdrYj5.js} +1 -1
  282. package/dist/twilight/{p-WLC9KdSz.js → p-CBemP5xi.js} +1 -1
  283. package/dist/twilight/{p-BimR7cIN.js → p-CJfJMerR.js} +1 -1
  284. package/dist/twilight/{p-DaGqpYdk.js → p-Dcu3dMye.js} +1 -1
  285. package/dist/twilight/{p-BqpEp7-e.js → p-DmjaYLNC.js} +1 -1
  286. package/dist/twilight/{p-B0zeNMnk.js → p-TGGC4EhK.js} +1 -1
  287. package/dist/twilight/{p-e5f6f36a.entry.js → p-a4c3d3e7.entry.js} +1 -1
  288. package/dist/twilight/{p-ea05a3b9.entry.js → p-a78ffd28.entry.js} +1 -1
  289. package/dist/twilight/{p-cdaafc9b.entry.js → p-ace973fb.entry.js} +1 -1
  290. package/dist/twilight/{p-c2b80e5c.entry.js → p-b4aea704.entry.js} +1 -1
  291. package/dist/twilight/{p-77ba1fda.entry.js → p-b5db2536.entry.js} +1 -1
  292. package/dist/twilight/{p-72ae244c.entry.js → p-b61b9a75.entry.js} +1 -1
  293. package/dist/twilight/{p-930f7101.entry.js → p-b7d98778.entry.js} +1 -1
  294. package/dist/twilight/p-b8323755.entry.js +4 -0
  295. package/dist/twilight/{p-4c30313e.entry.js → p-bb9a2f4e.entry.js} +1 -1
  296. package/dist/twilight/{p-71ced4b7.entry.js → p-bc370fba.entry.js} +1 -1
  297. package/dist/twilight/{p-c34bf692.entry.js → p-bf0a3c8c.entry.js} +1 -1
  298. package/dist/twilight/{p-d3ab94f2.entry.js → p-c33a1072.entry.js} +1 -1
  299. package/dist/twilight/{p-29cddb02.entry.js → p-c897cbe7.entry.js} +1 -1
  300. package/dist/twilight/{p-7763e0be.entry.js → p-cce7acc0.entry.js} +1 -1
  301. package/dist/twilight/{p-a08fb92b.entry.js → p-cec395cd.entry.js} +1 -1
  302. package/dist/twilight/{p-e50e92d4.entry.js → p-d0f0f19a.entry.js} +1 -1
  303. package/dist/twilight/{p-495b632f.entry.js → p-d1fccce6.entry.js} +1 -1
  304. package/dist/twilight/{p-5c51b1a6.entry.js → p-d3e729ab.entry.js} +1 -1
  305. package/dist/twilight/{p-6413aff2.entry.js → p-d6d94ebb.entry.js} +1 -1
  306. package/dist/twilight/{p-c21a156c.entry.js → p-d72c765c.entry.js} +1 -1
  307. package/dist/twilight/{p-53735832.entry.js → p-dac4fe78.entry.js} +1 -1
  308. package/dist/twilight/{p-09848b04.entry.js → p-ddecbb55.entry.js} +1 -1
  309. package/dist/twilight/{p-61eeadbb.entry.js → p-df6ce40c.entry.js} +1 -1
  310. package/dist/twilight/{p-de002b09.entry.js → p-e33bfb84.entry.js} +1 -1
  311. package/dist/twilight/{p-6794c97c.entry.js → p-e3923ba1.entry.js} +1 -1
  312. package/dist/twilight/{p-cc80d691.entry.js → p-eac3ee6a.entry.js} +1 -1
  313. package/dist/twilight/p-ec7efed0.entry.js +1024 -0
  314. package/dist/twilight/{p-7bb14e7b.entry.js → p-ef5bacc9.entry.js} +1 -1
  315. package/dist/twilight/{p-7d24fc33.entry.js → p-ef6b8ec8.entry.js} +1 -1
  316. package/dist/twilight/{p-268a3562.entry.js → p-eff31185.entry.js} +1 -1
  317. package/dist/twilight/{p-a9db1142.entry.js → p-f41a7693.entry.js} +1 -1
  318. package/dist/twilight/{p-ca56bdf4.entry.js → p-f5ea8c80.entry.js} +1 -1
  319. package/dist/twilight/{p-ce868465.entry.js → p-f929dfb2.entry.js} +1 -1
  320. package/dist/twilight/{p-6972d948.entry.js → p-fae07fdb.entry.js} +1 -1
  321. package/dist/twilight/{p-33a9c78a.entry.js → p-fe1c9edd.entry.js} +1 -1
  322. package/dist/twilight/{p-Cv-hXjUb.js → p-iAQXgb97.js} +1 -1
  323. package/dist/twilight/twilight.esm.js +1 -1
  324. package/dist/types/components/salla-bullet-delivery/helpers.d.ts +1 -0
  325. package/dist/types/components/salla-bullet-delivery/interfaces.d.ts +14 -4
  326. package/dist/types/components/salla-bullet-delivery/salla-bullet-delivery.d.ts +2 -0
  327. package/dist/types/components/salla-delivery-promise/delivery-promise-intent.d.ts +0 -4
  328. package/dist/types/components/salla-delivery-promise/interfaces.d.ts +2 -1
  329. package/package.json +5 -5
  330. package/dist/twilight/p-7c61baf1.entry.js +0 -4
  331. package/dist/twilight/p-ec0d05d5.entry.js +0 -1019
@@ -3,7 +3,7 @@
3
3
  */
4
4
  'use strict';
5
5
 
6
- var index = require('./index-ufJ3UmgO.js');
6
+ var index = require('./index-CvqLEBf0.js');
7
7
 
8
8
  const sallaWalletCss = "/*!twlt*/.s-wallet-table{min-width:100%}.s-wallet-table-balance-container{display:flex !important;align-items:center !important;justify-content:flex-start !important;gap:1rem}.s-wallet-table-balance-icon{border-radius:50%;width:52px;height:52px;font-size:25px;padding:16px 13px;background:var(--color-primary-reverse);color:var(--color-primary)}.s-wallet-table-empty-state{display:flex;flex-direction:column;align-items:center}.s-wallet-table-empty-state i{font-size:80px;margin:4rem 0 2rem;color:var(--infinte-color)}.s-wallet-table-transaction-status{padding:6px 19px !important;border-radius:20px;width:max-content;display:flex;align-items:center}.s-wallet-table-transaction-status-default{background:#fff6eb;color:#a46f29}.s-wallet-table-transaction-status-cashback{background:#effbf6;color:#00af6c}.s-wallet-table-transaction-status-refund{background:#ecf3fe;color:#5196f3}.s-wallet-table-transaction-status-purchase{background:#feecec;color:#f55157}.s-wallet-table-transaction-status-icons-success{color:#00af6c}.absolute{position:absolute}.relative{position:relative}.flex{display:flex}.table{display:table}.hidden{display:none}.items-center{align-items:center}.p-3{padding:0.75rem}.text-center{text-align:center}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:0.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.font-bold{font-weight:700}.font-normal{font-weight:400}.text-gray-400{--tw-text-opacity:1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.s-wallet-container>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(0.625rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(0.625rem * var(--tw-space-y-reverse))}@media (min-width: 768px){.s-wallet-container>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(1.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.25rem * var(--tw-space-y-reverse))}}.s-wallet-mobile-title{display:inline-block;width:8rem;font-weight:400;--tw-text-opacity:1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}@media (min-width: 768px){.s-wallet-mobile-title{display:none}}.s-wallet-reference-id{display:none}@media (min-width: 768px){.s-wallet-reference-id{display:inline-block}}.s-wallet-buy-as-gift-icon{margin-left:0.25rem;margin-right:0.25rem;display:inline-block;color:var(--color-primary)}.s-wallet-copy-to-clipboard-button{display:flex;align-items:center}@media (min-width: 768px){.s-wallet-copy-to-clipboard-button{display:none}}.s-wallet-copy-to-clipboard-button salla-button{position:relative}.s-wallet-copy-to-clipboard-button-icon{pointer-events:none;font-size:0.75rem;line-height:1rem}.s-wallet-copy-to-clipboard-button-icon:where([dir=\"ltr\"],[dir=\"ltr\"] *){margin-left:0.25rem}.s-wallet-copy-to-clipboard-button-icon:where([dir=\"rtl\"],[dir=\"rtl\"] *){margin-right:0.25rem}@media (min-width: 768px){.s-wallet-status-container{margin-left:0px;margin-right:0px}}.s-wallet-status-container:where([dir=\"ltr\"],[dir=\"ltr\"] *){margin-left:auto}.s-wallet-status-container:where([dir=\"rtl\"],[dir=\"rtl\"] *){margin-right:auto}.s-wallet-status-container i{margin-top:0.25rem}.s-wallet-status-container i:where([dir=\"ltr\"],[dir=\"ltr\"] *){margin-right:0.25rem}.s-wallet-status-container i:where([dir=\"rtl\"],[dir=\"rtl\"] *){margin-left:0.25rem}.s-wallet-rated-text{--tw-text-opacity:1;color:rgb(251 191 36 / var(--tw-text-opacity, 1))}.s-wallet-unrated-text{--tw-text-opacity:1;color:rgb(229 231 235 / var(--tw-text-opacity, 1))}.s-wallet-no-content{display:flex;height:100%;flex-direction:column;align-items:center;justify-content:center;padding-top:2.5rem;padding-bottom:5rem;--tw-text-opacity:1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.s-wallet-no-content .icon{margin-bottom:1rem;display:flex;height:8rem;width:8rem;align-items:center;justify-content:center;border-radius:9999px;--tw-bg-opacity:1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1));font-size:3rem;line-height:1;--tw-text-opacity:1;color:rgb(209 213 219 / var(--tw-text-opacity, 1))}.s-wallet-no-content p{margin-bottom:1rem;font-size:1rem;line-height:1.5rem;--tw-text-opacity:1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.s-wallet-table{min-width:100%;border-collapse:separate}@media (min-width: 768px){.s-wallet-table{margin-bottom:-0.75rem;--tw-border-spacing-y:1.25rem;border-spacing:var(--tw-border-spacing-x) var(--tw-border-spacing-y)}}.s-wallet-table-head{margin-bottom:1.25rem;display:none;--tw-bg-opacity:1;background-color:rgb(249 250 251 / var(--tw-bg-opacity, 1))}@media (min-width: 768px){.s-wallet-table-head{display:table-header-group}}.s-wallet-table-head-tr-th{padding-left:1.5rem;padding-right:1.5rem;text-align:start;font-size:0.875rem;line-height:1.25rem;font-weight:500;text-transform:uppercase;letter-spacing:0.05em}.s-wallet-table-head-tr-th:where([dir=\"ltr\"],[dir=\"ltr\"] *){text-align:left}.s-wallet-table-head-tr-th:last-child:where([dir=\"ltr\"],[dir=\"ltr\"] *){text-align:right}.s-wallet-table-head-tr-th:where([dir=\"rtl\"],[dir=\"rtl\"] *){text-align:right}.s-wallet-table-head-tr-th:last-child:where([dir=\"rtl\"],[dir=\"rtl\"] *){text-align:left}.s-wallet-table-tbody-tr{position:relative;display:flex;flex-direction:row;flex-wrap:wrap;overflow:hidden;border-radius:var(--s-radius, 0.25rem);border-bottom-width:8px;border-top-width:8px;--tw-border-opacity:1;border-color:rgb(249 250 251 / var(--tw-border-opacity, 1));--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1));padding:0.5rem;transition-property:box-shadow;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:500ms}@media (min-width: 768px){.s-wallet-table-tbody-tr{display:table-row;flex-direction:row;flex-wrap:nowrap;padding:0px}}.s-wallet-table-tbody-tr-td{width:100%;white-space:nowrap;font-size:0.875rem;line-height:1.25rem}.s-wallet-table-tbody-tr-td:first-child{font-weight:700}@media (min-width: 768px){.s-wallet-table-tbody-tr-td{height:5rem;width:auto}.s-wallet-table-tbody-tr-td:last-child{text-align:end}.s-wallet-table-tbody-tr-td:first-child:where([dir=\"ltr\"],[dir=\"ltr\"] *){border-top-left-radius:0.375rem;border-bottom-left-radius:0.375rem}.s-wallet-table-tbody-tr-td:first-child:where([dir=\"rtl\"],[dir=\"rtl\"] *){border-top-right-radius:0.375rem;border-bottom-right-radius:0.375rem}}.s-wallet-table-tbody-tr-td:first-child{font-weight:700}.s-wallet-table-tbody-tr-td-content{position:relative;display:flex;align-items:center;justify-content:space-between;padding-left:0.5rem;padding-right:0.5rem;padding-top:0.25rem;padding-bottom:0.25rem;font-size:0.75rem;line-height:1rem}@media (min-width: 768px){.s-wallet-table-tbody-tr-td-content{padding-left:1.5rem;padding-right:1.5rem;padding-top:1.5rem;padding-bottom:1.5rem}}.s-wallet-table-tbody-tr-td-content:where([dir=\"ltr\"],[dir=\"ltr\"] *){padding-right:0.5rem}.s-wallet-table-tbody-tr-td-content:where([dir=\"rtl\"],[dir=\"rtl\"] *){padding-left:0.5rem}.s-wallet-table-tbody-tr a{position:absolute;top:0px;bottom:0px;display:block;width:100%}.s-wallet-table-tbody-tr a:where([dir=\"ltr\"],[dir=\"ltr\"] *){left:0px}.s-wallet-table-tbody-tr a:where([dir=\"rtl\"],[dir=\"rtl\"] *){right:0px}@media (min-width: 768px){.md\\:mx-0{margin-left:0px;margin-right:0px}.md\\:inline-block{display:inline-block}.md\\:hidden{display:none}}.ltr\\:ml-auto:where([dir=\"ltr\"],[dir=\"ltr\"] *){margin-left:auto}.ltr\\:mr-4:where([dir=\"ltr\"],[dir=\"ltr\"] *){margin-right:1rem}.rtl\\:ml-4:where([dir=\"rtl\"],[dir=\"rtl\"] *){margin-left:1rem}.rtl\\:mr-auto:where([dir=\"rtl\"],[dir=\"rtl\"] *){margin-right:auto}";
9
9
 
@@ -3,7 +3,7 @@
3
3
  */
4
4
  'use strict';
5
5
 
6
- var index = require('./index-ufJ3UmgO.js');
6
+ var index = require('./index-CvqLEBf0.js');
7
7
 
8
8
  const sallaWishlistActionsCss = "/*!twlt*/:host{display:block}.s-wishlist-actions-menu{min-width:200px;inset-inline-end:0;inset-inline-start:auto;list-style:none;margin:0;padding:4px 0;box-shadow:0 4px 16px rgba(0, 0, 0, 0.12)}.s-wishlist-actions-menu-item{display:block;width:100%;padding:10px 16px;text-align:start;font-size:0.875rem;color:#374151;background:transparent;cursor:pointer;white-space:nowrap}.s-wishlist-actions-menu-item:hover{background-color:#f3f4f6;color:var(--color-primary)}.s-wishlist-actions-panel{box-shadow:0 1px 3px rgba(0, 0, 0, 0.08)}.s-wishlist-actions-panel-select-all{user-select:none}.s-wishlist-actions-select-all:indeterminate,.s-wishlist-actions-select-all:indeterminate:hover,.s-wishlist-actions-select-all:indeterminate:focus{background-color:var(--color-primary);border-color:var(--color-primary)}.s-wishlist-actions-select-all:indeterminate::after{content:\"\";position:absolute;top:50%;left:50%;width:10px;height:2px;background:#fff;border:none;transform:translate(-50%, -50%)}.s-wishlist-actions-social-anchor{display:none}h1.s-wishlist-actions-page-title{text-align:start !important}.static{position:static}.absolute{position:absolute}.relative{position:relative}.z-20{z-index:20}.mb-3{margin-bottom:0.75rem}.mt-1{margin-top:0.25rem}.mt-3{margin-top:0.75rem}.flex{display:flex}.cursor-pointer{cursor:pointer}.flex-row{flex-direction:row}.flex-wrap{flex-wrap:wrap}.items-center{align-items:center}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-2{gap:0.5rem}.gap-3{gap:0.75rem}.gap-4{gap:1rem}.overflow-hidden{overflow:hidden}.rounded-lg{border-radius:0.5rem}.bg-white{--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.p-4{padding:1rem}.text-sm{font-size:0.875rem;line-height:1.25rem}.font-bold{font-weight:700}.text-gray-700{--tw-text-opacity:1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.shadow{--tw-shadow:0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}.outline{outline-style:solid}";
9
9
 
@@ -3,7 +3,7 @@
3
3
  */
4
4
  'use strict';
5
5
 
6
- var index = require('./index-ufJ3UmgO.js');
6
+ var index = require('./index-CvqLEBf0.js');
7
7
 
8
8
  var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
9
9
  /*
@@ -3,7 +3,7 @@
3
3
  */
4
4
  'use strict';
5
5
 
6
- var index = require('./index-ufJ3UmgO.js');
6
+ var index = require('./index-CvqLEBf0.js');
7
7
 
8
8
  function _mergeNamespaces(n, m) {
9
9
  m.forEach(function (e) {
@@ -88,9 +88,12 @@ export const getIntentBranchId = (i) => i?.branch_details?.id;
88
88
  /** Intent coordinates (branch tab only; address flow no longer uses coordinates). */
89
89
  export const getIntentLatitude = (i) => i?.branch_details?.latitude;
90
90
  export const getIntentLongitude = (i) => i?.branch_details?.longitude;
91
+ export const isMapOriginIntent = (i) => !!i && i.type === 'address' && i.address_details?.lat != null && i.address_details?.lng != null;
91
92
  export const hasSessionAddressIntent = (intent) => {
92
93
  if (!intent || intent.type !== 'address' || intent.address_id)
93
94
  return false;
95
+ if (isMapOriginIntent(intent))
96
+ return true;
94
97
  const c = getIntentCountryId(intent);
95
98
  const city = getIntentCityId(intent);
96
99
  const d = getIntentDistrictId(intent);
@@ -3,7 +3,7 @@
3
3
  */
4
4
  import { h, Host, } from "@stencil/core";
5
5
  import { bulletDeliveryAPI, clearApiCache, isSaudiArabia } from "./api-service";
6
- import { buildAddressLocationPayloadFromSelection, filterBranches, findNearestBranch, getGeolocationErrorMessage, getIntentBranchId, getIntentCityId, getIntentCountryCode, getIntentCountryId, getIntentDistrictId, getIntentLatitude, getIntentLongitude, getIntentRegionId, getIntentSubtitle, hasSessionAddressIntent, isBranchSelectable, requireRegionAndDistrictForSA, } from "./helpers";
6
+ import { buildAddressLocationPayloadFromSelection, filterBranches, findNearestBranch, getGeolocationErrorMessage, getIntentBranchId, getIntentCityId, getIntentCountryCode, getIntentCountryId, getIntentDistrictId, getIntentLatitude, getIntentLongitude, getIntentRegionId, getIntentSubtitle, hasSessionAddressIntent, isMapOriginIntent, isBranchSelectable, requireRegionAndDistrictForSA, } from "./helpers";
7
7
  const BRANCH_SEARCH_DEBOUNCE_MS = 1000;
8
8
  const GEOLOCATION_TIMEOUT = 10000;
9
9
  /** Final fallback center used only if `user.default_geo_location` is absent (Riyadh — matches checkout map-page). */
@@ -1019,6 +1019,9 @@ export class SallaBulletDelivery {
1019
1019
  ? `${address.district.name}، ${address.city.name}`
1020
1020
  : (address.city?.name ?? "");
1021
1021
  }
1022
+ else if (this.isGuestMapPick) {
1023
+ locationText = result.address_details?.formatted_address ?? "";
1024
+ }
1022
1025
  else if (this.selectedCity) {
1023
1026
  locationText = this.selectedDistrict
1024
1027
  ? `${this.selectedDistrict.name}، ${this.selectedCity.name}`
@@ -1027,11 +1030,14 @@ export class SallaBulletDelivery {
1027
1030
  else if (result.address_details) {
1028
1031
  const parts = [
1029
1032
  result.address_details.district?.name,
1030
- result.address_details.city.name,
1031
- result.address_details.country.name,
1033
+ result.address_details.city?.name,
1034
+ result.address_details.country?.name,
1032
1035
  ].filter(Boolean);
1033
1036
  locationText =
1034
- parts.join("، ") || result.address_details.short_address || "";
1037
+ parts.join("، ") ||
1038
+ result.address_details.formatted_address ||
1039
+ result.address_details.short_address ||
1040
+ "";
1035
1041
  }
1036
1042
  }
1037
1043
  else if (branch) {
@@ -1307,6 +1313,10 @@ export class SallaBulletDelivery {
1307
1313
  get isMapModeAvailable() {
1308
1314
  return this.isMapSettingEnabled && !!salla.config.get('store.settings.keys.maps') && !!this.addressToken;
1309
1315
  }
1316
+ /** Guest is in map mode and has already dropped a pin (as opposed to still using the dropdowns). */
1317
+ get isGuestMapPick() {
1318
+ return !this.isLoggedIn && this.isMapModeAvailable && this.hasMapLocation();
1319
+ }
1310
1320
  /** Center shown before geolocation resolves — the customer's IP-based default (falls back to Riyadh). */
1311
1321
  get mapInitialCenter() {
1312
1322
  const geo = salla.config.get('user.default_geo_location');
@@ -1447,6 +1457,10 @@ export class SallaBulletDelivery {
1447
1457
  if (this.isLoggedIn && this.selectedSavedAddress) {
1448
1458
  return this.selectedSavedAddress.is_in_coverage === false;
1449
1459
  }
1460
+ // Guest map pick: a pin is the only requirement, independent of any incidental dropdown state.
1461
+ if (!this.isLoggedIn && this.isMapModeAvailable) {
1462
+ return !this.isGuestMapPick;
1463
+ }
1450
1464
  // Guest: require country + city; for SA require region + district
1451
1465
  if (!this.selectedCountry || !this.selectedCity)
1452
1466
  return true;
@@ -1472,9 +1486,26 @@ export class SallaBulletDelivery {
1472
1486
  resolve();
1473
1487
  }
1474
1488
  buildIntentAddress() {
1475
- if (this.activeTab !== "address" ||
1476
- !this.selectedCountry ||
1477
- !this.selectedCity) {
1489
+ if (this.activeTab !== "address")
1490
+ return undefined;
1491
+ if (this.isGuestMapPick && this.mapLocationData) {
1492
+ const { lat, lng, formattedAddress, shortAddress } = this.mapLocationData;
1493
+ return {
1494
+ country: this.selectedCountry
1495
+ ? {
1496
+ id: this.selectedCountry.id,
1497
+ name: this.selectedCountry.name,
1498
+ code: this.selectedCountry.code,
1499
+ }
1500
+ : undefined,
1501
+ lat,
1502
+ lng,
1503
+ formatted_address: formattedAddress,
1504
+ place_id: shortAddress,
1505
+ description: this.addressDescription?.trim() || undefined,
1506
+ };
1507
+ }
1508
+ if (!this.selectedCountry || !this.selectedCity) {
1478
1509
  return undefined;
1479
1510
  }
1480
1511
  const country = {
@@ -1553,6 +1584,9 @@ export class SallaBulletDelivery {
1553
1584
  district_name: this.districtName?.trim() || undefined,
1554
1585
  short_address: selectedAddress?.short_address ?? this.selectedSavedAddress?.short_address,
1555
1586
  form_data: { ...this.newAddressForm },
1587
+ lat: this.mapLocationData?.lat,
1588
+ lng: this.mapLocationData?.lng,
1589
+ formatted_address: this.mapLocationData?.formattedAddress,
1556
1590
  };
1557
1591
  }
1558
1592
  /**
@@ -1760,6 +1794,13 @@ export class SallaBulletDelivery {
1760
1794
  }
1761
1795
  else {
1762
1796
  result.address_details = this.buildIntentAddress();
1797
+ if (this.isGuestMapPick) {
1798
+ // Guest + map pin: defer to login instead of the blocked guest allocation (422, SHPD-9558).
1799
+ this.setStoredIntent(result);
1800
+ this.confirmBtn?.stop();
1801
+ this.handleLogin();
1802
+ return;
1803
+ }
1763
1804
  }
1764
1805
  }
1765
1806
  else {
@@ -1778,7 +1819,7 @@ export class SallaBulletDelivery {
1778
1819
  };
1779
1820
  }
1780
1821
  else {
1781
- // Case 1: Guest user or logged-in user without saved address
1822
+ // Case 1: Guest user (dropdown selection) or logged-in user without saved address
1782
1823
  allocationPayload = {
1783
1824
  type: "address",
1784
1825
  country_id: String(this.selectedCountry?.id || 0),
@@ -2015,6 +2056,28 @@ export class SallaBulletDelivery {
2015
2056
  */
2016
2057
  async saveSessionAddressToProfile() {
2017
2058
  const intent = this.getStoredIntent();
2059
+ if (isMapOriginIntent(intent)) {
2060
+ const details = intent.address_details;
2061
+ const payload = {
2062
+ lat: details.lat,
2063
+ lng: details.lng,
2064
+ ...(details.place_id && { short_address: details.place_id }),
2065
+ ...(details.description && { description: details.description }),
2066
+ };
2067
+ try {
2068
+ const { success, address } = await bulletDeliveryAPI.saveAddressLocation(payload);
2069
+ if (!success || !address)
2070
+ return null;
2071
+ // Persist address_id immediately to avoid duplicate creation on retry.
2072
+ this.setStoredIntent({ ...intent, address_id: address.id });
2073
+ this.addressCreated.emit({ address });
2074
+ return address;
2075
+ }
2076
+ catch (error) {
2077
+ console.error("SallaBulletDelivery: Error saving session address (map)", error);
2078
+ return null;
2079
+ }
2080
+ }
2018
2081
  const countryId = getIntentCountryId(intent);
2019
2082
  const cityId = getIntentCityId(intent);
2020
2083
  const districtId = getIntentDistrictId(intent);
@@ -2058,12 +2121,15 @@ export class SallaBulletDelivery {
2058
2121
  }
2059
2122
  const intent = this.getStoredIntent();
2060
2123
  const hasSessionAddress = hasSessionAddressIntent(intent);
2124
+ const isMapSession = isMapOriginIntent(intent);
2061
2125
  const sessionLine1 = hasSessionAddress && intent?.address_details
2062
- ? [intent.address_details.city?.name, intent.address_details.country?.name]
2063
- .filter(Boolean)
2064
- .join("، ") || ""
2126
+ ? isMapSession
2127
+ ? (intent.address_details.formatted_address ?? "")
2128
+ : [intent.address_details.city?.name, intent.address_details.country?.name]
2129
+ .filter(Boolean)
2130
+ .join("، ") || ""
2065
2131
  : "";
2066
- const sessionLine2 = hasSessionAddress && intent?.address_details
2132
+ const sessionLine2 = hasSessionAddress && intent?.address_details && !isMapSession
2067
2133
  ? (intent.address_details.district?.name ?? "").trim()
2068
2134
  : "";
2069
2135
  if (this.savedAddresses.length === 0 && !hasSessionAddress) {
@@ -2159,7 +2225,7 @@ export class SallaBulletDelivery {
2159
2225
  const isConfirmStep = this.mapStep === 'confirm' && hasMapLoc;
2160
2226
  const canAdvanceToConfirm = this.canConfirmMapLocation();
2161
2227
  const submitLabel = isConfirmStep
2162
- ? (this.savingAddress
2228
+ ? (this.confirming
2163
2229
  ? Salla.lang.get("pages.checkout.loading")
2164
2230
  : Salla.lang.get("pages.checkout.confirm_address"))
2165
2231
  : Salla.lang.get('pages.checkout.confirm_location');
@@ -2169,9 +2235,9 @@ export class SallaBulletDelivery {
2169
2235
  this.mapStep = 'confirm';
2170
2236
  return;
2171
2237
  }
2172
- this.handleSubmitAddAddress(e);
2238
+ this.handleConfirm();
2173
2239
  };
2174
- return (h("form", { onSubmit: handleSubmit }, this.renderGuestDeliveryForm(), h("div", { class: "s-bullet-delivery-form-actions s-bullet-delivery-form-actions--single", style: { padding: '24px' } }, h("salla-button", { type: "submit", loading: this.savingAddress, disabled: isConfirmStep ? this.savingAddress : !canAdvanceToConfirm, width: "wide" }, submitLabel), !this.isLoggedIn && (h("button", { type: "button", class: "s-bullet-delivery-login-prompt", onClick: () => this.handleLogin() }, Salla.lang.get('pages.checkout.login_to_use_saved_addresses'))))));
2240
+ return (h("form", { onSubmit: handleSubmit }, this.renderGuestDeliveryForm(), h("div", { class: "s-bullet-delivery-form-actions s-bullet-delivery-form-actions--single", style: { padding: '24px' } }, h("salla-button", { type: "submit", loading: this.confirming, disabled: isConfirmStep ? this.confirming : !canAdvanceToConfirm, width: "wide" }, submitLabel), !this.isLoggedIn && (h("button", { type: "button", class: "s-bullet-delivery-login-prompt", onClick: () => this.handleLogin() }, Salla.lang.get('pages.checkout.login_to_use_saved_addresses'))))));
2175
2241
  }
2176
2242
  renderBranchSearch() {
2177
2243
  return (h("div", { class: "s-bullet-delivery-branch-search" }, h("div", { class: "s-bullet-delivery-search-row" }, h("div", { class: "s-bullet-delivery-search s-bullet-delivery-branch-search-wrap" }, h("span", { class: "s-bullet-delivery-search-icon s-bullet-delivery-branch-search-icon", innerHTML: Search, "aria-hidden": "true" }), h("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("button", { type: "button", class: {
@@ -2266,7 +2332,7 @@ export class SallaBulletDelivery {
2266
2332
  this.confirmBtn = btn;
2267
2333
  }, disabled: this.isConfirmDisabled(), onClick: () => this.handleConfirm(), "loader-position": "center", width: "wide" }, this.activeTab === "branch"
2268
2334
  ? Salla.lang.get("pages.checkout.confirm_receipt_from_the_branch")
2269
- : Salla.lang.get("pages.checkout.confirm_address")), showAddAddressInFooter && (h("salla-button", { onClick: () => this.handleAddNewAddress(), width: "wide", shape: "link" }, Salla.lang.get("pages.checkout.add_new_address"))), !this.isLoggedIn && (h("salla-button", { shape: "link", onClick: this.handleLogin }, Salla.lang.get("pages.checkout.login_to_use_saved_addresses")))));
2335
+ : Salla.lang.get("pages.checkout.confirm_address")), showAddAddressInFooter && (h("salla-button", { onClick: () => this.handleAddNewAddress(), width: "wide", shape: "link" }, Salla.lang.get("pages.checkout.add_new_address"))), !this.isLoggedIn && (h("salla-button", { shape: "link", onClick: () => this.handleLogin() }, Salla.lang.get("pages.checkout.login_to_use_saved_addresses")))));
2270
2336
  }
2271
2337
  renderMainView() {
2272
2338
  const isAddressEmptyState = this.isLoggedIn &&
@@ -32,7 +32,7 @@ export async function fetchDeliveryMessage(productId, id, optionType, isLoginCyc
32
32
  const response = (await salla.api.withoutNotifier(() => salla.api.request(salla.url.api(`products/${productId}/delivery-promises${queryString}`))));
33
33
  if (!response.success) {
34
34
  log('fetchDeliveryMessage error', { response });
35
- throw new Error(response.error?.message || 'Failed to fetch delivery promise');
35
+ return null;
36
36
  }
37
37
  const message = response.data?.message?.trim();
38
38
  log('fetchDeliveryMessage success', { message });
@@ -1,6 +1,11 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
+ /**
5
+ * Bullet delivery intent helpers.
6
+ * Reads/writes the same storage key as salla-bullet-delivery so both components stay in sync.
7
+ */
8
+ import { isMapOriginIntent } from "../salla-bullet-delivery/helpers";
4
9
  const INTENT_KEY = 'bullet_delivery_intent';
5
10
  function getIntentStorage() {
6
11
  const rememberLastSession = Boolean(salla.config.get('store.settings.bullet_delivery.settings.remember_last_session'));
@@ -22,6 +27,10 @@ export function resolveIntent() {
22
27
  if (cityId != null) {
23
28
  return { type: 'address', option: { id: cityId, name: cityName } };
24
29
  }
30
+ // Map-origin pick: no city id to query a delivery estimate by, but still show the address.
31
+ if (isMapOriginIntent(intent) && intent.address_details?.formatted_address) {
32
+ return { type: 'address', option: { name: intent.address_details.formatted_address } };
33
+ }
25
34
  return null;
26
35
  }
27
36
  if (intent.type === 'branch') {
@@ -123,12 +123,19 @@ export class SallaDeliveryPromise {
123
123
  this.selectedCityLoginCycle = resolved.option;
124
124
  this.selectedBranchLoginCycle = null;
125
125
  this.selectedLabel = `${this.labels.deliveryTo} ${resolved.option.name || this.labels.selectCity}`;
126
- void this.loadDeliveryMessage(resolved.option.id, 'city');
126
+ // Map-origin picks have no resolved city id — nothing to query a delivery estimate by.
127
+ if (resolved.option.id != null) {
128
+ void this.loadDeliveryMessage(resolved.option.id, 'city');
129
+ }
130
+ else {
131
+ this.deliveryMessage = null;
132
+ }
127
133
  }
128
134
  else {
129
135
  this.selectedBranchLoginCycle = resolved.option;
130
136
  this.selectedCityLoginCycle = null;
131
137
  this.selectedLabel = `${this.labels.pickupFromBranch} ${resolved.option.name}`;
138
+ // Branch resolution in resolveIntent() always sets an id.
132
139
  void this.loadDeliveryMessage(resolved.option.id, 'branch');
133
140
  }
134
141
  return true;
@@ -183,8 +190,8 @@ export class SallaDeliveryPromise {
183
190
  this.deliveryMessage = await fetchDeliveryMessage(this.productId, id, optionType, this.isLoginCycleEnabled);
184
191
  }
185
192
  catch (error) {
186
- this.hasError = true;
187
- this.errorMessage = optionType === 'city' ? this.labels.errorDeliveryPromise : this.labels.errorPickupPromise;
193
+ log('loadDeliveryMessage failed', { id, optionType, error });
194
+ this.deliveryMessage = null;
188
195
  }
189
196
  finally {
190
197
  this.isLoadingPromises = false;
@@ -0,0 +1,319 @@
1
+ /*!
2
+ * Crafted with ❤ by Salla
3
+ */
4
+ /**
5
+ * API Service for salla-bullet-delivery component
6
+ * Uses Salla's shipping API and scope API for delivery location management
7
+ */
8
+ const API_LOG_PREFIX = 'BulletDeliveryAPI';
9
+ const validId = (id) => {
10
+ const n = id == null ? Number.NaN : Number(id);
11
+ return !Number.isNaN(n) && n !== 0;
12
+ };
13
+ async function withApiErrorHandling(fn, fallback, logLabel) {
14
+ try {
15
+ return await fn();
16
+ }
17
+ catch (error) {
18
+ console.error(`${API_LOG_PREFIX}: ${logLabel}`, error);
19
+ return fallback;
20
+ }
21
+ }
22
+ const apiCache = new Map();
23
+ const CACHE_TTL = 5 * 60 * 1000;
24
+ function getCached(key) {
25
+ const entry = apiCache.get(key);
26
+ if (!entry || Date.now() - entry.timestamp > CACHE_TTL) {
27
+ apiCache.delete(key);
28
+ return null;
29
+ }
30
+ return entry.data;
31
+ }
32
+ function setCache(key, data) {
33
+ apiCache.set(key, { data, timestamp: Date.now() });
34
+ }
35
+ /** Uses country code from API (e.g. 'SA'). */
36
+ const isSaudiArabia = (countryCode) => String(countryCode).toUpperCase() === 'SA';
37
+ /**
38
+ * Fast Delivery API Service
39
+ * Uses Salla's shipping API and scopes API. Branch and address data are used as returned by the API (no mapping).
40
+ */
41
+ const bulletDeliveryAPI = {
42
+ /**
43
+ * Get available countries from Salla shipping API
44
+ * @param forBranch - when true, use for_branch=1 (e.g. for pickup/branches tab)
45
+ */
46
+ async getCountries(forBranch = false, query) {
47
+ const cacheKey = !query?.trim() ? `countries_${forBranch ? 1 : 0}` : null;
48
+ if (cacheKey) {
49
+ const cached = getCached(cacheKey);
50
+ if (cached)
51
+ return cached;
52
+ }
53
+ const result = await withApiErrorHandling(async () => {
54
+ const params = { for_branch: forBranch ? 1 : 0 };
55
+ if (forBranch) {
56
+ params.for_allocation = 1;
57
+ }
58
+ if (query?.trim())
59
+ params.query = query.trim();
60
+ const data = (await salla.api.request("shipping/countries", { params }))?.data ?? [];
61
+ return data.map((c) => ({ id: c.id, code: c.code, name: c.name, has_regions: isSaudiArabia(c.code) }));
62
+ }, [], 'Error getting countries');
63
+ if (cacheKey && result.length > 0)
64
+ setCache(cacheKey, result);
65
+ return result;
66
+ },
67
+ /**
68
+ * Get regions for a country from Salla shipping API
69
+ * Endpoint: GET /shipping/countries/<COUNTRY_ID>/region
70
+ */
71
+ async getRegions(countryId, query) {
72
+ if (!validId(countryId)) {
73
+ console.warn(`${API_LOG_PREFIX}: getRegions called without valid country_id`);
74
+ return [];
75
+ }
76
+ const cacheKey = !query?.trim() ? `regions_${countryId}` : null;
77
+ if (cacheKey) {
78
+ const cached = getCached(cacheKey);
79
+ if (cached)
80
+ return cached;
81
+ }
82
+ const result = await withApiErrorHandling(async () => {
83
+ const params = {};
84
+ if (query?.trim())
85
+ params.query = query.trim();
86
+ const data = (await salla.api.request(`shipping/countries/${countryId}/regions`, { params }))?.data ?? [];
87
+ return data.map((r) => ({ id: r.id, name: r.name, code: r.code, country_id: Number(countryId) }));
88
+ }, [], 'Error fetching regions');
89
+ if (cacheKey && result.length > 0)
90
+ setCache(cacheKey, result);
91
+ return result;
92
+ },
93
+ /**
94
+ * Get cities from Salla shipping API
95
+ * @param regionId - Optional; when provided (e.g. for SA), cities are filtered by region
96
+ */
97
+ async getCities(countryId, regionId, query) {
98
+ if (!validId(countryId)) {
99
+ console.warn(`${API_LOG_PREFIX}: getCities called without valid country_id`);
100
+ return [];
101
+ }
102
+ const cacheKey = !query?.trim() ? `cities_${countryId}_${regionId || 'all'}` : null;
103
+ if (cacheKey) {
104
+ const cached = getCached(cacheKey);
105
+ if (cached)
106
+ return cached;
107
+ }
108
+ const result = await withApiErrorHandling(async () => {
109
+ const params = { for_branch: 0, country_id: countryId };
110
+ if (regionId)
111
+ params.region_id = regionId;
112
+ if (query?.trim())
113
+ params.query = query.trim();
114
+ const data = (await salla.api.request("shipping/cities", { params }))?.data ?? [];
115
+ return data.map((c) => ({ id: c.id, name: c.name, country_id: countryId, ...(c.region_id != null && { region_id: c.region_id }) }));
116
+ }, [], 'Error fetching cities');
117
+ if (cacheKey && result.length > 0)
118
+ setCache(cacheKey, result);
119
+ return result;
120
+ },
121
+ /**
122
+ * Get districts from Salla shipping API
123
+ */
124
+ async getDistricts(cityId, query) {
125
+ if (!validId(cityId)) {
126
+ console.warn(`${API_LOG_PREFIX}: getDistricts called without valid city_id`);
127
+ return [];
128
+ }
129
+ return withApiErrorHandling(async () => {
130
+ const params = { for_branch: 0, city_id: cityId };
131
+ if (query?.trim())
132
+ params.query = query.trim();
133
+ const raw = (await salla.api.request("shipping/districts", { params }))?.data;
134
+ const list = Array.isArray(raw) ? raw : (Array.isArray(raw?.districts) ? raw.districts : []);
135
+ return list.map((d) => ({ id: d.id, name: d.name, name_en: d.name_en, city_id: cityId }));
136
+ }, [], 'Error fetching districts');
137
+ },
138
+ async getSavedAddresses() {
139
+ return withApiErrorHandling(async () => {
140
+ const data = (await salla.api.request("address"))?.data;
141
+ return Array.isArray(data) ? data : [];
142
+ }, [], 'Error fetching user addresses');
143
+ },
144
+ async getBranches({ query, lat, lng, country_id, per_page = 20 } = {}) {
145
+ const hasSearchParams = query?.trim()?.length >= 2 || lat || lng;
146
+ const cacheKey = !hasSearchParams && country_id ? `branches_${country_id}` : null;
147
+ if (cacheKey) {
148
+ const cached = getCached(cacheKey);
149
+ if (cached)
150
+ return cached;
151
+ }
152
+ const result = await withApiErrorHandling(async () => {
153
+ const params = { per_page };
154
+ if (query?.trim().length >= 2)
155
+ params.query = query;
156
+ if (lat)
157
+ params.lat = lat;
158
+ if (lng)
159
+ params.lng = lng;
160
+ if (country_id)
161
+ params.country_id = country_id;
162
+ const res = await salla.api.request("branches", { params });
163
+ return (Array.isArray(res?.data) ? res.data : []);
164
+ }, [], 'Error fetching branches');
165
+ if (cacheKey && result.length > 0)
166
+ setCache(cacheKey, result);
167
+ return result;
168
+ },
169
+ async saveAddressLocation(payload) {
170
+ return withApiErrorHandling(async () => {
171
+ const res = await salla.api.request('address/location', { ...payload, for_allocation: true }, 'post');
172
+ const data = res?.data ?? res;
173
+ const address = typeof data === 'object' && data != null && 'id' in data ? data : undefined;
174
+ return { success: true, address };
175
+ }, { success: false }, 'Error saving address/location');
176
+ },
177
+ async setDeliveryScope(scopeId) {
178
+ return withApiErrorHandling(async () => {
179
+ await salla.api.withoutNotifier(() => salla.scope.change({ id: scopeId }));
180
+ salla.storage.set("scope", { ...(salla.storage.get("scope") || {}), id: scopeId });
181
+ return true;
182
+ }, false, 'Error setting delivery scope');
183
+ },
184
+ async allocateScope(payload) {
185
+ const errMsg = (d) => d?.error?.message ?? d?.message ?? 'Failed to allocate scope';
186
+ try {
187
+ const response = await salla.api.withoutNotifier(() => salla.api.request("scopes/allocation", payload, 'post'));
188
+ // SDK resolves with { data } and throws on non-2xx; any resolved value is success
189
+ const data = response?.data ?? response;
190
+ return { success: true, data: data };
191
+ }
192
+ catch (error) {
193
+ console.error(`${API_LOG_PREFIX}: Error allocating scope`, error);
194
+ const err = error;
195
+ return { success: false, error: err?.response?.data != null ? errMsg(err.response.data) : (err?.message ?? 'Unknown error') };
196
+ }
197
+ },
198
+ async getAddressToken() {
199
+ return withApiErrorHandling(async () => {
200
+ const res = await salla.api.request('address/autocomplete-token');
201
+ return res?.data?.token ?? null;
202
+ }, null, 'Error fetching address autocomplete token');
203
+ },
204
+ };
205
+ function clearApiCache() {
206
+ apiCache.clear();
207
+ }
208
+
209
+ /**
210
+ * Helper functions for salla-bullet-delivery component
211
+ */
212
+ const EARTH_RADIUS_KM = 6371;
213
+ const deg2rad = (deg) => deg * (Math.PI / 180);
214
+ /** Haversine distance in km */
215
+ function calculateDistance(lat1, lon1, lat2, lon2) {
216
+ const dLat = deg2rad(lat2 - lat1);
217
+ const dLon = deg2rad(lon2 - lon1);
218
+ const a = Math.sin(dLat / 2) ** 2 +
219
+ Math.cos(deg2rad(lat1)) * Math.cos(deg2rad(lat2)) * Math.sin(dLon / 2) ** 2;
220
+ return EARTH_RADIUS_KM * 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
221
+ }
222
+ /**
223
+ * Whether a pickup branch can be selected.
224
+ *
225
+ * `pickup_readiness` is the richer, backend-computed verdict (INV-357) and wins whenever the API
226
+ * sends it. Not every store's `GET /branches` returns it though, so we fall back to the original
227
+ * `is_open` rule instead of treating a missing object as "not selectable" — otherwise every branch
228
+ * in the list renders disabled and pickup cannot be chosen at all (SP-22202).
229
+ */
230
+ const isBranchSelectable = (branch) => {
231
+ if (!branch)
232
+ return false;
233
+ const selectable = branch.pickup_readiness?.selectable;
234
+ return typeof selectable === 'boolean' ? selectable : branch.is_open !== false;
235
+ };
236
+ /** Nearest available branch by distance; single pass O(n). */
237
+ function findNearestBranch(branches, userLat, userLon) {
238
+ let nearest = null;
239
+ let minD = Number.POSITIVE_INFINITY;
240
+ for (const b of branches) {
241
+ const lat = b.location?.lat != null ? Number(b.location.lat) : Number.NaN;
242
+ const lng = b.location?.lng != null ? Number(b.location.lng) : Number.NaN;
243
+ if (Number.isNaN(lat) || Number.isNaN(lng) || b.is_open === false)
244
+ continue;
245
+ const d = calculateDistance(userLat, userLon, lat, lng);
246
+ if (d < minD) {
247
+ minD = d;
248
+ nearest = b;
249
+ }
250
+ }
251
+ return nearest;
252
+ }
253
+ const filterBranches = (branches, searchQuery) => {
254
+ if (!searchQuery)
255
+ return branches;
256
+ const q = searchQuery.toLowerCase();
257
+ return branches.filter((b) => b.name.toLowerCase().includes(q) || b.city?.name?.toLowerCase().includes(q));
258
+ };
259
+ const getIntentSubtitle = (intent, toAddress, fromBranch) => {
260
+ if (intent.type === 'branch') {
261
+ const loc = intent.branch_details?.city ?? intent.branch_details?.name;
262
+ return loc ? `${fromBranch} ${loc}`.trim() : '';
263
+ }
264
+ if (intent.type === 'address' && intent.address_details) {
265
+ 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 || '';
266
+ return addr ? `${toAddress} ${addr}`.trim() : '';
267
+ }
268
+ return '';
269
+ };
270
+ const idFrom = (val) => (val != null ? Number(val) : undefined);
271
+ const getIntentCountryId = (i) => idFrom(i?.address_details?.country?.id);
272
+ const getIntentCountryCode = (i) => i?.country_code ?? i?.address_details?.country?.code ?? '';
273
+ const getIntentRegionId = (i) => idFrom(i?.address_details?.region?.id);
274
+ const getIntentCityId = (i) => idFrom(i?.address_details?.city?.id);
275
+ const getIntentDistrictId = (i) => idFrom(i?.address_details?.district?.id);
276
+ const getIntentBranchId = (i) => i?.branch_details?.id;
277
+ /** Intent coordinates (branch tab only; address flow no longer uses coordinates). */
278
+ const getIntentLatitude = (i) => i?.branch_details?.latitude;
279
+ const getIntentLongitude = (i) => i?.branch_details?.longitude;
280
+ const isMapOriginIntent = (i) => !!i && i.type === 'address' && i.address_details?.lat != null && i.address_details?.lng != null;
281
+ const hasSessionAddressIntent = (intent) => {
282
+ if (!intent || intent.type !== 'address' || intent.address_id)
283
+ return false;
284
+ if (isMapOriginIntent(intent))
285
+ return true;
286
+ const c = getIntentCountryId(intent);
287
+ const city = getIntentCityId(intent);
288
+ const d = getIntentDistrictId(intent);
289
+ const code = getIntentCountryCode(intent);
290
+ const hasDistrictId = d != null && Number(d) !== 0;
291
+ const hasDistrictName = Boolean(intent.address_details?.district?.name?.trim());
292
+ const districtOk = !isSaudiArabia(code) || hasDistrictId || hasDistrictName;
293
+ return !!(c && city && districtOk);
294
+ };
295
+ const requireRegionAndDistrictForSA = (countryCode, regionId, districtIdOrName) => !countryCode || !isSaudiArabia(countryCode)
296
+ ? true
297
+ : (regionId != null && Number(regionId) !== 0) && (districtIdOrName != null && (typeof districtIdOrName === 'number' ? districtIdOrName !== 0 : String(districtIdOrName).trim().length > 0));
298
+ function buildAddressLocationPayloadFromSelection(options) {
299
+ const { countryId, countryCode, regionId, cityId, districtId, description = '', lat, lng, shortAddress } = options;
300
+ const desc = description || '';
301
+ return {
302
+ country_id: Number(countryId) || undefined,
303
+ region_id: regionId != null ? Number(regionId) : undefined,
304
+ city_id: cityId != null ? Number(cityId) : undefined,
305
+ district_id: districtId != null ? Number(districtId) : undefined,
306
+ description: desc,
307
+ ...(countryCode && isSaudiArabia(countryCode) && { local: desc }),
308
+ ...(lat != null && lng != null && { lat, lng }),
309
+ ...(shortAddress && { short_address: shortAddress }),
310
+ };
311
+ }
312
+ const GEO_ERROR_MESSAGES = {
313
+ [GeolocationPositionError.PERMISSION_DENIED]: 'Location permission denied',
314
+ [GeolocationPositionError.POSITION_UNAVAILABLE]: 'Location unavailable',
315
+ [GeolocationPositionError.TIMEOUT]: 'Location timeout',
316
+ };
317
+ const getGeolocationErrorMessage = (errorCode) => GEO_ERROR_MESSAGES[errorCode] ?? 'An error occurred while detecting location';
318
+
319
+ export { getIntentLongitude as a, bulletDeliveryAPI as b, getIntentCityId as c, getIntentCountryId as d, getIntentRegionId as e, getIntentDistrictId as f, getIntentLatitude as g, hasSessionAddressIntent as h, isSaudiArabia as i, filterBranches as j, findNearestBranch as k, getGeolocationErrorMessage as l, buildAddressLocationPayloadFromSelection as m, clearApiCache as n, getIntentSubtitle as o, getIntentBranchId as p, isMapOriginIntent as q, requireRegionAndDistrictForSA as r, isBranchSelectable as s, getIntentCountryCode as t };