@salla.sa/twilight-components 3.0.17 → 3.0.18

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 (388) hide show
  1. package/dist/cjs/{Helper-DSYelC4c.js → Helper-D2VNt6eb.js} +1 -1
  2. package/dist/cjs/{filepond-l9D0Yv7b.js → filepond-DkCudLhG.js} +1 -1
  3. package/dist/cjs/{filepond-plugin-file-poster-8SrbLptI.js → filepond-plugin-file-poster-C-uxFWfW.js} +1 -1
  4. package/dist/cjs/{filepond-plugin-file-validate-size-DGD6oJy0.js → filepond-plugin-file-validate-size-BikXTQW2.js} +1 -1
  5. package/dist/cjs/{filepond-plugin-file-validate-type-BIvrhp3w.js → filepond-plugin-file-validate-type-Drs7PouU.js} +1 -1
  6. package/dist/cjs/{filepond-plugin-image-edit-4xKikdXG.js → filepond-plugin-image-edit-hxr0h9kt.js} +1 -1
  7. package/dist/cjs/{filepond-plugin-image-exif-orientation-C3BvwxQh.js → filepond-plugin-image-exif-orientation-CVZmWU_4.js} +1 -1
  8. package/dist/cjs/{filepond-plugin-image-preview-CBq_GY0V.js → filepond-plugin-image-preview-CBjPKx-d.js} +1 -1
  9. package/dist/cjs/free-shipping-timer-6QBe5BNS.js +156 -0
  10. package/dist/cjs/{index-BAwxpXnB.js → index-CTYg2zC6.js} +2 -2
  11. package/dist/cjs/{intlTelInput-xw-HaAEN.js → intlTelInput-C9X0hKXV.js} +1 -1
  12. package/dist/cjs/loader.cjs.js +2 -2
  13. package/dist/cjs/salla-accordion-body_2.cjs.entry.js +1 -1
  14. package/dist/cjs/salla-accordion_6.cjs.entry.js +2 -2
  15. package/dist/cjs/salla-add-product-button_5.cjs.entry.js +2 -2
  16. package/dist/cjs/salla-advertisement.cjs.entry.js +1 -1
  17. package/dist/cjs/salla-alert_2.cjs.entry.js +1 -1
  18. package/dist/cjs/salla-app-install-alert.cjs.entry.js +1 -1
  19. package/dist/cjs/salla-applied-filters.cjs.entry.js +2 -2
  20. package/dist/cjs/salla-apps-icons.cjs.entry.js +1 -1
  21. package/dist/cjs/salla-attachment-view_9.cjs.entry.js +11 -11
  22. package/dist/cjs/salla-badge.cjs.entry.js +1 -1
  23. package/dist/cjs/salla-basket-gap.cjs.entry.js +1 -1
  24. package/dist/cjs/salla-bullet-delivery_3.cjs.entry.js +166 -16
  25. package/dist/cjs/salla-cart-coupons.cjs.entry.js +1 -1
  26. package/dist/cjs/salla-cart-item-offers_2.cjs.entry.js +1 -1
  27. package/dist/cjs/salla-cart-summary-card.cjs.entry.js +1 -1
  28. package/dist/cjs/salla-cashback-banner.cjs.entry.js +1 -1
  29. package/dist/cjs/salla-comment-factors.cjs.entry.js +1 -1
  30. package/dist/cjs/salla-comment-form_9.cjs.entry.js +2 -2
  31. package/dist/cjs/salla-conditional-offer.cjs.entry.js +1 -1
  32. package/dist/cjs/salla-contacts.cjs.entry.js +1 -1
  33. package/dist/cjs/salla-cookies-bar.cjs.entry.js +1 -1
  34. package/dist/cjs/salla-count-down.cjs.entry.js +1 -1
  35. package/dist/cjs/salla-custom-fields.cjs.entry.js +1 -1
  36. package/dist/cjs/salla-delivery-promise.cjs.entry.js +1 -1
  37. package/dist/cjs/salla-edit-order-button.cjs.entry.js +1 -1
  38. package/dist/cjs/salla-filters-widget.cjs.entry.js +2 -2
  39. package/dist/cjs/salla-filters.cjs.entry.js +2 -2
  40. package/dist/cjs/salla-free-shipping-banner.cjs.entry.js +95 -9
  41. package/dist/cjs/salla-free-shipping-tag.cjs.entry.js +18 -5
  42. package/dist/cjs/salla-fulfillment-methods.cjs.entry.js +1 -1
  43. package/dist/cjs/salla-gift-card-redeem_2.cjs.entry.js +1 -1
  44. package/dist/cjs/salla-gifting.cjs.entry.js +13 -6
  45. package/dist/cjs/salla-hook.cjs.entry.js +1 -1
  46. package/dist/cjs/salla-infinite-scroll.cjs.entry.js +2 -2
  47. package/dist/cjs/salla-installment.cjs.entry.js +1 -1
  48. package/dist/cjs/salla-list-tile.cjs.entry.js +1 -1
  49. package/dist/cjs/salla-localization-modal.cjs.entry.js +1 -1
  50. package/dist/cjs/salla-login-modal.cjs.entry.js +1 -1
  51. package/dist/cjs/salla-loyalty-banner_10.cjs.entry.js +1 -1
  52. package/dist/cjs/salla-loyalty-exchange-product-card.cjs.entry.js +1 -1
  53. package/dist/cjs/salla-loyalty-points-banner.cjs.entry.js +1 -1
  54. package/dist/cjs/salla-loyalty-points-history.cjs.entry.js +1 -1
  55. package/dist/cjs/salla-loyalty-prize-item.cjs.entry.js +1 -1
  56. package/dist/cjs/salla-loyalty.cjs.entry.js +1 -1
  57. package/dist/cjs/salla-maintenance-alert.cjs.entry.js +1 -1
  58. package/dist/cjs/salla-map_3.cjs.entry.js +1 -1
  59. package/dist/cjs/salla-menu.cjs.entry.js +1 -1
  60. package/dist/cjs/salla-metadata.cjs.entry.js +1 -1
  61. package/dist/cjs/salla-multiple-bundle-product-cart_2.cjs.entry.js +1 -1
  62. package/dist/cjs/salla-multiple-bundle-product-options-modal_2.cjs.entry.js +1 -1
  63. package/dist/cjs/salla-multiple-bundle-product.cjs.entry.js +1 -1
  64. package/dist/cjs/salla-next-order-coupon.cjs.entry.js +1 -1
  65. package/dist/cjs/salla-notification-item_2.cjs.entry.js +2 -2
  66. package/dist/cjs/salla-offer-modal.cjs.entry.js +1 -1
  67. package/dist/cjs/salla-offer.cjs.entry.js +1 -1
  68. package/dist/cjs/salla-order-branch.cjs.entry.js +1 -1
  69. package/dist/cjs/salla-order-cancel.cjs.entry.js +1 -1
  70. package/dist/cjs/salla-order-details-multiple-bundle-product.cjs.entry.js +1 -1
  71. package/dist/cjs/salla-order-details-options.cjs.entry.js +1 -1
  72. package/dist/cjs/salla-order-details.cjs.entry.js +1 -1
  73. package/dist/cjs/salla-order-edit-item.cjs.entry.js +1 -1
  74. package/dist/cjs/salla-order-edit-product-card.cjs.entry.js +1 -1
  75. package/dist/cjs/salla-order-edit.cjs.entry.js +1 -1
  76. package/dist/cjs/salla-order-items.cjs.entry.js +1 -1
  77. package/dist/cjs/salla-order-options-modal.cjs.entry.js +1 -1
  78. package/dist/cjs/salla-order-payment.cjs.entry.js +1 -1
  79. package/dist/cjs/salla-order-rewards.cjs.entry.js +1 -1
  80. package/dist/cjs/salla-order-shipments.cjs.entry.js +1 -1
  81. package/dist/cjs/salla-order-summary.cjs.entry.js +1 -1
  82. package/dist/cjs/salla-order-totals-card.cjs.entry.js +1 -1
  83. package/dist/cjs/salla-orders.cjs.entry.js +2 -2
  84. package/dist/cjs/salla-payments.cjs.entry.js +1 -1
  85. package/dist/cjs/salla-placeholder.cjs.entry.js +1 -1
  86. package/dist/cjs/salla-price-range.cjs.entry.js +1 -1
  87. package/dist/cjs/salla-product-card-embed.cjs.entry.js +1 -1
  88. package/dist/cjs/salla-product-card.cjs.entry.js +1 -1
  89. package/dist/cjs/salla-product-size-guide.cjs.entry.js +1 -1
  90. package/dist/cjs/salla-products-list.cjs.entry.js +6 -5
  91. package/dist/cjs/salla-products-slider.cjs.entry.js +2 -2
  92. package/dist/cjs/salla-quick-order.cjs.entry.js +1 -1
  93. package/dist/cjs/salla-rating-modal-v2.cjs.entry.js +7 -4
  94. package/dist/cjs/salla-rating-modal.cjs.entry.js +2 -2
  95. package/dist/cjs/salla-review-factors-tags.cjs.entry.js +1 -1
  96. package/dist/cjs/salla-review-order-item.cjs.entry.js +1 -1
  97. package/dist/cjs/salla-scopes.cjs.entry.js +1 -1
  98. package/dist/cjs/salla-search-product-card.cjs.entry.js +1 -1
  99. package/dist/cjs/salla-search.cjs.entry.js +2 -2
  100. package/dist/cjs/salla-skeleton.cjs.entry.js +1 -1
  101. package/dist/cjs/salla-social-share.cjs.entry.js +1 -1
  102. package/dist/cjs/salla-social.cjs.entry.js +1 -1
  103. package/dist/cjs/salla-tab-content_3.cjs.entry.js +1 -1
  104. package/dist/cjs/salla-thank-you-header.cjs.entry.js +1 -1
  105. package/dist/cjs/salla-thank-you-page.cjs.entry.js +1 -1
  106. package/dist/cjs/salla-tiered-offer.cjs.entry.js +1 -1
  107. package/dist/cjs/salla-trust-badges.cjs.entry.js +1 -1
  108. package/dist/cjs/salla-user-menu.cjs.entry.js +1 -1
  109. package/dist/cjs/salla-user-profile.cjs.entry.js +1 -1
  110. package/dist/cjs/salla-user-settings.cjs.entry.js +1 -1
  111. package/dist/cjs/salla-verify.cjs.entry.js +1 -1
  112. package/dist/cjs/salla-wallet.cjs.entry.js +1 -1
  113. package/dist/cjs/salla-wishlist-actions.cjs.entry.js +1 -1
  114. package/dist/cjs/salla-wishlist-summary.cjs.entry.js +2 -2
  115. package/dist/cjs/twilight.cjs.js +2 -2
  116. package/dist/cjs/{vanilla-picker-Cm_uNdps.js → vanilla-picker-BsLm8rHT.js} +1 -1
  117. package/dist/collection/components/salla-bullet-delivery/salla-bullet-delivery.js +72 -16
  118. package/dist/collection/components/salla-bullet-delivery/selector-tracker.js +106 -0
  119. package/dist/collection/components/salla-free-shipping-banner/salla-free-shipping-banner.css +18 -4
  120. package/dist/collection/components/salla-free-shipping-banner/salla-free-shipping-banner.js +94 -11
  121. package/dist/collection/components/salla-free-shipping-tag/salla-free-shipping-tag.css +6 -0
  122. package/dist/collection/components/salla-free-shipping-tag/salla-free-shipping-tag.js +18 -2
  123. package/dist/collection/components/salla-gifting/salla-gifting.css +16 -1
  124. package/dist/collection/components/salla-gifting/salla-gifting.js +11 -4
  125. package/dist/collection/components/salla-products-list/salla-products-list.js +4 -3
  126. package/dist/collection/components/salla-rating-modal/salla-rating-modal-v2.js +5 -2
  127. package/dist/collection/shared/free-shipping-timer.js +130 -0
  128. package/dist/components/free-shipping-timer.js +150 -0
  129. package/dist/components/index.js +2 -2
  130. package/dist/components/salla-bullet-delivery.js +165 -15
  131. package/dist/components/salla-free-shipping-banner.js +95 -8
  132. package/dist/components/salla-free-shipping-tag.js +17 -3
  133. package/dist/components/salla-gifting.js +12 -5
  134. package/dist/components/salla-products-list2.js +4 -3
  135. package/dist/components/salla-rating-modal-v22.js +5 -2
  136. package/dist/docs.json +25 -5
  137. package/dist/esm/{Helper-POCi7J93.js → Helper-C1T-oD4J.js} +1 -1
  138. package/dist/esm/{filepond-Ct76xW02.js → filepond-BoWJzHeN.js} +1 -1
  139. package/dist/esm/{filepond-plugin-file-poster-C1OkzGRs.js → filepond-plugin-file-poster-B6MkMtuC.js} +1 -1
  140. package/dist/esm/{filepond-plugin-file-validate-size-gdd-69cO.js → filepond-plugin-file-validate-size-Dds_462B.js} +1 -1
  141. package/dist/esm/{filepond-plugin-file-validate-type-BaZ2QTzl.js → filepond-plugin-file-validate-type-DrfGXNay.js} +1 -1
  142. package/dist/esm/{filepond-plugin-image-edit-CsoNvf0i.js → filepond-plugin-image-edit-CN7eGg-7.js} +1 -1
  143. package/dist/esm/{filepond-plugin-image-exif-orientation-BHDSe3nH.js → filepond-plugin-image-exif-orientation-CyhxK_6R.js} +1 -1
  144. package/dist/esm/{filepond-plugin-image-preview-CD_S17z3.js → filepond-plugin-image-preview-DdKqAzT9.js} +1 -1
  145. package/dist/esm/free-shipping-timer-CnTwkF6y.js +150 -0
  146. package/dist/esm/{index-DmGAR42j.js → index-DgUQRYr2.js} +2 -2
  147. package/dist/esm/{intlTelInput-D76Q4XFx.js → intlTelInput-SwlavcFB.js} +1 -1
  148. package/dist/esm/loader.js +3 -3
  149. package/dist/esm/salla-accordion-body_2.entry.js +1 -1
  150. package/dist/esm/salla-accordion_6.entry.js +2 -2
  151. package/dist/esm/salla-add-product-button_5.entry.js +2 -2
  152. package/dist/esm/salla-advertisement.entry.js +1 -1
  153. package/dist/esm/salla-alert_2.entry.js +1 -1
  154. package/dist/esm/salla-app-install-alert.entry.js +1 -1
  155. package/dist/esm/salla-applied-filters.entry.js +2 -2
  156. package/dist/esm/salla-apps-icons.entry.js +1 -1
  157. package/dist/esm/salla-attachment-view_9.entry.js +11 -11
  158. package/dist/esm/salla-badge.entry.js +1 -1
  159. package/dist/esm/salla-basket-gap.entry.js +1 -1
  160. package/dist/esm/salla-bullet-delivery_3.entry.js +166 -16
  161. package/dist/esm/salla-cart-coupons.entry.js +1 -1
  162. package/dist/esm/salla-cart-item-offers_2.entry.js +1 -1
  163. package/dist/esm/salla-cart-summary-card.entry.js +1 -1
  164. package/dist/esm/salla-cashback-banner.entry.js +1 -1
  165. package/dist/esm/salla-comment-factors.entry.js +1 -1
  166. package/dist/esm/salla-comment-form_9.entry.js +2 -2
  167. package/dist/esm/salla-conditional-offer.entry.js +1 -1
  168. package/dist/esm/salla-contacts.entry.js +1 -1
  169. package/dist/esm/salla-cookies-bar.entry.js +1 -1
  170. package/dist/esm/salla-count-down.entry.js +1 -1
  171. package/dist/esm/salla-custom-fields.entry.js +1 -1
  172. package/dist/esm/salla-delivery-promise.entry.js +1 -1
  173. package/dist/esm/salla-edit-order-button.entry.js +1 -1
  174. package/dist/esm/salla-filters-widget.entry.js +2 -2
  175. package/dist/esm/salla-filters.entry.js +2 -2
  176. package/dist/esm/salla-free-shipping-banner.entry.js +94 -8
  177. package/dist/esm/salla-free-shipping-tag.entry.js +17 -4
  178. package/dist/esm/salla-fulfillment-methods.entry.js +1 -1
  179. package/dist/esm/salla-gift-card-redeem_2.entry.js +1 -1
  180. package/dist/esm/salla-gifting.entry.js +13 -6
  181. package/dist/esm/salla-hook.entry.js +1 -1
  182. package/dist/esm/salla-infinite-scroll.entry.js +2 -2
  183. package/dist/esm/salla-installment.entry.js +1 -1
  184. package/dist/esm/salla-list-tile.entry.js +1 -1
  185. package/dist/esm/salla-localization-modal.entry.js +1 -1
  186. package/dist/esm/salla-login-modal.entry.js +1 -1
  187. package/dist/esm/salla-loyalty-banner_10.entry.js +1 -1
  188. package/dist/esm/salla-loyalty-exchange-product-card.entry.js +1 -1
  189. package/dist/esm/salla-loyalty-points-banner.entry.js +1 -1
  190. package/dist/esm/salla-loyalty-points-history.entry.js +1 -1
  191. package/dist/esm/salla-loyalty-prize-item.entry.js +1 -1
  192. package/dist/esm/salla-loyalty.entry.js +1 -1
  193. package/dist/esm/salla-maintenance-alert.entry.js +1 -1
  194. package/dist/esm/salla-map_3.entry.js +1 -1
  195. package/dist/esm/salla-menu.entry.js +1 -1
  196. package/dist/esm/salla-metadata.entry.js +1 -1
  197. package/dist/esm/salla-multiple-bundle-product-cart_2.entry.js +1 -1
  198. package/dist/esm/salla-multiple-bundle-product-options-modal_2.entry.js +1 -1
  199. package/dist/esm/salla-multiple-bundle-product.entry.js +1 -1
  200. package/dist/esm/salla-next-order-coupon.entry.js +1 -1
  201. package/dist/esm/salla-notification-item_2.entry.js +2 -2
  202. package/dist/esm/salla-offer-modal.entry.js +1 -1
  203. package/dist/esm/salla-offer.entry.js +1 -1
  204. package/dist/esm/salla-order-branch.entry.js +1 -1
  205. package/dist/esm/salla-order-cancel.entry.js +1 -1
  206. package/dist/esm/salla-order-details-multiple-bundle-product.entry.js +1 -1
  207. package/dist/esm/salla-order-details-options.entry.js +1 -1
  208. package/dist/esm/salla-order-details.entry.js +1 -1
  209. package/dist/esm/salla-order-edit-item.entry.js +1 -1
  210. package/dist/esm/salla-order-edit-product-card.entry.js +1 -1
  211. package/dist/esm/salla-order-edit.entry.js +1 -1
  212. package/dist/esm/salla-order-items.entry.js +1 -1
  213. package/dist/esm/salla-order-options-modal.entry.js +1 -1
  214. package/dist/esm/salla-order-payment.entry.js +1 -1
  215. package/dist/esm/salla-order-rewards.entry.js +1 -1
  216. package/dist/esm/salla-order-shipments.entry.js +1 -1
  217. package/dist/esm/salla-order-summary.entry.js +1 -1
  218. package/dist/esm/salla-order-totals-card.entry.js +1 -1
  219. package/dist/esm/salla-orders.entry.js +2 -2
  220. package/dist/esm/salla-payments.entry.js +1 -1
  221. package/dist/esm/salla-placeholder.entry.js +1 -1
  222. package/dist/esm/salla-price-range.entry.js +1 -1
  223. package/dist/esm/salla-product-card-embed.entry.js +1 -1
  224. package/dist/esm/salla-product-card.entry.js +1 -1
  225. package/dist/esm/salla-product-size-guide.entry.js +1 -1
  226. package/dist/esm/salla-products-list.entry.js +6 -5
  227. package/dist/esm/salla-products-slider.entry.js +2 -2
  228. package/dist/esm/salla-quick-order.entry.js +1 -1
  229. package/dist/esm/salla-rating-modal-v2.entry.js +7 -4
  230. package/dist/esm/salla-rating-modal.entry.js +2 -2
  231. package/dist/esm/salla-review-factors-tags.entry.js +1 -1
  232. package/dist/esm/salla-review-order-item.entry.js +1 -1
  233. package/dist/esm/salla-scopes.entry.js +1 -1
  234. package/dist/esm/salla-search-product-card.entry.js +1 -1
  235. package/dist/esm/salla-search.entry.js +2 -2
  236. package/dist/esm/salla-skeleton.entry.js +1 -1
  237. package/dist/esm/salla-social-share.entry.js +1 -1
  238. package/dist/esm/salla-social.entry.js +1 -1
  239. package/dist/esm/salla-tab-content_3.entry.js +1 -1
  240. package/dist/esm/salla-thank-you-header.entry.js +1 -1
  241. package/dist/esm/salla-thank-you-page.entry.js +1 -1
  242. package/dist/esm/salla-tiered-offer.entry.js +1 -1
  243. package/dist/esm/salla-trust-badges.entry.js +1 -1
  244. package/dist/esm/salla-user-menu.entry.js +1 -1
  245. package/dist/esm/salla-user-profile.entry.js +1 -1
  246. package/dist/esm/salla-user-settings.entry.js +1 -1
  247. package/dist/esm/salla-verify.entry.js +1 -1
  248. package/dist/esm/salla-wallet.entry.js +1 -1
  249. package/dist/esm/salla-wishlist-actions.entry.js +1 -1
  250. package/dist/esm/salla-wishlist-summary.entry.js +2 -2
  251. package/dist/esm/twilight.js +3 -3
  252. package/dist/esm/{vanilla-picker-BlIXJyvJ.js → vanilla-picker-Buy50D7t.js} +1 -1
  253. package/dist/twilight/{p-4702959a.entry.js → p-027cbda6.entry.js} +1 -1
  254. package/dist/twilight/{p-e89a1905.entry.js → p-0418c2df.entry.js} +1 -1
  255. package/dist/twilight/{p-6757344a.entry.js → p-071aa0e7.entry.js} +1 -1
  256. package/dist/twilight/{p-a53e2c74.entry.js → p-08a15c81.entry.js} +1 -1
  257. package/dist/twilight/{p-acd48ae7.entry.js → p-0ba159db.entry.js} +1 -1
  258. package/dist/twilight/{p-a17784e6.entry.js → p-0d795b58.entry.js} +1 -1
  259. package/dist/twilight/{p-e81c4521.entry.js → p-0f25fedd.entry.js} +1 -1
  260. package/dist/twilight/{p-26fec98c.entry.js → p-12a25415.entry.js} +1 -1
  261. package/dist/twilight/p-1960020c.entry.js +4 -0
  262. package/dist/twilight/{p-b38c38fe.entry.js → p-1af9db24.entry.js} +1 -1
  263. package/dist/twilight/{p-24423a8d.entry.js → p-23772523.entry.js} +1 -1
  264. package/dist/twilight/{p-1982520c.entry.js → p-254cff9a.entry.js} +1 -1
  265. package/dist/twilight/{p-0225f396.entry.js → p-259c995a.entry.js} +1 -1
  266. package/dist/twilight/{p-7df4ee74.entry.js → p-26d2b28a.entry.js} +1 -1
  267. package/dist/twilight/{p-7a985c8c.entry.js → p-34148827.entry.js} +1 -1
  268. package/dist/twilight/{p-a5d2ad5e.entry.js → p-361f6033.entry.js} +1 -1
  269. package/dist/twilight/{p-ae9c0abe.entry.js → p-37192614.entry.js} +1 -1
  270. package/dist/twilight/{p-66f6d722.entry.js → p-3a632c69.entry.js} +1 -1
  271. package/dist/twilight/{p-14752d03.entry.js → p-3d8b77f7.entry.js} +1 -1
  272. package/dist/twilight/{p-4839d408.entry.js → p-3f842f32.entry.js} +1 -1
  273. package/dist/twilight/{p-c3c99d9e.entry.js → p-419d6d71.entry.js} +1 -1
  274. package/dist/twilight/{p-fae2a8d0.entry.js → p-481f52b1.entry.js} +1 -1
  275. package/dist/twilight/{p-b819de23.entry.js → p-487b4411.entry.js} +1 -1
  276. package/dist/twilight/{p-d495cce0.entry.js → p-4891c565.entry.js} +1 -1
  277. package/dist/twilight/{p-83ccad19.entry.js → p-4a3fa153.entry.js} +1 -1
  278. package/dist/twilight/{p-4057b692.entry.js → p-4ab5ee99.entry.js} +1 -1
  279. package/dist/twilight/{p-e5545546.entry.js → p-4b70e6c4.entry.js} +1 -1
  280. package/dist/twilight/{p-5d4fadd2.entry.js → p-516e4edc.entry.js} +1 -1
  281. package/dist/twilight/{p-90d4129f.entry.js → p-53735934.entry.js} +1 -1
  282. package/dist/twilight/{p-d68625f7.entry.js → p-5694edf1.entry.js} +1 -1
  283. package/dist/twilight/{p-7750bace.entry.js → p-5bbf17dd.entry.js} +1 -1
  284. package/dist/twilight/{p-783c6346.entry.js → p-5e8d019e.entry.js} +1 -1
  285. package/dist/twilight/{p-fce39869.entry.js → p-5f6fee0e.entry.js} +1 -1
  286. package/dist/twilight/{p-f10b887a.entry.js → p-66ad7a30.entry.js} +1 -1
  287. package/dist/twilight/{p-5d775867.entry.js → p-6af8a7b6.entry.js} +1 -1
  288. package/dist/twilight/{p-b66df976.entry.js → p-6b5de500.entry.js} +1 -1
  289. package/dist/twilight/{p-120b4694.entry.js → p-6ba3808a.entry.js} +1 -1
  290. package/dist/twilight/{p-3d5e862c.entry.js → p-6c3084c9.entry.js} +1 -1
  291. package/dist/twilight/{p-dc3ff1f0.entry.js → p-6dccd40f.entry.js} +1 -1
  292. package/dist/twilight/{p-bfb70998.entry.js → p-6e52b649.entry.js} +1 -1
  293. package/dist/twilight/{p-62ba0971.entry.js → p-70dfb2b4.entry.js} +1 -1
  294. package/dist/twilight/{p-f8ff074f.entry.js → p-76584a5b.entry.js} +1 -1
  295. package/dist/twilight/{p-2e8f95d0.entry.js → p-78a56dc6.entry.js} +1 -1
  296. package/dist/twilight/{p-eb160c2e.entry.js → p-79822d99.entry.js} +1 -1
  297. package/dist/twilight/{p-8b43035f.entry.js → p-7b5f97e7.entry.js} +1 -1
  298. package/dist/twilight/{p-2a3e2404.entry.js → p-7f97335a.entry.js} +1 -1
  299. package/dist/twilight/{p-184ea04c.entry.js → p-7fd9dc36.entry.js} +1 -1
  300. package/dist/twilight/p-84b0e7a9.entry.js +4 -0
  301. package/dist/twilight/p-8766e236.entry.js +4 -0
  302. package/dist/twilight/{p-622bfb21.entry.js → p-8c1d14f0.entry.js} +1 -1
  303. package/dist/twilight/{p-20939237.entry.js → p-8c40278d.entry.js} +1 -1
  304. package/dist/twilight/{p-f9b9af72.entry.js → p-92fd20a0.entry.js} +1 -1
  305. package/dist/twilight/{p-33ff7967.entry.js → p-9cf1cfd4.entry.js} +1 -1
  306. package/dist/twilight/{p-7e854633.entry.js → p-9d15f22d.entry.js} +1 -1
  307. package/dist/twilight/{p-9eb92980.entry.js → p-9e042cce.entry.js} +1 -1
  308. package/dist/twilight/{p-cc2c52bb.entry.js → p-9e0a9a5a.entry.js} +1 -1
  309. package/dist/twilight/{p-f034968b.entry.js → p-9e65451e.entry.js} +1 -1
  310. package/dist/twilight/{p-iCJI7qYe.js → p-BK9YeXWp.js} +1 -1
  311. package/dist/twilight/{p-Dhq3oJAe.js → p-BxQMWsr9.js} +1 -1
  312. package/dist/twilight/{p-CAc7tX2K.js → p-CBLWEyM9.js} +1 -1
  313. package/dist/twilight/{p-BbZqYBfp.js → p-CCwsxMbZ.js} +1 -1
  314. package/dist/twilight/{p-Nyk6-1lq.js → p-Ca_SZn0u.js} +1 -1
  315. package/dist/twilight/{p-BwzmoZpm.js → p-CgNJWeaK.js} +1 -1
  316. package/dist/twilight/p-CnTwkF6y.js +4 -0
  317. package/dist/twilight/{p-B7rn1taO.js → p-DMvhNbgN.js} +1 -1
  318. package/dist/twilight/{p-DVWVl151.js → p-De1tLqQF.js} +1 -1
  319. package/dist/twilight/{p-DmGAR42j.js → p-DgUQRYr2.js} +1 -1
  320. package/dist/twilight/{p-De2wEjqS.js → p-NqQdbGu6.js} +1 -1
  321. package/dist/twilight/{p-Dza6OBFg.js → p-Y2ZIN9Ok.js} +1 -1
  322. package/dist/twilight/{p-6c7cae8a.entry.js → p-a44670a9.entry.js} +1 -1
  323. package/dist/twilight/{p-509ad773.entry.js → p-a5b732b3.entry.js} +1 -1
  324. package/dist/twilight/{p-2153c6fd.entry.js → p-a95b0dc1.entry.js} +1 -1
  325. package/dist/twilight/{p-37b68ef3.entry.js → p-aa35cf98.entry.js} +1 -1
  326. package/dist/twilight/{p-d6c5bf2a.entry.js → p-ac736b30.entry.js} +1 -1
  327. package/dist/twilight/{p-d2c1457e.entry.js → p-af49191f.entry.js} +1 -1
  328. package/dist/twilight/{p-8b39a9f7.entry.js → p-b0d2e31f.entry.js} +1 -1
  329. package/dist/twilight/{p-31260fae.entry.js → p-b1f808f5.entry.js} +1 -1
  330. package/dist/twilight/{p-60f4357f.entry.js → p-b3ada3d0.entry.js} +1 -1
  331. package/dist/twilight/{p-4a1aa85f.entry.js → p-b5a45f87.entry.js} +1 -1
  332. package/dist/twilight/p-b9d67694.entry.js +4 -0
  333. package/dist/twilight/{p-64d49f5d.entry.js → p-ba6dd59c.entry.js} +1 -1
  334. package/dist/twilight/p-bac25e34.entry.js +4 -0
  335. package/dist/twilight/{p-fed66bcb.entry.js → p-bb8b2c85.entry.js} +1 -1
  336. package/dist/twilight/{p-49195cb6.entry.js → p-be6f8551.entry.js} +1 -1
  337. package/dist/twilight/{p-84d725d4.entry.js → p-bed54154.entry.js} +1 -1
  338. package/dist/twilight/{p-2a8d6e7e.entry.js → p-bed68e52.entry.js} +1 -1
  339. package/dist/twilight/{p-d63ce284.entry.js → p-bfd5e263.entry.js} +1 -1
  340. package/dist/twilight/{p-cd866be6.entry.js → p-c4cf0b4d.entry.js} +1 -1
  341. package/dist/twilight/{p-fe413496.entry.js → p-cb48a5ef.entry.js} +1 -1
  342. package/dist/twilight/{p-74f206cf.entry.js → p-cdeb9bcc.entry.js} +1 -1
  343. package/dist/twilight/{p-8e8e40bc.entry.js → p-d0aeeb7f.entry.js} +1 -1
  344. package/dist/twilight/{p-8f0af317.entry.js → p-d0ff9a3e.entry.js} +1 -1
  345. package/dist/twilight/{p-e8090773.entry.js → p-d1093a59.entry.js} +1 -1
  346. package/dist/twilight/{p-86ca22d5.entry.js → p-d1121b3f.entry.js} +1 -1
  347. package/dist/twilight/{p-3a3d4cb7.entry.js → p-d1204965.entry.js} +1 -1
  348. package/dist/twilight/p-d346dabd.entry.js +4 -0
  349. package/dist/twilight/{p-0a794d6f.entry.js → p-d4fb9921.entry.js} +1 -1
  350. package/dist/twilight/{p-4c801f91.entry.js → p-d8955835.entry.js} +1 -1
  351. package/dist/twilight/{p-f4411a04.entry.js → p-d9a1bf08.entry.js} +1 -1
  352. package/dist/twilight/{p-0c6a024f.entry.js → p-da0df10b.entry.js} +1 -1
  353. package/dist/twilight/p-e24fbbb4.entry.js +4 -0
  354. package/dist/twilight/{p-07450aed.entry.js → p-e38a6793.entry.js} +1 -1
  355. package/dist/twilight/{p-0e1248c4.entry.js → p-e457e68f.entry.js} +1 -1
  356. package/dist/twilight/{p-cd7029fc.entry.js → p-e9b03e9c.entry.js} +1 -1
  357. package/dist/twilight/{p-b9695308.entry.js → p-eaf0c514.entry.js} +1 -1
  358. package/dist/twilight/{p-b87ea253.entry.js → p-ee479819.entry.js} +1 -1
  359. package/dist/twilight/p-ee65c489.entry.js +4 -0
  360. package/dist/twilight/{p-7d337f25.entry.js → p-eefced26.entry.js} +1 -1
  361. package/dist/twilight/{p-a0a57259.entry.js → p-f7a58656.entry.js} +1 -1
  362. package/dist/twilight/{p-bf29daf3.entry.js → p-f7ab5825.entry.js} +1 -1
  363. package/dist/twilight/{p-57b93850.entry.js → p-f9587127.entry.js} +1 -1
  364. package/dist/twilight/{p-89cff0c8.entry.js → p-f9e5ed10.entry.js} +1 -1
  365. package/dist/twilight/{p-e4d90663.entry.js → p-fcb1009f.entry.js} +1 -1
  366. package/dist/twilight/{p-4f794057.entry.js → p-fddf1997.entry.js} +1 -1
  367. package/dist/twilight/twilight.esm.js +1 -1
  368. package/dist/types/components/salla-bullet-delivery/salla-bullet-delivery.d.ts +9 -1
  369. package/dist/types/components/salla-bullet-delivery/selector-tracker.d.ts +30 -0
  370. package/dist/types/components/salla-free-shipping-banner/salla-free-shipping-banner.d.ts +19 -5
  371. package/dist/types/components/salla-free-shipping-tag/salla-free-shipping-tag.d.ts +6 -1
  372. package/dist/types/components/salla-gifting/salla-gifting.d.ts +1 -0
  373. package/dist/types/components/salla-rating-modal/salla-rating-modal-v2.d.ts +1 -0
  374. package/dist/types/components.d.ts +11 -25
  375. package/dist/types/shared/free-shipping-timer.d.ts +36 -0
  376. package/package.json +5 -5
  377. package/dist/cjs/free-shipping-DkIKD6ch.js +0 -31
  378. package/dist/components/free-shipping.js +0 -29
  379. package/dist/esm/free-shipping-Brg4wsgg.js +0 -29
  380. package/dist/twilight/p-12a8aed8.entry.js +0 -4
  381. package/dist/twilight/p-40083f25.entry.js +0 -4
  382. package/dist/twilight/p-4f443e36.entry.js +0 -4
  383. package/dist/twilight/p-5b81a3d9.entry.js +0 -4
  384. package/dist/twilight/p-93f26336.entry.js +0 -4
  385. package/dist/twilight/p-Brg4wsgg.js +0 -4
  386. package/dist/twilight/p-bab5d057.entry.js +0 -4
  387. package/dist/twilight/p-c7c868b4.entry.js +0 -4
  388. package/dist/twilight/p-d5a2ba68.entry.js +0 -4
