@salla.sa/twilight-components 2.14.524 → 2.14.526

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 (354) hide show
  1. package/dist/cjs/{filepond-BVaAyFoF.js → filepond-dCwl_WGS.js} +1 -1
  2. package/dist/cjs/{filepond-plugin-file-poster-D_7P3fIq.js → filepond-plugin-file-poster-JE47euyP.js} +1 -1
  3. package/dist/cjs/{filepond-plugin-file-validate-size-wpUbEEJQ.js → filepond-plugin-file-validate-size-CFbzBG_a.js} +1 -1
  4. package/dist/cjs/{filepond-plugin-file-validate-type-DnsofxYi.js → filepond-plugin-file-validate-type-B95BRuZd.js} +1 -1
  5. package/dist/cjs/{filepond-plugin-image-edit-BN8NNj8r.js → filepond-plugin-image-edit-QbQgAOte.js} +1 -1
  6. package/dist/cjs/{filepond-plugin-image-exif-orientation-Bh2lasm5.js → filepond-plugin-image-exif-orientation-C3KRxOCO.js} +1 -1
  7. package/dist/cjs/{filepond-plugin-image-preview-CEuvK6zb.js → filepond-plugin-image-preview-Bg5kON16.js} +1 -1
  8. package/dist/cjs/{functions-BsqbMNo6.js → functions-DI3Yp4Of.js} +1 -1
  9. package/dist/cjs/{index-B2m0lkUU.js → index-CL2v3rWe.js} +2 -2
  10. package/dist/cjs/intlTelInput-BhGMuXpz.js +4449 -0
  11. package/dist/cjs/loader.cjs.js +2 -2
  12. package/dist/cjs/salla-accordion-body_2.cjs.entry.js +1 -1
  13. package/dist/cjs/salla-accordion_6.cjs.entry.js +1 -1
  14. package/dist/cjs/salla-add-product-button_5.cjs.entry.js +24 -6
  15. package/dist/cjs/salla-advertisement.cjs.entry.js +1 -1
  16. package/dist/cjs/salla-alert_2.cjs.entry.js +1 -1
  17. package/dist/cjs/salla-app-install-alert.cjs.entry.js +1 -1
  18. package/dist/cjs/salla-apps-icons.cjs.entry.js +1 -1
  19. package/dist/cjs/salla-badge.cjs.entry.js +1 -1
  20. package/dist/cjs/salla-basket-gap.cjs.entry.js +1 -1
  21. package/dist/cjs/salla-booking-field_7.cjs.entry.js +32 -16
  22. package/dist/cjs/salla-bullet-delivery_2.cjs.entry.js +82 -7
  23. package/dist/cjs/salla-cart-coupons.cjs.entry.js +1 -1
  24. package/dist/cjs/salla-cart-item-offers_2.cjs.entry.js +1 -1
  25. package/dist/cjs/salla-cart-summary-card.cjs.entry.js +1 -1
  26. package/dist/cjs/salla-cashback-banner.cjs.entry.js +1 -1
  27. package/dist/cjs/salla-comment-factors.cjs.entry.js +1 -1
  28. package/dist/cjs/salla-comment-form_8.cjs.entry.js +1 -1
  29. package/dist/cjs/salla-conditional-offer.cjs.entry.js +1 -1
  30. package/dist/cjs/salla-contacts.cjs.entry.js +1 -1
  31. package/dist/cjs/salla-cookies-bar.cjs.entry.js +1 -1
  32. package/dist/cjs/salla-count-down_2.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-gifting.cjs.entry.js +1 -1
  40. package/dist/cjs/salla-hook.cjs.entry.js +1 -1
  41. package/dist/cjs/salla-infinite-scroll.cjs.entry.js +1 -1
  42. package/dist/cjs/salla-installment.cjs.entry.js +1 -1
  43. package/dist/cjs/salla-list-tile.cjs.entry.js +1 -1
  44. package/dist/cjs/salla-localization-modal.cjs.entry.js +1 -1
  45. package/dist/cjs/salla-login-modal.cjs.entry.js +1 -1
  46. package/dist/cjs/salla-loyalty-banner.cjs.entry.js +2 -2
  47. package/dist/cjs/salla-loyalty-exchange-product-card_5.cjs.entry.js +3 -3
  48. package/dist/cjs/salla-loyalty-hero_2.cjs.entry.js +2 -2
  49. package/dist/cjs/salla-loyalty-panel.cjs.entry.js +3 -3
  50. package/dist/cjs/salla-loyalty-points-banner.cjs.entry.js +1 -1
  51. package/dist/cjs/salla-loyalty-points-history.cjs.entry.js +1 -1
  52. package/dist/cjs/salla-loyalty-prize-item.cjs.entry.js +1 -1
  53. package/dist/cjs/salla-loyalty-program.cjs.entry.js +3 -3
  54. package/dist/cjs/salla-loyalty-reward.cjs.entry.js +2 -2
  55. package/dist/cjs/salla-loyalty.cjs.entry.js +1 -1
  56. package/dist/cjs/salla-maintenance-alert.cjs.entry.js +1 -1
  57. package/dist/cjs/salla-map_2.cjs.entry.js +71 -15
  58. package/dist/cjs/salla-menu.cjs.entry.js +1 -1
  59. package/dist/cjs/salla-metadata.cjs.entry.js +1 -1
  60. package/dist/cjs/salla-multiple-bundle-product-cart_2.cjs.entry.js +1 -1
  61. package/dist/cjs/salla-multiple-bundle-product-options-modal_2.cjs.entry.js +1 -1
  62. package/dist/cjs/salla-multiple-bundle-product.cjs.entry.js +1 -1
  63. package/dist/cjs/salla-next-order-coupon.cjs.entry.js +1 -1
  64. package/dist/cjs/salla-notification-item.cjs.entry.js +1 -1
  65. package/dist/cjs/salla-notifications.cjs.entry.js +1 -1
  66. package/dist/cjs/salla-offer-modal.cjs.entry.js +1 -1
  67. package/dist/cjs/salla-offer.cjs.entry.js +1 -1
  68. package/dist/cjs/salla-order-branch.cjs.entry.js +1 -1
  69. package/dist/cjs/salla-order-cancel.cjs.entry.js +1 -1
  70. package/dist/cjs/salla-order-details-multiple-bundle-product.cjs.entry.js +1 -1
  71. package/dist/cjs/salla-order-details-options.cjs.entry.js +1 -1
  72. package/dist/cjs/salla-order-details.cjs.entry.js +1 -1
  73. package/dist/cjs/salla-order-edit-item.cjs.entry.js +1 -1
  74. package/dist/cjs/salla-order-edit-product-card.cjs.entry.js +1 -1
  75. package/dist/cjs/salla-order-edit.cjs.entry.js +1 -1
  76. package/dist/cjs/salla-order-shipments.cjs.entry.js +1 -1
  77. package/dist/cjs/salla-order-summary.cjs.entry.js +1 -1
  78. package/dist/cjs/salla-order-totals-card.cjs.entry.js +1 -1
  79. package/dist/cjs/salla-orders.cjs.entry.js +1 -1
  80. package/dist/cjs/salla-payments.cjs.entry.js +1 -1
  81. package/dist/cjs/salla-placeholder.cjs.entry.js +1 -1
  82. package/dist/cjs/salla-price-range.cjs.entry.js +1 -1
  83. package/dist/cjs/salla-product-card-embed.cjs.entry.js +1 -1
  84. package/dist/cjs/salla-product-card_2.cjs.entry.js +1 -1
  85. package/dist/cjs/salla-product-size-guide.cjs.entry.js +1 -1
  86. package/dist/cjs/salla-products-list.cjs.entry.js +1 -1
  87. package/dist/cjs/salla-quick-order.cjs.entry.js +1 -1
  88. package/dist/cjs/salla-rating-modal-v2.cjs.entry.js +1 -1
  89. package/dist/cjs/salla-rating-modal.cjs.entry.js +1 -1
  90. package/dist/cjs/salla-review-factors-tags.cjs.entry.js +1 -1
  91. package/dist/cjs/salla-scopes.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-slider.cjs.entry.js +1 -1
  95. package/dist/cjs/salla-social-share.cjs.entry.js +1 -1
  96. package/dist/cjs/salla-social.cjs.entry.js +1 -1
  97. package/dist/cjs/salla-tab-content_3.cjs.entry.js +1 -1
  98. package/dist/cjs/salla-tiered-offer.cjs.entry.js +1 -1
  99. package/dist/cjs/salla-tooltip.cjs.entry.js +1 -1
  100. package/dist/cjs/salla-trust-badges.cjs.entry.js +1 -1
  101. package/dist/cjs/salla-user-menu.cjs.entry.js +1 -1
  102. package/dist/cjs/salla-user-profile.cjs.entry.js +1 -1
  103. package/dist/cjs/salla-user-settings.cjs.entry.js +1 -1
  104. package/dist/cjs/salla-verify.cjs.entry.js +1 -1
  105. package/dist/cjs/salla-wallet.cjs.entry.js +1 -1
  106. package/dist/cjs/salla-wishlist-actions.cjs.entry.js +1 -1
  107. package/dist/cjs/{tracked-promise-DV7LEYsU.js → tracked-promise-BE9q9nKy.js} +1 -1
  108. package/dist/cjs/twilight.cjs.js +2 -2
  109. package/dist/cjs/utils-BD1un9WN.js +544 -0
  110. package/dist/cjs/{vanilla-picker-CXvH2EWT.js → vanilla-picker-DOFw7Ga1.js} +1 -1
  111. package/dist/collection/components/salla-bullet-delivery/salla-bullet-delivery.js +82 -6
  112. package/dist/collection/components/salla-map/salla-map.css +20 -1
  113. package/dist/collection/components/salla-map/salla-map.js +86 -13
  114. package/dist/collection/components/salla-product-options/salla-product-options.js +27 -5
  115. package/dist/collection/components/salla-tel-input/salla-tel-input.css +25 -17
  116. package/dist/collection/components/salla-tel-input/salla-tel-input.js +21 -5
  117. package/dist/components/index.js +2 -2
  118. package/dist/components/intlTelInput.js +4447 -0
  119. package/dist/components/salla-bullet-delivery.js +82 -6
  120. package/dist/components/salla-map2.js +71 -14
  121. package/dist/components/salla-product-options2.js +23 -5
  122. package/dist/components/salla-tel-input2.js +23 -7
  123. package/dist/components/utils.js +542 -0
  124. package/dist/esm/{filepond-DTzVnm2p.js → filepond-CTe79mlR.js} +1 -1
  125. package/dist/esm/{filepond-plugin-file-poster-Bgus9Ofh.js → filepond-plugin-file-poster-FpMbRCuf.js} +1 -1
  126. package/dist/esm/{filepond-plugin-file-validate-size-B8PRvgIP.js → filepond-plugin-file-validate-size-B_GPzKYu.js} +1 -1
  127. package/dist/esm/{filepond-plugin-file-validate-type-CAs60OfK.js → filepond-plugin-file-validate-type-CgBrFV7x.js} +1 -1
  128. package/dist/esm/{filepond-plugin-image-edit-5pQX-bqs.js → filepond-plugin-image-edit-DElBchkY.js} +1 -1
  129. package/dist/esm/{filepond-plugin-image-exif-orientation-CQmP0y_L.js → filepond-plugin-image-exif-orientation-BhZHvn_5.js} +1 -1
  130. package/dist/esm/{filepond-plugin-image-preview-DdIiCGg1.js → filepond-plugin-image-preview-D2oaWqOt.js} +1 -1
  131. package/dist/esm/{functions-DpljrYCU.js → functions-DzuTSHQl.js} +1 -1
  132. package/dist/esm/{index-Dm54yhRt.js → index-LKlIr4DH.js} +2 -2
  133. package/dist/esm/intlTelInput-Dv1YqwOl.js +4447 -0
  134. package/dist/esm/loader.js +3 -3
  135. package/dist/esm/salla-accordion-body_2.entry.js +1 -1
  136. package/dist/esm/salla-accordion_6.entry.js +1 -1
  137. package/dist/esm/salla-add-product-button_5.entry.js +24 -6
  138. package/dist/esm/salla-advertisement.entry.js +1 -1
  139. package/dist/esm/salla-alert_2.entry.js +1 -1
  140. package/dist/esm/salla-app-install-alert.entry.js +1 -1
  141. package/dist/esm/salla-apps-icons.entry.js +1 -1
  142. package/dist/esm/salla-badge.entry.js +1 -1
  143. package/dist/esm/salla-basket-gap.entry.js +1 -1
  144. package/dist/esm/salla-booking-field_7.entry.js +32 -16
  145. package/dist/esm/salla-bullet-delivery_2.entry.js +82 -7
  146. package/dist/esm/salla-cart-coupons.entry.js +1 -1
  147. package/dist/esm/salla-cart-item-offers_2.entry.js +1 -1
  148. package/dist/esm/salla-cart-summary-card.entry.js +1 -1
  149. package/dist/esm/salla-cashback-banner.entry.js +1 -1
  150. package/dist/esm/salla-comment-factors.entry.js +1 -1
  151. package/dist/esm/salla-comment-form_8.entry.js +1 -1
  152. package/dist/esm/salla-conditional-offer.entry.js +1 -1
  153. package/dist/esm/salla-contacts.entry.js +1 -1
  154. package/dist/esm/salla-cookies-bar.entry.js +1 -1
  155. package/dist/esm/salla-count-down_2.entry.js +1 -1
  156. package/dist/esm/salla-custom-fields.entry.js +1 -1
  157. package/dist/esm/salla-delivery-promise.entry.js +1 -1
  158. package/dist/esm/salla-edit-order-button.entry.js +1 -1
  159. package/dist/esm/salla-filters-widget.entry.js +1 -1
  160. package/dist/esm/salla-filters.entry.js +1 -1
  161. package/dist/esm/salla-fulfillment-methods.entry.js +1 -1
  162. package/dist/esm/salla-gifting.entry.js +1 -1
  163. package/dist/esm/salla-hook.entry.js +1 -1
  164. package/dist/esm/salla-infinite-scroll.entry.js +1 -1
  165. package/dist/esm/salla-installment.entry.js +1 -1
  166. package/dist/esm/salla-list-tile.entry.js +1 -1
  167. package/dist/esm/salla-localization-modal.entry.js +1 -1
  168. package/dist/esm/salla-login-modal.entry.js +1 -1
  169. package/dist/esm/salla-loyalty-banner.entry.js +2 -2
  170. package/dist/esm/salla-loyalty-exchange-product-card_5.entry.js +3 -3
  171. package/dist/esm/salla-loyalty-hero_2.entry.js +2 -2
  172. package/dist/esm/salla-loyalty-panel.entry.js +3 -3
  173. package/dist/esm/salla-loyalty-points-banner.entry.js +1 -1
  174. package/dist/esm/salla-loyalty-points-history.entry.js +1 -1
  175. package/dist/esm/salla-loyalty-prize-item.entry.js +1 -1
  176. package/dist/esm/salla-loyalty-program.entry.js +3 -3
  177. package/dist/esm/salla-loyalty-reward.entry.js +2 -2
  178. package/dist/esm/salla-loyalty.entry.js +1 -1
  179. package/dist/esm/salla-maintenance-alert.entry.js +1 -1
  180. package/dist/esm/salla-map_2.entry.js +71 -15
  181. package/dist/esm/salla-menu.entry.js +1 -1
  182. package/dist/esm/salla-metadata.entry.js +1 -1
  183. package/dist/esm/salla-multiple-bundle-product-cart_2.entry.js +1 -1
  184. package/dist/esm/salla-multiple-bundle-product-options-modal_2.entry.js +1 -1
  185. package/dist/esm/salla-multiple-bundle-product.entry.js +1 -1
  186. package/dist/esm/salla-next-order-coupon.entry.js +1 -1
  187. package/dist/esm/salla-notification-item.entry.js +1 -1
  188. package/dist/esm/salla-notifications.entry.js +1 -1
  189. package/dist/esm/salla-offer-modal.entry.js +1 -1
  190. package/dist/esm/salla-offer.entry.js +1 -1
  191. package/dist/esm/salla-order-branch.entry.js +1 -1
  192. package/dist/esm/salla-order-cancel.entry.js +1 -1
  193. package/dist/esm/salla-order-details-multiple-bundle-product.entry.js +1 -1
  194. package/dist/esm/salla-order-details-options.entry.js +1 -1
  195. package/dist/esm/salla-order-details.entry.js +1 -1
  196. package/dist/esm/salla-order-edit-item.entry.js +1 -1
  197. package/dist/esm/salla-order-edit-product-card.entry.js +1 -1
  198. package/dist/esm/salla-order-edit.entry.js +1 -1
  199. package/dist/esm/salla-order-shipments.entry.js +1 -1
  200. package/dist/esm/salla-order-summary.entry.js +1 -1
  201. package/dist/esm/salla-order-totals-card.entry.js +1 -1
  202. package/dist/esm/salla-orders.entry.js +1 -1
  203. package/dist/esm/salla-payments.entry.js +1 -1
  204. package/dist/esm/salla-placeholder.entry.js +1 -1
  205. package/dist/esm/salla-price-range.entry.js +1 -1
  206. package/dist/esm/salla-product-card-embed.entry.js +1 -1
  207. package/dist/esm/salla-product-card_2.entry.js +1 -1
  208. package/dist/esm/salla-product-size-guide.entry.js +1 -1
  209. package/dist/esm/salla-products-list.entry.js +1 -1
  210. package/dist/esm/salla-quick-order.entry.js +1 -1
  211. package/dist/esm/salla-rating-modal-v2.entry.js +1 -1
  212. package/dist/esm/salla-rating-modal.entry.js +1 -1
  213. package/dist/esm/salla-review-factors-tags.entry.js +1 -1
  214. package/dist/esm/salla-scopes.entry.js +1 -1
  215. package/dist/esm/salla-search.entry.js +1 -1
  216. package/dist/esm/salla-skeleton.entry.js +1 -1
  217. package/dist/esm/salla-slider.entry.js +1 -1
  218. package/dist/esm/salla-social-share.entry.js +1 -1
  219. package/dist/esm/salla-social.entry.js +1 -1
  220. package/dist/esm/salla-tab-content_3.entry.js +1 -1
  221. package/dist/esm/salla-tiered-offer.entry.js +1 -1
  222. package/dist/esm/salla-tooltip.entry.js +1 -1
  223. package/dist/esm/salla-trust-badges.entry.js +1 -1
  224. package/dist/esm/salla-user-menu.entry.js +1 -1
  225. package/dist/esm/salla-user-profile.entry.js +1 -1
  226. package/dist/esm/salla-user-settings.entry.js +1 -1
  227. package/dist/esm/salla-verify.entry.js +1 -1
  228. package/dist/esm/salla-wallet.entry.js +1 -1
  229. package/dist/esm/salla-wishlist-actions.entry.js +1 -1
  230. package/dist/esm/{tracked-promise-B8yCrzxY.js → tracked-promise-yYcxeJzZ.js} +1 -1
  231. package/dist/esm/twilight.js +3 -3
  232. package/dist/esm/utils-DxnArMXe.js +542 -0
  233. package/dist/esm/{vanilla-picker-DFISd8Ab.js → vanilla-picker-BAPOtEmC.js} +1 -1
  234. package/dist/twilight/{p-d6146737.entry.js → p-0559d448.entry.js} +1 -1
  235. package/dist/twilight/{p-34bb17c9.entry.js → p-067f052b.entry.js} +1 -1
  236. package/dist/twilight/{p-2e9f26cf.entry.js → p-06c4a0cd.entry.js} +1 -1
  237. package/dist/twilight/{p-4f5916dd.entry.js → p-10c3a012.entry.js} +1 -1
  238. package/dist/twilight/{p-cd0f27b8.entry.js → p-1227aa55.entry.js} +1 -1
  239. package/dist/twilight/{p-85ffcb0d.entry.js → p-146706fc.entry.js} +1 -1
  240. package/dist/twilight/{p-18dc5f4f.entry.js → p-166343b3.entry.js} +1 -1
  241. package/dist/twilight/{p-9f88fd32.entry.js → p-172a034d.entry.js} +1 -1
  242. package/dist/twilight/{p-6f20f79a.entry.js → p-1b5189f0.entry.js} +1 -1
  243. package/dist/twilight/{p-e4c40a79.entry.js → p-1e799c60.entry.js} +1 -1
  244. package/dist/twilight/{p-acfc17d6.entry.js → p-233039ec.entry.js} +1 -1
  245. package/dist/twilight/{p-0b74b865.entry.js → p-253afd49.entry.js} +1 -1
  246. package/dist/twilight/{p-bc633deb.entry.js → p-2766a17f.entry.js} +1 -1
  247. package/dist/twilight/{p-c55ed08e.entry.js → p-288e4fd6.entry.js} +1 -1
  248. package/dist/twilight/p-2c14546d.entry.js +4 -0
  249. package/dist/twilight/{p-a307c408.entry.js → p-2e9fcab1.entry.js} +1 -1
  250. package/dist/twilight/{p-eb1e775a.entry.js → p-2ea5c336.entry.js} +1 -1
  251. package/dist/twilight/{p-d5262ac3.entry.js → p-2f6e46b0.entry.js} +1 -1
  252. package/dist/twilight/{p-00d22240.entry.js → p-31a1bd9c.entry.js} +1 -1
  253. package/dist/twilight/{p-e6255c72.entry.js → p-326a584d.entry.js} +1 -1
  254. package/dist/twilight/{p-a5070e48.entry.js → p-385e1853.entry.js} +1 -1
  255. package/dist/twilight/{p-df1badad.entry.js → p-3a46d113.entry.js} +1 -1
  256. package/dist/twilight/{p-c38bfc00.entry.js → p-3a9c2e9d.entry.js} +1 -1
  257. package/dist/twilight/p-3f6fac09.entry.js +4 -0
  258. package/dist/twilight/{p-2798756b.entry.js → p-44bf6cdf.entry.js} +1 -1
  259. package/dist/twilight/{p-70e2d99d.entry.js → p-466fa362.entry.js} +1 -1
  260. package/dist/twilight/{p-4364da4b.entry.js → p-4c36ba4c.entry.js} +1 -1
  261. package/dist/twilight/{p-0e24390e.entry.js → p-4cc9583f.entry.js} +1 -1
  262. package/dist/twilight/{p-01277c1f.entry.js → p-4d46bd3d.entry.js} +1 -1
  263. package/dist/twilight/{p-1daa6531.entry.js → p-4e213aab.entry.js} +1 -1
  264. package/dist/twilight/{p-90929ee0.entry.js → p-500f0db8.entry.js} +1 -1
  265. package/dist/twilight/{p-b775c3a7.entry.js → p-50365a49.entry.js} +1 -1
  266. package/dist/twilight/{p-44ce2c67.entry.js → p-5555817c.entry.js} +1 -1
  267. package/dist/twilight/{p-d171016f.entry.js → p-584817e5.entry.js} +1 -1
  268. package/dist/twilight/{p-31d66e74.entry.js → p-59dbe5f1.entry.js} +1 -1
  269. package/dist/twilight/{p-2dbea343.entry.js → p-5c5f4f73.entry.js} +1 -1
  270. package/dist/twilight/{p-6c0de09b.entry.js → p-60a7b50b.entry.js} +1 -1
  271. package/dist/twilight/{p-764b05c3.entry.js → p-61cd30d3.entry.js} +1 -1
  272. package/dist/twilight/{p-6d989923.entry.js → p-6204462a.entry.js} +1 -1
  273. package/dist/twilight/{p-e8cc3acd.entry.js → p-630e769f.entry.js} +1 -1
  274. package/dist/twilight/{p-92cf1e0d.entry.js → p-65d86157.entry.js} +1 -1
  275. package/dist/twilight/{p-ce888cc2.entry.js → p-6bbc3c94.entry.js} +1 -1
  276. package/dist/twilight/{p-f9f3639d.entry.js → p-71344ddc.entry.js} +1 -1
  277. package/dist/twilight/{p-811d6f89.entry.js → p-72e4ef6a.entry.js} +1 -1
  278. package/dist/twilight/{p-fcfd176b.entry.js → p-761165fd.entry.js} +1 -1
  279. package/dist/twilight/{p-a26fb2b5.entry.js → p-797a7c1e.entry.js} +1 -1
  280. package/dist/twilight/{p-32f66a87.entry.js → p-7edb518f.entry.js} +1 -1
  281. package/dist/twilight/{p-82e55dfd.entry.js → p-85819cea.entry.js} +1 -1
  282. package/dist/twilight/{p-453ac18c.entry.js → p-879de784.entry.js} +1 -1
  283. package/dist/twilight/{p-8d2a1e57.entry.js → p-882128d2.entry.js} +1 -1
  284. package/dist/twilight/{p-bbad7f4d.entry.js → p-8993c586.entry.js} +1 -1
  285. package/dist/twilight/{p-e14dc1a9.entry.js → p-89ff463e.entry.js} +1 -1
  286. package/dist/twilight/{p-24901c56.entry.js → p-8a3cb52e.entry.js} +1 -1
  287. package/dist/twilight/{p-2b52c465.entry.js → p-8bb53ed2.entry.js} +2 -2
  288. package/dist/twilight/{p-f1639848.entry.js → p-8f7579e4.entry.js} +1 -1
  289. package/dist/twilight/{p-ff58cb8e.entry.js → p-9445f844.entry.js} +1 -1
  290. package/dist/twilight/{p-b53f24e0.entry.js → p-961941f2.entry.js} +1 -1
  291. package/dist/twilight/{p-6aa57467.entry.js → p-96fff354.entry.js} +1 -1
  292. package/dist/twilight/{p-2db47792.entry.js → p-97f12f7b.entry.js} +1 -1
  293. package/dist/twilight/{p-b9228f9e.entry.js → p-99228024.entry.js} +1 -1
  294. package/dist/twilight/{p-7622f77e.entry.js → p-9a9d4676.entry.js} +1 -1
  295. package/dist/twilight/{p-edae5524.entry.js → p-9bd015e5.entry.js} +1 -1
  296. package/dist/twilight/{p-DOQPe4jW.js → p-BGqFcZFD.js} +1 -1
  297. package/dist/twilight/{p-D6U543Hv.js → p-BJ2QKyWM.js} +1 -1
  298. package/dist/twilight/{p-CfrlyZxh.js → p-BOmRCp86.js} +1 -1
  299. package/dist/twilight/{p-CQ_QHwLy.js → p-BVtJp-gU.js} +1 -1
  300. package/dist/twilight/p-Bdz016Fy.js +4 -0
  301. package/dist/twilight/{p-CK_JEpA3.js → p-By36wPtc.js} +1 -1
  302. package/dist/twilight/{p-BdU8gNuL.js → p-CnIis-ob.js} +1 -1
  303. package/dist/twilight/{p-Bmtik9Kw.js → p-DkALFehO.js} +1 -1
  304. package/dist/twilight/{p-N0-g_Ku2.js → p-DmcP-9uS.js} +2 -2
  305. package/dist/twilight/p-DxnArMXe.js +4 -0
  306. package/dist/twilight/{p-3Tx29o41.js → p-HiDU1qAC.js} +1 -1
  307. package/dist/twilight/{p-Dm54yhRt.js → p-LKlIr4DH.js} +1 -1
  308. package/dist/twilight/{p-e775748f.entry.js → p-a435c54c.entry.js} +1 -1
  309. package/dist/twilight/{p-6417da90.entry.js → p-b063d0f3.entry.js} +1 -1
  310. package/dist/twilight/{p-d8d26e4b.entry.js → p-b1b11ebb.entry.js} +1 -1
  311. package/dist/twilight/{p-6fe98a4d.entry.js → p-b46bd39f.entry.js} +1 -1
  312. package/dist/twilight/{p-4467ceb0.entry.js → p-b5c106ac.entry.js} +1 -1
  313. package/dist/twilight/{p-f351fca5.entry.js → p-b6ce3117.entry.js} +1 -1
  314. package/dist/twilight/{p-8e05dbd7.entry.js → p-b76720e1.entry.js} +1 -1
  315. package/dist/twilight/{p-b089053b.entry.js → p-bb242f20.entry.js} +1 -1
  316. package/dist/twilight/{p-bd31410b.entry.js → p-beaf3f78.entry.js} +1 -1
  317. package/dist/twilight/{p-865393ae.entry.js → p-c06229a1.entry.js} +1 -1
  318. package/dist/twilight/{p-1ca4cb0a.entry.js → p-c06ab3be.entry.js} +1 -1
  319. package/dist/twilight/{p-083bc1c5.entry.js → p-c1036ebd.entry.js} +1 -1
  320. package/dist/twilight/{p-08c61694.entry.js → p-c19412a4.entry.js} +1 -1
  321. package/dist/twilight/{p-8493acd8.entry.js → p-c7c2dad0.entry.js} +1 -1
  322. package/dist/twilight/{p-d34ee17e.entry.js → p-cf3b863c.entry.js} +1 -1
  323. package/dist/twilight/{p-879904a5.entry.js → p-cf95b06d.entry.js} +1 -1
  324. package/dist/twilight/{p-042fe473.entry.js → p-cffe12a3.entry.js} +1 -1
  325. package/dist/twilight/{p-d8909798.entry.js → p-d477d0ab.entry.js} +1 -1
  326. package/dist/twilight/p-d81ee10d.entry.js +4 -0
  327. package/dist/twilight/{p-282d3b67.entry.js → p-de14bb3d.entry.js} +1 -1
  328. package/dist/twilight/{p-fcc76e96.entry.js → p-dfea079f.entry.js} +1 -1
  329. package/dist/twilight/{p-d9a53204.entry.js → p-e407d576.entry.js} +1 -1
  330. package/dist/twilight/{p-5acbcd72.entry.js → p-e6ae56e1.entry.js} +1 -1
  331. package/dist/twilight/{p-f6b097ee.entry.js → p-ebaa623e.entry.js} +1 -1
  332. package/dist/twilight/{p-074f8d80.entry.js → p-ec1730a3.entry.js} +1 -1
  333. package/dist/twilight/{p-066b78d8.entry.js → p-eea93ac7.entry.js} +1 -1
  334. package/dist/twilight/{p-71aeefcf.entry.js → p-eed700e7.entry.js} +1 -1
  335. package/dist/twilight/{p-2ca2dc2a.entry.js → p-ef4a0ae4.entry.js} +1 -1
  336. package/dist/twilight/{p-be71261f.entry.js → p-f418df90.entry.js} +1 -1
  337. package/dist/twilight/{p-4c3b7f11.entry.js → p-f4733e21.entry.js} +1 -1
  338. package/dist/twilight/{p-c88af64d.entry.js → p-f5154b22.entry.js} +1 -1
  339. package/dist/twilight/{p-d594a28c.entry.js → p-fd33515c.entry.js} +1 -1
  340. package/dist/twilight/{p-bf7b92c5.entry.js → p-fe40bb32.entry.js} +1 -1
  341. package/dist/twilight/{p-Bsy6Ioog.js → p-j2CozAo8.js} +1 -1
  342. package/dist/twilight/twilight.esm.js +1 -1
  343. package/dist/types/components/salla-bullet-delivery/salla-bullet-delivery.d.ts +16 -0
  344. package/dist/types/components/salla-map/salla-map.d.ts +15 -0
  345. package/dist/types/components/salla-tel-input/salla-tel-input.d.ts +3 -0
  346. package/dist/types/components.d.ts +4 -0
  347. package/package.json +6 -6
  348. package/dist/cjs/index-D5DmfeX9.js +0 -1714
  349. package/dist/components/index3.js +0 -1712
  350. package/dist/esm/index-DPAGXd41.js +0 -1712
  351. package/dist/twilight/p-8a789d76.entry.js +0 -4
  352. package/dist/twilight/p-96d471a9.entry.js +0 -4
  353. package/dist/twilight/p-C_YmM4Ke.js +0 -4
  354. package/dist/twilight/p-a7643570.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 r,H as a}from"./p-Dm54yhRt.js";import{S as s}from"./p-D4oPi1Ov.js";const e=new Map,o=new Map;function i(t){return t?Array.isArray(t)?t:Object.values(t):[]}const n=class{constructor(r){t(this,r),this.loadedFactors=[]}async componentWillLoad(){await salla.onReady(),await this.loadFactors()}async onPropsChange(){await this.loadFactors()}getDisplayFactors(){return this.factors?.length?this.factors:this.loadedFactors}async loadFactors(){if(this.factors?.length)this.loadedFactors=[];else if(this.orderId)try{const t=await async function(t){if(!t)return null;const r=e.get(t);if(r&&Date.now()-r.timestamp<=3e5)return r.data;const a=o.get(t);if(a)return a;const s=(async()=>{try{const r=await salla.api.request(`orders/${t}`,"","get"),a=r?.data??r;return e.set(t,{data:a,timestamp:Date.now()}),a}catch(r){throw e.delete(t),r}finally{o.delete(t)}})();return o.set(t,s),s}(this.orderId);this.loadedFactors=function(t,r,a,s){var e;const o=function(t,r,a,s){return t.find((t=>!(!r||Number(t.id??t.feedback_id)!==Number(r))||!(!s||Number(t.order_item_id)!==Number(s))||!(!a||Number(t.product_id??t.product?.id)!==Number(a))))}((e=t?.rating,e?[...i(e.product),...i(e.products)]:[]),r,a,s);return function(t){if(!t)return[];for(const r of["factor_reviews","review_factors","factors"]){const a=t[r];if(Array.isArray(a)&&a.length)return a}return[]}(o)}(t,this.ratingId,this.productId,this.itemId)}catch(t){console.error("[salla-review-factors-tags] failed to load order rating factors",t),this.loadedFactors=[]}else this.loadedFactors=[]}renderFactorTags(){const t=this.getDisplayFactors();return t.length?r("div",{class:"s-review-factors-tags-factors"},t.map((t=>r("div",{class:"s-review-factors-tags-factor-tag"},r("span",{class:"s-review-factors-tags-factor-name"},t.name),r("span",{class:"s-review-factors-tags-factor-star",innerHTML:s}),r("span",{class:"s-review-factors-tags-factor-rating"},t.rating||""))))):null}render(){return r(a,{key:"b9df42d369cd5a7c66d1275202a883f6dc8ac594",class:"s-review-factors-tags-wrapper"},this.renderFactorTags())}static get watchers(){return{factors:["onPropsChange"],orderId:["onPropsChange"],ratingId:["onPropsChange"],productId:["onPropsChange"],itemId:["onPropsChange"]}}};n.style=":host{display:inline-flex}.s-review-factors-tags-factors{display:flex;flex-wrap:wrap;gap:0.5rem;justify-content:flex-start;margin-bottom:0.6rem}.s-review-factors-tags-factor-tag{display:inline-flex;align-items:center;gap:0.25rem;border-radius:999px;border:1px solid #e8e8e8;background:rgba(255, 255, 255, 0.3);font-size:0.85rem;line-height:1;padding:0.4rem 0.65rem}.s-review-factors-tags-factor-rating{font-weight:600;color:var(--color-primary) !important}.s-review-factors-tags-factor-star{display:inline-flex;width:0.8rem;height:0.8rem;fill:var(--color-primary) !important}.s-review-factors-tags-factor-star svg{width:100%;height:100%}.s-review-factors-tags-factor-name{color:var(--main-text-color) !important;font-weight:unset !important}";export{n as salla_review_factors_tags}
