@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
@@ -2,17 +2,13 @@
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
4
  import { proxyCustomElement, HTMLElement, h } from '@stencil/core/internal/client';
5
- import { d as defineCustomElement$c } from './salla-add-product-button2.js';
6
- import { d as defineCustomElement$b } from './salla-button2.js';
7
- import { d as defineCustomElement$a } from './salla-count-down2.js';
8
- import { d as defineCustomElement$9 } from './salla-loading2.js';
9
- import { d as defineCustomElement$8 } from './salla-modal2.js';
10
- import { d as defineCustomElement$7 } from './salla-product-availability2.js';
11
- import { d as defineCustomElement$6 } from './salla-product-card2.js';
12
- import { d as defineCustomElement$5 } from './salla-progress-bar2.js';
13
- import { d as defineCustomElement$4 } from './salla-quick-buy2.js';
14
- import { d as defineCustomElement$3 } from './salla-slider2.js';
15
- import { d as defineCustomElement$2 } from './salla-tel-input2.js';
5
+ import { d as defineCustomElement$8 } from './salla-accordion2.js';
6
+ import { d as defineCustomElement$7 } from './salla-accordion-body2.js';
7
+ import { d as defineCustomElement$6 } from './salla-accordion-head2.js';
8
+ import { d as defineCustomElement$5 } from './salla-drawer2.js';
9
+ import { d as defineCustomElement$4 } from './salla-loading2.js';
10
+ import { d as defineCustomElement$3 } from './salla-products-list2.js';
11
+ import { d as defineCustomElement$2 } from './salla-slider2.js';
16
12
 
17
13
  var PageType;
18
14
  (function (PageType) {
@@ -27,9 +23,11 @@ var OfferType;
27
23
  OfferType["Bank"] = "bank";
28
24
  OfferType["BuyXGetY"] = "buy_x_get_y";
29
25
  OfferType["SpecialPrice"] = "special_price";
26
+ OfferType["Percentage"] = "percentage";
27
+ OfferType["FixedAmount"] = "fixed_amount";
30
28
  })(OfferType || (OfferType = {}));
31
29
 
32
- 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}";
30
+ const sallaOfferCss = ":host .s-drawer-close:where([dir=rtl],[dir=rtl] *){left:0}";
33
31
 
