@salla.sa/twilight-components 2.14.427 → 2.14.429

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 (441) hide show
  1. package/dist/cjs/{filepond-CnPKR-6x.js → filepond--V9rRgVA.js} +1 -1
  2. package/dist/cjs/{filepond-plugin-file-poster-D0g6EUyA.js → filepond-plugin-file-poster-DzvswSJb.js} +1 -1
  3. package/dist/cjs/{filepond-plugin-file-validate-size-DXUJ6UPq.js → filepond-plugin-file-validate-size-C5wUWXz6.js} +1 -1
  4. package/dist/cjs/{filepond-plugin-file-validate-type-NgEbyq_W.js → filepond-plugin-file-validate-type-HA2w2_fC.js} +1 -1
  5. package/dist/cjs/{filepond-plugin-image-edit-DU4QWlEV.js → filepond-plugin-image-edit-CXrhd-IB.js} +1 -1
  6. package/dist/cjs/{filepond-plugin-image-exif-orientation-xYuPxwvc.js → filepond-plugin-image-exif-orientation-BJnamgw6.js} +1 -1
  7. package/dist/cjs/{filepond-plugin-image-preview-CY_efZwj.js → filepond-plugin-image-preview-CmdkZJij.js} +1 -1
  8. package/dist/cjs/{functions-CTufnsoC.js → functions-DPnm948J.js} +1 -1
  9. package/dist/cjs/{index-BEj17I33.js → index-D3xsx646.js} +6 -6
  10. package/dist/cjs/{index-Z8F5J-RV.js → index-DRfjMaC1.js} +1 -1
  11. package/dist/cjs/loader.cjs.js +2 -2
  12. package/dist/cjs/salla-accordion-body_2.cjs.entry.js +1 -1
  13. package/dist/cjs/salla-accordion_6.cjs.entry.js +2 -2
  14. package/dist/cjs/salla-add-product-button_5.cjs.entry.js +3 -3
  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-badge.cjs.entry.js +1 -1
  20. package/dist/cjs/salla-booking-field_7.cjs.entry.js +17 -17
  21. package/dist/cjs/{salla-bullet-delivery.cjs.entry.js → salla-bullet-delivery_2.cjs.entry.js} +635 -140
  22. package/dist/cjs/salla-cart-coupons.cjs.entry.js +2 -2
  23. package/dist/cjs/salla-cart-item-offers_2.cjs.entry.js +2 -2
  24. package/dist/cjs/salla-comment-form_8.cjs.entry.js +8 -8
  25. package/dist/cjs/salla-conditional-offer.cjs.entry.js +1 -1
  26. package/dist/cjs/salla-contacts.cjs.entry.js +1 -1
  27. package/dist/cjs/salla-cookies-bar.cjs.entry.js +1 -1
  28. package/dist/cjs/salla-count-down.cjs.entry.js +2 -2
  29. package/dist/cjs/salla-custom-fields.cjs.entry.js +1 -1
  30. package/dist/cjs/salla-delivery-promise.cjs.entry.js +43 -17
  31. package/dist/cjs/salla-edit-order-button.cjs.entry.js +1 -1
  32. package/dist/cjs/salla-filters-widget.cjs.entry.js +3 -3
  33. package/dist/cjs/salla-filters.cjs.entry.js +2 -2
  34. package/dist/cjs/salla-fulfillment-methods.cjs.entry.js +2 -2
  35. package/dist/cjs/salla-gifting.cjs.entry.js +3 -3
  36. package/dist/cjs/salla-hook.cjs.entry.js +2 -2
  37. package/dist/cjs/salla-infinite-scroll.cjs.entry.js +1 -1
  38. package/dist/cjs/salla-installment.cjs.entry.js +1 -1
  39. package/dist/cjs/salla-list-tile.cjs.entry.js +2 -2
  40. package/dist/cjs/salla-localization-modal.cjs.entry.js +2 -2
  41. package/dist/cjs/salla-login-modal.cjs.entry.js +1 -1
  42. package/dist/cjs/salla-loyalty-banner.cjs.entry.js +2 -2
  43. package/dist/cjs/salla-loyalty-hero_2.cjs.entry.js +8 -8
  44. package/dist/cjs/salla-loyalty-panel.cjs.entry.js +3 -3
  45. package/dist/cjs/salla-loyalty-prize-item.cjs.entry.js +2 -2
  46. package/dist/cjs/salla-loyalty-program.cjs.entry.js +3 -3
  47. package/dist/cjs/salla-loyalty-reward.cjs.entry.js +4 -4
  48. package/dist/cjs/salla-loyalty.cjs.entry.js +1 -1
  49. package/dist/cjs/salla-maintenance-alert.cjs.entry.js +2 -2
  50. package/dist/cjs/salla-map.cjs.entry.js +4 -4
  51. package/dist/cjs/salla-menu.cjs.entry.js +1 -1
  52. package/dist/cjs/salla-metadata.cjs.entry.js +1 -1
  53. package/dist/cjs/salla-multiple-bundle-product-cart_2.cjs.entry.js +4 -4
  54. package/dist/cjs/salla-multiple-bundle-product-options-modal_2.cjs.entry.js +6 -6
  55. package/dist/cjs/salla-multiple-bundle-product.cjs.entry.js +2 -2
  56. package/dist/cjs/salla-next-order-coupon.cjs.entry.js +1 -1
  57. package/dist/cjs/salla-notification-item.cjs.entry.js +2 -2
  58. package/dist/cjs/salla-notifications.cjs.entry.js +1 -1
  59. package/dist/cjs/salla-offer-modal.cjs.entry.js +2 -2
  60. package/dist/cjs/salla-offer.cjs.entry.js +1 -1
  61. package/dist/cjs/salla-order-details-multiple-bundle-product.cjs.entry.js +1 -1
  62. package/dist/cjs/salla-order-details-options.cjs.entry.js +1 -1
  63. package/dist/cjs/salla-order-details.cjs.entry.js +2 -2
  64. package/dist/cjs/salla-order-edit-item.cjs.entry.js +1 -1
  65. package/dist/cjs/salla-order-edit-product-card.cjs.entry.js +2 -2
  66. package/dist/cjs/salla-order-edit.cjs.entry.js +1 -1
  67. package/dist/cjs/salla-order-summary.cjs.entry.js +2 -2
  68. package/dist/cjs/salla-order-totals-card.cjs.entry.js +1 -1
  69. package/dist/cjs/salla-orders.cjs.entry.js +1 -1
  70. package/dist/cjs/salla-payments.cjs.entry.js +3 -3
  71. package/dist/cjs/salla-placeholder.cjs.entry.js +2 -2
  72. package/dist/cjs/salla-price-range.cjs.entry.js +3 -3
  73. package/dist/cjs/salla-product-card_2.cjs.entry.js +6 -6
  74. package/dist/cjs/salla-product-size-guide.cjs.entry.js +3 -3
  75. package/dist/cjs/salla-products-list.cjs.entry.js +1 -1
  76. package/dist/cjs/salla-progress-bar.cjs.entry.js +1 -1
  77. package/dist/cjs/salla-quick-order.cjs.entry.js +1 -1
  78. package/dist/cjs/salla-rating-modal.cjs.entry.js +1 -1
  79. package/dist/cjs/salla-reward-action_4.cjs.entry.js +11 -11
  80. package/dist/cjs/salla-scopes.cjs.entry.js +2 -2
  81. package/dist/cjs/salla-search.cjs.entry.js +6 -6
  82. package/dist/cjs/salla-skeleton.cjs.entry.js +2 -2
  83. package/dist/cjs/salla-slider.cjs.entry.js +1 -1
  84. package/dist/cjs/salla-social-share.cjs.entry.js +2 -2
  85. package/dist/cjs/salla-social.cjs.entry.js +2 -2
  86. package/dist/cjs/salla-tab-content_3.cjs.entry.js +4 -4
  87. package/dist/cjs/salla-tiered-offer.cjs.entry.js +1 -1
  88. package/dist/cjs/salla-tooltip.cjs.entry.js +2 -2
  89. package/dist/cjs/salla-trust-badges.cjs.entry.js +1 -1
  90. package/dist/cjs/salla-user-menu.cjs.entry.js +1 -1
  91. package/dist/cjs/salla-user-profile.cjs.entry.js +1 -1
  92. package/dist/cjs/salla-user-settings.cjs.entry.js +2 -2
  93. package/dist/cjs/salla-verify.cjs.entry.js +1 -1
  94. package/dist/cjs/salla-wallet.cjs.entry.js +1 -1
  95. package/dist/cjs/{tracked-promise-C_10lCIK.js → tracked-promise-CFp5Besf.js} +1 -1
  96. package/dist/cjs/twilight.cjs.js +2 -2
  97. package/dist/cjs/{vanilla-picker-D9nRSUSv.js → vanilla-picker-Jk2F9CAy.js} +1 -1
  98. package/dist/collection/collection-manifest.json +7 -0
  99. package/dist/collection/components/salla-bullet-delivery/api-service.js +80 -13
  100. package/dist/collection/components/salla-bullet-delivery/salla-bullet-delivery.css +5 -0
  101. package/dist/collection/components/salla-bullet-delivery/salla-bullet-delivery.js +344 -120
  102. package/dist/collection/components/salla-cart-coupons/salla-cart-coupons.js +1 -1
  103. package/dist/collection/components/salla-cart-summary/salla-cart-summary.js +1 -1
  104. package/dist/collection/components/salla-color-picker/salla-color-picker.js +1 -1
  105. package/dist/collection/components/salla-comment-form/salla-comment-form.js +1 -1
  106. package/dist/collection/components/salla-comments/salla-comment-item.js +3 -3
  107. package/dist/collection/components/salla-conditional-fields/salla-conditional-fields.js +1 -1
  108. package/dist/collection/components/salla-count-down/salla-count-down.js +1 -1
  109. package/dist/collection/components/salla-datetime-picker/salla-datetime-picker.js +1 -1
  110. package/dist/collection/components/salla-delivery-promise/delivery-promise-api.js +4 -5
  111. package/dist/collection/components/salla-delivery-promise/salla-delivery-promise.js +40 -12
  112. package/dist/collection/components/salla-file-upload/salla-file-upload.js +2 -2
  113. package/dist/collection/components/salla-filters/salla-filters.js +1 -1
  114. package/dist/collection/components/salla-filters-widget/salla-filters-widget.js +2 -2
  115. package/dist/collection/components/salla-fulfillment-methods/salla-fulfillment-methods.js +1 -1
  116. package/dist/collection/components/salla-gifting/salla-gifting.js +2 -2
  117. package/dist/collection/components/salla-hook/salla-hook.js +1 -1
  118. package/dist/collection/components/salla-list-tile/salla-list-tile.js +1 -1
  119. package/dist/collection/components/salla-loading/salla-loading.js +1 -1
  120. package/dist/collection/components/salla-localization-modal/salla-localization-modal.js +1 -1
  121. package/dist/collection/components/salla-loyalty/salla-loyalty-prize-item.js +1 -1
  122. package/dist/collection/components/salla-loyalty-program/salla-loyalty-hero.js +3 -3
  123. package/dist/collection/components/salla-loyalty-program/salla-loyalty-point.js +3 -3
  124. package/dist/collection/components/salla-loyalty-program/salla-loyalty-reward.js +2 -2
  125. package/dist/collection/components/salla-loyalty-program/salla-reward-action.js +1 -1
  126. package/dist/collection/components/salla-loyalty-program/salla-reward-card.js +1 -1
  127. package/dist/collection/components/salla-loyalty-program/salla-reward-details.js +3 -3
  128. package/dist/collection/components/salla-loyalty-program/salla-reward-exchange.js +3 -3
  129. package/dist/collection/components/salla-maintenance-alert/salla-maintenance-alert.js +1 -1
  130. package/dist/collection/components/salla-map/salla-map.js +3 -3
  131. package/dist/collection/components/salla-multiple-bundle-product/components/salla-multiple-bundle-product-cart.js +1 -1
  132. package/dist/collection/components/salla-multiple-bundle-product/components/salla-multiple-bundle-product-details.js +2 -2
  133. package/dist/collection/components/salla-multiple-bundle-product/components/salla-multiple-bundle-product-options-modal.js +4 -4
  134. package/dist/collection/components/salla-multiple-bundle-product/components/salla-multiple-bundle-product-slider.js +1 -1
  135. package/dist/collection/components/salla-multiple-bundle-product/salla-multiple-bundle-product.js +1 -1
  136. package/dist/collection/components/salla-notifications/salla-notification-item.js +1 -1
  137. package/dist/collection/components/salla-offer-modal/salla-offer-modal.js +1 -1
  138. package/dist/collection/components/salla-order-details/salla-order-details.js +1 -1
  139. package/dist/collection/components/salla-order-edit/salla-order-edit-product-card.js +1 -1
  140. package/dist/collection/components/salla-order-summary/salla-order-summary.js +1 -1
  141. package/dist/collection/components/salla-payments/salla-payments.js +2 -2
  142. package/dist/collection/components/salla-placeholder/salla-placeholder.js +1 -1
  143. package/dist/collection/components/salla-price-range/salla-price-range.js +2 -2
  144. package/dist/collection/components/salla-product-availability/salla-product-availability.js +1 -1
  145. package/dist/collection/components/salla-product-card/salla-product-card.js +5 -5
  146. package/dist/collection/components/salla-product-size-guide/salla-product-size-guide.js +2 -2
  147. package/dist/collection/components/salla-quantity-input/salla-quantity-input.js +1 -1
  148. package/dist/collection/components/salla-quick-buy/salla-quick-buy.js +1 -1
  149. package/dist/collection/components/salla-review-card/salla-review-card.js +1 -1
  150. package/dist/collection/components/salla-reviews/salla-reviews.js +1 -1
  151. package/dist/collection/components/salla-reviews-page/salla-reviews-page.js +1 -1
  152. package/dist/collection/components/salla-scopes/salla-scopes.js +1 -1
  153. package/dist/collection/components/salla-search/salla-search.js +5 -5
  154. package/dist/collection/components/salla-searchable-dropdown/interfaces.js +1 -0
  155. package/dist/collection/components/salla-searchable-dropdown/salla-searchable-dropdown.js +566 -0
  156. package/dist/collection/components/salla-skeleton/salla-skeleton.js +1 -1
  157. package/dist/collection/components/salla-social/salla-social.js +1 -1
  158. package/dist/collection/components/salla-social-share/salla-social-share.js +1 -1
  159. package/dist/collection/components/salla-tabs/salla-tab-content.js +1 -1
  160. package/dist/collection/components/salla-tabs/salla-tab-header.js +1 -1
  161. package/dist/collection/components/salla-tabs/salla-tabs.js +1 -1
  162. package/dist/collection/components/salla-tel-input/salla-tel-input.js +1 -1
  163. package/dist/collection/components/salla-tooltip/salla-tooltip.js +1 -1
  164. package/dist/collection/components/salla-user-settings/salla-user-settings.js +1 -1
  165. package/dist/components/index.js +2 -2
  166. package/dist/components/salla-bullet-delivery.js +445 -148
  167. package/dist/components/salla-cart-coupons.js +1 -1
  168. package/dist/components/salla-cart-summary.js +1 -1
  169. package/dist/components/salla-color-picker2.js +1 -1
  170. package/dist/components/salla-comment-form2.js +1 -1
  171. package/dist/components/salla-comment-item2.js +3 -3
  172. package/dist/components/salla-conditional-fields2.js +1 -1
  173. package/dist/components/salla-count-down2.js +1 -1
  174. package/dist/components/salla-datetime-picker2.js +1 -1
  175. package/dist/components/salla-delivery-promise.js +42 -16
  176. package/dist/components/salla-file-upload2.js +2 -2
  177. package/dist/components/salla-filters-widget2.js +2 -2
  178. package/dist/components/salla-filters.js +1 -1
  179. package/dist/components/salla-fulfillment-methods.js +1 -1
  180. package/dist/components/salla-gifting.js +2 -2
  181. package/dist/components/salla-hook.js +1 -1
  182. package/dist/components/salla-list-tile2.js +1 -1
  183. package/dist/components/salla-loading2.js +1 -1
  184. package/dist/components/salla-localization-modal.js +1 -1
  185. package/dist/components/salla-loyalty-hero2.js +3 -3
  186. package/dist/components/salla-loyalty-point2.js +3 -3
  187. package/dist/components/salla-loyalty-prize-item.js +1 -1
  188. package/dist/components/salla-loyalty-reward.js +2 -2
  189. package/dist/components/salla-maintenance-alert.js +1 -1
  190. package/dist/components/salla-map2.js +3 -3
  191. package/dist/components/salla-multiple-bundle-product-cart2.js +1 -1
  192. package/dist/components/salla-multiple-bundle-product-details2.js +2 -2
  193. package/dist/components/salla-multiple-bundle-product-options-modal2.js +4 -4
  194. package/dist/components/salla-multiple-bundle-product-slider2.js +1 -1
  195. package/dist/components/salla-multiple-bundle-product.js +1 -1
  196. package/dist/components/salla-notification-item2.js +1 -1
  197. package/dist/components/salla-offer-modal.js +1 -1
  198. package/dist/components/salla-order-details.js +1 -1
  199. package/dist/components/salla-order-edit-product-card.js +1 -1
  200. package/dist/components/salla-order-summary.js +1 -1
  201. package/dist/components/salla-payments.js +2 -2
  202. package/dist/components/salla-placeholder2.js +1 -1
  203. package/dist/components/salla-price-range2.js +2 -2
  204. package/dist/components/salla-product-availability2.js +1 -1
  205. package/dist/components/salla-product-card2.js +5 -5
  206. package/dist/components/salla-product-size-guide.js +2 -2
  207. package/dist/components/salla-quantity-input2.js +1 -1
  208. package/dist/components/salla-quick-buy2.js +1 -1
  209. package/dist/components/salla-review-card2.js +1 -1
  210. package/dist/components/salla-reviews-page.js +1 -1
  211. package/dist/components/salla-reviews.js +1 -1
  212. package/dist/components/salla-reward-action2.js +1 -1
  213. package/dist/components/salla-reward-card2.js +1 -1
  214. package/dist/components/salla-reward-details2.js +3 -3
  215. package/dist/components/salla-reward-exchange2.js +3 -3
  216. package/dist/components/salla-scopes.js +1 -1
  217. package/dist/components/salla-search.js +5 -5
  218. package/dist/components/salla-searchable-dropdown.d.ts +11 -0
  219. package/dist/components/salla-searchable-dropdown.js +9 -0
  220. package/dist/components/salla-searchable-dropdown2.js +255 -0
  221. package/dist/components/salla-skeleton2.js +1 -1
  222. package/dist/components/salla-social-share.js +1 -1
  223. package/dist/components/salla-social.js +1 -1
  224. package/dist/components/salla-tab-content2.js +1 -1
  225. package/dist/components/salla-tab-header2.js +1 -1
  226. package/dist/components/salla-tabs2.js +1 -1
  227. package/dist/components/salla-tel-input2.js +1 -1
  228. package/dist/components/salla-tooltip2.js +1 -1
  229. package/dist/components/salla-user-settings.js +1 -1
  230. package/dist/esm/{filepond-BRnZDx-B.js → filepond-fJKURtC4.js} +1 -1
  231. package/dist/esm/{filepond-plugin-file-poster-D5fDjFO7.js → filepond-plugin-file-poster-Ll-3yUwR.js} +1 -1
  232. package/dist/esm/{filepond-plugin-file-validate-size-CFvpeu0k.js → filepond-plugin-file-validate-size-2D44oWIJ.js} +1 -1
  233. package/dist/esm/{filepond-plugin-file-validate-type-BhjoaDUg.js → filepond-plugin-file-validate-type-08Jawn6d.js} +1 -1
  234. package/dist/esm/{filepond-plugin-image-edit-Cenn_Vlr.js → filepond-plugin-image-edit-DmEVMjMi.js} +1 -1
  235. package/dist/esm/{filepond-plugin-image-exif-orientation-DC9TWqJo.js → filepond-plugin-image-exif-orientation-DJo_07yV.js} +1 -1
  236. package/dist/esm/{filepond-plugin-image-preview-Bj9DJRFj.js → filepond-plugin-image-preview-Nd-PQAho.js} +1 -1
  237. package/dist/esm/{functions-DyAwfRCL.js → functions-GnOlk8am.js} +1 -1
  238. package/dist/esm/{index-COFXO9XT.js → index-Ba0YDJC7.js} +1 -1
  239. package/dist/esm/{index-2RfKl9ZG.js → index-DR8BHH7X.js} +6 -6
  240. package/dist/esm/loader.js +3 -3
  241. package/dist/esm/salla-accordion-body_2.entry.js +1 -1
  242. package/dist/esm/salla-accordion_6.entry.js +2 -2
  243. package/dist/esm/salla-add-product-button_5.entry.js +3 -3
  244. package/dist/esm/salla-advertisement.entry.js +1 -1
  245. package/dist/esm/salla-alert_2.entry.js +1 -1
  246. package/dist/esm/salla-app-install-alert.entry.js +1 -1
  247. package/dist/esm/salla-apps-icons.entry.js +1 -1
  248. package/dist/esm/salla-badge.entry.js +1 -1
  249. package/dist/esm/salla-booking-field_7.entry.js +17 -17
  250. package/dist/esm/{salla-bullet-delivery.entry.js → salla-bullet-delivery_2.entry.js} +635 -141
  251. package/dist/esm/salla-cart-coupons.entry.js +2 -2
  252. package/dist/esm/salla-cart-item-offers_2.entry.js +2 -2
  253. package/dist/esm/salla-comment-form_8.entry.js +8 -8
  254. package/dist/esm/salla-conditional-offer.entry.js +1 -1
  255. package/dist/esm/salla-contacts.entry.js +1 -1
  256. package/dist/esm/salla-cookies-bar.entry.js +1 -1
  257. package/dist/esm/salla-count-down.entry.js +2 -2
  258. package/dist/esm/salla-custom-fields.entry.js +1 -1
  259. package/dist/esm/salla-delivery-promise.entry.js +43 -17
  260. package/dist/esm/salla-edit-order-button.entry.js +1 -1
  261. package/dist/esm/salla-filters-widget.entry.js +3 -3
  262. package/dist/esm/salla-filters.entry.js +2 -2
  263. package/dist/esm/salla-fulfillment-methods.entry.js +2 -2
  264. package/dist/esm/salla-gifting.entry.js +3 -3
  265. package/dist/esm/salla-hook.entry.js +2 -2
  266. package/dist/esm/salla-infinite-scroll.entry.js +1 -1
  267. package/dist/esm/salla-installment.entry.js +1 -1
  268. package/dist/esm/salla-list-tile.entry.js +2 -2
  269. package/dist/esm/salla-localization-modal.entry.js +2 -2
  270. package/dist/esm/salla-login-modal.entry.js +1 -1
  271. package/dist/esm/salla-loyalty-banner.entry.js +2 -2
  272. package/dist/esm/salla-loyalty-hero_2.entry.js +8 -8
  273. package/dist/esm/salla-loyalty-panel.entry.js +3 -3
  274. package/dist/esm/salla-loyalty-prize-item.entry.js +2 -2
  275. package/dist/esm/salla-loyalty-program.entry.js +3 -3
  276. package/dist/esm/salla-loyalty-reward.entry.js +4 -4
  277. package/dist/esm/salla-loyalty.entry.js +1 -1
  278. package/dist/esm/salla-maintenance-alert.entry.js +2 -2
  279. package/dist/esm/salla-map.entry.js +4 -4
  280. package/dist/esm/salla-menu.entry.js +1 -1
  281. package/dist/esm/salla-metadata.entry.js +1 -1
  282. package/dist/esm/salla-multiple-bundle-product-cart_2.entry.js +4 -4
  283. package/dist/esm/salla-multiple-bundle-product-options-modal_2.entry.js +6 -6
  284. package/dist/esm/salla-multiple-bundle-product.entry.js +2 -2
  285. package/dist/esm/salla-next-order-coupon.entry.js +1 -1
  286. package/dist/esm/salla-notification-item.entry.js +2 -2
  287. package/dist/esm/salla-notifications.entry.js +1 -1
  288. package/dist/esm/salla-offer-modal.entry.js +2 -2
  289. package/dist/esm/salla-offer.entry.js +1 -1
  290. package/dist/esm/salla-order-details-multiple-bundle-product.entry.js +1 -1
  291. package/dist/esm/salla-order-details-options.entry.js +1 -1
  292. package/dist/esm/salla-order-details.entry.js +2 -2
  293. package/dist/esm/salla-order-edit-item.entry.js +1 -1
  294. package/dist/esm/salla-order-edit-product-card.entry.js +2 -2
  295. package/dist/esm/salla-order-edit.entry.js +1 -1
  296. package/dist/esm/salla-order-summary.entry.js +2 -2
  297. package/dist/esm/salla-order-totals-card.entry.js +1 -1
  298. package/dist/esm/salla-orders.entry.js +1 -1
  299. package/dist/esm/salla-payments.entry.js +3 -3
  300. package/dist/esm/salla-placeholder.entry.js +2 -2
  301. package/dist/esm/salla-price-range.entry.js +3 -3
  302. package/dist/esm/salla-product-card_2.entry.js +6 -6
  303. package/dist/esm/salla-product-size-guide.entry.js +3 -3
  304. package/dist/esm/salla-products-list.entry.js +1 -1
  305. package/dist/esm/salla-progress-bar.entry.js +1 -1
  306. package/dist/esm/salla-quick-order.entry.js +1 -1
  307. package/dist/esm/salla-rating-modal.entry.js +1 -1
  308. package/dist/esm/salla-reward-action_4.entry.js +11 -11
  309. package/dist/esm/salla-scopes.entry.js +2 -2
  310. package/dist/esm/salla-search.entry.js +6 -6
  311. package/dist/esm/salla-skeleton.entry.js +2 -2
  312. package/dist/esm/salla-slider.entry.js +1 -1
  313. package/dist/esm/salla-social-share.entry.js +2 -2
  314. package/dist/esm/salla-social.entry.js +2 -2
  315. package/dist/esm/salla-tab-content_3.entry.js +4 -4
  316. package/dist/esm/salla-tiered-offer.entry.js +1 -1
  317. package/dist/esm/salla-tooltip.entry.js +2 -2
  318. package/dist/esm/salla-trust-badges.entry.js +1 -1
  319. package/dist/esm/salla-user-menu.entry.js +1 -1
  320. package/dist/esm/salla-user-profile.entry.js +1 -1
  321. package/dist/esm/salla-user-settings.entry.js +2 -2
  322. package/dist/esm/salla-verify.entry.js +1 -1
  323. package/dist/esm/salla-wallet.entry.js +1 -1
  324. package/dist/esm/{tracked-promise-DjHV13KA.js → tracked-promise-BTkBmrok.js} +1 -1
  325. package/dist/esm/twilight.js +3 -3
  326. package/dist/esm/{vanilla-picker-BoRNi1fj.js → vanilla-picker-f4lmttLY.js} +1 -1
  327. package/dist/twilight/p-031f8d35.entry.js +4 -0
  328. package/dist/twilight/{p-ddb5f8e3.entry.js → p-08c6172b.entry.js} +1 -1
  329. package/dist/twilight/p-097e2ba0.entry.js +4 -0
  330. package/dist/twilight/p-0ccf332d.entry.js +4 -0
  331. package/dist/twilight/{p-3d7a49d9.entry.js → p-103dc47c.entry.js} +1 -1
  332. package/dist/twilight/{p-c4b74217.entry.js → p-1208793a.entry.js} +1 -1
  333. package/dist/twilight/{p-15258fe3.entry.js → p-154e782d.entry.js} +1 -1
  334. package/dist/twilight/{p-b64d9557.entry.js → p-19bb31a5.entry.js} +1 -1
  335. package/dist/twilight/{p-022144ee.entry.js → p-1c8726e2.entry.js} +1 -1
  336. package/dist/twilight/{p-adf96b4c.entry.js → p-1e7d16a3.entry.js} +1 -1
  337. package/dist/twilight/{p-b4273ea4.entry.js → p-2d705236.entry.js} +1 -1
  338. package/dist/twilight/{p-7106682a.entry.js → p-2e8588ca.entry.js} +1 -1
  339. package/dist/twilight/{p-fb1b997d.entry.js → p-30256e5f.entry.js} +1 -1
  340. package/dist/twilight/p-308cfcab.entry.js +4 -0
  341. package/dist/twilight/{p-f1859466.entry.js → p-38a8f05e.entry.js} +1 -1
  342. package/dist/twilight/{p-a4f96a76.entry.js → p-3910e00f.entry.js} +1 -1
  343. package/dist/twilight/{p-ece0e68f.entry.js → p-3a2fdd6f.entry.js} +1 -1
  344. package/dist/twilight/p-3cc1582f.entry.js +4 -0
  345. package/dist/twilight/p-3ec34eae.entry.js +4 -0
  346. package/dist/twilight/{p-916187fb.entry.js → p-400257fd.entry.js} +1 -1
  347. package/dist/twilight/{p-a72161e7.entry.js → p-42cc9b33.entry.js} +1 -1
  348. package/dist/twilight/{p-7f07d192.entry.js → p-4482e672.entry.js} +1 -1
  349. package/dist/twilight/{p-aac173b7.entry.js → p-44b289bb.entry.js} +1 -1
  350. package/dist/twilight/{p-d2b90374.entry.js → p-4da58baf.entry.js} +1 -1
  351. package/dist/twilight/{p-390e50ee.entry.js → p-4f873363.entry.js} +1 -1
  352. package/dist/twilight/{p-1cc094d9.entry.js → p-5999d681.entry.js} +1 -1
  353. package/dist/twilight/{p-a96ae5ac.entry.js → p-59f47a08.entry.js} +1 -1
  354. package/dist/twilight/{p-9d20db0f.entry.js → p-5c347cd5.entry.js} +1 -1
  355. package/dist/twilight/{p-184fbcdf.entry.js → p-5ebbec76.entry.js} +1 -1
  356. package/dist/twilight/{p-56070211.entry.js → p-5ecf2b26.entry.js} +1 -1
  357. package/dist/twilight/{p-ce0ecd6d.entry.js → p-612c5b08.entry.js} +1 -1
  358. package/dist/twilight/{p-3eb30788.entry.js → p-624503ee.entry.js} +1 -1
  359. package/dist/twilight/{p-597273c9.entry.js → p-6339390a.entry.js} +1 -1
  360. package/dist/twilight/p-64376e97.entry.js +4 -0
  361. package/dist/twilight/{p-b75f02c5.entry.js → p-65839961.entry.js} +1 -1
  362. package/dist/twilight/{p-416bfa3c.entry.js → p-6c58235e.entry.js} +1 -1
  363. package/dist/twilight/{p-f5b4faf1.entry.js → p-6e26c815.entry.js} +1 -1
  364. package/dist/twilight/p-6f3da0b7.entry.js +4 -0
  365. package/dist/twilight/{p-63b807d8.entry.js → p-72b1e6ed.entry.js} +1 -1
  366. package/dist/twilight/{p-d198466f.entry.js → p-745329af.entry.js} +1 -1
  367. package/dist/twilight/{p-68981b47.entry.js → p-74eb04ec.entry.js} +1 -1
  368. package/dist/twilight/{p-be9b05ed.entry.js → p-78ce73ba.entry.js} +1 -1
  369. package/dist/twilight/{p-a4ee0f48.entry.js → p-7edaa78b.entry.js} +1 -1
  370. package/dist/twilight/{p-6fa8dc48.entry.js → p-807db423.entry.js} +1 -1
  371. package/dist/twilight/{p-5f4491df.entry.js → p-824dd42e.entry.js} +1 -1
  372. package/dist/twilight/{p-15f7a80c.entry.js → p-835c43e6.entry.js} +1 -1
  373. package/dist/twilight/{p-fdd9c784.entry.js → p-83c1d4b2.entry.js} +1 -1
  374. package/dist/twilight/{p-82b0696f.entry.js → p-8709e981.entry.js} +1 -1
  375. package/dist/twilight/{p-31a1aa8c.entry.js → p-8bfca6eb.entry.js} +1 -1
  376. package/dist/twilight/{p-26659429.entry.js → p-8fad5c91.entry.js} +1 -1
  377. package/dist/twilight/{p-abb0fe8a.entry.js → p-96d644b8.entry.js} +1 -1
  378. package/dist/twilight/{p-c57f29fb.entry.js → p-99d0fd61.entry.js} +1 -1
  379. package/dist/twilight/{p-9c6c3383.entry.js → p-9bde5e3c.entry.js} +1 -1
  380. package/dist/twilight/{p-25d69769.entry.js → p-9f320350.entry.js} +1 -1
  381. package/dist/twilight/{p-BRZ-xY4O.js → p-Bc2RLvfZ.js} +1 -1
  382. package/dist/twilight/{p-DIgIfJIX.js → p-CdbTKQNp.js} +1 -1
  383. package/dist/twilight/{p-BQHT0o4-.js → p-CiAXtUPQ.js} +1 -1
  384. package/dist/twilight/{p-gzETizzN.js → p-CmDT48y4.js} +1 -1
  385. package/dist/twilight/{p-f2zyoe62.js → p-D0FlIX_Z.js} +1 -1
  386. package/dist/twilight/{p-2RfKl9ZG.js → p-DR8BHH7X.js} +1 -1
  387. package/dist/twilight/{p-NH4fFDqc.js → p-Dqb1Ri2Y.js} +1 -1
  388. package/dist/twilight/{p-hMPmvZ4N.js → p-Dtp3srRX.js} +1 -1
  389. package/dist/twilight/{p-BWhaHax9.js → p-NohMjDY2.js} +1 -1
  390. package/dist/twilight/{p-5517f377.entry.js → p-a9cbd414.entry.js} +1 -1
  391. package/dist/twilight/{p-f758d06b.entry.js → p-b20265f2.entry.js} +1 -1
  392. package/dist/twilight/{p-826b7e39.entry.js → p-b59b7153.entry.js} +1 -1
  393. package/dist/twilight/{p-cd392e48.entry.js → p-bc47e256.entry.js} +1 -1
  394. package/dist/twilight/{p-c395af37.entry.js → p-bc76d253.entry.js} +1 -1
  395. package/dist/twilight/{p-f6afdeea.entry.js → p-bcf201a8.entry.js} +1 -1
  396. package/dist/twilight/{p-4a41c81f.entry.js → p-beb17e29.entry.js} +1 -1
  397. package/dist/twilight/{p-5dbfbde6.entry.js → p-c00d4e23.entry.js} +1 -1
  398. package/dist/twilight/p-c137e672.entry.js +4 -0
  399. package/dist/twilight/{p-49a31434.entry.js → p-c47e85e9.entry.js} +1 -1
  400. package/dist/twilight/{p-9e20aea5.entry.js → p-c4960804.entry.js} +1 -1
  401. package/dist/twilight/{p-0c50e6d1.entry.js → p-c52aac33.entry.js} +1 -1
  402. package/dist/twilight/{p-58e57008.entry.js → p-c707f55b.entry.js} +1 -1
  403. package/dist/twilight/p-cb8a1223.entry.js +4 -0
  404. package/dist/twilight/{p-0f17896f.entry.js → p-ccfe690a.entry.js} +1 -1
  405. package/dist/twilight/{p-B-Ntbq8B.js → p-cvulr5dQ.js} +1 -1
  406. package/dist/twilight/{p-674370d9.entry.js → p-d01e76f4.entry.js} +1 -1
  407. package/dist/twilight/{p-ea3e4838.entry.js → p-d567481d.entry.js} +1 -1
  408. package/dist/twilight/{p-d0a034ad.entry.js → p-d617d844.entry.js} +1 -1
  409. package/dist/twilight/{p-b59ea7ea.entry.js → p-df173474.entry.js} +1 -1
  410. package/dist/twilight/{p-85f0187e.entry.js → p-e0244c37.entry.js} +1 -1
  411. package/dist/twilight/{p-3c82be41.entry.js → p-e0750731.entry.js} +1 -1
  412. package/dist/twilight/{p-a44b9668.entry.js → p-e0af89bc.entry.js} +1 -1
  413. package/dist/twilight/{p-f95df964.entry.js → p-ed6007e1.entry.js} +1 -1
  414. package/dist/twilight/{p-6591111e.entry.js → p-ed8951c5.entry.js} +1 -1
  415. package/dist/twilight/p-f245d317.entry.js +4 -0
  416. package/dist/twilight/{p-f2cb9377.entry.js → p-f2b204a4.entry.js} +1 -1
  417. package/dist/twilight/{p-8fc96e64.entry.js → p-f579e8ef.entry.js} +1 -1
  418. package/dist/twilight/{p-ffa981ec.entry.js → p-fca971a6.entry.js} +1 -1
  419. package/dist/twilight/{p-3aa1e961.entry.js → p-ff75f1c4.entry.js} +1 -1
  420. package/dist/twilight/{p-8Cy2-80S.js → p-hkzTCOEy.js} +1 -1
  421. package/dist/twilight/{p-Ctl2lOrt.js → p-kg7IhfAv.js} +1 -1
  422. package/dist/twilight/twilight.esm.js +1 -1
  423. package/dist/types/components/salla-bullet-delivery/api-service.d.ts +6 -5
  424. package/dist/types/components/salla-bullet-delivery/salla-bullet-delivery.d.ts +38 -6
  425. package/dist/types/components/salla-delivery-promise/delivery-promise-api.d.ts +1 -1
  426. package/dist/types/components/salla-delivery-promise/salla-delivery-promise.d.ts +2 -0
  427. package/dist/types/components/salla-searchable-dropdown/interfaces.d.ts +5 -0
  428. package/dist/types/components/salla-searchable-dropdown/salla-searchable-dropdown.d.ts +47 -0
  429. package/dist/types/components.d.ts +135 -0
  430. package/package.json +5 -5
  431. package/dist/twilight/p-5be4ae85.entry.js +0 -4
  432. package/dist/twilight/p-5c2dcdb0.entry.js +0 -4
  433. package/dist/twilight/p-637724e7.entry.js +0 -4
  434. package/dist/twilight/p-68f163aa.entry.js +0 -4
  435. package/dist/twilight/p-6bf87309.entry.js +0 -4
  436. package/dist/twilight/p-873eed59.entry.js +0 -4
  437. package/dist/twilight/p-879f08a4.entry.js +0 -4
  438. package/dist/twilight/p-ae6aabba.entry.js +0 -4
  439. package/dist/twilight/p-d0520b44.entry.js +0 -4
  440. package/dist/twilight/p-dd0be0da.entry.js +0 -4
  441. package/dist/twilight/p-ec899dc9.entry.js +0 -4
