@salla.sa/twilight-components 2.14.166 → 2.14.167

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 (274) hide show
  1. package/dist/cjs/{app-globals-BvFSBfoT.js → app-globals-CqcxWCqd.js} +3 -3
  2. package/dist/cjs/{app-globals-BvFSBfoT.js.map → app-globals-CqcxWCqd.js.map} +1 -1
  3. package/dist/cjs/{index-iU0iVUza.js → index-D-KtTWOY.js} +4 -4
  4. package/dist/cjs/{index-iU0iVUza.js.map → index-D-KtTWOY.js.map} +1 -1
  5. package/dist/cjs/loader.cjs.js +2 -2
  6. package/dist/cjs/salla-add-product-button_49.cjs.entry.js +1 -1
  7. package/dist/cjs/salla-advertisement.cjs.entry.js +1 -1
  8. package/dist/cjs/salla-app-install-alert.cjs.entry.js +1 -1
  9. package/dist/cjs/salla-apps-icons.cjs.entry.js +1 -1
  10. package/dist/cjs/salla-booking-field_2.cjs.entry.js +1 -1
  11. package/dist/cjs/salla-cart-item-offers.cjs.entry.js +1 -1
  12. package/dist/cjs/salla-conditional-offer.cjs.entry.js +3 -3
  13. package/dist/cjs/salla-conditional-offer.cjs.entry.js.map +1 -1
  14. package/dist/cjs/salla-conditional-offer.entry.cjs.js.map +1 -1
  15. package/dist/cjs/salla-contacts.cjs.entry.js +1 -1
  16. package/dist/cjs/salla-filters-widget.cjs.entry.js +1 -1
  17. package/dist/cjs/salla-filters.cjs.entry.js +1 -1
  18. package/dist/cjs/salla-installment.cjs.entry.js +1 -1
  19. package/dist/cjs/salla-loyalty-prize-item.cjs.entry.js +1 -1
  20. package/dist/cjs/salla-metadata.cjs.entry.js +1 -1
  21. package/dist/cjs/salla-notification-item.cjs.entry.js +1 -1
  22. package/dist/cjs/salla-notifications.cjs.entry.js +1 -1
  23. package/dist/cjs/salla-offer.cjs.entry.js +1 -1
  24. package/dist/cjs/salla-order-summary.cjs.entry.js +1 -1
  25. package/dist/cjs/salla-orders.cjs.entry.js +1 -1
  26. package/dist/cjs/salla-payments.cjs.entry.js +1 -1
  27. package/dist/cjs/salla-price-range.cjs.entry.js +1 -1
  28. package/dist/cjs/salla-product-options.cjs.entry.js +1 -1
  29. package/dist/cjs/salla-review-card.cjs.entry.js +1 -1
  30. package/dist/cjs/salla-reviews-page.cjs.entry.js +1 -1
  31. package/dist/cjs/salla-reviews.cjs.entry.js +1 -1
  32. package/dist/cjs/salla-social.cjs.entry.js +1 -1
  33. package/dist/cjs/salla-tooltip.cjs.entry.js +1 -1
  34. package/dist/cjs/salla-verify.cjs.entry.js +1 -1
  35. package/dist/cjs/salla-wallet.cjs.entry.js +1 -1
  36. package/dist/cjs/twilight.cjs.js +2 -2
  37. package/dist/collection/components/salla-conditional-offer/interfaces.js.map +1 -1
  38. package/dist/collection/components/salla-conditional-offer/salla-conditional-offer.js +2 -2
  39. package/dist/collection/components/salla-conditional-offer/salla-conditional-offer.js.map +1 -1
  40. package/dist/components/index.js +2 -2
  41. package/dist/components/index.js.map +1 -1
  42. package/dist/components/salla-conditional-offer.js +2 -2
  43. package/dist/components/salla-conditional-offer.js.map +1 -1
  44. package/dist/esm/{app-globals-sE_ZSx6e.js → app-globals-BW7wDI-P.js} +3 -3
  45. package/dist/esm/{app-globals-sE_ZSx6e.js.map → app-globals-BW7wDI-P.js.map} +1 -1
  46. package/dist/esm/{index-BJcojI6v.js → index-HB9ZridH.js} +4 -4
  47. package/dist/esm/{index-BJcojI6v.js.map → index-HB9ZridH.js.map} +1 -1
  48. package/dist/esm/loader.js +3 -3
  49. package/dist/esm/salla-add-product-button_49.entry.js +1 -1
  50. package/dist/esm/salla-advertisement.entry.js +1 -1
  51. package/dist/esm/salla-app-install-alert.entry.js +1 -1
  52. package/dist/esm/salla-apps-icons.entry.js +1 -1
  53. package/dist/esm/salla-booking-field_2.entry.js +1 -1
  54. package/dist/esm/salla-cart-item-offers.entry.js +1 -1
  55. package/dist/esm/salla-conditional-offer.entry.js +3 -3
  56. package/dist/esm/salla-conditional-offer.entry.js.map +1 -1
  57. package/dist/esm/salla-contacts.entry.js +1 -1
  58. package/dist/esm/salla-filters-widget.entry.js +1 -1
  59. package/dist/esm/salla-filters.entry.js +1 -1
  60. package/dist/esm/salla-installment.entry.js +1 -1
  61. package/dist/esm/salla-loyalty-prize-item.entry.js +1 -1
  62. package/dist/esm/salla-metadata.entry.js +1 -1
  63. package/dist/esm/salla-notification-item.entry.js +1 -1
  64. package/dist/esm/salla-notifications.entry.js +1 -1
  65. package/dist/esm/salla-offer.entry.js +1 -1
  66. package/dist/esm/salla-order-summary.entry.js +1 -1
  67. package/dist/esm/salla-orders.entry.js +1 -1
  68. package/dist/esm/salla-payments.entry.js +1 -1
  69. package/dist/esm/salla-price-range.entry.js +1 -1
  70. package/dist/esm/salla-product-options.entry.js +1 -1
  71. package/dist/esm/salla-review-card.entry.js +1 -1
  72. package/dist/esm/salla-reviews-page.entry.js +1 -1
  73. package/dist/esm/salla-reviews.entry.js +1 -1
  74. package/dist/esm/salla-social.entry.js +1 -1
  75. package/dist/esm/salla-tooltip.entry.js +1 -1
  76. package/dist/esm/salla-verify.entry.js +1 -1
  77. package/dist/esm/salla-wallet.entry.js +1 -1
  78. package/dist/esm/twilight.js +3 -3
  79. package/dist/esm-es5/{app-globals-sE_ZSx6e.js → app-globals-BW7wDI-P.js} +2 -2
  80. package/dist/esm-es5/{app-globals-sE_ZSx6e.js.map → app-globals-BW7wDI-P.js.map} +1 -1
  81. package/dist/esm-es5/{index-BJcojI6v.js → index-HB9ZridH.js} +3 -3
  82. package/dist/esm-es5/{index-BJcojI6v.js.map → index-HB9ZridH.js.map} +1 -1
  83. package/dist/esm-es5/loader.js +1 -1
  84. package/dist/esm-es5/salla-add-product-button_49.entry.js +1 -1
  85. package/dist/esm-es5/salla-advertisement.entry.js +1 -1
  86. package/dist/esm-es5/salla-app-install-alert.entry.js +1 -1
  87. package/dist/esm-es5/salla-apps-icons.entry.js +1 -1
  88. package/dist/esm-es5/salla-booking-field_2.entry.js +1 -1
  89. package/dist/esm-es5/salla-cart-item-offers.entry.js +1 -1
  90. package/dist/esm-es5/salla-conditional-offer.entry.js +1 -1
  91. package/dist/esm-es5/salla-conditional-offer.entry.js.map +1 -1
  92. package/dist/esm-es5/salla-contacts.entry.js +1 -1
  93. package/dist/esm-es5/salla-filters-widget.entry.js +2 -2
  94. package/dist/esm-es5/salla-filters.entry.js +1 -1
  95. package/dist/esm-es5/salla-installment.entry.js +1 -1
  96. package/dist/esm-es5/salla-loyalty-prize-item.entry.js +1 -1
  97. package/dist/esm-es5/salla-metadata.entry.js +1 -1
  98. package/dist/esm-es5/salla-notification-item.entry.js +1 -1
  99. package/dist/esm-es5/salla-notifications.entry.js +1 -1
  100. package/dist/esm-es5/salla-offer.entry.js +1 -1
  101. package/dist/esm-es5/salla-order-summary.entry.js +2 -2
  102. package/dist/esm-es5/salla-orders.entry.js +2 -2
  103. package/dist/esm-es5/salla-payments.entry.js +1 -1
  104. package/dist/esm-es5/salla-price-range.entry.js +1 -1
  105. package/dist/esm-es5/salla-product-options.entry.js +1 -1
  106. package/dist/esm-es5/salla-review-card.entry.js +1 -1
  107. package/dist/esm-es5/salla-reviews-page.entry.js +1 -1
  108. package/dist/esm-es5/salla-reviews.entry.js +1 -1
  109. package/dist/esm-es5/salla-social.entry.js +1 -1
  110. package/dist/esm-es5/salla-tooltip.entry.js +1 -1
  111. package/dist/esm-es5/salla-verify.entry.js +1 -1
  112. package/dist/esm-es5/salla-wallet.entry.js +1 -1
  113. package/dist/esm-es5/twilight.js +1 -1
  114. package/dist/twilight/{p-b93f8a7b.system.entry.js → p-018a4264.system.entry.js} +2 -2
  115. package/dist/twilight/{p-9f151920.system.entry.js → p-0adaa176.system.entry.js} +2 -2
  116. package/dist/twilight/{p-905c335e.system.entry.js → p-0b0da808.system.entry.js} +2 -2
  117. package/dist/twilight/{p-1b069f5c.entry.js → p-115ce83d.entry.js} +2 -2
  118. package/dist/twilight/{p-eb859ac0.entry.js → p-11a0fecd.entry.js} +2 -2
  119. package/dist/twilight/{p-2139323e.entry.js → p-140a0990.entry.js} +2 -2
  120. package/dist/twilight/{p-263f39a8.system.entry.js → p-18082ec1.system.entry.js} +2 -2
  121. package/dist/twilight/{p-8177ab73.entry.js → p-1af9dbf8.entry.js} +2 -2
  122. package/dist/twilight/{p-e75ddf6b.entry.js → p-1c53591a.entry.js} +2 -2
  123. package/dist/twilight/{p-09d4e21c.system.entry.js → p-25cbcf1c.system.entry.js} +2 -2
  124. package/dist/twilight/{p-04acb9d5.system.entry.js → p-27aebbcd.system.entry.js} +2 -2
  125. package/dist/twilight/{p-f192ed81.entry.js → p-2b99b086.entry.js} +2 -2
  126. package/dist/twilight/{p-f5534187.entry.js → p-2d1f7977.entry.js} +2 -2
  127. package/dist/twilight/{p-fc5309ad.entry.js → p-3a78e4d7.entry.js} +2 -2
  128. package/dist/twilight/{p-9ddaf4b2.entry.js → p-3ab4a46b.entry.js} +2 -2
  129. package/dist/twilight/{p-ca989cdf.entry.js → p-3cfec44f.entry.js} +2 -2
  130. package/dist/twilight/{p-5237da49.system.entry.js → p-3dbc2c39.system.entry.js} +2 -2
  131. package/dist/twilight/{p-718df47e.system.entry.js → p-42e676d3.system.entry.js} +2 -2
  132. package/dist/twilight/{p-2984d7ee.entry.js → p-4ead18f6.entry.js} +2 -2
  133. package/dist/twilight/{p-BoU3rP9-.system.js → p-4qgD8zrp.system.js} +3 -3
  134. package/dist/twilight/{p-BoU3rP9-.system.js.map → p-4qgD8zrp.system.js.map} +1 -1
  135. package/dist/twilight/p-4xZSWcLX.system.js.map +1 -0
  136. package/dist/twilight/{p-5c3c4081.system.entry.js → p-54d76fcb.system.entry.js} +2 -2
  137. package/dist/twilight/{p-0c7e997f.entry.js → p-571fd3fe.entry.js} +2 -2
  138. package/dist/twilight/{p-3f973235.entry.js → p-62e836b7.entry.js} +2 -2
  139. package/dist/twilight/{p-6993e228.system.entry.js → p-63c55af5.system.entry.js} +2 -2
  140. package/dist/twilight/{p-1fcbf6bb.system.entry.js → p-657759bd.system.entry.js} +3 -3
  141. package/dist/twilight/{p-c76c05ff.entry.js → p-65a5aea9.entry.js} +2 -2
  142. package/dist/twilight/{p-551f5ae2.system.entry.js → p-6969cf59.system.entry.js} +2 -2
  143. package/dist/twilight/{p-f1493561.system.entry.js → p-6b8b9a13.system.entry.js} +2 -2
  144. package/dist/twilight/{p-4163dbb9.entry.js → p-777b4d0d.entry.js} +2 -2
  145. package/dist/twilight/{p-bd675f34.entry.js → p-7b4e7a7e.entry.js} +2 -2
  146. package/dist/twilight/p-7f3c4a51.system.entry.js +5 -0
  147. package/dist/twilight/p-7f3c4a51.system.entry.js.map +1 -0
  148. package/dist/twilight/{p-c5f58299.system.entry.js → p-83c8210e.system.entry.js} +2 -2
  149. package/dist/twilight/{p-26849df9.entry.js → p-95846a36.entry.js} +2 -2
  150. package/dist/twilight/{p-9f64a8a7.system.entry.js → p-9b5db207.system.entry.js} +2 -2
  151. package/dist/twilight/{p-26a83313.entry.js → p-9d53cdd8.entry.js} +2 -2
  152. package/dist/twilight/{p-fa752787.entry.js → p-9f0d1bdc.entry.js} +2 -2
  153. package/dist/twilight/{p-pX5I3INC.system.js.map → p-BQvQcx7N.system.js.map} +1 -1
  154. package/dist/twilight/{p-Bf0LxwB7.system.js.map → p-BTHAzAMQ.system.js.map} +1 -1
  155. package/dist/twilight/{p-BEBnH0T8.js → p-BqMvN5Kj.js} +2 -2
  156. package/dist/twilight/{p-BEBnH0T8.js.map → p-BqMvN5Kj.js.map} +1 -1
  157. package/dist/twilight/{p-Ck-MMoh4.system.js.map → p-Bu3GSKpN.system.js.map} +1 -1
  158. package/dist/twilight/{p-_Df6_reQ.system.js → p-CD871YNy.system.js} +2 -2
  159. package/dist/twilight/{p-_Df6_reQ.system.js.map → p-CD871YNy.system.js.map} +1 -1
  160. package/dist/twilight/{p-NnKijTrt.system.js.map → p-CQNKVsuc.system.js.map} +1 -1
  161. package/dist/twilight/{p-lA-1m-p5.system.js.map → p-Cbo6DTNd.system.js.map} +1 -1
  162. package/dist/twilight/{p-0Xmugzgq.system.js.map → p-CfbhNoJK.system.js.map} +1 -1
  163. package/dist/twilight/{p-D_NAqNa-.system.js → p-CqnUDkqq.system.js} +2 -2
  164. package/dist/twilight/{p-D_NAqNa-.system.js.map → p-CqnUDkqq.system.js.map} +1 -1
  165. package/dist/twilight/{p-B_ARsANj.system.js.map → p-CxoV9-M0.system.js.map} +1 -1
  166. package/dist/twilight/{p-BEz4dPyy.system.js.map → p-D4UzUaL6.system.js.map} +1 -1
  167. package/dist/twilight/{p-vJ_LeDO0.system.js.map → p-D8gru-kY.system.js.map} +1 -1
  168. package/dist/twilight/{p-X_JjG62r.system.js.map → p-DCau09Ja.system.js.map} +1 -1
  169. package/dist/twilight/{p-Cv3L1tRD.system.js.map → p-DU96usjD.system.js.map} +1 -1
  170. package/dist/twilight/{p-ByPmVcaW.system.js.map → p-DVm8JX0_.system.js.map} +1 -1
  171. package/dist/twilight/{p-BPHisSBS.system.js.map → p-Dc1sSeqy.system.js.map} +1 -1
  172. package/dist/twilight/{p-DMEPVSYJ.system.js.map → p-DiOMIMGR.system.js.map} +1 -1
  173. package/dist/twilight/{p-Bp3Jex-u.system.js.map → p-DnQPJ8nb.system.js.map} +1 -1
  174. package/dist/twilight/{p-BE4Tntj5.system.js.map → p-DtJ60QVH.system.js.map} +1 -1
  175. package/dist/twilight/{p-Be9PHZ6-.system.js.map → p-DtzirMaL.system.js.map} +1 -1
  176. package/dist/twilight/{p-BJcojI6v.js → p-HB9ZridH.js} +3 -3
  177. package/dist/twilight/{p-BJcojI6v.js.map → p-HB9ZridH.js.map} +1 -1
  178. package/dist/twilight/{p-BRFHsZkg.system.js.map → p-IKkAUd7v.system.js.map} +1 -1
  179. package/dist/twilight/{p-qgRft6ys.system.js.map → p-JNV6VoJP.system.js.map} +1 -1
  180. package/dist/twilight/{p-BRNwBf6q.system.js.map → p-JsJqzbss.system.js.map} +1 -1
  181. package/dist/twilight/{p-BMEAfpcQ.system.js.map → p-KCNcL1Nf.system.js.map} +1 -1
  182. package/dist/twilight/{p-BNfhCOep.system.js.map → p-MTv28B5b.system.js.map} +1 -1
  183. package/dist/twilight/{p-DiIWpMR9.system.js.map → p-NwgMlLD3.system.js.map} +1 -1
  184. package/dist/twilight/{p-8ewm7cmP.system.js.map → p-Rx3u4GRS.system.js.map} +1 -1
  185. package/dist/twilight/{p-DdgccFjk.system.js.map → p-YoeZhUmk.system.js.map} +1 -1
  186. package/dist/twilight/{p-CUrjp7xM.system.js.map → p-bH2k6BVg.system.js.map} +1 -1
  187. package/dist/twilight/{p-b66ce34c.system.entry.js → p-ba627edf.system.entry.js} +2 -2
  188. package/dist/twilight/{p-08c7235b.system.entry.js → p-bff46bc5.system.entry.js} +2 -2
  189. package/dist/twilight/{p-b3df8eba.entry.js → p-c8c58cb2.entry.js} +2 -2
  190. package/dist/twilight/{p-BxiSZFuT.system.js.map → p-cEbMaIWW.system.js.map} +1 -1
  191. package/dist/twilight/{p-7b1212df.system.entry.js → p-cc093f3f.system.entry.js} +2 -2
  192. package/dist/twilight/{p-dae66c49.entry.js → p-ccb0d6ba.entry.js} +2 -2
  193. package/dist/twilight/{p-6984531d.entry.js → p-d801fe6e.entry.js} +8 -8
  194. package/dist/twilight/{p-cdfb75e6.system.entry.js → p-d97da348.system.entry.js} +2 -2
  195. package/dist/twilight/{p-efb54461.entry.js → p-dc42fa00.entry.js} +2 -2
  196. package/dist/twilight/{p-8c1eca80.system.entry.js → p-deaef62c.system.entry.js} +2 -2
  197. package/dist/twilight/{p-cac0a37c.system.entry.js → p-e4995b27.system.entry.js} +2 -2
  198. package/dist/twilight/{p-ea45208a.system.entry.js → p-e5dd5833.system.entry.js} +2 -2
  199. package/dist/twilight/{p-277a736d.system.entry.js → p-e694d085.system.entry.js} +2 -2
  200. package/dist/twilight/{p-8c5e2cf8.system.entry.js → p-e7a279f5.system.entry.js} +2 -2
  201. package/dist/twilight/{p-1593ada3.entry.js → p-e7a9c16d.entry.js} +2 -2
  202. package/dist/twilight/{p-cc93cc27.system.entry.js → p-eb73d789.system.entry.js} +2 -2
  203. package/dist/twilight/{p-041cfdc6.system.entry.js → p-ee38e0ca.system.entry.js} +2 -2
  204. package/dist/twilight/{p-a8128d9a.entry.js → p-f4fa6e8a.entry.js} +2 -2
  205. package/dist/twilight/{p-55cef941.entry.js → p-f935e6b0.entry.js} +2 -2
  206. package/dist/twilight/{p-eb86070c.entry.js → p-fac2eb83.entry.js} +2 -2
  207. package/dist/twilight/p-ffad31bf.entry.js +5 -0
  208. package/dist/twilight/p-ffad31bf.entry.js.map +1 -0
  209. package/dist/twilight/{p-4526ac8e.system.entry.js → p-fff3ded4.system.entry.js} +2 -2
  210. package/dist/twilight/{p-CQJr95JP.system.js.map → p-jANnJoRR.system.js.map} +1 -1
  211. package/dist/twilight/salla-conditional-offer.entry.esm.js.map +1 -1
  212. package/dist/twilight/twilight.esm.js +1 -1
  213. package/dist/twilight/twilight.js +1 -1
  214. package/dist/types/components/salla-conditional-offer/interfaces.d.ts +1 -1
  215. package/package.json +5 -5
  216. package/dist/twilight/p-50baf30c.entry.js +0 -5
  217. package/dist/twilight/p-50baf30c.entry.js.map +0 -1
  218. package/dist/twilight/p-689aca0e.system.entry.js +0 -5
  219. package/dist/twilight/p-689aca0e.system.entry.js.map +0 -1
  220. package/dist/twilight/p-oYwTKzyC.system.js.map +0 -1
  221. /package/dist/twilight/{p-b93f8a7b.system.entry.js.map → p-018a4264.system.entry.js.map} +0 -0
  222. /package/dist/twilight/{p-9f151920.system.entry.js.map → p-0adaa176.system.entry.js.map} +0 -0
  223. /package/dist/twilight/{p-905c335e.system.entry.js.map → p-0b0da808.system.entry.js.map} +0 -0
  224. /package/dist/twilight/{p-1b069f5c.entry.js.map → p-115ce83d.entry.js.map} +0 -0
  225. /package/dist/twilight/{p-eb859ac0.entry.js.map → p-11a0fecd.entry.js.map} +0 -0
  226. /package/dist/twilight/{p-2139323e.entry.js.map → p-140a0990.entry.js.map} +0 -0
  227. /package/dist/twilight/{p-263f39a8.system.entry.js.map → p-18082ec1.system.entry.js.map} +0 -0
  228. /package/dist/twilight/{p-8177ab73.entry.js.map → p-1af9dbf8.entry.js.map} +0 -0
  229. /package/dist/twilight/{p-e75ddf6b.entry.js.map → p-1c53591a.entry.js.map} +0 -0
  230. /package/dist/twilight/{p-09d4e21c.system.entry.js.map → p-25cbcf1c.system.entry.js.map} +0 -0
  231. /package/dist/twilight/{p-04acb9d5.system.entry.js.map → p-27aebbcd.system.entry.js.map} +0 -0
  232. /package/dist/twilight/{p-f192ed81.entry.js.map → p-2b99b086.entry.js.map} +0 -0
  233. /package/dist/twilight/{p-f5534187.entry.js.map → p-2d1f7977.entry.js.map} +0 -0
  234. /package/dist/twilight/{p-fc5309ad.entry.js.map → p-3a78e4d7.entry.js.map} +0 -0
  235. /package/dist/twilight/{p-9ddaf4b2.entry.js.map → p-3ab4a46b.entry.js.map} +0 -0
  236. /package/dist/twilight/{p-ca989cdf.entry.js.map → p-3cfec44f.entry.js.map} +0 -0
  237. /package/dist/twilight/{p-5237da49.system.entry.js.map → p-3dbc2c39.system.entry.js.map} +0 -0
  238. /package/dist/twilight/{p-718df47e.system.entry.js.map → p-42e676d3.system.entry.js.map} +0 -0
  239. /package/dist/twilight/{p-2984d7ee.entry.js.map → p-4ead18f6.entry.js.map} +0 -0
  240. /package/dist/twilight/{p-5c3c4081.system.entry.js.map → p-54d76fcb.system.entry.js.map} +0 -0
  241. /package/dist/twilight/{p-0c7e997f.entry.js.map → p-571fd3fe.entry.js.map} +0 -0
  242. /package/dist/twilight/{p-3f973235.entry.js.map → p-62e836b7.entry.js.map} +0 -0
  243. /package/dist/twilight/{p-6993e228.system.entry.js.map → p-63c55af5.system.entry.js.map} +0 -0
  244. /package/dist/twilight/{p-1fcbf6bb.system.entry.js.map → p-657759bd.system.entry.js.map} +0 -0
  245. /package/dist/twilight/{p-c76c05ff.entry.js.map → p-65a5aea9.entry.js.map} +0 -0
  246. /package/dist/twilight/{p-551f5ae2.system.entry.js.map → p-6969cf59.system.entry.js.map} +0 -0
  247. /package/dist/twilight/{p-f1493561.system.entry.js.map → p-6b8b9a13.system.entry.js.map} +0 -0
  248. /package/dist/twilight/{p-4163dbb9.entry.js.map → p-777b4d0d.entry.js.map} +0 -0
  249. /package/dist/twilight/{p-bd675f34.entry.js.map → p-7b4e7a7e.entry.js.map} +0 -0
  250. /package/dist/twilight/{p-c5f58299.system.entry.js.map → p-83c8210e.system.entry.js.map} +0 -0
  251. /package/dist/twilight/{p-26849df9.entry.js.map → p-95846a36.entry.js.map} +0 -0
  252. /package/dist/twilight/{p-9f64a8a7.system.entry.js.map → p-9b5db207.system.entry.js.map} +0 -0
  253. /package/dist/twilight/{p-26a83313.entry.js.map → p-9d53cdd8.entry.js.map} +0 -0
  254. /package/dist/twilight/{p-fa752787.entry.js.map → p-9f0d1bdc.entry.js.map} +0 -0
  255. /package/dist/twilight/{p-b66ce34c.system.entry.js.map → p-ba627edf.system.entry.js.map} +0 -0
  256. /package/dist/twilight/{p-08c7235b.system.entry.js.map → p-bff46bc5.system.entry.js.map} +0 -0
  257. /package/dist/twilight/{p-b3df8eba.entry.js.map → p-c8c58cb2.entry.js.map} +0 -0
  258. /package/dist/twilight/{p-7b1212df.system.entry.js.map → p-cc093f3f.system.entry.js.map} +0 -0
  259. /package/dist/twilight/{p-dae66c49.entry.js.map → p-ccb0d6ba.entry.js.map} +0 -0
  260. /package/dist/twilight/{p-6984531d.entry.js.map → p-d801fe6e.entry.js.map} +0 -0
  261. /package/dist/twilight/{p-cdfb75e6.system.entry.js.map → p-d97da348.system.entry.js.map} +0 -0
  262. /package/dist/twilight/{p-efb54461.entry.js.map → p-dc42fa00.entry.js.map} +0 -0
  263. /package/dist/twilight/{p-8c1eca80.system.entry.js.map → p-deaef62c.system.entry.js.map} +0 -0
  264. /package/dist/twilight/{p-cac0a37c.system.entry.js.map → p-e4995b27.system.entry.js.map} +0 -0
  265. /package/dist/twilight/{p-ea45208a.system.entry.js.map → p-e5dd5833.system.entry.js.map} +0 -0
  266. /package/dist/twilight/{p-277a736d.system.entry.js.map → p-e694d085.system.entry.js.map} +0 -0
  267. /package/dist/twilight/{p-8c5e2cf8.system.entry.js.map → p-e7a279f5.system.entry.js.map} +0 -0
  268. /package/dist/twilight/{p-1593ada3.entry.js.map → p-e7a9c16d.entry.js.map} +0 -0
  269. /package/dist/twilight/{p-cc93cc27.system.entry.js.map → p-eb73d789.system.entry.js.map} +0 -0
  270. /package/dist/twilight/{p-041cfdc6.system.entry.js.map → p-ee38e0ca.system.entry.js.map} +0 -0
  271. /package/dist/twilight/{p-a8128d9a.entry.js.map → p-f4fa6e8a.entry.js.map} +0 -0
  272. /package/dist/twilight/{p-55cef941.entry.js.map → p-f935e6b0.entry.js.map} +0 -0
  273. /package/dist/twilight/{p-eb86070c.entry.js.map → p-fac2eb83.entry.js.map} +0 -0
  274. /package/dist/twilight/{p-4526ac8e.system.entry.js.map → p-fff3ded4.system.entry.js.map} +0 -0
