@salla.sa/twilight-components 2.14.219 → 2.14.221

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 (332) hide show
  1. package/dist/cjs/{app-globals-DwcsRV1q.js → app-globals-CURclN4K.js} +3 -3
  2. package/dist/cjs/{app-globals-DwcsRV1q.js.map → app-globals-CURclN4K.js.map} +1 -1
  3. package/dist/cjs/{index-CcKYmcmm.js → index-1TYwVkJb.js} +8 -4
  4. package/dist/cjs/index-1TYwVkJb.js.map +1 -0
  5. package/dist/cjs/loader.cjs.js +3 -3
  6. package/dist/cjs/salla-accordion-body.cjs.entry.js +1 -1
  7. package/dist/cjs/salla-accordion-head.cjs.entry.js +1 -1
  8. package/dist/cjs/salla-accordion.cjs.entry.js +1 -1
  9. package/dist/cjs/salla-add-product-button_51.cjs.entry.js +1 -1
  10. package/dist/cjs/salla-advertisement.cjs.entry.js +1 -1
  11. package/dist/cjs/salla-app-install-alert.cjs.entry.js +1 -1
  12. package/dist/cjs/salla-apps-icons.cjs.entry.js +1 -1
  13. package/dist/cjs/salla-booking-field_2.cjs.entry.js +1 -1
  14. package/dist/cjs/salla-cart-item-offers.cjs.entry.js +1 -1
  15. package/dist/cjs/salla-conditional-offer.cjs.entry.js +1 -1
  16. package/dist/cjs/salla-contacts.cjs.entry.js +1 -1
  17. package/dist/cjs/salla-filters-widget.cjs.entry.js +1 -1
  18. package/dist/cjs/salla-filters.cjs.entry.js +1 -1
  19. package/dist/cjs/salla-installment.cjs.entry.js +1 -1
  20. package/dist/cjs/salla-loyalty-prize-item.cjs.entry.js +1 -1
  21. package/dist/cjs/salla-loyalty-program.cjs.entry.js +1 -1
  22. package/dist/cjs/salla-metadata.cjs.entry.js +1 -1
  23. package/dist/cjs/salla-notification-item.cjs.entry.js +1 -1
  24. package/dist/cjs/salla-notifications.cjs.entry.js +1 -1
  25. package/dist/cjs/salla-offer.cjs.entry.js +1 -1
  26. package/dist/cjs/salla-order-summary.cjs.entry.js +1 -1
  27. package/dist/cjs/salla-orders.cjs.entry.js +1 -1
  28. package/dist/cjs/salla-payments.cjs.entry.js +1 -1
  29. package/dist/cjs/salla-price-range.cjs.entry.js +1 -1
  30. package/dist/cjs/salla-product-options.cjs.entry.js +1 -1
  31. package/dist/cjs/salla-review-card.cjs.entry.js +1 -1
  32. package/dist/cjs/salla-reviews-page.cjs.entry.js +1 -1
  33. package/dist/cjs/salla-reviews.cjs.entry.js +1 -1
  34. package/dist/cjs/salla-social.cjs.entry.js +1 -1
  35. package/dist/cjs/salla-tiered-offer.cjs.entry.js +338 -0
  36. package/dist/cjs/salla-tiered-offer.cjs.entry.js.map +1 -0
  37. package/dist/cjs/salla-tiered-offer.entry.cjs.js.map +1 -0
  38. package/dist/cjs/salla-tooltip.cjs.entry.js +1 -1
  39. package/dist/cjs/salla-verify.cjs.entry.js +1 -1
  40. package/dist/cjs/salla-wallet.cjs.entry.js +1 -1
  41. package/dist/cjs/twilight.cjs.js +3 -3
  42. package/dist/collection/assets/svg/diamond-02.svg +4 -0
  43. package/dist/collection/assets/svg/gold.svg +6 -0
  44. package/dist/collection/assets/svg/star-rounded.svg +3 -0
  45. package/dist/collection/assets/svg/stars.svg +5 -0
  46. package/dist/collection/collection-manifest.json +1 -0
  47. package/dist/collection/components/salla-tiered-offer/constants.js +12 -0
  48. package/dist/collection/components/salla-tiered-offer/constants.js.map +1 -0
  49. package/dist/collection/components/salla-tiered-offer/interfaces.js +9 -0
  50. package/dist/collection/components/salla-tiered-offer/interfaces.js.map +1 -0
  51. package/dist/collection/components/salla-tiered-offer/salla-tiered-offer.css +26 -0
  52. package/dist/collection/components/salla-tiered-offer/salla-tiered-offer.js +288 -0
  53. package/dist/collection/components/salla-tiered-offer/salla-tiered-offer.js.map +1 -0
  54. package/dist/collection/components/salla-tiered-offer/utils.js +38 -0
  55. package/dist/collection/components/salla-tiered-offer/utils.js.map +1 -0
  56. package/dist/components/index.js +2 -2
  57. package/dist/components/index.js.map +1 -1
  58. package/dist/components/salla-tiered-offer.d.ts +11 -0
  59. package/dist/components/salla-tiered-offer.js +371 -0
  60. package/dist/components/salla-tiered-offer.js.map +1 -0
  61. package/dist/esm/{app-globals-C4AMOceU.js → app-globals-CIvCwBrC.js} +3 -3
  62. package/dist/esm/{app-globals-C4AMOceU.js.map → app-globals-CIvCwBrC.js.map} +1 -1
  63. package/dist/esm/{index-5Ng8LPjI.js → index-DJeJWTdD.js} +8 -4
  64. package/dist/esm/index-DJeJWTdD.js.map +1 -0
  65. package/dist/esm/loader.js +4 -4
  66. package/dist/esm/salla-accordion-body.entry.js +1 -1
  67. package/dist/esm/salla-accordion-head.entry.js +1 -1
  68. package/dist/esm/salla-accordion.entry.js +1 -1
  69. package/dist/esm/salla-add-product-button_51.entry.js +1 -1
  70. package/dist/esm/salla-advertisement.entry.js +1 -1
  71. package/dist/esm/salla-app-install-alert.entry.js +1 -1
  72. package/dist/esm/salla-apps-icons.entry.js +1 -1
  73. package/dist/esm/salla-booking-field_2.entry.js +1 -1
  74. package/dist/esm/salla-cart-item-offers.entry.js +1 -1
  75. package/dist/esm/salla-conditional-offer.entry.js +1 -1
  76. package/dist/esm/salla-contacts.entry.js +1 -1
  77. package/dist/esm/salla-filters-widget.entry.js +1 -1
  78. package/dist/esm/salla-filters.entry.js +1 -1
  79. package/dist/esm/salla-installment.entry.js +1 -1
  80. package/dist/esm/salla-loyalty-prize-item.entry.js +1 -1
  81. package/dist/esm/salla-loyalty-program.entry.js +1 -1
  82. package/dist/esm/salla-metadata.entry.js +1 -1
  83. package/dist/esm/salla-notification-item.entry.js +1 -1
  84. package/dist/esm/salla-notifications.entry.js +1 -1
  85. package/dist/esm/salla-offer.entry.js +1 -1
  86. package/dist/esm/salla-order-summary.entry.js +1 -1
  87. package/dist/esm/salla-orders.entry.js +1 -1
  88. package/dist/esm/salla-payments.entry.js +1 -1
  89. package/dist/esm/salla-price-range.entry.js +1 -1
  90. package/dist/esm/salla-product-options.entry.js +1 -1
  91. package/dist/esm/salla-review-card.entry.js +1 -1
  92. package/dist/esm/salla-reviews-page.entry.js +1 -1
  93. package/dist/esm/salla-reviews.entry.js +1 -1
  94. package/dist/esm/salla-social.entry.js +1 -1
  95. package/dist/esm/salla-tiered-offer.entry.js +336 -0
  96. package/dist/esm/salla-tiered-offer.entry.js.map +1 -0
  97. package/dist/esm/salla-tooltip.entry.js +1 -1
  98. package/dist/esm/salla-verify.entry.js +1 -1
  99. package/dist/esm/salla-wallet.entry.js +1 -1
  100. package/dist/esm/twilight.js +4 -4
  101. package/dist/esm-es5/{app-globals-C4AMOceU.js → app-globals-CIvCwBrC.js} +2 -2
  102. package/dist/esm-es5/{app-globals-C4AMOceU.js.map → app-globals-CIvCwBrC.js.map} +1 -1
  103. package/dist/esm-es5/{index-5Ng8LPjI.js → index-DJeJWTdD.js} +3 -3
  104. package/dist/esm-es5/index-DJeJWTdD.js.map +1 -0
  105. package/dist/esm-es5/loader.js +1 -1
  106. package/dist/esm-es5/salla-accordion-body.entry.js +1 -1
  107. package/dist/esm-es5/salla-accordion-head.entry.js +1 -1
  108. package/dist/esm-es5/salla-accordion.entry.js +1 -1
  109. package/dist/esm-es5/salla-add-product-button_51.entry.js +4 -4
  110. package/dist/esm-es5/salla-advertisement.entry.js +1 -1
  111. package/dist/esm-es5/salla-app-install-alert.entry.js +1 -1
  112. package/dist/esm-es5/salla-apps-icons.entry.js +1 -1
  113. package/dist/esm-es5/salla-booking-field_2.entry.js +1 -1
  114. package/dist/esm-es5/salla-cart-item-offers.entry.js +1 -1
  115. package/dist/esm-es5/salla-conditional-offer.entry.js +1 -1
  116. package/dist/esm-es5/salla-contacts.entry.js +1 -1
  117. package/dist/esm-es5/salla-filters-widget.entry.js +1 -1
  118. package/dist/esm-es5/salla-filters.entry.js +1 -1
  119. package/dist/esm-es5/salla-installment.entry.js +1 -1
  120. package/dist/esm-es5/salla-loyalty-prize-item.entry.js +1 -1
  121. package/dist/esm-es5/salla-loyalty-program.entry.js +2 -2
  122. package/dist/esm-es5/salla-metadata.entry.js +1 -1
  123. package/dist/esm-es5/salla-notification-item.entry.js +1 -1
  124. package/dist/esm-es5/salla-notifications.entry.js +1 -1
  125. package/dist/esm-es5/salla-offer.entry.js +1 -1
  126. package/dist/esm-es5/salla-order-summary.entry.js +1 -1
  127. package/dist/esm-es5/salla-orders.entry.js +1 -1
  128. package/dist/esm-es5/salla-payments.entry.js +1 -1
  129. package/dist/esm-es5/salla-price-range.entry.js +1 -1
  130. package/dist/esm-es5/salla-product-options.entry.js +1 -1
  131. package/dist/esm-es5/salla-review-card.entry.js +1 -1
  132. package/dist/esm-es5/salla-reviews-page.entry.js +1 -1
  133. package/dist/esm-es5/salla-reviews.entry.js +1 -1
  134. package/dist/esm-es5/salla-social.entry.js +1 -1
  135. package/dist/esm-es5/salla-tiered-offer.entry.js +5 -0
  136. package/dist/esm-es5/salla-tiered-offer.entry.js.map +1 -0
  137. package/dist/esm-es5/salla-tooltip.entry.js +1 -1
  138. package/dist/esm-es5/salla-verify.entry.js +1 -1
  139. package/dist/esm-es5/salla-wallet.entry.js +1 -1
  140. package/dist/esm-es5/twilight.js +1 -1
  141. package/dist/twilight/{p-7f275c07.entry.js → p-018db6d5.entry.js} +2 -2
  142. package/dist/twilight/{p-592ab962.system.entry.js → p-01ab98b8.system.entry.js} +2 -2
  143. package/dist/twilight/{p-0997acd6.system.entry.js → p-0213d2ff.system.entry.js} +2 -2
  144. package/dist/twilight/{p-27b836fc.entry.js → p-0530fecd.entry.js} +2 -2
  145. package/dist/twilight/{p-a3867f03.system.entry.js → p-0a564fe6.system.entry.js} +2 -2
  146. package/dist/twilight/{p-3f87edc6.entry.js → p-0bd54dae.entry.js} +2 -2
  147. package/dist/twilight/{p-87ed46f2.entry.js → p-11542446.entry.js} +2 -2
  148. package/dist/twilight/{p-817c183a.entry.js → p-1196a23a.entry.js} +2 -2
  149. package/dist/twilight/{p-5bcba29f.system.entry.js → p-125e8e09.system.entry.js} +2 -2
  150. package/dist/twilight/{p-bb0a64fb.system.entry.js → p-137b9ced.system.entry.js} +2 -2
  151. package/dist/twilight/{p-4aec7d12.system.entry.js → p-14bce2e7.system.entry.js} +2 -2
  152. package/dist/twilight/{p-63f7bf97.system.entry.js → p-1bc7d70c.system.entry.js} +2 -2
  153. package/dist/twilight/{p-026b2234.system.entry.js → p-1c1baf96.system.entry.js} +2 -2
  154. package/dist/twilight/{p-7e2380cb.entry.js → p-1e32544e.entry.js} +2 -2
  155. package/dist/twilight/{p-CW47XnO5.system.js → p-1xnr2J3b.system.js} +6 -6
  156. package/dist/twilight/p-1xnr2J3b.system.js.map +1 -0
  157. package/dist/twilight/{p-b56edfc7.system.entry.js → p-2411b6cb.system.entry.js} +2 -2
  158. package/dist/twilight/{p-cd1a5066.system.entry.js → p-2943fae2.system.entry.js} +2 -2
  159. package/dist/twilight/{p-fe03bd17.entry.js → p-2e1838fc.entry.js} +2 -2
  160. package/dist/twilight/{p-606c8dfc.entry.js → p-2ecd9c73.entry.js} +2 -2
  161. package/dist/twilight/{p-917f2e0d.entry.js → p-345e7510.entry.js} +2 -2
  162. package/dist/twilight/{p-uTVeOuzK.system.js.map → p-3_GHqNLe.system.js.map} +1 -1
  163. package/dist/twilight/{p-B5V-3iwA.system.js.map → p-3iOHI_bZ.system.js.map} +1 -1
  164. package/dist/twilight/{p-50348764.entry.js → p-4719adfd.entry.js} +2 -2
  165. package/dist/twilight/{p-27fa775d.system.entry.js → p-512dbfd8.system.entry.js} +2 -2
  166. package/dist/twilight/{p-5092bc1b.system.entry.js → p-5222370a.system.entry.js} +2 -2
  167. package/dist/twilight/p-56329c93.system.entry.js +5 -0
  168. package/dist/twilight/{p-4defb732.entry.js → p-594c82e8.entry.js} +2 -2
  169. package/dist/twilight/{p-4260bfbf.entry.js → p-5a3e638f.entry.js} +2 -2
  170. package/dist/twilight/{p-89b36aa5.entry.js → p-5f22ded8.entry.js} +2 -2
  171. package/dist/twilight/{p-d39080ee.system.entry.js → p-60550d95.system.entry.js} +2 -2
  172. package/dist/twilight/{p-e7267b4b.system.entry.js → p-611a0591.system.entry.js} +2 -2
  173. package/dist/twilight/{p-6ccab36e.entry.js → p-62372bb6.entry.js} +2 -2
  174. package/dist/twilight/{p-2378fcc3.system.entry.js → p-64346d4f.system.entry.js} +2 -2
  175. package/dist/twilight/{p-725de283.system.entry.js → p-65f8266c.system.entry.js} +2 -2
  176. package/dist/twilight/{p-0c73100c.entry.js → p-7dc53e3e.entry.js} +2 -2
  177. package/dist/twilight/{p-e182183b.entry.js → p-84aaa78d.entry.js} +2 -2
  178. package/dist/twilight/{p-b66d9649.system.entry.js → p-8b0b63d3.system.entry.js} +2 -2
  179. package/dist/twilight/p-8b9cdaa8.system.entry.js +5 -0
  180. package/dist/twilight/p-8b9cdaa8.system.entry.js.map +1 -0
  181. package/dist/twilight/{p-74922500.entry.js → p-8d171391.entry.js} +2 -2
  182. package/dist/twilight/{p-568ca254.system.entry.js → p-8d241400.system.entry.js} +2 -2
  183. package/dist/twilight/{p-b0b3047d.entry.js → p-8f504c22.entry.js} +2 -2
  184. package/dist/twilight/{p-059307d0.system.entry.js → p-96c0dbe6.system.entry.js} +2 -2
  185. package/dist/twilight/{p-6831d2b2.entry.js → p-9c6d592b.entry.js} +2 -2
  186. package/dist/twilight/{p-jJ43wXLr.system.js.map → p-B0iUa0dk.system.js.map} +1 -1
  187. package/dist/twilight/{p-C435-Ngu.system.js.map → p-B78CJAeo.system.js.map} +1 -1
  188. package/dist/twilight/{p-7SiswGu5.system.js.map → p-BEAZDb3Z.system.js.map} +1 -1
  189. package/dist/twilight/{p-D0yWDY14.system.js.map → p-BQW3a64v.system.js.map} +1 -1
  190. package/dist/twilight/p-BYmyEppC.system.js.map +1 -0
  191. package/dist/twilight/{p-BKj6IZd9.system.js.map → p-BbGRMLwX.system.js.map} +1 -1
  192. package/dist/twilight/{p-F2JLu9jF.system.js.map → p-BiWj3BdY.system.js.map} +1 -1
  193. package/dist/twilight/{p-Qk6u-mnz.system.js.map → p-BmpTR30a.system.js.map} +1 -1
  194. package/dist/twilight/{p-Q3cnmL-k.system.js.map → p-BwBcvX6V.system.js.map} +1 -1
  195. package/dist/twilight/{p-DO1cm8rG.system.js.map → p-C1YpO4ps.system.js.map} +1 -1
  196. package/dist/twilight/{p-nXvqfF6q.system.js.map → p-CS3lHUTW.system.js.map} +1 -1
  197. package/dist/twilight/{p-gVMnKsEU.system.js.map → p-CW5Y_Ilm.system.js.map} +1 -1
  198. package/dist/twilight/{p-TbCQaUz_.system.js.map → p-CW_Wih48.system.js.map} +1 -1
  199. package/dist/twilight/{p-DkgAOYre.system.js.map → p-Cny8cSf0.system.js.map} +1 -1
  200. package/dist/twilight/{p-DUpLpWDY.system.js.map → p-Cv-fXCMq.system.js.map} +1 -1
  201. package/dist/twilight/{p-DvQyp25Z.js → p-D4Rc_kre.js} +2 -2
  202. package/dist/twilight/{p-DvQyp25Z.js.map → p-D4Rc_kre.js.map} +1 -1
  203. package/dist/twilight/{p-C1RajKkq.system.js.map → p-D8gfPwyY.system.js.map} +1 -1
  204. package/dist/twilight/{p-Uyr4Flns.system.js.map → p-DDxbK6va.system.js.map} +1 -1
  205. package/dist/twilight/{p-BC9d2sk2.system.js.map → p-DF0wZDI-.system.js.map} +1 -1
  206. package/dist/twilight/{p-0n3Z0RlT.system.js.map → p-DJO9K4n7.system.js.map} +1 -1
  207. package/dist/twilight/{p-5Ng8LPjI.js → p-DJeJWTdD.js} +3 -3
  208. package/dist/twilight/p-DJeJWTdD.js.map +1 -0
  209. package/dist/twilight/{p-SmO-pF11.system.js.map → p-DYXzVtwh.system.js.map} +1 -1
  210. package/dist/twilight/{p-W-D1NGNr.system.js.map → p-D_GDndNn.system.js.map} +1 -1
  211. package/dist/twilight/{p-B_XWr5W4.system.js.map → p-DanADfyI.system.js.map} +1 -1
  212. package/dist/twilight/{p-DrkjWDOn.system.js.map → p-DlFxCb4V.system.js.map} +1 -1
  213. package/dist/twilight/{p-DyTthv6s.system.js → p-Dtkyz9uf.system.js} +2 -2
  214. package/dist/twilight/{p-DyTthv6s.system.js.map → p-Dtkyz9uf.system.js.map} +1 -1
  215. package/dist/twilight/{p-DAcwScl7.system.js.map → p-DuXM8liP.system.js.map} +1 -1
  216. package/dist/twilight/{p-D5qlTBkb.system.js.map → p-DvaxAP4E.system.js.map} +1 -1
  217. package/dist/twilight/{p-D66T0o_K.system.js.map → p-DygvAhI4.system.js.map} +1 -1
  218. package/dist/twilight/{p-BRVKF1oX.system.js.map → p-V-F3jS9L.system.js.map} +1 -1
  219. package/dist/twilight/{p-CVCIt2lC.system.js.map → p-Vh3TFQnV.system.js.map} +1 -1
  220. package/dist/twilight/{p-38dbabf3.system.entry.js → p-a4376ad7.system.entry.js} +2 -2
  221. package/dist/twilight/{p-7425415e.entry.js → p-a52f5483.entry.js} +2 -2
  222. package/dist/twilight/{p-2bbb1442.system.entry.js → p-a8541cb2.system.entry.js} +2 -2
  223. package/dist/twilight/{p-b932035d.entry.js → p-aae55c3c.entry.js} +2 -2
  224. package/dist/twilight/{p-83ec57bf.system.entry.js → p-ab9a81e5.system.entry.js} +2 -2
  225. package/dist/twilight/{p-9a610905.entry.js → p-b311d422.entry.js} +2 -2
  226. package/dist/twilight/{p-8fee4078.entry.js → p-b734e69f.entry.js} +2 -2
  227. package/dist/twilight/{p-5cdc0973.entry.js → p-bdef02e0.entry.js} +2 -2
  228. package/dist/twilight/{p-ab25e4b2.system.entry.js → p-bec1f4a2.system.entry.js} +2 -2
  229. package/dist/twilight/{p-52d9262a.system.entry.js → p-c62d7968.system.entry.js} +2 -2
  230. package/dist/twilight/{p-2406c822.entry.js → p-cba454b7.entry.js} +2 -2
  231. package/dist/twilight/{p-3fcf491f.entry.js → p-d0db93be.entry.js} +2 -2
  232. package/dist/twilight/{p-30635b42.system.entry.js → p-d78f9304.system.entry.js} +2 -2
  233. package/dist/twilight/{p-DA5WTaBt.system.js.map → p-dKVQW-4Z.system.js.map} +1 -1
  234. package/dist/twilight/{p-fa63f709.entry.js → p-ddfc02db.entry.js} +2 -2
  235. package/dist/twilight/p-df86fa35.entry.js +5 -0
  236. package/dist/twilight/p-df86fa35.entry.js.map +1 -0
  237. package/dist/twilight/{p-727b5970.system.entry.js → p-e09dbe92.system.entry.js} +2 -2
  238. package/dist/twilight/{p-8aebf618.system.entry.js → p-e45781c5.system.entry.js} +2 -2
  239. package/dist/twilight/{p-1d9751af.system.entry.js → p-e490de2f.system.entry.js} +2 -2
  240. package/dist/twilight/{p-e38dcdec.entry.js → p-e9e4a641.entry.js} +7 -7
  241. package/dist/twilight/{p-c8833f02.system.entry.js → p-eb847afb.system.entry.js} +2 -2
  242. package/dist/twilight/{p-DAzL0lXn.system.js.map → p-eyvPNcBM.system.js.map} +1 -1
  243. package/dist/twilight/{p-1fec50ba.entry.js → p-f26aa117.entry.js} +2 -2
  244. package/dist/twilight/{p-e0039759.entry.js → p-f5364a4e.entry.js} +2 -2
  245. package/dist/twilight/{p-0f6f5c5a.system.entry.js → p-f6e14858.system.entry.js} +2 -2
  246. package/dist/twilight/{p-f0eacf55.entry.js → p-f8f0dd3d.entry.js} +2 -2
  247. package/dist/twilight/{p-f0443b95.entry.js → p-fd20f996.entry.js} +2 -2
  248. package/dist/twilight/{p-b0218d53.system.entry.js → p-fe4d5abb.system.entry.js} +2 -2
  249. package/dist/twilight/{p-BwQkR44B.system.js.map → p-rHIfLORZ.system.js.map} +1 -1
  250. package/dist/twilight/p-t_BLXxaT.system.js +5 -0
  251. package/dist/twilight/{p-DF9ZFyzo.system.js.map → p-t_BLXxaT.system.js.map} +1 -1
  252. package/dist/twilight/{p-DEap41uW.system.js.map → p-urL630v4.system.js.map} +1 -1
  253. package/dist/twilight/salla-tiered-offer.entry.esm.js.map +1 -0
  254. package/dist/twilight/twilight.esm.js +1 -1
  255. package/dist/twilight/twilight.js +1 -1
  256. package/dist/types/components/salla-tiered-offer/constants.d.ts +2 -0
  257. package/dist/types/components/salla-tiered-offer/interfaces.d.ts +44 -0
  258. package/dist/types/components/salla-tiered-offer/salla-tiered-offer.d.ts +39 -0
  259. package/dist/types/components/salla-tiered-offer/utils.d.ts +19 -0
  260. package/dist/types/components.d.ts +13 -0
  261. package/package.json +5 -5
  262. package/dist/cjs/index-CcKYmcmm.js.map +0 -1
  263. package/dist/esm/index-5Ng8LPjI.js.map +0 -1
  264. package/dist/esm-es5/index-5Ng8LPjI.js.map +0 -1
  265. package/dist/twilight/p-5Ng8LPjI.js.map +0 -1
  266. package/dist/twilight/p-CW47XnO5.system.js.map +0 -1
  267. package/dist/twilight/p-DF9ZFyzo.system.js +0 -5
  268. package/dist/twilight/p-bed89c3a.system.entry.js +0 -5
  269. /package/dist/twilight/{p-7f275c07.entry.js.map → p-018db6d5.entry.js.map} +0 -0
  270. /package/dist/twilight/{p-592ab962.system.entry.js.map → p-01ab98b8.system.entry.js.map} +0 -0
  271. /package/dist/twilight/{p-0997acd6.system.entry.js.map → p-0213d2ff.system.entry.js.map} +0 -0
  272. /package/dist/twilight/{p-27b836fc.entry.js.map → p-0530fecd.entry.js.map} +0 -0
  273. /package/dist/twilight/{p-a3867f03.system.entry.js.map → p-0a564fe6.system.entry.js.map} +0 -0
  274. /package/dist/twilight/{p-3f87edc6.entry.js.map → p-0bd54dae.entry.js.map} +0 -0
  275. /package/dist/twilight/{p-87ed46f2.entry.js.map → p-11542446.entry.js.map} +0 -0
  276. /package/dist/twilight/{p-817c183a.entry.js.map → p-1196a23a.entry.js.map} +0 -0
  277. /package/dist/twilight/{p-5bcba29f.system.entry.js.map → p-125e8e09.system.entry.js.map} +0 -0
  278. /package/dist/twilight/{p-bb0a64fb.system.entry.js.map → p-137b9ced.system.entry.js.map} +0 -0
  279. /package/dist/twilight/{p-4aec7d12.system.entry.js.map → p-14bce2e7.system.entry.js.map} +0 -0
  280. /package/dist/twilight/{p-63f7bf97.system.entry.js.map → p-1bc7d70c.system.entry.js.map} +0 -0
  281. /package/dist/twilight/{p-026b2234.system.entry.js.map → p-1c1baf96.system.entry.js.map} +0 -0
  282. /package/dist/twilight/{p-7e2380cb.entry.js.map → p-1e32544e.entry.js.map} +0 -0
  283. /package/dist/twilight/{p-b56edfc7.system.entry.js.map → p-2411b6cb.system.entry.js.map} +0 -0
  284. /package/dist/twilight/{p-cd1a5066.system.entry.js.map → p-2943fae2.system.entry.js.map} +0 -0
  285. /package/dist/twilight/{p-fe03bd17.entry.js.map → p-2e1838fc.entry.js.map} +0 -0
  286. /package/dist/twilight/{p-606c8dfc.entry.js.map → p-2ecd9c73.entry.js.map} +0 -0
  287. /package/dist/twilight/{p-917f2e0d.entry.js.map → p-345e7510.entry.js.map} +0 -0
  288. /package/dist/twilight/{p-50348764.entry.js.map → p-4719adfd.entry.js.map} +0 -0
  289. /package/dist/twilight/{p-27fa775d.system.entry.js.map → p-512dbfd8.system.entry.js.map} +0 -0
  290. /package/dist/twilight/{p-5092bc1b.system.entry.js.map → p-5222370a.system.entry.js.map} +0 -0
  291. /package/dist/twilight/{p-bed89c3a.system.entry.js.map → p-56329c93.system.entry.js.map} +0 -0
  292. /package/dist/twilight/{p-4defb732.entry.js.map → p-594c82e8.entry.js.map} +0 -0
  293. /package/dist/twilight/{p-4260bfbf.entry.js.map → p-5a3e638f.entry.js.map} +0 -0
  294. /package/dist/twilight/{p-89b36aa5.entry.js.map → p-5f22ded8.entry.js.map} +0 -0
  295. /package/dist/twilight/{p-d39080ee.system.entry.js.map → p-60550d95.system.entry.js.map} +0 -0
  296. /package/dist/twilight/{p-e7267b4b.system.entry.js.map → p-611a0591.system.entry.js.map} +0 -0
  297. /package/dist/twilight/{p-6ccab36e.entry.js.map → p-62372bb6.entry.js.map} +0 -0
  298. /package/dist/twilight/{p-2378fcc3.system.entry.js.map → p-64346d4f.system.entry.js.map} +0 -0
  299. /package/dist/twilight/{p-725de283.system.entry.js.map → p-65f8266c.system.entry.js.map} +0 -0
  300. /package/dist/twilight/{p-0c73100c.entry.js.map → p-7dc53e3e.entry.js.map} +0 -0
  301. /package/dist/twilight/{p-e182183b.entry.js.map → p-84aaa78d.entry.js.map} +0 -0
  302. /package/dist/twilight/{p-b66d9649.system.entry.js.map → p-8b0b63d3.system.entry.js.map} +0 -0
  303. /package/dist/twilight/{p-74922500.entry.js.map → p-8d171391.entry.js.map} +0 -0
  304. /package/dist/twilight/{p-568ca254.system.entry.js.map → p-8d241400.system.entry.js.map} +0 -0
  305. /package/dist/twilight/{p-b0b3047d.entry.js.map → p-8f504c22.entry.js.map} +0 -0
  306. /package/dist/twilight/{p-059307d0.system.entry.js.map → p-96c0dbe6.system.entry.js.map} +0 -0
  307. /package/dist/twilight/{p-6831d2b2.entry.js.map → p-9c6d592b.entry.js.map} +0 -0
  308. /package/dist/twilight/{p-38dbabf3.system.entry.js.map → p-a4376ad7.system.entry.js.map} +0 -0
  309. /package/dist/twilight/{p-7425415e.entry.js.map → p-a52f5483.entry.js.map} +0 -0
  310. /package/dist/twilight/{p-2bbb1442.system.entry.js.map → p-a8541cb2.system.entry.js.map} +0 -0
  311. /package/dist/twilight/{p-b932035d.entry.js.map → p-aae55c3c.entry.js.map} +0 -0
  312. /package/dist/twilight/{p-83ec57bf.system.entry.js.map → p-ab9a81e5.system.entry.js.map} +0 -0
  313. /package/dist/twilight/{p-9a610905.entry.js.map → p-b311d422.entry.js.map} +0 -0
  314. /package/dist/twilight/{p-8fee4078.entry.js.map → p-b734e69f.entry.js.map} +0 -0
  315. /package/dist/twilight/{p-5cdc0973.entry.js.map → p-bdef02e0.entry.js.map} +0 -0
  316. /package/dist/twilight/{p-ab25e4b2.system.entry.js.map → p-bec1f4a2.system.entry.js.map} +0 -0
  317. /package/dist/twilight/{p-52d9262a.system.entry.js.map → p-c62d7968.system.entry.js.map} +0 -0
  318. /package/dist/twilight/{p-2406c822.entry.js.map → p-cba454b7.entry.js.map} +0 -0
  319. /package/dist/twilight/{p-3fcf491f.entry.js.map → p-d0db93be.entry.js.map} +0 -0
  320. /package/dist/twilight/{p-30635b42.system.entry.js.map → p-d78f9304.system.entry.js.map} +0 -0
  321. /package/dist/twilight/{p-fa63f709.entry.js.map → p-ddfc02db.entry.js.map} +0 -0
  322. /package/dist/twilight/{p-727b5970.system.entry.js.map → p-e09dbe92.system.entry.js.map} +0 -0
  323. /package/dist/twilight/{p-8aebf618.system.entry.js.map → p-e45781c5.system.entry.js.map} +0 -0
  324. /package/dist/twilight/{p-1d9751af.system.entry.js.map → p-e490de2f.system.entry.js.map} +0 -0
  325. /package/dist/twilight/{p-e38dcdec.entry.js.map → p-e9e4a641.entry.js.map} +0 -0
  326. /package/dist/twilight/{p-c8833f02.system.entry.js.map → p-eb847afb.system.entry.js.map} +0 -0
  327. /package/dist/twilight/{p-1fec50ba.entry.js.map → p-f26aa117.entry.js.map} +0 -0
  328. /package/dist/twilight/{p-e0039759.entry.js.map → p-f5364a4e.entry.js.map} +0 -0
  329. /package/dist/twilight/{p-0f6f5c5a.system.entry.js.map → p-f6e14858.system.entry.js.map} +0 -0
  330. /package/dist/twilight/{p-f0eacf55.entry.js.map → p-f8f0dd3d.entry.js.map} +0 -0
  331. /package/dist/twilight/{p-f0443b95.entry.js.map → p-fd20f996.entry.js.map} +0 -0
  332. /package/dist/twilight/{p-b0218d53.system.entry.js.map → p-fe4d5abb.system.entry.js.map} +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"p-DAcwScl7.system.js","sources":["../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/now.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_trimmedEndIndex.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseTrim.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/toNumber.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/debounce.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/throttle.js","src/Helpers/masonry-layout.ts","src/components/salla-reviews-page/salla-reviews-page.css?tag=salla-reviews-page","src/components/salla-reviews-page/salla-reviews-page.tsx"],"sourcesContent":["var root = require('./_root');\n\n/**\n * Gets the timestamp of the number of milliseconds that have elapsed since\n * the Unix epoch (1 January 1970 00:00:00 UTC).\n *\n * @static\n * @memberOf _\n * @since 2.4.0\n * @category Date\n * @returns {number} Returns the timestamp.\n * @example\n *\n * _.defer(function(stamp) {\n * console.log(_.now() - stamp);\n * }, _.now());\n * // => Logs the number of milliseconds it took for the deferred invocation.\n */\nvar now = function() {\n return root.Date.now();\n};\n\nmodule.exports = now;\n","/** Used to match a single whitespace character. */\nvar reWhitespace = /\\s/;\n\n/**\n * Used by `_.trim` and `_.trimEnd` to get the index of the last non-whitespace\n * character of `string`.\n *\n * @private\n * @param {string} string The string to inspect.\n * @returns {number} Returns the index of the last non-whitespace character.\n */\nfunction trimmedEndIndex(string) {\n var index = string.length;\n\n while (index-- && reWhitespace.test(string.charAt(index))) {}\n return index;\n}\n\nmodule.exports = trimmedEndIndex;\n","var trimmedEndIndex = require('./_trimmedEndIndex');\n\n/** Used to match leading whitespace. */\nvar reTrimStart = /^\\s+/;\n\n/**\n * The base implementation of `_.trim`.\n *\n * @private\n * @param {string} string The string to trim.\n * @returns {string} Returns the trimmed string.\n */\nfunction baseTrim(string) {\n return string\n ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, '')\n : string;\n}\n\nmodule.exports = baseTrim;\n","var baseTrim = require('./_baseTrim'),\n isObject = require('./isObject'),\n isSymbol = require('./isSymbol');\n\n/** Used as references for various `Number` constants. */\nvar NAN = 0 / 0;\n\n/** Used to detect bad signed hexadecimal string values. */\nvar reIsBadHex = /^[-+]0x[0-9a-f]+$/i;\n\n/** Used to detect binary string values. */\nvar reIsBinary = /^0b[01]+$/i;\n\n/** Used to detect octal string values. */\nvar reIsOctal = /^0o[0-7]+$/i;\n\n/** Built-in method references without a dependency on `root`. */\nvar freeParseInt = parseInt;\n\n/**\n * Converts `value` to a number.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to process.\n * @returns {number} Returns the number.\n * @example\n *\n * _.toNumber(3.2);\n * // => 3.2\n *\n * _.toNumber(Number.MIN_VALUE);\n * // => 5e-324\n *\n * _.toNumber(Infinity);\n * // => Infinity\n *\n * _.toNumber('3.2');\n * // => 3.2\n */\nfunction toNumber(value) {\n if (typeof value == 'number') {\n return value;\n }\n if (isSymbol(value)) {\n return NAN;\n }\n if (isObject(value)) {\n var other = typeof value.valueOf == 'function' ? value.valueOf() : value;\n value = isObject(other) ? (other + '') : other;\n }\n if (typeof value != 'string') {\n return value === 0 ? value : +value;\n }\n value = baseTrim(value);\n var isBinary = reIsBinary.test(value);\n return (isBinary || reIsOctal.test(value))\n ? freeParseInt(value.slice(2), isBinary ? 2 : 8)\n : (reIsBadHex.test(value) ? NAN : +value);\n}\n\nmodule.exports = toNumber;\n","var isObject = require('./isObject'),\n now = require('./now'),\n toNumber = require('./toNumber');\n\n/** Error message constants. */\nvar FUNC_ERROR_TEXT = 'Expected a function';\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeMax = Math.max,\n nativeMin = Math.min;\n\n/**\n * Creates a debounced function that delays invoking `func` until after `wait`\n * milliseconds have elapsed since the last time the debounced function was\n * invoked. The debounced function comes with a `cancel` method to cancel\n * delayed `func` invocations and a `flush` method to immediately invoke them.\n * Provide `options` to indicate whether `func` should be invoked on the\n * leading and/or trailing edge of the `wait` timeout. The `func` is invoked\n * with the last arguments provided to the debounced function. Subsequent\n * calls to the debounced function return the result of the last `func`\n * invocation.\n *\n * **Note:** If `leading` and `trailing` options are `true`, `func` is\n * invoked on the trailing edge of the timeout only if the debounced function\n * is invoked more than once during the `wait` timeout.\n *\n * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred\n * until to the next tick, similar to `setTimeout` with a timeout of `0`.\n *\n * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)\n * for details over the differences between `_.debounce` and `_.throttle`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Function\n * @param {Function} func The function to debounce.\n * @param {number} [wait=0] The number of milliseconds to delay.\n * @param {Object} [options={}] The options object.\n * @param {boolean} [options.leading=false]\n * Specify invoking on the leading edge of the timeout.\n * @param {number} [options.maxWait]\n * The maximum time `func` is allowed to be delayed before it's invoked.\n * @param {boolean} [options.trailing=true]\n * Specify invoking on the trailing edge of the timeout.\n * @returns {Function} Returns the new debounced function.\n * @example\n *\n * // Avoid costly calculations while the window size is in flux.\n * jQuery(window).on('resize', _.debounce(calculateLayout, 150));\n *\n * // Invoke `sendMail` when clicked, debouncing subsequent calls.\n * jQuery(element).on('click', _.debounce(sendMail, 300, {\n * 'leading': true,\n * 'trailing': false\n * }));\n *\n * // Ensure `batchLog` is invoked once after 1 second of debounced calls.\n * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });\n * var source = new EventSource('/stream');\n * jQuery(source).on('message', debounced);\n *\n * // Cancel the trailing debounced invocation.\n * jQuery(window).on('popstate', debounced.cancel);\n */\nfunction debounce(func, wait, options) {\n var lastArgs,\n lastThis,\n maxWait,\n result,\n timerId,\n lastCallTime,\n lastInvokeTime = 0,\n leading = false,\n maxing = false,\n trailing = true;\n\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n wait = toNumber(wait) || 0;\n if (isObject(options)) {\n leading = !!options.leading;\n maxing = 'maxWait' in options;\n maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;\n trailing = 'trailing' in options ? !!options.trailing : trailing;\n }\n\n function invokeFunc(time) {\n var args = lastArgs,\n thisArg = lastThis;\n\n lastArgs = lastThis = undefined;\n lastInvokeTime = time;\n result = func.apply(thisArg, args);\n return result;\n }\n\n function leadingEdge(time) {\n // Reset any `maxWait` timer.\n lastInvokeTime = time;\n // Start the timer for the trailing edge.\n timerId = setTimeout(timerExpired, wait);\n // Invoke the leading edge.\n return leading ? invokeFunc(time) : result;\n }\n\n function remainingWait(time) {\n var timeSinceLastCall = time - lastCallTime,\n timeSinceLastInvoke = time - lastInvokeTime,\n timeWaiting = wait - timeSinceLastCall;\n\n return maxing\n ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke)\n : timeWaiting;\n }\n\n function shouldInvoke(time) {\n var timeSinceLastCall = time - lastCallTime,\n timeSinceLastInvoke = time - lastInvokeTime;\n\n // Either this is the first call, activity has stopped and we're at the\n // trailing edge, the system time has gone backwards and we're treating\n // it as the trailing edge, or we've hit the `maxWait` limit.\n return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||\n (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));\n }\n\n function timerExpired() {\n var time = now();\n if (shouldInvoke(time)) {\n return trailingEdge(time);\n }\n // Restart the timer.\n timerId = setTimeout(timerExpired, remainingWait(time));\n }\n\n function trailingEdge(time) {\n timerId = undefined;\n\n // Only invoke if we have `lastArgs` which means `func` has been\n // debounced at least once.\n if (trailing && lastArgs) {\n return invokeFunc(time);\n }\n lastArgs = lastThis = undefined;\n return result;\n }\n\n function cancel() {\n if (timerId !== undefined) {\n clearTimeout(timerId);\n }\n lastInvokeTime = 0;\n lastArgs = lastCallTime = lastThis = timerId = undefined;\n }\n\n function flush() {\n return timerId === undefined ? result : trailingEdge(now());\n }\n\n function debounced() {\n var time = now(),\n isInvoking = shouldInvoke(time);\n\n lastArgs = arguments;\n lastThis = this;\n lastCallTime = time;\n\n if (isInvoking) {\n if (timerId === undefined) {\n return leadingEdge(lastCallTime);\n }\n if (maxing) {\n // Handle invocations in a tight loop.\n clearTimeout(timerId);\n timerId = setTimeout(timerExpired, wait);\n return invokeFunc(lastCallTime);\n }\n }\n if (timerId === undefined) {\n timerId = setTimeout(timerExpired, wait);\n }\n return result;\n }\n debounced.cancel = cancel;\n debounced.flush = flush;\n return debounced;\n}\n\nmodule.exports = debounce;\n","var debounce = require('./debounce'),\n isObject = require('./isObject');\n\n/** Error message constants. */\nvar FUNC_ERROR_TEXT = 'Expected a function';\n\n/**\n * Creates a throttled function that only invokes `func` at most once per\n * every `wait` milliseconds. The throttled function comes with a `cancel`\n * method to cancel delayed `func` invocations and a `flush` method to\n * immediately invoke them. Provide `options` to indicate whether `func`\n * should be invoked on the leading and/or trailing edge of the `wait`\n * timeout. The `func` is invoked with the last arguments provided to the\n * throttled function. Subsequent calls to the throttled function return the\n * result of the last `func` invocation.\n *\n * **Note:** If `leading` and `trailing` options are `true`, `func` is\n * invoked on the trailing edge of the timeout only if the throttled function\n * is invoked more than once during the `wait` timeout.\n *\n * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred\n * until to the next tick, similar to `setTimeout` with a timeout of `0`.\n *\n * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)\n * for details over the differences between `_.throttle` and `_.debounce`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Function\n * @param {Function} func The function to throttle.\n * @param {number} [wait=0] The number of milliseconds to throttle invocations to.\n * @param {Object} [options={}] The options object.\n * @param {boolean} [options.leading=true]\n * Specify invoking on the leading edge of the timeout.\n * @param {boolean} [options.trailing=true]\n * Specify invoking on the trailing edge of the timeout.\n * @returns {Function} Returns the new throttled function.\n * @example\n *\n * // Avoid excessively updating the position while scrolling.\n * jQuery(window).on('scroll', _.throttle(updatePosition, 100));\n *\n * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.\n * var throttled = _.throttle(renewToken, 300000, { 'trailing': false });\n * jQuery(element).on('click', throttled);\n *\n * // Cancel the trailing throttled invocation.\n * jQuery(window).on('popstate', throttled.cancel);\n */\nfunction throttle(func, wait, options) {\n var leading = true,\n trailing = true;\n\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n if (isObject(options)) {\n leading = 'leading' in options ? !!options.leading : leading;\n trailing = 'trailing' in options ? !!options.trailing : trailing;\n }\n return debounce(func, wait, {\n 'leading': leading,\n 'maxWait': wait,\n 'trailing': trailing\n });\n}\n\nmodule.exports = throttle;\n","import throttle from \"lodash/throttle\";\n\nexport class MasonryLayout {\n\tprivate mutationObserver: MutationObserver;\n\tprivate resizeObserver: ResizeObserver;\n\n\tconstructor(private grid: Element) {\n\t\tthis.mutationObserver = new MutationObserver(this.onContainerMutation);\n\t\tthis.resizeObserver = new ResizeObserver(this.onChildrenResize);\n\n\t\tif (CSS.supports(\"grid-template-rows\", \"masonry\") === false) {\n\t\t\tthis.create();\n\t\t}\n\t}\n\n\tprivate create = () => {\n\t\tthis.mutationObserver.observe(this.grid, {\n\t\t\tchildList: true,\n\t\t});\n\n\t\tfor (const item of Array.from(this.grid.children)){\n\t\t\tthis.resizeObserver.observe(item);\n\t\t};\n\t};\n\n\tprivate onContainerMutation = (mutations: MutationRecord[]) => {\n\t\tconst removedNodes = mutations.flatMap((mutation) =>\n\t\t\tArray.from(mutation.removedNodes),\n\t\t);\n\t\tconst addedNodes = mutations.flatMap((mutation) =>\n\t\t\tArray.from(mutation.addedNodes),\n\t\t);\n\n\t\tfor (const node of removedNodes) {\n\t\t\tif (node instanceof Element) {\n\t\t\t\tthis.resizeObserver.unobserve(node);\n\t\t\t}\n\t\t}\n\n\t\tfor (const node of addedNodes) {\n\t\t\tif (node instanceof Element) {\n\t\t\t\tthis.resizeObserver.observe(node);\n\t\t\t}\n\t\t}\n\n\t\tif (removedNodes.length > 0 && addedNodes.length === 0) {\n\t\t\tthis.update();\n\t\t}\n\t};\n\n\tprivate onChildrenResize = (entries: ResizeObserverEntry[]) => {\n\t\tconst entriesToUpdate = entries.filter(\n\t\t\t(entry) => entry.target.parentElement !== null,\n\t\t);\n\n\t\tif (entriesToUpdate.length > 0) {\n\t\t\tthis.update();\n\t\t}\n\t};\n\n\tupdate = throttle(() => {\n\t\tconst computedStyle = window.getComputedStyle(this.grid);\n\n\t\tif (computedStyle.getPropertyValue(\"display\").includes(\"grid\") === false) {\n\t\t\tthis.clean();\n\t\t\treturn;\n\t\t}\n\n\t\tconst columns = parseGridTemplateColumns(this.grid);\n\n\t\tif (columns.length <= 1) {\n\t\t\tthis.clean();\n\n\t\t\treturn;\n\t\t}\n\n\t\tconst rowGap =\n\t\t\tNumber.parseFloat(computedStyle.getPropertyValue(\"row-gap\").trim()) || 0;\n\n\t\tconst items = Array.from(this.grid.children) as HTMLElement[];\n\n\t\tfor (let columnIndex = 0; columnIndex < columns.length; columnIndex++) {\n\t\t\tconst firstItemInColumn = items[columnIndex];\n\n\t\t\tfirstItemInColumn?.style.removeProperty(\"margin-top\");\n\t\t}\n\n\t\tfor (let index = 0; index < items.length; index++) {\n\t\t\tconst prevItem = items[index - columns.length];\n\t\t\tconst nextItem = items[index];\n\n\t\t\tif (prevItem !== undefined && nextItem !== undefined) {\n\t\t\t\tconst prevBottom = prevItem.getBoundingClientRect().bottom;\n\n\t\t\t\tnextItem.style.removeProperty(\"margin-top\");\n\n\t\t\t\tconst nextTop = nextItem.getBoundingClientRect().top;\n\n\t\t\t\tif (nextTop - rowGap !== prevBottom) {\n\t\t\t\t\tconst margin =\n\t\t\t\t\t\tMath.round(\n\t\t\t\t\t\t\t(prevBottom - (nextTop - rowGap) + Number.EPSILON) * 100,\n\t\t\t\t\t\t) / 100;\n\n\t\t\t\t\tnextItem.style.setProperty(\"margin-top\", `${margin}px`);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}, 32);\n\n\tdestroy = () => {\n\t\tthis.resizeObserver.disconnect();\n\t\tthis.mutationObserver.disconnect();\n\t\tthis.clean();\n\t};\n\n\tprivate clean = () => {\n\t\tfor ( const item of (Array.from(this.grid.children) as HTMLElement[])){\n\t\t\titem.style.removeProperty(\"margin-top\");\n\t\t}\n\t};\n\n\t[Symbol.dispose]() {\n\t\tthis.destroy();\n\t}\n}\n\nfunction parseGridTemplateColumns(grid: Element) {\n\tconst computedStyle = window.getComputedStyle(grid);\n\n\tconst gridTemplateColumns = computedStyle.getPropertyValue(\n\t\t\"grid-template-columns\",\n\t);\n\n\treturn gridTemplateColumns\n\t\t.trim()\n\t\t.split(/\\s+(?=(?:[^()]*\\([^()]*\\))*[^()]*$)/);\n}",":host {\n display: block;\n}","import { Component, State, Element, h } from '@stencil/core';\nimport type { Review } from '../salla-review-card/interfaces';\nimport type { Pagination } from '../../interfaces/common';\nimport ShoppingBag from '../../assets/svg/shopping-bag.svg';\nimport Helper from '../../Helpers/Helper';\nimport { MasonryLayout } from '../../Helpers/masonry-layout';\n\n\n@Component({\n tag: 'salla-reviews-page',\n styleUrl: 'salla-reviews-page.css',\n})\nexport class SallaReviewsPage {\n @Element() el: HTMLElement;\n @State() reviews: Partial<Review>[] = [];\n @State() isLoading = false;\n @State() pagination: Pagination = null;\n @State() sort: \"top_rating\" | \"bottom_rating\" | \"latest\" | \"oldest\" = \"latest\";\n\n // Language variables\n private langTitlesReviews: string;\n private langRatingReviews: string;\n private langSorting: string;\n private langSortByTopRating: string;\n private langSortByMostRecent: string;\n private langSortByLeastRecent: string;\n private langSortByLeastRated: string;\n\n private langLoadMore: string;\n private placeholderText: string;\n\n private infiniteScroll: any;\n private wrapper: HTMLElement;\n\n private getUrlParams() {\n const params = new URLSearchParams(window.location.search);\n return {\n sort: params.get('sort') as typeof this.sort || null,\n page: Number.parseInt(params.get('page')) || 1\n };\n }\n\n private updateUrlParams(params: { sort?: string, page?: number }) {\n const url = new URL(window.location.href);\n for (const [key, value] of Object.entries(params)) {\n if (value) {\n url.searchParams.set(key, value.toString());\n } else {\n url.searchParams.delete(key);\n }\n };\n window.history.replaceState({}, '', url.toString());\n }\n\n private fetchReviews(sort?: typeof this.sort, page?: number) {\n const urlParams = this.getUrlParams();\n return salla.api.request('reviews', {\n params: {\n type: 'products',\n format: 'lite',\n per_page: 8,\n page: page || urlParams.page || 1,\n sort: sort || urlParams.sort || null\n }\n });\n }\n\n\n private async initializeMasonry() {\n const grid = this.el.querySelector('.s-reviews-page-grid');\n if (!grid) return;\n\n try {\n new MasonryLayout(grid);\n salla.logger.info('Masonry initialized successfully');\n } catch (error) {\n salla.logger.error('Masonry initialization failed:', error);\n }\n }\n private animateReviewCards() {\n const items = this.wrapper.querySelectorAll('salla-review-card:not(.animated)');\n Helper.animateItems(items);\n }\n\n private initiateInfiniteScroll() {\n if (!this.wrapper) {\n salla.logger.error('Wrapper is undefined. Cannot initiate infinite scroll.');\n return;\n }\n\n this.infiniteScroll = salla.infiniteScroll.initiate(this.wrapper, this.wrapper, {\n path: () => this.pagination?.links?.next || null,\n history: false,\n scrollThreshold: false,\n }, true);\n\n this.infiniteScroll?.on('request', () => {\n this.isLoading = true;\n });\n\n this.infiniteScroll?.on('load', response => {\n this.pagination = response.pagination;\n this.reviews = [...this.reviews, ...response.data]\n this.isLoading = false;\n // Update URL with the current page\n this.updateUrlParams({ page: response.pagination.current_page });\n\n });\n\n this.infiniteScroll?.on('error', (e) => {\n salla.logger.error('Error loading more reviews:', e);\n this.isLoading = false;\n });\n }\n\n\n componentDidRender() {\n setTimeout(() => {\n requestAnimationFrame(this.animateReviewCards.bind(this))\n }, 176)\n }\n\n async componentWillLoad() {\n try {\n await salla.onReady();\n\n // Initialize language variables\n this.langTitlesReviews = salla.lang.get(\"common.titles.reviews\");\n this.langSorting = salla.lang.get('pages.categories.sorting');\n this.placeholderText = salla.lang.choice(\"pages.rating.reviews\", 0)\n this.langLoadMore = salla.lang.get('common.elements.load_more');\n this.langSortByTopRating = salla.lang.get('pages.testimonials.sort_by_rating_desc');\n this.langSortByMostRecent = salla.lang.get('pages.testimonials.sort_by_date_desc');\n this.langSortByLeastRated = salla.lang.get('pages.testimonials.sort_by_rating_asc');\n this.langSortByLeastRecent = salla.lang.get('pages.testimonials.sort_by_date_asc');\n\n const urlParams = this.getUrlParams();\n const response = await this.fetchReviews(urlParams.sort);\n this.sort = urlParams.sort;\n this.reviews = response.data\n this.pagination = response.pagination;\n this.langRatingReviews = salla.lang.choice(\"pages.rating.reviews\", this.pagination?.total);\n\n\n\n } catch (error) {\n salla.logger.error('Error loading reviews:', error);\n }\n }\n\n private async handleSorting(e: Event) {\n const value = (e.target as HTMLSelectElement).value as typeof this.sort;\n this.sort = value;\n this.updateUrlParams({ sort: value, page: 1 }); // Reset to page 1 when changing sort\n const response = await this.fetchReviews(value, 1);\n this.reviews = response.data\n this.pagination = response.pagination;\n }\n\n async componentDidLoad() {\n await this.initializeMasonry();\n this.initiateInfiniteScroll();\n this.sort = this.getUrlParams().sort || \"latest\";\n this.updateUrlParams({ sort: this.sort, page: 1 });\n }\n\n disconnectedCallback() {\n if (this.infiniteScroll) {\n this.infiniteScroll.destroy();\n }\n }\n\n private renderSortingOptions() {\n const options = [\n { value: 'latest', label: this.langSortByMostRecent },\n { value: 'oldest', label: this.langSortByLeastRecent },\n { value: 'top_rating', label: this.langSortByTopRating },\n { value: 'bottom_rating', label: this.langSortByLeastRated },\n ];\n return options.map(option => (\n <option key={option.value} value={option.value} selected={option.value === this.sort}>\n {option.label}\n </option>\n ));\n }\n\n\n render() {\n return (\n <host>\n <div class=\"s-reviews-page-header-wrapper\">\n <h2 class=\"s-reviews-page-title\">{this.langTitlesReviews}<span class=\"s-reviews-page-count\">({this.langRatingReviews})</span></h2>\n <div class=\"s-reviews-page-filter-wrapper\">\n <label class=\"s-reviews-page-filter-label\"\n htmlFor=\"testimonials-filter\">{this.langSorting}</label>\n <select onChange={(e) => this.handleSorting(e)} disabled={!this.reviews.length} class=\"s-reviews-page-filter\">\n {this.renderSortingOptions()}\n </select>\n </div>\n </div>\n {this.reviews.length ? <main class=\"s-reviews-page-grid\" ref={el => {\n this.wrapper = el\n }}>\n {this.reviews.map(review => (\n <salla-review-card\n key={review.id}\n review={review}\n />\n ))}\n </main>\n : <div class=\"s-products-list-placeholder\">\n <span innerHTML={ShoppingBag} />\n <p>{this.placeholderText}</p>\n </div>\n }\n {this.pagination?.links?.next && this.reviews.length ? (\n\n <div class=\"s-reviews-page-load-more-container\">\n <salla-button class=\"s-reviews-page-load-more-btn\" loading={this.isLoading} onClick={() => this.infiniteScroll?.loadNextPage()}\n onKeyUp={() => this.infiniteScroll?.loadNextPage()}>\n {this.langLoadMore}\n </salla-button>\n </div>\n ) : null}\n </host>\n );\n }\n}"],"names":["require$$0","require$$1","require$$2"],"mappings":";;;;;;;;;;;;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AAA,CAAA,IAAI,KAAI,IAAI,CAAC,OAAO,CAAC,MAAM,IAElD,CAAA,CAAA,KAAA,EAAA,EAAK,KAAK,EAAC,oCAAoC,EAAA,EAC7C,CAAc,CAAA,cAAA,EAAA,EAAA,KAAK,EAAC,8BAA8B,EAAC,OAAO,EAAE,IAAI,CAAC,SAAS,EAAE,OAAO,EAAE,MAAK,EAAA,IAAA,EAAA,CAAA,CAAC,OAAA,CAAA,EAAA,GAAA,IAAI,CAAC,cAAc,MAAA,IAAA,IAAA,EAAA,KAAA,MAAA,GAAA,MAAA,GAAA,EAAA,CAAE,YAAY,EAAE,CAAA,EAAA,EAC5H,OAAO,EAAE,QAAM,IAAA,EAAA,CAAA,CAAA,OAAA,CAAA,EAAA,GAAA,IAAI,CAAC,cAAc,MAAA,IAAA,IAAA,EAAA,KAAA,MAAA,GAAA,MAAA,GAAA,EAAA,CAAE,YAAY,EAAE,CAAA,EAAA,IACjD,IAAI,CAAC,YAAY,CACL,CACX,IACJ,IAAI,CACH;;;;;;;;;;;;","x_google_ignoreList":[0,1,2,3,4,5]}