@@ -1,10 +1,10 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import { r as registerInstance, c as createEvent, h, H as Host } from './index-2RfKl9ZG.js';
5
- import { S as Search } from './search-BscTeWDc.js';
6
- import { L as Location } from './location-BO5AoBAP.js';
4
+ import { r as registerInstance, c as createEvent, h, H as Host, a as getElement } from './index-DR8BHH7X.js';
7
5
  import { a as ArrowRightIcon, A as ArrowLeftIcon } from './keyboard_arrow_right-Vqpj4CWE.js';
6
+ import { L as Location } from './location-BO5AoBAP.js';
7
+ import { S as Search } from './search-BscTeWDc.js';
8
8
 
9
9
  /**
10
10
  * API Service for salla-bullet-delivery component
@@ -24,6 +24,19 @@ async function withApiErrorHandling(fn, fallback, logLabel) {
24
24
  return fallback;
25
25
  }
26
26
  }
27
+ const apiCache = new Map();
28
+ const CACHE_TTL = 5 * 60 * 1000;
29
+ function getCached(key) {
30
+ const entry = apiCache.get(key);
31
+ if (!entry || Date.now() - entry.timestamp > CACHE_TTL) {
32
+ apiCache.delete(key);
33
+ return null;
34
+ }
35
+ return entry.data;
36
+ }
37
+ function setCache(key, data) {
38
+ apiCache.set(key, { data, timestamp: Date.now() });
39
+ }
27
40
  /** Uses country code from API (e.g. 'SA'). */