@@ -1,5 +1,5 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r as registerInstance,h,H as Host}from"./index-BJcojI6v.js";var DiscountType;(function(i){i["PERCENTAGE"]="percentage";i["FIXED"]="fixed";i["FREE_PRODUCT"]="free_product"})(DiscountType||(DiscountType={}));var OfferType;(function(i){i["PRODUCT_COUNT"]="products_count";i["PRODUCT_PURCHASE"]="order_amount"})(OfferType||(OfferType={}));var sallaConditionalOfferCss=":host{display:block}";var SallaConditionalOffer=function(){function i(i){registerInstance(this,i);this.offer=null;this.products={};this.isLoading=true;this.canRender=true}i.prototype.componentWillLoad=function(){var i=this;salla.onReady().then((function(){var i,n,t;if(!((i=salla.config.get("store.features"))===null||i===void 0?void 0:i.includes("conditional-offer"))||salla.storage.get("cart")!==""&&!((t=(n=salla.storage.get("cart"))===null||n===void 0?void 0:n.summary)===null||t===void 0?void 0:t.count)){throw new Error("feature or cart object does not existed")}})).then((function(){return salla.api.cart.offers()})).then((function(n){var t=n.data;i.offer=t.find((function(i){return i.type==="conditional"}));if(!i.offer){throw new Error("No conditional offer has been activated in the merchant dashboard")}i.offer.details.discounts.unshift({value:0,min_spend:0});return i.updateInitialOfferValue()})).then((function(){return i.getProducts()})).then((function(){return salla.event.on("cart::updated",(function(n){return i.updateOfferValues(n)}))})).catch((function(n){i.canRender=false;salla.logger.warn("salla-conditional-offer:: ",n)})).finally((function(){i.isLoading=false}))};i.prototype.getProducts=function(){var i=this;var n=this.offer.details.discounts.filter((function(i){var n=i.type;return n===DiscountType.FREE_PRODUCT})).map((function(i){var n=i.value;return n}));if(n.length>0){return salla.product.fetch({source:"selected",source_value:n}).then((function(n){var t=n.data;t.forEach((function(n){var t=n.id,e=n.url,o=n.image;i.products[t]={url:e,image:o}}))}))}};i.prototype.updateInitialOfferValue=function(){var i=this;return salla.api.cart.details().then((function(n){var t=n.data.cart;return i.updateOfferValues(t)}))};i.prototype.updateOfferValues=function(i){var n=i.items,t=i.total;var e;var o=this.offer.details.based_on===OfferType.PRODUCT_COUNT?n.reduce((function(i,n){var t=n.quantity;return i+t}),0):t;this.offer=Object.assign(Object.assign({},this.offer),{details:Object.assign(Object.assign({},(e=this.offer)===null||e===void 0?void 0:e.details),{current_value:o})});return this.offer};i.prototype.getCheckpointContent=function(i){var n,t;if(i.type===DiscountType.PERCENTAGE)return"".concat(i.value,"%");if(i.type===DiscountType.FIXED)return salla.money(i.value);if(i.type!==DiscountType.FREE_PRODUCT){salla.logger.error("salla-conditional-offer:: unexpected type (".concat(i.type,")!"));return""}var e=this.products[i.value];if(!e){salla.logger.error("salla-conditional-offer:: there is no product with id (".concat(i.value,")!"));return""}return h("a",{class:"s-conditional-offer-product-link",href:e.url},h("img",{class:"s-conditional-offer-checkpoint-image-content",loading:"lazy",decoding:"async",alt:((n=e===null||e===void 0?void 0:e.image)===null||n===void 0?void 0:n.alt)||"",src:(t=e===null||e===void 0?void 0:e.image)===null||t===void 0?void 0:t.url}))};i.prototype.getOfferType=function(i){var n;var t=(n=this.offer.details)===null||n===void 0?void 0:n.based_on;if(t===OfferType.PRODUCT_COUNT)return salla.lang.choice("blocks.header.products_count",i.min_spend);if(t===OfferType.PRODUCT_PURCHASE)return salla.money(i.min_spend);salla.logger.warn("salla-conditional-offer:: Unexpected offer detail's based_on value: ".concat(t));return"".concat(i.min_spend)};i.prototype.clamp=function(i,n,t){return Math.max(n,Math.min(i,t))};i.prototype.mapValueRanges=function(i,n,t,e,o){var r=(i-n)*(o-e)/(t-n)+e;if(r===Number.POSITIVE_INFINITY)return 100;if(r===Number.NEGATIVE_INFINITY)return 0;return this.clamp(r,0,100)};i.prototype.getCheckPointView=function(i,n){var t,e;var o=this.offer.details.discounts.findIndex((function(n){var t=n.min_spend;return t===i.min_spend}));var r=(e=(t=this.offer.details.discounts[o-1])===null||t===void 0?void 0:t.min_spend)!==null&&e!==void 0?e:0;var a=this.mapValueRanges(this.offer.details.current_value,r,i.min_spend,0,100);var s=i.min_spend<=this.offer.details.current_value;return h("div",{class:"s-conditional-offer-checkpoint-container"},n>0?[h("div",{key:"progress-line",class:"s-conditional-offer-progress-line-container"},h("div",{class:"s-conditional-offer-progress-line-inactive"}),h("div",{class:"s-conditional-offer-progress-line-active",style:{width:"".concat(a,"%")}})),h("div",{key:"checkpoint",class:"s-conditional-offer-checkpoint ".concat(s?"s-conditional-offer-active-checkpoint":"")},h("div",{class:"s-conditional-offer-item-avatar-content ".concat(s?"active":""),innerHTML:this.products&&this.getCheckpointContent(i)}),h("div",{class:"s-conditional-offer-checkpoint-label ".concat(s?"active":""),innerHTML:this.getOfferType(i)}))]:h("div",{key:"label",class:{"s-conditional-offer-checkpoint-label":true,"first-checkpoint":n===0,active:s},innerHTML:this.getOfferType(i)}))};i.prototype.getLoadingSkeletonView=function(){return h(Host,{class:"s-conditional-offer-container"},h("div",{class:"s-conditional-offer-skeleton-inner-container"},h("div",{class:"s-conditional-offer-skeleton-subtitle"},h("salla-skeleton",{height:"16px",width:"30%"})),h("div",{class:"s-conditional-offer-skeleton-subtitle"},h("salla-skeleton",{height:"16px",width:"35%"})),h("div",{class:"s-conditional-offer-skeleton-checkpoints-wrapper"},Array(3).fill(null).map((function(){return[h("salla-skeleton",{key:"checkpoint-line",height:"8px"}),h("div",{key:"checkpoint"},h("salla-skeleton",{height:"60px",width:"60px",type:"circle"}))]})))))};i.prototype.render=function(){var i=this;if(!this.canRender)return null;if(this.isLoading)return this.getLoadingSkeletonView();return h(Host,{class:"s-conditional-offer-container"},h("div",{class:"s-conditional-offer-title-wrapper"},h("div",{class:"s-conditional-offer-title"},this.offer.title),this.offer.description?h("div",{class:"s-conditional-offer-subtitle"},this.offer.description," ",h("i",{class:"sicon-information"})):null),h("div",{class:"s-conditional-offer-progress-container"},this.offer.details.discounts.map((function(n,t){return h("div",{class:{"flex-1":t>0},key:n.min_spend},i.getCheckPointView(n,t))}))))};return i}();SallaConditionalOffer.style=sallaConditionalOfferCss;export{SallaConditionalOffer as salla_conditional_offer};
4
+ import{r as registerInstance,h,H as Host}from"./index-HB9ZridH.js";var DiscountType;(function(i){i["PERCENTAGE"]="percentage";i["FIXED"]="fixed";i["FREE_PRODUCT"]="free_product"})(DiscountType||(DiscountType={}));var OfferType;(function(i){i["PRODUCT_COUNT"]="products_count";i["PRODUCT_PURCHASE"]="order_amount"})(OfferType||(OfferType={}));var sallaConditionalOfferCss=":host{display:block}";var SallaConditionalOffer=function(){function i(i){registerInstance(this,i);this.offer=null;this.products={};this.isLoading=true;this.canRender=true}i.prototype.componentWillLoad=function(){var i=this;salla.onReady().then((function(){var i,n,t;if(!((i=salla.config.get("store.features"))===null||i===void 0?void 0:i.includes("conditional-offer"))||salla.storage.get("cart")!==""&&!((t=(n=salla.storage.get("cart"))===null||n===void 0?void 0:n.summary)===null||t===void 0?void 0:t.count)){throw new Error("feature or cart object does not existed")}})).then((function(){return salla.api.cart.offers()})).then((function(n){var t=n.data;i.offer=t.find((function(i){return i.type==="conditional"}));if(!i.offer){throw new Error("No conditional offer has been activated in the merchant dashboard")}i.offer.details.discounts.unshift({value:0,min_spend:0});return i.updateInitialOfferValue()})).then((function(){return i.getProducts()})).then((function(){return salla.event.on("cart::updated",(function(n){return i.updateOfferValues(n)}))})).catch((function(n){i.canRender=false;salla.logger.warn("salla-conditional-offer:: ",n)})).finally((function(){i.isLoading=false}))};i.prototype.getProducts=function(){var i=this;var n=this.offer.details.discounts.filter((function(i){var n=i.type;return n===DiscountType.FREE_PRODUCT})).map((function(i){var n=i.value;return n}));if(n.length>0){return salla.product.fetch({source:"selected",source_value:n}).then((function(n){var t=n.data;t.forEach((function(n){var t=n.id,e=n.url,o=n.image;i.products[t]={url:e,image:o}}))}))}};i.prototype.updateInitialOfferValue=function(){var i=this;return salla.api.cart.details().then((function(n){var t=n.data.cart;return i.updateOfferValues(t)}))};i.prototype.updateOfferValues=function(i){var n=i.items,t=i.sub_total;var e;var o=this.offer.details.based_on===OfferType.PRODUCT_COUNT?n.reduce((function(i,n){var t=n.quantity;return i+t}),0):t;this.offer=Object.assign(Object.assign({},this.offer),{details:Object.assign(Object.assign({},(e=this.offer)===null||e===void 0?void 0:e.details),{current_value:o})});return this.offer};i.prototype.getCheckpointContent=function(i){var n,t;if(i.type===DiscountType.PERCENTAGE)return"".concat(i.value,"%");if(i.type===DiscountType.FIXED)return salla.money(i.value);if(i.type!==DiscountType.FREE_PRODUCT){salla.logger.error("salla-conditional-offer:: unexpected type (".concat(i.type,")!"));return""}var e=this.products[i.value];if(!e){salla.logger.error("salla-conditional-offer:: there is no product with id (".concat(i.value,")!"));return""}return h("a",{class:"s-conditional-offer-product-link",href:e.url},h("img",{class:"s-conditional-offer-checkpoint-image-content",loading:"lazy",decoding:"async",alt:((n=e===null||e===void 0?void 0:e.image)===null||n===void 0?void 0:n.alt)||"",src:(t=e===null||e===void 0?void 0:e.image)===null||t===void 0?void 0:t.url}))};i.prototype.getOfferType=function(i){var n;var t=(n=this.offer.details)===null||n===void 0?void 0:n.based_on;if(t===OfferType.PRODUCT_COUNT)return salla.lang.choice("blocks.header.products_count",i.min_spend);if(t===OfferType.PRODUCT_PURCHASE)return salla.money(i.min_spend);salla.logger.warn("salla-conditional-offer:: Unexpected offer detail's based_on value: ".concat(t));return"".concat(i.min_spend)};i.prototype.clamp=function(i,n,t){return Math.max(n,Math.min(i,t))};i.prototype.mapValueRanges=function(i,n,t,e,o){var r=(i-n)*(o-e)/(t-n)+e;if(r===Number.POSITIVE_INFINITY)return 100;if(r===Number.NEGATIVE_INFINITY)return 0;return this.clamp(r,0,100)};i.prototype.getCheckPointView=function(i,n){var t,e;var o=this.offer.details.discounts.findIndex((function(n){var t=n.min_spend;return t===i.min_spend}));var r=(e=(t=this.offer.details.discounts[o-1])===null||t===void 0?void 0:t.min_spend)!==null&&e!==void 0?e:0;var a=this.mapValueRanges(this.offer.details.current_value,r,i.min_spend,0,100);var s=i.min_spend<=this.offer.details.current_value;return h("div",{class:"s-conditional-offer-checkpoint-container"},n>0?[h("div",{key:"progress-line",class:"s-conditional-offer-progress-line-container"},h("div",{class:"s-conditional-offer-progress-line-inactive"}),h("div",{class:"s-conditional-offer-progress-line-active",style:{width:"".concat(a,"%")}})),h("div",{key:"checkpoint",class:"s-conditional-offer-checkpoint ".concat(s?"s-conditional-offer-active-checkpoint":"")},h("div",{class:"s-conditional-offer-item-avatar-content ".concat(s?"active":""),innerHTML:this.products&&this.getCheckpointContent(i)}),h("div",{class:"s-conditional-offer-checkpoint-label ".concat(s?"active":""),innerHTML:this.getOfferType(i)}))]:h("div",{key:"label",class:{"s-conditional-offer-checkpoint-label":true,"first-checkpoint":n===0,active:s},innerHTML:this.getOfferType(i)}))};i.prototype.getLoadingSkeletonView=function(){return h(Host,{class:"s-conditional-offer-container"},h("div",{class:"s-conditional-offer-skeleton-inner-container"},h("div",{class:"s-conditional-offer-skeleton-subtitle"},h("salla-skeleton",{height:"16px",width:"30%"})),h("div",{class:"s-conditional-offer-skeleton-subtitle"},h("salla-skeleton",{height:"16px",width:"35%"})),h("div",{class:"s-conditional-offer-skeleton-checkpoints-wrapper"},Array(3).fill(null).map((function(){return[h("salla-skeleton",{key:"checkpoint-line",height:"8px"}),h("div",{key:"checkpoint"},h("salla-skeleton",{height:"60px",width:"60px",type:"circle"}))]})))))};i.prototype.render=function(){var i=this;if(!this.canRender)return null;if(this.isLoading)return this.getLoadingSkeletonView();return h(Host,{class:"s-conditional-offer-container"},h("div",{class:"s-conditional-offer-title-wrapper"},h("div",{class:"s-conditional-offer-title"},this.offer.title),this.offer.description?h("div",{class:"s-conditional-offer-subtitle"},this.offer.description," ",h("i",{class:"sicon-information"})):null),h("div",{class:"s-conditional-offer-progress-container"},this.offer.details.discounts.map((function(n,t){return h("div",{class:{"flex-1":t>0},key:n.min_spend},i.getCheckPointView(n,t))}))))};return i}();SallaConditionalOffer.style=sallaConditionalOfferCss;export{SallaConditionalOffer as salla_conditional_offer};
5
5
  //# sourceMappingURL=salla-conditional-offer.entry.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"salla-conditional-offer.entry.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 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, total }: UpdatedCart) {\n const current_value = this.offer.details.based_on === OfferType.PRODUCT_COUNT ? items.reduce((count: number, { quantity }) => count + quantity, 0,) : 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":";;;;;AAEA,IAAY,YAIX;AAJD,CAAA,UAAY,YAAY,EAAA;AACpB,IAAA,YAAA,CAAA,YAAA,CAAA,GAAA,YAAyB;AACzB,IAAA,YAAA,CAAA,OAAA,CAAA,GAAA,OAAe;AACf,IAAA,YAAA,CAAA,cAAA,CAAA,GAAA,cAA6B;AACjC,CAAC,EAJW,YAAY,KAAZ,YAAY,GAIvB,EAAA,CAAA,CAAA;AAED,IAAY,SAGX;AAHD,CAAA,UAAY,SAAS,EAAA;AACjB,IAAA,SAAA,CAAA,eAAA,CAAA,GAAA,gBAAgC;AAChC,IAAA,SAAA,CAA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AAI,CAAC,SAAS;AAAE,YAAA,OAAO,IAAI;QAChC,IAAI,IAAI,CAAC,SAAS;AAAE,YAAA,OAAO,IAAI,CAAC,sBAAsB,EAAE;AAExD,QAAA,OAAO,CAAC,CAAA,IAAI,EAAC,EAAA,KAAK,EAAC,+BAA+B,EAAA,EAC9C,CAAK,CAAA,KAAA,EAAA,EAAA,KAAK,EAAC,mCAAmC,EAAA,EAC1C,CAAK,CAAA,KAAA,EAAA,EAAA,KAAK,EAAC,2BAA2B,EAAA,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,CAAO,EAC9D,IAAI,CAAC,KAAK,CAAC,WAAW,GAAG,CAAA,CAAA,KAAA,EAAA,EAAK,KAAK,EAAC,8BAA8B,EAAA,EAC9D,IAAI,CAAC,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
