@salla.sa/twilight-components 2.14.543 → 2.14.545

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 (358) hide show
  1. package/dist/cjs/{filepond-uhJt4caG.js → filepond-B5aWlI3l.js} +1 -1
  2. package/dist/cjs/{filepond-plugin-file-poster-Dy-GRHf0.js → filepond-plugin-file-poster-BYq39KHd.js} +1 -1
  3. package/dist/cjs/{filepond-plugin-file-validate-size-BWIBGLW-.js → filepond-plugin-file-validate-size-Bi3TAsJv.js} +1 -1
  4. package/dist/cjs/{filepond-plugin-file-validate-type-DEVtMF0l.js → filepond-plugin-file-validate-type-Ck6S5TuZ.js} +1 -1
  5. package/dist/cjs/{filepond-plugin-image-edit-DSDoJaLw.js → filepond-plugin-image-edit-DbsdnH5j.js} +1 -1
  6. package/dist/cjs/{filepond-plugin-image-exif-orientation-BdZit5hj.js → filepond-plugin-image-exif-orientation-x7TfJR-2.js} +1 -1
  7. package/dist/cjs/{filepond-plugin-image-preview-Z3_zQyYR.js → filepond-plugin-image-preview-CrU7vIRk.js} +1 -1
  8. package/dist/cjs/helpers-DHdDjm5V.js +340 -0
  9. package/dist/cjs/{index-Bw3b6O6G.js → index-DGpOR-TH.js} +14 -14
  10. package/dist/cjs/{intlTelInput-CXe3TkdL.js → intlTelInput-DKAXRecW.js} +1 -1
  11. package/dist/cjs/loader.cjs.js +2 -2
  12. package/dist/cjs/{mail-CO8cFZH7.js → mail-C9D8MHae.js} +2 -2
  13. package/dist/cjs/salla-accordion-body_2.cjs.entry.js +1 -1
  14. package/dist/cjs/salla-accordion_6.cjs.entry.js +1 -1
  15. package/dist/cjs/salla-add-product-button_5.cjs.entry.js +1 -1
  16. package/dist/cjs/salla-advertisement.cjs.entry.js +1 -1
  17. package/dist/cjs/salla-alert_2.cjs.entry.js +1 -1
  18. package/dist/cjs/salla-app-install-alert.cjs.entry.js +1 -1
  19. package/dist/cjs/salla-apps-icons.cjs.entry.js +1 -1
  20. package/dist/cjs/salla-attachment-view_9.cjs.entry.js +10 -10
  21. package/dist/cjs/salla-badge.cjs.entry.js +1 -1
  22. package/dist/cjs/salla-basket-gap.cjs.entry.js +1 -1
  23. package/dist/cjs/salla-bullet-delivery_2.cjs.entry.js +156 -401
  24. package/dist/cjs/salla-cart-coupons.cjs.entry.js +1 -1
  25. package/dist/cjs/salla-cart-item-offers_2.cjs.entry.js +1 -1
  26. package/dist/cjs/salla-cart-summary-card.cjs.entry.js +1 -1
  27. package/dist/cjs/salla-cashback-banner.cjs.entry.js +1 -1
  28. package/dist/cjs/salla-comment-factors.cjs.entry.js +1 -1
  29. package/dist/cjs/{salla-comment-form_9.cjs.entry.js → salla-comment-form_8.cjs.entry.js} +3 -259
  30. package/dist/cjs/salla-conditional-offer.cjs.entry.js +1 -1
  31. package/dist/cjs/salla-contacts.cjs.entry.js +3 -3
  32. package/dist/cjs/salla-cookies-bar.cjs.entry.js +1 -1
  33. package/dist/cjs/salla-count-down.cjs.entry.js +1 -1
  34. package/dist/cjs/salla-custom-fields.cjs.entry.js +1 -1
  35. package/dist/cjs/salla-delivery-promise.cjs.entry.js +21 -5
  36. package/dist/cjs/salla-edit-order-button.cjs.entry.js +1 -1
  37. package/dist/cjs/salla-filters-widget.cjs.entry.js +1 -1
  38. package/dist/cjs/salla-filters.cjs.entry.js +1 -1
  39. package/dist/cjs/salla-fulfillment-methods.cjs.entry.js +1 -1
  40. package/dist/cjs/salla-gifting.cjs.entry.js +1 -1
  41. package/dist/cjs/salla-hook.cjs.entry.js +1 -1
  42. package/dist/cjs/salla-infinite-scroll.cjs.entry.js +1 -1
  43. package/dist/cjs/salla-installment.cjs.entry.js +1 -1
  44. package/dist/cjs/salla-list-tile.cjs.entry.js +1 -1
  45. package/dist/cjs/salla-localization-modal.cjs.entry.js +1 -1
  46. package/dist/cjs/salla-login-modal.cjs.entry.js +1 -1
  47. package/dist/cjs/salla-loyalty-banner_10.cjs.entry.js +3 -3
  48. package/dist/cjs/salla-loyalty-exchange-product-card.cjs.entry.js +1 -1
  49. package/dist/cjs/salla-loyalty-points-banner.cjs.entry.js +1 -1
  50. package/dist/cjs/salla-loyalty-points-history.cjs.entry.js +1 -1
  51. package/dist/cjs/salla-loyalty-prize-item.cjs.entry.js +1 -1
  52. package/dist/cjs/salla-loyalty.cjs.entry.js +1 -1
  53. package/dist/cjs/salla-maintenance-alert.cjs.entry.js +1 -1
  54. package/dist/cjs/salla-map_2.cjs.entry.js +1 -1
  55. package/dist/cjs/salla-menu.cjs.entry.js +1 -1
  56. package/dist/cjs/salla-metadata.cjs.entry.js +1 -1
  57. package/dist/cjs/salla-multiple-bundle-product-cart_2.cjs.entry.js +1 -1
  58. package/dist/cjs/salla-multiple-bundle-product-options-modal_2.cjs.entry.js +1 -1
  59. package/dist/cjs/salla-multiple-bundle-product.cjs.entry.js +1 -1
  60. package/dist/cjs/salla-next-order-coupon.cjs.entry.js +1 -1
  61. package/dist/cjs/salla-notification-item_2.cjs.entry.js +1 -1
  62. package/dist/cjs/salla-offer-modal.cjs.entry.js +1 -1
  63. package/dist/cjs/salla-offer.cjs.entry.js +1 -1
  64. package/dist/cjs/salla-order-branch.cjs.entry.js +1 -1
  65. package/dist/cjs/salla-order-cancel.cjs.entry.js +1 -1
  66. package/dist/cjs/salla-order-details-multiple-bundle-product.cjs.entry.js +1 -1
  67. package/dist/cjs/salla-order-details-options.cjs.entry.js +1 -1
  68. package/dist/cjs/salla-order-details.cjs.entry.js +1 -1
  69. package/dist/cjs/salla-order-edit-item.cjs.entry.js +1 -1
  70. package/dist/cjs/salla-order-edit-product-card.cjs.entry.js +1 -1
  71. package/dist/cjs/salla-order-edit.cjs.entry.js +1 -1
  72. package/dist/cjs/salla-order-options-modal_2.cjs.entry.js +1 -1
  73. package/dist/cjs/salla-order-shipments.cjs.entry.js +1 -1
  74. package/dist/cjs/salla-order-summary.cjs.entry.js +1 -1
  75. package/dist/cjs/salla-order-totals-card.cjs.entry.js +1 -1
  76. package/dist/cjs/salla-orders.cjs.entry.js +1 -1
  77. package/dist/cjs/salla-payments.cjs.entry.js +1 -1
  78. package/dist/cjs/salla-placeholder.cjs.entry.js +1 -1
  79. package/dist/cjs/salla-price-range.cjs.entry.js +1 -1
  80. package/dist/cjs/salla-product-card-embed.cjs.entry.js +1 -1
  81. package/dist/cjs/salla-product-size-guide.cjs.entry.js +1 -1
  82. package/dist/cjs/salla-products-list.cjs.entry.js +1 -1
  83. package/dist/cjs/salla-products-slider.cjs.entry.js +1 -1
  84. package/dist/cjs/salla-quick-order.cjs.entry.js +3 -3
  85. package/dist/cjs/salla-rating-modal-v2.cjs.entry.js +14 -73
  86. package/dist/cjs/salla-rating-modal.cjs.entry.js +7 -22
  87. package/dist/cjs/salla-review-factors-tags.cjs.entry.js +1 -1
  88. package/dist/cjs/salla-review-order-item.cjs.entry.js +1 -1
  89. package/dist/cjs/salla-scopes.cjs.entry.js +1 -1
  90. package/dist/cjs/salla-search.cjs.entry.js +1 -1
  91. package/dist/cjs/salla-skeleton.cjs.entry.js +1 -1
  92. package/dist/cjs/salla-slider.cjs.entry.js +1 -1
  93. package/dist/cjs/salla-social-share.cjs.entry.js +4 -4
  94. package/dist/cjs/salla-social.cjs.entry.js +1 -1
  95. package/dist/cjs/salla-tab-content_3.cjs.entry.js +1 -1
  96. package/dist/cjs/salla-tiered-offer.cjs.entry.js +1 -1
  97. package/dist/cjs/salla-tooltip.cjs.entry.js +1 -1
  98. package/dist/cjs/salla-trust-badges.cjs.entry.js +1 -1
  99. package/dist/cjs/salla-user-menu.cjs.entry.js +1 -1
  100. package/dist/cjs/salla-user-profile.cjs.entry.js +1 -1
  101. package/dist/cjs/salla-user-settings.cjs.entry.js +1 -1
  102. package/dist/cjs/salla-verify.cjs.entry.js +3 -3
  103. package/dist/cjs/salla-wallet.cjs.entry.js +1 -1
  104. package/dist/cjs/salla-wishlist-actions.cjs.entry.js +1 -1
  105. package/dist/cjs/twilight.cjs.js +2 -2
  106. package/dist/cjs/{vanilla-picker-GTx-kpDm.js → vanilla-picker-DQDSSf6Q.js} +1 -1
  107. package/dist/collection/collection-manifest.json +12 -14
  108. package/dist/collection/components/salla-bullet-delivery/helpers.js +3 -0
  109. package/dist/collection/components/salla-bullet-delivery/salla-bullet-delivery.js +82 -16
  110. package/dist/collection/components/salla-comments/interfaces.js +0 -12
  111. package/dist/collection/components/salla-comments/salla-comment-item.js +1 -1
  112. package/dist/collection/components/salla-comments/salla-comments.js +5 -38
  113. package/dist/collection/components/salla-delivery-promise/delivery-promise-api.js +1 -1
  114. package/dist/collection/components/salla-delivery-promise/delivery-promise-intent.js +9 -0
  115. package/dist/collection/components/salla-delivery-promise/salla-delivery-promise.js +10 -3
  116. package/dist/collection/components/salla-rating-modal/salla-rating-modal-v2.js +16 -119
  117. package/dist/collection/components/salla-rating-modal/salla-rating-modal.js +10 -69
  118. package/dist/components/helpers.js +319 -0
  119. package/dist/components/index.js +2 -2
  120. package/dist/components/salla-bullet-delivery.js +82 -327
  121. package/dist/components/salla-comment-item2.js +1 -1
  122. package/dist/components/salla-comments.js +1 -40
  123. package/dist/components/salla-delivery-promise.js +20 -4
  124. package/dist/components/salla-rating-modal-v22.js +12 -73
  125. package/dist/components/salla-rating-modal.js +591 -1
  126. package/dist/esm/{filepond-plugin-file-poster-BTU_WzVu.js → filepond-plugin-file-poster-CkWxCmZT.js} +1 -1
  127. package/dist/esm/{filepond-plugin-file-validate-size-c_09APqP.js → filepond-plugin-file-validate-size-DlWS-oUK.js} +1 -1
  128. package/dist/esm/{filepond-plugin-file-validate-type-Dz2Lgh8V.js → filepond-plugin-file-validate-type-mdpFM1TG.js} +1 -1
  129. package/dist/esm/{filepond-plugin-image-edit-DK7eXs2p.js → filepond-plugin-image-edit-BqPLKgZU.js} +1 -1
  130. package/dist/esm/{filepond-plugin-image-exif-orientation-DYBURwn_.js → filepond-plugin-image-exif-orientation-CMqFjPu7.js} +1 -1
  131. package/dist/esm/{filepond-plugin-image-preview-4WNiH-ie.js → filepond-plugin-image-preview-DjCwk-CI.js} +1 -1
  132. package/dist/esm/{filepond-BcXR53L3.js → filepond-wd7_MQSV.js} +1 -1
  133. package/dist/esm/helpers-BDChq2t4.js +319 -0
  134. package/dist/esm/{index-BW1au-Nh.js → index-CHZfg_a9.js} +14 -14
  135. package/dist/esm/{intlTelInput-DvPcVtVG.js → intlTelInput-B5Q8rrU9.js} +1 -1
  136. package/dist/esm/loader.js +3 -3
  137. package/dist/esm/{mail-DmgxDvXL.js → mail-DzAIgzdz.js} +2 -2
  138. package/dist/esm/salla-accordion-body_2.entry.js +1 -1
  139. package/dist/esm/salla-accordion_6.entry.js +1 -1
  140. package/dist/esm/salla-add-product-button_5.entry.js +1 -1
  141. package/dist/esm/salla-advertisement.entry.js +1 -1
  142. package/dist/esm/salla-alert_2.entry.js +1 -1
  143. package/dist/esm/salla-app-install-alert.entry.js +1 -1
  144. package/dist/esm/salla-apps-icons.entry.js +1 -1
  145. package/dist/esm/salla-attachment-view_9.entry.js +10 -10
  146. package/dist/esm/salla-badge.entry.js +1 -1
  147. package/dist/esm/salla-basket-gap.entry.js +1 -1
  148. package/dist/esm/salla-bullet-delivery_2.entry.js +83 -328
  149. package/dist/esm/salla-cart-coupons.entry.js +1 -1
  150. package/dist/esm/salla-cart-item-offers_2.entry.js +1 -1
  151. package/dist/esm/salla-cart-summary-card.entry.js +1 -1
  152. package/dist/esm/salla-cashback-banner.entry.js +1 -1
  153. package/dist/esm/salla-comment-factors.entry.js +1 -1
  154. package/dist/esm/{salla-comment-form_9.entry.js → salla-comment-form_8.entry.js} +4 -259
  155. package/dist/esm/salla-conditional-offer.entry.js +1 -1
  156. package/dist/esm/salla-contacts.entry.js +3 -3
  157. package/dist/esm/salla-cookies-bar.entry.js +1 -1
  158. package/dist/esm/salla-count-down.entry.js +1 -1
  159. package/dist/esm/salla-custom-fields.entry.js +1 -1
  160. package/dist/esm/salla-delivery-promise.entry.js +21 -5
  161. package/dist/esm/salla-edit-order-button.entry.js +1 -1
  162. package/dist/esm/salla-filters-widget.entry.js +1 -1
  163. package/dist/esm/salla-filters.entry.js +1 -1
  164. package/dist/esm/salla-fulfillment-methods.entry.js +1 -1
  165. package/dist/esm/salla-gifting.entry.js +1 -1
  166. package/dist/esm/salla-hook.entry.js +1 -1
  167. package/dist/esm/salla-infinite-scroll.entry.js +1 -1
  168. package/dist/esm/salla-installment.entry.js +1 -1
  169. package/dist/esm/salla-list-tile.entry.js +1 -1
  170. package/dist/esm/salla-localization-modal.entry.js +1 -1
  171. package/dist/esm/salla-login-modal.entry.js +1 -1
  172. package/dist/esm/salla-loyalty-banner_10.entry.js +3 -3
  173. package/dist/esm/salla-loyalty-exchange-product-card.entry.js +1 -1
  174. package/dist/esm/salla-loyalty-points-banner.entry.js +1 -1
  175. package/dist/esm/salla-loyalty-points-history.entry.js +1 -1
  176. package/dist/esm/salla-loyalty-prize-item.entry.js +1 -1
  177. package/dist/esm/salla-loyalty.entry.js +1 -1
  178. package/dist/esm/salla-maintenance-alert.entry.js +1 -1
  179. package/dist/esm/salla-map_2.entry.js +1 -1
  180. package/dist/esm/salla-menu.entry.js +1 -1
  181. package/dist/esm/salla-metadata.entry.js +1 -1
  182. package/dist/esm/salla-multiple-bundle-product-cart_2.entry.js +1 -1
  183. package/dist/esm/salla-multiple-bundle-product-options-modal_2.entry.js +1 -1
  184. package/dist/esm/salla-multiple-bundle-product.entry.js +1 -1
  185. package/dist/esm/salla-next-order-coupon.entry.js +1 -1
  186. package/dist/esm/salla-notification-item_2.entry.js +1 -1
  187. package/dist/esm/salla-offer-modal.entry.js +1 -1
  188. package/dist/esm/salla-offer.entry.js +1 -1
  189. package/dist/esm/salla-order-branch.entry.js +1 -1
  190. package/dist/esm/salla-order-cancel.entry.js +1 -1
  191. package/dist/esm/salla-order-details-multiple-bundle-product.entry.js +1 -1
  192. package/dist/esm/salla-order-details-options.entry.js +1 -1
  193. package/dist/esm/salla-order-details.entry.js +1 -1
  194. package/dist/esm/salla-order-edit-item.entry.js +1 -1
  195. package/dist/esm/salla-order-edit-product-card.entry.js +1 -1
  196. package/dist/esm/salla-order-edit.entry.js +1 -1
  197. package/dist/esm/salla-order-options-modal_2.entry.js +1 -1
  198. package/dist/esm/salla-order-shipments.entry.js +1 -1
  199. package/dist/esm/salla-order-summary.entry.js +1 -1
  200. package/dist/esm/salla-order-totals-card.entry.js +1 -1
  201. package/dist/esm/salla-orders.entry.js +1 -1
  202. package/dist/esm/salla-payments.entry.js +1 -1
  203. package/dist/esm/salla-placeholder.entry.js +1 -1
  204. package/dist/esm/salla-price-range.entry.js +1 -1
  205. package/dist/esm/salla-product-card-embed.entry.js +1 -1
  206. package/dist/esm/salla-product-size-guide.entry.js +1 -1
  207. package/dist/esm/salla-products-list.entry.js +1 -1
  208. package/dist/esm/salla-products-slider.entry.js +1 -1
  209. package/dist/esm/salla-quick-order.entry.js +3 -3
  210. package/dist/esm/salla-rating-modal-v2.entry.js +14 -73
  211. package/dist/esm/salla-rating-modal.entry.js +7 -22
  212. package/dist/esm/salla-review-factors-tags.entry.js +1 -1
  213. package/dist/esm/salla-review-order-item.entry.js +1 -1
  214. package/dist/esm/salla-scopes.entry.js +1 -1
  215. package/dist/esm/salla-search.entry.js +1 -1
  216. package/dist/esm/salla-skeleton.entry.js +1 -1
  217. package/dist/esm/salla-slider.entry.js +1 -1
  218. package/dist/esm/salla-social-share.entry.js +4 -4
  219. package/dist/esm/salla-social.entry.js +1 -1
  220. package/dist/esm/salla-tab-content_3.entry.js +1 -1
  221. package/dist/esm/salla-tiered-offer.entry.js +1 -1
  222. package/dist/esm/salla-tooltip.entry.js +1 -1
  223. package/dist/esm/salla-trust-badges.entry.js +1 -1
  224. package/dist/esm/salla-user-menu.entry.js +1 -1
  225. package/dist/esm/salla-user-profile.entry.js +1 -1
  226. package/dist/esm/salla-user-settings.entry.js +1 -1
  227. package/dist/esm/salla-verify.entry.js +3 -3
  228. package/dist/esm/salla-wallet.entry.js +1 -1
  229. package/dist/esm/salla-wishlist-actions.entry.js +1 -1
  230. package/dist/esm/twilight.js +3 -3
  231. package/dist/esm/{vanilla-picker-CDk_knNu.js → vanilla-picker-uNDULydX.js} +1 -1
  232. package/dist/twilight/{p-df202b1d.entry.js → p-0495bfac.entry.js} +1 -1
  233. package/dist/twilight/{p-13dbbbdc.entry.js → p-0573a498.entry.js} +1 -1
  234. package/dist/twilight/{p-b89d8c3c.entry.js → p-06d9e1c5.entry.js} +1 -1
  235. package/dist/twilight/{p-b1dfc455.entry.js → p-0749cc55.entry.js} +1 -1
  236. package/dist/twilight/p-0ae39262.entry.js +4 -0
  237. package/dist/twilight/{p-de83979a.entry.js → p-12836275.entry.js} +1 -1
  238. package/dist/twilight/p-12f61ae1.entry.js +4 -0
  239. package/dist/twilight/{p-69f4a089.entry.js → p-1419a93d.entry.js} +1 -1
  240. package/dist/twilight/{p-baa06c65.entry.js → p-17d49c87.entry.js} +1 -1
  241. package/dist/twilight/{p-1282e22a.entry.js → p-1ea25389.entry.js} +1 -1
  242. package/dist/twilight/{p-80c11fae.entry.js → p-2305edcc.entry.js} +1 -1
  243. package/dist/twilight/{p-10534171.entry.js → p-235d7596.entry.js} +1 -1
  244. package/dist/twilight/{p-50c0b6fa.entry.js → p-25d9f1b2.entry.js} +1 -1
  245. package/dist/twilight/{p-16ccbce5.entry.js → p-25f51a7e.entry.js} +1 -1
  246. package/dist/twilight/{p-3c28560f.entry.js → p-279a1661.entry.js} +1 -1
  247. package/dist/twilight/{p-ac794ed6.entry.js → p-28248b6b.entry.js} +1 -1
  248. package/dist/twilight/{p-7afd066a.entry.js → p-2d01a4f5.entry.js} +1 -1
  249. package/dist/twilight/{p-66c7b9e4.entry.js → p-2d62c947.entry.js} +1 -1
  250. package/dist/twilight/{p-489d084c.entry.js → p-2db5e829.entry.js} +1 -1
  251. package/dist/twilight/{p-362792d6.entry.js → p-2de58591.entry.js} +1 -1
  252. package/dist/twilight/{p-16296dce.entry.js → p-32e3daa3.entry.js} +1 -1
  253. package/dist/twilight/{p-beb2110d.entry.js → p-345532e5.entry.js} +1 -1
  254. package/dist/twilight/{p-280e67f0.entry.js → p-346366ba.entry.js} +1 -1
  255. package/dist/twilight/{p-46399dc8.entry.js → p-35557962.entry.js} +1 -1
  256. package/dist/twilight/{p-d54acab0.entry.js → p-3672d4f7.entry.js} +1 -1
  257. package/dist/twilight/{p-315890b5.entry.js → p-37163aef.entry.js} +1 -1
  258. package/dist/twilight/{p-e184cd72.entry.js → p-391a2ec6.entry.js} +1 -1
  259. package/dist/twilight/{p-b2b818a5.entry.js → p-3a8be7df.entry.js} +1 -1
  260. package/dist/twilight/{p-ceb40475.entry.js → p-3f5bc617.entry.js} +1 -1
  261. package/dist/twilight/{p-cf4efddb.entry.js → p-419499d6.entry.js} +1 -1
  262. package/dist/twilight/{p-d018fc49.entry.js → p-4ac9a3b6.entry.js} +1 -1
  263. package/dist/twilight/{p-aa9fb9f5.entry.js → p-5074de7d.entry.js} +1 -1
  264. package/dist/twilight/{p-65a86613.entry.js → p-51a062cd.entry.js} +1 -1
  265. package/dist/twilight/p-54e2d320.entry.js +1024 -0
  266. package/dist/twilight/{p-84679cc1.entry.js → p-5933ba05.entry.js} +1 -1
  267. package/dist/twilight/{p-4b14e0f8.entry.js → p-5d9a85b0.entry.js} +1 -1
  268. package/dist/twilight/{p-d7a68f6c.entry.js → p-5ded000f.entry.js} +1 -1
  269. package/dist/twilight/{p-a3fdec51.entry.js → p-63b01300.entry.js} +1 -1
  270. package/dist/twilight/{p-677bcf4c.entry.js → p-64efbb2c.entry.js} +1 -1
  271. package/dist/twilight/{p-feb80402.entry.js → p-67b91397.entry.js} +1 -1
  272. package/dist/twilight/{p-9b1403fc.entry.js → p-69119c00.entry.js} +1 -1
  273. package/dist/twilight/{p-6e78ee63.entry.js → p-6c18cc72.entry.js} +1 -1
  274. package/dist/twilight/{p-1ba8fb02.entry.js → p-6d961d73.entry.js} +1 -1
  275. package/dist/twilight/{p-64f0c216.entry.js → p-6ff53523.entry.js} +1 -1
  276. package/dist/twilight/{p-75065cbf.entry.js → p-72ee7071.entry.js} +1 -1
  277. package/dist/twilight/{p-6d6618f8.entry.js → p-72f54055.entry.js} +1 -1
  278. package/dist/twilight/{p-3b9dcb0f.entry.js → p-74529abb.entry.js} +1 -1
  279. package/dist/twilight/{p-664d428e.entry.js → p-766a3291.entry.js} +1 -1
  280. package/dist/twilight/{p-d3692caf.entry.js → p-788fd019.entry.js} +1 -1
  281. package/dist/twilight/{p-a15b4245.entry.js → p-82fe9f82.entry.js} +1 -1
  282. package/dist/twilight/{p-f45f5f91.entry.js → p-832f3a98.entry.js} +1 -1
  283. package/dist/twilight/{p-89fe5237.entry.js → p-84380d4a.entry.js} +1 -1
  284. package/dist/twilight/{p-311a905b.entry.js → p-8780a467.entry.js} +1 -1
  285. package/dist/twilight/{p-7adefcd6.entry.js → p-87e10a68.entry.js} +1 -1
  286. package/dist/twilight/{p-3cfd4fcd.entry.js → p-88f50d7e.entry.js} +1 -1
  287. package/dist/twilight/{p-f0a04676.entry.js → p-8fc6e860.entry.js} +1 -1
  288. package/dist/twilight/{p-cc3a9188.entry.js → p-90e5c3ab.entry.js} +1 -1
  289. package/dist/twilight/{p-641cc01d.entry.js → p-93aa1b67.entry.js} +1 -1
  290. package/dist/twilight/{p-a4436d17.entry.js → p-93dabb47.entry.js} +1 -1
  291. package/dist/twilight/{p-07c013f9.entry.js → p-98108ebe.entry.js} +1 -1
  292. package/dist/twilight/{p-72960bb3.entry.js → p-989f2adb.entry.js} +1 -1
  293. package/dist/twilight/{p-4be8900d.entry.js → p-9d224252.entry.js} +1 -1
  294. package/dist/twilight/p-BDChq2t4.js +4 -0
  295. package/dist/twilight/{p-D9Y6HNvi.js → p-BPkSO6gd.js} +1 -1
  296. package/dist/twilight/{p-BUMDIRU5.js → p-BWvO3cE-.js} +1 -1
  297. package/dist/twilight/{p-BW1au-Nh.js → p-CHZfg_a9.js} +1 -1
  298. package/dist/twilight/{p-AncUY1nn.js → p-CdgES2Of.js} +1 -1
  299. package/dist/twilight/{p-DPMPVhgw.js → p-D9VjvNQq.js} +2 -2
  300. package/dist/twilight/{p-C6nX89oY.js → p-DO7S0QBX.js} +1 -1
  301. package/dist/twilight/{p-UDPL8zGN.js → p-DtV7npW9.js} +1 -1
  302. package/dist/twilight/{p-DmgxDvXL.js → p-DzAIgzdz.js} +1 -1
  303. package/dist/twilight/{p-UIEwOe70.js → p-PCp-0mbL.js} +1 -1
  304. package/dist/twilight/{p-BjS2Vb6h.js → p-ZinKLSYw.js} +1 -1
  305. package/dist/twilight/{p-1c82117c.entry.js → p-a0561bd1.entry.js} +1 -1
  306. package/dist/twilight/{p-1187210a.entry.js → p-a785b49f.entry.js} +1 -1
  307. package/dist/twilight/{p-13bf1c47.entry.js → p-aa4daadf.entry.js} +1 -1
  308. package/dist/twilight/p-ab41d26c.entry.js +4 -0
  309. package/dist/twilight/{p-87cc2e08.entry.js → p-afb03ee5.entry.js} +1 -1
  310. package/dist/twilight/{p-caa8d5ae.entry.js → p-b279e0bb.entry.js} +1 -1
  311. package/dist/twilight/{p-bcee5564.entry.js → p-b33392c6.entry.js} +1 -1
  312. package/dist/twilight/{p-e1eb70d2.entry.js → p-b38c4e39.entry.js} +1 -1
  313. package/dist/twilight/{p-26f8a482.entry.js → p-bead6e6f.entry.js} +1 -1
  314. package/dist/twilight/{p-8643930a.entry.js → p-c26043ff.entry.js} +1 -1
  315. package/dist/twilight/{p-a7a10dbf.entry.js → p-c287e498.entry.js} +1 -1
  316. package/dist/twilight/{p-87af932a.entry.js → p-c2fe2dbe.entry.js} +1 -1
  317. package/dist/twilight/{p-6d3a4c41.entry.js → p-c603722c.entry.js} +1 -1
  318. package/dist/twilight/{p-edebecb3.entry.js → p-c816b198.entry.js} +1 -1
  319. package/dist/twilight/{p-f3f9d1fb.entry.js → p-c81bce54.entry.js} +1 -1
  320. package/dist/twilight/{p-40555637.entry.js → p-c9146d50.entry.js} +1 -1
  321. package/dist/twilight/{p-5335f307.entry.js → p-c92edd6f.entry.js} +1 -1
  322. package/dist/twilight/{p-821aa95a.entry.js → p-c948a8a8.entry.js} +1 -1
  323. package/dist/twilight/{p-93c006fc.entry.js → p-d0d3609c.entry.js} +1 -1
  324. package/dist/twilight/{p-a38dc391.entry.js → p-d9b0fa64.entry.js} +1 -1
  325. package/dist/twilight/{p-534e7760.entry.js → p-dd823fde.entry.js} +1 -1
  326. package/dist/twilight/p-e36f62a9.entry.js +4 -0
  327. package/dist/twilight/{p-beaab93e.entry.js → p-e5a3b689.entry.js} +1 -1
  328. package/dist/twilight/{p-c7e980aa.entry.js → p-ec281904.entry.js} +1 -1
  329. package/dist/twilight/{p-68d6fa66.entry.js → p-f07bbbc7.entry.js} +1 -1
  330. package/dist/twilight/{p-3ad55c42.entry.js → p-f168109d.entry.js} +1 -1
  331. package/dist/twilight/{p-e8153a9a.entry.js → p-f1d8729d.entry.js} +1 -1
  332. package/dist/twilight/{p-2a8f1ed4.entry.js → p-f1dfe18b.entry.js} +1 -1
  333. package/dist/twilight/{p-c23f7b95.entry.js → p-fb1ad954.entry.js} +1 -1
  334. package/dist/twilight/{p-c214700a.entry.js → p-ffdf5f92.entry.js} +1 -1
  335. package/dist/twilight/{p-CMWS1gyZ.js → p-ryHWESoh.js} +1 -1
  336. package/dist/twilight/twilight.esm.js +1 -1
  337. package/dist/types/components/salla-bullet-delivery/helpers.d.ts +1 -0
  338. package/dist/types/components/salla-bullet-delivery/interfaces.d.ts +14 -4
  339. package/dist/types/components/salla-bullet-delivery/salla-bullet-delivery.d.ts +2 -0
  340. package/dist/types/components/salla-comments/interfaces.d.ts +0 -15
  341. package/dist/types/components/salla-comments/salla-comments.d.ts +2 -5
  342. package/dist/types/components/salla-delivery-promise/delivery-promise-intent.d.ts +0 -4
  343. package/dist/types/components/salla-delivery-promise/interfaces.d.ts +2 -1
  344. package/dist/types/components/salla-rating-modal/salla-rating-modal-v2.d.ts +3 -16
  345. package/dist/types/components/salla-rating-modal/salla-rating-modal.d.ts +2 -10
  346. package/dist/types/components.d.ts +12 -45
  347. package/package.json +5 -5
  348. package/dist/collection/components/salla-verified-review/salla-verified-review.css +0 -162
  349. package/dist/collection/components/salla-verified-review/salla-verified-review.js +0 -264
  350. package/dist/components/salla-rating-modal2.js +0 -613
  351. package/dist/components/salla-verified-review.d.ts +0 -11
  352. package/dist/components/salla-verified-review.js +0 -325
  353. package/dist/twilight/p-03d77f90.entry.js +0 -4
  354. package/dist/twilight/p-4f052df8.entry.js +0 -4
  355. package/dist/twilight/p-a9674965.entry.js +0 -4
  356. package/dist/twilight/p-cbe760ce.entry.js +0 -4
  357. package/dist/twilight/p-e29f28eb.entry.js +0 -1019
  358. package/dist/types/components/salla-verified-review/salla-verified-review.d.ts +0 -51
