@salla.sa/twilight-components 2.14.365 → 2.14.367

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