@@ -12,6 +12,110 @@ import { d as defineCustomElement$4 } from './salla-placeholder2.js';
12
12
  import { d as defineCustomElement$3 } from './salla-searchable-dropdown2.js';
13
13
  import { d as defineCustomElement$2 } from './salla-skeleton2.js';
14
14
 
15
+ const SESSION_STORAGE_NAME = "sc_selector_session";
16
+ const TRACKING_TIMEOUT_MS = 5000;
17
+ const CLOSE_REASONS = {
18
+ closeButtonClick: "close_button",
19
+ backdropClick: "backdrop",
20
+ };
21
+ const toCloseReason = (reason) => CLOSE_REASONS[reason ?? ""] ?? "escape";
22
+ const uuid = () => typeof crypto.randomUUID === "function"
23
+ ? crypto.randomUUID()
24
+ : "10000000-1000-4000-8000-100000000000".replace(/[018]/g, (c) => (Number(c) ^ (crypto.getRandomValues(new Uint8Array(1))[0] & (15 >> (Number(c) / 4)))).toString(16));
25
+ const allocatedBranchIds = (intent) => {
26
+ const value = intent?.allocation_headers?.["s-scope-allocation-id"] ?? intent?.branch_id;
27
+ const ids = String(value ?? "")
28
+ .split(",")
29
+ .map(Number)
30
+ .filter((id) => Number.isSafeInteger(id) && id > 0);
31
+ return [...new Set(ids)].sort((a, b) => a - b);
32
+ };
33
+ const sameIds = (a, b) => a.length === b.length && a.every((id) => b.includes(id));
34
+ class SelectorTracker {
35
+ constructor() {
36
+ this.impressionId = null;
37
+ this.visibleAt = 0;
38
+ }
39
+ viewed(context) {
40
+ this.guarded(() => {
41
+ this.impressionId = uuid();
42
+ this.visibleAt = Date.now();
43
+ this.send("Branch Selector Viewed", { ...context });
44
+ });
45
+ }
46
+ dismissed(context, reason, hadAcceptedSelection) {
47
+ this.guarded(() => this.send("Branch Selector Dismissed", {
48
+ ...context,
49
+ close_reason: reason,
50
+ had_accepted_selection: hadAcceptedSelection,
51
+ elapsed_ms: this.visibleAt ? Date.now() - this.visibleAt : 0,
52
+ }));
53
+ }
54
+ result(context, result) {
55
+ this.guarded(() => {
56
+ const session = this.session();
57
+ const seq = session.seq + 1;
58
+ const accepted = result.outcome === "accepted";
59
+ const firstAccepted = session.first_accepted_branch_ids ?? (accepted ? result.new_branch_ids : null);
60
+ // A draft or a failed attempt replaces the stored intent, so the last accepted branches live here.
61
+ const previous = session.last_accepted_branch_ids ?? result.previous_branch_ids;
62
+ this.save({
63
+ ...session,
64
+ seq,
65
+ first_accepted_branch_ids: firstAccepted,
66
+ last_accepted_branch_ids: accepted ? result.new_branch_ids : previous,
67
+ });
68
+ this.send("Branch Selector Completed", {
69
+ ...context,
70
+ ...result,
71
+ previous_branch_ids: previous,
72
+ selection_attempt_id: uuid(),
73
+ selection_seq: seq,
74
+ first_accepted_branch_ids: firstAccepted,
75
+ changed: accepted && previous.length > 0 && !sameIds(previous, result.new_branch_ids),
76
+ });
77
+ });
78
+ }
79
+ guarded(track) {
80
+ try {
81
+ track();
82
+ }
83
+ catch {
84
+ // Tracking must never break the selector.
85
+ }
86
+ }
87
+ send(event, properties) {
88
+ const body = {
89
+ event,
90
+ session_id: this.session().id,
91
+ impression_id: this.impressionId,
92
+ ...properties,
93
+ };
94
+ // Use the configured transport without the SDK's shared notification suppression.
95
+ // Tracking failures stay silent while concurrent customer requests keep their alerts.
96
+ // keepalive lets the request outlive the reload that follows a confirmed selection.
97
+ Promise.resolve(salla.api.axios.post("selector-events", body, {
98
+ timeout: TRACKING_TIMEOUT_MS,
99
+ adapter: ["fetch", "xhr"],
100
+ fetchOptions: { keepalive: true },
101
+ })).catch(() => undefined);
102
+ }
103
+ session() {
104
+ const stored = Salla.storage.session.get(this.storageName());
105
+ if (stored?.id)
106
+ return stored;
107
+ const fresh = { id: uuid(), seq: 0, first_accepted_branch_ids: null };
108
+ this.save(fresh);
109
+ return fresh;
110
+ }
111
+ storageName() {
112
+ return `${SESSION_STORAGE_NAME}:${Salla.config.get("store.id")}`;
113
+ }
114
+ save(session) {
115
+ Salla.storage.session.set(this.storageName(), session);
116
+ }
117
+ }
118
+
15
119
  var LocationIcon = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 172 172" width="172" height="172">