@@ -3,322 +3,11 @@
3
3
  */
4
4
  'use strict';
5
5
 
6
- var index = require('./index-Bw3b6O6G.js');
6
+ var index = require('./index-DGpOR-TH.js');
7
+ var helpers = require('./helpers-DHdDjm5V.js');
7
8
  var location = require('./location-DIyESLuI.js');
8
9
  var search = require('./search-c7Aa7lM9.js');
9
10
 
10
- /**
11
- * API Service for salla-bullet-delivery component
12
- * Uses Salla's shipping API and scope API for delivery location management
13
- */
14
- const API_LOG_PREFIX = 'BulletDeliveryAPI';
15
- const validId = (id) => {
16
- const n = id == null ? Number.NaN : Number(id);
17
- return !Number.isNaN(n) && n !== 0;
18
- };
19
- async function withApiErrorHandling(fn, fallback, logLabel) {
20
- try {
21
- return await fn();
22
- }
23
- catch (error) {
24
- console.error(`${API_LOG_PREFIX}: ${logLabel}`, error);
25
- return fallback;
26
- }
27
- }
28
- const apiCache = new Map();
29
- const CACHE_TTL = 5 * 60 * 1000;
30
- function getCached(key) {
31
- const entry = apiCache.get(key);
32
- if (!entry || Date.now() - entry.timestamp > CACHE_TTL) {
33
- apiCache.delete(key);
34
- return null;
35
- }
36
- return entry.data;
37
- }
38
- function setCache(key, data) {
39
- apiCache.set(key, { data, timestamp: Date.now() });
40
- }
41
- /** Uses country code from API (e.g. 'SA'). */
42
- const isSaudiArabia = (countryCode) => String(countryCode).toUpperCase() === 'SA';
43
- /**
44
- * Fast Delivery API Service
45
- * Uses Salla's shipping API and scopes API. Branch and address data are used as returned by the API (no mapping).
46
- */
47
- const bulletDeliveryAPI = {
48
- /**
49
- * Get available countries from Salla shipping API
50
- * @param forBranch - when true, use for_branch=1 (e.g. for pickup/branches tab)
51
- */
52
- async getCountries(forBranch = false, query) {
53
- const cacheKey = !query?.trim() ? `countries_${forBranch ? 1 : 0}` : null;
54
- if (cacheKey) {
55
- const cached = getCached(cacheKey);
56
- if (cached)
57
- return cached;
58
- }
59
- const result = await withApiErrorHandling(async () => {
60
- const params = { for_branch: forBranch ? 1 : 0 };
61
- if (forBranch) {
62
- params.for_allocation = 1;
63
- }
64
- if (query?.trim())
65
- params.query = query.trim();
66
- const data = (await salla.api.request("shipping/countries", { params }))?.data ?? [];
67
- return data.map((c) => ({ id: c.id, code: c.code, name: c.name, has_regions: isSaudiArabia(c.code) }));
68
- }, [], 'Error getting countries');
69
- if (cacheKey && result.length > 0)
70
- setCache(cacheKey, result);
71
- return result;
72
- },
73
- /**
74
- * Get regions for a country from Salla shipping API
75
- * Endpoint: GET /shipping/countries/<COUNTRY_ID>/region
76
- */
77
- async getRegions(countryId, query) {
78
- if (!validId(countryId)) {
79
- console.warn(`${API_LOG_PREFIX}: getRegions called without valid country_id`);
80
- return [];
81
- }
82
- const cacheKey = !query?.trim() ? `regions_${countryId}` : null;
83
- if (cacheKey) {
84
- const cached = getCached(cacheKey);
85
- if (cached)
86
- return cached;
87
- }
88
- const result = await withApiErrorHandling(async () => {
89
- const params = {};
90
- if (query?.trim())
91
- params.query = query.trim();
92
- const data = (await salla.api.request(`shipping/countries/${countryId}/regions`, { params }))?.data ?? [];
93
- return data.map((r) => ({ id: r.id, name: r.name, code: r.code, country_id: Number(countryId) }));
94
- }, [], 'Error fetching regions');
95
- if (cacheKey && result.length > 0)
96
- setCache(cacheKey, result);
97
- return result;
98
- },
99
- /**
100
- * Get cities from Salla shipping API
101
- * @param regionId - Optional; when provided (e.g. for SA), cities are filtered by region
102
- */
103
- async getCities(countryId, regionId, query) {
104
- if (!validId(countryId)) {
105
- console.warn(`${API_LOG_PREFIX}: getCities called without valid country_id`);
106
- return [];
107
- }
108
- const cacheKey = !query?.trim() ? `cities_${countryId}_${regionId || 'all'}` : null;
109
- if (cacheKey) {
110
- const cached = getCached(cacheKey);
111
- if (cached)
112
- return cached;
113
- }
114
- const result = await withApiErrorHandling(async () => {
115
- const params = { for_branch: 0, country_id: countryId };
116
- if (regionId)
117
- params.region_id = regionId;
118
- if (query?.trim())
119
- params.query = query.trim();
120
- const data = (await salla.api.request("shipping/cities", { params }))?.data ?? [];
121
- return data.map((c) => ({ id: c.id, name: c.name, country_id: countryId, ...(c.region_id != null && { region_id: c.region_id }) }));
122
- }, [], 'Error fetching cities');
123
- if (cacheKey && result.length > 0)
124
- setCache(cacheKey, result);
125
- return result;
126
- },
127
- /**
128
- * Get districts from Salla shipping API
129
- */
130
- async getDistricts(cityId, query) {
131
- if (!validId(cityId)) {
132
- console.warn(`${API_LOG_PREFIX}: getDistricts called without valid city_id`);
133
- return [];
134
- }
135
- return withApiErrorHandling(async () => {
136
- const params = { for_branch: 0, city_id: cityId };
137
- if (query?.trim())
138
- params.query = query.trim();
139
- const raw = (await salla.api.request("shipping/districts", { params }))?.data;
140
- const list = Array.isArray(raw) ? raw : (Array.isArray(raw?.districts) ? raw.districts : []);
141
- return list.map((d) => ({ id: d.id, name: d.name, name_en: d.name_en, city_id: cityId }));
142
- }, [], 'Error fetching districts');
143
- },
144
- async getSavedAddresses() {
145
- return withApiErrorHandling(async () => {
146
- const data = (await salla.api.request("address"))?.data;
147
- return Array.isArray(data) ? data : [];
148
- }, [], 'Error fetching user addresses');
149
- },
150
- async getBranches({ query, lat, lng, country_id, per_page = 20 } = {}) {
151
- const hasSearchParams = query?.trim()?.length >= 2 || lat || lng;
152
- const cacheKey = !hasSearchParams && country_id ? `branches_${country_id}` : null;
153
- if (cacheKey) {
154
- const cached = getCached(cacheKey);
155
- if (cached)
156
- return cached;
157
- }
158
- const result = await withApiErrorHandling(async () => {
159
- const params = { per_page };
160
- if (query?.trim().length >= 2)
161
- params.query = query;
162
- if (lat)
163
- params.lat = lat;
164
- if (lng)
165
- params.lng = lng;
166
- if (country_id)
167
- params.country_id = country_id;
168
- const res = await salla.api.request("branches", { params });
169
- return (Array.isArray(res?.data) ? res.data : []);
170
- }, [], 'Error fetching branches');
171
- if (cacheKey && result.length > 0)
172
- setCache(cacheKey, result);
173
- return result;
174
- },
175
- async saveAddressLocation(payload) {
176
- return withApiErrorHandling(async () => {
177
- const res = await salla.api.request('address/location', { ...payload, for_allocation: true }, 'post');
178
- const data = res?.data ?? res;
179
- const address = typeof data === 'object' && data != null && 'id' in data ? data : undefined;
180
- return { success: true, address };
181
- }, { success: false }, 'Error saving address/location');
182
- },
183
- async setDeliveryScope(scopeId) {
184
- return withApiErrorHandling(async () => {
185
- await salla.api.withoutNotifier(() => salla.scope.change({ id: scopeId }));
186
- salla.storage.set("scope", { ...(salla.storage.get("scope") || {}), id: scopeId });
187
- return true;
188
- }, false, 'Error setting delivery scope');
189
- },
190
- async allocateScope(payload) {
191
- const errMsg = (d) => d?.error?.message ?? d?.message ?? 'Failed to allocate scope';
192
- try {
193
- const response = await salla.api.withoutNotifier(() => salla.api.request("scopes/allocation", payload, 'post'));
194
- // SDK resolves with { data } and throws on non-2xx; any resolved value is success
195
- const data = response?.data ?? response;
196
- return { success: true, data: data };
197
- }
198
- catch (error) {
199
- console.error(`${API_LOG_PREFIX}: Error allocating scope`, error);
200
- const err = error;
201
- return { success: false, error: err?.response?.data != null ? errMsg(err.response.data) : (err?.message ?? 'Unknown error') };
202
- }
203
- },
204
- async getAddressToken() {
205
- return withApiErrorHandling(async () => {
206
- const res = await salla.api.request('address/autocomplete-token');
207
- return res?.data?.token ?? null;
208
- }, null, 'Error fetching address autocomplete token');
209
- },
210
- };
211
- function clearApiCache() {
212
- apiCache.clear();
213
- }
214
-
215
- /**
216
- * Helper functions for salla-bullet-delivery component
217
- */
218
- const EARTH_RADIUS_KM = 6371;
219
- const deg2rad = (deg) => deg * (Math.PI / 180);
220
- /** Haversine distance in km */
221
- function calculateDistance(lat1, lon1, lat2, lon2) {
222
- const dLat = deg2rad(lat2 - lat1);
223
- const dLon = deg2rad(lon2 - lon1);
224
- const a = Math.sin(dLat / 2) ** 2 +
225
- Math.cos(deg2rad(lat1)) * Math.cos(deg2rad(lat2)) * Math.sin(dLon / 2) ** 2;
226
- return EARTH_RADIUS_KM * 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
227
- }
228
- /**
229
- * Whether a pickup branch can be selected.
230
- *
231
- * `pickup_readiness` is the richer, backend-computed verdict (INV-357) and wins whenever the API
232
- * sends it. Not every store's `GET /branches` returns it though, so we fall back to the original
233
- * `is_open` rule instead of treating a missing object as "not selectable" — otherwise every branch
234
- * in the list renders disabled and pickup cannot be chosen at all (SP-22202).
235
- */
236
- const isBranchSelectable = (branch) => {
237
- if (!branch)
238
- return false;
239
- const selectable = branch.pickup_readiness?.selectable;
240
- return typeof selectable === 'boolean' ? selectable : branch.is_open !== false;
241
- };
242
- /** Nearest available branch by distance; single pass O(n). */
243
- function findNearestBranch(branches, userLat, userLon) {
244
- let nearest = null;
245
- let minD = Number.POSITIVE_INFINITY;
246
- for (const b of branches) {
247
- const lat = b.location?.lat != null ? Number(b.location.lat) : Number.NaN;
248
- const lng = b.location?.lng != null ? Number(b.location.lng) : Number.NaN;
249
- if (Number.isNaN(lat) || Number.isNaN(lng) || b.is_open === false)
250
- continue;
251
- const d = calculateDistance(userLat, userLon, lat, lng);
252
- if (d < minD) {
253
- minD = d;
254
- nearest = b;
255
- }
256
- }
257
- return nearest;
258
- }
259
- const filterBranches = (branches, searchQuery) => {
260
- if (!searchQuery)
261
- return branches;
262
- const q = searchQuery.toLowerCase();
263
- return branches.filter((b) => b.name.toLowerCase().includes(q) || b.city?.name?.toLowerCase().includes(q));
264
- };
265
- const getIntentSubtitle = (intent, toAddress, fromBranch) => {
266
- if (intent.type === 'branch') {
267
- const loc = intent.branch_details?.city ?? intent.branch_details?.name;
268
- return loc ? `${fromBranch} ${loc}`.trim() : '';
269
- }
270
- if (intent.type === 'address' && intent.address_details) {
271
- 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 || '';
272
- return addr ? `${toAddress} ${addr}`.trim() : '';
273
- }
274
- return '';
275
- };
276
- const idFrom = (val) => (val != null ? Number(val) : undefined);
277
- const getIntentCountryId = (i) => idFrom(i?.address_details?.country?.id);
278
- const getIntentCountryCode = (i) => i?.country_code ?? i?.address_details?.country?.code ?? '';
279
- const getIntentRegionId = (i) => idFrom(i?.address_details?.region?.id);
280
- const getIntentCityId = (i) => idFrom(i?.address_details?.city?.id);
281
- const getIntentDistrictId = (i) => idFrom(i?.address_details?.district?.id);
282
- const getIntentBranchId = (i) => i?.branch_details?.id;
283
- /** Intent coordinates (branch tab only; address flow no longer uses coordinates). */
284
- const getIntentLatitude = (i) => i?.branch_details?.latitude;
285
- const getIntentLongitude = (i) => i?.branch_details?.longitude;
286
- const hasSessionAddressIntent = (intent) => {
287
- if (!intent || intent.type !== 'address' || intent.address_id)
288
- return false;
289
- const c = getIntentCountryId(intent);
290
- const city = getIntentCityId(intent);
291
- const d = getIntentDistrictId(intent);
292
- const code = getIntentCountryCode(intent);
293
- const hasDistrictId = d != null && Number(d) !== 0;
294
- const hasDistrictName = Boolean(intent.address_details?.district?.name?.trim());
295
- const districtOk = !isSaudiArabia(code) || hasDistrictId || hasDistrictName;
296
- return !!(c && city && districtOk);
297
- };
298
- const requireRegionAndDistrictForSA = (countryCode, regionId, districtIdOrName) => !countryCode || !isSaudiArabia(countryCode)
299
- ? true
300
- : (regionId != null && Number(regionId) !== 0) && (districtIdOrName != null && (typeof districtIdOrName === 'number' ? districtIdOrName !== 0 : String(districtIdOrName).trim().length > 0));
301
- function buildAddressLocationPayloadFromSelection(options) {
302
- const { countryId, countryCode, regionId, cityId, districtId, description = '', lat, lng, shortAddress } = options;
303
- const desc = description || '';
304
- return {
305
- country_id: Number(countryId) || undefined,
306
- region_id: regionId != null ? Number(regionId) : undefined,
307
- city_id: cityId != null ? Number(cityId) : undefined,
308
- district_id: districtId != null ? Number(districtId) : undefined,
309
- description: desc,
310
- ...(countryCode && isSaudiArabia(countryCode) && { local: desc }),
311
- ...(lat != null && lng != null && { lat, lng }),
312
- ...(shortAddress && { short_address: shortAddress }),
313
- };
314
- }
315
- const GEO_ERROR_MESSAGES = {
316
- [GeolocationPositionError.PERMISSION_DENIED]: 'Location permission denied',
317
- [GeolocationPositionError.POSITION_UNAVAILABLE]: 'Location unavailable',
318
- [GeolocationPositionError.TIMEOUT]: 'Location timeout',
319
- };
320
- const getGeolocationErrorMessage = (errorCode) => GEO_ERROR_MESSAGES[errorCode] ?? 'An error occurred while detecting location';
321
-
322
11
  /**
323
12
  * @license
324
13
  * Copyright 2019 Google LLC
@@ -4948,9 +4637,9 @@ const SallaBulletDelivery = class {
4948
4637
  this.citySearchTimer = setTimeout(async () => {
4949
4638
  this.searchingCities = true;
4950
4639
  try {
4951
- const isSA = isSaudiArabia(this.selectedCountry?.code ?? '');
4640
+ const isSA = helpers.isSaudiArabia(this.selectedCountry?.code ?? '');
4952
4641
  const regionId = isSA ? this.selectedRegion?.id : undefined;
4953
- const results = await bulletDeliveryAPI.getCities(this.selectedCountry?.id, regionId, query);
4642
+ const results = await helpers.bulletDeliveryAPI.getCities(this.selectedCountry?.id, regionId, query);
4954
4643
  if (requestId === this.citySearchCounter) {
4955
4644
  this.displayedCities = results;
4956
4645
  }
@@ -5062,12 +4751,12 @@ const SallaBulletDelivery = class {
5062
4751
  if (!hasMap && !hasDropdowns)
5063
4752
  return;
5064
4753
  if (!hasMap &&
5065
- !requireRegionAndDistrictForSA(this.selectedCountry?.code, this.selectedRegion?.id, this.selectedDistrict?.id ?? (this.districtName?.trim() || null)))
4754
+ !helpers.requireRegionAndDistrictForSA(this.selectedCountry?.code, this.selectedRegion?.id, this.selectedDistrict?.id ?? (this.districtName?.trim() || null)))
5066
4755
  return;
5067
4756
  this.savingAddress = true;
5068
4757
  try {
5069
4758
  const payload = this.buildAddressLocationPayload();
5070
- const { success, address } = await bulletDeliveryAPI.saveAddressLocation(payload);
4759
+ const { success, address } = await helpers.bulletDeliveryAPI.saveAddressLocation(payload);
5071
4760
  if (success) {
5072
4761
  await this.loadSavedAddresses();
5073
4762
  const latest = address ?? this.savedAddresses[0] ?? null;
@@ -5136,7 +4825,7 @@ const SallaBulletDelivery = class {
5136
4825
  }
5137
4826
  };
5138
4827
  this.handleCitySelected = (item) => {
5139
- const isSA = isSaudiArabia(this.selectedCountry?.code ?? '');
4828
+ const isSA = helpers.isSaudiArabia(this.selectedCountry?.code ?? '');
5140
4829
  const city = this.cities.find(c => String(c.id) === String(item.id)) || item;
5141
4830
  this.selectedCity = city || null;
5142
4831
  this.selectedDistrict = null;
@@ -5211,8 +4900,8 @@ const SallaBulletDelivery = class {
5211
4900
  this.applyPreselectedIdsFromIntent(savedIntent);
5212
4901
  const hasStoredAddressIds = !this.isLoggedIn &&
5213
4902
  savedIntent?.type === "address" &&
5214
- getIntentCountryId(savedIntent) != null &&
5215
- getIntentCityId(savedIntent) != null;
4903
+ helpers.getIntentCountryId(savedIntent) != null &&
4904
+ helpers.getIntentCityId(savedIntent) != null;
5216
4905
  // Set default tab first so we can lazy-load tab-specific data.
5217
4906
  if (this.supportsPickup && !this.isSupportsDelivery) {
5218
4907
  this.activeTab = 'branch';
@@ -5252,8 +4941,8 @@ const SallaBulletDelivery = class {
5252
4941
  // Load branches only when branch tab is active (lazy tab data)
5253
4942
  // Use lat/lng from session storage if available for more accurate results
5254
4943
  if (this.activeTab === "branch") {
5255
- const intentLat = getIntentLatitude(savedIntent);
5256
- const intentLng = getIntentLongitude(savedIntent);
4944
+ const intentLat = helpers.getIntentLatitude(savedIntent);
4945
+ const intentLng = helpers.getIntentLongitude(savedIntent);
5257
4946
  if (intentLat != null && intentLng != null) {
5258
4947
  await this.loadBranchesWithLocation(intentLat, intentLng);
5259
4948
  }
@@ -5372,7 +5061,7 @@ const SallaBulletDelivery = class {
5372
5061
  return false;
5373
5062
  // Intent is an address without address_id; consider it "incomplete"
5374
5063
  // only when it represents a valid session-style address.
5375
- return hasSessionAddressIntent(intent);
5064
+ return helpers.hasSessionAddressIntent(intent);
5376
5065
  }
5377
5066
  /**
5378
5067
  * Whether the store still supports the delivery method captured in a stored
@@ -5438,9 +5127,9 @@ const SallaBulletDelivery = class {
5438
5127
  */