+ {"version":3,"file":"salla-conditional-offer.entry.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":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AAG,EAAE,QAAQ,CAAC,SAAS,EACvD,EAAA,IAAI,CAAC,iBAAiB,CAAC,QAAQ,EAAE,KAAK,CAAC,CACtC,CACT,CAAC,CACA,CACH;;;;;;;"}
@@ -1,5 +1,5 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r as registerInstance,h,H as Host,g as getElement}from"./index-BJcojI6v.js";import{w as whatsapp}from"./whatsapp2-DWksgowB.js";import{M as MailIcon}from"./mail-DmgxDvXL.js";var mobile='\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>iphone</title>\n<path d="M15.053 27.613c0.133 0.12 0.28 0.213 0.44 0.28s0.333 0.107 0.507 0.107c0.36 0 0.693-0.135 0.947-0.387 0.12-0.135 0.213-0.28 0.28-0.44 0.080-0.16 0.107-0.333 0.107-0.507 0-0.347-0.147-0.695-0.387-0.947-0.507-0.493-1.387-0.493-1.893 0-0.12 0.12-0.213 0.267-0.28 0.44-0.067 0.16-0.107 0.333-0.107 0.507s0.040 0.347 0.107 0.507 0.16 0.305 0.28 0.44zM24 0h-16c-2.205 0-4 1.795-4 4v24c0 2.205 1.795 4 4 4h16c2.205 0 4-1.795 4-4v-24c0-2.205-1.795-4-4-4zM25.333 28c0 0.736-0.599 1.333-1.333 1.333h-16c-0.735 0-1.333-0.597-1.333-1.333v-4h18.667zM25.333 21.333h-18.667v-17.333c0-0.735 0.599-1.333 1.333-1.333h16c0.735 0 1.333 0.599 1.333 1.333z"></path>\n</svg>\n';var phone='\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>phone</title>\n<path d="M30.823 21.713l-3.883-3.883c-1.569-1.568-4.12-1.568-5.689 0l-2.568 2.568c-3.063-1.499-5.583-4.019-7.081-7.083l2.568-2.567c0.759-0.76 1.177-1.771 1.177-2.845s-0.419-2.084-1.179-2.844l-3.881-3.881c-1.52-1.521-4.171-1.521-5.689 0l-1.845 1.847c-2.22 2.219-3.183 5.407-2.573 8.527 1.98 10.144 10.125 18.292 20.269 20.271 0.616 0.121 1.236 0.18 1.849 0.18 2.492 0 4.896-0.972 6.677-2.752l1.847-1.847c1.568-1.571 1.568-4.121 0.001-5.691zM28.936 25.517l-1.845 1.847c-1.592 1.592-3.883 2.283-6.132 1.841-9.089-1.776-16.388-9.075-18.163-18.165-0.439-2.247 0.249-4.539 1.841-6.129l1.847-1.847c0.256-0.257 0.596-0.397 0.959-0.397s0.703 0.14 0.959 0.397l3.883 3.883c0.256 0.256 0.397 0.596 0.397 0.959s-0.141 0.703-0.397 0.96l-3.22 3.217c-0.383 0.384-0.496 0.959-0.287 1.457 1.813 4.339 5.343 7.868 9.683 9.684 0.497 0.207 1.073 0.095 1.457-0.288l3.22-3.22c0.529-0.529 1.389-0.528 1.917 0l3.881 3.883c0.528 0.529 0.528 1.389 0 1.919z"></path>\n</svg>\n';var telegram='\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>paper-plane-o</title>\n<path d="M31.5 0.482c0.375 0.268 0.554 0.696 0.482 1.143l-4.571 27.429c-0.054 0.339-0.268 0.625-0.571 0.804-0.161 0.089-0.357 0.143-0.554 0.143-0.143 0-0.286-0.036-0.429-0.089l-9.411-3.839-5.321 5.839c-0.214 0.25-0.518 0.375-0.839 0.375-0.143 0-0.286-0.018-0.411-0.071-0.446-0.179-0.732-0.607-0.732-1.071v-8.071l-8.429-3.446c-0.411-0.161-0.679-0.536-0.714-0.982-0.036-0.429 0.196-0.839 0.571-1.054l29.714-17.143c0.375-0.232 0.857-0.214 1.214 0.036zM25.393 27.25l3.946-23.625-25.607 14.768 6 2.446 15.411-11.411-8.536 14.232z"></path>\n</svg>\n';var sallaContactsCss=".unicode{unicode-bidi:-webkit-plaintext;unicode-bidi:plaintext}";var SallaContacts=function(){function t(t){var s=this;registerInstance(this,t);var n;this.contacts=salla.config.get("store.contacts");this.iconsList={mobile:mobile,whatsapp:whatsapp,phone:phone,telegram:telegram,email:MailIcon};this.contactSlot=((n=this.host.querySelector('[slot="contact"]'))===null||n===void 0?void 0:n.innerHTML)||'<a href={link} class="s-contacts-item"><span class="s-contacts-icon">{icon}</span>'.concat(!this.iconsOnly&&"<span class='unicode'>{value}</span>","</a>");salla.onReady((function(){s.contacts=salla.config.get("store.contacts")}));salla.lang.onLoaded((function(){s.contactsTitle=s.contactsTitle||salla.lang.get("blocks.footer.social")}))}t.prototype.getContactsArray=function(){return Object.entries(this.contacts).filter((function(t){var s=t[0],n=t[1];return n!==""})).map((function(t){var s=t[0],n=t[1];return{type:s,value:n}}))};t.prototype.getContactLink=function(t){var s=this.contacts[t];switch(t){case"phone":case"mobile":return"tel:".concat(s);case"whatsapp":return salla.url.get("whatsapp/send");case"email":return"mailto:".concat(s);case"telegram":return s.startsWith("https://t.me/")?s:"https://t.me/".concat(s);default:return s}};t.prototype.getContactIcon=function(t){return this.iconsList[t]};t.prototype.componentWillLoad=function(){return new Promise((function(t){return salla.onReady(t)}))};t.prototype.render=function(){var t=this;var s=this.getContactsArray();if(!s||s.length==0){return}if(this.isHeader){return h(Host,{class:"s-contacts s-contacts-header"},s.filter((function(t){return t.type=="phone"||t.type=="email"})).map((function(s,n){return h("a",{href:t.getContactLink(s.type),key:n,class:"s-contacts-topnav-link"},s.type==="email"?s.value:[h("span",null,t.contactsTitle,": "),h("a",{class:"unicode",href:t.iconsList[s.type]},s.value)])})))}return h(Host,{class:"s-contacts"},!this.hideTitle&&h("h3",{class:"s-contacts-title"},this.contactsTitle),h("div",{class:{"s-contacts-list":true,"s-contacts-list-horizontal":this.horizontal,"s-contacts-list-vertical":!this.horizontal,"s-contacts-list-icons-only":this.iconsOnly}},s.map((function(s,n){return h("div",{key:n,id:"contact-slot",innerHTML:t.contactSlot.replace(/\{icon\}/g,t.getContactIcon(s.type)).replace(/\{value\}/g,s.value.toString()).replace(/\{link\}/g,t.getContactLink(s.type))})}))))};t.prototype.componentDidRender=function(){var t;(t=this.host.querySelector('[slot="contact"]'))===null||t===void 0?void 0:t.remove()};Object.defineProperty(t.prototype,"host",{get:function(){return getElement(this)},enumerable:false,configurable:true});return t}();SallaContacts.style=sallaContactsCss;export{SallaContacts as salla_contacts};
4
+ import{r as registerInstance,h,H as Host,g as getElement}from"./index-HB9ZridH.js";import{w as whatsapp}from"./whatsapp2-DWksgowB.js";import{M as MailIcon}from"./mail-DmgxDvXL.js";var mobile='\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>iphone</title>\n<path d="M15.053 27.613c0.133 0.12 0.28 0.213 0.44 0.28s0.333 0.107 0.507 0.107c0.36 0 0.693-0.135 0.947-0.387 0.12-0.135 0.213-0.28 0.28-0.44 0.080-0.16 0.107-0.333 0.107-0.507 0-0.347-0.147-0.695-0.387-0.947-0.507-0.493-1.387-0.493-1.893 0-0.12 0.12-0.213 0.267-0.28 0.44-0.067 0.16-0.107 0.333-0.107 0.507s0.040 0.347 0.107 0.507 0.16 0.305 0.28 0.44zM24 0h-16c-2.205 0-4 1.795-4 4v24c0 2.205 1.795 4 4 4h16c2.205 0 4-1.795 4-4v-24c0-2.205-1.795-4-4-4zM25.333 28c0 0.736-0.599 1.333-1.333 1.333h-16c-0.735 0-1.333-0.597-1.333-1.333v-4h18.667zM25.333 21.333h-18.667v-17.333c0-0.735 0.599-1.333 1.333-1.333h16c0.735 0 1.333 0.599 1.333 1.333z"></path>\n</svg>\n';var phone='\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>phone</title>\n<path d="M30.823 21.713l-3.883-3.883c-1.569-1.568-4.12-1.568-5.689 0l-2.568 2.568c-3.063-1.499-5.583-4.019-7.081-7.083l2.568-2.567c0.759-0.76 1.177-1.771 1.177-2.845s-0.419-2.084-1.179-2.844l-3.881-3.881c-1.52-1.521-4.171-1.521-5.689 0l-1.845 1.847c-2.22 2.219-3.183 5.407-2.573 8.527 1.98 10.144 10.125 18.292 20.269 20.271 0.616 0.121 1.236 0.18 1.849 0.18 2.492 0 4.896-0.972 6.677-2.752l1.847-1.847c1.568-1.571 1.568-4.121 0.001-5.691zM28.936 25.517l-1.845 1.847c-1.592 1.592-3.883 2.283-6.132 1.841-9.089-1.776-16.388-9.075-18.163-18.165-0.439-2.247 0.249-4.539 1.841-6.129l1.847-1.847c0.256-0.257 0.596-0.397 0.959-0.397s0.703 0.14 0.959 0.397l3.883 3.883c0.256 0.256 0.397 0.596 0.397 0.959s-0.141 0.703-0.397 0.96l-3.22 3.217c-0.383 0.384-0.496 0.959-0.287 1.457 1.813 4.339 5.343 7.868 9.683 9.684 0.497 0.207 1.073 0.095 1.457-0.288l3.22-3.22c0.529-0.529 1.389-0.528 1.917 0l3.881 3.883c0.528 0.529 0.528 1.389 0 1.919z"></path>\n</svg>\n';var telegram='\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>paper-plane-o</title>\n<path d="M31.5 0.482c0.375 0.268 0.554 0.696 0.482 1.143l-4.571 27.429c-0.054 0.339-0.268 0.625-0.571 0.804-0.161 0.089-0.357 0.143-0.554 0.143-0.143 0-0.286-0.036-0.429-0.089l-9.411-3.839-5.321 5.839c-0.214 0.25-0.518 0.375-0.839 0.375-0.143 0-0.286-0.018-0.411-0.071-0.446-0.179-0.732-0.607-0.732-1.071v-8.071l-8.429-3.446c-0.411-0.161-0.679-0.536-0.714-0.982-0.036-0.429 0.196-0.839 0.571-1.054l29.714-17.143c0.375-0.232 0.857-0.214 1.214 0.036zM25.393 27.25l3.946-23.625-25.607 14.768 6 2.446 15.411-11.411-8.536 14.232z"></path>\n</svg>\n';var sallaContactsCss=".unicode{unicode-bidi:-webkit-plaintext;unicode-bidi:plaintext}";var SallaContacts=function(){function t(t){var s=this;registerInstance(this,t);var n;this.contacts=salla.config.get("store.contacts");this.iconsList={mobile:mobile,whatsapp:whatsapp,phone:phone,telegram:telegram,email:MailIcon};this.contactSlot=((n=this.host.querySelector('[slot="contact"]'))===null||n===void 0?void 0:n.innerHTML)||'<a href={link} class="s-contacts-item"><span class="s-contacts-icon">{icon}</span>'.concat(!this.iconsOnly&&"<span class='unicode'>{value}</span>","</a>");salla.onReady((function(){s.contacts=salla.config.get("store.contacts")}));salla.lang.onLoaded((function(){s.contactsTitle=s.contactsTitle||salla.lang.get("blocks.footer.social")}))}t.prototype.getContactsArray=function(){return Object.entries(this.contacts).filter((function(t){var s=t[0],n=t[1];return n!==""})).map((function(t){var s=t[0],n=t[1];return{type:s,value:n}}))};t.prototype.getContactLink=function(t){var s=this.contacts[t];switch(t){case"phone":case"mobile":return"tel:".concat(s);case"whatsapp":return salla.url.get("whatsapp/send");case"email":return"mailto:".concat(s);case"telegram":return s.startsWith("https://t.me/")?s:"https://t.me/".concat(s);default:return s}};t.prototype.getContactIcon=function(t){return this.iconsList[t]};t.prototype.componentWillLoad=function(){return new Promise((function(t){return salla.onReady(t)}))};t.prototype.render=function(){var t=this;var s=this.getContactsArray();if(!s||s.length==0){return}if(this.isHeader){return h(Host,{class:"s-contacts s-contacts-header"},s.filter((function(t){return t.type=="phone"||t.type=="email"})).map((function(s,n){return h("a",{href:t.getContactLink(s.type),key:n,class:"s-contacts-topnav-link"},s.type==="email"?s.value:[h("span",null,t.contactsTitle,": "),h("a",{class:"unicode",href:t.iconsList[s.type]},s.value)])})))}return h(Host,{class:"s-contacts"},!this.hideTitle&&h("h3",{class:"s-contacts-title"},this.contactsTitle),h("div",{class:{"s-contacts-list":true,"s-contacts-list-horizontal":this.horizontal,"s-contacts-list-vertical":!this.horizontal,"s-contacts-list-icons-only":this.iconsOnly}},s.map((function(s,n){return h("div",{key:n,id:"contact-slot",innerHTML:t.contactSlot.replace(/\{icon\}/g,t.getContactIcon(s.type)).replace(/\{value\}/g,s.value.toString()).replace(/\{link\}/g,t.getContactLink(s.type))})}))))};t.prototype.componentDidRender=function(){var t;(t=this.host.querySelector('[slot="contact"]'))===null||t===void 0?void 0:t.remove()};Object.defineProperty(t.prototype,"host",{get:function(){return getElement(this)},enumerable:false,configurable:true});return t}();SallaContacts.style=sallaContactsCss;export{SallaContacts as salla_contacts};
5
5
  //# sourceMappingURL=salla-contacts.entry.js.map
@@ -1,5 +1,5 @@
1
- var __awaiter=this&&this.__awaiter||function(t,e,i,n){function s(t){return t instanceof i?t:new i((function(e){e(t)}))}return new(i||(i=Promise))((function(i,r){function a(t){try{c(n.next(t))}catch(t){r(t)}}function o(t){try{c(n["throw"](t))}catch(t){r(t)}}function c(t){t.done?i(t.value):s(t.value).then(a,o)}c((n=n.apply(t,e||[])).next())}))};var __generator=this&&this.__generator||function(t,e){var i={label:0,sent:function(){if(r[0]&1)throw r[1];return r[1]},trys:[],ops:[]},n,s,r,a;return a={next:o(0),throw:o(1),return:o(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function o(t){return function(e){return c([t,e])}}function c(o){if(n)throw new TypeError("Generator is already executing.");while(a&&(a=0,o[0]&&(i=0)),i)try{if(n=1,s&&(r=o[0]&2?s["return"]:o[0]?s["throw"]||((r=s["return"])&&r.call(s),0):s.next)&&!(r=r.call(s,o[1])).done)return r;if(s=0,r)o=[o[0]&2,r.value];switch(o[0]){case 0:case 1:r=o;break;case 4:i.label++;return{value:o[1],done:false};case 5:i.label++;s=o[1];o=[0];continue;case 7:o=i.ops.pop();i.trys.pop();continue;default:if(!(r=i.trys,r=r.length>0&&r[r.length-1])&&(o[0]===6||o[0]===2)){i=0;continue}if(o[0]===3&&(!r||o[1]>r[0]&&o[1]<r[3])){i.label=o[1];break}if(o[0]===6&&i.label<r[1]){i.label=r[1];r=o;break}if(r&&i.label<r[2]){i.label=r[2];i.ops.push(o);break}if(r[2])i.ops.pop();i.trys.pop();continue}o=e.call(t,i)}catch(t){o=[6,t];s=0}finally{n=r=0}if(o[0]&5)throw o[1];return{value:o[0]?o[1]:void 0,done:true}}};
1
+ var __awaiter=this&&this.__awaiter||function(t,e,i,n){function r(t){return t instanceof i?t:new i((function(e){e(t)}))}return new(i||(i=Promise))((function(i,s){function a(t){try{c(n.next(t))}catch(t){s(t)}}function o(t){try{c(n["throw"](t))}catch(t){s(t)}}function c(t){t.done?i(t.value):r(t.value).then(a,o)}c((n=n.apply(t,e||[])).next())}))};var __generator=this&&this.__generator||function(t,e){var i={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},n,r,s,a;return a={next:o(0),throw:o(1),return:o(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function o(t){return function(e){return c([t,e])}}function c(o){if(n)throw new TypeError("Generator is already executing.");while(a&&(a=0,o[0]&&(i=0)),i)try{if(n=1,r&&(s=o[0]&2?r["return"]:o[0]?r["throw"]||((s=r["return"])&&s.call(r),0):r.next)&&!(s=s.call(r,o[1])).done)return s;if(r=0,s)o=[o[0]&2,s.value];switch(o[0]){case 0:case 1:s=o;break;case 4:i.label++;return{value:o[1],done:false};case 5:i.label++;r=o[1];o=[0];continue;case 7:o=i.ops.pop();i.trys.pop();continue;default:if(!(s=i.trys,s=s.length>0&&s[s.length-1])&&(o[0]===6||o[0]===2)){i=0;continue}if(o[0]===3&&(!s||o[1]>s[0]&&o[1]<s[3])){i.label=o[1];break}if(o[0]===6&&i.label<s[1]){i.label=s[1];s=o;break}if(s&&i.label<s[2]){i.label=s[2];i.ops.push(o);break}if(s[2])i.ops.pop();i.trys.pop();continue}o=e.call(t,i)}catch(t){o=[6,t];r=0}finally{n=s=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
- */import{r as registerInstance,c as createEvent,h,H as Host,g as getElement}from"./index-BJcojI6v.js";import{H as Helper}from"./Helper-MNQx5g4A.js";import{F as FilterOptionTypes}from"./interfaces-DL4h2bc3.js";import"./anime.es-CgtvEd63.js";var sallaFiltersWidgetCss=":host{display:block}";var SallaFiltersWidget=function(){function t(t){registerInstance(this,t);this.changed=createEvent(this,"changed");this.initHeight=195;this.isOpen=true;this.isShowMore=false;this.showMoreLabel="عرض المزيد";this.showLessLabel="عرض أقل";this.page=salla.config.get("page")}t.prototype.connectedCallback=function(){var t=this;this.withLoadMore=this.option.key!="price"&&Array.isArray(this.option.values)&&this.option.values.length>8;salla.onReady((function(){t.page=salla.config.get("page")}));salla.lang.onLoaded((function(){t.showMoreLabel=salla.lang.getWithDefault("common.titles.more",t.showMoreLabel);t.showLessLabel=salla.lang.getWithDefault("common.elements.show_less",t.showLessLabel)}))};t.prototype.componentDidLoad=function(){this.widgetValues.scrollHeight<this.initHeight&&(this.withLoadMore=false);this.withLoadMore&&this.widgetValues&&(this.widgetValues.style.maxHeight="".concat(this.initHeight,"px"));this.widgetContent.style.height="".concat(this.widgetContent.scrollHeight,"px")};t.prototype.setWidgetHeight=function(){return __awaiter(this,arguments,void 0,(function(t){var e=this;if(t===void 0){t=250}return __generator(this,(function(i){this.widgetContent.removeAttribute("style");setTimeout((function(){var t=e.widgetContent.scrollHeight;e.widgetContent.style.height=t+"px"}),t);return[2]}))}))};t.prototype.reset=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){if(this.option.type===FilterOptionTypes.RANGE){this.priceRange.reset()}Array.from(this.host.querySelectorAll("input")).forEach((function(t){return t.checked=false}));return[2]}))}))};t.prototype.showMore=function(){return __awaiter(this,void 0,void 0,(function(){var t=this;return __generator(this,(function(e){this.isShowMore=!this.isShowMore;this.widgetContent.style.height="auto";this.widgetValues.style.maxHeight=this.isShowMore?"".concat(this.widgetValues.scrollHeight,"px"):"".concat(this.initHeight,"px");setTimeout((function(){t.widgetContent.style.height="".concat(t.widgetContent.scrollHeight,"px")}),400);return[2]}))}))};t.prototype.toggleWidget=function(){return __awaiter(this,void 0,void 0,(function(){var t=this;return __generator(this,(function(e){this.isOpen=!this.isOpen;Helper.toggleElementClassIf(this.widgetContent,"s-filters-widget-opened","s-filters-widget-closed",(function(){return t.isOpen}));return[2]}))}))};t.prototype.renderFilterOption=function(t){var e=this;if(![FilterOptionTypes.VALUES,FilterOptionTypes.MINIMUM,FilterOptionTypes.VARIANTS].includes(t.type)){return""}return t.values.map((function(i,n){var s=typeof i=="number"?i:i.key||i.value;return h("label",{class:"s-filters-label",htmlFor:"".concat(t.key,"-option-").concat(s),key:"".concat(t.key,"-option-").concat(s)},h("input",{id:"".concat(t.key,"-option-").concat(s),name:t.key,type:"radio",checked:e.isSelectedOption(t,s),class:"s-filters-radio",onChange:function(i){return e.changed.emit({event:i,option:t,value:s})}}),e.getOptionLabel(t,i))}))};t.prototype.isSelectedOption=function(t,e){if(t.type===FilterOptionTypes.MINIMUM){return this.filtersData[t.key]==e}if(t.type===FilterOptionTypes.VARIANTS){return this.filtersData[t.type]&&this.filtersData[t.type][Object.keys(this.filtersData[t.type])[0]]==e}if(t.type===FilterOptionTypes.RANGE){return this.filtersData[t.key]&&this.filtersData[t.key].min==e.min&&this.filtersData[t.key].max==e.max}if(t.type===FilterOptionTypes.VALUES){return this.filtersData[t.key]&&Number(this.filtersData[t.key])==Number(e)}return false};t.prototype.getOptionLabel=function(t,e){if(t.key=="rating"){return h("salla-rating-stars",{size:"small",value:e})}var i=e.value||"null";return h("span",{class:"s-filters-option-name"},i)};t.prototype.render=function(){var t=this;return h(Host,{key:"faa16285c7c2dcd248f00230aa4b1eebc1814fdd",class:"s-filters-widget-container"},h("h3",{key:"019354d300116c2d567b75e5cc93d0d1dfc4785b",class:"s-filters-widget-title",onClick:function(){return t.toggleWidget()}},h("span",{key:"8ce2bc6a789a0f5d82308afad47cbae58467439a"},this.option.label),h("span",{key:"a5dcaa63ad18d41a324b499f36c82780c0670d4f",class:"s-filters-widget-plusminus ".concat(this.isOpen?"s-filters-widget-plusminus-active":"")})),h("div",{key:"bef8427341d94bb6eb6e37d9736f9ca3e9503058",class:"s-filters-widget-content",ref:function(e){return t.widgetContent=e}},h("div",{key:"451025fa922e84970107fe6ab2752db780effd86",class:"s-filters-widget-values",ref:function(e){return t.widgetValues=e}},h("slot",{key:"cbea119413f48c302684ae52c81786dcb69c6f29"}),this.option.type!==FilterOptionTypes.RANGE?this.renderFilterOption(this.option):h("salla-price-range",{onChanged:function(e){t.changed.emit(e.detail)},ref:function(e){return t.priceRange=e},filtersData:this.filtersData,option:this.option})),this.withLoadMore&&h("a",{key:"6b2e1b91b27509b445ad4af9367b4cc464bd2d4e",class:"s-filters-widget-more",onClick:function(){return t.showMore()}},!this.isShowMore?this.showMoreLabel:this.showLessLabel)))};Object.defineProperty(t.prototype,"host",{get:function(){return getElement(this)},enumerable:false,configurable:true});return t}();SallaFiltersWidget.style=sallaFiltersWidgetCss;export{SallaFiltersWidget as salla_filters_widget};
4
+ */import{r as registerInstance,c as createEvent,h,H as Host,g as getElement}from"./index-HB9ZridH.js";import{H as Helper}from"./Helper-MNQx5g4A.js";import{F as FilterOptionTypes}from"./interfaces-DL4h2bc3.js";import"./anime.es-CgtvEd63.js";var sallaFiltersWidgetCss=":host{display:block}";var SallaFiltersWidget=function(){function t(t){registerInstance(this,t);this.changed=createEvent(this,"changed");this.initHeight=195;this.isOpen=true;this.isShowMore=false;this.showMoreLabel="عرض المزيد";this.showLessLabel="عرض أقل";this.page=salla.config.get("page")}t.prototype.connectedCallback=function(){var t=this;this.withLoadMore=this.option.key!="price"&&Array.isArray(this.option.values)&&this.option.values.length>8;salla.onReady((function(){t.page=salla.config.get("page")}));salla.lang.onLoaded((function(){t.showMoreLabel=salla.lang.getWithDefault("common.titles.more",t.showMoreLabel);t.showLessLabel=salla.lang.getWithDefault("common.elements.show_less",t.showLessLabel)}))};t.prototype.componentDidLoad=function(){this.widgetValues.scrollHeight<this.initHeight&&(this.withLoadMore=false);this.withLoadMore&&this.widgetValues&&(this.widgetValues.style.maxHeight="".concat(this.initHeight,"px"));this.widgetContent.style.height="".concat(this.widgetContent.scrollHeight,"px")};t.prototype.setWidgetHeight=function(){return __awaiter(this,arguments,void 0,(function(t){var e=this;if(t===void 0){t=250}return __generator(this,(function(i){this.widgetContent.removeAttribute("style");setTimeout((function(){var t=e.widgetContent.scrollHeight;e.widgetContent.style.height=t+"px"}),t);return[2]}))}))};t.prototype.reset=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){if(this.option.type===FilterOptionTypes.RANGE){this.priceRange.reset()}Array.from(this.host.querySelectorAll("input")).forEach((function(t){return t.checked=false}));return[2]}))}))};t.prototype.showMore=function(){return __awaiter(this,void 0,void 0,(function(){var t=this;return __generator(this,(function(e){this.isShowMore=!this.isShowMore;this.widgetContent.style.height="auto";this.widgetValues.style.maxHeight=this.isShowMore?"".concat(this.widgetValues.scrollHeight,"px"):"".concat(this.initHeight,"px");setTimeout((function(){t.widgetContent.style.height="".concat(t.widgetContent.scrollHeight,"px")}),400);return[2]}))}))};t.prototype.toggleWidget=function(){return __awaiter(this,void 0,void 0,(function(){var t=this;return __generator(this,(function(e){this.isOpen=!this.isOpen;Helper.toggleElementClassIf(this.widgetContent,"s-filters-widget-opened","s-filters-widget-closed",(function(){return t.isOpen}));return[2]}))}))};t.prototype.renderFilterOption=function(t){var e=this;if(![FilterOptionTypes.VALUES,FilterOptionTypes.MINIMUM,FilterOptionTypes.VARIANTS].includes(t.type)){return""}return t.values.map((function(i,n){var r=typeof i=="number"?i:i.key||i.value;return h("label",{class:"s-filters-label",htmlFor:"".concat(t.key,"-option-").concat(r),key:"".concat(t.key,"-option-").concat(r)},h("input",{id:"".concat(t.key,"-option-").concat(r),name:t.key,type:"radio",checked:e.isSelectedOption(t,r),class:"s-filters-radio",onChange:function(i){return e.changed.emit({event:i,option:t,value:r})}}),e.getOptionLabel(t,i))}))};t.prototype.isSelectedOption=function(t,e){if(t.type===FilterOptionTypes.MINIMUM){return this.filtersData[t.key]==e}if(t.type===FilterOptionTypes.VARIANTS){return this.filtersData[t.type]&&this.filtersData[t.type][Object.keys(this.filtersData[t.type])[0]]==e}if(t.type===FilterOptionTypes.RANGE){return this.filtersData[t.key]&&this.filtersData[t.key].min==e.min&&this.filtersData[t.key].max==e.max}if(t.type===FilterOptionTypes.VALUES){return this.filtersData[t.key]&&Number(this.filtersData[t.key])==Number(e)}return false};t.prototype.getOptionLabel=function(t,e){if(t.key=="rating"){return h("salla-rating-stars",{size:"small",value:e})}var i=e.value||"null";return h("span",{class:"s-filters-option-name"},i)};t.prototype.render=function(){var t=this;return h(Host,{key:"faa16285c7c2dcd248f00230aa4b1eebc1814fdd",class:"s-filters-widget-container"},h("h3",{key:"019354d300116c2d567b75e5cc93d0d1dfc4785b",class:"s-filters-widget-title",onClick:function(){return t.toggleWidget()}},h("span",{key:"8ce2bc6a789a0f5d82308afad47cbae58467439a"},this.option.label),h("span",{key:"a5dcaa63ad18d41a324b499f36c82780c0670d4f",class:"s-filters-widget-plusminus ".concat(this.isOpen?"s-filters-widget-plusminus-active":"")})),h("div",{key:"bef8427341d94bb6eb6e37d9736f9ca3e9503058",class:"s-filters-widget-content",ref:function(e){return t.widgetContent=e}},h("div",{key:"451025fa922e84970107fe6ab2752db780effd86",class:"s-filters-widget-values",ref:function(e){return t.widgetValues=e}},h("slot",{key:"cbea119413f48c302684ae52c81786dcb69c6f29"}),this.option.type!==FilterOptionTypes.RANGE?this.renderFilterOption(this.option):h("salla-price-range",{onChanged:function(e){t.changed.emit(e.detail)},ref:function(e){return t.priceRange=e},filtersData:this.filtersData,option:this.option})),this.withLoadMore&&h("a",{key:"6b2e1b91b27509b445ad4af9367b4cc464bd2d4e",class:"s-filters-widget-more",onClick:function(){return t.showMore()}},!this.isShowMore?this.showMoreLabel:this.showLessLabel)))};Object.defineProperty(t.prototype,"host",{get:function(){return getElement(this)},enumerable:false,configurable:true});return t}();SallaFiltersWidget.style=sallaFiltersWidgetCss;export{SallaFiltersWidget as salla_filters_widget};
5
5
  //# sourceMappingURL=salla-filters-widget.entry.js.map