16
120
  <!-- White rounded background -->
17
121
  <rect width="172" height="172" rx="64" fill="#FFFFFF"/>
@@ -271,6 +375,13 @@ const SallaBulletDelivery$1 = /*@__PURE__*/ proxyCustomElement(class SallaBullet
271
375
  this.open();
272
376
  };
273
377
  this.closeHandler = null;
378
+ this.selectorTracker = new SelectorTracker();
379
+ this.openTrigger = "customer_requested";
380
+ this.pendingDismissReason = null;
381
+ this.modalCloseHandler = (detail) => {
382
+ this.pendingDismissReason = toCloseReason(detail?.reason);
383
+ queueMicrotask(() => (this.pendingDismissReason = null));
384
+ };
274
385
  this.bulletDeliveryMobileSelectHandler = null;
275
386
  /** True after saved addresses have been loaded (lazy: only when address tab is shown). */
276
387
  this.savedAddressesLoaded = false;
@@ -537,6 +648,7 @@ const SallaBulletDelivery$1 = /*@__PURE__*/ proxyCustomElement(class SallaBullet
537
648
  const details = this.buildIntentAddress();
538
649
  if (!details)
539
650
  return;
651
+ const previousIntent = this.getStoredIntent();
540
652
  this.setStoredIntent({
541
653
  type: "address",
542
654
  country_id: Number(this.selectedCountry?.id) || 0,
@@ -545,7 +657,7 @@ const SallaBulletDelivery$1 = /*@__PURE__*/ proxyCustomElement(class SallaBullet
545
657
  });
546
658
  this.selectedSavedAddress = null;
547
659
  this.selectedSessionAddress = true;
548
- await this.handleConfirm();
660
+ await this.handleConfirm(previousIntent);
549
661
  };
550
662
  this.handleCountrySelected = (item) => {
551
663
  const country = this.countries.find(c => String(c.id) === String(item.id)) || item;
@@ -630,9 +742,10 @@ const SallaBulletDelivery$1 = /*@__PURE__*/ proxyCustomElement(class SallaBullet
630
742
  * successful auto-confirm never flashes the saved-addresses list; the caller is
631
743
  * responsible for revealing the modal itself if it still needs the customer's input.
632
744
  */
633
- async open(silent = false) {
745
+ async open(silent = false, trigger = "customer_requested") {
634
746
  if (!this.isEnabled)
635
747
  return; // feature disabled — never open
748
+ this.openTrigger = trigger;
636
749
  // If mobile app, open the sheet
637
750
  if (this.isMobileApp) {
638
751
  Salla.event.dispatch('salla::bullet-delivery.open-sheet');
@@ -734,6 +847,33 @@ const SallaBulletDelivery$1 = /*@__PURE__*/ proxyCustomElement(class SallaBullet
734
847
  this.bulletDeliveryClosed.emit();
735
848
  return this.modal?.close();
736
849
  }
850
+ selectorContext() {
851
+ return {
852
+ configured_required: this.isRequired,
853
+ effective_nonclosable: this.isRequired || this.shouldForceNonClosable(),
854
+ trigger_configured: this.openingType ?? null,
855
+ trigger_actual: this.openTrigger,
856
+ };
857
+ }
858
+ handleModalVisibility(visible) {
859
+ if (visible) {
860
+ this.selectorTracker.viewed(this.selectorContext());
861
+ return;
862
+ }
863
+ if (!this.pendingDismissReason)
864
+ return;
865
+ this.selectorTracker.dismissed(this.selectorContext(), this.pendingDismissReason, !!this.getStoredIntent()?.scope_allocated);
866
+ this.pendingDismissReason = null;
867
+ }
868
+ trackSelectorResult(outcome, previousIntent, newBranchIds, scopeId) {
869
+ this.selectorTracker.result(this.selectorContext(), {
870
+ outcome,
871
+ fulfilment_method: this.activeTab === "branch" ? "pickup" : "delivery",
872
+ previous_branch_ids: previousIntent?.scope_allocated ? allocatedBranchIds(previousIntent) : [],
873
+ new_branch_ids: newBranchIds,
874
+ scope_id: scopeId ?? null,
875
+ });
876
+ }
737
877
  resetState() {
738
878
  this.viewMode = "main";
739
879
  this.mapLocationData = null;
@@ -873,7 +1013,7 @@ const SallaBulletDelivery$1 = /*@__PURE__*/ proxyCustomElement(class SallaBullet
873
1013
  if (!wasVisible) {
874
1014
  // Load silently — a successful auto-confirm should never flash the
875
1015
  // saved-addresses list; only reveal the modal below if it can't finish on its own.
876
- await this.open(true);
1016
+ await this.open(true, "after_login");
877
1017
  }
878
1018
  // open() -> loadSavedAddresses() already sets selectedSessionAddress when a
879
1019
  // session intent exists; bail if that didn't happen (e.g. address_id already set).
@@ -1936,7 +2076,7 @@ const SallaBulletDelivery$1 = /*@__PURE__*/ proxyCustomElement(class SallaBullet
1936
2076
  if (await this.tryAutoConfirmAfterLogin())
1937
2077
  return;
1938
2078
  if (!this.modal?.hasAttribute?.("visible") || !this.isLoggedIn) {
1939
- this.open();
2079
+ this.open(false, "after_login");
1940
2080
  }
1941
2081
  }
1942
2082
  buildIntentAddress() {
@@ -2215,13 +2355,14 @@ const SallaBulletDelivery$1 = /*@__PURE__*/ proxyCustomElement(class SallaBullet
2215
2355
  }
2216
2356
  return raw;
2217
2357
  }
2218
- async handleConfirm() {
2358
+ async handleConfirm(intentBeforeDraft) {
2219
2359
  if (this.isConfirmDisabled() || this.confirming)
2220
2360
  return;
2221
2361
  this.allocationOutOfCoverageMessage = null;
2222
2362
  this.confirming = true;
2223
2363
  this.confirmBtn?.load();
2224
2364
  let scheduledRedirect = false;
2365
+ const previousIntent = intentBeforeDraft === undefined ? this.getStoredIntent() : intentBeforeDraft;
2225
2366
  try {
2226
2367
  // A guest map pin uses the pin's own country; the IP/selected country may differ from it.
2227
2368
  const country = this.activeTab === "address" && this.isGuestMapPick
@@ -2239,6 +2380,7 @@ const SallaBulletDelivery$1 = /*@__PURE__*/ proxyCustomElement(class SallaBullet
2239
2380
  const savedAddress = await this.saveSessionAddressToProfile();
2240
2381
  if (!savedAddress) {
2241
2382
  Salla.notify?.error(Salla.lang.get("common.errors.error_occurred"));
2383
+ this.trackSelectorResult("failed", previousIntent, []);
2242
2384
  this.confirmBtn?.stop();
2243
2385
  return;
2244
2386
  }
@@ -2313,6 +2455,7 @@ const SallaBulletDelivery$1 = /*@__PURE__*/ proxyCustomElement(class SallaBullet
2313
2455
  ? Salla.lang.get("pages.checkout.address_out_of_coverage")
2314
2456
  : Salla.lang.get("pages.checkout.failed_to_set_pickup"));
2315
2457
  this.allocationOutOfCoverageMessage = `${errorMessage}.`;
2458
+ this.trackSelectorResult("failed", previousIntent, []);
2316
2459
  this.confirmBtn?.stop();
2317
2460
  this.confirming = false;
2318
2461
  return;
@@ -2349,6 +2492,7 @@ const SallaBulletDelivery$1 = /*@__PURE__*/ proxyCustomElement(class SallaBullet
2349
2492
  const scopeApplied = await bulletDeliveryAPI.setDeliveryScope(allocatedScopeId);
2350
2493
  if (!scopeApplied) {
2351
2494
  this.allocationOutOfCoverageMessage = `${Salla.lang.get("common.errors.error_occurred")}.`;
2495
+ this.trackSelectorResult("failed", previousIntent, [], allocatedScopeId);
2352
2496
  this.confirmBtn?.stop();
2353
2497
  this.confirming = false;
2354
2498
  return;
@@ -2368,6 +2512,7 @@ const SallaBulletDelivery$1 = /*@__PURE__*/ proxyCustomElement(class SallaBullet
2368
2512
  // After allocation success: persist latest intent so switch UI can always reflect
2369
2513
  // the selected address/branch once confirmed.
2370
2514
  this.setStoredIntent({ ...result, scope_allocated: true });
2515
+ this.trackSelectorResult("accepted", previousIntent, allocatedBranchIds(result), allocatedScopeId);
2371
2516
  const allocationConfirmedPayload = {
2372
2517
  ...result,
2373
2518
  address: this.buildAllocationConfirmedAddressData(selectedAddress),
@@ -2887,7 +3032,7 @@ const SallaBulletDelivery$1 = /*@__PURE__*/ proxyCustomElement(class SallaBullet
2887
3032
  if (canOpenForIncompleteIntent) {
2888
3033
  this.markIncompleteIntentPrompted();
2889
3034
  }
2890
- this.open();
3035
+ this.open(false, canOpenForIncompleteIntent ? "incomplete_intent" : "after_add_to_cart");
2891
3036
  }
2892
3037
  overrideScopeSwitchUI() {
2893
3038
  const intent = this.getStoredIntent();
@@ -2940,7 +3085,7 @@ const SallaBulletDelivery$1 = /*@__PURE__*/ proxyCustomElement(class SallaBullet
2940
3085
  // silently awaiting with nothing visible.
2941
3086
  if (!this.isGuestUser()) {
2942
3087
  if (!this.modal?.hasAttribute?.("visible")) {
2943
- this.open();
3088
+ this.open(false, "checkout_gate");
2944
3089
  }
2945
3090
  await this.pendingCartSubmitPromise;
2946
3091
  return;
@@ -2969,7 +3114,7 @@ const SallaBulletDelivery$1 = /*@__PURE__*/ proxyCustomElement(class SallaBullet
2969
3114
  this.openGuestLogin();
2970
3115
  return;
2971
3116
  }
2972
- this.open();
3117
+ this.open(false, "checkout_gate");
2973
3118
  });
2974
3119
  await this.pendingCartSubmitPromise;
2975
3120
  };
@@ -2985,6 +3130,7 @@ const SallaBulletDelivery$1 = /*@__PURE__*/ proxyCustomElement(class SallaBullet
2985
3130
  Salla.event.on("salla::bullet-delivery.modal.open.requested", this.bulletDeliveryOpenHandler);
2986
3131
  this.closeHandler = this.close.bind(this);
2987
3132
  Salla.event.on("salla::bullet-delivery.modal.close.requested", this.closeHandler);
3133
+ Salla.event.on("modal::close", this.modalCloseHandler);
2988
3134
  this.isRTL = Salla.config.get("theme.is_rtl");
2989
3135
  // Reading the permission never prompts, so it's safe to watch from here — the map view then
2990
3136
  // renders the notice (or not) on its first paint instead of a frame later.
@@ -3009,7 +3155,7 @@ const SallaBulletDelivery$1 = /*@__PURE__*/ proxyCustomElement(class SallaBullet
3009
3155
  return;
3010
3156
  if (this.modal?.hasAttribute?.("visible"))
3011
3157
  return;
3012
- this.open();
3158
+ this.open(false, "after_login");
3013
3159
  };
3014
3160
  Salla.event.on("auth::logged.in", this.authLoggedInHandler);
3015
3161
  this.authLoggedOutHandler = () => {
@@ -3041,7 +3187,10 @@ const SallaBulletDelivery$1 = /*@__PURE__*/ proxyCustomElement(class SallaBullet
3041
3187
  return null; // no-op when disabled
3042
3188
  return (h(Host, { class: "s-bullet-delivery" }, h("salla-modal", { ref: modal => {
3043
3189
  this.modal = modal;
3044
- }, isClosable: !this.isRequired && !this.shouldForceNonClosable(), class: "s-bullet-delivery-modal", width: "sm", "data-testid": "salla-bullet-delivery-modal" }, h("div", { class: "s-bullet-delivery-inner" }, h("div", { class: "s-bullet-delivery-header" }, h("h2", { class: "s-bullet-delivery-title" }, this.activeTab === 'address'
3190
+ }, isClosable: !this.isRequired && !this.shouldForceNonClosable(), onModalVisibilityChanged: (event) => {
3191
+ if (event.target === this.modal)
3192
+ this.handleModalVisibility(Boolean(event.detail));
3193
+ }, class: "s-bullet-delivery-modal", width: "sm", "data-testid": "salla-bullet-delivery-modal" }, h("div", { class: "s-bullet-delivery-inner" }, h("div", { class: "s-bullet-delivery-header" }, h("h2", { class: "s-bullet-delivery-title" }, this.activeTab === 'address'
3045
3194
  ? Salla.lang.get('blocks.home.add_address_for_order_delivery')
3046
3195
  : Salla.lang.get('blocks.home.choose_branch_for_order_pickup')), h("p", { class: "s-bullet-delivery-subtitle" }, this.activeTab === 'address'
3047
3196
  ? Salla.lang.get('blocks.home.products_available_for_delivery_shown_while_shopping')
@@ -3077,7 +3226,7 @@ const SallaBulletDelivery$1 = /*@__PURE__*/ proxyCustomElement(class SallaBullet
3077
3226
  // Handle pending open request (if event was emitted before component was ready)
3078
3227
  if (this.pendingOpen) {
3079
3228
  this.pendingOpen = false;
3080
- this.open();
3229
+ this.open(false, this.openTrigger);
3081
3230
  return;
3082
3231
  }
3083
3232
  // Strategy-based auto-open logic
@@ -3085,11 +3234,11 @@ const SallaBulletDelivery$1 = /*@__PURE__*/ proxyCustomElement(class SallaBullet
3085
3234
  case "first_visit":
3086
3235
  // Open once per session when component mounts (per-session behaviour)
3087
3236
  if (!this.hasBeenShownThisSession()) {
3088
- this.open();
3237
+ this.open(false, "first_visit");
3089
3238
  }
3090
3239
  else if (this.shouldPromptIncompleteIntentThisSession()) {
3091
3240
  this.markIncompleteIntentPrompted();
3092
- this.open();
3241
+ this.open(false, "incomplete_intent");
3093
3242
  }
3094
3243
  break;
3095
3244
  case "on_cart_click":
@@ -3097,11 +3246,11 @@ const SallaBulletDelivery$1 = /*@__PURE__*/ proxyCustomElement(class SallaBullet
3097
3246
  if (Salla.url.is_page("cart")) {
3098
3247
  const shown = this.getShownStorage().get(this.sessionShownKey) === true;
3099
3248
  if (!shown) {
3100
- this.open();
3249
+ this.open(false, "on_cart_click");
3101
3250
  }
3102
3251
  else if (this.shouldPromptIncompleteIntentThisSession()) {
3103
3252
  this.markIncompleteIntentPrompted();
3104
- this.open();
3253
+ this.open(false, "incomplete_intent");
3105
3254
  }
3106
3255
  }
3107
3256
  break;
@@ -3121,6 +3270,7 @@ const SallaBulletDelivery$1 = /*@__PURE__*/ proxyCustomElement(class SallaBullet
3121
3270
  this.stopWatchingLocationPermission = null;
3122
3271
  }
3123
3272
  Salla.event.off("salla::bullet-delivery.modal.open.requested", this.bulletDeliveryOpenHandler);
3273
+ Salla.event.off("modal::close", this.modalCloseHandler);
3124
3274
  if (this.closeHandler) {
3125
3275
  Salla.event.off("salla::bullet-delivery.modal.close.requested", this.closeHandler);
3126
3276
  this.closeHandler = null;
@@ -2,9 +2,9 @@
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
4
  import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
5
- import { i as isEligibleForFreeShipping } from './free-shipping.js';
5
+ import { i as isEligibleForFreeShipping, s as startTimerIfNeeded, a as isTimerEnabled, b as subscribeToFreeShippingTimer, g as getFreeShippingTimerState } from './free-shipping-timer.js';
6
6
 
7
- const sallaFreeShippingBannerCss = "/*!twlt*/salla-free-shipping-banner{display:block}.s-free-shipping-banner{--s-fsb-tint:rgba(128, 128, 128, 0.1);--s-fsb-tint-2:rgba(128, 128, 128, 0.18);--s-fsb-shine:rgba(128, 128, 128, 0.35);color:inherit;font-size:13.5px;line-height:1.4;background:var(--s-fsb-tint);margin-block-start:1rem;margin-block-end:1rem;border-radius:12px;padding:8px 12px}@supports (color: color-mix(in srgb, red, blue)){.s-free-shipping-banner{--s-fsb-tint:color-mix(in srgb, currentColor 9%, transparent);--s-fsb-tint-2:color-mix(in srgb, currentColor 12%, transparent);--s-fsb-shine:color-mix(in srgb, currentColor 40%, transparent)}}.s-free-shipping-banner svg{fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round;flex:none}.s-free-shipping-banner__inner{display:flex;align-items:center;gap:10px}.s-free-shipping-banner__icon{flex:none;inline-size:42px;block-size:28px;overflow:visible}.s-free-shipping-banner__icon .s-fsb-fill{fill:currentColor;stroke:none}.s-free-shipping-banner__icon .s-fsb-window{fill:#fff;stroke:none}.s-free-shipping-banner__icon .s-fsb-line{fill:none;stroke:currentColor;stroke-width:2.2;stroke-linecap:round}.s-free-shipping-banner__icon .s-fsb-wheel{fill:none;stroke:currentColor;stroke-width:2}.s-free-shipping-banner__icon .s-fsb-body{animation:s-fsb-bob 0.36s ease-in-out infinite alternate}.s-free-shipping-banner__icon .s-fsb-speed path{animation:s-fsb-speed 0.6s linear infinite}.s-free-shipping-banner__icon .s-fsb-speed path:nth-child(2){animation-delay:0.2s}.s-free-shipping-banner__icon .s-fsb-speed path:nth-child(3){animation-delay:0.4s}.s-free-shipping-banner__text{margin:0;flex:1 1 auto;min-inline-size:0}.s-free-shipping-banner__text strong{display:block;font-size:14.5px;font-weight:700;line-height:1.3}.s-free-shipping-banner__desc{display:block;font-size:12.5px;line-height:1.35;opacity:0.85;margin-block-start:2px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.s-free-shipping-banner__chip{position:relative;overflow:hidden;flex:none;display:inline-flex;align-items:center;gap:6px;min-block-size:28px;padding-inline:10px;border-radius:999px;font-size:13px;font-weight:600;white-space:nowrap;background:var(--s-fsb-tint-2)}.s-free-shipping-banner__chip svg{inline-size:15px;block-size:15px}.s-free-shipping-banner__chip::after{content:\"\";position:absolute;top:0;bottom:0;left:0;inline-size:45%;background:linear-gradient(90deg, transparent, var(--s-fsb-shine), transparent);transform:translateX(-150%) skewX(-18deg);animation:s-fsb-shine 5s ease-in-out infinite;pointer-events:none}@media (prefers-reduced-motion: reduce){.s-free-shipping-banner *,.s-free-shipping-banner *::after{animation:none !important}}@media (max-width: 767px){.s-free-shipping-banner__desc{white-space:normal;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical}.s-free-shipping-banner__chip{padding-inline:9px}}@media (min-width: 900px){.s-free-shipping-banner{padding:8px 14px}.s-free-shipping-banner__inner{gap:12px}.s-free-shipping-banner__icon{inline-size:48px;block-size:32px}.s-free-shipping-banner__text strong{font-size:15.5px}.s-free-shipping-banner__desc{font-size:13px}}@keyframes s-fsb-bob{from{transform:translateY(0)}to{transform:translateY(-0.8px)}}@keyframes s-fsb-speed{0%{transform:translateX(2px);opacity:0}30%{opacity:0.9}100%{transform:translateX(-7px);opacity:0}}@keyframes s-fsb-shine{0%{transform:translateX(-150%) skewX(-18deg)}26%,100%{transform:translateX(360%) skewX(-18deg)}}.visible{visibility:visible}.hidden{display:none}";
7
+ const sallaFreeShippingBannerCss = "/*!twlt*/salla-free-shipping-banner{display:block}.s-free-shipping-banner{--s-fsb-tint:rgba(128, 128, 128, 0.1);--s-fsb-tint-2:rgba(128, 128, 128, 0.18);--s-fsb-shine:rgba(128, 128, 128, 0.35);color:inherit;font-size:13.5px;line-height:1.4;background:var(--s-fsb-tint);margin-block-start:1rem;margin-block-end:1rem;border-radius:12px;padding:8px 12px}@supports (color: color-mix(in srgb, red, blue)){.s-free-shipping-banner{--s-fsb-tint:color-mix(in srgb, currentColor 9%, transparent);--s-fsb-tint-2:color-mix(in srgb, currentColor 12%, transparent);--s-fsb-shine:color-mix(in srgb, currentColor 40%, transparent)}}.s-free-shipping-banner svg{fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round;flex:none}.s-free-shipping-banner__inner{display:flex;align-items:center;gap:10px}.s-free-shipping-banner__icon{flex:none;inline-size:42px;block-size:28px;overflow:visible}.s-free-shipping-banner__icon .s-fsb-fill{fill:currentColor;stroke:none}.s-free-shipping-banner__icon .s-fsb-window{fill:#fff;stroke:none}.s-free-shipping-banner__icon .s-fsb-line{fill:none;stroke:currentColor;stroke-width:2.2;stroke-linecap:round}.s-free-shipping-banner__icon .s-fsb-wheel{fill:none;stroke:currentColor;stroke-width:2}.s-free-shipping-banner__icon .s-fsb-body{animation:s-fsb-bob 0.36s ease-in-out infinite alternate}.s-free-shipping-banner__icon .s-fsb-speed path{animation:s-fsb-speed 0.6s linear infinite}.s-free-shipping-banner__icon .s-fsb-speed path:nth-child(2){animation-delay:0.2s}.s-free-shipping-banner__icon .s-fsb-speed path:nth-child(3){animation-delay:0.4s}.s-free-shipping-banner__text{margin:0;flex:1 1 auto;min-inline-size:0}.s-free-shipping-banner__text strong{display:block;font-size:14.5px;font-weight:700;line-height:1.3}.s-free-shipping-banner__desc{display:block;font-size:12.5px;line-height:1.35;opacity:0.85;margin-block-start:2px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.s-free-shipping-banner__timer{position:relative;overflow:hidden;flex:none;display:inline-flex;align-items:center;gap:6px;min-block-size:28px;padding-inline:10px;border-radius:999px;font-size:13px;font-weight:600;white-space:nowrap;background:var(--s-fsb-tint-2)}.s-free-shipping-banner__timer svg{inline-size:15px;block-size:15px}.s-free-shipping-banner__timer::after{content:\"\";position:absolute;top:0;bottom:0;left:0;inline-size:45%;background:linear-gradient(90deg, transparent, var(--s-fsb-shine), transparent);transform:translateX(-150%) skewX(-18deg);animation:s-fsb-shine 5s ease-in-out infinite;pointer-events:none}.s-free-shipping-banner__clock{font-size:13.5px;font-variant-numeric:tabular-nums;font-feature-settings:\"tnum\";direction:ltr;unicode-bidi:isolate}.s-free-shipping-banner.has-paper .s-free-shipping-banner__timer{background:var(--s-fsb-ink);color:var(--s-fsb-paper)}@media (prefers-reduced-motion: reduce){.s-free-shipping-banner *,.s-free-shipping-banner *::after{animation:none !important}}@media (max-width: 767px){.s-free-shipping-banner__desc{white-space:normal;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical}.s-free-shipping-banner__label{display:none}.s-free-shipping-banner__timer{padding-inline:9px}}@media (min-width: 900px){.s-free-shipping-banner{padding:8px 14px}.s-free-shipping-banner__inner{gap:12px}.s-free-shipping-banner__icon{inline-size:48px;block-size:32px}.s-free-shipping-banner__text strong{font-size:15.5px}.s-free-shipping-banner__desc{font-size:13px}}@keyframes s-fsb-bob{from{transform:translateY(0)}to{transform:translateY(-0.8px)}}@keyframes s-fsb-speed{0%{transform:translateX(2px);opacity:0}30%{opacity:0.9}100%{transform:translateX(-7px);opacity:0}}@keyframes s-fsb-shine{0%{transform:translateX(-150%) skewX(-18deg)}26%,100%{transform:translateX(360%) skewX(-18deg)}}.visible{visibility:visible}.hidden{display:none}";
8
8
 
9
9
  const LABELS = {
10
10
  title: {
@@ -15,11 +15,27 @@ const LABELS = {
15
15
  ar: 'لفترة محدودة! تسوّق واستفد من الشحن المجاني',
16
16
  en: 'Shop now and save on delivery for a limited time.',
17
17
  },
18
- limited: {
19
- ar: 'عرض لفترة محدودة',
20
- en: 'Limited-time offer',
18
+ ends_in: {
19
+ ar: 'ينتهي خلال',
20
+ en: 'Ends in',
21
21
  },
22
22
  };
23
+ const pad = (n) => (n < 10 ? '0' : '') + n;
24
+ function formatClock(ms) {
25
+ const seconds = Math.max(0, Math.floor(ms / 1000));
26
+ return `${pad(Math.floor(seconds / 3600))}:${pad(Math.floor((seconds % 3600) / 60))}:${pad(seconds % 60)}`;
27
+ }
28
+ function luminance(rgb) {
29
+ const m = /rgba?\((\d+),\s*(\d+),\s*(\d+)/.exec(rgb || '');
30
+ if (!m)
31
+ return null;
32
+ const f = (c) => {
33
+ c /= 255;
34
+ return c <= 0.03928 ? c / 12.92 : Math.pow((c + 0.055) / 1.055, 2.4);
35
+ };
36
+ return 0.2126 * f(+m[1]) + 0.7152 * f(+m[2]) + 0.0722 * f(+m[3]);
37
+ }
38
+ const isTransparent = (bg) => !bg || bg === 'transparent' || /rgba\(\d+,\s*\d+,\s*\d+,\s*0\)/.test(bg);
23
39
  const SallaFreeShippingBanner$1 = /*@__PURE__*/ proxyCustomElement(class SallaFreeShippingBanner extends HTMLElement {
24
40
  constructor() {
25
41
  super();
@@ -27,7 +43,19 @@ const SallaFreeShippingBanner$1 = /*@__PURE__*/ proxyCustomElement(class SallaFr
27
43
  /** Where the banner is rendered: the home page or the product page. */
28
44
  this.placement = 'home';
29
45
  this.locale = 'ar';
46
+ /** Whether free shipping applies here (feature on and the eligibility check passed). */
30
47
  this.visible = false;
48
+ this.timer = null;
49
+ this.onColorSchemeChange = () => this.measureInkAndPaper();
50
+ }
51
+ connectedCallback() {
52
+ this.colorScheme = window.matchMedia?.('(prefers-color-scheme: dark)');
53
+ this.colorScheme?.addEventListener?.('change', this.onColorSchemeChange);
54
+ }
55
+ disconnectedCallback() {
56
+ this.unsubscribe?.();
57
+ this.stopTick();
58
+ this.colorScheme?.removeEventListener?.('change', this.onColorSchemeChange);
31
59
  }
32
60
  async componentWillLoad() {
33
61
  try {
@@ -43,27 +71,86 @@ const SallaFreeShippingBanner$1 = /*@__PURE__*/ proxyCustomElement(class SallaFr
43
71
  // home: is the store offering free shipping; product page: is this product eligible
44
72
  const productId = this.placement === 'product' ? salla.config.get('page.id') : undefined;
45
73
  this.visible = await isEligibleForFreeShipping(productId);
74
+ if (this.visible) {
75
+ // The visitor sees the banner now: remember when, the first time only.
76
+ startTimerIfNeeded();
77
+ // Only a banner that can show, and has a timer, follows it (to hide at the end and come back after).
78
+ if (isTimerEnabled()) {
79
+ this.unsubscribe = subscribeToFreeShippingTimer(() => this.refreshTimer());
80
+ }
81
+ }
82
+ this.refreshTimer();
46
83
  }
47
84
  catch (e) {
48
85
  salla?.logger?.warn?.('salla-free-shipping-banner: init failed', e);
49
86
  }
50
87
  }
88
+ refreshTimer() {
89
+ this.timer = getFreeShippingTimerState();
90
+ if (this.visible && this.timer?.visible) {
91
+ this.tick = this.tick ?? setInterval(() => this.refreshTimer(), 1000);
92
+ }
93
+ else {
94
+ this.stopTick();
95
+ }
96
+ }
97
+ stopTick() {
98
+ clearInterval(this.tick);
99
+ this.tick = undefined;
100
+ }
101
+ /**
102
+ * The timer chip is drawn from the theme's own colours: solid in the text colour ("ink")
103
+ * with the nearest opaque background behind the banner ("paper") as its text colour.
104
+ */
105
+ measureInkAndPaper() {
106
+ const bar = this.host?.querySelector('.s-free-shipping-banner');
107
+ if (!bar)
108
+ return;
109
+ this.measuredBar = bar;
110
+ const ink = getComputedStyle(bar.parentElement || bar).color;
111
+ let paper = null;
112
+ for (let node = bar.parentElement; node; node = node.parentElement) {
113
+ const bg = getComputedStyle(node).backgroundColor;
114
+ if (!isTransparent(bg)) {
115
+ paper = bg;
116
+ break;
117
+ }
118
+ }
119
+ if (!paper) {
120
+ const l = luminance(ink);
121
+ paper = l != null && l > 0.5 ? '#111418' : '#ffffff';
122
+ }
123
+ bar.style.setProperty('--s-fsb-ink', ink);
124
+ bar.style.setProperty('--s-fsb-paper', paper);
125
+ bar.classList.add('has-paper');
126
+ }
127
+ componentDidRender() {
128
+ // The colours do not change with the countdown: measure once per banner element (it is a new
129
+ // element each time the banner comes back), and again on a colour scheme change.
130
+ const bar = this.host?.querySelector('.s-free-shipping-banner');
131
+ if (bar && bar !== this.measuredBar) {
132
+ this.measureInkAndPaper();
133
+ }
134
+ }
51
135
  /** Store translation wins, the built-in label is the fallback for the current language. */
52
136
  label(name) {
53
137
  const label = LABELS?.[name]?.[this.locale];
54
138
  return salla.lang.getWithDefault?.(`blocks.free_shipping_banner.${name}`, label) || label;
55
139
  }
56
140
  render() {
57
- if (!this.visible) {
141
+ const timer = this.timer;
142
+ if (!this.visible || !timer?.visible) {
58
143
  return null;
59
144
  }
60
- return (h(Host, null, h("div", { class: "container" }, h("section", { class: "s-free-shipping-banner", "aria-label": this.label('title') }, h("div", { class: "s-free-shipping-banner__inner" }, h("svg", { class: "s-free-shipping-banner__icon", viewBox: "0 0 48 32", "aria-hidden": "true" }, h("g", { class: "s-fsb-speed" }, h("path", { class: "s-fsb-line", d: "M3 11h7" }), h("path", { class: "s-fsb-line", d: "M1 16h5" }), h("path", { class: "s-fsb-line", d: "M4 21h6" })), h("g", { class: "s-fsb-body" }, h("rect", { class: "s-fsb-fill", x: "12", y: "5", width: "21", height: "16", rx: "2.5" }), h("path", { class: "s-fsb-fill", d: "M33 10h6.5a2 2 0 0 1 1.6.8l4.1 5.5c.5.7.8 1.5.8 2.4V21H33z" }), h("rect", { class: "s-fsb-fill", x: "12", y: "20", width: "34", height: "3.5", rx: "1.2" }), h("rect", { class: "s-fsb-window", x: "35", y: "12", width: "5.5", height: "4", rx: "1" })), h("circle", { class: "s-fsb-wheel", cx: "19.5", cy: "25.5", r: "3" }), h("circle", { class: "s-fsb-wheel", cx: "38", cy: "25.5", r: "3" })), h("p", { class: "s-free-shipping-banner__text" }, h("strong", null, this.label('title')), h("span", { class: "s-free-shipping-banner__desc" }, this.label('description'))), h("span", { class: "s-free-shipping-banner__chip" }, h("svg", { viewBox: "0 0 24 24", "aria-hidden": "true" }, h("circle", { cx: "12", cy: "13.5", r: "7" }), h("path", { d: "M10 2.5h4M12 2.5v4M12 13.5V9.5M18 7.5l1.5-1.5" })), h("span", null, this.label('limited'))))))));
145
+ return (h(Host, null, h("div", { class: "container" }, h("section", { class: "s-free-shipping-banner", "aria-label": this.label('title') }, h("div", { class: "s-free-shipping-banner__inner" }, h("svg", { class: "s-free-shipping-banner__icon", viewBox: "0 0 48 32", "aria-hidden": "true" }, h("g", { class: "s-fsb-speed" }, h("path", { class: "s-fsb-line", d: "M3 11h7" }), h("path", { class: "s-fsb-line", d: "M1 16h5" }), h("path", { class: "s-fsb-line", d: "M4 21h6" })), h("g", { class: "s-fsb-body" }, h("rect", { class: "s-fsb-fill", x: "12", y: "5", width: "21", height: "16", rx: "2.5" }), h("path", { class: "s-fsb-fill", d: "M33 10h6.5a2 2 0 0 1 1.6.8l4.1 5.5c.5.7.8 1.5.8 2.4V21H33z" }), h("rect", { class: "s-fsb-fill", x: "12", y: "20", width: "34", height: "3.5", rx: "1.2" }), h("rect", { class: "s-fsb-window", x: "35", y: "12", width: "5.5", height: "4", rx: "1" })), h("circle", { class: "s-fsb-wheel", cx: "19.5", cy: "25.5", r: "3" }), h("circle", { class: "s-fsb-wheel", cx: "38", cy: "25.5", r: "3" })), h("p", { class: "s-free-shipping-banner__text" }, h("strong", null, this.label('title')), h("span", { class: "s-free-shipping-banner__desc" }, this.label('description'))), h("span", { class: "s-free-shipping-banner__timer" }, h("svg", { viewBox: "0 0 24 24", "aria-hidden": "true" }, h("circle", { cx: "12", cy: "12", r: "8" }), h("path", { d: "M12 8v4l3 2" })), h("span", { class: "s-free-shipping-banner__label" }, this.label('ends_in')), h("span", { class: "s-free-shipping-banner__clock", role: "timer" }, formatClock(timer.remainingMs))))))));
61
146
  }
147
+ get host() { return this; }
62
148
  static get style() { return sallaFreeShippingBannerCss; }
63
149
  }, [0, "salla-free-shipping-banner", {
64
150
  "placement": [1],
65
151
  "locale": [32],
66
- "visible": [32]
152
+ "visible": [32],
153
+ "timer": [32]
67
154
  }]);
68
155
  function defineCustomElement$1() {
69
156
  if (typeof customElements === "undefined") {
@@ -2,9 +2,9 @@
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
4
  import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
5
- import { i as isEligibleForFreeShipping } from './free-shipping.js';
5
+ import { g as getFreeShippingTimerState, a as isTimerEnabled, b as subscribeToFreeShippingTimer, i as isEligibleForFreeShipping } from './free-shipping-timer.js';
6
6
 
7
- const sallaFreeShippingTagCss = "/*!twlt*/salla-free-shipping-tag{display:block}.s-free-shipping-tag{display:inline-flex;align-items:center;gap:6px;margin-block-start:0.5rem;margin-bottom:1.25rem;padding:4px 10px;border-radius:8px;font-size:13px;line-height:1.4;color:#7a4b0c;background:rgba(245, 158, 11, 0.14)}.s-free-shipping-tag svg{inline-size:16px;block-size:16px;flex:none;fill:none;stroke:currentColor;stroke-width:1.6;stroke-linecap:round;stroke-linejoin:round}";
7
+ const sallaFreeShippingTagCss = "/*!twlt*/salla-free-shipping-tag{display:block}.s-free-shipping-tag{display:inline-flex;align-items:center;gap:6px;margin-block-start:0.5rem;margin-bottom:1.25rem;padding:4px 10px;border-radius:8px;font-size:13px;line-height:1.4;color:#7a4b0c;background:rgba(245, 158, 11, 0.14)}.s-free-shipping-tag svg{inline-size:16px;block-size:16px;flex:none;fill:none;stroke:currentColor;stroke-width:1.6;stroke-linecap:round;stroke-linejoin:round}.visible{visibility:visible}.hidden{display:none}";
8
8
 
9
9
  const SallaFreeShippingTag$1 = /*@__PURE__*/ proxyCustomElement(class SallaFreeShippingTag extends HTMLElement {
10
10
  constructor() {
@@ -15,13 +15,26 @@ const SallaFreeShippingTag$1 = /*@__PURE__*/ proxyCustomElement(class SallaFreeS
15
15
  /** With `fromProductCard`, whether the tag is shown. */
16
16
  this.showFreeShipping = false;
17
17
  this.isFree = false;
18
+ this.timerHidden = false;
18
19
  this.label = '';
19
20
  }
21
+ disconnectedCallback() {
22
+ this.unsubscribe?.();
23
+ }
24
+ // The banner records when the visitor first saw it. Until then, or with the feature off, nothing hides the tag.
25
+ refreshTimer() {
26
+ this.timerHidden = getFreeShippingTimerState()?.visible === false;
27
+ }
20
28
  async componentWillLoad() {
21
29
  try {
22
30
  await salla.onReady();
23
31
  await salla.lang.onLoaded();
24
32
  const fallback = salla.lang.getLocale?.() === 'en' ? 'Free shipping' : 'شحن مجاني';
33
+ // Only follow the timer when there is one (feature on and timer settings present).
34
+ if (isTimerEnabled()) {
35
+ this.unsubscribe = subscribeToFreeShippingTimer(() => this.refreshTimer());
36
+ }
37
+ this.refreshTimer();
25
38
  this.label =
26
39
  salla.lang.getWithDefault?.('pages.products.free_shipping', fallback) || fallback;
27
40
  if (this.fromProductCard) {
@@ -36,7 +49,7 @@ const SallaFreeShippingTag$1 = /*@__PURE__*/ proxyCustomElement(class SallaFreeS
36
49
  }
37
50
  }
38
51
  render() {
39
- if (!this.isFree) {
52
+ if (!this.isFree || this.timerHidden) {
40
53
  return null;
41
54
  }
42
55
  return (h(Host, null, h("div", { class: "s-free-shipping-tag" }, h("svg", { viewBox: "0 0 24 24", "aria-hidden": "true" }, h("path", { d: "M3 6.5h11v9H3zM14 9.5h3.6l2.9 3.2v2.8H14" }), h("circle", { cx: "7.5", cy: "17", r: "1.8" }), h("circle", { cx: "17", cy: "17", r: "1.8" })), h("span", { class: "s-free-shipping-tag-label" }, this.label))));
@@ -48,6 +61,7 @@ const SallaFreeShippingTag$1 = /*@__PURE__*/ proxyCustomElement(class SallaFreeS
48
61
  "fromProductCard": [4, "from-product-card"],
49
62
  "showFreeShipping": [4, "show-free-shipping"],
50
63
  "isFree": [32],
64
+ "timerHidden": [32],
51
65
  "label": [32]
52
66
  }]);
53
67
  function defineCustomElement$1() {