5439
5128
  async prefillAddressFromStoredIntent() {
5440
5129
  const intent = this.getStoredIntent();
5441
- if (!intent || intent.type !== "address" || getIntentCityId(intent) == null)
5130
+ if (!intent || intent.type !== "address" || helpers.getIntentCityId(intent) == null)
5442
5131
  return;
5443
- const countryId = getIntentCountryId(intent);
5132
+ const countryId = helpers.getIntentCountryId(intent);
5444
5133
  if (!countryId)
5445
5134
  return;
5446
5135
  const country = this.countries.find((c) => String(c.id) === String(countryId));
@@ -5448,16 +5137,16 @@ const SallaBulletDelivery = class {
5448
5137
  return;
5449
5138
  this.selectedCountry = country;
5450
5139
  this.updateNewAddressForm({ country_id: Number(country.id) });
5451
- const isSA = isSaudiArabia(country.code);
5452
- const cityId = getIntentCityId(intent);
5453
- const regionId = getIntentRegionId(intent);
5454
- const districtId = getIntentDistrictId(intent);
5140
+ const isSA = helpers.isSaudiArabia(country.code);
5141
+ const cityId = helpers.getIntentCityId(intent);
5142
+ const regionId = helpers.getIntentRegionId(intent);
5143
+ const districtId = helpers.getIntentDistrictId(intent);
5455
5144
  const districtName = intent.address_details?.district?.name;
5456
5145
  const [regions, cities, districts] = await Promise.all([
5457
- isSA ? bulletDeliveryAPI.getRegions(country.id) : Promise.resolve([]),
5458
- bulletDeliveryAPI.getCities(country.id, isSA && regionId != null ? regionId : undefined),
5146
+ isSA ? helpers.bulletDeliveryAPI.getRegions(country.id) : Promise.resolve([]),
5147
+ helpers.bulletDeliveryAPI.getCities(country.id, isSA && regionId != null ? regionId : undefined),
5459
5148
  cityId != null
5460
- ? bulletDeliveryAPI.getDistricts(Number(cityId))
5149
+ ? helpers.bulletDeliveryAPI.getDistricts(Number(cityId))
5461
5150
  : Promise.resolve([]),
5462
5151
  ]);
5463
5152
  if (isSA) {
@@ -5525,7 +5214,7 @@ const SallaBulletDelivery = class {
5525
5214
  this.loadingCountries = true;
5526
5215
  const forBranch = this.activeTab === "branch";
5527
5216
  try {
5528
- this.countries = await bulletDeliveryAPI.getCountries(forBranch);
5217
+ this.countries = await helpers.bulletDeliveryAPI.getCountries(forBranch);
5529
5218
  this.displayedCountries = this.countries;
5530
5219
  const { countryId: configCountryId, regionId: configRegionId, cityId: configCityId, districtId: configDistrictId } = this.getIPLocationConfig();
5531
5220
  log("getIPLocationConfig", this.getIPLocationConfig());
@@ -5550,7 +5239,7 @@ const SallaBulletDelivery = class {
5550
5239
  districtId: configDistrictId,
5551
5240
  });
5552
5241
  }
5553
- else if (isSaudiArabia(this.selectedCountry.code)) {
5242
+ else if (helpers.isSaudiArabia(this.selectedCountry.code)) {
5554
5243
  await this.loadRegions(this.selectedCountry.id);
5555
5244
  }
5556
5245
  else {
@@ -5564,13 +5253,13 @@ const SallaBulletDelivery = class {
5564
5253
  }
5565
5254
  }
5566
5255
  async prefillFromIPLocation(country, ids) {
5567
- const isSA = isSaudiArabia(country.code);
5256
+ const isSA = helpers.isSaudiArabia(country.code);
5568
5257
  const { regionId, cityId, districtId } = ids;
5569
5258
  const [regions, cities, districts] = await Promise.all([
5570
- isSA ? bulletDeliveryAPI.getRegions(country.id) : Promise.resolve([]),
5571
- bulletDeliveryAPI.getCities(country.id, isSA && regionId != null ? regionId : undefined),
5259
+ isSA ? helpers.bulletDeliveryAPI.getRegions(country.id) : Promise.resolve([]),
5260
+ helpers.bulletDeliveryAPI.getCities(country.id, isSA && regionId != null ? regionId : undefined),
5572
5261
  cityId != null
5573
- ? bulletDeliveryAPI.getDistricts(Number(cityId))
5262
+ ? helpers.bulletDeliveryAPI.getDistricts(Number(cityId))
5574
5263
  : Promise.resolve([]),
5575
5264
  ]);
5576
5265
  if (isSA) {
@@ -5619,7 +5308,7 @@ const SallaBulletDelivery = class {
5619
5308
  this.selectedDistrict = null;
5620
5309
  this.districtName = "";
5621
5310
  try {
5622
- this.cities = await bulletDeliveryAPI.getCities(countryId, regionId);
5311
+ this.cities = await helpers.bulletDeliveryAPI.getCities(countryId, regionId);
5623
5312
  this.displayedCities = this.cities;
5624
5313
  }
5625
5314
  finally {
@@ -5633,7 +5322,7 @@ const SallaBulletDelivery = class {
5633
5322
  this.selectedDistrict = null;
5634
5323
  this.districtName = "";
5635
5324
  try {
5636
- this.districts = await bulletDeliveryAPI.getDistricts(cityId);
5325
+ this.districts = await helpers.bulletDeliveryAPI.getDistricts(cityId);
5637
5326
  this.displayedDistricts = this.districts;
5638
5327
  }
5639
5328
  finally {
@@ -5663,7 +5352,7 @@ const SallaBulletDelivery = class {
5663
5352
  async loadBranches() {
5664
5353
  this.loadingBranches = true;
5665
5354
  try {
5666
- this.branches = await bulletDeliveryAPI.getBranches({
5355
+ this.branches = await helpers.bulletDeliveryAPI.getBranches({
5667
5356
  country_id: this.selectedCountry?.id,
5668
5357
  });
5669
5358
  this.filterBranches();
@@ -5673,7 +5362,7 @@ const SallaBulletDelivery = class {
5673
5362
  }
5674
5363
  }
5675
5364
  filterBranches() {
5676
- this.filteredBranches = filterBranches(this.branches, this.branchSearchQuery);
5365
+ this.filteredBranches = helpers.filterBranches(this.branches, this.branchSearchQuery);
5677
5366
  }
5678
5367
  /**
5679
5368
  * Prefill form fields from session storage
@@ -5692,13 +5381,13 @@ const SallaBulletDelivery = class {
5692
5381
  }
5693
5382
  // Prefill branch tab
5694
5383
  if (this.activeTab === "branch" && intent.type === "branch") {
5695
- const countryId = getIntentCountryId(intent);
5384
+ const countryId = helpers.getIntentCountryId(intent);
5696
5385
  if (countryId != null) {
5697
5386
  const country = this.countries.find((c) => String(c.id) === String(countryId));
5698
5387
  if (country) {
5699
5388
  this.selectedCountry = country;
5700
5389
  this.updateNewAddressForm({ country_id: Number(country.id) });
5701
- const branchId = getIntentBranchId(intent);
5390
+ const branchId = helpers.getIntentBranchId(intent);
5702
5391
  if (branchId != null && this.branches.length > 0) {
5703
5392
  const branch = this.branches.find((b) => b.id === branchId);
5704
5393
  if (branch) {
@@ -5715,9 +5404,9 @@ const SallaBulletDelivery = class {
5715
5404
  }
5716
5405
  async loadSavedAddresses() {
5717
5406
  const previouslySelectedId = this.selectedSavedAddress?.id;
5718
- this.savedAddresses = await bulletDeliveryAPI.getSavedAddresses();
5407
+ this.savedAddresses = await helpers.bulletDeliveryAPI.getSavedAddresses();
5719
5408
  const intent = this.getStoredIntent();
5720
- const hasSessionAddress = hasSessionAddressIntent(intent);
5409
+ const hasSessionAddress = helpers.hasSessionAddressIntent(intent);
5721
5410
  if (hasSessionAddress) {
5722
5411
  this.selectedSessionAddress = true;
5723
5412
  this.selectedSavedAddress = null;
@@ -5774,7 +5463,7 @@ const SallaBulletDelivery = class {
5774
5463
  if (this.activeTab === "branch") {
5775
5464
  this.loadBranches();
5776
5465
  }
5777
- else if (isSaudiArabia(this.selectedCountry.code)) {
5466
+ else if (helpers.isSaudiArabia(this.selectedCountry.code)) {
5778
5467
  this.loadRegions(this.selectedCountry.id);
5779
5468
  }
5780
5469
  else {
@@ -5795,7 +5484,7 @@ const SallaBulletDelivery = class {
5795
5484
  this.selectedDistrict = null;
5796
5485
  this.districtName = "";
5797
5486
  try {
5798
- this.regions = await bulletDeliveryAPI.getRegions(countryId);
5487
+ this.regions = await helpers.bulletDeliveryAPI.getRegions(countryId);
5799
5488
  this.displayedRegions = this.regions;
5800
5489
  }
5801
5490
  finally {
@@ -5811,6 +5500,9 @@ const SallaBulletDelivery = class {
5811
5500
  ? `${address.district.name}، ${address.city.name}`
5812
5501
  : (address.city?.name ?? "");
5813
5502
  }
5503
+ else if (this.isGuestMapPick) {
5504
+ locationText = result.address_details?.formatted_address ?? "";
5505
+ }
5814
5506
  else if (this.selectedCity) {
5815
5507
  locationText = this.selectedDistrict
5816
5508
  ? `${this.selectedDistrict.name}، ${this.selectedCity.name}`
@@ -5819,11 +5511,14 @@ const SallaBulletDelivery = class {
5819
5511
  else if (result.address_details) {
5820
5512
  const parts = [
5821
5513
  result.address_details.district?.name,
5822
- result.address_details.city.name,
5823
- result.address_details.country.name,
5514
+ result.address_details.city?.name,
5515
+ result.address_details.country?.name,
5824
5516
  ].filter(Boolean);
5825
5517
  locationText =
5826
- parts.join("، ") || result.address_details.short_address || "";
5518
+ parts.join("، ") ||
5519
+ result.address_details.formatted_address ||
5520
+ result.address_details.short_address ||
5521
+ "";
5827
5522
  }
5828
5523
  }
5829
5524
  else if (branch) {
@@ -5862,7 +5557,7 @@ const SallaBulletDelivery = class {
5862
5557
  return;
5863
5558
  this.loadingBranches = true;
5864
5559
  try {
5865
- this.branches = await bulletDeliveryAPI.getBranches({
5560
+ this.branches = await helpers.bulletDeliveryAPI.getBranches({
5866
5561
  country_id: this.selectedCountry?.id,
5867
5562
  query,
5868
5563
  });
@@ -5899,7 +5594,7 @@ const SallaBulletDelivery = class {
5899
5594
  async loadBranchesWithLocation(lat, lng) {
5900
5595
  this.loadingBranches = true;
5901
5596
  try {
5902
- this.branches = await bulletDeliveryAPI.getBranches({
5597
+ this.branches = await helpers.bulletDeliveryAPI.getBranches({
5903
5598
  country_id: this.selectedCountry?.id,
5904
5599
  lat,
5905
5600
  lng,
@@ -5941,7 +5636,7 @@ const SallaBulletDelivery = class {
5941
5636
  });
5942
5637
  const { latitude, longitude } = position.coords;
5943
5638
  await this.loadBranchesWithLocation(latitude, longitude);
5944
- const nearestBranch = findNearestBranch(this.branches, latitude, longitude);
5639
+ const nearestBranch = helpers.findNearestBranch(this.branches, latitude, longitude);
5945
5640
  if (nearestBranch) {
5946
5641
  this.selectedBranch = nearestBranch;
5947
5642
  this.branchSearchQuery = "";
@@ -5951,7 +5646,7 @@ const SallaBulletDelivery = class {
5951
5646
  catch (error) {
5952
5647
  const geoError = error;
5953
5648
  const code = typeof geoError?.code === "number" ? geoError.code : -1;
5954
- this.locationError = getGeolocationErrorMessage(code);
5649
+ this.locationError = helpers.getGeolocationErrorMessage(code);
5955
5650
  }
5956
5651
  finally {
5957
5652
  this.loadingNearestBranch = false;
@@ -5984,13 +5679,13 @@ const SallaBulletDelivery = class {
5984
5679
  this.autoGeolocationTriggered = false;
5985
5680
  this.fetchAddressToken();
5986
5681
  const intent = this.getStoredIntent();
5987
- const sessionCountryId = getIntentCountryId(intent);
5682
+ const sessionCountryId = helpers.getIntentCountryId(intent);
5988
5683
  if (sessionCountryId && this.countries.length > 0) {
5989
5684
  const country = this.countries.find((c) => c.id === sessionCountryId);
5990
5685
  if (country) {
5991
5686
  this.selectedCountry = country;
5992
5687
  this.updateNewAddressForm({ country_id: Number(country.id) });
5993
- if (isSaudiArabia(country.code)) {
5688
+ if (helpers.isSaudiArabia(country.code)) {
5994
5689
  await this.loadRegions(country.id);
5995
5690
  }
5996
5691
  else {
@@ -6021,7 +5716,7 @@ const SallaBulletDelivery = class {
6021
5716
  language: salla.config.get('user.language_code') || 'ar',
6022
5717
  }).catch(err => log('Failed to load Google Maps SDK', err));
6023
5718
  }
6024
- this.addressToken = await bulletDeliveryAPI.getAddressToken();
5719
+ this.addressToken = await helpers.bulletDeliveryAPI.getAddressToken();
6025
5720
  }
6026
5721
  catch {
6027
5722
  log('SallaBulletDelivery: Failed to fetch address token');
@@ -6099,6 +5794,10 @@ const SallaBulletDelivery = class {
6099
5794
  get isMapModeAvailable() {
6100
5795
  return this.isMapSettingEnabled && !!salla.config.get('store.settings.keys.maps') && !!this.addressToken;
6101
5796
  }
5797
+ /** Guest is in map mode and has already dropped a pin (as opposed to still using the dropdowns). */
5798
+ get isGuestMapPick() {
5799
+ return !this.isLoggedIn && this.isMapModeAvailable && this.hasMapLocation();
5800
+ }
6102
5801
  /** Center shown before geolocation resolves — the customer's IP-based default (falls back to Riyadh). */
6103
5802
  get mapInitialCenter() {
6104
5803
  const geo = salla.config.get('user.default_geo_location');
@@ -6134,7 +5833,7 @@ const SallaBulletDelivery = class {
6134
5833
  };
6135
5834
  }
6136
5835
  const districtName = this.selectedDistrict?.name ?? this.districtName?.trim() ?? "";
6137
- return buildAddressLocationPayloadFromSelection({
5836
+ return helpers.buildAddressLocationPayloadFromSelection({
6138
5837
  countryId: this.selectedCountry?.id ?? 0,
6139
5838
  countryCode: this.selectedCountry?.code,
6140
5839
  regionId: this.selectedRegion?.id,
@@ -6162,7 +5861,7 @@ const SallaBulletDelivery = class {
6162
5861
  this.allocationOutOfCoverageMessage = null;
6163
5862
  this.resetSearchState();
6164
5863
  const forBranch = tab === "branch";
6165
- this.countries = await bulletDeliveryAPI.getCountries(forBranch);
5864
+ this.countries = await helpers.bulletDeliveryAPI.getCountries(forBranch);
6166
5865
  this.displayedCountries = this.countries;
6167
5866
  const previousCountryId = this.selectedCountry?.id;
6168
5867
  if (previousCountryId !== undefined && previousCountryId !== null) {
@@ -6186,8 +5885,8 @@ const SallaBulletDelivery = class {
6186
5885
  // Load branches when switching to branch tab
6187
5886
  // Check session storage for lat/lng to get nearby branches
6188
5887
  const savedIntent = this.getStoredIntent();
6189
- const intentLat = getIntentLatitude(savedIntent);
6190
- const intentLng = getIntentLongitude(savedIntent);
5888
+ const intentLat = helpers.getIntentLatitude(savedIntent);
5889
+ const intentLng = helpers.getIntentLongitude(savedIntent);
6191
5890
  if (intentLat != null && intentLng != null) {
6192
5891
  await this.loadBranchesWithLocation(intentLat, intentLng);
6193
5892
  }
@@ -6195,7 +5894,7 @@ const SallaBulletDelivery = class {
6195
5894
  await this.loadBranches();
6196
5895
  }
6197
5896
  // Preselect branch from session storage if available
6198
- const branchId = getIntentBranchId(savedIntent);
5897
+ const branchId = helpers.getIntentBranchId(savedIntent);
6199
5898
  if (branchId != null && this.branches.length > 0) {
6200
5899
  const branch = this.branches.find((b) => b.id === branchId);
6201
5900
  if (branch) {
@@ -6217,7 +5916,7 @@ const SallaBulletDelivery = class {
6217
5916
  }
6218
5917
  if (!this.isLoggedIn) {
6219
5918
  const savedIntent = this.getStoredIntent();
6220
- if (savedIntent && getIntentCityId(savedIntent)) {
5919
+ if (savedIntent && helpers.getIntentCityId(savedIntent)) {
6221
5920
  await this.prefillAddressFromStoredIntent();
6222
5921
  }
6223
5922
  }
@@ -6239,10 +5938,14 @@ const SallaBulletDelivery = class {
6239
5938
  if (this.isLoggedIn && this.selectedSavedAddress) {
6240
5939
  return this.selectedSavedAddress.is_in_coverage === false;
6241
5940
  }
5941
+ // Guest map pick: a pin is the only requirement, independent of any incidental dropdown state.
5942
+ if (!this.isLoggedIn && this.isMapModeAvailable) {
5943
+ return !this.isGuestMapPick;
5944
+ }
6242
5945
  // Guest: require country + city; for SA require region + district
6243
5946
  if (!this.selectedCountry || !this.selectedCity)
6244
5947
  return true;
6245
- return !requireRegionAndDistrictForSA(this.selectedCountry?.code, this.selectedRegion?.id, this.selectedDistrict?.id ?? (this.districtName?.trim() || null));
5948
+ return !helpers.requireRegionAndDistrictForSA(this.selectedCountry?.code, this.selectedRegion?.id, this.selectedDistrict?.id ?? (this.districtName?.trim() || null));
6246
5949
  }
6247
5950
  return false;
6248
5951
  }
@@ -6264,9 +5967,26 @@ const SallaBulletDelivery = class {
6264
5967
  resolve();
6265
5968
  }
6266
5969
  buildIntentAddress() {
6267
- if (this.activeTab !== "address" ||
6268
- !this.selectedCountry ||
6269
- !this.selectedCity) {
5970
+ if (this.activeTab !== "address")
5971
+ return undefined;
5972
+ if (this.isGuestMapPick && this.mapLocationData) {
5973
+ const { lat, lng, formattedAddress, shortAddress } = this.mapLocationData;
5974
+ return {
5975
+ country: this.selectedCountry
5976
+ ? {
5977
+ id: this.selectedCountry.id,
5978
+ name: this.selectedCountry.name,
5979
+ code: this.selectedCountry.code,
5980
+ }
5981
+ : undefined,
5982
+ lat,
5983
+ lng,
5984
+ formatted_address: formattedAddress,
5985
+ place_id: shortAddress,
5986
+ description: this.addressDescription?.trim() || undefined,
5987
+ };
5988
+ }
5989
+ if (!this.selectedCountry || !this.selectedCity) {
6270
5990
  return undefined;
6271
5991
  }
6272
5992
  const country = {
@@ -6345,6 +6065,9 @@ const SallaBulletDelivery = class {
6345
6065
  district_name: this.districtName?.trim() || undefined,
6346
6066
  short_address: selectedAddress?.short_address ?? this.selectedSavedAddress?.short_address,
6347
6067
  form_data: { ...this.newAddressForm },
6068
+ lat: this.mapLocationData?.lat,
6069
+ lng: this.mapLocationData?.lng,
6070
+ formatted_address: this.mapLocationData?.formattedAddress,
6348
6071
  };
6349
6072
  }
6350
6073
  /**
@@ -6486,7 +6209,7 @@ const SallaBulletDelivery = class {
6486
6209
  },
6487
6210
  };
6488
6211
  this.setStoredIntent(normalisedIntent);
6489
- clearApiCache();
6212
+ helpers.clearApiCache();
6490
6213
  const branch = this.buildBranchFromIntent(normalisedIntent);
6491
6214
  const allocationConfirmedPayload = {
6492
6215
  ...normalisedIntent,
@@ -6552,6 +6275,13 @@ const SallaBulletDelivery = class {
6552
6275
  }
6553
6276
  else {
6554
6277
  result.address_details = this.buildIntentAddress();
6278
+ if (this.isGuestMapPick) {
6279
+ // Guest + map pin: defer to login instead of the blocked guest allocation (422, SHPD-9558).
6280
+ this.setStoredIntent(result);
6281
+ this.confirmBtn?.stop();
6282
+ this.handleLogin();
6283
+ return;
6284
+ }
6555
6285
  }
6556
6286
  }
6557
6287
  else {
@@ -6570,13 +6300,13 @@ const SallaBulletDelivery = class {
6570
6300
  };
6571
6301
  }
6572
6302
  else {
6573
- // Case 1: Guest user or logged-in user without saved address
6303
+ // Case 1: Guest user (dropdown selection) or logged-in user without saved address
6574
6304
  allocationPayload = {
6575
6305
  type: "address",
6576
6306
  country_id: String(this.selectedCountry?.id || 0),
6577
6307
  city_id: String(this.selectedCity?.id || ""),
6578
6308
  };
6579
- if (isSaudiArabia(this.selectedCountry?.code ?? '')) {
6309
+ if (helpers.isSaudiArabia(this.selectedCountry?.code ?? '')) {
6580
6310
  if (this.selectedRegion?.id) {
6581
6311
  allocationPayload.region_id = String(this.selectedRegion.id);
6582
6312
  }
@@ -6592,7 +6322,7 @@ const SallaBulletDelivery = class {
6592
6322
  };
6593
6323
  }
6594
6324
  // Make API call to allocate scope
6595
- const allocationResult = await bulletDeliveryAPI.allocateScope(allocationPayload);
6325
+ const allocationResult = await helpers.bulletDeliveryAPI.allocateScope(allocationPayload);
6596
6326
  if (!allocationResult.success) {
6597
6327
  console.error("BulletDelivery: Scope allocation failed", allocationResult.error);
6598
6328
  const errorMessage = allocationResult.error ||
@@ -6642,8 +6372,8 @@ const SallaBulletDelivery = class {
6642
6372
  // the selected address/branch once confirmed.
6643
6373
  this.setStoredIntent(result);
6644
6374
  if (allocatedScopeId) {
6645
- await bulletDeliveryAPI.setDeliveryScope(allocatedScopeId);
6646
- clearApiCache();
6375
+ await helpers.bulletDeliveryAPI.setDeliveryScope(allocatedScopeId);
6376
+ helpers.clearApiCache();
6647
6377
  }
6648
6378
  const allocationConfirmedPayload = {
6649
6379
  ...result,
@@ -6702,7 +6432,7 @@ const SallaBulletDelivery = class {
6702
6432
  title: isBranch
6703
6433
  ? Salla.lang.get("pages.checkout.pickup_option")
6704
6434
  : Salla.lang.get("pages.checkout.delivery_option"),
6705
- subtitle: getIntentSubtitle(intent, Salla.lang.get("common.elements.to"), ""),
6435
+ subtitle: helpers.getIntentSubtitle(intent, Salla.lang.get("common.elements.to"), ""),
6706
6436
  buttonText: Salla.lang.get("common.elements.edit"),
6707
6437
  isAddress,
6708
6438
  intent,
@@ -6716,7 +6446,7 @@ const SallaBulletDelivery = class {
6716
6446
  return null;
6717
6447
  const { title, subtitle, buttonText, intent: configIntent } = config;
6718
6448
  const openPayload = configIntent.type === "branch"
6719
- ? { preselected_branch_id: getIntentBranchId(configIntent) }
6449
+ ? { preselected_branch_id: helpers.getIntentBranchId(configIntent) }
6720
6450
  : { preselected_address_id: configIntent.address_id };
6721
6451
  const icon = document.createElement("span");
6722
6452
  icon.className =
@@ -6773,13 +6503,13 @@ const SallaBulletDelivery = class {
6773
6503
  }
6774
6504
  /** Region select (SA only): shown when SA is selected; city and district disabled until region selected. */
6775
6505
  renderRegionSelect() {
6776
- const isSA = isSaudiArabia(this.selectedCountry?.code ?? '');
6506
+ const isSA = helpers.isSaudiArabia(this.selectedCountry?.code ?? '');
6777
6507
  if (!isSA || !this.selectedCountry)
6778
6508
  return null;
6779
6509
  return (index.h("div", { class: "s-bullet-delivery-field" }, index.h("salla-searchable-dropdown", { label: Salla.lang.get("pages.checkout.region_field"), placeholder: Salla.lang.get("pages.checkout.select_region"), items: this.displayedRegions, selectedItem: this.selectedRegion, loading: this.loadingRegions, searching: this.searchingRegions, disabled: this.loadingRegions || this.regions.length === 0, required: true, inputId: "bullet-delivery-region", searchQuery: this.regionSearchQuery, clientSearch: true, onItemSelected: (e) => this.handleRegionSelected(e.detail), onSearchInput: (e) => this.handleRegionSearch(e.detail), onDropdownClosed: () => this.handleRegionDropdownClosed() })));
6780
6510
  }
6781
6511
  renderCityDistrictSelects() {
6782
- const isSA = isSaudiArabia(this.selectedCountry?.code ?? '');
6512
+ const isSA = helpers.isSaudiArabia(this.selectedCountry?.code ?? '');
6783
6513
  const showDistrict = isSA;
6784
6514
  const showDistrictInput = showDistrict &&
6785
6515
  this.selectedCity &&
@@ -6807,19 +6537,41 @@ const SallaBulletDelivery = class {
6807
6537
  */
6808
6538
  async saveSessionAddressToProfile() {
6809
6539
  const intent = this.getStoredIntent();
6810
- const countryId = getIntentCountryId(intent);
6811
- const cityId = getIntentCityId(intent);
6812
- const districtId = getIntentDistrictId(intent);
6540
+ if (helpers.isMapOriginIntent(intent)) {
6541
+ const details = intent.address_details;
6542
+ const payload = {
6543
+ lat: details.lat,
6544
+ lng: details.lng,
6545
+ ...(details.place_id && { short_address: details.place_id }),
6546
+ ...(details.description && { description: details.description }),
6547
+ };
6548
+ try {
6549
+ const { success, address } = await helpers.bulletDeliveryAPI.saveAddressLocation(payload);
6550
+ if (!success || !address)
6551
+ return null;
6552
+ // Persist address_id immediately to avoid duplicate creation on retry.
6553
+ this.setStoredIntent({ ...intent, address_id: address.id });
6554
+ this.addressCreated.emit({ address });
6555
+ return address;
6556
+ }
6557
+ catch (error) {
6558
+ console.error("SallaBulletDelivery: Error saving session address (map)", error);
6559
+ return null;
6560
+ }
6561
+ }
6562
+ const countryId = helpers.getIntentCountryId(intent);
6563
+ const cityId = helpers.getIntentCityId(intent);
6564
+ const districtId = helpers.getIntentDistrictId(intent);
6813
6565
  if (!intent || intent.type !== "address" || !countryId || !cityId)
6814
6566
  return null;
6815
- const countryCode = getIntentCountryCode(intent);
6816
- if (isSaudiArabia(countryCode) && !districtId)
6567
+ const countryCode = helpers.getIntentCountryCode(intent);
6568
+ if (helpers.isSaudiArabia(countryCode) && !districtId)
6817
6569
  return null;
6818
- const isSA = isSaudiArabia(countryCode);
6570
+ const isSA = helpers.isSaudiArabia(countryCode);
6819
6571
  const districtName = intent.address_details?.district?.name ?? "";
6820
6572
  const payload = {
6821
6573
  country_id: countryId,
6822
- region_id: getIntentRegionId(intent),
6574
+ region_id: helpers.getIntentRegionId(intent),
6823
6575
  city_id: cityId,
6824
6576
  district_id: districtId,
6825
6577
  description: districtName,
@@ -6828,7 +6580,7 @@ const SallaBulletDelivery = class {
6828
6580
  payload.local = districtName;
6829
6581
  }
6830
6582
  try {
6831
- const { success, address } = await bulletDeliveryAPI.saveAddressLocation(payload);
6583
+ const { success, address } = await helpers.bulletDeliveryAPI.saveAddressLocation(payload);
6832
6584
  if (!success)
6833
6585
  return null;
6834
6586
  const savedAddress = address ?? null;
@@ -6849,13 +6601,16 @@ const SallaBulletDelivery = class {
6849
6601
  return (index.h("div", { class: "s-bullet-delivery-addresses-list s-scrollbar" }, [1, 2, 3].map((v) => (index.h("div", { key: v, class: "s-bullet-delivery-address-item s-bullet-delivery-address-item--skeleton" }, index.h("salla-skeleton", { class: "s-bullet-delivery-skel-radio", height: "18px", width: "18px" }), index.h("salla-skeleton", { class: "s-bullet-delivery-skel-map", height: "36px", width: "36px" }), index.h("div", { class: "s-bullet-delivery-address-content" }, index.h("div", { class: "s-bullet-delivery-address-lines" }, index.h("salla-skeleton", { height: "18px", width: "72%" }), index.h("salla-skeleton", { height: "16px", width: "56%" }))))))));
6850
6602
  }
6851
6603
  const intent = this.getStoredIntent();
6852
- const hasSessionAddress = hasSessionAddressIntent(intent);
6604
+ const hasSessionAddress = helpers.hasSessionAddressIntent(intent);
6605
+ const isMapSession = helpers.isMapOriginIntent(intent);
6853
6606
  const sessionLine1 = hasSessionAddress && intent?.address_details
6854
- ? [intent.address_details.city?.name, intent.address_details.country?.name]
6855
- .filter(Boolean)
6856
- .join("، ") || ""
6607
+ ? isMapSession
6608
+ ? (intent.address_details.formatted_address ?? "")
6609
+ : [intent.address_details.city?.name, intent.address_details.country?.name]
6610
+ .filter(Boolean)
6611
+ .join("، ") || ""
6857
6612
  : "";
6858
- const sessionLine2 = hasSessionAddress && intent?.address_details
6613
+ const sessionLine2 = hasSessionAddress && intent?.address_details && !isMapSession
6859
6614
  ? (intent.address_details.district?.name ?? "").trim()
6860
6615
  : "";
6861
6616
  if (this.savedAddresses.length === 0 && !hasSessionAddress) {
@@ -6907,7 +6662,7 @@ const SallaBulletDelivery = class {
6907
6662
  } }, index.h("input", { type: "radio", name: "saved_address", class: "s-bullet-delivery-radio", checked: selected, disabled: disabled }), index.h("span", { class: "s-bullet-delivery-address-map-icon", innerHTML: MiniMap, "aria-hidden": "true" }), index.h("div", { class: "s-bullet-delivery-address-content" }, index.h("div", { class: "s-bullet-delivery-address-lines" }, index.h("span", { class: "s-bullet-delivery-address-line1" }, line1), index.h("span", { class: "s-bullet-delivery-address-line2" }, line2)))));
6908
6663
  }
6909
6664
  renderMapSection() {
6910
- const isSA = isSaudiArabia(this.selectedCountry?.code ?? '');
6665
+ const isSA = helpers.isSaudiArabia(this.selectedCountry?.code ?? '');
6911
6666
  const loc = this.mapLocationData;
6912
6667
  const hasLoc = loc?.lat != null && loc?.lng != null;
6913
6668
  // Resolve the center once (the getter reads salla.config) and reuse it for the marker so the
@@ -6927,7 +6682,7 @@ const SallaBulletDelivery = class {
6927
6682
  ? this.renderAddressConfirmation()
6928
6683
  : this.renderMapSection();
6929
6684
  }
6930
- const isSA = isSaudiArabia(this.selectedCountry?.code ?? '');
6685
+ const isSA = helpers.isSaudiArabia(this.selectedCountry?.code ?? '');
6931
6686
  return [
6932
6687
  this.renderCountrySelect(),
6933
6688
  isSA ? this.renderRegionSelect() : null,
@@ -6951,7 +6706,7 @@ const SallaBulletDelivery = class {
6951
6706
  const isConfirmStep = this.mapStep === 'confirm' && hasMapLoc;
6952
6707
  const canAdvanceToConfirm = this.canConfirmMapLocation();
6953
6708
  const submitLabel = isConfirmStep
6954
- ? (this.savingAddress
6709
+ ? (this.confirming
6955
6710
  ? Salla.lang.get("pages.checkout.loading")
6956
6711
  : Salla.lang.get("pages.checkout.confirm_address"))
6957
6712
  : Salla.lang.get('pages.checkout.confirm_location');
@@ -6961,9 +6716,9 @@ const SallaBulletDelivery = class {
6961
6716
  this.mapStep = 'confirm';
6962
6717
  return;
6963
6718
  }
6964
- this.handleSubmitAddAddress(e);
6719
+ this.handleConfirm();
6965
6720
  };
6966
- return (index.h("form", { onSubmit: handleSubmit }, this.renderGuestDeliveryForm(), index.h("div", { class: "s-bullet-delivery-form-actions s-bullet-delivery-form-actions--single", style: { padding: '24px' } }, index.h("salla-button", { type: "submit", loading: this.savingAddress, disabled: isConfirmStep ? this.savingAddress : !canAdvanceToConfirm, width: "wide" }, submitLabel), !this.isLoggedIn && (index.h("button", { type: "button", class: "s-bullet-delivery-login-prompt", onClick: () => this.handleLogin() }, Salla.lang.get('pages.checkout.login_to_use_saved_addresses'))))));
6721
+ return (index.h("form", { onSubmit: handleSubmit }, this.renderGuestDeliveryForm(), index.h("div", { class: "s-bullet-delivery-form-actions s-bullet-delivery-form-actions--single", style: { padding: '24px' } }, index.h("salla-button", { type: "submit", loading: this.confirming, disabled: isConfirmStep ? this.confirming : !canAdvanceToConfirm, width: "wide" }, submitLabel), !this.isLoggedIn && (index.h("button", { type: "button", class: "s-bullet-delivery-login-prompt", onClick: () => this.handleLogin() }, Salla.lang.get('pages.checkout.login_to_use_saved_addresses'))))));
6967
6722
  }
6968
6723
  renderBranchSearch() {
6969
6724
  return (index.h("div", { class: "s-bullet-delivery-branch-search" }, index.h("div", { class: "s-bullet-delivery-search-row" }, index.h("div", { class: "s-bullet-delivery-search s-bullet-delivery-branch-search-wrap" }, index.h("span", { class: "s-bullet-delivery-search-icon s-bullet-delivery-branch-search-icon", innerHTML: search.Search, "aria-hidden": "true" }), index.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" })), index.h("button", { type: "button", class: {
@@ -6980,7 +6735,7 @@ const SallaBulletDelivery = class {
6980
6735
  return (index.h("salla-placeholder", { alignment: "center", class: "s-bullet-delivery-placeholder" }, index.h("span", { slot: "title" }, Salla.lang.get("pages.checkout.no_pickup_branches_found"))));
6981
6736
  }
6982
6737
  return (index.h("div", { class: "s-bullet-delivery-branches-wrap" }, index.h("ul", { class: "s-bullet-delivery-branches-list s-scrollbar" }, this.filteredBranches.map(branch => {
6983
- const selectable = isBranchSelectable(branch);
6738
+ const selectable = helpers.isBranchSelectable(branch);
6984
6739
  const readiness = branch?.pickup_readiness;
6985
6740
  return (index.h("li", { key: branch.id, class: {
6986
6741
  's-bullet-delivery-branch-item': true,
@@ -7010,7 +6765,7 @@ const SallaBulletDelivery = class {
7010
6765
  renderAddAddressForm() {
7011
6766
  Salla.lang.get("pages.checkout.add_new_address");
7012
6767
  const mapMode = this.isMapModeAvailable;
7013
- const isSA = isSaudiArabia(this.selectedCountry?.code ?? '');
6768
+ const isSA = helpers.isSaudiArabia(this.selectedCountry?.code ?? '');
7014
6769
  const hasMapLoc = this.hasMapLocation();
7015
6770
  let canSubmit;
7016
6771
  let submitLabel;
@@ -7038,7 +6793,7 @@ const SallaBulletDelivery = class {
7038
6793
  ? Salla.lang.get("pages.checkout.loading")
7039
6794
  : Salla.lang.get("pages.checkout.confirm_address");
7040
6795
  }
7041
- this.savedAddresses.length > 0 || hasSessionAddressIntent(this.getStoredIntent());
6796
+ this.savedAddresses.length > 0 || helpers.hasSessionAddressIntent(this.getStoredIntent());
7042
6797
  const handleFormSubmit = (e) => {
7043
6798
  e.preventDefault();
7044
6799
  if (mapMode && this.mapStep === 'map' && canSubmit) {
@@ -7058,13 +6813,13 @@ const SallaBulletDelivery = class {
7058
6813
  this.confirmBtn = btn;
7059
6814
  }, disabled: this.isConfirmDisabled(), onClick: () => this.handleConfirm(), "loader-position": "center", width: "wide" }, this.activeTab === "branch"
7060
6815
  ? Salla.lang.get("pages.checkout.confirm_receipt_from_the_branch")
7061
- : Salla.lang.get("pages.checkout.confirm_address")), showAddAddressInFooter && (index.h("salla-button", { onClick: () => this.handleAddNewAddress(), width: "wide", shape: "link" }, Salla.lang.get("pages.checkout.add_new_address"))), !this.isLoggedIn && (index.h("salla-button", { shape: "link", onClick: this.handleLogin }, Salla.lang.get("pages.checkout.login_to_use_saved_addresses")))));
6816
+ : Salla.lang.get("pages.checkout.confirm_address")), showAddAddressInFooter && (index.h("salla-button", { onClick: () => this.handleAddNewAddress(), width: "wide", shape: "link" }, Salla.lang.get("pages.checkout.add_new_address"))), !this.isLoggedIn && (index.h("salla-button", { shape: "link", onClick: () => this.handleLogin() }, Salla.lang.get("pages.checkout.login_to_use_saved_addresses")))));
7062
6817
  }
7063
6818
  renderMainView() {
7064
6819
  const isAddressEmptyState = this.isLoggedIn &&
7065
6820
  this.activeTab === "address" &&
7066
6821
  this.savedAddresses.length === 0 &&
7067
- !hasSessionAddressIntent(this.getStoredIntent());
6822
+ !helpers.hasSessionAddressIntent(this.getStoredIntent());
7068
6823
  const activeTabView = this.activeTab === "branch" && this.supportsPickup
7069
6824
  ? this.renderPickupTab()
7070
6825
  : this.renderDeliveryTab();