34
32
  const SallaOffer$1 = /*@__PURE__*/ proxyCustomElement(class SallaOffer extends HTMLElement {
35
33
  constructor() {
@@ -44,36 +42,45 @@ const SallaOffer$1 = /*@__PURE__*/ proxyCustomElement(class SallaOffer extends H
44
42
  * <salla-products-list product-card-component="my-custom-card-style1" ...
45
43
  * <salla-products-list product-card-component="my-custom-card-style2" ...
46
44
  */
47
- this.productCardComponent = 'custom-salla-product-card';
45
+ this.productCardComponent = 'salla-product-card';
48
46
  // Declare component state variables
49
47
  this.offersList = [];
50
- this.isMultipleBank = false;
51
- this.isBankOffer = false;
52
48
  this.canRender = false;
53
49
  this.showOffer = salla.config.get('store.settings.product.show_special_offers');
50
+ this.showAllOffersModal = false;
51
+ this.showProductsModal = false;
52
+ this.selectedOfferProducts = [];
53
+ this.collapsedOffers = {};
54
+ this.expandedCategories = {};
55
+ this.productsLoaded = false;
54
56
  // Default translated texts
55
57
  this.offer_with_price_text = salla.lang.get('pages.offer.with_price', { price: '' });
56
58
  this.with_discount_text = salla.lang.get('pages.products.with_a_discount');
57
59
  this.product_discount_text = salla.lang.get('pages.products.discount');
58
60
  this.special_offer_text = salla.lang.get('pages.products.special_offer');
59
- this.multipleBankOfferTitleText = salla.lang.get('pages.offer.multiple_bank_offers_title');
60
- this.multipleBankOfferTitleDescription = salla.lang.get('pages.offer.multiple_bank_offers_message');
61
61
  this.buy_quantity_text = (quantity) => salla.lang.get('pages.offer.buy_quantity', { quantity });
62
+ this.products_link_text = salla.lang.get('pages.offer.included_products', 'المنتجات المشمولة');
63
+ this.min_spend_text = (amount, currency) => salla.lang.get('pages.offer.min_spend_amount', { amount, currency }, `بحد أدنى ${amount} ${currency} من مبلغ الشراء`);
64
+ this.min_items_text = (items) => salla.lang.get('pages.offer.min_items', { items }, `بحد أدنى ${items} منتجات`);
65
+ this.product_text = salla.lang.get('common.elements.product', 'منتج');
62
66
  // Language
63
67
  salla.lang.onLoaded(() => {
64
68
  this.offer_with_price_text = salla.lang.get('pages.offer.with_price');
65
69
  this.with_discount_text = salla.lang.get('pages.products.with_a_discount');
66
70
  this.product_discount_text = salla.lang.get('pages.products.discount');
67
71
  this.special_offer_text = salla.lang.get('pages.products.special_offer');
68
- this.multipleBankOfferTitleText = salla.lang.get('pages.offer.multiple_bank_offers_title');
69
- this.multipleBankOfferTitleDescription = salla.lang.get('pages.offer.multiple_bank_offers_message');
70
72
  this.buy_quantity_text(0);
73
+ this.products_link_text = salla.lang.get('pages.offer.included_products', 'المنتجات المشمولة');
74
+ this.min_spend_text = (amount, currency) => salla.lang.get('pages.offer.min_spend_amount', { amount, currency }, `بحد أدنى ${amount} ${currency} من مبلغ الشراء`);
75
+ this.min_items_text = (items) => salla.lang.get('pages.offer.min_items', { items }, `بحد أدنى ${items} منتجات`);
76
+ this.product_text = salla.lang.get('common.elements.product', 'منتج');
71
77
  });
72
78
  salla.onReady(() => {
73
79
  this.currentPage = salla.config.get('page.slug');
74
- this.userCurrency = salla.config.get('currencies')[salla.config.get('user.currency_code')].symbol;
80
+ const currencies = salla.config.get('currencies') || {};
81
+ const currencyCode = salla.config.get('user.currency_code');
82
+ this.userCurrency = currencies[currencyCode] || { symbol: '', code: currencyCode || 'SAR', name: '' };
75
83
  });
76
- 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>';
77
84
  }
78
85
  async getEndpointByPageName() {
79
86
  if (this.currentPage == PageType.Cart) {
@@ -91,36 +98,34 @@ const SallaOffer$1 = /*@__PURE__*/ proxyCustomElement(class SallaOffer extends H
91
98
  emitPromotionViewed() {
92
99
  if (!(this.offersList.length && this.canRender && this.showOffer))
93
100
  return;
94
- // Transform offer data to match analytics expectations
95
- const promotionData = {
96
- id: this.offersList[0].id,
97
- name: this.offersList[0].title,
98
- creative: this.offersList[0].description || '',
99
- position: 1
100
- };
101
- salla.event.emit('promotion::viewed', [promotionData]);
101
+ // Emit analytics for all visible offers (first 5) with correct positions
102
+ const visibleOffers = this.offersList.slice(0, 5);
103
+ const promotionDataArray = visibleOffers.map((offer, index) => ({
104
+ id: offer.id,
105
+ name: offer.title,
106
+ creative: offer.description || '',
107
+ position: index + 1
108
+ }));
109
+ salla.event.emit('salla::offer.promotion.viewed', promotionDataArray);
102
110
  }
103
111
  /**
104
112
  * Emits a promotion clicked event
105
113
  */
106
- emitPromotionClicked(position = 1) {
114
+ emitPromotionClicked(offer, position = 1) {
107
115
  if (!(this.offersList.length && this.canRender && this.showOffer))
108
116
  return;
117
+ const targetOffer = offer || this.offersList[0];
109
118
  // Transform offer data to match analytics expectations
110
119
  const promotionData = {
111
- id: this.offersList[0].id,
112
- name: this.offersList[0].title,
113
- creative: this.offersList[0].description || '',
120
+ id: targetOffer.id,
121
+ name: targetOffer.title,
122
+ creative: targetOffer.description || '',
114
123
  position: position
115
124
  };
116
- salla.event.emit('promotion::clicked', [promotionData]);
125
+ salla.event.emit('salla::offer.promotion.clicked', [promotionData]);
117
126
  }
118
127
  componentWillLoad() {
119
128
  this.hasCustomComponent = !!customElements.get(this.productCardComponent);
120
- // let offers = this.getOffersFromStorage();
121
- // if (offers) {
122
- // return offers.then(offersFromStorage => this.offersList = offersFromStorage);
123
- // }
124
129
  return (new Promise(resolve => salla.onReady(resolve)))
125
130
  .then(() => {
126
131
  this.showOffer = !salla.url.is_page('product.single') || salla.config.get('store.settings.product.show_special_offers');
@@ -130,61 +135,86 @@ const SallaOffer$1 = /*@__PURE__*/ proxyCustomElement(class SallaOffer extends H
130
135
  throw new Error("Merchant disabled showing the offers on product page");
131
136
  })
132
137
  .then(async () => salla.api.request(await this.getEndpointByPageName()))
133
- .then((res) => {
138
+ .then(async (res) => {
134
139
  if (!(this.offersList = res.data).length) {
135
140
  throw new Error('salla-offers:: There is no offers!');
136
141
  }
137
- //we support these offers only
138
- const offer = this.offersList.find(offer => [OfferType.SpecialPrice, OfferType.Bank, OfferType.BuyXGetY, OfferType.DiscountsTable].includes(offer.type));
139
- if (!offer) {
140
- throw new Error('salla-offers:: Offer type not supported yet!');
142
+ // Filter to only supported offer types
143
+ this.offersList = this.offersList.filter(offer => [OfferType.SpecialPrice, OfferType.Bank, OfferType.BuyXGetY, OfferType.DiscountsTable, OfferType.PercentageOrFixed, OfferType.Percentage, OfferType.FixedAmount].includes(offer.type));
144
+ if (!this.offersList.length) {
145
+ throw new Error('salla-offers:: No supported offer types found!');
141
146
  }
142
- //because there is no need for special handling for discounts table, just skip the other cases
143
- if (offer.type === OfferType.DiscountsTable) {
144
- return this.offersList = [offer];
145
- }
146
- //if it's banks offer, we need to include the other banks overs
147
- if ((this.isBankOffer = offer.type === OfferType.Bank)) {
148
- this.offersList = this.offersList.filter(offer => offer.type === OfferType.Bank);
149
- this.isMultipleBank = this.offersList.length > 1;
150
- return this.offersList;
147
+ // Fetch all categories once if any offer needs them
148
+ let allCategories = null;
149
+ const needsCategories = this.offersList.some(offer => {
150
+ const details = offer.details;
151
+ return (details.apply_to === 'category' && details.targets) ||
152
+ (details.apply_to === 'categories' && details.targets) ||
153
+ (offer.type === OfferType.BuyXGetY && (details.get?.source === 'categories' || details.get?.source === 'category'));
154
+ });
155
+ if (needsCategories) {
156
+ const res = await salla.product.api.categories();
157
+ allCategories = res.data;
151
158
  }
152
- //if it's special price offer
153
- if (offer.type === OfferType.SpecialPrice) {
159
+ // Collect all unique product IDs to make single batched API call
160
+ const productIds = new Set();
161
+ for (const offer of this.offersList) {
154
162
  const details = offer.details;
155
- return details.apply_to === 'product'
156
- // Avoid additional requests; use `salla-products-slider` and pass the custom card
157
- ? salla.product.api.fetch({ source: "selected", source_value: details.targets })
158
- .then((response) => {
159
- offer.details.products = response.data; // Set the fetched products
160
- return this.offersList = [offer];
161
- })
162
- : salla.product.api.categories() // Fetch all categories in one query
163
- .then((res) => {
164
- const categoriesToRender = this.findCategories(res.data, details.targets); // Extract only the selected categories
165
- offer.details.categories = categoriesToRender;
166
- return this.offersList = [offer];
163
+ if ((details.apply_to === 'product' || details.apply_to === 'products') && details.targets) {
164
+ details.targets.forEach(id => productIds.add(id));
165
+ }
166
+ if (offer.type === OfferType.BuyXGetY && details.get?.source === 'products' && details.get?.source_value) {
167
+ details.get.source_value.forEach(id => productIds.add(id));
168
+ }
169
+ if (offer.type === OfferType.BuyXGetY && (details.buy?.source === 'products' || details.buy?.source === 'product') && details.buy?.source_value) {
170
+ details.buy.source_value.forEach(id => productIds.add(id));
171
+ }
172
+ }
173
+ // Single batched API call with source="selected" prevents redundant requests
174
+ let allProducts = {};
175
+ if (productIds.size > 0) {
176
+ try {
177
+ const response = await salla.product.api.fetch({
178
+ source: "selected",
179
+ source_value: Array.from(productIds)
167
180
  });
181
+ allProducts = Object.fromEntries(response.data.map(p => [p.id, p]));
182
+ }
183
+ catch (error) {
184
+ allProducts = {};
185
+ }
186
+ }
187
+ // Process each offer using cached data
188
+ for (const offer of this.offersList) {
189
+ const details = offer.details;
190
+ const shouldFetchCategories = (details.apply_to === 'category' && details.targets) ||
191
+ (details.apply_to === 'categories' && details.targets);
192
+ if (shouldFetchCategories && allCategories) {
193
+ details.categories = this.findCategories(allCategories, details.targets);
194
+ }
195
+ if ((details.apply_to === 'product' || details.apply_to === 'products') && details.targets) {
196
+ details.products = details.targets.map(id => allProducts[id]).filter(Boolean);
197
+ }
198
+ if (offer.type === OfferType.BuyXGetY && details.get) {
199
+ const getY = details.get;
200
+ if (getY.source === 'products' && getY.source_value) {
201
+ getY.products = getY.source_value.map(id => allProducts[id]).filter(Boolean);
202
+ }
203
+ else if ((getY.source === 'categories' || getY.source === 'category') && allCategories && getY.source_value) {
204
+ getY.categories = this.findCategories(allCategories, getY.source_value);
205
+ details.categories = getY.categories;
206
+ }
207
+ }
208
+ if (offer.type === OfferType.BuyXGetY && details.buy) {
209
+ const buyX = details.buy;
210
+ if ((buyX.source === 'products' || buyX.source === 'product') && buyX.source_value) {
211
+ buyX.products = buyX.source_value.map(id => allProducts[id]).filter(Boolean);
212
+ }
213
+ }
168
214
  }
169
- //BuyXGetY offers
170
- const getY = offer.details.get;
171
- return getY.source === 'products'
172
- //todo:: avoid this request, and the handling for the products, just use `salla-products-slider` and don't forget to pass the customcard
173
- ? salla.product.api.fetch({ source: "selected", source_value: getY.source_value })
174
- .then((response) => {
175
- getY.products = response.data;
176
- offer.details.get = getY;
177
- return this.offersList = [offer];
178
- }) //set the products
179
- : salla.product.api.categories() //get all categories in one query, then extract only the selected one, instead of sending multi requests
180
- .then((res) => {
181
- getY.categories = this.findCategories(res.data, getY.source_value);
182
- offer.details.get = getY;
183
- return this.offersList = [offer];
184
- });
215
+ return this.offersList;
185
216
  })
186
- .then((offers) => {
187
- salla.storage.set(this.getStorageKey(), { offers, stored_at: new Date().getTime() });
217
+ .then(() => {
188
218
  this.canRender = true;
189
219
  })
190
220
  .catch((error) => {
@@ -208,128 +238,165 @@ const SallaOffer$1 = /*@__PURE__*/ proxyCustomElement(class SallaOffer extends H
208
238
  }
209
239
  return found;
210
240
  }
211
- //todo::add to the key params, to make sure it will support multi offers in the same page if it's wanted
212
- getStorageKey() {
213
- try {
214
- const pageSlug = salla.config.get('page.slug').replace('.', '_');
215
- const locale = salla.lang.getLocale();
216
- const currencyCode = salla.config.currency().code;
217
- if (!pageSlug || !locale || !currencyCode) {
218
- throw new Error('Unable to get the storage key.');
219
- }
220
- return `s-offers-${pageSlug}-${salla.config.get('page.id')}-${locale}-${currencyCode}`;
221
- }
222
- catch (error) {
223
- return '';
224
- }
225
- }
226
- //@ts-ignore
227
- getOffersFromStorage() {
228
- let storageOffers = salla.storage.get(this.getStorageKey());
229
- //if the offers not existed, or it has been stored before 10 minutes from now, ignore it;
230
- if (!storageOffers || storageOffers.stored_at < (new Date().getTime() - 10 * 60 * 1000)) {
231
- salla.storage.remove(this.getStorageKey());
232
- return null;
233
- }
234
- this.canRender = true;
235
- //return it as resolve to support .then
236
- return Promise.resolve(storageOffers.offers);
237
- }
238
241
  render() {
239
242
  // Check if the offers list is empty or if the component is not ready to render
240
243
  if (!this.offersList.length || !this.canRender || !this.showOffer)
241
244
  return null;
242
- const offer = this.offersList[0];
243
- const blockTitle = this.isBankOffer ? (this.isMultipleBank ? this.multipleBankOfferTitleText : null) : offer.title;
244
- const blockSubTitle = this.isBankOffer ? (this.isMultipleBank ? this.multipleBankOfferTitleDescription : null) : offer.description;
245
+ const blockTitle = salla.lang.get('pages.offer.offers_title', 'عروض المنتج');
246
+ const blockSubTitle = salla.lang.get('pages.offer.offers_subtitle', 'احصل على المنتج بسعر مخفض مع أفضل العروض');
245
247
  const titles = {
246
248
  'block-title': blockTitle,
247
249
  'block-subTitle': blockSubTitle,
248
- 'show-controls': this.isMultipleBank
250
+ 'show-controls': this.offersList.length > 1
251
+ };
252
+ return [
253
+ 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()))),
254
+ // Always render drawers but control visibility through visible prop
255
+ this.renderAllOffersModal(),
256
+ this.renderProductsModal()
257
+ ];
258
+ }
259
+ renderShowMoreCard() {
260
+ return (h("div", { class: "s-offer-slide-one-fourth swiper-slide", onClick: (e) => {
261
+ e.preventDefault();
262
+ e.stopPropagation();
263
+ this.openAllOffersModal();
264
+ } }, 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', 'عرض المزيد من العروض')))));
265
+ }
266
+ openAllOffersModal() {
267
+ this.showAllOffersModal = true;
268
+ }
269
+ closeAllOffersModal() {
270
+ this.showAllOffersModal = false;
271
+ }
272
+ closeProductsModal() {
273
+ this.showProductsModal = false;
274
+ this.selectedOfferProducts = [];
275
+ this.productsLoaded = false;
276
+ }
277
+ handleAccordionToggle(offerId, collapsed) {
278
+ this.collapsedOffers = {
279
+ ...this.collapsedOffers,
280
+ [offerId]: collapsed
249
281
  };
250
- 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)))));
251
282
  }
252
- renderSectionForOfferType(offerType) {
253
- if (this.isBankOffer) {
254
- return this.renderBankSection();
283
+ getOfferProducts(offer) {
284
+ const details = offer.details;
285
+ // Handle products from any offer type
286
+ if (details.products && details.products.length > 0) {
287
+ return details.products;
255
288
  }
256
- if (offerType == OfferType.SpecialPrice) {
257
- return this.renderSpecialPriceSection();
289
+ // Handle BuyXGetY special case
290
+ if (offer.type === OfferType.BuyXGetY && details.get?.products) {
291
+ return details.get.products;
258
292
  }
259
- if (offerType == OfferType.BuyXGetY) {
260
- return this.renderBuyXGetYSection();
293
+ // For categories, we'll return empty array as we handle categories separately
294
+ return [];
295
+ }
296
+ renderProductsLinkForModalCard(offer, isInDrawer) {
297
+ const products = this.getOfferProducts(offer);
298
+ if (!products || products.length === 0) {
299
+ return null;
261
300
  }
262
- return this.renderDiscountTableSection();
301
+ const handleProductsClick = (e) => {
302
+ e.stopPropagation();
303
+ this.selectedOfferProducts = products;
304
+ this.showProductsModal = true;
305
+ };
306
+ 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" })));
263
307
  }
264
- /**
265
- * Generates content for the categories section.
266
- *
267
- * @param offeredCategories - An array of Category objects.
268
- * @returns An array of HTML elements representing categories.
269
- */
270
- getCategoriesSection(category) {
271
- return h("div", { class: "s-offer-slide-one-sixth swiper-slide", innerHTML: this.categorySlot
272
- .replace(/\{url\}/g, category.url)
273
- .replace(/\{icon\}/g, category.icon || "sicon-store")
274
- .replace(/\{name\}/g, category.name) });
308
+ renderAllOffersModal() {
309
+ 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)))));
275
310
  }
276
- renderBuyXGetYSection() {
277
- const details = this.offersList[0].details;
278
- return [
279
- details.get.products?.map((product) => (h("div", { class: "s-offer-slide-one-fourth" }, this.hasCustomComponent
280
- ? h(this.productCardComponent, { product: product })
281
- : h("salla-product-card", { "shadow-on-hover": true, product: product })))),
282
- details.get.categories?.map((category) => this.getCategoriesSection(category))
283
- ];
311
+ renderProductsModal() {
312
+ 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', 'لا توجد منتجات'))))));
284
313
  }
285
- /**
286
- * Generates content for the bank section.
287
- *
288
- * @param offeredBank - An array of Bank objects.
289
- * @param name - The title of the current offer.
290
- * @param description - The description of the current offer.
291
- * @returns An array of HTML elements representing banks.
292
- *
293
- * TODO: loop over the list and filter bank types and pass it to this function
294
- */
295
- renderBankSection() {
296
- return this.offersList.map((bankOffer) => {
297
- 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) => {
298
- 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" }));
299
- })), this.isMultipleBank ?
300
- h("p", { class: "s-offer-bank-payment-discount-percent" }, `${this.product_discount_text} ${bankOffer.details.discount_value}${bankOffer.details.discount_type === "percentage" && '%'}`)
301
- : ""), !this.isMultipleBank ?
302
- 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) }))
303
- : "");
304
- });
314
+ renderModalOfferCard(offer, position = 1) {
315
+ const products = this.getOfferProducts(offer);
316
+ const hasProducts = products && products.length > 0;
317
+ const isCollapsed = this.collapsedOffers[offer.id] !== false; // Default to collapsed
318
+ 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"] })))))));
305
319
  }
306
- generateBankDescription(desc, value) {
307
- return desc.replace(new RegExp(`${value} %`), `<span class="s-offer-bank-message-amount">${value} %</span>`);
320
+ renderOfferCard(offer, position = 1) {
321
+ 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
322
+ ? this.renderDiscountTableOfferContent(offer)
323
+ : (offer.type === OfferType.PercentageOrFixed || offer.type === OfferType.Percentage || offer.type === OfferType.FixedAmount)
324
+ ? [
325
+ this.renderPercentageOrFixedOfferContent(offer),
326
+ this.renderOfferCategories(offer)
327
+ ]
328
+ : this.renderOfferCategories(offer), this.renderProductsLinkForModalCard(offer, false))))));
329
+ }
330
+ getOfferIcon(offerType) {
331
+ const iconMap = {
332
+ [OfferType.DiscountsTable]: 'sicon-discount-calculator',
333
+ [OfferType.Bank]: 'sicon-bank',
334
+ [OfferType.SpecialPrice]: 'sicon-fire',
335
+ [OfferType.BuyXGetY]: 'sicon-gift',
336
+ [OfferType.PercentageOrFixed]: 'sicon-special-discount',
337
+ [OfferType.Percentage]: 'sicon-special-discount',
338
+ [OfferType.FixedAmount]: 'sicon-special-discount'
339
+ };
340
+ return h("i", { class: iconMap[offerType] || 'sicon-discount' });
341
+ }
342
+ renderDiscountTableOfferContent(offer) {
343
+ const details = offer.details;
344
+ const discounts = details.discounts || [];
345
+ if (!discounts.length)
346
+ return null;
347
+ 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))))))))))));
348
+ }
349
+ renderPercentageOrFixedOfferContent(offer) {
350
+ const details = offer.details;
351
+ if (!details.discount_value && !(details.min_spend > 0) && !(details.min_items > 0))
352
+ return null;
353
+ 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)))));
354
+ }
355
+ groupDiscountsByRows(discounts, itemsPerRow) {
356
+ const rows = [];
357
+ for (let i = 0; i < discounts.length; i += itemsPerRow) {
358
+ rows.push(discounts.slice(i, i + itemsPerRow));
359
+ }
360
+ return rows;
361
+ }
362
+ formatDiscountCondition(discount) {
363
+ // Format the condition text based on discount amount or quantity
364
+ if (discount.discounted_amount) {
365
+ return `${discount.discounted_amount} ${this.userCurrency?.symbol || ''}`;
366
+ }
367
+ if (discount.quantity != null) {
368
+ return this.buy_quantity_text(discount.quantity);
369
+ }
370
+ return `1 ${this.product_text}`;
371
+ }
372
+ renderOfferCategories(offer) {
373
+ const details = offer.details;
374
+ // Get categories from different locations based on offer type
375
+ let categories = details.categories || [];
376
+ // For BuyXGetY offers, also check get.categories
377
+ if (offer.type === OfferType.BuyXGetY && details.get?.categories) {
378
+ categories = details.get.categories;
379
+ }
380
+ if (!categories.length)
381
+ return null;
382
+ const maxVisible = 3; // Show only first 3 categories initially
383
+ const isExpanded = this.expandedCategories[offer.id];
384
+ const shouldShowMore = categories.length > maxVisible;
385
+ const visibleCategories = isExpanded ? categories : categories.slice(0, maxVisible);
386
+ 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) => {
387
+ e.preventDefault();
388
+ e.stopPropagation();
389
+ this.toggleCategoryExpansion(offer.id);
390
+ } }, 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" }))))))));
308
391
  }
