@salla.sa/twilight-components 2.14.549 → 2.14.551

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 (341) hide show
  1. package/dist/cjs/{Helper-6RI07gZo.js → Helper-D1YsoJud.js} +46 -0
  2. package/dist/cjs/{filepond-COUccQWv.js → filepond-C99K1KEB.js} +1 -1
  3. package/dist/cjs/{filepond-plugin-file-poster-B_yyvbJ6.js → filepond-plugin-file-poster-CggRjTNg.js} +1 -1
  4. package/dist/cjs/{filepond-plugin-file-validate-size-KDZtJpSs.js → filepond-plugin-file-validate-size-B009kdAV.js} +1 -1
  5. package/dist/cjs/{filepond-plugin-file-validate-type-Dbm_-1V2.js → filepond-plugin-file-validate-type-DZs9-bai.js} +1 -1
  6. package/dist/cjs/{filepond-plugin-image-edit-C-q8yFXi.js → filepond-plugin-image-edit-DNNheErX.js} +1 -1
  7. package/dist/cjs/{filepond-plugin-image-exif-orientation-C2Q2chpj.js → filepond-plugin-image-exif-orientation-ChN0IpOy.js} +1 -1
  8. package/dist/cjs/{filepond-plugin-image-preview-DVK8eIMv.js → filepond-plugin-image-preview-BZo2ftGo.js} +1 -1
  9. package/dist/cjs/{index-CSq9uCjw.js → index-0JUvtl0d.js} +6 -2
  10. package/dist/cjs/{intlTelInput-NQOLNYxO.js → intlTelInput-D84-rI5D.js} +1 -1
  11. package/dist/cjs/loader.cjs.js +2 -2
  12. package/dist/cjs/salla-accordion-body_2.cjs.entry.js +1 -1
  13. package/dist/cjs/salla-accordion_6.cjs.entry.js +2 -2
  14. package/dist/cjs/salla-add-product-button_5.cjs.entry.js +2 -2
  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-applied-filters.cjs.entry.js +175 -0
  19. package/dist/cjs/salla-apps-icons.cjs.entry.js +1 -1
  20. package/dist/cjs/salla-attachment-view_9.cjs.entry.js +11 -11
  21. package/dist/cjs/salla-badge.cjs.entry.js +1 -1
  22. package/dist/cjs/salla-basket-gap.cjs.entry.js +1 -1
  23. package/dist/cjs/salla-bullet-delivery_2.cjs.entry.js +1 -1
  24. package/dist/cjs/salla-cart-coupons.cjs.entry.js +1 -1
  25. package/dist/cjs/salla-cart-item-offers_2.cjs.entry.js +1 -1
  26. package/dist/cjs/salla-cart-summary-card.cjs.entry.js +1 -1
  27. package/dist/cjs/salla-cashback-banner.cjs.entry.js +1 -1
  28. package/dist/cjs/salla-comment-factors.cjs.entry.js +1 -1
  29. package/dist/cjs/salla-comment-form_9.cjs.entry.js +2 -2
  30. package/dist/cjs/salla-conditional-offer.cjs.entry.js +1 -1
  31. package/dist/cjs/salla-contacts.cjs.entry.js +1 -1
  32. package/dist/cjs/salla-cookies-bar.cjs.entry.js +1 -1
  33. package/dist/cjs/salla-count-down.cjs.entry.js +1 -1
  34. package/dist/cjs/salla-custom-fields.cjs.entry.js +1 -1
  35. package/dist/cjs/salla-delivery-promise.cjs.entry.js +1 -1
  36. package/dist/cjs/salla-edit-order-button.cjs.entry.js +1 -1
  37. package/dist/cjs/salla-filters-widget.cjs.entry.js +10 -11
  38. package/dist/cjs/salla-filters.cjs.entry.js +14 -79
  39. package/dist/cjs/salla-fulfillment-methods.cjs.entry.js +1 -1
  40. package/dist/cjs/salla-gifting.cjs.entry.js +1 -1
  41. package/dist/cjs/salla-hook.cjs.entry.js +1 -1
  42. package/dist/cjs/salla-infinite-scroll.cjs.entry.js +2 -2
  43. package/dist/cjs/salla-installment.cjs.entry.js +1 -1
  44. package/dist/cjs/salla-list-tile.cjs.entry.js +1 -1
  45. package/dist/cjs/salla-localization-modal.cjs.entry.js +1 -1
  46. package/dist/cjs/salla-login-modal.cjs.entry.js +1 -1
  47. package/dist/cjs/salla-loyalty-banner_10.cjs.entry.js +1 -1
  48. package/dist/cjs/salla-loyalty-exchange-product-card.cjs.entry.js +1 -1
  49. package/dist/cjs/salla-loyalty-points-banner.cjs.entry.js +1 -1
  50. package/dist/cjs/salla-loyalty-points-history.cjs.entry.js +1 -1
  51. package/dist/cjs/salla-loyalty-prize-item.cjs.entry.js +1 -1
  52. package/dist/cjs/salla-loyalty.cjs.entry.js +1 -1
  53. package/dist/cjs/salla-maintenance-alert.cjs.entry.js +1 -1
  54. package/dist/cjs/salla-map_2.cjs.entry.js +1 -1
  55. package/dist/cjs/salla-menu.cjs.entry.js +1 -1
  56. package/dist/cjs/salla-metadata.cjs.entry.js +1 -1
  57. package/dist/cjs/salla-multiple-bundle-product-cart_2.cjs.entry.js +1 -1
  58. package/dist/cjs/salla-multiple-bundle-product-options-modal_2.cjs.entry.js +1 -1
  59. package/dist/cjs/salla-multiple-bundle-product.cjs.entry.js +1 -1
  60. package/dist/cjs/salla-next-order-coupon.cjs.entry.js +1 -1
  61. package/dist/cjs/salla-notification-item_2.cjs.entry.js +2 -2
  62. package/dist/cjs/salla-offer-modal.cjs.entry.js +1 -1
  63. package/dist/cjs/salla-offer.cjs.entry.js +1 -1
  64. package/dist/cjs/salla-order-branch.cjs.entry.js +1 -1
  65. package/dist/cjs/salla-order-cancel.cjs.entry.js +1 -1
  66. package/dist/cjs/salla-order-details-multiple-bundle-product.cjs.entry.js +1 -1
  67. package/dist/cjs/salla-order-details-options.cjs.entry.js +1 -1
  68. package/dist/cjs/salla-order-details.cjs.entry.js +1 -1
  69. package/dist/cjs/salla-order-edit-item.cjs.entry.js +1 -1
  70. package/dist/cjs/salla-order-edit-product-card.cjs.entry.js +1 -1
  71. package/dist/cjs/salla-order-edit.cjs.entry.js +1 -1
  72. package/dist/cjs/salla-order-options-modal_2.cjs.entry.js +1 -1
  73. package/dist/cjs/salla-order-shipments.cjs.entry.js +1 -1
  74. package/dist/cjs/salla-order-summary.cjs.entry.js +1 -1
  75. package/dist/cjs/salla-order-totals-card.cjs.entry.js +1 -1
  76. package/dist/cjs/salla-orders.cjs.entry.js +2 -2
  77. package/dist/cjs/salla-payments.cjs.entry.js +1 -1
  78. package/dist/cjs/salla-placeholder.cjs.entry.js +1 -1
  79. package/dist/cjs/salla-price-range.cjs.entry.js +1 -1
  80. package/dist/cjs/salla-product-card-embed.cjs.entry.js +1 -1
  81. package/dist/cjs/salla-product-size-guide.cjs.entry.js +1 -1
  82. package/dist/cjs/salla-products-list.cjs.entry.js +2 -2
  83. package/dist/cjs/salla-products-slider.cjs.entry.js +2 -2
  84. package/dist/cjs/salla-quick-order.cjs.entry.js +1 -1
  85. package/dist/cjs/salla-rating-modal-v2.cjs.entry.js +2 -2
  86. package/dist/cjs/salla-rating-modal.cjs.entry.js +2 -2
  87. package/dist/cjs/salla-review-factors-tags.cjs.entry.js +1 -1
  88. package/dist/cjs/salla-review-order-item.cjs.entry.js +1 -1
  89. package/dist/cjs/salla-scopes.cjs.entry.js +1 -1
  90. package/dist/cjs/salla-search.cjs.entry.js +2 -2
  91. package/dist/cjs/salla-skeleton.cjs.entry.js +1 -1
  92. package/dist/cjs/salla-slider.cjs.entry.js +1 -1
  93. package/dist/cjs/salla-social-share.cjs.entry.js +1 -1
  94. package/dist/cjs/salla-social.cjs.entry.js +1 -1
  95. package/dist/cjs/salla-tab-content_3.cjs.entry.js +1 -1
  96. package/dist/cjs/salla-tiered-offer.cjs.entry.js +1 -1
  97. package/dist/cjs/salla-tooltip.cjs.entry.js +1 -1
  98. package/dist/cjs/salla-trust-badges.cjs.entry.js +1 -1
  99. package/dist/cjs/salla-user-menu.cjs.entry.js +1 -1
  100. package/dist/cjs/salla-user-profile.cjs.entry.js +1 -1
  101. package/dist/cjs/salla-user-settings.cjs.entry.js +1 -1
  102. package/dist/cjs/salla-verify.cjs.entry.js +1 -1
  103. package/dist/cjs/salla-wallet.cjs.entry.js +1 -1
  104. package/dist/cjs/salla-wishlist-actions.cjs.entry.js +1 -1
  105. package/dist/cjs/twilight.cjs.js +2 -2
  106. package/dist/cjs/{vanilla-picker-My41190Y.js → vanilla-picker-D8r5xyK7.js} +1 -1
  107. package/dist/collection/Helpers/Helper.js +28 -0
  108. package/dist/collection/collection-manifest.json +1 -0
  109. package/dist/collection/components/salla-applied-filters/salla-applied-filters.css +115 -0
  110. package/dist/collection/components/salla-applied-filters/salla-applied-filters.js +185 -0
  111. package/dist/collection/components/salla-filters/salla-filters.css +0 -119
  112. package/dist/collection/components/salla-filters/salla-filters.js +27 -73
  113. package/dist/components/Helper.js +47 -1
  114. package/dist/components/index.js +2 -2
  115. package/dist/components/salla-applied-filters.d.ts +11 -0
  116. package/dist/components/salla-applied-filters.js +195 -0
  117. package/dist/components/salla-filters-widget2.js +2 -21
  118. package/dist/components/salla-filters.js +10 -76
  119. package/dist/esm/{Helper-CBmYxrzX.js → Helper-DsjZ6kte.js} +47 -1
  120. package/dist/esm/{filepond-CA4TWKuz.js → filepond-DuMUHI7t.js} +1 -1
  121. package/dist/esm/{filepond-plugin-file-poster-C4_NyGjO.js → filepond-plugin-file-poster-Dv25V2UU.js} +1 -1
  122. package/dist/esm/{filepond-plugin-file-validate-size-DVV7mZ-K.js → filepond-plugin-file-validate-size-Dxl4yPm6.js} +1 -1
  123. package/dist/esm/{filepond-plugin-file-validate-type-DT1IX9KM.js → filepond-plugin-file-validate-type-C602myuq.js} +1 -1
  124. package/dist/esm/{filepond-plugin-image-edit-RrqhOPfq.js → filepond-plugin-image-edit-DLd3ht_R.js} +1 -1
  125. package/dist/esm/{filepond-plugin-image-exif-orientation-Dc9_Qlva.js → filepond-plugin-image-exif-orientation-BaQ5DNLu.js} +1 -1
  126. package/dist/esm/{filepond-plugin-image-preview-Iu7ULzAy.js → filepond-plugin-image-preview-C-RFNs7l.js} +1 -1
  127. package/dist/esm/{index-C0qiFNJn.js → index-BsIeN-bg.js} +6 -2
  128. package/dist/esm/{intlTelInput-CrkMI_sC.js → intlTelInput-Cf6zBu5Y.js} +1 -1
  129. package/dist/esm/loader.js +3 -3
  130. package/dist/esm/salla-accordion-body_2.entry.js +1 -1
  131. package/dist/esm/salla-accordion_6.entry.js +2 -2
  132. package/dist/esm/salla-add-product-button_5.entry.js +2 -2
  133. package/dist/esm/salla-advertisement.entry.js +1 -1
  134. package/dist/esm/salla-alert_2.entry.js +1 -1
  135. package/dist/esm/salla-app-install-alert.entry.js +1 -1
  136. package/dist/esm/salla-applied-filters.entry.js +173 -0
  137. package/dist/esm/salla-apps-icons.entry.js +1 -1
  138. package/dist/esm/salla-attachment-view_9.entry.js +11 -11
  139. package/dist/esm/salla-badge.entry.js +1 -1
  140. package/dist/esm/salla-basket-gap.entry.js +1 -1
  141. package/dist/esm/salla-bullet-delivery_2.entry.js +1 -1
  142. package/dist/esm/salla-cart-coupons.entry.js +1 -1
  143. package/dist/esm/salla-cart-item-offers_2.entry.js +1 -1
  144. package/dist/esm/salla-cart-summary-card.entry.js +1 -1
  145. package/dist/esm/salla-cashback-banner.entry.js +1 -1
  146. package/dist/esm/salla-comment-factors.entry.js +1 -1
  147. package/dist/esm/salla-comment-form_9.entry.js +2 -2
  148. package/dist/esm/salla-conditional-offer.entry.js +1 -1
  149. package/dist/esm/salla-contacts.entry.js +1 -1
  150. package/dist/esm/salla-cookies-bar.entry.js +1 -1
  151. package/dist/esm/salla-count-down.entry.js +1 -1
  152. package/dist/esm/salla-custom-fields.entry.js +1 -1
  153. package/dist/esm/salla-delivery-promise.entry.js +1 -1
  154. package/dist/esm/salla-edit-order-button.entry.js +1 -1
  155. package/dist/esm/salla-filters-widget.entry.js +2 -3
  156. package/dist/esm/salla-filters.entry.js +8 -73
  157. package/dist/esm/salla-fulfillment-methods.entry.js +1 -1
  158. package/dist/esm/salla-gifting.entry.js +1 -1
  159. package/dist/esm/salla-hook.entry.js +1 -1
  160. package/dist/esm/salla-infinite-scroll.entry.js +2 -2
  161. package/dist/esm/salla-installment.entry.js +1 -1
  162. package/dist/esm/salla-list-tile.entry.js +1 -1
  163. package/dist/esm/salla-localization-modal.entry.js +1 -1
  164. package/dist/esm/salla-login-modal.entry.js +1 -1
  165. package/dist/esm/salla-loyalty-banner_10.entry.js +1 -1
  166. package/dist/esm/salla-loyalty-exchange-product-card.entry.js +1 -1
  167. package/dist/esm/salla-loyalty-points-banner.entry.js +1 -1
  168. package/dist/esm/salla-loyalty-points-history.entry.js +1 -1
  169. package/dist/esm/salla-loyalty-prize-item.entry.js +1 -1
  170. package/dist/esm/salla-loyalty.entry.js +1 -1
  171. package/dist/esm/salla-maintenance-alert.entry.js +1 -1
  172. package/dist/esm/salla-map_2.entry.js +1 -1
  173. package/dist/esm/salla-menu.entry.js +1 -1
  174. package/dist/esm/salla-metadata.entry.js +1 -1
  175. package/dist/esm/salla-multiple-bundle-product-cart_2.entry.js +1 -1
  176. package/dist/esm/salla-multiple-bundle-product-options-modal_2.entry.js +1 -1
  177. package/dist/esm/salla-multiple-bundle-product.entry.js +1 -1
  178. package/dist/esm/salla-next-order-coupon.entry.js +1 -1
  179. package/dist/esm/salla-notification-item_2.entry.js +2 -2
  180. package/dist/esm/salla-offer-modal.entry.js +1 -1
  181. package/dist/esm/salla-offer.entry.js +1 -1
  182. package/dist/esm/salla-order-branch.entry.js +1 -1
  183. package/dist/esm/salla-order-cancel.entry.js +1 -1
  184. package/dist/esm/salla-order-details-multiple-bundle-product.entry.js +1 -1
  185. package/dist/esm/salla-order-details-options.entry.js +1 -1
  186. package/dist/esm/salla-order-details.entry.js +1 -1
  187. package/dist/esm/salla-order-edit-item.entry.js +1 -1
  188. package/dist/esm/salla-order-edit-product-card.entry.js +1 -1
  189. package/dist/esm/salla-order-edit.entry.js +1 -1
  190. package/dist/esm/salla-order-options-modal_2.entry.js +1 -1
  191. package/dist/esm/salla-order-shipments.entry.js +1 -1
  192. package/dist/esm/salla-order-summary.entry.js +1 -1
  193. package/dist/esm/salla-order-totals-card.entry.js +1 -1
  194. package/dist/esm/salla-orders.entry.js +2 -2
  195. package/dist/esm/salla-payments.entry.js +1 -1
  196. package/dist/esm/salla-placeholder.entry.js +1 -1
  197. package/dist/esm/salla-price-range.entry.js +1 -1
  198. package/dist/esm/salla-product-card-embed.entry.js +1 -1
  199. package/dist/esm/salla-product-size-guide.entry.js +1 -1
  200. package/dist/esm/salla-products-list.entry.js +2 -2
  201. package/dist/esm/salla-products-slider.entry.js +2 -2
  202. package/dist/esm/salla-quick-order.entry.js +1 -1
  203. package/dist/esm/salla-rating-modal-v2.entry.js +2 -2
  204. package/dist/esm/salla-rating-modal.entry.js +2 -2
  205. package/dist/esm/salla-review-factors-tags.entry.js +1 -1
  206. package/dist/esm/salla-review-order-item.entry.js +1 -1
  207. package/dist/esm/salla-scopes.entry.js +1 -1
  208. package/dist/esm/salla-search.entry.js +2 -2
  209. package/dist/esm/salla-skeleton.entry.js +1 -1
  210. package/dist/esm/salla-slider.entry.js +1 -1
  211. package/dist/esm/salla-social-share.entry.js +1 -1
  212. package/dist/esm/salla-social.entry.js +1 -1
  213. package/dist/esm/salla-tab-content_3.entry.js +1 -1
  214. package/dist/esm/salla-tiered-offer.entry.js +1 -1
  215. package/dist/esm/salla-tooltip.entry.js +1 -1
  216. package/dist/esm/salla-trust-badges.entry.js +1 -1
  217. package/dist/esm/salla-user-menu.entry.js +1 -1
  218. package/dist/esm/salla-user-profile.entry.js +1 -1
  219. package/dist/esm/salla-user-settings.entry.js +1 -1
  220. package/dist/esm/salla-verify.entry.js +1 -1
  221. package/dist/esm/salla-wallet.entry.js +1 -1
  222. package/dist/esm/salla-wishlist-actions.entry.js +1 -1
  223. package/dist/esm/twilight.js +3 -3
  224. package/dist/esm/{vanilla-picker-Cf9pEgos.js → vanilla-picker-S7qZ7YZm.js} +1 -1
  225. package/dist/twilight/{p-2a64e50b.entry.js → p-01406425.entry.js} +1 -1
  226. package/dist/twilight/{p-i-tkvIE0.js → p-035DwuUC.js} +1 -1
  227. package/dist/twilight/{p-bbd2cb8c.entry.js → p-07adeb89.entry.js} +1 -1
  228. package/dist/twilight/{p-e806b976.entry.js → p-0944d367.entry.js} +1 -1
  229. package/dist/twilight/{p-e190e1cf.entry.js → p-0a332226.entry.js} +1 -1
  230. package/dist/twilight/{p-adbf6324.entry.js → p-0e3d72ab.entry.js} +1 -1
  231. package/dist/twilight/{p-368beadc.entry.js → p-1118bee2.entry.js} +1 -1
  232. package/dist/twilight/{p-a37a692a.entry.js → p-13c4b450.entry.js} +1 -1
  233. package/dist/twilight/{p-e36310e2.entry.js → p-18639885.entry.js} +1 -1
  234. package/dist/twilight/{p-dc7f11e4.entry.js → p-18a604c5.entry.js} +1 -1
  235. package/dist/twilight/{p-5364f42e.entry.js → p-1abe8321.entry.js} +1 -1
  236. package/dist/twilight/{p-27b6fd51.entry.js → p-1bf18c56.entry.js} +1 -1
  237. package/dist/twilight/{p-c3bed022.entry.js → p-211324e6.entry.js} +1 -1
  238. package/dist/twilight/p-22cb8a9c.entry.js +4 -0
  239. package/dist/twilight/{p-c2005d4a.entry.js → p-2331e63a.entry.js} +1 -1
  240. package/dist/twilight/{p-ab86dc29.entry.js → p-27456209.entry.js} +1 -1
  241. package/dist/twilight/{p-c72a1861.entry.js → p-2a3d30d1.entry.js} +1 -1
  242. package/dist/twilight/{p-4d149e9e.entry.js → p-2a683382.entry.js} +1 -1
  243. package/dist/twilight/{p-7e26332e.entry.js → p-2bef08e8.entry.js} +1 -1
  244. package/dist/twilight/{p-73db9793.entry.js → p-2c48bb97.entry.js} +1 -1
  245. package/dist/twilight/p-2df31e90.entry.js +4 -0
  246. package/dist/twilight/{p-7122a097.entry.js → p-2ff7bb22.entry.js} +1 -1
  247. package/dist/twilight/{p-ed5d8787.entry.js → p-357b5593.entry.js} +1 -1
  248. package/dist/twilight/{p-8c086859.entry.js → p-3aa6fa7d.entry.js} +1 -1
  249. package/dist/twilight/{p-a5185029.entry.js → p-3c2cc4fe.entry.js} +1 -1
  250. package/dist/twilight/{p-c15eeb62.entry.js → p-3fb485a6.entry.js} +1 -1
  251. package/dist/twilight/{p-e4c3ca60.entry.js → p-43f8f33b.entry.js} +1 -1
  252. package/dist/twilight/{p-354da069.entry.js → p-47713dd1.entry.js} +1 -1
  253. package/dist/twilight/{p-86cec54b.entry.js → p-49738042.entry.js} +1 -1
  254. package/dist/twilight/{p-499ccb8b.entry.js → p-49f9e536.entry.js} +1 -1
  255. package/dist/twilight/{p-945b3f38.entry.js → p-4ef06a6f.entry.js} +1 -1
  256. package/dist/twilight/{p-55c716a4.entry.js → p-501c0798.entry.js} +1 -1
  257. package/dist/twilight/{p-a5f477fd.entry.js → p-523572e9.entry.js} +1 -1
  258. package/dist/twilight/{p-f3bd1c09.entry.js → p-54974d98.entry.js} +1 -1
  259. package/dist/twilight/{p-a9554697.entry.js → p-56845467.entry.js} +1 -1
  260. package/dist/twilight/{p-3c99951e.entry.js → p-569c6d6c.entry.js} +1 -1
  261. package/dist/twilight/{p-14f2c393.entry.js → p-56f164bb.entry.js} +1 -1
  262. package/dist/twilight/{p-8fa81b10.entry.js → p-5918dd8d.entry.js} +1 -1
  263. package/dist/twilight/{p-95117a08.entry.js → p-5ba2eb55.entry.js} +1 -1
  264. package/dist/twilight/{p-28efc3a8.entry.js → p-5cd4b67f.entry.js} +1 -1
  265. package/dist/twilight/{p-bf9cc549.entry.js → p-5dfd449d.entry.js} +1 -1
  266. package/dist/twilight/{p-a30ae3e6.entry.js → p-683db553.entry.js} +1 -1
  267. package/dist/twilight/{p-d322a3e8.entry.js → p-68d754be.entry.js} +1 -1
  268. package/dist/twilight/{p-84181d45.entry.js → p-6a746b8a.entry.js} +1 -1
  269. package/dist/twilight/{p-0357b501.entry.js → p-6c5a1ded.entry.js} +1 -1
  270. package/dist/twilight/{p-4358c48e.entry.js → p-6d787fa0.entry.js} +1 -1
  271. package/dist/twilight/{p-6da4a9b3.entry.js → p-6edd1008.entry.js} +1 -1
  272. package/dist/twilight/{p-7bdf543a.entry.js → p-6f3516a1.entry.js} +1 -1
  273. package/dist/twilight/{p-a72bf47b.entry.js → p-6f58ac6a.entry.js} +1 -1
  274. package/dist/twilight/{p-4cfccc31.entry.js → p-704553fb.entry.js} +1 -1
  275. package/dist/twilight/{p-f51a1326.entry.js → p-709c2184.entry.js} +1 -1
  276. package/dist/twilight/{p-453f92f9.entry.js → p-83a5b8a4.entry.js} +1 -1
  277. package/dist/twilight/{p-c0d89d74.entry.js → p-847cdd79.entry.js} +1 -1
  278. package/dist/twilight/p-84cffb13.entry.js +4 -0
  279. package/dist/twilight/{p-dc51e991.entry.js → p-869fe4c0.entry.js} +1 -1
  280. package/dist/twilight/{p-32af49cd.entry.js → p-8711224a.entry.js} +1 -1
  281. package/dist/twilight/{p-ee7530fe.entry.js → p-8ebb86ce.entry.js} +1 -1
  282. package/dist/twilight/{p-875beddd.entry.js → p-9025e5d9.entry.js} +1 -1
  283. package/dist/twilight/{p-4a8b3e89.entry.js → p-906b36e3.entry.js} +1 -1
  284. package/dist/twilight/{p-a9b9deb9.entry.js → p-90f29c99.entry.js} +1 -1
  285. package/dist/twilight/{p-42efd1b1.entry.js → p-9dd126e2.entry.js} +1 -1
  286. package/dist/twilight/{p-a909aff5.entry.js → p-9f431f78.entry.js} +1 -1
  287. package/dist/twilight/{p-5be5be8b.entry.js → p-9fdbe8a0.entry.js} +1 -1
  288. package/dist/twilight/{p-CW2JQnYK.js → p-B3oo4tIx.js} +1 -1
  289. package/dist/twilight/p-BRZVMxhy.js +9 -0
  290. package/dist/twilight/{p-C0qiFNJn.js → p-BsIeN-bg.js} +1 -1
  291. package/dist/twilight/{p-ClV-F79e.js → p-CPiqlSTo.js} +1 -1
  292. package/dist/twilight/{p-CyO2XGkr.js → p-CaCiueRc.js} +1 -1
  293. package/dist/twilight/p-D6rFREuQ.js +4 -0
  294. package/dist/twilight/{p-BeFR_h3q.js → p-DNS31w5e.js} +1 -1
  295. package/dist/twilight/{p-l7Rr63jq.js → p-DeX830vG.js} +1 -1
  296. package/dist/twilight/{p-b5028411.entry.js → p-a01f64e7.entry.js} +1 -1
  297. package/dist/twilight/{p-344f751a.entry.js → p-a037e47d.entry.js} +1 -1
  298. package/dist/twilight/{p-709af483.entry.js → p-a0ed97f5.entry.js} +1 -1
  299. package/dist/twilight/{p-8f2f8693.entry.js → p-a30390a7.entry.js} +1 -1
  300. package/dist/twilight/{p-b3ba53c5.entry.js → p-a344db00.entry.js} +1 -1
  301. package/dist/twilight/{p-b6d259be.entry.js → p-a3579980.entry.js} +1 -1
  302. package/dist/twilight/{p-7a1169f6.entry.js → p-a46a9d28.entry.js} +1 -1
  303. package/dist/twilight/{p-33c2f3bc.entry.js → p-a64771f7.entry.js} +1 -1
  304. package/dist/twilight/{p-a243d3cc.entry.js → p-a8316527.entry.js} +1 -1
  305. package/dist/twilight/{p-e2d501f5.entry.js → p-a9ef3c52.entry.js} +1 -1
  306. package/dist/twilight/{p-ecaf7d87.entry.js → p-aa8962f8.entry.js} +1 -1
  307. package/dist/twilight/{p-0dea4239.entry.js → p-aa91a230.entry.js} +1 -1
  308. package/dist/twilight/{p-b2662a4f.entry.js → p-af348a67.entry.js} +1 -1
  309. package/dist/twilight/{p-1adf1893.entry.js → p-b1e0bc90.entry.js} +1 -1
  310. package/dist/twilight/{p-0d44c47f.entry.js → p-b238c74b.entry.js} +1 -1
  311. package/dist/twilight/{p-6da0b2b3.entry.js → p-b5a2342c.entry.js} +1 -1
  312. package/dist/twilight/{p-b73b7e15.entry.js → p-be0ac755.entry.js} +1 -1
  313. package/dist/twilight/{p-6bedb896.entry.js → p-cdba9d35.entry.js} +1 -1
  314. package/dist/twilight/{p-fba13fd5.entry.js → p-d5215891.entry.js} +1 -1
  315. package/dist/twilight/{p-a8561cc8.entry.js → p-e3e2baa2.entry.js} +1 -1
  316. package/dist/twilight/{p-7f11af86.entry.js → p-e875f53e.entry.js} +1 -1
  317. package/dist/twilight/{p-ae96e338.entry.js → p-ea968ba3.entry.js} +1 -1
  318. package/dist/twilight/{p-88148fed.entry.js → p-eb3a095b.entry.js} +1 -1
  319. package/dist/twilight/{p-c82b8aa7.entry.js → p-ebc6ba28.entry.js} +1 -1
  320. package/dist/twilight/{p-b8da968d.entry.js → p-ecdbd18f.entry.js} +1 -1
  321. package/dist/twilight/{p-4ebdef90.entry.js → p-ef145c1e.entry.js} +1 -1
  322. package/dist/twilight/{p-5d71c16a.entry.js → p-efe6493f.entry.js} +1 -1
  323. package/dist/twilight/{p-5d261682.entry.js → p-f037e508.entry.js} +1 -1
  324. package/dist/twilight/{p-34889d17.entry.js → p-f4f355e5.entry.js} +1 -1
  325. package/dist/twilight/{p-862f7fda.entry.js → p-fed3efba.entry.js} +1 -1
  326. package/dist/twilight/{p-b217fea1.entry.js → p-ff37c2af.entry.js} +1 -1
  327. package/dist/twilight/{p-yV2X3Oc1.js → p-mgSPapOV.js} +1 -1
  328. package/dist/twilight/{p-C7NprL2x.js → p-wqmCmzsY.js} +1 -1
  329. package/dist/twilight/twilight.esm.js +1 -1
  330. package/dist/types/Helpers/Helper.d.ts +10 -0
  331. package/dist/types/components/salla-applied-filters/salla-applied-filters.d.ts +37 -0
  332. package/dist/types/components/salla-filters/salla-filters.d.ts +3 -11
  333. package/dist/types/components.d.ts +17 -0
  334. package/package.json +5 -5
  335. package/dist/cjs/interfaces-DZDQwN6-.js +0 -23
  336. package/dist/esm/interfaces-DL4h2bc3.js +0 -23
  337. package/dist/twilight/p-01b52f2f.entry.js +0 -4
  338. package/dist/twilight/p-B3th5No1.js +0 -9
  339. package/dist/twilight/p-DL4h2bc3.js +0 -4
  340. package/dist/twilight/p-DOBDDG4K.js +0 -4
  341. package/dist/twilight/p-c55c576c.entry.js +0 -4
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r as e,h as t,H as r}from"./p-C0qiFNJn.js";var i;!function(e){e.PERCENTAGE="percentage",e.FIXED="fixed"}(i||(i={}));const o={staticIcons:['<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="40" height="40" color="#000000" fill="none">\n <path d="M13.7276 3.44418L15.4874 6.99288C15.7274 7.48687 16.3673 7.9607 16.9073 8.05143L20.0969 8.58575C22.1367 8.92853 22.6167 10.4206 21.1468 11.8925L18.6671 14.3927C18.2471 14.8161 18.0172 15.6327 18.1471 16.2175L18.8571 19.3125C19.417 21.7623 18.1271 22.71 15.9774 21.4296L12.9877 19.6452C12.4478 19.3226 11.5579 19.3226 11.0079 19.6452L8.01827 21.4296C5.8785 22.71 4.57865 21.7522 5.13859 19.3125L5.84851 16.2175C5.97849 15.6327 5.74852 14.8161 5.32856 14.3927L2.84884 11.8925C1.389 10.4206 1.85895 8.92853 3.89872 8.58575L7.08837 8.05143C7.61831 7.9607 8.25824 7.48687 8.49821 6.99288L10.258 3.44418C11.2179 1.51861 12.7777 1.51861 13.7276 3.44418Z" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path>\n</svg>','<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" color="#000000" fill="none">\n <path d="M3 12C7.5 12 12 7.5 12 3C12 7.5 16.5 12 21 12C16.5 12 12 16.5 12 21C12 16.5 7.5 12 3 12Z" stroke="currentColor" stroke-width="1.5" stroke-linejoin="round"></path>\n <path d="M2 19.5C2.83333 19.5 4.5 17.8333 4.5 17C4.5 17.8333 6.16667 19.5 7 19.5C6.16667 19.5 4.5 21.1667 4.5 22C4.5 21.1667 2.83333 19.5 2 19.5Z" stroke="currentColor" stroke-width="1.5" stroke-linejoin="round"></path>\n <path d="M16 5C17 5 19 3 19 2C19 3 21 5 22 5C21 5 19 7 19 8C19 7 17 5 16 5Z" stroke="currentColor" stroke-width="1.5" stroke-linejoin="round"></path>\n</svg>','<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="40" height="40" color="#000000" fill="none">\n <path d="M14.2644 18.3717C14.5806 17.407 14.7387 16.9247 15.0616 16.593C15.215 16.4354 15.3932 16.3048 15.5887 16.2066C16.0003 16 16.5003 16 17.5002 16C18.5001 16 19.0001 16 19.4116 16.2066C19.6072 16.3048 19.7853 16.4354 19.9388 16.593C20.2617 16.9247 20.4198 17.407 20.736 18.3717L21.0624 19.3675C21.4561 20.5688 21.653 21.1694 21.3587 21.5847C21.0643 22 20.4418 22 19.1966 22H15.8038C14.5586 22 13.936 22 13.6417 21.5847C13.3473 21.1694 13.5442 20.5688 13.938 19.3675L14.2644 18.3717Z" stroke="currentColor" stroke-width="1.5"></path>\n <path d="M8.76421 10.3717C9.08041 9.40705 9.23851 8.92471 9.56143 8.59298C9.71485 8.43537 9.89299 8.3048 10.0885 8.20663C10.5001 8 11.0001 8 12 8C12.9999 8 13.4999 8 13.9115 8.20663C14.107 8.3048 14.2851 8.43537 14.4386 8.59298C14.7615 8.92471 14.9196 9.40705 15.2358 10.3717L15.5622 11.3675C15.956 12.5688 16.1528 13.1694 15.8585 13.5847C15.5642 14 14.9416 14 13.6964 14H10.3036C9.05842 14 8.43585 14 8.1415 13.5847C7.84716 13.1694 8.04404 12.5688 8.43779 11.3675L8.76421 10.3717Z" stroke="currentColor" stroke-width="1.5"></path>\n <path d="M3.26439 18.3717C3.58059 17.407 3.73869 16.9247 4.06162 16.593C4.21504 16.4354 4.39317 16.3048 4.58872 16.2066C5.00031 16 5.50027 16 6.50018 16C7.5001 16 8.00006 16 8.41165 16.2066C8.6072 16.3048 8.78533 16.4354 8.93875 16.593C9.26167 16.9247 9.41977 17.407 9.73597 18.3717L10.0624 19.3675C10.4561 20.5688 10.653 21.1694 10.3587 21.5847C10.0643 22 9.44176 22 8.19661 22H4.80375C3.5586 22 2.93603 22 2.64169 21.5847C2.34735 21.1694 2.54422 20.5688 2.93797 19.3675L3.26439 18.3717Z" stroke="currentColor" stroke-width="1.5"></path>\n <path d="M12 2V4M7.5 3.5L9 5M16.5 3.5L15 5" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"></path>\n</svg>','<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" color="#000000" fill="none">\n <path d="M5.78223 4.18192C6.43007 3.68319 6.754 3.43383 7.12788 3.27323C7.29741 3.20041 7.47367 3.14158 7.65459 3.09741C8.0536 3 8.4767 3 9.32289 3H14.6771C15.5233 3 15.9464 3 16.3454 3.09741C16.5263 3.14158 16.7026 3.20041 16.8721 3.27323C17.246 3.43383 17.5699 3.68319 18.2178 4.18192C20.3644 5.83448 21.4378 6.66077 21.8057 7.73078C21.9694 8.20673 22.0305 8.70728 21.9858 9.20461C21.8852 10.3227 21.0379 11.346 19.3433 13.3925L15.3498 18.2153C13.8126 20.0718 13.044 21 12 21C10.956 21 10.1874 20.0718 8.65018 18.2153L4.65671 13.3925C2.96208 11.346 2.11476 10.3227 2.0142 9.20461C1.96947 8.70728 2.03064 8.20673 2.1943 7.73078C2.56224 6.66077 3.63557 5.83448 5.78223 4.18192Z" stroke="currentColor" stroke-width="1.5"></path>\n <path d="M10 8.5H14" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path>\n</svg>'],staticColors:["#993018","#444444","#D18F36","#315F9C"]};class s{static findTierByIndex(e,t){return e.find((e=>e.index===t))||null}static findTierByName(e,t){return e.find((e=>e.tier_name===t))||null}static getTierNameByIndex(e,t){return this.findTierByIndex(e,t)?.tier_name}static findCurrentTierIndex(e,t){if(!t)return 0;for(let r=t.length-1;r>=0;r--)if(e>=t[r].threshold)return t[r].index;return 0}}const n=class{constructor(t){e(this,t),this.currentTierIndex=0,this.canRender=!1,this.isLoading=!1,this.handleTabClick=e=>{this.activeTabTier=e},salla.lang.onLoaded((()=>{this.loyaltyProgramText=salla.lang.get("blocks.tiered_offer.program_title"),this.currentTierText=salla.lang.get("blocks.tiered_offer.current_tier"),this.discountText=salla.lang.get("blocks.tiered_offer.discount"),this.benefitText=salla.lang.get("blocks.tiered_offer.tier_description")}))}async componentWillLoad(){try{if(await salla.onReady(),!this.checkFeatureEnabled())return;if(!this.checkCartExists())return;this.isLoading=!0;const e=await this.fetchTieredOfferData();if(!e)return;this.initializeComponent(e)}catch(e){this.canRender=!1,salla.logger.warn("salla-tiered-offer:: ",e)}finally{this.isLoading=!1}}checkFeatureEnabled(){return salla.config.get("store.features")?.includes("tiered-offer")}checkCartExists(){return!!salla.storage.get("cart")?.summary?.count}validateCouponCompatibility(e,t){return!(t&&!e.details?.applied_with_coupon)}shouldHideForGuest(){return salla.config.isGuest()}shouldHideUntilThreshold(e,t){return!(!e?.hide_until_threshold||0!==t)}resolveTierName(e,t){return s.getTierNameByIndex(e,t)||""}async fetchTieredOfferData(){try{const{data:e}=await salla.api.cart.offers(),t=e.find((e=>"tiered_offer"===e.type));return t?this.validateCouponCompatibility(t,salla.storage.get("cart")?.coupon)?t:(this.canRender=!1,null):null}catch(e){throw e}}initializeComponent(e){this.apiOfferData=e,this.tieredOfferData=this.mapApiDataToTiers(this.apiOfferData),this.loyaltyProgramText=this.apiOfferData.title||this.loyaltyProgramText;const t=this.findCurrentTierIndex(this.apiOfferData.details?.current_value||0);this.shouldHideForGuest()||this.shouldHideUntilThreshold(this.apiOfferData.details,t)?this.canRender=!1:(this.currentTierIndex=t,this.currentTier=this.resolveTierName(this.tieredOfferData.tiers,t),this.activeTabTier=this.currentTier||this.tieredOfferData.tiers[0]?.tier_name,this.canRender=!0)}componentDidLoad(){salla.event.on("cart::updated",(async e=>{const t=await this.fetchTieredOfferData();t&&(this.tieredOfferData?this.updateOfferValues(e,t):this.initializeComponent(t))}))}mapApiDataToTiers(e){const t=[...e.details.discounts].sort(((e,t)=>e.min_spend-t.min_spend)).map(((e,t)=>({name:e.name,tier_name:e.name,discount:e.type===i.PERCENTAGE?`${salla.helpers.number(e.value)}%`:salla.money(e.value),icon:o.staticIcons[t]||o.staticIcons[0],threshold:e.min_spend,text_color:o.staticColors[t],index:t+1})));return{current_tier:s.getTierNameByIndex(t,this.findCurrentTierIndex(e.details.current_value,t)),tiers:t}}findCurrentTierIndex(e,t=this.tieredOfferData?.tiers){return s.findCurrentTierIndex(e,t||[])}updateOfferValues(e,t){if(!t||!this.tieredOfferData)return;if(!t.details?.discounts?.length)return void(this.canRender=!1);if(!this.validateCouponCompatibility(t,e.coupon))return void(this.canRender=!1);if(this.shouldHideForGuest())return void(this.canRender=!1);const r=this.mapApiDataToTiers(t),i=this.findCurrentTierIndex(t.details?.current_value||0,r.tiers);if(this.shouldHideUntilThreshold(t.details,i))return void(this.canRender=!1);if(!1===t.details?.with_current_cart)return void(this.canRender=!0);this.apiOfferData=t,this.tieredOfferData=r,this.canRender=!0,this.currentTierIndex=i,this.currentTier=this.resolveTierName(r.tiers,i);const o=this.currentTier||r.tiers[0]?.tier_name;this.activeTabTier!==o&&(this.activeTabTier=o)}getLoadingSkeletonView(){return t(r,null,t("div",{class:"s-tiered-offer-container"},t("div",{class:"s-tiered-offer-skeleton-wrapper"},t("div",{class:"s-tiered-offer-skeleton-title"},t("salla-skeleton",{height:"16px",width:"40%"})),t("div",{class:"s-tiered-offer-skeleton-subtitle"},t("salla-skeleton",{height:"20px",width:"60%"})),t("div",{class:"s-tiered-offer-skeleton-progress"},t("salla-skeleton",{height:"16px",width:"100%"})),t("div",{class:"s-tiered-offer-skeleton-tabs"},t("salla-skeleton",{height:"50px",width:"100%"})))))}getCurrentTierData(){return s.findTierByIndex(this.tieredOfferData.tiers,this.currentTierIndex)||this.tieredOfferData.tiers[0]}getProgressWidth(){const e=this.tieredOfferData.tiers.length;return this.findCurrentTierIndex(this.apiOfferData.details?.current_value||0)/e*100}calculateMilestonePosition(e,t){return 1===t?"calc(100% - 18px)":`${Math.max(2,Math.min(95,(e+1)/t*100-8/t))}%`}getMilestoneStyles(e,t,r){const i="rtl"===document.documentElement.dir,o=this.calculateMilestonePosition(t,r),s=e.name.length>6?"flex-end":"center";return{[i?"right":"left"]:o,alignItems:s,position:"absolute",transform:i?"translateX(50%)":"translateX(-50%)"}}getMilestoneIconStyles(e,t,r){return t?{color:e.text_color}:r?{color:"var(--color-primary)"}:{}}renderProgressBarBackground(e){return[t("div",{class:"s-tiered-offer-progress-bg"}),t("div",{class:"s-tiered-offer-progress-fill",style:{width:`${e}%`}})]}renderMilestoneIcon(e,r,i){const o=["s-tiered-offer-milestone-icon",r?"s-tiered-offer-milestone-active":"",i?"s-tiered-offer-milestone-completed":""].filter(Boolean).join(" ");return t("div",{class:o,style:this.getMilestoneIconStyles(e,r,i)},t("span",{innerHTML:e.icon}))}renderMilestoneName(e,r){return t("div",{class:"s-tiered-offer-milestone-name"},r&&t("span",{style:{color:e.text_color}},e.name))}renderMilestones(e,r){return t("div",{class:"s-tiered-offer-milestones-wrapper"},t("div",{class:1===r?"s-tiered-offer-single-milestone-justify-end":"s-tiered-offer-milestones"},this.tieredOfferData.tiers.map(((i,o)=>{const s=e>=i.threshold,n=i.tier_name===this.currentTier;return t("div",{class:"s-tiered-offer-milestone",style:this.getMilestoneStyles(i,o,r)},this.renderMilestoneIcon(i,n,s),this.renderMilestoneName(i,n))}))))}renderProgressBar(){const e=this.getProgressWidth(),r=this.tieredOfferData.tiers.length,i=this.apiOfferData.details?.current_value||0;return t("div",{class:"s-tiered-offer-progress-container"},t("div",{class:"s-tiered-offer-progress-wrapper"},this.renderProgressBarBackground(e),this.renderMilestones(i,r)))}renderTabs(){return t("div",{class:"s-tiered-offer-tabs-container"},t("div",{class:"s-tiered-offer-tab-headers"},this.tieredOfferData.tiers.map((e=>t("button",{class:"s-tiered-offer-tab-header "+(e.tier_name===this.activeTabTier?"s-tiered-offer-tab-active":""),onClick:()=>this.handleTabClick(e.tier_name)},t("span",null,e.name))))),t("div",{class:"s-tiered-offer-tab-content-wrapper"},(()=>{const e=s.findTierByName(this.tieredOfferData.tiers,this.activeTabTier);return e?t("div",{class:"s-tiered-offer-tab-content"},t("div",{class:"s-tiered-offer-tab-content-inner"},t("div",{class:"s-tiered-offer-discount-section"},t("p",{class:"s-tiered-offer-discount-title"},this.discountText," ",t("span",{innerHTML:e.discount})),t("p",{class:"s-tiered-offer-benefit-description"},this.benefitText," ",e.name)))):null})()))}render(){if(this.isLoading)return this.getLoadingSkeletonView();if(!this.canRender||!this.tieredOfferData)return null;const e=this.getCurrentTierData();return t(r,null,t("div",{class:"s-tiered-offer-container"},t("div",{class:"s-tiered-offer-header"},t("div",{class:"s-tiered-offer-header-content"},t("p",{class:"s-tiered-offer-program-title"},this.loyaltyProgramText),this.currentTier&&t("div",{class:"s-tiered-offer-current-tier-name-wrapper"},t("h2",{class:"s-tiered-offer-current-tier"},this.currentTierText," ",t("span",{class:"s-tiered-offer-tier-name"},e.name)),t("span",{innerHTML:e.icon})))),this.renderProgressBar(),this.renderTabs()))}};n.style="/*!twlt*/.s-tiered-offer-milestone-icon svg{color:currentColor}.s-tiered-offer-milestone-icon svg path{stroke:currentColor;fill:none}.s-tiered-offer-milestone-icon.s-tiered-offer-milestone-active svg path,.s-tiered-offer-milestone-icon.s-tiered-offer-milestone-completed svg path{fill:currentColor;stroke:none}.s-tiered-offer-milestone-icon.s-tiered-offer-milestone-active svg[fill=none] path,.s-tiered-offer-milestone-icon.s-tiered-offer-milestone-completed svg[fill=none] path{fill:none;stroke:currentColor}[dir=rtl] .s-tiered-offer-progress-wrapper .s-tiered-offer-progress-bg{transform:scaleX(-1)}[dir=rtl] .s-tiered-offer-progress-wrapper .s-tiered-offer-progress-fill{transform:scaleX(-1);left:auto}[dir=rtl] .flip-x{transform:scaleX(-1)}.visible{visibility:visible}.static{position:static}.fixed{position:fixed}.absolute{position:absolute}.hidden{display:none}.transform{transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.s-tiered-offer-container{position:relative;margin-bottom:1.25rem;width:100%;border-radius:0.5rem;--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1));padding:1rem;--tw-shadow:0 1px 2px 0 rgb(0 0 0 / 0.05);--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}@media (min-width: 640px){.s-tiered-offer-container{padding:1.25rem;padding-left:1.5rem;padding-right:1.5rem}}.s-tiered-offer-header{margin-bottom:1.5rem;display:flex;align-items:center;gap:0.75rem}.s-tiered-offer-header-content{flex:1 1 0%}.s-tiered-offer-current-tier-name-wrapper{display:flex;flex-direction:row;align-items:flex-start;gap:0.375rem}.s-tiered-offer-current-tier-name-wrapper h2{font-size:1.125rem;line-height:1.75rem}.s-tiered-offer-current-tier-name-wrapper svg{height:1.5rem;width:1.5rem}.s-tiered-offer-program-title{margin:0px;margin-bottom:0.5rem;--tw-text-opacity:1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.s-tiered-offer-program-title h2{font-size:1.125rem;line-height:1.75rem}.s-tiered-offer-current-tier{margin:0px;margin-bottom:0.375rem;font-weight:700}.s-tiered-offer-tier-name{font-weight:600;--tw-text-opacity:1;color:rgb(17 24 39 / var(--tw-text-opacity, 1))}.s-tiered-offer-progress-container{margin-top:1.5rem;margin-bottom:1rem}.s-tiered-offer-progress-wrapper{position:relative}.s-tiered-offer-progress-bg{position:absolute;top:0.5rem;left:1rem;right:1rem;height:1rem;border-radius:9999px;--tw-bg-opacity:1;background-color:rgb(229 231 235 / var(--tw-bg-opacity, 1))}.s-tiered-offer-progress-fill{position:absolute;top:0.5rem;height:1rem;border-radius:9999px;background-color:var(--color-primary);transition-property:all;transition-duration:500ms;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1)}.s-tiered-offer-milestones-wrapper{display:flex;justify-content:flex-end}.s-tiered-offer-milestones{position:relative;display:flex;height:3rem;width:100%;align-items:center;justify-content:space-between}.s-tiered-offer-single-milestone-justify-end{position:relative;display:flex;height:3rem;width:100%;align-items:center;justify-content:flex-end}.s-tiered-offer-milestone{display:flex;flex-direction:column;align-items:center}.s-tiered-offer-milestone-icon{position:relative;z-index:10;margin-top:0px;display:flex;height:2.25rem;width:2.25rem;align-items:center;justify-content:center;border-radius:0.75rem;border-width:2px;--tw-border-opacity:1;border-color:rgb(243 244 246 / var(--tw-border-opacity, 1));--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1));padding:0.25rem;--tw-text-opacity:1;color:rgb(107 114 128 / var(--tw-text-opacity, 1));--tw-shadow:0 1px 2px 0 rgb(0 0 0 / 0.05);--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);transition-property:all;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:300ms}.s-tiered-offer-milestone-icon span{display:flex;align-items:center;justify-content:center}.s-tiered-offer-milestone-icon svg{height:1.25rem;width:1.25rem;color:currentColor}.s-tiered-offer-milestone-name{margin-top:0.5rem;display:flex;height:1rem;align-items:center;justify-content:center}.s-tiered-offer-milestone-name span{text-align:center;font-size:0.875rem;line-height:1.25rem;font-weight:500}@media (min-width: 640px){.s-tiered-offer-milestone-name span{font-size:0.75rem;line-height:1rem}}.s-tiered-offer-tabs-container{margin-top:1rem}.s-tiered-offer-tab-headers{display:flex;gap:0.25rem;border-radius:0.375rem;border-width:1px;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1));--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1));padding:0.25rem}.s-tiered-offer-tab-header{display:flex;flex:1 1 0%;cursor:pointer;align-items:center;justify-content:center;border-radius:0.125rem;border-style:none;background-color:transparent;padding-top:0.625rem;padding-bottom:0.625rem;padding-left:0.75rem;padding-right:0.75rem;font-size:0.875rem;line-height:1.25rem;font-weight:500;--tw-text-opacity:1;color:rgb(75 85 99 / var(--tw-text-opacity, 1));transition-property:all;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:200ms}@media (min-width: 640px){.s-tiered-offer-tab-header{padding-top:0.5rem;padding-bottom:0.5rem;font-size:0.75rem;line-height:1rem}}.s-tiered-offer-tab-active{border-radius:0.375rem;background-color:var(--color-primary);--tw-text-opacity:1;color:rgb(255 255 255 / var(--tw-text-opacity, 1));--tw-shadow:0 1px 2px 0 rgb(0 0 0 / 0.05);--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}.s-tiered-offer-tab-active:hover{background-color:var(--color-primary-dark);opacity:0.8}.s-tiered-offer-tab-content-wrapper{border-bottom-right-radius:0.375rem;border-bottom-left-radius:0.375rem;border-width:1px;border-top-width:0px;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1));--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.s-tiered-offer-tab-content{padding-left:1.5rem;padding-right:1.5rem}@media (min-width: 640px){.s-tiered-offer-tab-content{padding-left:1rem;padding-right:1rem}}.s-tiered-offer-tab-content.tab-hidden{display:none}.s-tiered-offer-tab-content-inner{padding-top:1rem}.s-tiered-offer-discount-section{margin-bottom:0.5rem}.s-tiered-offer-discount-title{margin:0px;margin-bottom:0.5rem;font-size:1rem;line-height:1.5rem;font-weight:700;--tw-text-opacity:1;color:rgb(17 24 39 / var(--tw-text-opacity, 1))}.s-tiered-offer-benefit-description{margin:0px;font-size:0.875rem;line-height:1.25rem;--tw-text-opacity:1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.s-tiered-offer-skeleton-wrapper{padding:1.25rem}.s-tiered-offer-skeleton-title{margin-bottom:0.75rem}.s-tiered-offer-skeleton-subtitle{margin-bottom:1.5rem}.s-tiered-offer-skeleton-progress{margin-bottom:1.25rem}";export{n as salla_tiered_offer}
4
+ import{r as e,h as t,H as r}from"./p-BsIeN-bg.js";var i;!function(e){e.PERCENTAGE="percentage",e.FIXED="fixed"}(i||(i={}));const o={staticIcons:['<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="40" height="40" color="#000000" fill="none">\n <path d="M13.7276 3.44418L15.4874 6.99288C15.7274 7.48687 16.3673 7.9607 16.9073 8.05143L20.0969 8.58575C22.1367 8.92853 22.6167 10.4206 21.1468 11.8925L18.6671 14.3927C18.2471 14.8161 18.0172 15.6327 18.1471 16.2175L18.8571 19.3125C19.417 21.7623 18.1271 22.71 15.9774 21.4296L12.9877 19.6452C12.4478 19.3226 11.5579 19.3226 11.0079 19.6452L8.01827 21.4296C5.8785 22.71 4.57865 21.7522 5.13859 19.3125L5.84851 16.2175C5.97849 15.6327 5.74852 14.8161 5.32856 14.3927L2.84884 11.8925C1.389 10.4206 1.85895 8.92853 3.89872 8.58575L7.08837 8.05143C7.61831 7.9607 8.25824 7.48687 8.49821 6.99288L10.258 3.44418C11.2179 1.51861 12.7777 1.51861 13.7276 3.44418Z" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path>\n</svg>','<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" color="#000000" fill="none">\n <path d="M3 12C7.5 12 12 7.5 12 3C12 7.5 16.5 12 21 12C16.5 12 12 16.5 12 21C12 16.5 7.5 12 3 12Z" stroke="currentColor" stroke-width="1.5" stroke-linejoin="round"></path>\n <path d="M2 19.5C2.83333 19.5 4.5 17.8333 4.5 17C4.5 17.8333 6.16667 19.5 7 19.5C6.16667 19.5 4.5 21.1667 4.5 22C4.5 21.1667 2.83333 19.5 2 19.5Z" stroke="currentColor" stroke-width="1.5" stroke-linejoin="round"></path>\n <path d="M16 5C17 5 19 3 19 2C19 3 21 5 22 5C21 5 19 7 19 8C19 7 17 5 16 5Z" stroke="currentColor" stroke-width="1.5" stroke-linejoin="round"></path>\n</svg>','<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="40" height="40" color="#000000" fill="none">\n <path d="M14.2644 18.3717C14.5806 17.407 14.7387 16.9247 15.0616 16.593C15.215 16.4354 15.3932 16.3048 15.5887 16.2066C16.0003 16 16.5003 16 17.5002 16C18.5001 16 19.0001 16 19.4116 16.2066C19.6072 16.3048 19.7853 16.4354 19.9388 16.593C20.2617 16.9247 20.4198 17.407 20.736 18.3717L21.0624 19.3675C21.4561 20.5688 21.653 21.1694 21.3587 21.5847C21.0643 22 20.4418 22 19.1966 22H15.8038C14.5586 22 13.936 22 13.6417 21.5847C13.3473 21.1694 13.5442 20.5688 13.938 19.3675L14.2644 18.3717Z" stroke="currentColor" stroke-width="1.5"></path>\n <path d="M8.76421 10.3717C9.08041 9.40705 9.23851 8.92471 9.56143 8.59298C9.71485 8.43537 9.89299 8.3048 10.0885 8.20663C10.5001 8 11.0001 8 12 8C12.9999 8 13.4999 8 13.9115 8.20663C14.107 8.3048 14.2851 8.43537 14.4386 8.59298C14.7615 8.92471 14.9196 9.40705 15.2358 10.3717L15.5622 11.3675C15.956 12.5688 16.1528 13.1694 15.8585 13.5847C15.5642 14 14.9416 14 13.6964 14H10.3036C9.05842 14 8.43585 14 8.1415 13.5847C7.84716 13.1694 8.04404 12.5688 8.43779 11.3675L8.76421 10.3717Z" stroke="currentColor" stroke-width="1.5"></path>\n <path d="M3.26439 18.3717C3.58059 17.407 3.73869 16.9247 4.06162 16.593C4.21504 16.4354 4.39317 16.3048 4.58872 16.2066C5.00031 16 5.50027 16 6.50018 16C7.5001 16 8.00006 16 8.41165 16.2066C8.6072 16.3048 8.78533 16.4354 8.93875 16.593C9.26167 16.9247 9.41977 17.407 9.73597 18.3717L10.0624 19.3675C10.4561 20.5688 10.653 21.1694 10.3587 21.5847C10.0643 22 9.44176 22 8.19661 22H4.80375C3.5586 22 2.93603 22 2.64169 21.5847C2.34735 21.1694 2.54422 20.5688 2.93797 19.3675L3.26439 18.3717Z" stroke="currentColor" stroke-width="1.5"></path>\n <path d="M12 2V4M7.5 3.5L9 5M16.5 3.5L15 5" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"></path>\n</svg>','<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" color="#000000" fill="none">\n <path d="M5.78223 4.18192C6.43007 3.68319 6.754 3.43383 7.12788 3.27323C7.29741 3.20041 7.47367 3.14158 7.65459 3.09741C8.0536 3 8.4767 3 9.32289 3H14.6771C15.5233 3 15.9464 3 16.3454 3.09741C16.5263 3.14158 16.7026 3.20041 16.8721 3.27323C17.246 3.43383 17.5699 3.68319 18.2178 4.18192C20.3644 5.83448 21.4378 6.66077 21.8057 7.73078C21.9694 8.20673 22.0305 8.70728 21.9858 9.20461C21.8852 10.3227 21.0379 11.346 19.3433 13.3925L15.3498 18.2153C13.8126 20.0718 13.044 21 12 21C10.956 21 10.1874 20.0718 8.65018 18.2153L4.65671 13.3925C2.96208 11.346 2.11476 10.3227 2.0142 9.20461C1.96947 8.70728 2.03064 8.20673 2.1943 7.73078C2.56224 6.66077 3.63557 5.83448 5.78223 4.18192Z" stroke="currentColor" stroke-width="1.5"></path>\n <path d="M10 8.5H14" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path>\n</svg>'],staticColors:["#993018","#444444","#D18F36","#315F9C"]};class s{static findTierByIndex(e,t){return e.find((e=>e.index===t))||null}static findTierByName(e,t){return e.find((e=>e.tier_name===t))||null}static getTierNameByIndex(e,t){return this.findTierByIndex(e,t)?.tier_name}static findCurrentTierIndex(e,t){if(!t)return 0;for(let r=t.length-1;r>=0;r--)if(e>=t[r].threshold)return t[r].index;return 0}}const n=class{constructor(t){e(this,t),this.currentTierIndex=0,this.canRender=!1,this.isLoading=!1,this.handleTabClick=e=>{this.activeTabTier=e},salla.lang.onLoaded((()=>{this.loyaltyProgramText=salla.lang.get("blocks.tiered_offer.program_title"),this.currentTierText=salla.lang.get("blocks.tiered_offer.current_tier"),this.discountText=salla.lang.get("blocks.tiered_offer.discount"),this.benefitText=salla.lang.get("blocks.tiered_offer.tier_description")}))}async componentWillLoad(){try{if(await salla.onReady(),!this.checkFeatureEnabled())return;if(!this.checkCartExists())return;this.isLoading=!0;const e=await this.fetchTieredOfferData();if(!e)return;this.initializeComponent(e)}catch(e){this.canRender=!1,salla.logger.warn("salla-tiered-offer:: ",e)}finally{this.isLoading=!1}}checkFeatureEnabled(){return salla.config.get("store.features")?.includes("tiered-offer")}checkCartExists(){return!!salla.storage.get("cart")?.summary?.count}validateCouponCompatibility(e,t){return!(t&&!e.details?.applied_with_coupon)}shouldHideForGuest(){return salla.config.isGuest()}shouldHideUntilThreshold(e,t){return!(!e?.hide_until_threshold||0!==t)}resolveTierName(e,t){return s.getTierNameByIndex(e,t)||""}async fetchTieredOfferData(){try{const{data:e}=await salla.api.cart.offers(),t=e.find((e=>"tiered_offer"===e.type));return t?this.validateCouponCompatibility(t,salla.storage.get("cart")?.coupon)?t:(this.canRender=!1,null):null}catch(e){throw e}}initializeComponent(e){this.apiOfferData=e,this.tieredOfferData=this.mapApiDataToTiers(this.apiOfferData),this.loyaltyProgramText=this.apiOfferData.title||this.loyaltyProgramText;const t=this.findCurrentTierIndex(this.apiOfferData.details?.current_value||0);this.shouldHideForGuest()||this.shouldHideUntilThreshold(this.apiOfferData.details,t)?this.canRender=!1:(this.currentTierIndex=t,this.currentTier=this.resolveTierName(this.tieredOfferData.tiers,t),this.activeTabTier=this.currentTier||this.tieredOfferData.tiers[0]?.tier_name,this.canRender=!0)}componentDidLoad(){salla.event.on("cart::updated",(async e=>{const t=await this.fetchTieredOfferData();t&&(this.tieredOfferData?this.updateOfferValues(e,t):this.initializeComponent(t))}))}mapApiDataToTiers(e){const t=[...e.details.discounts].sort(((e,t)=>e.min_spend-t.min_spend)).map(((e,t)=>({name:e.name,tier_name:e.name,discount:e.type===i.PERCENTAGE?`${salla.helpers.number(e.value)}%`:salla.money(e.value),icon:o.staticIcons[t]||o.staticIcons[0],threshold:e.min_spend,text_color:o.staticColors[t],index:t+1})));return{current_tier:s.getTierNameByIndex(t,this.findCurrentTierIndex(e.details.current_value,t)),tiers:t}}findCurrentTierIndex(e,t=this.tieredOfferData?.tiers){return s.findCurrentTierIndex(e,t||[])}updateOfferValues(e,t){if(!t||!this.tieredOfferData)return;if(!t.details?.discounts?.length)return void(this.canRender=!1);if(!this.validateCouponCompatibility(t,e.coupon))return void(this.canRender=!1);if(this.shouldHideForGuest())return void(this.canRender=!1);const r=this.mapApiDataToTiers(t),i=this.findCurrentTierIndex(t.details?.current_value||0,r.tiers);if(this.shouldHideUntilThreshold(t.details,i))return void(this.canRender=!1);if(!1===t.details?.with_current_cart)return void(this.canRender=!0);this.apiOfferData=t,this.tieredOfferData=r,this.canRender=!0,this.currentTierIndex=i,this.currentTier=this.resolveTierName(r.tiers,i);const o=this.currentTier||r.tiers[0]?.tier_name;this.activeTabTier!==o&&(this.activeTabTier=o)}getLoadingSkeletonView(){return t(r,null,t("div",{class:"s-tiered-offer-container"},t("div",{class:"s-tiered-offer-skeleton-wrapper"},t("div",{class:"s-tiered-offer-skeleton-title"},t("salla-skeleton",{height:"16px",width:"40%"})),t("div",{class:"s-tiered-offer-skeleton-subtitle"},t("salla-skeleton",{height:"20px",width:"60%"})),t("div",{class:"s-tiered-offer-skeleton-progress"},t("salla-skeleton",{height:"16px",width:"100%"})),t("div",{class:"s-tiered-offer-skeleton-tabs"},t("salla-skeleton",{height:"50px",width:"100%"})))))}getCurrentTierData(){return s.findTierByIndex(this.tieredOfferData.tiers,this.currentTierIndex)||this.tieredOfferData.tiers[0]}getProgressWidth(){const e=this.tieredOfferData.tiers.length;return this.findCurrentTierIndex(this.apiOfferData.details?.current_value||0)/e*100}calculateMilestonePosition(e,t){return 1===t?"calc(100% - 18px)":`${Math.max(2,Math.min(95,(e+1)/t*100-8/t))}%`}getMilestoneStyles(e,t,r){const i="rtl"===document.documentElement.dir,o=this.calculateMilestonePosition(t,r),s=e.name.length>6?"flex-end":"center";return{[i?"right":"left"]:o,alignItems:s,position:"absolute",transform:i?"translateX(50%)":"translateX(-50%)"}}getMilestoneIconStyles(e,t,r){return t?{color:e.text_color}:r?{color:"var(--color-primary)"}:{}}renderProgressBarBackground(e){return[t("div",{class:"s-tiered-offer-progress-bg"}),t("div",{class:"s-tiered-offer-progress-fill",style:{width:`${e}%`}})]}renderMilestoneIcon(e,r,i){const o=["s-tiered-offer-milestone-icon",r?"s-tiered-offer-milestone-active":"",i?"s-tiered-offer-milestone-completed":""].filter(Boolean).join(" ");return t("div",{class:o,style:this.getMilestoneIconStyles(e,r,i)},t("span",{innerHTML:e.icon}))}renderMilestoneName(e,r){return t("div",{class:"s-tiered-offer-milestone-name"},r&&t("span",{style:{color:e.text_color}},e.name))}renderMilestones(e,r){return t("div",{class:"s-tiered-offer-milestones-wrapper"},t("div",{class:1===r?"s-tiered-offer-single-milestone-justify-end":"s-tiered-offer-milestones"},this.tieredOfferData.tiers.map(((i,o)=>{const s=e>=i.threshold,n=i.tier_name===this.currentTier;return t("div",{class:"s-tiered-offer-milestone",style:this.getMilestoneStyles(i,o,r)},this.renderMilestoneIcon(i,n,s),this.renderMilestoneName(i,n))}))))}renderProgressBar(){const e=this.getProgressWidth(),r=this.tieredOfferData.tiers.length,i=this.apiOfferData.details?.current_value||0;return t("div",{class:"s-tiered-offer-progress-container"},t("div",{class:"s-tiered-offer-progress-wrapper"},this.renderProgressBarBackground(e),this.renderMilestones(i,r)))}renderTabs(){return t("div",{class:"s-tiered-offer-tabs-container"},t("div",{class:"s-tiered-offer-tab-headers"},this.tieredOfferData.tiers.map((e=>t("button",{class:"s-tiered-offer-tab-header "+(e.tier_name===this.activeTabTier?"s-tiered-offer-tab-active":""),onClick:()=>this.handleTabClick(e.tier_name)},t("span",null,e.name))))),t("div",{class:"s-tiered-offer-tab-content-wrapper"},(()=>{const e=s.findTierByName(this.tieredOfferData.tiers,this.activeTabTier);return e?t("div",{class:"s-tiered-offer-tab-content"},t("div",{class:"s-tiered-offer-tab-content-inner"},t("div",{class:"s-tiered-offer-discount-section"},t("p",{class:"s-tiered-offer-discount-title"},this.discountText," ",t("span",{innerHTML:e.discount})),t("p",{class:"s-tiered-offer-benefit-description"},this.benefitText," ",e.name)))):null})()))}render(){if(this.isLoading)return this.getLoadingSkeletonView();if(!this.canRender||!this.tieredOfferData)return null;const e=this.getCurrentTierData();return t(r,null,t("div",{class:"s-tiered-offer-container"},t("div",{class:"s-tiered-offer-header"},t("div",{class:"s-tiered-offer-header-content"},t("p",{class:"s-tiered-offer-program-title"},this.loyaltyProgramText),this.currentTier&&t("div",{class:"s-tiered-offer-current-tier-name-wrapper"},t("h2",{class:"s-tiered-offer-current-tier"},this.currentTierText," ",t("span",{class:"s-tiered-offer-tier-name"},e.name)),t("span",{innerHTML:e.icon})))),this.renderProgressBar(),this.renderTabs()))}};n.style="/*!twlt*/.s-tiered-offer-milestone-icon svg{color:currentColor}.s-tiered-offer-milestone-icon svg path{stroke:currentColor;fill:none}.s-tiered-offer-milestone-icon.s-tiered-offer-milestone-active svg path,.s-tiered-offer-milestone-icon.s-tiered-offer-milestone-completed svg path{fill:currentColor;stroke:none}.s-tiered-offer-milestone-icon.s-tiered-offer-milestone-active svg[fill=none] path,.s-tiered-offer-milestone-icon.s-tiered-offer-milestone-completed svg[fill=none] path{fill:none;stroke:currentColor}[dir=rtl] .s-tiered-offer-progress-wrapper .s-tiered-offer-progress-bg{transform:scaleX(-1)}[dir=rtl] .s-tiered-offer-progress-wrapper .s-tiered-offer-progress-fill{transform:scaleX(-1);left:auto}[dir=rtl] .flip-x{transform:scaleX(-1)}.visible{visibility:visible}.static{position:static}.fixed{position:fixed}.absolute{position:absolute}.hidden{display:none}.transform{transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.s-tiered-offer-container{position:relative;margin-bottom:1.25rem;width:100%;border-radius:0.5rem;--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1));padding:1rem;--tw-shadow:0 1px 2px 0 rgb(0 0 0 / 0.05);--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}@media (min-width: 640px){.s-tiered-offer-container{padding:1.25rem;padding-left:1.5rem;padding-right:1.5rem}}.s-tiered-offer-header{margin-bottom:1.5rem;display:flex;align-items:center;gap:0.75rem}.s-tiered-offer-header-content{flex:1 1 0%}.s-tiered-offer-current-tier-name-wrapper{display:flex;flex-direction:row;align-items:flex-start;gap:0.375rem}.s-tiered-offer-current-tier-name-wrapper h2{font-size:1.125rem;line-height:1.75rem}.s-tiered-offer-current-tier-name-wrapper svg{height:1.5rem;width:1.5rem}.s-tiered-offer-program-title{margin:0px;margin-bottom:0.5rem;--tw-text-opacity:1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.s-tiered-offer-program-title h2{font-size:1.125rem;line-height:1.75rem}.s-tiered-offer-current-tier{margin:0px;margin-bottom:0.375rem;font-weight:700}.s-tiered-offer-tier-name{font-weight:600;--tw-text-opacity:1;color:rgb(17 24 39 / var(--tw-text-opacity, 1))}.s-tiered-offer-progress-container{margin-top:1.5rem;margin-bottom:1rem}.s-tiered-offer-progress-wrapper{position:relative}.s-tiered-offer-progress-bg{position:absolute;top:0.5rem;left:1rem;right:1rem;height:1rem;border-radius:9999px;--tw-bg-opacity:1;background-color:rgb(229 231 235 / var(--tw-bg-opacity, 1))}.s-tiered-offer-progress-fill{position:absolute;top:0.5rem;height:1rem;border-radius:9999px;background-color:var(--color-primary);transition-property:all;transition-duration:500ms;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1)}.s-tiered-offer-milestones-wrapper{display:flex;justify-content:flex-end}.s-tiered-offer-milestones{position:relative;display:flex;height:3rem;width:100%;align-items:center;justify-content:space-between}.s-tiered-offer-single-milestone-justify-end{position:relative;display:flex;height:3rem;width:100%;align-items:center;justify-content:flex-end}.s-tiered-offer-milestone{display:flex;flex-direction:column;align-items:center}.s-tiered-offer-milestone-icon{position:relative;z-index:10;margin-top:0px;display:flex;height:2.25rem;width:2.25rem;align-items:center;justify-content:center;border-radius:0.75rem;border-width:2px;--tw-border-opacity:1;border-color:rgb(243 244 246 / var(--tw-border-opacity, 1));--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1));padding:0.25rem;--tw-text-opacity:1;color:rgb(107 114 128 / var(--tw-text-opacity, 1));--tw-shadow:0 1px 2px 0 rgb(0 0 0 / 0.05);--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);transition-property:all;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:300ms}.s-tiered-offer-milestone-icon span{display:flex;align-items:center;justify-content:center}.s-tiered-offer-milestone-icon svg{height:1.25rem;width:1.25rem;color:currentColor}.s-tiered-offer-milestone-name{margin-top:0.5rem;display:flex;height:1rem;align-items:center;justify-content:center}.s-tiered-offer-milestone-name span{text-align:center;font-size:0.875rem;line-height:1.25rem;font-weight:500}@media (min-width: 640px){.s-tiered-offer-milestone-name span{font-size:0.75rem;line-height:1rem}}.s-tiered-offer-tabs-container{margin-top:1rem}.s-tiered-offer-tab-headers{display:flex;gap:0.25rem;border-radius:0.375rem;border-width:1px;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1));--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1));padding:0.25rem}.s-tiered-offer-tab-header{display:flex;flex:1 1 0%;cursor:pointer;align-items:center;justify-content:center;border-radius:0.125rem;border-style:none;background-color:transparent;padding-top:0.625rem;padding-bottom:0.625rem;padding-left:0.75rem;padding-right:0.75rem;font-size:0.875rem;line-height:1.25rem;font-weight:500;--tw-text-opacity:1;color:rgb(75 85 99 / var(--tw-text-opacity, 1));transition-property:all;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:200ms}@media (min-width: 640px){.s-tiered-offer-tab-header{padding-top:0.5rem;padding-bottom:0.5rem;font-size:0.75rem;line-height:1rem}}.s-tiered-offer-tab-active{border-radius:0.375rem;background-color:var(--color-primary);--tw-text-opacity:1;color:rgb(255 255 255 / var(--tw-text-opacity, 1));--tw-shadow:0 1px 2px 0 rgb(0 0 0 / 0.05);--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}.s-tiered-offer-tab-active:hover{background-color:var(--color-primary-dark);opacity:0.8}.s-tiered-offer-tab-content-wrapper{border-bottom-right-radius:0.375rem;border-bottom-left-radius:0.375rem;border-width:1px;border-top-width:0px;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1));--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.s-tiered-offer-tab-content{padding-left:1.5rem;padding-right:1.5rem}@media (min-width: 640px){.s-tiered-offer-tab-content{padding-left:1rem;padding-right:1rem}}.s-tiered-offer-tab-content.tab-hidden{display:none}.s-tiered-offer-tab-content-inner{padding-top:1rem}.s-tiered-offer-discount-section{margin-bottom:0.5rem}.s-tiered-offer-discount-title{margin:0px;margin-bottom:0.5rem;font-size:1rem;line-height:1.5rem;font-weight:700;--tw-text-opacity:1;color:rgb(17 24 39 / var(--tw-text-opacity, 1))}.s-tiered-offer-benefit-description{margin:0px;font-size:0.875rem;line-height:1.25rem;--tw-text-opacity:1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.s-tiered-offer-skeleton-wrapper{padding:1.25rem}.s-tiered-offer-skeleton-title{margin-bottom:0.75rem}.s-tiered-offer-skeleton-subtitle{margin-bottom:1.5rem}.s-tiered-offer-skeleton-progress{margin-bottom:1.25rem}";export{n as salla_tiered_offer}
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r as e,h as t,H as l}from"./p-C0qiFNJn.js";const i=class{constructor(t){e(this,t),this.methods=[],this.shouldRender=!1}async componentDidLoad(){await Salla.onReady(),await Salla.lang.onLoaded(),Salla.config.get("store.shipping.support_pickup")&&(this.shouldRender=!0,this.setLabels())}setLabels(){this.methods=[{id:"delivery",title:Salla.lang.getWithDefault("pages.products.promise_delivery_title","متاح للتوصيل"),subtitle:Salla.lang.getWithDefault("pages.products.promise_delivery_subtitle","طلبك يوصلك لباب البيت بسهولة."),iconClass:"sicon-location"},{id:"pickup",title:Salla.lang.getWithDefault("pages.products.promise_pickup_title","متاح للاستلام"),subtitle:Salla.lang.getWithDefault("pages.products.promise_pickup_subtitle","استلام فوري من أقرب فرع."),iconClass:"sicon-store"}]}render(){return this.shouldRender?t(l,{class:"s-fulfillment-methods"},t("div",{class:"s-fulfillment-methods-list"},this.methods.map((e=>t("div",{key:e.id,class:"s-fulfillment-methods-card"},t("div",{class:"s-fulfillment-methods-content"},t("div",{class:"s-fulfillment-methods-icon-wrap"},t("i",{class:`${e.iconClass} s-fulfillment-methods-icon`})),t("div",{class:"s-fulfillment-methods-text"},t("span",{class:"s-fulfillment-methods-title"},e.title),t("span",{class:"s-fulfillment-methods-subtitle"},e.subtitle)))))))):null}};i.style='/*!twlt*/:host{display:block}.s-fulfillment-methods{font-family:inherit}.s-fulfillment-methods-list{display:flex;gap:16px;flex-wrap:wrap;margin-bottom:12px;margin-top:12px}:host-context([dir=rtl]) .s-fulfillment-methods-content{flex-direction:row-reverse}:host-context([dir=ltr]) .s-fulfillment-methods-content{flex-direction:row}.s-fulfillment-methods-card{flex:1;min-width:0;border:1px solid var(--color-border, #e5e7eb);border-radius:12px;padding:16px}.s-fulfillment-methods-content{display:flex;align-items:center;gap:12px}.s-fulfillment-methods-text{flex:1;min-width:0;display:flex;flex-direction:column;gap:4px}.s-fulfillment-methods-title{font-weight:700;font-size:14px;line-height:1.3;color:var(--color-text-primary, #2b2d34)}.s-fulfillment-methods-subtitle{font-size:12px;line-height:1.4;color:var(--color-text-secondary, #6b7280)}.s-fulfillment-methods-icon-wrap{flex-shrink:0;width:44px;height:44px;display:flex;align-items:center;justify-content:center;background:var(--color-surface-secondary, #f3f4f6);border-radius:10px}.s-fulfillment-methods-icon{font-size:22px;color:var(--color-text-secondary, #6b7280);line-height:1}.shadow{--tw-shadow:0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}.s-fulfillment-methods-list{margin-bottom:0.75rem;margin-top:0.75rem;display:flex;flex-wrap:wrap;gap:1rem}.s-fulfillment-methods-card{min-width:0px;flex:1 1 0%;border-radius:0.75rem;border-width:1px;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1));padding:1rem}.s-fulfillment-methods-content{display:flex;flex-direction:row;align-items:center;gap:0.75rem}.s-fulfillment-methods-content:where([dir="rtl"],[dir="rtl"] *){flex-direction:row-reverse}.s-fulfillment-methods-text{display:flex;min-width:0px;flex:1 1 0%;flex-direction:column;gap:0.25rem}.s-fulfillment-methods-title{font-size:0.875rem;line-height:1.25rem;font-weight:700;line-height:1.375;color:var(--color-text-primary,#2b2d34)}.s-fulfillment-methods-subtitle{font-size:0.75rem;line-height:1rem;line-height:1.4;color:var(--color-text-secondary,#6b7280)}.s-fulfillment-methods-icon-wrap{display:flex;height:2.75rem;width:2.75rem;flex-shrink:0;align-items:center;justify-content:center;border-radius:10px;background-color:var(--color-surface-secondary,#f3f4f6)}.s-fulfillment-methods-icon{font-size:22px;line-height:1;color:var(--color-text-secondary,#6b7280)}';export{i as salla_fulfillment_methods}
4
+ import{r as e,h as t,H as l}from"./p-BsIeN-bg.js";const i=class{constructor(t){e(this,t),this.methods=[],this.shouldRender=!1}async componentDidLoad(){await Salla.onReady(),await Salla.lang.onLoaded(),Salla.config.get("store.shipping.support_pickup")&&(this.shouldRender=!0,this.setLabels())}setLabels(){this.methods=[{id:"delivery",title:Salla.lang.getWithDefault("pages.products.promise_delivery_title","متاح للتوصيل"),subtitle:Salla.lang.getWithDefault("pages.products.promise_delivery_subtitle","طلبك يوصلك لباب البيت بسهولة."),iconClass:"sicon-location"},{id:"pickup",title:Salla.lang.getWithDefault("pages.products.promise_pickup_title","متاح للاستلام"),subtitle:Salla.lang.getWithDefault("pages.products.promise_pickup_subtitle","استلام فوري من أقرب فرع."),iconClass:"sicon-store"}]}render(){return this.shouldRender?t(l,{class:"s-fulfillment-methods"},t("div",{class:"s-fulfillment-methods-list"},this.methods.map((e=>t("div",{key:e.id,class:"s-fulfillment-methods-card"},t("div",{class:"s-fulfillment-methods-content"},t("div",{class:"s-fulfillment-methods-icon-wrap"},t("i",{class:`${e.iconClass} s-fulfillment-methods-icon`})),t("div",{class:"s-fulfillment-methods-text"},t("span",{class:"s-fulfillment-methods-title"},e.title),t("span",{class:"s-fulfillment-methods-subtitle"},e.subtitle)))))))):null}};i.style='/*!twlt*/:host{display:block}.s-fulfillment-methods{font-family:inherit}.s-fulfillment-methods-list{display:flex;gap:16px;flex-wrap:wrap;margin-bottom:12px;margin-top:12px}:host-context([dir=rtl]) .s-fulfillment-methods-content{flex-direction:row-reverse}:host-context([dir=ltr]) .s-fulfillment-methods-content{flex-direction:row}.s-fulfillment-methods-card{flex:1;min-width:0;border:1px solid var(--color-border, #e5e7eb);border-radius:12px;padding:16px}.s-fulfillment-methods-content{display:flex;align-items:center;gap:12px}.s-fulfillment-methods-text{flex:1;min-width:0;display:flex;flex-direction:column;gap:4px}.s-fulfillment-methods-title{font-weight:700;font-size:14px;line-height:1.3;color:var(--color-text-primary, #2b2d34)}.s-fulfillment-methods-subtitle{font-size:12px;line-height:1.4;color:var(--color-text-secondary, #6b7280)}.s-fulfillment-methods-icon-wrap{flex-shrink:0;width:44px;height:44px;display:flex;align-items:center;justify-content:center;background:var(--color-surface-secondary, #f3f4f6);border-radius:10px}.s-fulfillment-methods-icon{font-size:22px;color:var(--color-text-secondary, #6b7280);line-height:1}.shadow{--tw-shadow:0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}.s-fulfillment-methods-list{margin-bottom:0.75rem;margin-top:0.75rem;display:flex;flex-wrap:wrap;gap:1rem}.s-fulfillment-methods-card{min-width:0px;flex:1 1 0%;border-radius:0.75rem;border-width:1px;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1));padding:1rem}.s-fulfillment-methods-content{display:flex;flex-direction:row;align-items:center;gap:0.75rem}.s-fulfillment-methods-content:where([dir="rtl"],[dir="rtl"] *){flex-direction:row-reverse}.s-fulfillment-methods-text{display:flex;min-width:0px;flex:1 1 0%;flex-direction:column;gap:0.25rem}.s-fulfillment-methods-title{font-size:0.875rem;line-height:1.25rem;font-weight:700;line-height:1.375;color:var(--color-text-primary,#2b2d34)}.s-fulfillment-methods-subtitle{font-size:0.75rem;line-height:1rem;line-height:1.4;color:var(--color-text-secondary,#6b7280)}.s-fulfillment-methods-icon-wrap{display:flex;height:2.75rem;width:2.75rem;flex-shrink:0;align-items:center;justify-content:center;border-radius:10px;background-color:var(--color-surface-secondary,#f3f4f6)}.s-fulfillment-methods-icon{font-size:22px;line-height:1;color:var(--color-text-secondary,#6b7280)}';export{i as salla_fulfillment_methods}
@@ -0,0 +1,4 @@
1
+ /*!
2
+ * Crafted with ❤ by Salla
3
+ */
4
+ import{r as e,h as t,H as r}from"./p-BsIeN-bg.js";import{H as a,F as i}from"./p-D6rFREuQ.js";import"./p-CgtvEd63.js";const s=class{constructor(t){e(this,t),this.filters=[],this.filtersData={},this.clearAllLabel="",this.removeLabel="",this.translationDefaults={"pages.categories.clear_all_filters":{ar:"إزالة التصفية",en:"Clear All"},"common.elements.delete":{ar:"حذف",en:"Delete"}}}async componentWillLoad(){salla.event.on("filters::fetched",(({filters:e})=>{this.filters=a.resolveFilterLabels(e),this.syncFiltersDataFromFiltersElement()})),salla.event.on("filters::hidden",(()=>{this.filters=[]})),salla.event.on("salla-filters::changed",(e=>{this.filtersData={...e}})),salla.event.on("salla-filters::reset",(()=>{this.filtersData={}})),salla.lang.onLoaded((()=>{this.registerTranslationDefaults(),this.loadTranslations()})),this.getInitialFiltersData()}getInitialFiltersData(){const e=new URLSearchParams(window.location.search);this.filtersData=a.extractFiltersFromUrl(e)}syncFiltersDataFromFiltersElement(){setTimeout((async()=>{const e=await(this.getFiltersElement()?.getFilters());e&&(this.filtersData={...e})}))}registerTranslationDefaults(){const e=Object.entries(this.translationDefaults).reduce(((e,[t,r])=>(salla.lang.get(t)===t&&(e[t]=r),e)),{});Object.keys(e).length&&salla.lang.addBulk(e)}loadTranslations(){this.clearAllLabel=salla.lang.get("pages.categories.clear_all_filters"),this.removeLabel=salla.lang.get("common.elements.delete")}getAppliedFilters(){const e=[],t=this.filtersData||{};for(const r of Object.keys(t)){if("variants"===r){const a=this.filters?.find((e=>e.type===i.VARIANTS));for(const s of Object.keys(t.variants||{})){const l=t.variants[s],o=a?.values?.find((e=>(e.key||e.value)==l));o&&e.push({key:r,variantKey:s,value:l,type:i.VARIANTS,groupLabel:a?.label,optionLabel:o.value})}continue}const a=this.filters?.find((e=>e.key===r));if(!a)continue;const s=t[r];if(a.type===i.RANGE||s&&"object"==typeof s&&!Array.isArray(s)){e.push({key:r,value:s,type:i.RANGE,groupLabel:a.label,optionLabel:`${s.min} - ${s.max}`});continue}if("category_id"===r&&!Array.isArray(s)&&"product.index"==salla.config.get("page.slug")&&s==salla.config.get("page.id"))continue;const l=Array.isArray(s)?s:[s];for(const t of l){const i=a.values?.find((e=>("number"==typeof e?e:e.key||e.value)==t)),s="rating"===a.key?`${t}`:i&&"number"!=typeof i?i.value:void 0;null!=s&&e.push({key:r,value:t,type:a.type,groupLabel:a.label,optionLabel:s})}}return e}getFiltersElement(){return document.querySelector("salla-filters")}removeFilter(e){this.getFiltersElement()?.removeFilter(e)}clearAll(){this.getFiltersElement()?.resetFilters()}render(){const e=this.getAppliedFilters();return e.length?t(r,{class:"s-applied-filters-wrapper"},t("div",{class:"s-applied-filters-tags"},e.map((e=>t("div",{class:"s-applied-filters-tag"},t("span",{class:"s-applied-filters-tag-name"},e.groupLabel,": ",e.optionLabel),t("button",{type:"button",class:"s-applied-filters-tag-remove","aria-label":`${this.removeLabel} ${e.groupLabel}: ${e.optionLabel}`,onClick:()=>this.removeFilter(e)},t("i",{class:"sicon-cancel","aria-hidden":"true"}))))),t("button",{type:"button",class:"s-applied-filters-clear-tag",onClick:()=>this.clearAll()},t("span",null,this.clearAllLabel)))):null}};s.style="/*!twlt*/:host{display:block}.s-applied-filters-tags{display:flex;flex-wrap:wrap;align-items:center;gap:0.5rem;margin-bottom:1rem}.s-applied-filters-tag{display:inline-flex;align-items:center;gap:0.4rem;border-radius:999px;border:1px solid #e8e8e8;background:rgba(255, 255, 255, 0.3);color:var(--main-text-color);font-size:0.85rem;line-height:1;padding:0.4rem 0.65rem}.s-applied-filters-tag-remove{display:inline-flex;align-items:center;justify-content:center;border:0;padding:0;background:transparent;color:inherit;font-size:0.75rem;cursor:pointer}.s-applied-filters-clear-tag{display:inline-flex;align-items:center;gap:0.4rem;border-radius:999px;border:1px solid var(--color-danger, #dc3545);background:transparent;color:var(--color-danger, #dc3545);font-size:0.85rem;line-height:1;padding:0.4rem 0.65rem;cursor:pointer}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.s-applied-filters-wrapper{display:block}.s-applied-filters-tags{margin-bottom:1rem;display:flex;flex-direction:row;flex-wrap:wrap;align-items:center;gap:0.5rem}.s-applied-filters-tag{display:inline-flex;align-items:center;gap:0.375rem;border-radius:9999px;border-width:1px;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1));background-color:rgb(255 255 255 / 0.3);padding-top:0.375rem;padding-bottom:0.375rem;padding-left:0.625rem;padding-right:0.625rem;font-size:0.875rem;line-height:1.25rem;color:var(--main-text-color)}.s-applied-filters-tag-name{color:inherit}.s-applied-filters-tag-remove{display:inline-flex;cursor:pointer;align-items:center;justify-content:center;border-width:0px;background-color:transparent;padding:0px;font-size:0.75rem;line-height:1rem;color:inherit}.s-applied-filters-clear-tag{display:inline-flex;cursor:pointer;align-items:center;gap:0.375rem;border-radius:9999px;border-width:1px;--tw-border-opacity:1;border-color:rgb(248 113 113 / var(--tw-border-opacity, 1));background-color:transparent;padding-top:0.375rem;padding-bottom:0.375rem;padding-left:0.625rem;padding-right:0.625rem;font-size:0.875rem;line-height:1.25rem;--tw-text-opacity:1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}";export{s as salla_applied_filters}
@@ -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}from"./p-C0qiFNJn.js";import{a}from"./p-C8xwacGT.js";import"./p-CoQJOPRz.js";const r=class{constructor(i){t(this,i),this.orderItemUpdated=s(this,"orderItemUpdated"),this.orderItemRemoved=s(this,"orderItemRemoved"),this.quantityInput=null,this.productOptions=null,this.handleQuantityChange=t=>{const s=t.detail,i=s?.quantity??parseInt(t.target.value,10);isNaN(i)||i<1||i!==this.quantity&&(this.quantity=i,this.emitUpdate(i))},this.handleOptionsChange=()=>{this.emitUpdate(this.quantity)}}componentWillLoad(){this.quantity=this.item?.quantity||1}handleItemChange(t){const s=t?.quantity||1;s!==this.quantity&&(this.quantity=s,this.quantityInput?.setValue?.(s,!1))}get hasOptions(){return(this.item.product?.options?.length||0)>0}async getSelectedOptions(){return await(this.productOptions?.getSelectedOptionsData?.())||{}}async getOptionsData(){return await(this.productOptions?.getOptionsData?.())||this.item.product?.options||[]}async emitUpdate(t){const s=this.item?.id;if(null==s)return;const i={itemId:s,quantity:t};this.hasOptions&&(i.options=await this.getSelectedOptions(),i.optionDefinitions=await this.getOptionsData()),this.orderItemUpdated.emit(i)}removeItem(){const t=this.item?.id;null!=t&&this.orderItemRemoved.emit({itemId:t})}render(){if(!this.item)return null;const t=this.item.product,s=this.item.name||t?.name||"",r=t?.image?.url||"",n=t?.image?.alt||s,l=t?.url||"#",o=t?.price,h=a(t),d=t?.weight_label,c=this.item.product?.options,m=`order-edit-item-${this.item.id}-${t?.id}`,u={value:this.quantity};return h&&(u.max=h),i(e,null,i("div",null,i("div",{class:"s-order-edit-item-header"},i("div",{class:"s-order-edit-item-media"},r&&i("a",{href:l},i("img",{src:r,alt:n,class:"s-order-edit-item-image"})),i("div",{class:"s-order-edit-item-details"},i("h2",{class:"s-order-edit-item-name"},i("a",{href:l,class:"s-order-edit-item-link"},s)),null!=o&&i("span",{class:"s-order-edit-item-price",innerHTML:salla.money(o)}),d&&i("p",{class:"s-order-edit-item-weight"},salla.lang.getWithDefault("pages.products.weight","الوزن")," ",d))),i("salla-button",{type:"button",shape:"icon",size:"small",color:"danger","aria-label":salla.lang.getWithDefault("common.elements.delete","حذف"),onClick:()=>this.removeItem()},i("i",{class:"sicon-cancel"}))),i("div",{class:"s-order-edit-item-quantity"},i("h3",{class:"s-order-edit-item-quantity-label"},salla.lang.getWithDefault("common.elements.quantity","الكمية")),i("div",{class:"s-order-edit-item-quantity-input"},i("salla-quantity-input",{ref:t=>this.quantityInput=t,...u,onChange:this.handleQuantityChange}))),this.hasOptions&&i("form",{class:"s-order-edit-item-options",onSubmit:t=>t.preventDefault()},i("salla-product-options",{ref:t=>this.productOptions=t,onChange:this.handleOptionsChange,"product-id":t.id,"unique-key":m,options:JSON.stringify(c),key:`${m}-options`}))))}static get watchers(){return{item:["handleItemChange"]}}};r.style=":host{display:block}";export{r as salla_order_edit_item}
4
+ import{r as t,c as s,h as i,H as e}from"./p-BsIeN-bg.js";import{a}from"./p-C8xwacGT.js";import"./p-CoQJOPRz.js";const r=class{constructor(i){t(this,i),this.orderItemUpdated=s(this,"orderItemUpdated"),this.orderItemRemoved=s(this,"orderItemRemoved"),this.quantityInput=null,this.productOptions=null,this.handleQuantityChange=t=>{const s=t.detail,i=s?.quantity??parseInt(t.target.value,10);isNaN(i)||i<1||i!==this.quantity&&(this.quantity=i,this.emitUpdate(i))},this.handleOptionsChange=()=>{this.emitUpdate(this.quantity)}}componentWillLoad(){this.quantity=this.item?.quantity||1}handleItemChange(t){const s=t?.quantity||1;s!==this.quantity&&(this.quantity=s,this.quantityInput?.setValue?.(s,!1))}get hasOptions(){return(this.item.product?.options?.length||0)>0}async getSelectedOptions(){return await(this.productOptions?.getSelectedOptionsData?.())||{}}async getOptionsData(){return await(this.productOptions?.getOptionsData?.())||this.item.product?.options||[]}async emitUpdate(t){const s=this.item?.id;if(null==s)return;const i={itemId:s,quantity:t};this.hasOptions&&(i.options=await this.getSelectedOptions(),i.optionDefinitions=await this.getOptionsData()),this.orderItemUpdated.emit(i)}removeItem(){const t=this.item?.id;null!=t&&this.orderItemRemoved.emit({itemId:t})}render(){if(!this.item)return null;const t=this.item.product,s=this.item.name||t?.name||"",r=t?.image?.url||"",n=t?.image?.alt||s,l=t?.url||"#",o=t?.price,h=a(t),d=t?.weight_label,c=this.item.product?.options,m=`order-edit-item-${this.item.id}-${t?.id}`,u={value:this.quantity};return h&&(u.max=h),i(e,null,i("div",null,i("div",{class:"s-order-edit-item-header"},i("div",{class:"s-order-edit-item-media"},r&&i("a",{href:l},i("img",{src:r,alt:n,class:"s-order-edit-item-image"})),i("div",{class:"s-order-edit-item-details"},i("h2",{class:"s-order-edit-item-name"},i("a",{href:l,class:"s-order-edit-item-link"},s)),null!=o&&i("span",{class:"s-order-edit-item-price",innerHTML:salla.money(o)}),d&&i("p",{class:"s-order-edit-item-weight"},salla.lang.getWithDefault("pages.products.weight","الوزن")," ",d))),i("salla-button",{type:"button",shape:"icon",size:"small",color:"danger","aria-label":salla.lang.getWithDefault("common.elements.delete","حذف"),onClick:()=>this.removeItem()},i("i",{class:"sicon-cancel"}))),i("div",{class:"s-order-edit-item-quantity"},i("h3",{class:"s-order-edit-item-quantity-label"},salla.lang.getWithDefault("common.elements.quantity","الكمية")),i("div",{class:"s-order-edit-item-quantity-input"},i("salla-quantity-input",{ref:t=>this.quantityInput=t,...u,onChange:this.handleQuantityChange}))),this.hasOptions&&i("form",{class:"s-order-edit-item-options",onSubmit:t=>t.preventDefault()},i("salla-product-options",{ref:t=>this.productOptions=t,onChange:this.handleOptionsChange,"product-id":t.id,"unique-key":m,options:JSON.stringify(c),key:`${m}-options`}))))}static get watchers(){return{item:["handleItemChange"]}}};r.style=":host{display:block}";export{r as salla_order_edit_item}
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r as t,h as a,H as e,a as r}from"./p-C0qiFNJn.js";import{f as i}from"./p-CL7OPpYS.js";const s=class{constructor(a){t(this,a),this.limit=10,this.products=[],this.isLoading=!0,this.canRender=!0,this.title="",this.addToCartLabel="",this.weightLabel="",this.discountLabel="",this.placeholder="",this.fetchGeneration=0,this.isSyncingCart=!1,this.cartItemChangedHandler=t=>{const a=t?.data?.cart?.items??[],e=a.map((t=>String(t.product_id))).filter(Boolean);this.syncCartItemsDom(a),this.fetchRecommendations(e)},this.beforeAddItemHandler=t=>{const a=String(t?.id??"");a&&this.products.some((t=>String(t.id)===a))&&salla.cart?.api&&(salla.cart.api.addToCartSource="basket_gap")},this.addButtonSuccessHandler=t=>{const a=t?.target?.getAttribute?.("product-id");if(!a)return;const e=this.products.find((t=>String(t.id)===String(a)));if(!e)return;const r=t?.detail?.data?.items??[],i=r.find((t=>String(t.product_id)===String(e.id)))??r.slice(-1)[0];salla.event.emit("salla-basket-gap::product.added",[{product:e,position:this.products.indexOf(e)+1,cartItem:i,cartId:t?.detail?.data?.id,source:"basket_gap"}])},salla.lang.onLoaded((()=>{this.title=salla.lang.get("pages.cart.basket_gap_title"),this.addToCartLabel=salla.lang.get("pages.cart.add_to_cart"),this.weightLabel=salla.lang.get("pages.products.weight"),this.discountLabel=salla.lang.get("pages.products.discount")}))}componentWillLoad(){salla.onReady().then((()=>{if(!salla.config.get("store.settings.cart.basket_gap"))return this.canRender=!1,void(this.isLoading=!1);this.title=salla.lang.get("pages.cart.basket_gap_title"),this.addToCartLabel=salla.lang.get("pages.cart.add_to_cart"),this.weightLabel=salla.lang.get("pages.products.weight"),this.discountLabel=salla.lang.get("pages.products.discount"),this.placeholder=salla.url.asset(salla.config.get("theme.settings.placeholder"));const t=salla.storage.get("cart"),a=(t?.items??[]).map((t=>String(t.product_id))).filter(Boolean);return a.length?this.fetchRecommendations(a):salla.api.cart.details().then((({data:{cart:t}})=>{const a=(t?.items??[]).map((t=>String(t.product_id))).filter(Boolean);return this.fetchRecommendations(a)})).catch((()=>{this.canRender=!1,this.isLoading=!1}))}))}componentDidLoad(){this.positionUnderCartItems()}componentDidUpdate(){document.lazyLoadInstance?.update(this.host.querySelectorAll(".lazy")),this.positionUnderCartItems()}getCartItemForms(t=document){return Array.from(t.querySelectorAll('form[id^="item-"]')).filter((t=>!t.closest(".cart-options")))}positionUnderCartItems(){const t=this.getCartItemForms(),a=t[t.length-1];a&&a.nextElementSibling!==this.host&&a.after(this.host)}syncCartItemsDom(t){t?.length&&!this.isSyncingCart&&t.filter((t=>!document.getElementById("item-"+t.id))).length&&(this.isSyncingCart=!0,fetch(window.location.href,{headers:{"X-Requested-With":"XMLHttpRequest"},credentials:"same-origin"}).then((t=>t.text())).then((t=>{const a=(new DOMParser).parseFromString(t,"text/html"),e=this.getCartItemForms(a),r=this.getCartItemForms();if(!e.length||!r.length)return;const i=r[0],s=i.parentElement;s&&(e.forEach((t=>{s.insertBefore(document.importNode(t,!0),i)})),r.forEach((t=>t.remove())),document.lazyLoadInstance?.update?.(),this.positionUnderCartItems())})).catch((()=>{})).finally((()=>{this.isSyncingCart=!1})))}connectedCallback(){salla.event.on("cart::item.added",this.cartItemChangedHandler),salla.event.on("cart::item.deleted",this.cartItemChangedHandler),salla.event.on("cart::before.add.item",this.beforeAddItemHandler),this.host.addEventListener("success",this.addButtonSuccessHandler)}disconnectedCallback(){salla.event.off("cart::item.added",this.cartItemChangedHandler),salla.event.off("cart::item.deleted",this.cartItemChangedHandler),salla.event.off("cart::before.add.item",this.beforeAddItemHandler),this.host.removeEventListener("success",this.addButtonSuccessHandler)}getCartProductIds(t){if(t?.length)return new Set(t);const a=salla.storage.get("cart");return new Set((a?.items??[]).map((t=>String(t.product_id))).filter(Boolean))}fetchRecommendations(t){if(!t.length)return this.canRender=!1,this.isLoading=!1,Promise.resolve();const a=++this.fetchGeneration;return i(t).then((e=>{if(a!==this.fetchGeneration)return;const r=this.getCartProductIds(t),i=e.filter((t=>!r.has(t)));if(i.length)return this.fetchProducts(i.slice(0,this.limit),a);this.canRender=!1})).catch((()=>{a===this.fetchGeneration&&(this.canRender=!1)})).finally((()=>{a===this.fetchGeneration&&(this.isLoading=!1)}))}fetchProducts(t,a){return salla.api.withoutNotifier((()=>salla.product.api.fetch({source:"selected",source_value:t,limit:this.limit}))).then((t=>{a===this.fetchGeneration&&(this.products=t?.data??[],this.canRender=this.products.length>0)})).catch((()=>{a===this.fetchGeneration&&(this.canRender=!1)}))}getDiscountLabel(t){if(t.promotion_title)return t.promotion_title;if(t.is_on_sale&&t.regular_price>0&&t.sale_price>0){const a=Math.round(100*(1-t.sale_price/t.regular_price));return a>0?`${this.discountLabel} ${a}%`:null}return null}formatDate(t){const a=new Date(1e3*t),e=String(a.getMonth()+1).padStart(2,"0"),r=String(a.getDate()).padStart(2,"0");return`${a.getFullYear()}-${e}-${r}`}getSkeletonView(){return a(e,{class:"s-basket-gap-entry"},a("div",{class:"s-basket-gap-skeleton"},a("salla-skeleton",{height:"16px",width:"40%",style:{marginBottom:"16px"}}),Array(3).fill(null).map(((t,e)=>a("div",{key:e,class:"s-basket-gap-skeleton-card"},a("salla-skeleton",{height:"64px",width:"64px",style:{borderRadius:"8px",flexShrink:"0"}}),a("div",{class:"s-basket-gap-skeleton-info"},a("salla-skeleton",{height:"14px",width:"50%"}),a("salla-skeleton",{height:"12px",width:"25%",style:{marginTop:"6px"}}),a("salla-skeleton",{height:"10px",width:"35%",style:{marginTop:"4px"}})),a("salla-skeleton",{height:"36px",width:"100px",style:{borderRadius:"6px",flexShrink:"0",marginInlineStart:"auto"}}))))))}getProductCard(t){const e=this.getDiscountLabel(t);return a("div",{key:t.id,class:"s-basket-gap-card"},a("a",{href:t.url,class:"s-basket-gap-card-image"},a("img",{class:"lazy",src:this.placeholder,"data-src":t.image?.url,alt:t.image?.alt||t.name})),a("div",{class:"s-basket-gap-card-info"},a("h3",{class:"s-basket-gap-card-name"},a("a",{href:t.url},t.name)),t.is_on_sale?a("div",{class:"s-basket-gap-card-sale-price"},a("span",{innerHTML:salla.money(t.sale_price)}),a("del",{innerHTML:salla.money(t.regular_price)})):a("span",{class:"s-basket-gap-card-price",innerHTML:salla.money(t.price)}),t.weight_label&&a("span",{class:"s-basket-gap-card-weight"},this.weightLabel," ",t.weight_label)),a("div",{class:"s-basket-gap-card-actions"},(t.promotion_title||t.discount_ends||t.is_on_sale)&&a("div",{class:"s-basket-gap-card-offer"},a("i",{class:"sicon-gift"}),e&&a("span",null,e),t.discount_ends&&[a("salla-count-down",{date:this.formatDate(t.discount_ends),"end-of-day":!0,digits:"en","auto-segments":!0}),a("i",{class:"sicon-alarm"})]),a("salla-add-product-button",{class:"s-basket-gap-card-btn","product-id":t.id,"product-status":t.status,"product-type":t.type},this.addToCartLabel)))}render(){return this.canRender?this.isLoading?this.getSkeletonView():this.products.length?a(e,{class:"s-basket-gap-entry"},this.title&&a("h2",{class:"s-basket-gap-title"},this.title),a("div",{class:"s-basket-gap-list"},this.products.map((t=>this.getProductCard(t))))):null:null}get host(){return r(this)}};s.style='/*!twlt*/:host{display:block}.block{display:block}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.s-basket-gap-entry{margin-top:1.25rem;margin-bottom:1.25rem;display:block;border-radius:0.375rem;--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1));padding:1.25rem}.s-basket-gap-title{margin-bottom:1rem;font-size:1.125rem;line-height:1.75rem;font-weight:700}.s-basket-gap-list{display:flex;flex-direction:column}.s-basket-gap-list>:not([hidden])~:not([hidden]){--tw-divide-y-reverse:0;border-top-width:calc(1px * calc(1 - var(--tw-divide-y-reverse)));border-bottom-width:calc(1px * var(--tw-divide-y-reverse));--tw-divide-opacity:1;border-color:rgb(243 244 246 / var(--tw-divide-opacity, 1))}.s-basket-gap-card{display:flex;flex-wrap:wrap;align-items:center;column-gap:0.75rem;row-gap:0.625rem;padding-top:1rem;padding-bottom:1rem}.s-basket-gap-card-image{height:4rem;width:4rem;flex-shrink:0;overflow:hidden;border-radius:0.375rem;border-width:1px;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1))}.s-basket-gap-card-image img{height:100%;width:100%;object-fit:cover}.s-basket-gap-card-info{display:flex;min-width:0px;flex:1 1 0%;flex-direction:column;gap:0.25rem}.s-basket-gap-card-actions{display:flex;width:100%;align-items:center;justify-content:flex-end;gap:0.5rem}@media (min-width: 640px){.s-basket-gap-card-actions{width:auto}}.s-basket-gap-card-name{font-size:0.875rem;line-height:1.25rem;font-weight:600;line-height:1.25;--tw-text-opacity:1;color:rgb(31 41 55 / var(--tw-text-opacity, 1))}.s-basket-gap-card-name a:hover{color:var(--color-primary)}.s-basket-gap-card-price{font-size:0.875rem;line-height:1.25rem;--tw-text-opacity:1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.s-basket-gap-card-sale-price{display:flex;align-items:center;gap:0.5rem}.s-basket-gap-card-sale-price span{font-size:0.875rem;line-height:1.25rem;font-weight:700;--tw-text-opacity:1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.s-basket-gap-card-sale-price del{font-size:0.75rem;line-height:1rem;--tw-text-opacity:1;color:rgb(156 163 175 / var(--tw-text-opacity, 1));text-decoration-line:line-through}.s-basket-gap-card-weight{font-size:0.75rem;line-height:1rem;--tw-text-opacity:1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.s-basket-gap-card-offer{display:flex;flex-shrink:0;align-items:center;gap:0.25rem;border-radius:0.375rem;--tw-bg-opacity:1;background-color:rgb(240 253 244 / var(--tw-bg-opacity, 1));padding-left:9px;padding-right:9px;padding-top:3px;padding-bottom:3px;font-size:11px;font-weight:500;--tw-text-opacity:1;color:rgb(21 128 61 / var(--tw-text-opacity, 1))}.s-basket-gap-card-offer i{font-size:0.75rem;line-height:1rem}.s-basket-gap-card-offer span{font-weight:700;--tw-text-opacity:1 !important;color:rgb(31 41 55 / var(--tw-text-opacity, 1)) !important}.s-basket-gap-card-offer salla-count-down{flex-shrink:0}.s-basket-gap-card-offer salla-count-down:where([dir="ltr"],[dir="ltr"] *){margin-inline-start:0.25rem}.s-basket-gap-card-offer salla-count-down:where([dir="rtl"],[dir="rtl"] *){margin-inline-end:0.25rem}.s-basket-gap-card-offer .s-count-down-list{margin-left:-0px !important;margin-right:-0px !important;margin-bottom:0px !important;margin-top:0px !important;display:inline-flex;flex-wrap:nowrap;align-items:center;justify-content:flex-start !important;column-gap:0px;--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal) var(--tw-slashed-zero) var(--tw-numeric-figure) var(--tw-numeric-spacing) var(--tw-numeric-fraction)}.s-basket-gap-card-offer .s-count-down-list:where([dir="ltr"],[dir="ltr"] *){flex-direction:row-reverse !important}.s-basket-gap-card-offer .s-count-down-list:where([dir="rtl"],[dir="rtl"] *){flex-direction:row !important}.s-basket-gap-card-offer .s-count-down-item{position:relative !important;margin-left:0px !important;margin-right:0px !important;display:inline-flex !important;width:auto !important;flex:none !important;flex-grow:0 !important;flex-direction:row !important;align-items:center !important;justify-content:center !important;padding-top:0px !important;padding-bottom:0px !important;padding-left:0px !important;padding-right:0px !important;font-size:12px !important;font-weight:700 !important;line-height:1 !important;--tw-text-opacity:1 !important;color:rgb(21 128 61 / var(--tw-text-opacity, 1)) !important}.s-basket-gap-card-offer .s-count-down-item-value{display:inline-block !important;width:2ch !important;min-width:2ch !important;text-align:center;--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal) var(--tw-slashed-zero) var(--tw-numeric-figure) var(--tw-numeric-spacing) var(--tw-numeric-fraction);line-height:1}.s-basket-gap-card-offer .s-count-down-item-label{display:none}.s-basket-gap-entry .s-basket-gap-card-offer.s-basket-gap-card-offer .s-count-down-item::before{content:none !important}.s-basket-gap-entry .s-basket-gap-card-offer.s-basket-gap-card-offer .s-count-down-item::after{content:none !important;position:static;left:auto;right:auto;transform:none}[dir=\'rtl\'] .s-basket-gap-entry .s-basket-gap-card-offer.s-basket-gap-card-offer .s-count-down-item:not(:last-child)::after{content:\':\' !important;position:static;left:auto;right:auto;transform:none;margin-left:0.15rem;margin-right:0.15rem;color:#15803d;font-size:12px;font-weight:700;line-height:1}[dir=\'ltr\'] .s-basket-gap-entry .s-basket-gap-card-offer.s-basket-gap-card-offer .s-count-down-item:not(:first-child)::after{content:\':\' !important;position:static;left:auto;right:auto;transform:none;margin-left:0.15rem;margin-right:0.15rem;color:#15803d;font-size:12px;font-weight:700;line-height:1}.s-basket-gap-card-btn{flex-shrink:0}.s-basket-gap-card-btn salla-button .s-button-btn{border-radius:var(--s-radius, 0.25rem);border-width:1px !important;border-color:var(--color-primary) !important;background-color:transparent !important;color:var(--color-primary) !important}.s-basket-gap-card-btn salla-button .s-button-btn:hover{background-color:var(--color-primary) !important;--tw-text-opacity:1 !important;color:rgb(255 255 255 / var(--tw-text-opacity, 1)) !important}.s-basket-gap-card-btn salla-button .s-button-loader:before{border-top-color:var(--color-primary) !important;border-left-color:var(--color-primary) !important;border-bottom-color:rgb(243 244 246 / var(--tw-border-opacity, 1)) !important;--tw-border-opacity:1 !important;border-right-color:rgb(243 244 246 / var(--tw-border-opacity, 1)) !important}.s-basket-gap-skeleton{display:flex;flex-direction:column;gap:0.75rem}.s-basket-gap-skeleton-card{display:flex;align-items:center;gap:0.75rem;padding-top:0.75rem;padding-bottom:0.75rem}.s-basket-gap-skeleton-info{display:flex;flex:1 1 0%;flex-direction:column;gap:0.5rem}';export{s as salla_basket_gap}
4
+ import{r as t,h as a,H as e,a as r}from"./p-BsIeN-bg.js";import{f as i}from"./p-CL7OPpYS.js";const s=class{constructor(a){t(this,a),this.limit=10,this.products=[],this.isLoading=!0,this.canRender=!0,this.title="",this.addToCartLabel="",this.weightLabel="",this.discountLabel="",this.placeholder="",this.fetchGeneration=0,this.isSyncingCart=!1,this.cartItemChangedHandler=t=>{const a=t?.data?.cart?.items??[],e=a.map((t=>String(t.product_id))).filter(Boolean);this.syncCartItemsDom(a),this.fetchRecommendations(e)},this.beforeAddItemHandler=t=>{const a=String(t?.id??"");a&&this.products.some((t=>String(t.id)===a))&&salla.cart?.api&&(salla.cart.api.addToCartSource="basket_gap")},this.addButtonSuccessHandler=t=>{const a=t?.target?.getAttribute?.("product-id");if(!a)return;const e=this.products.find((t=>String(t.id)===String(a)));if(!e)return;const r=t?.detail?.data?.items??[],i=r.find((t=>String(t.product_id)===String(e.id)))??r.slice(-1)[0];salla.event.emit("salla-basket-gap::product.added",[{product:e,position:this.products.indexOf(e)+1,cartItem:i,cartId:t?.detail?.data?.id,source:"basket_gap"}])},salla.lang.onLoaded((()=>{this.title=salla.lang.get("pages.cart.basket_gap_title"),this.addToCartLabel=salla.lang.get("pages.cart.add_to_cart"),this.weightLabel=salla.lang.get("pages.products.weight"),this.discountLabel=salla.lang.get("pages.products.discount")}))}componentWillLoad(){salla.onReady().then((()=>{if(!salla.config.get("store.settings.cart.basket_gap"))return this.canRender=!1,void(this.isLoading=!1);this.title=salla.lang.get("pages.cart.basket_gap_title"),this.addToCartLabel=salla.lang.get("pages.cart.add_to_cart"),this.weightLabel=salla.lang.get("pages.products.weight"),this.discountLabel=salla.lang.get("pages.products.discount"),this.placeholder=salla.url.asset(salla.config.get("theme.settings.placeholder"));const t=salla.storage.get("cart"),a=(t?.items??[]).map((t=>String(t.product_id))).filter(Boolean);return a.length?this.fetchRecommendations(a):salla.api.cart.details().then((({data:{cart:t}})=>{const a=(t?.items??[]).map((t=>String(t.product_id))).filter(Boolean);return this.fetchRecommendations(a)})).catch((()=>{this.canRender=!1,this.isLoading=!1}))}))}componentDidLoad(){this.positionUnderCartItems()}componentDidUpdate(){document.lazyLoadInstance?.update(this.host.querySelectorAll(".lazy")),this.positionUnderCartItems()}getCartItemForms(t=document){return Array.from(t.querySelectorAll('form[id^="item-"]')).filter((t=>!t.closest(".cart-options")))}positionUnderCartItems(){const t=this.getCartItemForms(),a=t[t.length-1];a&&a.nextElementSibling!==this.host&&a.after(this.host)}syncCartItemsDom(t){t?.length&&!this.isSyncingCart&&t.filter((t=>!document.getElementById("item-"+t.id))).length&&(this.isSyncingCart=!0,fetch(window.location.href,{headers:{"X-Requested-With":"XMLHttpRequest"},credentials:"same-origin"}).then((t=>t.text())).then((t=>{const a=(new DOMParser).parseFromString(t,"text/html"),e=this.getCartItemForms(a),r=this.getCartItemForms();if(!e.length||!r.length)return;const i=r[0],s=i.parentElement;s&&(e.forEach((t=>{s.insertBefore(document.importNode(t,!0),i)})),r.forEach((t=>t.remove())),document.lazyLoadInstance?.update?.(),this.positionUnderCartItems())})).catch((()=>{})).finally((()=>{this.isSyncingCart=!1})))}connectedCallback(){salla.event.on("cart::item.added",this.cartItemChangedHandler),salla.event.on("cart::item.deleted",this.cartItemChangedHandler),salla.event.on("cart::before.add.item",this.beforeAddItemHandler),this.host.addEventListener("success",this.addButtonSuccessHandler)}disconnectedCallback(){salla.event.off("cart::item.added",this.cartItemChangedHandler),salla.event.off("cart::item.deleted",this.cartItemChangedHandler),salla.event.off("cart::before.add.item",this.beforeAddItemHandler),this.host.removeEventListener("success",this.addButtonSuccessHandler)}getCartProductIds(t){if(t?.length)return new Set(t);const a=salla.storage.get("cart");return new Set((a?.items??[]).map((t=>String(t.product_id))).filter(Boolean))}fetchRecommendations(t){if(!t.length)return this.canRender=!1,this.isLoading=!1,Promise.resolve();const a=++this.fetchGeneration;return i(t).then((e=>{if(a!==this.fetchGeneration)return;const r=this.getCartProductIds(t),i=e.filter((t=>!r.has(t)));if(i.length)return this.fetchProducts(i.slice(0,this.limit),a);this.canRender=!1})).catch((()=>{a===this.fetchGeneration&&(this.canRender=!1)})).finally((()=>{a===this.fetchGeneration&&(this.isLoading=!1)}))}fetchProducts(t,a){return salla.api.withoutNotifier((()=>salla.product.api.fetch({source:"selected",source_value:t,limit:this.limit}))).then((t=>{a===this.fetchGeneration&&(this.products=t?.data??[],this.canRender=this.products.length>0)})).catch((()=>{a===this.fetchGeneration&&(this.canRender=!1)}))}getDiscountLabel(t){if(t.promotion_title)return t.promotion_title;if(t.is_on_sale&&t.regular_price>0&&t.sale_price>0){const a=Math.round(100*(1-t.sale_price/t.regular_price));return a>0?`${this.discountLabel} ${a}%`:null}return null}formatDate(t){const a=new Date(1e3*t),e=String(a.getMonth()+1).padStart(2,"0"),r=String(a.getDate()).padStart(2,"0");return`${a.getFullYear()}-${e}-${r}`}getSkeletonView(){return a(e,{class:"s-basket-gap-entry"},a("div",{class:"s-basket-gap-skeleton"},a("salla-skeleton",{height:"16px",width:"40%",style:{marginBottom:"16px"}}),Array(3).fill(null).map(((t,e)=>a("div",{key:e,class:"s-basket-gap-skeleton-card"},a("salla-skeleton",{height:"64px",width:"64px",style:{borderRadius:"8px",flexShrink:"0"}}),a("div",{class:"s-basket-gap-skeleton-info"},a("salla-skeleton",{height:"14px",width:"50%"}),a("salla-skeleton",{height:"12px",width:"25%",style:{marginTop:"6px"}}),a("salla-skeleton",{height:"10px",width:"35%",style:{marginTop:"4px"}})),a("salla-skeleton",{height:"36px",width:"100px",style:{borderRadius:"6px",flexShrink:"0",marginInlineStart:"auto"}}))))))}getProductCard(t){const e=this.getDiscountLabel(t);return a("div",{key:t.id,class:"s-basket-gap-card"},a("a",{href:t.url,class:"s-basket-gap-card-image"},a("img",{class:"lazy",src:this.placeholder,"data-src":t.image?.url,alt:t.image?.alt||t.name})),a("div",{class:"s-basket-gap-card-info"},a("h3",{class:"s-basket-gap-card-name"},a("a",{href:t.url},t.name)),t.is_on_sale?a("div",{class:"s-basket-gap-card-sale-price"},a("span",{innerHTML:salla.money(t.sale_price)}),a("del",{innerHTML:salla.money(t.regular_price)})):a("span",{class:"s-basket-gap-card-price",innerHTML:salla.money(t.price)}),t.weight_label&&a("span",{class:"s-basket-gap-card-weight"},this.weightLabel," ",t.weight_label)),a("div",{class:"s-basket-gap-card-actions"},(t.promotion_title||t.discount_ends||t.is_on_sale)&&a("div",{class:"s-basket-gap-card-offer"},a("i",{class:"sicon-gift"}),e&&a("span",null,e),t.discount_ends&&[a("salla-count-down",{date:this.formatDate(t.discount_ends),"end-of-day":!0,digits:"en","auto-segments":!0}),a("i",{class:"sicon-alarm"})]),a("salla-add-product-button",{class:"s-basket-gap-card-btn","product-id":t.id,"product-status":t.status,"product-type":t.type},this.addToCartLabel)))}render(){return this.canRender?this.isLoading?this.getSkeletonView():this.products.length?a(e,{class:"s-basket-gap-entry"},this.title&&a("h2",{class:"s-basket-gap-title"},this.title),a("div",{class:"s-basket-gap-list"},this.products.map((t=>this.getProductCard(t))))):null:null}get host(){return r(this)}};s.style='/*!twlt*/:host{display:block}.block{display:block}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.s-basket-gap-entry{margin-top:1.25rem;margin-bottom:1.25rem;display:block;border-radius:0.375rem;--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1));padding:1.25rem}.s-basket-gap-title{margin-bottom:1rem;font-size:1.125rem;line-height:1.75rem;font-weight:700}.s-basket-gap-list{display:flex;flex-direction:column}.s-basket-gap-list>:not([hidden])~:not([hidden]){--tw-divide-y-reverse:0;border-top-width:calc(1px * calc(1 - var(--tw-divide-y-reverse)));border-bottom-width:calc(1px * var(--tw-divide-y-reverse));--tw-divide-opacity:1;border-color:rgb(243 244 246 / var(--tw-divide-opacity, 1))}.s-basket-gap-card{display:flex;flex-wrap:wrap;align-items:center;column-gap:0.75rem;row-gap:0.625rem;padding-top:1rem;padding-bottom:1rem}.s-basket-gap-card-image{height:4rem;width:4rem;flex-shrink:0;overflow:hidden;border-radius:0.375rem;border-width:1px;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1))}.s-basket-gap-card-image img{height:100%;width:100%;object-fit:cover}.s-basket-gap-card-info{display:flex;min-width:0px;flex:1 1 0%;flex-direction:column;gap:0.25rem}.s-basket-gap-card-actions{display:flex;width:100%;align-items:center;justify-content:flex-end;gap:0.5rem}@media (min-width: 640px){.s-basket-gap-card-actions{width:auto}}.s-basket-gap-card-name{font-size:0.875rem;line-height:1.25rem;font-weight:600;line-height:1.25;--tw-text-opacity:1;color:rgb(31 41 55 / var(--tw-text-opacity, 1))}.s-basket-gap-card-name a:hover{color:var(--color-primary)}.s-basket-gap-card-price{font-size:0.875rem;line-height:1.25rem;--tw-text-opacity:1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.s-basket-gap-card-sale-price{display:flex;align-items:center;gap:0.5rem}.s-basket-gap-card-sale-price span{font-size:0.875rem;line-height:1.25rem;font-weight:700;--tw-text-opacity:1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.s-basket-gap-card-sale-price del{font-size:0.75rem;line-height:1rem;--tw-text-opacity:1;color:rgb(156 163 175 / var(--tw-text-opacity, 1));text-decoration-line:line-through}.s-basket-gap-card-weight{font-size:0.75rem;line-height:1rem;--tw-text-opacity:1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.s-basket-gap-card-offer{display:flex;flex-shrink:0;align-items:center;gap:0.25rem;border-radius:0.375rem;--tw-bg-opacity:1;background-color:rgb(240 253 244 / var(--tw-bg-opacity, 1));padding-left:9px;padding-right:9px;padding-top:3px;padding-bottom:3px;font-size:11px;font-weight:500;--tw-text-opacity:1;color:rgb(21 128 61 / var(--tw-text-opacity, 1))}.s-basket-gap-card-offer i{font-size:0.75rem;line-height:1rem}.s-basket-gap-card-offer span{font-weight:700;--tw-text-opacity:1 !important;color:rgb(31 41 55 / var(--tw-text-opacity, 1)) !important}.s-basket-gap-card-offer salla-count-down{flex-shrink:0}.s-basket-gap-card-offer salla-count-down:where([dir="ltr"],[dir="ltr"] *){margin-inline-start:0.25rem}.s-basket-gap-card-offer salla-count-down:where([dir="rtl"],[dir="rtl"] *){margin-inline-end:0.25rem}.s-basket-gap-card-offer .s-count-down-list{margin-left:-0px !important;margin-right:-0px !important;margin-bottom:0px !important;margin-top:0px !important;display:inline-flex;flex-wrap:nowrap;align-items:center;justify-content:flex-start !important;column-gap:0px;--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal) var(--tw-slashed-zero) var(--tw-numeric-figure) var(--tw-numeric-spacing) var(--tw-numeric-fraction)}.s-basket-gap-card-offer .s-count-down-list:where([dir="ltr"],[dir="ltr"] *){flex-direction:row-reverse !important}.s-basket-gap-card-offer .s-count-down-list:where([dir="rtl"],[dir="rtl"] *){flex-direction:row !important}.s-basket-gap-card-offer .s-count-down-item{position:relative !important;margin-left:0px !important;margin-right:0px !important;display:inline-flex !important;width:auto !important;flex:none !important;flex-grow:0 !important;flex-direction:row !important;align-items:center !important;justify-content:center !important;padding-top:0px !important;padding-bottom:0px !important;padding-left:0px !important;padding-right:0px !important;font-size:12px !important;font-weight:700 !important;line-height:1 !important;--tw-text-opacity:1 !important;color:rgb(21 128 61 / var(--tw-text-opacity, 1)) !important}.s-basket-gap-card-offer .s-count-down-item-value{display:inline-block !important;width:2ch !important;min-width:2ch !important;text-align:center;--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal) var(--tw-slashed-zero) var(--tw-numeric-figure) var(--tw-numeric-spacing) var(--tw-numeric-fraction);line-height:1}.s-basket-gap-card-offer .s-count-down-item-label{display:none}.s-basket-gap-entry .s-basket-gap-card-offer.s-basket-gap-card-offer .s-count-down-item::before{content:none !important}.s-basket-gap-entry .s-basket-gap-card-offer.s-basket-gap-card-offer .s-count-down-item::after{content:none !important;position:static;left:auto;right:auto;transform:none}[dir=\'rtl\'] .s-basket-gap-entry .s-basket-gap-card-offer.s-basket-gap-card-offer .s-count-down-item:not(:last-child)::after{content:\':\' !important;position:static;left:auto;right:auto;transform:none;margin-left:0.15rem;margin-right:0.15rem;color:#15803d;font-size:12px;font-weight:700;line-height:1}[dir=\'ltr\'] .s-basket-gap-entry .s-basket-gap-card-offer.s-basket-gap-card-offer .s-count-down-item:not(:first-child)::after{content:\':\' !important;position:static;left:auto;right:auto;transform:none;margin-left:0.15rem;margin-right:0.15rem;color:#15803d;font-size:12px;font-weight:700;line-height:1}.s-basket-gap-card-btn{flex-shrink:0}.s-basket-gap-card-btn salla-button .s-button-btn{border-radius:var(--s-radius, 0.25rem);border-width:1px !important;border-color:var(--color-primary) !important;background-color:transparent !important;color:var(--color-primary) !important}.s-basket-gap-card-btn salla-button .s-button-btn:hover{background-color:var(--color-primary) !important;--tw-text-opacity:1 !important;color:rgb(255 255 255 / var(--tw-text-opacity, 1)) !important}.s-basket-gap-card-btn salla-button .s-button-loader:before{border-top-color:var(--color-primary) !important;border-left-color:var(--color-primary) !important;border-bottom-color:rgb(243 244 246 / var(--tw-border-opacity, 1)) !important;--tw-border-opacity:1 !important;border-right-color:rgb(243 244 246 / var(--tw-border-opacity, 1)) !important}.s-basket-gap-skeleton{display:flex;flex-direction:column;gap:0.75rem}.s-basket-gap-skeleton-card{display:flex;align-items:center;gap:0.75rem;padding-top:0.75rem;padding-bottom:0.75rem}.s-basket-gap-skeleton-info{display:flex;flex:1 1 0%;flex-direction:column;gap:0.5rem}';export{s as salla_basket_gap}
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r as s,h as a,H as i,a as t}from"./p-C0qiFNJn.js";const l=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(i,{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,i)=>a("a",{key:i,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 t(this)}};l.style="/*!twlt*/:host{display:block}.s-apps-icons-list{display:flex;gap:1rem}.s-apps-icons-list.vertical{flex-direction:column}.s-apps-icons-item{line-height:1}.s-apps-icons-item:hover{color:var(--color-primary)}";export{l as salla_apps_icons}
4
+ import{r as s,h as a,H as t,a as i}from"./p-BsIeN-bg.js";const l=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 i(this)}};l.style="/*!twlt*/:host{display:block}.s-apps-icons-list{display:flex;gap:1rem}.s-apps-icons-list.vertical{flex-direction:column}.s-apps-icons-item{line-height:1}.s-apps-icons-item:hover{color:var(--color-primary)}";export{l as salla_apps_icons}
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r as t,h as o,H as i}from"./p-C0qiFNJn.js";import{l as a}from"./p-BChI23pG.js";const l=t=>t?new Date(Number(t)).toLocaleDateString(salla.lang.locale,{weekday:"long",year:"numeric",month:"long",day:"numeric",hour:"numeric"}):"",s=class{constructor(o){t(this,o),this.loyaltyPointsArray=[],this.balance=0,this.isLoadingLoyalty=!1,this.nextPageUrlLoyalty="",this.handleClick=()=>{this.loadMoreLoyaltyPoints()}}async componentWillLoad(){try{await salla.onReady(),await salla.lang.onLoaded(),await this.loadLoyaltyPoints()}catch(t){salla?.logger?.warn?.("salla-loyalty-points-history: init failed",t)}}async loadLoyaltyPoints(){this.isLoadingLoyalty=!0;try{let t="/balance/points?page=1",o=await salla.api.request(t);this.loyaltyPointsArray=o.data,this.balance=o.balance,this.nextPageUrlLoyalty=o.cursor.next}catch(t){console.error("Error loading loyalty points transactions",t)}finally{this.isLoadingLoyalty=!1}}async loadMoreLoyaltyPoints(){if(this.nextPageUrlLoyalty){this.isLoadingLoyalty=!0;try{let t=await salla.api.request(this.nextPageUrlLoyalty);this.loyaltyPointsArray=[...this.loyaltyPointsArray,...t.data],this.nextPageUrlLoyalty=t.cursor?.next||""}catch(t){console.error("Error loading more loyalty points",t)}finally{this.isLoadingLoyalty=!1}}}render(){return o(i,{key:"2727e153c078533fa8fa48fa4b7349d5e7115b2b"},o("div",{key:"24fa22fc520b8bb53d49a8f5ca1014fe01e60fb2"},this.isLoadingLoyalty?o("salla-loading",null):o("div",null,o("table",{class:"s-loyalty-points-history-table"},o("tbody",null,o("tr",null,o("td",null,o("div",{class:"s-loyalty-points-history-balance-container"},o("i",{class:"s-loyalty-points-history-balance-icon sicon-gift"}),o("div",null,o("div",{class:"s-loyalty-points-history-balance-value"},this.balance," ",salla.lang.get("pages.loyalty_program.point")),o("div",{class:"s-loyalty-points-history-balance-label"},salla.lang.get("pages.loyalty_program.your_points")))))))),this.loyaltyPointsArray.length>0?o("div",null,o("table",{class:"s-loyalty-points-history-table"},o("thead",{class:"s-loyalty-points-history-table-head"},o("tr",null,o("th",{scope:"col",class:"s-loyalty-points-history-table-head-tr-th"},salla.lang.get("pages.wallet.points")),o("th",{scope:"col",class:"s-loyalty-points-history-table-head-tr-th"},salla.lang.get("pages.wallet.date")),o("th",{scope:"col",class:"s-loyalty-points-history-table-head-tr-th"},salla.lang.get("pages.wallet.expiry_date")),o("th",{scope:"col",class:"s-loyalty-points-history-table-head-tr-th"},salla.lang.get("common.elements.note")),o("th",{scope:"col",class:"s-loyalty-points-history-table-head-tr-th"},salla.lang.get("common.elements.status")))),o("tbody",null,this.loyaltyPointsArray.map((t=>o("tr",{class:"s-loyalty-points-history-table-tbody-tr"},o("td",{class:"s-loyalty-points-history-table-tbody-tr-td"},o("div",{class:"s-loyalty-points-history-table-tbody-tr-td-content"},o("span",{class:"s-loyalty-points-history-mobile-title"},salla.lang.get("pages.wallet.points"),":"),o("span",null,"plus"===t?.type?"+":"",t?.amount||""," ",salla.lang.get("pages.loyalty_program.point")))),o("td",{class:"s-loyalty-points-history-table-tbody-tr-td"},o("div",{class:"s-loyalty-points-history-table-tbody-tr-td-content"},o("span",{class:"s-loyalty-points-history-mobile-title"},salla.lang.get("pages.wallet.date"),":"),o("span",null,l(t?.created_at?1e3*Number(t.created_at):void 0)))),o("td",{class:"s-loyalty-points-history-table-tbody-tr-td"},o("div",{class:"s-loyalty-points-history-table-tbody-tr-td-content"},o("span",{class:"s-loyalty-points-history-mobile-title"},salla.lang.get("pages.wallet.expiry_date"),":"),o("span",null,l(t?.expires_at?1e3*Number(t.expires_at):void 0)))),o("td",{class:"s-loyalty-points-history-table-tbody-tr-td"},o("div",{class:"s-loyalty-points-history-table-tbody-tr-td-content"},o("span",{class:"s-loyalty-points-history-mobile-title"},salla.lang.get("common.elements.note"),":"),o("span",null,(t=>{if(!t)return"";try{const o=t.toLowerCase(),i=salla.lang.get(`pages.loyalty_program.${o}`);return i===`pages.loyalty_program.${o}`?t:i}catch{return t}})(t?.key)))),o("td",{class:"s-loyalty-points-history-table-tbody-tr-td"},o("div",{class:"s-loyalty-points-history-table-tbody-tr-td-content"},o("span",{class:"s-loyalty-points-history-mobile-title"},salla.lang.get("common.elements.status"),":"),o("div",{class:{"s-loyalty-points-history-table-transaction-status":!0,"s-loyalty-points-history-table-transaction-status-pending":"pending"===t?.status_key,"s-loyalty-points-history-table-transaction-status-revoked":"revoked"===t?.status_key,"s-loyalty-points-history-table-transaction-status-used":"used"===t?.status_key,"s-loyalty-points-history-table-transaction-status-expired":"expired"===t?.status_key}},t?.status)))))))),o("div",{class:"s-loyalty-points-history-load-more"},!!this.nextPageUrlLoyalty&&o("salla-button",{onClick:this.handleClick,loading:this.isLoadingLoyalty},salla.lang.get("common.elements.load_more")))):o("div",{class:"s-loyalty-points-history-table-empty-state"},o("span",{innerHTML:a}),o("div",{class:"s-loyalty-points-history-table-placeholder-title"},salla.lang.get("pages.loyalty_program.no_loyality_points_title")),o("div",{class:"s-loyalty-points-history-table-placeholder-sub-title"},salla.lang.get("pages.loyalty_program.no_loyality_points_sub_title"))))))}};s.style='/*!twlt*/:host{display:block}.table{display:table}.s-loyalty-points-history-balance-container{display:flex;align-items:center;justify-content:flex-start;gap:1rem}.s-loyalty-points-history-balance-value{font-size:1.25rem;line-height:1.75rem;font-weight:600}.s-loyalty-points-history-balance-label{font-weight:400;--tw-text-opacity:1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.s-loyalty-points-history-balance-icon{height:52px;width:52px;border-radius:9999px;background-color:var(--color-primary-reverse);padding-top:16px;padding-bottom:16px;padding-left:13px;padding-right:13px;font-size:25px;color:var(--color-primary)}.s-loyalty-points-history-container>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(0.625rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(0.625rem * var(--tw-space-y-reverse))}@media (min-width: 768px){.s-loyalty-points-history-container>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(1.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.25rem * var(--tw-space-y-reverse))}}.s-loyalty-points-history-mobile-title{display:inline-block;width:8rem;font-weight:400;--tw-text-opacity:1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}@media (min-width: 768px){.s-loyalty-points-history-mobile-title{display:none}}.s-loyalty-points-history-reference-id{display:none}@media (min-width: 768px){.s-loyalty-points-history-reference-id{display:inline-block}}.s-loyalty-points-history-buy-as-gift-icon{margin-left:0.25rem;margin-right:0.25rem;display:inline-block;color:var(--color-primary)}.s-loyalty-points-history-copy-to-clipboard-button{display:flex;align-items:center}@media (min-width: 768px){.s-loyalty-points-history-copy-to-clipboard-button{display:none}}.s-loyalty-points-history-copy-to-clipboard-button salla-button{position:relative}.s-loyalty-points-history-copy-to-clipboard-button-icon{pointer-events:none;font-size:0.75rem;line-height:1rem}.s-loyalty-points-history-copy-to-clipboard-button-icon:where([dir="ltr"],[dir="ltr"] *){margin-left:0.25rem}.s-loyalty-points-history-copy-to-clipboard-button-icon:where([dir="rtl"],[dir="rtl"] *){margin-right:0.25rem}@media (min-width: 768px){.s-loyalty-points-history-status-container{margin-left:0px;margin-right:0px}}.s-loyalty-points-history-status-container:where([dir="ltr"],[dir="ltr"] *){margin-left:auto}.s-loyalty-points-history-status-container:where([dir="rtl"],[dir="rtl"] *){margin-right:auto}.s-loyalty-points-history-status-container i{margin-top:0.25rem}.s-loyalty-points-history-status-container i:where([dir="ltr"],[dir="ltr"] *){margin-right:0.25rem}.s-loyalty-points-history-status-container i:where([dir="rtl"],[dir="rtl"] *){margin-left:0.25rem}.s-loyalty-points-history-rated-text{--tw-text-opacity:1;color:rgb(251 191 36 / var(--tw-text-opacity, 1))}.s-loyalty-points-history-unrated-text{--tw-text-opacity:1;color:rgb(229 231 235 / var(--tw-text-opacity, 1))}.s-loyalty-points-history-no-content{display:flex;height:100%;flex-direction:column;align-items:center;justify-content:center;padding-top:2.5rem;padding-bottom:5rem;--tw-text-opacity:1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.s-loyalty-points-history-no-content .icon{margin-bottom:1rem;display:flex;height:8rem;width:8rem;align-items:center;justify-content:center;border-radius:9999px;--tw-bg-opacity:1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1));font-size:3rem;line-height:1;--tw-text-opacity:1;color:rgb(209 213 219 / var(--tw-text-opacity, 1))}.s-loyalty-points-history-no-content p{margin-bottom:1rem;font-size:1rem;line-height:1.5rem;--tw-text-opacity:1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.s-loyalty-points-history-table{min-width:100%;border-collapse:separate}@media (min-width: 768px){.s-loyalty-points-history-table{margin-bottom:-0.75rem;--tw-border-spacing-y:1.25rem;border-spacing:var(--tw-border-spacing-x) var(--tw-border-spacing-y)}}.s-loyalty-points-history-table-head{margin-bottom:1.25rem;display:none;--tw-bg-opacity:1;background-color:rgb(249 250 251 / var(--tw-bg-opacity, 1))}@media (min-width: 768px){.s-loyalty-points-history-table-head{display:table-header-group}}.s-loyalty-points-history-table-head-tr-th{padding-left:1.5rem;padding-right:1.5rem;text-align:start;font-size:0.875rem;line-height:1.25rem;font-weight:500;text-transform:uppercase;letter-spacing:0.05em}.s-loyalty-points-history-table-head-tr-th:where([dir="ltr"],[dir="ltr"] *){text-align:left}.s-loyalty-points-history-table-head-tr-th:last-child:where([dir="ltr"],[dir="ltr"] *){text-align:right}.s-loyalty-points-history-table-head-tr-th:where([dir="rtl"],[dir="rtl"] *){text-align:right}.s-loyalty-points-history-table-head-tr-th:last-child:where([dir="rtl"],[dir="rtl"] *){text-align:left}.s-loyalty-points-history-table-tbody-tr{position:relative;display:flex;flex-direction:row;flex-wrap:wrap;overflow:hidden;border-radius:var(--s-radius, 0.25rem);border-bottom-width:8px;border-top-width:8px;--tw-border-opacity:1;border-color:rgb(249 250 251 / var(--tw-border-opacity, 1));--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1));padding:0.5rem;transition-property:box-shadow;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:500ms}@media (min-width: 768px){.s-loyalty-points-history-table-tbody-tr{display:table-row;flex-direction:row;flex-wrap:nowrap;padding:0px}}.s-loyalty-points-history-table-tbody-tr-td{width:100%;white-space:nowrap;font-size:0.875rem;line-height:1.25rem}.s-loyalty-points-history-table-tbody-tr-td:first-child{font-weight:700}@media (min-width: 768px){.s-loyalty-points-history-table-tbody-tr-td{height:5rem;width:auto}.s-loyalty-points-history-table-tbody-tr-td:last-child{text-align:end}.s-loyalty-points-history-table-tbody-tr-td:first-child:where([dir="ltr"],[dir="ltr"] *){border-top-left-radius:0.375rem;border-bottom-left-radius:0.375rem}.s-loyalty-points-history-table-tbody-tr-td:first-child:where([dir="rtl"],[dir="rtl"] *){border-top-right-radius:0.375rem;border-bottom-right-radius:0.375rem}}.s-loyalty-points-history-table-tbody-tr-td:first-child{font-weight:700}.s-loyalty-points-history-table-tbody-tr-td-content{position:relative;display:flex;align-items:center;justify-content:space-between;padding-left:0.5rem;padding-right:0.5rem;padding-top:0.25rem;padding-bottom:0.25rem;font-size:0.75rem;line-height:1rem}@media (min-width: 768px){.s-loyalty-points-history-table-tbody-tr-td-content{padding-left:1.5rem;padding-right:1.5rem;padding-top:1.5rem;padding-bottom:1.5rem}}.s-loyalty-points-history-table-tbody-tr-td-content:where([dir="ltr"],[dir="ltr"] *){padding-right:0.5rem}.s-loyalty-points-history-table-tbody-tr-td-content:where([dir="rtl"],[dir="rtl"] *){padding-left:0.5rem}.s-loyalty-points-history-table-tbody-tr a{position:absolute;top:0px;bottom:0px;display:block;width:100%}.s-loyalty-points-history-table-tbody-tr a:where([dir="ltr"],[dir="ltr"] *){left:0px}.s-loyalty-points-history-table-tbody-tr a:where([dir="rtl"],[dir="rtl"] *){right:0px}.s-loyalty-points-history-table-empty-state{display:flex;flex-direction:column;align-items:center;font-size:80px}.s-loyalty-points-history-table-empty-state i{margin-bottom:2rem;margin-top:4rem;font-size:80px;color:var(--infinte-color)}.s-loyalty-points-history-table-placeholder-title{padding:0.75rem;text-align:center;font-size:1.25rem;line-height:1.75rem;font-weight:700}.s-loyalty-points-history-table-placeholder-sub-title{text-align:center;font-size:0.875rem;line-height:1.25rem;font-weight:400;--tw-text-opacity:1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.s-loyalty-points-history-load-more{margin-top:1rem;display:flex;justify-content:center}.s-loyalty-points-history-table-transaction-status{display:flex;width:max-content;align-items:center;border-radius:20px;--tw-bg-opacity:1;background-color:rgb(255 246 235 / var(--tw-bg-opacity, 1));padding-top:6px;padding-bottom:6px;padding-left:19px;padding-right:19px;--tw-text-opacity:1;color:rgb(164 111 41 / var(--tw-text-opacity, 1))}.s-loyalty-points-history-table-transaction-status-pending{--tw-bg-opacity:1;background-color:rgb(255 246 235 / var(--tw-bg-opacity, 1));--tw-text-opacity:1;color:rgb(164 111 41 / var(--tw-text-opacity, 1))}.s-loyalty-points-history-table-transaction-status-used{--tw-bg-opacity:1;background-color:rgb(239 251 246 / var(--tw-bg-opacity, 1));--tw-text-opacity:1;color:rgb(0 175 108 / var(--tw-text-opacity, 1))}.s-loyalty-points-history-table-transaction-status-revoked{--tw-bg-opacity:1;background-color:rgb(254 236 236 / var(--tw-bg-opacity, 1));--tw-text-opacity:1;color:rgb(245 81 87 / var(--tw-text-opacity, 1))}.s-loyalty-points-history-table-transaction-status-expired{--tw-bg-opacity:1;background-color:rgb(245 245 245 / var(--tw-bg-opacity, 1));--tw-text-opacity:1;color:rgb(158 158 158 / var(--tw-text-opacity, 1))}';export{s as salla_loyalty_points_history}
4
+ import{r as t,h as o,H as i}from"./p-BsIeN-bg.js";import{l as a}from"./p-BChI23pG.js";const l=t=>t?new Date(Number(t)).toLocaleDateString(salla.lang.locale,{weekday:"long",year:"numeric",month:"long",day:"numeric",hour:"numeric"}):"",s=class{constructor(o){t(this,o),this.loyaltyPointsArray=[],this.balance=0,this.isLoadingLoyalty=!1,this.nextPageUrlLoyalty="",this.handleClick=()=>{this.loadMoreLoyaltyPoints()}}async componentWillLoad(){try{await salla.onReady(),await salla.lang.onLoaded(),await this.loadLoyaltyPoints()}catch(t){salla?.logger?.warn?.("salla-loyalty-points-history: init failed",t)}}async loadLoyaltyPoints(){this.isLoadingLoyalty=!0;try{let t="/balance/points?page=1",o=await salla.api.request(t);this.loyaltyPointsArray=o.data,this.balance=o.balance,this.nextPageUrlLoyalty=o.cursor.next}catch(t){console.error("Error loading loyalty points transactions",t)}finally{this.isLoadingLoyalty=!1}}async loadMoreLoyaltyPoints(){if(this.nextPageUrlLoyalty){this.isLoadingLoyalty=!0;try{let t=await salla.api.request(this.nextPageUrlLoyalty);this.loyaltyPointsArray=[...this.loyaltyPointsArray,...t.data],this.nextPageUrlLoyalty=t.cursor?.next||""}catch(t){console.error("Error loading more loyalty points",t)}finally{this.isLoadingLoyalty=!1}}}render(){return o(i,{key:"2727e153c078533fa8fa48fa4b7349d5e7115b2b"},o("div",{key:"24fa22fc520b8bb53d49a8f5ca1014fe01e60fb2"},this.isLoadingLoyalty?o("salla-loading",null):o("div",null,o("table",{class:"s-loyalty-points-history-table"},o("tbody",null,o("tr",null,o("td",null,o("div",{class:"s-loyalty-points-history-balance-container"},o("i",{class:"s-loyalty-points-history-balance-icon sicon-gift"}),o("div",null,o("div",{class:"s-loyalty-points-history-balance-value"},this.balance," ",salla.lang.get("pages.loyalty_program.point")),o("div",{class:"s-loyalty-points-history-balance-label"},salla.lang.get("pages.loyalty_program.your_points")))))))),this.loyaltyPointsArray.length>0?o("div",null,o("table",{class:"s-loyalty-points-history-table"},o("thead",{class:"s-loyalty-points-history-table-head"},o("tr",null,o("th",{scope:"col",class:"s-loyalty-points-history-table-head-tr-th"},salla.lang.get("pages.wallet.points")),o("th",{scope:"col",class:"s-loyalty-points-history-table-head-tr-th"},salla.lang.get("pages.wallet.date")),o("th",{scope:"col",class:"s-loyalty-points-history-table-head-tr-th"},salla.lang.get("pages.wallet.expiry_date")),o("th",{scope:"col",class:"s-loyalty-points-history-table-head-tr-th"},salla.lang.get("common.elements.note")),o("th",{scope:"col",class:"s-loyalty-points-history-table-head-tr-th"},salla.lang.get("common.elements.status")))),o("tbody",null,this.loyaltyPointsArray.map((t=>o("tr",{class:"s-loyalty-points-history-table-tbody-tr"},o("td",{class:"s-loyalty-points-history-table-tbody-tr-td"},o("div",{class:"s-loyalty-points-history-table-tbody-tr-td-content"},o("span",{class:"s-loyalty-points-history-mobile-title"},salla.lang.get("pages.wallet.points"),":"),o("span",null,"plus"===t?.type?"+":"",t?.amount||""," ",salla.lang.get("pages.loyalty_program.point")))),o("td",{class:"s-loyalty-points-history-table-tbody-tr-td"},o("div",{class:"s-loyalty-points-history-table-tbody-tr-td-content"},o("span",{class:"s-loyalty-points-history-mobile-title"},salla.lang.get("pages.wallet.date"),":"),o("span",null,l(t?.created_at?1e3*Number(t.created_at):void 0)))),o("td",{class:"s-loyalty-points-history-table-tbody-tr-td"},o("div",{class:"s-loyalty-points-history-table-tbody-tr-td-content"},o("span",{class:"s-loyalty-points-history-mobile-title"},salla.lang.get("pages.wallet.expiry_date"),":"),o("span",null,l(t?.expires_at?1e3*Number(t.expires_at):void 0)))),o("td",{class:"s-loyalty-points-history-table-tbody-tr-td"},o("div",{class:"s-loyalty-points-history-table-tbody-tr-td-content"},o("span",{class:"s-loyalty-points-history-mobile-title"},salla.lang.get("common.elements.note"),":"),o("span",null,(t=>{if(!t)return"";try{const o=t.toLowerCase(),i=salla.lang.get(`pages.loyalty_program.${o}`);return i===`pages.loyalty_program.${o}`?t:i}catch{return t}})(t?.key)))),o("td",{class:"s-loyalty-points-history-table-tbody-tr-td"},o("div",{class:"s-loyalty-points-history-table-tbody-tr-td-content"},o("span",{class:"s-loyalty-points-history-mobile-title"},salla.lang.get("common.elements.status"),":"),o("div",{class:{"s-loyalty-points-history-table-transaction-status":!0,"s-loyalty-points-history-table-transaction-status-pending":"pending"===t?.status_key,"s-loyalty-points-history-table-transaction-status-revoked":"revoked"===t?.status_key,"s-loyalty-points-history-table-transaction-status-used":"used"===t?.status_key,"s-loyalty-points-history-table-transaction-status-expired":"expired"===t?.status_key}},t?.status)))))))),o("div",{class:"s-loyalty-points-history-load-more"},!!this.nextPageUrlLoyalty&&o("salla-button",{onClick:this.handleClick,loading:this.isLoadingLoyalty},salla.lang.get("common.elements.load_more")))):o("div",{class:"s-loyalty-points-history-table-empty-state"},o("span",{innerHTML:a}),o("div",{class:"s-loyalty-points-history-table-placeholder-title"},salla.lang.get("pages.loyalty_program.no_loyality_points_title")),o("div",{class:"s-loyalty-points-history-table-placeholder-sub-title"},salla.lang.get("pages.loyalty_program.no_loyality_points_sub_title"))))))}};s.style='/*!twlt*/:host{display:block}.table{display:table}.s-loyalty-points-history-balance-container{display:flex;align-items:center;justify-content:flex-start;gap:1rem}.s-loyalty-points-history-balance-value{font-size:1.25rem;line-height:1.75rem;font-weight:600}.s-loyalty-points-history-balance-label{font-weight:400;--tw-text-opacity:1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.s-loyalty-points-history-balance-icon{height:52px;width:52px;border-radius:9999px;background-color:var(--color-primary-reverse);padding-top:16px;padding-bottom:16px;padding-left:13px;padding-right:13px;font-size:25px;color:var(--color-primary)}.s-loyalty-points-history-container>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(0.625rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(0.625rem * var(--tw-space-y-reverse))}@media (min-width: 768px){.s-loyalty-points-history-container>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(1.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.25rem * var(--tw-space-y-reverse))}}.s-loyalty-points-history-mobile-title{display:inline-block;width:8rem;font-weight:400;--tw-text-opacity:1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}@media (min-width: 768px){.s-loyalty-points-history-mobile-title{display:none}}.s-loyalty-points-history-reference-id{display:none}@media (min-width: 768px){.s-loyalty-points-history-reference-id{display:inline-block}}.s-loyalty-points-history-buy-as-gift-icon{margin-left:0.25rem;margin-right:0.25rem;display:inline-block;color:var(--color-primary)}.s-loyalty-points-history-copy-to-clipboard-button{display:flex;align-items:center}@media (min-width: 768px){.s-loyalty-points-history-copy-to-clipboard-button{display:none}}.s-loyalty-points-history-copy-to-clipboard-button salla-button{position:relative}.s-loyalty-points-history-copy-to-clipboard-button-icon{pointer-events:none;font-size:0.75rem;line-height:1rem}.s-loyalty-points-history-copy-to-clipboard-button-icon:where([dir="ltr"],[dir="ltr"] *){margin-left:0.25rem}.s-loyalty-points-history-copy-to-clipboard-button-icon:where([dir="rtl"],[dir="rtl"] *){margin-right:0.25rem}@media (min-width: 768px){.s-loyalty-points-history-status-container{margin-left:0px;margin-right:0px}}.s-loyalty-points-history-status-container:where([dir="ltr"],[dir="ltr"] *){margin-left:auto}.s-loyalty-points-history-status-container:where([dir="rtl"],[dir="rtl"] *){margin-right:auto}.s-loyalty-points-history-status-container i{margin-top:0.25rem}.s-loyalty-points-history-status-container i:where([dir="ltr"],[dir="ltr"] *){margin-right:0.25rem}.s-loyalty-points-history-status-container i:where([dir="rtl"],[dir="rtl"] *){margin-left:0.25rem}.s-loyalty-points-history-rated-text{--tw-text-opacity:1;color:rgb(251 191 36 / var(--tw-text-opacity, 1))}.s-loyalty-points-history-unrated-text{--tw-text-opacity:1;color:rgb(229 231 235 / var(--tw-text-opacity, 1))}.s-loyalty-points-history-no-content{display:flex;height:100%;flex-direction:column;align-items:center;justify-content:center;padding-top:2.5rem;padding-bottom:5rem;--tw-text-opacity:1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.s-loyalty-points-history-no-content .icon{margin-bottom:1rem;display:flex;height:8rem;width:8rem;align-items:center;justify-content:center;border-radius:9999px;--tw-bg-opacity:1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1));font-size:3rem;line-height:1;--tw-text-opacity:1;color:rgb(209 213 219 / var(--tw-text-opacity, 1))}.s-loyalty-points-history-no-content p{margin-bottom:1rem;font-size:1rem;line-height:1.5rem;--tw-text-opacity:1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.s-loyalty-points-history-table{min-width:100%;border-collapse:separate}@media (min-width: 768px){.s-loyalty-points-history-table{margin-bottom:-0.75rem;--tw-border-spacing-y:1.25rem;border-spacing:var(--tw-border-spacing-x) var(--tw-border-spacing-y)}}.s-loyalty-points-history-table-head{margin-bottom:1.25rem;display:none;--tw-bg-opacity:1;background-color:rgb(249 250 251 / var(--tw-bg-opacity, 1))}@media (min-width: 768px){.s-loyalty-points-history-table-head{display:table-header-group}}.s-loyalty-points-history-table-head-tr-th{padding-left:1.5rem;padding-right:1.5rem;text-align:start;font-size:0.875rem;line-height:1.25rem;font-weight:500;text-transform:uppercase;letter-spacing:0.05em}.s-loyalty-points-history-table-head-tr-th:where([dir="ltr"],[dir="ltr"] *){text-align:left}.s-loyalty-points-history-table-head-tr-th:last-child:where([dir="ltr"],[dir="ltr"] *){text-align:right}.s-loyalty-points-history-table-head-tr-th:where([dir="rtl"],[dir="rtl"] *){text-align:right}.s-loyalty-points-history-table-head-tr-th:last-child:where([dir="rtl"],[dir="rtl"] *){text-align:left}.s-loyalty-points-history-table-tbody-tr{position:relative;display:flex;flex-direction:row;flex-wrap:wrap;overflow:hidden;border-radius:var(--s-radius, 0.25rem);border-bottom-width:8px;border-top-width:8px;--tw-border-opacity:1;border-color:rgb(249 250 251 / var(--tw-border-opacity, 1));--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1));padding:0.5rem;transition-property:box-shadow;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:500ms}@media (min-width: 768px){.s-loyalty-points-history-table-tbody-tr{display:table-row;flex-direction:row;flex-wrap:nowrap;padding:0px}}.s-loyalty-points-history-table-tbody-tr-td{width:100%;white-space:nowrap;font-size:0.875rem;line-height:1.25rem}.s-loyalty-points-history-table-tbody-tr-td:first-child{font-weight:700}@media (min-width: 768px){.s-loyalty-points-history-table-tbody-tr-td{height:5rem;width:auto}.s-loyalty-points-history-table-tbody-tr-td:last-child{text-align:end}.s-loyalty-points-history-table-tbody-tr-td:first-child:where([dir="ltr"],[dir="ltr"] *){border-top-left-radius:0.375rem;border-bottom-left-radius:0.375rem}.s-loyalty-points-history-table-tbody-tr-td:first-child:where([dir="rtl"],[dir="rtl"] *){border-top-right-radius:0.375rem;border-bottom-right-radius:0.375rem}}.s-loyalty-points-history-table-tbody-tr-td:first-child{font-weight:700}.s-loyalty-points-history-table-tbody-tr-td-content{position:relative;display:flex;align-items:center;justify-content:space-between;padding-left:0.5rem;padding-right:0.5rem;padding-top:0.25rem;padding-bottom:0.25rem;font-size:0.75rem;line-height:1rem}@media (min-width: 768px){.s-loyalty-points-history-table-tbody-tr-td-content{padding-left:1.5rem;padding-right:1.5rem;padding-top:1.5rem;padding-bottom:1.5rem}}.s-loyalty-points-history-table-tbody-tr-td-content:where([dir="ltr"],[dir="ltr"] *){padding-right:0.5rem}.s-loyalty-points-history-table-tbody-tr-td-content:where([dir="rtl"],[dir="rtl"] *){padding-left:0.5rem}.s-loyalty-points-history-table-tbody-tr a{position:absolute;top:0px;bottom:0px;display:block;width:100%}.s-loyalty-points-history-table-tbody-tr a:where([dir="ltr"],[dir="ltr"] *){left:0px}.s-loyalty-points-history-table-tbody-tr a:where([dir="rtl"],[dir="rtl"] *){right:0px}.s-loyalty-points-history-table-empty-state{display:flex;flex-direction:column;align-items:center;font-size:80px}.s-loyalty-points-history-table-empty-state i{margin-bottom:2rem;margin-top:4rem;font-size:80px;color:var(--infinte-color)}.s-loyalty-points-history-table-placeholder-title{padding:0.75rem;text-align:center;font-size:1.25rem;line-height:1.75rem;font-weight:700}.s-loyalty-points-history-table-placeholder-sub-title{text-align:center;font-size:0.875rem;line-height:1.25rem;font-weight:400;--tw-text-opacity:1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.s-loyalty-points-history-load-more{margin-top:1rem;display:flex;justify-content:center}.s-loyalty-points-history-table-transaction-status{display:flex;width:max-content;align-items:center;border-radius:20px;--tw-bg-opacity:1;background-color:rgb(255 246 235 / var(--tw-bg-opacity, 1));padding-top:6px;padding-bottom:6px;padding-left:19px;padding-right:19px;--tw-text-opacity:1;color:rgb(164 111 41 / var(--tw-text-opacity, 1))}.s-loyalty-points-history-table-transaction-status-pending{--tw-bg-opacity:1;background-color:rgb(255 246 235 / var(--tw-bg-opacity, 1));--tw-text-opacity:1;color:rgb(164 111 41 / var(--tw-text-opacity, 1))}.s-loyalty-points-history-table-transaction-status-used{--tw-bg-opacity:1;background-color:rgb(239 251 246 / var(--tw-bg-opacity, 1));--tw-text-opacity:1;color:rgb(0 175 108 / var(--tw-text-opacity, 1))}.s-loyalty-points-history-table-transaction-status-revoked{--tw-bg-opacity:1;background-color:rgb(254 236 236 / var(--tw-bg-opacity, 1));--tw-text-opacity:1;color:rgb(245 81 87 / var(--tw-text-opacity, 1))}.s-loyalty-points-history-table-transaction-status-expired{--tw-bg-opacity:1;background-color:rgb(245 245 245 / var(--tw-bg-opacity, 1));--tw-text-opacity:1;color:rgb(158 158 158 / var(--tw-text-opacity, 1))}';export{s as salla_loyalty_points_history}
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r as e,h as r}from"./p-C0qiFNJn.js";function t(e){var r,a,s="";if("string"==typeof e||"number"==typeof e)s+=e;else if("object"==typeof e)if(Array.isArray(e))for(r=0;r<e.length;r++)e[r]&&(a=t(e[r]))&&(s&&(s+=" "),s+=a);else for(r in e)e[r]&&(s&&(s+=" "),s+=r);return s}const a=e=>"boolean"==typeof e?"".concat(e):0===e?"0":e,s=function(){for(var e,r,a=0,s="";a<arguments.length;)(e=arguments[a++])&&(r=t(e))&&(s&&(s+=" "),s+=r);return s},i=(o="s-badge-base",l={variants:{size:{xs:"s-badge-xs",sm:"s-badge-sm",md:"s-badge-md"},bg:{transparent:"s-badge-transparent",light:"s-badge-light","primary-100":"s-badge-primary-100"},color:{black:"s-badge-black","primary-900":"s-badge-color-primary-900"}}},e=>{var r;if(null==(null==l?void 0:l.variants))return s(o,null==e?void 0:e.class,null==e?void 0:e.className);const{variants:t,defaultVariants:i}=l,n=Object.keys(t).map((r=>{const s=null==e?void 0:e[r],o=null==i?void 0:i[r];if(null===s)return null;const l=a(s)||a(o);return t[r][l]})),d=e&&Object.entries(e).reduce(((e,r)=>{let[t,a]=r;return void 0===a||(e[t]=a),e}),{}),c=null==l||null===(r=l.compoundVariants)||void 0===r?void 0:r.reduce(((e,r)=>{let{class:t,className:a,...s}=r;return Object.entries(s).every((e=>{let[r,t]=e;return Array.isArray(t)?t.includes({...i,...d}[r]):{...i,...d}[r]===t}))?[...e,t,a]:e}),[]);return s(o,n,c,null==e?void 0:e.class,null==e?void 0:e.className)});var o,l;const n=class{constructor(r){e(this,r),this.size="sm",this.color="black",this.bg="light"}render(){return r("div",{key:"54d35eb76a59251edb581786e5e89a83b6f8fbf0",class:i({size:this.size,bg:this.bg,color:this.color})},r("slot",{key:"4641cb434a2c0a6d7c004e3384848a200cb79dff"}))}};n.style='/*!twlt*/.s-badge-base{display:flex;max-width:max-content;align-items:center}.s-badge-base>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-right:calc(0.5rem * var(--tw-space-x-reverse));margin-left:calc(0.5rem * calc(1 - var(--tw-space-x-reverse)))}.s-badge-base{white-space:nowrap;border-radius:0.375rem;padding-left:0.5rem;padding-right:0.5rem;padding-top:0.25rem;padding-bottom:0.25rem;font-weight:500;--tw-text-opacity:1;color:rgb(31 41 55 / var(--tw-text-opacity, 1))}.s-badge-base:where([dir="rtl"],[dir="rtl"] *)>:not([hidden])~:not([hidden]){--tw-space-x-reverse:1}.s-badge-xs{font-size:0.75rem;line-height:1rem}.s-badge-xs svg{height:0.75rem;width:0.75rem}.s-badge-sm{font-size:0.875rem;line-height:1.25rem}.s-badge-sm svg{height:1rem;width:1rem}.s-badge-md{font-size:1rem;line-height:1.5rem}.s-badge-md svg{height:1.25rem;width:1.25rem}.s-badge-transparent{background-color:transparent}.s-badge-light{--tw-bg-opacity:1;background-color:rgb(249 250 251 / var(--tw-bg-opacity, 1))}.s-badge-primary-100{background-color:color-mix(in srgb,var(--color-primary) 20%,white 80%)}.s-badge-color-black{--tw-text-opacity:1;color:rgb(0 0 0 / var(--tw-text-opacity, 1))}.s-badge-color-primary-900{color:color-mix(in srgb,var(--color-primary) 45%,black 55%)}.s-badge-color-primary-900 svg{fill:currentColor}.s-badge-black{--tw-text-opacity:1;color:rgb(0 0 0 / var(--tw-text-opacity, 1))}';export{n as salla_badge}
4
+ import{r as e,h as r}from"./p-BsIeN-bg.js";function t(e){var r,a,s="";if("string"==typeof e||"number"==typeof e)s+=e;else if("object"==typeof e)if(Array.isArray(e))for(r=0;r<e.length;r++)e[r]&&(a=t(e[r]))&&(s&&(s+=" "),s+=a);else for(r in e)e[r]&&(s&&(s+=" "),s+=r);return s}const a=e=>"boolean"==typeof e?"".concat(e):0===e?"0":e,s=function(){for(var e,r,a=0,s="";a<arguments.length;)(e=arguments[a++])&&(r=t(e))&&(s&&(s+=" "),s+=r);return s},i=(o="s-badge-base",l={variants:{size:{xs:"s-badge-xs",sm:"s-badge-sm",md:"s-badge-md"},bg:{transparent:"s-badge-transparent",light:"s-badge-light","primary-100":"s-badge-primary-100"},color:{black:"s-badge-black","primary-900":"s-badge-color-primary-900"}}},e=>{var r;if(null==(null==l?void 0:l.variants))return s(o,null==e?void 0:e.class,null==e?void 0:e.className);const{variants:t,defaultVariants:i}=l,n=Object.keys(t).map((r=>{const s=null==e?void 0:e[r],o=null==i?void 0:i[r];if(null===s)return null;const l=a(s)||a(o);return t[r][l]})),d=e&&Object.entries(e).reduce(((e,r)=>{let[t,a]=r;return void 0===a||(e[t]=a),e}),{}),c=null==l||null===(r=l.compoundVariants)||void 0===r?void 0:r.reduce(((e,r)=>{let{class:t,className:a,...s}=r;return Object.entries(s).every((e=>{let[r,t]=e;return Array.isArray(t)?t.includes({...i,...d}[r]):{...i,...d}[r]===t}))?[...e,t,a]:e}),[]);return s(o,n,c,null==e?void 0:e.class,null==e?void 0:e.className)});var o,l;const n=class{constructor(r){e(this,r),this.size="sm",this.color="black",this.bg="light"}render(){return r("div",{key:"54d35eb76a59251edb581786e5e89a83b6f8fbf0",class:i({size:this.size,bg:this.bg,color:this.color})},r("slot",{key:"4641cb434a2c0a6d7c004e3384848a200cb79dff"}))}};n.style='/*!twlt*/.s-badge-base{display:flex;max-width:max-content;align-items:center}.s-badge-base>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-right:calc(0.5rem * var(--tw-space-x-reverse));margin-left:calc(0.5rem * calc(1 - var(--tw-space-x-reverse)))}.s-badge-base{white-space:nowrap;border-radius:0.375rem;padding-left:0.5rem;padding-right:0.5rem;padding-top:0.25rem;padding-bottom:0.25rem;font-weight:500;--tw-text-opacity:1;color:rgb(31 41 55 / var(--tw-text-opacity, 1))}.s-badge-base:where([dir="rtl"],[dir="rtl"] *)>:not([hidden])~:not([hidden]){--tw-space-x-reverse:1}.s-badge-xs{font-size:0.75rem;line-height:1rem}.s-badge-xs svg{height:0.75rem;width:0.75rem}.s-badge-sm{font-size:0.875rem;line-height:1.25rem}.s-badge-sm svg{height:1rem;width:1rem}.s-badge-md{font-size:1rem;line-height:1.5rem}.s-badge-md svg{height:1.25rem;width:1.25rem}.s-badge-transparent{background-color:transparent}.s-badge-light{--tw-bg-opacity:1;background-color:rgb(249 250 251 / var(--tw-bg-opacity, 1))}.s-badge-primary-100{background-color:color-mix(in srgb,var(--color-primary) 20%,white 80%)}.s-badge-color-black{--tw-text-opacity:1;color:rgb(0 0 0 / var(--tw-text-opacity, 1))}.s-badge-color-primary-900{color:color-mix(in srgb,var(--color-primary) 45%,black 55%)}.s-badge-color-primary-900 svg{fill:currentColor}.s-badge-black{--tw-text-opacity:1;color:rgb(0 0 0 / var(--tw-text-opacity, 1))}';export{n as salla_badge}
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r as t,h as s,H as a}from"./p-C0qiFNJn.js";const l=class{constructor(s){t(this,s),this.order=null,this.loading=!0}async componentWillLoad(){await salla.onReady(),await this.loadOrder()}async onOrderIdChange(){this.loading=!0,this.order=null,await this.loadOrder()}get paymentUrl(){return this.order?.customer_editing?.payment_url}async loadOrder(){const t=this.orderId||salla.config.get("page.id");if(t)try{const s=await salla.order.api.getDetails(t);this.order=s?.data??s??null}catch(t){salla.logger?.warn?.("[salla-edit-order-button] failed to fetch order details",t),this.order=null}finally{this.loading=!1}else this.loading=!1}renderEditButton(){return s("salla-count-down",{prefixText:salla.lang.getWithDefault("pages.orders.edit_within","يمكنك التعديل خلال"),buttonHref:this.order?.edit_url,buttonText:salla.lang.getWithDefault("pages.orders.edit_order","تعديل الطلب"),buttonIcon:"sicon-edit",date:this.order?.editable_until,horizontal:!0,autoSegments:!0,withButton:!0,labeled:!1,size:"sm",color:"primary"})}render(){return this.loading||!this.order?null:this.order?.is_editable?s(a,null,this.renderEditButton()):this.paymentUrl?s(a,null,s("salla-button",{href:this.paymentUrl,color:"primary",size:"small"},s("i",{class:"sicon-wallet"}),salla.lang.getWithDefault("pages.orders.pay_difference","دفع فارق المبلغ"))):null}static get watchers(){return{orderId:["onOrderIdChange"]}}};l.style="/*!twlt*/:host{display:block}";export{l as salla_edit_order_button}
4
+ import{r as t,h as s,H as a}from"./p-BsIeN-bg.js";const l=class{constructor(s){t(this,s),this.order=null,this.loading=!0}async componentWillLoad(){await salla.onReady(),await this.loadOrder()}async onOrderIdChange(){this.loading=!0,this.order=null,await this.loadOrder()}get paymentUrl(){return this.order?.customer_editing?.payment_url}async loadOrder(){const t=this.orderId||salla.config.get("page.id");if(t)try{const s=await salla.order.api.getDetails(t);this.order=s?.data??s??null}catch(t){salla.logger?.warn?.("[salla-edit-order-button] failed to fetch order details",t),this.order=null}finally{this.loading=!1}else this.loading=!1}renderEditButton(){return s("salla-count-down",{prefixText:salla.lang.getWithDefault("pages.orders.edit_within","يمكنك التعديل خلال"),buttonHref:this.order?.edit_url,buttonText:salla.lang.getWithDefault("pages.orders.edit_order","تعديل الطلب"),buttonIcon:"sicon-edit",date:this.order?.editable_until,horizontal:!0,autoSegments:!0,withButton:!0,labeled:!1,size:"sm",color:"primary"})}render(){return this.loading||!this.order?null:this.order?.is_editable?s(a,null,this.renderEditButton()):this.paymentUrl?s(a,null,s("salla-button",{href:this.paymentUrl,color:"primary",size:"small"},s("i",{class:"sicon-wallet"}),salla.lang.getWithDefault("pages.orders.pay_difference","دفع فارق المبلغ"))):null}static get watchers(){return{orderId:["onOrderIdChange"]}}};l.style="/*!twlt*/:host{display:block}";export{l as salla_edit_order_button}