4
+ import{r as t,h as r,H as a}from"./p-LKlIr4DH.js";import{S as s}from"./p-D4oPi1Ov.js";const e=new Map,o=new Map;function i(t){return t?Array.isArray(t)?t:Object.values(t):[]}const n=class{constructor(r){t(this,r),this.loadedFactors=[]}async componentWillLoad(){await salla.onReady(),await this.loadFactors()}async onPropsChange(){await this.loadFactors()}getDisplayFactors(){return this.factors?.length?this.factors:this.loadedFactors}async loadFactors(){if(this.factors?.length)this.loadedFactors=[];else if(this.orderId)try{const t=await async function(t){if(!t)return null;const r=e.get(t);if(r&&Date.now()-r.timestamp<=3e5)return r.data;const a=o.get(t);if(a)return a;const s=(async()=>{try{const r=await salla.api.request(`orders/${t}`,"","get"),a=r?.data??r;return e.set(t,{data:a,timestamp:Date.now()}),a}catch(r){throw e.delete(t),r}finally{o.delete(t)}})();return o.set(t,s),s}(this.orderId);this.loadedFactors=function(t,r,a,s){var e;const o=function(t,r,a,s){return t.find((t=>!(!r||Number(t.id??t.feedback_id)!==Number(r))||!(!s||Number(t.order_item_id)!==Number(s))||!(!a||Number(t.product_id??t.product?.id)!==Number(a))))}((e=t?.rating,e?[...i(e.product),...i(e.products)]:[]),r,a,s);return function(t){if(!t)return[];for(const r of["factor_reviews","review_factors","factors"]){const a=t[r];if(Array.isArray(a)&&a.length)return a}return[]}(o)}(t,this.ratingId,this.productId,this.itemId)}catch(t){console.error("[salla-review-factors-tags] failed to load order rating factors",t),this.loadedFactors=[]}else this.loadedFactors=[]}renderFactorTags(){const t=this.getDisplayFactors();return t.length?r("div",{class:"s-review-factors-tags-factors"},t.map((t=>r("div",{class:"s-review-factors-tags-factor-tag"},r("span",{class:"s-review-factors-tags-factor-name"},t.name),r("span",{class:"s-review-factors-tags-factor-star",innerHTML:s}),r("span",{class:"s-review-factors-tags-factor-rating"},t.rating||""))))):null}render(){return r(a,{key:"b9df42d369cd5a7c66d1275202a883f6dc8ac594",class:"s-review-factors-tags-wrapper"},this.renderFactorTags())}static get watchers(){return{factors:["onPropsChange"],orderId:["onPropsChange"],ratingId:["onPropsChange"],productId:["onPropsChange"],itemId:["onPropsChange"]}}};n.style=":host{display:inline-flex}.s-review-factors-tags-factors{display:flex;flex-wrap:wrap;gap:0.5rem;justify-content:flex-start;margin-bottom:0.6rem}.s-review-factors-tags-factor-tag{display:inline-flex;align-items:center;gap:0.25rem;border-radius:999px;border:1px solid #e8e8e8;background:rgba(255, 255, 255, 0.3);font-size:0.85rem;line-height:1;padding:0.4rem 0.65rem}.s-review-factors-tags-factor-rating{font-weight:600;color:var(--color-primary) !important}.s-review-factors-tags-factor-star{display:inline-flex;width:0.8rem;height:0.8rem;fill:var(--color-primary) !important}.s-review-factors-tags-factor-star svg{width:100%;height:100%}.s-review-factors-tags-factor-name{color:var(--main-text-color) !important;font-weight:unset !important}";export{n as salla_review_factors_tags}
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r as e,c as t,h as s,H as i}from"./p-Dm54yhRt.js";import{a}from"./p-BedNk7k1.js";import{a as l}from"./p-B9q7ymSg.js";const r=class{constructor(s){e(this,s),this.changed=t(this,"changed"),this.min=0,this.max=1e4,this.moreThanLabel="أكثر من",this.lessThanLabel="أقل من",this.toLabel="الى",this.fromLabel="من",this.typing=!1,this.isMin=!1,this.isRTL=salla.config.get("theme.is_rtl",!0),this.filterValues=[]}connectedCallback(){if(this.filtersData&&this.filtersData?.price&&(this.minPrice=this.filtersData.price.min,this.maxPrice=this.filtersData.price.max),salla.lang.onLoaded((()=>{this.moreThanLabel=salla.lang.getWithDefault("common.elements.more_than",this.moreThanLabel),this.lessThanLabel=salla.lang.getWithDefault("common.elements.less_than",this.lessThanLabel),this.toLabel=salla.lang.getWithDefault("common.elements.to",this.toLabel),this.fromLabel=salla.lang.getWithDefault("common.elements.from",this.fromLabel)})),1==this.option.values.length)return;if(this.option.values.length<=5)return void(this.filterValues=this.option.values);const e=Math.ceil(this.option.values.length/5);for(let t=0;t<this.option.values.length;t+=e)this.filterValues.push(this.option.values.slice(t,t+e).reduce(((e,t)=>(e.to=t.to,e.count+=t.count,e))))}async reset(){this.minInput.value=null,this.maxInput.value=null,this.minPrice=null,this.maxPrice=null}getPriceLabel(e){return isNaN(e.from)||e.from<1?`${this.lessThanLabel} ${salla.money(e.to)}`:isNaN(e.to)||e.to<1?`${this.moreThanLabel} ${salla.money(e.from)}`:`${salla.money(e.from)} ${this.toLabel} ${salla.money(e.to)}`}minInputValidation(e){e&&(e>this.max||this.maxPrice&&e>this.maxPrice)||(e<this.min?this.minPrice=this.min:e&&(this.minPrice=e))}maxInputValidation(e){e&&(e<this.min||this.minPrice&&e<this.minPrice)||e>this.max&&(this.maxPrice=this.max)}async changedEventHandler(e){salla.helpers.inputDigitsOnly(this.minInput),salla.helpers.inputDigitsOnly(this.maxInput);const t=this.minPrice?1*+this.minPrice:null,s=this.maxPrice?1*+this.maxPrice:null;this.maxPrice||(this.maxPrice=""),this.isMin?this.minInputValidation(t):(this.minPrice||(this.minPrice=0),this.maxInputValidation(s)),this.isReady&&this.changed.emit({event:e,option:this.option,value:{max:this.maxPrice,min:this.minPrice}})}handleMinMaxPrice(e,t){this.minPrice=t.from,this.maxPrice="*"!==t.to?t.to:"",this.changedEventHandler(e)}isChecked(e){return!(!this.minPrice&&!this.maxPrice)&&(((e.from<1||"*"==e.from)&&0==this.minPrice||e.from==this.minPrice)&&("*"==e.to||!e.to||e.to==this.maxPrice))}handleMinPrice(e){this.isMin=!0;const t=e.target.value;this.minPrice=""===t?0:t}handleMaxPrice(e){this.isMin=!1;const t=e.target.value;this.maxPrice=void 0===t?"":t}render(){return s(i,{key:"dc74966c1d2d9e5626b23db0a80b693fef047f41"},this.filterValues.map(((e,t)=>s("label",{class:"s-filters-label",htmlFor:`${this.option.key}-${t}`,key:t},s("input",{id:`${this.option.key}-${t}`,name:"price",type:"radio",checked:this.isChecked(e),class:"s-filters-radio",onChange:t=>this.handleMinMaxPrice(t,e)}),s("span",{innerHTML:this.getPriceLabel(e)})))),s("div",{key:"b12dad0c27f3fbe9ad8a9c98b9bd1302388b35ef",class:"flex justify-center items-center"},s("div",{key:"e034058e195a94c2434e99c5b30b2e5909daff87",class:"relative max-w-xl w-full"},s("div",{key:"4c59f5a3c8249717c4c6decbcdb63d97343bd871",class:"s-price-range-inputs"},s("div",{key:"65de0733e3ce1ea7b37976f1d077d1f3192056c5",class:"s-price-range-relative"},s("div",{key:"ed842802aff5cd874e708c062aa79e8185d330f3",class:"s-price-range-currency"}," ",salla.config.currency().symbol),s("input",{key:"78d020948e3edc4e53fff976fa8e00b2e6ac6868",type:"number",maxlength:"5",ref:e=>this.minInput=e,onBlur:e=>this.handleMinPrice(e),value:this.minPrice,placeholder:this.fromLabel,class:"s-price-range-number-input"})),s("div",{key:"edfb3dd62b7898d4493a1adefeee20bdb305c89a",class:"s-price-range-gray-text"}," -"),s("div",{key:"f2227f09a344b8cc8c1160c23a6dbc9cd96cb260",class:"s-price-range-relative"},s("div",{key:"e528e7766eb7f6b9e0791116c87374441c73afe6",class:"s-price-range-currency"}," ",salla.config.currency().symbol),s("input",{key:"6dda7a17097ae51c50c3d4aae290ce1b0369dcfa",type:"number",maxlength:"5",ref:e=>this.maxInput=e,onBlur:e=>this.handleMaxPrice(e),value:this.maxPrice,placeholder:this.toLabel,class:"s-price-range-number-input","aria-describedby":"price-currency"})),s("salla-button",{key:"970d39060c565e7dc18e6a2039452a3b3df04082",color:"gray",shape:"icon",size:"small",fill:"outline",onClick:e=>this.changedEventHandler(e)},s("span",{key:"da9b6ed688a64d624eedc3834ad3be47533c9dd5",innerHTML:this.isRTL?a:l}))))))}componentDidLoad(){this.isReady=!0}};r.style=":host{display:block}.rtl .rtl-range-slider,[dir=rtl] .rtl-range-slider{transform:rotateY(180deg)}.rtl .rtl-range-numbers,[dir=rtl] .rtl-range-numbers{flex-direction:row-reverse}.rtl .form-select,.rtl select,[dir=rtl] .form-select,[dir=rtl] select{background-position:left 0.5rem center;padding-right:12px}.rtl .menu-divide li:not(:last-child):after,[dir=rtl] .menu-divide li:not(:last-child):after{left:0;right:auto}input[type=range]::-webkit-slider-thumb{pointer-events:all;width:24px;height:24px;-webkit-appearance:none}[type=checkbox]:checked{background-size:80%}";export{r as salla_price_range}
4
+ import{r as e,c as t,h as s,H as i}from"./p-LKlIr4DH.js";import{a}from"./p-BedNk7k1.js";import{a as l}from"./p-B9q7ymSg.js";const r=class{constructor(s){e(this,s),this.changed=t(this,"changed"),this.min=0,this.max=1e4,this.moreThanLabel="أكثر من",this.lessThanLabel="أقل من",this.toLabel="الى",this.fromLabel="من",this.typing=!1,this.isMin=!1,this.isRTL=salla.config.get("theme.is_rtl",!0),this.filterValues=[]}connectedCallback(){if(this.filtersData&&this.filtersData?.price&&(this.minPrice=this.filtersData.price.min,this.maxPrice=this.filtersData.price.max),salla.lang.onLoaded((()=>{this.moreThanLabel=salla.lang.getWithDefault("common.elements.more_than",this.moreThanLabel),this.lessThanLabel=salla.lang.getWithDefault("common.elements.less_than",this.lessThanLabel),this.toLabel=salla.lang.getWithDefault("common.elements.to",this.toLabel),this.fromLabel=salla.lang.getWithDefault("common.elements.from",this.fromLabel)})),1==this.option.values.length)return;if(this.option.values.length<=5)return void(this.filterValues=this.option.values);const e=Math.ceil(this.option.values.length/5);for(let t=0;t<this.option.values.length;t+=e)this.filterValues.push(this.option.values.slice(t,t+e).reduce(((e,t)=>(e.to=t.to,e.count+=t.count,e))))}async reset(){this.minInput.value=null,this.maxInput.value=null,this.minPrice=null,this.maxPrice=null}getPriceLabel(e){return isNaN(e.from)||e.from<1?`${this.lessThanLabel} ${salla.money(e.to)}`:isNaN(e.to)||e.to<1?`${this.moreThanLabel} ${salla.money(e.from)}`:`${salla.money(e.from)} ${this.toLabel} ${salla.money(e.to)}`}minInputValidation(e){e&&(e>this.max||this.maxPrice&&e>this.maxPrice)||(e<this.min?this.minPrice=this.min:e&&(this.minPrice=e))}maxInputValidation(e){e&&(e<this.min||this.minPrice&&e<this.minPrice)||e>this.max&&(this.maxPrice=this.max)}async changedEventHandler(e){salla.helpers.inputDigitsOnly(this.minInput),salla.helpers.inputDigitsOnly(this.maxInput);const t=this.minPrice?1*+this.minPrice:null,s=this.maxPrice?1*+this.maxPrice:null;this.maxPrice||(this.maxPrice=""),this.isMin?this.minInputValidation(t):(this.minPrice||(this.minPrice=0),this.maxInputValidation(s)),this.isReady&&this.changed.emit({event:e,option:this.option,value:{max:this.maxPrice,min:this.minPrice}})}handleMinMaxPrice(e,t){this.minPrice=t.from,this.maxPrice="*"!==t.to?t.to:"",this.changedEventHandler(e)}isChecked(e){return!(!this.minPrice&&!this.maxPrice)&&(((e.from<1||"*"==e.from)&&0==this.minPrice||e.from==this.minPrice)&&("*"==e.to||!e.to||e.to==this.maxPrice))}handleMinPrice(e){this.isMin=!0;const t=e.target.value;this.minPrice=""===t?0:t}handleMaxPrice(e){this.isMin=!1;const t=e.target.value;this.maxPrice=void 0===t?"":t}render(){return s(i,{key:"dc74966c1d2d9e5626b23db0a80b693fef047f41"},this.filterValues.map(((e,t)=>s("label",{class:"s-filters-label",htmlFor:`${this.option.key}-${t}`,key:t},s("input",{id:`${this.option.key}-${t}`,name:"price",type:"radio",checked:this.isChecked(e),class:"s-filters-radio",onChange:t=>this.handleMinMaxPrice(t,e)}),s("span",{innerHTML:this.getPriceLabel(e)})))),s("div",{key:"b12dad0c27f3fbe9ad8a9c98b9bd1302388b35ef",class:"flex justify-center items-center"},s("div",{key:"e034058e195a94c2434e99c5b30b2e5909daff87",class:"relative max-w-xl w-full"},s("div",{key:"4c59f5a3c8249717c4c6decbcdb63d97343bd871",class:"s-price-range-inputs"},s("div",{key:"65de0733e3ce1ea7b37976f1d077d1f3192056c5",class:"s-price-range-relative"},s("div",{key:"ed842802aff5cd874e708c062aa79e8185d330f3",class:"s-price-range-currency"}," ",salla.config.currency().symbol),s("input",{key:"78d020948e3edc4e53fff976fa8e00b2e6ac6868",type:"number",maxlength:"5",ref:e=>this.minInput=e,onBlur:e=>this.handleMinPrice(e),value:this.minPrice,placeholder:this.fromLabel,class:"s-price-range-number-input"})),s("div",{key:"edfb3dd62b7898d4493a1adefeee20bdb305c89a",class:"s-price-range-gray-text"}," -"),s("div",{key:"f2227f09a344b8cc8c1160c23a6dbc9cd96cb260",class:"s-price-range-relative"},s("div",{key:"e528e7766eb7f6b9e0791116c87374441c73afe6",class:"s-price-range-currency"}," ",salla.config.currency().symbol),s("input",{key:"6dda7a17097ae51c50c3d4aae290ce1b0369dcfa",type:"number",maxlength:"5",ref:e=>this.maxInput=e,onBlur:e=>this.handleMaxPrice(e),value:this.maxPrice,placeholder:this.toLabel,class:"s-price-range-number-input","aria-describedby":"price-currency"})),s("salla-button",{key:"970d39060c565e7dc18e6a2039452a3b3df04082",color:"gray",shape:"icon",size:"small",fill:"outline",onClick:e=>this.changedEventHandler(e)},s("span",{key:"da9b6ed688a64d624eedc3834ad3be47533c9dd5",innerHTML:this.isRTL?a:l}))))))}componentDidLoad(){this.isReady=!0}};r.style=":host{display:block}.rtl .rtl-range-slider,[dir=rtl] .rtl-range-slider{transform:rotateY(180deg)}.rtl .rtl-range-numbers,[dir=rtl] .rtl-range-numbers{flex-direction:row-reverse}.rtl .form-select,.rtl select,[dir=rtl] .form-select,[dir=rtl] select{background-position:left 0.5rem center;padding-right:12px}.rtl .menu-divide li:not(:last-child):after,[dir=rtl] .menu-divide li:not(:last-child):after{left:0;right:auto}input[type=range]::-webkit-slider-thumb{pointer-events:all;width:24px;height:24px;-webkit-appearance:none}[type=checkbox]:checked{background-size:80%}";export{r as salla_price_range}
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r as s,c as t,h as i,H as e,a as h}from"./p-Dm54yhRt.js";import{e as r}from"./p-DzAIgzdz.js";const l=class{constructor(i){s(this,i),this.verified=t(this,"verified"),this.translationLoaded=!1,this.display="modal",this.type="mobile",this.autoReload=!0,this.supportWebAuth=!0,this.resendAfter=30,this.isProfileVerify=!1,salla.lang.onLoaded((()=>{this.translationLoaded=!0,this.title=salla.lang.get("pages.profile.verify_title")+salla.lang.get("common.elements."+this.type),this.modal?.setTitle(this.title)})),"inline"!=this.display?(salla.event.on("profile::verification",(s=>{let t=Array.isArray(s)?s[0]:s;"delete_account"===t?.request_type||document.getElementById("salla-user-settings-delete-modal")?.hasAttribute("visible")||(this.isProfileVerify=!0,this.open(t),this.title=salla.lang.get("pages.profile.verify_title")+salla.lang.get("common.elements."+t.type),this.modal?.setTitle(this.title))})),salla.event.on("modalClosed",(()=>{this.resendAfter=0,this.timer.innerHTML="30 : 00"}))):this.modal={open:()=>"",close:()=>"",setTitle:()=>""}}splitNumber(s){this.resetError();let t=s.data||s.target.value;t&&1!==t.length&&this.modifyNext(s.target,t)}modifyNext(s,t){s.value=t[0],t=t.substring(1),s.nextElementSibling&&t.length?this.modifyNext(s.nextElementSibling,t):s.nextElementSibling||0!==t.length?s.nextElementSibling&&0===t.length&&s.nextElementSibling.focus():s.focus()}checkAllInputs(){let s=!0;for(let t=0;t<this.otpInputs.length;t++)""===this.otpInputs[t].value&&(s=!1);return s}handleKeyUp(s){if(this.resetError(),["Alt","Shift","Control","AltGraph","Ctrl"].includes(s.key))return;let t=s.keyCode||s.charCode;s.target.value?(s.target.nextElementSibling?.focus(),s.target.nextElementSibling?.select()):[8,46].includes(t)&&(s.target.previousElementSibling?.focus(),s.target.previousElementSibling?.select()),s.target.value.length>1&&this.splitNumber(s)}handlePaste(s){this.resetError();let t=(salla.helpers.number(s.clipboardData.getData("text"))||"").replace(/[^0-9]/g,"");t=t.substring(0,this.otpInputs.length),this.otpInputs.forEach((s=>s.value="")),this.modifyNext(this.otpInputs[0],t)}handleInput(s){this.resetError(),salla.helpers.inputDigitsOnly(s.target),this.checkAllInputs()&&setTimeout((()=>{this.toggleOTPSubmit()}),100)}resetError(){this.hasError=!1,this.errorMessage=""}handleFocus(s){s.target!==this.firstOtpInput&&(""==this.firstOtpInput?.value&&this.firstOtpInput.focus(),""==s.target.previousElementSibling.value&&s.target.previousElementSibling.focus())}async getCode(){return this.code.value}async open(s){this.data=s,this.data.type=this.data.type||this.type,this.type=this.data.type,this.resendTimer(),this.otpInputs=this.body.querySelectorAll(".s-verify-input"),this.firstOtpInput=this.body.querySelector("#otp-1"),this.reset(),this.resetError(),"modal"==this.display&&this.modal?.setTitle(this.title),this.modal.open(),this.firstOtpInput?.addEventListener("input",(s=>this.splitNumber(s))),setTimeout((()=>this.otpInputs[0].focus()),100)}toggleOTPSubmit(){let s=[];if(this.otpInputs.forEach((t=>t.value&&s.push(t.value))),this.code.value=s.join(""),4===s.length)return this.btn.disable(),void this.btn.click();this.btn.enable()}reset(){this.otpInputs.forEach((s=>s.value="")),this.code.value="",this.otpInputs[0].focus()}resendTimer(){this.resendMessage.style.display="block",this.resend.style.display="none",this.resendAfter=30;let s=setInterval((()=>{this.resendAfter<=0?(clearInterval(s),this.resend.style.display="block",this.resendMessage.style.display="none"):(this.timer.innerHTML=`${this.resendAfter>=10?this.resendAfter:"0"+this.resendAfter} : 00`,this.resendAfter--)}),1e3)}resendCode(){return this.btn.stop().then((()=>this.btn.disable())).then((()=>{this.otpInputs.forEach((s=>s.value="")),this.otpInputs[0].focus()})).then((()=>salla.api.auth.resend(this.data))).finally((()=>this.resendTimer()))}submit(){if(this.code.value.length<4)return this.otpInputs[this.code.value.length].focus(),void salla.log("Trying to submit without 4 digits!");let s={code:this.code.value,...this.data};return this.btn.load().then((()=>this.btn.disable())).then((()=>this.isProfileVerify?salla.profile.verify(s):salla.auth.verify(s,this.supportWebAuth))).then((s=>this.verified.emit(s))).then((()=>this.btn.stop()&&this.btn.disable())).then((()=>this.modal.close())).then((()=>this.autoReload&&window.location.reload())).catch((s=>{this.hasError=!0,this.errorMessage=s.response?.data?.error?.message||salla.lang.get("common.errors.error_occurred"),s.response?salla.logger.error(s):console.log("Unexpected error",s),this.btn.stop()&&this.btn.enable()&&this.reset()}))}render(){return"inline"==this.display?i(e,null,this.myBody()):i("salla-modal",{width:"xs",class:"s-verify",ref:s=>this.modal=s,"modal-title":this.title},i("span",{slot:"icon",class:"s-verify-header-icon",innerHTML:"mobile"==this.type?'\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>android-phone</title>\n<path d="M22.667 0h-13.333c-2.941 0-5.333 2.392-5.333 5.333v21.333c0 2.941 2.392 5.333 5.333 5.333h13.333c2.941 0 5.333-2.392 5.333-5.333v-21.333c0-2.941-2.392-5.333-5.333-5.333zM25.333 26.667c0 1.471-1.196 2.667-2.667 2.667h-13.333c-1.471 0-2.667-1.196-2.667-2.667v-2.667h18.667zM25.333 21.333h-18.667v-16c0-1.471 1.196-2.667 2.667-2.667h13.333c1.471 0 2.667 1.196 2.667 2.667zM13.333 28h5.333c0.736 0 1.333-0.597 1.333-1.333s-0.597-1.333-1.333-1.333h-5.333c-0.736 0-1.333 0.597-1.333 1.333s0.597 1.333 1.333 1.333z"></path>\n</svg>\n':r}),this.myBody())}myBody(){return i("div",{class:"s-verify-body",ref:s=>this.body=s},i("div",{class:"s-verify-message",innerHTML:salla.lang.get("pages.profile.verify_message")}),i("slot",{name:"mobile"}),i("slot",{name:"email"}),i("input",{type:"hidden",name:"code",maxlength:"4",required:!0,ref:s=>this.code=s}),i("div",{class:{"s-verify-codes":!0,"has-error":this.hasError},dir:"ltr"},[1,2,3,4].map((s=>i("input",{type:"number",autocomplete:"one-time-code",pattern:"[0-9]*",inputmode:"numeric",maxlength:"1",value:"",id:`otp-${s}`,class:{"s-verify-input":!0,"s-has-error":this.hasError},onInput:s=>this.handleInput(s),onPaste:s=>this.handlePaste(s),onKeyUp:s=>this.handleKeyUp(s),onFocus:s=>this.handleFocus(s),required:!0})))),this.hasError&&this.errorMessage?i("span",{class:"s-verify-error-message"},this.errorMessage):"",i("div",{slot:"footer",class:"s-verify-footer"},i("salla-button",{class:"s-verify-submit","loader-position":"center",disabled:!0,onClick:()=>this.submit(),ref:s=>this.btn=s},salla.lang.get("pages.profile.verify")),i("p",{class:"s-verify-resend-message",ref:s=>this.resendMessage=s},salla.lang.get("blocks.header.resend_after"),i("b",{class:"s-verify-timer",ref:s=>this.timer=s})),i("a",{href:"#",class:"s-verify-resend",onClick:()=>this.resendCode(),ref:s=>this.resend=s},salla.lang.get("blocks.comments.submit"))),i("slot",{name:"after-footer"}))}get host(){return h(this)}};l.style="salla-verify{display:block}.s-verify-input{}.s-verify-input::-webkit-outer-spin-button,.s-verify-input::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}.s-verify-input[type=number]{-moz-appearance:textfield}";export{l as salla_verify}
4
+ import{r as s,c as t,h as i,H as e,a as h}from"./p-LKlIr4DH.js";import{e as r}from"./p-DzAIgzdz.js";const l=class{constructor(i){s(this,i),this.verified=t(this,"verified"),this.translationLoaded=!1,this.display="modal",this.type="mobile",this.autoReload=!0,this.supportWebAuth=!0,this.resendAfter=30,this.isProfileVerify=!1,salla.lang.onLoaded((()=>{this.translationLoaded=!0,this.title=salla.lang.get("pages.profile.verify_title")+salla.lang.get("common.elements."+this.type),this.modal?.setTitle(this.title)})),"inline"!=this.display?(salla.event.on("profile::verification",(s=>{let t=Array.isArray(s)?s[0]:s;"delete_account"===t?.request_type||document.getElementById("salla-user-settings-delete-modal")?.hasAttribute("visible")||(this.isProfileVerify=!0,this.open(t),this.title=salla.lang.get("pages.profile.verify_title")+salla.lang.get("common.elements."+t.type),this.modal?.setTitle(this.title))})),salla.event.on("modalClosed",(()=>{this.resendAfter=0,this.timer.innerHTML="30 : 00"}))):this.modal={open:()=>"",close:()=>"",setTitle:()=>""}}splitNumber(s){this.resetError();let t=s.data||s.target.value;t&&1!==t.length&&this.modifyNext(s.target,t)}modifyNext(s,t){s.value=t[0],t=t.substring(1),s.nextElementSibling&&t.length?this.modifyNext(s.nextElementSibling,t):s.nextElementSibling||0!==t.length?s.nextElementSibling&&0===t.length&&s.nextElementSibling.focus():s.focus()}checkAllInputs(){let s=!0;for(let t=0;t<this.otpInputs.length;t++)""===this.otpInputs[t].value&&(s=!1);return s}handleKeyUp(s){if(this.resetError(),["Alt","Shift","Control","AltGraph","Ctrl"].includes(s.key))return;let t=s.keyCode||s.charCode;s.target.value?(s.target.nextElementSibling?.focus(),s.target.nextElementSibling?.select()):[8,46].includes(t)&&(s.target.previousElementSibling?.focus(),s.target.previousElementSibling?.select()),s.target.value.length>1&&this.splitNumber(s)}handlePaste(s){this.resetError();let t=(salla.helpers.number(s.clipboardData.getData("text"))||"").replace(/[^0-9]/g,"");t=t.substring(0,this.otpInputs.length),this.otpInputs.forEach((s=>s.value="")),this.modifyNext(this.otpInputs[0],t)}handleInput(s){this.resetError(),salla.helpers.inputDigitsOnly(s.target),this.checkAllInputs()&&setTimeout((()=>{this.toggleOTPSubmit()}),100)}resetError(){this.hasError=!1,this.errorMessage=""}handleFocus(s){s.target!==this.firstOtpInput&&(""==this.firstOtpInput?.value&&this.firstOtpInput.focus(),""==s.target.previousElementSibling.value&&s.target.previousElementSibling.focus())}async getCode(){return this.code.value}async open(s){this.data=s,this.data.type=this.data.type||this.type,this.type=this.data.type,this.resendTimer(),this.otpInputs=this.body.querySelectorAll(".s-verify-input"),this.firstOtpInput=this.body.querySelector("#otp-1"),this.reset(),this.resetError(),"modal"==this.display&&this.modal?.setTitle(this.title),this.modal.open(),this.firstOtpInput?.addEventListener("input",(s=>this.splitNumber(s))),setTimeout((()=>this.otpInputs[0].focus()),100)}toggleOTPSubmit(){let s=[];if(this.otpInputs.forEach((t=>t.value&&s.push(t.value))),this.code.value=s.join(""),4===s.length)return this.btn.disable(),void this.btn.click();this.btn.enable()}reset(){this.otpInputs.forEach((s=>s.value="")),this.code.value="",this.otpInputs[0].focus()}resendTimer(){this.resendMessage.style.display="block",this.resend.style.display="none",this.resendAfter=30;let s=setInterval((()=>{this.resendAfter<=0?(clearInterval(s),this.resend.style.display="block",this.resendMessage.style.display="none"):(this.timer.innerHTML=`${this.resendAfter>=10?this.resendAfter:"0"+this.resendAfter} : 00`,this.resendAfter--)}),1e3)}resendCode(){return this.btn.stop().then((()=>this.btn.disable())).then((()=>{this.otpInputs.forEach((s=>s.value="")),this.otpInputs[0].focus()})).then((()=>salla.api.auth.resend(this.data))).finally((()=>this.resendTimer()))}submit(){if(this.code.value.length<4)return this.otpInputs[this.code.value.length].focus(),void salla.log("Trying to submit without 4 digits!");let s={code:this.code.value,...this.data};return this.btn.load().then((()=>this.btn.disable())).then((()=>this.isProfileVerify?salla.profile.verify(s):salla.auth.verify(s,this.supportWebAuth))).then((s=>this.verified.emit(s))).then((()=>this.btn.stop()&&this.btn.disable())).then((()=>this.modal.close())).then((()=>this.autoReload&&window.location.reload())).catch((s=>{this.hasError=!0,this.errorMessage=s.response?.data?.error?.message||salla.lang.get("common.errors.error_occurred"),s.response?salla.logger.error(s):console.log("Unexpected error",s),this.btn.stop()&&this.btn.enable()&&this.reset()}))}render(){return"inline"==this.display?i(e,null,this.myBody()):i("salla-modal",{width:"xs",class:"s-verify",ref:s=>this.modal=s,"modal-title":this.title},i("span",{slot:"icon",class:"s-verify-header-icon",innerHTML:"mobile"==this.type?'\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>android-phone</title>\n<path d="M22.667 0h-13.333c-2.941 0-5.333 2.392-5.333 5.333v21.333c0 2.941 2.392 5.333 5.333 5.333h13.333c2.941 0 5.333-2.392 5.333-5.333v-21.333c0-2.941-2.392-5.333-5.333-5.333zM25.333 26.667c0 1.471-1.196 2.667-2.667 2.667h-13.333c-1.471 0-2.667-1.196-2.667-2.667v-2.667h18.667zM25.333 21.333h-18.667v-16c0-1.471 1.196-2.667 2.667-2.667h13.333c1.471 0 2.667 1.196 2.667 2.667zM13.333 28h5.333c0.736 0 1.333-0.597 1.333-1.333s-0.597-1.333-1.333-1.333h-5.333c-0.736 0-1.333 0.597-1.333 1.333s0.597 1.333 1.333 1.333z"></path>\n</svg>\n':r}),this.myBody())}myBody(){return i("div",{class:"s-verify-body",ref:s=>this.body=s},i("div",{class:"s-verify-message",innerHTML:salla.lang.get("pages.profile.verify_message")}),i("slot",{name:"mobile"}),i("slot",{name:"email"}),i("input",{type:"hidden",name:"code",maxlength:"4",required:!0,ref:s=>this.code=s}),i("div",{class:{"s-verify-codes":!0,"has-error":this.hasError},dir:"ltr"},[1,2,3,4].map((s=>i("input",{type:"number",autocomplete:"one-time-code",pattern:"[0-9]*",inputmode:"numeric",maxlength:"1",value:"",id:`otp-${s}`,class:{"s-verify-input":!0,"s-has-error":this.hasError},onInput:s=>this.handleInput(s),onPaste:s=>this.handlePaste(s),onKeyUp:s=>this.handleKeyUp(s),onFocus:s=>this.handleFocus(s),required:!0})))),this.hasError&&this.errorMessage?i("span",{class:"s-verify-error-message"},this.errorMessage):"",i("div",{slot:"footer",class:"s-verify-footer"},i("salla-button",{class:"s-verify-submit","loader-position":"center",disabled:!0,onClick:()=>this.submit(),ref:s=>this.btn=s},salla.lang.get("pages.profile.verify")),i("p",{class:"s-verify-resend-message",ref:s=>this.resendMessage=s},salla.lang.get("blocks.header.resend_after"),i("b",{class:"s-verify-timer",ref:s=>this.timer=s})),i("a",{href:"#",class:"s-verify-resend",onClick:()=>this.resendCode(),ref:s=>this.resend=s},salla.lang.get("blocks.comments.submit"))),i("slot",{name:"after-footer"}))}get host(){return h(this)}};l.style="salla-verify{display:block}.s-verify-input{}.s-verify-input::-webkit-outer-spin-button,.s-verify-input::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}.s-verify-input[type=number]{-moz-appearance:textfield}";export{l as salla_verify}
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r as e,h as t,H as a}from"./p-Dm54yhRt.js";const c=class{constructor(t){e(this,t),this.href=void 0,this.target="_self"}generateClass(){return{"s-list-tile-item":!0,"s-list-tile-item-href":!!this.href}}render(){return t(a,{key:"b1b2a6bf65c40643d59f392e91cc76acaea5e89e"},t("a",{key:"4b2026fd739b243a41bfc37fcb55bc07a1a54636",class:this.generateClass(),href:this.href||"#",target:this.target,"aria-label":"List Tile Link"},t("div",{key:"bbc7a7133da0e471ad92a5466e9ec0481d74cdd7",class:"s-list-tile-item-icon"},t("slot",{key:"e4e338854bfc7e6843c4b87f419c9aa59970c77b",name:"icon"})),t("div",{key:"1b7b2e0a65193be521cdf6cccc314c83f853216d",class:"s-list-tile-item-content"},t("div",{key:"4e6a178d219827b1feef394ea5564769bf11ded2",class:"s-list-tile-item-title"},t("slot",{key:"75b036812aca3e00162fc8c40459b67d4db2cc6f",name:"title"})),t("div",{key:"ab0959a43214ae0eb4cf092ea3738c71ed987709",class:"s-list-tile-item-subtitle"},t("slot",{key:"e13f66fb2a0e1c5ab2a9081c808973c9f9ecca45",name:"subtitle"}))),t("div",{key:"78c7542367a41a1f8bc74bca73d2581f5c0b7bfd",class:"s-list-tile-item-action"},t("slot",{key:"14c8c0f31d29855d743b52f82d52a3bed300b25f",name:"action"}))))}};c.style="";export{c as salla_list_tile}
4
+ import{r as e,h as t,H as a}from"./p-LKlIr4DH.js";const c=class{constructor(t){e(this,t),this.href=void 0,this.target="_self"}generateClass(){return{"s-list-tile-item":!0,"s-list-tile-item-href":!!this.href}}render(){return t(a,{key:"b1b2a6bf65c40643d59f392e91cc76acaea5e89e"},t("a",{key:"4b2026fd739b243a41bfc37fcb55bc07a1a54636",class:this.generateClass(),href:this.href||"#",target:this.target,"aria-label":"List Tile Link"},t("div",{key:"bbc7a7133da0e471ad92a5466e9ec0481d74cdd7",class:"s-list-tile-item-icon"},t("slot",{key:"e4e338854bfc7e6843c4b87f419c9aa59970c77b",name:"icon"})),t("div",{key:"1b7b2e0a65193be521cdf6cccc314c83f853216d",class:"s-list-tile-item-content"},t("div",{key:"4e6a178d219827b1feef394ea5564769bf11ded2",class:"s-list-tile-item-title"},t("slot",{key:"75b036812aca3e00162fc8c40459b67d4db2cc6f",name:"title"})),t("div",{key:"ab0959a43214ae0eb4cf092ea3738c71ed987709",class:"s-list-tile-item-subtitle"},t("slot",{key:"e13f66fb2a0e1c5ab2a9081c808973c9f9ecca45",name:"subtitle"}))),t("div",{key:"78c7542367a41a1f8bc74bca73d2581f5c0b7bfd",class:"s-list-tile-item-action"},t("slot",{key:"14c8c0f31d29855d743b52f82d52a3bed300b25f",name:"action"}))))}};c.style="";export{c as salla_list_tile}
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r as e,c as a,h as t,H as s}from"./p-Dm54yhRt.js";const i=class{constructor(t){e(this,t),this.prizeItemSelected=a(this,"prizeItemSelected")}onPrizeItemClick(){this.prizeItemSelected.emit(this.item)}render(){return t(s,{key:"1a3463c51bf3e3e250f62b65d3a81815ec465923"},t("div",{key:"03bf4d3e35b10d17a325ca4ef280cb384f3a76f4",onClick:this.onPrizeItemClick.bind(this)},t("img",{key:"a4d319b2daec5cdfec1c85910edea10bc1d1ab6c",class:"s-loyalty-prize-item-image",src:this.item.image,alt:this.item.name}),t("div",{key:"52059fafc318c1f5a6b0289669083476650f8761",class:"s-loyalty-prize-item-title"},this.item.name),t("div",{key:"a3e14e2d1bd86dc3e7dbd2e6c5115e119af965e5",class:"s-loyalty-prize-item-subtitle"},this.item.description),t("div",{key:"55df95c028748c0387dc75dc4ad35c7285c907af",class:"s-loyalty-prize-item-points"},this.item.cost_points," ",salla.lang.get("pages.loyalty_program.point"))))}};i.style="salla-loyalty-prize-item:hover{box-shadow:0 5px 15px 1px rgba(0, 0, 0, 0.04) !important}";export{i as salla_loyalty_prize_item}
4
+ import{r as e,c as a,h as t,H as s}from"./p-LKlIr4DH.js";const i=class{constructor(t){e(this,t),this.prizeItemSelected=a(this,"prizeItemSelected")}onPrizeItemClick(){this.prizeItemSelected.emit(this.item)}render(){return t(s,{key:"1a3463c51bf3e3e250f62b65d3a81815ec465923"},t("div",{key:"03bf4d3e35b10d17a325ca4ef280cb384f3a76f4",onClick:this.onPrizeItemClick.bind(this)},t("img",{key:"a4d319b2daec5cdfec1c85910edea10bc1d1ab6c",class:"s-loyalty-prize-item-image",src:this.item.image,alt:this.item.name}),t("div",{key:"52059fafc318c1f5a6b0289669083476650f8761",class:"s-loyalty-prize-item-title"},this.item.name),t("div",{key:"a3e14e2d1bd86dc3e7dbd2e6c5115e119af965e5",class:"s-loyalty-prize-item-subtitle"},this.item.description),t("div",{key:"55df95c028748c0387dc75dc4ad35c7285c907af",class:"s-loyalty-prize-item-points"},this.item.cost_points," ",salla.lang.get("pages.loyalty_program.point"))))}};i.style="salla-loyalty-prize-item:hover{box-shadow:0 5px 15px 1px rgba(0, 0, 0, 0.04) !important}";export{i as salla_loyalty_prize_item}
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r as s,h as a,H as t,a as l}from"./p-Dm54yhRt.js";const i=class{constructor(a){s(this,a),this.apps=salla.config.get("store.apps"),this.appSlot=this.host.querySelector('[slot="app"]')?.innerHTML||'<img alt="{name}" src="{icon}" width="135" height="40" decoding="async" loading="lazy" />',salla.onReady((()=>{this.apps=salla.config.get("store.apps")})),salla.lang.onLoaded((()=>{this.appsTitle=salla.lang.get("blocks.footer.download_apps")}))}getAppsArray(){return Object.entries(this.apps).map((([s,a])=>({name:s,value:a})))}componentWillLoad(){return new Promise((s=>salla.onReady(s)))}render(){const s=this.getAppsArray();if(!Array.isArray(s)||s.length)return a(t,{class:"s-apps-icons"},!this.hideTitle&&a("h3",null,this.appsTitle),a("div",{class:{"s-apps-icons-list":!0,vertical:this.vertical}},s.map(((s,t)=>a("a",{key:t,href:s.value,rel:"noreferrer",target:"_blank",class:"s-apps-icons-item",id:"app-slot",innerHTML:this.appSlot.replace(/\{icon\}/g,salla.url.cdn(`images/${s.name}.png`)).replace(/\{name\}/g,s.name)})))))}componentDidRender(){this.host.querySelector('[slot="app"]')?.remove()}get host(){return l(this)}};i.style=":host{display:block}";export{i as salla_apps_icons}
4
+ import{r as s,h as a,H as t,a as l}from"./p-LKlIr4DH.js";const i=class{constructor(a){s(this,a),this.apps=salla.config.get("store.apps"),this.appSlot=this.host.querySelector('[slot="app"]')?.innerHTML||'<img alt="{name}" src="{icon}" width="135" height="40" decoding="async" loading="lazy" />',salla.onReady((()=>{this.apps=salla.config.get("store.apps")})),salla.lang.onLoaded((()=>{this.appsTitle=salla.lang.get("blocks.footer.download_apps")}))}getAppsArray(){return Object.entries(this.apps).map((([s,a])=>({name:s,value:a})))}componentWillLoad(){return new Promise((s=>salla.onReady(s)))}render(){const s=this.getAppsArray();if(!Array.isArray(s)||s.length)return a(t,{class:"s-apps-icons"},!this.hideTitle&&a("h3",null,this.appsTitle),a("div",{class:{"s-apps-icons-list":!0,vertical:this.vertical}},s.map(((s,t)=>a("a",{key:t,href:s.value,rel:"noreferrer",target:"_blank",class:"s-apps-icons-item",id:"app-slot",innerHTML:this.appSlot.replace(/\{icon\}/g,salla.url.cdn(`images/${s.name}.png`)).replace(/\{name\}/g,s.name)})))))}componentDidRender(){this.host.querySelector('[slot="app"]')?.remove()}get host(){return l(this)}};i.style=":host{display:block}";export{i as salla_apps_icons}
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r as t,c as s,h as i,H as e,a as r}from"./p-Dm54yhRt.js";import{a as o}from"./p-CgtvEd63.js";import{S as a}from"./p-DiKTtDW5.js";import{H as l}from"./p-XnA1YTjA.js";const n=class{constructor(i){t(this,i),this.productsFetched=s(this,"productsFetched"),this.selectionChanged=s(this,"selectionChanged"),this.autoload=!1,this.productCardComponent="custom-salla-product-card",this.selectable=!1,this.page=1,this.placeholderText=salla.lang.get("pages.categories.no_products"),this.endOfText=salla.lang.get("common.elements.end_of_content"),this.failedLoadMore=salla.lang.get("common.elements.failed_to_load_more"),this.currentPage=salla.config.get("page"),this.filtersSnapshot=[],this.selectedProducts=new Map,this.lastViewedProductKey="lastViewedProductId",this.filtersKey="filters",this.infiniteScrollStateKey="infiniteScrollState",this.prevCategoryIdKey="prevCategoryId",this.isProcessing=!1,this.scrollTimeout=null,this.boundScrollToLastViewedProduct=()=>this.scrollToLastViewedProduct(),this.boundHandleScroll=()=>this.handleScroll(),this.specialPagesWithoutIds={"product.index.latest":"latest","product.index.offers":"offers","product.index.search":"search","product.index.sales":"sales"},this.onWishlistItemRemoved=(t,s)=>{if("wishlist"!==this.getSource()||!this.wrapper)return;const i=String(s),e=this.hasCustomComponent?this.productCardComponent:"salla-product-card";for(const t of Array.from(this.wrapper.children)){const s=t,r=t.querySelector(e),o=s.product?.id??r?.product?.id;if(null!=o&&String(o)===i){t.remove();break}}for(const t of Array.from(this.wrapper.children)){if(!t.classList.contains("s-products-list-selectable-item"))continue;const s=t;if(null!=s.product?.id&&String(s.product.id)===i&&!t.querySelector(e)){t.remove();break}}if(this.selectable){for(const t of Array.from(this.selectedProducts.keys()))String(t)===i&&this.selectedProducts.delete(t);this.emitSelection()}},this.onWishlistStorageSynced=()=>l.syncWishlistIcons(this.wrapper,`${this.productCardComponent}, salla-product-card`),this.includes=l.parseJson(this.includes||this.host.getAttribute("includes")),Array.isArray(this.includes)||(this.includes=null),l.setIncludes(this.includes),salla.lang.onLoaded((()=>{this.placeholderText=salla.lang.get("pages.categories.no_products"),this.endOfText=salla.lang.get("common.elements.end_of_content"),this.failedLoadMore=salla.lang.get("common.elements.failed_to_load_more"),this.currentPage=salla.config.get("page")}))}connectedCallback(){"scrollRestoration"in history&&(history.scrollRestoration="manual"),window.addEventListener("DOMContentLoaded",this.boundScrollToLastViewedProduct),salla.event.on("salla-filters::changed",(t=>this.setFilters(t))),salla.event.on("wishlist::removed",this.onWishlistItemRemoved),salla.event.on("wishlist::storage.synced",this.onWishlistStorageSynced)}disconnectedCallback(){window.removeEventListener("DOMContentLoaded",this.boundScrollToLastViewedProduct),window.removeEventListener("scroll",this.boundHandleScroll),salla.event.off("wishlist::removed",this.onWishlistItemRemoved),salla.event.off("wishlist::storage.synced",this.onWishlistStorageSynced)}async setFilters(t){if(t&&JSON.stringify(t)!==JSON.stringify(this.parsedFilters))return window.scrollTo({top:0,behavior:"smooth"}),this.parsedFilters=JSON.parse(JSON.stringify(t)),"product.index"==this.currentPage?.slug&&(this.currentCategoryIdFilter=this.parsedFilters?.category_id?this.toCategoryIdFilter(this.parsedFilters.category_id):null),this.reload()}async reload(){!this.autoload&&this.loadMoreWrapper&&(this.loadMoreWrapper.style.display="none"),this.hasInfiniteScroll&&salla.infiniteScroll.destroy(this.infiniteScroll),await this.buildNextPageUrl(),this.wrapper.innerHTML="",this.hasInfiniteScroll?this.init():this.getInitialData(),this.showPlaceholder&&(this.showPlaceholder=!1,this.placeholderLoader=document.createElement("div"),this.placeholderLoader.classList.add("s-products-list-loading-wrapper"),this.placeholderLoader.style.display="inherit",this.placeholderLoader.innerHTML='<span class="s-button-loader s-button-loader-center s-infinite-scroll-btn-loader"></span>',this.host.insertAdjacentElement("afterend",this.placeholderLoader))}isFilterable(){return salla.config.get("store.settings.product.filters")&&this.filtersResults}getCachedFilters(){return Array.isArray(this.filtersSnapshot)&&this.filtersSnapshot.length?JSON.parse(JSON.stringify(this.filtersSnapshot)):null}emitFilters(t){if(!this.isFilterable())return;if(t.filters)return this.filtersResults=!0,this.filtersSnapshot=JSON.parse(JSON.stringify(t.filters)),void salla.event.emit("filters::fetched",{filters:t.filters});const s=t.cursor?.current>1?this.getCachedFilters():null;if(s)return this.filtersResults=!0,void salla.event.emit("filters::fetched",{filters:s});this.filtersSnapshot=[],salla.event.emit("filters::hidden")}isSourceWithoutValue(){const t=this.getSource();if("wishlist"===t){const t=new URLSearchParams(window.location.search);return!(t.has("source_value")||t.has("source_value[]")||this.sourceValue)}return["offers","latest","sales","top-rated","reorder"].includes(t)}animateItems(){o({targets:"salla-products-list salla-product-card",opacity:[0,1],duration:1200,translateY:[20,0],delay:function(t,s){return 100*s}})}async initBaseNextPageUrl(t){this.nextPage=salla.url.api(`products?source=${t}`),this.includes?.length&&(this.nextPage+=`&includes[]=${this.includes.join("&includes[]=")}`),this.limit&&(this.nextPage+=`&per_page=${this.limit>32?32:this.limit}`),this.sortBy&&(this.nextPage+=`&sort=${this.sortBy}`),"preview"===salla.config.get("theme.mode")&&(this.nextPage+="&use_username_url=1"),this.nextPage+="&filterable=1";for(const[t,s]of Object.entries(this.parsedFilters||{}))if("source_value"!==t&&"source_value[]"!==t)if(["string","number"].includes(typeof s))this.nextPage+=`&filters[${encodeURIComponent(t)}]=${encodeURIComponent(s)}`;else if(Array.isArray(s))s.forEach((s=>this.nextPage+=`&filters[${encodeURIComponent(t)}][]=${encodeURIComponent(s)}`));else if("object"==typeof s)for(const[i,e]of Object.entries(s))this.nextPage+=`&filters[${encodeURIComponent(t)}][${encodeURIComponent(i)}]=${encodeURIComponent(e)}`;this.nextPage=await this.applyBeforeBuildListUrl(this.nextPage)}async buildNextPageUrl(){let t=this.getSource();if("json"===t)return;const s=sessionStorage.getItem(this.infiniteScrollStateKey);if(s){const{nextPage:t}=JSON.parse(s);if(!t)return}if(await this.initBaseNextPageUrl(t),!this.isSourceWithoutValue())if(["search","related","landing-page"].includes(t))this.nextPage+=`&source_value=${this.getSourceValue()}`;else try{this.nextPage+=`&source_value[]=${this.getSourceValue().join("&source_value[]=")}`}catch(s){salla.logger.warn(`source-value prop should be array of ids ex source-value="[1,2,3]" for the source [${t}]`),this.sourceValueIsValid=!1}}loading(t=!0,s=!1){if(t){let t=s&&!this.autoload?this.btnLoader:this.loader;t&&(t.style.display="inherit")}else this.autoload||this.btnLoader&&(this.btnLoader.style.display="none"),this.loader&&(this.loader.style.display="none")}getItemHTML(t){"landing-page"===this.getSource()&&(t.url="");const s=document.createElement(this.hasCustomComponent?this.productCardComponent:"salla-product-card");return s.product=t,this.compactCards&&(s.compact=!0,s.toggleAttribute("compact",!0)),this.applyLandingPageStyles(s),this.applyHorizontalCardStyles(s),s.addEventListener("click",(s=>{s.target.closest("a")&&(l.saveProductSource(this.getSource()),this.hasInfiniteScroll&&(this.takeStateSnapshot(),sessionStorage.setItem(this.lastViewedProductKey,t.id)))})),this.selectable?this.wrapSelectableItem(s,t):s}wrapSelectableItem(t,s){const i=document.createElement("div");i.className="s-products-list-selectable-item",i.product=s;const e=this.selectedProducts.has(s.id);e&&i.classList.add("s-products-list-item-selected");const r=document.createElement("label");r.className="s-products-list-select-control",r.setAttribute("aria-label",salla.lang.get("common.elements.select","تحديد"));const o=document.createElement("input");return o.type="checkbox",o.className="s-products-list-select-checkbox",o.checked=e,o.addEventListener("change",(()=>this.toggleSelection(s,i,o.checked))),r.appendChild(o),i.appendChild(r),i.appendChild(t),i}toggleSelection(t,s,i){i?(this.selectedProducts.set(t.id,t),s?.classList.add("s-products-list-item-selected")):(this.selectedProducts.delete(t.id),s?.classList.remove("s-products-list-item-selected")),this.emitSelection()}emitSelection(){const t=Array.from(this.selectedProducts.values()),s=Array.from(this.selectedProducts.keys()),i={ids:s,products:t,count:s.length};this.selectionChanged.emit(i),salla.event.emit("salla-products-list::selection.changed",i)}appendProductCards(t){this.wrapper&&((Array.isArray(t)?t:[t]).forEach((t=>this.wrapper.append(t))),this.onWishlistStorageSynced())}refreshWishlistIconsAfterHydration(){return salla.wishlist.api.syncStorageFromServer()}onSelectableChanged(t,s){t!==s&&this.isReady&&this.wrapper&&(t||(this.selectedProducts.clear(),this.emitSelection()),this.reload())}applyLandingPageStyles(t){"landing-page"!==this.getSource()||this.hasCustomComponent||(t.toggleAttribute("hide-add-btn",!0),t.classList.add("s-product-card-fit-height"))}applyHorizontalCardStyles(t){this.horizontalCards&&(t.toggleAttribute("horizontal",!0),this.hasCustomComponent||t.toggleAttribute("shadow-on-hover",!0))}waitForResizing(t){let s=null;return new Promise((i=>{const e=new ResizeObserver((()=>{clearTimeout(s),s=setTimeout((()=>{e.disconnect(),i(null)}),160)}));e.observe(t)}))}waitForLayoutStable(t){let s=null,i=null;return new Promise((e=>{let r;const o=()=>{clearTimeout(s),clearTimeout(i),r.disconnect(),e(null)};r=new MutationObserver((()=>{clearTimeout(s),s=setTimeout(o,160)})),r.observe(t,{childList:!0,subtree:!0,attributes:!0}),i=setTimeout(o,1e3)}))}async waitForStableLayout(t){return await Promise.allSettled([this.waitForResizing(t),this.waitForLayoutStable(t)])}scrollToLastViewedProduct(){const t=sessionStorage.getItem(this.lastViewedProductKey);t&&!salla.url.is_page("product.single")&&this.isElementLoaded(`[id*="${t}"]`).then((()=>{const s=this.wrapper?.querySelector(`[id*="${t}"]`);if(!s)return;const i=()=>{const t=()=>{s.scrollIntoView({block:"start",behavior:"instant"});const t=matchMedia("(max-width: 1024px)").matches?"header .inner":"ul.main-menu",i=window?.header_is_sticky?document.querySelector(t)?.getBoundingClientRect()?.height??56:0,e=parseInt(getComputedStyle(this.wrapper).rowGap)??16;scrollBy({top:-1*(i+e),behavior:"instant"})};requestAnimationFrame(t),s.querySelectorAll("img.lazy").forEach((s=>{const i=s,e=()=>{requestAnimationFrame(t),i.onload=i.onerror=null};i.onload=e,i.onerror=e})),this.removeScrollRestorationSession()};this.waitForStableLayout(this.host).then((()=>requestAnimationFrame(i)))}))}isElementLoaded(t){return new Promise((s=>{const i=setInterval((()=>{if(document.querySelector(t))return clearInterval(i),s(document.querySelector(t))}),50)}))}takeStateSnapshot(){const t=[];for(let s=0;s<this.wrapper.children.length;s++){const i=this.wrapper.children?.[s];t.push(i.product)}const s={pageIndex:Math.max((this.infiniteScroll?.pageIndex??1)-1,1),nextPage:this.nextPage,currentPageData:t};if(this.isFilterable()){const t=sessionStorage.getItem(this.filtersKey);sessionStorage.setItem(this.filtersKey,t||JSON.stringify(this.filtersSnapshot))}sessionStorage.setItem(this.infiniteScrollStateKey,JSON.stringify(s));let i=salla.config.get("page.id");const e=Object.keys(this.specialPagesWithoutIds).find((t=>salla.url.is_page(t)));e?i=this.specialPagesWithoutIds[e]:null!==i&&(i=String(i)),sessionStorage.setItem(this.prevCategoryIdKey,i)}removeScrollRestorationSession(){this.isFilterable()||sessionStorage.removeItem(this.filtersKey),sessionStorage.removeItem(this.infiniteScrollStateKey),sessionStorage.removeItem(this.lastViewedProductKey),sessionStorage.removeItem(this.prevCategoryIdKey)}loadStoredScrollState(){const t=sessionStorage.getItem(this.infiniteScrollStateKey),s=sessionStorage.getItem(this.filtersKey),i=sessionStorage.getItem(this.prevCategoryIdKey),e=this.specialPagesWithoutIds[salla.config.get("page.slug")]||null,r=salla.config.get("page.id"),o=salla.url.is_page("index"),a=salla.url.is_page("product.single"),l=e?i!==e:i!==String(r);if(i&&l&&!o&&!a||o&&!this.hasInfiniteScroll)return this.removeScrollRestorationSession(),this.switchToNormalBehavior=!0,!1;if(a)return this.switchToNormalBehavior=!0,!1;if(t)try{const{pageIndex:i,nextPage:e,currentPageData:r}=JSON.parse(t);if(s&&"undefined"!==s){const t=JSON.parse(s);this.filtersSnapshot=JSON.parse(JSON.stringify(t)),salla.event.emit("filters::fetched",{filters:t})}return this.page=i,this.nextPage=e,this.appendProductCards(r.map((t=>this.getItemHTML(t)))),!0}catch(t){console.error("Failed to load stored scroll state:",t),this.removeScrollRestorationSession()}return!1}getSource(){return l.getProductsSource(this.source)}isAuxiliaryProductsListSource(){return["json","selected","related","landing-page","recently"].includes(this.getSource())}toCategoryIdFilter(t){return Array.isArray(t)?t:t&&"object"==typeof t?Object.values(t):[t]}getSourceValue(){if("wishlist"===this.getSource()){const t=new URLSearchParams(window.location.search),s=t.getAll("source_value[]").length?t.getAll("source_value[]"):t.getAll("source_value");if(s.length)return s}return this.currentCategoryIdFilter?this.currentCategoryIdFilter:l.getProductsSourceValue(this.source,this.sourceValue)}getResponseHeader(t,s){if(!t)return;if("function"==typeof t.get)return t.get(s)||void 0;const i=t[s]??t[s.toLowerCase()];return"string"==typeof i?i:Array.isArray(i)&&"string"==typeof i[0]?i[0]:void 0}logFetchError(t,s,i,e){try{const r=s instanceof Error?s.name:void 0,o=s instanceof Error?s.message:String(s),a=e?.url||i,l=this.getResponseHeader(e?.headers,"cf-ray"),n=this.getResponseHeader(e?.headers,"cf-mitigated"),h=this.getResponseHeader(e?.headers,"server"),c="challenge"===n?.toLowerCase()||403===e?.status&&(!!l||!!h?.toLowerCase().includes("cloudflare")),d=`${r||""} ${o}`;let u="processing"===t?"processing":"unknown";"fetch"===t&&(c?u="cloudflare":/(?:^|\/)null(?:[/?#]|$)/i.test(a||"")?u="invalid_url":/timeout|timed out|abort/i.test(d)?u="timeout":!e?.status&&/fetch|network|load failed|connection/i.test(d)?u="network":e?.status&&(u="http")),salla.analytics?.log("salla::products.list.fetch.error",{errorPhase:t,failureType:u,cloudflareBlock:c,sourceList:this.getSource(),pageIndex:this.infiniteScroll?.pageIndex,httpStatus:e?.status,responseUrl:a,cfRay:l,cfMitigated:n,errorName:r,errorMessage:o.slice(0,500)})}catch{}}appendDataLayer(t){"object"==typeof dataLayer&&Array.isArray(dataLayer)&&dataLayer.push({event:"impressions",ecommerce:{currencyCode:salla.config.currency().code,impressions:t.map(((t,s)=>({id:t.id,name:t.name,price:t.price,brand:t.brand?.name||"",quantity:t.quantity,categories:[{name:t.category?.name||salla.config.get("page.title"),id:salla.config.get("page.id")}],category:t.category?.name||salla.config.get("page.title"),position:s+1})))}})}initiateInfiniteScroll(){if(!this.hasInfiniteScroll)return;const t=this.autoload&&this.includes&&this.includes.length>0;this.infiniteScroll=salla.infiniteScroll.initiate(this.wrapper,this.wrapper,{path:()=>this.nextPage,history:!1,nextPage:this.nextPage,scrollThreshold:!t&&!!this.autoload&&100,loadOnScroll:!t&&this.autoload},!0),this.infiniteScroll.pageIndex=this.page,this.infiniteScroll?.on("request",(()=>{this.loading(!0,!this.autoload)})),t&&window.addEventListener("scroll",this.boundHandleScroll),this.infiniteScroll?.on("load",(async(t,s,i)=>{if(!this.isProcessing){this.isProcessing=!0;try{if(!t.data?.length&&2===this.infiniteScroll.pageIndex)return this.showPlaceholder=!0,salla.infiniteScroll.destroy(this.infiniteScroll),this.loading(!1),void(this.placeholderLoader&&this.placeholderLoader.remove());this.includes&&await this.injectAndProcessData(t);const s=await this.handleResponse(t);this.infiniteScroll.appendItems(s),this.onWishlistStorageSynced(),2===this.infiniteScroll.pageIndex&&(!this.autoload&&this.nextPage&&(this.loadMoreWrapper.style.display="block"),this.animateItems(),this.refreshInfiniteScrollMeasurements())}catch(t){console.error("Error during load:",t),this.logFetchError("processing",t,"string"==typeof s?s:void 0,i)}finally{this.isProcessing=!1}}})),this.infiniteScroll?.on("error",((t,s,i)=>{const e=i;this.status.querySelector(".s-infinite-scroll-error").classList.remove("s-hidden"),this.placeholderLoader&&this.placeholderLoader.remove(),this.loading(!1),this.isProcessing=!1,this.logFetchError("fetch",t,s,e)})),salla.onReady((()=>{sessionStorage.getItem(this.infiniteScrollStateKey)||this.manualLoadNextPage()}))}handleScroll(){this.isProcessing||this.scrollTimeout||(this.scrollTimeout=setTimeout((()=>{this.scrollTimeout=null,requestAnimationFrame((()=>{const t=this.wrapper.getBoundingClientRect(),s=window.innerHeight;t.bottom-s<=200&&!this.isProcessing&&this.nextPage&&this.manualLoadNextPage()}))}),200))}manualLoadNextPage(){this.nextPage&&this.infiniteScroll.loadNextPage()}refreshInfiniteScrollMeasurements(){this.autoload&&this.infiniteScroll?.updateMeasurements&&this.waitForStableLayout(document.body).then((()=>this.infiniteScroll?.updateMeasurements?.()))}async applyBeforeBuildListUrl(t){try{const s={component:this,url:t};return await salla.hooks.call("salla-products-list","beforeBuildListUrl",s),s.url}catch(s){return salla.logger.warn("beforeBuildListUrl hook failed",s?.message),t}}async resolveNextPageFromCursor(t){return t.cursor?t.cursor.next?await this.applyBeforeBuildListUrl(t.cursor.next):t.cursor.next:this.nextPage}async injectAndProcessData(t){try{await l.injectExtraFieldsToResponse(t)}catch(t){console.error("Error injecting data:",t)}}getInitialData(){return this.loading(),salla.api.withoutNotifier((()=>salla.product.api.fetch({source:l.getApiSource(this.getSource()),source_value:this.getSourceValue(),limit:this.limit}).catch((t=>{const s=t?.response,i=s?.request?.responseURL||t?.config?.url;throw this.logFetchError("fetch",t,i,{status:s?.status,url:i,headers:s?.headers}),t})).then((async t=>t.data.length?(await l.injectExtraFieldsToResponse(t),this.firstPageResponse?void this.appendProductCards(await this.handleResponse(t)):(this.firstPageResponse=t,void(this.nextPage=await this.resolveNextPageFromCursor(t)))):(this.showPlaceholder=!0,this.placeholderLoader&&this.placeholderLoader.remove(),void this.loading(!1))))))}async loadMore(){this.infiniteScroll?.loadNextPage()}async getSelected(){return{ids:Array.from(this.selectedProducts.keys()),products:Array.from(this.selectedProducts.values())}}async getLoadedProducts(){const t=[];if(!this.wrapper)return t;for(let s=0;s<this.wrapper.children.length;s++){const i=this.wrapper.children[s];i?.product&&t.push(i.product)}return t}async selectAll(){if(this.selectable&&this.wrapper){for(let t=0;t<this.wrapper.children.length;t++){const s=this.wrapper.children[t];if(s?.product){this.selectedProducts.set(s.product.id,s.product),s.classList.add("s-products-list-item-selected");const t=s.querySelector(".s-products-list-select-checkbox");t&&(t.checked=!0)}}this.emitSelection()}}async clearSelection(){this.selectedProducts.clear(),this.wrapper&&(this.wrapper.querySelectorAll(".s-products-list-select-checkbox").forEach((t=>t.checked=!1)),this.wrapper.querySelectorAll(".s-products-list-item-selected").forEach((t=>t.classList.remove("s-products-list-item-selected")))),this.emitSelection()}componentWillLoad(){return salla.onReady().then((async()=>{this.hasCustomComponent=!!customElements.get(this.productCardComponent),this.sourceValueIsValid=!(!this.getSourceValue()&&!this.isSourceWithoutValue()),this.hasInfiniteScroll=!this.isAuxiliaryProductsListSource()&&!this.limit;let t=new URLSearchParams(window.location.search);try{this.sortBy=this.sortBy||t.get("sort")||t.get("by"),this.parsedFilters=l.extractFiltersFromUrl(t),this.parsedFilters&&this.parsedFilters.category_id&&(this.currentCategoryIdFilter=this.toCategoryIdFilter(this.parsedFilters.category_id))}catch(t){salla.logger.warn("failed to get filters from url",t.message)}if(await this.buildNextPageUrl(),this.isReady=!0,!sessionStorage.getItem(this.infiniteScrollStateKey))if(this.sourceValueIsValid){if(!this.hasInfiniteScroll){if("json"===this.getSource())return this.getSourceValue().length?void setTimeout((()=>{this.appendProductCards(this.getSourceValue().map((t=>this.getItemHTML(t))))})):void(this.showPlaceholder=!0);if("selected"!==this.getSource()||this.getSourceValue().length)return this.getInitialData();this.showPlaceholder=!0}}else salla.logger.warn(`source-value prop is required for source [${this.getSource()}]`)}))}async componentDidLoad(){this.hasInfiniteScroll&&this.init(),await Salla.hooks.registerComponent("salla-products-list",this),this.loadStoredScrollState()?(this.autoload?!this.nextPage&&this.loading(!1):this.nextPage?this.loadMoreWrapper&&(this.loadMoreWrapper.style.display="block"):(this.loadMoreWrapper&&(this.loadMoreWrapper.style.display="none"),this.status.querySelector(".s-infinite-scroll-last").classList.remove("s-hidden")),this.scrollToLastViewedProduct(),this.refreshInfiniteScrollMeasurements()):!this.firstPageResponse&&this.switchToNormalBehavior?this.getInitialData().then((async()=>{this.firstPageResponse?(this.appendProductCards(await this.handleResponse(this.firstPageResponse,!1)),setTimeout((()=>{if(!this.autoload&&this.nextPage&&1==this.infiniteScroll.pageIndex){const t=this.host.querySelector(".s-infinite-scroll-wrapper");t&&(t.style.display="block")}}))):console.error("No response received after getInitialData.")})).catch((t=>{console.error("Error during initial data fetch:",t)})):this.firstPageResponse&&this.appendProductCards(await this.handleResponse(this.firstPageResponse,!1)),await this.refreshWishlistIconsAfterHydration()}canRender(){return this.sourceValueIsValid&&this.isReady}render(){return this.canRender()?this.showPlaceholder?i("div",{class:"s-products-list-placeholder"},i("span",{innerHTML:a}),i("p",null,this.placeholderText)):i(e,{class:"s-products-list"},i("div",{class:{"s-products-list-wrapper":!0,"s-products-list-horizontal-cards":this.horizontalCards&&!this.filtersResults,"s-products-list-vertical-cards":!this.horizontalCards&&!this.rowCards&&!this.filtersResults,"s-products-list-row-cards":this.rowCards,"s-products-list-compact-cards":this.compactCards,"s-products-list-filters-results":this.filtersResults},ref:t=>this.wrapper=t}),i("div",{class:"s-infinite-scroll-status",ref:t=>this.status=t},i("p",{class:"s-infinite-scroll-last infinite-scroll-last s-hidden"},this.endOfText),i("p",{class:"s-infinite-scroll-error infinite-scroll-error s-hidden"},this.failedLoadMore)),this.autoload&&i("div",{class:"s-products-list-loading-wrapper",style:{display:"none"},ref:t=>this.loader=t},i("span",{class:"s-button-loader s-button-loader-center s-infinite-scroll-btn-loader"})),this.hasInfiniteScroll&&this.nextPage&&!this.autoload?i("div",{class:"s-infinite-scroll-wrapper",style:{display:"none"},ref:t=>this.loadMoreWrapper=t},i("button",{onClick:()=>this.loadMore(),class:"s-infinite-scroll-btn s-button-btn s-button-primary"},i("span",{class:"s-button-text s-infinite-scroll-btn-text"},this.loadMoreText?this.loadMoreText:salla.lang.get("common.elements.load_more")),i("span",{class:"s-button-loader s-button-loader-center s-infinite-scroll-btn-loader",ref:t=>this.btnLoader=t,style:{display:"none"}}))):""):""}init(){this.initiateInfiniteScroll(),this.loading()}async handleResponse(t,s=!0){if(!t)return[];let i=this.getSource();if(1===t.cursor?.current){if(!this.isAuxiliaryProductsListSource()){let s=l.getPageTitleForSource(i);try{if("search"===this.getSource())s=salla.lang.get("common.elements.search_about",{word:this.getSourceValue()});else if(!s){let i=Object.keys(this.parsedFilters||{}).length?null:this.getSourceValue()[0];s=t.filters?.find((t=>"category_id"===t.key))?.values?.find((t=>t.key==i))?.value??""}s+=(s?" - ":"")+salla.lang.choice("blocks.header.products_count",t.data?.length),15===t.data.length&&(s=s.replace(t.data.length,salla.lang.get("common.elements.more_than")+" "+t.data.length)),t.title=s}catch(t){salla.logger.error("Error::falid to handle response",t)}}l.generateProductSchema(t.data)}this.appendDataLayer(t.data),t.nextPage=this.nextPage,t.source=this.getSource(),t.sourceValue=this.getSourceValue(),salla.event.emit("salla-products-list::products.fetched",t),this.productsFetched.emit(t),this.emitFilters(t),s&&(this.nextPage=await this.resolveNextPageFromCursor(t)),this.loading(!1),this.placeholderLoader&&this.placeholderLoader.remove(),this.hasInfiniteScroll&&!this.nextPage&&(this.infiniteScroll.option({scrollThreshold:!1,loadOnScroll:!1}),this.status.querySelector(".s-infinite-scroll-last").classList.remove("s-hidden"));let e=await this.applyBeforeAppendItems(t.data);const r=[];for(let t=0;t<e.length;t++)r.push(this.getItemHTML(e[t]));return r}async applyBeforeAppendItems(t){const s={component:this,items:t};try{return await salla.hooks.call("salla-products-list","beforeAppendItems",s),Array.isArray(s.items)?s.items:t}catch{return t}}get host(){return r(this)}static get watchers(){return{selectable:["onSelectableChanged"]}}};n.style='.s-products-list-selectable-item{position:relative;border-radius:0.5rem;transition:box-shadow 0.15s ease-in-out}.s-products-list-item-selected{box-shadow:0 0 0 2px var(--color-primary)}.s-products-list-select-control{position:absolute;top:10px;inset-inline-start:10px;z-index:5;display:inline-flex;align-items:center;justify-content:center;cursor:pointer}.s-products-list-select-checkbox{appearance:none;-webkit-appearance:none;-moz-appearance:none;position:relative;width:22px;height:22px;margin:0;cursor:pointer;color:var(--color-primary);border:1px solid rgba(0, 0, 0, 0.15);border-radius:6px;background-color:#fff;box-shadow:0 1px 3px rgba(0, 0, 0, 0.2);transition:background-color 0.15s ease-in-out, border-color 0.15s ease-in-out}.s-products-list-select-checkbox:hover{border-color:var(--color-primary)}.s-products-list-select-checkbox:focus,.s-products-list-select-checkbox:focus-visible{outline:none;border-color:var(--color-primary);box-shadow:0 1px 3px rgba(0, 0, 0, 0.2), 0 0 0 3px color-mix(in srgb, var(--color-primary) 30%, transparent)}.s-products-list-select-checkbox:checked,.s-products-list-select-checkbox:checked:hover,.s-products-list-select-checkbox:checked:focus{background-color:var(--color-primary);border-color:var(--color-primary)}.s-products-list-select-checkbox:checked::after{content:"";position:absolute;top:50%;left:50%;width:5px;height:10px;border:solid #fff;border-width:0 2px 2px 0;transform:translate(-50%, -60%) rotate(45deg)}.s-products-list-row-cards .s-products-list-select-control{top:50%;inset-inline-start:14px;transform:translateY(-50%)}.s-products-list-row-cards .s-products-list-selectable-item>:not(.s-products-list-select-control){padding-inline-start:2.75rem}';export{n as salla_products_list}
4
+ import{r as t,c as s,h as i,H as e,a as r}from"./p-LKlIr4DH.js";import{a as o}from"./p-CgtvEd63.js";import{S as a}from"./p-DiKTtDW5.js";import{H as l}from"./p-XnA1YTjA.js";const n=class{constructor(i){t(this,i),this.productsFetched=s(this,"productsFetched"),this.selectionChanged=s(this,"selectionChanged"),this.autoload=!1,this.productCardComponent="custom-salla-product-card",this.selectable=!1,this.page=1,this.placeholderText=salla.lang.get("pages.categories.no_products"),this.endOfText=salla.lang.get("common.elements.end_of_content"),this.failedLoadMore=salla.lang.get("common.elements.failed_to_load_more"),this.currentPage=salla.config.get("page"),this.filtersSnapshot=[],this.selectedProducts=new Map,this.lastViewedProductKey="lastViewedProductId",this.filtersKey="filters",this.infiniteScrollStateKey="infiniteScrollState",this.prevCategoryIdKey="prevCategoryId",this.isProcessing=!1,this.scrollTimeout=null,this.boundScrollToLastViewedProduct=()=>this.scrollToLastViewedProduct(),this.boundHandleScroll=()=>this.handleScroll(),this.specialPagesWithoutIds={"product.index.latest":"latest","product.index.offers":"offers","product.index.search":"search","product.index.sales":"sales"},this.onWishlistItemRemoved=(t,s)=>{if("wishlist"!==this.getSource()||!this.wrapper)return;const i=String(s),e=this.hasCustomComponent?this.productCardComponent:"salla-product-card";for(const t of Array.from(this.wrapper.children)){const s=t,r=t.querySelector(e),o=s.product?.id??r?.product?.id;if(null!=o&&String(o)===i){t.remove();break}}for(const t of Array.from(this.wrapper.children)){if(!t.classList.contains("s-products-list-selectable-item"))continue;const s=t;if(null!=s.product?.id&&String(s.product.id)===i&&!t.querySelector(e)){t.remove();break}}if(this.selectable){for(const t of Array.from(this.selectedProducts.keys()))String(t)===i&&this.selectedProducts.delete(t);this.emitSelection()}},this.onWishlistStorageSynced=()=>l.syncWishlistIcons(this.wrapper,`${this.productCardComponent}, salla-product-card`),this.includes=l.parseJson(this.includes||this.host.getAttribute("includes")),Array.isArray(this.includes)||(this.includes=null),l.setIncludes(this.includes),salla.lang.onLoaded((()=>{this.placeholderText=salla.lang.get("pages.categories.no_products"),this.endOfText=salla.lang.get("common.elements.end_of_content"),this.failedLoadMore=salla.lang.get("common.elements.failed_to_load_more"),this.currentPage=salla.config.get("page")}))}connectedCallback(){"scrollRestoration"in history&&(history.scrollRestoration="manual"),window.addEventListener("DOMContentLoaded",this.boundScrollToLastViewedProduct),salla.event.on("salla-filters::changed",(t=>this.setFilters(t))),salla.event.on("wishlist::removed",this.onWishlistItemRemoved),salla.event.on("wishlist::storage.synced",this.onWishlistStorageSynced)}disconnectedCallback(){window.removeEventListener("DOMContentLoaded",this.boundScrollToLastViewedProduct),window.removeEventListener("scroll",this.boundHandleScroll),salla.event.off("wishlist::removed",this.onWishlistItemRemoved),salla.event.off("wishlist::storage.synced",this.onWishlistStorageSynced)}async setFilters(t){if(t&&JSON.stringify(t)!==JSON.stringify(this.parsedFilters))return window.scrollTo({top:0,behavior:"smooth"}),this.parsedFilters=JSON.parse(JSON.stringify(t)),"product.index"==this.currentPage?.slug&&(this.currentCategoryIdFilter=this.parsedFilters?.category_id?this.toCategoryIdFilter(this.parsedFilters.category_id):null),this.reload()}async reload(){!this.autoload&&this.loadMoreWrapper&&(this.loadMoreWrapper.style.display="none"),this.hasInfiniteScroll&&salla.infiniteScroll.destroy(this.infiniteScroll),await this.buildNextPageUrl(),this.wrapper.innerHTML="",this.hasInfiniteScroll?this.init():this.getInitialData(),this.showPlaceholder&&(this.showPlaceholder=!1,this.placeholderLoader=document.createElement("div"),this.placeholderLoader.classList.add("s-products-list-loading-wrapper"),this.placeholderLoader.style.display="inherit",this.placeholderLoader.innerHTML='<span class="s-button-loader s-button-loader-center s-infinite-scroll-btn-loader"></span>',this.host.insertAdjacentElement("afterend",this.placeholderLoader))}isFilterable(){return salla.config.get("store.settings.product.filters")&&this.filtersResults}getCachedFilters(){return Array.isArray(this.filtersSnapshot)&&this.filtersSnapshot.length?JSON.parse(JSON.stringify(this.filtersSnapshot)):null}emitFilters(t){if(!this.isFilterable())return;if(t.filters)return this.filtersResults=!0,this.filtersSnapshot=JSON.parse(JSON.stringify(t.filters)),void salla.event.emit("filters::fetched",{filters:t.filters});const s=t.cursor?.current>1?this.getCachedFilters():null;if(s)return this.filtersResults=!0,void salla.event.emit("filters::fetched",{filters:s});this.filtersSnapshot=[],salla.event.emit("filters::hidden")}isSourceWithoutValue(){const t=this.getSource();if("wishlist"===t){const t=new URLSearchParams(window.location.search);return!(t.has("source_value")||t.has("source_value[]")||this.sourceValue)}return["offers","latest","sales","top-rated","reorder"].includes(t)}animateItems(){o({targets:"salla-products-list salla-product-card",opacity:[0,1],duration:1200,translateY:[20,0],delay:function(t,s){return 100*s}})}async initBaseNextPageUrl(t){this.nextPage=salla.url.api(`products?source=${t}`),this.includes?.length&&(this.nextPage+=`&includes[]=${this.includes.join("&includes[]=")}`),this.limit&&(this.nextPage+=`&per_page=${this.limit>32?32:this.limit}`),this.sortBy&&(this.nextPage+=`&sort=${this.sortBy}`),"preview"===salla.config.get("theme.mode")&&(this.nextPage+="&use_username_url=1"),this.nextPage+="&filterable=1";for(const[t,s]of Object.entries(this.parsedFilters||{}))if("source_value"!==t&&"source_value[]"!==t)if(["string","number"].includes(typeof s))this.nextPage+=`&filters[${encodeURIComponent(t)}]=${encodeURIComponent(s)}`;else if(Array.isArray(s))s.forEach((s=>this.nextPage+=`&filters[${encodeURIComponent(t)}][]=${encodeURIComponent(s)}`));else if("object"==typeof s)for(const[i,e]of Object.entries(s))this.nextPage+=`&filters[${encodeURIComponent(t)}][${encodeURIComponent(i)}]=${encodeURIComponent(e)}`;this.nextPage=await this.applyBeforeBuildListUrl(this.nextPage)}async buildNextPageUrl(){let t=this.getSource();if("json"===t)return;const s=sessionStorage.getItem(this.infiniteScrollStateKey);if(s){const{nextPage:t}=JSON.parse(s);if(!t)return}if(await this.initBaseNextPageUrl(t),!this.isSourceWithoutValue())if(["search","related","landing-page"].includes(t))this.nextPage+=`&source_value=${this.getSourceValue()}`;else try{this.nextPage+=`&source_value[]=${this.getSourceValue().join("&source_value[]=")}`}catch(s){salla.logger.warn(`source-value prop should be array of ids ex source-value="[1,2,3]" for the source [${t}]`),this.sourceValueIsValid=!1}}loading(t=!0,s=!1){if(t){let t=s&&!this.autoload?this.btnLoader:this.loader;t&&(t.style.display="inherit")}else this.autoload||this.btnLoader&&(this.btnLoader.style.display="none"),this.loader&&(this.loader.style.display="none")}getItemHTML(t){"landing-page"===this.getSource()&&(t.url="");const s=document.createElement(this.hasCustomComponent?this.productCardComponent:"salla-product-card");return s.product=t,this.compactCards&&(s.compact=!0,s.toggleAttribute("compact",!0)),this.applyLandingPageStyles(s),this.applyHorizontalCardStyles(s),s.addEventListener("click",(s=>{s.target.closest("a")&&(l.saveProductSource(this.getSource()),this.hasInfiniteScroll&&(this.takeStateSnapshot(),sessionStorage.setItem(this.lastViewedProductKey,t.id)))})),this.selectable?this.wrapSelectableItem(s,t):s}wrapSelectableItem(t,s){const i=document.createElement("div");i.className="s-products-list-selectable-item",i.product=s;const e=this.selectedProducts.has(s.id);e&&i.classList.add("s-products-list-item-selected");const r=document.createElement("label");r.className="s-products-list-select-control",r.setAttribute("aria-label",salla.lang.get("common.elements.select","تحديد"));const o=document.createElement("input");return o.type="checkbox",o.className="s-products-list-select-checkbox",o.checked=e,o.addEventListener("change",(()=>this.toggleSelection(s,i,o.checked))),r.appendChild(o),i.appendChild(r),i.appendChild(t),i}toggleSelection(t,s,i){i?(this.selectedProducts.set(t.id,t),s?.classList.add("s-products-list-item-selected")):(this.selectedProducts.delete(t.id),s?.classList.remove("s-products-list-item-selected")),this.emitSelection()}emitSelection(){const t=Array.from(this.selectedProducts.values()),s=Array.from(this.selectedProducts.keys()),i={ids:s,products:t,count:s.length};this.selectionChanged.emit(i),salla.event.emit("salla-products-list::selection.changed",i)}appendProductCards(t){this.wrapper&&((Array.isArray(t)?t:[t]).forEach((t=>this.wrapper.append(t))),this.onWishlistStorageSynced())}refreshWishlistIconsAfterHydration(){return salla.wishlist.api.syncStorageFromServer()}onSelectableChanged(t,s){t!==s&&this.isReady&&this.wrapper&&(t||(this.selectedProducts.clear(),this.emitSelection()),this.reload())}applyLandingPageStyles(t){"landing-page"!==this.getSource()||this.hasCustomComponent||(t.toggleAttribute("hide-add-btn",!0),t.classList.add("s-product-card-fit-height"))}applyHorizontalCardStyles(t){this.horizontalCards&&(t.toggleAttribute("horizontal",!0),this.hasCustomComponent||t.toggleAttribute("shadow-on-hover",!0))}waitForResizing(t){let s=null;return new Promise((i=>{const e=new ResizeObserver((()=>{clearTimeout(s),s=setTimeout((()=>{e.disconnect(),i(null)}),160)}));e.observe(t)}))}waitForLayoutStable(t){let s=null,i=null;return new Promise((e=>{let r;const o=()=>{clearTimeout(s),clearTimeout(i),r.disconnect(),e(null)};r=new MutationObserver((()=>{clearTimeout(s),s=setTimeout(o,160)})),r.observe(t,{childList:!0,subtree:!0,attributes:!0}),i=setTimeout(o,1e3)}))}async waitForStableLayout(t){return await Promise.allSettled([this.waitForResizing(t),this.waitForLayoutStable(t)])}scrollToLastViewedProduct(){const t=sessionStorage.getItem(this.lastViewedProductKey);t&&!salla.url.is_page("product.single")&&this.isElementLoaded(`[id*="${t}"]`).then((()=>{const s=this.wrapper?.querySelector(`[id*="${t}"]`);if(!s)return;const i=()=>{const t=()=>{s.scrollIntoView({block:"start",behavior:"instant"});const t=matchMedia("(max-width: 1024px)").matches?"header .inner":"ul.main-menu",i=window?.header_is_sticky?document.querySelector(t)?.getBoundingClientRect()?.height??56:0,e=parseInt(getComputedStyle(this.wrapper).rowGap)??16;scrollBy({top:-1*(i+e),behavior:"instant"})};requestAnimationFrame(t),s.querySelectorAll("img.lazy").forEach((s=>{const i=s,e=()=>{requestAnimationFrame(t),i.onload=i.onerror=null};i.onload=e,i.onerror=e})),this.removeScrollRestorationSession()};this.waitForStableLayout(this.host).then((()=>requestAnimationFrame(i)))}))}isElementLoaded(t){return new Promise((s=>{const i=setInterval((()=>{if(document.querySelector(t))return clearInterval(i),s(document.querySelector(t))}),50)}))}takeStateSnapshot(){const t=[];for(let s=0;s<this.wrapper.children.length;s++){const i=this.wrapper.children?.[s];t.push(i.product)}const s={pageIndex:Math.max((this.infiniteScroll?.pageIndex??1)-1,1),nextPage:this.nextPage,currentPageData:t};if(this.isFilterable()){const t=sessionStorage.getItem(this.filtersKey);sessionStorage.setItem(this.filtersKey,t||JSON.stringify(this.filtersSnapshot))}sessionStorage.setItem(this.infiniteScrollStateKey,JSON.stringify(s));let i=salla.config.get("page.id");const e=Object.keys(this.specialPagesWithoutIds).find((t=>salla.url.is_page(t)));e?i=this.specialPagesWithoutIds[e]:null!==i&&(i=String(i)),sessionStorage.setItem(this.prevCategoryIdKey,i)}removeScrollRestorationSession(){this.isFilterable()||sessionStorage.removeItem(this.filtersKey),sessionStorage.removeItem(this.infiniteScrollStateKey),sessionStorage.removeItem(this.lastViewedProductKey),sessionStorage.removeItem(this.prevCategoryIdKey)}loadStoredScrollState(){const t=sessionStorage.getItem(this.infiniteScrollStateKey),s=sessionStorage.getItem(this.filtersKey),i=sessionStorage.getItem(this.prevCategoryIdKey),e=this.specialPagesWithoutIds[salla.config.get("page.slug")]||null,r=salla.config.get("page.id"),o=salla.url.is_page("index"),a=salla.url.is_page("product.single"),l=e?i!==e:i!==String(r);if(i&&l&&!o&&!a||o&&!this.hasInfiniteScroll)return this.removeScrollRestorationSession(),this.switchToNormalBehavior=!0,!1;if(a)return this.switchToNormalBehavior=!0,!1;if(t)try{const{pageIndex:i,nextPage:e,currentPageData:r}=JSON.parse(t);if(s&&"undefined"!==s){const t=JSON.parse(s);this.filtersSnapshot=JSON.parse(JSON.stringify(t)),salla.event.emit("filters::fetched",{filters:t})}return this.page=i,this.nextPage=e,this.appendProductCards(r.map((t=>this.getItemHTML(t)))),!0}catch(t){console.error("Failed to load stored scroll state:",t),this.removeScrollRestorationSession()}return!1}getSource(){return l.getProductsSource(this.source)}isAuxiliaryProductsListSource(){return["json","selected","related","landing-page","recently"].includes(this.getSource())}toCategoryIdFilter(t){return Array.isArray(t)?t:t&&"object"==typeof t?Object.values(t):[t]}getSourceValue(){if("wishlist"===this.getSource()){const t=new URLSearchParams(window.location.search),s=t.getAll("source_value[]").length?t.getAll("source_value[]"):t.getAll("source_value");if(s.length)return s}return this.currentCategoryIdFilter?this.currentCategoryIdFilter:l.getProductsSourceValue(this.source,this.sourceValue)}getResponseHeader(t,s){if(!t)return;if("function"==typeof t.get)return t.get(s)||void 0;const i=t[s]??t[s.toLowerCase()];return"string"==typeof i?i:Array.isArray(i)&&"string"==typeof i[0]?i[0]:void 0}logFetchError(t,s,i,e){try{const r=s instanceof Error?s.name:void 0,o=s instanceof Error?s.message:String(s),a=e?.url||i,l=this.getResponseHeader(e?.headers,"cf-ray"),n=this.getResponseHeader(e?.headers,"cf-mitigated"),h=this.getResponseHeader(e?.headers,"server"),c="challenge"===n?.toLowerCase()||403===e?.status&&(!!l||!!h?.toLowerCase().includes("cloudflare")),d=`${r||""} ${o}`;let u="processing"===t?"processing":"unknown";"fetch"===t&&(c?u="cloudflare":/(?:^|\/)null(?:[/?#]|$)/i.test(a||"")?u="invalid_url":/timeout|timed out|abort/i.test(d)?u="timeout":!e?.status&&/fetch|network|load failed|connection/i.test(d)?u="network":e?.status&&(u="http")),salla.analytics?.log("salla::products.list.fetch.error",{errorPhase:t,failureType:u,cloudflareBlock:c,sourceList:this.getSource(),pageIndex:this.infiniteScroll?.pageIndex,httpStatus:e?.status,responseUrl:a,cfRay:l,cfMitigated:n,errorName:r,errorMessage:o.slice(0,500)})}catch{}}appendDataLayer(t){"object"==typeof dataLayer&&Array.isArray(dataLayer)&&dataLayer.push({event:"impressions",ecommerce:{currencyCode:salla.config.currency().code,impressions:t.map(((t,s)=>({id:t.id,name:t.name,price:t.price,brand:t.brand?.name||"",quantity:t.quantity,categories:[{name:t.category?.name||salla.config.get("page.title"),id:salla.config.get("page.id")}],category:t.category?.name||salla.config.get("page.title"),position:s+1})))}})}initiateInfiniteScroll(){if(!this.hasInfiniteScroll)return;const t=this.autoload&&this.includes&&this.includes.length>0;this.infiniteScroll=salla.infiniteScroll.initiate(this.wrapper,this.wrapper,{path:()=>this.nextPage,history:!1,nextPage:this.nextPage,scrollThreshold:!t&&!!this.autoload&&100,loadOnScroll:!t&&this.autoload},!0),this.infiniteScroll.pageIndex=this.page,this.infiniteScroll?.on("request",(()=>{this.loading(!0,!this.autoload)})),t&&window.addEventListener("scroll",this.boundHandleScroll),this.infiniteScroll?.on("load",(async(t,s,i)=>{if(!this.isProcessing){this.isProcessing=!0;try{if(!t.data?.length&&2===this.infiniteScroll.pageIndex)return this.showPlaceholder=!0,salla.infiniteScroll.destroy(this.infiniteScroll),this.loading(!1),void(this.placeholderLoader&&this.placeholderLoader.remove());this.includes&&await this.injectAndProcessData(t);const s=await this.handleResponse(t);this.infiniteScroll.appendItems(s),this.onWishlistStorageSynced(),2===this.infiniteScroll.pageIndex&&(!this.autoload&&this.nextPage&&(this.loadMoreWrapper.style.display="block"),this.animateItems(),this.refreshInfiniteScrollMeasurements())}catch(t){console.error("Error during load:",t),this.logFetchError("processing",t,"string"==typeof s?s:void 0,i)}finally{this.isProcessing=!1}}})),this.infiniteScroll?.on("error",((t,s,i)=>{const e=i;this.status.querySelector(".s-infinite-scroll-error").classList.remove("s-hidden"),this.placeholderLoader&&this.placeholderLoader.remove(),this.loading(!1),this.isProcessing=!1,this.logFetchError("fetch",t,s,e)})),salla.onReady((()=>{sessionStorage.getItem(this.infiniteScrollStateKey)||this.manualLoadNextPage()}))}handleScroll(){this.isProcessing||this.scrollTimeout||(this.scrollTimeout=setTimeout((()=>{this.scrollTimeout=null,requestAnimationFrame((()=>{const t=this.wrapper.getBoundingClientRect(),s=window.innerHeight;t.bottom-s<=200&&!this.isProcessing&&this.nextPage&&this.manualLoadNextPage()}))}),200))}manualLoadNextPage(){this.nextPage&&this.infiniteScroll.loadNextPage()}refreshInfiniteScrollMeasurements(){this.autoload&&this.infiniteScroll?.updateMeasurements&&this.waitForStableLayout(document.body).then((()=>this.infiniteScroll?.updateMeasurements?.()))}async applyBeforeBuildListUrl(t){try{const s={component:this,url:t};return await salla.hooks.call("salla-products-list","beforeBuildListUrl",s),s.url}catch(s){return salla.logger.warn("beforeBuildListUrl hook failed",s?.message),t}}async resolveNextPageFromCursor(t){return t.cursor?t.cursor.next?await this.applyBeforeBuildListUrl(t.cursor.next):t.cursor.next:this.nextPage}async injectAndProcessData(t){try{await l.injectExtraFieldsToResponse(t)}catch(t){console.error("Error injecting data:",t)}}getInitialData(){return this.loading(),salla.api.withoutNotifier((()=>salla.product.api.fetch({source:l.getApiSource(this.getSource()),source_value:this.getSourceValue(),limit:this.limit}).catch((t=>{const s=t?.response,i=s?.request?.responseURL||t?.config?.url;throw this.logFetchError("fetch",t,i,{status:s?.status,url:i,headers:s?.headers}),t})).then((async t=>t.data.length?(await l.injectExtraFieldsToResponse(t),this.firstPageResponse?void this.appendProductCards(await this.handleResponse(t)):(this.firstPageResponse=t,void(this.nextPage=await this.resolveNextPageFromCursor(t)))):(this.showPlaceholder=!0,this.placeholderLoader&&this.placeholderLoader.remove(),void this.loading(!1))))))}async loadMore(){this.infiniteScroll?.loadNextPage()}async getSelected(){return{ids:Array.from(this.selectedProducts.keys()),products:Array.from(this.selectedProducts.values())}}async getLoadedProducts(){const t=[];if(!this.wrapper)return t;for(let s=0;s<this.wrapper.children.length;s++){const i=this.wrapper.children[s];i?.product&&t.push(i.product)}return t}async selectAll(){if(this.selectable&&this.wrapper){for(let t=0;t<this.wrapper.children.length;t++){const s=this.wrapper.children[t];if(s?.product){this.selectedProducts.set(s.product.id,s.product),s.classList.add("s-products-list-item-selected");const t=s.querySelector(".s-products-list-select-checkbox");t&&(t.checked=!0)}}this.emitSelection()}}async clearSelection(){this.selectedProducts.clear(),this.wrapper&&(this.wrapper.querySelectorAll(".s-products-list-select-checkbox").forEach((t=>t.checked=!1)),this.wrapper.querySelectorAll(".s-products-list-item-selected").forEach((t=>t.classList.remove("s-products-list-item-selected")))),this.emitSelection()}componentWillLoad(){return salla.onReady().then((async()=>{this.hasCustomComponent=!!customElements.get(this.productCardComponent),this.sourceValueIsValid=!(!this.getSourceValue()&&!this.isSourceWithoutValue()),this.hasInfiniteScroll=!this.isAuxiliaryProductsListSource()&&!this.limit;let t=new URLSearchParams(window.location.search);try{this.sortBy=this.sortBy||t.get("sort")||t.get("by"),this.parsedFilters=l.extractFiltersFromUrl(t),this.parsedFilters&&this.parsedFilters.category_id&&(this.currentCategoryIdFilter=this.toCategoryIdFilter(this.parsedFilters.category_id))}catch(t){salla.logger.warn("failed to get filters from url",t.message)}if(await this.buildNextPageUrl(),this.isReady=!0,!sessionStorage.getItem(this.infiniteScrollStateKey))if(this.sourceValueIsValid){if(!this.hasInfiniteScroll){if("json"===this.getSource())return this.getSourceValue().length?void setTimeout((()=>{this.appendProductCards(this.getSourceValue().map((t=>this.getItemHTML(t))))})):void(this.showPlaceholder=!0);if("selected"!==this.getSource()||this.getSourceValue().length)return this.getInitialData();this.showPlaceholder=!0}}else salla.logger.warn(`source-value prop is required for source [${this.getSource()}]`)}))}async componentDidLoad(){this.hasInfiniteScroll&&this.init(),await Salla.hooks.registerComponent("salla-products-list",this),this.loadStoredScrollState()?(this.autoload?!this.nextPage&&this.loading(!1):this.nextPage?this.loadMoreWrapper&&(this.loadMoreWrapper.style.display="block"):(this.loadMoreWrapper&&(this.loadMoreWrapper.style.display="none"),this.status.querySelector(".s-infinite-scroll-last").classList.remove("s-hidden")),this.scrollToLastViewedProduct(),this.refreshInfiniteScrollMeasurements()):!this.firstPageResponse&&this.switchToNormalBehavior?this.getInitialData().then((async()=>{this.firstPageResponse?(this.appendProductCards(await this.handleResponse(this.firstPageResponse,!1)),setTimeout((()=>{if(!this.autoload&&this.nextPage&&1==this.infiniteScroll.pageIndex){const t=this.host.querySelector(".s-infinite-scroll-wrapper");t&&(t.style.display="block")}}))):console.error("No response received after getInitialData.")})).catch((t=>{console.error("Error during initial data fetch:",t)})):this.firstPageResponse&&this.appendProductCards(await this.handleResponse(this.firstPageResponse,!1)),await this.refreshWishlistIconsAfterHydration()}canRender(){return this.sourceValueIsValid&&this.isReady}render(){return this.canRender()?this.showPlaceholder?i("div",{class:"s-products-list-placeholder"},i("span",{innerHTML:a}),i("p",null,this.placeholderText)):i(e,{class:"s-products-list"},i("div",{class:{"s-products-list-wrapper":!0,"s-products-list-horizontal-cards":this.horizontalCards&&!this.filtersResults,"s-products-list-vertical-cards":!this.horizontalCards&&!this.rowCards&&!this.filtersResults,"s-products-list-row-cards":this.rowCards,"s-products-list-compact-cards":this.compactCards,"s-products-list-filters-results":this.filtersResults},ref:t=>this.wrapper=t}),i("div",{class:"s-infinite-scroll-status",ref:t=>this.status=t},i("p",{class:"s-infinite-scroll-last infinite-scroll-last s-hidden"},this.endOfText),i("p",{class:"s-infinite-scroll-error infinite-scroll-error s-hidden"},this.failedLoadMore)),this.autoload&&i("div",{class:"s-products-list-loading-wrapper",style:{display:"none"},ref:t=>this.loader=t},i("span",{class:"s-button-loader s-button-loader-center s-infinite-scroll-btn-loader"})),this.hasInfiniteScroll&&this.nextPage&&!this.autoload?i("div",{class:"s-infinite-scroll-wrapper",style:{display:"none"},ref:t=>this.loadMoreWrapper=t},i("button",{onClick:()=>this.loadMore(),class:"s-infinite-scroll-btn s-button-btn s-button-primary"},i("span",{class:"s-button-text s-infinite-scroll-btn-text"},this.loadMoreText?this.loadMoreText:salla.lang.get("common.elements.load_more")),i("span",{class:"s-button-loader s-button-loader-center s-infinite-scroll-btn-loader",ref:t=>this.btnLoader=t,style:{display:"none"}}))):""):""}init(){this.initiateInfiniteScroll(),this.loading()}async handleResponse(t,s=!0){if(!t)return[];let i=this.getSource();if(1===t.cursor?.current){if(!this.isAuxiliaryProductsListSource()){let s=l.getPageTitleForSource(i);try{if("search"===this.getSource())s=salla.lang.get("common.elements.search_about",{word:this.getSourceValue()});else if(!s){let i=Object.keys(this.parsedFilters||{}).length?null:this.getSourceValue()[0];s=t.filters?.find((t=>"category_id"===t.key))?.values?.find((t=>t.key==i))?.value??""}s+=(s?" - ":"")+salla.lang.choice("blocks.header.products_count",t.data?.length),15===t.data.length&&(s=s.replace(t.data.length,salla.lang.get("common.elements.more_than")+" "+t.data.length)),t.title=s}catch(t){salla.logger.error("Error::falid to handle response",t)}}l.generateProductSchema(t.data)}this.appendDataLayer(t.data),t.nextPage=this.nextPage,t.source=this.getSource(),t.sourceValue=this.getSourceValue(),salla.event.emit("salla-products-list::products.fetched",t),this.productsFetched.emit(t),this.emitFilters(t),s&&(this.nextPage=await this.resolveNextPageFromCursor(t)),this.loading(!1),this.placeholderLoader&&this.placeholderLoader.remove(),this.hasInfiniteScroll&&!this.nextPage&&(this.infiniteScroll.option({scrollThreshold:!1,loadOnScroll:!1}),this.status.querySelector(".s-infinite-scroll-last").classList.remove("s-hidden"));let e=await this.applyBeforeAppendItems(t.data);const r=[];for(let t=0;t<e.length;t++)r.push(this.getItemHTML(e[t]));return r}async applyBeforeAppendItems(t){const s={component:this,items:t};try{return await salla.hooks.call("salla-products-list","beforeAppendItems",s),Array.isArray(s.items)?s.items:t}catch{return t}}get host(){return r(this)}static get watchers(){return{selectable:["onSelectableChanged"]}}};n.style='.s-products-list-selectable-item{position:relative;border-radius:0.5rem;transition:box-shadow 0.15s ease-in-out}.s-products-list-item-selected{box-shadow:0 0 0 2px var(--color-primary)}.s-products-list-select-control{position:absolute;top:10px;inset-inline-start:10px;z-index:5;display:inline-flex;align-items:center;justify-content:center;cursor:pointer}.s-products-list-select-checkbox{appearance:none;-webkit-appearance:none;-moz-appearance:none;position:relative;width:22px;height:22px;margin:0;cursor:pointer;color:var(--color-primary);border:1px solid rgba(0, 0, 0, 0.15);border-radius:6px;background-color:#fff;box-shadow:0 1px 3px rgba(0, 0, 0, 0.2);transition:background-color 0.15s ease-in-out, border-color 0.15s ease-in-out}.s-products-list-select-checkbox:hover{border-color:var(--color-primary)}.s-products-list-select-checkbox:focus,.s-products-list-select-checkbox:focus-visible{outline:none;border-color:var(--color-primary);box-shadow:0 1px 3px rgba(0, 0, 0, 0.2), 0 0 0 3px color-mix(in srgb, var(--color-primary) 30%, transparent)}.s-products-list-select-checkbox:checked,.s-products-list-select-checkbox:checked:hover,.s-products-list-select-checkbox:checked:focus{background-color:var(--color-primary);border-color:var(--color-primary)}.s-products-list-select-checkbox:checked::after{content:"";position:absolute;top:50%;left:50%;width:5px;height:10px;border:solid #fff;border-width:0 2px 2px 0;transform:translate(-50%, -60%) rotate(45deg)}.s-products-list-row-cards .s-products-list-select-control{top:50%;inset-inline-start:14px;transform:translateY(-50%)}.s-products-list-row-cards .s-products-list-selectable-item>:not(.s-products-list-select-control){padding-inline-start:2.75rem}';export{n as salla_products_list}
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r as a,c as r,h as e}from"./p-Dm54yhRt.js";import{c as s}from"./p-CK_JEpA3.js";import{S as t}from"./p-CXRKXFgT.js";const d=class{constructor(e){a(this,e),this.rewardModalOpen=r(this,"rewardModalOpen"),this.confirmModalOpen=r(this,"confirmModalOpen"),this.size="md",this.isActionClickable=a=>"free_product"!==a.key?.toLowerCase()||a.is_product_available,this.handleActionArea=()=>{this.rewardModalOpen.emit(this.prize)},this.handleAction=()=>{this.isActionClickable(this.prize)&&(salla.config.isUser()?this.confirmModalOpen.emit(this.prize):s((()=>salla.event.dispatch("login::open"))))}}render(){return e("div",{key:"22e55c164715cff3ab89a9d2d0ac98042aee3063",class:{"s-loyalty-program-reward-container":!0,"s-loyalty-program-reward-xs":"xs"===this.size}},e("div",{key:"f4854008846b39552fdce909b497e43c649543ca",onClick:this.handleActionArea,role:"button"},e("div",{key:"adc5c0df86193798cc166f6adfa0c2447df0832b",class:"s-loyalty-program-reward-img"},e("img",{key:"859cc1f77a4be5548ff1caa6820ec40b09af213d",src:this.prize.image,class:"s-loyalty-program-rewards-img",alt:""})),e("div",{key:"8c7d6248e557108462dfb82ba2974768686734c7",class:"s-loyalty-program-reward-content"},e("div",{key:"a2bf4e4971697d3cefb3d14d5ef5fbe4406edd09",class:"s-loyalty-program-reward-points"},e("salla-badge",{key:"06640ab8ec19795a8a451274c371e0f77f888fb7",size:"xs"},e("span",{key:"f5c90a08e80d106bf11fe45a9c3ace3cedf61af1",innerHTML:t}),e("span",{key:"7feeea4188439c1c23acacf222149e7c59367dc4",class:"s-loyalty-program-rewards-points",innerHTML:salla.lang.choice("pages.loyalty_program.points",this.prize.cost_points)}))),e("div",{key:"8e5ef727a8c704b8f0040b752796bc59924ee64c",class:"s-loyalty-program-reward-title"},e("span",{key:"fbdd1636477122d629ec2fec71d8a57bc8dfe4cb"},this.group)),e("div",{key:"a0d4f204e207be64bdb515e7e4e8ba89235b2693",class:"s-loyalty-program-reward-name"},e("div",{key:"000794a28c85f67d0c72a4f886c81d303a41f345",class:"s-loyalty-program-rewards-name",id:`prize-${this.prize.id}`},this.prize.name)))),e("div",{key:"d4c51e1fe48bf9ec23f9c9d0b48b0e2343428d59",class:"p-4"},e("button",{key:"ca12fd9a4ee98380ed1db9f7aebbbf1e2906ab79",onClick:this.handleAction,disabled:!this.isActionClickable(this.prize),class:{"s-loyalty-program-rewards-action-base":!0,"s-loyalty-program-rewards-action-on":this.isActionClickable(this.prize),"s-loyalty-program-rewards-action-off":!this.isActionClickable(this.prize)}},this.isActionClickable(this.prize)?salla.lang.get("pages.loyalty_program.redeem_reward"):salla.lang.get("pages.loyalty_program.out_of_stock"))))}};d.style="@media (max-width: 639px){.s-loyalty-program-modal .s-modal-body{position:relative !important;left:unset !important;bottom:unset !important;max-height:100dvh;overflow-y:auto !important}}.s-loyalty-exchange-card salla-product-card .s-product-card-image,.s-loyalty-exchange-card custom-salla-product-card .s-product-card-image{flex:none;aspect-ratio:1;overflow:hidden}.s-loyalty-exchange-card-btn{padding:0 1.25rem 1.25rem;margin-top:0.75rem}.s-loyalty-program-reward-details-products-grid{display:flex;flex-wrap:wrap;gap:1rem;margin-top:0.75rem}.s-loyalty-program-reward-details-products-grid>*{flex:1 1 100%;min-width:0;touch-action:pan-y}@media (min-width: 640px){.s-loyalty-program-reward-details-products-grid>*{flex-basis:calc((100% - 1rem) / 2)}}@media (min-width: 768px){.s-loyalty-program-reward-details-products-grid>*{flex-basis:calc((100% - 2rem) / 3)}}.s-loyalty-program-reward-details-products-grid>*:only-child{max-width:320px;margin-inline:auto}.s-loyalty-program-reward-details-products-grid:has(>*:nth-child(3))>*{flex-grow:0}";export{d as salla_loyalty_reward}
4
+ import{r as a,c as r,h as e}from"./p-LKlIr4DH.js";import{c as s}from"./p-By36wPtc.js";import{S as t}from"./p-CXRKXFgT.js";const d=class{constructor(e){a(this,e),this.rewardModalOpen=r(this,"rewardModalOpen"),this.confirmModalOpen=r(this,"confirmModalOpen"),this.size="md",this.isActionClickable=a=>"free_product"!==a.key?.toLowerCase()||a.is_product_available,this.handleActionArea=()=>{this.rewardModalOpen.emit(this.prize)},this.handleAction=()=>{this.isActionClickable(this.prize)&&(salla.config.isUser()?this.confirmModalOpen.emit(this.prize):s((()=>salla.event.dispatch("login::open"))))}}render(){return e("div",{key:"22e55c164715cff3ab89a9d2d0ac98042aee3063",class:{"s-loyalty-program-reward-container":!0,"s-loyalty-program-reward-xs":"xs"===this.size}},e("div",{key:"f4854008846b39552fdce909b497e43c649543ca",onClick:this.handleActionArea,role:"button"},e("div",{key:"adc5c0df86193798cc166f6adfa0c2447df0832b",class:"s-loyalty-program-reward-img"},e("img",{key:"859cc1f77a4be5548ff1caa6820ec40b09af213d",src:this.prize.image,class:"s-loyalty-program-rewards-img",alt:""})),e("div",{key:"8c7d6248e557108462dfb82ba2974768686734c7",class:"s-loyalty-program-reward-content"},e("div",{key:"a2bf4e4971697d3cefb3d14d5ef5fbe4406edd09",class:"s-loyalty-program-reward-points"},e("salla-badge",{key:"06640ab8ec19795a8a451274c371e0f77f888fb7",size:"xs"},e("span",{key:"f5c90a08e80d106bf11fe45a9c3ace3cedf61af1",innerHTML:t}),e("span",{key:"7feeea4188439c1c23acacf222149e7c59367dc4",class:"s-loyalty-program-rewards-points",innerHTML:salla.lang.choice("pages.loyalty_program.points",this.prize.cost_points)}))),e("div",{key:"8e5ef727a8c704b8f0040b752796bc59924ee64c",class:"s-loyalty-program-reward-title"},e("span",{key:"fbdd1636477122d629ec2fec71d8a57bc8dfe4cb"},this.group)),e("div",{key:"a0d4f204e207be64bdb515e7e4e8ba89235b2693",class:"s-loyalty-program-reward-name"},e("div",{key:"000794a28c85f67d0c72a4f886c81d303a41f345",class:"s-loyalty-program-rewards-name",id:`prize-${this.prize.id}`},this.prize.name)))),e("div",{key:"d4c51e1fe48bf9ec23f9c9d0b48b0e2343428d59",class:"p-4"},e("button",{key:"ca12fd9a4ee98380ed1db9f7aebbbf1e2906ab79",onClick:this.handleAction,disabled:!this.isActionClickable(this.prize),class:{"s-loyalty-program-rewards-action-base":!0,"s-loyalty-program-rewards-action-on":this.isActionClickable(this.prize),"s-loyalty-program-rewards-action-off":!this.isActionClickable(this.prize)}},this.isActionClickable(this.prize)?salla.lang.get("pages.loyalty_program.redeem_reward"):salla.lang.get("pages.loyalty_program.out_of_stock"))))}};d.style="@media (max-width: 639px){.s-loyalty-program-modal .s-modal-body{position:relative !important;left:unset !important;bottom:unset !important;max-height:100dvh;overflow-y:auto !important}}.s-loyalty-exchange-card salla-product-card .s-product-card-image,.s-loyalty-exchange-card custom-salla-product-card .s-product-card-image{flex:none;aspect-ratio:1;overflow:hidden}.s-loyalty-exchange-card-btn{padding:0 1.25rem 1.25rem;margin-top:0.75rem}.s-loyalty-program-reward-details-products-grid{display:flex;flex-wrap:wrap;gap:1rem;margin-top:0.75rem}.s-loyalty-program-reward-details-products-grid>*{flex:1 1 100%;min-width:0;touch-action:pan-y}@media (min-width: 640px){.s-loyalty-program-reward-details-products-grid>*{flex-basis:calc((100% - 1rem) / 2)}}@media (min-width: 768px){.s-loyalty-program-reward-details-products-grid>*{flex-basis:calc((100% - 2rem) / 3)}}.s-loyalty-program-reward-details-products-grid>*:only-child{max-width:320px;margin-inline:auto}.s-loyalty-program-reward-details-products-grid:has(>*:nth-child(3))>*{flex-grow:0}";export{d as salla_loyalty_reward}
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r as s,h as a,H as t,a as o}from"./p-Dm54yhRt.js";const i=class{constructor(a){s(this,a),this.availableCoupons=[],this.cartTotal=0,this.cartTotalReady=!1,this.currentCoupon="",this.couponInputValue="",this.couponError="",this.isApplying=!1,this.appliedCoupons=[],this.multiCoupon=!1,this.isHandlingInternalError=!1,this.cartUpdatedHandler=s=>{this.syncCartTotal(s),(this.multiCoupon?Array.isArray(s?.coupons):s&&"coupon"in s)&&this.syncAppliedFromCart(s),this.couponError=""},this.couponAddedHandler=()=>{this.isApplying||this.isHandlingInternalError||this.refreshFromServer()},this.couponAdditionFailedHandler=s=>{this.isApplying||this.isHandlingInternalError||this.showCouponError(s?.message||salla.lang.get("pages.cart.coupon_application_error"))},this.couponDeletedHandler=()=>{this.isApplying||this.isHandlingInternalError||this.refreshFromServer()},this.onKeyUp=s=>{"Enter"===s.key&&this.couponButtonRef?.click(),this.couponError=""},this.onInput=s=>{this.couponInputValue=s.target.value}}async componentWillLoad(){await Salla.onReady(),await Salla.lang.onLoaded(),this.multiCoupon=!!salla.config.get("store.settings.cart.multi_coupon"),this.loadCouponsData(),this.seedFromStorage(),this.loadCartTotal(),this.setupCartEventListeners()}setupCartEventListeners(){salla.event.on("cart::updated",this.cartUpdatedHandler),salla.event.on("cart::coupon.added",this.couponAddedHandler),salla.event.on("cart::coupon.addition.failed",this.couponAdditionFailedHandler),salla.event.on("cart::coupon.deleted",this.couponDeletedHandler)}disconnectedCallback(){salla.event.off("cart::updated",this.cartUpdatedHandler),salla.event.off("cart::coupon.added",this.couponAddedHandler),salla.event.off("cart::coupon.addition.failed",this.couponAdditionFailedHandler),salla.event.off("cart::coupon.deleted",this.couponDeletedHandler)}async selectCoupon(s){const a=this.availableCoupons.find((a=>a.code===s));if(a){if(!this.isEligible(a))throw new Error("Coupon not eligible: minimum cart amount not met");try{await this.applyCoupon(s),this.host.dispatchEvent(new CustomEvent("salla::cart-coupons.coupon.selected",{detail:a,bubbles:!0}))}catch(s){throw s}}return a}async loadCouponsData(){try{const s=await salla.api.request("coupons"),a=s?.data,t=Array.isArray(a)?a:Array.isArray(a?.data)?a.data:[];this.availableCoupons=t}catch(s){console.warn("Failed to load coupons:",s),this.availableCoupons=[]}}async loadCartTotal(){await this.refreshFromServer()}seedFromStorage(){if(this.multiCoupon)return;const s=salla.storage.get("cart");s&&"object"==typeof s&&"coupon"in s&&this.applyCart(s),this.seedTotalsFromSummaryStorage()}seedTotalsFromSummaryStorage(){const s=salla.storage.get("cart.summary");s&&"object"==typeof s&&null!=s.sub_total&&(this.cartTotal=Number(s.sub_total),this.cartTotalReady=!0)}syncCartTotal(s){const a=s?.summary?.sub_total??s?.sub_total??s?.total;null!=a&&(this.cartTotal=Number(a),this.cartTotalReady=!0)}async refreshFromServer(){try{const s=await salla.cart.details(),a=s?.data?.cart??s?.data??s;if(a&&"object"==typeof a&&(Array.isArray(a.coupons)||"coupon"in a))return void this.applyCart(a)}catch(s){}const s=salla.storage.get("cart");s&&this.applyCart(s),this.seedTotalsFromSummaryStorage()}applyCart(s){this.syncCartTotal(s),this.syncAppliedFromCart(s)}syncAppliedFromCart(s){this.currentCoupon=s?.coupon||"",this.multiCoupon?this.appliedCoupons=Array.isArray(s?.coupons)?s.coupons.filter(Boolean):this.currentCoupon?[this.currentCoupon]:[]:(this.couponInputValue=this.currentCoupon,this.appliedCoupons=this.currentCoupon?[this.currentCoupon]:[])}async handleApplyClick(){if(this.isApplying)return;const s=this.couponInputValue.trim();if(s){this.isApplying=!0,this.isHandlingInternalError=!0;try{await salla.cart.addCoupon(s),await this.refreshFromServer(),this.couponInputValue=""}catch(s){this.showCouponError(s.response?.data?.error?.message||salla.lang.get("pages.cart.coupon_application_error"))}finally{this.isApplying=!1,setTimeout((()=>{this.isHandlingInternalError=!1}),100)}}else this.showCouponError(salla.lang.get("pages.cart.enter_coupon_code"))}async handleCouponButtonClick(){if(this.isApplying)return;const s=!!this.currentCoupon;if(s||this.couponInputValue.trim()){this.isApplying=!0,this.isHandlingInternalError=!0;try{s?await salla.cart.deleteCoupon():await salla.cart.addCoupon(this.couponInputValue.trim()),await this.refreshFromServer()}catch(s){this.showCouponError(s.response?.data?.error?.message||salla.lang.get("pages.cart.coupon_application_error"))}finally{this.isApplying=!1,setTimeout((()=>{this.isHandlingInternalError=!1}),100)}}else this.showCouponError(salla.lang.get("pages.cart.enter_coupon_code"))}async removeCoupon(s){if(!this.isApplying){this.isApplying=!0,this.isHandlingInternalError=!0;try{this.multiCoupon?await salla.cart.deleteCoupon(s):await salla.cart.deleteCoupon(),await this.refreshFromServer()}catch(s){this.showCouponError(s.response?.data?.error?.message||salla.lang.get("pages.cart.coupon_application_error"))}finally{this.isApplying=!1,setTimeout((()=>{this.isHandlingInternalError=!1}),100)}}}showCouponError(s){this.couponError=s}handleCouponClick(s){this.applyCoupon(s.code,!1).catch((()=>{}))}async applyCoupon(s,a=!0){if(this.isApplying){if(a)throw new Error("Coupon application already in progress")}else{this.couponInputValue=s,this.couponError="",this.isApplying=!0,this.isHandlingInternalError=!0;try{await salla.cart.addCoupon(s.trim()),await this.refreshFromServer(),this.multiCoupon&&(this.couponInputValue="")}catch(s){if(this.showCouponError(s.response?.data?.error?.message||salla.lang.get("pages.cart.coupon_application_error")),a)throw s}finally{this.isApplying=!1,setTimeout((()=>{this.isHandlingInternalError=!1}),100)}}}formatMainAmount(s){if("percentage"===s.type)return`${salla.helpers.number("object"==typeof s.amount?s.amount.amount:s.amount)}%`;{const t="object"==typeof s.amount?s.amount:{amount:s.amount,currency:s.minimum_amount?.currency||salla.config.get("store.currency.code","SAR")};return a("span",{innerHTML:salla.money(t.amount,t.currency)})}}isEligible(s){return!this.cartTotalReady||!s.minimum_amount||this.cartTotal>=parseFloat(s.minimum_amount.amount)}renderCouponCard(s){const t=this.isEligible(s);return a("div",{class:"s-cart-coupons-slide-one-fourth swiper-slide"},a("div",{class:"s-cart-coupons-card "+(!t||this.isApplying?"s-cart-coupons-disabled":""),onClick:()=>t&&!this.isApplying&&this.handleCouponClick(s)},a("div",{class:"s-cart-coupons-top-section"},a("div",{class:"s-cart-coupons-discount-values"},a("div",{class:"s-cart-coupons-main-amount"},this.formatMainAmount(s)),s.free_shipping?a("div",{class:"s-cart-coupons-secondary-info"},"+ ",salla.lang.get("pages.cart.free_shipping")):s.maximum_amount&&a("div",{class:"s-cart-coupons-secondary-info"},salla.lang.get("pages.cart.up_to")," ",a("span",{innerHTML:salla.money(s.maximum_amount.amount,s.maximum_amount.currency)}))),a("div",{class:"s-cart-coupons-code"},s.code)),a("div",{class:"s-cart-coupons-divider"}),a("div",{class:"s-cart-coupons-bottom-section"},a("div",{class:"s-cart-coupons-terms"},null!=s.remaining_days&&a("div",{class:"s-cart-coupons-expiry "+(s.remaining_days<=3?"s-cart-coupons-expiry-warning":"")},0===s.remaining_days?salla.lang.get("pages.cart.expires_today"):`${salla.lang.get("pages.cart.expires_after")} ${s.remaining_days} ${salla.lang.get("pages.cart.day")}`),s.minimum_amount&&parseFloat(s.minimum_amount.amount)>0&&a("div",{class:"s-cart-coupons-minimum"},salla.lang.get("pages.cart.minimum")," ",a("span",{innerHTML:salla.money(s.minimum_amount.amount,s.minimum_amount.currency)}))),a("div",{class:"s-cart-coupons-action"},t?salla.lang.get("pages.cart.save_coupon"):salla.lang.get("pages.cart.coupon_not_compatible")))))}render(){return a(t,{key:"e3bed8f1f2019db5e1c5ca4280696933913e3081"},a("div",{key:"9c6a7c383394f9bd19107db9b8e76fd9129648e3",class:"s-cart-coupons-wrapper"},a("div",{key:"1e7f74969e709062c36aa19ff4ec27bde0bb10df",class:"s-cart-coupons-input-section"},a("label",{key:"f3bc1f4ffa9c8a64bee8af273597d6f8ff1f8fd0",htmlFor:"coupon-input",class:"s-cart-coupons-coupon-label"},salla.lang.get("pages.cart.have_coupon")),a("div",{key:"7abbdbd41cf6e65b6c08928bb10a68bfb2677d85",class:"s-cart-coupons-coupon-input-container"},this.multiCoupon?[a("input",{type:"text",id:"coupon-input",name:"coupon",class:"form-input "+(this.couponError?"s-coupon-input-error":""),placeholder:salla.lang.get("pages.cart.coupon_placeholder"),value:this.couponInputValue,disabled:this.isApplying,onInput:this.onInput,onKeyUp:this.onKeyUp,"aria-label":salla.lang.get("pages.cart.apply_coupon"),key:"coupon-input"}),a("salla-button",{ref:s=>this.couponButtonRef=s,class:"s-cart-coupons-coupon-button s-cart-coupons-coupon-button-apply",color:"primary",loading:this.isApplying,"loader-position":"center",onClick:()=>this.handleApplyClick(),key:"apply-button"},a("span",null,salla.lang.get("pages.cart.save_coupon")))]:[a("input",{type:"text",id:"coupon-input",name:"coupon",class:"form-input "+(this.couponError?"s-coupon-input-error":""),placeholder:salla.lang.get("pages.cart.coupon_placeholder"),value:this.couponInputValue,disabled:!!this.currentCoupon||this.isApplying,onInput:this.onInput,onKeyUp:this.onKeyUp,"aria-label":salla.lang.get("pages.cart.apply_coupon"),key:"coupon-input"}),a("salla-button",{ref:s=>this.couponButtonRef=s,class:"s-cart-coupons-coupon-button "+(this.currentCoupon?"s-cart-coupons-coupon-button-remove":"s-cart-coupons-coupon-button-apply"),color:this.currentCoupon?"danger":"primary",loading:this.isApplying,"loader-position":"center",onClick:()=>this.handleCouponButtonClick(),key:"apply-button"},this.currentCoupon?a("i",{class:"sicon-cancel"}):a("span",null,salla.lang.get("pages.cart.save_coupon")))]),this.couponError&&a("span",{key:"6c259fbca7a2a3c2ece3d4c335707c833be5f8d6",class:"s-cart-coupons-coupon-error"},this.couponError),this.multiCoupon&&this.appliedCoupons.length>0&&a("div",{key:"87335fd875279e97fc7a02c9f3519af51a953a7b",class:"s-cart-coupons-applied-list"},this.appliedCoupons.map((s=>a("div",{class:"s-cart-coupons-applied-item",key:s},a("span",{class:"s-cart-coupons-applied-code"},s),a("button",{type:"button",class:"s-cart-coupons-applied-remove","aria-label":`${salla.lang.get("pages.cart.delete")} ${s}`,disabled:this.isApplying,onClick:()=>this.removeCoupon(s)},a("i",{class:"sicon-cancel"}))))))),this.availableCoupons&&this.availableCoupons.length>0&&a("salla-slider",{key:"86c665d3135fa8bc393c4b7ad9daca3ce87bed50",type:"carousel",showControls:!1,class:"s-cart-coupons-slider"},a("div",{key:"45ddccd7e0c5d38e9b98f42862a6d64f6040c942",slot:"items"},this.availableCoupons.map((s=>this.renderCouponCard(s)))))))}get host(){return o(this)}};i.style='.s-cart-coupons-applied-list{display:flex;flex-direction:column;gap:8px;margin-top:12px}.s-cart-coupons-applied-item{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:10px 12px;background:#fff;border:1px solid #e5e7eb;border-radius:10px;border-inline-start:3px solid #10b981}.s-cart-coupons-applied-code{display:inline-flex;align-items:center;gap:6px;font-size:13px;font-weight:700;color:#111827}.s-cart-coupons-applied-code::before{content:"";width:7px;height:7px;border-radius:9999px;background:#10b981}.s-cart-coupons-applied-remove{display:inline-flex;align-items:center;justify-content:center;width:26px;height:26px;color:#ef4444;background:transparent;border:0;border-radius:9999px;cursor:pointer;transition:background-color 0.15s ease, color 0.15s ease}.s-cart-coupons-applied-remove:hover{background:#fef2f2}.s-cart-coupons-applied-remove:disabled{opacity:0.5;cursor:not-allowed}';export{i as salla_cart_coupons}
4
+ import{r as s,h as a,H as t,a as o}from"./p-LKlIr4DH.js";const i=class{constructor(a){s(this,a),this.availableCoupons=[],this.cartTotal=0,this.cartTotalReady=!1,this.currentCoupon="",this.couponInputValue="",this.couponError="",this.isApplying=!1,this.appliedCoupons=[],this.multiCoupon=!1,this.isHandlingInternalError=!1,this.cartUpdatedHandler=s=>{this.syncCartTotal(s),(this.multiCoupon?Array.isArray(s?.coupons):s&&"coupon"in s)&&this.syncAppliedFromCart(s),this.couponError=""},this.couponAddedHandler=()=>{this.isApplying||this.isHandlingInternalError||this.refreshFromServer()},this.couponAdditionFailedHandler=s=>{this.isApplying||this.isHandlingInternalError||this.showCouponError(s?.message||salla.lang.get("pages.cart.coupon_application_error"))},this.couponDeletedHandler=()=>{this.isApplying||this.isHandlingInternalError||this.refreshFromServer()},this.onKeyUp=s=>{"Enter"===s.key&&this.couponButtonRef?.click(),this.couponError=""},this.onInput=s=>{this.couponInputValue=s.target.value}}async componentWillLoad(){await Salla.onReady(),await Salla.lang.onLoaded(),this.multiCoupon=!!salla.config.get("store.settings.cart.multi_coupon"),this.loadCouponsData(),this.seedFromStorage(),this.loadCartTotal(),this.setupCartEventListeners()}setupCartEventListeners(){salla.event.on("cart::updated",this.cartUpdatedHandler),salla.event.on("cart::coupon.added",this.couponAddedHandler),salla.event.on("cart::coupon.addition.failed",this.couponAdditionFailedHandler),salla.event.on("cart::coupon.deleted",this.couponDeletedHandler)}disconnectedCallback(){salla.event.off("cart::updated",this.cartUpdatedHandler),salla.event.off("cart::coupon.added",this.couponAddedHandler),salla.event.off("cart::coupon.addition.failed",this.couponAdditionFailedHandler),salla.event.off("cart::coupon.deleted",this.couponDeletedHandler)}async selectCoupon(s){const a=this.availableCoupons.find((a=>a.code===s));if(a){if(!this.isEligible(a))throw new Error("Coupon not eligible: minimum cart amount not met");try{await this.applyCoupon(s),this.host.dispatchEvent(new CustomEvent("salla::cart-coupons.coupon.selected",{detail:a,bubbles:!0}))}catch(s){throw s}}return a}async loadCouponsData(){try{const s=await salla.api.request("coupons"),a=s?.data,t=Array.isArray(a)?a:Array.isArray(a?.data)?a.data:[];this.availableCoupons=t}catch(s){console.warn("Failed to load coupons:",s),this.availableCoupons=[]}}async loadCartTotal(){await this.refreshFromServer()}seedFromStorage(){if(this.multiCoupon)return;const s=salla.storage.get("cart");s&&"object"==typeof s&&"coupon"in s&&this.applyCart(s),this.seedTotalsFromSummaryStorage()}seedTotalsFromSummaryStorage(){const s=salla.storage.get("cart.summary");s&&"object"==typeof s&&null!=s.sub_total&&(this.cartTotal=Number(s.sub_total),this.cartTotalReady=!0)}syncCartTotal(s){const a=s?.summary?.sub_total??s?.sub_total??s?.total;null!=a&&(this.cartTotal=Number(a),this.cartTotalReady=!0)}async refreshFromServer(){try{const s=await salla.cart.details(),a=s?.data?.cart??s?.data??s;if(a&&"object"==typeof a&&(Array.isArray(a.coupons)||"coupon"in a))return void this.applyCart(a)}catch(s){}const s=salla.storage.get("cart");s&&this.applyCart(s),this.seedTotalsFromSummaryStorage()}applyCart(s){this.syncCartTotal(s),this.syncAppliedFromCart(s)}syncAppliedFromCart(s){this.currentCoupon=s?.coupon||"",this.multiCoupon?this.appliedCoupons=Array.isArray(s?.coupons)?s.coupons.filter(Boolean):this.currentCoupon?[this.currentCoupon]:[]:(this.couponInputValue=this.currentCoupon,this.appliedCoupons=this.currentCoupon?[this.currentCoupon]:[])}async handleApplyClick(){if(this.isApplying)return;const s=this.couponInputValue.trim();if(s){this.isApplying=!0,this.isHandlingInternalError=!0;try{await salla.cart.addCoupon(s),await this.refreshFromServer(),this.couponInputValue=""}catch(s){this.showCouponError(s.response?.data?.error?.message||salla.lang.get("pages.cart.coupon_application_error"))}finally{this.isApplying=!1,setTimeout((()=>{this.isHandlingInternalError=!1}),100)}}else this.showCouponError(salla.lang.get("pages.cart.enter_coupon_code"))}async handleCouponButtonClick(){if(this.isApplying)return;const s=!!this.currentCoupon;if(s||this.couponInputValue.trim()){this.isApplying=!0,this.isHandlingInternalError=!0;try{s?await salla.cart.deleteCoupon():await salla.cart.addCoupon(this.couponInputValue.trim()),await this.refreshFromServer()}catch(s){this.showCouponError(s.response?.data?.error?.message||salla.lang.get("pages.cart.coupon_application_error"))}finally{this.isApplying=!1,setTimeout((()=>{this.isHandlingInternalError=!1}),100)}}else this.showCouponError(salla.lang.get("pages.cart.enter_coupon_code"))}async removeCoupon(s){if(!this.isApplying){this.isApplying=!0,this.isHandlingInternalError=!0;try{this.multiCoupon?await salla.cart.deleteCoupon(s):await salla.cart.deleteCoupon(),await this.refreshFromServer()}catch(s){this.showCouponError(s.response?.data?.error?.message||salla.lang.get("pages.cart.coupon_application_error"))}finally{this.isApplying=!1,setTimeout((()=>{this.isHandlingInternalError=!1}),100)}}}showCouponError(s){this.couponError=s}handleCouponClick(s){this.applyCoupon(s.code,!1).catch((()=>{}))}async applyCoupon(s,a=!0){if(this.isApplying){if(a)throw new Error("Coupon application already in progress")}else{this.couponInputValue=s,this.couponError="",this.isApplying=!0,this.isHandlingInternalError=!0;try{await salla.cart.addCoupon(s.trim()),await this.refreshFromServer(),this.multiCoupon&&(this.couponInputValue="")}catch(s){if(this.showCouponError(s.response?.data?.error?.message||salla.lang.get("pages.cart.coupon_application_error")),a)throw s}finally{this.isApplying=!1,setTimeout((()=>{this.isHandlingInternalError=!1}),100)}}}formatMainAmount(s){if("percentage"===s.type)return`${salla.helpers.number("object"==typeof s.amount?s.amount.amount:s.amount)}%`;{const t="object"==typeof s.amount?s.amount:{amount:s.amount,currency:s.minimum_amount?.currency||salla.config.get("store.currency.code","SAR")};return a("span",{innerHTML:salla.money(t.amount,t.currency)})}}isEligible(s){return!this.cartTotalReady||!s.minimum_amount||this.cartTotal>=parseFloat(s.minimum_amount.amount)}renderCouponCard(s){const t=this.isEligible(s);return a("div",{class:"s-cart-coupons-slide-one-fourth swiper-slide"},a("div",{class:"s-cart-coupons-card "+(!t||this.isApplying?"s-cart-coupons-disabled":""),onClick:()=>t&&!this.isApplying&&this.handleCouponClick(s)},a("div",{class:"s-cart-coupons-top-section"},a("div",{class:"s-cart-coupons-discount-values"},a("div",{class:"s-cart-coupons-main-amount"},this.formatMainAmount(s)),s.free_shipping?a("div",{class:"s-cart-coupons-secondary-info"},"+ ",salla.lang.get("pages.cart.free_shipping")):s.maximum_amount&&a("div",{class:"s-cart-coupons-secondary-info"},salla.lang.get("pages.cart.up_to")," ",a("span",{innerHTML:salla.money(s.maximum_amount.amount,s.maximum_amount.currency)}))),a("div",{class:"s-cart-coupons-code"},s.code)),a("div",{class:"s-cart-coupons-divider"}),a("div",{class:"s-cart-coupons-bottom-section"},a("div",{class:"s-cart-coupons-terms"},null!=s.remaining_days&&a("div",{class:"s-cart-coupons-expiry "+(s.remaining_days<=3?"s-cart-coupons-expiry-warning":"")},0===s.remaining_days?salla.lang.get("pages.cart.expires_today"):`${salla.lang.get("pages.cart.expires_after")} ${s.remaining_days} ${salla.lang.get("pages.cart.day")}`),s.minimum_amount&&parseFloat(s.minimum_amount.amount)>0&&a("div",{class:"s-cart-coupons-minimum"},salla.lang.get("pages.cart.minimum")," ",a("span",{innerHTML:salla.money(s.minimum_amount.amount,s.minimum_amount.currency)}))),a("div",{class:"s-cart-coupons-action"},t?salla.lang.get("pages.cart.save_coupon"):salla.lang.get("pages.cart.coupon_not_compatible")))))}render(){return a(t,{key:"e3bed8f1f2019db5e1c5ca4280696933913e3081"},a("div",{key:"9c6a7c383394f9bd19107db9b8e76fd9129648e3",class:"s-cart-coupons-wrapper"},a("div",{key:"1e7f74969e709062c36aa19ff4ec27bde0bb10df",class:"s-cart-coupons-input-section"},a("label",{key:"f3bc1f4ffa9c8a64bee8af273597d6f8ff1f8fd0",htmlFor:"coupon-input",class:"s-cart-coupons-coupon-label"},salla.lang.get("pages.cart.have_coupon")),a("div",{key:"7abbdbd41cf6e65b6c08928bb10a68bfb2677d85",class:"s-cart-coupons-coupon-input-container"},this.multiCoupon?[a("input",{type:"text",id:"coupon-input",name:"coupon",class:"form-input "+(this.couponError?"s-coupon-input-error":""),placeholder:salla.lang.get("pages.cart.coupon_placeholder"),value:this.couponInputValue,disabled:this.isApplying,onInput:this.onInput,onKeyUp:this.onKeyUp,"aria-label":salla.lang.get("pages.cart.apply_coupon"),key:"coupon-input"}),a("salla-button",{ref:s=>this.couponButtonRef=s,class:"s-cart-coupons-coupon-button s-cart-coupons-coupon-button-apply",color:"primary",loading:this.isApplying,"loader-position":"center",onClick:()=>this.handleApplyClick(),key:"apply-button"},a("span",null,salla.lang.get("pages.cart.save_coupon")))]:[a("input",{type:"text",id:"coupon-input",name:"coupon",class:"form-input "+(this.couponError?"s-coupon-input-error":""),placeholder:salla.lang.get("pages.cart.coupon_placeholder"),value:this.couponInputValue,disabled:!!this.currentCoupon||this.isApplying,onInput:this.onInput,onKeyUp:this.onKeyUp,"aria-label":salla.lang.get("pages.cart.apply_coupon"),key:"coupon-input"}),a("salla-button",{ref:s=>this.couponButtonRef=s,class:"s-cart-coupons-coupon-button "+(this.currentCoupon?"s-cart-coupons-coupon-button-remove":"s-cart-coupons-coupon-button-apply"),color:this.currentCoupon?"danger":"primary",loading:this.isApplying,"loader-position":"center",onClick:()=>this.handleCouponButtonClick(),key:"apply-button"},this.currentCoupon?a("i",{class:"sicon-cancel"}):a("span",null,salla.lang.get("pages.cart.save_coupon")))]),this.couponError&&a("span",{key:"6c259fbca7a2a3c2ece3d4c335707c833be5f8d6",class:"s-cart-coupons-coupon-error"},this.couponError),this.multiCoupon&&this.appliedCoupons.length>0&&a("div",{key:"87335fd875279e97fc7a02c9f3519af51a953a7b",class:"s-cart-coupons-applied-list"},this.appliedCoupons.map((s=>a("div",{class:"s-cart-coupons-applied-item",key:s},a("span",{class:"s-cart-coupons-applied-code"},s),a("button",{type:"button",class:"s-cart-coupons-applied-remove","aria-label":`${salla.lang.get("pages.cart.delete")} ${s}`,disabled:this.isApplying,onClick:()=>this.removeCoupon(s)},a("i",{class:"sicon-cancel"}))))))),this.availableCoupons&&this.availableCoupons.length>0&&a("salla-slider",{key:"86c665d3135fa8bc393c4b7ad9daca3ce87bed50",type:"carousel",showControls:!1,class:"s-cart-coupons-slider"},a("div",{key:"45ddccd7e0c5d38e9b98f42862a6d64f6040c942",slot:"items"},this.availableCoupons.map((s=>this.renderCouponCard(s)))))))}get host(){return o(this)}};i.style='.s-cart-coupons-applied-list{display:flex;flex-direction:column;gap:8px;margin-top:12px}.s-cart-coupons-applied-item{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:10px 12px;background:#fff;border:1px solid #e5e7eb;border-radius:10px;border-inline-start:3px solid #10b981}.s-cart-coupons-applied-code{display:inline-flex;align-items:center;gap:6px;font-size:13px;font-weight:700;color:#111827}.s-cart-coupons-applied-code::before{content:"";width:7px;height:7px;border-radius:9999px;background:#10b981}.s-cart-coupons-applied-remove{display:inline-flex;align-items:center;justify-content:center;width:26px;height:26px;color:#ef4444;background:transparent;border:0;border-radius:9999px;cursor:pointer;transition:background-color 0.15s ease, color 0.15s ease}.s-cart-coupons-applied-remove:hover{background:#fef2f2}.s-cart-coupons-applied-remove:disabled{opacity:0.5;cursor:not-allowed}';export{i as salla_cart_coupons}
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{d as e}from"./p-Dm54yhRt.js";function E(e,E){return E.forEach((function(E){E&&"string"!=typeof E&&!Array.isArray(E)&&Object.keys(E).forEach((function(i){if("default"!==i&&!(i in e)){var _=Object.getOwnPropertyDescriptor(E,i);Object.defineProperty(e,i,_.get?_:{enumerable:!0,get:function(){return E[i]}})}}))})),Object.freeze(e)}var i,_,l={exports:{}},n=i?l.exports:(i=1,l.exports=(_=function(e){var E=e.addFilter,i=e.utils,_=i.Type,l=i.replaceInString,n=i.toNaturalFileSize;return E("ALLOW_HOPPER_ITEM",(function(e,E){var i=E.query;if(!i("GET_ALLOW_FILE_SIZE_VALIDATION"))return!0;var _=i("GET_MAX_FILE_SIZE");if(null!==_&&e.size>_)return!1;var l=i("GET_MIN_FILE_SIZE");return!(null!==l&&e.size<l)})),E("LOAD_FILE",(function(e,E){var i=E.query;return new Promise((function(E,_){if(!i("GET_ALLOW_FILE_SIZE_VALIDATION"))return E(e);var t=i("GET_FILE_VALIDATE_SIZE_FILTER");if(t&&!t(e))return E(e);var I=i("GET_MAX_FILE_SIZE");if(null!==I&&e.size>I)_({status:{main:i("GET_LABEL_MAX_FILE_SIZE_EXCEEDED"),sub:l(i("GET_LABEL_MAX_FILE_SIZE"),{filesize:n(I,".",i("GET_FILE_SIZE_BASE"),i("GET_FILE_SIZE_LABELS",i))})}});else{var L=i("GET_MIN_FILE_SIZE");if(null!==L&&e.size<L)_({status:{main:i("GET_LABEL_MIN_FILE_SIZE_EXCEEDED"),sub:l(i("GET_LABEL_MIN_FILE_SIZE"),{filesize:n(L,".",i("GET_FILE_SIZE_BASE"),i("GET_FILE_SIZE_LABELS",i))})}});else{var a=i("GET_MAX_TOTAL_FILE_SIZE");if(null!==a&&i("GET_ACTIVE_ITEMS").reduce((function(e,E){return e+E.fileSize}),0)>a)return void _({status:{main:i("GET_LABEL_MAX_TOTAL_FILE_SIZE_EXCEEDED"),sub:l(i("GET_LABEL_MAX_TOTAL_FILE_SIZE"),{filesize:n(a,".",i("GET_FILE_SIZE_BASE"),i("GET_FILE_SIZE_LABELS",i))})}});E(e)}}}))})),{options:{allowFileSizeValidation:[!0,_.BOOLEAN],maxFileSize:[null,_.INT],minFileSize:[null,_.INT],maxTotalFileSize:[null,_.INT],fileValidateSizeFilter:[null,_.FUNCTION],labelMinFileSizeExceeded:["File is too small",_.STRING],labelMinFileSize:["Minimum file size is {filesize}",_.STRING],labelMaxFileSizeExceeded:["File is too large",_.STRING],labelMaxFileSize:["Maximum file size is {filesize}",_.STRING],labelMaxTotalFileSizeExceeded:["Maximum total size exceeded",_.STRING],labelMaxTotalFileSize:["Maximum total file size is {filesize}",_.STRING]}}},"undefined"!=typeof window&&void 0!==window.document&&document.dispatchEvent(new CustomEvent("FilePond:pluginloaded",{detail:_})),_)),t=E({__proto__:null,default:e(n)},[n]);
4
+ import{d as e}from"./p-LKlIr4DH.js";function E(e,E){return E.forEach((function(E){E&&"string"!=typeof E&&!Array.isArray(E)&&Object.keys(E).forEach((function(i){if("default"!==i&&!(i in e)){var _=Object.getOwnPropertyDescriptor(E,i);Object.defineProperty(e,i,_.get?_:{enumerable:!0,get:function(){return E[i]}})}}))})),Object.freeze(e)}var i,_,l={exports:{}},n=i?l.exports:(i=1,l.exports=(_=function(e){var E=e.addFilter,i=e.utils,_=i.Type,l=i.replaceInString,n=i.toNaturalFileSize;return E("ALLOW_HOPPER_ITEM",(function(e,E){var i=E.query;if(!i("GET_ALLOW_FILE_SIZE_VALIDATION"))return!0;var _=i("GET_MAX_FILE_SIZE");if(null!==_&&e.size>_)return!1;var l=i("GET_MIN_FILE_SIZE");return!(null!==l&&e.size<l)})),E("LOAD_FILE",(function(e,E){var i=E.query;return new Promise((function(E,_){if(!i("GET_ALLOW_FILE_SIZE_VALIDATION"))return E(e);var t=i("GET_FILE_VALIDATE_SIZE_FILTER");if(t&&!t(e))return E(e);var I=i("GET_MAX_FILE_SIZE");if(null!==I&&e.size>I)_({status:{main:i("GET_LABEL_MAX_FILE_SIZE_EXCEEDED"),sub:l(i("GET_LABEL_MAX_FILE_SIZE"),{filesize:n(I,".",i("GET_FILE_SIZE_BASE"),i("GET_FILE_SIZE_LABELS",i))})}});else{var L=i("GET_MIN_FILE_SIZE");if(null!==L&&e.size<L)_({status:{main:i("GET_LABEL_MIN_FILE_SIZE_EXCEEDED"),sub:l(i("GET_LABEL_MIN_FILE_SIZE"),{filesize:n(L,".",i("GET_FILE_SIZE_BASE"),i("GET_FILE_SIZE_LABELS",i))})}});else{var a=i("GET_MAX_TOTAL_FILE_SIZE");if(null!==a&&i("GET_ACTIVE_ITEMS").reduce((function(e,E){return e+E.fileSize}),0)>a)return void _({status:{main:i("GET_LABEL_MAX_TOTAL_FILE_SIZE_EXCEEDED"),sub:l(i("GET_LABEL_MAX_TOTAL_FILE_SIZE"),{filesize:n(a,".",i("GET_FILE_SIZE_BASE"),i("GET_FILE_SIZE_LABELS",i))})}});E(e)}}}))})),{options:{allowFileSizeValidation:[!0,_.BOOLEAN],maxFileSize:[null,_.INT],minFileSize:[null,_.INT],maxTotalFileSize:[null,_.INT],fileValidateSizeFilter:[null,_.FUNCTION],labelMinFileSizeExceeded:["File is too small",_.STRING],labelMinFileSize:["Minimum file size is {filesize}",_.STRING],labelMaxFileSizeExceeded:["File is too large",_.STRING],labelMaxFileSize:["Maximum file size is {filesize}",_.STRING],labelMaxTotalFileSizeExceeded:["Maximum total size exceeded",_.STRING],labelMaxTotalFileSize:["Maximum total file size is {filesize}",_.STRING]}}},"undefined"!=typeof window&&void 0!==window.document&&document.dispatchEvent(new CustomEvent("FilePond:pluginloaded",{detail:_})),_)),t=E({__proto__:null,default:e(n)},[n]);
5
5
  /*!
6
6
  * FilePondPluginFileValidateSize 2.2.8
7
7
  * Licensed under MIT, https://opensource.org/licenses/MIT/