@@ -1,5 +1,5 @@
1
1
  var __awaiter=this&&this.__awaiter||function(t,e,r,i){function n(t){return t instanceof r?t:new r((function(e){e(t)}))}return new(r||(r=Promise))((function(r,a){function s(t){try{l(i.next(t))}catch(t){a(t)}}function o(t){try{l(i["throw"](t))}catch(t){a(t)}}function l(t){t.done?r(t.value):n(t.value).then(s,o)}l((i=i.apply(t,e||[])).next())}))};var __generator=this&&this.__generator||function(t,e){var r={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},i,n,a,s;return s={next:o(0),throw:o(1),return:o(2)},typeof Symbol==="function"&&(s[Symbol.iterator]=function(){return this}),s;function o(t){return function(e){return l([t,e])}}function l(o){if(i)throw new TypeError("Generator is already executing.");while(s&&(s=0,o[0]&&(r=0)),r)try{if(i=1,n&&(a=o[0]&2?n["return"]:o[0]?n["throw"]||((a=n["return"])&&a.call(n),0):n.next)&&!(a=a.call(n,o[1])).done)return a;if(n=0,a)o=[o[0]&2,a.value];switch(o[0]){case 0:case 1:a=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(!(a=r.trys,a=a.length>0&&a[a.length-1])&&(o[0]===6||o[0]===2)){r=0;continue}if(o[0]===3&&(!a||o[1]>a[0]&&o[1]<a[3])){r.label=o[1];break}if(o[0]===6&&r.label<a[1]){r.label=a[1];a=o;break}if(a&&r.label<a[2]){r.label=a[2];r.ops.push(o);break}if(a[2])r.ops.pop();r.trys.pop();continue}o=e.call(t,r)}catch(t){o=[6,t];n=0}finally{i=a=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
- */import{r as registerInstance,c as createEvent,h,H as Host,g as getElement}from"./index-BJcojI6v.js";import{F as FilterOptionTypes}from"./interfaces-DL4h2bc3.js";import{H as Helper}from"./Helper-MNQx5g4A.js";import"./anime.es-CgtvEd63.js";var sallaFiltersCss=":host{display:block}.s-rating-stars-small{line-height:12px}.s-filters-radio{background-image:none !important}";var SallaFilters=function(){function t(t){var e=this;registerInstance(this,t);this.changed=createEvent(this,"changed");this.isReady=false;this.filtersData={};salla.event.on("filters::hidden",(function(){return e.host.style.display="none"}));salla.lang.onLoaded((function(){e.apply=salla.lang.get("pages.checkout.apply");e.reset=salla.lang.get("pages.categories.filters_reset")}));salla.event.on("filters::fetched",(function(t){var r=t.filters;e.host.style.display="";var i={};e.filters=r.map((function(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=FilterOptionTypes.VALUES;var r=t.values,n=r.max,a=r.min;t.values=[5,4,3,2,1].filter((function(t){return t>=a||t<=n}))}if(e.filtersData.variants&&t.type==FilterOptionTypes.VARIANTS){i.variants=e.filtersData.variants}if(e.filtersData[t.key]&&t.type!==FilterOptionTypes.VARIANTS){i[t.key]=e.filtersData[t.key]}var s=new URLSearchParams(window.location.search);var o=false;for(var l=0,f=s.keys();l<f.length;l++){var c=f[l];if(c.includes("filters")){o=true;break}}if(salla.config.get("page.slug")=="product.index"&&Object.keys(i).length==0&&!o){var u=window.location.href;var h=salla.config.get("page.id");var d=u.indexOf("?")!==-1?"&":"?";var v=u+d+"filters[category_id]="+h;i.category_id=h;window.history.pushState({path:v},"",v)}return t}));e.filtersData=i;e.host.childNodes.forEach((function(t){return __awaiter(e,void 0,void 0,(function(){var e;return __generator(this,(function(r){switch(r.label){case 0:e=t.setWidgetHeight;if(!e)return[3,2];return[4,t.setWidgetHeight()];case 1:e=r.sent();r.label=2;case 2:return[2,e]}}))}))}))}))}t.prototype.componentWillLoad=function(){return __awaiter(this,void 0,void 0,(function(){var t,e,r;return __generator(this,(function(i){switch(i.label){case 0:i.trys.push([0,2,,3]);t=new URLSearchParams(window.location.search);e=this;return[4,Helper.extractFiltersFromUrl(t)];case 1:e.filtersData=i.sent();return[3,3];case 2:r=i.sent();console.warn("failed to get filters from URL",r.message);return[3,3];case 3:return[2]}}))}))};t.prototype.getFilters=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){return[2,this.filtersData]}))}))};t.prototype.applyFilters=function(){return __awaiter(this,void 0,void 0,(function(){var t;var e=this;return __generator(this,(function(r){if(!this.isReady){return[2]}t=Object.keys(this.filtersData).length>0;setTimeout((function(){var r;if(t){var i=new URL(window.location.href);for(var n=0,a=i.searchParams.entries();n<a.length;n++){var s=a[n][0];if(s.startsWith("filters")){i.searchParams.delete(s)}}var o=e.encodeFilters(e.filtersData);var l=i.search.split("&").filter((function(t){return!t.includes("filters")})).join("&");if(l){i.search=i.search.split("&filters")[0]+"&"+o}else{i.search="?".concat(o)}window.history.pushState({},"",i.href)}else{var i=new URL(window.location.href);(r=i.searchParams)===null||r===void 0?void 0:r.delete("filters");window.history.pushState({},"",i.toString())}salla.event.emit("salla-filters::changed",e.filtersData);e.changed.emit(e.filtersData)}),300);return[2]}))}))};t.prototype.encodeFilters=function(t,e){if(e===void 0){e="filters"}var r=[];for(var i in t){if(Object.prototype.hasOwnProperty.call(t,i)){var n=t[i];var a=e?"".concat(e,"[").concat(i,"]"):i;if(Array.isArray(n)){for(var s=0;s<n.length;s++){r.push("".concat(a,"[").concat(s,"]=").concat(n[s]))}}else if(typeof n==="object"&&n!==null){r.push(this.encodeFilters(n,a))}else{var o="".concat(a,"=").concat(n);r.push(o)}}}return r.join("&")};t.prototype.resetFilters=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){this.removeFiltersQueryParams();this.filtersData={};this.host.childNodes.forEach((function(t){return t.reset&&t.reset()}));salla.event.emit("salla-filters::reset");return[2,this.applyFilters()]}))}))};t.prototype.removeFiltersQueryParams=function(){var t=new URLSearchParams(window.location.search);var e=Array.from(t.keys()).filter((function(t){return!t.startsWith("filters[")})).map((function(e){return"".concat(encodeURIComponent(e),"=").concat(encodeURIComponent(t.get(e)))})).join("&");var r=e?"".concat(window.location.pathname,"?").concat(e):window.location.pathname;window.history.pushState({},"",r)};t.prototype.handleOptionChange=function(t,e,r){if(e.type===FilterOptionTypes.RANGE){this.filtersData[e.key]=r}var i=t.target.checked;if(e.type===FilterOptionTypes.VARIANTS){this.filtersData.variants=this.filtersData.variants||{};i&&(this.filtersData.variants[e.key]=r);i||delete this.filtersData.variants[e.key]}else if(t.target.type=="radio"){i&&(this.filtersData[e.key]=r);i||delete this.filtersData[e.key]}else if(t.target.type=="checkbox"){this.filtersData[e.key]=this.filtersData[e.key]||[];if(i){this.filtersData[e.key].push(r)}this.filtersData[e.key]=this.filtersData[e.key].filter((function(t){return t!=r}))}this.applyFilters()};t.prototype.render=function(){var t=this;var e,r;return h(Host,{key:"80fda46c33daf06c6a22d567d13375351db4e3cb"},(e=this.filters)===null||e===void 0?void 0:e.map((function(e){return h("salla-filters-widget",{option:e,filtersData:t.filtersData,onChanged:function(e){var r=e.detail,i=r.event,n=r.option,a=r.value;t.handleOptionChange(i,n,a)}})})),((r=this.filters)===null||r===void 0?void 0:r.length)?h("div",{class:"s-filters-footer"},h("salla-button",{color:"gray",fill:"outline",onClick:function(){return t.resetFilters()}},this.reset)):"")};t.prototype.componentDidLoad=function(){this.isReady=true};Object.defineProperty(t.prototype,"host",{get:function(){return getElement(this)},enumerable:false,configurable:true});return t}();SallaFilters.style=sallaFiltersCss;export{SallaFilters as salla_filters};
4
+ */import{r as registerInstance,c as createEvent,h,H as Host,g as getElement}from"./index-HB9ZridH.js";import{F as FilterOptionTypes}from"./interfaces-DL4h2bc3.js";import{H as Helper}from"./Helper-MNQx5g4A.js";import"./anime.es-CgtvEd63.js";var sallaFiltersCss=":host{display:block}.s-rating-stars-small{line-height:12px}.s-filters-radio{background-image:none !important}";var SallaFilters=function(){function t(t){var e=this;registerInstance(this,t);this.changed=createEvent(this,"changed");this.isReady=false;this.filtersData={};salla.event.on("filters::hidden",(function(){return e.host.style.display="none"}));salla.lang.onLoaded((function(){e.apply=salla.lang.get("pages.checkout.apply");e.reset=salla.lang.get("pages.categories.filters_reset")}));salla.event.on("filters::fetched",(function(t){var r=t.filters;e.host.style.display="";var i={};e.filters=r.map((function(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=FilterOptionTypes.VALUES;var r=t.values,n=r.max,a=r.min;t.values=[5,4,3,2,1].filter((function(t){return t>=a||t<=n}))}if(e.filtersData.variants&&t.type==FilterOptionTypes.VARIANTS){i.variants=e.filtersData.variants}if(e.filtersData[t.key]&&t.type!==FilterOptionTypes.VARIANTS){i[t.key]=e.filtersData[t.key]}var s=new URLSearchParams(window.location.search);var o=false;for(var l=0,f=s.keys();l<f.length;l++){var c=f[l];if(c.includes("filters")){o=true;break}}if(salla.config.get("page.slug")=="product.index"&&Object.keys(i).length==0&&!o){var u=window.location.href;var h=salla.config.get("page.id");var d=u.indexOf("?")!==-1?"&":"?";var v=u+d+"filters[category_id]="+h;i.category_id=h;window.history.pushState({path:v},"",v)}return t}));e.filtersData=i;e.host.childNodes.forEach((function(t){return __awaiter(e,void 0,void 0,(function(){var e;return __generator(this,(function(r){switch(r.label){case 0:e=t.setWidgetHeight;if(!e)return[3,2];return[4,t.setWidgetHeight()];case 1:e=r.sent();r.label=2;case 2:return[2,e]}}))}))}))}))}t.prototype.componentWillLoad=function(){return __awaiter(this,void 0,void 0,(function(){var t,e,r;return __generator(this,(function(i){switch(i.label){case 0:i.trys.push([0,2,,3]);t=new URLSearchParams(window.location.search);e=this;return[4,Helper.extractFiltersFromUrl(t)];case 1:e.filtersData=i.sent();return[3,3];case 2:r=i.sent();console.warn("failed to get filters from URL",r.message);return[3,3];case 3:return[2]}}))}))};t.prototype.getFilters=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){return[2,this.filtersData]}))}))};t.prototype.applyFilters=function(){return __awaiter(this,void 0,void 0,(function(){var t;var e=this;return __generator(this,(function(r){if(!this.isReady){return[2]}t=Object.keys(this.filtersData).length>0;setTimeout((function(){var r;if(t){var i=new URL(window.location.href);for(var n=0,a=i.searchParams.entries();n<a.length;n++){var s=a[n][0];if(s.startsWith("filters")){i.searchParams.delete(s)}}var o=e.encodeFilters(e.filtersData);var l=i.search.split("&").filter((function(t){return!t.includes("filters")})).join("&");if(l){i.search=i.search.split("&filters")[0]+"&"+o}else{i.search="?".concat(o)}window.history.pushState({},"",i.href)}else{var i=new URL(window.location.href);(r=i.searchParams)===null||r===void 0?void 0:r.delete("filters");window.history.pushState({},"",i.toString())}salla.event.emit("salla-filters::changed",e.filtersData);e.changed.emit(e.filtersData)}),300);return[2]}))}))};t.prototype.encodeFilters=function(t,e){if(e===void 0){e="filters"}var r=[];for(var i in t){if(Object.prototype.hasOwnProperty.call(t,i)){var n=t[i];var a=e?"".concat(e,"[").concat(i,"]"):i;if(Array.isArray(n)){for(var s=0;s<n.length;s++){r.push("".concat(a,"[").concat(s,"]=").concat(n[s]))}}else if(typeof n==="object"&&n!==null){r.push(this.encodeFilters(n,a))}else{var o="".concat(a,"=").concat(n);r.push(o)}}}return r.join("&")};t.prototype.resetFilters=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){this.removeFiltersQueryParams();this.filtersData={};this.host.childNodes.forEach((function(t){return t.reset&&t.reset()}));salla.event.emit("salla-filters::reset");return[2,this.applyFilters()]}))}))};t.prototype.removeFiltersQueryParams=function(){var t=new URLSearchParams(window.location.search);var e=Array.from(t.keys()).filter((function(t){return!t.startsWith("filters[")})).map((function(e){return"".concat(encodeURIComponent(e),"=").concat(encodeURIComponent(t.get(e)))})).join("&");var r=e?"".concat(window.location.pathname,"?").concat(e):window.location.pathname;window.history.pushState({},"",r)};t.prototype.handleOptionChange=function(t,e,r){if(e.type===FilterOptionTypes.RANGE){this.filtersData[e.key]=r}var i=t.target.checked;if(e.type===FilterOptionTypes.VARIANTS){this.filtersData.variants=this.filtersData.variants||{};i&&(this.filtersData.variants[e.key]=r);i||delete this.filtersData.variants[e.key]}else if(t.target.type=="radio"){i&&(this.filtersData[e.key]=r);i||delete this.filtersData[e.key]}else if(t.target.type=="checkbox"){this.filtersData[e.key]=this.filtersData[e.key]||[];if(i){this.filtersData[e.key].push(r)}this.filtersData[e.key]=this.filtersData[e.key].filter((function(t){return t!=r}))}this.applyFilters()};t.prototype.render=function(){var t=this;var e,r;return h(Host,{key:"80fda46c33daf06c6a22d567d13375351db4e3cb"},(e=this.filters)===null||e===void 0?void 0:e.map((function(e){return h("salla-filters-widget",{option:e,filtersData:t.filtersData,onChanged:function(e){var r=e.detail,i=r.event,n=r.option,a=r.value;t.handleOptionChange(i,n,a)}})})),((r=this.filters)===null||r===void 0?void 0:r.length)?h("div",{class:"s-filters-footer"},h("salla-button",{color:"gray",fill:"outline",onClick:function(){return t.resetFilters()}},this.reset)):"")};t.prototype.componentDidLoad=function(){this.isReady=true};Object.defineProperty(t.prototype,"host",{get:function(){return getElement(this)},enumerable:false,configurable:true});return t}();SallaFilters.style=sallaFiltersCss;export{SallaFilters as salla_filters};
5
5
  //# sourceMappingURL=salla-filters.entry.js.map