309
392
  /**
310
- * Generates content for the discount table section.
311
- *
312
- * @param discountTable - An array of Discount objects.
313
- * @returns An array of HTML elements representing discounts_table.
393
+ * Toggle category expansion for a specific offer
314
394
  */
315
- renderDiscountTableSection() {
316
- const offer = this.offersList[0];
317
- let show_discounted_price = offer.details.show_price_after_discount;
318
- 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 ?
319
- 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 && '%'), ")"))));
320
- }
321
- renderSpecialPriceSection() {
322
- const details = this.offersList[0].details;
323
- return [
324
- // Render products if `apply_to` is "product"
325
- details.apply_to === "product" &&
326
- details.products?.map((product) => (h("div", { class: "s-offer-slide-one-fourth" }, this.hasCustomComponent
327
- ? h(this.productCardComponent, { product: product })
328
- : h("salla-product-card", { "shadow-on-hover": true, product: product })))),
329
- // Render categories if `apply_to` is "category"
330
- details.apply_to === "category" &&
331
- details.categories?.map((category) => this.getCategoriesSection(category)),
332
- ];
395
+ toggleCategoryExpansion(offerId) {
396
+ this.expandedCategories = {
397
+ ...this.expandedCategories,
398
+ [offerId]: !this.expandedCategories[offerId]
399
+ };
333
400
  }
334
401
  get host() { return this; }
335
402
  static get style() { return sallaOfferCss; }
@@ -337,83 +404,69 @@ const SallaOffer$1 = /*@__PURE__*/ proxyCustomElement(class SallaOffer extends H
337
404
  "productCardComponent": [1, "product-card-component"],
338
405
  "offersList": [32],
339
406
  "userCurrency": [32],
340
- "isMultipleBank": [32],
341
407
  "title": [32],
342
408
  "currentPage": [32],
343
409
  "hasCustomComponent": [32],
344
- "isBankOffer": [32],
345
410
  "canRender": [32],
346
411
  "showOffer": [32],
412
+ "showAllOffersModal": [32],
413
+ "showProductsModal": [32],
414
+ "selectedOfferProducts": [32],
415
+ "collapsedOffers": [32],
416
+ "expandedCategories": [32],
417
+ "productsLoaded": [32],
347
418
  "offer_with_price_text": [32],
348
419
  "with_discount_text": [32],
349
420
  "product_discount_text": [32],
350
421
  "special_offer_text": [32],
351
- "multipleBankOfferTitleText": [32],
352
- "multipleBankOfferTitleDescription": [32],
353
- "buy_quantity_text": [32]
422
+ "buy_quantity_text": [32],
423
+ "products_link_text": [32],
424
+ "min_spend_text": [32],
425
+ "min_items_text": [32],
426
+ "product_text": [32]
354
427
  }]);
