@salla.sa/twilight-components 2.14.594 → 2.14.595

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (331) hide show
  1. package/dist/cjs/{filepond-DtGoIKEP.js → filepond-BmX7bEQk.js} +1 -1
  2. package/dist/cjs/{filepond-plugin-file-poster-DMejMF1-.js → filepond-plugin-file-poster-Cs6e85Vn.js} +1 -1
  3. package/dist/cjs/{filepond-plugin-file-validate-size-J_fE6OBS.js → filepond-plugin-file-validate-size-CSk66JAo.js} +1 -1
  4. package/dist/cjs/{filepond-plugin-file-validate-type-BpewyAzF.js → filepond-plugin-file-validate-type-Piu3p2Um.js} +1 -1
  5. package/dist/cjs/{filepond-plugin-image-edit-DPNUTWCK.js → filepond-plugin-image-edit-Ba9FBal4.js} +1 -1
  6. package/dist/cjs/{filepond-plugin-image-exif-orientation-CZ6YRu70.js → filepond-plugin-image-exif-orientation-zwtgHyrT.js} +1 -1
  7. package/dist/cjs/{filepond-plugin-image-preview-CgV-oWXK.js → filepond-plugin-image-preview-BmGjui8n.js} +1 -1
  8. package/dist/cjs/{index-BziKkkwT.js → index-DkrDtx6i.js} +2 -2
  9. package/dist/cjs/{intlTelInput-BLuZALMt.js → intlTelInput-Bty1-N7J.js} +1 -1
  10. package/dist/cjs/loader.cjs.js +2 -2
  11. package/dist/cjs/salla-accordion-body_2.cjs.entry.js +1 -1
  12. package/dist/cjs/salla-accordion_6.cjs.entry.js +1 -1
  13. package/dist/cjs/salla-add-product-button_5.cjs.entry.js +1 -1
  14. package/dist/cjs/salla-advertisement.cjs.entry.js +1 -1
  15. package/dist/cjs/salla-alert_2.cjs.entry.js +1 -1
  16. package/dist/cjs/salla-app-install-alert.cjs.entry.js +1 -1
  17. package/dist/cjs/salla-applied-filters.cjs.entry.js +1 -1
  18. package/dist/cjs/salla-apps-icons.cjs.entry.js +1 -1
  19. package/dist/cjs/salla-attachment-view_9.cjs.entry.js +10 -10
  20. package/dist/cjs/salla-badge.cjs.entry.js +1 -1
  21. package/dist/cjs/salla-basket-gap.cjs.entry.js +1 -1
  22. package/dist/cjs/salla-bullet-delivery_3.cjs.entry.js +1 -1
  23. package/dist/cjs/salla-cart-coupons.cjs.entry.js +68 -15
  24. package/dist/cjs/salla-cart-item-offers_2.cjs.entry.js +1 -1
  25. package/dist/cjs/salla-cart-summary-card.cjs.entry.js +29 -4
  26. package/dist/cjs/salla-cashback-banner.cjs.entry.js +1 -1
  27. package/dist/cjs/salla-comment-factors.cjs.entry.js +1 -1
  28. package/dist/cjs/salla-comment-form_9.cjs.entry.js +1 -1
  29. package/dist/cjs/salla-conditional-offer.cjs.entry.js +1 -1
  30. package/dist/cjs/salla-contacts.cjs.entry.js +1 -1
  31. package/dist/cjs/salla-cookies-bar.cjs.entry.js +1 -1
  32. package/dist/cjs/salla-count-down.cjs.entry.js +1 -1
  33. package/dist/cjs/salla-custom-fields.cjs.entry.js +1 -1
  34. package/dist/cjs/salla-delivery-promise.cjs.entry.js +1 -1
  35. package/dist/cjs/salla-edit-order-button.cjs.entry.js +1 -1
  36. package/dist/cjs/salla-filters-widget.cjs.entry.js +1 -1
  37. package/dist/cjs/salla-filters.cjs.entry.js +1 -1
  38. package/dist/cjs/salla-fulfillment-methods.cjs.entry.js +1 -1
  39. package/dist/cjs/salla-gift-card-redeem_2.cjs.entry.js +1 -1
  40. package/dist/cjs/salla-gifting.cjs.entry.js +1 -1
  41. package/dist/cjs/salla-hook.cjs.entry.js +1 -1
  42. package/dist/cjs/salla-infinite-scroll.cjs.entry.js +1 -1
  43. package/dist/cjs/salla-installment.cjs.entry.js +1 -1
  44. package/dist/cjs/salla-list-tile.cjs.entry.js +1 -1
  45. package/dist/cjs/salla-localization-modal.cjs.entry.js +1 -1
  46. package/dist/cjs/salla-login-modal.cjs.entry.js +1 -1
  47. package/dist/cjs/salla-loyalty-banner_10.cjs.entry.js +1 -1
  48. package/dist/cjs/salla-loyalty-exchange-product-card.cjs.entry.js +1 -1
  49. package/dist/cjs/salla-loyalty-points-banner.cjs.entry.js +1 -1
  50. package/dist/cjs/salla-loyalty-points-history.cjs.entry.js +1 -1
  51. package/dist/cjs/salla-loyalty-prize-item.cjs.entry.js +1 -1
  52. package/dist/cjs/salla-loyalty.cjs.entry.js +1 -1
  53. package/dist/cjs/salla-maintenance-alert.cjs.entry.js +1 -1
  54. package/dist/cjs/salla-map_3.cjs.entry.js +1 -1
  55. package/dist/cjs/salla-menu.cjs.entry.js +1 -1
  56. package/dist/cjs/salla-metadata.cjs.entry.js +1 -1
  57. package/dist/cjs/salla-multiple-bundle-product-cart_2.cjs.entry.js +1 -1
  58. package/dist/cjs/salla-multiple-bundle-product-options-modal_2.cjs.entry.js +1 -1
  59. package/dist/cjs/salla-multiple-bundle-product.cjs.entry.js +1 -1
  60. package/dist/cjs/salla-next-order-coupon.cjs.entry.js +1 -1
  61. package/dist/cjs/salla-notification-item_2.cjs.entry.js +1 -1
  62. package/dist/cjs/salla-offer-modal.cjs.entry.js +1 -1
  63. package/dist/cjs/salla-offer.cjs.entry.js +1 -1
  64. package/dist/cjs/salla-order-branch.cjs.entry.js +1 -1
  65. package/dist/cjs/salla-order-cancel.cjs.entry.js +1 -1
  66. package/dist/cjs/salla-order-details-multiple-bundle-product.cjs.entry.js +1 -1
  67. package/dist/cjs/salla-order-details-options.cjs.entry.js +1 -1
  68. package/dist/cjs/salla-order-details.cjs.entry.js +1 -1
  69. package/dist/cjs/salla-order-edit-item.cjs.entry.js +1 -1
  70. package/dist/cjs/salla-order-edit-product-card.cjs.entry.js +1 -1
  71. package/dist/cjs/salla-order-edit.cjs.entry.js +1 -1
  72. package/dist/cjs/salla-order-options-modal.cjs.entry.js +1 -1
  73. package/dist/cjs/salla-order-shipments.cjs.entry.js +1 -1
  74. package/dist/cjs/salla-order-summary.cjs.entry.js +1 -1
  75. package/dist/cjs/salla-order-totals-card.cjs.entry.js +1 -1
  76. package/dist/cjs/salla-orders.cjs.entry.js +1 -1
  77. package/dist/cjs/salla-payments.cjs.entry.js +1 -1
  78. package/dist/cjs/salla-placeholder.cjs.entry.js +1 -1
  79. package/dist/cjs/salla-price-range.cjs.entry.js +1 -1
  80. package/dist/cjs/salla-product-card-embed.cjs.entry.js +1 -1
  81. package/dist/cjs/salla-product-card.cjs.entry.js +1 -1
  82. package/dist/cjs/salla-product-size-guide.cjs.entry.js +1 -1
  83. package/dist/cjs/salla-products-list.cjs.entry.js +1 -1
  84. package/dist/cjs/salla-products-slider.cjs.entry.js +1 -1
  85. package/dist/cjs/salla-quick-order.cjs.entry.js +1 -1
  86. package/dist/cjs/salla-rating-modal-v2.cjs.entry.js +1 -1
  87. package/dist/cjs/salla-rating-modal.cjs.entry.js +1 -1
  88. package/dist/cjs/salla-review-factors-tags.cjs.entry.js +1 -1
  89. package/dist/cjs/salla-review-order-item.cjs.entry.js +1 -1
  90. package/dist/cjs/salla-scopes.cjs.entry.js +1 -1
  91. package/dist/cjs/salla-search-product-card.cjs.entry.js +1 -1
  92. package/dist/cjs/salla-search.cjs.entry.js +1 -1
  93. package/dist/cjs/salla-skeleton.cjs.entry.js +1 -1
  94. package/dist/cjs/salla-social-share.cjs.entry.js +1 -1
  95. package/dist/cjs/salla-social.cjs.entry.js +1 -1
  96. package/dist/cjs/salla-tab-content_3.cjs.entry.js +1 -1
  97. package/dist/cjs/salla-tiered-offer.cjs.entry.js +1 -1
  98. package/dist/cjs/salla-trust-badges.cjs.entry.js +1 -1
  99. package/dist/cjs/salla-user-menu.cjs.entry.js +1 -1
  100. package/dist/cjs/salla-user-profile.cjs.entry.js +1 -1
  101. package/dist/cjs/salla-user-settings.cjs.entry.js +1 -1
  102. package/dist/cjs/salla-verify.cjs.entry.js +1 -1
  103. package/dist/cjs/salla-wallet.cjs.entry.js +1 -1
  104. package/dist/cjs/salla-wishlist-actions.cjs.entry.js +1 -1
  105. package/dist/cjs/salla-wishlist-summary.cjs.entry.js +1 -1
  106. package/dist/cjs/twilight.cjs.js +2 -2
  107. package/dist/cjs/{vanilla-picker-36O-wrIX.js → vanilla-picker-DgPfWupN.js} +1 -1
  108. package/dist/collection/components/salla-cart-coupons/salla-cart-coupons.js +69 -15
  109. package/dist/collection/components/salla-cart-summary-card/salla-cart-summary-card.js +30 -3
  110. package/dist/components/index.js +2 -2
  111. package/dist/components/salla-cart-coupons.js +68 -14
  112. package/dist/components/salla-cart-summary-card.js +30 -3
  113. package/dist/docs.json +1 -1
  114. package/dist/esm/{filepond-DZJO0NDO.js → filepond-DF26o67L.js} +1 -1
  115. package/dist/esm/{filepond-plugin-file-poster-BGjhc2cd.js → filepond-plugin-file-poster-B4epzDDH.js} +1 -1
  116. package/dist/esm/{filepond-plugin-file-validate-size-s9w1K7Bl.js → filepond-plugin-file-validate-size-DILJc03j.js} +1 -1
  117. package/dist/esm/{filepond-plugin-file-validate-type-OfI6GFgP.js → filepond-plugin-file-validate-type-Bic7dGts.js} +1 -1
  118. package/dist/esm/{filepond-plugin-image-edit-Cfselyr4.js → filepond-plugin-image-edit-DHfCLKK0.js} +1 -1
  119. package/dist/esm/{filepond-plugin-image-exif-orientation-ConUo4eP.js → filepond-plugin-image-exif-orientation-C7y59Hrn.js} +1 -1
  120. package/dist/esm/{filepond-plugin-image-preview-BJ4T10Ty.js → filepond-plugin-image-preview-C-ZqWLeC.js} +1 -1
  121. package/dist/esm/{index-Bxge4xib.js → index-HRJpfiBN.js} +2 -2
  122. package/dist/esm/{intlTelInput-B-IoM3ox.js → intlTelInput-DOVRUqFb.js} +1 -1
  123. package/dist/esm/loader.js +3 -3
  124. package/dist/esm/salla-accordion-body_2.entry.js +1 -1
  125. package/dist/esm/salla-accordion_6.entry.js +1 -1
  126. package/dist/esm/salla-add-product-button_5.entry.js +1 -1
  127. package/dist/esm/salla-advertisement.entry.js +1 -1
  128. package/dist/esm/salla-alert_2.entry.js +1 -1
  129. package/dist/esm/salla-app-install-alert.entry.js +1 -1
  130. package/dist/esm/salla-applied-filters.entry.js +1 -1
  131. package/dist/esm/salla-apps-icons.entry.js +1 -1
  132. package/dist/esm/salla-attachment-view_9.entry.js +10 -10
  133. package/dist/esm/salla-badge.entry.js +1 -1
  134. package/dist/esm/salla-basket-gap.entry.js +1 -1
  135. package/dist/esm/salla-bullet-delivery_3.entry.js +1 -1
  136. package/dist/esm/salla-cart-coupons.entry.js +68 -15
  137. package/dist/esm/salla-cart-item-offers_2.entry.js +1 -1
  138. package/dist/esm/salla-cart-summary-card.entry.js +29 -4
  139. package/dist/esm/salla-cashback-banner.entry.js +1 -1
  140. package/dist/esm/salla-comment-factors.entry.js +1 -1
  141. package/dist/esm/salla-comment-form_9.entry.js +1 -1
  142. package/dist/esm/salla-conditional-offer.entry.js +1 -1
  143. package/dist/esm/salla-contacts.entry.js +1 -1
  144. package/dist/esm/salla-cookies-bar.entry.js +1 -1
  145. package/dist/esm/salla-count-down.entry.js +1 -1
  146. package/dist/esm/salla-custom-fields.entry.js +1 -1
  147. package/dist/esm/salla-delivery-promise.entry.js +1 -1
  148. package/dist/esm/salla-edit-order-button.entry.js +1 -1
  149. package/dist/esm/salla-filters-widget.entry.js +1 -1
  150. package/dist/esm/salla-filters.entry.js +1 -1
  151. package/dist/esm/salla-fulfillment-methods.entry.js +1 -1
  152. package/dist/esm/salla-gift-card-redeem_2.entry.js +1 -1
  153. package/dist/esm/salla-gifting.entry.js +1 -1
  154. package/dist/esm/salla-hook.entry.js +1 -1
  155. package/dist/esm/salla-infinite-scroll.entry.js +1 -1
  156. package/dist/esm/salla-installment.entry.js +1 -1
  157. package/dist/esm/salla-list-tile.entry.js +1 -1
  158. package/dist/esm/salla-localization-modal.entry.js +1 -1
  159. package/dist/esm/salla-login-modal.entry.js +1 -1
  160. package/dist/esm/salla-loyalty-banner_10.entry.js +1 -1
  161. package/dist/esm/salla-loyalty-exchange-product-card.entry.js +1 -1
  162. package/dist/esm/salla-loyalty-points-banner.entry.js +1 -1
  163. package/dist/esm/salla-loyalty-points-history.entry.js +1 -1
  164. package/dist/esm/salla-loyalty-prize-item.entry.js +1 -1
  165. package/dist/esm/salla-loyalty.entry.js +1 -1
  166. package/dist/esm/salla-maintenance-alert.entry.js +1 -1
  167. package/dist/esm/salla-map_3.entry.js +1 -1
  168. package/dist/esm/salla-menu.entry.js +1 -1
  169. package/dist/esm/salla-metadata.entry.js +1 -1
  170. package/dist/esm/salla-multiple-bundle-product-cart_2.entry.js +1 -1
  171. package/dist/esm/salla-multiple-bundle-product-options-modal_2.entry.js +1 -1
  172. package/dist/esm/salla-multiple-bundle-product.entry.js +1 -1
  173. package/dist/esm/salla-next-order-coupon.entry.js +1 -1
  174. package/dist/esm/salla-notification-item_2.entry.js +1 -1
  175. package/dist/esm/salla-offer-modal.entry.js +1 -1
  176. package/dist/esm/salla-offer.entry.js +1 -1
  177. package/dist/esm/salla-order-branch.entry.js +1 -1
  178. package/dist/esm/salla-order-cancel.entry.js +1 -1
  179. package/dist/esm/salla-order-details-multiple-bundle-product.entry.js +1 -1
  180. package/dist/esm/salla-order-details-options.entry.js +1 -1
  181. package/dist/esm/salla-order-details.entry.js +1 -1
  182. package/dist/esm/salla-order-edit-item.entry.js +1 -1
  183. package/dist/esm/salla-order-edit-product-card.entry.js +1 -1
  184. package/dist/esm/salla-order-edit.entry.js +1 -1
  185. package/dist/esm/salla-order-options-modal.entry.js +1 -1
  186. package/dist/esm/salla-order-shipments.entry.js +1 -1
  187. package/dist/esm/salla-order-summary.entry.js +1 -1
  188. package/dist/esm/salla-order-totals-card.entry.js +1 -1
  189. package/dist/esm/salla-orders.entry.js +1 -1
  190. package/dist/esm/salla-payments.entry.js +1 -1
  191. package/dist/esm/salla-placeholder.entry.js +1 -1
  192. package/dist/esm/salla-price-range.entry.js +1 -1
  193. package/dist/esm/salla-product-card-embed.entry.js +1 -1
  194. package/dist/esm/salla-product-card.entry.js +1 -1
  195. package/dist/esm/salla-product-size-guide.entry.js +1 -1
  196. package/dist/esm/salla-products-list.entry.js +1 -1
  197. package/dist/esm/salla-products-slider.entry.js +1 -1
  198. package/dist/esm/salla-quick-order.entry.js +1 -1
  199. package/dist/esm/salla-rating-modal-v2.entry.js +1 -1
  200. package/dist/esm/salla-rating-modal.entry.js +1 -1
  201. package/dist/esm/salla-review-factors-tags.entry.js +1 -1
  202. package/dist/esm/salla-review-order-item.entry.js +1 -1
  203. package/dist/esm/salla-scopes.entry.js +1 -1
  204. package/dist/esm/salla-search-product-card.entry.js +1 -1
  205. package/dist/esm/salla-search.entry.js +1 -1
  206. package/dist/esm/salla-skeleton.entry.js +1 -1
  207. package/dist/esm/salla-social-share.entry.js +1 -1
  208. package/dist/esm/salla-social.entry.js +1 -1
  209. package/dist/esm/salla-tab-content_3.entry.js +1 -1
  210. package/dist/esm/salla-tiered-offer.entry.js +1 -1
  211. package/dist/esm/salla-trust-badges.entry.js +1 -1
  212. package/dist/esm/salla-user-menu.entry.js +1 -1
  213. package/dist/esm/salla-user-profile.entry.js +1 -1
  214. package/dist/esm/salla-user-settings.entry.js +1 -1
  215. package/dist/esm/salla-verify.entry.js +1 -1
  216. package/dist/esm/salla-wallet.entry.js +1 -1
  217. package/dist/esm/salla-wishlist-actions.entry.js +1 -1
  218. package/dist/esm/salla-wishlist-summary.entry.js +1 -1
  219. package/dist/esm/twilight.js +3 -3
  220. package/dist/esm/{vanilla-picker-D1RSTlum.js → vanilla-picker-DQKehCLa.js} +1 -1
  221. package/dist/twilight/{p-5b3a04cd.entry.js → p-02d79968.entry.js} +1 -1
  222. package/dist/twilight/{p-e19a980b.entry.js → p-078e5ef8.entry.js} +1 -1
  223. package/dist/twilight/{p-f22ec479.entry.js → p-07e1822a.entry.js} +1 -1
  224. package/dist/twilight/{p-34454493.entry.js → p-0e430b25.entry.js} +1 -1
  225. package/dist/twilight/{p-d9188e76.entry.js → p-100260a2.entry.js} +1 -1
  226. package/dist/twilight/{p-a912d6a3.entry.js → p-117c8823.entry.js} +1 -1
  227. package/dist/twilight/{p-30b7383a.entry.js → p-119aa7c1.entry.js} +1 -1
  228. package/dist/twilight/{p-aafa69d6.entry.js → p-14b78c6e.entry.js} +1 -1
  229. package/dist/twilight/{p-790ea507.entry.js → p-155f1fed.entry.js} +1 -1
  230. package/dist/twilight/{p-a3a69984.entry.js → p-16b45c19.entry.js} +1 -1
  231. package/dist/twilight/{p-3e02b792.entry.js → p-1a684490.entry.js} +1 -1
  232. package/dist/twilight/{p-6b90f160.entry.js → p-1b0da3b9.entry.js} +1 -1
  233. package/dist/twilight/{p-abfbba72.entry.js → p-20d5665b.entry.js} +1 -1
  234. package/dist/twilight/{p-d1e4e15e.entry.js → p-231d4bf2.entry.js} +1 -1
  235. package/dist/twilight/{p-4362756f.entry.js → p-235f40b0.entry.js} +1 -1
  236. package/dist/twilight/{p-d38b5aaa.entry.js → p-2413d450.entry.js} +1 -1
  237. package/dist/twilight/{p-fb119c27.entry.js → p-25ea21a6.entry.js} +1 -1
  238. package/dist/twilight/{p-2ef59b30.entry.js → p-2c13b5e8.entry.js} +1 -1
  239. package/dist/twilight/{p-106ea7ed.entry.js → p-2f96a72f.entry.js} +1 -1
  240. package/dist/twilight/{p-66131771.entry.js → p-312d231b.entry.js} +1 -1
  241. package/dist/twilight/{p-125482ce.entry.js → p-313dbe67.entry.js} +1 -1
  242. package/dist/twilight/{p-e1b0dafc.entry.js → p-334fc442.entry.js} +1 -1
  243. package/dist/twilight/{p-2510973e.entry.js → p-33a64882.entry.js} +1 -1
  244. package/dist/twilight/{p-78963d5d.entry.js → p-3c0be6b1.entry.js} +1 -1
  245. package/dist/twilight/{p-c16b9f4a.entry.js → p-3e232b09.entry.js} +1 -1
  246. package/dist/twilight/{p-1b56374e.entry.js → p-3f376a9d.entry.js} +1 -1
  247. package/dist/twilight/{p-b3213fee.entry.js → p-46ad2b0e.entry.js} +1 -1
  248. package/dist/twilight/{p-c476eaab.entry.js → p-49d6d82e.entry.js} +1 -1
  249. package/dist/twilight/{p-4543b3b3.entry.js → p-49e2f73d.entry.js} +1 -1
  250. package/dist/twilight/{p-b8661b67.entry.js → p-4cee6b43.entry.js} +1 -1
  251. package/dist/twilight/{p-51243641.entry.js → p-4e0dcb5c.entry.js} +1 -1
  252. package/dist/twilight/{p-35bc566f.entry.js → p-4e3a3c55.entry.js} +1 -1
  253. package/dist/twilight/{p-6bfcdb38.entry.js → p-4e74c79f.entry.js} +1 -1
  254. package/dist/twilight/{p-db53740d.entry.js → p-4f9da81b.entry.js} +1 -1
  255. package/dist/twilight/{p-2c8b8935.entry.js → p-5134faef.entry.js} +1 -1
  256. package/dist/twilight/p-5b617110.entry.js +4 -0
  257. package/dist/twilight/{p-6d3d5a0b.entry.js → p-5bc3f956.entry.js} +1 -1
  258. package/dist/twilight/{p-42162de9.entry.js → p-5f0eca54.entry.js} +1 -1
  259. package/dist/twilight/{p-8c229520.entry.js → p-5fae444a.entry.js} +1 -1
  260. package/dist/twilight/{p-b1dc78db.entry.js → p-61c8e3c6.entry.js} +1 -1
  261. package/dist/twilight/{p-15824030.entry.js → p-6e8cb8fb.entry.js} +1 -1
  262. package/dist/twilight/{p-22f21c95.entry.js → p-6feb378a.entry.js} +1 -1
  263. package/dist/twilight/{p-c903b6bb.entry.js → p-70c45a90.entry.js} +1 -1
  264. package/dist/twilight/{p-988f6193.entry.js → p-73b8ed51.entry.js} +1 -1
  265. package/dist/twilight/p-75ed7d4e.entry.js +4 -0
  266. package/dist/twilight/{p-f4c94e30.entry.js → p-761e273c.entry.js} +1 -1
  267. package/dist/twilight/{p-aa96807e.entry.js → p-768f5c26.entry.js} +1 -1
  268. package/dist/twilight/{p-b6918b2b.entry.js → p-76f49fd8.entry.js} +1 -1
  269. package/dist/twilight/{p-4457a289.entry.js → p-7960e489.entry.js} +1 -1
  270. package/dist/twilight/{p-21d1a687.entry.js → p-7f38cf0c.entry.js} +1 -1
  271. package/dist/twilight/{p-2e5bace8.entry.js → p-7f58cf36.entry.js} +1 -1
  272. package/dist/twilight/{p-4cedf139.entry.js → p-83edd1a1.entry.js} +1 -1
  273. package/dist/twilight/{p-f046edd3.entry.js → p-845e4790.entry.js} +1 -1
  274. package/dist/twilight/{p-df407f01.entry.js → p-84c56f4d.entry.js} +1 -1
  275. package/dist/twilight/{p-e7e52491.entry.js → p-8688c21f.entry.js} +1 -1
  276. package/dist/twilight/{p-00cb1c25.entry.js → p-87d34b7c.entry.js} +1 -1
  277. package/dist/twilight/{p-79bb0c41.entry.js → p-8be3fa1c.entry.js} +1 -1
  278. package/dist/twilight/{p-751ff32d.entry.js → p-8dc7ae26.entry.js} +1 -1
  279. package/dist/twilight/{p-0d464350.entry.js → p-8e0a33dd.entry.js} +1 -1
  280. package/dist/twilight/{p-6e42d70f.entry.js → p-8eabd62f.entry.js} +1 -1
  281. package/dist/twilight/{p-b2322278.entry.js → p-8f0b6a64.entry.js} +1 -1
  282. package/dist/twilight/{p-d6d7c6a1.entry.js → p-8fc42a50.entry.js} +1 -1
  283. package/dist/twilight/{p-1d551b52.entry.js → p-943f3e5a.entry.js} +1 -1
  284. package/dist/twilight/{p-c4bf8d24.entry.js → p-96317fc8.entry.js} +1 -1
  285. package/dist/twilight/{p-2c2f0608.entry.js → p-96560ca2.entry.js} +1 -1
  286. package/dist/twilight/{p-0bbd0d06.entry.js → p-97b51153.entry.js} +1 -1
  287. package/dist/twilight/{p-614b7b61.entry.js → p-9a4a84b8.entry.js} +1 -1
  288. package/dist/twilight/{p-bff2400f.entry.js → p-9a723216.entry.js} +1 -1
  289. package/dist/twilight/{p-6e57ff9f.entry.js → p-9c1bf3fb.entry.js} +1 -1
  290. package/dist/twilight/{p-BXAODWDa.js → p-BCFB-lfz.js} +1 -1
  291. package/dist/twilight/{p-EiLe0Yi_.js → p-BFMu9w68.js} +1 -1
  292. package/dist/twilight/{p-B5twlAuI.js → p-BGUXYEQf.js} +1 -1
  293. package/dist/twilight/{p-CWLJmpv-.js → p-BdaR2plD.js} +1 -1
  294. package/dist/twilight/{p-CINox5XU.js → p-CSRWBUvd.js} +1 -1
  295. package/dist/twilight/{p-W-AkIawg.js → p-CliIfO7G.js} +1 -1
  296. package/dist/twilight/{p-DKEu8h4M.js → p-D1oXS6KY.js} +1 -1
  297. package/dist/twilight/{p-BkWctmFE.js → p-DlxVucku.js} +1 -1
  298. package/dist/twilight/{p-Bxge4xib.js → p-HRJpfiBN.js} +1 -1
  299. package/dist/twilight/{p-DnoH14HK.js → p-O5jKs1Zb.js} +1 -1
  300. package/dist/twilight/{p-572a1f84.entry.js → p-a2cbbc56.entry.js} +1 -1
  301. package/dist/twilight/{p-fd615606.entry.js → p-a3009d00.entry.js} +1 -1
  302. package/dist/twilight/{p-fd6fc043.entry.js → p-b202c2d3.entry.js} +1 -1
  303. package/dist/twilight/{p-57097563.entry.js → p-b2b896d1.entry.js} +1 -1
  304. package/dist/twilight/{p-530b513d.entry.js → p-b66c664b.entry.js} +1 -1
  305. package/dist/twilight/{p-fae38591.entry.js → p-c327bc95.entry.js} +1 -1
  306. package/dist/twilight/{p-30f24d97.entry.js → p-c3afee2f.entry.js} +1 -1
  307. package/dist/twilight/{p-94e85b3c.entry.js → p-c699207a.entry.js} +1 -1
  308. package/dist/twilight/{p-94970458.entry.js → p-c89d7291.entry.js} +1 -1
  309. package/dist/twilight/{p-1769ead6.entry.js → p-c8d4b211.entry.js} +1 -1
  310. package/dist/twilight/{p-be3f6dbe.entry.js → p-c919171b.entry.js} +1 -1
  311. package/dist/twilight/{p-64c76ad9.entry.js → p-d565b168.entry.js} +1 -1
  312. package/dist/twilight/{p-ebbb25fc.entry.js → p-d7a70a29.entry.js} +1 -1
  313. package/dist/twilight/{p-52012794.entry.js → p-d8181149.entry.js} +1 -1
  314. package/dist/twilight/{p-0835d9ab.entry.js → p-d8a5198b.entry.js} +1 -1
  315. package/dist/twilight/{p-a37bc663.entry.js → p-db27df13.entry.js} +1 -1
  316. package/dist/twilight/{p-0e1a454b.entry.js → p-df8c51c2.entry.js} +1 -1
  317. package/dist/twilight/{p-c0274022.entry.js → p-e4d76bce.entry.js} +1 -1
  318. package/dist/twilight/{p-3162901e.entry.js → p-eb6f86fb.entry.js} +1 -1
  319. package/dist/twilight/{p-9f0459ec.entry.js → p-ee23fbba.entry.js} +1 -1
  320. package/dist/twilight/{p-59256d82.entry.js → p-ee8d13fd.entry.js} +1 -1
  321. package/dist/twilight/{p-7ed0db2e.entry.js → p-ef09a761.entry.js} +1 -1
  322. package/dist/twilight/{p-09e56514.entry.js → p-f5e46494.entry.js} +1 -1
  323. package/dist/twilight/{p-35c0ca9a.entry.js → p-f9abcf4f.entry.js} +1 -1
  324. package/dist/twilight/{p-51e8c2b2.entry.js → p-fd0d136d.entry.js} +1 -1
  325. package/dist/twilight/{p-d2e929bd.entry.js → p-fe72290f.entry.js} +1 -1
  326. package/dist/twilight/twilight.esm.js +1 -1
  327. package/dist/types/components/salla-cart-coupons/salla-cart-coupons.d.ts +14 -0
  328. package/dist/types/components/salla-cart-summary-card/salla-cart-summary-card.d.ts +3 -0
  329. package/package.json +5 -5
  330. package/dist/twilight/p-84308a79.entry.js +0 -4
  331. package/dist/twilight/p-df313b00.entry.js +0 -4
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r as t,h as i,H as e}from"./p-Bxge4xib.js";import{f as s,g as l}from"./p-DqXpn47Z.js";const a=class{constructor(i){t(this,i),this.productRatings=[],this.allowUpdate=!1}async componentWillLoad(){await salla.onReady(),await this.loadOrderItem()}async onProductIdChange(){this.orderItem=void 0,this.productRatings=[],await this.loadOrderItem()}resolveFetchOrderId(){return salla.config.get("page.id")}sameId(t,i){return null!=t&&null!=i&&String(t)===String(i)}label(t,i){return"function"==typeof salla?.lang?.getWithDefault?salla.lang.getWithDefault(t,i):salla?.lang?.get?.(t)||i}toOrderItemRating(t){return{id:t.id??t.feedback_id,stars:t.stars??t.rating,content:t.content||"",is_pending:t.is_pending,can_update:t.can_update,images:t.images||[],videos:t.videos||[],product:t.product}}resolveOrderItem(t,i){const e=Array.isArray(t?.items)?t.items:[],s=i.find((t=>this.sameId(t.product?.id,this.productId)));if(!s)return;const l=e.find((t=>this.sameId(t.product?.id,this.productId)))||{product:s.product||{id:this.productId}};return{...l,product:l.product||s.product||{id:this.productId},rating:this.toOrderItemRating(s)}}async loadOrderItem(){const t=this.resolveFetchOrderId();if(t&&null!=this.productId&&""!==this.productId){this.fetchOrderId=t,this.allowUpdate=!!salla.config.get("store.settings.rating.allow_update");try{const i=await s(t);this.productRatings=l(i?.rating),this.orderItem=this.resolveOrderItem(i,this.productRatings)}catch(t){console.error("[salla-review-order-item] failed to load order item review",t)}}}renderActions(t){const e=t.rating;return e&&this.allowUpdate?i("div",{class:"rating-actions"},i("div",{class:"tooltip-toggle tooltip-toggle--hover icon-trigger mobile-shifted"},e.can_update?null:i("div",{class:"tooltip-content shadow-md rounded"},i("small",null,this.label("pages.order.edit_period_ended","انتهت مدة التعديل"),".")),i("salla-button",{"loader-position":"center",disabled:!e.can_update,shape:"icon",fill:"outline",color:"dark",size:"medium",onClick:()=>e.can_update?salla.event.dispatch("rating::edit",{type:"product",feedback_id:e.id}):void 0},i("i",{class:"sicon-format-border-color text-xl"}))),i("div",{class:"tooltip-toggle tooltip-toggle--hover icon-trigger mobile-shifted"},e.can_update?null:i("div",{class:"tooltip-content shadow-md rounded"},i("small",null,this.label("pages.order.delete_period_ended","انتهت مدة الحذف"),".")),i("salla-button",{"loader-position":"center",disabled:!e.can_update,shape:"icon",color:"danger",fill:"outline",size:"medium",onClick:()=>e.can_update?salla.event.dispatch("rating::delete",{feedback_id:e.id}):void 0},i("i",{class:"sicon-trash-2 text-xl"})))):null}serializeRatingMedia(t){return JSON.stringify({images:t.images||[],videos:t.videos||[],product:t.product})}serializeProductRatings(){return JSON.stringify(this.productRatings)}render(){const t=this.orderItem,s=t?.rating;return t&&s&&this.fetchOrderId?i(e,null,i("section",{class:"flex justify-between items-start border-t mt-10 pt-8"},i("div",null,i("p",{innerHTML:s.content||""}),s.is_pending?i("span",null,this.label("pages.rating.pending","قيد المراجعة")):null,i("div",{class:"flex flex-row flex-wrap gap-2"},i("salla-rating-stars",{size:"large",value:s.stars}),i("salla-review-factors-tags",{"order-id":this.fetchOrderId,"rating-id":s.id,"product-id":t.product?.id})),i("div",{class:"mt-2"},i("salla-attachments",{rating:this.serializeRatingMedia(s),"product-ratings":this.serializeProductRatings(),"product-id":t.product?.id??null,"max-visible":8,clickable:!0}))),this.renderActions(t))):i(e,null)}static get watchers(){return{productId:["onProductIdChange"]}}};export{a as salla_review_order_item}
4
+ import{r as t,h as i,H as e}from"./p-HRJpfiBN.js";import{f as s,g as l}from"./p-DqXpn47Z.js";const a=class{constructor(i){t(this,i),this.productRatings=[],this.allowUpdate=!1}async componentWillLoad(){await salla.onReady(),await this.loadOrderItem()}async onProductIdChange(){this.orderItem=void 0,this.productRatings=[],await this.loadOrderItem()}resolveFetchOrderId(){return salla.config.get("page.id")}sameId(t,i){return null!=t&&null!=i&&String(t)===String(i)}label(t,i){return"function"==typeof salla?.lang?.getWithDefault?salla.lang.getWithDefault(t,i):salla?.lang?.get?.(t)||i}toOrderItemRating(t){return{id:t.id??t.feedback_id,stars:t.stars??t.rating,content:t.content||"",is_pending:t.is_pending,can_update:t.can_update,images:t.images||[],videos:t.videos||[],product:t.product}}resolveOrderItem(t,i){const e=Array.isArray(t?.items)?t.items:[],s=i.find((t=>this.sameId(t.product?.id,this.productId)));if(!s)return;const l=e.find((t=>this.sameId(t.product?.id,this.productId)))||{product:s.product||{id:this.productId}};return{...l,product:l.product||s.product||{id:this.productId},rating:this.toOrderItemRating(s)}}async loadOrderItem(){const t=this.resolveFetchOrderId();if(t&&null!=this.productId&&""!==this.productId){this.fetchOrderId=t,this.allowUpdate=!!salla.config.get("store.settings.rating.allow_update");try{const i=await s(t);this.productRatings=l(i?.rating),this.orderItem=this.resolveOrderItem(i,this.productRatings)}catch(t){console.error("[salla-review-order-item] failed to load order item review",t)}}}renderActions(t){const e=t.rating;return e&&this.allowUpdate?i("div",{class:"rating-actions"},i("div",{class:"tooltip-toggle tooltip-toggle--hover icon-trigger mobile-shifted"},e.can_update?null:i("div",{class:"tooltip-content shadow-md rounded"},i("small",null,this.label("pages.order.edit_period_ended","انتهت مدة التعديل"),".")),i("salla-button",{"loader-position":"center",disabled:!e.can_update,shape:"icon",fill:"outline",color:"dark",size:"medium",onClick:()=>e.can_update?salla.event.dispatch("rating::edit",{type:"product",feedback_id:e.id}):void 0},i("i",{class:"sicon-format-border-color text-xl"}))),i("div",{class:"tooltip-toggle tooltip-toggle--hover icon-trigger mobile-shifted"},e.can_update?null:i("div",{class:"tooltip-content shadow-md rounded"},i("small",null,this.label("pages.order.delete_period_ended","انتهت مدة الحذف"),".")),i("salla-button",{"loader-position":"center",disabled:!e.can_update,shape:"icon",color:"danger",fill:"outline",size:"medium",onClick:()=>e.can_update?salla.event.dispatch("rating::delete",{feedback_id:e.id}):void 0},i("i",{class:"sicon-trash-2 text-xl"})))):null}serializeRatingMedia(t){return JSON.stringify({images:t.images||[],videos:t.videos||[],product:t.product})}serializeProductRatings(){return JSON.stringify(this.productRatings)}render(){const t=this.orderItem,s=t?.rating;return t&&s&&this.fetchOrderId?i(e,null,i("section",{class:"flex justify-between items-start border-t mt-10 pt-8"},i("div",null,i("p",{innerHTML:s.content||""}),s.is_pending?i("span",null,this.label("pages.rating.pending","قيد المراجعة")):null,i("div",{class:"flex flex-row flex-wrap gap-2"},i("salla-rating-stars",{size:"large",value:s.stars}),i("salla-review-factors-tags",{"order-id":this.fetchOrderId,"rating-id":s.id,"product-id":t.product?.id})),i("div",{class:"mt-2"},i("salla-attachments",{rating:this.serializeRatingMedia(s),"product-ratings":this.serializeProductRatings(),"product-id":t.product?.id??null,"max-visible":8,clickable:!0}))),this.renderActions(t))):i(e,null)}static get watchers(){return{productId:["onProductIdChange"]}}};export{a as salla_review_order_item}
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r,h as e,a as t}from"./p-Bxge4xib.js";import{S as s}from"./p-BscTeWDc.js";import{C as a}from"./p-BsLF_HK7.js";import{A as i,a as o}from"./p-Vqpj4CWE.js";import{H as c}from"./p-Brgf4SAC.js";import"./p-CgtvEd63.js";const n="salla::search-history";function l(){if("undefined"==typeof window)return n;const r=new URLSearchParams(window.location.search).get("scope");return r?`${n}-${r}`:n}const h={searchPlaceholder:"",noOptions:"",outOfStock:"",close:"",back:"",remove:"",searchHistory:"",trendingCategories:"",mostSearched:"",searchSuggestions:"",categories:"",searchResults:"",searchViewAllTemplate:""},d={"common.elements.search_history":{ar:"آخر ما تم البحث عنه",en:"Recently Searched"},"common.elements.trending_categories":{ar:"التصنيفات الأكثر بحثاً",en:"Trending categories"},"common.elements.most_searched":{ar:"المنتجات الأكثر بحثاً",en:"Trending products"},"common.elements.search_suggestions":{ar:"اقتراحات البحث",en:"Search suggestions"},"common.elements.categories":{ar:"التصنيفات",en:"Categories"},"common.elements.search_results":{ar:"نتائج البحث",en:"Search results"},"common.elements.search_view_all":{ar:'عرض كل النتائج لـ ":word"',en:'View all results for ":word"'}};function p(r){return salla.url.get("search?q="+encodeURI(r))}function m(r,e){const[t,s=""]=r.split("?"),a=new URLSearchParams(s);return a.set("_svs",e),`${t}?${a.toString()}`}function g(r){const e=l();salla.storage.set(e,r)}const w={trendingCategories:[],mostSearchedProducts:[]};let u=null;const b=class{constructor(e){r(this,e),this.hasTrackedFocus=!1,this.hasLoadedPopularSearches=!1,this.translationLoaded=!1,this.labels=h,this.loading=!1,this.typing=!1,this.debounce=setTimeout((()=>""),1e3),this.search_term="",this.hasInputValue=!1,this.searchHistory=function(){const r=l(),e=salla.storage.get(r,[]);return Array.isArray(e)?e.filter((r=>"string"==typeof r)):[]}(),this.trendingCategories=[],this.mostSearchedProducts=[],this.placeholder=!1,this.inline=!1,this.oval=!1,this.height=60,this.maxWords=5,this.showAction=!1,this.tracking={searchFocus:()=>{this.hasTrackedFocus||(this.hasTrackedFocus=!0,salla.event.emit("salla-search::input.focused"))},productClick:(r,e)=>{c.saveProductSource("search"),this.commitSearchHistory(this.search_term),salla.event.emit("salla-search::product.clicked",[{product:r,position:e}])},recommendationClick:(r,e)=>{salla.event.emit("salla-search::recommendation.clicked",{term:r,source:e})}},salla.event.on("search::open",(()=>this.open()))}async open(){this.hasLoadedPopularSearches||(this.hasLoadedPopularSearches=!0,function(){if(!u){const r=salla.search.popular().then((r=>({trendingCategories:(r?.data?.categories||[]).map((r=>({name:r.name,url:m(salla.url.create("categories",r.id),"search-trending")}))),mostSearchedProducts:(r?.data?.products||[]).map((r=>({name:r.name,url:m(salla.url.create("products",r.id),"search-trending")})))}))).catch((()=>(u=null,w)));u=r}return u}().then((({trendingCategories:r,mostSearchedProducts:e})=>{this.trendingCategories=r,this.mostSearchedProducts=e}))),await(this.modal?.open().then((()=>setTimeout((()=>this.searchInput?.focus()),300))))}handleModalVisibilityChanged(r){r.target!==this.modal||r.detail||this.onModalClose()}onModalClose(){this.searchInput&&(this.searchInput.value=""),this.results=void 0,this.search_term="",this.hasInputValue=!1,this.afterSearching()}handleKeyDown(r){if("Enter"!==r.key)return;const e=this.searchInput?.value??"";e.length<=2||(e!==this.search_term&&(clearTimeout(this.debounce),this.typing=!1,this.search_term=e),this.commitSearchHistory(e),this.searchInput&&(this.searchInput.value=""),this.hasInputValue=!1,setTimeout((()=>{window.location.href=p(e)}),100))}commitSearchHistory(r){r&&(this.searchHistory=function(r,e){const t=e.trim();if(!t)return r;const s=r.filter((r=>r.toLowerCase()!==t.toLowerCase()));return[t,...s].slice(0,10)}(this.searchHistory,r),g(this.searchHistory))}removeFromSearchHistory(r){this.searchHistory=this.searchHistory.filter((e=>e!==r)),g(this.searchHistory),this.afterSearching()}async componentWillLoad(){await salla.lang.onLoaded(),function(){if(!salla?.lang?.addBulk)return;const r=Object.entries(d).reduce(((r,[e,t])=>(salla.lang.get(e)===e&&(r[e]=t),r)),{});Object.keys(r).length&&salla.lang.addBulk(r)}(),this.labels={searchPlaceholder:salla.lang.get("blocks.header.search_placeholder"),noOptions:salla.lang.get("common.elements.no_options"),outOfStock:salla.lang.get("pages.products.out_of_stock"),close:salla.lang.get("common.elements.close"),back:salla.lang.get("common.elements.back"),remove:salla.lang.get("common.elements.remove"),searchHistory:salla.lang.get("common.elements.search_history"),trendingCategories:salla.lang.get("common.elements.trending_categories"),mostSearched:salla.lang.get("common.elements.most_searched"),searchSuggestions:salla.lang.get("common.elements.search_suggestions"),categories:salla.lang.get("common.elements.categories"),searchResults:salla.lang.get("common.elements.search_results"),searchViewAllTemplate:salla.lang.get("common.elements.search_view_all")},this.translationLoaded=!0}debounceSearch(r){this.typing=!0,clearTimeout(this.debounce),this.debounce=setTimeout((()=>{this.typing=!1,this.search_term=r.target.value}),700)}limitWordsAndSearch(r){let e=r.target.value;this.hasInputValue=e.length>0;const t=e.trim().split(/\s+/);if(t.length>this.maxWords){const r=t.slice(0,this.maxWords).join(" ");this.searchInput&&(this.searchInput.value=r)}this.debounceSearch(r)}getQueryParam(r){return new URLSearchParams(window.location.search).get(r)}handleActionClick(){if(this.search_term&&this.search_term.length>2)return this.search(this.search_term)}handleSearch(r){r.length>2?this.search(r):(this.results=void 0,this.afterSearching())}search(r){this.loading=!0,salla.product.fetch({source:"search",source_value:r}).then((e=>{this.results=e,salla.event.emit("Products Searched",{query:r,total:e.data?.length,metadata:e.metadata})})).catch((r=>"Query is same as previous one!"!==r?this.results=void 0:null)).finally((()=>this.afterSearching()))}afterSearching(){this.loading=!1,salla.product.api.previousQuery=""}renderCategoriesSection(r){return this.trendingCategories.length?e("div",null,e("p",{class:"s-search-idle-section-title"},r),e("div",{class:"s-search-idle-categories-list"},this.trendingCategories.map((r=>e("a",{class:"s-search-idle-category-chip",href:r.url,onClick:()=>this.tracking.recommendationClick(r.name,"category")},r.name,r.count?e("span",{class:"s-search-idle-category-count"},r.count):null))))):null}renderMostSearchedProductsSection(r,t){return this.mostSearchedProducts.length?e("div",null,e("p",{class:"s-search-idle-section-title"},r),e("ul",{class:"s-search-most-searched-list"},this.mostSearchedProducts.map((r=>e("li",null,e("a",{class:"s-search-most-searched-item",href:r.url,onClick:()=>this.tracking.recommendationClick(r.name,t)},e("span",{class:"s-search-most-searched-icon",innerHTML:s}),r.name)))))):null}renderSearchHistorySection(){return!this.searchHistory.length||this.hasInputValue?null:e("div",null,e("p",{class:"s-search-idle-section-title"},this.labels.searchHistory),e("div",{class:"s-search-history-list"},this.searchHistory.map((r=>e("span",{class:"s-search-history-chip"},e("a",{class:"s-search-history-chip-term",href:m(p(r),"history"),onClick:()=>{this.tracking.recommendationClick(r,"history")}},e("span",{class:"s-search-history-chip-icon",innerHTML:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" color="currentColor" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round">\n <path d="M3.49902 14.9656C4.72475 18.4791 8.06749 21 11.999 21C16.9696 21 20.999 16.9706 20.999 12C20.999 7.02944 16.9696 3 11.999 3C8.29827 3 4.8984 5.6756 3.68943 8.5"></path>\n <path d="M11.999 7V12L14.999 14"></path>\n <path d="M7.49751 8.74363C7.49751 8.74363 3.81388 9.3026 3.25487 8.7436C2.69585 8.1846 3.25488 4.50098 3.25488 4.50098"></path>\n</svg>\n'}),r),e("button",{type:"button",class:"s-search-history-chip-remove","aria-label":this.labels.remove,onClick:()=>this.removeFromSearchHistory(r)},e("span",{innerHTML:a})))))))}renderIdlePanel(){return e("div",{class:{"s-search-idle-panel":!0,"s-search-idle-panel-empty":!(this.searchHistory.length>0&&!this.hasInputValue||this.trendingCategories.length>0||this.mostSearchedProducts.length>0)}},this.renderSearchHistorySection(),this.renderCategoriesSection(this.labels.trendingCategories),this.renderMostSearchedProductsSection(this.labels.mostSearched,"trending"))}renderResultsBody(){return e("div",{class:"s-search-results-body"},null,e("div",{class:{"s-search-results-grid-wrap":!0,"s-search-results-grid-wrap-no-sidebar":!0}},e("p",{class:"s-search-idle-section-title"},this.labels.searchResults),e("div",{class:"s-search-results-grid"},this.results?.data.map(((r,t)=>e("div",{key:r.id,class:"s-search-grid-item",onClick:()=>this.tracking.productClick(r,t)},e("salla-search-product-card",{product:{...r,url:r.url+"?from=search-bar"},hideAddBtn:!0})))),0===this.results?.data.length?e("p",{class:"s-search-no-results-placeholder"},this.labels.noOptions):null)))}renderViewAllLink(){return this.results?.data.length?e("a",{class:"s-search-view-all",href:p(this.search_term),onClick:()=>this.commitSearchHistory(this.search_term)},this.labels.searchViewAllTemplate.replace(":word",this.search_term),e("span",{class:"s-search-view-all-icon",innerHTML:salla.config.get("theme.is_rtl",!0)?i:o})):null}renderDropdown(){return this.results?this.renderResultsBody():this.renderIdlePanel()}renderInputWrapper(){const r=e("div",{class:"s-search-input-wrapper"},e("span",{class:"s-search-icon-wrap"},e("span",{class:"s-search-icon",innerHTML:this.loading?'<i class="s-search-spinner-loader"/>':s})),e("input",{type:"search",enterkeyhint:"search",autocomplete:"off",class:"s-search-input",placeholder:this.labels.searchPlaceholder,onInput:r=>this.limitWordsAndSearch(r),onKeyDown:r=>this.handleKeyDown(r),onFocus:()=>this.tracking.searchFocus(),ref:r=>this.searchInput=r,style:{height:this.height+"px",borderRadius:this.oval?this.height/2+"px":""}}),this.showAction?e("salla-button",{loading:this.loading,class:{"s-search-action":!0,"s-search-action-oval":this.oval},onClick:()=>this.handleActionClick()},!this.loading&&e("span",{innerHTML:s})):null);return e("div",{class:"s-search-input-row"},e("button",{type:"button",class:"s-search-back-btn","aria-label":this.labels.back,onClick:()=>this.modal?.close()},e("span",{innerHTML:salla.config.get("theme.is_rtl",!0)?o:i})),r)}renderPlaceholderTrigger(){return e("div",{class:"s-search-input-wrapper"},e("span",{class:"s-search-icon-wrap"},e("span",{class:"s-search-icon",innerHTML:s})),e("button",{type:"button",class:"s-search-input s-search-placeholder-trigger",onClick:()=>this.open(),style:{height:this.height+"px",borderRadius:this.oval?this.height/2+"px":""}},this.labels.searchPlaceholder))}renderInlineTrigger(){return e("div",{class:"s-search-input-wrapper"},e("span",{class:"s-search-icon-wrap"},e("span",{class:"s-search-icon",innerHTML:s})),e("input",{type:"search",readOnly:!0,class:"s-search-input s-search-placeholder-trigger",placeholder:this.labels.searchPlaceholder,onFocus:()=>this.open(),style:{height:this.height+"px",borderRadius:this.oval?this.height/2+"px":""}}))}renderModal(){return e("salla-modal",{position:"top",class:"s-search-modal s-search-modal-new","hide-close-button":!0,ref:r=>this.modal=r},e("div",{class:"s-search-panel"},this.renderInputWrapper(),this.renderDropdown(),this.renderViewAllLink()))}render(){return this.placeholder?e("div",{class:"s-search-placeholder-wrapper s-search-placeholder-wrapper-new s-search-inline"},this.renderPlaceholderTrigger(),this.renderModal()):this.inline?e("div",{class:"s-search-placeholder-wrapper s-search-placeholder-wrapper-new s-search-inline"},this.renderInlineTrigger(),this.renderModal()):this.renderModal()}componentDidLoad(){this.afterSearching()}get host(){return t(this)}static get watchers(){return{search_term:["handleSearch"]}}};b.style='/*!twlt*/.s-search-placeholder-wrapper{position:relative;display:inline-block}.s-search-placeholder-wrapper-new{display:block;width:100%}.s-search-input-wrapper{position:relative}.s-search-placeholder-trigger{cursor:pointer;appearance:none;text-align:start}.s-search-divider{border:none;border-top:1px solid #F3F4F6;margin:0.25rem 0}.visible{visibility:visible}.inline{display:inline}.hidden{display:none}.border{border-width:1px}.shadow{--tw-shadow:0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.s-search-container{position:relative;z-index:99;max-height:14rem;border-radius:0.375rem;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms}.s-search-oval{border-radius:20px}.s-search-inline{min-width:220px}.s-search-container-open{max-height:24rem;border-radius:0px !important}.s-search-container-open .s-search-input{border-top-left-radius:0.375rem !important;border-top-right-radius:0.375rem !important;border-bottom-right-radius:0px !important;border-bottom-left-radius:0px !important;border-width:1px;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1))}.s-search-no-results .s-search-input{border-bottom-right-radius:0px;border-bottom-left-radius:0px;border-width:1px;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1))}.s-search-input{height:2.5rem;width:100%;border-radius:0.375rem;--tw-border-opacity:1;border-color:rgb(243 244 246 / var(--tw-border-opacity, 1));--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1));padding-top:0px;padding-bottom:0.125rem;font-size:0.875rem;line-height:1.25rem;--tw-text-opacity:1;color:rgb(75 85 99 / var(--tw-text-opacity, 1));transition-property:color, background-color, border-color, text-decoration-color, fill, stroke;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:300ms}.s-search-input:focus{--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1));--tw-ring-color:transparent}.s-search-input:where([dir="ltr"],[dir="ltr"] *){padding-left:2.5rem}.s-search-input:where([dir="rtl"],[dir="rtl"] *){padding-right:2.5rem}.s-search-input:focus{outline:2px solid transparent !important;outline-offset:2px !important;box-shadow:none !important;border-color:#e5e7eb !important}.s-search-modal-new .s-search-input{--tw-bg-opacity:1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.s-search-icon-wrap{position:absolute;top:50%;--tw-translate-y:-50%;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));line-height:1;--tw-text-opacity:1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.s-search-icon-wrap:where([dir="ltr"],[dir="ltr"] *){left:1rem}.s-search-icon-wrap:where([dir="rtl"],[dir="rtl"] *){right:1rem}.s-search-icon svg{height:1rem;width:1rem;fill:#9ca3af}.s-search-spinner-loader{display:block;height:1rem;width:1rem}@keyframes spin{to{transform:rotate(360deg)}}.s-search-spinner-loader{animation:spin 1s linear infinite;border-radius:9999px;border-width:2px;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1));border-right-color:var(--color-primary)}.s-search-results{position:absolute;margin:auto;max-height:24rem;width:100%;max-width:100%;overflow-y:auto;border-bottom-right-radius:0.375rem;border-bottom-left-radius:0.375rem;--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1));--tw-shadow:0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);--tw-shadow-colored:0 20px 25px -5px var(--tw-shadow-color), 0 8px 10px -6px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}.s-search-no-results{border-bottom-right-radius:0px !important;border-bottom-left-radius:0px !important}.s-search-no-results-placeholder{grid-column:1 / -1;padding:1rem;text-align:center;font-size:1rem;line-height:1.5rem;--tw-text-opacity:1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.s-search-product{display:flex;height:100%;justify-content:space-around;overflow:hidden;border-bottom-width:1px;--tw-border-opacity:1;border-color:rgb(243 244 246 / var(--tw-border-opacity, 1));background-color:transparent;padding-left:1rem;padding-right:1rem;padding-top:0.75rem;padding-bottom:0.75rem;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:300ms}.s-search-product:last-child{border-bottom-width:0px}.s-search-product:hover{--tw-bg-opacity:1;background-color:rgb(249 250 251 / var(--tw-bg-opacity, 1))}@media (min-width: 480px){.s-search-product{padding-left:1.25rem;padding-right:1.25rem}}.s-search-product-image-container{position:relative;height:3.5rem;width:5rem;overflow:hidden;border-radius:0.375rem;--tw-bg-opacity:1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.s-search-product-image{position:relative;height:100%;width:100%;object-fit:cover;font-size:0px}.s-search-product-image::before{position:absolute;top:0px;left:0px;height:100%;width:100%;--tw-bg-opacity:1;background-color:rgb(229 231 235 / var(--tw-bg-opacity, 1));--tw-content:\'\';content:var(--tw-content)}.s-search-product-details{flex:1 1 0%;padding-top:0.25rem}.s-search-product-details:where([dir="ltr"],[dir="ltr"] *){padding-left:1rem}@media (min-width: 480px){.s-search-product-details:where([dir="ltr"],[dir="ltr"] *){padding-left:1.25rem}}.s-search-product-details:where([dir="rtl"],[dir="rtl"] *){padding-right:1rem}@media (min-width: 480px){.s-search-product-details:where([dir="rtl"],[dir="rtl"] *){padding-right:1.25rem}}.s-search-product-title{margin-bottom:0.375rem;display:flex;flex-direction:column;align-items:baseline;justify-content:flex-start;font-size:0.875rem;font-weight:700;line-height:1.5rem;--tw-text-opacity:1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.s-search-product-price{display:flex;width:100%;align-items:center;font-size:0.875rem;line-height:1.25rem;font-weight:700;color:var(--color-primary)}.s-search-product-regular-price{padding-left:0.75rem;padding-right:0.75rem;font-weight:500;--tw-text-opacity:1;color:rgb(156 163 175 / var(--tw-text-opacity, 1));text-decoration-line:line-through}.s-search-product-not-available{--tw-grayscale:grayscale(100%);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.s-search-action{position:absolute;height:100%}.s-search-action:where([dir="ltr"],[dir="ltr"] *){right:0px}.s-search-action:where([dir="rtl"],[dir="rtl"] *){left:0px;border-top-right-radius:0px;border-bottom-right-radius:0px}.s-search-action-oval:where([dir="ltr"],[dir="ltr"] *){border-top-right-radius:9999px;border-bottom-right-radius:9999px}.s-search-action-oval:where([dir="rtl"],[dir="rtl"] *){border-top-left-radius:9999px;border-bottom-left-radius:9999px}.s-search-input-row{margin:1rem;display:flex;align-items:center}.s-search-back-btn{display:flex;flex-shrink:0;align-items:center;justify-content:center;padding:0.25rem;line-height:1;--tw-text-opacity:1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.s-search-back-btn:hover{--tw-text-opacity:1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}@media (min-width: 640px){.s-search-back-btn{display:none}}.s-search-back-btn svg{height:1.5rem;width:1.5rem;fill:#6b7280}.s-search-input-wrapper{position:relative;display:flex;flex-grow:1;align-items:center}.s-search-panel{display:flex;height:100%;flex-direction:column}.s-search-results-body{display:flex;min-height:0px;flex:1 1 0%;flex-direction:column;gap:0.75rem;overflow:hidden;--tw-shadow:0 -4px 6px -4px rgba(0,0,0,0.1);--tw-shadow-colored:0 -4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}@media (min-width: 640px){.s-search-results-body{flex-direction:row}}.s-search-results-grid-wrap{min-height:0px;min-width:0px;flex:1 1 0%;overflow-y:auto}@media (min-width: 640px){.s-search-results-grid-wrap{max-height:24rem !important}}.s-search-results-grid-wrap-no-sidebar{padding-left:1rem;padding-right:1rem}@media (min-width: 640px){.s-search-results-grid-wrap-no-sidebar{padding-left:1.25rem;padding-right:1.25rem}}.s-search-results-grid{display:grid;grid-template-columns:repeat(1, minmax(0, 1fr));align-content:flex-start;column-gap:0.75rem;row-gap:0.25rem}@media (min-width: 640px){.s-search-results-grid{grid-template-columns:repeat(2, minmax(0, 1fr))}}@media (min-width: 1024px){.s-search-results-grid{grid-template-columns:repeat(3, minmax(0, 1fr))}}.s-search-grid-item{cursor:pointer;border-radius:0.375rem;padding:0.25rem;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:300ms}.s-search-grid-item:hover{--tw-bg-opacity:1;background-color:rgb(249 250 251 / var(--tw-bg-opacity, 1))}.s-search-grid-item .s-product-card-out-badge{--tw-bg-opacity:1;background-color:rgb(254 226 226 / var(--tw-bg-opacity, 1));--tw-text-opacity:1;color:rgb(220 38 38 / var(--tw-text-opacity, 1))}.s-search-view-all{display:flex;flex-shrink:0;align-items:center;justify-content:center;gap:0.25rem;border-top-width:1px;--tw-border-opacity:1;border-color:rgb(243 244 246 / var(--tw-border-opacity, 1));padding:0.75rem;text-align:center;font-size:0.875rem;line-height:1.25rem;font-weight:500;--tw-text-opacity:1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.s-search-view-all:hover{text-decoration-line:underline}.s-search-view-all-icon{line-height:1}.s-search-view-all-icon svg{height:1rem;width:1rem;fill:#6b7280}.s-search-sidebar{max-height:none;width:100%;flex-shrink:0}.s-search-sidebar>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.s-search-sidebar{padding:0.5rem}@media (min-width: 640px){.s-search-sidebar{max-height:24rem !important;width:16rem;overflow-y:auto !important;--tw-bg-opacity:1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1));padding:0.75rem}}@media (min-width: 480px){.s-search-sidebar{width:13rem}}.s-search-sidebar:where([dir="ltr"],[dir="ltr"] *){--tw-shadow:4px 0 6px -4px rgba(0,0,0,0.1);--tw-shadow-colored:4px 0 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}.s-search-sidebar:where([dir="rtl"],[dir="rtl"] *){--tw-shadow:-4px 0 6px -4px rgba(0,0,0,0.1);--tw-shadow-colored:-4px 0 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}.s-search-idle-panel{min-height:6rem}.s-search-idle-panel>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.s-search-idle-panel{overflow-y:auto;padding:1rem;padding-top:0px;--tw-shadow:0 -4px 6px -4px rgba(0,0,0,0.1);--tw-shadow-colored:0 -4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}.s-search-idle-panel-empty{max-height:none !important;min-height:0px !important;padding:0px !important;--tw-shadow:0 0 #0000 !important;--tw-shadow-colored:0 0 #0000 !important;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow) !important}.s-search-idle-section-title{margin-bottom:0.5rem;margin-top:0.5rem;font-size:1rem;line-height:1.5rem;--tw-text-opacity:1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.s-search-history-list{display:flex;flex-wrap:wrap;gap:0.5rem}.s-search-history-chip{display:inline-flex;align-items:center;gap:0.375rem;border-radius:9999px;--tw-bg-opacity:1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1));padding-top:0.375rem;padding-bottom:0.375rem;font-size:1rem;line-height:1.5rem;--tw-text-opacity:1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.s-search-history-chip:hover{background-color:color-mix(in srgb,var(--color-primary) 10%,transparent)}.s-search-history-chip:where([dir="ltr"],[dir="ltr"] *){padding-left:0.75rem;padding-right:0.5rem}.s-search-history-chip:where([dir="rtl"],[dir="rtl"] *){padding-right:0.75rem;padding-left:0.5rem}.s-search-history-chip-term{display:inline-flex;align-items:center;gap:0.25rem;line-height:1}.s-search-history-chip:hover .s-search-history-chip-term{color:var(--color-primary)}.s-search-history-chip-icon svg{height:0.875rem;width:0.875rem}.s-search-history-chip-remove svg{height:0.625rem;width:0.625rem;fill:#9ca3af}.s-search-idle-categories-list{display:flex;flex-wrap:wrap;gap:0.5rem}.s-search-idle-category-chip{display:inline-flex;align-items:center;gap:0.25rem;border-radius:9999px;--tw-bg-opacity:1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1));padding-left:0.75rem;padding-right:0.75rem;padding-top:0.375rem;padding-bottom:0.375rem;font-size:0.875rem;line-height:1.25rem;--tw-text-opacity:1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.s-search-idle-category-chip:hover{background-color:color-mix(in srgb,var(--color-primary) 10%,transparent);color:var(--color-primary)}.s-search-sidebar .s-search-idle-category-chip{--tw-bg-opacity:1;background-color:rgb(229 231 235 / var(--tw-bg-opacity, 1))}.s-search-idle-category-count{font-size:0.875rem;line-height:1.25rem;--tw-text-opacity:1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.s-search-most-searched-list{display:flex;flex-direction:column}.s-search-most-searched-item{display:flex;width:100%;align-items:center;gap:0.5rem;padding-top:0.375rem;padding-bottom:0.375rem;font-size:0.875rem;line-height:1.25rem;--tw-text-opacity:1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.s-search-most-searched-item:hover{color:var(--color-primary)}.s-search-most-searched-icon svg{height:0.875rem;width:0.875rem;fill:#9ca3af}@media (min-width: 640px){.s-search-modal .s-modal-wrapper{align-items:flex-start;padding:0}.s-search-modal .s-modal-spacer{display:inline}.s-search-modal .s-modal-body{padding:0;width:700px;max-width:90%;margin-top:3.2rem;border-radius:0.5rem;overflow:visible;position:relative !important}}.s-search-modal .s-modal-close{top:50%;transform:translateY(-50%)}@media (max-width: 639px){.s-search-modal .s-modal-body .s-search-results{position:static;margin-top:0}.s-search-modal.s-search-modal-new .s-modal-body{height:100dvh;max-height:100dvh !important}}@media (min-width: 640px){.s-search-modal.s-search-modal-new .s-modal-body{background:var(--color-surface, #fff);overflow:hidden;width:1100px;max-width:95%}}.s-search-product-card-out-of-stock img.loaded{--tw-grayscale:grayscale(100%);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.s-search-product-card-image img.loaded{position:relative;opacity:1}';export{b as salla_search}
4
+ import{r,h as e,a as t}from"./p-HRJpfiBN.js";import{S as s}from"./p-BscTeWDc.js";import{C as a}from"./p-BsLF_HK7.js";import{A as i,a as o}from"./p-Vqpj4CWE.js";import{H as c}from"./p-Brgf4SAC.js";import"./p-CgtvEd63.js";const n="salla::search-history";function l(){if("undefined"==typeof window)return n;const r=new URLSearchParams(window.location.search).get("scope");return r?`${n}-${r}`:n}const h={searchPlaceholder:"",noOptions:"",outOfStock:"",close:"",back:"",remove:"",searchHistory:"",trendingCategories:"",mostSearched:"",searchSuggestions:"",categories:"",searchResults:"",searchViewAllTemplate:""},d={"common.elements.search_history":{ar:"آخر ما تم البحث عنه",en:"Recently Searched"},"common.elements.trending_categories":{ar:"التصنيفات الأكثر بحثاً",en:"Trending categories"},"common.elements.most_searched":{ar:"المنتجات الأكثر بحثاً",en:"Trending products"},"common.elements.search_suggestions":{ar:"اقتراحات البحث",en:"Search suggestions"},"common.elements.categories":{ar:"التصنيفات",en:"Categories"},"common.elements.search_results":{ar:"نتائج البحث",en:"Search results"},"common.elements.search_view_all":{ar:'عرض كل النتائج لـ ":word"',en:'View all results for ":word"'}};function p(r){return salla.url.get("search?q="+encodeURI(r))}function m(r,e){const[t,s=""]=r.split("?"),a=new URLSearchParams(s);return a.set("_svs",e),`${t}?${a.toString()}`}function g(r){const e=l();salla.storage.set(e,r)}const w={trendingCategories:[],mostSearchedProducts:[]};let u=null;const b=class{constructor(e){r(this,e),this.hasTrackedFocus=!1,this.hasLoadedPopularSearches=!1,this.translationLoaded=!1,this.labels=h,this.loading=!1,this.typing=!1,this.debounce=setTimeout((()=>""),1e3),this.search_term="",this.hasInputValue=!1,this.searchHistory=function(){const r=l(),e=salla.storage.get(r,[]);return Array.isArray(e)?e.filter((r=>"string"==typeof r)):[]}(),this.trendingCategories=[],this.mostSearchedProducts=[],this.placeholder=!1,this.inline=!1,this.oval=!1,this.height=60,this.maxWords=5,this.showAction=!1,this.tracking={searchFocus:()=>{this.hasTrackedFocus||(this.hasTrackedFocus=!0,salla.event.emit("salla-search::input.focused"))},productClick:(r,e)=>{c.saveProductSource("search"),this.commitSearchHistory(this.search_term),salla.event.emit("salla-search::product.clicked",[{product:r,position:e}])},recommendationClick:(r,e)=>{salla.event.emit("salla-search::recommendation.clicked",{term:r,source:e})}},salla.event.on("search::open",(()=>this.open()))}async open(){this.hasLoadedPopularSearches||(this.hasLoadedPopularSearches=!0,function(){if(!u){const r=salla.search.popular().then((r=>({trendingCategories:(r?.data?.categories||[]).map((r=>({name:r.name,url:m(salla.url.create("categories",r.id),"search-trending")}))),mostSearchedProducts:(r?.data?.products||[]).map((r=>({name:r.name,url:m(salla.url.create("products",r.id),"search-trending")})))}))).catch((()=>(u=null,w)));u=r}return u}().then((({trendingCategories:r,mostSearchedProducts:e})=>{this.trendingCategories=r,this.mostSearchedProducts=e}))),await(this.modal?.open().then((()=>setTimeout((()=>this.searchInput?.focus()),300))))}handleModalVisibilityChanged(r){r.target!==this.modal||r.detail||this.onModalClose()}onModalClose(){this.searchInput&&(this.searchInput.value=""),this.results=void 0,this.search_term="",this.hasInputValue=!1,this.afterSearching()}handleKeyDown(r){if("Enter"!==r.key)return;const e=this.searchInput?.value??"";e.length<=2||(e!==this.search_term&&(clearTimeout(this.debounce),this.typing=!1,this.search_term=e),this.commitSearchHistory(e),this.searchInput&&(this.searchInput.value=""),this.hasInputValue=!1,setTimeout((()=>{window.location.href=p(e)}),100))}commitSearchHistory(r){r&&(this.searchHistory=function(r,e){const t=e.trim();if(!t)return r;const s=r.filter((r=>r.toLowerCase()!==t.toLowerCase()));return[t,...s].slice(0,10)}(this.searchHistory,r),g(this.searchHistory))}removeFromSearchHistory(r){this.searchHistory=this.searchHistory.filter((e=>e!==r)),g(this.searchHistory),this.afterSearching()}async componentWillLoad(){await salla.lang.onLoaded(),function(){if(!salla?.lang?.addBulk)return;const r=Object.entries(d).reduce(((r,[e,t])=>(salla.lang.get(e)===e&&(r[e]=t),r)),{});Object.keys(r).length&&salla.lang.addBulk(r)}(),this.labels={searchPlaceholder:salla.lang.get("blocks.header.search_placeholder"),noOptions:salla.lang.get("common.elements.no_options"),outOfStock:salla.lang.get("pages.products.out_of_stock"),close:salla.lang.get("common.elements.close"),back:salla.lang.get("common.elements.back"),remove:salla.lang.get("common.elements.remove"),searchHistory:salla.lang.get("common.elements.search_history"),trendingCategories:salla.lang.get("common.elements.trending_categories"),mostSearched:salla.lang.get("common.elements.most_searched"),searchSuggestions:salla.lang.get("common.elements.search_suggestions"),categories:salla.lang.get("common.elements.categories"),searchResults:salla.lang.get("common.elements.search_results"),searchViewAllTemplate:salla.lang.get("common.elements.search_view_all")},this.translationLoaded=!0}debounceSearch(r){this.typing=!0,clearTimeout(this.debounce),this.debounce=setTimeout((()=>{this.typing=!1,this.search_term=r.target.value}),700)}limitWordsAndSearch(r){let e=r.target.value;this.hasInputValue=e.length>0;const t=e.trim().split(/\s+/);if(t.length>this.maxWords){const r=t.slice(0,this.maxWords).join(" ");this.searchInput&&(this.searchInput.value=r)}this.debounceSearch(r)}getQueryParam(r){return new URLSearchParams(window.location.search).get(r)}handleActionClick(){if(this.search_term&&this.search_term.length>2)return this.search(this.search_term)}handleSearch(r){r.length>2?this.search(r):(this.results=void 0,this.afterSearching())}search(r){this.loading=!0,salla.product.fetch({source:"search",source_value:r}).then((e=>{this.results=e,salla.event.emit("Products Searched",{query:r,total:e.data?.length,metadata:e.metadata})})).catch((r=>"Query is same as previous one!"!==r?this.results=void 0:null)).finally((()=>this.afterSearching()))}afterSearching(){this.loading=!1,salla.product.api.previousQuery=""}renderCategoriesSection(r){return this.trendingCategories.length?e("div",null,e("p",{class:"s-search-idle-section-title"},r),e("div",{class:"s-search-idle-categories-list"},this.trendingCategories.map((r=>e("a",{class:"s-search-idle-category-chip",href:r.url,onClick:()=>this.tracking.recommendationClick(r.name,"category")},r.name,r.count?e("span",{class:"s-search-idle-category-count"},r.count):null))))):null}renderMostSearchedProductsSection(r,t){return this.mostSearchedProducts.length?e("div",null,e("p",{class:"s-search-idle-section-title"},r),e("ul",{class:"s-search-most-searched-list"},this.mostSearchedProducts.map((r=>e("li",null,e("a",{class:"s-search-most-searched-item",href:r.url,onClick:()=>this.tracking.recommendationClick(r.name,t)},e("span",{class:"s-search-most-searched-icon",innerHTML:s}),r.name)))))):null}renderSearchHistorySection(){return!this.searchHistory.length||this.hasInputValue?null:e("div",null,e("p",{class:"s-search-idle-section-title"},this.labels.searchHistory),e("div",{class:"s-search-history-list"},this.searchHistory.map((r=>e("span",{class:"s-search-history-chip"},e("a",{class:"s-search-history-chip-term",href:m(p(r),"history"),onClick:()=>{this.tracking.recommendationClick(r,"history")}},e("span",{class:"s-search-history-chip-icon",innerHTML:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" color="currentColor" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round">\n <path d="M3.49902 14.9656C4.72475 18.4791 8.06749 21 11.999 21C16.9696 21 20.999 16.9706 20.999 12C20.999 7.02944 16.9696 3 11.999 3C8.29827 3 4.8984 5.6756 3.68943 8.5"></path>\n <path d="M11.999 7V12L14.999 14"></path>\n <path d="M7.49751 8.74363C7.49751 8.74363 3.81388 9.3026 3.25487 8.7436C2.69585 8.1846 3.25488 4.50098 3.25488 4.50098"></path>\n</svg>\n'}),r),e("button",{type:"button",class:"s-search-history-chip-remove","aria-label":this.labels.remove,onClick:()=>this.removeFromSearchHistory(r)},e("span",{innerHTML:a})))))))}renderIdlePanel(){return e("div",{class:{"s-search-idle-panel":!0,"s-search-idle-panel-empty":!(this.searchHistory.length>0&&!this.hasInputValue||this.trendingCategories.length>0||this.mostSearchedProducts.length>0)}},this.renderSearchHistorySection(),this.renderCategoriesSection(this.labels.trendingCategories),this.renderMostSearchedProductsSection(this.labels.mostSearched,"trending"))}renderResultsBody(){return e("div",{class:"s-search-results-body"},null,e("div",{class:{"s-search-results-grid-wrap":!0,"s-search-results-grid-wrap-no-sidebar":!0}},e("p",{class:"s-search-idle-section-title"},this.labels.searchResults),e("div",{class:"s-search-results-grid"},this.results?.data.map(((r,t)=>e("div",{key:r.id,class:"s-search-grid-item",onClick:()=>this.tracking.productClick(r,t)},e("salla-search-product-card",{product:{...r,url:r.url+"?from=search-bar"},hideAddBtn:!0})))),0===this.results?.data.length?e("p",{class:"s-search-no-results-placeholder"},this.labels.noOptions):null)))}renderViewAllLink(){return this.results?.data.length?e("a",{class:"s-search-view-all",href:p(this.search_term),onClick:()=>this.commitSearchHistory(this.search_term)},this.labels.searchViewAllTemplate.replace(":word",this.search_term),e("span",{class:"s-search-view-all-icon",innerHTML:salla.config.get("theme.is_rtl",!0)?i:o})):null}renderDropdown(){return this.results?this.renderResultsBody():this.renderIdlePanel()}renderInputWrapper(){const r=e("div",{class:"s-search-input-wrapper"},e("span",{class:"s-search-icon-wrap"},e("span",{class:"s-search-icon",innerHTML:this.loading?'<i class="s-search-spinner-loader"/>':s})),e("input",{type:"search",enterkeyhint:"search",autocomplete:"off",class:"s-search-input",placeholder:this.labels.searchPlaceholder,onInput:r=>this.limitWordsAndSearch(r),onKeyDown:r=>this.handleKeyDown(r),onFocus:()=>this.tracking.searchFocus(),ref:r=>this.searchInput=r,style:{height:this.height+"px",borderRadius:this.oval?this.height/2+"px":""}}),this.showAction?e("salla-button",{loading:this.loading,class:{"s-search-action":!0,"s-search-action-oval":this.oval},onClick:()=>this.handleActionClick()},!this.loading&&e("span",{innerHTML:s})):null);return e("div",{class:"s-search-input-row"},e("button",{type:"button",class:"s-search-back-btn","aria-label":this.labels.back,onClick:()=>this.modal?.close()},e("span",{innerHTML:salla.config.get("theme.is_rtl",!0)?o:i})),r)}renderPlaceholderTrigger(){return e("div",{class:"s-search-input-wrapper"},e("span",{class:"s-search-icon-wrap"},e("span",{class:"s-search-icon",innerHTML:s})),e("button",{type:"button",class:"s-search-input s-search-placeholder-trigger",onClick:()=>this.open(),style:{height:this.height+"px",borderRadius:this.oval?this.height/2+"px":""}},this.labels.searchPlaceholder))}renderInlineTrigger(){return e("div",{class:"s-search-input-wrapper"},e("span",{class:"s-search-icon-wrap"},e("span",{class:"s-search-icon",innerHTML:s})),e("input",{type:"search",readOnly:!0,class:"s-search-input s-search-placeholder-trigger",placeholder:this.labels.searchPlaceholder,onFocus:()=>this.open(),style:{height:this.height+"px",borderRadius:this.oval?this.height/2+"px":""}}))}renderModal(){return e("salla-modal",{position:"top",class:"s-search-modal s-search-modal-new","hide-close-button":!0,ref:r=>this.modal=r},e("div",{class:"s-search-panel"},this.renderInputWrapper(),this.renderDropdown(),this.renderViewAllLink()))}render(){return this.placeholder?e("div",{class:"s-search-placeholder-wrapper s-search-placeholder-wrapper-new s-search-inline"},this.renderPlaceholderTrigger(),this.renderModal()):this.inline?e("div",{class:"s-search-placeholder-wrapper s-search-placeholder-wrapper-new s-search-inline"},this.renderInlineTrigger(),this.renderModal()):this.renderModal()}componentDidLoad(){this.afterSearching()}get host(){return t(this)}static get watchers(){return{search_term:["handleSearch"]}}};b.style='/*!twlt*/.s-search-placeholder-wrapper{position:relative;display:inline-block}.s-search-placeholder-wrapper-new{display:block;width:100%}.s-search-input-wrapper{position:relative}.s-search-placeholder-trigger{cursor:pointer;appearance:none;text-align:start}.s-search-divider{border:none;border-top:1px solid #F3F4F6;margin:0.25rem 0}.visible{visibility:visible}.inline{display:inline}.hidden{display:none}.border{border-width:1px}.shadow{--tw-shadow:0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.s-search-container{position:relative;z-index:99;max-height:14rem;border-radius:0.375rem;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms}.s-search-oval{border-radius:20px}.s-search-inline{min-width:220px}.s-search-container-open{max-height:24rem;border-radius:0px !important}.s-search-container-open .s-search-input{border-top-left-radius:0.375rem !important;border-top-right-radius:0.375rem !important;border-bottom-right-radius:0px !important;border-bottom-left-radius:0px !important;border-width:1px;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1))}.s-search-no-results .s-search-input{border-bottom-right-radius:0px;border-bottom-left-radius:0px;border-width:1px;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1))}.s-search-input{height:2.5rem;width:100%;border-radius:0.375rem;--tw-border-opacity:1;border-color:rgb(243 244 246 / var(--tw-border-opacity, 1));--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1));padding-top:0px;padding-bottom:0.125rem;font-size:0.875rem;line-height:1.25rem;--tw-text-opacity:1;color:rgb(75 85 99 / var(--tw-text-opacity, 1));transition-property:color, background-color, border-color, text-decoration-color, fill, stroke;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:300ms}.s-search-input:focus{--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1));--tw-ring-color:transparent}.s-search-input:where([dir="ltr"],[dir="ltr"] *){padding-left:2.5rem}.s-search-input:where([dir="rtl"],[dir="rtl"] *){padding-right:2.5rem}.s-search-input:focus{outline:2px solid transparent !important;outline-offset:2px !important;box-shadow:none !important;border-color:#e5e7eb !important}.s-search-modal-new .s-search-input{--tw-bg-opacity:1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.s-search-icon-wrap{position:absolute;top:50%;--tw-translate-y:-50%;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));line-height:1;--tw-text-opacity:1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.s-search-icon-wrap:where([dir="ltr"],[dir="ltr"] *){left:1rem}.s-search-icon-wrap:where([dir="rtl"],[dir="rtl"] *){right:1rem}.s-search-icon svg{height:1rem;width:1rem;fill:#9ca3af}.s-search-spinner-loader{display:block;height:1rem;width:1rem}@keyframes spin{to{transform:rotate(360deg)}}.s-search-spinner-loader{animation:spin 1s linear infinite;border-radius:9999px;border-width:2px;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1));border-right-color:var(--color-primary)}.s-search-results{position:absolute;margin:auto;max-height:24rem;width:100%;max-width:100%;overflow-y:auto;border-bottom-right-radius:0.375rem;border-bottom-left-radius:0.375rem;--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1));--tw-shadow:0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);--tw-shadow-colored:0 20px 25px -5px var(--tw-shadow-color), 0 8px 10px -6px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}.s-search-no-results{border-bottom-right-radius:0px !important;border-bottom-left-radius:0px !important}.s-search-no-results-placeholder{grid-column:1 / -1;padding:1rem;text-align:center;font-size:1rem;line-height:1.5rem;--tw-text-opacity:1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.s-search-product{display:flex;height:100%;justify-content:space-around;overflow:hidden;border-bottom-width:1px;--tw-border-opacity:1;border-color:rgb(243 244 246 / var(--tw-border-opacity, 1));background-color:transparent;padding-left:1rem;padding-right:1rem;padding-top:0.75rem;padding-bottom:0.75rem;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:300ms}.s-search-product:last-child{border-bottom-width:0px}.s-search-product:hover{--tw-bg-opacity:1;background-color:rgb(249 250 251 / var(--tw-bg-opacity, 1))}@media (min-width: 480px){.s-search-product{padding-left:1.25rem;padding-right:1.25rem}}.s-search-product-image-container{position:relative;height:3.5rem;width:5rem;overflow:hidden;border-radius:0.375rem;--tw-bg-opacity:1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.s-search-product-image{position:relative;height:100%;width:100%;object-fit:cover;font-size:0px}.s-search-product-image::before{position:absolute;top:0px;left:0px;height:100%;width:100%;--tw-bg-opacity:1;background-color:rgb(229 231 235 / var(--tw-bg-opacity, 1));--tw-content:\'\';content:var(--tw-content)}.s-search-product-details{flex:1 1 0%;padding-top:0.25rem}.s-search-product-details:where([dir="ltr"],[dir="ltr"] *){padding-left:1rem}@media (min-width: 480px){.s-search-product-details:where([dir="ltr"],[dir="ltr"] *){padding-left:1.25rem}}.s-search-product-details:where([dir="rtl"],[dir="rtl"] *){padding-right:1rem}@media (min-width: 480px){.s-search-product-details:where([dir="rtl"],[dir="rtl"] *){padding-right:1.25rem}}.s-search-product-title{margin-bottom:0.375rem;display:flex;flex-direction:column;align-items:baseline;justify-content:flex-start;font-size:0.875rem;font-weight:700;line-height:1.5rem;--tw-text-opacity:1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.s-search-product-price{display:flex;width:100%;align-items:center;font-size:0.875rem;line-height:1.25rem;font-weight:700;color:var(--color-primary)}.s-search-product-regular-price{padding-left:0.75rem;padding-right:0.75rem;font-weight:500;--tw-text-opacity:1;color:rgb(156 163 175 / var(--tw-text-opacity, 1));text-decoration-line:line-through}.s-search-product-not-available{--tw-grayscale:grayscale(100%);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.s-search-action{position:absolute;height:100%}.s-search-action:where([dir="ltr"],[dir="ltr"] *){right:0px}.s-search-action:where([dir="rtl"],[dir="rtl"] *){left:0px;border-top-right-radius:0px;border-bottom-right-radius:0px}.s-search-action-oval:where([dir="ltr"],[dir="ltr"] *){border-top-right-radius:9999px;border-bottom-right-radius:9999px}.s-search-action-oval:where([dir="rtl"],[dir="rtl"] *){border-top-left-radius:9999px;border-bottom-left-radius:9999px}.s-search-input-row{margin:1rem;display:flex;align-items:center}.s-search-back-btn{display:flex;flex-shrink:0;align-items:center;justify-content:center;padding:0.25rem;line-height:1;--tw-text-opacity:1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.s-search-back-btn:hover{--tw-text-opacity:1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}@media (min-width: 640px){.s-search-back-btn{display:none}}.s-search-back-btn svg{height:1.5rem;width:1.5rem;fill:#6b7280}.s-search-input-wrapper{position:relative;display:flex;flex-grow:1;align-items:center}.s-search-panel{display:flex;height:100%;flex-direction:column}.s-search-results-body{display:flex;min-height:0px;flex:1 1 0%;flex-direction:column;gap:0.75rem;overflow:hidden;--tw-shadow:0 -4px 6px -4px rgba(0,0,0,0.1);--tw-shadow-colored:0 -4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}@media (min-width: 640px){.s-search-results-body{flex-direction:row}}.s-search-results-grid-wrap{min-height:0px;min-width:0px;flex:1 1 0%;overflow-y:auto}@media (min-width: 640px){.s-search-results-grid-wrap{max-height:24rem !important}}.s-search-results-grid-wrap-no-sidebar{padding-left:1rem;padding-right:1rem}@media (min-width: 640px){.s-search-results-grid-wrap-no-sidebar{padding-left:1.25rem;padding-right:1.25rem}}.s-search-results-grid{display:grid;grid-template-columns:repeat(1, minmax(0, 1fr));align-content:flex-start;column-gap:0.75rem;row-gap:0.25rem}@media (min-width: 640px){.s-search-results-grid{grid-template-columns:repeat(2, minmax(0, 1fr))}}@media (min-width: 1024px){.s-search-results-grid{grid-template-columns:repeat(3, minmax(0, 1fr))}}.s-search-grid-item{cursor:pointer;border-radius:0.375rem;padding:0.25rem;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:300ms}.s-search-grid-item:hover{--tw-bg-opacity:1;background-color:rgb(249 250 251 / var(--tw-bg-opacity, 1))}.s-search-grid-item .s-product-card-out-badge{--tw-bg-opacity:1;background-color:rgb(254 226 226 / var(--tw-bg-opacity, 1));--tw-text-opacity:1;color:rgb(220 38 38 / var(--tw-text-opacity, 1))}.s-search-view-all{display:flex;flex-shrink:0;align-items:center;justify-content:center;gap:0.25rem;border-top-width:1px;--tw-border-opacity:1;border-color:rgb(243 244 246 / var(--tw-border-opacity, 1));padding:0.75rem;text-align:center;font-size:0.875rem;line-height:1.25rem;font-weight:500;--tw-text-opacity:1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.s-search-view-all:hover{text-decoration-line:underline}.s-search-view-all-icon{line-height:1}.s-search-view-all-icon svg{height:1rem;width:1rem;fill:#6b7280}.s-search-sidebar{max-height:none;width:100%;flex-shrink:0}.s-search-sidebar>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.s-search-sidebar{padding:0.5rem}@media (min-width: 640px){.s-search-sidebar{max-height:24rem !important;width:16rem;overflow-y:auto !important;--tw-bg-opacity:1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1));padding:0.75rem}}@media (min-width: 480px){.s-search-sidebar{width:13rem}}.s-search-sidebar:where([dir="ltr"],[dir="ltr"] *){--tw-shadow:4px 0 6px -4px rgba(0,0,0,0.1);--tw-shadow-colored:4px 0 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}.s-search-sidebar:where([dir="rtl"],[dir="rtl"] *){--tw-shadow:-4px 0 6px -4px rgba(0,0,0,0.1);--tw-shadow-colored:-4px 0 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}.s-search-idle-panel{min-height:6rem}.s-search-idle-panel>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.s-search-idle-panel{overflow-y:auto;padding:1rem;padding-top:0px;--tw-shadow:0 -4px 6px -4px rgba(0,0,0,0.1);--tw-shadow-colored:0 -4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}.s-search-idle-panel-empty{max-height:none !important;min-height:0px !important;padding:0px !important;--tw-shadow:0 0 #0000 !important;--tw-shadow-colored:0 0 #0000 !important;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow) !important}.s-search-idle-section-title{margin-bottom:0.5rem;margin-top:0.5rem;font-size:1rem;line-height:1.5rem;--tw-text-opacity:1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.s-search-history-list{display:flex;flex-wrap:wrap;gap:0.5rem}.s-search-history-chip{display:inline-flex;align-items:center;gap:0.375rem;border-radius:9999px;--tw-bg-opacity:1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1));padding-top:0.375rem;padding-bottom:0.375rem;font-size:1rem;line-height:1.5rem;--tw-text-opacity:1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.s-search-history-chip:hover{background-color:color-mix(in srgb,var(--color-primary) 10%,transparent)}.s-search-history-chip:where([dir="ltr"],[dir="ltr"] *){padding-left:0.75rem;padding-right:0.5rem}.s-search-history-chip:where([dir="rtl"],[dir="rtl"] *){padding-right:0.75rem;padding-left:0.5rem}.s-search-history-chip-term{display:inline-flex;align-items:center;gap:0.25rem;line-height:1}.s-search-history-chip:hover .s-search-history-chip-term{color:var(--color-primary)}.s-search-history-chip-icon svg{height:0.875rem;width:0.875rem}.s-search-history-chip-remove svg{height:0.625rem;width:0.625rem;fill:#9ca3af}.s-search-idle-categories-list{display:flex;flex-wrap:wrap;gap:0.5rem}.s-search-idle-category-chip{display:inline-flex;align-items:center;gap:0.25rem;border-radius:9999px;--tw-bg-opacity:1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1));padding-left:0.75rem;padding-right:0.75rem;padding-top:0.375rem;padding-bottom:0.375rem;font-size:0.875rem;line-height:1.25rem;--tw-text-opacity:1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.s-search-idle-category-chip:hover{background-color:color-mix(in srgb,var(--color-primary) 10%,transparent);color:var(--color-primary)}.s-search-sidebar .s-search-idle-category-chip{--tw-bg-opacity:1;background-color:rgb(229 231 235 / var(--tw-bg-opacity, 1))}.s-search-idle-category-count{font-size:0.875rem;line-height:1.25rem;--tw-text-opacity:1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.s-search-most-searched-list{display:flex;flex-direction:column}.s-search-most-searched-item{display:flex;width:100%;align-items:center;gap:0.5rem;padding-top:0.375rem;padding-bottom:0.375rem;font-size:0.875rem;line-height:1.25rem;--tw-text-opacity:1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.s-search-most-searched-item:hover{color:var(--color-primary)}.s-search-most-searched-icon svg{height:0.875rem;width:0.875rem;fill:#9ca3af}@media (min-width: 640px){.s-search-modal .s-modal-wrapper{align-items:flex-start;padding:0}.s-search-modal .s-modal-spacer{display:inline}.s-search-modal .s-modal-body{padding:0;width:700px;max-width:90%;margin-top:3.2rem;border-radius:0.5rem;overflow:visible;position:relative !important}}.s-search-modal .s-modal-close{top:50%;transform:translateY(-50%)}@media (max-width: 639px){.s-search-modal .s-modal-body .s-search-results{position:static;margin-top:0}.s-search-modal.s-search-modal-new .s-modal-body{height:100dvh;max-height:100dvh !important}}@media (min-width: 640px){.s-search-modal.s-search-modal-new .s-modal-body{background:var(--color-surface, #fff);overflow:hidden;width:1100px;max-width:95%}}.s-search-product-card-out-of-stock img.loaded{--tw-grayscale:grayscale(100%);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.s-search-product-card-image img.loaded{position:relative;opacity:1}';export{b as salla_search}
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r as t,h as a,H as l,a as r}from"./p-Bxge4xib.js";const i=class{constructor(a){t(this,a),this.alertDelay=null,this.data=salla.config.get("store.app_install_prompt"),this.open=!1,this.closing=!1}connectedCallback(){salla.onReady((()=>{if(this.data=salla.config.get("store.app_install_prompt"),this.isMobileOrTabletDevice()){if(!this.data)return salla.logger.error("Failed to retrieve salla-app-install-alert config");this.ctaLink=salla.url.get("app"),this.alertDelay=setTimeout((()=>this.open=!0),3e3)}}))}disconnectedCallback(){clearTimeout(this.alertDelay)}isMobileOrTabletDevice(t=1024){if("undefined"==typeof window||"undefined"==typeof navigator||"undefined"==typeof document)return!1;const a=window.matchMedia(`(max-width: ${t}px)`).matches,l=/Macintosh|Android|iPhone|iPad|iPod/i.test(navigator.userAgent),r="ontouchstart"in window||"ontouchend"in document||navigator.maxTouchPoints>0;return l&&a&&r}closeAlert(){salla.storage.set("app_install_prompt_disabled",!0),this.closing=!0,this.host.addEventListener("animationend",(()=>{this.closing=!1,this.open=!1}),{once:!0})}shouldShowAlert(){return!salla.config.isMobileApp()}render(){return this.data&&this.shouldShowAlert()?a(l,{class:`s-app-install-alert-wrapper ${this.open?"open":""} ${this.closing?"closing":""}`,position:this.data.position},a("div",null,a("img",{src:this.data.icon,width:"58",height:"58",alt:`${salla.config.get("store.name")}`})),a("div",{class:"s-app-install-alert-content"},a("h2",{class:"s-app-install-alert-title"},this.data.title),a("p",{class:"s-app-install-alert-sub-title"},this.data.sub_title," "," ",a("a",{href:this.ctaLink,target:"_blank","aria-label":"download app",class:"s-app-install-alert-cta"},salla.lang.getWithDefault("blocks.footer.download_app_now","حمله الآن")))),a("button",{class:"s-app-install-alert-cancel-button","aria-label":"close alert",onClick:()=>this.closeAlert()},a("i",{class:"sicon-cancel"}))):null}get host(){return r(this)}};i.style='/*!twlt*/:host{display:block}.s-app-install-alert-wrapper{display:none;flex-direction:row;align-items:center;position:fixed;left:0;right:0;width:95%;margin-top:1rem;margin-bottom:1rem;margin-left:auto;margin-right:auto;z-index:999;border-radius:0.375rem;padding:0.75rem;gap:0.5rem;background-color:color-mix(in srgb, var(--color-primary) 15%, white);filter:drop-shadow(0 4px 3px rgba(0, 0, 0, 0.07)) drop-shadow(0 2px 2px rgba(0, 0, 0, 0.06))}.s-app-install-alert-wrapper.open[position=top]{display:flex;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes slideDownFromTop{0%{transform:translateY(-100%);opacity:0}100%{transform:translateY(-0%);opacity:1}}.s-app-install-alert-wrapper.open[position=top]{animation:slideDownFromTop .6s linear;transition-duration:500ms}.s-app-install-alert-wrapper:not(.open){display:none}.s-app-install-alert-content{width:100%}.s-app-install-alert-wrapper[position=top]{top:0px}.s-app-install-alert-wrapper.open[position=bottom]{display:flex}@keyframes slideUpFromBottom{0%{transform:translateY(100%);opacity:0}100%{transform:translateY(0%);opacity:1}}.s-app-install-alert-wrapper.open[position=bottom]{animation:slideUpFromBottom .6s linear}.s-app-install-alert-wrapper[position=bottom]{bottom:0px}@keyframes slideUPFromTop{0%{transform:translateY(-0%);opacity:1}100%{transform:translateY(-100%);opacity:0}}.s-app-install-alert-wrapper[position=top].closing{animation:slideUPFromTop .6s linear}@keyframes slideDownFromBottom{0%{transform:translateY(0%);opacity:1}100%{transform:translateY(100%);opacity:0}}.s-app-install-alert-wrapper[position=bottom].closing{animation:slideDownFromBottom .6s linear}.s-app-install-alert-wrapper.closing{animation-fill-mode:forwards}.s-app-install-alert-title{max-width:95%;font-size:1rem;line-height:1.5rem;font-weight:700;color:var(--color-primary)}.s-app-install-alert-sub-title{max-width:95%;font-size:0.875rem;line-height:1.25rem;font-weight:400}.s-app-install-alert-cta{color:var(--color-primary);text-decoration-line:underline}.s-app-install-alert-cancel-button{position:absolute;top:0.5rem}.s-app-install-alert-cancel-button:where([dir="ltr"],[dir="ltr"] *){right:0.75rem}.s-app-install-alert-cancel-button:where([dir="rtl"],[dir="rtl"] *){left:0.75rem}';export{i as salla_app_install_alert}
4
+ import{r as t,h as a,H as l,a as r}from"./p-HRJpfiBN.js";const i=class{constructor(a){t(this,a),this.alertDelay=null,this.data=salla.config.get("store.app_install_prompt"),this.open=!1,this.closing=!1}connectedCallback(){salla.onReady((()=>{if(this.data=salla.config.get("store.app_install_prompt"),this.isMobileOrTabletDevice()){if(!this.data)return salla.logger.error("Failed to retrieve salla-app-install-alert config");this.ctaLink=salla.url.get("app"),this.alertDelay=setTimeout((()=>this.open=!0),3e3)}}))}disconnectedCallback(){clearTimeout(this.alertDelay)}isMobileOrTabletDevice(t=1024){if("undefined"==typeof window||"undefined"==typeof navigator||"undefined"==typeof document)return!1;const a=window.matchMedia(`(max-width: ${t}px)`).matches,l=/Macintosh|Android|iPhone|iPad|iPod/i.test(navigator.userAgent),r="ontouchstart"in window||"ontouchend"in document||navigator.maxTouchPoints>0;return l&&a&&r}closeAlert(){salla.storage.set("app_install_prompt_disabled",!0),this.closing=!0,this.host.addEventListener("animationend",(()=>{this.closing=!1,this.open=!1}),{once:!0})}shouldShowAlert(){return!salla.config.isMobileApp()}render(){return this.data&&this.shouldShowAlert()?a(l,{class:`s-app-install-alert-wrapper ${this.open?"open":""} ${this.closing?"closing":""}`,position:this.data.position},a("div",null,a("img",{src:this.data.icon,width:"58",height:"58",alt:`${salla.config.get("store.name")}`})),a("div",{class:"s-app-install-alert-content"},a("h2",{class:"s-app-install-alert-title"},this.data.title),a("p",{class:"s-app-install-alert-sub-title"},this.data.sub_title," "," ",a("a",{href:this.ctaLink,target:"_blank","aria-label":"download app",class:"s-app-install-alert-cta"},salla.lang.getWithDefault("blocks.footer.download_app_now","حمله الآن")))),a("button",{class:"s-app-install-alert-cancel-button","aria-label":"close alert",onClick:()=>this.closeAlert()},a("i",{class:"sicon-cancel"}))):null}get host(){return r(this)}};i.style='/*!twlt*/:host{display:block}.s-app-install-alert-wrapper{display:none;flex-direction:row;align-items:center;position:fixed;left:0;right:0;width:95%;margin-top:1rem;margin-bottom:1rem;margin-left:auto;margin-right:auto;z-index:999;border-radius:0.375rem;padding:0.75rem;gap:0.5rem;background-color:color-mix(in srgb, var(--color-primary) 15%, white);filter:drop-shadow(0 4px 3px rgba(0, 0, 0, 0.07)) drop-shadow(0 2px 2px rgba(0, 0, 0, 0.06))}.s-app-install-alert-wrapper.open[position=top]{display:flex;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes slideDownFromTop{0%{transform:translateY(-100%);opacity:0}100%{transform:translateY(-0%);opacity:1}}.s-app-install-alert-wrapper.open[position=top]{animation:slideDownFromTop .6s linear;transition-duration:500ms}.s-app-install-alert-wrapper:not(.open){display:none}.s-app-install-alert-content{width:100%}.s-app-install-alert-wrapper[position=top]{top:0px}.s-app-install-alert-wrapper.open[position=bottom]{display:flex}@keyframes slideUpFromBottom{0%{transform:translateY(100%);opacity:0}100%{transform:translateY(0%);opacity:1}}.s-app-install-alert-wrapper.open[position=bottom]{animation:slideUpFromBottom .6s linear}.s-app-install-alert-wrapper[position=bottom]{bottom:0px}@keyframes slideUPFromTop{0%{transform:translateY(-0%);opacity:1}100%{transform:translateY(-100%);opacity:0}}.s-app-install-alert-wrapper[position=top].closing{animation:slideUPFromTop .6s linear}@keyframes slideDownFromBottom{0%{transform:translateY(0%);opacity:1}100%{transform:translateY(100%);opacity:0}}.s-app-install-alert-wrapper[position=bottom].closing{animation:slideDownFromBottom .6s linear}.s-app-install-alert-wrapper.closing{animation-fill-mode:forwards}.s-app-install-alert-title{max-width:95%;font-size:1rem;line-height:1.5rem;font-weight:700;color:var(--color-primary)}.s-app-install-alert-sub-title{max-width:95%;font-size:0.875rem;line-height:1.25rem;font-weight:400}.s-app-install-alert-cta{color:var(--color-primary);text-decoration-line:underline}.s-app-install-alert-cancel-button{position:absolute;top:0.5rem}.s-app-install-alert-cancel-button:where([dir="ltr"],[dir="ltr"] *){right:0.75rem}.s-app-install-alert-cancel-button:where([dir="rtl"],[dir="rtl"] *){left:0.75rem}';export{i as salla_app_install_alert}
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r as t,h as e,H as s,a as l,F as i}from"./p-Bxge4xib.js";const n=class{constructor(e){t(this,e),this.sections=[],this.itemNumber=""}deleteItem(t,e){const s=this.host.closest("form");if(s){const l=s.getAttribute("id");if(l&&"string"==typeof l){const s=l.match(/item-(\d+)/)?.[1];this.itemNumber=s||"";const i=this.host.querySelector(`#accordion-${e.id}`);salla.cart.deleteItem(`${this.itemNumber}?product_id=${e.id}&section_id=${t}`).then((()=>i?.remove()))}}}renderRemoveButton(t,s,l=!1){return e("salla-button",{type:"button",shape:l?"btn":"icon",fill:l?"outline":"solid",size:"small",color:"danger","aria-label":"Remove from the cart",onClick:()=>this.deleteItem(t,s)},l?salla.lang.get("common.elements.delete"):e("i",{class:"sicon-cancel"}))}renderAccordionHeader(t,s){const l=s?.options&&s?.options?.length>0;return e("div",{slot:"html",class:"s-multiple-bundle-product-cart-header-wrapper"},e("div",{class:"s-multiple-bundle-product-cart-header "+(l?"":"s-multiple-bundle-product-cart-header-no-options")},e("div",{class:"s-multiple-bundle-product-cart-header-content"},e("a",{href:s?.url,class:"s-multiple-bundle-product-cart-header-image-wrapper"},e("img",{src:s?.image?.url,alt:s?.image?.alt||s?.name,class:"s-multiple-bundle-product-cart-header-image"})),e("div",{class:"s-multiple-bundle-product-cart-header-content-details"},e("h2",{class:"s-multiple-bundle-product-cart-header-content-details-title"},e("a",{href:s?.url,class:"s-multiple-bundle-product-cart-header-content-details-title-link"},s?.name)),e("div",{class:"s-multiple-bundle-product-cart-header-content-details-price"},e("span",{class:"s-multiple-bundle-product-cart-header-content-details-price-regular"},e("span",{innerHTML:s?.price?salla.money(s?.price):""})),s?.sale_price>0&&e("span",{class:"s-multiple-bundle-product-cart-header-content-details-price-sale"},e("span",{innerHTML:salla.money(s?.sale_price)}))),s?.quantity_in_group>0&&0!==s?.quantity&&e("p",{class:"s-multiple-bundle-product-cart-header-content-details-quantity"},e("span",null,salla.lang.get("pages.products.number_of_pieces")),e("span",null,s?.quantity_in_group)))),!l&&e("div",{class:"s-multiple-bundle-product-cart-header-remove-button"},this.renderRemoveButton(t,s,!1))))}render(){return e(s,{key:"f4a66dc2916ad42108b551790e1a1a581a55d6b1",class:"s-multiple-bundle-product-wrapper"},e("div",{key:"fa96a2da58ee5be80c79c1a6fff66fbcf49cd87e",class:"s-multiple-bundle-product-wrapper-sections"},this.sections.map(((t,s)=>t.products.map((l=>{const i={sectionId:t.id,sectionIndex:s,productId:l.id};return e("salla-accordion",{key:l.id,collapsed:!1,bordered:!0,collapsible:!!(l.options&&l.options.length>0),size:"sm",id:`accordion-${l.id}`},e("salla-accordion-head",null,this.renderAccordionHeader(String(t.id),l)),l.options&&l.options.length>0&&e("salla-accordion-body",null,e("salla-product-options",{options:JSON.stringify(l.options),key:`${l.id}-persistent`,"product-id":l.id,"bundle-context":JSON.stringify(i)}),e("div",{class:"s-multiple-bundle-product-cart-body-remove-button"},this.renderRemoveButton(String(t.id),l,!0))))}))))))}get host(){return l(this)}};n.style="";const c=class{constructor(e){t(this,e),this.sections=[],this.selectedProducts={},this.productSelectedHandler=null,this.onSelectProduct=(t,e)=>{const s=e.id,l=this.selectedProducts[t]?.has(s)??!1,i=this.sections.find((e=>e.id==t));if(!(l&&i&&this.isProductSelectionLocked(i))){if(!l){if(!i)return;if(1!==this.getEffectiveMax(i)&&this.isAtSelectionLimit(i))return}this.selectedProducts={...this.selectedProducts,[t]:new Set(this.selectedProducts[t]||[])},l?(this.selectedProducts[t].delete(s),this.clearProductFormData(s,t),this.clearProductModalOptions(s,t)):1===this.getEffectiveMax(i)?this.syncSectionSelection(t,s):this.selectedProducts[t].add(s),this.selectedProducts={...this.selectedProducts},salla.event.dispatch("on-bundle-product-selected",{id:e.id,name:e.name,options:e.options,wasSelected:l,isSelected:!l})}},this.ensureProductSelected=(t,e)=>{this.selectedProducts={...this.selectedProducts,[t]:new Set(this.selectedProducts[t]||[])};const s=e.id;if(this.selectedProducts[t].has(s))return;const l=this.sections.find((e=>e.id==t));if(!l)return;const i=this.getEffectiveMax(l);if(1===i)this.syncSectionSelection(t,s);else{if(i>1&&this.isAtSelectionLimit(l))return;this.selectedProducts[t].add(s)}this.selectedProducts={...this.selectedProducts},salla.event.dispatch("on-bundle-product-selected",{id:e.id,name:e.name,options:e.options})},this.onSelectProductOptions=(t,e)=>{const s=this.sections.find((t=>t.id==e));if(!s||!this.canSelectProductInSection(s,t.id))return;const l=this.sections.findIndex((t=>t.id==e)),i=s.products?.findIndex((e=>e.id==t.id))??0,n=this.selectedProducts[e]?.has(t.id)??!1;salla.event.dispatch("multiple-bundle-product-modal::open",{product:t,sectionId:e,sectionIndex:l,productIndex:i,isProductAlreadySelected:n})},this.handleBundleSliderProductSelected=t=>{const{product:e,sectionId:s}=t.detail;this.onSelectProduct(s,e)},this.handleBundleSliderProductOptionsSelected=t=>{const{product:e,sectionId:s}=t.detail;this.onSelectProductOptions(e,s)}}isSingleProductSection(t){return 1===(t.products?.length??0)}getObligatoryMin(t){const e=t.obligatory_products;if(null==e)return 0;const s=Number(e);return Number.isNaN(s)?0:s}isProductSelectionLocked(t){return this.isSingleProductSection(t)&&1===this.getObligatoryMin(t)}getEffectiveMax(t){const e=t.products?.length??0,s=t.max_obligatory_products;return null!=s&&s>0?Math.min(s,e):e}getSelectedCount(t){return this.selectedProducts[t]?.size??0}isAtSelectionLimit(t){return this.getSelectedCount(t.id)>=this.getEffectiveMax(t)}canSelectProductInSection(t,e){return!!this.selectedProducts[t.id]?.has(e)||1===this.getEffectiveMax(t)||!this.isAtSelectionLimit(t)}async canSelectBundleProduct(t,e){const s=this.sections.find((e=>e.id==t));return!!s&&this.canSelectProductInSection(s,e)}queryProductCheckbox(t,e){const s=`input.s-multiple-bundle-product-checkbox[name="bundle[${t}][${e}][id]"]`,l=this.host.closest("form"),i=l?.querySelector(s);if(i)return i;for(const t of this.host.querySelectorAll("salla-multiple-bundle-product-slider")){const e=(t.shadowRoot??t).querySelector(s);if(e)return e}return null}dispatchBubblingChange(t){requestAnimationFrame((()=>{t.dispatchEvent(new window.Event("change",{bubbles:!0}))}))}clearSectionProductSlot(t,e,s){const l=this.queryProductCheckbox(t,s);l&&(l.checked=!1);const i=this.host.closest("form");if(i){const e=`bundle[${t}][${s}]`;Array.from(i.querySelectorAll("input")).forEach((t=>{t.name?.startsWith(e)&&("checkbox"===t.type&&t.name?.endsWith("][id]")?t.checked=!1:t.remove())}))}this.clearProductModalOptions(e,t)}syncSectionSelection(t,e){const s=this.sections.find((e=>e.id==t));s?.products?.forEach(((s,l)=>{s.id!=e&&this.clearSectionProductSlot(t,s.id,l)})),this.selectedProducts[t]=new Set([e]);const l=s?.products?.findIndex((t=>t.id==e))??-1,i=l>=0?this.queryProductCheckbox(t,l):null;i&&(i.checked=!0,this.dispatchBubblingChange(i))}autoSelectSingleProductSections(){if(!this.sections?.length)return;const t={...this.selectedProducts};let e=!1;const s=[];for(const l of this.sections){if(!this.isProductSelectionLocked(l))continue;const i=l.products?.[0];if(!i||!i.unlimited_quantity&&(i.quantity??0)<=0)continue;const n=l.id,c=new Set(t[n]||[]);c.has(i.id)||(c.add(i.id),t[n]=c,e=!0,s.push({product:i}))}e&&(this.selectedProducts=t,s.forEach((({product:t})=>{salla.event.dispatch("on-bundle-product-selected",{id:t.id,name:t.name,options:t.options})})))}clearProductFormData(t,e){if(null!=e){const s=this.sections.find((t=>t.id==e)),l=s?.products?.findIndex((e=>e.id==t))??-1;if(l>=0)return void this.clearSectionProductSlot(e,t,l)}const s=this.host.closest("form");s&&s.querySelectorAll(`[data-product-id="${t}"]`).forEach((t=>t.remove()))}clearProductModalOptions(t,e){let s=null,l=null;if(null!=e&&(s=this.sections.findIndex((t=>t.id==e)),s>-1)){const e=this.sections[s];if(e){const s=e.products?.findIndex((e=>e.id==t));l="number"==typeof s&&s>-1?s:null}}salla.event.dispatch("multiple-bundle-product-modal::clear-options",{productId:t,sectionId:e,sectionIndex:s,productIndex:l})}getProgressStatus(t){const e=this.getSelectedCount(t.id),s=this.getEffectiveMax(t);return s>0?`${e}/${s}`:"0"}getSectionSelectionNote(t){const e=this.getObligatoryMin(t),s=Number(t.max_obligatory_products)||0,l=e>0,i=s>0;return l||i?l&&i?e===s?salla.lang.getWithDefault("pages.products.bundle_select_exact",`اختر ${e} منتجات`,{count:e}):salla.lang.getWithDefault("pages.products.bundle_select_range",`اختر من ${e} إلى ${s} منتجات`,{min:e,max:s}):l?salla.lang.getWithDefault("pages.products.bundle_select_min",`اختر على الأقل ${e} منتجات`,{min:e}):salla.lang.getWithDefault("pages.products.bundle_select_max",`اختر حتى ${s} منتجات`,{max:s}):null}handleSectionsChange(){this.autoSelectSingleProductSections()}componentWillLoad(){this.autoSelectSingleProductSections()}renderAccordionHeader(t){const s=this.getSectionSelectionNote(t);return e(i,null,e("h2",{slot:"title"},t?.name),s?e("span",{slot:"note"},s):null,e("span",{slot:"progress"},this.getProgressStatus(t)))}componentDidLoad(){const t=this.host.querySelector("salla-multiple-bundle-product-options-modal");t&&(this.productSelectedHandler=t=>{const{productId:e,sectionId:s,product:l,fromModal:i}=t.detail;i?this.ensureProductSelected(s,l||{id:e}):this.onSelectProduct(s,l||{id:e})},t.addEventListener("productSelected",this.productSelectedHandler))}disconnectedCallback(){if(this.productSelectedHandler){const t=this.host.querySelector("salla-multiple-bundle-product-options-modal");t&&t.removeEventListener("productSelected",this.productSelectedHandler),this.productSelectedHandler=null}}render(){return e(s,{key:"379725e546f6eeb670a23166de2a2d829e48da96",class:"s-multiple-bundle-product-wrapper"},e("div",{key:"5939dfacd285738495dda3481d4974775152dc76",class:"s-multiple-bundle-product-wrapper-sections"},this.sections.map(((t,s)=>e("salla-accordion",{key:t.id,collapsed:0!==s},e("salla-accordion-head",null,this.renderAccordionHeader(t)),e("salla-accordion-body",null,e("salla-multiple-bundle-product-slider",{section:t,sectionIndex:s,selectedProducts:this.selectedProducts,selectionLimit:this.getEffectiveMax(t),isSelectionLocked:this.isProductSelectionLocked(t),onProductSelected:this.handleBundleSliderProductSelected,onProductOptionsSelected:this.handleBundleSliderProductOptionsSelected})))))),e("salla-multiple-bundle-product-options-modal",{key:"2270a07c784a748e7ffaf48164e5cc8b09116878"}))}get host(){return l(this)}static get watchers(){return{sections:["handleSectionsChange"]}}};c.style="";export{n as salla_multiple_bundle_product_cart,c as salla_multiple_bundle_product_details}
4
+ import{r as t,h as e,H as s,a as l,F as i}from"./p-HRJpfiBN.js";const n=class{constructor(e){t(this,e),this.sections=[],this.itemNumber=""}deleteItem(t,e){const s=this.host.closest("form");if(s){const l=s.getAttribute("id");if(l&&"string"==typeof l){const s=l.match(/item-(\d+)/)?.[1];this.itemNumber=s||"";const i=this.host.querySelector(`#accordion-${e.id}`);salla.cart.deleteItem(`${this.itemNumber}?product_id=${e.id}&section_id=${t}`).then((()=>i?.remove()))}}}renderRemoveButton(t,s,l=!1){return e("salla-button",{type:"button",shape:l?"btn":"icon",fill:l?"outline":"solid",size:"small",color:"danger","aria-label":"Remove from the cart",onClick:()=>this.deleteItem(t,s)},l?salla.lang.get("common.elements.delete"):e("i",{class:"sicon-cancel"}))}renderAccordionHeader(t,s){const l=s?.options&&s?.options?.length>0;return e("div",{slot:"html",class:"s-multiple-bundle-product-cart-header-wrapper"},e("div",{class:"s-multiple-bundle-product-cart-header "+(l?"":"s-multiple-bundle-product-cart-header-no-options")},e("div",{class:"s-multiple-bundle-product-cart-header-content"},e("a",{href:s?.url,class:"s-multiple-bundle-product-cart-header-image-wrapper"},e("img",{src:s?.image?.url,alt:s?.image?.alt||s?.name,class:"s-multiple-bundle-product-cart-header-image"})),e("div",{class:"s-multiple-bundle-product-cart-header-content-details"},e("h2",{class:"s-multiple-bundle-product-cart-header-content-details-title"},e("a",{href:s?.url,class:"s-multiple-bundle-product-cart-header-content-details-title-link"},s?.name)),e("div",{class:"s-multiple-bundle-product-cart-header-content-details-price"},e("span",{class:"s-multiple-bundle-product-cart-header-content-details-price-regular"},e("span",{innerHTML:s?.price?salla.money(s?.price):""})),s?.sale_price>0&&e("span",{class:"s-multiple-bundle-product-cart-header-content-details-price-sale"},e("span",{innerHTML:salla.money(s?.sale_price)}))),s?.quantity_in_group>0&&0!==s?.quantity&&e("p",{class:"s-multiple-bundle-product-cart-header-content-details-quantity"},e("span",null,salla.lang.get("pages.products.number_of_pieces")),e("span",null,s?.quantity_in_group)))),!l&&e("div",{class:"s-multiple-bundle-product-cart-header-remove-button"},this.renderRemoveButton(t,s,!1))))}render(){return e(s,{key:"f4a66dc2916ad42108b551790e1a1a581a55d6b1",class:"s-multiple-bundle-product-wrapper"},e("div",{key:"fa96a2da58ee5be80c79c1a6fff66fbcf49cd87e",class:"s-multiple-bundle-product-wrapper-sections"},this.sections.map(((t,s)=>t.products.map((l=>{const i={sectionId:t.id,sectionIndex:s,productId:l.id};return e("salla-accordion",{key:l.id,collapsed:!1,bordered:!0,collapsible:!!(l.options&&l.options.length>0),size:"sm",id:`accordion-${l.id}`},e("salla-accordion-head",null,this.renderAccordionHeader(String(t.id),l)),l.options&&l.options.length>0&&e("salla-accordion-body",null,e("salla-product-options",{options:JSON.stringify(l.options),key:`${l.id}-persistent`,"product-id":l.id,"bundle-context":JSON.stringify(i)}),e("div",{class:"s-multiple-bundle-product-cart-body-remove-button"},this.renderRemoveButton(String(t.id),l,!0))))}))))))}get host(){return l(this)}};n.style="";const c=class{constructor(e){t(this,e),this.sections=[],this.selectedProducts={},this.productSelectedHandler=null,this.onSelectProduct=(t,e)=>{const s=e.id,l=this.selectedProducts[t]?.has(s)??!1,i=this.sections.find((e=>e.id==t));if(!(l&&i&&this.isProductSelectionLocked(i))){if(!l){if(!i)return;if(1!==this.getEffectiveMax(i)&&this.isAtSelectionLimit(i))return}this.selectedProducts={...this.selectedProducts,[t]:new Set(this.selectedProducts[t]||[])},l?(this.selectedProducts[t].delete(s),this.clearProductFormData(s,t),this.clearProductModalOptions(s,t)):1===this.getEffectiveMax(i)?this.syncSectionSelection(t,s):this.selectedProducts[t].add(s),this.selectedProducts={...this.selectedProducts},salla.event.dispatch("on-bundle-product-selected",{id:e.id,name:e.name,options:e.options,wasSelected:l,isSelected:!l})}},this.ensureProductSelected=(t,e)=>{this.selectedProducts={...this.selectedProducts,[t]:new Set(this.selectedProducts[t]||[])};const s=e.id;if(this.selectedProducts[t].has(s))return;const l=this.sections.find((e=>e.id==t));if(!l)return;const i=this.getEffectiveMax(l);if(1===i)this.syncSectionSelection(t,s);else{if(i>1&&this.isAtSelectionLimit(l))return;this.selectedProducts[t].add(s)}this.selectedProducts={...this.selectedProducts},salla.event.dispatch("on-bundle-product-selected",{id:e.id,name:e.name,options:e.options})},this.onSelectProductOptions=(t,e)=>{const s=this.sections.find((t=>t.id==e));if(!s||!this.canSelectProductInSection(s,t.id))return;const l=this.sections.findIndex((t=>t.id==e)),i=s.products?.findIndex((e=>e.id==t.id))??0,n=this.selectedProducts[e]?.has(t.id)??!1;salla.event.dispatch("multiple-bundle-product-modal::open",{product:t,sectionId:e,sectionIndex:l,productIndex:i,isProductAlreadySelected:n})},this.handleBundleSliderProductSelected=t=>{const{product:e,sectionId:s}=t.detail;this.onSelectProduct(s,e)},this.handleBundleSliderProductOptionsSelected=t=>{const{product:e,sectionId:s}=t.detail;this.onSelectProductOptions(e,s)}}isSingleProductSection(t){return 1===(t.products?.length??0)}getObligatoryMin(t){const e=t.obligatory_products;if(null==e)return 0;const s=Number(e);return Number.isNaN(s)?0:s}isProductSelectionLocked(t){return this.isSingleProductSection(t)&&1===this.getObligatoryMin(t)}getEffectiveMax(t){const e=t.products?.length??0,s=t.max_obligatory_products;return null!=s&&s>0?Math.min(s,e):e}getSelectedCount(t){return this.selectedProducts[t]?.size??0}isAtSelectionLimit(t){return this.getSelectedCount(t.id)>=this.getEffectiveMax(t)}canSelectProductInSection(t,e){return!!this.selectedProducts[t.id]?.has(e)||1===this.getEffectiveMax(t)||!this.isAtSelectionLimit(t)}async canSelectBundleProduct(t,e){const s=this.sections.find((e=>e.id==t));return!!s&&this.canSelectProductInSection(s,e)}queryProductCheckbox(t,e){const s=`input.s-multiple-bundle-product-checkbox[name="bundle[${t}][${e}][id]"]`,l=this.host.closest("form"),i=l?.querySelector(s);if(i)return i;for(const t of this.host.querySelectorAll("salla-multiple-bundle-product-slider")){const e=(t.shadowRoot??t).querySelector(s);if(e)return e}return null}dispatchBubblingChange(t){requestAnimationFrame((()=>{t.dispatchEvent(new window.Event("change",{bubbles:!0}))}))}clearSectionProductSlot(t,e,s){const l=this.queryProductCheckbox(t,s);l&&(l.checked=!1);const i=this.host.closest("form");if(i){const e=`bundle[${t}][${s}]`;Array.from(i.querySelectorAll("input")).forEach((t=>{t.name?.startsWith(e)&&("checkbox"===t.type&&t.name?.endsWith("][id]")?t.checked=!1:t.remove())}))}this.clearProductModalOptions(e,t)}syncSectionSelection(t,e){const s=this.sections.find((e=>e.id==t));s?.products?.forEach(((s,l)=>{s.id!=e&&this.clearSectionProductSlot(t,s.id,l)})),this.selectedProducts[t]=new Set([e]);const l=s?.products?.findIndex((t=>t.id==e))??-1,i=l>=0?this.queryProductCheckbox(t,l):null;i&&(i.checked=!0,this.dispatchBubblingChange(i))}autoSelectSingleProductSections(){if(!this.sections?.length)return;const t={...this.selectedProducts};let e=!1;const s=[];for(const l of this.sections){if(!this.isProductSelectionLocked(l))continue;const i=l.products?.[0];if(!i||!i.unlimited_quantity&&(i.quantity??0)<=0)continue;const n=l.id,c=new Set(t[n]||[]);c.has(i.id)||(c.add(i.id),t[n]=c,e=!0,s.push({product:i}))}e&&(this.selectedProducts=t,s.forEach((({product:t})=>{salla.event.dispatch("on-bundle-product-selected",{id:t.id,name:t.name,options:t.options})})))}clearProductFormData(t,e){if(null!=e){const s=this.sections.find((t=>t.id==e)),l=s?.products?.findIndex((e=>e.id==t))??-1;if(l>=0)return void this.clearSectionProductSlot(e,t,l)}const s=this.host.closest("form");s&&s.querySelectorAll(`[data-product-id="${t}"]`).forEach((t=>t.remove()))}clearProductModalOptions(t,e){let s=null,l=null;if(null!=e&&(s=this.sections.findIndex((t=>t.id==e)),s>-1)){const e=this.sections[s];if(e){const s=e.products?.findIndex((e=>e.id==t));l="number"==typeof s&&s>-1?s:null}}salla.event.dispatch("multiple-bundle-product-modal::clear-options",{productId:t,sectionId:e,sectionIndex:s,productIndex:l})}getProgressStatus(t){const e=this.getSelectedCount(t.id),s=this.getEffectiveMax(t);return s>0?`${e}/${s}`:"0"}getSectionSelectionNote(t){const e=this.getObligatoryMin(t),s=Number(t.max_obligatory_products)||0,l=e>0,i=s>0;return l||i?l&&i?e===s?salla.lang.getWithDefault("pages.products.bundle_select_exact",`اختر ${e} منتجات`,{count:e}):salla.lang.getWithDefault("pages.products.bundle_select_range",`اختر من ${e} إلى ${s} منتجات`,{min:e,max:s}):l?salla.lang.getWithDefault("pages.products.bundle_select_min",`اختر على الأقل ${e} منتجات`,{min:e}):salla.lang.getWithDefault("pages.products.bundle_select_max",`اختر حتى ${s} منتجات`,{max:s}):null}handleSectionsChange(){this.autoSelectSingleProductSections()}componentWillLoad(){this.autoSelectSingleProductSections()}renderAccordionHeader(t){const s=this.getSectionSelectionNote(t);return e(i,null,e("h2",{slot:"title"},t?.name),s?e("span",{slot:"note"},s):null,e("span",{slot:"progress"},this.getProgressStatus(t)))}componentDidLoad(){const t=this.host.querySelector("salla-multiple-bundle-product-options-modal");t&&(this.productSelectedHandler=t=>{const{productId:e,sectionId:s,product:l,fromModal:i}=t.detail;i?this.ensureProductSelected(s,l||{id:e}):this.onSelectProduct(s,l||{id:e})},t.addEventListener("productSelected",this.productSelectedHandler))}disconnectedCallback(){if(this.productSelectedHandler){const t=this.host.querySelector("salla-multiple-bundle-product-options-modal");t&&t.removeEventListener("productSelected",this.productSelectedHandler),this.productSelectedHandler=null}}render(){return e(s,{key:"379725e546f6eeb670a23166de2a2d829e48da96",class:"s-multiple-bundle-product-wrapper"},e("div",{key:"5939dfacd285738495dda3481d4974775152dc76",class:"s-multiple-bundle-product-wrapper-sections"},this.sections.map(((t,s)=>e("salla-accordion",{key:t.id,collapsed:0!==s},e("salla-accordion-head",null,this.renderAccordionHeader(t)),e("salla-accordion-body",null,e("salla-multiple-bundle-product-slider",{section:t,sectionIndex:s,selectedProducts:this.selectedProducts,selectionLimit:this.getEffectiveMax(t),isSelectionLocked:this.isProductSelectionLocked(t),onProductSelected:this.handleBundleSliderProductSelected,onProductOptionsSelected:this.handleBundleSliderProductOptionsSelected})))))),e("salla-multiple-bundle-product-options-modal",{key:"2270a07c784a748e7ffaf48164e5cc8b09116878"}))}get host(){return l(this)}static get watchers(){return{sections:["handleSectionsChange"]}}};c.style="";export{n as salla_multiple_bundle_product_cart,c as salla_multiple_bundle_product_details}
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r,h as e,H as s}from"./p-Bxge4xib.js";import{i as t}from"./p-DqDX5na4.js";class i{async run(r){this.abort();const{signal:e}=this.controller=new AbortController;try{const s=await r(e);return e.aborted?{aborted:!0}:{aborted:!1,result:s}}catch(r){if(e.aborted)return{aborted:!0};throw r}}abort(){this.controller?.abort()}}const o=class{constructor(e){r(this,e),this.shipments=[],this.request=new i}async componentWillLoad(){return await salla.onReady(),this.fetchShipments()}async onOrderIdChange(){this.shipments=[],await this.fetchShipments()}disconnectedCallback(){this.request.abort()}async fetchShipments(){if(this.request.abort(),!salla.config.get("store.features",[]).includes("thankyou-page-multi-shipments"))return;const r=this.orderId||salla.config.get("page.id");if(r)try{const{aborted:e,result:s}=await this.request.run((e=>salla.order.api.getShipments(r,e)));if(e)return;const t=s?.data;this.shipments=Array.isArray(t)?t:Array.isArray(t?.data)?t.data:[]}catch(r){const e=r?.response?.data?.error?.message||r?.response?.data?.message;e&&salla.notify.error(e)}}label(r,e){return salla.lang.getWithDefault(r,e)}async copyTracking(r){try{await navigator.clipboard.writeText(r),salla.notify.success(this.label("common.elements.copied","تم النسخ"))}catch{}}renderTracking(r){const s=r.number;return s&&0!==Number(s)?e("span",{class:"s-order-shipments-tracking"},this.label("pages.thank_you.tracking_no","رقم تتبع الشحنة"),e("b",{dir:"ltr"},"#",s),e("button",{type:"button",class:"s-order-shipments-copy",title:this.label("common.elements.copy","نسخ"),onClick:()=>this.copyTracking(String(s))},e("span",{innerHTML:t}))):e("span",{class:"s-order-shipments-placeholder"},this.label("pages.thank_you.tracking_placeholder","سيتم تعيين رقم تتبع بمجرد تجهيز الشحنة"))}renderShipment(r,s){return e("div",{class:"s-order-shipments-card"},e("div",{class:"s-order-shipments-header"},r.logo?e("img",{src:r.logo,class:"s-order-shipments-logo",alt:r.name||"",width:"56",height:"32"}):null,e("span",{class:"s-order-shipments-title"},this.label("pages.thank_you.shipment","الشحنة")," (",s+1,")")),e("div",{class:"s-order-shipments-info"},this.renderTracking(r)),e("div",{class:"s-order-shipments-items"},(r.products||[]).map((r=>e("span",{class:"s-order-shipments-item",title:r.name},r.image?e("img",{src:r.image,alt:r.name,width:"56",height:"56"}):e("span",{class:"s-order-shipments-item-name"},r.name))))))}render(){return this.shipments.length<2?e(s,{class:"s-order-shipments-empty"}):e(s,{class:"s-order-shipments-wrapper"},e("div",{class:"s-order-shipments-list"},this.shipments.map(((r,e)=>this.renderShipment(r,e)))))}static get watchers(){return{orderId:["onOrderIdChange"]}}};o.style="/*!twlt*/:host{display:block}.s-order-shipments-wrapper{display:block}.s-order-shipments-empty{display:none}.s-order-shipments-list{display:flex;flex-wrap:wrap;gap:1rem}.s-order-shipments-card{display:flex;min-width:16rem;flex:1 1 0%;flex-basis:25%;flex-direction:column;gap:0.75rem;border-radius:1rem;background-color:var(--color-surface);padding:1rem;--tw-shadow:0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);--tw-shadow-colored:0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}.s-order-shipments-header{display:flex;gap:0.5rem}.s-order-shipments-title{font-size:15px;font-weight:700;color:var(--color-text-primary)}.s-order-shipments-logo{height:3rem;width:3rem;flex-shrink:0;border-radius:9999px;object-fit:cover}.s-order-shipments-info{display:flex;flex-wrap:wrap;align-items:center;column-gap:0.75rem;row-gap:0.5rem;font-size:13px;color:var(--color-text-secondary)}.s-order-shipments-tracking{display:inline-flex;align-items:center;gap:0.25rem}.s-order-shipments-placeholder{color:var(--color-text-secondary)}.s-order-shipments-copy{display:inline-flex;cursor:pointer;align-items:center;border-width:0px;background-color:transparent;padding:0px;color:currentColor}.s-order-shipments-copy svg{height:0.875rem;width:0.875rem;fill:currentColor}.s-order-shipments-items{display:flex;gap:0.5rem;overflow-x:auto}.s-order-shipments-item{display:inline-flex;height:4.5rem;width:4.5rem;flex-shrink:0;align-items:center;justify-content:center;overflow:hidden;border-radius:0.75rem;border-width:1px;border-color:var(--color-border);padding:0.375rem}.s-order-shipments-item img{display:block;height:100%;width:100%;object-fit:contain}.s-order-shipments-item-name{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:3;padding-left:0.25rem;padding-right:0.25rem;text-align:center;font-size:10px;line-height:1.25;color:var(--color-text-secondary)}";export{o as salla_order_shipments}
4
+ import{r,h as e,H as s}from"./p-HRJpfiBN.js";import{i as t}from"./p-DqDX5na4.js";class i{async run(r){this.abort();const{signal:e}=this.controller=new AbortController;try{const s=await r(e);return e.aborted?{aborted:!0}:{aborted:!1,result:s}}catch(r){if(e.aborted)return{aborted:!0};throw r}}abort(){this.controller?.abort()}}const o=class{constructor(e){r(this,e),this.shipments=[],this.request=new i}async componentWillLoad(){return await salla.onReady(),this.fetchShipments()}async onOrderIdChange(){this.shipments=[],await this.fetchShipments()}disconnectedCallback(){this.request.abort()}async fetchShipments(){if(this.request.abort(),!salla.config.get("store.features",[]).includes("thankyou-page-multi-shipments"))return;const r=this.orderId||salla.config.get("page.id");if(r)try{const{aborted:e,result:s}=await this.request.run((e=>salla.order.api.getShipments(r,e)));if(e)return;const t=s?.data;this.shipments=Array.isArray(t)?t:Array.isArray(t?.data)?t.data:[]}catch(r){const e=r?.response?.data?.error?.message||r?.response?.data?.message;e&&salla.notify.error(e)}}label(r,e){return salla.lang.getWithDefault(r,e)}async copyTracking(r){try{await navigator.clipboard.writeText(r),salla.notify.success(this.label("common.elements.copied","تم النسخ"))}catch{}}renderTracking(r){const s=r.number;return s&&0!==Number(s)?e("span",{class:"s-order-shipments-tracking"},this.label("pages.thank_you.tracking_no","رقم تتبع الشحنة"),e("b",{dir:"ltr"},"#",s),e("button",{type:"button",class:"s-order-shipments-copy",title:this.label("common.elements.copy","نسخ"),onClick:()=>this.copyTracking(String(s))},e("span",{innerHTML:t}))):e("span",{class:"s-order-shipments-placeholder"},this.label("pages.thank_you.tracking_placeholder","سيتم تعيين رقم تتبع بمجرد تجهيز الشحنة"))}renderShipment(r,s){return e("div",{class:"s-order-shipments-card"},e("div",{class:"s-order-shipments-header"},r.logo?e("img",{src:r.logo,class:"s-order-shipments-logo",alt:r.name||"",width:"56",height:"32"}):null,e("span",{class:"s-order-shipments-title"},this.label("pages.thank_you.shipment","الشحنة")," (",s+1,")")),e("div",{class:"s-order-shipments-info"},this.renderTracking(r)),e("div",{class:"s-order-shipments-items"},(r.products||[]).map((r=>e("span",{class:"s-order-shipments-item",title:r.name},r.image?e("img",{src:r.image,alt:r.name,width:"56",height:"56"}):e("span",{class:"s-order-shipments-item-name"},r.name))))))}render(){return this.shipments.length<2?e(s,{class:"s-order-shipments-empty"}):e(s,{class:"s-order-shipments-wrapper"},e("div",{class:"s-order-shipments-list"},this.shipments.map(((r,e)=>this.renderShipment(r,e)))))}static get watchers(){return{orderId:["onOrderIdChange"]}}};o.style="/*!twlt*/:host{display:block}.s-order-shipments-wrapper{display:block}.s-order-shipments-empty{display:none}.s-order-shipments-list{display:flex;flex-wrap:wrap;gap:1rem}.s-order-shipments-card{display:flex;min-width:16rem;flex:1 1 0%;flex-basis:25%;flex-direction:column;gap:0.75rem;border-radius:1rem;background-color:var(--color-surface);padding:1rem;--tw-shadow:0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);--tw-shadow-colored:0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}.s-order-shipments-header{display:flex;gap:0.5rem}.s-order-shipments-title{font-size:15px;font-weight:700;color:var(--color-text-primary)}.s-order-shipments-logo{height:3rem;width:3rem;flex-shrink:0;border-radius:9999px;object-fit:cover}.s-order-shipments-info{display:flex;flex-wrap:wrap;align-items:center;column-gap:0.75rem;row-gap:0.5rem;font-size:13px;color:var(--color-text-secondary)}.s-order-shipments-tracking{display:inline-flex;align-items:center;gap:0.25rem}.s-order-shipments-placeholder{color:var(--color-text-secondary)}.s-order-shipments-copy{display:inline-flex;cursor:pointer;align-items:center;border-width:0px;background-color:transparent;padding:0px;color:currentColor}.s-order-shipments-copy svg{height:0.875rem;width:0.875rem;fill:currentColor}.s-order-shipments-items{display:flex;gap:0.5rem;overflow-x:auto}.s-order-shipments-item{display:inline-flex;height:4.5rem;width:4.5rem;flex-shrink:0;align-items:center;justify-content:center;overflow:hidden;border-radius:0.75rem;border-width:1px;border-color:var(--color-border);padding:0.375rem}.s-order-shipments-item img{display:block;height:100%;width:100%;object-fit:contain}.s-order-shipments-item-name{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:3;padding-left:0.25rem;padding-right:0.25rem;text-align:center;font-size:10px;line-height:1.25;color:var(--color-text-secondary)}";export{o as salla_order_shipments}
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r as e,h as t,H as r}from"./p-Bxge4xib.js";var i;!function(e){e.PERCENTAGE="percentage",e.FIXED="fixed"}(i||(i={}));const o={staticIcons:['<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="40" height="40" color="#000000" fill="none">\n <path d="M13.7276 3.44418L15.4874 6.99288C15.7274 7.48687 16.3673 7.9607 16.9073 8.05143L20.0969 8.58575C22.1367 8.92853 22.6167 10.4206 21.1468 11.8925L18.6671 14.3927C18.2471 14.8161 18.0172 15.6327 18.1471 16.2175L18.8571 19.3125C19.417 21.7623 18.1271 22.71 15.9774 21.4296L12.9877 19.6452C12.4478 19.3226 11.5579 19.3226 11.0079 19.6452L8.01827 21.4296C5.8785 22.71 4.57865 21.7522 5.13859 19.3125L5.84851 16.2175C5.97849 15.6327 5.74852 14.8161 5.32856 14.3927L2.84884 11.8925C1.389 10.4206 1.85895 8.92853 3.89872 8.58575L7.08837 8.05143C7.61831 7.9607 8.25824 7.48687 8.49821 6.99288L10.258 3.44418C11.2179 1.51861 12.7777 1.51861 13.7276 3.44418Z" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path>\n</svg>','<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" color="#000000" fill="none">\n <path d="M3 12C7.5 12 12 7.5 12 3C12 7.5 16.5 12 21 12C16.5 12 12 16.5 12 21C12 16.5 7.5 12 3 12Z" stroke="currentColor" stroke-width="1.5" stroke-linejoin="round"></path>\n <path d="M2 19.5C2.83333 19.5 4.5 17.8333 4.5 17C4.5 17.8333 6.16667 19.5 7 19.5C6.16667 19.5 4.5 21.1667 4.5 22C4.5 21.1667 2.83333 19.5 2 19.5Z" stroke="currentColor" stroke-width="1.5" stroke-linejoin="round"></path>\n <path d="M16 5C17 5 19 3 19 2C19 3 21 5 22 5C21 5 19 7 19 8C19 7 17 5 16 5Z" stroke="currentColor" stroke-width="1.5" stroke-linejoin="round"></path>\n</svg>','<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="40" height="40" color="#000000" fill="none">\n <path d="M14.2644 18.3717C14.5806 17.407 14.7387 16.9247 15.0616 16.593C15.215 16.4354 15.3932 16.3048 15.5887 16.2066C16.0003 16 16.5003 16 17.5002 16C18.5001 16 19.0001 16 19.4116 16.2066C19.6072 16.3048 19.7853 16.4354 19.9388 16.593C20.2617 16.9247 20.4198 17.407 20.736 18.3717L21.0624 19.3675C21.4561 20.5688 21.653 21.1694 21.3587 21.5847C21.0643 22 20.4418 22 19.1966 22H15.8038C14.5586 22 13.936 22 13.6417 21.5847C13.3473 21.1694 13.5442 20.5688 13.938 19.3675L14.2644 18.3717Z" stroke="currentColor" stroke-width="1.5"></path>\n <path d="M8.76421 10.3717C9.08041 9.40705 9.23851 8.92471 9.56143 8.59298C9.71485 8.43537 9.89299 8.3048 10.0885 8.20663C10.5001 8 11.0001 8 12 8C12.9999 8 13.4999 8 13.9115 8.20663C14.107 8.3048 14.2851 8.43537 14.4386 8.59298C14.7615 8.92471 14.9196 9.40705 15.2358 10.3717L15.5622 11.3675C15.956 12.5688 16.1528 13.1694 15.8585 13.5847C15.5642 14 14.9416 14 13.6964 14H10.3036C9.05842 14 8.43585 14 8.1415 13.5847C7.84716 13.1694 8.04404 12.5688 8.43779 11.3675L8.76421 10.3717Z" stroke="currentColor" stroke-width="1.5"></path>\n <path d="M3.26439 18.3717C3.58059 17.407 3.73869 16.9247 4.06162 16.593C4.21504 16.4354 4.39317 16.3048 4.58872 16.2066C5.00031 16 5.50027 16 6.50018 16C7.5001 16 8.00006 16 8.41165 16.2066C8.6072 16.3048 8.78533 16.4354 8.93875 16.593C9.26167 16.9247 9.41977 17.407 9.73597 18.3717L10.0624 19.3675C10.4561 20.5688 10.653 21.1694 10.3587 21.5847C10.0643 22 9.44176 22 8.19661 22H4.80375C3.5586 22 2.93603 22 2.64169 21.5847C2.34735 21.1694 2.54422 20.5688 2.93797 19.3675L3.26439 18.3717Z" stroke="currentColor" stroke-width="1.5"></path>\n <path d="M12 2V4M7.5 3.5L9 5M16.5 3.5L15 5" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"></path>\n</svg>','<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" color="#000000" fill="none">\n <path d="M5.78223 4.18192C6.43007 3.68319 6.754 3.43383 7.12788 3.27323C7.29741 3.20041 7.47367 3.14158 7.65459 3.09741C8.0536 3 8.4767 3 9.32289 3H14.6771C15.5233 3 15.9464 3 16.3454 3.09741C16.5263 3.14158 16.7026 3.20041 16.8721 3.27323C17.246 3.43383 17.5699 3.68319 18.2178 4.18192C20.3644 5.83448 21.4378 6.66077 21.8057 7.73078C21.9694 8.20673 22.0305 8.70728 21.9858 9.20461C21.8852 10.3227 21.0379 11.346 19.3433 13.3925L15.3498 18.2153C13.8126 20.0718 13.044 21 12 21C10.956 21 10.1874 20.0718 8.65018 18.2153L4.65671 13.3925C2.96208 11.346 2.11476 10.3227 2.0142 9.20461C1.96947 8.70728 2.03064 8.20673 2.1943 7.73078C2.56224 6.66077 3.63557 5.83448 5.78223 4.18192Z" stroke="currentColor" stroke-width="1.5"></path>\n <path d="M10 8.5H14" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path>\n</svg>'],staticColors:["#993018","#444444","#D18F36","#315F9C"]};class s{static findTierByIndex(e,t){return e.find((e=>e.index===t))||null}static findTierByName(e,t){return e.find((e=>e.tier_name===t))||null}static getTierNameByIndex(e,t){return this.findTierByIndex(e,t)?.tier_name}static findCurrentTierIndex(e,t){if(!t)return 0;for(let r=t.length-1;r>=0;r--)if(e>=t[r].threshold)return t[r].index;return 0}}const n=class{constructor(t){e(this,t),this.currentTierIndex=0,this.canRender=!1,this.isLoading=!1,this.handleTabClick=e=>{this.activeTabTier=e},salla.lang.onLoaded((()=>{this.loyaltyProgramText=salla.lang.get("blocks.tiered_offer.program_title"),this.currentTierText=salla.lang.get("blocks.tiered_offer.current_tier"),this.discountText=salla.lang.get("blocks.tiered_offer.discount"),this.benefitText=salla.lang.get("blocks.tiered_offer.tier_description")}))}async componentWillLoad(){try{if(await salla.onReady(),!this.checkFeatureEnabled())return;if(!this.checkCartExists())return;this.isLoading=!0;const e=await this.fetchTieredOfferData();if(!e)return;this.initializeComponent(e)}catch(e){this.canRender=!1,salla.logger.warn("salla-tiered-offer:: ",e)}finally{this.isLoading=!1}}checkFeatureEnabled(){return salla.config.get("store.features")?.includes("tiered-offer")}checkCartExists(){return!!salla.storage.get("cart")?.summary?.count}validateCouponCompatibility(e,t){return!(t&&!e.details?.applied_with_coupon)}shouldHideForGuest(){return salla.config.isGuest()}shouldHideUntilThreshold(e,t){return!(!e?.hide_until_threshold||0!==t)}resolveTierName(e,t){return s.getTierNameByIndex(e,t)||""}async fetchTieredOfferData(){try{const{data:e}=await salla.api.cart.offers(),t=e.find((e=>"tiered_offer"===e.type));return t?this.validateCouponCompatibility(t,salla.storage.get("cart")?.coupon)?t:(this.canRender=!1,null):null}catch(e){throw e}}initializeComponent(e){this.apiOfferData=e,this.tieredOfferData=this.mapApiDataToTiers(this.apiOfferData),this.loyaltyProgramText=this.apiOfferData.title||this.loyaltyProgramText;const t=this.findCurrentTierIndex(this.apiOfferData.details?.current_value||0);this.shouldHideForGuest()||this.shouldHideUntilThreshold(this.apiOfferData.details,t)?this.canRender=!1:(this.currentTierIndex=t,this.currentTier=this.resolveTierName(this.tieredOfferData.tiers,t),this.activeTabTier=this.currentTier||this.tieredOfferData.tiers[0]?.tier_name,this.canRender=!0)}componentDidLoad(){salla.event.on("cart::updated",(async e=>{let t=null;try{t=await this.fetchTieredOfferData()}catch(e){return void salla.logger.warn("salla-tiered-offer:: ",e)}t&&(this.tieredOfferData?this.updateOfferValues(e,t):this.initializeComponent(t))}))}mapApiDataToTiers(e){const t=[...e.details.discounts].sort(((e,t)=>e.min_spend-t.min_spend)).map(((e,t)=>({name:e.name,tier_name:e.name,discount:e.type===i.PERCENTAGE?`${salla.helpers.number(e.value)}%`:salla.money(e.value),icon:o.staticIcons[t]||o.staticIcons[0],threshold:e.min_spend,text_color:o.staticColors[t],index:t+1})));return{current_tier:s.getTierNameByIndex(t,this.findCurrentTierIndex(e.details.current_value,t)),tiers:t}}findCurrentTierIndex(e,t=this.tieredOfferData?.tiers){return s.findCurrentTierIndex(e,t||[])}updateOfferValues(e,t){if(!t||!this.tieredOfferData)return;if(!t.details?.discounts?.length)return void(this.canRender=!1);if(!this.validateCouponCompatibility(t,e.coupon))return void(this.canRender=!1);if(this.shouldHideForGuest())return void(this.canRender=!1);const r=this.mapApiDataToTiers(t),i=this.findCurrentTierIndex(t.details?.current_value||0,r.tiers);if(this.shouldHideUntilThreshold(t.details,i))return void(this.canRender=!1);if(!1===t.details?.with_current_cart)return void(this.canRender=!0);this.apiOfferData=t,this.tieredOfferData=r,this.canRender=!0,this.currentTierIndex=i,this.currentTier=this.resolveTierName(r.tiers,i);const o=this.currentTier||r.tiers[0]?.tier_name;this.activeTabTier!==o&&(this.activeTabTier=o)}getLoadingSkeletonView(){return t(r,null,t("div",{class:"s-tiered-offer-container"},t("div",{class:"s-tiered-offer-skeleton-wrapper"},t("div",{class:"s-tiered-offer-skeleton-title"},t("salla-skeleton",{height:"16px",width:"40%"})),t("div",{class:"s-tiered-offer-skeleton-subtitle"},t("salla-skeleton",{height:"20px",width:"60%"})),t("div",{class:"s-tiered-offer-skeleton-progress"},t("salla-skeleton",{height:"16px",width:"100%"})),t("div",{class:"s-tiered-offer-skeleton-tabs"},t("salla-skeleton",{height:"50px",width:"100%"})))))}getCurrentTierData(){return s.findTierByIndex(this.tieredOfferData.tiers,this.currentTierIndex)||this.tieredOfferData.tiers[0]}getProgressWidth(){const e=this.tieredOfferData.tiers.length;return this.findCurrentTierIndex(this.apiOfferData.details?.current_value||0)/e*100}calculateMilestonePosition(e,t){return 1===t?"calc(100% - 18px)":`${Math.max(2,Math.min(95,(e+1)/t*100-8/t))}%`}getMilestoneStyles(e,t,r){const i="rtl"===document.documentElement.dir,o=this.calculateMilestonePosition(t,r),s=e.name.length>6?"flex-end":"center";return{[i?"right":"left"]:o,alignItems:s,position:"absolute",transform:i?"translateX(50%)":"translateX(-50%)"}}getMilestoneIconStyles(e,t,r){return t?{color:e.text_color}:r?{color:"var(--color-primary)"}:{}}renderProgressBarBackground(e){return[t("div",{class:"s-tiered-offer-progress-bg"}),t("div",{class:"s-tiered-offer-progress-fill",style:{width:`${e}%`}})]}renderMilestoneIcon(e,r,i){const o=["s-tiered-offer-milestone-icon",r?"s-tiered-offer-milestone-active":"",i?"s-tiered-offer-milestone-completed":""].filter(Boolean).join(" ");return t("div",{class:o,style:this.getMilestoneIconStyles(e,r,i)},t("span",{innerHTML:e.icon}))}renderMilestoneName(e,r){return t("div",{class:"s-tiered-offer-milestone-name"},r&&t("span",{style:{color:e.text_color}},e.name))}renderMilestones(e,r){return t("div",{class:"s-tiered-offer-milestones-wrapper"},t("div",{class:1===r?"s-tiered-offer-single-milestone-justify-end":"s-tiered-offer-milestones"},this.tieredOfferData.tiers.map(((i,o)=>{const s=e>=i.threshold,n=i.tier_name===this.currentTier;return t("div",{class:"s-tiered-offer-milestone",style:this.getMilestoneStyles(i,o,r)},this.renderMilestoneIcon(i,n,s),this.renderMilestoneName(i,n))}))))}renderProgressBar(){const e=this.getProgressWidth(),r=this.tieredOfferData.tiers.length,i=this.apiOfferData.details?.current_value||0;return t("div",{class:"s-tiered-offer-progress-container"},t("div",{class:"s-tiered-offer-progress-wrapper"},this.renderProgressBarBackground(e),this.renderMilestones(i,r)))}renderTabs(){return t("div",{class:"s-tiered-offer-tabs-container"},t("div",{class:"s-tiered-offer-tab-headers"},this.tieredOfferData.tiers.map((e=>t("button",{class:"s-tiered-offer-tab-header "+(e.tier_name===this.activeTabTier?"s-tiered-offer-tab-active":""),onClick:()=>this.handleTabClick(e.tier_name)},t("span",null,e.name))))),t("div",{class:"s-tiered-offer-tab-content-wrapper"},(()=>{const e=s.findTierByName(this.tieredOfferData.tiers,this.activeTabTier);return e?t("div",{class:"s-tiered-offer-tab-content"},t("div",{class:"s-tiered-offer-tab-content-inner"},t("div",{class:"s-tiered-offer-discount-section"},t("p",{class:"s-tiered-offer-discount-title"},this.discountText," ",t("span",{innerHTML:e.discount})),t("p",{class:"s-tiered-offer-benefit-description"},this.benefitText," ",e.name)))):null})()))}render(){if(this.isLoading)return this.getLoadingSkeletonView();if(!this.canRender||!this.tieredOfferData)return null;const e=this.getCurrentTierData();return t(r,null,t("div",{class:"s-tiered-offer-container"},t("div",{class:"s-tiered-offer-header"},t("div",{class:"s-tiered-offer-header-content"},t("p",{class:"s-tiered-offer-program-title"},this.loyaltyProgramText),this.currentTier&&t("div",{class:"s-tiered-offer-current-tier-name-wrapper"},t("h2",{class:"s-tiered-offer-current-tier"},this.currentTierText," ",t("span",{class:"s-tiered-offer-tier-name"},e.name)),t("span",{innerHTML:e.icon})))),this.renderProgressBar(),this.renderTabs()))}};n.style="/*!twlt*/.s-tiered-offer-milestone-icon svg{color:currentColor}.s-tiered-offer-milestone-icon svg path{stroke:currentColor;fill:none}.s-tiered-offer-milestone-icon.s-tiered-offer-milestone-active svg path,.s-tiered-offer-milestone-icon.s-tiered-offer-milestone-completed svg path{fill:currentColor;stroke:none}.s-tiered-offer-milestone-icon.s-tiered-offer-milestone-active svg[fill=none] path,.s-tiered-offer-milestone-icon.s-tiered-offer-milestone-completed svg[fill=none] path{fill:none;stroke:currentColor}[dir=rtl] .s-tiered-offer-progress-wrapper .s-tiered-offer-progress-bg{transform:scaleX(-1)}[dir=rtl] .s-tiered-offer-progress-wrapper .s-tiered-offer-progress-fill{transform:scaleX(-1);left:auto}[dir=rtl] .flip-x{transform:scaleX(-1)}.visible{visibility:visible}.static{position:static}.fixed{position:fixed}.absolute{position:absolute}.hidden{display:none}.transform{transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.s-tiered-offer-container{position:relative;margin-bottom:1.25rem;width:100%;border-radius:0.5rem;--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1));padding:1rem;--tw-shadow:0 1px 2px 0 rgb(0 0 0 / 0.05);--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}@media (min-width: 640px){.s-tiered-offer-container{padding:1.25rem;padding-left:1.5rem;padding-right:1.5rem}}.s-tiered-offer-header{margin-bottom:1.5rem;display:flex;align-items:center;gap:0.75rem}.s-tiered-offer-header-content{flex:1 1 0%}.s-tiered-offer-current-tier-name-wrapper{display:flex;flex-direction:row;align-items:flex-start;gap:0.375rem}.s-tiered-offer-current-tier-name-wrapper h2{font-size:1.125rem;line-height:1.75rem}.s-tiered-offer-current-tier-name-wrapper svg{height:1.5rem;width:1.5rem}.s-tiered-offer-program-title{margin:0px;margin-bottom:0.5rem;--tw-text-opacity:1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.s-tiered-offer-program-title h2{font-size:1.125rem;line-height:1.75rem}.s-tiered-offer-current-tier{margin:0px;margin-bottom:0.375rem;font-weight:700}.s-tiered-offer-tier-name{font-weight:600;--tw-text-opacity:1;color:rgb(17 24 39 / var(--tw-text-opacity, 1))}.s-tiered-offer-progress-container{margin-top:1.5rem;margin-bottom:1rem}.s-tiered-offer-progress-wrapper{position:relative}.s-tiered-offer-progress-bg{position:absolute;top:0.5rem;left:1rem;right:1rem;height:1rem;border-radius:9999px;--tw-bg-opacity:1;background-color:rgb(229 231 235 / var(--tw-bg-opacity, 1))}.s-tiered-offer-progress-fill{position:absolute;top:0.5rem;height:1rem;border-radius:9999px;background-color:var(--color-primary);transition-property:all;transition-duration:500ms;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1)}.s-tiered-offer-milestones-wrapper{display:flex;justify-content:flex-end}.s-tiered-offer-milestones{position:relative;display:flex;height:3rem;width:100%;align-items:center;justify-content:space-between}.s-tiered-offer-single-milestone-justify-end{position:relative;display:flex;height:3rem;width:100%;align-items:center;justify-content:flex-end}.s-tiered-offer-milestone{display:flex;flex-direction:column;align-items:center}.s-tiered-offer-milestone-icon{position:relative;z-index:10;margin-top:0px;display:flex;height:2.25rem;width:2.25rem;align-items:center;justify-content:center;border-radius:0.75rem;border-width:2px;--tw-border-opacity:1;border-color:rgb(243 244 246 / var(--tw-border-opacity, 1));--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1));padding:0.25rem;--tw-text-opacity:1;color:rgb(107 114 128 / var(--tw-text-opacity, 1));--tw-shadow:0 1px 2px 0 rgb(0 0 0 / 0.05);--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);transition-property:all;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:300ms}.s-tiered-offer-milestone-icon span{display:flex;align-items:center;justify-content:center}.s-tiered-offer-milestone-icon svg{height:1.25rem;width:1.25rem;color:currentColor}.s-tiered-offer-milestone-name{margin-top:0.5rem;display:flex;height:1rem;align-items:center;justify-content:center}.s-tiered-offer-milestone-name span{text-align:center;font-size:0.875rem;line-height:1.25rem;font-weight:500}@media (min-width: 640px){.s-tiered-offer-milestone-name span{font-size:0.75rem;line-height:1rem}}.s-tiered-offer-tabs-container{margin-top:1rem}.s-tiered-offer-tab-headers{display:flex;gap:0.25rem;border-radius:0.375rem;border-width:1px;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1));--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1));padding:0.25rem}.s-tiered-offer-tab-header{display:flex;flex:1 1 0%;cursor:pointer;align-items:center;justify-content:center;border-radius:0.125rem;border-style:none;background-color:transparent;padding-top:0.625rem;padding-bottom:0.625rem;padding-left:0.75rem;padding-right:0.75rem;font-size:0.875rem;line-height:1.25rem;font-weight:500;--tw-text-opacity:1;color:rgb(75 85 99 / var(--tw-text-opacity, 1));transition-property:all;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:200ms}@media (min-width: 640px){.s-tiered-offer-tab-header{padding-top:0.5rem;padding-bottom:0.5rem;font-size:0.75rem;line-height:1rem}}.s-tiered-offer-tab-active{border-radius:0.375rem;background-color:var(--color-primary);--tw-text-opacity:1;color:rgb(255 255 255 / var(--tw-text-opacity, 1));--tw-shadow:0 1px 2px 0 rgb(0 0 0 / 0.05);--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}.s-tiered-offer-tab-active:hover{background-color:var(--color-primary-dark);opacity:0.8}.s-tiered-offer-tab-content-wrapper{border-bottom-right-radius:0.375rem;border-bottom-left-radius:0.375rem;border-width:1px;border-top-width:0px;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1));--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.s-tiered-offer-tab-content{padding-left:1.5rem;padding-right:1.5rem}@media (min-width: 640px){.s-tiered-offer-tab-content{padding-left:1rem;padding-right:1rem}}.s-tiered-offer-tab-content.tab-hidden{display:none}.s-tiered-offer-tab-content-inner{padding-top:1rem}.s-tiered-offer-discount-section{margin-bottom:0.5rem}.s-tiered-offer-discount-title{margin:0px;margin-bottom:0.5rem;font-size:1rem;line-height:1.5rem;font-weight:700;--tw-text-opacity:1;color:rgb(17 24 39 / var(--tw-text-opacity, 1))}.s-tiered-offer-benefit-description{margin:0px;font-size:0.875rem;line-height:1.25rem;--tw-text-opacity:1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.s-tiered-offer-skeleton-wrapper{padding:1.25rem}.s-tiered-offer-skeleton-title{margin-bottom:0.75rem}.s-tiered-offer-skeleton-subtitle{margin-bottom:1.5rem}.s-tiered-offer-skeleton-progress{margin-bottom:1.25rem}";export{n as salla_tiered_offer}
4
+ import{r as e,h as t,H as r}from"./p-HRJpfiBN.js";var i;!function(e){e.PERCENTAGE="percentage",e.FIXED="fixed"}(i||(i={}));const o={staticIcons:['<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="40" height="40" color="#000000" fill="none">\n <path d="M13.7276 3.44418L15.4874 6.99288C15.7274 7.48687 16.3673 7.9607 16.9073 8.05143L20.0969 8.58575C22.1367 8.92853 22.6167 10.4206 21.1468 11.8925L18.6671 14.3927C18.2471 14.8161 18.0172 15.6327 18.1471 16.2175L18.8571 19.3125C19.417 21.7623 18.1271 22.71 15.9774 21.4296L12.9877 19.6452C12.4478 19.3226 11.5579 19.3226 11.0079 19.6452L8.01827 21.4296C5.8785 22.71 4.57865 21.7522 5.13859 19.3125L5.84851 16.2175C5.97849 15.6327 5.74852 14.8161 5.32856 14.3927L2.84884 11.8925C1.389 10.4206 1.85895 8.92853 3.89872 8.58575L7.08837 8.05143C7.61831 7.9607 8.25824 7.48687 8.49821 6.99288L10.258 3.44418C11.2179 1.51861 12.7777 1.51861 13.7276 3.44418Z" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path>\n</svg>','<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" color="#000000" fill="none">\n <path d="M3 12C7.5 12 12 7.5 12 3C12 7.5 16.5 12 21 12C16.5 12 12 16.5 12 21C12 16.5 7.5 12 3 12Z" stroke="currentColor" stroke-width="1.5" stroke-linejoin="round"></path>\n <path d="M2 19.5C2.83333 19.5 4.5 17.8333 4.5 17C4.5 17.8333 6.16667 19.5 7 19.5C6.16667 19.5 4.5 21.1667 4.5 22C4.5 21.1667 2.83333 19.5 2 19.5Z" stroke="currentColor" stroke-width="1.5" stroke-linejoin="round"></path>\n <path d="M16 5C17 5 19 3 19 2C19 3 21 5 22 5C21 5 19 7 19 8C19 7 17 5 16 5Z" stroke="currentColor" stroke-width="1.5" stroke-linejoin="round"></path>\n</svg>','<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="40" height="40" color="#000000" fill="none">\n <path d="M14.2644 18.3717C14.5806 17.407 14.7387 16.9247 15.0616 16.593C15.215 16.4354 15.3932 16.3048 15.5887 16.2066C16.0003 16 16.5003 16 17.5002 16C18.5001 16 19.0001 16 19.4116 16.2066C19.6072 16.3048 19.7853 16.4354 19.9388 16.593C20.2617 16.9247 20.4198 17.407 20.736 18.3717L21.0624 19.3675C21.4561 20.5688 21.653 21.1694 21.3587 21.5847C21.0643 22 20.4418 22 19.1966 22H15.8038C14.5586 22 13.936 22 13.6417 21.5847C13.3473 21.1694 13.5442 20.5688 13.938 19.3675L14.2644 18.3717Z" stroke="currentColor" stroke-width="1.5"></path>\n <path d="M8.76421 10.3717C9.08041 9.40705 9.23851 8.92471 9.56143 8.59298C9.71485 8.43537 9.89299 8.3048 10.0885 8.20663C10.5001 8 11.0001 8 12 8C12.9999 8 13.4999 8 13.9115 8.20663C14.107 8.3048 14.2851 8.43537 14.4386 8.59298C14.7615 8.92471 14.9196 9.40705 15.2358 10.3717L15.5622 11.3675C15.956 12.5688 16.1528 13.1694 15.8585 13.5847C15.5642 14 14.9416 14 13.6964 14H10.3036C9.05842 14 8.43585 14 8.1415 13.5847C7.84716 13.1694 8.04404 12.5688 8.43779 11.3675L8.76421 10.3717Z" stroke="currentColor" stroke-width="1.5"></path>\n <path d="M3.26439 18.3717C3.58059 17.407 3.73869 16.9247 4.06162 16.593C4.21504 16.4354 4.39317 16.3048 4.58872 16.2066C5.00031 16 5.50027 16 6.50018 16C7.5001 16 8.00006 16 8.41165 16.2066C8.6072 16.3048 8.78533 16.4354 8.93875 16.593C9.26167 16.9247 9.41977 17.407 9.73597 18.3717L10.0624 19.3675C10.4561 20.5688 10.653 21.1694 10.3587 21.5847C10.0643 22 9.44176 22 8.19661 22H4.80375C3.5586 22 2.93603 22 2.64169 21.5847C2.34735 21.1694 2.54422 20.5688 2.93797 19.3675L3.26439 18.3717Z" stroke="currentColor" stroke-width="1.5"></path>\n <path d="M12 2V4M7.5 3.5L9 5M16.5 3.5L15 5" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"></path>\n</svg>','<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" color="#000000" fill="none">\n <path d="M5.78223 4.18192C6.43007 3.68319 6.754 3.43383 7.12788 3.27323C7.29741 3.20041 7.47367 3.14158 7.65459 3.09741C8.0536 3 8.4767 3 9.32289 3H14.6771C15.5233 3 15.9464 3 16.3454 3.09741C16.5263 3.14158 16.7026 3.20041 16.8721 3.27323C17.246 3.43383 17.5699 3.68319 18.2178 4.18192C20.3644 5.83448 21.4378 6.66077 21.8057 7.73078C21.9694 8.20673 22.0305 8.70728 21.9858 9.20461C21.8852 10.3227 21.0379 11.346 19.3433 13.3925L15.3498 18.2153C13.8126 20.0718 13.044 21 12 21C10.956 21 10.1874 20.0718 8.65018 18.2153L4.65671 13.3925C2.96208 11.346 2.11476 10.3227 2.0142 9.20461C1.96947 8.70728 2.03064 8.20673 2.1943 7.73078C2.56224 6.66077 3.63557 5.83448 5.78223 4.18192Z" stroke="currentColor" stroke-width="1.5"></path>\n <path d="M10 8.5H14" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path>\n</svg>'],staticColors:["#993018","#444444","#D18F36","#315F9C"]};class s{static findTierByIndex(e,t){return e.find((e=>e.index===t))||null}static findTierByName(e,t){return e.find((e=>e.tier_name===t))||null}static getTierNameByIndex(e,t){return this.findTierByIndex(e,t)?.tier_name}static findCurrentTierIndex(e,t){if(!t)return 0;for(let r=t.length-1;r>=0;r--)if(e>=t[r].threshold)return t[r].index;return 0}}const n=class{constructor(t){e(this,t),this.currentTierIndex=0,this.canRender=!1,this.isLoading=!1,this.handleTabClick=e=>{this.activeTabTier=e},salla.lang.onLoaded((()=>{this.loyaltyProgramText=salla.lang.get("blocks.tiered_offer.program_title"),this.currentTierText=salla.lang.get("blocks.tiered_offer.current_tier"),this.discountText=salla.lang.get("blocks.tiered_offer.discount"),this.benefitText=salla.lang.get("blocks.tiered_offer.tier_description")}))}async componentWillLoad(){try{if(await salla.onReady(),!this.checkFeatureEnabled())return;if(!this.checkCartExists())return;this.isLoading=!0;const e=await this.fetchTieredOfferData();if(!e)return;this.initializeComponent(e)}catch(e){this.canRender=!1,salla.logger.warn("salla-tiered-offer:: ",e)}finally{this.isLoading=!1}}checkFeatureEnabled(){return salla.config.get("store.features")?.includes("tiered-offer")}checkCartExists(){return!!salla.storage.get("cart")?.summary?.count}validateCouponCompatibility(e,t){return!(t&&!e.details?.applied_with_coupon)}shouldHideForGuest(){return salla.config.isGuest()}shouldHideUntilThreshold(e,t){return!(!e?.hide_until_threshold||0!==t)}resolveTierName(e,t){return s.getTierNameByIndex(e,t)||""}async fetchTieredOfferData(){try{const{data:e}=await salla.api.cart.offers(),t=e.find((e=>"tiered_offer"===e.type));return t?this.validateCouponCompatibility(t,salla.storage.get("cart")?.coupon)?t:(this.canRender=!1,null):null}catch(e){throw e}}initializeComponent(e){this.apiOfferData=e,this.tieredOfferData=this.mapApiDataToTiers(this.apiOfferData),this.loyaltyProgramText=this.apiOfferData.title||this.loyaltyProgramText;const t=this.findCurrentTierIndex(this.apiOfferData.details?.current_value||0);this.shouldHideForGuest()||this.shouldHideUntilThreshold(this.apiOfferData.details,t)?this.canRender=!1:(this.currentTierIndex=t,this.currentTier=this.resolveTierName(this.tieredOfferData.tiers,t),this.activeTabTier=this.currentTier||this.tieredOfferData.tiers[0]?.tier_name,this.canRender=!0)}componentDidLoad(){salla.event.on("cart::updated",(async e=>{let t=null;try{t=await this.fetchTieredOfferData()}catch(e){return void salla.logger.warn("salla-tiered-offer:: ",e)}t&&(this.tieredOfferData?this.updateOfferValues(e,t):this.initializeComponent(t))}))}mapApiDataToTiers(e){const t=[...e.details.discounts].sort(((e,t)=>e.min_spend-t.min_spend)).map(((e,t)=>({name:e.name,tier_name:e.name,discount:e.type===i.PERCENTAGE?`${salla.helpers.number(e.value)}%`:salla.money(e.value),icon:o.staticIcons[t]||o.staticIcons[0],threshold:e.min_spend,text_color:o.staticColors[t],index:t+1})));return{current_tier:s.getTierNameByIndex(t,this.findCurrentTierIndex(e.details.current_value,t)),tiers:t}}findCurrentTierIndex(e,t=this.tieredOfferData?.tiers){return s.findCurrentTierIndex(e,t||[])}updateOfferValues(e,t){if(!t||!this.tieredOfferData)return;if(!t.details?.discounts?.length)return void(this.canRender=!1);if(!this.validateCouponCompatibility(t,e.coupon))return void(this.canRender=!1);if(this.shouldHideForGuest())return void(this.canRender=!1);const r=this.mapApiDataToTiers(t),i=this.findCurrentTierIndex(t.details?.current_value||0,r.tiers);if(this.shouldHideUntilThreshold(t.details,i))return void(this.canRender=!1);if(!1===t.details?.with_current_cart)return void(this.canRender=!0);this.apiOfferData=t,this.tieredOfferData=r,this.canRender=!0,this.currentTierIndex=i,this.currentTier=this.resolveTierName(r.tiers,i);const o=this.currentTier||r.tiers[0]?.tier_name;this.activeTabTier!==o&&(this.activeTabTier=o)}getLoadingSkeletonView(){return t(r,null,t("div",{class:"s-tiered-offer-container"},t("div",{class:"s-tiered-offer-skeleton-wrapper"},t("div",{class:"s-tiered-offer-skeleton-title"},t("salla-skeleton",{height:"16px",width:"40%"})),t("div",{class:"s-tiered-offer-skeleton-subtitle"},t("salla-skeleton",{height:"20px",width:"60%"})),t("div",{class:"s-tiered-offer-skeleton-progress"},t("salla-skeleton",{height:"16px",width:"100%"})),t("div",{class:"s-tiered-offer-skeleton-tabs"},t("salla-skeleton",{height:"50px",width:"100%"})))))}getCurrentTierData(){return s.findTierByIndex(this.tieredOfferData.tiers,this.currentTierIndex)||this.tieredOfferData.tiers[0]}getProgressWidth(){const e=this.tieredOfferData.tiers.length;return this.findCurrentTierIndex(this.apiOfferData.details?.current_value||0)/e*100}calculateMilestonePosition(e,t){return 1===t?"calc(100% - 18px)":`${Math.max(2,Math.min(95,(e+1)/t*100-8/t))}%`}getMilestoneStyles(e,t,r){const i="rtl"===document.documentElement.dir,o=this.calculateMilestonePosition(t,r),s=e.name.length>6?"flex-end":"center";return{[i?"right":"left"]:o,alignItems:s,position:"absolute",transform:i?"translateX(50%)":"translateX(-50%)"}}getMilestoneIconStyles(e,t,r){return t?{color:e.text_color}:r?{color:"var(--color-primary)"}:{}}renderProgressBarBackground(e){return[t("div",{class:"s-tiered-offer-progress-bg"}),t("div",{class:"s-tiered-offer-progress-fill",style:{width:`${e}%`}})]}renderMilestoneIcon(e,r,i){const o=["s-tiered-offer-milestone-icon",r?"s-tiered-offer-milestone-active":"",i?"s-tiered-offer-milestone-completed":""].filter(Boolean).join(" ");return t("div",{class:o,style:this.getMilestoneIconStyles(e,r,i)},t("span",{innerHTML:e.icon}))}renderMilestoneName(e,r){return t("div",{class:"s-tiered-offer-milestone-name"},r&&t("span",{style:{color:e.text_color}},e.name))}renderMilestones(e,r){return t("div",{class:"s-tiered-offer-milestones-wrapper"},t("div",{class:1===r?"s-tiered-offer-single-milestone-justify-end":"s-tiered-offer-milestones"},this.tieredOfferData.tiers.map(((i,o)=>{const s=e>=i.threshold,n=i.tier_name===this.currentTier;return t("div",{class:"s-tiered-offer-milestone",style:this.getMilestoneStyles(i,o,r)},this.renderMilestoneIcon(i,n,s),this.renderMilestoneName(i,n))}))))}renderProgressBar(){const e=this.getProgressWidth(),r=this.tieredOfferData.tiers.length,i=this.apiOfferData.details?.current_value||0;return t("div",{class:"s-tiered-offer-progress-container"},t("div",{class:"s-tiered-offer-progress-wrapper"},this.renderProgressBarBackground(e),this.renderMilestones(i,r)))}renderTabs(){return t("div",{class:"s-tiered-offer-tabs-container"},t("div",{class:"s-tiered-offer-tab-headers"},this.tieredOfferData.tiers.map((e=>t("button",{class:"s-tiered-offer-tab-header "+(e.tier_name===this.activeTabTier?"s-tiered-offer-tab-active":""),onClick:()=>this.handleTabClick(e.tier_name)},t("span",null,e.name))))),t("div",{class:"s-tiered-offer-tab-content-wrapper"},(()=>{const e=s.findTierByName(this.tieredOfferData.tiers,this.activeTabTier);return e?t("div",{class:"s-tiered-offer-tab-content"},t("div",{class:"s-tiered-offer-tab-content-inner"},t("div",{class:"s-tiered-offer-discount-section"},t("p",{class:"s-tiered-offer-discount-title"},this.discountText," ",t("span",{innerHTML:e.discount})),t("p",{class:"s-tiered-offer-benefit-description"},this.benefitText," ",e.name)))):null})()))}render(){if(this.isLoading)return this.getLoadingSkeletonView();if(!this.canRender||!this.tieredOfferData)return null;const e=this.getCurrentTierData();return t(r,null,t("div",{class:"s-tiered-offer-container"},t("div",{class:"s-tiered-offer-header"},t("div",{class:"s-tiered-offer-header-content"},t("p",{class:"s-tiered-offer-program-title"},this.loyaltyProgramText),this.currentTier&&t("div",{class:"s-tiered-offer-current-tier-name-wrapper"},t("h2",{class:"s-tiered-offer-current-tier"},this.currentTierText," ",t("span",{class:"s-tiered-offer-tier-name"},e.name)),t("span",{innerHTML:e.icon})))),this.renderProgressBar(),this.renderTabs()))}};n.style="/*!twlt*/.s-tiered-offer-milestone-icon svg{color:currentColor}.s-tiered-offer-milestone-icon svg path{stroke:currentColor;fill:none}.s-tiered-offer-milestone-icon.s-tiered-offer-milestone-active svg path,.s-tiered-offer-milestone-icon.s-tiered-offer-milestone-completed svg path{fill:currentColor;stroke:none}.s-tiered-offer-milestone-icon.s-tiered-offer-milestone-active svg[fill=none] path,.s-tiered-offer-milestone-icon.s-tiered-offer-milestone-completed svg[fill=none] path{fill:none;stroke:currentColor}[dir=rtl] .s-tiered-offer-progress-wrapper .s-tiered-offer-progress-bg{transform:scaleX(-1)}[dir=rtl] .s-tiered-offer-progress-wrapper .s-tiered-offer-progress-fill{transform:scaleX(-1);left:auto}[dir=rtl] .flip-x{transform:scaleX(-1)}.visible{visibility:visible}.static{position:static}.fixed{position:fixed}.absolute{position:absolute}.hidden{display:none}.transform{transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.s-tiered-offer-container{position:relative;margin-bottom:1.25rem;width:100%;border-radius:0.5rem;--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1));padding:1rem;--tw-shadow:0 1px 2px 0 rgb(0 0 0 / 0.05);--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}@media (min-width: 640px){.s-tiered-offer-container{padding:1.25rem;padding-left:1.5rem;padding-right:1.5rem}}.s-tiered-offer-header{margin-bottom:1.5rem;display:flex;align-items:center;gap:0.75rem}.s-tiered-offer-header-content{flex:1 1 0%}.s-tiered-offer-current-tier-name-wrapper{display:flex;flex-direction:row;align-items:flex-start;gap:0.375rem}.s-tiered-offer-current-tier-name-wrapper h2{font-size:1.125rem;line-height:1.75rem}.s-tiered-offer-current-tier-name-wrapper svg{height:1.5rem;width:1.5rem}.s-tiered-offer-program-title{margin:0px;margin-bottom:0.5rem;--tw-text-opacity:1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.s-tiered-offer-program-title h2{font-size:1.125rem;line-height:1.75rem}.s-tiered-offer-current-tier{margin:0px;margin-bottom:0.375rem;font-weight:700}.s-tiered-offer-tier-name{font-weight:600;--tw-text-opacity:1;color:rgb(17 24 39 / var(--tw-text-opacity, 1))}.s-tiered-offer-progress-container{margin-top:1.5rem;margin-bottom:1rem}.s-tiered-offer-progress-wrapper{position:relative}.s-tiered-offer-progress-bg{position:absolute;top:0.5rem;left:1rem;right:1rem;height:1rem;border-radius:9999px;--tw-bg-opacity:1;background-color:rgb(229 231 235 / var(--tw-bg-opacity, 1))}.s-tiered-offer-progress-fill{position:absolute;top:0.5rem;height:1rem;border-radius:9999px;background-color:var(--color-primary);transition-property:all;transition-duration:500ms;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1)}.s-tiered-offer-milestones-wrapper{display:flex;justify-content:flex-end}.s-tiered-offer-milestones{position:relative;display:flex;height:3rem;width:100%;align-items:center;justify-content:space-between}.s-tiered-offer-single-milestone-justify-end{position:relative;display:flex;height:3rem;width:100%;align-items:center;justify-content:flex-end}.s-tiered-offer-milestone{display:flex;flex-direction:column;align-items:center}.s-tiered-offer-milestone-icon{position:relative;z-index:10;margin-top:0px;display:flex;height:2.25rem;width:2.25rem;align-items:center;justify-content:center;border-radius:0.75rem;border-width:2px;--tw-border-opacity:1;border-color:rgb(243 244 246 / var(--tw-border-opacity, 1));--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1));padding:0.25rem;--tw-text-opacity:1;color:rgb(107 114 128 / var(--tw-text-opacity, 1));--tw-shadow:0 1px 2px 0 rgb(0 0 0 / 0.05);--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);transition-property:all;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:300ms}.s-tiered-offer-milestone-icon span{display:flex;align-items:center;justify-content:center}.s-tiered-offer-milestone-icon svg{height:1.25rem;width:1.25rem;color:currentColor}.s-tiered-offer-milestone-name{margin-top:0.5rem;display:flex;height:1rem;align-items:center;justify-content:center}.s-tiered-offer-milestone-name span{text-align:center;font-size:0.875rem;line-height:1.25rem;font-weight:500}@media (min-width: 640px){.s-tiered-offer-milestone-name span{font-size:0.75rem;line-height:1rem}}.s-tiered-offer-tabs-container{margin-top:1rem}.s-tiered-offer-tab-headers{display:flex;gap:0.25rem;border-radius:0.375rem;border-width:1px;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1));--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1));padding:0.25rem}.s-tiered-offer-tab-header{display:flex;flex:1 1 0%;cursor:pointer;align-items:center;justify-content:center;border-radius:0.125rem;border-style:none;background-color:transparent;padding-top:0.625rem;padding-bottom:0.625rem;padding-left:0.75rem;padding-right:0.75rem;font-size:0.875rem;line-height:1.25rem;font-weight:500;--tw-text-opacity:1;color:rgb(75 85 99 / var(--tw-text-opacity, 1));transition-property:all;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:200ms}@media (min-width: 640px){.s-tiered-offer-tab-header{padding-top:0.5rem;padding-bottom:0.5rem;font-size:0.75rem;line-height:1rem}}.s-tiered-offer-tab-active{border-radius:0.375rem;background-color:var(--color-primary);--tw-text-opacity:1;color:rgb(255 255 255 / var(--tw-text-opacity, 1));--tw-shadow:0 1px 2px 0 rgb(0 0 0 / 0.05);--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}.s-tiered-offer-tab-active:hover{background-color:var(--color-primary-dark);opacity:0.8}.s-tiered-offer-tab-content-wrapper{border-bottom-right-radius:0.375rem;border-bottom-left-radius:0.375rem;border-width:1px;border-top-width:0px;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1));--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.s-tiered-offer-tab-content{padding-left:1.5rem;padding-right:1.5rem}@media (min-width: 640px){.s-tiered-offer-tab-content{padding-left:1rem;padding-right:1rem}}.s-tiered-offer-tab-content.tab-hidden{display:none}.s-tiered-offer-tab-content-inner{padding-top:1rem}.s-tiered-offer-discount-section{margin-bottom:0.5rem}.s-tiered-offer-discount-title{margin:0px;margin-bottom:0.5rem;font-size:1rem;line-height:1.5rem;font-weight:700;--tw-text-opacity:1;color:rgb(17 24 39 / var(--tw-text-opacity, 1))}.s-tiered-offer-benefit-description{margin:0px;font-size:0.875rem;line-height:1.25rem;--tw-text-opacity:1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.s-tiered-offer-skeleton-wrapper{padding:1.25rem}.s-tiered-offer-skeleton-title{margin-bottom:0.75rem}.s-tiered-offer-skeleton-subtitle{margin-bottom:1.5rem}.s-tiered-offer-skeleton-progress{margin-bottom:1.25rem}";export{n as salla_tiered_offer}
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r as t,h as e,c as r,a}from"./p-Bxge4xib.js";const s=class{constructor(e){t(this,e),this.isSelected=!1}async getChild(){return{selected:this.selected.bind(this),unselect:this.unselect.bind(this),name:this.name}}unselect(){this.isSelected=!1}selected(){this.isSelected=!0}render(){return e("div",{key:"3107faffd358504438b464be5000682d403e1b22",class:{"s-tabs-content":!0,"s-tabs-content-selected":this.isSelected}},e("slot",{key:"e6fc9e480389b54f9e6e20a7c8ccdb880a4ee6d4"}))}};s.style="";const o=class{constructor(e){t(this,e),this.tabSelected=r(this,"tabSelected"),this.id=Math.random().toString(36).slice(2,10),this.activeClass=void 0,this.height=void 0,this.centered=!1,this.isSelected=!1}async getChild(){return{selected:this.selected.bind(this),unselect:this.unselect.bind(this),name:this.name,id:this.id}}unselect(){this.isSelected=!1}selected(){this.isSelected=!0}onClick(){this.getChild().then((t=>{this.tabSelected.emit(t)}))}render(){return[e("div",{key:"04bb51760a3e43aed1645cf724b90e21ee2631bf",class:{"s-tabs-header-item":!0,"s-tabs-bg-normal":!0,"s-tabs-active":this.isSelected},onClick:this.onClick.bind(this)},e("slot",{key:"c9d5fc5dbc0a45712c9aa5e03becc613590011ea"}))]}};o.style="";const i=class{constructor(e){t(this,e),this.backgroundColor=void 0,this.vertical=!1}componentWillLoad(){this.createGroup().then((()=>{const[t]=this.tabGroup;this.selectGroup(t)}))}onSelectedTab(t){const e=this.tabGroup.find((e=>e.header.id===t.detail.id));this.selectGroup(e)}async createGroup(){const t=Array.from(this.host.querySelectorAll("salla-tab-header"));this.tabsHeader=await Promise.all(t.map((async t=>await t.getChild())));const e=Array.from(this.host.querySelectorAll("salla-tab-content"));this.tabsContent=await Promise.all(e.map((async t=>await t.getChild()))),this.tabGroup=this.tabsHeader.map((t=>{const e=this.tabsContent.find((e=>e.name===t.name));return{header:t,content:e}}))}selectGroup(t){this.tabGroup.map((t=>{t.header.unselect(),t.content.unselect()})),t.header.selected(),t.content.selected()}render(){return[e("div",{key:"de6455b0d68cb3e174771ad7be1bc95141d61df1",class:"s-tabs"},e("div",{key:"57c21f00a709723fa0be789f388b3defb391bcb2",class:"s-tabs-header"},e("slot",{key:"b5107fab289f9d7c661ddd7c4cfea4795eb7bb19",name:"header"})),e("div",{key:"344d142adc8f6adbc70baf4009e2d594fdbaea06",class:"s-tabs-content-wrapper"},e("slot",{key:"acd41f2ebb7120a2c043d17740e5fd4d2db95276",name:"content"})))]}get host(){return a(this)}};i.style='/*!twlt*/.s-tabs-header{-ms-overflow-style:none;scrollbar-width:none;}.s-tabs-header::-webkit-scrollbar{display:none}.flex{display:flex}.shadow{--tw-shadow:0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}.s-loyalty-program-rewards-container .s-tabs-content-wrapper{padding:0px}@media (min-width: 768px){.s-loyalty-program-rewards-container .s-tabs-content-wrapper{padding-top:1rem}}.s-loyalty-program-rewards-container .s-tabs-header{display:flex;align-items:center;justify-content:space-between;border-style:none}.s-loyalty-program-rewards-container .s-tabs-header div{order:1}.s-loyalty-program-rewards-container .s-tabs-header-item{position:relative;margin:0px;display:flex;width:max-content;align-items:center;justify-content:center;gap:0.5rem;border-radius:0.5rem;background-color:transparent;padding-top:0.5rem;padding-bottom:0.5rem;padding-left:1rem;padding-right:1rem;font-size:0.875rem;line-height:1.25rem;--tw-text-opacity:1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.s-loyalty-program-rewards-container .s-tabs-bg-normal{background-color:transparent;--tw-text-opacity:1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.s-loyalty-program-rewards-container-cart .s-tabs-bg-normal{background-color:transparent;--tw-text-opacity:1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.s-loyalty-program-rewards-container-cart .s-tabs-header-item{display:flex;width:max-content;align-items:center;justify-content:center;gap:0.5rem;padding-top:0.5rem;padding-bottom:0.5rem;padding-left:1rem;padding-right:1rem;font-size:0.875rem;line-height:1.25rem}.s-loyalty-program-rewards-container-cart .s-tabs-content-wrapper{padding:0px}.s-loyalty-program-rewards-container-cart .s-tabs-header{overflow-x:auto;border-bottom-width:1px;border-color:var(--color-primary-light);padding-left:1.25rem;padding-right:1.25rem}@media (min-width: 640px){.s-loyalty-program-rewards-container-cart .s-tabs-header{margin-left:1.25rem;margin-right:1.25rem;padding-left:0px;padding-right:0px}}.s-loyalty-program-rewards-container .s-tabs-active{background-color:var(--color-primary-light);--tw-text-opacity:1;color:rgb(17 24 39 / var(--tw-text-opacity, 1))}.s-loyalty-program-rewards-container-cart .s-tabs-active{background-color:var(--color-primary-light);--tw-text-opacity:1;color:rgb(17 24 39 / var(--tw-text-opacity, 1))}.s-loyalty-program-reward-details .s-tabs-header{margin-top:0.5rem;margin-bottom:0.5rem;margin-left:1rem;margin-right:1rem;display:flex}.s-loyalty-program-reward-details .s-tabs-header>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-right:calc(0.5rem * var(--tw-space-x-reverse));margin-left:calc(0.5rem * calc(1 - var(--tw-space-x-reverse)))}.s-loyalty-program-reward-details .s-tabs-header{border-style:none}@media (min-width: 768px){.s-loyalty-program-reward-details .s-tabs-header{margin-left:3rem;margin-right:3rem}}.s-loyalty-program-reward-details .s-tabs-header:where([dir="rtl"],[dir="rtl"] *)>:not([hidden])~:not([hidden]){--tw-space-x-reverse:1}.s-loyalty-program-reward-details .s-tabs-header-item{display:flex;width:max-content;align-items:center}.s-loyalty-program-reward-details .s-tabs-header-item>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-right:calc(0.5rem * var(--tw-space-x-reverse));margin-left:calc(0.5rem * calc(1 - var(--tw-space-x-reverse)))}.s-loyalty-program-reward-details .s-tabs-header-item{border-radius:9999px;padding-top:0.25rem;padding-bottom:0.25rem;padding-left:1rem;padding-right:1rem}.s-loyalty-program-reward-details .s-tabs-header-item:where([dir="rtl"],[dir="rtl"] *)>:not([hidden])~:not([hidden]){--tw-space-x-reverse:1}.s-loyalty-program-reward-details .s-tabs-bg-normal{background-color:transparent;--tw-text-opacity:1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.s-loyalty-program-reward-details .s-tabs-active{background-color:var(--color-primary-light);font-weight:700;--tw-text-opacity:1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.s-loyalty-program-reward-details .s-tabs-header-item span{font-size:0.75rem;line-height:1rem;--tw-text-opacity:1;color:rgb(31 41 55 / var(--tw-text-opacity, 1))}.s-loyalty-program-tabs-hider .s-tabs-header{border-style:none}.s-product-size-guide-wrapper .s-tabs-content{max-height:60vh;overflow:auto}@media (min-width: 768px){.s-product-size-guide-wrapper .s-tabs-content{max-height:70vh}}.s-tabs-bg-normal{--tw-bg-opacity:1;background-color:rgb(249 250 251 / var(--tw-bg-opacity, 1))}.s-tabs-header{display:flex;cursor:pointer;align-content:center;justify-content:flex-start}.s-tabs-header>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-right:calc(0.25rem * var(--tw-space-x-reverse));margin-left:calc(0.25rem * calc(1 - var(--tw-space-x-reverse)))}.s-tabs-header{overflow-x:auto;border-bottom-width:2px;border-color:var(--color-primary)}@media (min-width: 768px){.s-tabs-header{overflow-x:hidden}}.s-tabs-header:where([dir="rtl"],[dir="rtl"] *)>:not([hidden])~:not([hidden]){--tw-space-x-reverse:1}.s-tabs-header *{pointer-events:auto !important}.s-tabs-header-item{border-top-left-radius:0.5rem;border-top-right-radius:0.5rem;--tw-bg-opacity:1;background-color:rgb(229 231 235 / var(--tw-bg-opacity, 1));padding-top:0.5rem;padding-bottom:0.5rem;padding-left:0.75rem;padding-right:0.75rem;font-size:0.875rem;line-height:1.25rem}@media (min-width: 768px){.s-tabs-header-item{padding-left:1.75rem;padding-right:1.75rem}}.s-tabs-content{display:none}.s-tabs-content-wrapper{padding-top:0.75rem}.s-tabs-content-selected{display:block}.s-tabs-active{background-color:var(--color-primary);--tw-text-opacity:1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}';export{s as salla_tab_content,o as salla_tab_header,i as salla_tabs}
4
+ import{r as t,h as e,c as r,a}from"./p-HRJpfiBN.js";const s=class{constructor(e){t(this,e),this.isSelected=!1}async getChild(){return{selected:this.selected.bind(this),unselect:this.unselect.bind(this),name:this.name}}unselect(){this.isSelected=!1}selected(){this.isSelected=!0}render(){return e("div",{key:"3107faffd358504438b464be5000682d403e1b22",class:{"s-tabs-content":!0,"s-tabs-content-selected":this.isSelected}},e("slot",{key:"e6fc9e480389b54f9e6e20a7c8ccdb880a4ee6d4"}))}};s.style="";const o=class{constructor(e){t(this,e),this.tabSelected=r(this,"tabSelected"),this.id=Math.random().toString(36).slice(2,10),this.activeClass=void 0,this.height=void 0,this.centered=!1,this.isSelected=!1}async getChild(){return{selected:this.selected.bind(this),unselect:this.unselect.bind(this),name:this.name,id:this.id}}unselect(){this.isSelected=!1}selected(){this.isSelected=!0}onClick(){this.getChild().then((t=>{this.tabSelected.emit(t)}))}render(){return[e("div",{key:"04bb51760a3e43aed1645cf724b90e21ee2631bf",class:{"s-tabs-header-item":!0,"s-tabs-bg-normal":!0,"s-tabs-active":this.isSelected},onClick:this.onClick.bind(this)},e("slot",{key:"c9d5fc5dbc0a45712c9aa5e03becc613590011ea"}))]}};o.style="";const i=class{constructor(e){t(this,e),this.backgroundColor=void 0,this.vertical=!1}componentWillLoad(){this.createGroup().then((()=>{const[t]=this.tabGroup;this.selectGroup(t)}))}onSelectedTab(t){const e=this.tabGroup.find((e=>e.header.id===t.detail.id));this.selectGroup(e)}async createGroup(){const t=Array.from(this.host.querySelectorAll("salla-tab-header"));this.tabsHeader=await Promise.all(t.map((async t=>await t.getChild())));const e=Array.from(this.host.querySelectorAll("salla-tab-content"));this.tabsContent=await Promise.all(e.map((async t=>await t.getChild()))),this.tabGroup=this.tabsHeader.map((t=>{const e=this.tabsContent.find((e=>e.name===t.name));return{header:t,content:e}}))}selectGroup(t){this.tabGroup.map((t=>{t.header.unselect(),t.content.unselect()})),t.header.selected(),t.content.selected()}render(){return[e("div",{key:"de6455b0d68cb3e174771ad7be1bc95141d61df1",class:"s-tabs"},e("div",{key:"57c21f00a709723fa0be789f388b3defb391bcb2",class:"s-tabs-header"},e("slot",{key:"b5107fab289f9d7c661ddd7c4cfea4795eb7bb19",name:"header"})),e("div",{key:"344d142adc8f6adbc70baf4009e2d594fdbaea06",class:"s-tabs-content-wrapper"},e("slot",{key:"acd41f2ebb7120a2c043d17740e5fd4d2db95276",name:"content"})))]}get host(){return a(this)}};i.style='/*!twlt*/.s-tabs-header{-ms-overflow-style:none;scrollbar-width:none;}.s-tabs-header::-webkit-scrollbar{display:none}.flex{display:flex}.shadow{--tw-shadow:0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}.s-loyalty-program-rewards-container .s-tabs-content-wrapper{padding:0px}@media (min-width: 768px){.s-loyalty-program-rewards-container .s-tabs-content-wrapper{padding-top:1rem}}.s-loyalty-program-rewards-container .s-tabs-header{display:flex;align-items:center;justify-content:space-between;border-style:none}.s-loyalty-program-rewards-container .s-tabs-header div{order:1}.s-loyalty-program-rewards-container .s-tabs-header-item{position:relative;margin:0px;display:flex;width:max-content;align-items:center;justify-content:center;gap:0.5rem;border-radius:0.5rem;background-color:transparent;padding-top:0.5rem;padding-bottom:0.5rem;padding-left:1rem;padding-right:1rem;font-size:0.875rem;line-height:1.25rem;--tw-text-opacity:1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.s-loyalty-program-rewards-container .s-tabs-bg-normal{background-color:transparent;--tw-text-opacity:1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.s-loyalty-program-rewards-container-cart .s-tabs-bg-normal{background-color:transparent;--tw-text-opacity:1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.s-loyalty-program-rewards-container-cart .s-tabs-header-item{display:flex;width:max-content;align-items:center;justify-content:center;gap:0.5rem;padding-top:0.5rem;padding-bottom:0.5rem;padding-left:1rem;padding-right:1rem;font-size:0.875rem;line-height:1.25rem}.s-loyalty-program-rewards-container-cart .s-tabs-content-wrapper{padding:0px}.s-loyalty-program-rewards-container-cart .s-tabs-header{overflow-x:auto;border-bottom-width:1px;border-color:var(--color-primary-light);padding-left:1.25rem;padding-right:1.25rem}@media (min-width: 640px){.s-loyalty-program-rewards-container-cart .s-tabs-header{margin-left:1.25rem;margin-right:1.25rem;padding-left:0px;padding-right:0px}}.s-loyalty-program-rewards-container .s-tabs-active{background-color:var(--color-primary-light);--tw-text-opacity:1;color:rgb(17 24 39 / var(--tw-text-opacity, 1))}.s-loyalty-program-rewards-container-cart .s-tabs-active{background-color:var(--color-primary-light);--tw-text-opacity:1;color:rgb(17 24 39 / var(--tw-text-opacity, 1))}.s-loyalty-program-reward-details .s-tabs-header{margin-top:0.5rem;margin-bottom:0.5rem;margin-left:1rem;margin-right:1rem;display:flex}.s-loyalty-program-reward-details .s-tabs-header>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-right:calc(0.5rem * var(--tw-space-x-reverse));margin-left:calc(0.5rem * calc(1 - var(--tw-space-x-reverse)))}.s-loyalty-program-reward-details .s-tabs-header{border-style:none}@media (min-width: 768px){.s-loyalty-program-reward-details .s-tabs-header{margin-left:3rem;margin-right:3rem}}.s-loyalty-program-reward-details .s-tabs-header:where([dir="rtl"],[dir="rtl"] *)>:not([hidden])~:not([hidden]){--tw-space-x-reverse:1}.s-loyalty-program-reward-details .s-tabs-header-item{display:flex;width:max-content;align-items:center}.s-loyalty-program-reward-details .s-tabs-header-item>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-right:calc(0.5rem * var(--tw-space-x-reverse));margin-left:calc(0.5rem * calc(1 - var(--tw-space-x-reverse)))}.s-loyalty-program-reward-details .s-tabs-header-item{border-radius:9999px;padding-top:0.25rem;padding-bottom:0.25rem;padding-left:1rem;padding-right:1rem}.s-loyalty-program-reward-details .s-tabs-header-item:where([dir="rtl"],[dir="rtl"] *)>:not([hidden])~:not([hidden]){--tw-space-x-reverse:1}.s-loyalty-program-reward-details .s-tabs-bg-normal{background-color:transparent;--tw-text-opacity:1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.s-loyalty-program-reward-details .s-tabs-active{background-color:var(--color-primary-light);font-weight:700;--tw-text-opacity:1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.s-loyalty-program-reward-details .s-tabs-header-item span{font-size:0.75rem;line-height:1rem;--tw-text-opacity:1;color:rgb(31 41 55 / var(--tw-text-opacity, 1))}.s-loyalty-program-tabs-hider .s-tabs-header{border-style:none}.s-product-size-guide-wrapper .s-tabs-content{max-height:60vh;overflow:auto}@media (min-width: 768px){.s-product-size-guide-wrapper .s-tabs-content{max-height:70vh}}.s-tabs-bg-normal{--tw-bg-opacity:1;background-color:rgb(249 250 251 / var(--tw-bg-opacity, 1))}.s-tabs-header{display:flex;cursor:pointer;align-content:center;justify-content:flex-start}.s-tabs-header>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-right:calc(0.25rem * var(--tw-space-x-reverse));margin-left:calc(0.25rem * calc(1 - var(--tw-space-x-reverse)))}.s-tabs-header{overflow-x:auto;border-bottom-width:2px;border-color:var(--color-primary)}@media (min-width: 768px){.s-tabs-header{overflow-x:hidden}}.s-tabs-header:where([dir="rtl"],[dir="rtl"] *)>:not([hidden])~:not([hidden]){--tw-space-x-reverse:1}.s-tabs-header *{pointer-events:auto !important}.s-tabs-header-item{border-top-left-radius:0.5rem;border-top-right-radius:0.5rem;--tw-bg-opacity:1;background-color:rgb(229 231 235 / var(--tw-bg-opacity, 1));padding-top:0.5rem;padding-bottom:0.5rem;padding-left:0.75rem;padding-right:0.75rem;font-size:0.875rem;line-height:1.25rem}@media (min-width: 768px){.s-tabs-header-item{padding-left:1.75rem;padding-right:1.75rem}}.s-tabs-content{display:none}.s-tabs-content-wrapper{padding-top:0.75rem}.s-tabs-content-selected{display:block}.s-tabs-active{background-color:var(--color-primary);--tw-text-opacity:1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}';export{s as salla_tab_content,o as salla_tab_header,i as salla_tabs}
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r as t,h as a,F as s,a as e}from"./p-Bxge4xib.js";const i=class{constructor(a){t(this,a),this.isMobileAllowed=!0,this.isEmailRequired=!1,this.supportWebAuth=!0,this.withoutReload=!1,this.source="",this.htmlElement=document.documentElement,this.messages=[],this.isClosable=!0,this.iframeLoaded=!1,this.scrolling="no",this.direction=document.dir,this.canRenderIframe=!1,salla.event.on("login::open",(t=>this.onLoginOpen(t))),salla.event.on("modal::close",(t=>{this.iframe&&this.sendMessageToIframe({source:"login",type:"modal_closed",data:t})})),salla.onReady((()=>{this.api=salla.config.get("store.api"),this.storeId=salla.config.get("store.id")}))}onLoginOpen(t){salla.mobile?.isNativeLoginEnabled?.()||(this.isEmailAllowed||this.isMobileAllowed?(this.source=t?.source??!1,this.withoutReload=t?.withoutReload??this.withoutReload,this.open(t),this.openModal()):salla.logger.warn("Please enable atleast one login type to use this component."))}componentDidLoad(){window.addEventListener("message",(t=>{if(!this.isTrustedMessage(t)||"login"!=t.data?.source)return;if(!this.inline&&!this.canRenderIframe)return;salla.log("salla-account:: recived an event",t.data);let a=t.data?.type?.replace("iframe::",""),s=t.data.message;if("ready"==a)return s.isPasskeyPage?void this.createPassKey.postMessage({source:"login",type:"init_passkey_page",data:{token:salla.storage.get("token"),store_id:salla.config.get("store.id"),locale:salla.config.get("user.language_code"),redirect:salla.config.get("store.url")}},salla.config.get("login.url")):void this.handleIframeReadyAction();if("height"==a)return this.iframe.height=s?.height+"px";if("storage"==a)return this.handleIframeStorageAction(s);if("scrolling"==a)return this.scrolling=s,void(this.isClosable=!1);if("direction"==a)return document.dir=this.direction=s?"rtl":"ltr";if("notify"==a)return salla.notify[s.type](s.message);if("authenticated"==a||"authenticated_web_auth"==a)return!s?.withoutClose&&this.close(),salla.auth.api.handlAfterAuthenticatedResponse(s,this.supportWebAuth).then((()=>!(s?.withoutReload||this.withoutReload)&&setTimeout((()=>window.location.reload()),1e3)));if("dispatchEvent"!=a||"auth::verified"!=s.event){if("dispatchEvent"==a)return salla.event.emit(s.event,...s.payload);if("reload"==a)return s?.withClose&&this.modal.close(),window.location.reload();if("open_page"===a){if(!this.isSafeUrl(s?.url))return;return window.location.href=s.url}if("open_passkey_page"!==a)return"guest-checkout"===a?this.handleGuestCheckout():void("close"==a&&this.close());this.createPassKey=window.open(`${salla.config.get("login.url")}/create-passkey`)}else salla.log("Ignored dispatchEvent `auth::verified` from iframe")})),this.observeDarkModeChanges(),setTimeout((()=>Salla.event.emit("salla-login::ready")),1)}async open(t=null){return Salla.config.isGuest()?this.modal.open():this.withoutReload?void 0:location.reload()}close(){Salla.event.emit("salla-login::closing"),this.modal.close(),this.iframeLoaded=!1,this.canRenderIframe=!1,this.host.dispatchEvent(new CustomEvent("salla-login:closed",{cancelable:!0,bubbles:!0,detail:null})),Salla.event.emit("salla-login::closed")}handleIframeReadyAction(){this.sendInitMessage(),this.sendMessageToIframe({source:"login",type:"width",data:document.body.clientWidth})}observeDarkModeChanges(){new MutationObserver((t=>{t.forEach((t=>{"class"===t.attributeName&&this.sendMessageToIframe({source:"login",type:"darkMode",data:{isDark:!!this.htmlElement.classList.contains("dark")}})}))})).observe(this.htmlElement,{attributes:!0})}async handleIframeStorageAction(t){let a,s=salla.storage.get("cart.user_id"),e=!1;if(Object.entries(t).filter((t=>!Salla.storage.get(t[0]))).forEach((([t,i])=>{salla.log("Shared storage from accounts domain",t,i);let l="string"==typeof i?i?.replace(/^"|"$/g,""):i;salla.storage.set(t,l),"token"===t&&(a=l),"user"===t&&s&&l.id!==s&&(e=!0)})),a){this.modal.close(),Salla.auth.event.tokenFetched(a);try{await Salla.api.cart.assign()}catch(t){Salla.log("Error on assign after handle iframe",t)}e&&Salla.cart.reset();try{!Salla.auth.api.isSessionless()&&await Salla.auth.api.request("auth/jwt"),Salla.auth.api.canRedirect()?setTimeout((()=>window.location.reload()),100):await Salla.auth.event.loggedIn({data:{token:a}}).then((()=>Salla.auth.api.afterUserLogin()))}catch(t){this.modal.open(),Salla.log("Error on request auth/jwt after handle iframe",t)}}else e&&Salla.cart.reset()}isTrustedMessage(t){if(!(this.iframe&&t.source===this.iframe.contentWindow||this.createPassKey&&t.source===this.createPassKey))return!1;let a;try{a=new URL(salla.config.get("login.url","https://accounts.salla.com")).origin}catch(t){a="https://accounts.salla.com"}return t.origin===a}isSafeUrl(t){if("string"!=typeof t||!t)return!1;try{const{protocol:a}=new URL(t,location.href);return"https:"===a||"http:"===a}catch(t){return!1}}sendMessageToIframe(t){if(this.iframe)return this.iframe.contentWindow.postMessage(t,"*")}sendInitMessage(){let t=this.headers;try{t="string"==typeof t?JSON.parse(t):t}catch(a){console.error("Failed to parse headers!",this.headers,a),t=void 0}const a={user:salla.storage.get("user"),s_translations:salla.storage.get("s_translations"),token:salla.storage.get("token")};a.user||delete a.user,a.s_translations||delete a.s_translations,a.token||delete a.token,this.sendMessageToIframe({source:"login",type:"init",data:{id:this.storeId,lang:salla.lang.locale,isDark:!!this.htmlElement.classList.contains("dark"),apiUrl:this.api?.replace(/\/+$/,""),supportWebAuth:this.supportWebAuth,withoutReload:this.withoutReload,inline:this.inline,settings:salla.config.all(),headers:t,storage:a}})}async handleGuestCheckout(){if(this.modal.close(),salla.config.isGuest())return salla.cart.submit(!1,!0)}openModal(){this.canRenderIframe||(this.canRenderIframe=!0),this.modal.open()}render(){if(!Salla.config.isUser())return this.inline?this.getLoginDom():a("salla-modal",{class:"s-login-modal",ref:t=>this.modal=t,width:"xs"},this.getLoginDom())}getLoginDom(){if(this.canRenderIframe)return a(s,null,a("iframe",{src:`${salla.config.get("login.url","https://accounts.salla.com")}?src=${this.source}&version=${salla.config.get("login.version","0.1.78")}`,title:"Salla Login",class:"hide-scroll",loading:"lazy",ref:t=>{this.iframe=t},allow:"publickey-credentials-get; publickey-credentials-create",scrolling:this.scrolling,frameborder:"0",width:"100%"}))}get host(){return e(this)}};i.style="/*!twlt*/iframe{-moz-transition:height 0.3s;-ms-transition:height 0.3s;-o-transition:height 0.3s;-webkit-transition:height 0.3s;transition:height 0.3s;width:100%}.inline{display:inline}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}";export{i as salla_login_modal}
4
+ import{r as t,h as a,F as s,a as i}from"./p-HRJpfiBN.js";const e=class{constructor(a){t(this,a),this.isMobileAllowed=!0,this.isEmailRequired=!1,this.supportWebAuth=!0,this.withoutReload=!1,this.source="",this.htmlElement=document.documentElement,this.messages=[],this.isClosable=!0,this.iframeLoaded=!1,this.scrolling="no",this.direction=document.dir,this.canRenderIframe=!1,salla.event.on("login::open",(t=>this.onLoginOpen(t))),salla.event.on("modal::close",(t=>{this.iframe&&this.sendMessageToIframe({source:"login",type:"modal_closed",data:t})})),salla.onReady((()=>{this.api=salla.config.get("store.api"),this.storeId=salla.config.get("store.id")}))}onLoginOpen(t){salla.mobile?.isNativeLoginEnabled?.()||(this.isEmailAllowed||this.isMobileAllowed?(this.source=t?.source??!1,this.withoutReload=t?.withoutReload??this.withoutReload,this.open(t),this.openModal()):salla.logger.warn("Please enable atleast one login type to use this component."))}componentDidLoad(){window.addEventListener("message",(t=>{if(!this.isTrustedMessage(t)||"login"!=t.data?.source)return;if(!this.inline&&!this.canRenderIframe)return;salla.log("salla-account:: recived an event",t.data);let a=t.data?.type?.replace("iframe::",""),s=t.data.message;if("ready"==a)return s.isPasskeyPage?void this.createPassKey.postMessage({source:"login",type:"init_passkey_page",data:{token:salla.storage.get("token"),store_id:salla.config.get("store.id"),locale:salla.config.get("user.language_code"),redirect:salla.config.get("store.url")}},salla.config.get("login.url")):void this.handleIframeReadyAction();if("height"==a)return this.iframe.height=s?.height+"px";if("storage"==a)return this.handleIframeStorageAction(s);if("scrolling"==a)return this.scrolling=s,void(this.isClosable=!1);if("direction"==a)return document.dir=this.direction=s?"rtl":"ltr";if("notify"==a)return salla.notify[s.type](s.message);if("authenticated"==a||"authenticated_web_auth"==a)return!s?.withoutClose&&this.close(),salla.auth.api.handlAfterAuthenticatedResponse(s,this.supportWebAuth).then((()=>!(s?.withoutReload||this.withoutReload)&&setTimeout((()=>window.location.reload()),1e3)));if("dispatchEvent"!=a||"auth::verified"!=s.event){if("dispatchEvent"==a)return salla.event.emit(s.event,...s.payload);if("reload"==a)return s?.withClose&&this.modal.close(),window.location.reload();if("open_page"===a){if(!this.isSafeUrl(s?.url))return;return window.location.href=s.url}if("open_passkey_page"!==a)return"guest-checkout"===a?this.handleGuestCheckout():void("close"==a&&this.close());this.createPassKey=window.open(`${salla.config.get("login.url")}/create-passkey`)}else salla.log("Ignored dispatchEvent `auth::verified` from iframe")})),this.observeDarkModeChanges(),setTimeout((()=>Salla.event.emit("salla-login::ready")),1)}async open(t=null){return Salla.config.isGuest()?this.modal.open():this.withoutReload?void 0:location.reload()}close(){Salla.event.emit("salla-login::closing"),this.modal.close(),this.iframeLoaded=!1,this.canRenderIframe=!1,this.host.dispatchEvent(new CustomEvent("salla-login:closed",{cancelable:!0,bubbles:!0,detail:null})),Salla.event.emit("salla-login::closed")}handleIframeReadyAction(){this.sendInitMessage(),this.sendMessageToIframe({source:"login",type:"width",data:document.body.clientWidth})}observeDarkModeChanges(){new MutationObserver((t=>{t.forEach((t=>{"class"===t.attributeName&&this.sendMessageToIframe({source:"login",type:"darkMode",data:{isDark:!!this.htmlElement.classList.contains("dark")}})}))})).observe(this.htmlElement,{attributes:!0})}async handleIframeStorageAction(t){let a,s=salla.storage.get("cart.user_id"),i=!1;if(Object.entries(t).filter((t=>!Salla.storage.get(t[0]))).forEach((([t,e])=>{salla.log("Shared storage from accounts domain",t,e);let l="string"==typeof e?e?.replace(/^"|"$/g,""):e;salla.storage.set(t,l),"token"===t&&(a=l),"user"===t&&s&&l.id!==s&&(i=!0)})),a){this.modal.close(),Salla.auth.event.tokenFetched(a);try{await Salla.api.cart.assign()}catch(t){Salla.log("Error on assign after handle iframe",t)}i&&Salla.cart.reset();try{!Salla.auth.api.isSessionless()&&await Salla.auth.api.request("auth/jwt"),Salla.auth.api.canRedirect()?setTimeout((()=>window.location.reload()),100):await Salla.auth.event.loggedIn({data:{token:a}}).then((()=>Salla.auth.api.afterUserLogin()))}catch(t){this.modal.open(),Salla.log("Error on request auth/jwt after handle iframe",t)}}else i&&Salla.cart.reset()}isTrustedMessage(t){if(!(this.iframe&&t.source===this.iframe.contentWindow||this.createPassKey&&t.source===this.createPassKey))return!1;let a;try{a=new URL(salla.config.get("login.url","https://accounts.salla.com")).origin}catch(t){a="https://accounts.salla.com"}return t.origin===a}isSafeUrl(t){if("string"!=typeof t||!t)return!1;try{const{protocol:a}=new URL(t,location.href);return"https:"===a||"http:"===a}catch(t){return!1}}sendMessageToIframe(t){if(this.iframe)return this.iframe.contentWindow.postMessage(t,"*")}sendInitMessage(){let t=this.headers;try{t="string"==typeof t?JSON.parse(t):t}catch(a){console.error("Failed to parse headers!",this.headers,a),t=void 0}const a={user:salla.storage.get("user"),s_translations:salla.storage.get("s_translations"),token:salla.storage.get("token")};a.user||delete a.user,a.s_translations||delete a.s_translations,a.token||delete a.token,this.sendMessageToIframe({source:"login",type:"init",data:{id:this.storeId,lang:salla.lang.locale,isDark:!!this.htmlElement.classList.contains("dark"),apiUrl:this.api?.replace(/\/+$/,""),supportWebAuth:this.supportWebAuth,withoutReload:this.withoutReload,inline:this.inline,settings:salla.config.all(),headers:t,storage:a}})}async handleGuestCheckout(){if(this.modal.close(),salla.config.isGuest())return salla.cart.submit(!1,!0)}openModal(){this.canRenderIframe||(this.canRenderIframe=!0),this.modal.open()}render(){if(!Salla.config.isUser())return this.inline?this.getLoginDom():a("salla-modal",{class:"s-login-modal",ref:t=>this.modal=t,width:"xs"},this.getLoginDom())}getLoginDom(){if(this.canRenderIframe)return a(s,null,a("iframe",{src:`${salla.config.get("login.url","https://accounts.salla.com")}?src=${this.source}&version=${salla.config.get("login.version","0.1.78")}`,title:"Salla Login",class:"hide-scroll",loading:"lazy",ref:t=>{this.iframe=t},allow:"publickey-credentials-get; publickey-credentials-create",scrolling:this.scrolling,frameborder:"0",width:"100%"}))}get host(){return i(this)}};e.style="/*!twlt*/iframe{-moz-transition:height 0.3s;-ms-transition:height 0.3s;-o-transition:height 0.3s;-webkit-transition:height 0.3s;transition:height 0.3s;width:100%}.inline{display:inline}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}";export{e as salla_login_modal}
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r as e,h as o}from"./p-Bxge4xib.js";import{T as t}from"./p-CJUR4sUM.js";import{i as r}from"./p-DqDX5na4.js";const n=class{constructor(o){e(this,o),this.coupon=null,this.isLoading=!0,this.titlePercentTpl="",this.titleFixedTpl="",this.badgeLabel="",this.minSpendTpl="",this.expiresTpl="",this.shopNowLabel="",this.copyLabel="",this.copiedLabel=""}componentWillLoad(){Salla.onReady().then((()=>Salla.lang.onLoaded())).then((()=>(this.loadTranslations(),this.loadCoupon()))).catch((()=>{this.isLoading=!1}))}loadTranslations(){this.titlePercentTpl=Salla.lang.get("pages.thank_you.next_order_coupon_title_percent")||"",this.titleFixedTpl=Salla.lang.get("pages.thank_you.next_order_coupon_title_fixed")||"",this.badgeLabel=Salla.lang.get("pages.thank_you.next_order_coupon_badge")||"",this.minSpendTpl=Salla.lang.get("pages.thank_you.next_order_coupon_min_spend")||"",this.expiresTpl=Salla.lang.get("pages.thank_you.next_order_coupon_expires")||"",this.shopNowLabel=Salla.lang.get("pages.thank_you.next_order_coupon_shop_now")||"",this.copyLabel=Salla.lang.get("common.elements.copy")||"",this.copiedLabel=Salla.lang.get("pages.thank_you.next_order_coupon_copied")||""}async loadCoupon(){try{const e=await salla.api.request("coupons",{params:{type:"thankyou"}}),o=e?.data,t=Array.isArray(o)?o:Array.isArray(o?.data)?o.data:[];this.coupon=t[0]??null}catch{this.coupon=null}finally{this.isLoading=!1}}async copyCode(){if(this.coupon)try{await navigator.clipboard.writeText(this.coupon.code),salla.notify.success(this.copiedLabel),salla.event.dispatch("salla::next-order-coupon.code.copied",{code:this.coupon.code})}catch{}}isPercentage(){return"P"===this.coupon?.type||"percentage"===this.coupon?.type}formatAmount(){if(!this.coupon)return"";if(this.isPercentage())return`${salla.helpers.number(this.coupon.amount)}%`;const e=this.coupon.amount;return o("span","object"==typeof e&&e.amount?{innerHTML:salla.money(e.amount,e.currency)}:{innerHTML:salla.money(e)})}formatMinSpend(){const e=this.coupon?.minimum_amount;return e&&("object"!=typeof e||e.amount)?"string"==typeof e?e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;"):salla.money(e.amount,e.currency):""}formatExpiry(){const e=this.coupon?.expiry_date;return e?new Date(e).toLocaleDateString(Salla.lang.locale||"en-GB"):""}renderSkeleton(){return o("div",{class:"s-next-order-coupon-wrapper s-next-order-coupon-skeleton"},o("div",{class:"s-next-order-coupon-inner"},o("div",{class:"s-next-order-coupon-info"},o("salla-skeleton",{type:"normal",width:"48px",height:"48px"}),o("div",{class:"s-next-order-coupon-details"},o("salla-skeleton",{height:"14px",width:"220px"}),o("salla-skeleton",{height:"12px",width:"140px"}))),o("div",{class:"s-next-order-coupon-actions"},o("salla-skeleton",{height:"40px",width:"140px"}),o("salla-skeleton",{height:"40px",width:"100px"}))))}renderTitle(){const e=this.formatAmount(),t=this.isPercentage()?this.titlePercentTpl:this.titleFixedTpl,r=this.isPercentage()?":amount%":":amount",n=t.split(r);return o("p",{class:"s-next-order-coupon-title"},n[0],o("span",{class:"s-next-order-coupon-amount"},e),n[1]||"")}render(){if(this.isLoading)return this.renderSkeleton();if(!this.coupon)return null;const e=this.formatMinSpend(),n=this.formatExpiry();return o("div",{class:"s-next-order-coupon-wrapper"},o("div",{class:"s-next-order-coupon-inner"},o("div",{class:"s-next-order-coupon-info"},o("div",{class:"s-next-order-coupon-icon-wrap"},o("span",{class:"s-next-order-coupon-icon-bg"}),o("span",{class:"s-next-order-coupon-icon",innerHTML:t})),o("div",{class:"s-next-order-coupon-details"},o("div",{class:"s-next-order-coupon-title-row"},this.renderTitle(),o("span",{class:"s-next-order-coupon-badge"},o("span",{class:"s-next-order-coupon-badge-bg"}),o("span",{class:"s-next-order-coupon-badge-text"},this.badgeLabel))),(e||n)&&o("p",{class:"s-next-order-coupon-meta"},e&&o("span",{innerHTML:this.minSpendTpl.replace(":amount",e)}),n&&o("span",null,this.expiresTpl.replace(":date",n))))),o("div",{class:"s-next-order-coupon-actions"},o("div",{class:"s-next-order-coupon-code-box"},o("span",{class:"s-next-order-coupon-code-text"},this.coupon.code),o("salla-button",{shape:"link",class:"s-next-order-coupon-copy-btn",title:this.copyLabel,onClick:()=>this.copyCode()},o("span",{class:"s-next-order-coupon-copy-icon",innerHTML:r}))),o("salla-button",{href:salla.url.get(""),class:"s-next-order-coupon-shop-btn"},this.shopNowLabel))))}};n.style="/*!twlt*/:host{display:block}.fixed{position:fixed}.s-next-order-coupon-wrapper{margin-bottom:1.5rem;border-radius:0.375rem;--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1));padding-left:1rem;padding-right:1rem;padding-top:1rem;padding-bottom:1rem}@media (min-width: 768px){.s-next-order-coupon-wrapper{margin-bottom:2rem;padding-left:2rem;padding-right:2rem}}.s-next-order-coupon-inner{display:flex;flex-direction:column;gap:1rem}@media (min-width: 768px){.s-next-order-coupon-inner{flex-direction:row;align-items:center;justify-content:space-between}}.s-next-order-coupon-info{display:flex;min-width:0px;flex:1 1 0%;align-items:center;gap:0.75rem}.s-next-order-coupon-icon-wrap{position:relative;display:flex;height:3rem;width:3rem;flex-shrink:0;align-items:center;justify-content:center;border-radius:var(--s-radius, 0.25rem)}.s-next-order-coupon-icon-bg{position:absolute;inset:0px;border-radius:var(--s-radius, 0.25rem);background-color:var(--color-primary);opacity:0.25}.s-next-order-coupon-icon{position:relative;color:var(--color-primary)}.s-next-order-coupon-icon svg{height:1.5rem;width:1.75rem;fill:currentColor}.s-next-order-coupon-details{display:flex;min-width:0px;flex-direction:column;gap:0.5rem}.s-next-order-coupon-title-row{display:flex;flex-wrap:wrap;align-items:center;gap:0.375rem}.s-next-order-coupon-title{font-size:1rem;line-height:1.5rem;font-weight:700;line-height:1.375}.s-next-order-coupon-amount{color:var(--color-primary)}.s-next-order-coupon-badge{position:relative;display:inline-flex;height:1.5rem;align-items:center;border-radius:9999px;padding-left:0.75rem;padding-right:0.75rem;font-size:0.75rem;line-height:1rem;color:var(--color-primary)}.s-next-order-coupon-badge-bg{position:absolute;inset:0px;border-radius:9999px;background-color:var(--color-primary);opacity:0.25}.s-next-order-coupon-badge-text{position:relative}.s-next-order-coupon-meta{display:flex;flex-wrap:wrap;column-gap:0.25rem;font-size:0.875rem;line-height:1.25rem;line-height:1.375;--tw-text-opacity:1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.s-next-order-coupon-actions{display:flex;flex-direction:column;gap:0.75rem}@media (min-width: 768px){.s-next-order-coupon-actions{flex-shrink:0;flex-direction:row;align-items:center}}.s-next-order-coupon-code-box{display:flex;height:2.5rem;width:100%;align-items:center;justify-content:center;gap:0.5rem;border-radius:0.375rem;border-width:1px;border-style:dashed;border-color:var(--color-primary);padding-left:1rem;padding-right:1rem}@media (min-width: 768px){.s-next-order-coupon-code-box{width:auto}}.s-next-order-coupon-code-text{font-size:1rem;line-height:1.5rem;line-height:1;letter-spacing:0.025em}.s-next-order-coupon-copy-btn{display:flex;height:auto !important;align-items:center;padding:0px !important}.s-next-order-coupon-copy-icon{pointer-events:none;color:var(--color-primary)}.s-next-order-coupon-copy-icon svg{height:1rem;width:1rem;fill:currentColor}.s-next-order-coupon-shop-btn{width:100%;white-space:nowrap;text-align:center}@media (min-width: 768px){.s-next-order-coupon-shop-btn{width:auto}}@keyframes pulse{50%{opacity:.5}}.s-next-order-coupon-skeleton{animation:pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite}";export{n as salla_next_order_coupon}
4
+ import{r as e,h as o}from"./p-HRJpfiBN.js";import{T as t}from"./p-CJUR4sUM.js";import{i as r}from"./p-DqDX5na4.js";const n=class{constructor(o){e(this,o),this.coupon=null,this.isLoading=!0,this.titlePercentTpl="",this.titleFixedTpl="",this.badgeLabel="",this.minSpendTpl="",this.expiresTpl="",this.shopNowLabel="",this.copyLabel="",this.copiedLabel=""}componentWillLoad(){Salla.onReady().then((()=>Salla.lang.onLoaded())).then((()=>(this.loadTranslations(),this.loadCoupon()))).catch((()=>{this.isLoading=!1}))}loadTranslations(){this.titlePercentTpl=Salla.lang.get("pages.thank_you.next_order_coupon_title_percent")||"",this.titleFixedTpl=Salla.lang.get("pages.thank_you.next_order_coupon_title_fixed")||"",this.badgeLabel=Salla.lang.get("pages.thank_you.next_order_coupon_badge")||"",this.minSpendTpl=Salla.lang.get("pages.thank_you.next_order_coupon_min_spend")||"",this.expiresTpl=Salla.lang.get("pages.thank_you.next_order_coupon_expires")||"",this.shopNowLabel=Salla.lang.get("pages.thank_you.next_order_coupon_shop_now")||"",this.copyLabel=Salla.lang.get("common.elements.copy")||"",this.copiedLabel=Salla.lang.get("pages.thank_you.next_order_coupon_copied")||""}async loadCoupon(){try{const e=await salla.api.request("coupons",{params:{type:"thankyou"}}),o=e?.data,t=Array.isArray(o)?o:Array.isArray(o?.data)?o.data:[];this.coupon=t[0]??null}catch{this.coupon=null}finally{this.isLoading=!1}}async copyCode(){if(this.coupon)try{await navigator.clipboard.writeText(this.coupon.code),salla.notify.success(this.copiedLabel),salla.event.dispatch("salla::next-order-coupon.code.copied",{code:this.coupon.code})}catch{}}isPercentage(){return"P"===this.coupon?.type||"percentage"===this.coupon?.type}formatAmount(){if(!this.coupon)return"";if(this.isPercentage())return`${salla.helpers.number(this.coupon.amount)}%`;const e=this.coupon.amount;return o("span","object"==typeof e&&e.amount?{innerHTML:salla.money(e.amount,e.currency)}:{innerHTML:salla.money(e)})}formatMinSpend(){const e=this.coupon?.minimum_amount;return e&&("object"!=typeof e||e.amount)?"string"==typeof e?e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;"):salla.money(e.amount,e.currency):""}formatExpiry(){const e=this.coupon?.expiry_date;return e?new Date(e).toLocaleDateString(Salla.lang.locale||"en-GB"):""}renderSkeleton(){return o("div",{class:"s-next-order-coupon-wrapper s-next-order-coupon-skeleton"},o("div",{class:"s-next-order-coupon-inner"},o("div",{class:"s-next-order-coupon-info"},o("salla-skeleton",{type:"normal",width:"48px",height:"48px"}),o("div",{class:"s-next-order-coupon-details"},o("salla-skeleton",{height:"14px",width:"220px"}),o("salla-skeleton",{height:"12px",width:"140px"}))),o("div",{class:"s-next-order-coupon-actions"},o("salla-skeleton",{height:"40px",width:"140px"}),o("salla-skeleton",{height:"40px",width:"100px"}))))}renderTitle(){const e=this.formatAmount(),t=this.isPercentage()?this.titlePercentTpl:this.titleFixedTpl,r=this.isPercentage()?":amount%":":amount",n=t.split(r);return o("p",{class:"s-next-order-coupon-title"},n[0],o("span",{class:"s-next-order-coupon-amount"},e),n[1]||"")}render(){if(this.isLoading)return this.renderSkeleton();if(!this.coupon)return null;const e=this.formatMinSpend(),n=this.formatExpiry();return o("div",{class:"s-next-order-coupon-wrapper"},o("div",{class:"s-next-order-coupon-inner"},o("div",{class:"s-next-order-coupon-info"},o("div",{class:"s-next-order-coupon-icon-wrap"},o("span",{class:"s-next-order-coupon-icon-bg"}),o("span",{class:"s-next-order-coupon-icon",innerHTML:t})),o("div",{class:"s-next-order-coupon-details"},o("div",{class:"s-next-order-coupon-title-row"},this.renderTitle(),o("span",{class:"s-next-order-coupon-badge"},o("span",{class:"s-next-order-coupon-badge-bg"}),o("span",{class:"s-next-order-coupon-badge-text"},this.badgeLabel))),(e||n)&&o("p",{class:"s-next-order-coupon-meta"},e&&o("span",{innerHTML:this.minSpendTpl.replace(":amount",e)}),n&&o("span",null,this.expiresTpl.replace(":date",n))))),o("div",{class:"s-next-order-coupon-actions"},o("div",{class:"s-next-order-coupon-code-box"},o("span",{class:"s-next-order-coupon-code-text"},this.coupon.code),o("salla-button",{shape:"link",class:"s-next-order-coupon-copy-btn",title:this.copyLabel,onClick:()=>this.copyCode()},o("span",{class:"s-next-order-coupon-copy-icon",innerHTML:r}))),o("salla-button",{href:salla.url.get(""),class:"s-next-order-coupon-shop-btn"},this.shopNowLabel))))}};n.style="/*!twlt*/:host{display:block}.fixed{position:fixed}.s-next-order-coupon-wrapper{margin-bottom:1.5rem;border-radius:0.375rem;--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1));padding-left:1rem;padding-right:1rem;padding-top:1rem;padding-bottom:1rem}@media (min-width: 768px){.s-next-order-coupon-wrapper{margin-bottom:2rem;padding-left:2rem;padding-right:2rem}}.s-next-order-coupon-inner{display:flex;flex-direction:column;gap:1rem}@media (min-width: 768px){.s-next-order-coupon-inner{flex-direction:row;align-items:center;justify-content:space-between}}.s-next-order-coupon-info{display:flex;min-width:0px;flex:1 1 0%;align-items:center;gap:0.75rem}.s-next-order-coupon-icon-wrap{position:relative;display:flex;height:3rem;width:3rem;flex-shrink:0;align-items:center;justify-content:center;border-radius:var(--s-radius, 0.25rem)}.s-next-order-coupon-icon-bg{position:absolute;inset:0px;border-radius:var(--s-radius, 0.25rem);background-color:var(--color-primary);opacity:0.25}.s-next-order-coupon-icon{position:relative;color:var(--color-primary)}.s-next-order-coupon-icon svg{height:1.5rem;width:1.75rem;fill:currentColor}.s-next-order-coupon-details{display:flex;min-width:0px;flex-direction:column;gap:0.5rem}.s-next-order-coupon-title-row{display:flex;flex-wrap:wrap;align-items:center;gap:0.375rem}.s-next-order-coupon-title{font-size:1rem;line-height:1.5rem;font-weight:700;line-height:1.375}.s-next-order-coupon-amount{color:var(--color-primary)}.s-next-order-coupon-badge{position:relative;display:inline-flex;height:1.5rem;align-items:center;border-radius:9999px;padding-left:0.75rem;padding-right:0.75rem;font-size:0.75rem;line-height:1rem;color:var(--color-primary)}.s-next-order-coupon-badge-bg{position:absolute;inset:0px;border-radius:9999px;background-color:var(--color-primary);opacity:0.25}.s-next-order-coupon-badge-text{position:relative}.s-next-order-coupon-meta{display:flex;flex-wrap:wrap;column-gap:0.25rem;font-size:0.875rem;line-height:1.25rem;line-height:1.375;--tw-text-opacity:1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.s-next-order-coupon-actions{display:flex;flex-direction:column;gap:0.75rem}@media (min-width: 768px){.s-next-order-coupon-actions{flex-shrink:0;flex-direction:row;align-items:center}}.s-next-order-coupon-code-box{display:flex;height:2.5rem;width:100%;align-items:center;justify-content:center;gap:0.5rem;border-radius:0.375rem;border-width:1px;border-style:dashed;border-color:var(--color-primary);padding-left:1rem;padding-right:1rem}@media (min-width: 768px){.s-next-order-coupon-code-box{width:auto}}.s-next-order-coupon-code-text{font-size:1rem;line-height:1.5rem;line-height:1;letter-spacing:0.025em}.s-next-order-coupon-copy-btn{display:flex;height:auto !important;align-items:center;padding:0px !important}.s-next-order-coupon-copy-icon{pointer-events:none;color:var(--color-primary)}.s-next-order-coupon-copy-icon svg{height:1rem;width:1rem;fill:currentColor}.s-next-order-coupon-shop-btn{width:100%;white-space:nowrap;text-align:center}@media (min-width: 768px){.s-next-order-coupon-shop-btn{width:auto}}@keyframes pulse{50%{opacity:.5}}.s-next-order-coupon-skeleton{animation:pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite}";export{n as salla_next_order_coupon}