@@ -1,5 +1,5 @@
1
1
  var __awaiter=this&&this.__awaiter||function(t,a,i,e){function n(t){return t instanceof i?t:new i((function(a){a(t)}))}return new(i||(i=Promise))((function(i,r){function s(t){try{l(e.next(t))}catch(t){r(t)}}function o(t){try{l(e["throw"](t))}catch(t){r(t)}}function l(t){t.done?i(t.value):n(t.value).then(s,o)}l((e=e.apply(t,a||[])).next())}))};var __generator=this&&this.__generator||function(t,a){var i={label:0,sent:function(){if(r[0]&1)throw r[1];return r[1]},trys:[],ops:[]},e,n,r,s;return s={next:o(0),throw:o(1),return:o(2)},typeof Symbol==="function"&&(s[Symbol.iterator]=function(){return this}),s;function o(t){return function(a){return l([t,a])}}function l(o){if(e)throw new TypeError("Generator is already executing.");while(s&&(s=0,o[0]&&(i=0)),i)try{if(e=1,n&&(r=o[0]&2?n["return"]:o[0]?n["throw"]||((r=n["return"])&&r.call(n),0):n.next)&&!(r=r.call(n,o[1])).done)return r;if(n=0,r)o=[o[0]&2,r.value];switch(o[0]){case 0:case 1:r=o;break;case 4:i.label++;return{value:o[1],done:false};case 5:i.label++;n=o[1];o=[0];continue;case 7:o=i.ops.pop();i.trys.pop();continue;default:if(!(r=i.trys,r=r.length>0&&r[r.length-1])&&(o[0]===6||o[0]===2)){i=0;continue}if(o[0]===3&&(!r||o[1]>r[0]&&o[1]<r[3])){i.label=o[1];break}if(o[0]===6&&i.label<r[1]){i.label=r[1];r=o;break}if(r&&i.label<r[2]){i.label=r[2];i.ops.push(o);break}if(r[2])i.ops.pop();i.trys.pop();continue}o=a.call(t,i)}catch(t){o=[6,t];n=0}finally{e=r=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
- */import{r as registerInstance,h,H as Host,g as getElement}from"./index-BJcojI6v.js";var sallaInstallmentCss="salla-installment:empty{display:none}#tabbyPromoWrapper{background:white;border-radius:0.375rem;-webkit-transition:-webkit-box-shadow 0.5s cubic-bezier(0.4, 0, 0.2, 1);transition:-webkit-box-shadow 0.5s cubic-bezier(0.4, 0, 0.2, 1);transition:box-shadow 0.5s cubic-bezier(0.4, 0, 0.2, 1);transition:box-shadow 0.5s cubic-bezier(0.4, 0, 0.2, 1), -webkit-box-shadow 0.5s cubic-bezier(0.4, 0, 0.2, 1);margin-bottom:20px;border:unset !important;font-weight:500}.salla-y #tabbyPromoWrapper{border:1px solid var(--color-grey-dark);border-radius:12px}#tabbyPromoWrapper:hover{-webkit-box-shadow:0 0 rgba(0, 0, 0, 0), 0 0 rgba(0, 0, 0, 0), 5px 10px 30px rgba(43, 45, 52, 0.0509803922);box-shadow:0 0 rgba(0, 0, 0, 0), 0 0 rgba(0, 0, 0, 0), 5px 10px 30px rgba(43, 45, 52, 0.0509803922)}#tabbyPromoWrapper #tabbyPromo *{font-family:var(--font-main)}#tabbyPromoWrapper #tabbyPromo>div>div{max-width:none;-webkit-box-shadow:none;box-shadow:none;border:none}#tabbyPromoWrapper #tabbyPromo .tabby-promo-snippet{max-width:100%;min-height:100px;padding:18px 20px;border:none !important}#tabbyPromoWrapper #tabbyPromo .tabby-promo-snippet__text,#tabbyPromoWrapper #tabbyPromo .tabby-promo-snippet__link{font-size:var(--font-sm);color:var(--color-text) !important}#tabbyPromoWrapper #tabbyPromo .tabby-promo-snippet__link{font-weight:bold}.tabby-promo-wrapper #tabby-promo{font-family:var(--font-main) !important}.tabby-promo-wrapper #tabby-promo .tabby-promo__feature-title{font-size:var(--font-md)}.tabby-promo-wrapper #tabby-promo .tabby-promo__feature-desc{font-size:var(--font-sm);line-height:20px}.tamara-product-widget{margin-bottom:20px}.tamara-product-widget,.spotii-wrapper{min-height:100px;position:relative;color:var(--main-text-color);font-size:var(--font-sm);line-height:1.25;padding:20px 20px 20px 115px !important;background:white;border-radius:0.375rem;-webkit-transition:-webkit-box-shadow 0.5s cubic-bezier(0.4, 0, 0.2, 1);transition:-webkit-box-shadow 0.5s cubic-bezier(0.4, 0, 0.2, 1);transition:box-shadow 0.5s cubic-bezier(0.4, 0, 0.2, 1);transition:box-shadow 0.5s cubic-bezier(0.4, 0, 0.2, 1), -webkit-box-shadow 0.5s cubic-bezier(0.4, 0, 0.2, 1);border:unset !important;font-family:inherit !important;font-weight:500}.salla-y .tamara-product-widget,.salla-y .spotii-wrapper{border-radius:12px;border:1px solid var(--color-grey-dark)}.tamara-product-widget:hover,.spotii-wrapper:hover{-webkit-box-shadow:0 0 rgba(0, 0, 0, 0), 0 0 rgba(0, 0, 0, 0), 5px 10px 30px rgba(43, 45, 52, 0.0509803922);box-shadow:0 0 rgba(0, 0, 0, 0), 0 0 rgba(0, 0, 0, 0), 5px 10px 30px rgba(43, 45, 52, 0.0509803922)}.tamara-product-widget .spotii-logo,.spotii-wrapper .spotii-logo{float:left;margin:0 0 0 -75px}.ltr .tamara-product-widget,.ltr .spotii-wrapper{text-align:left;padding:18px 100px 18px 20px !important}.ltr .tamara-product-widget .spotii-logo,.ltr .spotii-wrapper .spotii-logo{float:right;margin:0 -75px 0 0}.ltr .tamara-product-widget .spotii-product-widget,.ltr .spotii-wrapper .spotii-product-widget{text-align:left !important}.spotii-wrapper{margin-bottom:20px}.spotii-wrapper .spotii-promo{font-size:var(--font-md)}.spotii-wrapper .spotii-product-widget{font-size:var(--font-sm) !important;margin-top:10px}.tamara-product-widget .tamara-logo{position:absolute;left:20px !important;top:35px !important;margin:0 !important;height:24px !important}.ltr .tamara-product-widget .tamara-logo{right:20px !important;left:auto !important}.tamara-product-widget span{font-family:var(--font-main);font-size:var(--font-sm);color:var(--color-text)}.tamara-product-widget span:last-child{display:block;position:relative;margin-top:8px}.tamara-popup__wrap{overflow:auto !important}.s-installment-mispay-wrapper,.s-installment-madfu-wrapper,.s-installment-emkan-wrapper,.s-installment-rajehi-wrapper{font-size:14px;text-align:right;padding:20px;gap:42px;direction:rtl;line-height:22px;color:rgb(0, 0, 0);min-width:100%;-webkit-box-sizing:border-box;box-sizing:border-box;position:relative;background-color:white;border-radius:10px;margin:15px 0;display:-ms-flexbox;display:flex;-webkit-transition:-webkit-box-shadow 0.5s cubic-bezier(0.4, 0, 0.2, 1);transition:-webkit-box-shadow 0.5s cubic-bezier(0.4, 0, 0.2, 1);transition:box-shadow 0.5s cubic-bezier(0.4, 0, 0.2, 1);transition:box-shadow 0.5s cubic-bezier(0.4, 0, 0.2, 1), -webkit-box-shadow 0.5s cubic-bezier(0.4, 0, 0.2, 1)}.s-installment-mispay-wrapper:hover,.s-installment-madfu-wrapper:hover,.s-installment-emkan-wrapper:hover,.s-installment-rajehi-wrapper:hover{-webkit-box-shadow:0 0 rgba(0, 0, 0, 0), 0 0 rgba(0, 0, 0, 0), 5px 10px 30px rgba(43, 45, 52, 0.0509803922);box-shadow:0 0 rgba(0, 0, 0, 0), 0 0 rgba(0, 0, 0, 0), 5px 10px 30px rgba(43, 45, 52, 0.0509803922)}.s-installment-mispay-content,.s-installment-madfu-content,.s-installment-emkan-content,.s-installment-rajehi-content{display:-ms-flexbox;display:flex;-ms-flex-direction:row-reverse;flex-direction:row-reverse;width:100%;-ms-flex-pack:justify;justify-content:space-between;-ms-flex-align:center;align-items:center;gap:1rem}.ltr .s-installment-mispay-content,.ltr .s-installment-madfu-content,.ltr .s-installment-emkan-content,.ltr .s-installment-rajehi-content{-ms-flex-direction:row;flex-direction:row}.s-installment-mispay-content-text,.s-installment-madfu-content-text,.s-installment-emkan-content-text,.s-installment-rajehi-content-text{color:var(--main-text-color);font-size:14px;font-weight:500;margin:0 16px 0 0;width:80%;left:14px;text-align:left}.s-installment-mispay-content img,.s-installment-madfu-content img,.s-installment-emkan-content img,.s-installment-rajehi-content img{height:28px;width:70px;display:inline-block;max-height:100%;vertical-align:middle;fill:none;stroke:unset;width:auto}.rtl .s-installment-mispay-content-text,.rtl .s-installment-madfu-content-text,.rtl .s-installment-emkan-content-text,.rtl .s-installment-rajehi-content-text{right:14px;text-align:right;margin:0 0 0 16px}.rtl .s-installment-mispay-content img,.rtl .s-installment-madfu-content img,.rtl .s-installment-emkan-content img,.rtl .s-installment-rajehi-content img{left:14px !important}.ltr .s-installment-mispay-content img,.ltr .s-installment-madfu-content img,.ltr .s-installment-emkan-content img,.ltr .s-installment-rajehi-content img{right:14px !important}.s-installment-rajehi-content img{width:70px !important;height:40px !important}.s-installment-emkan-content img{height:35px !important}";var SallaInstallment=function(){function t(t){registerInstance(this,t);this.tabbyBorderRemoved=false;this.tabbyRemoveBorderTries=0;this.language=salla.config.get("user.language_code");this.currency=salla.config.get("user.currency_code");this.country=salla.config.get("user.country_code");this.installment_sheria_text=function(t,a){return salla.lang.get(t,a)}}t.prototype.componentWillLoad=function(){return __awaiter(this,void 0,void 0,(function(){var t,a;var i=this;return __generator(this,(function(e){switch(e.label){case 0:return[4,salla.onReady()];case 1:e.sent();return[4,salla.lang.onLoaded()];case 2:e.sent();this.currency=salla.config.get("user.currency_code")||"SAR";this.language=salla.config.get("user.language_code")||"ar";this.country=salla.config.get("user.country_code")||"SA";t=[{key:"pages.products.installments",installments:3},{key:"pages.products.installments_emkan",installments:5}];t.forEach((function(t){i.installment_sheria_text(t.key,{payment:salla.money(parseFloat(i.price)),amount:salla.money((parseFloat(i.price)/t.installments).toFixed(2)).replace(/\.00$/,""),installments:t.installments})}));a=salla.config.get("store.settings.installments");if(a){this.tamaraIsActive=a.tamara;this.tabbyIsActive=a.tabby;this.spotiiIsActive=a.spotii;this.mispayActive=a.mispay;this.emkanIsActive=a.emkan;this.madfuActive=a.madfu;this.rajehiIsActive=a.mokafaa_alrajhi}salla.event.on("product::price.updated",(function(t){var a=t.data;if(!a.price||a.price==i.price){return}i.price=a.price;i.renderInstallments(true)}));return[2]}}))}))};t.prototype.componentDidLoad=function(){this.renderInstallments()};t.prototype.render=function(){var t;var a=this.currency==="SAR";if(!this.isValidPrice(this.price)){return""}return h(Host,null,this.tamaraIsActive&&(((t=this.tamaraIsActive)===null||t===void 0?void 0:t.publicKey)?h("div",{class:"mb-5"},h("tamara-widget",{type:"tamara-summary","inline-type":"2",amount:this.price})):h("div",{class:"tamara-product-widget","data-price":this.price,"data-currency":this.currency,"data-lang":this.language,"data-payment-type":"installment"})),this.tabbyIsActive?h("div",{id:"tabbyPromoWrapper"},h("div",{id:"tabbyPromo"})):"",this.spotiiIsActive?h("div",{class:"spotii-wrapper"},h("div",{class:"spotii-promo"})):"",this.shouldShowMispay()&&(this.mispayActive.publicKey?h("div",{class:"mb-5"},h("mispay-widget",{amount:this.price,lang:this.language})):h("div",{class:"s-installment-mispay-wrapper"},h("div",{class:"s-installment-mispay-content"},h("img",{src:salla.url.cdn("images/payment/png/mispay.png"),alt:"mispay"}),h("span",{class:"s-installment-mispay-content-text",innerHTML:this.installment_sheria_text("pages.products.installments",{payment:salla.money(parseFloat(this.price)),amount:salla.money((parseFloat(this.price)/4).toFixed(2)),installments:4})})))),this.emkanIsActive&&this.currency==="SAR"?h("div",{class:"s-installment-emkan-wrapper"},h("div",{class:"s-installment-emkan-content"},h("img",{src:salla.url.cdn("images/payment/png/emkan.png"),alt:"emkan"}),h("span",{class:"s-installment-emkan-content-text",innerHTML:this.installment_sheria_text("pages.products.installments_emkan",{payment:salla.money(parseFloat(this.price)),amount:salla.money((parseFloat(this.price)/5).toFixed(2)),installments:5})}))):"",this.madfuActive&&this.currency==="SAR"?h("div",{class:"s-installment-madfu-wrapper"},h("div",{class:"s-installment-madfu-content"},h("img",{src:salla.url.cdn("images/payment/png/madfu.png"),alt:"madfu"}),h("span",{class:"s-installment-madfu-content-text"},salla.lang.get("pages.products.installments_madfu")))):"",a&&this.rajehiIsActive?h("div",{class:"s-installment-rajehi-wrapper"},h("div",{class:"s-installment-rajehi-content"},h("img",{src:salla.url.cdn("images/payment/png/mokafaa_alrajhi_loyalty.png"),alt:"mokafaa_alrajhi_loyalty"}),h("span",{class:"s-installment-rajehi-content-text"},salla.lang.get("pages.products.rajahi_earn_points",{points:Math.floor(+this.price*this.rajehiIsActive.pointsPerRiyal)})))):"")};t.prototype.renderInstallments=function(t){var a=this;if(t===void 0){t=false}if(!this.isValidPrice(this.price)){return}if(this.tamaraIsActive){this.loadTamara({isUpdating:t})}if(this.tabbyIsActive){if(t){var i=this.host.querySelector("#tabbyPromoWrapper");if(i){i.remove()}var e=document.createElement("div");e.setAttribute("id","tabbyPromoWrapper");var n=document.createElement("div");n.setAttribute("id","tabbyPromo");e.appendChild(n);this.host.appendChild(e);var r=document.querySelector('script[src="https://checkout.tabby.ai/tabby-promo.js"]');if(r){r.remove()}}var s=document.createElement("script");s.setAttribute("src","https://checkout.tabby.ai/tabby-promo.js");document.head.appendChild(s);s.onload=function(){var t=window.TabbyPromo;new t({selector:"#tabbyPromo",currency:a.currency,price:a.price,lang:a.language,publicKey:salla.config.get("store.settings.installments.tabby.publicKey"),merchantCode:salla.config.get("store.settings.installments.tabby.merchantCode")});document.querySelectorAll(".tabby-promo-snippet__logo").forEach((function(t){t.setAttribute("aria-label","Tabby Logo")}))};this.removeTabbyBorder()}if(this.spotiiIsActive){if(t){var o=this.host.querySelector(".spotii-wrapper");if(o){o.remove()}var l=document.createElement("div");l.classList.add("spotii-wrapper");var p=document.createElement("div");p.classList.add("spotii-promo");l.appendChild(p);this.host.appendChild(l);var m=document.querySelector('script[src="'+salla.url.cdn("js/price-widget-ar-salla.js")+'"]');if(m){m.remove()}}var c=salla.money((Number(this.price)/3).toFixed(2),false);var d=salla.config.get("theme.is_rtl",true);window.spotiiConfig={targetXPath:[".spotii-wrapper"],renderToPath:[".spotii-promo"],numberOfPayment:3,currency:this.currency,templateLine:"${textOne} ${number} ${textTwo} "+c+"${logo} ${info}",textOne:d?"جزء الدفع على":"Split it into",textTwo:d?"أقساط متساوية بدون تكاليف اضافية بقيمة":"payments of",textThree:"مع",price:this.price};var h=document.createElement("script");h.setAttribute("src",salla.url.cdn("js/price-widget-ar-salla.js"));document.head.appendChild(h)}if(this.shouldShowMispay()&&this.mispayActive.publicKey){this.loadExternalScript({position:"head",src:"https://widget.mispay.co/v1/sdk.js?authorize=".concat(this.mispayActive.publicKey)})}};t.prototype.isValidPrice=function(t){var a=/^\d+(\.\d{1,2})?$/;var i=a.test(t);var e=parseFloat(t)>0;return i&&e};t.prototype.loadExternalScript=function(t){var a=t.src,i=t.onLoad,e=t.position;var n=document.createElement("script");n.src=a;n.onload=i;document[e].appendChild(n)};t.prototype.loadTamara=function(t){var a=this;var i=t.isUpdating;var e,n;var r=!!((e=this.tamaraIsActive)===null||e===void 0?void 0:e.publicKey);if(i){setTimeout((function(){var t,a;if(r){return(t=window.TamaraWidgetV2)===null||t===void 0?void 0:t.refresh()}(a=window.TamaraProductWidget)===null||a===void 0?void 0:a.render()}),300)}else{if(r){var s=salla.config.get("user.language_code");var o=["ar","en"].includes(s)?s:"ar";var l=(n=this.currency)===null||n===void 0?void 0:n.slice(0,-1);var p=["SA","AE","KW","BH","OM","QA"].includes(l)?l:null;if(!p){console.error("Tamara: Country code is not supported",l)}else{window.tamaraWidgetConfig={lang:o,country:p,publicKey:this.tamaraIsActive.publicKey,style:{fontSize:"14px"}};this.loadExternalScript({position:"head",src:"https://cdn.tamara.co/widget-v2/tamara-widget.js"})}}else{this.loadExternalScript({position:"head",src:"https://cdn.tamara.co/widget/product-widget.min.js",onLoad:function(){window.TamaraProductWidget.init({lang:a.language});setTimeout((function(){window.TamaraProductWidget.render()}),300)}})}}};t.prototype.shouldShowMispay=function(){return this.currency==="SAR"&&this.mispayActive&&parseInt(this.price)>=200};t.prototype.removeTabbyBorder=function(){var t=this;if(this.tabbyBorderRemoved||this.tabbyRemoveBorderTries>5){return}this.tabbyRemoveBorderTries++;setTimeout((function(){var a=document.querySelector("#tabbyPromo>div>div");a=a&&a.shadowRoot?a.shadowRoot.querySelector('div[class^="styles__tabby-promo-snippet--"]'):null;if(a){a.style="border: none; margin: 15px 0!important;";t.tabbyBorderRemoved=true}else{t.removeTabbyBorder()}}),this.tabbyRemoveBorderTries*500)};Object.defineProperty(t.prototype,"host",{get:function(){return getElement(this)},enumerable:false,configurable:true});return t}();SallaInstallment.style=sallaInstallmentCss;export{SallaInstallment as salla_installment};
4
+ */import{r as registerInstance,h,H as Host,g as getElement}from"./index-HB9ZridH.js";var sallaInstallmentCss="salla-installment:empty{display:none}#tabbyPromoWrapper{background:white;border-radius:0.375rem;-webkit-transition:-webkit-box-shadow 0.5s cubic-bezier(0.4, 0, 0.2, 1);transition:-webkit-box-shadow 0.5s cubic-bezier(0.4, 0, 0.2, 1);transition:box-shadow 0.5s cubic-bezier(0.4, 0, 0.2, 1);transition:box-shadow 0.5s cubic-bezier(0.4, 0, 0.2, 1), -webkit-box-shadow 0.5s cubic-bezier(0.4, 0, 0.2, 1);margin-bottom:20px;border:unset !important;font-weight:500}.salla-y #tabbyPromoWrapper{border:1px solid var(--color-grey-dark);border-radius:12px}#tabbyPromoWrapper:hover{-webkit-box-shadow:0 0 rgba(0, 0, 0, 0), 0 0 rgba(0, 0, 0, 0), 5px 10px 30px rgba(43, 45, 52, 0.0509803922);box-shadow:0 0 rgba(0, 0, 0, 0), 0 0 rgba(0, 0, 0, 0), 5px 10px 30px rgba(43, 45, 52, 0.0509803922)}#tabbyPromoWrapper #tabbyPromo *{font-family:var(--font-main)}#tabbyPromoWrapper #tabbyPromo>div>div{max-width:none;-webkit-box-shadow:none;box-shadow:none;border:none}#tabbyPromoWrapper #tabbyPromo .tabby-promo-snippet{max-width:100%;min-height:100px;padding:18px 20px;border:none !important}#tabbyPromoWrapper #tabbyPromo .tabby-promo-snippet__text,#tabbyPromoWrapper #tabbyPromo .tabby-promo-snippet__link{font-size:var(--font-sm);color:var(--color-text) !important}#tabbyPromoWrapper #tabbyPromo .tabby-promo-snippet__link{font-weight:bold}.tabby-promo-wrapper #tabby-promo{font-family:var(--font-main) !important}.tabby-promo-wrapper #tabby-promo .tabby-promo__feature-title{font-size:var(--font-md)}.tabby-promo-wrapper #tabby-promo .tabby-promo__feature-desc{font-size:var(--font-sm);line-height:20px}.tamara-product-widget{margin-bottom:20px}.tamara-product-widget,.spotii-wrapper{min-height:100px;position:relative;color:var(--main-text-color);font-size:var(--font-sm);line-height:1.25;padding:20px 20px 20px 115px !important;background:white;border-radius:0.375rem;-webkit-transition:-webkit-box-shadow 0.5s cubic-bezier(0.4, 0, 0.2, 1);transition:-webkit-box-shadow 0.5s cubic-bezier(0.4, 0, 0.2, 1);transition:box-shadow 0.5s cubic-bezier(0.4, 0, 0.2, 1);transition:box-shadow 0.5s cubic-bezier(0.4, 0, 0.2, 1), -webkit-box-shadow 0.5s cubic-bezier(0.4, 0, 0.2, 1);border:unset !important;font-family:inherit !important;font-weight:500}.salla-y .tamara-product-widget,.salla-y .spotii-wrapper{border-radius:12px;border:1px solid var(--color-grey-dark)}.tamara-product-widget:hover,.spotii-wrapper:hover{-webkit-box-shadow:0 0 rgba(0, 0, 0, 0), 0 0 rgba(0, 0, 0, 0), 5px 10px 30px rgba(43, 45, 52, 0.0509803922);box-shadow:0 0 rgba(0, 0, 0, 0), 0 0 rgba(0, 0, 0, 0), 5px 10px 30px rgba(43, 45, 52, 0.0509803922)}.tamara-product-widget .spotii-logo,.spotii-wrapper .spotii-logo{float:left;margin:0 0 0 -75px}.ltr .tamara-product-widget,.ltr .spotii-wrapper{text-align:left;padding:18px 100px 18px 20px !important}.ltr .tamara-product-widget .spotii-logo,.ltr .spotii-wrapper .spotii-logo{float:right;margin:0 -75px 0 0}.ltr .tamara-product-widget .spotii-product-widget,.ltr .spotii-wrapper .spotii-product-widget{text-align:left !important}.spotii-wrapper{margin-bottom:20px}.spotii-wrapper .spotii-promo{font-size:var(--font-md)}.spotii-wrapper .spotii-product-widget{font-size:var(--font-sm) !important;margin-top:10px}.tamara-product-widget .tamara-logo{position:absolute;left:20px !important;top:35px !important;margin:0 !important;height:24px !important}.ltr .tamara-product-widget .tamara-logo{right:20px !important;left:auto !important}.tamara-product-widget span{font-family:var(--font-main);font-size:var(--font-sm);color:var(--color-text)}.tamara-product-widget span:last-child{display:block;position:relative;margin-top:8px}.tamara-popup__wrap{overflow:auto !important}.s-installment-mispay-wrapper,.s-installment-madfu-wrapper,.s-installment-emkan-wrapper,.s-installment-rajehi-wrapper{font-size:14px;text-align:right;padding:20px;gap:42px;direction:rtl;line-height:22px;color:rgb(0, 0, 0);min-width:100%;-webkit-box-sizing:border-box;box-sizing:border-box;position:relative;background-color:white;border-radius:10px;margin:15px 0;display:-ms-flexbox;display:flex;-webkit-transition:-webkit-box-shadow 0.5s cubic-bezier(0.4, 0, 0.2, 1);transition:-webkit-box-shadow 0.5s cubic-bezier(0.4, 0, 0.2, 1);transition:box-shadow 0.5s cubic-bezier(0.4, 0, 0.2, 1);transition:box-shadow 0.5s cubic-bezier(0.4, 0, 0.2, 1), -webkit-box-shadow 0.5s cubic-bezier(0.4, 0, 0.2, 1)}.s-installment-mispay-wrapper:hover,.s-installment-madfu-wrapper:hover,.s-installment-emkan-wrapper:hover,.s-installment-rajehi-wrapper:hover{-webkit-box-shadow:0 0 rgba(0, 0, 0, 0), 0 0 rgba(0, 0, 0, 0), 5px 10px 30px rgba(43, 45, 52, 0.0509803922);box-shadow:0 0 rgba(0, 0, 0, 0), 0 0 rgba(0, 0, 0, 0), 5px 10px 30px rgba(43, 45, 52, 0.0509803922)}.s-installment-mispay-content,.s-installment-madfu-content,.s-installment-emkan-content,.s-installment-rajehi-content{display:-ms-flexbox;display:flex;-ms-flex-direction:row-reverse;flex-direction:row-reverse;width:100%;-ms-flex-pack:justify;justify-content:space-between;-ms-flex-align:center;align-items:center;gap:1rem}.ltr .s-installment-mispay-content,.ltr .s-installment-madfu-content,.ltr .s-installment-emkan-content,.ltr .s-installment-rajehi-content{-ms-flex-direction:row;flex-direction:row}.s-installment-mispay-content-text,.s-installment-madfu-content-text,.s-installment-emkan-content-text,.s-installment-rajehi-content-text{color:var(--main-text-color);font-size:14px;font-weight:500;margin:0 16px 0 0;width:80%;left:14px;text-align:left}.s-installment-mispay-content img,.s-installment-madfu-content img,.s-installment-emkan-content img,.s-installment-rajehi-content img{height:28px;width:70px;display:inline-block;max-height:100%;vertical-align:middle;fill:none;stroke:unset;width:auto}.rtl .s-installment-mispay-content-text,.rtl .s-installment-madfu-content-text,.rtl .s-installment-emkan-content-text,.rtl .s-installment-rajehi-content-text{right:14px;text-align:right;margin:0 0 0 16px}.rtl .s-installment-mispay-content img,.rtl .s-installment-madfu-content img,.rtl .s-installment-emkan-content img,.rtl .s-installment-rajehi-content img{left:14px !important}.ltr .s-installment-mispay-content img,.ltr .s-installment-madfu-content img,.ltr .s-installment-emkan-content img,.ltr .s-installment-rajehi-content img{right:14px !important}.s-installment-rajehi-content img{width:70px !important;height:40px !important}.s-installment-emkan-content img{height:35px !important}";var SallaInstallment=function(){function t(t){registerInstance(this,t);this.tabbyBorderRemoved=false;this.tabbyRemoveBorderTries=0;this.language=salla.config.get("user.language_code");this.currency=salla.config.get("user.currency_code");this.country=salla.config.get("user.country_code");this.installment_sheria_text=function(t,a){return salla.lang.get(t,a)}}t.prototype.componentWillLoad=function(){return __awaiter(this,void 0,void 0,(function(){var t,a;var i=this;return __generator(this,(function(e){switch(e.label){case 0:return[4,salla.onReady()];case 1:e.sent();return[4,salla.lang.onLoaded()];case 2:e.sent();this.currency=salla.config.get("user.currency_code")||"SAR";this.language=salla.config.get("user.language_code")||"ar";this.country=salla.config.get("user.country_code")||"SA";t=[{key:"pages.products.installments",installments:3},{key:"pages.products.installments_emkan",installments:5}];t.forEach((function(t){i.installment_sheria_text(t.key,{payment:salla.money(parseFloat(i.price)),amount:salla.money((parseFloat(i.price)/t.installments).toFixed(2)).replace(/\.00$/,""),installments:t.installments})}));a=salla.config.get("store.settings.installments");if(a){this.tamaraIsActive=a.tamara;this.tabbyIsActive=a.tabby;this.spotiiIsActive=a.spotii;this.mispayActive=a.mispay;this.emkanIsActive=a.emkan;this.madfuActive=a.madfu;this.rajehiIsActive=a.mokafaa_alrajhi}salla.event.on("product::price.updated",(function(t){var a=t.data;if(!a.price||a.price==i.price){return}i.price=a.price;i.renderInstallments(true)}));return[2]}}))}))};t.prototype.componentDidLoad=function(){this.renderInstallments()};t.prototype.render=function(){var t;var a=this.currency==="SAR";if(!this.isValidPrice(this.price)){return""}return h(Host,null,this.tamaraIsActive&&(((t=this.tamaraIsActive)===null||t===void 0?void 0:t.publicKey)?h("div",{class:"mb-5"},h("tamara-widget",{type:"tamara-summary","inline-type":"2",amount:this.price})):h("div",{class:"tamara-product-widget","data-price":this.price,"data-currency":this.currency,"data-lang":this.language,"data-payment-type":"installment"})),this.tabbyIsActive?h("div",{id:"tabbyPromoWrapper"},h("div",{id:"tabbyPromo"})):"",this.spotiiIsActive?h("div",{class:"spotii-wrapper"},h("div",{class:"spotii-promo"})):"",this.shouldShowMispay()&&(this.mispayActive.publicKey?h("div",{class:"mb-5"},h("mispay-widget",{amount:this.price,lang:this.language})):h("div",{class:"s-installment-mispay-wrapper"},h("div",{class:"s-installment-mispay-content"},h("img",{src:salla.url.cdn("images/payment/png/mispay.png"),alt:"mispay"}),h("span",{class:"s-installment-mispay-content-text",innerHTML:this.installment_sheria_text("pages.products.installments",{payment:salla.money(parseFloat(this.price)),amount:salla.money((parseFloat(this.price)/4).toFixed(2)),installments:4})})))),this.emkanIsActive&&this.currency==="SAR"?h("div",{class:"s-installment-emkan-wrapper"},h("div",{class:"s-installment-emkan-content"},h("img",{src:salla.url.cdn("images/payment/png/emkan.png"),alt:"emkan"}),h("span",{class:"s-installment-emkan-content-text",innerHTML:this.installment_sheria_text("pages.products.installments_emkan",{payment:salla.money(parseFloat(this.price)),amount:salla.money((parseFloat(this.price)/5).toFixed(2)),installments:5})}))):"",this.madfuActive&&this.currency==="SAR"?h("div",{class:"s-installment-madfu-wrapper"},h("div",{class:"s-installment-madfu-content"},h("img",{src:salla.url.cdn("images/payment/png/madfu.png"),alt:"madfu"}),h("span",{class:"s-installment-madfu-content-text"},salla.lang.get("pages.products.installments_madfu")))):"",a&&this.rajehiIsActive?h("div",{class:"s-installment-rajehi-wrapper"},h("div",{class:"s-installment-rajehi-content"},h("img",{src:salla.url.cdn("images/payment/png/mokafaa_alrajhi_loyalty.png"),alt:"mokafaa_alrajhi_loyalty"}),h("span",{class:"s-installment-rajehi-content-text"},salla.lang.get("pages.products.rajahi_earn_points",{points:Math.floor(+this.price*this.rajehiIsActive.pointsPerRiyal)})))):"")};t.prototype.renderInstallments=function(t){var a=this;if(t===void 0){t=false}if(!this.isValidPrice(this.price)){return}if(this.tamaraIsActive){this.loadTamara({isUpdating:t})}if(this.tabbyIsActive){if(t){var i=this.host.querySelector("#tabbyPromoWrapper");if(i){i.remove()}var e=document.createElement("div");e.setAttribute("id","tabbyPromoWrapper");var n=document.createElement("div");n.setAttribute("id","tabbyPromo");e.appendChild(n);this.host.appendChild(e);var r=document.querySelector('script[src="https://checkout.tabby.ai/tabby-promo.js"]');if(r){r.remove()}}var s=document.createElement("script");s.setAttribute("src","https://checkout.tabby.ai/tabby-promo.js");document.head.appendChild(s);s.onload=function(){var t=window.TabbyPromo;new t({selector:"#tabbyPromo",currency:a.currency,price:a.price,lang:a.language,publicKey:salla.config.get("store.settings.installments.tabby.publicKey"),merchantCode:salla.config.get("store.settings.installments.tabby.merchantCode")});document.querySelectorAll(".tabby-promo-snippet__logo").forEach((function(t){t.setAttribute("aria-label","Tabby Logo")}))};this.removeTabbyBorder()}if(this.spotiiIsActive){if(t){var o=this.host.querySelector(".spotii-wrapper");if(o){o.remove()}var l=document.createElement("div");l.classList.add("spotii-wrapper");var p=document.createElement("div");p.classList.add("spotii-promo");l.appendChild(p);this.host.appendChild(l);var m=document.querySelector('script[src="'+salla.url.cdn("js/price-widget-ar-salla.js")+'"]');if(m){m.remove()}}var c=salla.money((Number(this.price)/3).toFixed(2),false);var d=salla.config.get("theme.is_rtl",true);window.spotiiConfig={targetXPath:[".spotii-wrapper"],renderToPath:[".spotii-promo"],numberOfPayment:3,currency:this.currency,templateLine:"${textOne} ${number} ${textTwo} "+c+"${logo} ${info}",textOne:d?"جزء الدفع على":"Split it into",textTwo:d?"أقساط متساوية بدون تكاليف اضافية بقيمة":"payments of",textThree:"مع",price:this.price};var h=document.createElement("script");h.setAttribute("src",salla.url.cdn("js/price-widget-ar-salla.js"));document.head.appendChild(h)}if(this.shouldShowMispay()&&this.mispayActive.publicKey){this.loadExternalScript({position:"head",src:"https://widget.mispay.co/v1/sdk.js?authorize=".concat(this.mispayActive.publicKey)})}};t.prototype.isValidPrice=function(t){var a=/^\d+(\.\d{1,2})?$/;var i=a.test(t);var e=parseFloat(t)>0;return i&&e};t.prototype.loadExternalScript=function(t){var a=t.src,i=t.onLoad,e=t.position;var n=document.createElement("script");n.src=a;n.onload=i;document[e].appendChild(n)};t.prototype.loadTamara=function(t){var a=this;var i=t.isUpdating;var e,n;var r=!!((e=this.tamaraIsActive)===null||e===void 0?void 0:e.publicKey);if(i){setTimeout((function(){var t,a;if(r){return(t=window.TamaraWidgetV2)===null||t===void 0?void 0:t.refresh()}(a=window.TamaraProductWidget)===null||a===void 0?void 0:a.render()}),300)}else{if(r){var s=salla.config.get("user.language_code");var o=["ar","en"].includes(s)?s:"ar";var l=(n=this.currency)===null||n===void 0?void 0:n.slice(0,-1);var p=["SA","AE","KW","BH","OM","QA"].includes(l)?l:null;if(!p){console.error("Tamara: Country code is not supported",l)}else{window.tamaraWidgetConfig={lang:o,country:p,publicKey:this.tamaraIsActive.publicKey,style:{fontSize:"14px"}};this.loadExternalScript({position:"head",src:"https://cdn.tamara.co/widget-v2/tamara-widget.js"})}}else{this.loadExternalScript({position:"head",src:"https://cdn.tamara.co/widget/product-widget.min.js",onLoad:function(){window.TamaraProductWidget.init({lang:a.language});setTimeout((function(){window.TamaraProductWidget.render()}),300)}})}}};t.prototype.shouldShowMispay=function(){return this.currency==="SAR"&&this.mispayActive&&parseInt(this.price)>=200};t.prototype.removeTabbyBorder=function(){var t=this;if(this.tabbyBorderRemoved||this.tabbyRemoveBorderTries>5){return}this.tabbyRemoveBorderTries++;setTimeout((function(){var a=document.querySelector("#tabbyPromo>div>div");a=a&&a.shadowRoot?a.shadowRoot.querySelector('div[class^="styles__tabby-promo-snippet--"]'):null;if(a){a.style="border: none; margin: 15px 0!important;";t.tabbyBorderRemoved=true}else{t.removeTabbyBorder()}}),this.tabbyRemoveBorderTries*500)};Object.defineProperty(t.prototype,"host",{get:function(){return getElement(this)},enumerable:false,configurable:true});return t}();SallaInstallment.style=sallaInstallmentCss;export{SallaInstallment as salla_installment};
5
5
  //# sourceMappingURL=salla-installment.entry.js.map
@@ -1,5 +1,5 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r as registerInstance,c as createEvent,h,H as Host}from"./index-BJcojI6v.js";var sallaLoyaltyPrizeItemCss="salla-loyalty-prize-item:hover{-webkit-box-shadow:0 5px 15px 1px rgba(0, 0, 0, 0.04) !important;box-shadow:0 5px 15px 1px rgba(0, 0, 0, 0.04) !important}";var SallaLoyaltyPrizeItem=function(){function e(e){registerInstance(this,e);this.prizeItemSelected=createEvent(this,"prizeItemSelected")}e.prototype.onPrizeItemClick=function(){this.prizeItemSelected.emit(this.item)};e.prototype.render=function(){return h(Host,{key:"5434064e3e54117f4df4e16282f70e81503d7489"},h("div",{key:"28b5a19dcd1f239a74d69e91a1cda66ae7521e8e",onClick:this.onPrizeItemClick.bind(this)},h("img",{key:"82917e0074006f4e462b2328405714a31d168c17",class:"s-loyalty-prize-item-image",src:this.item.image,alt:this.item.name}),h("div",{key:"089ac134ed2a0474067c79cd590154ca85a380c9",class:"s-loyalty-prize-item-title"},this.item.name),h("div",{key:"85d245c32c42701274fa29761c4345020532eac1",class:"s-loyalty-prize-item-subtitle"},this.item.description),h("div",{key:"5f37781c8c77998a0bb586ddcda4640741db0b6e",class:"s-loyalty-prize-item-points"},this.item.cost_points," Points")))};return e}();SallaLoyaltyPrizeItem.style=sallaLoyaltyPrizeItemCss;export{SallaLoyaltyPrizeItem as salla_loyalty_prize_item};
4
+ import{r as registerInstance,c as createEvent,h,H as Host}from"./index-HB9ZridH.js";var sallaLoyaltyPrizeItemCss="salla-loyalty-prize-item:hover{-webkit-box-shadow:0 5px 15px 1px rgba(0, 0, 0, 0.04) !important;box-shadow:0 5px 15px 1px rgba(0, 0, 0, 0.04) !important}";var SallaLoyaltyPrizeItem=function(){function e(e){registerInstance(this,e);this.prizeItemSelected=createEvent(this,"prizeItemSelected")}e.prototype.onPrizeItemClick=function(){this.prizeItemSelected.emit(this.item)};e.prototype.render=function(){return h(Host,{key:"5434064e3e54117f4df4e16282f70e81503d7489"},h("div",{key:"28b5a19dcd1f239a74d69e91a1cda66ae7521e8e",onClick:this.onPrizeItemClick.bind(this)},h("img",{key:"82917e0074006f4e462b2328405714a31d168c17",class:"s-loyalty-prize-item-image",src:this.item.image,alt:this.item.name}),h("div",{key:"089ac134ed2a0474067c79cd590154ca85a380c9",class:"s-loyalty-prize-item-title"},this.item.name),h("div",{key:"85d245c32c42701274fa29761c4345020532eac1",class:"s-loyalty-prize-item-subtitle"},this.item.description),h("div",{key:"5f37781c8c77998a0bb586ddcda4640741db0b6e",class:"s-loyalty-prize-item-points"},this.item.cost_points," Points")))};return e}();SallaLoyaltyPrizeItem.style=sallaLoyaltyPrizeItemCss;export{SallaLoyaltyPrizeItem as salla_loyalty_prize_item};
5
5
  //# sourceMappingURL=salla-loyalty-prize-item.entry.js.map
@@ -1,5 +1,5 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r as registerInstance,h,H as Host,g as getElement}from"./index-BJcojI6v.js";var sallaMetadataCss="";var SallaMetadata=function(){function a(a){registerInstance(this,a);this.entity="product";this.specs=[];this.download=salla.lang.get("pages.thank_you.download");if(this.entityId){try{this.entityId=Array.isArray(this.entityId)?this.entityId:JSON.parse(this.entityId);return}catch(a){salla.log("Bad json passed via entityId prop")}}}a.prototype.getValue=function(a){if(a.type==="file"){return'<a href="'.concat(a.value,'" class="text-primary" target="_blank"><span class="sicon-download"></span> ').concat(this.download,"</a>")}if(a.type==="url"){return'<a href="'.concat(a.value,'" class="text-blue-700 underline" target="_blank">').concat(a.value,"</a>")}if(a.type==="date"){var t=new Date(a.value);var r=String(t.getDate()).padStart(2,"0");var e=String(t.getMonth()+1).padStart(2,"0");var s=t.getFullYear();var n="".concat(r,"/").concat(e,"/").concat(s);return n}return a.value};a.prototype.componentWillLoad=function(){var a=this;return salla.onReady().then((function(){var a;if(!((a=salla.config.get("store.features"))===null||a===void 0?void 0:a.includes("custom-fields"))){throw new Error("feature custom-fields is not activated")}})).then((function(){if(!a.entityId&&salla.url.is_page("product.single")){a.entityId=salla.config.get("page.id")}if(!a.entityId){throw new Error("can't render salla-metadata without enity-id prop!")}salla.lang.onLoaded((function(){return a.download=salla.lang.get("pages.thank_you.download")}));var t=Array.isArray(a.entityId)?a.entityId:[a.entityId];var r=t.map((function(a){return"entities[]=".concat(a)})).join("&");var e="https://api.salla.dev/store/v1/metadata/values?type=".concat(a.entity,"&").concat(r);return salla.api.request(e).then((function(a){var t;return(t=a.data[0])===null||t===void 0?void 0:t.sections}))})).then((function(t){return a.specs=t})).catch((function(a){return salla.logger.error("Error loading more specs:",a)}))};a.prototype.render=function(){var a=this;if(!this.specs.length){return}return h(Host,{class:"s-metadata-wrapper"},this.specs.map((function(t){return h("div",{class:"s-metadata-box"},h("div",{class:"s-metadata-box-header"},h("i",{class:"sicon-list"}),t.name),t.fields.map((function(t){return h("div",{class:"s-metadata-row"},h("p",{class:"s-metadata-row-name"},t.name),h("p",{class:"s-metadata-row-value",innerHTML:a.getValue(t)}))})))})))};Object.defineProperty(a.prototype,"host",{get:function(){return getElement(this)},enumerable:false,configurable:true});return a}();SallaMetadata.style=sallaMetadataCss;export{SallaMetadata as salla_metadata};
4
+ import{r as registerInstance,h,H as Host,g as getElement}from"./index-HB9ZridH.js";var sallaMetadataCss="";var SallaMetadata=function(){function a(a){registerInstance(this,a);this.entity="product";this.specs=[];this.download=salla.lang.get("pages.thank_you.download");if(this.entityId){try{this.entityId=Array.isArray(this.entityId)?this.entityId:JSON.parse(this.entityId);return}catch(a){salla.log("Bad json passed via entityId prop")}}}a.prototype.getValue=function(a){if(a.type==="file"){return'<a href="'.concat(a.value,'" class="text-primary" target="_blank"><span class="sicon-download"></span> ').concat(this.download,"</a>")}if(a.type==="url"){return'<a href="'.concat(a.value,'" class="text-blue-700 underline" target="_blank">').concat(a.value,"</a>")}if(a.type==="date"){var t=new Date(a.value);var r=String(t.getDate()).padStart(2,"0");var e=String(t.getMonth()+1).padStart(2,"0");var s=t.getFullYear();var n="".concat(r,"/").concat(e,"/").concat(s);return n}return a.value};a.prototype.componentWillLoad=function(){var a=this;return salla.onReady().then((function(){var a;if(!((a=salla.config.get("store.features"))===null||a===void 0?void 0:a.includes("custom-fields"))){throw new Error("feature custom-fields is not activated")}})).then((function(){if(!a.entityId&&salla.url.is_page("product.single")){a.entityId=salla.config.get("page.id")}if(!a.entityId){throw new Error("can't render salla-metadata without enity-id prop!")}salla.lang.onLoaded((function(){return a.download=salla.lang.get("pages.thank_you.download")}));var t=Array.isArray(a.entityId)?a.entityId:[a.entityId];var r=t.map((function(a){return"entities[]=".concat(a)})).join("&");var e="https://api.salla.dev/store/v1/metadata/values?type=".concat(a.entity,"&").concat(r);return salla.api.request(e).then((function(a){var t;return(t=a.data[0])===null||t===void 0?void 0:t.sections}))})).then((function(t){return a.specs=t})).catch((function(a){return salla.logger.error("Error loading more specs:",a)}))};a.prototype.render=function(){var a=this;if(!this.specs.length){return}return h(Host,{class:"s-metadata-wrapper"},this.specs.map((function(t){return h("div",{class:"s-metadata-box"},h("div",{class:"s-metadata-box-header"},h("i",{class:"sicon-list"}),t.name),t.fields.map((function(t){return h("div",{class:"s-metadata-row"},h("p",{class:"s-metadata-row-name"},t.name),h("p",{class:"s-metadata-row-value",innerHTML:a.getValue(t)}))})))})))};Object.defineProperty(a.prototype,"host",{get:function(){return getElement(this)},enumerable:false,configurable:true});return a}();SallaMetadata.style=sallaMetadataCss;export{SallaMetadata as salla_metadata};
5
5
  //# sourceMappingURL=salla-metadata.entry.js.map
@@ -1,5 +1,5 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r as registerInstance,h}from"./index-BJcojI6v.js";var sallaNotificationsCss="";var SallaNotificationItem=function(){function i(i){registerInstance(this,i)}i.prototype.render=function(){return h("a",{key:"1b234e649b23636170f30dfc46884e047d0f02ce",href:this.notification.url,class:{"s-notifications-item":true,"s-notifications-item-shadow":true,"s-notifications-item-read":!this.notification.is_new}},h("span",{key:"948c47868767a413bc488287af46caac7aa35c1e",class:"s-notifications-item-icon"},h("i",{key:"2ac3ada00bd7d7f3a6d5ba85341628ac382acef5",class:{"s-notifications-item-icon sicon-bell-ring":true,"s-notifications-item-icon-new":this.notification.is_new}})),h("div",{key:"a19c06341302bc389a2f5829c06367c03372fbfb",class:"s-notifications-item-content"},h("div",{key:"77ed75864e91b39095ee2505e10f432fbc896ec5",class:"s-notifications-item-content-leading"},h("h4",{key:"cee7566266dff68eeb2d8635e1eeaf2745b1930f"},this.notification.title),h("p",{key:"459ffde17436ff4311c64ee7f53966283390c410"},this.notification.sub_title)),h("span",{key:"b681d2c40f719e7d6d1e5abda8993b1bb870cbb6",class:"s-notifications-item-content-trailing"},h("i",{key:"2cd02287aaeeeaa00f972f4e0448f66e96949525",class:"sicon-time s-notifications-item-content-trailing-icon"}),h("span",{key:"4fd57d3f80816b0e607d5e6900d7975f94cf0892"},this.notification.date))))};return i}();SallaNotificationItem.style=sallaNotificationsCss;export{SallaNotificationItem as salla_notification_item};
4
+ import{r as registerInstance,h}from"./index-HB9ZridH.js";var sallaNotificationsCss="";var SallaNotificationItem=function(){function i(i){registerInstance(this,i)}i.prototype.render=function(){return h("a",{key:"1b234e649b23636170f30dfc46884e047d0f02ce",href:this.notification.url,class:{"s-notifications-item":true,"s-notifications-item-shadow":true,"s-notifications-item-read":!this.notification.is_new}},h("span",{key:"948c47868767a413bc488287af46caac7aa35c1e",class:"s-notifications-item-icon"},h("i",{key:"2ac3ada00bd7d7f3a6d5ba85341628ac382acef5",class:{"s-notifications-item-icon sicon-bell-ring":true,"s-notifications-item-icon-new":this.notification.is_new}})),h("div",{key:"a19c06341302bc389a2f5829c06367c03372fbfb",class:"s-notifications-item-content"},h("div",{key:"77ed75864e91b39095ee2505e10f432fbc896ec5",class:"s-notifications-item-content-leading"},h("h4",{key:"cee7566266dff68eeb2d8635e1eeaf2745b1930f"},this.notification.title),h("p",{key:"459ffde17436ff4311c64ee7f53966283390c410"},this.notification.sub_title)),h("span",{key:"b681d2c40f719e7d6d1e5abda8993b1bb870cbb6",class:"s-notifications-item-content-trailing"},h("i",{key:"2cd02287aaeeeaa00f972f4e0448f66e96949525",class:"sicon-time s-notifications-item-content-trailing-icon"}),h("span",{key:"4fd57d3f80816b0e607d5e6900d7975f94cf0892"},this.notification.date))))};return i}();SallaNotificationItem.style=sallaNotificationsCss;export{SallaNotificationItem as salla_notification_item};
5
5
  //# sourceMappingURL=salla-notification-item.entry.js.map