355
428
  function defineCustomElement$1() {
356
429
  if (typeof customElements === "undefined") {
357
430
  return;
358
431
  }
359
- const components = ["salla-offer", "salla-add-product-button", "salla-button", "salla-count-down", "salla-loading", "salla-modal", "salla-product-availability", "salla-product-card", "salla-progress-bar", "salla-quick-buy", "salla-slider", "salla-tel-input"];
432
+ const components = ["salla-offer", "salla-accordion", "salla-accordion-body", "salla-accordion-head", "salla-drawer", "salla-loading", "salla-products-list", "salla-slider"];
360
433
  components.forEach(tagName => { switch (tagName) {
361
434
  case "salla-offer":
362
435
  if (!customElements.get(tagName)) {
363
436
  customElements.define(tagName, SallaOffer$1);
364
437
  }
365
438
  break;
366
- case "salla-add-product-button":
367
- if (!customElements.get(tagName)) {
368
- defineCustomElement$c();
369
- }
370
- break;
371
- case "salla-button":
372
- if (!customElements.get(tagName)) {
373
- defineCustomElement$b();
374
- }
375
- break;
376
- case "salla-count-down":
377
- if (!customElements.get(tagName)) {
378
- defineCustomElement$a();
379
- }
380
- break;
381
- case "salla-loading":
382
- if (!customElements.get(tagName)) {
383
- defineCustomElement$9();
384
- }
385
- break;
386
- case "salla-modal":
439
+ case "salla-accordion":
387
440
  if (!customElements.get(tagName)) {
388
441
  defineCustomElement$8();
389
442
  }
390
443
  break;
391
- case "salla-product-availability":
444
+ case "salla-accordion-body":
392
445
  if (!customElements.get(tagName)) {
393
446
  defineCustomElement$7();
394
447
  }
395
448
  break;
396
- case "salla-product-card":
449
+ case "salla-accordion-head":
397
450
  if (!customElements.get(tagName)) {
398
451
  defineCustomElement$6();
399
452
  }
400
453
  break;
401
- case "salla-progress-bar":
454
+ case "salla-drawer":
402
455
  if (!customElements.get(tagName)) {
403
456
  defineCustomElement$5();
404
457
  }
405
458
  break;
406
- case "salla-quick-buy":
459
+ case "salla-loading":
407
460
  if (!customElements.get(tagName)) {
408
461
  defineCustomElement$4();
409
462
  }
410
463
  break;
411
- case "salla-slider":
464
+ case "salla-products-list":
412
465
  if (!customElements.get(tagName)) {
413
466
  defineCustomElement$3();
414
467
  }
415
468
  break;
416
- case "salla-tel-input":
469
+ case "salla-slider":
417
470
  if (!customElements.get(tagName)) {
418
471
  defineCustomElement$2();
419
472
  }