@salla.sa/twilight-components 2.14.365 → 2.14.366

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 (253) hide show
  1. package/dist/cjs/{filepond-5FseaYGO.js → filepond-iKAI8_Ua.js} +1 -1
  2. package/dist/cjs/{filepond-plugin-file-poster-B6jRMST8.js → filepond-plugin-file-poster-DBOuyuqE.js} +1 -1
  3. package/dist/cjs/{filepond-plugin-file-validate-size-B5KYrf7Q.js → filepond-plugin-file-validate-size-3OjivJWc.js} +1 -1
  4. package/dist/cjs/{filepond-plugin-file-validate-type-D6zZbyEw.js → filepond-plugin-file-validate-type-C4wPNa1h.js} +1 -1
  5. package/dist/cjs/{filepond-plugin-image-edit-D9sIYJpS.js → filepond-plugin-image-edit-D06RnDWS.js} +1 -1
  6. package/dist/cjs/{filepond-plugin-image-exif-orientation-DCPv8T5a.js → filepond-plugin-image-exif-orientation-CbwYrnuw.js} +1 -1
  7. package/dist/cjs/{filepond-plugin-image-preview-B6ya_UMz.js → filepond-plugin-image-preview-mOmpKkFJ.js} +1 -1
  8. package/dist/cjs/{index-DaB0o62I.js → index-DL9nqubd.js} +6 -6
  9. package/dist/cjs/{index-DsLCYojB.js → index-TmWujwmX.js} +1 -1
  10. package/dist/cjs/loader.cjs.js +2 -2
  11. package/dist/cjs/salla-accordion-body_3.cjs.entry.js +1 -1
  12. package/dist/cjs/salla-accordion_6.cjs.entry.js +1 -1
  13. package/dist/cjs/salla-add-product-button_4.cjs.entry.js +1 -1
  14. package/dist/cjs/salla-advertisement.cjs.entry.js +1 -1
  15. package/dist/cjs/salla-alert_2.cjs.entry.js +1 -1
  16. package/dist/cjs/salla-app-install-alert.cjs.entry.js +1 -1
  17. package/dist/cjs/salla-apps-icons.cjs.entry.js +1 -1
  18. package/dist/cjs/salla-booking-field_7.cjs.entry.js +10 -10
  19. package/dist/cjs/salla-cart-item-offers_2.cjs.entry.js +1 -1
  20. package/dist/cjs/salla-comment-form_8.cjs.entry.js +1 -1
  21. package/dist/cjs/salla-conditional-offer.cjs.entry.js +1 -1
  22. package/dist/cjs/salla-contacts.cjs.entry.js +1 -1
  23. package/dist/cjs/salla-cookies-bar.cjs.entry.js +1 -1
  24. package/dist/cjs/salla-count-down_2.cjs.entry.js +11 -8
  25. package/dist/cjs/salla-custom-fields.cjs.entry.js +1 -1
  26. package/dist/cjs/salla-filters-widget.cjs.entry.js +1 -1
  27. package/dist/cjs/salla-filters.cjs.entry.js +1 -1
  28. package/dist/cjs/salla-gifting.cjs.entry.js +1 -1
  29. package/dist/cjs/salla-hook.cjs.entry.js +1 -1
  30. package/dist/cjs/salla-infinite-scroll.cjs.entry.js +1 -1
  31. package/dist/cjs/salla-installment.cjs.entry.js +1 -1
  32. package/dist/cjs/salla-list-tile.cjs.entry.js +1 -1
  33. package/dist/cjs/salla-localization-modal.cjs.entry.js +1 -1
  34. package/dist/cjs/salla-login-modal.cjs.entry.js +1 -1
  35. package/dist/cjs/salla-loyalty-prize-item.cjs.entry.js +1 -1
  36. package/dist/cjs/salla-loyalty-program.cjs.entry.js +1 -1
  37. package/dist/cjs/salla-loyalty.cjs.entry.js +1 -1
  38. package/dist/cjs/salla-maintenance-alert.cjs.entry.js +1 -1
  39. package/dist/cjs/salla-menu.cjs.entry.js +1 -1
  40. package/dist/cjs/salla-metadata.cjs.entry.js +1 -1
  41. package/dist/cjs/salla-multiple-bundle-product-cart_2.cjs.entry.js +1 -1
  42. package/dist/cjs/salla-multiple-bundle-product-options-modal_2.cjs.entry.js +1 -1
  43. package/dist/cjs/salla-multiple-bundle-product.cjs.entry.js +1 -1
  44. package/dist/cjs/salla-notification-item.cjs.entry.js +1 -1
  45. package/dist/cjs/salla-notifications.cjs.entry.js +1 -1
  46. package/dist/cjs/salla-offer-modal.cjs.entry.js +1 -1
  47. package/dist/cjs/salla-offer.cjs.entry.js +248 -177
  48. package/dist/cjs/salla-order-details-multiple-bundle-product.cjs.entry.js +1 -1
  49. package/dist/cjs/salla-order-details-options.cjs.entry.js +1 -1
  50. package/dist/cjs/salla-order-details.cjs.entry.js +1 -1
  51. package/dist/cjs/salla-order-summary.cjs.entry.js +1 -1
  52. package/dist/cjs/salla-order-totals-card.cjs.entry.js +1 -1
  53. package/dist/cjs/salla-orders.cjs.entry.js +1 -1
  54. package/dist/cjs/salla-payments.cjs.entry.js +1 -1
  55. package/dist/cjs/salla-placeholder.cjs.entry.js +1 -1
  56. package/dist/cjs/salla-price-range.cjs.entry.js +1 -1
  57. package/dist/cjs/salla-product-size-guide.cjs.entry.js +1 -1
  58. package/dist/cjs/salla-products-list.cjs.entry.js +9 -3
  59. package/dist/cjs/salla-products-slider.cjs.entry.js +1 -1
  60. package/dist/cjs/salla-progress-bar.cjs.entry.js +1 -1
  61. package/dist/cjs/salla-quick-order.cjs.entry.js +1 -1
  62. package/dist/cjs/salla-rating-modal.cjs.entry.js +1 -1
  63. package/dist/cjs/salla-scopes.cjs.entry.js +1 -1
  64. package/dist/cjs/salla-search.cjs.entry.js +1 -1
  65. package/dist/cjs/salla-skeleton.cjs.entry.js +1 -1
  66. package/dist/cjs/salla-slider.cjs.entry.js +1 -1
  67. package/dist/cjs/salla-social-share.cjs.entry.js +1 -1
  68. package/dist/cjs/salla-social.cjs.entry.js +1 -1
  69. package/dist/cjs/salla-tab-content_3.cjs.entry.js +1 -1
  70. package/dist/cjs/salla-tiered-offer.cjs.entry.js +1 -1
  71. package/dist/cjs/salla-tooltip.cjs.entry.js +1 -1
  72. package/dist/cjs/salla-trust-badges.cjs.entry.js +1 -1
  73. package/dist/cjs/salla-user-menu.cjs.entry.js +1 -1
  74. package/dist/cjs/salla-user-profile.cjs.entry.js +1 -1
  75. package/dist/cjs/salla-user-settings.cjs.entry.js +1 -1
  76. package/dist/cjs/salla-verify.cjs.entry.js +1 -1
  77. package/dist/cjs/salla-wallet.cjs.entry.js +1 -1
  78. package/dist/cjs/twilight.cjs.js +2 -2
  79. package/dist/cjs/{vanilla-picker-DE9NaT9j.js → vanilla-picker-DPu_Z0gW.js} +1 -1
  80. package/dist/collection/components/salla-offer/interfaces.js +2 -0
  81. package/dist/collection/components/salla-offer/salla-offer.css +2 -25
  82. package/dist/collection/components/salla-offer/salla-offer.js +256 -181
  83. package/dist/collection/components/salla-product-card/salla-product-card.js +29 -7
  84. package/dist/collection/components/salla-products-list/salla-products-list.js +27 -2
  85. package/dist/components/index.js +2 -2
  86. package/dist/components/salla-offer.js +273 -220
  87. package/dist/components/salla-product-card2.js +11 -7
  88. package/dist/components/salla-products-list2.js +9 -2
  89. package/dist/esm/{filepond-BGPYjCAA.js → filepond-OIAu6i0O.js} +1 -1
  90. package/dist/esm/{filepond-plugin-file-poster-sd-w_Hri.js → filepond-plugin-file-poster-BMvjO1cc.js} +1 -1
  91. package/dist/esm/{filepond-plugin-file-validate-size-CQkfT5sz.js → filepond-plugin-file-validate-size-CMCs88HU.js} +1 -1
  92. package/dist/esm/{filepond-plugin-file-validate-type-Cu8nOdXD.js → filepond-plugin-file-validate-type-Bjpeuqen.js} +1 -1
  93. package/dist/esm/{filepond-plugin-image-edit-CWpBhgby.js → filepond-plugin-image-edit-Fpoh6xBj.js} +1 -1
  94. package/dist/esm/{filepond-plugin-image-exif-orientation-DbSLLg4E.js → filepond-plugin-image-exif-orientation-CPChwYPW.js} +1 -1
  95. package/dist/esm/{filepond-plugin-image-preview-DXgOkLlG.js → filepond-plugin-image-preview-pLwEytag.js} +1 -1
  96. package/dist/esm/{index-DcD0Zbyk.js → index-CV1rqKQz.js} +6 -6
  97. package/dist/esm/{index-BNB-g4_5.js → index-Cs4XvAmW.js} +1 -1
  98. package/dist/esm/loader.js +3 -3
  99. package/dist/esm/salla-accordion-body_3.entry.js +1 -1
  100. package/dist/esm/salla-accordion_6.entry.js +1 -1
  101. package/dist/esm/salla-add-product-button_4.entry.js +1 -1
  102. package/dist/esm/salla-advertisement.entry.js +1 -1
  103. package/dist/esm/salla-alert_2.entry.js +1 -1
  104. package/dist/esm/salla-app-install-alert.entry.js +1 -1
  105. package/dist/esm/salla-apps-icons.entry.js +1 -1
  106. package/dist/esm/salla-booking-field_7.entry.js +10 -10
  107. package/dist/esm/salla-cart-item-offers_2.entry.js +1 -1
  108. package/dist/esm/salla-comment-form_8.entry.js +1 -1
  109. package/dist/esm/salla-conditional-offer.entry.js +1 -1
  110. package/dist/esm/salla-contacts.entry.js +1 -1
  111. package/dist/esm/salla-cookies-bar.entry.js +1 -1
  112. package/dist/esm/salla-count-down_2.entry.js +11 -8
  113. package/dist/esm/salla-custom-fields.entry.js +1 -1
  114. package/dist/esm/salla-filters-widget.entry.js +1 -1
  115. package/dist/esm/salla-filters.entry.js +1 -1
  116. package/dist/esm/salla-gifting.entry.js +1 -1
  117. package/dist/esm/salla-hook.entry.js +1 -1
  118. package/dist/esm/salla-infinite-scroll.entry.js +1 -1
  119. package/dist/esm/salla-installment.entry.js +1 -1
  120. package/dist/esm/salla-list-tile.entry.js +1 -1
  121. package/dist/esm/salla-localization-modal.entry.js +1 -1
  122. package/dist/esm/salla-login-modal.entry.js +1 -1
  123. package/dist/esm/salla-loyalty-prize-item.entry.js +1 -1
  124. package/dist/esm/salla-loyalty-program.entry.js +1 -1
  125. package/dist/esm/salla-loyalty.entry.js +1 -1
  126. package/dist/esm/salla-maintenance-alert.entry.js +1 -1
  127. package/dist/esm/salla-menu.entry.js +1 -1
  128. package/dist/esm/salla-metadata.entry.js +1 -1
  129. package/dist/esm/salla-multiple-bundle-product-cart_2.entry.js +1 -1
  130. package/dist/esm/salla-multiple-bundle-product-options-modal_2.entry.js +1 -1
  131. package/dist/esm/salla-multiple-bundle-product.entry.js +1 -1
  132. package/dist/esm/salla-notification-item.entry.js +1 -1
  133. package/dist/esm/salla-notifications.entry.js +1 -1
  134. package/dist/esm/salla-offer-modal.entry.js +1 -1
  135. package/dist/esm/salla-offer.entry.js +248 -177
  136. package/dist/esm/salla-order-details-multiple-bundle-product.entry.js +1 -1
  137. package/dist/esm/salla-order-details-options.entry.js +1 -1
  138. package/dist/esm/salla-order-details.entry.js +1 -1
  139. package/dist/esm/salla-order-summary.entry.js +1 -1
  140. package/dist/esm/salla-order-totals-card.entry.js +1 -1
  141. package/dist/esm/salla-orders.entry.js +1 -1
  142. package/dist/esm/salla-payments.entry.js +1 -1
  143. package/dist/esm/salla-placeholder.entry.js +1 -1
  144. package/dist/esm/salla-price-range.entry.js +1 -1
  145. package/dist/esm/salla-product-size-guide.entry.js +1 -1
  146. package/dist/esm/salla-products-list.entry.js +9 -3
  147. package/dist/esm/salla-products-slider.entry.js +1 -1
  148. package/dist/esm/salla-progress-bar.entry.js +1 -1
  149. package/dist/esm/salla-quick-order.entry.js +1 -1
  150. package/dist/esm/salla-rating-modal.entry.js +1 -1
  151. package/dist/esm/salla-scopes.entry.js +1 -1
  152. package/dist/esm/salla-search.entry.js +1 -1
  153. package/dist/esm/salla-skeleton.entry.js +1 -1
  154. package/dist/esm/salla-slider.entry.js +1 -1
  155. package/dist/esm/salla-social-share.entry.js +1 -1
  156. package/dist/esm/salla-social.entry.js +1 -1
  157. package/dist/esm/salla-tab-content_3.entry.js +1 -1
  158. package/dist/esm/salla-tiered-offer.entry.js +1 -1
  159. package/dist/esm/salla-tooltip.entry.js +1 -1
  160. package/dist/esm/salla-trust-badges.entry.js +1 -1
  161. package/dist/esm/salla-user-menu.entry.js +1 -1
  162. package/dist/esm/salla-user-profile.entry.js +1 -1
  163. package/dist/esm/salla-user-settings.entry.js +1 -1
  164. package/dist/esm/salla-verify.entry.js +1 -1
  165. package/dist/esm/salla-wallet.entry.js +1 -1
  166. package/dist/esm/twilight.js +3 -3
  167. package/dist/esm/{vanilla-picker-ErWyfb2S.js → vanilla-picker-BASTfXcg.js} +1 -1
  168. package/dist/twilight/{p-eaf91b32.entry.js → p-04664fcb.entry.js} +1 -1
  169. package/dist/twilight/{p-61b073fe.entry.js → p-0c385d73.entry.js} +1 -1
  170. package/dist/twilight/{p-05edd1ae.entry.js → p-0ede455c.entry.js} +1 -1
  171. package/dist/twilight/{p-90375d86.entry.js → p-0f1d7449.entry.js} +1 -1
  172. package/dist/twilight/{p-df475039.entry.js → p-134c9d22.entry.js} +1 -1
  173. package/dist/twilight/{p-37baa677.entry.js → p-15242c87.entry.js} +1 -1
  174. package/dist/twilight/{p-0a33368c.entry.js → p-1aead6d3.entry.js} +1 -1
  175. package/dist/twilight/{p-f0234135.entry.js → p-1f6ead7d.entry.js} +1 -1
  176. package/dist/twilight/{p-05b3f2ba.entry.js → p-215ed586.entry.js} +1 -1
  177. package/dist/twilight/{p-a3b90d18.entry.js → p-22b1bd15.entry.js} +1 -1
  178. package/dist/twilight/{p-e53c695d.entry.js → p-233b89ad.entry.js} +1 -1
  179. package/dist/twilight/{p-cf4c8fc8.entry.js → p-2405c0f7.entry.js} +1 -1
  180. package/dist/twilight/{p-3f99644a.entry.js → p-2c787ba0.entry.js} +1 -1
  181. package/dist/twilight/{p-ca43a3b7.entry.js → p-2dd98664.entry.js} +1 -1
  182. package/dist/twilight/{p-281ca90e.entry.js → p-3c09b198.entry.js} +1 -1
  183. package/dist/twilight/{p-f959adcd.entry.js → p-3c418ff7.entry.js} +1 -1
  184. package/dist/twilight/{p-a916b222.entry.js → p-3c6f9112.entry.js} +1 -1
  185. package/dist/twilight/{p-4b508998.entry.js → p-3f8b06b3.entry.js} +1 -1
  186. package/dist/twilight/{p-ec61d027.entry.js → p-40ec7a33.entry.js} +1 -1
  187. package/dist/twilight/{p-3e62ea6f.entry.js → p-4d35a32b.entry.js} +1 -1
  188. package/dist/twilight/{p-794141e7.entry.js → p-50f5e38d.entry.js} +1 -1
  189. package/dist/twilight/{p-1df500d5.entry.js → p-5485978c.entry.js} +1 -1
  190. package/dist/twilight/{p-eb1ee098.entry.js → p-585a349f.entry.js} +1 -1
  191. package/dist/twilight/{p-d4135be2.entry.js → p-58f562df.entry.js} +1 -1
  192. package/dist/twilight/{p-1db6e42a.entry.js → p-594d219c.entry.js} +1 -1
  193. package/dist/twilight/{p-D94qS2bu.js → p-5mQqqwMU.js} +1 -1
  194. package/dist/twilight/{p-f1865223.entry.js → p-64ac4c0c.entry.js} +1 -1
  195. package/dist/twilight/{p-28fa2261.entry.js → p-6aecc925.entry.js} +1 -1
  196. package/dist/twilight/{p-bac8dfc6.entry.js → p-6b6e2a52.entry.js} +1 -1
  197. package/dist/twilight/{p-5b221eda.entry.js → p-6daa8bd8.entry.js} +1 -1
  198. package/dist/twilight/{p-5ca44db4.entry.js → p-6dbcd99e.entry.js} +1 -1
  199. package/dist/twilight/{p-34690dc4.entry.js → p-6f09b53e.entry.js} +1 -1
  200. package/dist/twilight/{p-a12e53fb.entry.js → p-721bb258.entry.js} +1 -1
  201. package/dist/twilight/{p-43bed278.entry.js → p-75ab49a3.entry.js} +1 -1
  202. package/dist/twilight/{p-22b8f56b.entry.js → p-7bfb9d71.entry.js} +1 -1
  203. package/dist/twilight/{p-0f9b63f1.entry.js → p-7c8c6c47.entry.js} +1 -1
  204. package/dist/twilight/{p-50b01475.entry.js → p-8c2b148a.entry.js} +1 -1
  205. package/dist/twilight/{p-2a8e49ca.entry.js → p-907b40cd.entry.js} +1 -1
  206. package/dist/twilight/{p-7e971fde.entry.js → p-90eea1a9.entry.js} +1 -1
  207. package/dist/twilight/{p-ac4d4de4.entry.js → p-95db0124.entry.js} +1 -1
  208. package/dist/twilight/{p-31e390fc.entry.js → p-965fe2b3.entry.js} +1 -1
  209. package/dist/twilight/{p-3504a127.entry.js → p-9797a552.entry.js} +1 -1
  210. package/dist/twilight/{p-27198dfa.entry.js → p-9d937a82.entry.js} +1 -1
  211. package/dist/twilight/{p-BpwFfwom.js → p-BGB1zYFQ.js} +1 -1
  212. package/dist/twilight/{p-CMeOfINj.js → p-BLbGjdAU.js} +1 -1
  213. package/dist/twilight/{p-DcD0Zbyk.js → p-CV1rqKQz.js} +1 -1
  214. package/dist/twilight/{p-DI8hZjwW.js → p-CofhuO2Z.js} +1 -1
  215. package/dist/twilight/{p-DaQtMKKH.js → p-CvLPGpFQ.js} +1 -1
  216. package/dist/twilight/{p-CfS_Im-l.js → p-D5AsuzfF.js} +1 -1
  217. package/dist/twilight/{p-r4UR1cQJ.js → p-DbzHZVd1.js} +1 -1
  218. package/dist/twilight/p-a08f5eae.entry.js +4 -0
  219. package/dist/twilight/{p-5463603e.entry.js → p-a0a6a255.entry.js} +1 -1
  220. package/dist/twilight/{p-48b8702d.entry.js → p-a386b02a.entry.js} +1 -1
  221. package/dist/twilight/{p-62eecdc3.entry.js → p-a5df57f9.entry.js} +1 -1
  222. package/dist/twilight/{p-3fbb37fc.entry.js → p-ac7f094e.entry.js} +1 -1
  223. package/dist/twilight/{p-14d02ff1.entry.js → p-af3d4d0d.entry.js} +1 -1
  224. package/dist/twilight/{p-7472ce60.entry.js → p-bb0585cc.entry.js} +1 -1
  225. package/dist/twilight/{p-9a2691e8.entry.js → p-c0ab0fc6.entry.js} +1 -1
  226. package/dist/twilight/{p-4fcd9105.entry.js → p-c3f515ae.entry.js} +1 -1
  227. package/dist/twilight/{p-ea2ebd0c.entry.js → p-c7719ce9.entry.js} +1 -1
  228. package/dist/twilight/{p-38fb50ed.entry.js → p-c90a6440.entry.js} +1 -1
  229. package/dist/twilight/{p-eb21f677.entry.js → p-cf64bb24.entry.js} +1 -1
  230. package/dist/twilight/{p-0f733d50.entry.js → p-d64027b9.entry.js} +1 -1
  231. package/dist/twilight/{p-4afcc4e1.entry.js → p-db4f5b38.entry.js} +1 -1
  232. package/dist/twilight/p-de42ef8c.entry.js +4 -0
  233. package/dist/twilight/{p-cad7741c.entry.js → p-dfc75ce2.entry.js} +1 -1
  234. package/dist/twilight/{p-84920a03.entry.js → p-e0ce2c0d.entry.js} +1 -1
  235. package/dist/twilight/{p-bd15fbda.entry.js → p-e0e61f73.entry.js} +1 -1
  236. package/dist/twilight/{p-cacb3ce1.entry.js → p-e1bf6d23.entry.js} +1 -1
  237. package/dist/twilight/{p-3bd66c8c.entry.js → p-e2c6ed54.entry.js} +1 -1
  238. package/dist/twilight/{p-2e1418d2.entry.js → p-f1156ab8.entry.js} +1 -1
  239. package/dist/twilight/{p-d9e1559a.entry.js → p-f1be81ba.entry.js} +1 -1
  240. package/dist/twilight/{p-C6smOZtR.js → p-f2v0udIe.js} +1 -1
  241. package/dist/twilight/{p-049e7629.entry.js → p-f8fb3130.entry.js} +1 -1
  242. package/dist/twilight/{p-62ab3466.entry.js → p-f9fcf183.entry.js} +1 -1
  243. package/dist/twilight/{p-5286e950.entry.js → p-fc6ddedc.entry.js} +1 -1
  244. package/dist/twilight/{p-Ctf313G7.js → p-tacIS_Xg.js} +1 -1
  245. package/dist/twilight/twilight.esm.js +1 -1
  246. package/dist/types/components/salla-offer/interfaces.d.ts +9 -7
  247. package/dist/types/components/salla-offer/salla-offer.d.ts +35 -36
  248. package/dist/types/components/salla-product-card/salla-product-card.d.ts +4 -0
  249. package/dist/types/components/salla-products-list/salla-products-list.d.ts +4 -0
  250. package/dist/types/components.d.ts +18 -2
  251. package/package.json +5 -5
  252. package/dist/twilight/p-f94c1c9a.entry.js +0 -4
  253. package/dist/twilight/p-fbc08feb.entry.js +0 -4