@@ -1,5 +1,5 @@
1
1
  var __awaiter=this&&this.__awaiter||function(t,n,i,e){function r(t){return t instanceof i?t:new i((function(n){n(t)}))}return new(i||(i=Promise))((function(i,o){function a(t){try{u(e.next(t))}catch(t){o(t)}}function s(t){try{u(e["throw"](t))}catch(t){o(t)}}function u(t){t.done?i(t.value):r(t.value).then(a,s)}u((e=e.apply(t,n||[])).next())}))};var __generator=this&&this.__generator||function(t,n){var i={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},e,r,o,a;return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(t){return function(n){return u([t,n])}}function u(s){if(e)throw new TypeError("Generator is already executing.");while(a&&(a=0,s[0]&&(i=0)),i)try{if(e=1,r&&(o=s[0]&2?r["return"]:s[0]?r["throw"]||((o=r["return"])&&o.call(r),0):r.next)&&!(o=o.call(r,s[1])).done)return o;if(r=0,o)s=[s[0]&2,o.value];switch(s[0]){case 0:case 1:o=s;break;case 4:i.label++;return{value:s[1],done:false};case 5:i.label++;r=s[1];s=[0];continue;case 7:s=i.ops.pop();i.trys.pop();continue;default:if(!(o=i.trys,o=o.length>0&&o[o.length-1])&&(s[0]===6||s[0]===2)){i=0;continue}if(s[0]===3&&(!o||s[1]>o[0]&&s[1]<o[3])){i.label=s[1];break}if(s[0]===6&&i.label<o[1]){i.label=o[1];o=s;break}if(o&&i.label<o[2]){i.label=o[2];i.ops.push(s);break}if(o[2])i.ops.pop();i.trys.pop();continue}s=n.call(t,i)}catch(t){s=[6,t];r=0}finally{e=o=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:true}}};