28
41
  const isSaudiArabia = (countryCode) => String(countryCode).toUpperCase() === 'SA';
29
42
  /**
@@ -35,53 +48,94 @@ const bulletDeliveryAPI = {
35
48
  * Get available countries from Salla shipping API
36
49
  * @param forBranch - when true, use for_branch=1 (e.g. for pickup/branches tab)
37
50
  */
38
- async getCountries(forBranch = false) {
39
- return withApiErrorHandling(async () => {
40
- const data = (await salla.api.request("shipping/countries", { params: { for_branch: forBranch ? 1 : 0 } }))?.data ?? [];
51
+ async getCountries(forBranch = false, query) {
52
+ const cacheKey = !query?.trim() ? `countries_${forBranch ? 1 : 0}` : null;
53
+ if (cacheKey) {
54
+ const cached = getCached(cacheKey);
55
+ if (cached)
56
+ return cached;
57
+ }
58
+ const result = await withApiErrorHandling(async () => {
59
+ const params = { for_branch: forBranch ? 1 : 0 };
60
+ if (forBranch) {
61
+ params.for_allocation = 1;
62
+ }
63
+ if (query?.trim())
64
+ params.query = query.trim();
65
+ const data = (await salla.api.request("shipping/countries", { params }))?.data ?? [];
41
66
  return data.map((c) => ({ id: c.id, code: c.code, name: c.name, has_regions: isSaudiArabia(c.code) }));
42
67
  }, [], 'Error getting countries');
68
+ if (cacheKey && result.length > 0)
69
+ setCache(cacheKey, result);
70
+ return result;
43
71
  },
44
72
  /**
45
73
  * Get regions for a country from Salla shipping API
46
74
  * Endpoint: GET /shipping/countries/<COUNTRY_ID>/region
47
75
  */
48
- async getRegions(countryId) {
76
+ async getRegions(countryId, query) {
49
77
  if (!validId(countryId)) {
50
78
  console.warn(`${API_LOG_PREFIX}: getRegions called without valid country_id`);
51
79
  return [];
52
80
  }
53
- return withApiErrorHandling(async () => {
54
- const data = (await salla.api.request(`shipping/countries/${countryId}/regions`))?.data ?? [];
81
+ const cacheKey = !query?.trim() ? `regions_${countryId}` : null;
82
+ if (cacheKey) {
83
+ const cached = getCached(cacheKey);
84
+ if (cached)
85
+ return cached;
86
+ }
87
+ const result = await withApiErrorHandling(async () => {
88
+ const params = {};
89
+ if (query?.trim())
90
+ params.query = query.trim();
91
+ const data = (await salla.api.request(`shipping/countries/${countryId}/regions`, { params }))?.data ?? [];
55
92
  return data.map((r) => ({ id: r.id, name: r.name, code: r.code, country_id: Number(countryId) }));
56
93
  }, [], 'Error fetching regions');
94
+ if (cacheKey && result.length > 0)
95
+ setCache(cacheKey, result);
96
+ return result;
57
97
  },
58
98
  /**
59
99
  * Get cities from Salla shipping API
60
100
  * @param regionId - Optional; when provided (e.g. for SA), cities are filtered by region
61
101
  */
62
- async getCities(countryId, regionId) {
102
+ async getCities(countryId, regionId, query) {
63
103
  if (!validId(countryId)) {
64
104
  console.warn(`${API_LOG_PREFIX}: getCities called without valid country_id`);
65
105
  return [];
66
106
  }
67
- return withApiErrorHandling(async () => {
107
+ const cacheKey = !query?.trim() ? `cities_${countryId}_${regionId || 'all'}` : null;
108
+ if (cacheKey) {
109
+ const cached = getCached(cacheKey);
110
+ if (cached)
111
+ return cached;
112
+ }
113
+ const result = await withApiErrorHandling(async () => {
68
114
  const params = { for_branch: 0, country_id: countryId };
69
115
  if (regionId)
70
116
  params.region_id = regionId;
117
+ if (query?.trim())
118
+ params.query = query.trim();
71
119
  const data = (await salla.api.request("shipping/cities", { params }))?.data ?? [];
72
120
  return data.map((c) => ({ id: c.id, name: c.name, country_id: countryId, ...(c.region_id != null && { region_id: c.region_id }) }));
73
121
  }, [], 'Error fetching cities');
122
+ if (cacheKey && result.length > 0)
123
+ setCache(cacheKey, result);
124
+ return result;
74
125
  },
75
126
  /**
76
127
  * Get districts from Salla shipping API
77
128
  */
78
- async getDistricts(cityId) {
129
+ async getDistricts(cityId, query) {
79
130
  if (!validId(cityId)) {
80
131
  console.warn(`${API_LOG_PREFIX}: getDistricts called without valid city_id`);
81
132
  return [];
82
133
  }
83
134
  return withApiErrorHandling(async () => {
84
- const raw = (await salla.api.request("shipping/districts", { params: { for_branch: 0, city_id: cityId } }))?.data;
135
+ const params = { for_branch: 0, city_id: cityId };
136
+ if (query?.trim())
137
+ params.query = query.trim();
138
+ const raw = (await salla.api.request("shipping/districts", { params }))?.data;
85
139
  const list = Array.isArray(raw) ? raw : (Array.isArray(raw?.districts) ? raw.districts : []);
86
140
  return list.map((d) => ({ id: d.id, name: d.name, name_en: d.name_en, city_id: cityId }));
87
141
  }, [], 'Error fetching districts');
@@ -93,7 +147,14 @@ const bulletDeliveryAPI = {
93
147
  }, [], 'Error fetching user addresses');
94
148
  },
95
149
  async getBranches({ query, lat, lng, country_id, per_page = 20 } = {}) {
96
- return withApiErrorHandling(async () => {
150
+ const hasSearchParams = query?.trim()?.length >= 2 || lat || lng;
151
+ const cacheKey = !hasSearchParams && country_id ? `branches_${country_id}` : null;
152
+ if (cacheKey) {
153
+ const cached = getCached(cacheKey);
154
+ if (cached)
155
+ return cached;
156
+ }
157
+ const result = await withApiErrorHandling(async () => {
97
158
  const params = { per_page };
98
159
  if (query?.trim().length >= 2)
99
160
  params.query = query;
@@ -106,6 +167,9 @@ const bulletDeliveryAPI = {
106
167
  const res = await salla.api.request("branches", { params });
107
168
  return (Array.isArray(res?.data) ? res.data : []);
108
169
  }, [], 'Error fetching branches');
170
+ if (cacheKey && result.length > 0)
171
+ setCache(cacheKey, result);
172
+ return result;
109
173
  },
110
174
  async saveAddressLocation(payload) {
111
175
  return withApiErrorHandling(async () => {
@@ -117,7 +181,7 @@ const bulletDeliveryAPI = {
117
181
  },
118
182
  async setDeliveryScope(scopeId) {
119
183
  return withApiErrorHandling(async () => {
120
- await salla.scope.change({ id: scopeId });
184
+ await salla.api.withoutNotifier(() => salla.scope.change({ id: scopeId }));
121
185
  salla.storage.set("scope", { ...(salla.storage.get("scope") || {}), id: scopeId });
122
186
  return true;
123
187
  }, false, 'Error setting delivery scope');
@@ -125,7 +189,7 @@ const bulletDeliveryAPI = {
125
189
  async allocateScope(payload) {
126
190
  const errMsg = (d) => d?.error?.message ?? d?.message ?? 'Failed to allocate scope';
127
191
  try {
128
- const response = await salla.api.request("scopes/allocation", payload, 'post');
192
+ const response = await salla.api.withoutNotifier(() => salla.api.request("scopes/allocation", payload, 'post'));
129
193
  // SDK resolves with { data } and throws on non-2xx; any resolved value is success
130
194
  const data = response?.data ?? response;
131
195
  return { success: true, data: data };
@@ -137,6 +201,9 @@ const bulletDeliveryAPI = {
137
201
  }
138
202
  },
139
203
  };
204
+ function clearApiCache() {
205
+ apiCache.clear();
206
+ }
140
207
 
141
208
  /**
142
209
  * Helper functions for salla-bullet-delivery component
@@ -244,16 +311,10 @@ const GEO_ERROR_MESSAGES = {
244
311
  };
245
312
  const getGeolocationErrorMessage = (errorCode) => GEO_ERROR_MESSAGES[errorCode] ?? 'An error occurred while detecting location';
246
313
 
247
- var Store = `<svg width="15" height="14" viewBox="0 0 15 14" fill="none" xmlns="http://www.w3.org/2000/svg">
248
- <path
249
- d="M1.14453 5.83032L1.14453 9.16486C1.14453 11.0511 1.14453 11.9943 1.73032 12.5803C2.3161 13.1663 3.25891 13.1663 5.14453 13.1663L9.14453 13.1663C11.0301 13.1663 11.9729 13.1663 12.5587 12.5803C13.1445 11.9943 13.1445 11.0511 13.1445 9.16486V5.83032"
250
- stroke="currentcolor" stroke-linecap="round" />
251
- <path
252
- d="M9.14453 10.1619C8.68846 10.5667 7.9624 10.8285 7.14453 10.8285C6.32666 10.8285 5.60059 10.5667 5.14453 10.1619"
253
- stroke="currentcolor" stroke-linecap="round" />
314
+ var GetDirections = `<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
254
315
  <path
255
- d="M5.90256 4.44533C5.71455 5.12426 5.03086 6.29542 3.73185 6.46516C2.58488 6.61502 1.71497 6.11437 1.49277 5.90504C1.24779 5.7353 0.689441 5.19216 0.552703 4.85269C0.415966 4.51322 0.575492 3.77771 0.689441 3.47785L1.14495 2.15892C1.25615 1.82765 1.51646 1.04411 1.78334 0.779094C2.05022 0.514073 2.59054 0.502543 2.81294 0.502543L7.48329 0.502543C8.68543 0.519525 11.3139 0.491824 11.8335 0.502545C12.3532 0.513266 12.6654 0.948828 12.7565 1.13553C13.5318 3.01341 13.8333 4.08889 13.8333 4.54717C13.7321 5.03605 13.3133 5.95787 11.8335 6.36332C10.2956 6.7847 9.42363 5.96509 9.15007 5.65043M5.27015 5.65044C5.48665 5.91635 6.16578 6.45158 7.15029 6.46516C8.1348 6.47873 8.98485 5.79188 9.28681 5.44676C9.37227 5.34492 9.55687 5.04279 9.7483 4.44533"
256
- stroke="currentcolor" stroke-linecap="round" stroke-linejoin="round" />
316
+ d="M7.94798 3.19336C11.1309 2.1083 12.7223 1.56578 13.5783 2.42174C14.4342 3.27771 13.8917 4.86914 12.8066 8.05201L12.0678 10.2195C11.2344 12.6639 10.8178 13.8861 10.131 13.9872C9.94631 14.0144 9.75517 13.9981 9.57248 13.9394C8.89297 13.7212 8.53377 12.4326 7.81538 9.8553C7.65604 9.28364 7.57637 8.99781 7.39494 8.7795C7.34228 8.71614 7.28386 8.65772 7.2205 8.60506C7.00219 8.42363 6.71636 8.34396 6.1447 8.18462C3.56741 7.46623 2.27876 7.10703 2.0606 6.42752C2.00195 6.24483 1.98558 6.05369 2.01277 5.86903C2.11392 5.18221 3.33613 4.76556 5.78054 3.93225L7.94798 3.19336Z"
317
+ stroke="#555555" stroke-width="1.2" />
257
318
  </svg>
258
319
  `;
259
320
 
@@ -307,17 +368,30 @@ var MiniMap = `<svg width="35" height="35" viewBox="0 0 35 35" fill="none" xmlns
307
368
  </svg>
308
369
  `;
309
370
 
310
- var GetDirections = `<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
371
+ var Store = `<svg width="15" height="14" viewBox="0 0 15 14" fill="none" xmlns="http://www.w3.org/2000/svg">
311
372
  <path
312
- d="M7.94798 3.19336C11.1309 2.1083 12.7223 1.56578 13.5783 2.42174C14.4342 3.27771 13.8917 4.86914 12.8066 8.05201L12.0678 10.2195C11.2344 12.6639 10.8178 13.8861 10.131 13.9872C9.94631 14.0144 9.75517 13.9981 9.57248 13.9394C8.89297 13.7212 8.53377 12.4326 7.81538 9.8553C7.65604 9.28364 7.57637 8.99781 7.39494 8.7795C7.34228 8.71614 7.28386 8.65772 7.2205 8.60506C7.00219 8.42363 6.71636 8.34396 6.1447 8.18462C3.56741 7.46623 2.27876 7.10703 2.0606 6.42752C2.00195 6.24483 1.98558 6.05369 2.01277 5.86903C2.11392 5.18221 3.33613 4.76556 5.78054 3.93225L7.94798 3.19336Z"
313
- stroke="#555555" stroke-width="1.2" />
373
+ d="M1.14453 5.83032L1.14453 9.16486C1.14453 11.0511 1.14453 11.9943 1.73032 12.5803C2.3161 13.1663 3.25891 13.1663 5.14453 13.1663L9.14453 13.1663C11.0301 13.1663 11.9729 13.1663 12.5587 12.5803C13.1445 11.9943 13.1445 11.0511 13.1445 9.16486V5.83032"
374
+ stroke="currentcolor" stroke-linecap="round" />
375
+ <path
376
+ d="M9.14453 10.1619C8.68846 10.5667 7.9624 10.8285 7.14453 10.8285C6.32666 10.8285 5.60059 10.5667 5.14453 10.1619"
377
+ stroke="currentcolor" stroke-linecap="round" />
378
+ <path
379
+ d="M5.90256 4.44533C5.71455 5.12426 5.03086 6.29542 3.73185 6.46516C2.58488 6.61502 1.71497 6.11437 1.49277 5.90504C1.24779 5.7353 0.689441 5.19216 0.552703 4.85269C0.415966 4.51322 0.575492 3.77771 0.689441 3.47785L1.14495 2.15892C1.25615 1.82765 1.51646 1.04411 1.78334 0.779094C2.05022 0.514073 2.59054 0.502543 2.81294 0.502543L7.48329 0.502543C8.68543 0.519525 11.3139 0.491824 11.8335 0.502545C12.3532 0.513266 12.6654 0.948828 12.7565 1.13553C13.5318 3.01341 13.8333 4.08889 13.8333 4.54717C13.7321 5.03605 13.3133 5.95787 11.8335 6.36332C10.2956 6.7847 9.42363 5.96509 9.15007 5.65043M5.27015 5.65044C5.48665 5.91635 6.16578 6.45158 7.15029 6.46516C8.1348 6.47873 8.98485 5.79188 9.28681 5.44676C9.37227 5.34492 9.55687 5.04279 9.7483 4.44533"
380
+ stroke="currentcolor" stroke-linecap="round" stroke-linejoin="round" />
314
381
  </svg>
315
382
  `;
316
383
 
317
- const sallaBulletDeliveryCss = "@supports (interpolate-size: allow-keywords) and (block-size: calc-size(auto, size)) {\n .s-bullet-delivery .s-bullet-delivery-modal .s-modal-body, .s-bullet-delivery-inner {\n @apply [interpolate-size:allow-keywords];\n }\n .s-bullet-delivery .s-bullet-delivery-modal .s-modal-body {\n @apply [overflow:clip] [transition:block-size_500ms_ease];\n }\n .s-bullet-delivery-inner {\n @apply [overflow:clip] [transition:block-size_500ms_ease];\n block-size: calc-size(auto, size);\n }\n}\n\n@keyframes s-bullet-delivery-fade-in {\n from {\n opacity: 0;\n transform: translateY(6px);\n }\n to {\n opacity: 1;\n transform: translateY(0);\n }\n}";
384
+ const sallaBulletDeliveryCss = "@supports (interpolate-size: allow-keywords) and (block-size: calc-size(auto, size)) {\n .s-bullet-delivery .s-bullet-delivery-modal .s-modal-body, .s-bullet-delivery-inner {\n @apply [interpolate-size:allow-keywords];\n }\n .s-bullet-delivery .s-bullet-delivery-modal .s-modal-body {\n @apply [overflow:clip] [transition:block-size_500ms_ease];\n }\n .s-bullet-delivery-inner {\n @apply [overflow:clip] [transition:block-size_500ms_ease];\n block-size: calc-size(auto, size);\n }\n}\n\n/* Allow searchable dropdown popover to paint outside the modal body */\n.s-bullet-delivery .s-bullet-delivery-modal .s-modal-body:has(.s-searchable-dropdown--open) {\n overflow: visible !important;\n}\n\n@keyframes s-bullet-delivery-fade-in {\n from {\n opacity: 0;\n transform: translateY(6px);\n }\n to {\n opacity: 1;\n transform: translateY(0);\n }\n}";
318
385
 
319
386
  const BRANCH_SEARCH_DEBOUNCE_MS = 1000;
320
387
  const GEOLOCATION_TIMEOUT = 10000;
388
+ const DEBUG_KEY = 'salla-bullet-delivery-debug';
389
+ const OVERRIDE_IP_KEY = 'salla-bullet-delivery-override-ip';
390
+ function log(message, data) {
391
+ if (localStorage.getItem(DEBUG_KEY)) {
392
+ data !== undefined ? console.log(message, data) : console.log(message);
393
+ }
394
+ }
321
395
  const SallaBulletDelivery = class {
322
396
  constructor(hostRef) {
323
397
  registerInstance(this, hostRef);
@@ -330,6 +404,11 @@ const SallaBulletDelivery = class {
330
404
  this.pendingCartSubmitPromise = null;
331
405
  this.cartSubmitConfirmationPending = false;
332
406
  this.branchSearchDebounceTimer = null;
407
+ this.countrySearchTimer = null;
408
+ this.regionSearchTimer = null;
409
+ this.citySearchTimer = null;
410
+ this.districtSearchTimer = null;
411
+ this.citySearchCounter = 0;
333
412
  this.componentReady = false;
334
413
  this.pendingOpen = false;
335
414
  this.tabChanging = false;
@@ -356,7 +435,6 @@ const SallaBulletDelivery = class {
356
435
  /** True after saved addresses have been loaded (lazy: only when address tab is shown). */
357
436
  this.savedAddressesLoaded = false;
358
437
  // Core state
359
- this.loading = true;
360
438
  this.activeTab = "address";
361
439
  this.isLoggedIn = false;
362
440
  this.viewMode = "main";
@@ -382,6 +460,7 @@ const SallaBulletDelivery = class {
382
460
  this.selectedBranch = null;
383
461
  this.branchSearchQuery = "";
384
462
  // Loading states
463
+ this.loadingCountries = false;
385
464
  this.loadingCities = false;
386
465
  this.loadingDistricts = false;
387
466
  this.loadingBranches = false;
@@ -390,11 +469,95 @@ const SallaBulletDelivery = class {
390
469
  this.savingAddress = false;
391
470
  this.loadingSavedAddresses = false;
392
471
  this.showCartWillBeClearedBanner = false;
472
+ // Searchable dropdown state
473
+ this.countrySearchQuery = '';
474
+ this.regionSearchQuery = '';
475
+ this.citySearchQuery = '';
476
+ this.districtSearchQuery = '';
477
+ this.searchingCountries = false;
478
+ this.searchingRegions = false;
479
+ this.searchingCities = false;
480
+ this.searchingDistricts = false;
481
+ this.displayedCountries = [];
482
+ this.displayedRegions = [];
483
+ this.displayedCities = [];
484
+ this.displayedDistricts = [];
393
485
  /** Shown when scopes/allocation returns 422 (address outside delivery coverage). Only on delivery tab. */
394
486
  this.allocationOutOfCoverageMessage = null;
395
487
  this.newAddressForm = {
396
488
  ...SallaBulletDelivery.INITIAL_ADDRESS_FORM,
397
489
  };
490
+ this.handleCountrySearch = (query) => {
491
+ this.countrySearchQuery = query;
492
+ return;
493
+ };
494
+ this.handleRegionSearch = (query) => {
495
+ this.regionSearchQuery = query;
496
+ return;
497
+ };
498
+ this.handleCitySearch = (query) => {
499
+ this.citySearchQuery = query;
500
+ if (this.citySearchTimer)
501
+ clearTimeout(this.citySearchTimer);
502
+ if (!query.trim()) {
503
+ this.displayedCities = this.cities;
504
+ this.searchingCities = false;
505
+ return;
506
+ }
507
+ if (query.trim().length < SallaBulletDelivery.DROPDOWN_SEARCH_MIN_CHARS)
508
+ return;
509
+ const requestId = ++this.citySearchCounter;
510
+ this.citySearchTimer = setTimeout(async () => {
511
+ this.searchingCities = true;
512
+ try {
513
+ const isSA = isSaudiArabia(this.selectedCountry?.code ?? '');
514
+ const regionId = isSA ? this.selectedRegion?.id : undefined;
515
+ const results = await bulletDeliveryAPI.getCities(this.selectedCountry?.id, regionId, query);
516
+ if (requestId === this.citySearchCounter) {
517
+ this.displayedCities = results;
518
+ }
519
+ }
520
+ catch {
521
+ if (requestId === this.citySearchCounter) {
522
+ this.displayedCities = this.cities;
523
+ }
524
+ }
525
+ finally {
526
+ if (requestId === this.citySearchCounter) {
527
+ this.searchingCities = false;
528
+ }
529
+ }
530
+ }, SallaBulletDelivery.DROPDOWN_SEARCH_DEBOUNCE_MS);
531
+ };
532
+ this.handleDistrictSearch = (query) => {
533
+ this.districtSearchQuery = query;
534
+ return;
535
+ };
536
+ this.handleCountryDropdownClosed = () => {
537
+ this.countrySearchQuery = '';
538
+ this.displayedCountries = this.countries;
539
+ this.searchingCountries = false;
540
+ };
541
+ this.handleRegionDropdownClosed = () => {
542
+ this.regionSearchQuery = '';
543
+ this.displayedRegions = this.regions;
544
+ this.searchingRegions = false;
545
+ };
546
+ this.handleCityDropdownClosed = () => {
547
+ this.citySearchQuery = '';
548
+ if (this.citySearchTimer) {
549
+ clearTimeout(this.citySearchTimer);
550
+ this.citySearchTimer = null;
551
+ }
552
+ ++this.citySearchCounter;
553
+ this.displayedCities = this.cities;
554
+ this.searchingCities = false;
555
+ };
556
+ this.handleDistrictDropdownClosed = () => {
557
+ this.districtSearchQuery = '';
558
+ this.displayedDistricts = this.districts;
559
+ this.searchingDistricts = false;
560
+ };
398
561
  /**
399
562
  * Submit add-address form: create address via API then switch back to list.
400
563
  */
@@ -433,10 +596,61 @@ const SallaBulletDelivery = class {
433
596
  this.savingAddress = false;
434
597
  }
435
598
  };
599
+ this.handleCountrySelected = (item) => {
600
+ const country = this.countries.find(c => String(c.id) === String(item.id)) || item;
601
+ const isCountrySwitch = this.selectedCountry &&
602
+ country &&
603
+ this.selectedCountry.code !== country.code;
604
+ this.showCartWillBeClearedBanner = !!isCountrySwitch;
605
+ this.countrySearchQuery = '';
606
+ this.displayedCountries = this.countries;
607
+ this.applyCountryChange(country || null);
608
+ };
609
+ this.handleRegionSelected = (item) => {
610
+ const region = this.regions.find(r => String(r.id) === String(item.id)) || item;
611
+ this.selectedRegion = region || null;
612
+ this.regionSearchQuery = '';
613
+ this.displayedRegions = this.regions;
614
+ this.updateNewAddressForm({
615
+ region_id: region?.id,
616
+ city_id: undefined,
617
+ district_id: undefined,
618
+ city: undefined,
619
+ district: undefined,
620
+ });
621
+ if (region && this.selectedCountry) {
622
+ this.loadCities(this.selectedCountry.id, region.id);
623
+ }
624
+ };
625
+ this.handleCitySelected = (item) => {
626
+ const isSA = isSaudiArabia(this.selectedCountry?.code ?? '');
627
+ const city = this.cities.find(c => String(c.id) === String(item.id)) || item;
628
+ this.selectedCity = city || null;
629
+ this.selectedDistrict = null;
630
+ this.districtName = "";
631
+ this.citySearchQuery = '';
632
+ this.displayedCities = this.cities;
633
+ if (city) {
634
+ this.updateNewAddressForm({ city: city, district: undefined });
635
+ if (isSA) {
636
+ this.loadDistricts(city.id);
637
+ }
638
+ }
639
+ };
640
+ this.handleDistrictSelected = (item) => {
641
+ const district = this.districts.find(d => String(d.id) === String(item.id)) || item;
642
+ this.selectedDistrict = district || null;
643
+ this.districtName = "";
644
+ this.districtSearchQuery = '';
645
+ this.displayedDistricts = this.districts;
646
+ if (district) {
647
+ this.updateNewAddressForm({ district });
648
+ }
649
+ };
436
650
  }
437
- /** Whether to show delivery + pickup tabs. From store.settings.bullet_delivery.supports_pickup */
651
+ /** Whether to show delivery + pickup tabs. From store.shipping.support_pickup */
438
652
  get supportsPickup() {
439
- return !!Salla.config.get("store.settings.bullet_delivery.supports_pickup");
653
+ return Boolean(Salla.config.get("store.shipping.support_pickup"));
440
654
  }
441
655
  /** The modal opening strategy: 'first_visit' | 'on_cart_click' | 'after_add_to_cart' */
442
656
  get openingType() {
@@ -455,10 +669,9 @@ const SallaBulletDelivery = class {
455
669
  this.pendingOpen = true;
456
670
  return;
457
671
  }
458
- // Reset state and set loading before opening
672
+ // Reset state before opening
459
673
  this.resetState();
460
- this.loading = true;
461
- // Open modal immediately to show skeleton/loading state
674
+ // Open modal immediately — fields render right away with inline loading
462
675
  this.modal.open();
463
676
  Salla.event.dispatch("salla::bullet-delivery.modal.opened");
464
677
  try {
@@ -479,11 +692,16 @@ const SallaBulletDelivery = class {
479
692
  this.activeTab = "address";
480
693
  }
481
694
  // Load countries always; load saved addresses only when address tab is active (lazy tab data).
695
+ if (this.isLoggedIn && this.activeTab === "address") {
696
+ this.loadingSavedAddresses = true;
697
+ }
482
698
  await Promise.all([
483
699
  this.loadCountries(hasStoredAddressIds),
484
700
  this.isLoggedIn && this.activeTab === "address"
485
701
  ? this.loadSavedAddresses().then(() => {
486
702
  this.savedAddressesLoaded = true;
703
+ }).finally(() => {
704
+ this.loadingSavedAddresses = false;
487
705
  })
488
706
  : Promise.resolve(),
489
707
  ]);
@@ -521,9 +739,6 @@ const SallaBulletDelivery = class {
521
739
  console.error("SallaBulletDelivery: Error loading data", e);
522
740
  }
523
741
  finally {
524
- // Only hide loading after all data is loaded and UI is ready
525
- this.loading = false;
526
- this.modal?.stopLoading();
527
742
  this.overrideScopeSwitchUI();
528
743
  }
529
744
  }
@@ -558,12 +773,13 @@ const SallaBulletDelivery = class {
558
773
  this.branches = [];
559
774
  this.filteredBranches = [];
560
775
  this.newAddressForm = { ...SallaBulletDelivery.INITIAL_ADDRESS_FORM };
561
- // Reset new state variables
562
776
  this.showCartWillBeClearedBanner = false;
563
777
  this.allocationOutOfCoverageMessage = null;
564
778
  this.locationError = "";
565
779
  this.savedAddressesLoaded = false;
566
780
  this.loadingSavedAddresses = false;
781
+ this.loadingCountries = false;
782
+ this.resetSearchState();
567
783
  }
568
784
  getIntentStorage() {
569
785
  const rememberLastSession = Boolean(Salla.config.get("store.settings.bullet_delivery.settings.remember_last_session"));
@@ -690,10 +906,14 @@ const SallaBulletDelivery = class {
690
906
  ? bulletDeliveryAPI.getDistricts(Number(cityId))
691
907
  : Promise.resolve([]),
692
908
  ]);
693
- if (isSA)
909
+ if (isSA) {
694
910
  this.regions = regions;
911
+ this.displayedRegions = this.regions;
912
+ }
695
913
  this.cities = cities;
914
+ this.displayedCities = this.cities;
696
915
  this.districts = districts;
916
+ this.displayedDistricts = this.districts;
697
917
  this.loadingCities = false;
698
918
  this.loadingRegions = false;
699
919
  this.loadingDistricts = false;
@@ -736,41 +956,117 @@ const SallaBulletDelivery = class {
736
956
  const storage = this.getShownStorage();
737
957
  storage.set(this.sessionShownKey, true);
738
958
  }
959
+ getIPLocationConfig() {
960
+ const configPath = "store.shipping.delivery_location";
961
+ const ipAddress = {
962
+ countryId: Salla.config.get(`${configPath}.country_id`),
963
+ regionId: Salla.config.get(`${configPath}.region_id`),
964
+ cityId: Salla.config.get(`${configPath}.city_id`),
965
+ districtId: Salla.config.get(`${configPath}.district_id`),
966
+ };
967
+ return localStorage.getItem(OVERRIDE_IP_KEY) ?
968
+ JSON.parse(localStorage.getItem(OVERRIDE_IP_KEY)) : ipAddress;
969
+ }
739
970
  async loadCountries(skipEagerSubFetch = false) {
971
+ this.loadingCountries = true;
740
972
  const forBranch = this.activeTab === "branch";
741
- this.countries = await bulletDeliveryAPI.getCountries(forBranch);
742
- // Preselect country from bullet_delivery.customer_location.country (SA | EG | ...)
743
- const configCountryCode = Salla.config.get("store.settings.bullet_delivery.customer_location.country");
744
- const countryToSelect = configCountryCode && this.countries.length > 0
745
- ? this.countries.find((c) => String(c.code).toUpperCase() ===
746
- String(configCountryCode).toUpperCase())
747
- : null;
748
- if (countryToSelect) {
749
- this.selectedCountry = countryToSelect;
750
- this.updateNewAddressForm({
751
- country_id: Number(this.selectedCountry.id),
752
- });
753
- // Skip eager sub-fetches when stored intent IDs exist — prefillFromSessionStorage
754
- // will fire regions/cities/districts in parallel using the stored IDs directly.
755
- if (!skipEagerSubFetch) {
756
- if (isSaudiArabia(this.selectedCountry.code)) {
757
- await this.loadRegions(this.selectedCountry.id);
758
- }
759
- else {
760
- await this.loadCities(this.selectedCountry.id);
973
+ try {
974
+ this.countries = await bulletDeliveryAPI.getCountries(forBranch);
975
+ this.displayedCountries = this.countries;
976
+ const { countryId: configCountryId, regionId: configRegionId, cityId: configCityId, districtId: configDistrictId } = this.getIPLocationConfig();
977
+ log("getIPLocationConfig", this.getIPLocationConfig());
978
+ const countryToSelect = configCountryId && this.countries.length > 0
979
+ ? this.countries.find((c) => String(c.id) === String(configCountryId))
980
+ : null;
981
+ if (countryToSelect) {
982
+ this.selectedCountry = countryToSelect;
983
+ this.updateNewAddressForm({
984
+ country_id: Number(this.selectedCountry.id),
985
+ });
986
+ // Skip eager sub-fetches when stored intent IDs exist prefillFromSessionStorage
987
+ // will fire regions/cities/districts in parallel using the stored IDs directly.
988
+ if (!skipEagerSubFetch) {
989
+ const hasIPLocationIds = configRegionId != null ||
990
+ configCityId != null ||
991
+ configDistrictId != null;
992
+ if (hasIPLocationIds) {
993
+ await this.prefillFromIPLocation(countryToSelect, {
994
+ regionId: configRegionId,
995
+ cityId: configCityId,
996
+ districtId: configDistrictId,
997
+ });
998
+ }
999
+ else if (isSaudiArabia(this.selectedCountry.code)) {
1000
+ await this.loadRegions(this.selectedCountry.id);
1001
+ }
1002
+ else {
1003
+ await this.loadCities(this.selectedCountry.id);
1004
+ }
761
1005
  }
762
1006
  }
763
1007
  }
1008
+ finally {
1009
+ this.loadingCountries = false;
1010
+ }
1011
+ }
1012
+ async prefillFromIPLocation(country, ids) {
1013
+ const isSA = isSaudiArabia(country.code);
1014
+ const { regionId, cityId, districtId } = ids;
1015
+ const [regions, cities, districts] = await Promise.all([
1016
+ isSA ? bulletDeliveryAPI.getRegions(country.id) : Promise.resolve([]),
1017
+ bulletDeliveryAPI.getCities(country.id, isSA && regionId != null ? regionId : undefined),
1018
+ cityId != null
1019
+ ? bulletDeliveryAPI.getDistricts(Number(cityId))
1020
+ : Promise.resolve([]),
1021
+ ]);
1022
+ if (isSA) {
1023
+ this.regions = regions;
1024
+ this.displayedRegions = this.regions;
1025
+ }
1026
+ this.cities = cities;
1027
+ this.displayedCities = this.cities;
1028
+ this.districts = districts;
1029
+ this.displayedDistricts = this.districts;
1030
+ this.loadingRegions = false;
1031
+ this.loadingCities = false;
1032
+ this.loadingDistricts = false;
1033
+ if (isSA && regionId != null) {
1034
+ const region = this.regions.find((r) => String(r.id) === String(regionId));
1035
+ if (region) {
1036
+ this.selectedRegion = region;
1037
+ this.updateNewAddressForm({ region_id: region.id });
1038
+ }
1039
+ }
1040
+ if (cityId != null && this.cities.length > 0) {
1041
+ const city = this.cities.find((c) => String(c.id) === String(cityId));
1042
+ if (city) {
1043
+ this.selectedCity = city;
1044
+ this.updateNewAddressForm({ city_id: city.id, city });
1045
+ }
1046
+ }
1047
+ if (districtId != null && this.districts.length > 0) {
1048
+ const district = this.findPrefillDistrict(districtId);
1049
+ if (district) {
1050
+ this.selectedDistrict = district;
1051
+ this.updateNewAddressForm({
1052
+ district_id: district.id,
1053
+ district,
1054
+ });
1055
+ }
1056
+ }
764
1057
  }
765
1058
  async loadCities(countryId, regionId) {
766
1059
  this.loadingCities = true;
767
1060
  this.cities = [];
1061
+ this.displayedCities = [];
768
1062
  this.districts = [];
1063
+ this.displayedDistricts = [];
769
1064
  this.selectedCity = null;
770
1065
  this.selectedDistrict = null;
771
1066
  this.districtName = "";
772
1067
  try {
773
1068
  this.cities = await bulletDeliveryAPI.getCities(countryId, regionId);
1069
+ this.displayedCities = this.cities;
774
1070
  }
775
1071
  finally {
776
1072
  this.loadingCities = false;
@@ -779,10 +1075,12 @@ const SallaBulletDelivery = class {
779
1075
  async loadDistricts(cityId) {
780
1076
  this.loadingDistricts = true;
781
1077
  this.districts = [];
1078
+ this.displayedDistricts = [];
782
1079
  this.selectedDistrict = null;
783
1080
  this.districtName = "";
784
1081
  try {
785
1082
  this.districts = await bulletDeliveryAPI.getDistricts(cityId);
1083
+ this.displayedDistricts = this.districts;
786
1084
  }
787
1085
  finally {
788
1086
  this.loadingDistricts = false;
@@ -863,7 +1161,6 @@ const SallaBulletDelivery = class {
863
1161
  }
864
1162
  async loadSavedAddresses() {
865
1163
  this.savedAddresses = await bulletDeliveryAPI.getSavedAddresses();
866
- // If session address exists (guest intent before login), select it by default
867
1164
  const intent = this.getStoredIntent();
868
1165
  const hasSessionAddress = hasSessionAddressIntent(intent);
869
1166
  if (hasSessionAddress) {
@@ -871,13 +1168,11 @@ const SallaBulletDelivery = class {
871
1168
  this.selectedSavedAddress = null;
872
1169
  }
873
1170
  else {
874
- // Select default address if available and valid
875
1171
  const defaultAddress = this.savedAddresses.find((a) => a.is_default && a.is_in_coverage !== false);
876
1172
  if (defaultAddress) {
877
1173
  this.selectedSavedAddress = defaultAddress;
878
1174
  }
879
1175
  else {
880
- // Select first valid address
881
1176
  const validAddress = this.savedAddresses.find((a) => a.is_in_coverage !== false);
882
1177
  if (validAddress) {
883
1178
  this.selectedSavedAddress = validAddress;
@@ -889,12 +1184,22 @@ const SallaBulletDelivery = class {
889
1184
  this.selectedCountry = newCountry;
890
1185
  this.selectedRegion = null;
891
1186
  this.regions = [];
1187
+ this.displayedRegions = [];
892
1188
  this.cities = [];
1189
+ this.displayedCities = [];
893
1190
  this.districts = [];
1191
+ this.displayedDistricts = [];
894
1192
  this.selectedCity = null;
895
1193
  this.selectedDistrict = null;
896
1194
  this.districtName = "";
897
1195
  this.allocationOutOfCoverageMessage = null;
1196
+ this.regionSearchQuery = '';
1197
+ this.citySearchQuery = '';
1198
+ this.districtSearchQuery = '';
1199
+ this.searchingRegions = false;
1200
+ this.searchingCities = false;
1201
+ this.searchingDistricts = false;
1202
+ this.clearSearchTimers();
898
1203
  if (this.selectedCountry) {
899
1204
  this.updateNewAddressForm({
900
1205
  country_id: Number(this.selectedCountry.id),
@@ -918,14 +1223,18 @@ const SallaBulletDelivery = class {
918
1223
  async loadRegions(countryId) {
919
1224
  this.loadingRegions = true;
920
1225
  this.regions = [];
1226
+ this.displayedRegions = [];
921
1227
  this.selectedRegion = null;
922
1228
  this.cities = [];
1229
+ this.displayedCities = [];
923
1230
  this.districts = [];
1231
+ this.displayedDistricts = [];
924
1232
  this.selectedCity = null;
925
1233
  this.selectedDistrict = null;
926
1234
  this.districtName = "";
927
1235
  try {
928
1236
  this.regions = await bulletDeliveryAPI.getRegions(countryId);
1237
+ this.displayedRegions = this.regions;
929
1238
  }
930
1239
  finally {
931
1240
  this.loadingRegions = false;
@@ -1002,6 +1311,29 @@ const SallaBulletDelivery = class {
1002
1311
  }
1003
1312
  }, BRANCH_SEARCH_DEBOUNCE_MS);
1004
1313
  }
1314
+ clearSearchTimers() {
1315
+ [this.countrySearchTimer, this.regionSearchTimer, this.citySearchTimer, this.districtSearchTimer]
1316
+ .forEach(t => {
1317
+ if (t)
1318
+ clearTimeout(t);
1319
+ });
1320
+ this.countrySearchTimer = this.regionSearchTimer = this.citySearchTimer = this.districtSearchTimer = null;
1321
+ }
1322
+ resetSearchState() {
1323
+ this.countrySearchQuery = '';
1324
+ this.regionSearchQuery = '';
1325
+ this.citySearchQuery = '';
1326
+ this.districtSearchQuery = '';
1327
+ this.searchingCountries = false;
1328
+ this.searchingRegions = false;
1329
+ this.searchingCities = false;
1330
+ this.searchingDistricts = false;
1331
+ this.displayedCountries = [];
1332
+ this.displayedRegions = [];
1333
+ this.displayedCities = [];
1334
+ this.displayedDistricts = [];
1335
+ this.clearSearchTimers();
1336
+ }
1005
1337
  async loadBranchesWithLocation(lat, lng) {
1006
1338
  this.loadingBranches = true;
1007
1339
  try {
@@ -1126,14 +1458,26 @@ const SallaBulletDelivery = class {
1126
1458
  this.activeTab = tab;
1127
1459
  this.showCartWillBeClearedBanner = false;
1128
1460
  this.allocationOutOfCoverageMessage = null;
1129
- // Reload countries with for_branch=1 for pickup tab, for_branch=0 for delivery tab
1461
+ this.resetSearchState();
1130
1462
  const forBranch = tab === "branch";
1131
1463
  this.countries = await bulletDeliveryAPI.getCountries(forBranch);
1464
+ this.displayedCountries = this.countries;
1132
1465
  const previousCountryId = this.selectedCountry?.id;
1133
1466
  if (previousCountryId !== undefined && previousCountryId !== null) {
1134
1467
  this.selectedCountry =
1135
1468
  this.countries.find((c) => c.id === previousCountryId) || null;
1136
1469
  }
1470
+ // Fallback to IP-detected country when carry-over fails
1471
+ if (!this.selectedCountry) {
1472
+ const { countryId: configCountryId } = this.getIPLocationConfig();
1473
+ if (configCountryId && this.countries.length > 0) {
1474
+ this.selectedCountry =
1475
+ this.countries.find((c) => String(c.id) === String(configCountryId)) || null;
1476
+ }
1477
+ if (!this.selectedCountry && this.countries.length === 1) {
1478
+ this.selectedCountry = this.countries[0];
1479
+ }
1480
+ }
1137
1481
  // Load appropriate data when switching tabs if country is selected
1138
1482
  if (this.selectedCountry) {
1139
1483
  if (tab === "branch") {
@@ -1383,7 +1727,6 @@ const SallaBulletDelivery = class {
1383
1727
  (this.activeTab === "address"
1384
1728
  ? Salla.lang.get("pages.checkout.address_out_of_coverage")
1385
1729
  : Salla.lang.get("pages.checkout.failed_to_set_pickup"));
1386
- Salla.notify?.error(errorMessage);
1387
1730
  this.allocationOutOfCoverageMessage = errorMessage;
1388
1731
  this.confirmBtn?.stop();
1389
1732
  this.confirming = false;
@@ -1428,6 +1771,7 @@ const SallaBulletDelivery = class {
1428
1771
  this.setStoredIntent(result);
1429
1772
  if (allocatedScopeId) {
1430
1773
  await bulletDeliveryAPI.setDeliveryScope(allocatedScopeId);
1774
+ clearApiCache();
1431
1775
  }
1432
1776
  const allocationConfirmedPayload = {
1433
1777
  ...result,
@@ -1530,12 +1874,6 @@ const SallaBulletDelivery = class {
1530
1874
  wrapper.append(info, btn);
1531
1875
  return wrapper;
1532
1876
  }
1533
- renderSkeleton() {
1534
- return (h("div", { slot: "loading", class: "s-bullet-delivery-skeleton" }, h("div", { class: "s-bullet-delivery-skeleton-header" }, h("salla-skeleton", { class: "s-bullet-delivery-skeleton-title", height: "28px", width: "68%" }), h("salla-skeleton", { class: "s-bullet-delivery-skeleton-subtitle", height: "18px", width: "84%" })), h("div", { class: {
1535
- "s-bullet-delivery-skeleton-tabs": true,
1536
- "s-bullet-delivery-skeleton-tabs--single": !this.supportsPickup,
1537
- } }, h("div", { class: "s-bullet-delivery-skeleton-tab" }, h("salla-skeleton", { class: "s-bullet-delivery-skeleton-tab-icon", height: "32px", width: "32px" }), h("salla-skeleton", { class: "s-bullet-delivery-skeleton-tab-label", height: "18px", width: "92px" })), this.supportsPickup && (h("div", { class: "s-bullet-delivery-skeleton-tab" }, h("salla-skeleton", { class: "s-bullet-delivery-skeleton-tab-icon", height: "32px", width: "32px" }), h("salla-skeleton", { class: "s-bullet-delivery-skeleton-tab-label", height: "18px", width: "84px" })))), h("div", { class: "s-bullet-delivery-skeleton-content" }, h("div", { class: "s-bullet-delivery-skeleton-field" }, h("salla-skeleton", { class: "s-bullet-delivery-skeleton-field-label", height: "16px", width: "96px" }), h("salla-skeleton", { class: "s-bullet-delivery-skeleton-field-control", height: "56px", width: "100%" })), h("div", { class: "s-bullet-delivery-skeleton-field" }, h("salla-skeleton", { class: "s-bullet-delivery-skeleton-field-label", height: "16px", width: "104px" }), h("salla-skeleton", { class: "s-bullet-delivery-skeleton-field-control", height: "56px", width: "100%" })), h("div", { class: "s-bullet-delivery-skeleton-field" }, h("salla-skeleton", { class: "s-bullet-delivery-skeleton-field-label", height: "16px", width: "88px" }), h("salla-skeleton", { class: "s-bullet-delivery-skeleton-field-control", height: "56px", width: "100%" }))), h("div", { class: "s-bullet-delivery-skeleton-footer" }, h("salla-skeleton", { height: "52px", width: "100%" }))));
1538
- }
1539
1877
  renderTabs() {
1540
1878
  // Show tabs only when pickup is supported; otherwise delivery-only view with no tabs
1541
1879
  if (!this.supportsPickup)
@@ -1557,56 +1895,22 @@ const SallaBulletDelivery = class {
1557
1895
  return this.renderAlert(message);
1558
1896
  }
1559
1897
  renderCountrySelect() {
1560
- return (h("div", { class: "s-bullet-delivery-field" }, h("label", { class: "s-bullet-delivery-label", htmlFor: "bullet-delivery-country" }, Salla.lang.get("blocks.buy_as_gift.receiver_country"), h("span", { class: "text-red-500" }, " *")), h("select", { id: "bullet-delivery-country", class: "form-input", onChange: (e) => {
1561
- const select = e.target;
1562
- const countryId = Number.parseInt(select.value);
1563
- const country = this.countries.find((c) => c.id === countryId);
1564
- // A "switch" means the user already had a country and picked a different one
1565
- const isCountrySwitch = this.selectedCountry &&
1566
- country &&
1567
- this.selectedCountry.code !== country.code;
1568
- // Show the info banner whenever a country is changed to a different one
1569
- this.showCartWillBeClearedBanner = !!isCountrySwitch;
1570
- this.applyCountryChange(country || null);
1571
- } }, h("option", { value: "", disabled: true, selected: !this.selectedCountry }, Salla.lang.get("pages.checkout.select_country")), this.countries.map((country) => (h("option", { key: country.id, value: country.id, selected: this.selectedCountry?.id === country.id }, country.name))))));
1572
- }
1573
- renderSelectLoader() {
1574
- return (h("span", { class: "s-bullet-delivery-select-loader", "aria-hidden": "true" }, h("salla-skeleton", { height: "16px", width: "16px" })));
1575
- }
1576
- renderLoadingLabel(label, htmlFor, isLoading = false, isRequired = true) {
1577
- return (h("label", { class: "s-bullet-delivery-label", htmlFor: htmlFor }, h("span", { class: "s-bullet-delivery-label-content" }, h("span", null, label, isRequired && h("span", { class: "text-red-500" }, " *")), isLoading && this.renderSelectLoader())));
1898
+ return (h("div", { class: "s-bullet-delivery-field" }, h("salla-searchable-dropdown", { label: Salla.lang.get("blocks.buy_as_gift.receiver_country"), placeholder: Salla.lang.get("pages.checkout.select_country"), items: this.displayedCountries, selectedItem: this.selectedCountry, loading: this.loadingCountries, searching: this.searchingCountries, disabled: this.countries.length <= 1, required: true, inputId: "bullet-delivery-country", searchQuery: this.countrySearchQuery, clientSearch: true, onItemSelected: (e) => this.handleCountrySelected(e.detail), onSearchInput: (e) => this.handleCountrySearch(e.detail), onDropdownClosed: () => this.handleCountryDropdownClosed() })));
1578
1899
  }
1579
1900
  /** Region select (SA only): shown when SA is selected; city and district disabled until region selected. */
1580
1901
  renderRegionSelect() {
1581
1902
  const isSA = isSaudiArabia(this.selectedCountry?.code ?? '');
1582
1903
  if (!isSA || !this.selectedCountry)
1583
1904
  return null;
1584
- return (h("div", { class: "s-bullet-delivery-field" }, this.renderLoadingLabel(Salla.lang.get("pages.checkout.region_field"), "bullet-delivery-region", this.loadingRegions), h("select", { id: "bullet-delivery-region", class: "form-input", disabled: this.loadingRegions || this.regions.length === 0, onChange: (e) => {
1585
- const select = e.target;
1586
- const regionId = Number.parseInt(select.value);
1587
- const region = this.regions.find((r) => r.id === regionId);
1588
- this.selectedRegion = region || null;
1589
- this.updateNewAddressForm({
1590
- region_id: region?.id,
1591
- city_id: undefined,
1592
- district_id: undefined,
1593
- city: undefined,
1594
- district: undefined,
1595
- });
1596
- if (region && this.selectedCountry) {
1597
- this.loadCities(this.selectedCountry.id, region.id);
1598
- }
1599
- } }, h("option", { value: "", disabled: true, selected: !this.selectedRegion }, Salla.lang.get("pages.checkout.select_region")), this.regions.map((region) => (h("option", { key: region.id, value: region.id, selected: this.selectedRegion?.id === region.id }, region.name))))));
1905
+ return (h("div", { class: "s-bullet-delivery-field" }, 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() })));
1600
1906
  }
1601
1907
  renderCityDistrictSelects() {
1602
- // Guest form: region + district only for SA; other countries get country + city only
1603
1908
  const isSA = isSaudiArabia(this.selectedCountry?.code ?? '');
1604
1909
  const showDistrict = isSA;
1605
1910
  const showDistrictInput = showDistrict &&
1606
1911
  this.selectedCity &&
1607
1912
  !this.loadingDistricts &&
1608
1913
  this.districts.length === 0;
1609
- // For SA: city disabled until region selected; for non-SA: city disabled until country selected
1610
1914
  const cityDisabled = !this.selectedCountry ||
1611
1915
  (isSA && !this.selectedRegion) ||
1612
1916
  this.loadingCities ||
@@ -1615,39 +1919,11 @@ const SallaBulletDelivery = class {
1615
1919
  (isSA && !this.selectedRegion) ||
1616
1920
  !this.selectedCity ||
1617
1921
  this.loadingDistricts;
1618
- return (h("div", { class: "s-bullet-delivery-field-row" }, h("div", { class: "s-bullet-delivery-field" }, this.renderLoadingLabel(Salla.lang.get("blocks.buy_as_gift.receiver_city"), "bullet-delivery-city", this.loadingCities), h("select", { id: "bullet-delivery-city", class: "form-input", disabled: cityDisabled, onChange: (e) => {
1619
- const select = e.target;
1620
- const cityId = Number.parseInt(select.value);
1621
- const city = this.cities.find((c) => c.id === cityId);
1622
- this.selectedCity = city || null;
1623
- this.selectedDistrict = null;
1624
- this.districtName = "";
1625
- if (city) {
1626
- this.updateNewAddressForm({ city: city, district: undefined });
1627
- if (showDistrict) {
1628
- this.loadDistricts(city.id);
1629
- }
1630
- }
1631
- } }, h("option", { value: "", disabled: true, selected: !this.selectedCity }, Salla.lang.get("pages.checkout.select_city")), this.cities.map((city) => (h("option", { key: city.id, value: city.id, selected: this.selectedCity?.id === city.id }, city.name))))), showDistrict && (h("div", { class: "s-bullet-delivery-field" }, this.renderLoadingLabel(Salla.lang.get("pages.checkout.district_field"), "bullet-delivery-district", this.loadingDistricts && !showDistrictInput), showDistrictInput ? (h("input", { id: "bullet-delivery-district", type: "text", class: "form-input", placeholder: Salla.lang.get("pages.checkout.select_district"), value: this.districtName, disabled: districtDisabled, onInput: (e) => {
1922
+ return (h("div", { class: "s-bullet-delivery-field-row" }, h("div", { class: "s-bullet-delivery-field" }, h("salla-searchable-dropdown", { label: Salla.lang.get("blocks.buy_as_gift.receiver_city"), placeholder: Salla.lang.get("pages.checkout.select_city"), items: this.displayedCities, selectedItem: this.selectedCity, loading: this.loadingCities, searching: this.searchingCities, disabled: cityDisabled, required: true, inputId: "bullet-delivery-city", searchQuery: this.citySearchQuery, onItemSelected: (e) => this.handleCitySelected(e.detail), onSearchInput: (e) => this.handleCitySearch(e.detail), onDropdownClosed: () => this.handleCityDropdownClosed(), dropUp: true })), showDistrict && (h("div", { class: "s-bullet-delivery-field" }, showDistrictInput ? (h("div", null, h("label", { class: "s-bullet-delivery-label", htmlFor: "bullet-delivery-district" }, Salla.lang.get("pages.checkout.district_field"), h("span", { class: "text-red-500" }, " *")), h("input", { id: "bullet-delivery-district", type: "text", class: "form-input", placeholder: Salla.lang.get("pages.checkout.select_district"), value: this.districtName, disabled: districtDisabled, onInput: (e) => {
1632
1923
  const input = e.target;
1633
1924
  this.districtName = input.value;
1634
1925
  this.updateNewAddressForm({ district: undefined });
1635
- } })) : (h("select", { id: "bullet-delivery-district", class: "form-input", disabled: districtDisabled || this.districts.length === 0, onChange: (e) => {
1636
- const select = e.target;
1637
- const districtId = Number.parseInt(select.value);
1638
- const district = this.districts.find((d) => d.id === districtId);
1639
- this.selectedDistrict = district || null;
1640
- this.districtName = "";
1641
- if (district) {
1642
- this.updateNewAddressForm({ district });
1643
- }
1644
- } }, h("option", { value: "", disabled: true, selected: !this.selectedDistrict }, Salla.lang.get("pages.checkout.select_district")), this.districts.map((district) => {
1645
- const langCode = Salla.config.get("user.language_code");
1646
- const label = langCode === "ar"
1647
- ? district.name
1648
- : (district.name_en ?? district.name);
1649
- return (h("option", { key: district.id, value: district.id, selected: this.selectedDistrict?.id === district.id }, label));
1650
- })))))));
1926
+ } }))) : (h("salla-searchable-dropdown", { label: Salla.lang.get("pages.checkout.district_field"), placeholder: Salla.lang.get("pages.checkout.select_district"), items: this.displayedDistricts, selectedItem: this.selectedDistrict, loading: this.loadingDistricts, searching: this.searchingDistricts, disabled: districtDisabled || this.districts.length === 0, required: true, inputId: "bullet-delivery-district", searchQuery: this.districtSearchQuery, clientSearch: true, onItemSelected: (e) => this.handleDistrictSelected(e.detail), onSearchInput: (e) => this.handleDistrictSearch(e.detail), onDropdownClosed: () => this.handleDistrictDropdownClosed(), dropUp: true }))))));
1651
1927
  }
1652
1928
  renderSavedAddressesEmptyState() {
1653
1929
  return (h("div", { class: "s-bullet-delivery-saved-addresses-empty" }, h("div", { class: "s-bullet-delivery-saved-addresses-empty-icon", "aria-hidden": "true" }, h("svg", { width: "28", height: "28", viewBox: "0 0 28 29", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, h("title", null, "No Saved Adresses"), h("path", { d: "M20.16 0C21.4613 0 22.6773 0.341333 23.808 1.024C24.9387 1.70667 25.8347 2.61333 26.496 3.744C27.1787 4.91733 27.52 6.18667 27.52 7.552C27.52 9.45067 26.8267 11.232 25.44 12.896C24.4587 14.0907 23.0827 15.2427 21.312 16.352H21.28C20.9387 16.5653 20.5653 16.672 20.16 16.672C19.7547 16.672 19.3813 16.5653 19.04 16.352H19.008C17.2373 15.2213 15.8613 14.0693 14.88 12.896C13.4933 11.232 12.8 9.45067 12.8 7.552C12.8 6.18667 13.1413 4.91733 13.824 3.744C14.4853 2.61333 15.3813 1.70667 16.512 1.024C17.6427 0.341333 18.8587 0 20.16 0ZM11.488 1.984C9.67467 2.368 8.04267 3.14667 6.592 4.32C5.14133 5.49333 4.01067 6.92267 3.2 8.608C2.34667 10.3573 1.92 12.224 1.92 14.208C1.92 14.72 1.952 15.2427 2.016 15.776L2.08 15.744C2.57067 15.488 2.94933 15.3067 3.216 15.2C3.48267 15.0933 3.73867 15.0933 3.984 15.2C4.22933 15.3067 4.4 15.488 4.496 15.744C4.592 16 4.58667 16.256 4.48 16.512C4.37333 16.768 4.19733 16.9493 3.952 17.056C3.70667 17.1627 3.36 17.3227 2.912 17.536L2.656 17.664C2.57067 17.7067 2.48533 17.7387 2.4 17.76C2.89067 19.4667 3.70133 20.9973 4.832 22.352C5.96267 23.7067 7.296 24.7573 8.832 25.504C10.432 26.272 12.1173 26.656 13.888 26.656C15.4667 26.656 16.9813 26.3467 18.432 25.728C19.8187 25.1307 21.0667 24.288 22.176 23.2C21.92 23.0507 21.7653 22.8373 21.712 22.56C21.6587 22.2827 21.7013 22.0267 21.84 21.792C21.9787 21.5573 22.176 21.408 22.432 21.344C22.8373 21.2587 23.2 21.12 23.52 20.928C23.6907 20.8427 23.8613 20.8 24.032 20.8C24.8 19.5413 25.3333 18.176 25.632 16.704C25.6747 16.4267 25.808 16.2133 26.032 16.064C26.256 15.9147 26.496 15.8667 26.752 15.92C27.008 15.9733 27.2107 16.1173 27.36 16.352C27.5093 16.5867 27.552 16.832 27.488 17.088C27.0613 19.2853 26.1973 21.264 24.896 23.024C23.5947 24.784 22.0053 26.1547 20.128 27.136C18.1653 28.16 16.0853 28.672 13.888 28.672C11.3707 28.672 9.03467 28.0107 6.88 26.688C4.78933 25.408 3.12533 23.68 1.888 21.504C0.629333 19.264 0 16.832 0 14.208C0 11.904 0.490667 9.73867 1.472 7.712C2.41067 5.74933 3.728 4.09067 5.424 2.736C7.12 1.38133 9.01333 0.48 11.104 0.032C11.36 -0.032 11.6 0.0106667 11.824 0.16C12.048 0.309333 12.1867 0.522667 12.24 0.8C12.2933 1.07733 12.2453 1.328 12.096 1.552C11.9467 1.776 11.744 1.92 11.488 1.984ZM14.72 7.552C14.72 8.96 15.2533 10.304 16.32 11.584C17.1733 12.5867 18.3893 13.6 19.968 14.624C20.032 14.6453 20.096 14.656 20.16 14.656C20.224 14.656 20.288 14.6453 20.352 14.624C21.9307 13.6213 23.1467 12.608 24 11.584C25.0667 10.304 25.6 8.96 25.6 7.552C25.6 6.57067 25.3547 5.65333 24.864 4.8C24.3733 3.94667 23.7067 3.26933 22.864 2.768C22.0213 2.26667 21.12 2.016 20.16 2.016C19.2 2.016 18.2987 2.26667 17.456 2.768C16.6133 3.26933 15.9467 3.94667 15.456 4.8C14.9653 5.65333 14.72 6.57067 14.72 7.552ZM17.28 7.68C17.28 6.848 17.5627 6.13867 18.128 5.552C18.6933 4.96533 19.3707 4.672 20.16 4.672C20.9493 4.672 21.6267 4.96533 22.192 5.552C22.7573 6.13867 23.04 6.848 23.04 7.68C23.04 8.512 22.7573 9.216 22.192 9.792C21.6267 10.368 20.9493 10.656 20.16 10.656C19.3707 10.656 18.6933 10.368 18.128 9.792C17.5627 9.216 17.28 8.512 17.28 7.68ZM6.752 14.688C7.62667 14.7733 8.53333 15.0293 9.472 15.456C9.70667 15.5627 9.87733 15.744 9.984 16C10.0907 16.256 10.0907 16.512 9.984 16.768C9.87733 17.024 9.70133 17.2 9.456 17.296C9.21067 17.392 8.97067 17.3867 8.736 17.28C7.94667 16.9387 7.22133 16.736 6.56 16.672C6.28267 16.6293 6.064 16.5013 5.904 16.288C5.744 16.0747 5.68 15.8293 5.712 15.552C5.744 15.2747 5.86133 15.0507 6.064 14.88C6.26667 14.7093 6.496 14.6453 6.752 14.688ZM17.6 20.544C18.304 20.864 18.976 21.0987 19.616 21.248C19.872 21.312 20.0693 21.4613 20.208 21.696C20.3467 21.9307 20.3893 22.1813 20.336 22.448C20.2827 22.7147 20.144 22.9227 19.92 23.072C19.696 23.2213 19.4453 23.264 19.168 23.2C18.4213 23.0293 17.632 22.752 16.8 22.368C16.5653 22.2613 16.4 22.08 16.304 21.824C16.208 21.568 16.2133 21.312 16.32 21.056C16.4267 20.8 16.6027 20.624 16.848 20.528C17.0933 20.432 17.344 20.4373 17.6 20.544ZM12.832 17.44C13.0027 17.568 13.248 17.7493 13.568 17.984L14.496 18.688C14.7093 18.8587 14.8373 19.0773 14.88 19.344C14.9227 19.6107 14.8693 19.856 14.72 20.08C14.5707 20.304 14.368 20.4427 14.112 20.496C13.856 20.5493 13.6107 20.5013 13.376 20.352L11.744 19.072C11.5307 18.9227 11.4027 18.7093 11.36 18.432C11.3173 18.1547 11.3707 17.904 11.52 17.68C11.6693 17.456 11.872 17.3227 12.128 17.28C12.384 17.2373 12.6187 17.2907 12.832 17.44ZM20.16 8.672C20.416 8.672 20.64 8.576 20.832 8.384C21.024 8.192 21.12 7.95733 21.12 7.68C21.12 7.40267 21.024 7.16267 20.832 6.96C20.64 6.75733 20.416 6.656 20.16 6.656C19.904 6.656 19.68 6.75733 19.488 6.96C19.296 7.16267 19.2 7.40267 19.2 7.68C19.2 7.95733 19.296 8.192 19.488 8.384C19.68 8.576 19.904 8.672 20.16 8.672Z", fill: "#666666" }))), h("p", { class: "s-bullet-delivery-saved-addresses-empty-title" }, Salla.lang.get("pages.checkout.no_saved_addresses")), h("p", { class: "s-bullet-delivery-saved-addresses-empty-desc" }, Salla.lang.get("pages.checkout.add_address_simplify_shipping")), h("salla-button", { onClick: () => this.handleAddNewAddress(), onKeyUp: () => this.handleAddNewAddress() }, Salla.lang.get("pages.checkout.add_new_address"))));
@@ -1823,7 +2099,8 @@ const SallaBulletDelivery = class {
1823
2099
  const submitLabel = this.savingAddress
1824
2100
  ? Salla.lang.get("pages.checkout.loading")
1825
2101
  : Salla.lang.get("pages.checkout.confirm_address");
1826
- return (h("div", { class: "s-bullet-delivery-add-address" }, h("div", { class: "s-bullet-delivery-add-address-header" }, h("button", { type: "button", class: "s-bullet-delivery-add-address-title", onClick: () => this.handleBackToAddressList(), onKeyDown: (e) => e.key === "Enter" && this.handleBackToAddressList() }, h("span", { innerHTML: this.isRTL ? ArrowRightIcon : ArrowLeftIcon, "aria-hidden": "true" }), h("span", { class: "s-bullet-delivery-add-address-title-text" }, title))), h("form", { class: "s-bullet-delivery-add-address-form", onSubmit: (e) => this.handleSubmitAddAddress(e) }, this.renderGuestDeliveryForm(), h("div", { class: "s-bullet-delivery-form-actions s-bullet-delivery-form-actions--single" }, h("salla-button", { type: "submit", loading: this.savingAddress, disabled: !canSubmit || this.savingAddress, class: "s-bullet-delivery-add-address-submit" }, submitLabel)))));
2102
+ const hasAddressesToGoBack = this.savedAddresses.length > 0 || hasSessionAddressIntent(this.getStoredIntent());
2103
+ return (h("div", { class: "s-bullet-delivery-add-address" }, h("div", { class: "s-bullet-delivery-add-address-header" }, hasAddressesToGoBack ? (h("button", { type: "button", class: "s-bullet-delivery-add-address-title", onClick: () => this.handleBackToAddressList(), onKeyDown: (e) => e.key === "Enter" && this.handleBackToAddressList() }, h("span", { innerHTML: this.isRTL ? ArrowRightIcon : ArrowLeftIcon, "aria-hidden": "true" }), h("span", { class: "s-bullet-delivery-add-address-title-text" }, title))) : (h("span", { class: "s-bullet-delivery-add-address-title" }, h("span", { class: "s-bullet-delivery-add-address-title-text" }, title)))), h("form", { class: "s-bullet-delivery-add-address-form", onSubmit: (e) => this.handleSubmitAddAddress(e) }, this.renderGuestDeliveryForm(), h("div", { class: "s-bullet-delivery-form-actions s-bullet-delivery-form-actions--single" }, h("salla-button", { type: "submit", loading: this.savingAddress, disabled: !canSubmit || this.savingAddress, class: "s-bullet-delivery-add-address-submit" }, submitLabel)))));
1827
2104
  }
1828
2105
  renderFooter() {
1829
2106
  const showAddAddressInFooter = this.activeTab === "address" && this.isLoggedIn;
@@ -1966,9 +2243,9 @@ const SallaBulletDelivery = class {
1966
2243
  }
1967
2244
  }
1968
2245
  render() {
1969
- return (h(Host, { key: '8ca46eeae00aea840c260c599b10c7c544da1edc', class: "s-bullet-delivery" }, h("salla-modal", { key: '6197fa0b5f3d0a3479d37d9d54a2fe977a632215', ref: (modal) => {
2246
+ return (h(Host, { key: '0daead232faa6590712faef140ab694b3324960e', class: "s-bullet-delivery" }, h("salla-modal", { key: '4f318a88c10b524d5f6b71a46cb93535d4b25a82', ref: (modal) => {
1970
2247
  this.modal = modal;
1971
- }, isClosable: !this.isRequired && !this.shouldForceNonClosable(), class: "s-bullet-delivery-modal", isLoading: this.loading, width: "sm" }, this.loading ? (this.renderSkeleton()) : (h("div", { class: "s-bullet-delivery-inner" }, this.viewMode === "main" && this.renderMainView(), this.viewMode === "add-address" && this.renderAddAddressForm())))));
2248
+ }, isClosable: !this.isRequired && !this.shouldForceNonClosable(), class: "s-bullet-delivery-modal", width: "sm" }, h("div", { key: '66f3d844ce325e47bfb52f941c038339f3f0cf6c', class: "s-bullet-delivery-inner" }, this.viewMode === "main" && this.renderMainView(), this.viewMode === "add-address" && this.renderAddAddressForm()))));
1972
2249
  }
1973
2250
  componentDidLoad() {
1974
2251
  // Mark component as ready
@@ -2067,6 +2344,223 @@ SallaBulletDelivery.INITIAL_ADDRESS_FORM = {
2067
2344
  postal_code: undefined,
2068
2345
  description: undefined,
2069
2346
  };
2347
+ SallaBulletDelivery.DROPDOWN_SEARCH_DEBOUNCE_MS = 400;
2348
+ SallaBulletDelivery.DROPDOWN_SEARCH_MIN_CHARS = 2;
2070
2349
  SallaBulletDelivery.style = sallaBulletDeliveryCss;
2071
2350
 
2072
- export { SallaBulletDelivery as salla_bullet_delivery };
2351
+ const SallaSearchableDropdown = class {
2352
+ constructor(hostRef) {
2353
+ registerInstance(this, hostRef);
2354
+ this.itemSelected = createEvent(this, "itemSelected");
2355
+ this.searchInput = createEvent(this, "searchInput");
2356
+ this.dropdownOpened = createEvent(this, "dropdownOpened");
2357
+ this.dropdownClosed = createEvent(this, "dropdownClosed");
2358
+ this.placeholder = '';
2359
+ this.items = [];
2360
+ this.selectedItem = null;
2361
+ this.loading = false;
2362
+ this.searching = false;
2363
+ this.disabled = false;
2364
+ this.required = false;
2365
+ this.noResultsText = '';
2366
+ this.inputId = '';
2367
+ this.searchQuery = '';
2368
+ this.clientSearch = false;
2369
+ this.dropUp = false;
2370
+ this.isOpen = false;
2371
+ this.focusedIndex = -1;
2372
+ this.clientSearchQuery = '';
2373
+ this.scrollableAncestor = null;
2374
+ this.handleTriggerClick = () => {
2375
+ if (this.isOpen) {
2376
+ this.close();
2377
+ }
2378
+ else {
2379
+ this.open();
2380
+ }
2381
+ };
2382
+ this.handleTriggerKeyDown = (e) => {
2383
+ if (e.key === 'Enter' || e.key === ' ' || e.key === 'ArrowDown') {
2384
+ e.preventDefault();
2385
+ if (!this.isOpen)
2386
+ this.open();
2387
+ }
2388
+ else if (e.key === 'Escape') {
2389
+ this.close();
2390
+ }
2391
+ };
2392
+ this.handleSearchInputChange = (e) => {
2393
+ const value = e.target.value;
2394
+ if (this.clientSearch) {
2395
+ this.clientSearchQuery = value;
2396
+ }
2397
+ this.searchInput.emit(value);
2398
+ this.focusedIndex = -1;
2399
+ };
2400
+ this.handleSearchKeyDown = (e) => {
2401
+ const visibleItems = this.filteredItems;
2402
+ const itemCount = visibleItems.length;
2403
+ switch (e.key) {
2404
+ case 'ArrowDown':
2405
+ e.preventDefault();
2406
+ this.focusedIndex = itemCount > 0
2407
+ ? (this.focusedIndex + 1) % itemCount
2408
+ : -1;
2409
+ this.scrollFocusedIntoView();
2410
+ break;
2411
+ case 'ArrowUp':
2412
+ e.preventDefault();
2413
+ this.focusedIndex = itemCount > 0
2414
+ ? (this.focusedIndex - 1 + itemCount) % itemCount
2415
+ : -1;
2416
+ this.scrollFocusedIntoView();
2417
+ break;
2418
+ case 'Enter':
2419
+ e.preventDefault();
2420
+ if (this.focusedIndex >= 0 && this.focusedIndex < itemCount) {
2421
+ this.selectItem(visibleItems[this.focusedIndex]);
2422
+ }
2423
+ break;
2424
+ case 'Escape':
2425
+ e.preventDefault();
2426
+ this.close();
2427
+ break;
2428
+ }
2429
+ };
2430
+ }
2431
+ connectedCallback() {
2432
+ this.boundHandleClickOutside = this.handleClickOutside.bind(this);
2433
+ document.addEventListener('mousedown', this.boundHandleClickOutside);
2434
+ }
2435
+ disconnectedCallback() {
2436
+ document.removeEventListener('mousedown', this.boundHandleClickOutside);
2437
+ if (this.scrollableAncestor) {
2438
+ this.scrollableAncestor.style.overflow = '';
2439
+ this.scrollableAncestor = null;
2440
+ }
2441
+ }
2442
+ onItemsChange() {
2443
+ this.focusedIndex = -1;
2444
+ }
2445
+ normalizeArabic(text) {
2446
+ return text.replace(/[أإآا]/g, 'ا');
2447
+ }
2448
+ get filteredItems() {
2449
+ if (!this.clientSearch || !this.clientSearchQuery.trim()) {
2450
+ return this.items;
2451
+ }
2452
+ const query = this.normalizeArabic(this.clientSearchQuery.trim().toLowerCase());
2453
+ return this.items.filter(item => {
2454
+ const normalizedName = this.normalizeArabic(item.name.toLowerCase());
2455
+ const normalizedNameEn = item.name_en ? item.name_en.toLowerCase() : '';
2456
+ return normalizedName.includes(query) || normalizedNameEn.includes(query);
2457
+ });
2458
+ }
2459
+ getDisplayName(item) {
2460
+ const lang = salla?.config?.get('user.language_code');
2461
+ if (lang && lang !== 'ar' && item.name_en?.trim()) {
2462
+ return item.name_en.trim();
2463
+ }
2464
+ return item.name;
2465
+ }
2466
+ handleClickOutside(e) {
2467
+ if (!this.isOpen)
2468
+ return;
2469
+ const target = e.target;
2470
+ if (!this.host.contains(target)) {
2471
+ this.close();
2472
+ }
2473
+ }
2474
+ findScrollableAncestor() {
2475
+ let el = this.host.parentElement;
2476
+ while (el) {
2477
+ const style = getComputedStyle(el);
2478
+ const overflowY = style.overflowY;
2479
+ if (overflowY === 'auto' || overflowY === 'scroll' || overflowY === 'hidden' || style.overflow === 'clip') {
2480
+ return el;
2481
+ }
2482
+ el = el.parentElement;
2483
+ }
2484
+ return null;
2485
+ }
2486
+ open() {
2487
+ if (this.disabled || this.loading)
2488
+ return;
2489
+ this.isOpen = true;
2490
+ this.focusedIndex = -1;
2491
+ this.scrollableAncestor = this.findScrollableAncestor();
2492
+ if (this.scrollableAncestor) {
2493
+ this.scrollableAncestor.style.overflow = 'visible';
2494
+ }
2495
+ this.dropdownOpened.emit();
2496
+ requestAnimationFrame(() => this.searchInputRef?.focus());
2497
+ }
2498
+ close() {
2499
+ if (!this.isOpen)
2500
+ return;
2501
+ this.isOpen = false;
2502
+ this.focusedIndex = -1;
2503
+ this.clientSearchQuery = '';
2504
+ if (this.scrollableAncestor) {
2505
+ this.scrollableAncestor.style.overflow = '';
2506
+ this.scrollableAncestor = null;
2507
+ }
2508
+ this.dropdownClosed.emit();
2509
+ }
2510
+ scrollFocusedIntoView() {
2511
+ if (this.focusedIndex < 0)
2512
+ return;
2513
+ requestAnimationFrame(() => {
2514
+ const listEl = this.panelRef?.querySelector('.s-searchable-dropdown-list');
2515
+ const focused = listEl?.children[this.focusedIndex];
2516
+ focused?.scrollIntoView({ block: 'nearest' });
2517
+ });
2518
+ }
2519
+ selectItem(item) {
2520
+ this.itemSelected.emit(item);
2521
+ this.close();
2522
+ }
2523
+ render() {
2524
+ const hasSelection = this.selectedItem != null;
2525
+ const listboxId = `${this.inputId}-listbox`;
2526
+ return (h(Host, { key: '1e413d4391362f274223724ab37f5842a196f936', class: "s-searchable-dropdown" }, h("div", { key: 'c1c0b595a458db8918bc7c72b949cd514d764613', class: { 's-searchable-dropdown': true, 's-searchable-dropdown--open': this.isOpen } }, this.label && (h("label", { key: '576831e0383f561d5512792cb52d1c6d40156015', class: "s-searchable-dropdown-label", htmlFor: this.inputId }, this.label, this.required && h("span", { key: '290e1edb52971f5af6c6555f82ad595e97c9994d', class: "s-searchable-dropdown-required" }, " *"))), h("div", { key: 'e3c9aaea5697839e67aab1b91d07cb825ee76c7b', class: {
2527
+ 's-searchable-dropdown-trigger': true,
2528
+ 's-searchable-dropdown-trigger--disabled': this.disabled || this.loading,
2529
+ 's-searchable-dropdown-trigger--open': this.isOpen,
2530
+ }, role: "combobox", "aria-expanded": this.isOpen ? 'true' : 'false', "aria-haspopup": "listbox", "aria-controls": listboxId, "aria-disabled": this.disabled || this.loading ? 'true' : 'false', tabIndex: this.disabled || this.loading ? -1 : 0, onClick: this.handleTriggerClick, onKeyDown: this.handleTriggerKeyDown }, hasSelection ? (h("span", { class: "s-searchable-dropdown-trigger-text" }, this.getDisplayName(this.selectedItem))) : (h("span", { class: "s-searchable-dropdown-trigger-placeholder" }, this.placeholder)), h("i", { key: 'f1e95e38ebffc358a9045f0fd38dd205eb2a14bb', class: {
2531
+ 'sicon-keyboard_arrow_down': true,
2532
+ 's-searchable-dropdown-trigger-icon': true,
2533
+ 's-searchable-dropdown-trigger-icon--open': this.isOpen,
2534
+ }, "aria-hidden": "true" })), this.isOpen && (h("div", { key: 'a5c6b4650d8de5467c1d53e67700168a0795ff0b', class: {
2535
+ 's-searchable-dropdown-panel': true,
2536
+ 's-searchable-dropdown-panel--up': this.dropUp,
2537
+ }, ref: (el) => (this.panelRef = el) }, h("div", { key: '5ddf73d6d8cb96881ac6f94ef25a9f58b883a6c0', class: "s-searchable-dropdown-search-wrap" }, h("i", { key: 'ec52897c25962c6d1e84986f25bdac2dd8ecdac0', class: "sicon-search s-searchable-dropdown-search-icon", "aria-hidden": "true" }), h("input", { key: 'e14dd7a0dae605dd37782cdd8c235e875105fcc9', ref: (el) => (this.searchInputRef = el), id: this.inputId, type: "text", class: "s-searchable-dropdown-search-input", placeholder: this.placeholder, value: this.clientSearch ? this.clientSearchQuery : this.searchQuery, onInput: this.handleSearchInputChange, onKeyDown: this.handleSearchKeyDown, autocomplete: "off", "aria-autocomplete": "list", "aria-expanded": this.isOpen ? 'true' : 'false', "aria-controls": listboxId })), h("div", { key: '80daad72643001e400a9ff43444bbad5077ffa2d', id: listboxId, class: "s-searchable-dropdown-list s-scrollbar", role: "listbox" }, this.renderListContent()))))));
2538
+ }
2539
+ renderListContent() {
2540
+ if (this.searching || this.loading) {
2541
+ return (h("div", { class: "s-searchable-dropdown-loading" }, h("svg", { class: "s-searchable-dropdown-spinner", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, h("circle", { cx: "12", cy: "12", r: "10", stroke: "currentColor", "stroke-width": "3", "stroke-linecap": "round", opacity: "0.25" }), h("path", { d: "M12 2a10 10 0 0 1 10 10", stroke: "currentColor", "stroke-width": "3", "stroke-linecap": "round" }))));
2542
+ }
2543
+ const visibleItems = this.filteredItems;
2544
+ if (visibleItems.length === 0) {
2545
+ return (h("div", { class: "s-searchable-dropdown-empty" }, this.noResultsText || salla?.lang?.get('common.elements.no_options') || 'No results found'));
2546
+ }
2547
+ return visibleItems.map((item, index) => {
2548
+ const isSelected = this.selectedItem?.id === item.id;
2549
+ const isFocused = this.focusedIndex === index;
2550
+ return (h("button", { key: item.id, type: "button", role: "option", class: {
2551
+ 's-searchable-dropdown-item': true,
2552
+ 's-searchable-dropdown-item--selected': isSelected,
2553
+ 's-searchable-dropdown-item--focused': isFocused && !isSelected,
2554
+ }, "aria-selected": isSelected ? 'true' : 'false', onClick: () => this.selectItem(item) }, h("span", { class: {
2555
+ 's-searchable-dropdown-item-name': true,
2556
+ 's-searchable-dropdown-item-name--selected': isSelected,
2557
+ } }, this.getDisplayName(item)), isSelected && (h("i", { class: "sicon-check s-searchable-dropdown-item-check", "aria-hidden": "true" }))));
2558
+ });
2559
+ }
2560
+ get host() { return getElement(this); }
2561
+ static get watchers() { return {
2562
+ "items": ["onItemsChange"]
2563
+ }; }
2564
+ };
2565
+
2566
+ export { SallaBulletDelivery as salla_bullet_delivery, SallaSearchableDropdown as salla_searchable_dropdown };