@@ -3,7 +3,7 @@
3
3
  */
4
4
  'use strict';
5
5
 
6
- var index = require('./index-DaB0o62I.js');
6
+ var index = require('./index-DL9nqubd.js');
7
7
 
8
8
  var PageType;
9
9
  (function (PageType) {
@@ -18,9 +18,11 @@ var OfferType;
18
18
  OfferType["Bank"] = "bank";
19
19
  OfferType["BuyXGetY"] = "buy_x_get_y";
20
20
  OfferType["SpecialPrice"] = "special_price";
21
+ OfferType["Percentage"] = "percentage";
22
+ OfferType["FixedAmount"] = "fixed_amount";
21
23
  })(OfferType || (OfferType = {}));
22
24
 
23
- const sallaOfferCss = ".s-offer-wrapper .s-slider-block__title h2{font-size:1.125rem;line-height:1.75rem;color:#f87171}.s-offer-wrapper .s-slider-block__title h2::before{font-family:\"sallaicons\";content:\"\\ee30\" !important;position:absolute;top:1rem;font-size:3rem;font-weight:400;line-height:1;color:#fef2f2}.s-offer-bank-wrapper-sinlge-item{display:flex;align-items:center !important;gap:14px}.s-offer-bank-wrapper{display:flex !important;width:100% !important}";
25
+ const sallaOfferCss = ":host .s-drawer-close:where([dir=rtl],[dir=rtl] *){left:0}";
24
26
 