2
2
  /*!
3
3
  * Crafted with ❤ by Salla
4
- */import{r as registerInstance,h,g as getElement}from"./index-BJcojI6v.js";import{H as Helper}from"./Helper-MNQx5g4A.js";import"./anime.es-CgtvEd63.js";var sallaNotificationsCss="";var SallaNotifications=function(){function t(t){var n=this;registerInstance(this,t);this.itemPerPage=10;this.no_notifications_trans=salla.lang.get("blocks.header.no_notifications");this.load_more_text_trans=salla.lang.get("common.elements.load_more");salla.lang.onLoaded((function(){n.no_notifications_trans=salla.lang.get("blocks.header.no_notifications");n.load_more_text_trans=salla.lang.get("common.elements.load_more")}))}t.prototype.loading=function(t){if(t===void 0){t=true}var n;var i=(n=this.status)===null||n===void 0?void 0:n.querySelector(".s-button-text");if(i){Helper.toggleElementClassIf(i,"s-button-hide","s-button-show",(function(){return t}));this.btnLoader.style.display=t?"inherit":"none"}};t.prototype.getNotificationCard=function(t){var n=document.createElement("salla-notification-item");n.notification=t;n.classList.add("s-block");return n};t.prototype.render=function(){var t=this;var n;if(this.showPlaceholder){return h("div",{class:"s-notifications-no-content"},h("salla-placeholder",{alignment:"center"},h("span",{slot:"title"},this.no_notifications_trans)))}return h("div",{class:"s-notifications-wrapper"},h("div",{class:"s-notifications-container",ref:function(n){return t.wrapper=n}}),this.nextPage&&h("div",{class:"s-infinite-scroll-wrapper",ref:function(n){return t.status=n}},h("button",{onClick:function(){return t.loadMore()},class:"s-infinite-scroll-btn s-button-btn s-button-primary"},h("span",{class:"s-button-text s-infinite-scroll-btn-text"},(n=this.loadMoreText)!==null&&n!==void 0?n:this.load_more_text_trans),h("span",{class:"s-button-loader s-button-loader-center s-infinite-scroll-btn-loader",ref:function(n){return t.btnLoader=n},style:{display:"none"}}))))};t.prototype.handleResponse=function(t){var n=this;return t.map((function(t){return n.getNotificationCard(t)}))};t.prototype.initiateInfiniteScroll=function(){var t=this;var n,i,e;if(!this.wrapper){salla.logger.error("Wrapper is undefined. Cannot initiate infinite scroll.");return}this.infiniteScroll=salla.infiniteScroll.initiate(this.wrapper,this.wrapper,{path:function(){return t.nextPage},history:true,nextPage:this.nextPage,scrollThreshold:false},true);(n=this.infiniteScroll)===null||n===void 0?void 0:n.on("request",(function(n){t.loading()}));(i=this.infiniteScroll)===null||i===void 0?void 0:i.on("load",(function(n){var i;t.loading(false);t.pagination=n.pagination;t.nextPage=((i=n.pagination.links)===null||i===void 0?void 0:i.next)||null;t.handleResponse(n.data).forEach((function(n){return t.wrapper.append(n)}));var e=t.host.querySelectorAll("salla-notification-item:not(.animated)");Helper.animateItems(e)}));(e=this.infiniteScroll)===null||e===void 0?void 0:e.on("error",(function(t){salla.logger.error("Error loading more comments:",t)}))};t.prototype.loadInitialData=function(){return __awaiter(this,void 0,void 0,(function(){var t=this;return __generator(this,(function(n){switch(n.label){case 0:return[4,salla.api.notifications.fetch({per_page:this.itemPerPage}).then((function(n){var i;t.pagination=n.pagination;t.total=n.pagination.total;t.nextPage=((i=n.pagination.links)===null||i===void 0?void 0:i.next)||null;setTimeout((function(){if(!n.data.length){return t.showPlaceholder=true}t.handleResponse(n.data).forEach((function(n){return t.wrapper.append(n)}));t.initiateInfiniteScroll();var i=t.wrapper.querySelectorAll("salla-notification-item:not(.animated)");Helper.animateItems(i)}),100)})).catch((function(n){salla.logger.error(n);t.showPlaceholder=true;t.loading(false)}))];case 1:n.sent();return[2]}}))}))};t.prototype.loadMore=function(){return __awaiter(this,void 0,void 0,(function(){var t;return __generator(this,(function(n){(t=this.infiniteScroll)===null||t===void 0?void 0:t.loadNextPage();return[2]}))}))};t.prototype.componentWillLoad=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){switch(t.label){case 0:return[4,this.loadInitialData()];case 1:t.sent();return[2]}}))}))};Object.defineProperty(t.prototype,"host",{get:function(){return getElement(this)},enumerable:false,configurable:true});return t}();SallaNotifications.style=sallaNotificationsCss;export{SallaNotifications as salla_notifications};
4
+ */import{r as registerInstance,h,g as getElement}from"./index-HB9ZridH.js";import{H as Helper}from"./Helper-MNQx5g4A.js";import"./anime.es-CgtvEd63.js";var sallaNotificationsCss="";var SallaNotifications=function(){function t(t){var n=this;registerInstance(this,t);this.itemPerPage=10;this.no_notifications_trans=salla.lang.get("blocks.header.no_notifications");this.load_more_text_trans=salla.lang.get("common.elements.load_more");salla.lang.onLoaded((function(){n.no_notifications_trans=salla.lang.get("blocks.header.no_notifications");n.load_more_text_trans=salla.lang.get("common.elements.load_more")}))}t.prototype.loading=function(t){if(t===void 0){t=true}var n;var i=(n=this.status)===null||n===void 0?void 0:n.querySelector(".s-button-text");if(i){Helper.toggleElementClassIf(i,"s-button-hide","s-button-show",(function(){return t}));this.btnLoader.style.display=t?"inherit":"none"}};t.prototype.getNotificationCard=function(t){var n=document.createElement("salla-notification-item");n.notification=t;n.classList.add("s-block");return n};t.prototype.render=function(){var t=this;var n;if(this.showPlaceholder){return h("div",{class:"s-notifications-no-content"},h("salla-placeholder",{alignment:"center"},h("span",{slot:"title"},this.no_notifications_trans)))}return h("div",{class:"s-notifications-wrapper"},h("div",{class:"s-notifications-container",ref:function(n){return t.wrapper=n}}),this.nextPage&&h("div",{class:"s-infinite-scroll-wrapper",ref:function(n){return t.status=n}},h("button",{onClick:function(){return t.loadMore()},class:"s-infinite-scroll-btn s-button-btn s-button-primary"},h("span",{class:"s-button-text s-infinite-scroll-btn-text"},(n=this.loadMoreText)!==null&&n!==void 0?n:this.load_more_text_trans),h("span",{class:"s-button-loader s-button-loader-center s-infinite-scroll-btn-loader",ref:function(n){return t.btnLoader=n},style:{display:"none"}}))))};t.prototype.handleResponse=function(t){var n=this;return t.map((function(t){return n.getNotificationCard(t)}))};t.prototype.initiateInfiniteScroll=function(){var t=this;var n,i,e;if(!this.wrapper){salla.logger.error("Wrapper is undefined. Cannot initiate infinite scroll.");return}this.infiniteScroll=salla.infiniteScroll.initiate(this.wrapper,this.wrapper,{path:function(){return t.nextPage},history:true,nextPage:this.nextPage,scrollThreshold:false},true);(n=this.infiniteScroll)===null||n===void 0?void 0:n.on("request",(function(n){t.loading()}));(i=this.infiniteScroll)===null||i===void 0?void 0:i.on("load",(function(n){var i;t.loading(false);t.pagination=n.pagination;t.nextPage=((i=n.pagination.links)===null||i===void 0?void 0:i.next)||null;t.handleResponse(n.data).forEach((function(n){return t.wrapper.append(n)}));var e=t.host.querySelectorAll("salla-notification-item:not(.animated)");Helper.animateItems(e)}));(e=this.infiniteScroll)===null||e===void 0?void 0:e.on("error",(function(t){salla.logger.error("Error loading more comments:",t)}))};t.prototype.loadInitialData=function(){return __awaiter(this,void 0,void 0,(function(){var t=this;return __generator(this,(function(n){switch(n.label){case 0:return[4,salla.api.notifications.fetch({per_page:this.itemPerPage}).then((function(n){var i;t.pagination=n.pagination;t.total=n.pagination.total;t.nextPage=((i=n.pagination.links)===null||i===void 0?void 0:i.next)||null;setTimeout((function(){if(!n.data.length){return t.showPlaceholder=true}t.handleResponse(n.data).forEach((function(n){return t.wrapper.append(n)}));t.initiateInfiniteScroll();var i=t.wrapper.querySelectorAll("salla-notification-item:not(.animated)");Helper.animateItems(i)}),100)})).catch((function(n){salla.logger.error(n);t.showPlaceholder=true;t.loading(false)}))];case 1:n.sent();return[2]}}))}))};t.prototype.loadMore=function(){return __awaiter(this,void 0,void 0,(function(){var t;return __generator(this,(function(n){(t=this.infiniteScroll)===null||t===void 0?void 0:t.loadNextPage();return[2]}))}))};t.prototype.componentWillLoad=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){switch(t.label){case 0:return[4,this.loadInitialData()];case 1:t.sent();return[2]}}))}))};Object.defineProperty(t.prototype,"host",{get:function(){return getElement(this)},enumerable:false,configurable:true});return t}();SallaNotifications.style=sallaNotificationsCss;export{SallaNotifications as salla_notifications};
5
5
  //# sourceMappingURL=salla-notifications.entry.js.map
@@ -1,5 +1,5 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r as registerInstance,h,g as getElement}from"./index-BJcojI6v.js";var PageType;(function(e){e["ProductDetail"]="product.single";e["Cart"]="cart"})(PageType||(PageType={}));var OfferType;(function(e){e["Conditional"]="conditional";e["PercentageOrFixed"]="fixed";e["DiscountsTable"]="discounts_table";e["Bank"]="bank";e["BuyXGetY"]="buy_x_get_y"})(OfferType||(OfferType={}));var sallaOfferCss='.s-offer-wrapper .s-slider-block__title h2{font-size:1.125rem;line-height:1.75rem;color:#f87171}.s-offer-wrapper .s-slider-block__title h2::before{font-family:"sallaicons";content:"\\ee30" !important;position:absolute;top:1rem;font-size:3rem;font-weight:400;line-height:1;color:#fef2f2}.s-offer-bank-wrapper-sinlge-item{display:-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 SallaOffer=function(){function e(e){var s=this;registerInstance(this,e);var r;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(){s.offer_with_price_text=salla.lang.get("pages.offer.with_price");s.with_discount_text=salla.lang.get("pages.products.with_a_discount");s.product_discount_text=salla.lang.get("pages.products.discount");s.special_offer_text=salla.lang.get("pages.products.special_offer");s.multipleBankOfferTitleText=salla.lang.get("pages.offer.multiple_bank_offers_title");s.multipleBankOfferTitleDescription=salla.lang.get("pages.offer.multiple_bank_offers_message");s.buy_quantity_text(0)}));salla.onReady((function(){s.currentPage=salla.config.get("page.slug");s.userCurrency=salla.config.get("currencies")[salla.config.get("user.currency_code")].symbol}));this.categorySlot=((r=this.host.querySelector('[slot="category"]'))===null||r===void 0?void 0:r.innerHTML)||'<a href={url} class="s-offer-slide-cat-entry"><i class={icon}></i><h4>{name}</h4></a>'}e.prototype.getEndpointByPageName=function(){var e;return(e={},e[PageType.Cart]="offers/cart/".concat(salla.storage.get("cart.id")),e[PageType.ProductDetail]="offers/product/".concat(salla.config.get("page.id")),e)[this.currentPage]||"offers"};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 salla.api.request(e.getEndpointByPageName())})).then((function(s){if(!(e.offersList=s.data).length){throw new Error("salla-offers:: There is no offers!")}var r=e.offersList.find((function(e){return[OfferType.Bank,OfferType.BuyXGetY,OfferType.DiscountsTable].includes(e.type)}));if(!r){throw new Error("salla-offers:: Offer type not supported yet!")}if(r.type===OfferType.DiscountsTable){return e.offersList=[r]}if(e.isBankOffer=r.type===OfferType.Bank){e.offersList=e.offersList.filter((function(e){return e.type===OfferType.Bank}));e.isMultipleBank=e.offersList.length>1;return e.offersList}var t=r.details.get;return t.source==="products"?salla.product.api.fetch({source:"selected",source_value:t.source_value}).then((function(s){t.products=s.data;r.details.get=t;return e.offersList=[r]})):salla.product.api.categories().then((function(s){t.categories=e.findCategories(s.data,t.source_value);r.details.get=t;return e.offersList=[r]}))})).then((function(s){salla.storage.set(e.getStorageKey(),{offers:s,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")};e.prototype.findCategories=function(e,s){var r;var t=[];for(var a=0,n=e;a<n.length;a++){var i=n[a];if(s.includes(i.id_||i.id)){t.push(i)}if(((r=i.sub_categories)===null||r===void 0?void 0:r.length)>0){t=t.concat(this.findCategories(i.sub_categories,s))}}return t};e.prototype.getStorageKey=function(){try{var e=salla.config.get("page.slug").replace(".","_");var s=salla.lang.getLocale();var r=salla.config.currency().code;if(!e||!s||!r){throw new Error("Unable to get the storage key.")}return"s-offers-".concat(e,"-").concat(salla.config.get("page.id"),"-").concat(s,"-").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(){if(!this.offersList.length||!this.canRender||!this.showOffer)return null;var e=this.offersList[0];var s=this.isBankOffer?this.isMultipleBank?this.multipleBankOfferTitleText:null:e.title;var r=this.isBankOffer?this.isMultipleBank?this.multipleBankOfferTitleDescription:null:e.description;var t={"block-title":s,"block-subTitle":r,"show-controls":this.isMultipleBank};return h("div",{class:"s-offer-wrapper"},h("p",{class:"s-offer-corner-badge"},this.special_offer_text),h("salla-slider",Object.assign({type:"carousel",id:"offer-slider"},t),h("div",{slot:"items"},this.renderSectionForOfferType(e.type))))};e.prototype.renderSectionForOfferType=function(e){if(this.isBankOffer){return this.renderBankSection()}if(e==OfferType.BuyXGetY){return this.renderBuyXGetYSection()}return this.renderDiscountTableSection()};e.prototype.getCategoriesSection=function(e){return h("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 s,r;var t=this.offersList[0].details;return[(s=t.get.products)===null||s===void 0?void 0:s.map((function(s){return h("div",{class:"s-offer-slide-one-fourth"},e.hasCustomComponent?h(e.productCardComponent,{product:s}):h("salla-product-card",{"shadow-on-hover":true,product:s}))})),(r=t.get.categories)===null||r===void 0?void 0:r.map((function(s){return e.getCategoriesSection(s)}))]};e.prototype.renderBankSection=function(){var e=this;return this.offersList.map((function(s){return h("div",{class:{"s-offer-slide-one-sixth":e.isMultipleBank,"s-offer-bank-wrapper-sinlge-item":!e.isMultipleBank}},h("div",{class:{"s-offer-bank-wrapper":true,"s-offer-slide-one-sixth":!e.isMultipleBank,"s-offer-bank-wrapper-multi-spacer":e.isMultipleBank}},h("div",{class:"s-offer-bank-logo"},h("img",{src:s.details.logo||salla.url.cdn("images/s-empty.png"),"data-src":s.details.logo,alt:s.title+" offer"})),h("ul",{class:"s-offer-bank-payment-wrapper"},s.details.payments.map((function(e){return h("li",{class:"s-offer-bank-payment-single"},h("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?h("p",{class:"s-offer-bank-payment-discount-percent"},"".concat(e.product_discount_text," ").concat(s.details.discount_value).concat(s.details.discount_type==="percentage"&&"%")):""),!e.isMultipleBank?h("div",{class:"s-offer-bank-message s-offer-slide-one-fourth"},h("h2",null,e.offersList[0].title),h("p",{innerHTML:e.generateBankDescription(e.offersList[0].description,s.details.discount_value)})):"")}))};e.prototype.generateBankDescription=function(e,s){return e.replace(new RegExp("".concat(s," %")),'<span class="s-offer-bank-message-amount">'.concat(s," %</span>"))};e.prototype.renderDiscountTableSection=function(){var e=this;var s;var r=this.offersList[0];var t=r.details.show_price_after_discount;return(s=this.offersList[0].details.discounts)===null||s===void 0?void 0:s.map((function(s){return h("div",{class:"s-offer-slide-one-fourth"},h("div",{class:"s-offer-slide-offer-entry"},h("div",{class:"s-offer-slide-offer-entry-price-quantity-container"},h("p",{class:"s-offer-slide-offer-entry-quantity"},e.buy_quantity_text(s.quantity)),t?h("div",{class:"s-offer-slide-offer-entry-price"},h("span",null,e.offer_with_price_text),h("span",{class:"s-offer-slide-offer-entry-price-amount"},s.discounted_amount)," ",h("span",null,e.userCurrency)):""),h("p",{class:"s-offer-slide-offer-entry-price-amount-percent"},e.with_discount_text,"(",h("span",null,s.percentage,!!s.percentage&&"%"),")")))}))};Object.defineProperty(e.prototype,"host",{get:function(){return getElement(this)},enumerable:false,configurable:true});return e}();SallaOffer.style=sallaOfferCss;export{SallaOffer as salla_offer};
4
+ import{r as registerInstance,h,g as getElement}from"./index-HB9ZridH.js";var PageType;(function(e){e["ProductDetail"]="product.single";e["Cart"]="cart"})(PageType||(PageType={}));var OfferType;(function(e){e["Conditional"]="conditional";e["PercentageOrFixed"]="fixed";e["DiscountsTable"]="discounts_table";e["Bank"]="bank";e["BuyXGetY"]="buy_x_get_y"})(OfferType||(OfferType={}));var sallaOfferCss='.s-offer-wrapper .s-slider-block__title h2{font-size:1.125rem;line-height:1.75rem;color:#f87171}.s-offer-wrapper .s-slider-block__title h2::before{font-family:"sallaicons";content:"\\ee30" !important;position:absolute;top:1rem;font-size:3rem;font-weight:400;line-height:1;color:#fef2f2}.s-offer-bank-wrapper-sinlge-item{display:-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 SallaOffer=function(){function e(e){var s=this;registerInstance(this,e);var r;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(){s.offer_with_price_text=salla.lang.get("pages.offer.with_price");s.with_discount_text=salla.lang.get("pages.products.with_a_discount");s.product_discount_text=salla.lang.get("pages.products.discount");s.special_offer_text=salla.lang.get("pages.products.special_offer");s.multipleBankOfferTitleText=salla.lang.get("pages.offer.multiple_bank_offers_title");s.multipleBankOfferTitleDescription=salla.lang.get("pages.offer.multiple_bank_offers_message");s.buy_quantity_text(0)}));salla.onReady((function(){s.currentPage=salla.config.get("page.slug");s.userCurrency=salla.config.get("currencies")[salla.config.get("user.currency_code")].symbol}));this.categorySlot=((r=this.host.querySelector('[slot="category"]'))===null||r===void 0?void 0:r.innerHTML)||'<a href={url} class="s-offer-slide-cat-entry"><i class={icon}></i><h4>{name}</h4></a>'}e.prototype.getEndpointByPageName=function(){var e;return(e={},e[PageType.Cart]="offers/cart/".concat(salla.storage.get("cart.id")),e[PageType.ProductDetail]="offers/product/".concat(salla.config.get("page.id")),e)[this.currentPage]||"offers"};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 salla.api.request(e.getEndpointByPageName())})).then((function(s){if(!(e.offersList=s.data).length){throw new Error("salla-offers:: There is no offers!")}var r=e.offersList.find((function(e){return[OfferType.Bank,OfferType.BuyXGetY,OfferType.DiscountsTable].includes(e.type)}));if(!r){throw new Error("salla-offers:: Offer type not supported yet!")}if(r.type===OfferType.DiscountsTable){return e.offersList=[r]}if(e.isBankOffer=r.type===OfferType.Bank){e.offersList=e.offersList.filter((function(e){return e.type===OfferType.Bank}));e.isMultipleBank=e.offersList.length>1;return e.offersList}var t=r.details.get;return t.source==="products"?salla.product.api.fetch({source:"selected",source_value:t.source_value}).then((function(s){t.products=s.data;r.details.get=t;return e.offersList=[r]})):salla.product.api.categories().then((function(s){t.categories=e.findCategories(s.data,t.source_value);r.details.get=t;return e.offersList=[r]}))})).then((function(s){salla.storage.set(e.getStorageKey(),{offers:s,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")};e.prototype.findCategories=function(e,s){var r;var t=[];for(var a=0,n=e;a<n.length;a++){var i=n[a];if(s.includes(i.id_||i.id)){t.push(i)}if(((r=i.sub_categories)===null||r===void 0?void 0:r.length)>0){t=t.concat(this.findCategories(i.sub_categories,s))}}return t};e.prototype.getStorageKey=function(){try{var e=salla.config.get("page.slug").replace(".","_");var s=salla.lang.getLocale();var r=salla.config.currency().code;if(!e||!s||!r){throw new Error("Unable to get the storage key.")}return"s-offers-".concat(e,"-").concat(salla.config.get("page.id"),"-").concat(s,"-").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(){if(!this.offersList.length||!this.canRender||!this.showOffer)return null;var e=this.offersList[0];var s=this.isBankOffer?this.isMultipleBank?this.multipleBankOfferTitleText:null:e.title;var r=this.isBankOffer?this.isMultipleBank?this.multipleBankOfferTitleDescription:null:e.description;var t={"block-title":s,"block-subTitle":r,"show-controls":this.isMultipleBank};return h("div",{class:"s-offer-wrapper"},h("p",{class:"s-offer-corner-badge"},this.special_offer_text),h("salla-slider",Object.assign({type:"carousel",id:"offer-slider"},t),h("div",{slot:"items"},this.renderSectionForOfferType(e.type))))};e.prototype.renderSectionForOfferType=function(e){if(this.isBankOffer){return this.renderBankSection()}if(e==OfferType.BuyXGetY){return this.renderBuyXGetYSection()}return this.renderDiscountTableSection()};e.prototype.getCategoriesSection=function(e){return h("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 s,r;var t=this.offersList[0].details;return[(s=t.get.products)===null||s===void 0?void 0:s.map((function(s){return h("div",{class:"s-offer-slide-one-fourth"},e.hasCustomComponent?h(e.productCardComponent,{product:s}):h("salla-product-card",{"shadow-on-hover":true,product:s}))})),(r=t.get.categories)===null||r===void 0?void 0:r.map((function(s){return e.getCategoriesSection(s)}))]};e.prototype.renderBankSection=function(){var e=this;return this.offersList.map((function(s){return h("div",{class:{"s-offer-slide-one-sixth":e.isMultipleBank,"s-offer-bank-wrapper-sinlge-item":!e.isMultipleBank}},h("div",{class:{"s-offer-bank-wrapper":true,"s-offer-slide-one-sixth":!e.isMultipleBank,"s-offer-bank-wrapper-multi-spacer":e.isMultipleBank}},h("div",{class:"s-offer-bank-logo"},h("img",{src:s.details.logo||salla.url.cdn("images/s-empty.png"),"data-src":s.details.logo,alt:s.title+" offer"})),h("ul",{class:"s-offer-bank-payment-wrapper"},s.details.payments.map((function(e){return h("li",{class:"s-offer-bank-payment-single"},h("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?h("p",{class:"s-offer-bank-payment-discount-percent"},"".concat(e.product_discount_text," ").concat(s.details.discount_value).concat(s.details.discount_type==="percentage"&&"%")):""),!e.isMultipleBank?h("div",{class:"s-offer-bank-message s-offer-slide-one-fourth"},h("h2",null,e.offersList[0].title),h("p",{innerHTML:e.generateBankDescription(e.offersList[0].description,s.details.discount_value)})):"")}))};e.prototype.generateBankDescription=function(e,s){return e.replace(new RegExp("".concat(s," %")),'<span class="s-offer-bank-message-amount">'.concat(s," %</span>"))};e.prototype.renderDiscountTableSection=function(){var e=this;var s;var r=this.offersList[0];var t=r.details.show_price_after_discount;return(s=this.offersList[0].details.discounts)===null||s===void 0?void 0:s.map((function(s){return h("div",{class:"s-offer-slide-one-fourth"},h("div",{class:"s-offer-slide-offer-entry"},h("div",{class:"s-offer-slide-offer-entry-price-quantity-container"},h("p",{class:"s-offer-slide-offer-entry-quantity"},e.buy_quantity_text(s.quantity)),t?h("div",{class:"s-offer-slide-offer-entry-price"},h("span",null,e.offer_with_price_text),h("span",{class:"s-offer-slide-offer-entry-price-amount"},s.discounted_amount)," ",h("span",null,e.userCurrency)):""),h("p",{class:"s-offer-slide-offer-entry-price-amount-percent"},e.with_discount_text,"(",h("span",null,s.percentage,!!s.percentage&&"%"),")")))}))};Object.defineProperty(e.prototype,"host",{get:function(){return getElement(this)},enumerable:false,configurable:true});return e}();SallaOffer.style=sallaOfferCss;export{SallaOffer as salla_offer};
5
5
  //# sourceMappingURL=salla-offer.entry.js.map