1
+ {"version":3,"file":"p-DuXM8liP.system.js","sources":["../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/now.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_trimmedEndIndex.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseTrim.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/toNumber.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/debounce.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/throttle.js","src/Helpers/masonry-layout.ts","src/components/salla-reviews-page/salla-reviews-page.css?tag=salla-reviews-page","src/components/salla-reviews-page/salla-reviews-page.tsx"],"sourcesContent":["var root = require('./_root');\n\n/**\n * Gets the timestamp of the number of milliseconds that have elapsed since\n * the Unix epoch (1 January 1970 00:00:00 UTC).\n *\n * @static\n * @memberOf _\n * @since 2.4.0\n * @category Date\n * @returns {number} Returns the timestamp.\n * @example\n *\n * _.defer(function(stamp) {\n * console.log(_.now() - stamp);\n * }, _.now());\n * // => Logs the number of milliseconds it took for the deferred invocation.\n */\nvar now = function() {\n return root.Date.now();\n};\n\nmodule.exports = now;\n","/** Used to match a single whitespace character. */\nvar reWhitespace = /\\s/;\n\n/**\n * Used by `_.trim` and `_.trimEnd` to get the index of the last non-whitespace\n * character of `string`.\n *\n * @private\n * @param {string} string The string to inspect.\n * @returns {number} Returns the index of the last non-whitespace character.\n */\nfunction trimmedEndIndex(string) {\n var index = string.length;\n\n while (index-- && reWhitespace.test(string.charAt(index))) {}\n return index;\n}\n\nmodule.exports = trimmedEndIndex;\n","var trimmedEndIndex = require('./_trimmedEndIndex');\n\n/** Used to match leading whitespace. */\nvar reTrimStart = /^\\s+/;\n\n/**\n * The base implementation of `_.trim`.\n *\n * @private\n * @param {string} string The string to trim.\n * @returns {string} Returns the trimmed string.\n */\nfunction baseTrim(string) {\n return string\n ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, '')\n : string;\n}\n\nmodule.exports = baseTrim;\n","var baseTrim = require('./_baseTrim'),\n isObject = require('./isObject'),\n isSymbol = require('./isSymbol');\n\n/** Used as references for various `Number` constants. */\nvar NAN = 0 / 0;\n\n/** Used to detect bad signed hexadecimal string values. */\nvar reIsBadHex = /^[-+]0x[0-9a-f]+$/i;\n\n/** Used to detect binary string values. */\nvar reIsBinary = /^0b[01]+$/i;\n\n/** Used to detect octal string values. */\nvar reIsOctal = /^0o[0-7]+$/i;\n\n/** Built-in method references without a dependency on `root`. */\nvar freeParseInt = parseInt;\n\n/**\n * Converts `value` to a number.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to process.\n * @returns {number} Returns the number.\n * @example\n *\n * _.toNumber(3.2);\n * // => 3.2\n *\n * _.toNumber(Number.MIN_VALUE);\n * // => 5e-324\n *\n * _.toNumber(Infinity);\n * // => Infinity\n *\n * _.toNumber('3.2');\n * // => 3.2\n */\nfunction toNumber(value) {\n if (typeof value == 'number') {\n return value;\n }\n if (isSymbol(value)) {\n return NAN;\n }\n if (isObject(value)) {\n var other = typeof value.valueOf == 'function' ? value.valueOf() : value;\n value = isObject(other) ? (other + '') : other;\n }\n if (typeof value != 'string') {\n return value === 0 ? value : +value;\n }\n value = baseTrim(value);\n var isBinary = reIsBinary.test(value);\n return (isBinary || reIsOctal.test(value))\n ? freeParseInt(value.slice(2), isBinary ? 2 : 8)\n : (reIsBadHex.test(value) ? NAN : +value);\n}\n\nmodule.exports = toNumber;\n","var isObject = require('./isObject'),\n now = require('./now'),\n toNumber = require('./toNumber');\n\n/** Error message constants. */\nvar FUNC_ERROR_TEXT = 'Expected a function';\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeMax = Math.max,\n nativeMin = Math.min;\n\n/**\n * Creates a debounced function that delays invoking `func` until after `wait`\n * milliseconds have elapsed since the last time the debounced function was\n * invoked. The debounced function comes with a `cancel` method to cancel\n * delayed `func` invocations and a `flush` method to immediately invoke them.\n * Provide `options` to indicate whether `func` should be invoked on the\n * leading and/or trailing edge of the `wait` timeout. The `func` is invoked\n * with the last arguments provided to the debounced function. Subsequent\n * calls to the debounced function return the result of the last `func`\n * invocation.\n *\n * **Note:** If `leading` and `trailing` options are `true`, `func` is\n * invoked on the trailing edge of the timeout only if the debounced function\n * is invoked more than once during the `wait` timeout.\n *\n * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred\n * until to the next tick, similar to `setTimeout` with a timeout of `0`.\n *\n * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)\n * for details over the differences between `_.debounce` and `_.throttle`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Function\n * @param {Function} func The function to debounce.\n * @param {number} [wait=0] The number of milliseconds to delay.\n * @param {Object} [options={}] The options object.\n * @param {boolean} [options.leading=false]\n * Specify invoking on the leading edge of the timeout.\n * @param {number} [options.maxWait]\n * The maximum time `func` is allowed to be delayed before it's invoked.\n * @param {boolean} [options.trailing=true]\n * Specify invoking on the trailing edge of the timeout.\n * @returns {Function} Returns the new debounced function.\n * @example\n *\n * // Avoid costly calculations while the window size is in flux.\n * jQuery(window).on('resize', _.debounce(calculateLayout, 150));\n *\n * // Invoke `sendMail` when clicked, debouncing subsequent calls.\n * jQuery(element).on('click', _.debounce(sendMail, 300, {\n * 'leading': true,\n * 'trailing': false\n * }));\n *\n * // Ensure `batchLog` is invoked once after 1 second of debounced calls.\n * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });\n * var source = new EventSource('/stream');\n * jQuery(source).on('message', debounced);\n *\n * // Cancel the trailing debounced invocation.\n * jQuery(window).on('popstate', debounced.cancel);\n */\nfunction debounce(func, wait, options) {\n var lastArgs,\n lastThis,\n maxWait,\n result,\n timerId,\n lastCallTime,\n lastInvokeTime = 0,\n leading = false,\n maxing = false,\n trailing = true;\n\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n wait = toNumber(wait) || 0;\n if (isObject(options)) {\n leading = !!options.leading;\n maxing = 'maxWait' in options;\n maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;\n trailing = 'trailing' in options ? !!options.trailing : trailing;\n }\n\n function invokeFunc(time) {\n var args = lastArgs,\n thisArg = lastThis;\n\n lastArgs = lastThis = undefined;\n lastInvokeTime = time;\n result = func.apply(thisArg, args);\n return result;\n }\n\n function leadingEdge(time) {\n // Reset any `maxWait` timer.\n lastInvokeTime = time;\n // Start the timer for the trailing edge.\n timerId = setTimeout(timerExpired, wait);\n // Invoke the leading edge.\n return leading ? invokeFunc(time) : result;\n }\n\n function remainingWait(time) {\n var timeSinceLastCall = time - lastCallTime,\n timeSinceLastInvoke = time - lastInvokeTime,\n timeWaiting = wait - timeSinceLastCall;\n\n return maxing\n ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke)\n : timeWaiting;\n }\n\n function shouldInvoke(time) {\n var timeSinceLastCall = time - lastCallTime,\n timeSinceLastInvoke = time - lastInvokeTime;\n\n // Either this is the first call, activity has stopped and we're at the\n // trailing edge, the system time has gone backwards and we're treating\n // it as the trailing edge, or we've hit the `maxWait` limit.\n return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||\n (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));\n }\n\n function timerExpired() {\n var time = now();\n if (shouldInvoke(time)) {\n return trailingEdge(time);\n }\n // Restart the timer.\n timerId = setTimeout(timerExpired, remainingWait(time));\n }\n\n function trailingEdge(time) {\n timerId = undefined;\n\n // Only invoke if we have `lastArgs` which means `func` has been\n // debounced at least once.\n if (trailing && lastArgs) {\n return invokeFunc(time);\n }\n lastArgs = lastThis = undefined;\n return result;\n }\n\n function cancel() {\n if (timerId !== undefined) {\n clearTimeout(timerId);\n }\n lastInvokeTime = 0;\n lastArgs = lastCallTime = lastThis = timerId = undefined;\n }\n\n function flush() {\n return timerId === undefined ? result : trailingEdge(now());\n }\n\n function debounced() {\n var time = now(),\n isInvoking = shouldInvoke(time);\n\n lastArgs = arguments;\n lastThis = this;\n lastCallTime = time;\n\n if (isInvoking) {\n if (timerId === undefined) {\n return leadingEdge(lastCallTime);\n }\n if (maxing) {\n // Handle invocations in a tight loop.\n clearTimeout(timerId);\n timerId = setTimeout(timerExpired, wait);\n return invokeFunc(lastCallTime);\n }\n }\n if (timerId === undefined) {\n timerId = setTimeout(timerExpired, wait);\n }\n return result;\n }\n debounced.cancel = cancel;\n debounced.flush = flush;\n return debounced;\n}\n\nmodule.exports = debounce;\n","var debounce = require('./debounce'),\n isObject = require('./isObject');\n\n/** Error message constants. */\nvar FUNC_ERROR_TEXT = 'Expected a function';\n\n/**\n * Creates a throttled function that only invokes `func` at most once per\n * every `wait` milliseconds. The throttled function comes with a `cancel`\n * method to cancel delayed `func` invocations and a `flush` method to\n * immediately invoke them. Provide `options` to indicate whether `func`\n * should be invoked on the leading and/or trailing edge of the `wait`\n * timeout. The `func` is invoked with the last arguments provided to the\n * throttled function. Subsequent calls to the throttled function return the\n * result of the last `func` invocation.\n *\n * **Note:** If `leading` and `trailing` options are `true`, `func` is\n * invoked on the trailing edge of the timeout only if the throttled function\n * is invoked more than once during the `wait` timeout.\n *\n * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred\n * until to the next tick, similar to `setTimeout` with a timeout of `0`.\n *\n * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)\n * for details over the differences between `_.throttle` and `_.debounce`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Function\n * @param {Function} func The function to throttle.\n * @param {number} [wait=0] The number of milliseconds to throttle invocations to.\n * @param {Object} [options={}] The options object.\n * @param {boolean} [options.leading=true]\n * Specify invoking on the leading edge of the timeout.\n * @param {boolean} [options.trailing=true]\n * Specify invoking on the trailing edge of the timeout.\n * @returns {Function} Returns the new throttled function.\n * @example\n *\n * // Avoid excessively updating the position while scrolling.\n * jQuery(window).on('scroll', _.throttle(updatePosition, 100));\n *\n * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.\n * var throttled = _.throttle(renewToken, 300000, { 'trailing': false });\n * jQuery(element).on('click', throttled);\n *\n * // Cancel the trailing throttled invocation.\n * jQuery(window).on('popstate', throttled.cancel);\n */\nfunction throttle(func, wait, options) {\n var leading = true,\n trailing = true;\n\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n if (isObject(options)) {\n leading = 'leading' in options ? !!options.leading : leading;\n trailing = 'trailing' in options ? !!options.trailing : trailing;\n }\n return debounce(func, wait, {\n 'leading': leading,\n 'maxWait': wait,\n 'trailing': trailing\n });\n}\n\nmodule.exports = throttle;\n","import throttle from \"lodash/throttle\";\n\nexport class MasonryLayout {\n\tprivate mutationObserver: MutationObserver;\n\tprivate resizeObserver: ResizeObserver;\n\n\tconstructor(private grid: Element) {\n\t\tthis.mutationObserver = new MutationObserver(this.onContainerMutation);\n\t\tthis.resizeObserver = new ResizeObserver(this.onChildrenResize);\n\n\t\tif (CSS.supports(\"grid-template-rows\", \"masonry\") === false) {\n\t\t\tthis.create();\n\t\t}\n\t}\n\n\tprivate create = () => {\n\t\tthis.mutationObserver.observe(this.grid, {\n\t\t\tchildList: true,\n\t\t});\n\n\t\tfor (const item of Array.from(this.grid.children)){\n\t\t\tthis.resizeObserver.observe(item);\n\t\t};\n\t};\n\n\tprivate onContainerMutation = (mutations: MutationRecord[]) => {\n\t\tconst removedNodes = mutations.flatMap((mutation) =>\n\t\t\tArray.from(mutation.removedNodes),\n\t\t);\n\t\tconst addedNodes = mutations.flatMap((mutation) =>\n\t\t\tArray.from(mutation.addedNodes),\n\t\t);\n\n\t\tfor (const node of removedNodes) {\n\t\t\tif (node instanceof Element) {\n\t\t\t\tthis.resizeObserver.unobserve(node);\n\t\t\t}\n\t\t}\n\n\t\tfor (const node of addedNodes) {\n\t\t\tif (node instanceof Element) {\n\t\t\t\tthis.resizeObserver.observe(node);\n\t\t\t}\n\t\t}\n\n\t\tif (removedNodes.length > 0 && addedNodes.length === 0) {\n\t\t\tthis.update();\n\t\t}\n\t};\n\n\tprivate onChildrenResize = (entries: ResizeObserverEntry[]) => {\n\t\tconst entriesToUpdate = entries.filter(\n\t\t\t(entry) => entry.target.parentElement !== null,\n\t\t);\n\n\t\tif (entriesToUpdate.length > 0) {\n\t\t\tthis.update();\n\t\t}\n\t};\n\n\tupdate = throttle(() => {\n\t\tconst computedStyle = window.getComputedStyle(this.grid);\n\n\t\tif (computedStyle.getPropertyValue(\"display\").includes(\"grid\") === false) {\n\t\t\tthis.clean();\n\t\t\treturn;\n\t\t}\n\n\t\tconst columns = parseGridTemplateColumns(this.grid);\n\n\t\tif (columns.length <= 1) {\n\t\t\tthis.clean();\n\n\t\t\treturn;\n\t\t}\n\n\t\tconst rowGap =\n\t\t\tNumber.parseFloat(computedStyle.getPropertyValue(\"row-gap\").trim()) || 0;\n\n\t\tconst items = Array.from(this.grid.children) as HTMLElement[];\n\n\t\tfor (let columnIndex = 0; columnIndex < columns.length; columnIndex++) {\n\t\t\tconst firstItemInColumn = items[columnIndex];\n\n\t\t\tfirstItemInColumn?.style.removeProperty(\"margin-top\");\n\t\t}\n\n\t\tfor (let index = 0; index < items.length; index++) {\n\t\t\tconst prevItem = items[index - columns.length];\n\t\t\tconst nextItem = items[index];\n\n\t\t\tif (prevItem !== undefined && nextItem !== undefined) {\n\t\t\t\tconst prevBottom = prevItem.getBoundingClientRect().bottom;\n\n\t\t\t\tnextItem.style.removeProperty(\"margin-top\");\n\n\t\t\t\tconst nextTop = nextItem.getBoundingClientRect().top;\n\n\t\t\t\tif (nextTop - rowGap !== prevBottom) {\n\t\t\t\t\tconst margin =\n\t\t\t\t\t\tMath.round(\n\t\t\t\t\t\t\t(prevBottom - (nextTop - rowGap) + Number.EPSILON) * 100,\n\t\t\t\t\t\t) / 100;\n\n\t\t\t\t\tnextItem.style.setProperty(\"margin-top\", `${margin}px`);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}, 32);\n\n\tdestroy = () => {\n\t\tthis.resizeObserver.disconnect();\n\t\tthis.mutationObserver.disconnect();\n\t\tthis.clean();\n\t};\n\n\tprivate clean = () => {\n\t\tfor ( const item of (Array.from(this.grid.children) as HTMLElement[])){\n\t\t\titem.style.removeProperty(\"margin-top\");\n\t\t}\n\t};\n\n\t[Symbol.dispose]() {\n\t\tthis.destroy();\n\t}\n}\n\nfunction parseGridTemplateColumns(grid: Element) {\n\tconst computedStyle = window.getComputedStyle(grid);\n\n\tconst gridTemplateColumns = computedStyle.getPropertyValue(\n\t\t\"grid-template-columns\",\n\t);\n\n\treturn gridTemplateColumns\n\t\t.trim()\n\t\t.split(/\\s+(?=(?:[^()]*\\([^()]*\\))*[^()]*$)/);\n}",":host {\n display: block;\n}","import { Component, State, Element, h } from '@stencil/core';\nimport type { Review } from '../salla-review-card/interfaces';\nimport type { Pagination } from '../../interfaces/common';\nimport ShoppingBag from '../../assets/svg/shopping-bag.svg';\nimport Helper from '../../Helpers/Helper';\nimport { MasonryLayout } from '../../Helpers/masonry-layout';\n\n\n@Component({\n tag: 'salla-reviews-page',\n styleUrl: 'salla-reviews-page.css',\n})\nexport class SallaReviewsPage {\n @Element() el: HTMLElement;\n @State() reviews: Partial<Review>[] = [];\n @State() isLoading = false;\n @State() pagination: Pagination = null;\n @State() sort: \"top_rating\" | \"bottom_rating\" | \"latest\" | \"oldest\" = \"latest\";\n\n // Language variables\n private langTitlesReviews: string;\n private langRatingReviews: string;\n private langSorting: string;\n private langSortByTopRating: string;\n private langSortByMostRecent: string;\n private langSortByLeastRecent: string;\n private langSortByLeastRated: string;\n\n private langLoadMore: string;\n private placeholderText: string;\n\n private infiniteScroll: any;\n private wrapper: HTMLElement;\n\n private getUrlParams() {\n const params = new URLSearchParams(window.location.search);\n return {\n sort: params.get('sort') as typeof this.sort || null,\n page: Number.parseInt(params.get('page')) || 1\n };\n }\n\n private updateUrlParams(params: { sort?: string, page?: number }) {\n const url = new URL(window.location.href);\n for (const [key, value] of Object.entries(params)) {\n if (value) {\n url.searchParams.set(key, value.toString());\n } else {\n url.searchParams.delete(key);\n }\n };\n window.history.replaceState({}, '', url.toString());\n }\n\n private fetchReviews(sort?: typeof this.sort, page?: number) {\n const urlParams = this.getUrlParams();\n return salla.api.request('reviews', {\n params: {\n type: 'products',\n format: 'lite',\n per_page: 8,\n page: page || urlParams.page || 1,\n sort: sort || urlParams.sort || null\n }\n });\n }\n\n\n private async initializeMasonry() {\n const grid = this.el.querySelector('.s-reviews-page-grid');\n if (!grid) return;\n\n try {\n new MasonryLayout(grid);\n salla.logger.info('Masonry initialized successfully');\n } catch (error) {\n salla.logger.error('Masonry initialization failed:', error);\n }\n }\n private animateReviewCards() {\n const items = this.wrapper.querySelectorAll('salla-review-card:not(.animated)');\n Helper.animateItems(items);\n }\n\n private initiateInfiniteScroll() {\n if (!this.wrapper) {\n salla.logger.error('Wrapper is undefined. Cannot initiate infinite scroll.');\n return;\n }\n\n this.infiniteScroll = salla.infiniteScroll.initiate(this.wrapper, this.wrapper, {\n path: () => this.pagination?.links?.next || null,\n history: false,\n scrollThreshold: false,\n }, true);\n\n this.infiniteScroll?.on('request', () => {\n this.isLoading = true;\n });\n\n this.infiniteScroll?.on('load', response => {\n this.pagination = response.pagination;\n this.reviews = [...this.reviews, ...response.data]\n this.isLoading = false;\n // Update URL with the current page\n this.updateUrlParams({ page: response.pagination.current_page });\n\n });\n\n this.infiniteScroll?.on('error', (e) => {\n salla.logger.error('Error loading more reviews:', e);\n this.isLoading = false;\n });\n }\n\n\n componentDidRender() {\n setTimeout(() => {\n requestAnimationFrame(this.animateReviewCards.bind(this))\n }, 176)\n }\n\n async componentWillLoad() {\n try {\n await salla.onReady();\n\n // Initialize language variables\n this.langTitlesReviews = salla.lang.get(\"common.titles.reviews\");\n this.langSorting = salla.lang.get('pages.categories.sorting');\n this.placeholderText = salla.lang.choice(\"pages.rating.reviews\", 0)\n this.langLoadMore = salla.lang.get('common.elements.load_more');\n this.langSortByTopRating = salla.lang.get('pages.testimonials.sort_by_rating_desc');\n this.langSortByMostRecent = salla.lang.get('pages.testimonials.sort_by_date_desc');\n this.langSortByLeastRated = salla.lang.get('pages.testimonials.sort_by_rating_asc');\n this.langSortByLeastRecent = salla.lang.get('pages.testimonials.sort_by_date_asc');\n\n const urlParams = this.getUrlParams();\n const response = await this.fetchReviews(urlParams.sort);\n this.sort = urlParams.sort;\n this.reviews = response.data\n this.pagination = response.pagination;\n this.langRatingReviews = salla.lang.choice(\"pages.rating.reviews\", this.pagination?.total);\n\n\n\n } catch (error) {\n salla.logger.error('Error loading reviews:', error);\n }\n }\n\n private async handleSorting(e: Event) {\n const value = (e.target as HTMLSelectElement).value as typeof this.sort;\n this.sort = value;\n this.updateUrlParams({ sort: value, page: 1 }); // Reset to page 1 when changing sort\n const response = await this.fetchReviews(value, 1);\n this.reviews = response.data\n this.pagination = response.pagination;\n }\n\n async componentDidLoad() {\n await this.initializeMasonry();\n this.initiateInfiniteScroll();\n this.sort = this.getUrlParams().sort || \"latest\";\n this.updateUrlParams({ sort: this.sort, page: 1 });\n }\n\n disconnectedCallback() {\n if (this.infiniteScroll) {\n this.infiniteScroll.destroy();\n }\n }\n\n private renderSortingOptions() {\n const options = [\n { value: 'latest', label: this.langSortByMostRecent },\n { value: 'oldest', label: this.langSortByLeastRecent },\n { value: 'top_rating', label: this.langSortByTopRating },\n { value: 'bottom_rating', label: this.langSortByLeastRated },\n ];\n return options.map(option => (\n <option key={option.value} value={option.value} selected={option.value === this.sort}>\n {option.label}\n </option>\n ));\n }\n\n\n render() {\n return (\n <host>\n <div class=\"s-reviews-page-header-wrapper\">\n <h2 class=\"s-reviews-page-title\">{this.langTitlesReviews}<span class=\"s-reviews-page-count\">({this.langRatingReviews})</span></h2>\n <div class=\"s-reviews-page-filter-wrapper\">\n <label class=\"s-reviews-page-filter-label\"\n htmlFor=\"testimonials-filter\">{this.langSorting}</label>\n <select onChange={(e) => this.handleSorting(e)} disabled={!this.reviews.length} class=\"s-reviews-page-filter\">\n {this.renderSortingOptions()}\n </select>\n </div>\n </div>\n {this.reviews.length ? <main class=\"s-reviews-page-grid\" ref={el => {\n this.wrapper = el\n }}>\n {this.reviews.map(review => (\n <salla-review-card\n key={review.id}\n review={review}\n />\n ))}\n </main>\n : <div class=\"s-products-list-placeholder\">\n <span innerHTML={ShoppingBag} />\n <p>{this.placeholderText}</p>\n </div>\n }\n {this.pagination?.links?.next && this.reviews.length ? (\n\n <div class=\"s-reviews-page-load-more-container\">\n <salla-button class=\"s-reviews-page-load-more-btn\" loading={this.isLoading} onClick={() => this.infiniteScroll?.loadNextPage()}\n onKeyUp={() => this.infiniteScroll?.loadNextPage()}>\n {this.langLoadMore}\n </salla-button>\n </div>\n ) : null}\n </host>\n );\n }\n}"],"names":["require$$0","require$$1","require$$2"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;OAAA,IAAI,IAAI,GAAGA,YAAkB,EAAA;;MAE7B;MACA;MACA;MACA;MACA;MACA;MACA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,EAAC,oCAAoC,EAAA,EAC7C,CAAc,CAAA,cAAA,EAAA,EAAA,KAAK,EAAC,8BAA8B,EAAC,OAAO,EAAE,IAAI,CAAC,SAAS,EAAE,OAAO,EAAE,MAAK,EAAA,IAAA,EAAA,CAAA,CAAC,OAAA,CAAA,EAAA,GAAA,IAAI,CAAC,cAAc,MAAA,IAAA,IAAA,EAAA,KAAA,MAAA,GAAA,MAAA,GAAA,EAAA,CAAE,YAAY,EAAE,CAAA,EAAA,EAC5H,OAAO,EAAE,QAAM,IAAA,EAAA,CAAA,CAAA,OAAA,CAAA,EAAA,GAAA,IAAI,CAAC,cAAc,MAAA,IAAA,IAAA,EAAA,KAAA,MAAA,GAAA,MAAA,GAAA,EAAA,CAAE,YAAY,EAAE,CAAA,EAAA,IACjD,IAAI,CAAC,YAAY,CACL,CACX,IACJ,IAAI,CACH;;;;;;;;;;;;","x_google_ignoreList":[0,1,2,3,4,5]}
@@ -1 +1 @@
1
- {"version":3,"file":"p-D5qlTBkb.system.js","sources":["src/components/salla-accordion/salla-accordion.scss?tag=salla-accordion","src/components/salla-accordion/salla-accordion.tsx"],"sourcesContent":["\n","import { Component, Host, h, Element, Prop, State, Listen } from '@stencil/core';\n\n/**\n * @salla/ui-components\n * The `salla-accordion` component represents an accordion element.\n * Use this component to encapsulate content within a collapsible section.\n */\n@Component({\n tag: 'salla-accordion',\n styleUrl: 'salla-accordion.scss',\n shadow: false\n})\nexport class SallaAccordion {\n /** Reference to the host element. */\n @Element() host: HTMLElement;\n\n /** Should the accordion be collapsible or not. Default is true. */\n @Prop() collapsible: boolean = true;\n\n /** Detect if accordion collapsed or not. */\n @Prop({ mutable: true, reflect: true }) collapsed: boolean = true;\n\n /** Represents the direction of the layout. */\n @State() dir: string = document.dir || 'rtl';\n\n @Listen('salla::language.change', { target: 'document' })\n directionChangedHandler(event: CustomEvent) {\n this.dir = event.detail.dir;\n }\n\n @Listen('accordionToggle')\n handleCollapse(event: CustomEvent) {\n this.collapsed = event.detail.payload.collapsed;\n }\n\n private setcollapsibleProp(): void {\n const head = this.host.querySelector('salla-accordion-head');\n if (this.collapsible && head) {\n head.setAttribute('collapsible', 'true');\n head.setAttribute('collapsed', this.collapsed.toString());\n }\n }\n\n componentDidRender() {\n this.setcollapsibleProp();\n\n const body = this.host.querySelector('salla-accordion-body');\n if (this.collapsible) {\n this.host.setAttribute('data-collapsed', this.collapsed.toString());\n body?.setAttribute('data-collapsed', this.collapsed.toString());\n }\n }\n\n render() {\n return (\n <Host class={`s-accordion-wrapper ${this.dir}`} data-collapsed={this.collapsed.toString()}>\n <slot></slot>\n </Host>\n );\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;YAAA,MAAM,iBAAiB,GAAG,EAAE;;kBCYf,cAAc,8BAAA,MAAA;YAL3B,IAAA,WAAA,CAAA,OAAA,EAAA;;;YAUU,QAAA,IAAW,CAAA,WAAA,GAAY,IAAI;;YAGK,QAAA,IAAS,CAAA,SAAA,GAAY,IAAI;;oBAGxD,IAAA,CAAA,GAAG,GAAW,QAAQ,CAAC,GAAG,IAAI,KAAK;YAqC7C;YAlCC,IAAA,uBAAuB,CAAC,KAAkB,EAAA;oBACxC,IAAI,CAAC,GAAG,GAAG,KAAK,CAAC,MAAM,CAAC,GAAG;;YAI7B,IAAA,cAAc,CAAC,KAAkB,EAAA;oBAC/B,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,SAAS;;gBAGzC,kBAAkB,GAAA;oBACxB,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,sBAAsB,CAAC;YAC5D,QAAA,IAAI,IAAI,CAAC,WAAW,IAAI,IAAI,EAAE;YAC5B,YAAA,IAAI,CAAC,YAAY,CAAC,aAAa,EAAE,MAAM,CAAC;YACxC,YAAA,IAAI,CAAC,YAAY,CAAC,WAAW,EAAE,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,CAAC;;;gBAI7D,kBAAkB,GAAA;oBAChB,IAAI,CAAC,kBAAkB,EAAE;oBAEzB,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,sBAAsB,CAAC;YAC5D,QAAA,IAAI,IAAI,CAAC,WAAW,EAAE;YACpB,YAAA,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,gBAAgB,EAAE,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,CAAC;YACnE,YAAA,IAAI,aAAJ,IAAI,KAAA,MAAA,GAAA,MAAA,GAAJ,IAAI,CAAE,YAAY,CAAC,gBAAgB,EAAE,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,CAAC;;;gBAInE,MAAM,GAAA;YACJ,QAAA,QACE,CAAC,CAAA,IAAI,EAAC,EAAA,GAAA,EAAA,0CAAA,EAAA,KAAK,EAAE,CAAuB,oBAAA,EAAA,IAAI,CAAC,GAAG,CAAA,CAAE,EAAkB,gBAAA,EAAA,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,EAAA,EACvF,CAAa,CAAA,MAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAA,CAAA,CACR;;;;;;;;;;;;"}
1
+ {"version":3,"file":"p-DvaxAP4E.system.js","sources":["src/components/salla-accordion/salla-accordion.scss?tag=salla-accordion","src/components/salla-accordion/salla-accordion.tsx"],"sourcesContent":["\n","import { Component, Host, h, Element, Prop, State, Listen } from '@stencil/core';\n\n/**\n * @salla/ui-components\n * The `salla-accordion` component represents an accordion element.\n * Use this component to encapsulate content within a collapsible section.\n */\n@Component({\n tag: 'salla-accordion',\n styleUrl: 'salla-accordion.scss',\n shadow: false\n})\nexport class SallaAccordion {\n /** Reference to the host element. */\n @Element() host: HTMLElement;\n\n /** Should the accordion be collapsible or not. Default is true. */\n @Prop() collapsible: boolean = true;\n\n /** Detect if accordion collapsed or not. */\n @Prop({ mutable: true, reflect: true }) collapsed: boolean = true;\n\n /** Represents the direction of the layout. */\n @State() dir: string = document.dir || 'rtl';\n\n @Listen('salla::language.change', { target: 'document' })\n directionChangedHandler(event: CustomEvent) {\n this.dir = event.detail.dir;\n }\n\n @Listen('accordionToggle')\n handleCollapse(event: CustomEvent) {\n this.collapsed = event.detail.payload.collapsed;\n }\n\n private setcollapsibleProp(): void {\n const head = this.host.querySelector('salla-accordion-head');\n if (this.collapsible && head) {\n head.setAttribute('collapsible', 'true');\n head.setAttribute('collapsed', this.collapsed.toString());\n }\n }\n\n componentDidRender() {\n this.setcollapsibleProp();\n\n const body = this.host.querySelector('salla-accordion-body');\n if (this.collapsible) {\n this.host.setAttribute('data-collapsed', this.collapsed.toString());\n body?.setAttribute('data-collapsed', this.collapsed.toString());\n }\n }\n\n render() {\n return (\n <Host class={`s-accordion-wrapper ${this.dir}`} data-collapsed={this.collapsed.toString()}>\n <slot></slot>\n </Host>\n );\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;YAAA,MAAM,iBAAiB,GAAG,EAAE;;kBCYf,cAAc,8BAAA,MAAA;YAL3B,IAAA,WAAA,CAAA,OAAA,EAAA;;;YAUU,QAAA,IAAW,CAAA,WAAA,GAAY,IAAI;;YAGK,QAAA,IAAS,CAAA,SAAA,GAAY,IAAI;;oBAGxD,IAAA,CAAA,GAAG,GAAW,QAAQ,CAAC,GAAG,IAAI,KAAK;YAqC7C;YAlCC,IAAA,uBAAuB,CAAC,KAAkB,EAAA;oBACxC,IAAI,CAAC,GAAG,GAAG,KAAK,CAAC,MAAM,CAAC,GAAG;;YAI7B,IAAA,cAAc,CAAC,KAAkB,EAAA;oBAC/B,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,SAAS;;gBAGzC,kBAAkB,GAAA;oBACxB,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,sBAAsB,CAAC;YAC5D,QAAA,IAAI,IAAI,CAAC,WAAW,IAAI,IAAI,EAAE;YAC5B,YAAA,IAAI,CAAC,YAAY,CAAC,aAAa,EAAE,MAAM,CAAC;YACxC,YAAA,IAAI,CAAC,YAAY,CAAC,WAAW,EAAE,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,CAAC;;;gBAI7D,kBAAkB,GAAA;oBAChB,IAAI,CAAC,kBAAkB,EAAE;oBAEzB,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,sBAAsB,CAAC;YAC5D,QAAA,IAAI,IAAI,CAAC,WAAW,EAAE;YACpB,YAAA,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,gBAAgB,EAAE,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,CAAC;YACnE,YAAA,IAAI,aAAJ,IAAI,KAAA,MAAA,GAAA,MAAA,GAAJ,IAAI,CAAE,YAAY,CAAC,gBAAgB,EAAE,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,CAAC;;;gBAInE,MAAM,GAAA;YACJ,QAAA,QACE,CAAC,CAAA,IAAI,EAAC,EAAA,GAAA,EAAA,0CAAA,EAAA,KAAK,EAAE,CAAuB,oBAAA,EAAA,IAAI,CAAC,GAAG,CAAA,CAAE,EAAkB,gBAAA,EAAA,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,EAAA,EACvF,CAAa,CAAA,MAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAA,CAAA,CACR;;;;;;;;;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"p-D66T0o_K.system.js","sources":["src/components/salla-conditional-offer/interfaces.ts","src/components/salla-conditional-offer/salla-conditional-offer.scss?tag=salla-conditional-offer","src/components/salla-conditional-offer/salla-conditional-offer.tsx"],"sourcesContent":["import type { Product } from \"@salla.sa/twilight/types/common\";\n\nexport enum DiscountType {\n PERCENTAGE = \"percentage\",\n FIXED = \"fixed\",\n FREE_PRODUCT = \"free_product\",\n}\n\nexport enum OfferType {\n PRODUCT_COUNT = \"products_count\",\n PRODUCT_PURCHASE = \"order_amount\",\n}\n\nexport interface Discount {\n type?: DiscountType;\n value?: number;\n min_spend?: number;\n max_discount?: number;\n}\n\nexport interface OfferDetails {\n based_on?: OfferType;\n ends_at?: number;\n start_value?: number;\n end_value?: number;\n current_value?: number;\n discounts?: Discount[];\n}\n\nexport interface Offer {\n id?: number;\n type?: string;\n title?: string;\n description?: string;\n details?: OfferDetails | null;\n}\n\n\nexport interface ProductDetail {\n id?: number;\n sku?: string;\n name?: string;\n description?: string;\n url?: string;\n promotion_title?: null;\n subtitle?: null;\n type?: string;\n status?: string;\n price?: number;\n base_currency_price?: BaseCurrencyPrice;\n sale_price?: number;\n regular_price?: number;\n starting_price?: null;\n quantity?: null;\n max_quantity?: number;\n discount_ends?: null;\n is_taxable?: boolean;\n has_read_more?: boolean;\n can_add_note?: boolean;\n can_show_remained_quantity?: boolean;\n can_upload_file?: boolean;\n has_custom_form?: boolean;\n has_metadata?: boolean;\n is_on_sale?: boolean;\n is_hidden_quantity?: boolean;\n is_available?: boolean;\n is_out_of_stock?: boolean;\n is_require_shipping?: boolean;\n weight?: null;\n calories?: null;\n image?: Image;\n currency?: string;\n}\n\nexport interface BaseCurrencyPrice {\n currency?: string;\n amount?: number;\n}\n\nexport interface Image {\n url?: string;\n alt?: string;\n}\n\nexport interface UpdatedCart {\n items: Array<Product>;\n sub_total: number;\n}\n",":host {\n display: block;\n}","import { Component, Host, State, h } from \"@stencil/core\";\nimport {\n type Discount,\n DiscountType,\n type Offer,\n OfferType,\n type UpdatedCart,\n} from \"./interfaces\";\nimport type { Product } from \"@salla.sa/twilight/types/common\";\n\n@Component({\n tag: \"salla-conditional-offer\",\n styleUrl: \"salla-conditional-offer.scss\",\n})\nexport class SallaConditionalOffer {\n\n @State() offer: Offer = null;\n @State() products: Record<string, Pick<Product, 'image' | 'url'>> = {}\n @State() isLoading = true\n @State() canRender = true\n\n componentWillLoad() {\n salla.onReady().then(() => {\n if (!salla.config.get('store.features')?.includes('conditional-offer') || (salla.storage.get(\"cart\") !== '' && !salla.storage.get(\"cart\")?.summary?.count)) {\n throw new Error('feature or cart object does not existed');\n }\n })\n .then(() => salla.api.cart.offers())\n .then(({ data }: { data: Offer[] }) => {\n //it's okay if there is an exception here, all thens will be skipped, and will catch the error,\n this.offer = data.find(offer => offer.type === \"conditional\")\n\n if (!this.offer) {\n throw new Error('No conditional offer has been activated in the merchant dashboard');\n }\n\n this.offer.details.discounts.unshift(({ value: 0, min_spend: 0 }))\n return this.updateInitialOfferValue()\n }).then(() => this.getProducts()).then(() => salla.event.on(\"cart::updated\", (updatedCart: UpdatedCart) => this.updateOfferValues(updatedCart)))\n .catch(error => {\n this.canRender = false\n salla.logger.warn('salla-conditional-offer:: ', error)\n }).finally(() => {\n this.isLoading = false\n })\n\n }\n\n private getProducts() {\n const freeProductIDs = this.offer.details.discounts.filter(({ type }) => type === DiscountType.FREE_PRODUCT).map(({ value }) => value)\n if (freeProductIDs.length > 0) {\n return salla.product.fetch({ source: 'selected', source_value: freeProductIDs }).then(({ data }: { data: Array<Product> }) => {\n data.forEach(({ id, url, image }) => {\n this.products[id] = { url, image }\n })\n })\n }\n }\n\n private updateInitialOfferValue() {\n return salla.api.cart.details().then(({ data: { cart } }: { data: { cart: UpdatedCart } }) => this.updateOfferValues(cart))\n }\n\n private updateOfferValues({ items, sub_total }: UpdatedCart) {\n const current_value = this.offer.details.based_on === OfferType.PRODUCT_COUNT ? items.reduce((count: number, { quantity }) => count + quantity, 0,) : sub_total\n //we need to assign the offer object a new reference to trigger re-rendering\n this.offer = {\n ...this.offer, details: {\n ...this.offer?.details, current_value,\n }\n }\n return this.offer\n }\n\n private getCheckpointContent(discount: Discount) {\n\n if (discount.type === DiscountType.PERCENTAGE) return `${discount.value}%`\n\n if (discount.type === DiscountType.FIXED) return salla.money(discount.value)\n\n if (discount.type !== DiscountType.FREE_PRODUCT) {\n salla.logger.error(`salla-conditional-offer:: unexpected type (${discount.type})!`);\n return \"\";\n }\n\n const productItem = this.products[discount.value]\n\n if (!productItem) {\n salla.logger.error(`salla-conditional-offer:: there is no product with id (${discount.value})!`);\n return \"\";\n }\n\n return <a class=\"s-conditional-offer-product-link\" href={productItem.url} >\n <img\n class=\"s-conditional-offer-checkpoint-image-content\"\n loading=\"lazy\"\n decoding=\"async\"\n alt={productItem?.image?.alt || \"\"}\n src={productItem?.image?.url} />\n </a>\n }\n\n private getOfferType(discount: Discount): string {\n const basedOn = this.offer.details?.based_on;\n if (basedOn === OfferType.PRODUCT_COUNT) return salla.lang.choice(\"blocks.header.products_count\", discount.min_spend);\n if (basedOn === OfferType.PRODUCT_PURCHASE) return salla.money(discount.min_spend);\n\n salla.logger.warn(`salla-conditional-offer:: Unexpected offer detail's based_on value: ${basedOn}`);\n return `${discount.min_spend}`;\n }\n\n private clamp(value: number, min: number, max: number) {\n return Math.max(min, Math.min(value, max));\n }\n\n private mapValueRanges(value: number, initialMinRange: number, initialMaxRange: number, newMinRange: number, newMaxRange: number) {\n\n const newRange = ((value - initialMinRange) * (newMaxRange - newMinRange)) / (initialMaxRange - initialMinRange) + newMinRange;\n\n if (newRange === Number.POSITIVE_INFINITY) return 100\n\n if (newRange === Number.NEGATIVE_INFINITY) return 0\n\n return this.clamp(newRange, 0, 100)\n }\n\n private getCheckPointView(discount: Discount, index: number) {\n const checkpointIndex = this.offer.details.discounts.findIndex(({ min_spend }) => min_spend === discount.min_spend);\n const previousCheckpointValue = this.offer.details.discounts[checkpointIndex - 1]?.min_spend ?? 0;\n const progressPercentage = this.mapValueRanges(this.offer.details.current_value, previousCheckpointValue, discount.min_spend, 0, 100);\n const isActive = discount.min_spend <= this.offer.details.current_value;\n\n return (\n <div class=\"s-conditional-offer-checkpoint-container\">\n {index > 0 ? [\n <div key=\"progress-line\" class=\"s-conditional-offer-progress-line-container\">\n <div class=\"s-conditional-offer-progress-line-inactive\" />\n <div class=\"s-conditional-offer-progress-line-active\" style={{ width: `${progressPercentage}%` }} />\n </div>,\n <div key=\"checkpoint\" class={`s-conditional-offer-checkpoint ${isActive ? \"s-conditional-offer-active-checkpoint\" : \"\"}`} >\n <div class={`s-conditional-offer-item-avatar-content ${isActive ? \"active\" : \"\"}`} innerHTML={this.products && this.getCheckpointContent(discount)}>\n </div>\n <div class={`s-conditional-offer-checkpoint-label ${isActive ? \"active\" : \"\"}`} innerHTML={this.getOfferType(discount)} />\n\n </div>\n ] :\n <div key=\"label\" class={{ \"s-conditional-offer-checkpoint-label\": true, \"first-checkpoint\": index === 0, active: isActive }} innerHTML={this.getOfferType(discount)} />\n }\n </div>\n );\n }\n\n private getLoadingSkeletonView() {\n return <Host class=\"s-conditional-offer-container\" >\n <div class=\"s-conditional-offer-skeleton-inner-container\">\n <div class=\"s-conditional-offer-skeleton-subtitle\">\n <salla-skeleton height=\"16px\" width=\"30%\" />\n </div>\n\n <div class=\"s-conditional-offer-skeleton-subtitle\">\n <salla-skeleton height=\"16px\" width=\"35%\" />\n </div>\n <div class=\"s-conditional-offer-skeleton-checkpoints-wrapper\">\n {Array(3).fill(null).map(() => (\n [<salla-skeleton key=\"checkpoint-line\" height=\"8px\" />,\n <div key=\"checkpoint\">\n <salla-skeleton height=\"60px\" width=\"60px\" type=\"circle\" />\n </div>]\n ))}\n </div>\n\n </div>\n </Host>\n }\n\n render() {\n if (!this.canRender) return null\n if (this.isLoading) return this.getLoadingSkeletonView()\n\n return <Host class=\"s-conditional-offer-container\">\n <div class=\"s-conditional-offer-title-wrapper\">\n <div class=\"s-conditional-offer-title\">{this.offer.title}</div>\n {this.offer.description ? <div class=\"s-conditional-offer-subtitle\">\n {this.offer.description} <i class=\"sicon-information\" />\n </div> : null}\n </div>\n <div class=\"s-conditional-offer-progress-container\">\n {this.offer.details.discounts.map((discount, index) => (\n <div class={{ \"flex-1\": index > 0 }} key={discount.min_spend}>\n {this.getCheckPointView(discount, index)}\n </div>\n ))}\n </div>\n </Host>\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;YAEA,IAAY,YAIX;YAJD,CAAA,UAAY,YAAY,EAAA;YACpB,IAAA,YAAA,CAAA,YAAA,CAAA,GAAA,YAAyB;Y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EAAE,KAAK,CAAC,CACtC,CACT,CAAC,CACA,CACH;;;;;;;;;;;"}
1
+ {"version":3,"file":"p-DygvAhI4.system.js","sources":["src/components/salla-conditional-offer/interfaces.ts","src/components/salla-conditional-offer/salla-conditional-offer.scss?tag=salla-conditional-offer","src/components/salla-conditional-offer/salla-conditional-offer.tsx"],"sourcesContent":["import type { Product } from \"@salla.sa/twilight/types/common\";\n\nexport enum DiscountType {\n PERCENTAGE = \"percentage\",\n FIXED = \"fixed\",\n FREE_PRODUCT = \"free_product\",\n}\n\nexport enum OfferType {\n PRODUCT_COUNT = \"products_count\",\n PRODUCT_PURCHASE = \"order_amount\",\n}\n\nexport interface Discount {\n type?: DiscountType;\n value?: number;\n min_spend?: number;\n max_discount?: number;\n}\n\nexport interface OfferDetails {\n based_on?: OfferType;\n ends_at?: number;\n start_value?: number;\n end_value?: number;\n current_value?: number;\n discounts?: Discount[];\n}\n\nexport interface Offer {\n id?: number;\n type?: string;\n title?: string;\n description?: string;\n details?: OfferDetails | null;\n}\n\n\nexport interface ProductDetail {\n id?: number;\n sku?: string;\n name?: string;\n description?: string;\n url?: string;\n promotion_title?: null;\n subtitle?: null;\n type?: string;\n status?: string;\n price?: number;\n base_currency_price?: BaseCurrencyPrice;\n sale_price?: number;\n regular_price?: number;\n starting_price?: null;\n quantity?: null;\n max_quantity?: number;\n discount_ends?: null;\n is_taxable?: boolean;\n has_read_more?: boolean;\n can_add_note?: boolean;\n can_show_remained_quantity?: boolean;\n can_upload_file?: boolean;\n has_custom_form?: boolean;\n has_metadata?: boolean;\n is_on_sale?: boolean;\n is_hidden_quantity?: boolean;\n is_available?: boolean;\n is_out_of_stock?: boolean;\n is_require_shipping?: boolean;\n weight?: null;\n calories?: null;\n image?: Image;\n currency?: string;\n}\n\nexport interface BaseCurrencyPrice {\n currency?: string;\n amount?: number;\n}\n\nexport interface Image {\n url?: string;\n alt?: string;\n}\n\nexport interface UpdatedCart {\n items: Array<Product>;\n sub_total: number;\n}\n",":host {\n display: block;\n}","import { Component, Host, State, h } from \"@stencil/core\";\nimport {\n type Discount,\n DiscountType,\n type Offer,\n OfferType,\n type UpdatedCart,\n} from \"./interfaces\";\nimport type { Product } from \"@salla.sa/twilight/types/common\";\n\n@Component({\n tag: \"salla-conditional-offer\",\n styleUrl: \"salla-conditional-offer.scss\",\n})\nexport class SallaConditionalOffer {\n\n @State() offer: Offer = null;\n @State() products: Record<string, Pick<Product, 'image' | 'url'>> = {}\n @State() isLoading = true\n @State() canRender = true\n\n componentWillLoad() {\n salla.onReady().then(() => {\n if (!salla.config.get('store.features')?.includes('conditional-offer') || (salla.storage.get(\"cart\") !== '' && !salla.storage.get(\"cart\")?.summary?.count)) {\n throw new Error('feature or cart object does not existed');\n }\n })\n .then(() => salla.api.cart.offers())\n .then(({ data }: { data: Offer[] }) => {\n //it's okay if there is an exception here, all thens will be skipped, and will catch the error,\n this.offer = data.find(offer => offer.type === \"conditional\")\n\n if (!this.offer) {\n throw new Error('No conditional offer has been activated in the merchant dashboard');\n }\n\n this.offer.details.discounts.unshift(({ value: 0, min_spend: 0 }))\n return this.updateInitialOfferValue()\n }).then(() => this.getProducts()).then(() => salla.event.on(\"cart::updated\", (updatedCart: UpdatedCart) => this.updateOfferValues(updatedCart)))\n .catch(error => {\n this.canRender = false\n salla.logger.warn('salla-conditional-offer:: ', error)\n }).finally(() => {\n this.isLoading = false\n })\n\n }\n\n private getProducts() {\n const freeProductIDs = this.offer.details.discounts.filter(({ type }) => type === DiscountType.FREE_PRODUCT).map(({ value }) => value)\n if (freeProductIDs.length > 0) {\n return salla.product.fetch({ source: 'selected', source_value: freeProductIDs }).then(({ data }: { data: Array<Product> }) => {\n data.forEach(({ id, url, image }) => {\n this.products[id] = { url, image }\n })\n })\n }\n }\n\n private updateInitialOfferValue() {\n return salla.api.cart.details().then(({ data: { cart } }: { data: { cart: UpdatedCart } }) => this.updateOfferValues(cart))\n }\n\n private updateOfferValues({ items, sub_total }: UpdatedCart) {\n const current_value = this.offer.details.based_on === OfferType.PRODUCT_COUNT ? items.reduce((count: number, { quantity }) => count + quantity, 0,) : sub_total\n //we need to assign the offer object a new reference to trigger re-rendering\n this.offer = {\n ...this.offer, details: {\n ...this.offer?.details, current_value,\n }\n }\n return this.offer\n }\n\n private getCheckpointContent(discount: Discount) {\n\n if (discount.type === DiscountType.PERCENTAGE) return `${discount.value}%`\n\n if (discount.type === DiscountType.FIXED) return salla.money(discount.value)\n\n if (discount.type !== DiscountType.FREE_PRODUCT) {\n salla.logger.error(`salla-conditional-offer:: unexpected type (${discount.type})!`);\n return \"\";\n }\n\n const productItem = this.products[discount.value]\n\n if (!productItem) {\n salla.logger.error(`salla-conditional-offer:: there is no product with id (${discount.value})!`);\n return \"\";\n }\n\n return <a class=\"s-conditional-offer-product-link\" href={productItem.url} >\n <img\n class=\"s-conditional-offer-checkpoint-image-content\"\n loading=\"lazy\"\n decoding=\"async\"\n alt={productItem?.image?.alt || \"\"}\n src={productItem?.image?.url} />\n </a>\n }\n\n private getOfferType(discount: Discount): string {\n const basedOn = this.offer.details?.based_on;\n if (basedOn === OfferType.PRODUCT_COUNT) return salla.lang.choice(\"blocks.header.products_count\", discount.min_spend);\n if (basedOn === OfferType.PRODUCT_PURCHASE) return salla.money(discount.min_spend);\n\n salla.logger.warn(`salla-conditional-offer:: Unexpected offer detail's based_on value: ${basedOn}`);\n return `${discount.min_spend}`;\n }\n\n private clamp(value: number, min: number, max: number) {\n return Math.max(min, Math.min(value, max));\n }\n\n private mapValueRanges(value: number, initialMinRange: number, initialMaxRange: number, newMinRange: number, newMaxRange: number) {\n\n const newRange = ((value - initialMinRange) * (newMaxRange - newMinRange)) / (initialMaxRange - initialMinRange) + newMinRange;\n\n if (newRange === Number.POSITIVE_INFINITY) return 100\n\n if (newRange === Number.NEGATIVE_INFINITY) return 0\n\n return this.clamp(newRange, 0, 100)\n }\n\n private getCheckPointView(discount: Discount, index: number) {\n const checkpointIndex = this.offer.details.discounts.findIndex(({ min_spend }) => min_spend === discount.min_spend);\n const previousCheckpointValue = this.offer.details.discounts[checkpointIndex - 1]?.min_spend ?? 0;\n const progressPercentage = this.mapValueRanges(this.offer.details.current_value, previousCheckpointValue, discount.min_spend, 0, 100);\n const isActive = discount.min_spend <= this.offer.details.current_value;\n\n return (\n <div class=\"s-conditional-offer-checkpoint-container\">\n {index > 0 ? [\n <div key=\"progress-line\" class=\"s-conditional-offer-progress-line-container\">\n <div class=\"s-conditional-offer-progress-line-inactive\" />\n <div class=\"s-conditional-offer-progress-line-active\" style={{ width: `${progressPercentage}%` }} />\n </div>,\n <div key=\"checkpoint\" class={`s-conditional-offer-checkpoint ${isActive ? \"s-conditional-offer-active-checkpoint\" : \"\"}`} >\n <div class={`s-conditional-offer-item-avatar-content ${isActive ? \"active\" : \"\"}`} innerHTML={this.products && this.getCheckpointContent(discount)}>\n </div>\n <div class={`s-conditional-offer-checkpoint-label ${isActive ? \"active\" : \"\"}`} innerHTML={this.getOfferType(discount)} />\n\n </div>\n ] :\n <div key=\"label\" class={{ \"s-conditional-offer-checkpoint-label\": true, \"first-checkpoint\": index === 0, active: isActive }} innerHTML={this.getOfferType(discount)} />\n }\n </div>\n );\n }\n\n private getLoadingSkeletonView() {\n return <Host class=\"s-conditional-offer-container\" >\n <div class=\"s-conditional-offer-skeleton-inner-container\">\n <div class=\"s-conditional-offer-skeleton-subtitle\">\n <salla-skeleton height=\"16px\" width=\"30%\" />\n </div>\n\n <div class=\"s-conditional-offer-skeleton-subtitle\">\n <salla-skeleton height=\"16px\" width=\"35%\" />\n </div>\n <div class=\"s-conditional-offer-skeleton-checkpoints-wrapper\">\n {Array(3).fill(null).map(() => (\n [<salla-skeleton key=\"checkpoint-line\" height=\"8px\" />,\n <div key=\"checkpoint\">\n <salla-skeleton height=\"60px\" width=\"60px\" type=\"circle\" />\n </div>]\n ))}\n </div>\n\n </div>\n </Host>\n }\n\n render() {\n if (!this.canRender) return null\n if (this.isLoading) return this.getLoadingSkeletonView()\n\n return <Host class=\"s-conditional-offer-container\">\n <div class=\"s-conditional-offer-title-wrapper\">\n <div class=\"s-conditional-offer-title\">{this.offer.title}</div>\n {this.offer.description ? <div class=\"s-conditional-offer-subtitle\">\n {this.offer.description} <i class=\"sicon-information\" />\n </div> : null}\n </div>\n <div class=\"s-conditional-offer-progress-container\">\n {this.offer.details.discounts.map((discount, index) => (\n <div class={{ \"flex-1\": index > 0 }} key={discount.min_spend}>\n {this.getCheckPointView(discount, index)}\n </div>\n ))}\n </div>\n </Host>\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;YAEA,IAAY,YAIX;YAJD,CAAA,UAAY,YAAY,EAAA;YACpB,IAAA,YAAA,CAAA,YAAA,CAAA,GAAA,YAAyB;YACzB,IAAA,YAAA,CAAA,OAAA,CAAA,GAAA,OAAe;YACf,IAAA,YAAA,CAAA,cAAA,CAAA,GAAA,cAA6B;YACjC,CAAC,EAJW,YAAY,KAAZ,YAAY,GAIvB,EAAA,CAAA,CAAA;YAED,IAAY,SAGX;YAHD,CAAA,UAAY,SAAS,EAAA;YACjB,IAAA,SAAA,CAAA,eAAA,CAAA,GAAA,gBAAgC;YAChC,IAAA,SAAA,CAAA,kBAAA,CAAA,GAAA,cAAiC;YACrC,CAAC,EAHW,SAAS,KAAT,SAAS,GAGpB,EAAA,CAAA,CAAA;;YCXD,MAAM,wBAAwB,GAAG,sBAAsB;;kBCc1C,qBAAqB,sCAAA,MAAA;YAJlC,IAAA,WAAA,CAAA,OAAA,EAAA;;YAMa,QAAA,IAAK,CAAA,KAAA,GAAU,IAAI;YACnB,QAAA,IAAQ,CAAA,QAAA,GAAmD,EAAE;YAC7D,QAAA,IAAS,CAAA,SAAA,GAAG,IAAI;YAChB,QAAA,IAAS,CAAA,SAAA,GAAG,IAAI;YAgL5B;gBA9KG,iBAAiB,GAAA;YACb,QAAA,KAAK,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC,MAAK;;wBACtB,IAAI,EAAC,CAAA,EAAA,GAAA,KAAK,CAAC,MAAM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C,KAAK,CAAC,WAAW,OAAE,CAAG,CAAA,GAAA,EAAA,EAAA,KAAK,EAAC,mBAAmB,EAAA,CAAG,CACtD,GAAG,IAAI,CACX,EACN,CAAK,CAAA,KAAA,EAAA,EAAA,KAAK,EAAC,wCAAwC,EAC9C,EAAA,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,KAAK,MAC9C,CAAK,CAAA,KAAA,EAAA,EAAA,KAAK,EAAE,EAAE,QAAQ,EAAE,KAAK,GAAG,CAAC,EAAE,EAAE,GAAG,EAAE,QAAQ,CAAC,SAAS,EACvD,EAAA,IAAI,CAAC,iBAAiB,CAAC,QAAQ,EAAE,KAAK,CAAC,CACtC,CACT,CAAC,CACA,CACH;;;;;;;;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"p-BRVKF1oX.system.js","sources":["src/components/salla-order-summary/salla-order-summary.scss?tag=salla-order-summary","src/components/salla-order-summary/salla-order-summary.tsx"],"sourcesContent":[":host {\n display: block;\n}","import { Component, State, h, Prop } from '@stencil/core';\nimport { orderItem } from './interfaces';\n\nimport iconFileArchive from '../../assets/svg/file-archive.svg'\nimport iconDownload from '../../assets/svg/download.svg'\nimport iconCopy from '../../assets/svg/swap-stroke.svg'\nimport iconCheck from '../../assets/svg/check.svg'\nimport iconCreditCard from '../../assets/svg/debit-card-back.svg'\n\n@Component({\n tag: 'salla-order-summary',\n styleUrl: 'salla-order-summary.scss',\n})\nexport class SallaOrderSummary {\n\n copyCodeButtonTimeout: NodeJS.Timeout\n\n /**\n * The order ID to fetch items from\n */\n @Prop({ reflect: true }) orderId?: number;\n\n @State() codeCopied: string | null = null\n @State() noItemFound: boolean = true\n @State() order_items: orderItem[] = []\n\n private codes_text: string\n private copy_text: string\n private files_text: string\n private download_text: string\n\n private isDigitalCard = (item: orderItem) => item.product.type === 'codes'\n private isDigitalProduct = (item: orderItem) => item.product.type === 'digital'\n\n async componentWillLoad() {\n salla.lang.onLoaded(() => {\n this.codes_text = salla.lang.get('pages.thank_you.codes')\n this.copy_text = salla.lang.get('common.elements.copy')\n this.files_text = salla.lang.get('pages.thank_you.files')\n this.download_text = salla.lang.get('pages.thank_you.download')\n })\n return await this.getOrderItems()\n \n }\n\n private copyToClipboardHandler(code: string) {\n if (navigator && 'clipboard' in navigator) {\n try {\n navigator.clipboard.writeText(code).then(() => {\n this.codeCopied = code\n\n this.copyCodeButtonTimeout = setTimeout(() => {\n this.codeCopied = null\n }, 3000)\n\n })\n } catch (error) {\n salla.loggers.error('copy functionality is not supported by the browser')\n }\n }\n }\n\n private async getOrderItems() {\n\n const orderId = this.orderId || salla.config.get('page.id')\n const errorMessage = \"Failed to fetch order items\"\n\n if (!orderId) {\n salla.logger.error(errorMessage)\n throw new Error(errorMessage)\n }\n\n try {\n const { data: { items = [] } } = await salla.api.request(`orders/${orderId}`)\n\n const validItems = items.some((item) => (this.isDigitalCard(item) || this.isDigitalProduct(item)))\n\n if (validItems) {\n this.order_items = items\n this.noItemFound = false\n }\n } catch (error) {\n salla.logger.error(errorMessage)\n }\n }\n\n disconnectedCallback() {\n this.copyCodeButtonTimeout && clearTimeout(this.copyCodeButtonTimeout)\n }\n\n render() {\n return (\n\n <ul class=\"s-order-summary-wrapper\">\n {this.noItemFound ? <salla-placeholder alignment=\"center\">\n <span slot=\"title\" />\n </salla-placeholder> :\n this.order_items.map((item) => (\n this.isDigitalCard(item) ? (\n <li key={item.product.id} class=\"s-order-summary-item\">\n <h2 class=\"s-order-summary-item-title\">\n {this.codes_text} ({item.name})\n </h2>\n {item.codes.map((code) => (\n <div key={code.code} class=\"s-order-summary-code-item-wrapper\">\n <p>\n <span innerHTML={iconCreditCard} />\n <span>{code.code}</span>\n </p>\n <salla-button class={`s-order-summary-item-copy-button ${this.codeCopied === code.code ? 'copied' : ''}`} onClick={() => this.copyToClipboardHandler(code.code)} shape=\"link\">\n <span innerHTML={this.codeCopied === code.code ? iconCheck : iconCopy} />\n <span >{this.copy_text}</span>\n </salla-button >\n </div>\n ))}\n </li>\n ) :\n this.isDigitalProduct(item) ? (\n <li key={item.product.id} class=\"s-order-summary-item\">\n <h2 class=\"s-order-summary-item-title\">\n {this.files_text} ({item.name})\n </h2>\n <ul>\n {item.files.map((file) => (\n <li class=\"s-order-summary-digital-item-wrapper\">\n <div>\n <span innerHTML={iconFileArchive} />\n <span>{file.name}</span>\n </div>\n <a href={file.url} target=\"_blank\" class=\"s-order-summary-item-download\">\n <span innerHTML={iconDownload} />\n <span>{this.download_text}</span>\n </a>\n </li>\n ))}\n </ul>\n </li>\n ) : null\n ))\n }\n </ul>\n );\n }\n\n}\n\n\n"],"names":["iconCheck"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAAA,MAAM,oBAAoB,GAAG,sBAAsB;;YCatC,iBAAiB,kCAAA,MAAA;MAJ9B,IAAA,WAAA,CAAA,OAAA,EAAA;;MAaW,QAAA,IAAU,CAAA,UAAA,GAAkB,IAAI;MAChC,QAAA,IAAW,CAAA,WAAA,GAAY,IAAI;MAC3B,QAAA,IAAW,CAAA,WAAA,GAAgB,EAAE;MAO9B,QAAA,IAAA,CAAA,aAAa,GAAG,CAAC,IAAe,KAAK,IAAI,CAAC,OAAO,CAAC,IAAI,KAAK,OAAO;MAClE,QAAA,IAAA,CAAA,gBAAgB,GAAG,CAAC,IAAe,KAAK,IAAI,CAAC,OAAO,CAAC,IAAI,KAAK,SAAS;MAgHhF;MA9GC,IAAA,MAAM,iBAAiB,GAAA;MACrB,QAAA,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAK;kBACvB,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,uBAAuB,CAAC;kBACzD,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,sBAAsB,CAAC;kBACvD,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC,IAAI,CAAC,GAA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MAAM,EAAC,QAAQ,EAAC,KAAK,EAAC,+BAA+B,EAAA,EACtE,CAAM,CAAA,MAAA,EAAA,EAAA,SAAS,EAAE,YAAY,EAAI,CAAA,EACjC,CAAA,CAAA,MAAA,EAAA,IAAA,EAAO,IAAI,CAAC,aAAa,CAAQ,CAC/B,CACD,CACN,CAAC,CACC,CACF,IACH,IAAI,CACX,CAAC,CAED;;;;;;;;;;;"}
1
+ {"version":3,"file":"p-V-F3jS9L.system.js","sources":["src/components/salla-order-summary/salla-order-summary.scss?tag=salla-order-summary","src/components/salla-order-summary/salla-order-summary.tsx"],"sourcesContent":[":host {\n display: block;\n}","import { Component, State, h, Prop } from '@stencil/core';\nimport { orderItem } from './interfaces';\n\nimport iconFileArchive from '../../assets/svg/file-archive.svg'\nimport iconDownload from '../../assets/svg/download.svg'\nimport iconCopy from '../../assets/svg/swap-stroke.svg'\nimport iconCheck from '../../assets/svg/check.svg'\nimport iconCreditCard from '../../assets/svg/debit-card-back.svg'\n\n@Component({\n tag: 'salla-order-summary',\n styleUrl: 'salla-order-summary.scss',\n})\nexport class SallaOrderSummary {\n\n copyCodeButtonTimeout: NodeJS.Timeout\n\n /**\n * The order ID to fetch items from\n */\n @Prop({ reflect: true }) orderId?: number;\n\n @State() codeCopied: string | null = null\n @State() noItemFound: boolean = true\n @State() order_items: orderItem[] = []\n\n private codes_text: string\n private copy_text: string\n private files_text: string\n private download_text: string\n\n private isDigitalCard = (item: orderItem) => item.product.type === 'codes'\n private isDigitalProduct = (item: orderItem) => item.product.type === 'digital'\n\n async componentWillLoad() {\n salla.lang.onLoaded(() => {\n this.codes_text = salla.lang.get('pages.thank_you.codes')\n this.copy_text = salla.lang.get('common.elements.copy')\n this.files_text = salla.lang.get('pages.thank_you.files')\n this.download_text = salla.lang.get('pages.thank_you.download')\n })\n return await this.getOrderItems()\n \n }\n\n private copyToClipboardHandler(code: string) {\n if (navigator && 'clipboard' in navigator) {\n try {\n navigator.clipboard.writeText(code).then(() => {\n this.codeCopied = code\n\n this.copyCodeButtonTimeout = setTimeout(() => {\n this.codeCopied = null\n }, 3000)\n\n })\n } catch (error) {\n salla.loggers.error('copy functionality is not supported by the browser')\n }\n }\n }\n\n private async getOrderItems() {\n\n const orderId = this.orderId || salla.config.get('page.id')\n const errorMessage = \"Failed to fetch order items\"\n\n if (!orderId) {\n salla.logger.error(errorMessage)\n throw new Error(errorMessage)\n }\n\n try {\n const { data: { items = [] } } = await salla.api.request(`orders/${orderId}`)\n\n const validItems = items.some((item) => (this.isDigitalCard(item) || this.isDigitalProduct(item)))\n\n if (validItems) {\n this.order_items = items\n this.noItemFound = false\n }\n } catch (error) {\n salla.logger.error(errorMessage)\n }\n }\n\n disconnectedCallback() {\n this.copyCodeButtonTimeout && clearTimeout(this.copyCodeButtonTimeout)\n }\n\n render() {\n return (\n\n <ul class=\"s-order-summary-wrapper\">\n {this.noItemFound ? <salla-placeholder alignment=\"center\">\n <span slot=\"title\" />\n </salla-placeholder> :\n this.order_items.map((item) => (\n this.isDigitalCard(item) ? (\n <li key={item.product.id} class=\"s-order-summary-item\">\n <h2 class=\"s-order-summary-item-title\">\n {this.codes_text} ({item.name})\n </h2>\n {item.codes.map((code) => (\n <div key={code.code} class=\"s-order-summary-code-item-wrapper\">\n <p>\n <span innerHTML={iconCreditCard} />\n <span>{code.code}</span>\n </p>\n <salla-button class={`s-order-summary-item-copy-button ${this.codeCopied === code.code ? 'copied' : ''}`} onClick={() => this.copyToClipboardHandler(code.code)} shape=\"link\">\n <span innerHTML={this.codeCopied === code.code ? iconCheck : iconCopy} />\n <span >{this.copy_text}</span>\n </salla-button >\n </div>\n ))}\n </li>\n ) :\n this.isDigitalProduct(item) ? (\n <li key={item.product.id} class=\"s-order-summary-item\">\n <h2 class=\"s-order-summary-item-title\">\n {this.files_text} ({item.name})\n </h2>\n <ul>\n {item.files.map((file) => (\n <li class=\"s-order-summary-digital-item-wrapper\">\n <div>\n <span innerHTML={iconFileArchive} />\n <span>{file.name}</span>\n </div>\n <a href={file.url} target=\"_blank\" class=\"s-order-summary-item-download\">\n <span innerHTML={iconDownload} />\n <span>{this.download_text}</span>\n </a>\n </li>\n ))}\n </ul>\n </li>\n ) : null\n ))\n }\n </ul>\n );\n }\n\n}\n\n\n"],"names":["iconCheck"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAAA,MAAM,oBAAoB,GAAG,sBAAsB;;YCatC,iBAAiB,kCAAA,MAAA;MAJ9B,IAAA,WAAA,CAAA,OAAA,EAAA;;MAaW,QAAA,IAAU,CAAA,UAAA,GAAkB,IAAI;MAChC,QAAA,IAAW,CAAA,WAAA,GAAY,IAAI;MAC3B,QAAA,IAAW,CAAA,WAAA,GAAgB,EAAE;MAO9B,QAAA,IAAA,CAAA,aAAa,GAAG,CAAC,IAAe,KAAK,IAAI,CAAC,OAAO,CAAC,IAAI,KAAK,OAAO;MAClE,QAAA,IAAA,CAAA,gBAAgB,GAAG,CAAC,IAAe,KAAK,IAAI,CAAC,OAAO,CAAC,IAAI,KAAK,SAAS;MAgHhF;MA9GC,IAAA,MAAM,iBAAiB,GAAA;MACrB,QAAA,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAK;kBACvB,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,uBAAuB,CAAC;kBACzD,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,sBAAsB,CAAC;kBACvD,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,uBAAuB,CAAC;kBACzD,IAAI,CAAC,aAAa,GAAG,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,0BAA0B,CAAC;MACjE,SAAC,CAAC;MACF,QAAA,OAAO,MAAM,IAAI,CAAC,aAAa,EAAE;;MAI3B,IAAA,sBAAsB,CAAC,IAAY,EAAA;MACzC,QAAA,IAAI,SAAS,IAAI,WAAW,IAAI,SA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;"}
@@ -1 +1 @@
1
- {"version":3,"file":"p-CVCIt2lC.system.js","sources":["src/components/salla-metadata/salla-metadata.scss?tag=salla-metadata","src/components/salla-metadata/salla-metadata.tsx"],"sourcesContent":["","import { Component, Host, h, Element, Prop, State } from '@stencil/core';\nimport { Field, Specs } from './interfaces';\n\n@Component({\n tag: 'salla-metadata',\n styleUrl: 'salla-metadata.scss',\n})\nexport class SallaMetadata {\n constructor() {\n if (this.entityId) {\n try {\n this.entityId = Array.isArray(this.entityId)\n ? this.entityId\n : JSON.parse(this.entityId as string);\n return;\n } catch (e) {\n salla.log('Bad json passed via entityId prop');\n }\n }\n }\n\n @Element() host: HTMLElement;\n\n /**\n * The entity type.\n */\n @Prop() entity: string = 'product';\n\n /**\n * The id of the product/the endity to which the specs are going to be fetched for.\n */\n @Prop() entityId: number | number[] | string;\n\n @State() specs: Specs[] = [];\n @State() download: string = salla.lang.get('pages.thank_you.download');\n\n private getValue(field: Field) {\n if (field.type === 'file') {\n return `<a href=\"${field.value}\" class=\"text-primary\" target=\"_blank\"><span class=\"sicon-download\"></span> ${this.download}</a>`;\n }\n if (field.type === 'url') {\n return `<a href=\"${field.value}\" class=\"text-blue-700 underline\" target=\"_blank\">${field.value}</a>`; // classes will be moved to the utilities.json file\n }\n if (field.type === 'date') {\n const date = new Date(field.value);\n const day = String(date.getDate()).padStart(2, '0');\n const month = String(date.getMonth() + 1).padStart(2, '0'); // Months are 0-based\n const year = date.getFullYear();\n\n const formattedDate = `${day}/${month}/${year}`;\n\n return formattedDate;\n }\n return field.value;\n }\n\n async componentWillLoad() {\n await salla.onReady();\n\n if (!salla.config.get('store.features')?.includes('custom-fields')) {\n return salla.logger.error('feature custom-fields is not activated');\n }\n\n //todo:: remove `product.showNewUrls` after changing it from BE\n if (!this.entityId && (salla.url.is_page('product.single') || salla.url.is_page(\"product.showNewUrls\"))) {\n this.entityId = salla.config.get('page.id');\n }\n\n if (!this.entityId) {\n return salla.logger.error(\"can't render salla-metadata without enity-id prop!\");\n }\n\n await salla.lang.onLoaded();\n this.download = salla.lang.get('pages.thank_you.download');\n\n const response = await Salla.api.metadata.fetchValues(this.entity, this.entityId);\n this.specs = response.data[0]?.sections;\n }\n render() {\n if (!this.specs.length) {\n return;\n }\n return (\n <Host class=\"s-metadata-wrapper\">\n {this.specs.map((item: Specs) => {\n return (\n <div class=\"s-metadata-box\">\n <div class=\"s-metadata-box-header\">\n <i class=\"sicon-list\"></i>\n {item.name}\n </div>\n\n {item.fields.map((field: Field) => {\n return (\n <div class=\"s-metadata-row\">\n <p class=\"s-metadata-row-name\">{field.name}</p>\n <p class=\"s-metadata-row-value\" innerHTML={this.getValue(field) as any}></p>\n </div>\n );\n })}\n </div>\n );\n })}\n </Host>\n );\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;YAAA,MAAM,gBAAgB,GAAG,EAAE;;kBCOd,aAAa,6BAAA,MAAA;YACxB,IAAA,WAAA,CAAA,OAAA,EAAA;;YAeA;;YAEG;YACK,QAAA,IAAM,CAAA,MAAA,GAAW,SAAS;YAOzB,QAAA,IAAK,CAAA,KAAA,GAAY,EAAE;oBACnB,IAAQ,CAAA,QAAA,GAAW,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,0BAA0B,CAAC;YAzBpE,QAAA,IAAI,IAAI,CAAC,QAAQ,EAAE;YACjB,YAAA,IAAI;4BACF,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ;kCACvC,IAAI,CAAC;kCACL,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,QAAkB,CAAC;4BACvC;;wBACA,OAAO,CAAC,EAAE;YACV,gBAAA,KAAK,CAAC,GAAG,CAAC,mCAAmC,CAAC;;;YAGnD;YAiBO,IAAA,QAAQ,CAAC,KAAY,EAAA;YAC3B,QAAA,IAAI,KAAK,CAAC,IAAI,KAAK,MAAM,EAAE;wBACzB,OAAO,CAAA,SAAA,EAAY,KAAK,CAAC,KAAK,+EAA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,GAAA,EAAA,EAAG,KAAK,EAAC,qBAAqB,IAAE,KAAK,CAAC,IAAI,CAAK,EAC/C,CAAA,CAAA,GAAA,EAAA,EAAG,KAAK,EAAC,sBAAsB,EAAC,SAAS,EAAE,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAQ,EAAM,CAAA,CACxE;yBAET,CAAC,CACE;qBAET,CAAC,CACG;;;;;;;;;;;;"}
1
+ {"version":3,"file":"p-Vh3TFQnV.system.js","sources":["src/components/salla-metadata/salla-metadata.scss?tag=salla-metadata","src/components/salla-metadata/salla-metadata.tsx"],"sourcesContent":["","import { Component, Host, h, Element, Prop, State } from '@stencil/core';\nimport { Field, Specs } from './interfaces';\n\n@Component({\n tag: 'salla-metadata',\n styleUrl: 'salla-metadata.scss',\n})\nexport class SallaMetadata {\n constructor() {\n if (this.entityId) {\n try {\n this.entityId = Array.isArray(this.entityId)\n ? this.entityId\n : JSON.parse(this.entityId as string);\n return;\n } catch (e) {\n salla.log('Bad json passed via entityId prop');\n }\n }\n }\n\n @Element() host: HTMLElement;\n\n /**\n * The entity type.\n */\n @Prop() entity: string = 'product';\n\n /**\n * The id of the product/the endity to which the specs are going to be fetched for.\n */\n @Prop() entityId: number | number[] | string;\n\n @State() specs: Specs[] = [];\n @State() download: string = salla.lang.get('pages.thank_you.download');\n\n private getValue(field: Field) {\n if (field.type === 'file') {\n return `<a href=\"${field.value}\" class=\"text-primary\" target=\"_blank\"><span class=\"sicon-download\"></span> ${this.download}</a>`;\n }\n if (field.type === 'url') {\n return `<a href=\"${field.value}\" class=\"text-blue-700 underline\" target=\"_blank\">${field.value}</a>`; // classes will be moved to the utilities.json file\n }\n if (field.type === 'date') {\n const date = new Date(field.value);\n const day = String(date.getDate()).padStart(2, '0');\n const month = String(date.getMonth() + 1).padStart(2, '0'); // Months are 0-based\n const year = date.getFullYear();\n\n const formattedDate = `${day}/${month}/${year}`;\n\n return formattedDate;\n }\n return field.value;\n }\n\n async componentWillLoad() {\n await salla.onReady();\n\n if (!salla.config.get('store.features')?.includes('custom-fields')) {\n return salla.logger.error('feature custom-fields is not activated');\n }\n\n //todo:: remove `product.showNewUrls` after changing it from BE\n if (!this.entityId && (salla.url.is_page('product.single') || salla.url.is_page(\"product.showNewUrls\"))) {\n this.entityId = salla.config.get('page.id');\n }\n\n if (!this.entityId) {\n return salla.logger.error(\"can't render salla-metadata without enity-id prop!\");\n }\n\n await salla.lang.onLoaded();\n this.download = salla.lang.get('pages.thank_you.download');\n\n const response = await Salla.api.metadata.fetchValues(this.entity, this.entityId);\n this.specs = response.data[0]?.sections;\n }\n render() {\n if (!this.specs.length) {\n return;\n }\n return (\n <Host class=\"s-metadata-wrapper\">\n {this.specs.map((item: Specs) => {\n return (\n <div class=\"s-metadata-box\">\n <div class=\"s-metadata-box-header\">\n <i class=\"sicon-list\"></i>\n {item.name}\n </div>\n\n {item.fields.map((field: Field) => {\n return (\n <div class=\"s-metadata-row\">\n <p class=\"s-metadata-row-name\">{field.name}</p>\n <p class=\"s-metadata-row-value\" innerHTML={this.getValue(field) as any}></p>\n </div>\n );\n })}\n </div>\n );\n })}\n </Host>\n );\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;YAAA,MAAM,gBAAgB,GAAG,EAAE;;kBCOd,aAAa,6BAAA,MAAA;YACxB,IAAA,WAAA,CAAA,OAAA,EAAA;;YAeA;;YAEG;YACK,QAAA,IAAM,CAAA,MAAA,GAAW,SAAS;YAOzB,QAAA,IAAK,CAAA,KAAA,GAAY,EAAE;oBACnB,IAAQ,CAAA,QAAA,GAAW,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,0BAA0B,CAAC;YAzBpE,QAAA,IAAI,IAAI,CAAC,QAAQ,EAAE;YACjB,YAAA,IAAI;4BACF,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ;kCACvC,IAAI,CAAC;kCACL,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,QAAkB,CAAC;4BACv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,CAAG,CAAA,GAAA,EAAA,EAAA,KAAK,EAAC,YAAY,EAAK,CAAA,EACzB,IAAI,CAAC,IAAI,CACN,EAEL,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAY,KAAI;4BAChC,QACE,CAAA,CAAA,KAAA,EAAA,EAAK,KAAK,EAAC,gBAAgB,EAAA,EACzB,CAAA,CAAA,GAAA,EAAA,EAAG,KAAK,EAAC,qBAAqB,IAAE,KAAK,CAAC,IAAI,CAAK,EAC/C,CAAA,CAAA,GAAA,EAAA,EAAG,KAAK,EAAC,sBAAsB,EAAC,SAAS,EAAE,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAQ,EAAM,CAAA,CACxE;yBAET,CAAC,CACE;qBAET,CAAC,CACG;;;;;;;;;;;;"}
@@ -1,5 +1,5 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- System.register(["./p-CW47XnO5.system.js"],(function(i){"use strict";var e,t;return{setters:[function(i){e=i.r;t=i.h}],execute:function(){var a="";var c=i("salla_notification_item",function(){function i(i){e(this,i)}i.prototype.render=function(){return t("a",{key:"f4818ac9b7dc2573dd1ac8aa31aabc82454ea439",href:this.notification.url,class:{"s-notifications-item":true,"s-notifications-item-shadow":true,"s-notifications-item-read":!this.notification.is_new}},t("span",{key:"3766a4eb835408bf293054be3e04a561e1510728",class:"s-notifications-item-icon"},t("i",{key:"e9b1e4a18f22e765053b7d62f83a4af6e426bd47",class:{"s-notifications-item-icon sicon-bell-ring":true,"s-notifications-item-icon-new":this.notification.is_new}})),t("div",{key:"2005bcf68b61bb0aa5606480f703e4ee4cfbd415",class:"s-notifications-item-content"},t("div",{key:"a60fdc96431899c0c3183512ea81477f52e550d0",class:"s-notifications-item-content-leading"},t("h4",{key:"fb0eb1efe08440a1e2c12dc1af263adba0413d2b"},this.notification.title),t("p",{key:"c32790ad29bd267323d86e5c3abdec1ab75c09b2"},this.notification.sub_title)),t("span",{key:"e8fbfea5e91fe7d16c489a285502eaab08b16fd5",class:"s-notifications-item-content-trailing"},t("i",{key:"ea9fb9cf6ac2f9c84cde152fa1381e884971cba4",class:"sicon-time s-notifications-item-content-trailing-icon"}),t("span",{key:"1fb25f1463210c8ab467dff8aea22d9c4510301c"},this.notification.date))))};return i}());c.style=a}}}));
5
- //# sourceMappingURL=p-38dbabf3.system.entry.js.map
4
+ System.register(["./p-1xnr2J3b.system.js"],(function(i){"use strict";var e,t;return{setters:[function(i){e=i.r;t=i.h}],execute:function(){var a="";var c=i("salla_notification_item",function(){function i(i){e(this,i)}i.prototype.render=function(){return t("a",{key:"f4818ac9b7dc2573dd1ac8aa31aabc82454ea439",href:this.notification.url,class:{"s-notifications-item":true,"s-notifications-item-shadow":true,"s-notifications-item-read":!this.notification.is_new}},t("span",{key:"3766a4eb835408bf293054be3e04a561e1510728",class:"s-notifications-item-icon"},t("i",{key:"e9b1e4a18f22e765053b7d62f83a4af6e426bd47",class:{"s-notifications-item-icon sicon-bell-ring":true,"s-notifications-item-icon-new":this.notification.is_new}})),t("div",{key:"2005bcf68b61bb0aa5606480f703e4ee4cfbd415",class:"s-notifications-item-content"},t("div",{key:"a60fdc96431899c0c3183512ea81477f52e550d0",class:"s-notifications-item-content-leading"},t("h4",{key:"fb0eb1efe08440a1e2c12dc1af263adba0413d2b"},this.notification.title),t("p",{key:"c32790ad29bd267323d86e5c3abdec1ab75c09b2"},this.notification.sub_title)),t("span",{key:"e8fbfea5e91fe7d16c489a285502eaab08b16fd5",class:"s-notifications-item-content-trailing"},t("i",{key:"ea9fb9cf6ac2f9c84cde152fa1381e884971cba4",class:"sicon-time s-notifications-item-content-trailing-icon"}),t("span",{key:"1fb25f1463210c8ab467dff8aea22d9c4510301c"},this.notification.date))))};return i}());c.style=a}}}));
5
+ //# sourceMappingURL=p-a4376ad7.system.entry.js.map
@@ -1,5 +1,5 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r as t,c as s,h as e,H as i,g as l}from"./p-5Ng8LPjI.js";import{F as a}from"./p-DL4h2bc3.js";import{H as r}from"./p-DjVGZdqd.js";import"./p-CgtvEd63.js";const o=":host{display:block}.s-rating-stars-small{line-height:12px}.s-filters-radio{background-image:none !important}";const n=class{constructor(e){t(this,e);this.changed=s(this,"changed");this.isReady=false;this.filtersData={};salla.event.on("filters::hidden",(()=>this.host.style.display="none"));salla.lang.onLoaded((()=>{this.apply=salla.lang.get("pages.checkout.apply");this.reset=salla.lang.get("pages.categories.filters_reset")}));salla.event.on("filters::fetched",(({filters:t})=>{this.host.style.display="";let s={};this.filters=t.map((t=>{t.label={category_id:salla.lang.get("common.titles.categories"),brand_id:salla.lang.get("common.titles.brands"),rating:salla.lang.get("pages.categories.filter_rating"),price:salla.lang.get("pages.categories.filter_price")}[t.key]||t.label;if(t.key=="rating"){t.type=a.VALUES;let{max:s,min:e}=t.values;t.values=[5,4,3,2,1].filter((t=>t>=e||t<=s))}if(this.filtersData.variants&&t.type==a.VARIANTS){s.variants=this.filtersData.variants}if(this.filtersData[t.key]&&t.type!==a.VARIANTS){s[t.key]=this.filtersData[t.key]}let e=new URLSearchParams(window.location.search);let i=false;for(let t of e.keys()){if(t.includes("filters")){i=true;break}}if(salla.config.get("page.slug")=="product.index"&&Object.keys(s).length==0&&!i){let t=window.location.href;let e=salla.config.get("page.id");let i=t.indexOf("?")!==-1?"&":"?";let l=t+i+"filters[category_id]="+e;s.category_id=e;window.history.pushState({path:l},"",l)}return t}));this.filtersData=s;this.host.childNodes.forEach((async t=>t.setWidgetHeight&&await t.setWidgetHeight()))}))}async componentWillLoad(){try{const t=new URLSearchParams(window.location.search);this.filtersData=await r.extractFiltersFromUrl(t)}catch(t){console.warn("failed to get filters from URL",t.message)}}async getFilters(){return this.filtersData}async applyFilters(){if(!this.isReady){return}let t=Object.keys(this.filtersData).length>0;setTimeout((()=>{var s;if(t){let t=new URL(window.location.href);for(const[s]of t.searchParams.entries()){if(s.startsWith("filters")){t.searchParams.delete(s)}}let s=this.encodeFilters(this.filtersData);let e=t.search.split("&").filter((t=>!t.includes("filters"))).join("&");if(e){t.search=t.search.split("&filters")[0]+"&"+s}else{t.search=`?${s}`}window.history.pushState({},"",t.href)}else{let t=new URL(window.location.href);(s=t.searchParams)===null||s===void 0?void 0:s.delete("filters");window.history.pushState({},"",t.toString())}salla.event.emit("salla-filters::changed",this.filtersData);this.changed.emit(this.filtersData)}),300)}encodeFilters(t,s="filters"){const e=[];for(const i in t){if(Object.prototype.hasOwnProperty.call(t,i)){const l=t[i];const a=s?`${s}[${i}]`:i;if(Array.isArray(l)){for(let t=0;t<l.length;t++){e.push(`${a}[${t}]=${l[t]}`)}}else if(typeof l==="object"&&l!==null){e.push(this.encodeFilters(l,a))}else{let t=`${a}=${l}`;e.push(t)}}}return e.join("&")}async resetFilters(){this.removeFiltersQueryParams();this.filtersData={};this.host.childNodes.forEach((t=>t.reset&&t.reset()));salla.event.emit("salla-filters::reset");return this.applyFilters()}removeFiltersQueryParams(){const t=new URLSearchParams(window.location.search);const s=Array.from(t.keys()).filter((t=>!t.startsWith("filters["))).map((s=>`${encodeURIComponent(s)}=${encodeURIComponent(t.get(s))}`)).join("&");const e=s?`${window.location.pathname}?${s}`:window.location.pathname;window.history.pushState({},"",e)}handleOptionChange(t,s,e){if(s.type===a.RANGE){this.filtersData[s.key]=e}let i=t.target.checked;if(s.type===a.VARIANTS){this.filtersData.variants=this.filtersData.variants||{};i&&(this.filtersData.variants[s.key]=e);i||delete this.filtersData.variants[s.key]}else if(t.target.type=="radio"){i&&(this.filtersData[s.key]=e);i||delete this.filtersData[s.key]}else if(t.target.type=="checkbox"){this.filtersData[s.key]=this.filtersData[s.key]||[];if(i){this.filtersData[s.key].push(e)}this.filtersData[s.key]=this.filtersData[s.key].filter((t=>t!=e))}this.applyFilters()}render(){var t,s;return e(i,{key:"d62d9a867f140a911cb5da11a1034511fd230745"},(t=this.filters)===null||t===void 0?void 0:t.map((t=>e("salla-filters-widget",{option:t,filtersData:this.filtersData,onChanged:({detail:{event:t,option:s,value:e}})=>{this.handleOptionChange(t,s,e)}}))),((s=this.filters)===null||s===void 0?void 0:s.length)?e("div",{class:"s-filters-footer"},e("salla-button",{color:"gray",fill:"outline",onClick:()=>this.resetFilters()},this.reset)):"")}componentDidLoad(){this.isReady=true}get host(){return l(this)}};n.style=o;export{n as salla_filters};
5
- //# sourceMappingURL=p-7425415e.entry.js.map
4
+ import{r as t,c as s,h as e,H as i,g as l}from"./p-DJeJWTdD.js";import{F as a}from"./p-DL4h2bc3.js";import{H as r}from"./p-DjVGZdqd.js";import"./p-CgtvEd63.js";const o=":host{display:block}.s-rating-stars-small{line-height:12px}.s-filters-radio{background-image:none !important}";const n=class{constructor(e){t(this,e);this.changed=s(this,"changed");this.isReady=false;this.filtersData={};salla.event.on("filters::hidden",(()=>this.host.style.display="none"));salla.lang.onLoaded((()=>{this.apply=salla.lang.get("pages.checkout.apply");this.reset=salla.lang.get("pages.categories.filters_reset")}));salla.event.on("filters::fetched",(({filters:t})=>{this.host.style.display="";let s={};this.filters=t.map((t=>{t.label={category_id:salla.lang.get("common.titles.categories"),brand_id:salla.lang.get("common.titles.brands"),rating:salla.lang.get("pages.categories.filter_rating"),price:salla.lang.get("pages.categories.filter_price")}[t.key]||t.label;if(t.key=="rating"){t.type=a.VALUES;let{max:s,min:e}=t.values;t.values=[5,4,3,2,1].filter((t=>t>=e||t<=s))}if(this.filtersData.variants&&t.type==a.VARIANTS){s.variants=this.filtersData.variants}if(this.filtersData[t.key]&&t.type!==a.VARIANTS){s[t.key]=this.filtersData[t.key]}let e=new URLSearchParams(window.location.search);let i=false;for(let t of e.keys()){if(t.includes("filters")){i=true;break}}if(salla.config.get("page.slug")=="product.index"&&Object.keys(s).length==0&&!i){let t=window.location.href;let e=salla.config.get("page.id");let i=t.indexOf("?")!==-1?"&":"?";let l=t+i+"filters[category_id]="+e;s.category_id=e;window.history.pushState({path:l},"",l)}return t}));this.filtersData=s;this.host.childNodes.forEach((async t=>t.setWidgetHeight&&await t.setWidgetHeight()))}))}async componentWillLoad(){try{const t=new URLSearchParams(window.location.search);this.filtersData=await r.extractFiltersFromUrl(t)}catch(t){console.warn("failed to get filters from URL",t.message)}}async getFilters(){return this.filtersData}async applyFilters(){if(!this.isReady){return}let t=Object.keys(this.filtersData).length>0;setTimeout((()=>{var s;if(t){let t=new URL(window.location.href);for(const[s]of t.searchParams.entries()){if(s.startsWith("filters")){t.searchParams.delete(s)}}let s=this.encodeFilters(this.filtersData);let e=t.search.split("&").filter((t=>!t.includes("filters"))).join("&");if(e){t.search=t.search.split("&filters")[0]+"&"+s}else{t.search=`?${s}`}window.history.pushState({},"",t.href)}else{let t=new URL(window.location.href);(s=t.searchParams)===null||s===void 0?void 0:s.delete("filters");window.history.pushState({},"",t.toString())}salla.event.emit("salla-filters::changed",this.filtersData);this.changed.emit(this.filtersData)}),300)}encodeFilters(t,s="filters"){const e=[];for(const i in t){if(Object.prototype.hasOwnProperty.call(t,i)){const l=t[i];const a=s?`${s}[${i}]`:i;if(Array.isArray(l)){for(let t=0;t<l.length;t++){e.push(`${a}[${t}]=${l[t]}`)}}else if(typeof l==="object"&&l!==null){e.push(this.encodeFilters(l,a))}else{let t=`${a}=${l}`;e.push(t)}}}return e.join("&")}async resetFilters(){this.removeFiltersQueryParams();this.filtersData={};this.host.childNodes.forEach((t=>t.reset&&t.reset()));salla.event.emit("salla-filters::reset");return this.applyFilters()}removeFiltersQueryParams(){const t=new URLSearchParams(window.location.search);const s=Array.from(t.keys()).filter((t=>!t.startsWith("filters["))).map((s=>`${encodeURIComponent(s)}=${encodeURIComponent(t.get(s))}`)).join("&");const e=s?`${window.location.pathname}?${s}`:window.location.pathname;window.history.pushState({},"",e)}handleOptionChange(t,s,e){if(s.type===a.RANGE){this.filtersData[s.key]=e}let i=t.target.checked;if(s.type===a.VARIANTS){this.filtersData.variants=this.filtersData.variants||{};i&&(this.filtersData.variants[s.key]=e);i||delete this.filtersData.variants[s.key]}else if(t.target.type=="radio"){i&&(this.filtersData[s.key]=e);i||delete this.filtersData[s.key]}else if(t.target.type=="checkbox"){this.filtersData[s.key]=this.filtersData[s.key]||[];if(i){this.filtersData[s.key].push(e)}this.filtersData[s.key]=this.filtersData[s.key].filter((t=>t!=e))}this.applyFilters()}render(){var t,s;return e(i,{key:"d62d9a867f140a911cb5da11a1034511fd230745"},(t=this.filters)===null||t===void 0?void 0:t.map((t=>e("salla-filters-widget",{option:t,filtersData:this.filtersData,onChanged:({detail:{event:t,option:s,value:e}})=>{this.handleOptionChange(t,s,e)}}))),((s=this.filters)===null||s===void 0?void 0:s.length)?e("div",{class:"s-filters-footer"},e("salla-button",{color:"gray",fill:"outline",onClick:()=>this.resetFilters()},this.reset)):"")}componentDidLoad(){this.isReady=true}get host(){return l(this)}};n.style=o;export{n as salla_filters};
5
+ //# sourceMappingURL=p-a52f5483.entry.js.map
@@ -1,5 +1,5 @@
1
1
  var __awaiter=this&&this.__awaiter||function(e,t,r,s){function n(e){return e instanceof r?e:new r((function(t){t(e)}))}return new(r||(r=Promise))((function(r,i){function a(e){try{l(s.next(e))}catch(e){i(e)}}function o(e){try{l(s["throw"](e))}catch(e){i(e)}}function l(e){e.done?r(e.value):n(e.value).then(a,o)}l((s=s.apply(e,t||[])).next())}))};var __generator=this&&this.__generator||function(e,t){var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},s,n,i,a;return a={next:o(0),throw:o(1),return:o(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function o(e){return function(t){return l([e,t])}}function l(o){if(s)throw new TypeError("Generator is already executing.");while(a&&(a=0,o[0]&&(r=0)),r)try{if(s=1,n&&(i=o[0]&2?n["return"]:o[0]?n["throw"]||((i=n["return"])&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;if(n=0,i)o=[o[0]&2,i.value];switch(o[0]){case 0:case 1:i=o;break;case 4:r.label++;return{value:o[1],done:false};case 5:r.label++;n=o[1];o=[0];continue;case 7:o=r.ops.pop();r.trys.pop();continue;default:if(!(i=r.trys,i=i.length>0&&i[i.length-1])&&(o[0]===6||o[0]===2)){r=0;continue}if(o[0]===3&&(!i||o[1]>i[0]&&o[1]<i[3])){r.label=o[1];break}if(o[0]===6&&r.label<i[1]){r.label=i[1];i=o;break}if(i&&r.label<i[2]){r.label=i[2];r.ops.push(o);break}if(i[2])r.ops.pop();r.trys.pop();continue}o=t.call(e,r)}catch(e){o=[6,e];n=0}finally{s=i=0}if(o[0]&5)throw o[1];return{value:o[0]?o[1]:void 0,done:true}}};
2
2
  /*!
3
3
  * Crafted with ❤ by Salla
4
- */System.register(["./p-CW47XnO5.system.js"],(function(e){"use strict";var t,r,s;return{setters:[function(e){t=e.r;r=e.h;s=e.g}],execute:function(){var n;(function(e){e["ProductDetail"]="product.single";e["Cart"]="cart"})(n||(n={}));var i;(function(e){e["Conditional"]="conditional";e["PercentageOrFixed"]="fixed";e["DiscountsTable"]="discounts_table";e["Bank"]="bank";e["BuyXGetY"]="buy_x_get_y";e["SpecialPrice"]="special_price"})(i||(i={}));var a='.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:-ms-flexbox;display:flex;-ms-flex-align:center !important;align-items:center !important;gap:14px}.s-offer-bank-wrapper{display:-ms-flexbox !important;display:flex !important;width:100% !important}';var o=e("salla_offer",function(){function e(e){var r=this;t(this,e);var s;this.productCardComponent="custom-salla-product-card";this.offersList=[];this.isMultipleBank=false;this.isBankOffer=false;this.canRender=false;this.showOffer=salla.config.get("store.settings.product.show_special_offers");this.offer_with_price_text=salla.lang.get("pages.offer.with_price",{price:""});this.with_discount_text=salla.lang.get("pages.products.with_a_discount");this.product_discount_text=salla.lang.get("pages.products.discount");this.special_offer_text=salla.lang.get("pages.products.special_offer");this.multipleBankOfferTitleText=salla.lang.get("pages.offer.multiple_bank_offers_title");this.multipleBankOfferTitleDescription=salla.lang.get("pages.offer.multiple_bank_offers_message");this.buy_quantity_text=function(e){return salla.lang.get("pages.offer.buy_quantity",{quantity:e})};salla.lang.onLoaded((function(){r.offer_with_price_text=salla.lang.get("pages.offer.with_price");r.with_discount_text=salla.lang.get("pages.products.with_a_discount");r.product_discount_text=salla.lang.get("pages.products.discount");r.special_offer_text=salla.lang.get("pages.products.special_offer");r.multipleBankOfferTitleText=salla.lang.get("pages.offer.multiple_bank_offers_title");r.multipleBankOfferTitleDescription=salla.lang.get("pages.offer.multiple_bank_offers_message");r.buy_quantity_text(0)}));salla.onReady((function(){r.currentPage=salla.config.get("page.slug");r.userCurrency=salla.config.get("currencies")[salla.config.get("user.currency_code")].symbol}));this.categorySlot=((s=this.host.querySelector('[slot="category"]'))===null||s===void 0?void 0:s.innerHTML)||'<a href={url} class="s-offer-slide-cat-entry"><i class={icon}></i><h4>{name}</h4></a>'}e.prototype.getEndpointByPageName=function(){return __awaiter(this,void 0,void 0,(function(){var e;return __generator(this,(function(t){switch(t.label){case 0:if(!(this.currentPage==n.Cart))return[3,2];return[4,Salla.cart.getCurrentCartId()];case 1:e=t.sent();return[2,"offers/cart/".concat(e)];case 2:if(this.currentPage==n.ProductDetail){return[2,"offers/product/".concat(salla.config.get("page.id"))]}return[2,"offers"]}}))}))};e.prototype.emitPromotionViewed=function(){if(!(this.offersList.length&&this.canRender&&this.showOffer))return;var e={id:this.offersList[0].id,name:this.offersList[0].title,creative:this.offersList[0].description||"",position:1};salla.event.emit("promotion::viewed",[e])};e.prototype.emitPromotionClicked=function(e){if(e===void 0){e=1}if(!(this.offersList.length&&this.canRender&&this.showOffer))return;var t={id:this.offersList[0].id,name:this.offersList[0].title,creative:this.offersList[0].description||"",position:e};salla.event.emit("promotion::clicked",[t])};e.prototype.componentWillLoad=function(){var e=this;this.hasCustomComponent=!!customElements.get(this.productCardComponent);return new Promise((function(e){return salla.onReady(e)})).then((function(){e.showOffer=!salla.url.is_page("product.single")||salla.config.get("store.settings.product.show_special_offers");if(e.showOffer){return}throw new Error("Merchant disabled showing the offers on product page")})).then((function(){return __awaiter(e,void 0,void 0,(function(){var e,t;return __generator(this,(function(r){switch(r.label){case 0:t=(e=salla.api).request;return[4,this.getEndpointByPageName()];case 1:return[2,t.apply(e,[r.sent()])]}}))}))})).then((function(t){if(!(e.offersList=t.data).length){throw new Error("salla-offers:: There is no offers!")}var r=e.offersList.find((function(e){return[i.SpecialPrice,i.Bank,i.BuyXGetY,i.DiscountsTable].includes(e.type)}));if(!r){throw new Error("salla-offers:: Offer type not supported yet!")}if(r.type===i.DiscountsTable){return e.offersList=[r]}if(e.isBankOffer=r.type===i.Bank){e.offersList=e.offersList.filter((function(e){return e.type===i.Bank}));e.isMultipleBank=e.offersList.length>1;return e.offersList}if(r.type===i.SpecialPrice){var s=r.details;return s.apply_to==="product"?salla.product.api.fetch({source:"selected",source_value:s.targets}).then((function(t){r.details.products=t.data;return e.offersList=[r]})):salla.product.api.categories().then((function(t){var n=e.findCategories(t.data,s.targets);r.details.categories=n;return e.offersList=[r]}))}var n=r.details.get;return n.source==="products"?salla.product.api.fetch({source:"selected",source_value:n.source_value}).then((function(t){n.products=t.data;r.details.get=n;return e.offersList=[r]})):salla.product.api.categories().then((function(t){n.categories=e.findCategories(t.data,n.source_value);r.details.get=n;return e.offersList=[r]}))})).then((function(t){salla.storage.set(e.getStorageKey(),{offers:t,stored_at:(new Date).getTime()});e.canRender=true})).catch((function(e){salla.logger.warn(e)}))};e.prototype.componentDidLoad=function(){var e=this.host.querySelector(".s-slider-block__title-nav");e===null||e===void 0?void 0:e.classList.add("s-offer-bank-payment-nav");this.emitPromotionViewed()};e.prototype.findCategories=function(e,t){var r;var s=[];for(var n=0,i=e;n<i.length;n++){var a=i[n];if(t.includes(a.id_||a.id)){s.push(a)}if(((r=a.sub_categories)===null||r===void 0?void 0:r.length)>0){s=s.concat(this.findCategories(a.sub_categories,t))}}return s};e.prototype.getStorageKey=function(){try{var e=salla.config.get("page.slug").replace(".","_");var t=salla.lang.getLocale();var r=salla.config.currency().code;if(!e||!t||!r){throw new Error("Unable to get the storage key.")}return"s-offers-".concat(e,"-").concat(salla.config.get("page.id"),"-").concat(t,"-").concat(r)}catch(e){return""}};e.prototype.getOffersFromStorage=function(){var e=salla.storage.get(this.getStorageKey());if(!e||e.stored_at<(new Date).getTime()-10*60*1e3){salla.storage.remove(this.getStorageKey());return null}this.canRender=true;return Promise.resolve(e.offers)};e.prototype.render=function(){var e=this;if(!this.offersList.length||!this.canRender||!this.showOffer)return null;var t=this.offersList[0];var s=this.isBankOffer?this.isMultipleBank?this.multipleBankOfferTitleText:null:t.title;var n=this.isBankOffer?this.isMultipleBank?this.multipleBankOfferTitleDescription:null:t.description;var i={"block-title":s,"block-subTitle":n,"show-controls":this.isMultipleBank};return r("div",{class:"s-offer-wrapper",onClick:function(){return e.emitPromotionClicked()}},r("p",{class:"s-offer-corner-badge"},this.special_offer_text),r("salla-slider",Object.assign({type:"carousel",id:"offer-slider"},i),r("div",{slot:"items"},this.renderSectionForOfferType(t.type))))};e.prototype.renderSectionForOfferType=function(e){if(this.isBankOffer){return this.renderBankSection()}if(e==i.SpecialPrice){return this.renderSpecialPriceSection()}if(e==i.BuyXGetY){return this.renderBuyXGetYSection()}return this.renderDiscountTableSection()};e.prototype.getCategoriesSection=function(e){return r("div",{class:"s-offer-slide-one-sixth swiper-slide",innerHTML:this.categorySlot.replace(/\{url\}/g,e.url).replace(/\{icon\}/g,e.icon||"sicon-store").replace(/\{name\}/g,e.name)})};e.prototype.renderBuyXGetYSection=function(){var e=this;var t,s;var n=this.offersList[0].details;return[(t=n.get.products)===null||t===void 0?void 0:t.map((function(t){return r("div",{class:"s-offer-slide-one-fourth"},e.hasCustomComponent?r(e.productCardComponent,{product:t}):r("salla-product-card",{"shadow-on-hover":true,product:t}))})),(s=n.get.categories)===null||s===void 0?void 0:s.map((function(t){return e.getCategoriesSection(t)}))]};e.prototype.renderBankSection=function(){var e=this;return this.offersList.map((function(t){return r("div",{class:{"s-offer-slide-one-sixth":e.isMultipleBank,"s-offer-bank-wrapper-sinlge-item":!e.isMultipleBank}},r("div",{class:{"s-offer-bank-wrapper":true,"s-offer-slide-one-sixth":!e.isMultipleBank,"s-offer-bank-wrapper-multi-spacer":e.isMultipleBank}},r("div",{class:"s-offer-bank-logo"},r("img",{src:t.details.logo||salla.url.cdn("images/s-empty.png"),"data-src":t.details.logo,alt:t.title+" offer"})),r("ul",{class:"s-offer-bank-payment-wrapper"},t.details.payments.map((function(e){return r("li",{class:"s-offer-bank-payment-single"},r("img",{src:salla.url.cdn("images/payment/"+e+".png")||salla.url.cdn("images/s-empty.png"),"data-src":salla.url.cdn("images/payment/"+e+".png"),alt:"payment"}))}))),e.isMultipleBank?r("p",{class:"s-offer-bank-payment-discount-percent"},"".concat(e.product_discount_text," ").concat(t.details.discount_value).concat(t.details.discount_type==="percentage"&&"%")):""),!e.isMultipleBank?r("div",{class:"s-offer-bank-message s-offer-slide-one-fourth"},r("h2",null,e.offersList[0].title),r("p",{innerHTML:e.generateBankDescription(e.offersList[0].description,t.details.discount_value)})):"")}))};e.prototype.generateBankDescription=function(e,t){return e.replace(new RegExp("".concat(t," %")),'<span class="s-offer-bank-message-amount">'.concat(t," %</span>"))};e.prototype.renderDiscountTableSection=function(){var e=this;var t;var s=this.offersList[0];var n=s.details.show_price_after_discount;return(t=this.offersList[0].details.discounts)===null||t===void 0?void 0:t.map((function(t){return r("div",{class:"s-offer-slide-one-fourth"},r("div",{class:"s-offer-slide-offer-entry"},r("div",{class:"s-offer-slide-offer-entry-price-quantity-container"},r("p",{class:"s-offer-slide-offer-entry-quantity"},e.buy_quantity_text(t.quantity)),n?r("div",{class:"s-offer-slide-offer-entry-price"},r("span",null,e.offer_with_price_text),r("span",{class:"s-offer-slide-offer-entry-price-amount"},t.discounted_amount)," ",r("span",null,e.userCurrency)):""),r("p",{class:"s-offer-slide-offer-entry-price-amount-percent"},e.with_discount_text,"(",r("span",null,t.percentage,!!t.percentage&&"%"),")")))}))};e.prototype.renderSpecialPriceSection=function(){var e=this;var t,s;var n=this.offersList[0].details;return[n.apply_to==="product"&&((t=n.products)===null||t===void 0?void 0:t.map((function(t){return r("div",{class:"s-offer-slide-one-fourth"},e.hasCustomComponent?r(e.productCardComponent,{product:t}):r("salla-product-card",{"shadow-on-hover":true,product:t}))}))),n.apply_to==="category"&&((s=n.categories)===null||s===void 0?void 0:s.map((function(t){return e.getCategoriesSection(t)})))]};Object.defineProperty(e.prototype,"host",{get:function(){return s(this)},enumerable:false,configurable:true});return e}());o.style=a}}}));
5
- //# sourceMappingURL=p-2bbb1442.system.entry.js.map
4
+ */System.register(["./p-1xnr2J3b.system.js"],(function(e){"use strict";var t,r,s;return{setters:[function(e){t=e.r;r=e.h;s=e.g}],execute:function(){var n;(function(e){e["ProductDetail"]="product.single";e["Cart"]="cart"})(n||(n={}));var i;(function(e){e["Conditional"]="conditional";e["PercentageOrFixed"]="fixed";e["DiscountsTable"]="discounts_table";e["Bank"]="bank";e["BuyXGetY"]="buy_x_get_y";e["SpecialPrice"]="special_price"})(i||(i={}));var a='.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:-ms-flexbox;display:flex;-ms-flex-align:center !important;align-items:center !important;gap:14px}.s-offer-bank-wrapper{display:-ms-flexbox !important;display:flex !important;width:100% !important}';var o=e("salla_offer",function(){function e(e){var r=this;t(this,e);var s;this.productCardComponent="custom-salla-product-card";this.offersList=[];this.isMultipleBank=false;this.isBankOffer=false;this.canRender=false;this.showOffer=salla.config.get("store.settings.product.show_special_offers");this.offer_with_price_text=salla.lang.get("pages.offer.with_price",{price:""});this.with_discount_text=salla.lang.get("pages.products.with_a_discount");this.product_discount_text=salla.lang.get("pages.products.discount");this.special_offer_text=salla.lang.get("pages.products.special_offer");this.multipleBankOfferTitleText=salla.lang.get("pages.offer.multiple_bank_offers_title");this.multipleBankOfferTitleDescription=salla.lang.get("pages.offer.multiple_bank_offers_message");this.buy_quantity_text=function(e){return salla.lang.get("pages.offer.buy_quantity",{quantity:e})};salla.lang.onLoaded((function(){r.offer_with_price_text=salla.lang.get("pages.offer.with_price");r.with_discount_text=salla.lang.get("pages.products.with_a_discount");r.product_discount_text=salla.lang.get("pages.products.discount");r.special_offer_text=salla.lang.get("pages.products.special_offer");r.multipleBankOfferTitleText=salla.lang.get("pages.offer.multiple_bank_offers_title");r.multipleBankOfferTitleDescription=salla.lang.get("pages.offer.multiple_bank_offers_message");r.buy_quantity_text(0)}));salla.onReady((function(){r.currentPage=salla.config.get("page.slug");r.userCurrency=salla.config.get("currencies")[salla.config.get("user.currency_code")].symbol}));this.categorySlot=((s=this.host.querySelector('[slot="category"]'))===null||s===void 0?void 0:s.innerHTML)||'<a href={url} class="s-offer-slide-cat-entry"><i class={icon}></i><h4>{name}</h4></a>'}e.prototype.getEndpointByPageName=function(){return __awaiter(this,void 0,void 0,(function(){var e;return __generator(this,(function(t){switch(t.label){case 0:if(!(this.currentPage==n.Cart))return[3,2];return[4,Salla.cart.getCurrentCartId()];case 1:e=t.sent();return[2,"offers/cart/".concat(e)];case 2:if(this.currentPage==n.ProductDetail){return[2,"offers/product/".concat(salla.config.get("page.id"))]}return[2,"offers"]}}))}))};e.prototype.emitPromotionViewed=function(){if(!(this.offersList.length&&this.canRender&&this.showOffer))return;var e={id:this.offersList[0].id,name:this.offersList[0].title,creative:this.offersList[0].description||"",position:1};salla.event.emit("promotion::viewed",[e])};e.prototype.emitPromotionClicked=function(e){if(e===void 0){e=1}if(!(this.offersList.length&&this.canRender&&this.showOffer))return;var t={id:this.offersList[0].id,name:this.offersList[0].title,creative:this.offersList[0].description||"",position:e};salla.event.emit("promotion::clicked",[t])};e.prototype.componentWillLoad=function(){var e=this;this.hasCustomComponent=!!customElements.get(this.productCardComponent);return new Promise((function(e){return salla.onReady(e)})).then((function(){e.showOffer=!salla.url.is_page("product.single")||salla.config.get("store.settings.product.show_special_offers");if(e.showOffer){return}throw new Error("Merchant disabled showing the offers on product page")})).then((function(){return __awaiter(e,void 0,void 0,(function(){var e,t;return __generator(this,(function(r){switch(r.label){case 0:t=(e=salla.api).request;return[4,this.getEndpointByPageName()];case 1:return[2,t.apply(e,[r.sent()])]}}))}))})).then((function(t){if(!(e.offersList=t.data).length){throw new Error("salla-offers:: There is no offers!")}var r=e.offersList.find((function(e){return[i.SpecialPrice,i.Bank,i.BuyXGetY,i.DiscountsTable].includes(e.type)}));if(!r){throw new Error("salla-offers:: Offer type not supported yet!")}if(r.type===i.DiscountsTable){return e.offersList=[r]}if(e.isBankOffer=r.type===i.Bank){e.offersList=e.offersList.filter((function(e){return e.type===i.Bank}));e.isMultipleBank=e.offersList.length>1;return e.offersList}if(r.type===i.SpecialPrice){var s=r.details;return s.apply_to==="product"?salla.product.api.fetch({source:"selected",source_value:s.targets}).then((function(t){r.details.products=t.data;return e.offersList=[r]})):salla.product.api.categories().then((function(t){var n=e.findCategories(t.data,s.targets);r.details.categories=n;return e.offersList=[r]}))}var n=r.details.get;return n.source==="products"?salla.product.api.fetch({source:"selected",source_value:n.source_value}).then((function(t){n.products=t.data;r.details.get=n;return e.offersList=[r]})):salla.product.api.categories().then((function(t){n.categories=e.findCategories(t.data,n.source_value);r.details.get=n;return e.offersList=[r]}))})).then((function(t){salla.storage.set(e.getStorageKey(),{offers:t,stored_at:(new Date).getTime()});e.canRender=true})).catch((function(e){salla.logger.warn(e)}))};e.prototype.componentDidLoad=function(){var e=this.host.querySelector(".s-slider-block__title-nav");e===null||e===void 0?void 0:e.classList.add("s-offer-bank-payment-nav");this.emitPromotionViewed()};e.prototype.findCategories=function(e,t){var r;var s=[];for(var n=0,i=e;n<i.length;n++){var a=i[n];if(t.includes(a.id_||a.id)){s.push(a)}if(((r=a.sub_categories)===null||r===void 0?void 0:r.length)>0){s=s.concat(this.findCategories(a.sub_categories,t))}}return s};e.prototype.getStorageKey=function(){try{var e=salla.config.get("page.slug").replace(".","_");var t=salla.lang.getLocale();var r=salla.config.currency().code;if(!e||!t||!r){throw new Error("Unable to get the storage key.")}return"s-offers-".concat(e,"-").concat(salla.config.get("page.id"),"-").concat(t,"-").concat(r)}catch(e){return""}};e.prototype.getOffersFromStorage=function(){var e=salla.storage.get(this.getStorageKey());if(!e||e.stored_at<(new Date).getTime()-10*60*1e3){salla.storage.remove(this.getStorageKey());return null}this.canRender=true;return Promise.resolve(e.offers)};e.prototype.render=function(){var e=this;if(!this.offersList.length||!this.canRender||!this.showOffer)return null;var t=this.offersList[0];var s=this.isBankOffer?this.isMultipleBank?this.multipleBankOfferTitleText:null:t.title;var n=this.isBankOffer?this.isMultipleBank?this.multipleBankOfferTitleDescription:null:t.description;var i={"block-title":s,"block-subTitle":n,"show-controls":this.isMultipleBank};return r("div",{class:"s-offer-wrapper",onClick:function(){return e.emitPromotionClicked()}},r("p",{class:"s-offer-corner-badge"},this.special_offer_text),r("salla-slider",Object.assign({type:"carousel",id:"offer-slider"},i),r("div",{slot:"items"},this.renderSectionForOfferType(t.type))))};e.prototype.renderSectionForOfferType=function(e){if(this.isBankOffer){return this.renderBankSection()}if(e==i.SpecialPrice){return this.renderSpecialPriceSection()}if(e==i.BuyXGetY){return this.renderBuyXGetYSection()}return this.renderDiscountTableSection()};e.prototype.getCategoriesSection=function(e){return r("div",{class:"s-offer-slide-one-sixth swiper-slide",innerHTML:this.categorySlot.replace(/\{url\}/g,e.url).replace(/\{icon\}/g,e.icon||"sicon-store").replace(/\{name\}/g,e.name)})};e.prototype.renderBuyXGetYSection=function(){var e=this;var t,s;var n=this.offersList[0].details;return[(t=n.get.products)===null||t===void 0?void 0:t.map((function(t){return r("div",{class:"s-offer-slide-one-fourth"},e.hasCustomComponent?r(e.productCardComponent,{product:t}):r("salla-product-card",{"shadow-on-hover":true,product:t}))})),(s=n.get.categories)===null||s===void 0?void 0:s.map((function(t){return e.getCategoriesSection(t)}))]};e.prototype.renderBankSection=function(){var e=this;return this.offersList.map((function(t){return r("div",{class:{"s-offer-slide-one-sixth":e.isMultipleBank,"s-offer-bank-wrapper-sinlge-item":!e.isMultipleBank}},r("div",{class:{"s-offer-bank-wrapper":true,"s-offer-slide-one-sixth":!e.isMultipleBank,"s-offer-bank-wrapper-multi-spacer":e.isMultipleBank}},r("div",{class:"s-offer-bank-logo"},r("img",{src:t.details.logo||salla.url.cdn("images/s-empty.png"),"data-src":t.details.logo,alt:t.title+" offer"})),r("ul",{class:"s-offer-bank-payment-wrapper"},t.details.payments.map((function(e){return r("li",{class:"s-offer-bank-payment-single"},r("img",{src:salla.url.cdn("images/payment/"+e+".png")||salla.url.cdn("images/s-empty.png"),"data-src":salla.url.cdn("images/payment/"+e+".png"),alt:"payment"}))}))),e.isMultipleBank?r("p",{class:"s-offer-bank-payment-discount-percent"},"".concat(e.product_discount_text," ").concat(t.details.discount_value).concat(t.details.discount_type==="percentage"&&"%")):""),!e.isMultipleBank?r("div",{class:"s-offer-bank-message s-offer-slide-one-fourth"},r("h2",null,e.offersList[0].title),r("p",{innerHTML:e.generateBankDescription(e.offersList[0].description,t.details.discount_value)})):"")}))};e.prototype.generateBankDescription=function(e,t){return e.replace(new RegExp("".concat(t," %")),'<span class="s-offer-bank-message-amount">'.concat(t," %</span>"))};e.prototype.renderDiscountTableSection=function(){var e=this;var t;var s=this.offersList[0];var n=s.details.show_price_after_discount;return(t=this.offersList[0].details.discounts)===null||t===void 0?void 0:t.map((function(t){return r("div",{class:"s-offer-slide-one-fourth"},r("div",{class:"s-offer-slide-offer-entry"},r("div",{class:"s-offer-slide-offer-entry-price-quantity-container"},r("p",{class:"s-offer-slide-offer-entry-quantity"},e.buy_quantity_text(t.quantity)),n?r("div",{class:"s-offer-slide-offer-entry-price"},r("span",null,e.offer_with_price_text),r("span",{class:"s-offer-slide-offer-entry-price-amount"},t.discounted_amount)," ",r("span",null,e.userCurrency)):""),r("p",{class:"s-offer-slide-offer-entry-price-amount-percent"},e.with_discount_text,"(",r("span",null,t.percentage,!!t.percentage&&"%"),")")))}))};e.prototype.renderSpecialPriceSection=function(){var e=this;var t,s;var n=this.offersList[0].details;return[n.apply_to==="product"&&((t=n.products)===null||t===void 0?void 0:t.map((function(t){return r("div",{class:"s-offer-slide-one-fourth"},e.hasCustomComponent?r(e.productCardComponent,{product:t}):r("salla-product-card",{"shadow-on-hover":true,product:t}))}))),n.apply_to==="category"&&((s=n.categories)===null||s===void 0?void 0:s.map((function(t){return e.getCategoriesSection(t)})))]};Object.defineProperty(e.prototype,"host",{get:function(){return s(this)},enumerable:false,configurable:true});return e}());o.style=a}}}));
5
+ //# sourceMappingURL=p-a8541cb2.system.entry.js.map
@@ -1,5 +1,5 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r as s,c as t,h as i,H as e,g as a}from"./p-5Ng8LPjI.js";import{H as h}from"./p-DjVGZdqd.js";import{F as l}from"./p-DL4h2bc3.js";import"./p-CgtvEd63.js";const r=":host{display:block}";const n=class{constructor(i){s(this,i);this.changed=t(this,"changed");this.initHeight=195;this.isOpen=true;this.isShowMore=false;this.showMoreLabel="عرض المزيد";this.showLessLabel="عرض أقل";this.page=salla.config.get("page")}connectedCallback(){this.withLoadMore=this.option.key!="price"&&Array.isArray(this.option.values)&&this.option.values.length>8;salla.onReady((()=>{this.page=salla.config.get("page")}));salla.lang.onLoaded((()=>{this.showMoreLabel=salla.lang.getWithDefault("common.titles.more",this.showMoreLabel);this.showLessLabel=salla.lang.getWithDefault("common.elements.show_less",this.showLessLabel)}))}componentDidLoad(){this.widgetValues.scrollHeight<this.initHeight&&(this.withLoadMore=false);this.withLoadMore&&this.widgetValues&&(this.widgetValues.style.maxHeight=`${this.initHeight}px`);this.widgetContent.style.height=`${this.widgetContent.scrollHeight}px`}async setWidgetHeight(s=250){this.widgetContent.removeAttribute("style");setTimeout((()=>{let s=this.widgetContent.scrollHeight;this.widgetContent.style.height=s+"px"}),s)}async reset(){if(this.option.type===l.RANGE){this.priceRange.reset()}Array.from(this.host.querySelectorAll("input")).forEach((s=>s.checked=false))}async showMore(){this.isShowMore=!this.isShowMore;this.widgetContent.style.height="auto";this.widgetValues.style.maxHeight=this.isShowMore?`${this.widgetValues.scrollHeight}px`:`${this.initHeight}px`;setTimeout((()=>{this.widgetContent.style.height=`${this.widgetContent.scrollHeight}px`}),400)}async toggleWidget(){this.isOpen=!this.isOpen;h.toggleElementClassIf(this.widgetContent,"s-filters-widget-opened","s-filters-widget-closed",(()=>this.isOpen))}renderFilterOption(s){if(![l.VALUES,l.MINIMUM,l.VARIANTS].includes(s.type)){return""}return s.values.map(((t,e)=>{let a=typeof t=="number"?t:t.key||t.value;return i("label",{class:"s-filters-label",htmlFor:`${s.key}-option-${a}`,key:`${s.key}-option-${a}`},i("input",{id:`${s.key}-option-${a}`,name:s.key,type:"radio",checked:this.isSelectedOption(s,a),class:`s-filters-radio`,onChange:t=>this.changed.emit({event:t,option:s,value:a})}),this.getOptionLabel(s,t))}))}isSelectedOption(s,t){if(s.type===l.MINIMUM){return this.filtersData[s.key]==t}if(s.type===l.VARIANTS){return this.filtersData[s.type]&&this.filtersData[s.type][Object.keys(this.filtersData[s.type])[0]]==t}if(s.type===l.RANGE){return this.filtersData[s.key]&&this.filtersData[s.key].min==t.min&&this.filtersData[s.key].max==t.max}if(s.type===l.VALUES){return this.filtersData[s.key]&&Number(this.filtersData[s.key])==Number(t)}return false}getOptionLabel(s,t){if(s.key=="rating"){return i("salla-rating-stars",{size:"small",value:t})}let e=t.value||"null";return i("span",{class:"s-filters-option-name"},e)}render(){return i(e,{key:"d6f2078b058a8244a95a78e879886f3b04e0e1c0",class:"s-filters-widget-container"},i("h3",{key:"40ff9f985604de49752b38c0fc66611cd1811857",class:"s-filters-widget-title",onClick:()=>this.toggleWidget()},i("span",{key:"06847af2f3f089afb3223e4ce4c56bfa1cb195d5"},this.option.label),i("span",{key:"8ecf9c638f7ad163cda5f7235ecac66661cf8e68",class:`s-filters-widget-plusminus ${this.isOpen?"s-filters-widget-plusminus-active":""}`})),i("div",{key:"15c98c71532ec2bf1f43f3e9bcc1d964a0f3d88d",class:"s-filters-widget-content",ref:s=>this.widgetContent=s},i("div",{key:"f1221b0ce096e1fda0044776bfdba952a990230c",class:"s-filters-widget-values",ref:s=>this.widgetValues=s},i("slot",{key:"1612242828f38a9c086d2a7887174bcdde05618b"}),this.option.type!==l.RANGE?this.renderFilterOption(this.option):i("salla-price-range",{onChanged:s=>{this.changed.emit(s.detail)},ref:s=>this.priceRange=s,filtersData:this.filtersData,option:this.option})),this.withLoadMore&&i("a",{key:"5726822a429c26ee9ddadaf7351e8d32a3a98695",class:"s-filters-widget-more",onClick:()=>this.showMore()},!this.isShowMore?this.showMoreLabel:this.showLessLabel)))}get host(){return a(this)}};n.style=r;export{n as salla_filters_widget};
5
- //# sourceMappingURL=p-b932035d.entry.js.map
4
+ import{r as s,c as t,h as i,H as e,g as a}from"./p-DJeJWTdD.js";import{H as h}from"./p-DjVGZdqd.js";import{F as l}from"./p-DL4h2bc3.js";import"./p-CgtvEd63.js";const r=":host{display:block}";const n=class{constructor(i){s(this,i);this.changed=t(this,"changed");this.initHeight=195;this.isOpen=true;this.isShowMore=false;this.showMoreLabel="عرض المزيد";this.showLessLabel="عرض أقل";this.page=salla.config.get("page")}connectedCallback(){this.withLoadMore=this.option.key!="price"&&Array.isArray(this.option.values)&&this.option.values.length>8;salla.onReady((()=>{this.page=salla.config.get("page")}));salla.lang.onLoaded((()=>{this.showMoreLabel=salla.lang.getWithDefault("common.titles.more",this.showMoreLabel);this.showLessLabel=salla.lang.getWithDefault("common.elements.show_less",this.showLessLabel)}))}componentDidLoad(){this.widgetValues.scrollHeight<this.initHeight&&(this.withLoadMore=false);this.withLoadMore&&this.widgetValues&&(this.widgetValues.style.maxHeight=`${this.initHeight}px`);this.widgetContent.style.height=`${this.widgetContent.scrollHeight}px`}async setWidgetHeight(s=250){this.widgetContent.removeAttribute("style");setTimeout((()=>{let s=this.widgetContent.scrollHeight;this.widgetContent.style.height=s+"px"}),s)}async reset(){if(this.option.type===l.RANGE){this.priceRange.reset()}Array.from(this.host.querySelectorAll("input")).forEach((s=>s.checked=false))}async showMore(){this.isShowMore=!this.isShowMore;this.widgetContent.style.height="auto";this.widgetValues.style.maxHeight=this.isShowMore?`${this.widgetValues.scrollHeight}px`:`${this.initHeight}px`;setTimeout((()=>{this.widgetContent.style.height=`${this.widgetContent.scrollHeight}px`}),400)}async toggleWidget(){this.isOpen=!this.isOpen;h.toggleElementClassIf(this.widgetContent,"s-filters-widget-opened","s-filters-widget-closed",(()=>this.isOpen))}renderFilterOption(s){if(![l.VALUES,l.MINIMUM,l.VARIANTS].includes(s.type)){return""}return s.values.map(((t,e)=>{let a=typeof t=="number"?t:t.key||t.value;return i("label",{class:"s-filters-label",htmlFor:`${s.key}-option-${a}`,key:`${s.key}-option-${a}`},i("input",{id:`${s.key}-option-${a}`,name:s.key,type:"radio",checked:this.isSelectedOption(s,a),class:`s-filters-radio`,onChange:t=>this.changed.emit({event:t,option:s,value:a})}),this.getOptionLabel(s,t))}))}isSelectedOption(s,t){if(s.type===l.MINIMUM){return this.filtersData[s.key]==t}if(s.type===l.VARIANTS){return this.filtersData[s.type]&&this.filtersData[s.type][Object.keys(this.filtersData[s.type])[0]]==t}if(s.type===l.RANGE){return this.filtersData[s.key]&&this.filtersData[s.key].min==t.min&&this.filtersData[s.key].max==t.max}if(s.type===l.VALUES){return this.filtersData[s.key]&&Number(this.filtersData[s.key])==Number(t)}return false}getOptionLabel(s,t){if(s.key=="rating"){return i("salla-rating-stars",{size:"small",value:t})}let e=t.value||"null";return i("span",{class:"s-filters-option-name"},e)}render(){return i(e,{key:"d6f2078b058a8244a95a78e879886f3b04e0e1c0",class:"s-filters-widget-container"},i("h3",{key:"40ff9f985604de49752b38c0fc66611cd1811857",class:"s-filters-widget-title",onClick:()=>this.toggleWidget()},i("span",{key:"06847af2f3f089afb3223e4ce4c56bfa1cb195d5"},this.option.label),i("span",{key:"8ecf9c638f7ad163cda5f7235ecac66661cf8e68",class:`s-filters-widget-plusminus ${this.isOpen?"s-filters-widget-plusminus-active":""}`})),i("div",{key:"15c98c71532ec2bf1f43f3e9bcc1d964a0f3d88d",class:"s-filters-widget-content",ref:s=>this.widgetContent=s},i("div",{key:"f1221b0ce096e1fda0044776bfdba952a990230c",class:"s-filters-widget-values",ref:s=>this.widgetValues=s},i("slot",{key:"1612242828f38a9c086d2a7887174bcdde05618b"}),this.option.type!==l.RANGE?this.renderFilterOption(this.option):i("salla-price-range",{onChanged:s=>{this.changed.emit(s.detail)},ref:s=>this.priceRange=s,filtersData:this.filtersData,option:this.option})),this.withLoadMore&&i("a",{key:"5726822a429c26ee9ddadaf7351e8d32a3a98695",class:"s-filters-widget-more",onClick:()=>this.showMore()},!this.isShowMore?this.showMoreLabel:this.showLessLabel)))}get host(){return a(this)}};n.style=r;export{n as salla_filters_widget};
5
+ //# sourceMappingURL=p-aae55c3c.entry.js.map