25
27
  const SallaOffer = class {
26
28
  constructor(hostRef) {
@@ -34,36 +36,45 @@ const SallaOffer = class {
34
36
  * <salla-products-list product-card-component="my-custom-card-style1" ...
35
37
  * <salla-products-list product-card-component="my-custom-card-style2" ...
36
38
  */
37
- this.productCardComponent = 'custom-salla-product-card';
39
+ this.productCardComponent = 'salla-product-card';
38
40
  // Declare component state variables
39
41
  this.offersList = [];
40
- this.isMultipleBank = false;
41
- this.isBankOffer = false;
42
42
  this.canRender = false;
43
43
  this.showOffer = salla.config.get('store.settings.product.show_special_offers');
44
+ this.showAllOffersModal = false;
45
+ this.showProductsModal = false;
46
+ this.selectedOfferProducts = [];
47
+ this.collapsedOffers = {};
48
+ this.expandedCategories = {};
49
+ this.productsLoaded = false;
44
50
  // Default translated texts
45
51
  this.offer_with_price_text = salla.lang.get('pages.offer.with_price', { price: '' });
46
52
  this.with_discount_text = salla.lang.get('pages.products.with_a_discount');
47
53
  this.product_discount_text = salla.lang.get('pages.products.discount');
48
54
  this.special_offer_text = salla.lang.get('pages.products.special_offer');
49
- this.multipleBankOfferTitleText = salla.lang.get('pages.offer.multiple_bank_offers_title');
50
- this.multipleBankOfferTitleDescription = salla.lang.get('pages.offer.multiple_bank_offers_message');
51
55
  this.buy_quantity_text = (quantity) => salla.lang.get('pages.offer.buy_quantity', { quantity });
56
+ this.products_link_text = salla.lang.get('pages.offer.included_products', 'المنتجات المشمولة');
57
+ this.min_spend_text = (amount, currency) => salla.lang.get('pages.offer.min_spend_amount', { amount, currency }, `بحد أدنى ${amount} ${currency} من مبلغ الشراء`);
58
+ this.min_items_text = (items) => salla.lang.get('pages.offer.min_items', { items }, `بحد أدنى ${items} منتجات`);
59
+ this.product_text = salla.lang.get('common.elements.product', 'منتج');
52
60
  // Language
53
61
  salla.lang.onLoaded(() => {
54
62
  this.offer_with_price_text = salla.lang.get('pages.offer.with_price');
55
63
  this.with_discount_text = salla.lang.get('pages.products.with_a_discount');
56
64
  this.product_discount_text = salla.lang.get('pages.products.discount');
57
65
  this.special_offer_text = salla.lang.get('pages.products.special_offer');
58
- this.multipleBankOfferTitleText = salla.lang.get('pages.offer.multiple_bank_offers_title');
59
- this.multipleBankOfferTitleDescription = salla.lang.get('pages.offer.multiple_bank_offers_message');
60
66
  this.buy_quantity_text(0);
67
+ this.products_link_text = salla.lang.get('pages.offer.included_products', 'المنتجات المشمولة');
68
+ this.min_spend_text = (amount, currency) => salla.lang.get('pages.offer.min_spend_amount', { amount, currency }, `بحد أدنى ${amount} ${currency} من مبلغ الشراء`);
69
+ this.min_items_text = (items) => salla.lang.get('pages.offer.min_items', { items }, `بحد أدنى ${items} منتجات`);
70
+ this.product_text = salla.lang.get('common.elements.product', 'منتج');
61
71
  });
62
72
  salla.onReady(() => {
63
73
  this.currentPage = salla.config.get('page.slug');
64
- this.userCurrency = salla.config.get('currencies')[salla.config.get('user.currency_code')].symbol;
74
+ const currencies = salla.config.get('currencies') || {};
75
+ const currencyCode = salla.config.get('user.currency_code');
76
+ this.userCurrency = currencies[currencyCode] || { symbol: '', code: currencyCode || 'SAR', name: '' };
65
77
  });
66
- this.categorySlot = this.host.querySelector('[slot="category"]')?.innerHTML || '<a href={url} class="s-offer-slide-cat-entry"><i class={icon}></i><h4>{name}</h4></a>';
67
78
  }
68
79
  async getEndpointByPageName() {
69
80
  if (this.currentPage == PageType.Cart) {
@@ -81,36 +92,34 @@ const SallaOffer = class {
81
92
  emitPromotionViewed() {
82
93
  if (!(this.offersList.length && this.canRender && this.showOffer))
83
94
  return;
84
- // Transform offer data to match analytics expectations
85
- const promotionData = {
86
- id: this.offersList[0].id,
87
- name: this.offersList[0].title,
88
- creative: this.offersList[0].description || '',
89
- position: 1
90
- };
91
- salla.event.emit('promotion::viewed', [promotionData]);
95
+ // Emit analytics for all visible offers (first 5) with correct positions
96
+ const visibleOffers = this.offersList.slice(0, 5);
97
+ const promotionDataArray = visibleOffers.map((offer, index) => ({
98
+ id: offer.id,
99
+ name: offer.title,
100
+ creative: offer.description || '',
101
+ position: index + 1
102
+ }));
103
+ salla.event.emit('salla::offer.promotion.viewed', promotionDataArray);
92
104
  }
93
105
  /**
94
106
  * Emits a promotion clicked event
95
107
  */
96
- emitPromotionClicked(position = 1) {
108
+ emitPromotionClicked(offer, position = 1) {
97
109
  if (!(this.offersList.length && this.canRender && this.showOffer))
98
110
  return;
111
+ const targetOffer = offer || this.offersList[0];
99
112
  // Transform offer data to match analytics expectations
100
113
  const promotionData = {
101
- id: this.offersList[0].id,
102
- name: this.offersList[0].title,
103
- creative: this.offersList[0].description || '',
114
+ id: targetOffer.id,
115
+ name: targetOffer.title,
116
+ creative: targetOffer.description || '',
104
117
  position: position
105
118
  };
106
- salla.event.emit('promotion::clicked', [promotionData]);
119
+ salla.event.emit('salla::offer.promotion.clicked', [promotionData]);
107
120
  }
108
121
  componentWillLoad() {
109
122
  this.hasCustomComponent = !!customElements.get(this.productCardComponent);
110
- // let offers = this.getOffersFromStorage();
111
- // if (offers) {
112
- // return offers.then(offersFromStorage => this.offersList = offersFromStorage);
113
- // }
114
123
  return (new Promise(resolve => salla.onReady(resolve)))
115
124
  .then(() => {
116
125
  this.showOffer = !salla.url.is_page('product.single') || salla.config.get('store.settings.product.show_special_offers');
@@ -120,61 +129,86 @@ const SallaOffer = class {
120
129
  throw new Error("Merchant disabled showing the offers on product page");
121
130
  })
122
131
  .then(async () => salla.api.request(await this.getEndpointByPageName()))
123
- .then((res) => {
132
+ .then(async (res) => {
124
133
  if (!(this.offersList = res.data).length) {
125
134
  throw new Error('salla-offers:: There is no offers!');
126
135
  }
127
- //we support these offers only
128
- const offer = this.offersList.find(offer => [OfferType.SpecialPrice, OfferType.Bank, OfferType.BuyXGetY, OfferType.DiscountsTable].includes(offer.type));
129
- if (!offer) {
130
- throw new Error('salla-offers:: Offer type not supported yet!');
131
- }
132
- //because there is no need for special handling for discounts table, just skip the other cases
133
- if (offer.type === OfferType.DiscountsTable) {
134
- return this.offersList = [offer];
136
+ // Filter to only supported offer types
137
+ this.offersList = this.offersList.filter(offer => [OfferType.SpecialPrice, OfferType.Bank, OfferType.BuyXGetY, OfferType.DiscountsTable, OfferType.PercentageOrFixed, OfferType.Percentage, OfferType.FixedAmount].includes(offer.type));
138
+ if (!this.offersList.length) {
139
+ throw new Error('salla-offers:: No supported offer types found!');
135
140
  }
136
- //if it's banks offer, we need to include the other banks overs
137
- if ((this.isBankOffer = offer.type === OfferType.Bank)) {
138
- this.offersList = this.offersList.filter(offer => offer.type === OfferType.Bank);
139
- this.isMultipleBank = this.offersList.length > 1;
140
- return this.offersList;
141
+ // Fetch all categories once if any offer needs them
142
+ let allCategories = null;
143
+ const needsCategories = this.offersList.some(offer => {
144
+ const details = offer.details;
145
+ return (details.apply_to === 'category' && details.targets) ||
146
+ (details.apply_to === 'categories' && details.targets) ||
147
+ (offer.type === OfferType.BuyXGetY && (details.get?.source === 'categories' || details.get?.source === 'category'));
148
+ });
149
+ if (needsCategories) {
150
+ const res = await salla.product.api.categories();
151
+ allCategories = res.data;
141
152
  }
142
- //if it's special price offer
143
- if (offer.type === OfferType.SpecialPrice) {
153
+ // Collect all unique product IDs to make single batched API call
154
+ const productIds = new Set();
155
+ for (const offer of this.offersList) {
144
156
  const details = offer.details;
145
- return details.apply_to === 'product'
146
- // Avoid additional requests; use `salla-products-slider` and pass the custom card
147
- ? salla.product.api.fetch({ source: "selected", source_value: details.targets })
148
- .then((response) => {
149
- offer.details.products = response.data; // Set the fetched products
150
- return this.offersList = [offer];
151
- })
152
- : salla.product.api.categories() // Fetch all categories in one query
153
- .then((res) => {
154
- const categoriesToRender = this.findCategories(res.data, details.targets); // Extract only the selected categories
155
- offer.details.categories = categoriesToRender;
156
- return this.offersList = [offer];
157
+ if ((details.apply_to === 'product' || details.apply_to === 'products') && details.targets) {
158
+ details.targets.forEach(id => productIds.add(id));
159
+ }
160
+ if (offer.type === OfferType.BuyXGetY && details.get?.source === 'products' && details.get?.source_value) {
161
+ details.get.source_value.forEach(id => productIds.add(id));
162
+ }
163
+ if (offer.type === OfferType.BuyXGetY && (details.buy?.source === 'products' || details.buy?.source === 'product') && details.buy?.source_value) {
164
+ details.buy.source_value.forEach(id => productIds.add(id));
165
+ }
166
+ }
167
+ // Single batched API call with source="selected" prevents redundant requests
168
+ let allProducts = {};
169
+ if (productIds.size > 0) {
170
+ try {
171
+ const response = await salla.product.api.fetch({
172
+ source: "selected",
173
+ source_value: Array.from(productIds)
157
174
  });
175
+ allProducts = Object.fromEntries(response.data.map(p => [p.id, p]));
176
+ }
177
+ catch (error) {
178
+ allProducts = {};
179
+ }
158
180
  }
159
- //BuyXGetY offers
160
- const getY = offer.details.get;
161
- return getY.source === 'products'
162
- //todo:: avoid this request, and the handling for the products, just use `salla-products-slider` and don't forget to pass the customcard
163
- ? salla.product.api.fetch({ source: "selected", source_value: getY.source_value })
164
- .then((response) => {
165
- getY.products = response.data;
166
- offer.details.get = getY;
167
- return this.offersList = [offer];
168
- }) //set the products
169
- : salla.product.api.categories() //get all categories in one query, then extract only the selected one, instead of sending multi requests
170
- .then((res) => {
171
- getY.categories = this.findCategories(res.data, getY.source_value);
172
- offer.details.get = getY;
173
- return this.offersList = [offer];
174
- });
181
+ // Process each offer using cached data
182
+ for (const offer of this.offersList) {
183
+ const details = offer.details;
184
+ const shouldFetchCategories = (details.apply_to === 'category' && details.targets) ||
185
+ (details.apply_to === 'categories' && details.targets);
186
+ if (shouldFetchCategories && allCategories) {
187
+ details.categories = this.findCategories(allCategories, details.targets);
188
+ }
189
+ if ((details.apply_to === 'product' || details.apply_to === 'products') && details.targets) {
190
+ details.products = details.targets.map(id => allProducts[id]).filter(Boolean);
191
+ }
192
+ if (offer.type === OfferType.BuyXGetY && details.get) {
193
+ const getY = details.get;
194
+ if (getY.source === 'products' && getY.source_value) {
195
+ getY.products = getY.source_value.map(id => allProducts[id]).filter(Boolean);
196
+ }
197
+ else if ((getY.source === 'categories' || getY.source === 'category') && allCategories && getY.source_value) {
198
+ getY.categories = this.findCategories(allCategories, getY.source_value);
199
+ details.categories = getY.categories;
200
+ }
201
+ }
202
+ if (offer.type === OfferType.BuyXGetY && details.buy) {
203
+ const buyX = details.buy;
204
+ if ((buyX.source === 'products' || buyX.source === 'product') && buyX.source_value) {
205
+ buyX.products = buyX.source_value.map(id => allProducts[id]).filter(Boolean);
206
+ }
207
+ }
208
+ }
209
+ return this.offersList;
175
210
  })
176
- .then((offers) => {
177
- salla.storage.set(this.getStorageKey(), { offers, stored_at: new Date().getTime() });
211
+ .then(() => {
178
212
  this.canRender = true;
179
213
  })
180
214
  .catch((error) => {
@@ -198,128 +232,165 @@ const SallaOffer = class {
198
232
  }
199
233
  return found;
200
234
  }
201
- //todo::add to the key params, to make sure it will support multi offers in the same page if it's wanted
202
- getStorageKey() {
203
- try {
204
- const pageSlug = salla.config.get('page.slug').replace('.', '_');
205
- const locale = salla.lang.getLocale();
206
- const currencyCode = salla.config.currency().code;
207
- if (!pageSlug || !locale || !currencyCode) {
208
- throw new Error('Unable to get the storage key.');
209
- }
210
- return `s-offers-${pageSlug}-${salla.config.get('page.id')}-${locale}-${currencyCode}`;
211
- }
212
- catch (error) {
213
- return '';
214
- }
215
- }
216
- //@ts-ignore
217
- getOffersFromStorage() {
218
- let storageOffers = salla.storage.get(this.getStorageKey());
219
- //if the offers not existed, or it has been stored before 10 minutes from now, ignore it;
220
- if (!storageOffers || storageOffers.stored_at < (new Date().getTime() - 10 * 60 * 1000)) {
221
- salla.storage.remove(this.getStorageKey());
222
- return null;
223
- }
224
- this.canRender = true;
225
- //return it as resolve to support .then
226
- return Promise.resolve(storageOffers.offers);
227
- }
228
235
  render() {
229
236
  // Check if the offers list is empty or if the component is not ready to render
230
237
  if (!this.offersList.length || !this.canRender || !this.showOffer)
231
238
  return null;
232
- const offer = this.offersList[0];
233
- const blockTitle = this.isBankOffer ? (this.isMultipleBank ? this.multipleBankOfferTitleText : null) : offer.title;
234
- const blockSubTitle = this.isBankOffer ? (this.isMultipleBank ? this.multipleBankOfferTitleDescription : null) : offer.description;
239
+ const blockTitle = salla.lang.get('pages.offer.offers_title', 'عروض المنتج');
240
+ const blockSubTitle = salla.lang.get('pages.offer.offers_subtitle', 'احصل على المنتج بسعر مخفض مع أفضل العروض');
235
241
  const titles = {
236
242
  'block-title': blockTitle,
237
243
  'block-subTitle': blockSubTitle,
238
- 'show-controls': this.isMultipleBank
244
+ 'show-controls': this.offersList.length > 1
239
245
  };
240
- return (index.h("div", { class: "s-offer-wrapper", onClick: () => this.emitPromotionClicked() }, index.h("p", { class: "s-offer-corner-badge" }, this.special_offer_text), index.h("salla-slider", { type: "carousel", id: "offer-slider", ...titles }, index.h("div", { slot: 'items' }, this.renderSectionForOfferType(offer.type)))));
246
+ return [
247
+ index.h("div", { class: "s-offer-wrapper" }, index.h("salla-slider", { type: "carousel", id: "offers-slider", ...titles }, index.h("div", { slot: "items" }, this.offersList.slice(0, 5).map((offer, index) => this.renderOfferCard(offer, index + 1)), this.offersList.length > 5 && this.renderShowMoreCard()))),
248
+ // Always render drawers but control visibility through visible prop
249
+ this.renderAllOffersModal(),
250
+ this.renderProductsModal()
251
+ ];
252
+ }
253
+ renderShowMoreCard() {
254
+ return (index.h("div", { class: "s-offer-slide-one-fourth swiper-slide", onClick: (e) => {
255
+ e.preventDefault();
256
+ e.stopPropagation();
257
+ this.openAllOffersModal();
258
+ } }, index.h("div", { class: "s-offer-card s-offer-show-more-card" }, index.h("i", { class: "sicon-add s-offer-show-more-icon" }), index.h("h3", { class: "s-offer-show-more-title" }, salla.lang.get('pages.offer.show_more_offers', 'عرض المزيد من العروض')))));
259
+ }
260
+ openAllOffersModal() {
261
+ this.showAllOffersModal = true;
241
262
  }
242
- renderSectionForOfferType(offerType) {
243
- if (this.isBankOffer) {
244
- return this.renderBankSection();
263
+ closeAllOffersModal() {
264
+ this.showAllOffersModal = false;
265
+ }
266
+ closeProductsModal() {
267
+ this.showProductsModal = false;
268
+ this.selectedOfferProducts = [];
269
+ this.productsLoaded = false;
270
+ }
271
+ handleAccordionToggle(offerId, collapsed) {
272
+ this.collapsedOffers = {
273
+ ...this.collapsedOffers,
274
+ [offerId]: collapsed
275
+ };
276
+ }
277
+ getOfferProducts(offer) {
278
+ const details = offer.details;
279
+ // Handle products from any offer type
280
+ if (details.products && details.products.length > 0) {
281
+ return details.products;
245
282
  }
246
- if (offerType == OfferType.SpecialPrice) {
247
- return this.renderSpecialPriceSection();
283
+ // Handle BuyXGetY special case
284
+ if (offer.type === OfferType.BuyXGetY && details.get?.products) {
285
+ return details.get.products;
248
286
  }
249
- if (offerType == OfferType.BuyXGetY) {
250
- return this.renderBuyXGetYSection();
287
+ // For categories, we'll return empty array as we handle categories separately
288
+ return [];
289
+ }
290
+ renderProductsLinkForModalCard(offer, isInDrawer) {
291
+ const products = this.getOfferProducts(offer);
292
+ if (!products || products.length === 0) {
293
+ return null;
251
294
  }
252
- return this.renderDiscountTableSection();
295
+ const handleProductsClick = (e) => {
296
+ e.stopPropagation();
297
+ this.selectedOfferProducts = products;
298
+ this.showProductsModal = true;
299
+ };
300
+ return (index.h("div", { class: "s-offer-products-link", onClick: handleProductsClick }, index.h("span", { class: "s-offer-products-link-text" }, this.products_link_text), isInDrawer && index.h("i", { class: "sicon-keyboard_arrow_down s-offer-products-link-icon" })));
253
301
  }
254
- /**
255
- * Generates content for the categories section.
256
- *
257
- * @param offeredCategories - An array of Category objects.
258
- * @returns An array of HTML elements representing categories.
259
- */
260
- getCategoriesSection(category) {
261
- return index.h("div", { class: "s-offer-slide-one-sixth swiper-slide", innerHTML: this.categorySlot
262
- .replace(/\{url\}/g, category.url)
263
- .replace(/\{icon\}/g, category.icon || "sicon-store")
264
- .replace(/\{name\}/g, category.name) });
302
+ renderAllOffersModal() {
303
+ return (index.h("salla-drawer", { visible: this.showAllOffersModal, position: "right", width: "md", "no-padding": true, "drawer-title": salla.lang.get('pages.offer.all_offers_title', 'جميع العروض'), onDrawerVisibilityChanged: (e) => !e.detail && this.closeAllOffersModal() }, index.h("div", { class: "s-offer-drawer-content" }, this.offersList.map((offer, index) => this.renderModalOfferCard(offer, index + 1)))));
265
304
  }
266
- renderBuyXGetYSection() {
267
- const details = this.offersList[0].details;
268
- return [
269
- details.get.products?.map((product) => (index.h("div", { class: "s-offer-slide-one-fourth" }, this.hasCustomComponent
270
- ? index.h(this.productCardComponent, { product: product })
271
- : index.h("salla-product-card", { "shadow-on-hover": true, product: product })))),
272
- details.get.categories?.map((category) => this.getCategoriesSection(category))
273
- ];
305
+ renderProductsModal() {
306
+ return (index.h("salla-drawer", { visible: this.showProductsModal, width: "md", position: "right", "no-padding": true, "drawer-title": this.products_link_text, onDrawerVisibilityChanged: (e) => !e.detail && this.closeProductsModal() }, index.h("div", { class: "s-offer-products-drawer-content" }, this.selectedOfferProducts?.length > 0 ? (index.h("div", null, !this.productsLoaded && (index.h("div", { class: "flex items-center justify-center p-8" }, index.h("salla-loading", { size: "24" }))), index.h("salla-products-list", { source: "selected", "source-value": JSON.stringify(this.selectedOfferProducts.map(p => p.id)), "product-card-component": this.productCardComponent, "horizontal-cards": true, "compact-cards": true, includes: ["images"], onProductsFetched: () => this.productsLoaded = true }))) : (index.h("div", { class: "p-4 text-center text-gray-500" }, salla.lang.get('blocks.products.no_products_found', 'لا توجد منتجات'))))));
274
307
  }
275
- /**
276
- * Generates content for the bank section.
277
- *
278
- * @param offeredBank - An array of Bank objects.
279
- * @param name - The title of the current offer.
280
- * @param description - The description of the current offer.
281
- * @returns An array of HTML elements representing banks.
282
- *
283
- * TODO: loop over the list and filter bank types and pass it to this function
284
- */
285
- renderBankSection() {
286
- return this.offersList.map((bankOffer) => {
287
- return index.h("div", { class: { "s-offer-slide-one-sixth": this.isMultipleBank, "s-offer-bank-wrapper-sinlge-item": !this.isMultipleBank } }, index.h("div", { class: { "s-offer-bank-wrapper": true, "s-offer-slide-one-sixth": !this.isMultipleBank, "s-offer-bank-wrapper-multi-spacer": this.isMultipleBank } }, index.h("div", { class: "s-offer-bank-logo" }, index.h("img", { src: bankOffer.details.logo || salla.url.cdn('images/s-empty.png'), "data-src": bankOffer.details.logo, alt: bankOffer.title + " offer" })), index.h("ul", { class: "s-offer-bank-payment-wrapper" }, bankOffer.details.payments.map((payment) => {
288
- return index.h("li", { class: "s-offer-bank-payment-single" }, index.h("img", { src: salla.url.cdn('images/payment/' + payment + '.png') || salla.url.cdn('images/s-empty.png'), "data-src": salla.url.cdn('images/payment/' + payment + '.png'), alt: "payment" }));
289
- })), this.isMultipleBank ?
290
- index.h("p", { class: "s-offer-bank-payment-discount-percent" }, `${this.product_discount_text} ${bankOffer.details.discount_value}${bankOffer.details.discount_type === "percentage" && '%'}`)
291
- : ""), !this.isMultipleBank ?
292
- index.h("div", { class: "s-offer-bank-message s-offer-slide-one-fourth" }, index.h("h2", null, this.offersList[0].title), index.h("p", { innerHTML: this.generateBankDescription(this.offersList[0].description, bankOffer.details.discount_value) }))
293
- : "");
294
- });
308
+ renderModalOfferCard(offer, position = 1) {
309
+ const products = this.getOfferProducts(offer);
310
+ const hasProducts = products && products.length > 0;
311
+ const isCollapsed = this.collapsedOffers[offer.id] !== false; // Default to collapsed
312
+ return (index.h("div", { class: "s-offer-drawer-card" }, index.h("div", { class: "s-offer-card-main", onClick: () => this.emitPromotionClicked(offer, position) }, index.h("div", { class: "s-offer-card-icon" }, this.getOfferIcon(offer.type)), index.h("div", { class: "s-offer-card-content" }, index.h("h3", { class: "s-offer-card-title", title: offer.title }, offer.title), offer.description && index.h("p", { class: "s-offer-card-description" }, offer.description), offer.type === OfferType.DiscountsTable ? (index.h("div", { class: "s-offer-card-details" }, this.renderDiscountTableOfferContent(offer))) : (offer.type === OfferType.PercentageOrFixed || offer.type === OfferType.Percentage || offer.type === OfferType.FixedAmount) ? (index.h("div", { class: "s-offer-card-details" }, this.renderPercentageOrFixedOfferContent(offer), this.renderOfferCategories(offer))) : (index.h("div", { class: "s-offer-card-details" }, this.renderOfferCategories(offer))))), hasProducts && (index.h("salla-accordion", { collapsed: isCollapsed, collapsible: true, size: "sm", onClick: (e) => e.stopPropagation(), onAccordionToggle: (e) => this.handleAccordionToggle(offer.id, e.detail.payload.collapsed) }, index.h("salla-accordion-head", { collapsible: true, collapsed: isCollapsed }, index.h("div", { slot: "title", class: "s-offer-products-thumbnails" }, index.h("span", { class: "s-offer-products-title" }, this.products_link_text, index.h("i", { class: `sicon-keyboard_arrow_${isCollapsed ? 'down' : 'up'} s-offer-products-link-icon` })), index.h("div", { class: "s-offer-products-thumbnails-stack" }, products.slice(0, 3).map((product, index$1) => (index.h("div", { class: "s-offer-product-thumbnail", style: { zIndex: `${index$1 + 1}` } }, index.h("img", { src: product.thumbnail || product.image?.url || salla.url.cdn('images/s-empty.png'), alt: product.name })))), products.length > 3 && (index.h("div", { class: "s-offer-products-more-count", style: { zIndex: '7' } }, "+", products.length - 3))))), index.h("salla-accordion-body", null, index.h("div", { class: "s-offer-products-content" }, index.h("salla-products-list", { source: "selected", "source-value": JSON.stringify(products.map(p => p.id)), "product-card-component": this.productCardComponent, "horizontal-cards": true, "compact-cards": true, includes: ["images"] })))))));
313
+ }
314
+ renderOfferCard(offer, position = 1) {
315
+ return (index.h("div", { class: "s-offer-slide-one-fourth swiper-slide", onClick: () => this.emitPromotionClicked(offer, position) }, index.h("div", { class: "s-offer-card" }, index.h("div", { class: "s-offer-card-icon" }, this.getOfferIcon(offer.type)), index.h("div", { class: "s-offer-card-content" }, index.h("h3", { class: "s-offer-card-title", title: offer.title }, offer.title), offer.description && index.h("p", { class: "s-offer-card-description" }, offer.description), index.h("div", { class: "s-offer-card-details" }, offer.type === OfferType.DiscountsTable
316
+ ? this.renderDiscountTableOfferContent(offer)
317
+ : (offer.type === OfferType.PercentageOrFixed || offer.type === OfferType.Percentage || offer.type === OfferType.FixedAmount)
318
+ ? [
319
+ this.renderPercentageOrFixedOfferContent(offer),
320
+ this.renderOfferCategories(offer)
321
+ ]
322
+ : this.renderOfferCategories(offer), this.renderProductsLinkForModalCard(offer, false))))));
323
+ }
324
+ getOfferIcon(offerType) {
325
+ const iconMap = {
326
+ [OfferType.DiscountsTable]: 'sicon-discount-calculator',
327
+ [OfferType.Bank]: 'sicon-bank',
328
+ [OfferType.SpecialPrice]: 'sicon-fire',
329
+ [OfferType.BuyXGetY]: 'sicon-gift',
330
+ [OfferType.PercentageOrFixed]: 'sicon-special-discount',
331
+ [OfferType.Percentage]: 'sicon-special-discount',
332
+ [OfferType.FixedAmount]: 'sicon-special-discount'
333
+ };
334
+ return index.h("i", { class: iconMap[offerType] || 'sicon-discount' });
335
+ }
336
+ renderDiscountTableOfferContent(offer) {
337
+ const details = offer.details;
338
+ const discounts = details.discounts || [];
339
+ if (!discounts.length)
340
+ return null;
341
+ return (index.h("div", null, index.h("div", { class: "s-offer-card-description" }, salla.lang.get('pages.offer.discount_table_subtitle', 'وفر اكتر بشراء منتجات أكثر')), index.h("table", { class: "s-offer-discount-table" }, index.h("tbody", null, this.groupDiscountsByRows(discounts, 3).map((row, rowIndex) => (index.h("tr", { key: rowIndex }, row.map((discount, colIndex) => (index.h("td", { key: colIndex }, index.h("div", { class: "s-offer-discount-percentage" }, discount.percentage, "%"), index.h("div", { class: "s-offer-discount-condition" }, this.formatDiscountCondition(discount))))))))))));
295
342
  }
296
- generateBankDescription(desc, value) {
297
- return desc.replace(new RegExp(`${value} %`), `<span class="s-offer-bank-message-amount">${value} %</span>`);
343
+ renderPercentageOrFixedOfferContent(offer) {
344
+ const details = offer.details;
345
+ if (!details.discount_value && !(details.min_spend > 0) && !(details.min_items > 0))
346
+ return null;
347
+ return (index.h("div", { class: "s-offer-percentage-fixed-content" }, details.min_spend > 0 && (index.h("div", { class: "s-offer-min-spend" }, this.min_spend_text(details.min_spend, this.userCurrency?.symbol || ''))), details.min_items > 0 && (index.h("div", { class: "s-offer-min-items" }, this.min_items_text(details.min_items)))));
348
+ }
349
+ groupDiscountsByRows(discounts, itemsPerRow) {
350
+ const rows = [];
351
+ for (let i = 0; i < discounts.length; i += itemsPerRow) {
352
+ rows.push(discounts.slice(i, i + itemsPerRow));
353
+ }
354
+ return rows;
355
+ }
356
+ formatDiscountCondition(discount) {
357
+ // Format the condition text based on discount amount or quantity
358
+ if (discount.discounted_amount) {
359
+ return `${discount.discounted_amount} ${this.userCurrency?.symbol || ''}`;
360
+ }
361
+ if (discount.quantity != null) {
362
+ return this.buy_quantity_text(discount.quantity);
363
+ }
364
+ return `1 ${this.product_text}`;
365
+ }
366
+ renderOfferCategories(offer) {
367
+ const details = offer.details;
368
+ // Get categories from different locations based on offer type
369
+ let categories = details.categories || [];
370
+ // For BuyXGetY offers, also check get.categories
371
+ if (offer.type === OfferType.BuyXGetY && details.get?.categories) {
372
+ categories = details.get.categories;
373
+ }
374
+ if (!categories.length)
375
+ return null;
376
+ const maxVisible = 3; // Show only first 3 categories initially
377
+ const isExpanded = this.expandedCategories[offer.id];
378
+ const shouldShowMore = categories.length > maxVisible;
379
+ const visibleCategories = isExpanded ? categories : categories.slice(0, maxVisible);
380
+ return (index.h("div", { class: "s-offer-categories" }, index.h("div", { class: "s-offer-categories-list" }, visibleCategories.map((category, index$1) => (index.h("a", { key: index$1, class: "s-offer-category-item", href: category.url || salla.url.create('categories', category.id || category.id_) }, category.name))), shouldShowMore && (index.h("span", { class: "s-offer-categories-toggle", onClick: (e) => {
381
+ e.preventDefault();
382
+ e.stopPropagation();
383
+ this.toggleCategoryExpansion(offer.id);
384
+ } }, isExpanded ? (index.h("span", null, index.h("i", { class: "sicon-keyboard_arrow_up" }), ' ', salla.lang.get('common.elements.hide', 'إخفاء'))) : (index.h("span", null, salla.lang.get('common.elements.show', 'عرض'), " ", `+${categories.length - maxVisible}`, ' ', index.h("i", { class: "sicon-keyboard_arrow_down" }))))))));
298
385
  }
299
386
  /**
300
- * Generates content for the discount table section.
301
- *
302
- * @param discountTable - An array of Discount objects.
303
- * @returns An array of HTML elements representing discounts_table.
387
+ * Toggle category expansion for a specific offer
304
388
  */
305
- renderDiscountTableSection() {
306
- const offer = this.offersList[0];
307
- let show_discounted_price = offer.details.show_price_after_discount;
308
- return this.offersList[0].details.discounts?.map((discount) => index.h("div", { class: "s-offer-slide-one-fourth" }, index.h("div", { class: "s-offer-slide-offer-entry" }, index.h("div", { class: "s-offer-slide-offer-entry-price-quantity-container" }, index.h("p", { class: "s-offer-slide-offer-entry-quantity" }, this.buy_quantity_text(discount.quantity)), show_discounted_price ?
309
- index.h("div", { class: "s-offer-slide-offer-entry-price" }, index.h("span", null, this.offer_with_price_text), index.h("span", { class: "s-offer-slide-offer-entry-price-amount" }, discount.discounted_amount), " ", index.h("span", null, this.userCurrency)) : ""), index.h("p", { class: "s-offer-slide-offer-entry-price-amount-percent" }, this.with_discount_text, "(", index.h("span", null, discount.percentage, !!discount.percentage && '%'), ")"))));
310
- }
311
- renderSpecialPriceSection() {
312
- const details = this.offersList[0].details;
313
- return [
314
- // Render products if `apply_to` is "product"
315
- details.apply_to === "product" &&
316
- details.products?.map((product) => (index.h("div", { class: "s-offer-slide-one-fourth" }, this.hasCustomComponent
317
- ? index.h(this.productCardComponent, { product: product })
318
- : index.h("salla-product-card", { "shadow-on-hover": true, product: product })))),
319
- // Render categories if `apply_to` is "category"
320
- details.apply_to === "category" &&
321
- details.categories?.map((category) => this.getCategoriesSection(category)),
322
- ];
389
+ toggleCategoryExpansion(offerId) {
390
+ this.expandedCategories = {
391
+ ...this.expandedCategories,
392
+ [offerId]: !this.expandedCategories[offerId]
393
+ };
323
394
  }
324
395
  get host() { return index.getElement(this); }
325
396
  };
@@ -3,7 +3,7 @@
3
3
  */
4
4
  'use strict';
5
5
 
6
- var index = require('./index-DaB0o62I.js');
6
+ var index = require('./index-DL9nqubd.js');
7
7
 
8
8
  const sallaOrderDetailsMultipleBundleProductCss = "";
9
9
 
@@ -3,7 +3,7 @@
3
3
  */
4
4
  'use strict';
5
5
 
6
- var index = require('./index-DaB0o62I.js');
6
+ var index = require('./index-DL9nqubd.js');
7
7
 
8
8
  var copyIcon = `<!-- Generated by IcoMoon.io -->
9
9
  <svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">
@@ -3,7 +3,7 @@
3
3
  */
4
4
  'use strict';
5
5
 
6
- var index = require('./index-DaB0o62I.js');
6
+ var index = require('./index-DL9nqubd.js');
7
7
 
8
8
  const sallaOrderDetailsCss = "";
9
9
 
@@ -3,7 +3,7 @@
3
3
  */
4
4
  'use strict';
5
5
 
6
- var index = require('./index-DaB0o62I.js');
6
+ var index = require('./index-DL9nqubd.js');
7
7
  var check = require('./check-x3w3-gpj.js');
8
8
 
9
9
  var iconFileArchive = `<!-- Generated by IcoMoon.io -->
@@ -3,7 +3,7 @@
3
3
  */
4
4
  'use strict';
5
5
 
6
- var index = require('./index-DaB0o62I.js');
6
+ var index = require('./index-DL9nqubd.js');
7
7
 
8
8
  const sallaOrderTotalsCardCss = ":host{display:block}";
9
9
 
@@ -3,7 +3,7 @@
3
3
  */
4
4
  'use strict';
5
5
 
6
- var index = require('./index-DaB0o62I.js');
6
+ var index = require('./index-DL9nqubd.js');
7
7
  var Helper = require('./Helper-CU4Xuiki.js');
8
8
  require('./anime.es-BqW8JHZi.js');
9
9
 
@@ -3,7 +3,7 @@
3
3
  */
4
4
  'use strict';
5
5
 
6
- var index = require('./index-DaB0o62I.js');
6
+ var index = require('./index-DL9nqubd.js');
7
7
 
8
8
  const sallaPaymentsCss = ":host{display:block}";
9
9
 
@@ -3,7 +3,7 @@
3
3
  */
4
4
  'use strict';
5
5
 
6
- var index = require('./index-DaB0o62I.js');
6
+ var index = require('./index-DL9nqubd.js');
7
7
 
8
8
  var Inbox = `<!-- Generated by IcoMoon.io -->
9
9
  <svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">