@@ -1,5 +1,5 @@
1
- var __awaiter=this&&this.__awaiter||function(n,t,e,r){function i(n){return n instanceof e?n:new e((function(t){t(n)}))}return new(e||(e=Promise))((function(e,s){function c(n){try{o(r.next(n))}catch(n){s(n)}}function a(n){try{o(r["throw"](n))}catch(n){s(n)}}function o(n){n.done?e(n.value):i(n.value).then(c,a)}o((r=r.apply(n,t||[])).next())}))};var __generator=this&&this.__generator||function(n,t){var e={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},r,i,s,c;return c={next:a(0),throw:a(1),return:a(2)},typeof Symbol==="function"&&(c[Symbol.iterator]=function(){return this}),c;function a(n){return function(t){return o([n,t])}}function o(a){if(r)throw new TypeError("Generator is already executing.");while(c&&(c=0,a[0]&&(e=0)),e)try{if(r=1,i&&(s=a[0]&2?i["return"]:a[0]?i["throw"]||((s=i["return"])&&s.call(i),0):i.next)&&!(s=s.call(i,a[1])).done)return s;if(i=0,s)a=[a[0]&2,s.value];switch(a[0]){case 0:case 1:s=a;break;case 4:e.label++;return{value:a[1],done:false};case 5:e.label++;i=a[1];a=[0];continue;case 7:a=e.ops.pop();e.trys.pop();continue;default:if(!(s=e.trys,s=s.length>0&&s[s.length-1])&&(a[0]===6||a[0]===2)){e=0;continue}if(a[0]===3&&(!s||a[1]>s[0]&&a[1]<s[3])){e.label=a[1];break}if(a[0]===6&&e.label<s[1]){e.label=s[1];s=a;break}if(s&&e.label<s[2]){e.label=s[2];e.ops.push(a);break}if(s[2])e.ops.pop();e.trys.pop();continue}a=t.call(n,e)}catch(n){a=[6,n];i=0}finally{r=s=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}};
1
+ var __awaiter=this&&this.__awaiter||function(n,t,e,r){function i(n){return n instanceof e?n:new e((function(t){t(n)}))}return new(e||(e=Promise))((function(e,s){function a(n){try{o(r.next(n))}catch(n){s(n)}}function c(n){try{o(r["throw"](n))}catch(n){s(n)}}function o(n){n.done?e(n.value):i(n.value).then(a,c)}o((r=r.apply(n,t||[])).next())}))};var __generator=this&&this.__generator||function(n,t){var e={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},r,i,s,a;return a={next:c(0),throw:c(1),return:c(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function c(n){return function(t){return o([n,t])}}function o(c){if(r)throw new TypeError("Generator is already executing.");while(a&&(a=0,c[0]&&(e=0)),e)try{if(r=1,i&&(s=c[0]&2?i["return"]:c[0]?i["throw"]||((s=i["return"])&&s.call(i),0):i.next)&&!(s=s.call(i,c[1])).done)return s;if(i=0,s)c=[c[0]&2,s.value];switch(c[0]){case 0:case 1:s=c;break;case 4:e.label++;return{value:c[1],done:false};case 5:e.label++;i=c[1];c=[0];continue;case 7:c=e.ops.pop();e.trys.pop();continue;default:if(!(s=e.trys,s=s.length>0&&s[s.length-1])&&(c[0]===6||c[0]===2)){e=0;continue}if(c[0]===3&&(!s||c[1]>s[0]&&c[1]<s[3])){e.label=c[1];break}if(c[0]===6&&e.label<s[1]){e.label=s[1];s=c;break}if(s&&e.label<s[2]){e.label=s[2];e.ops.push(c);break}if(s[2])e.ops.pop();e.trys.pop();continue}c=t.call(n,e)}catch(n){c=[6,n];i=0}finally{r=s=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:true}}};
2
2
  /*!
3
3
  * Crafted with ❤ by Salla
4
- */import{r as registerInstance,h}from"./index-BJcojI6v.js";import{I as IconVerified}from"./check-uTyAzPSy.js";var iconFileArchive='\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>file-archive</title>\n<path d="M17.333 16h-5.333c-0.737 0-1.333 0.597-1.333 1.333v2.667c0 2.205 1.795 4 4 4s4-1.795 4-4v-2.667c0-0.736-0.596-1.333-1.333-1.333zM16 20c0 0.735-0.597 1.333-1.333 1.333s-1.333-0.599-1.333-1.333v-1.333h2.667zM17.333 12h-5.333c-0.737 0-1.333 0.597-1.333 1.333s0.596 1.333 1.333 1.333h5.333c0.737 0 1.333-0.597 1.333-1.333s-0.596-1.333-1.333-1.333zM28.943 8.391l-8-8c-0.249-0.251-0.588-0.391-0.943-0.391h-13.333c-2.205 0-4 1.795-4 4v24c0 2.205 1.795 4 4 4h18.667c2.205 0 4-1.795 4-4v-18.667c0-0.353-0.14-0.693-0.391-0.943zM26.667 28c0 0.735-0.597 1.333-1.333 1.333h-18.667c-0.736 0-1.333-0.599-1.333-1.333v-24c0-0.735 0.597-1.333 1.333-1.333h12.781l7.219 7.219zM17.333 8h-5.333c-0.737 0-1.333 0.597-1.333 1.333s0.596 1.333 1.333 1.333h5.333c0.737 0 1.333-0.597 1.333-1.333s-0.596-1.333-1.333-1.333zM17.333 4h-5.333c-0.737 0-1.333 0.597-1.333 1.333s0.596 1.333 1.333 1.333h5.333c0.737 0 1.333-0.597 1.333-1.333s-0.596-1.333-1.333-1.333z"></path>\n</svg>\n';var iconDownload='\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>download</title>\n<path d="M15.056 20.941c0.123 0.124 0.271 0.221 0.435 0.289 0.163 0.067 0.336 0.103 0.509 0.103s0.347-0.036 0.509-0.103c0.164-0.068 0.311-0.165 0.435-0.289l5.332-5.332c0.521-0.521 0.521-1.364 0-1.885s-1.364-0.521-1.885 0l-3.057 3.057v-12.781c0-0.737-0.597-1.333-1.333-1.333s-1.333 0.596-1.333 1.333v12.781l-3.057-3.057c-0.521-0.521-1.364-0.521-1.885 0s-0.521 1.364 0 1.885zM25.333 26.667h-18.667c-0.736 0-1.333 0.596-1.333 1.333s0.597 1.333 1.333 1.333h18.667c0.736 0 1.333-0.596 1.333-1.333s-0.597-1.333-1.333-1.333z"></path>\n</svg>\n';var iconCopy='\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>swap-stroke</title>\n<path d="M6.667 18.667h-2.667c-0.736 0-1.333-0.597-1.333-1.333v-13.333c0-0.736 0.597-1.333 1.333-1.333h13.333c0.736 0 1.333 0.597 1.333 1.333v2.667c0 0.737 0.596 1.333 1.333 1.333s1.333-0.596 1.333-1.333v-2.667c0-2.205-1.795-4-4-4h-13.333c-2.205 0-4 1.795-4 4v13.333c0 2.205 1.795 4 4 4h2.667c0.737 0 1.333-0.596 1.333-1.333s-0.596-1.333-1.333-1.333zM28 10.667h-13.333c-2.205 0-4 1.795-4 4v13.333c0 2.205 1.795 4 4 4h13.333c2.205 0 4-1.795 4-4v-13.333c0-2.205-1.795-4-4-4zM29.333 28c0 0.736-0.597 1.333-1.333 1.333h-13.333c-0.736 0-1.333-0.597-1.333-1.333v-13.333c0-0.736 0.597-1.333 1.333-1.333h13.333c0.736 0 1.333 0.597 1.333 1.333z"></path>\n</svg>\n';var iconCreditCard='\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>debit-card-back</title>\n<path d="M30 28h-28c-1.105 0-2-0.895-2-2v0-18c0-1.105 0.895-2 2-2v0h28c1.105 0 2 0.895 2 2v0 18c0 1.105-0.895 2-2 2v0zM30 26v0zM2 8v18h28v-18zM31 14h-30c-0.552 0-1-0.448-1-1s0.448-1 1-1v0h30c0.552 0 1 0.448 1 1s-0.448 1-1 1v0zM11 22h-6c-0.552 0-1-0.448-1-1s0.448-1 1-1v0h6c0.552 0 1 0.448 1 1s-0.448 1-1 1v0zM24 24c-2.209 0-4-1.791-4-4s1.791-4 4-4c2.209 0 4 1.791 4 4v0c0 2.209-1.791 4-4 4v0zM24 18c-1.105 0-2 0.895-2 2s0.895 2 2 2c1.105 0 2-0.895 2-2v0c0-1.105-0.895-2-2-2v0zM20 24c-2.209 0-4-1.791-4-4s1.791-4 4-4v0c0.002 0 0.005 0 0.007 0 1.032 0 1.972 0.398 2.673 1.048l-0.003-0.002c0.191 0.183 0.311 0.439 0.311 0.724 0 0.552-0.448 1-1 1-0.257 0-0.492-0.097-0.669-0.257l0.001 0.001c-0.345-0.319-0.807-0.514-1.315-0.514-0.002 0-0.003 0-0.005 0h0c-1.105 0-2 0.895-2 2s0.895 2 2 2v0c0.002 0 0.004 0 0.007 0 0.508 0 0.971-0.195 1.317-0.515l-0.001 0.001c0.179-0.171 0.422-0.276 0.689-0.276 0.552 0 1 0.448 1 1 0 0.295-0.128 0.56-0.331 0.743l-0.001 0.001c-0.699 0.648-1.638 1.046-2.671 1.046-0.003 0-0.007 0-0.010 0h0.001z"></path>\n</svg>\n';var sallaOrderSummaryCss=":host{display:block}";var SallaOrderSummary=function(){function n(n){registerInstance(this,n);this.codeCopied=null;this.noItemFound=true;this.order_items=[];this.isDigitalCard=function(n){return n.product.type==="codes"};this.isDigitalProduct=function(n){return n.product.type==="digital"}}n.prototype.componentWillLoad=function(){return __awaiter(this,void 0,void 0,(function(){var n=this;return __generator(this,(function(t){switch(t.label){case 0:salla.lang.onLoaded((function(){n.codes_text=salla.lang.get("pages.thank_you.codes");n.copy_text=salla.lang.get("common.elements.copy");n.files_text=salla.lang.get("pages.thank_you.files");n.download_text=salla.lang.get("pages.thank_you.download")}));return[4,this.getOrderItems()];case 1:return[2,t.sent()]}}))}))};n.prototype.copyToClipboardHandler=function(n){var t=this;if(navigator&&"clipboard"in navigator){try{navigator.clipboard.writeText(n).then((function(){t.codeCopied=n;t.copyCodeButtonTimeout=setTimeout((function(){t.codeCopied=null}),3e3)}))}catch(n){salla.loggers.error("copy functionality is not supported by the browser")}}};n.prototype.getOrderItems=function(){return __awaiter(this,void 0,void 0,(function(){var n,t,e,r,i,s;var c=this;return __generator(this,(function(a){switch(a.label){case 0:n=this.orderId||salla.config.get("page.id");t="Failed to fetch order items";if(!n){salla.logger.error(t);throw new Error(t)}a.label=1;case 1:a.trys.push([1,3,,4]);return[4,salla.api.request("orders/".concat(n))];case 2:e=a.sent().data.items,r=e===void 0?[]:e;i=r.some((function(n){return c.isDigitalCard(n)||c.isDigitalProduct(n)}));if(i){this.order_items=r;this.noItemFound=false}return[3,4];case 3:s=a.sent();salla.logger.error(t);return[3,4];case 4:return[2]}}))}))};n.prototype.disconnectedCallback=function(){this.copyCodeButtonTimeout&&clearTimeout(this.copyCodeButtonTimeout)};n.prototype.render=function(){var n=this;return h("ul",{key:"e5fb79540f0dc836b97c04c38a183341b7bfa64d",class:"s-order-summary-wrapper"},this.noItemFound?h("salla-placeholder",{alignment:"center"},h("span",{slot:"title"})):this.order_items.map((function(t){return n.isDigitalCard(t)?h("li",{key:t.product.id,class:"s-order-summary-item"},h("h2",{class:"s-order-summary-item-title"},n.codes_text," (",t.name,")"),t.codes.map((function(t){return h("div",{key:t.code,class:"s-order-summary-code-item-wrapper"},h("p",null,h("span",{innerHTML:iconCreditCard}),h("span",null,t.code)),h("salla-button",{class:"s-order-summary-item-copy-button ".concat(n.codeCopied===t.code?"copied":""),onClick:function(){return n.copyToClipboardHandler(t.code)},shape:"link"},h("span",{innerHTML:n.codeCopied===t.code?IconVerified:iconCopy}),h("span",null,n.copy_text)))}))):n.isDigitalProduct(t)?h("li",{key:t.product.id,class:"s-order-summary-item"},h("h2",{class:"s-order-summary-item-title"},n.files_text," (",t.name,")"),h("ul",null,t.files.map((function(t){return h("li",{class:"s-order-summary-digital-item-wrapper"},h("div",null,h("span",{innerHTML:iconFileArchive}),h("span",null,t.name)),h("a",{href:t.url,target:"_blank",class:"s-order-summary-item-download"},h("span",{innerHTML:iconDownload}),h("span",null,n.download_text)))})))):null})))};return n}();SallaOrderSummary.style=sallaOrderSummaryCss;export{SallaOrderSummary as salla_order_summary};
4
+ */import{r as registerInstance,h}from"./index-HB9ZridH.js";import{I as IconVerified}from"./check-uTyAzPSy.js";var iconFileArchive='\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>file-archive</title>\n<path d="M17.333 16h-5.333c-0.737 0-1.333 0.597-1.333 1.333v2.667c0 2.205 1.795 4 4 4s4-1.795 4-4v-2.667c0-0.736-0.596-1.333-1.333-1.333zM16 20c0 0.735-0.597 1.333-1.333 1.333s-1.333-0.599-1.333-1.333v-1.333h2.667zM17.333 12h-5.333c-0.737 0-1.333 0.597-1.333 1.333s0.596 1.333 1.333 1.333h5.333c0.737 0 1.333-0.597 1.333-1.333s-0.596-1.333-1.333-1.333zM28.943 8.391l-8-8c-0.249-0.251-0.588-0.391-0.943-0.391h-13.333c-2.205 0-4 1.795-4 4v24c0 2.205 1.795 4 4 4h18.667c2.205 0 4-1.795 4-4v-18.667c0-0.353-0.14-0.693-0.391-0.943zM26.667 28c0 0.735-0.597 1.333-1.333 1.333h-18.667c-0.736 0-1.333-0.599-1.333-1.333v-24c0-0.735 0.597-1.333 1.333-1.333h12.781l7.219 7.219zM17.333 8h-5.333c-0.737 0-1.333 0.597-1.333 1.333s0.596 1.333 1.333 1.333h5.333c0.737 0 1.333-0.597 1.333-1.333s-0.596-1.333-1.333-1.333zM17.333 4h-5.333c-0.737 0-1.333 0.597-1.333 1.333s0.596 1.333 1.333 1.333h5.333c0.737 0 1.333-0.597 1.333-1.333s-0.596-1.333-1.333-1.333z"></path>\n</svg>\n';var iconDownload='\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>download</title>\n<path d="M15.056 20.941c0.123 0.124 0.271 0.221 0.435 0.289 0.163 0.067 0.336 0.103 0.509 0.103s0.347-0.036 0.509-0.103c0.164-0.068 0.311-0.165 0.435-0.289l5.332-5.332c0.521-0.521 0.521-1.364 0-1.885s-1.364-0.521-1.885 0l-3.057 3.057v-12.781c0-0.737-0.597-1.333-1.333-1.333s-1.333 0.596-1.333 1.333v12.781l-3.057-3.057c-0.521-0.521-1.364-0.521-1.885 0s-0.521 1.364 0 1.885zM25.333 26.667h-18.667c-0.736 0-1.333 0.596-1.333 1.333s0.597 1.333 1.333 1.333h18.667c0.736 0 1.333-0.596 1.333-1.333s-0.597-1.333-1.333-1.333z"></path>\n</svg>\n';var iconCopy='\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>swap-stroke</title>\n<path d="M6.667 18.667h-2.667c-0.736 0-1.333-0.597-1.333-1.333v-13.333c0-0.736 0.597-1.333 1.333-1.333h13.333c0.736 0 1.333 0.597 1.333 1.333v2.667c0 0.737 0.596 1.333 1.333 1.333s1.333-0.596 1.333-1.333v-2.667c0-2.205-1.795-4-4-4h-13.333c-2.205 0-4 1.795-4 4v13.333c0 2.205 1.795 4 4 4h2.667c0.737 0 1.333-0.596 1.333-1.333s-0.596-1.333-1.333-1.333zM28 10.667h-13.333c-2.205 0-4 1.795-4 4v13.333c0 2.205 1.795 4 4 4h13.333c2.205 0 4-1.795 4-4v-13.333c0-2.205-1.795-4-4-4zM29.333 28c0 0.736-0.597 1.333-1.333 1.333h-13.333c-0.736 0-1.333-0.597-1.333-1.333v-13.333c0-0.736 0.597-1.333 1.333-1.333h13.333c0.736 0 1.333 0.597 1.333 1.333z"></path>\n</svg>\n';var iconCreditCard='\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>debit-card-back</title>\n<path d="M30 28h-28c-1.105 0-2-0.895-2-2v0-18c0-1.105 0.895-2 2-2v0h28c1.105 0 2 0.895 2 2v0 18c0 1.105-0.895 2-2 2v0zM30 26v0zM2 8v18h28v-18zM31 14h-30c-0.552 0-1-0.448-1-1s0.448-1 1-1v0h30c0.552 0 1 0.448 1 1s-0.448 1-1 1v0zM11 22h-6c-0.552 0-1-0.448-1-1s0.448-1 1-1v0h6c0.552 0 1 0.448 1 1s-0.448 1-1 1v0zM24 24c-2.209 0-4-1.791-4-4s1.791-4 4-4c2.209 0 4 1.791 4 4v0c0 2.209-1.791 4-4 4v0zM24 18c-1.105 0-2 0.895-2 2s0.895 2 2 2c1.105 0 2-0.895 2-2v0c0-1.105-0.895-2-2-2v0zM20 24c-2.209 0-4-1.791-4-4s1.791-4 4-4v0c0.002 0 0.005 0 0.007 0 1.032 0 1.972 0.398 2.673 1.048l-0.003-0.002c0.191 0.183 0.311 0.439 0.311 0.724 0 0.552-0.448 1-1 1-0.257 0-0.492-0.097-0.669-0.257l0.001 0.001c-0.345-0.319-0.807-0.514-1.315-0.514-0.002 0-0.003 0-0.005 0h0c-1.105 0-2 0.895-2 2s0.895 2 2 2v0c0.002 0 0.004 0 0.007 0 0.508 0 0.971-0.195 1.317-0.515l-0.001 0.001c0.179-0.171 0.422-0.276 0.689-0.276 0.552 0 1 0.448 1 1 0 0.295-0.128 0.56-0.331 0.743l-0.001 0.001c-0.699 0.648-1.638 1.046-2.671 1.046-0.003 0-0.007 0-0.010 0h0.001z"></path>\n</svg>\n';var sallaOrderSummaryCss=":host{display:block}";var SallaOrderSummary=function(){function n(n){registerInstance(this,n);this.codeCopied=null;this.noItemFound=true;this.order_items=[];this.isDigitalCard=function(n){return n.product.type==="codes"};this.isDigitalProduct=function(n){return n.product.type==="digital"}}n.prototype.componentWillLoad=function(){return __awaiter(this,void 0,void 0,(function(){var n=this;return __generator(this,(function(t){switch(t.label){case 0:salla.lang.onLoaded((function(){n.codes_text=salla.lang.get("pages.thank_you.codes");n.copy_text=salla.lang.get("common.elements.copy");n.files_text=salla.lang.get("pages.thank_you.files");n.download_text=salla.lang.get("pages.thank_you.download")}));return[4,this.getOrderItems()];case 1:return[2,t.sent()]}}))}))};n.prototype.copyToClipboardHandler=function(n){var t=this;if(navigator&&"clipboard"in navigator){try{navigator.clipboard.writeText(n).then((function(){t.codeCopied=n;t.copyCodeButtonTimeout=setTimeout((function(){t.codeCopied=null}),3e3)}))}catch(n){salla.loggers.error("copy functionality is not supported by the browser")}}};n.prototype.getOrderItems=function(){return __awaiter(this,void 0,void 0,(function(){var n,t,e,r,i,s;var a=this;return __generator(this,(function(c){switch(c.label){case 0:n=this.orderId||salla.config.get("page.id");t="Failed to fetch order items";if(!n){salla.logger.error(t);throw new Error(t)}c.label=1;case 1:c.trys.push([1,3,,4]);return[4,salla.api.request("orders/".concat(n))];case 2:e=c.sent().data.items,r=e===void 0?[]:e;i=r.some((function(n){return a.isDigitalCard(n)||a.isDigitalProduct(n)}));if(i){this.order_items=r;this.noItemFound=false}return[3,4];case 3:s=c.sent();salla.logger.error(t);return[3,4];case 4:return[2]}}))}))};n.prototype.disconnectedCallback=function(){this.copyCodeButtonTimeout&&clearTimeout(this.copyCodeButtonTimeout)};n.prototype.render=function(){var n=this;return h("ul",{key:"e5fb79540f0dc836b97c04c38a183341b7bfa64d",class:"s-order-summary-wrapper"},this.noItemFound?h("salla-placeholder",{alignment:"center"},h("span",{slot:"title"})):this.order_items.map((function(t){return n.isDigitalCard(t)?h("li",{key:t.product.id,class:"s-order-summary-item"},h("h2",{class:"s-order-summary-item-title"},n.codes_text," (",t.name,")"),t.codes.map((function(t){return h("div",{key:t.code,class:"s-order-summary-code-item-wrapper"},h("p",null,h("span",{innerHTML:iconCreditCard}),h("span",null,t.code)),h("salla-button",{class:"s-order-summary-item-copy-button ".concat(n.codeCopied===t.code?"copied":""),onClick:function(){return n.copyToClipboardHandler(t.code)},shape:"link"},h("span",{innerHTML:n.codeCopied===t.code?IconVerified:iconCopy}),h("span",null,n.copy_text)))}))):n.isDigitalProduct(t)?h("li",{key:t.product.id,class:"s-order-summary-item"},h("h2",{class:"s-order-summary-item-title"},n.files_text," (",t.name,")"),h("ul",null,t.files.map((function(t){return h("li",{class:"s-order-summary-digital-item-wrapper"},h("div",null,h("span",{innerHTML:iconFileArchive}),h("span",null,t.name)),h("a",{href:t.url,target:"_blank",class:"s-order-summary-item-download"},h("span",{innerHTML:iconDownload}),h("span",null,n.download_text)))})))):null})))};return n}();SallaOrderSummary.style=sallaOrderSummaryCss;export{SallaOrderSummary as salla_order_summary};
5
5
  //# sourceMappingURL=salla-order-summary.entry.js.map