@salla.sa/twilight-components 2.14.170 → 2.14.172

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 (287) hide show
  1. package/dist/cjs/{app-globals-KyQhbOUb.js → app-globals-Bk9IDSPX.js} +3 -3
  2. package/dist/cjs/{app-globals-KyQhbOUb.js.map → app-globals-Bk9IDSPX.js.map} +1 -1
  3. package/dist/cjs/{index-CyyWuThh.js → index-B1jJnKON.js} +4 -4
  4. package/dist/cjs/{index-CyyWuThh.js.map → index-B1jJnKON.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.salla-conditional-fields.entry.cjs.js.map +1 -1
  11. package/dist/cjs/salla-booking-field_2.cjs.entry.js +2 -2
  12. package/dist/cjs/salla-booking-field_2.cjs.entry.js.map +1 -1
  13. package/dist/cjs/salla-cart-item-offers.cjs.entry.js +1 -1
  14. package/dist/cjs/salla-conditional-offer.cjs.entry.js +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 +11 -7
  24. package/dist/cjs/salla-offer.cjs.entry.js.map +1 -1
  25. package/dist/cjs/salla-offer.entry.cjs.js.map +1 -1
  26. package/dist/cjs/salla-order-summary.cjs.entry.js +1 -1
  27. package/dist/cjs/salla-orders.cjs.entry.js +1 -1
  28. package/dist/cjs/salla-payments.cjs.entry.js +1 -1
  29. package/dist/cjs/salla-price-range.cjs.entry.js +1 -1
  30. package/dist/cjs/salla-product-options.cjs.entry.js +1 -1
  31. package/dist/cjs/salla-review-card.cjs.entry.js +1 -1
  32. package/dist/cjs/salla-reviews-page.cjs.entry.js +1 -1
  33. package/dist/cjs/salla-reviews.cjs.entry.js +1 -1
  34. package/dist/cjs/salla-social.cjs.entry.js +1 -1
  35. package/dist/cjs/salla-tooltip.cjs.entry.js +1 -1
  36. package/dist/cjs/salla-verify.cjs.entry.js +1 -1
  37. package/dist/cjs/salla-wallet.cjs.entry.js +1 -1
  38. package/dist/cjs/twilight.cjs.js +2 -2
  39. package/dist/collection/components/salla-booking-field/salla-booking-field.js +1 -1
  40. package/dist/collection/components/salla-booking-field/salla-booking-field.js.map +1 -1
  41. package/dist/collection/components/salla-offer/salla-offer.js +10 -6
  42. package/dist/collection/components/salla-offer/salla-offer.js.map +1 -1
  43. package/dist/components/index.js +2 -2
  44. package/dist/components/index.js.map +1 -1
  45. package/dist/components/salla-booking-field2.js +1 -1
  46. package/dist/components/salla-booking-field2.js.map +1 -1
  47. package/dist/components/salla-offer.js +10 -6
  48. package/dist/components/salla-offer.js.map +1 -1
  49. package/dist/esm/{app-globals-Eok5C8eP.js → app-globals-BlWInTtE.js} +3 -3
  50. package/dist/esm/{app-globals-Eok5C8eP.js.map → app-globals-BlWInTtE.js.map} +1 -1
  51. package/dist/esm/{index-EWYMQsdr.js → index-CayW-agT.js} +4 -4
  52. package/dist/esm/{index-EWYMQsdr.js.map → index-CayW-agT.js.map} +1 -1
  53. package/dist/esm/loader.js +3 -3
  54. package/dist/esm/salla-add-product-button_49.entry.js +1 -1
  55. package/dist/esm/salla-advertisement.entry.js +1 -1
  56. package/dist/esm/salla-app-install-alert.entry.js +1 -1
  57. package/dist/esm/salla-apps-icons.entry.js +1 -1
  58. package/dist/esm/salla-booking-field.salla-conditional-fields.entry.js.map +1 -1
  59. package/dist/esm/salla-booking-field_2.entry.js +2 -2
  60. package/dist/esm/salla-booking-field_2.entry.js.map +1 -1
  61. package/dist/esm/salla-cart-item-offers.entry.js +1 -1
  62. package/dist/esm/salla-conditional-offer.entry.js +1 -1
  63. package/dist/esm/salla-contacts.entry.js +1 -1
  64. package/dist/esm/salla-filters-widget.entry.js +1 -1
  65. package/dist/esm/salla-filters.entry.js +1 -1
  66. package/dist/esm/salla-installment.entry.js +1 -1
  67. package/dist/esm/salla-loyalty-prize-item.entry.js +1 -1
  68. package/dist/esm/salla-metadata.entry.js +1 -1
  69. package/dist/esm/salla-notification-item.entry.js +1 -1
  70. package/dist/esm/salla-notifications.entry.js +1 -1
  71. package/dist/esm/salla-offer.entry.js +11 -7
  72. package/dist/esm/salla-offer.entry.js.map +1 -1
  73. package/dist/esm/salla-order-summary.entry.js +1 -1
  74. package/dist/esm/salla-orders.entry.js +1 -1
  75. package/dist/esm/salla-payments.entry.js +1 -1
  76. package/dist/esm/salla-price-range.entry.js +1 -1
  77. package/dist/esm/salla-product-options.entry.js +1 -1
  78. package/dist/esm/salla-review-card.entry.js +1 -1
  79. package/dist/esm/salla-reviews-page.entry.js +1 -1
  80. package/dist/esm/salla-reviews.entry.js +1 -1
  81. package/dist/esm/salla-social.entry.js +1 -1
  82. package/dist/esm/salla-tooltip.entry.js +1 -1
  83. package/dist/esm/salla-verify.entry.js +1 -1
  84. package/dist/esm/salla-wallet.entry.js +1 -1
  85. package/dist/esm/twilight.js +3 -3
  86. package/dist/esm-es5/{app-globals-Eok5C8eP.js → app-globals-BlWInTtE.js} +2 -2
  87. package/dist/esm-es5/{app-globals-Eok5C8eP.js.map → app-globals-BlWInTtE.js.map} +1 -1
  88. package/dist/esm-es5/{index-EWYMQsdr.js → index-CayW-agT.js} +3 -3
  89. package/dist/esm-es5/{index-EWYMQsdr.js.map → index-CayW-agT.js.map} +1 -1
  90. package/dist/esm-es5/loader.js +1 -1
  91. package/dist/esm-es5/salla-add-product-button_49.entry.js +1 -1
  92. package/dist/esm-es5/salla-advertisement.entry.js +1 -1
  93. package/dist/esm-es5/salla-app-install-alert.entry.js +1 -1
  94. package/dist/esm-es5/salla-apps-icons.entry.js +1 -1
  95. package/dist/esm-es5/salla-booking-field.salla-conditional-fields.entry.js.map +1 -1
  96. package/dist/esm-es5/salla-booking-field_2.entry.js +2 -2
  97. package/dist/esm-es5/salla-booking-field_2.entry.js.map +1 -1
  98. package/dist/esm-es5/salla-cart-item-offers.entry.js +1 -1
  99. package/dist/esm-es5/salla-conditional-offer.entry.js +1 -1
  100. package/dist/esm-es5/salla-contacts.entry.js +1 -1
  101. package/dist/esm-es5/salla-filters-widget.entry.js +1 -1
  102. package/dist/esm-es5/salla-filters.entry.js +1 -1
  103. package/dist/esm-es5/salla-installment.entry.js +1 -1
  104. package/dist/esm-es5/salla-loyalty-prize-item.entry.js +1 -1
  105. package/dist/esm-es5/salla-metadata.entry.js +1 -1
  106. package/dist/esm-es5/salla-notification-item.entry.js +1 -1
  107. package/dist/esm-es5/salla-notifications.entry.js +1 -1
  108. package/dist/esm-es5/salla-offer.entry.js +2 -2
  109. package/dist/esm-es5/salla-offer.entry.js.map +1 -1
  110. package/dist/esm-es5/salla-order-summary.entry.js +1 -1
  111. package/dist/esm-es5/salla-orders.entry.js +2 -2
  112. package/dist/esm-es5/salla-payments.entry.js +1 -1
  113. package/dist/esm-es5/salla-price-range.entry.js +1 -1
  114. package/dist/esm-es5/salla-product-options.entry.js +1 -1
  115. package/dist/esm-es5/salla-review-card.entry.js +1 -1
  116. package/dist/esm-es5/salla-reviews-page.entry.js +1 -1
  117. package/dist/esm-es5/salla-reviews.entry.js +1 -1
  118. package/dist/esm-es5/salla-social.entry.js +1 -1
  119. package/dist/esm-es5/salla-tooltip.entry.js +1 -1
  120. package/dist/esm-es5/salla-verify.entry.js +1 -1
  121. package/dist/esm-es5/salla-wallet.entry.js +1 -1
  122. package/dist/esm-es5/twilight.js +1 -1
  123. package/dist/twilight/{p-4fbad277.entry.js → p-0649d076.entry.js} +2 -2
  124. package/dist/twilight/{p-b6d17480.system.entry.js → p-1696a245.system.entry.js} +2 -2
  125. package/dist/twilight/{p-1d879370.entry.js → p-19f533ec.entry.js} +2 -2
  126. package/dist/twilight/{p-0bdf2224.entry.js → p-1dd178a2.entry.js} +2 -2
  127. package/dist/twilight/{p-1f4fc47f.entry.js → p-20bdcd53.entry.js} +2 -2
  128. package/dist/twilight/{p-5c52e00c.entry.js → p-247636ef.entry.js} +2 -2
  129. package/dist/twilight/{p-38a60819.entry.js → p-269ebd5d.entry.js} +2 -2
  130. package/dist/twilight/{p-1fbf0ba0.entry.js → p-29e96484.entry.js} +2 -2
  131. package/dist/twilight/p-29e96484.entry.js.map +1 -0
  132. package/dist/twilight/{p-fe7d4113.system.entry.js → p-2a10bff2.system.entry.js} +2 -2
  133. package/dist/twilight/{p-cd6c8a64.entry.js → p-2d0c2877.entry.js} +2 -2
  134. package/dist/twilight/{p-8a42ee60.system.entry.js → p-2da442c2.system.entry.js} +2 -2
  135. package/dist/twilight/{p-c7589247.system.entry.js → p-3093ea8e.system.entry.js} +2 -2
  136. package/dist/twilight/{p-7f0b3753.entry.js → p-316e3ea9.entry.js} +2 -2
  137. package/dist/twilight/{p-f5929cee.entry.js → p-33963e7d.entry.js} +2 -2
  138. package/dist/twilight/{p-feb9b85a.entry.js → p-37a3c661.entry.js} +2 -2
  139. package/dist/twilight/{p-d9073cf3.entry.js → p-41480e7b.entry.js} +2 -2
  140. package/dist/twilight/{p-2a8279d6.entry.js → p-41ecc4f7.entry.js} +2 -2
  141. package/dist/twilight/{p-9395f082.system.entry.js → p-44a213de.system.entry.js} +2 -2
  142. package/dist/twilight/p-4ced9aab.entry.js +5 -0
  143. package/dist/twilight/p-4fb112e6.system.entry.js +5 -0
  144. package/dist/twilight/p-4fb112e6.system.entry.js.map +1 -0
  145. package/dist/twilight/{p-ec81a36e.entry.js → p-51195e76.entry.js} +2 -2
  146. package/dist/twilight/{p-ff9d70f4.system.entry.js → p-54bd7e18.system.entry.js} +2 -2
  147. package/dist/twilight/{p-3134126e.system.entry.js → p-611b6013.system.entry.js} +2 -2
  148. package/dist/twilight/{p-bd4d0f9a.system.entry.js → p-679bb855.system.entry.js} +2 -2
  149. package/dist/twilight/{p-4c74100d.system.entry.js → p-67fe618e.system.entry.js} +2 -2
  150. package/dist/twilight/{p-1ebd5929.system.entry.js → p-69ec9ac8.system.entry.js} +2 -2
  151. package/dist/twilight/{p-b09ad735.system.entry.js → p-740b39fc.system.entry.js} +2 -2
  152. package/dist/twilight/{p-2ea1d52b.entry.js → p-756fe45d.entry.js} +2 -2
  153. package/dist/twilight/{p-d2edeb7c.system.entry.js → p-7ddf00a9.system.entry.js} +2 -2
  154. package/dist/twilight/{p-5fd16112.system.entry.js → p-86dd7e02.system.entry.js} +2 -2
  155. package/dist/twilight/{p-42291bce.entry.js → p-8c9ae8bd.entry.js} +2 -2
  156. package/dist/twilight/{p-3b5eb2c9.system.entry.js → p-8e242779.system.entry.js} +2 -2
  157. package/dist/twilight/{p-4daef7a0.entry.js → p-9361e7a2.entry.js} +2 -2
  158. package/dist/twilight/{p-3aa0ac01.entry.js → p-952a8078.entry.js} +2 -2
  159. package/dist/twilight/{p-bf454ddd.entry.js → p-9ca8c6b6.entry.js} +2 -2
  160. package/dist/twilight/{p-15e36352.system.entry.js → p-9d750b3d.system.entry.js} +2 -2
  161. package/dist/twilight/{p-B4BfwIfE.system.js.map → p-B3wutB2s.system.js.map} +1 -1
  162. package/dist/twilight/{p-BRLbCud3.system.js.map → p-BYBYDro2.system.js.map} +1 -1
  163. package/dist/twilight/{p-CaL9vXSW.system.js.map → p-BeVJFUxX.system.js.map} +1 -1
  164. package/dist/twilight/{p-ug8rkhBt.system.js.map → p-BmwlZkRw.system.js.map} +1 -1
  165. package/dist/twilight/{p-D9oLy_KT.system.js → p-BuezmX1t.system.js} +2 -2
  166. package/dist/twilight/{p-D9oLy_KT.system.js.map → p-BuezmX1t.system.js.map} +1 -1
  167. package/dist/twilight/{p-qSZ6al46.system.js.map → p-BuxFmGAL.system.js.map} +1 -1
  168. package/dist/twilight/{p-DSV8tV1E.system.js.map → p-Bxsqm2ye.system.js.map} +1 -1
  169. package/dist/twilight/{p-5vs3r5UR.system.js.map → p-C2OoabIm.system.js.map} +1 -1
  170. package/dist/twilight/{p-vvacIepq.system.js.map → p-C4gOv56I.system.js.map} +1 -1
  171. package/dist/twilight/{p-CbLv2Rkn.system.js.map → p-C7B9pjwv.system.js.map} +1 -1
  172. package/dist/twilight/{p-6eZfgC1O.system.js.map → p-CCr4sv_K.system.js.map} +1 -1
  173. package/dist/twilight/{p-DO9CJiWa.system.js.map → p-CECjqlBg.system.js.map} +1 -1
  174. package/dist/twilight/p-CPIDPWPd.system.js.map +1 -0
  175. package/dist/twilight/{p-DraEtCIO.system.js.map → p-CT4XUl4u.system.js.map} +1 -1
  176. package/dist/twilight/{p-Mx729n7_.system.js.map → p-CT7GoHDG.system.js.map} +1 -1
  177. package/dist/twilight/{p-EWYMQsdr.js → p-CayW-agT.js} +3 -3
  178. package/dist/twilight/{p-EWYMQsdr.js.map → p-CayW-agT.js.map} +1 -1
  179. package/dist/twilight/{p-zj6gyLfC.system.js.map → p-Ccj3kuAD.system.js.map} +1 -1
  180. package/dist/twilight/{p-Ew9kSVbn.system.js.map → p-CeyDIaJF.system.js.map} +1 -1
  181. package/dist/twilight/{p-CeyGkw1h.system.js.map → p-CjXAM86c.system.js.map} +1 -1
  182. package/dist/twilight/{p-BU23HIMq.system.js → p-CmumtzEL.system.js} +3 -3
  183. package/dist/twilight/{p-BU23HIMq.system.js.map → p-CmumtzEL.system.js.map} +1 -1
  184. package/dist/twilight/{p-48XKn75T.system.js.map → p-D4ot6EsS.system.js.map} +1 -1
  185. package/dist/twilight/{p-Dd5CEUFO.system.js.map → p-DEOECcHf.system.js.map} +1 -1
  186. package/dist/twilight/{p-gm6N2F_h.system.js.map → p-DUKloBXK.system.js.map} +1 -1
  187. package/dist/twilight/{p-Cni316MV.system.js.map → p-Dg8Ywiaf.system.js.map} +1 -1
  188. package/dist/twilight/{p-5QHjuX9p.system.js.map → p-Dmm2RXZq.system.js.map} +1 -1
  189. package/dist/twilight/{p-QtuY1UHD.system.js.map → p-DraNKP6B.system.js.map} +1 -1
  190. package/dist/twilight/{p-a0nHD-aB.system.js.map → p-DzJCsxNk.system.js.map} +1 -1
  191. package/dist/twilight/{p-m9Evhpmi.system.js → p-FxRE-bWf.system.js} +2 -2
  192. package/dist/twilight/{p-m9Evhpmi.system.js.map → p-FxRE-bWf.system.js.map} +1 -1
  193. package/dist/twilight/{p-B3t8frU_.js → p-PnQHllOh.js} +2 -2
  194. package/dist/twilight/{p-B3t8frU_.js.map → p-PnQHllOh.js.map} +1 -1
  195. package/dist/twilight/{p-BBMoQKyK.system.js.map → p-UOO6uSKD.system.js.map} +1 -1
  196. package/dist/twilight/{p-L8BD77j0.system.js.map → p-W3JU15BC.system.js.map} +1 -1
  197. package/dist/twilight/{p-9f657953.system.entry.js → p-a78387e7.system.entry.js} +2 -2
  198. package/dist/twilight/{p-abcc0cbf.entry.js → p-aa6a0113.entry.js} +2 -2
  199. package/dist/twilight/{p-2147391e.system.entry.js → p-ad02a471.system.entry.js} +2 -2
  200. package/dist/twilight/{p-c8053b6f.entry.js → p-b63bc4db.entry.js} +2 -2
  201. package/dist/twilight/{p-213c3ce4.entry.js → p-b72f268b.entry.js} +2 -2
  202. package/dist/twilight/{p-f2dda5b0.system.entry.js → p-c70ed29b.system.entry.js} +2 -2
  203. package/dist/twilight/{p-5a86938a.system.entry.js → p-cdc147d2.system.entry.js} +2 -2
  204. package/dist/twilight/p-d0912efd.entry.js +5 -0
  205. package/dist/twilight/p-d0912efd.entry.js.map +1 -0
  206. package/dist/twilight/{p-55ce45d1.system.entry.js → p-d14e40fe.system.entry.js} +2 -2
  207. package/dist/twilight/{p-01578d6d.system.entry.js → p-d2c834be.system.entry.js} +2 -2
  208. package/dist/twilight/{p-32429afe.system.entry.js → p-d56a7bd9.system.entry.js} +2 -2
  209. package/dist/twilight/{p-50c60622.entry.js → p-d600f506.entry.js} +2 -2
  210. package/dist/twilight/{p-b6ac3dd8.system.entry.js → p-db68e58b.system.entry.js} +2 -2
  211. package/dist/twilight/p-db68e58b.system.entry.js.map +1 -0
  212. package/dist/twilight/{p-95e2b228.system.entry.js → p-e061a1f5.system.entry.js} +2 -2
  213. package/dist/twilight/{p-065d60f6.entry.js → p-e084e3c4.entry.js} +2 -2
  214. package/dist/twilight/{p-0ebd2162.entry.js → p-e9ca7e7c.entry.js} +2 -2
  215. package/dist/twilight/{p-df8a68d9.system.entry.js → p-ee97bc7b.system.entry.js} +2 -2
  216. package/dist/twilight/{p-8079920d.system.entry.js → p-f5ce1227.system.entry.js} +2 -2
  217. package/dist/twilight/{p-e9046909.system.entry.js → p-fb9cd621.system.entry.js} +2 -2
  218. package/dist/twilight/{p-01f043b8.entry.js → p-fdd3788a.entry.js} +2 -2
  219. package/dist/twilight/{p-zB1aXyll.system.js.map → p-hIDulQlu.system.js.map} +1 -1
  220. package/dist/twilight/p-qziIzWVk.system.js.map +1 -0
  221. package/dist/twilight/{p-Bs4v2LtA.system.js.map → p-y427D1HL.system.js.map} +1 -1
  222. package/dist/twilight/salla-booking-field.salla-conditional-fields.entry.esm.js.map +1 -1
  223. package/dist/twilight/salla-offer.entry.esm.js.map +1 -1
  224. package/dist/twilight/twilight.esm.js +1 -1
  225. package/dist/twilight/twilight.js +1 -1
  226. package/package.json +5 -5
  227. package/dist/twilight/p-1fbf0ba0.entry.js.map +0 -1
  228. package/dist/twilight/p-545302d2.entry.js +0 -5
  229. package/dist/twilight/p-545302d2.entry.js.map +0 -1
  230. package/dist/twilight/p-B3dc8MoR.system.js.map +0 -1
  231. package/dist/twilight/p-BkvW8UWg.system.js.map +0 -1
  232. package/dist/twilight/p-a22b72f6.entry.js +0 -5
  233. package/dist/twilight/p-b6ac3dd8.system.entry.js.map +0 -1
  234. package/dist/twilight/p-d0122bff.system.entry.js +0 -5
  235. package/dist/twilight/p-d0122bff.system.entry.js.map +0 -1
  236. /package/dist/twilight/{p-4fbad277.entry.js.map → p-0649d076.entry.js.map} +0 -0
  237. /package/dist/twilight/{p-b6d17480.system.entry.js.map → p-1696a245.system.entry.js.map} +0 -0
  238. /package/dist/twilight/{p-1d879370.entry.js.map → p-19f533ec.entry.js.map} +0 -0
  239. /package/dist/twilight/{p-0bdf2224.entry.js.map → p-1dd178a2.entry.js.map} +0 -0
  240. /package/dist/twilight/{p-1f4fc47f.entry.js.map → p-20bdcd53.entry.js.map} +0 -0
  241. /package/dist/twilight/{p-5c52e00c.entry.js.map → p-247636ef.entry.js.map} +0 -0
  242. /package/dist/twilight/{p-38a60819.entry.js.map → p-269ebd5d.entry.js.map} +0 -0
  243. /package/dist/twilight/{p-fe7d4113.system.entry.js.map → p-2a10bff2.system.entry.js.map} +0 -0
  244. /package/dist/twilight/{p-cd6c8a64.entry.js.map → p-2d0c2877.entry.js.map} +0 -0
  245. /package/dist/twilight/{p-8a42ee60.system.entry.js.map → p-2da442c2.system.entry.js.map} +0 -0
  246. /package/dist/twilight/{p-c7589247.system.entry.js.map → p-3093ea8e.system.entry.js.map} +0 -0
  247. /package/dist/twilight/{p-7f0b3753.entry.js.map → p-316e3ea9.entry.js.map} +0 -0
  248. /package/dist/twilight/{p-f5929cee.entry.js.map → p-33963e7d.entry.js.map} +0 -0
  249. /package/dist/twilight/{p-feb9b85a.entry.js.map → p-37a3c661.entry.js.map} +0 -0
  250. /package/dist/twilight/{p-d9073cf3.entry.js.map → p-41480e7b.entry.js.map} +0 -0
  251. /package/dist/twilight/{p-2a8279d6.entry.js.map → p-41ecc4f7.entry.js.map} +0 -0
  252. /package/dist/twilight/{p-9395f082.system.entry.js.map → p-44a213de.system.entry.js.map} +0 -0
  253. /package/dist/twilight/{p-a22b72f6.entry.js.map → p-4ced9aab.entry.js.map} +0 -0
  254. /package/dist/twilight/{p-ec81a36e.entry.js.map → p-51195e76.entry.js.map} +0 -0
  255. /package/dist/twilight/{p-ff9d70f4.system.entry.js.map → p-54bd7e18.system.entry.js.map} +0 -0
  256. /package/dist/twilight/{p-3134126e.system.entry.js.map → p-611b6013.system.entry.js.map} +0 -0
  257. /package/dist/twilight/{p-bd4d0f9a.system.entry.js.map → p-679bb855.system.entry.js.map} +0 -0
  258. /package/dist/twilight/{p-4c74100d.system.entry.js.map → p-67fe618e.system.entry.js.map} +0 -0
  259. /package/dist/twilight/{p-1ebd5929.system.entry.js.map → p-69ec9ac8.system.entry.js.map} +0 -0
  260. /package/dist/twilight/{p-b09ad735.system.entry.js.map → p-740b39fc.system.entry.js.map} +0 -0
  261. /package/dist/twilight/{p-2ea1d52b.entry.js.map → p-756fe45d.entry.js.map} +0 -0
  262. /package/dist/twilight/{p-d2edeb7c.system.entry.js.map → p-7ddf00a9.system.entry.js.map} +0 -0
  263. /package/dist/twilight/{p-5fd16112.system.entry.js.map → p-86dd7e02.system.entry.js.map} +0 -0
  264. /package/dist/twilight/{p-42291bce.entry.js.map → p-8c9ae8bd.entry.js.map} +0 -0
  265. /package/dist/twilight/{p-3b5eb2c9.system.entry.js.map → p-8e242779.system.entry.js.map} +0 -0
  266. /package/dist/twilight/{p-4daef7a0.entry.js.map → p-9361e7a2.entry.js.map} +0 -0
  267. /package/dist/twilight/{p-3aa0ac01.entry.js.map → p-952a8078.entry.js.map} +0 -0
  268. /package/dist/twilight/{p-bf454ddd.entry.js.map → p-9ca8c6b6.entry.js.map} +0 -0
  269. /package/dist/twilight/{p-15e36352.system.entry.js.map → p-9d750b3d.system.entry.js.map} +0 -0
  270. /package/dist/twilight/{p-9f657953.system.entry.js.map → p-a78387e7.system.entry.js.map} +0 -0
  271. /package/dist/twilight/{p-abcc0cbf.entry.js.map → p-aa6a0113.entry.js.map} +0 -0
  272. /package/dist/twilight/{p-2147391e.system.entry.js.map → p-ad02a471.system.entry.js.map} +0 -0
  273. /package/dist/twilight/{p-c8053b6f.entry.js.map → p-b63bc4db.entry.js.map} +0 -0
  274. /package/dist/twilight/{p-213c3ce4.entry.js.map → p-b72f268b.entry.js.map} +0 -0
  275. /package/dist/twilight/{p-f2dda5b0.system.entry.js.map → p-c70ed29b.system.entry.js.map} +0 -0
  276. /package/dist/twilight/{p-5a86938a.system.entry.js.map → p-cdc147d2.system.entry.js.map} +0 -0
  277. /package/dist/twilight/{p-55ce45d1.system.entry.js.map → p-d14e40fe.system.entry.js.map} +0 -0
  278. /package/dist/twilight/{p-01578d6d.system.entry.js.map → p-d2c834be.system.entry.js.map} +0 -0
  279. /package/dist/twilight/{p-32429afe.system.entry.js.map → p-d56a7bd9.system.entry.js.map} +0 -0
  280. /package/dist/twilight/{p-50c60622.entry.js.map → p-d600f506.entry.js.map} +0 -0
  281. /package/dist/twilight/{p-95e2b228.system.entry.js.map → p-e061a1f5.system.entry.js.map} +0 -0
  282. /package/dist/twilight/{p-065d60f6.entry.js.map → p-e084e3c4.entry.js.map} +0 -0
  283. /package/dist/twilight/{p-0ebd2162.entry.js.map → p-e9ca7e7c.entry.js.map} +0 -0
  284. /package/dist/twilight/{p-df8a68d9.system.entry.js.map → p-ee97bc7b.system.entry.js.map} +0 -0
  285. /package/dist/twilight/{p-8079920d.system.entry.js.map → p-f5ce1227.system.entry.js.map} +0 -0
  286. /package/dist/twilight/{p-e9046909.system.entry.js.map → p-fb9cd621.system.entry.js.map} +0 -0
  287. /package/dist/twilight/{p-01f043b8.entry.js.map → p-fdd3788a.entry.js.map} +0 -0
@@ -1,5 +0,0 @@
1
- /*!
2
- * Crafted with ❤ by Salla
3
- */
4
- import{r as s,h as e,g as t}from"./p-EWYMQsdr.js";var r;(function(s){s["ProductDetail"]="product.single";s["Cart"]="cart"})(r||(r={}));var a;(function(s){s["Conditional"]="conditional";s["PercentageOrFixed"]="fixed";s["DiscountsTable"]="discounts_table";s["Bank"]="bank";s["BuyXGetY"]="buy_x_get_y"})(a||(a={}));const i='.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}';const l=class{constructor(e){s(this,e);var t;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=s=>salla.lang.get("pages.offer.buy_quantity",{quantity:s});salla.lang.onLoaded((()=>{this.offer_with_price_text=salla.lang.get("pages.offer.with_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(0)}));salla.onReady((()=>{this.currentPage=salla.config.get("page.slug");this.userCurrency=salla.config.get("currencies")[salla.config.get("user.currency_code")].symbol}));this.categorySlot=((t=this.host.querySelector('[slot="category"]'))===null||t===void 0?void 0:t.innerHTML)||'<a href={url} class="s-offer-slide-cat-entry"><i class={icon}></i><h4>{name}</h4></a>'}getEndpointByPageName(){return{[r.Cart]:`offers/cart/${salla.storage.get("cart.id")}`,[r.ProductDetail]:`offers/product/${salla.config.get("page.id")}`}[this.currentPage]||"offers"}componentWillLoad(){this.hasCustomComponent=!!customElements.get(this.productCardComponent);return new Promise((s=>salla.onReady(s))).then((()=>{this.showOffer=!salla.url.is_page("product.single")||salla.config.get("store.settings.product.show_special_offers");if(this.showOffer){return}throw new Error("Merchant disabled showing the offers on product page")})).then((()=>salla.api.request(this.getEndpointByPageName()))).then((s=>{if(!(this.offersList=s.data).length){throw new Error("salla-offers:: There is no offers!")}const e=this.offersList.find((s=>[a.Bank,a.BuyXGetY,a.DiscountsTable].includes(s.type)));if(!e){throw new Error("salla-offers:: Offer type not supported yet!")}if(e.type===a.DiscountsTable){return this.offersList=[e]}if(this.isBankOffer=e.type===a.Bank){this.offersList=this.offersList.filter((s=>s.type===a.Bank));this.isMultipleBank=this.offersList.length>1;return this.offersList}const t=e.details.get;return t.source==="products"?salla.product.api.fetch({source:"selected",source_value:t.source_value}).then((s=>{t.products=s.data;e.details.get=t;return this.offersList=[e]})):salla.product.api.categories().then((s=>{t.categories=this.findCategories(s.data,t.source_value);e.details.get=t;return this.offersList=[e]}))})).then((s=>{salla.storage.set(this.getStorageKey(),{offers:s,stored_at:(new Date).getTime()});this.canRender=true})).catch((s=>{salla.logger.warn(s)}))}componentDidLoad(){let s=this.host.querySelector(".s-slider-block__title-nav");s===null||s===void 0?void 0:s.classList.add("s-offer-bank-payment-nav")}findCategories(s,e){var t;let r=[];for(const a of s){if(e.includes(a.id_||a.id)){r.push(a)}if(((t=a.sub_categories)===null||t===void 0?void 0:t.length)>0){r=r.concat(this.findCategories(a.sub_categories,e))}}return r}getStorageKey(){try{const s=salla.config.get("page.slug").replace(".","_");const e=salla.lang.getLocale();const t=salla.config.currency().code;if(!s||!e||!t){throw new Error("Unable to get the storage key.")}return`s-offers-${s}-${salla.config.get("page.id")}-${e}-${t}`}catch(s){return""}}getOffersFromStorage(){let s=salla.storage.get(this.getStorageKey());if(!s||s.stored_at<(new Date).getTime()-10*60*1e3){salla.storage.remove(this.getStorageKey());return null}this.canRender=true;return Promise.resolve(s.offers)}render(){if(!this.offersList.length||!this.canRender||!this.showOffer)return null;const s=this.offersList[0];const t=this.isBankOffer?this.isMultipleBank?this.multipleBankOfferTitleText:null:s.title;const r=this.isBankOffer?this.isMultipleBank?this.multipleBankOfferTitleDescription:null:s.description;const a={"block-title":t,"block-subTitle":r,"show-controls":this.isMultipleBank};return e("div",{class:"s-offer-wrapper"},e("p",{class:"s-offer-corner-badge"},this.special_offer_text),e("salla-slider",Object.assign({type:"carousel",id:"offer-slider"},a),e("div",{slot:"items"},this.renderSectionForOfferType(s.type))))}renderSectionForOfferType(s){if(this.isBankOffer){return this.renderBankSection()}if(s==a.BuyXGetY){return this.renderBuyXGetYSection()}return this.renderDiscountTableSection()}getCategoriesSection(s){return e("div",{class:"s-offer-slide-one-sixth swiper-slide",innerHTML:this.categorySlot.replace(/\{url\}/g,s.url).replace(/\{icon\}/g,s.icon||"sicon-store").replace(/\{name\}/g,s.name)})}renderBuyXGetYSection(){var s,t;const r=this.offersList[0].details;return[(s=r.get.products)===null||s===void 0?void 0:s.map((s=>e("div",{class:"s-offer-slide-one-fourth"},this.hasCustomComponent?e(this.productCardComponent,{product:s}):e("salla-product-card",{"shadow-on-hover":true,product:s})))),(t=r.get.categories)===null||t===void 0?void 0:t.map((s=>this.getCategoriesSection(s)))]}renderBankSection(){return this.offersList.map((s=>e("div",{class:{"s-offer-slide-one-sixth":this.isMultipleBank,"s-offer-bank-wrapper-sinlge-item":!this.isMultipleBank}},e("div",{class:{"s-offer-bank-wrapper":true,"s-offer-slide-one-sixth":!this.isMultipleBank,"s-offer-bank-wrapper-multi-spacer":this.isMultipleBank}},e("div",{class:"s-offer-bank-logo"},e("img",{src:s.details.logo||salla.url.cdn("images/s-empty.png"),"data-src":s.details.logo,alt:s.title+" offer"})),e("ul",{class:"s-offer-bank-payment-wrapper"},s.details.payments.map((s=>e("li",{class:"s-offer-bank-payment-single"},e("img",{src:salla.url.cdn("images/payment/"+s+".png")||salla.url.cdn("images/s-empty.png"),"data-src":salla.url.cdn("images/payment/"+s+".png"),alt:"payment"}))))),this.isMultipleBank?e("p",{class:"s-offer-bank-payment-discount-percent"},`${this.product_discount_text} ${s.details.discount_value}${s.details.discount_type==="percentage"&&"%"}`):""),!this.isMultipleBank?e("div",{class:"s-offer-bank-message s-offer-slide-one-fourth"},e("h2",null,this.offersList[0].title),e("p",{innerHTML:this.generateBankDescription(this.offersList[0].description,s.details.discount_value)})):"")))}generateBankDescription(s,e){return s.replace(new RegExp(`${e} %`),`<span class="s-offer-bank-message-amount">${e} %</span>`)}renderDiscountTableSection(){var s;const t=this.offersList[0];let r=t.details.show_price_after_discount;return(s=this.offersList[0].details.discounts)===null||s===void 0?void 0:s.map((s=>e("div",{class:"s-offer-slide-one-fourth"},e("div",{class:"s-offer-slide-offer-entry"},e("div",{class:"s-offer-slide-offer-entry-price-quantity-container"},e("p",{class:"s-offer-slide-offer-entry-quantity"},this.buy_quantity_text(s.quantity)),r?e("div",{class:"s-offer-slide-offer-entry-price"},e("span",null,this.offer_with_price_text),e("span",{class:"s-offer-slide-offer-entry-price-amount"},s.discounted_amount)," ",e("span",null,this.userCurrency)):""),e("p",{class:"s-offer-slide-offer-entry-price-amount-percent"},this.with_discount_text,"(",e("span",null,s.percentage,!!s.percentage&&"%"),")")))))}get host(){return t(this)}};l.style=i;export{l as salla_offer};
5
- //# sourceMappingURL=p-545302d2.entry.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["PageType","OfferType","sallaOfferCss","SallaOffer","constructor","hostRef","this","productCardComponent","offersList","isMultipleBank","isBankOffer","canRender","showOffer","salla","config","get","offer_with_price_text","lang","price","with_discount_text","product_discount_text","special_offer_text","multipleBankOfferTitleText","multipleBankOfferTitleDescription","buy_quantity_text","quantity","onLoaded","onReady","currentPage","userCurrency","symbol","categorySlot","_a","host","querySelector","innerHTML","getEndpointByPageName","Cart","storage","ProductDetail","componentWillLoad","hasCustomComponent","customElements","Promise","resolve","then","url","is_page","Error","api","request","res","data","length","offer","find","Bank","BuyXGetY","DiscountsTable","includes","type","filter","getY","details","source","product","fetch","source_value","response","products","categories","findCategories","offers","set","getStorageKey","stored_at","Date","getTime","catch","error","logger","warn","componentDidLoad","nav","classList","add","ids","found","category","id_","id","push","sub_categories","concat","pageSlug","replace","locale","getLocale","currencyCode","currency","code","getOffersFromStorage","storageOffers","remove","render","blockTitle","title","blockSubTitle","description","titles","h","class","Object","assign","slot","renderSectionForOfferType","offerType","renderBankSection","renderBuyXGetYSection","renderDiscountTableSection","getCategoriesSection","icon","name","map","_b","bankOffer","src","logo","cdn","alt","payments","payment","discount_value","discount_type","generateBankDescription","desc","value","RegExp","show_discounted_price","show_price_after_discount","discounts","discount","discounted_amount","percentage"],"sources":["src/components/salla-offer/interfaces.ts","src/components/salla-offer/salla-offer.scss?tag=salla-offer","src/components/salla-offer/salla-offer.tsx"],"sourcesContent":["export enum PageType {\n ProductDetail = \"product.single\",\n Cart = \"cart\"\n}\n\nexport enum OfferType {\n Conditional = \"conditional\",\n PercentageOrFixed = \"fixed\",\n DiscountsTable = \"discounts_table\",\n Bank = \"bank\",\n BuyXGetY = \"buy_x_get_y\"\n}\n\n\nexport interface DiscountDetailFixed {\n discount_type: \"fixed\";\n min_spend: number;\n discount_value: number;\n}\n\nexport interface DiscountDetailFreeProduct {\n discount_type: \"free_product\";\n min_spend: number;\n discount_value: number;\n}\n\nexport interface DiscountDetailConditional extends Array<DiscountDetailFixed | DiscountDetailFreeProduct> {}\n\nexport interface DiscountDetailPercentageFixed {\n apply_to: \"all\" | \"products\" | \"categories\" | \"payment_methods\";\n targets: Array<string | number>;\n ends_at: number;\n min_spend: number;\n discount_value: number;\n}\n\nexport interface Discount {\n discounted_amount: any;\n quantity: number;\n percentage: number;\n}\n\nexport interface DiscountDetailTable {\n apply_to: \"all\" | \"products\" | \"categories\" | \"payment_methods\" | \"order\";\n discount_value: number;\n ends_at: string;\n min_items: number;\n min_spend: number;\n show_price_after_discount: boolean;\n discounts: Discount[];\n}\n\nexport interface BankOffer {\n logo: string;\n discount_value: number;\n discount_type: string;\n minimum_spend: number;\n payments: string[];\n}\n\nexport interface BuyXGetYDetail {\n ends_at: number;\n buy: {\n source: \"product\" | \"category\";\n source_value: number[];\n quantity: number;\n };\n get: {\n source: \"products\" | \"category\";\n source_value: number[];\n type: \"free_product\" | \"percentage\" | \"fixed\";\n value: number;\n products?: Product[];//we will set this dynamically\n categories?: Category[];//we will set this dynamically\n };\n}\n\nexport interface Offer {\n id: number;\n title: string;\n description: string;\n type: OfferType | \"conditional\" | \"fixed\" | \"discounts_table\" | \"bank\" | \"buy_x_get_y\";\n details: DiscountDetailConditional | DiscountDetailPercentageFixed | DiscountDetailTable | BankOffer | BuyXGetYDetail;\n}\n\nexport interface Product {\n id: number;\n type: string;\n status: string;\n is_available: boolean;\n sku: string;\n name: string;\n price: { amount: number; currency: string; };\n promotion: { title: string; sub_title: string; };\n sale_price: { amount: number; currency: string; };\n regular_price: { amount: number; currency: string; };\n currency: string;\n url: string;\n thumbnail: string;\n has_special_price: boolean;\n favorite?: any;\n}\n\nexport interface Category {\n id?: string;\n id_?: number;\n name?: string;\n url?: string;\n icon?: string;\n sub_categories?: Category[];\n items?: any[] | null;\n}\n\nexport interface Currency {\n code: string | 'SAR';\n name: string;\n symbol: string;\n amount?: number;\n country_code?: string;\n}\n",".s-offer-wrapper .s-slider-block__title {\n h2 {\n font-size: 1.125rem;\n line-height: 1.75rem;\n color: #f87171;\n\n &::before {\n font-family: \"sallaicons\";\n content: \"\\ee30\" !important;\n position: absolute;\n top: 1rem;\n font-size: 3rem;\n font-weight: 400;\n line-height: 1;\n color: #fef2f2;\n }\n }\n}\n\n.s-offer-bank-wrapper-sinlge-item{\n display: flex;\n align-items: center !important;\n gap: 14px;\n}\n\n.s-offer-bank-wrapper {\n display: flex !important;\n width: 100% !important;\n}\n\n// .s-offer-bank-wrapper {\n // \n// }","import { Component, Element, Prop, State, h } from '@stencil/core';\nimport { Offer, Category, Product, Discount, Currency, BuyXGetYDetail, PageType, OfferType, BankOffer, DiscountDetailTable } from './interfaces';\n\n\n/**\n * `salla-offer` is a StencilJS component that displays offers, categories, products, banks, and discount information.\n * It uses the `salla-slider` component for carousel functionality.\n *\n * @slot category - The slot for customizing the category entry layout.\n * \n * @csspart custom - Custom CSS part to target specific elements in the component.\n *\n * @example\n * <salla-offer product-id=\"123\"></salla-offer>\n */\n@Component({\n tag: 'salla-offer',\n styleUrl: 'salla-offer.scss',\n})\nexport class SallaOffer {\n\n constructor() {\n // Language\n salla.lang.onLoaded(() => {\n this.offer_with_price_text = salla.lang.get('pages.offer.with_price');\n this.with_discount_text = salla.lang.get('pages.products.with_a_discount');\n this.product_discount_text = salla.lang.get('pages.products.discount');\n this.special_offer_text = salla.lang.get('pages.products.special_offer');\n this.multipleBankOfferTitleText = salla.lang.get('pages.offer.multiple_bank_offers_title');\n this.multipleBankOfferTitleDescription = salla.lang.get('pages.offer.multiple_bank_offers_message');\n this.buy_quantity_text(0);\n })\n\n salla.onReady(() => {\n this.currentPage = salla.config.get('page.slug')\n this.userCurrency = salla.config.get('currencies')[salla.config.get('user.currency_code')].symbol\n });\n\n this.categorySlot = this.host.querySelector('[slot=\"category\"]')?.innerHTML || '<a href={url} class=\"s-offer-slide-cat-entry\"><i class={icon}></i><h4>{name}</h4></a>';\n }\n\n /**\n * Custom Card Component for the Salla Products List.\n *\n * This component allows you to customize the appearance of individual product cards within a Salla Products List.\n *\n * @example\n * <salla-products-list product-card-component=\"my-custom-card-style1\" ...\n * <salla-products-list product-card-component=\"my-custom-card-style2\" ...\n */\n @Prop() productCardComponent: string = 'custom-salla-product-card';\n\n // Declare component state variables\n @State() offersList: Offer[] = [];\n @State() userCurrency: Currency;\n @State() isMultipleBank: boolean = false;\n @State() title?: string;\n @State() currentPage: string;\n @State() hasCustomComponent: boolean;\n\n @State() isBankOffer: boolean = false;\n @State() canRender: boolean = false;\n @State() showOffer: boolean = salla.config.get('store.settings.product.show_special_offers');\n\n // Default translated texts\n @State() offer_with_price_text: string = salla.lang.get('pages.offer.with_price', { price: '' });\n @State() with_discount_text: string = salla.lang.get('pages.products.with_a_discount')\n @State() product_discount_text: string = salla.lang.get('pages.products.discount')\n @State() special_offer_text: string = salla.lang.get('pages.products.special_offer')\n @State() multipleBankOfferTitleText: string = salla.lang.get('pages.offer.multiple_bank_offers_title')\n @State() multipleBankOfferTitleDescription: string = salla.lang.get('pages.offer.multiple_bank_offers_message')\n @State() buy_quantity_text: (quantity: number) => string = (quantity) => salla.lang.get('pages.offer.buy_quantity', { quantity })\n\n // Reference to the host element\n @Element() host: HTMLElement;\n\n private categorySlot: string;\n\n private getEndpointByPageName(): string {\n return {\n [PageType.Cart]: `offers/cart/${salla.storage.get('cart.id')}`,\n [PageType.ProductDetail]: `offers/product/${salla.config.get('page.id')}`,\n }[this.currentPage] || \"offers\";\n }\n\n componentWillLoad() {\n this.hasCustomComponent = !!customElements.get(this.productCardComponent);\n // let offers = this.getOffersFromStorage();\n // if (offers) {\n // return offers.then(offersFromStorage => this.offersList = offersFromStorage);\n // }\n\n return (new Promise(resolve => salla.onReady(resolve)))\n .then(() => {\n this.showOffer = !salla.url.is_page('product.single') || salla.config.get('store.settings.product.show_special_offers')\n if (this.showOffer) {\n return;\n }\n throw new Error(\"Merchant disabled showing the offers on product page\");\n }\n )\n .then(() => salla.api.request(this.getEndpointByPageName()))\n .then((res) => {\n if (!(this.offersList = res.data).length) {\n throw new Error('salla-offers:: There is no offers!');\n }\n //we support these offers only\n const offer = this.offersList.find(offer => [OfferType.Bank, OfferType.BuyXGetY, OfferType.DiscountsTable].includes(offer.type as any));\n if (!offer) {\n throw new Error('salla-offers:: Offer type not supported yet!');\n }\n //because there is no need for special handling for discounts table, just skip the other cases\n if (offer.type === OfferType.DiscountsTable) {\n return this.offersList = [offer];\n }\n\n //if it's banks offer, we need to include the other banks overs\n if ((this.isBankOffer = offer.type === OfferType.Bank)) {\n this.offersList = this.offersList.filter(offer => offer.type === OfferType.Bank);\n this.isMultipleBank = this.offersList.length > 1;\n return this.offersList;\n }\n //BuyXGetY offers\n const getY = (offer.details as BuyXGetYDetail).get;\n\n return getY.source === 'products'\n //todo:: avoid this request, and the handling for the products, just use `salla-products-slider` and don't forget to pass the customcard\n ? salla.product.api.fetch({ source: \"selected\", source_value: getY.source_value })\n .then((response: any) => {\n getY.products = response.data;\n (offer.details as any).get = getY;\n return this.offersList = [offer];\n })//set the products\n : salla.product.api.categories()//get all categories in one query, then extract only the selected one, instead of sending multi requests\n .then((res) => {\n getY.categories = this.findCategories(res.data, getY.source_value);\n (offer.details as any).get = getY;\n return this.offersList = [offer];\n });\n })\n .then((offers: Offer[]) => {\n salla.storage.set(this.getStorageKey(), { offers, stored_at: new Date().getTime() });\n this.canRender = true;\n })\n .catch((error) => {\n salla.logger.warn(error)\n });\n }\n\n componentDidLoad() {\n let nav = this.host.querySelector('.s-slider-block__title-nav');\n nav?.classList.add(\"s-offer-bank-payment-nav\")\n }\n\n\n findCategories(categories: Category[], ids: any[]): Category[] {\n let found: Category[] = [];\n\n for (const category of categories) {\n if (ids.includes(category.id_ || category.id)) { //here we are using || because we are planning to drop `id_`\n found.push(category);\n }\n if (category.sub_categories?.length > 0) {\n found = found.concat(this.findCategories(category.sub_categories, ids));\n }\n }\n\n return found;\n }\n\n //todo::add to the key params, to make sure it will support multi offers in the same page if it's wanted\n getStorageKey(): string {\n try {\n const pageSlug = salla.config.get('page.slug').replace('.', '_');\n const locale = salla.lang.getLocale();\n const currencyCode = salla.config.currency().code;\n\n if (!pageSlug || !locale || !currencyCode) {\n throw new Error('Unable to get the storage key.');\n }\n\n return `s-offers-${pageSlug}-${salla.config.get('page.id')}-${locale}-${currencyCode}`;\n } catch (error) {\n return '';\n }\n }\n\n //@ts-ignore\n getOffersFromStorage(): null | Promise<Offer[]> {\n let storageOffers = salla.storage.get(this.getStorageKey());\n //if the offers not existed, or it has been stored before 10 minutes from now, ignore it;\n if (!storageOffers || storageOffers.stored_at < (new Date().getTime() - 10 * 60 * 1000)) {\n salla.storage.remove(this.getStorageKey());\n return null;\n }\n this.canRender = true;\n\n //return it as resolve to support .then\n return Promise.resolve(storageOffers.offers);\n }\n\n render() {\n if (!this.offersList.length || !this.canRender || !this.showOffer) return null;\n const offer: Offer = this.offersList[0];\n\n const blockTitle = this.isBankOffer ? (this.isMultipleBank ? this.multipleBankOfferTitleText : null) : offer.title;\n const blockSubTitle = this.isBankOffer ? (this.isMultipleBank ? this.multipleBankOfferTitleDescription : null) : offer.description;\n\n const titles = {\n 'block-title': blockTitle,\n 'block-subTitle': blockSubTitle,\n 'show-controls': this.isMultipleBank\n };\n\n return (\n <div class=\"s-offer-wrapper\">\n {<p class=\"s-offer-corner-badge\">{this.special_offer_text}</p>}\n {/* discounts table is not a slider, it's a table🤔 */}\n {/* single bank offer is not a slider, it's a dom without slider🤔 */}\n <salla-slider type=\"carousel\" id=\"offer-slider\" {...titles}>\n <div slot='items'>\n {this.renderSectionForOfferType(offer.type)}\n </div>\n </salla-slider>\n </div>\n );\n }\n\n private renderSectionForOfferType(offerType: OfferType | string) {\n if (this.isBankOffer) {\n return this.renderBankSection();\n }\n if (offerType == OfferType.BuyXGetY) {\n return this.renderBuyXGetYSection();\n }\n\n return this.renderDiscountTableSection();\n }\n\n /**\n * Generates content for the categories section.\n *\n * @param offeredCategories - An array of Category objects.\n * @returns An array of HTML elements representing categories.\n */\n private getCategoriesSection(category: Category) {\n return <div class=\"s-offer-slide-one-sixth swiper-slide\" innerHTML={this.categorySlot\n .replace(/\\{url\\}/g, category.url)\n .replace(/\\{icon\\}/g, category.icon || \"sicon-store\")\n .replace(/\\{name\\}/g, category.name)}></div>\n }\n\n private renderBuyXGetYSection() {\n const details = (this.offersList[0].details as BuyXGetYDetail)\n return [\n details.get.products?.map((product: Product) => (\n <div class=\"s-offer-slide-one-fourth\">\n {this.hasCustomComponent\n ? <this.productCardComponent product={product}></this.productCardComponent>\n : <salla-product-card shadow-on-hover product={product}></salla-product-card>}\n </div>\n )),\n details.get.categories?.map((category: Category) => this.getCategoriesSection(category))\n ];\n }\n\n /**\n * Generates content for the bank section.\n *\n * @param offeredBank - An array of Bank objects.\n * @param name - The title of the current offer.\n * @param description - The description of the current offer.\n * @returns An array of HTML elements representing banks.\n * \n * TODO: loop over the list and filter bank types and pass it to this function\n */\n private renderBankSection() {\n return this.offersList.map((bankOffer: Offer) => {\n return <div class={{ \"s-offer-slide-one-sixth\": this.isMultipleBank, \"s-offer-bank-wrapper-sinlge-item\": !this.isMultipleBank }}>\n <div class={{ \"s-offer-bank-wrapper\": true, \"s-offer-slide-one-sixth\": !this.isMultipleBank, \"s-offer-bank-wrapper-multi-spacer\": this.isMultipleBank }}>\n <div class=\"s-offer-bank-logo\">\n <img src={(bankOffer.details as BankOffer).logo || salla.url.cdn('images/s-empty.png')} data-src={(bankOffer.details as BankOffer).logo} alt={bankOffer.title + \" offer\"} />\n </div>\n <ul class=\"s-offer-bank-payment-wrapper\">\n {(bankOffer.details as BankOffer).payments.map((payment: string) => {\n return <li class=\"s-offer-bank-payment-single\">\n <img\n src={salla.url.cdn('images/payment/' + payment + '.png') || salla.url.cdn('images/s-empty.png')}\n data-src={salla.url.cdn('images/payment/' + payment + '.png')}\n alt=\"payment\" />\n </li>\n })}\n </ul>\n {this.isMultipleBank ?\n <p class=\"s-offer-bank-payment-discount-percent\">\n {`${this.product_discount_text} ${(bankOffer.details as BankOffer).discount_value}${(bankOffer.details as BankOffer).discount_type === \"percentage\" && '%'}`}\n </p>\n : \"\"}\n </div>\n {!this.isMultipleBank ?\n <div class=\"s-offer-bank-message s-offer-slide-one-fourth\">\n <h2>{this.offersList[0].title}</h2>\n <p innerHTML={this.generateBankDescription(this.offersList[0].description, (bankOffer.details as BankOffer).discount_value)}></p>\n </div>\n : \"\"}\n </div>\n })\n }\n\n private generateBankDescription(desc: string, value): string {\n return desc.replace(new RegExp(`${value} %`), `<span class=\"s-offer-bank-message-amount\">${value} %</span>`)\n }\n\n /**\n * Generates content for the discount table section.\n *\n * @param discountTable - An array of Discount objects.\n * @returns An array of HTML elements representing discounts_table.\n */\n private renderDiscountTableSection() {\n const offer: Offer = this.offersList[0];\n let show_discounted_price = (offer.details as DiscountDetailTable).show_price_after_discount;\n return (this.offersList[0].details as DiscountDetailTable).discounts?.map((discount: Discount) => <div class=\"s-offer-slide-one-fourth\">\n <div class=\"s-offer-slide-offer-entry\">\n <div class=\"s-offer-slide-offer-entry-price-quantity-container\">\n <p class=\"s-offer-slide-offer-entry-quantity\">{this.buy_quantity_text(discount.quantity)}</p>\n {show_discounted_price ?\n <div class=\"s-offer-slide-offer-entry-price\">\n <span>{this.offer_with_price_text}</span>\n <span class=\"s-offer-slide-offer-entry-price-amount\">{discount.discounted_amount}</span> <span>{this.userCurrency}</span>\n </div> : \"\"}\n </div>\n <p class=\"s-offer-slide-offer-entry-price-amount-percent\">{this.with_discount_text}\n (<span>{discount.percentage}{!!discount.percentage && '%'}</span>)</p>\n </div>\n </div>\n )\n }\n\n}\n"],"mappings":";;;kDAAA,IAAYA,GAAZ,SAAYA,GACVA,EAAA,kCACAA,EAAA,cACD,EAHD,CAAYA,MAGX,KAED,IAAYC,GAAZ,SAAYA,GACVA,EAAA,6BACAA,EAAA,6BACAA,EAAA,oCACAA,EAAA,eACAA,EAAA,yBACD,EAND,CAAYA,MAMX,KCXD,MAAMC,EAAgB,+gB,MCmBTC,EAAU,MAErB,WAAAC,CAAAC,G,gBA6BQC,KAAoBC,qBAAW,4BAG9BD,KAAUE,WAAY,GAEtBF,KAAcG,eAAY,MAK1BH,KAAWI,YAAY,MACvBJ,KAASK,UAAY,MACrBL,KAASM,UAAYC,MAAMC,OAAOC,IAAI,8CAGtCT,KAAAU,sBAAgCH,MAAMI,KAAKF,IAAI,yBAA0B,CAAEG,MAAO,KAClFZ,KAAkBa,mBAAWN,MAAMI,KAAKF,IAAI,kCAC5CT,KAAqBc,sBAAWP,MAA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A,EAAE2F,KAAKkB,GAAuB/B,EAAA,OAAKC,MAAM,4BAC3GD,EAAK,OAAAC,MAAM,6BACTD,EAAK,OAAAC,MAAM,sDACTD,EAAA,KAAGC,MAAM,sCAAsCzG,KAAKkB,kBAAkBqH,EAASpH,WAC9EiH,EACC5B,EAAK,OAAAC,MAAM,mCACTD,EAAO,YAAAxG,KAAKU,uBACZ8F,EAAA,QAAMC,MAAM,0CAA0C8B,EAASC,mBAAyB,IAAChC,EAAO,YAAAxG,KAAKuB,eAC9F,IAEbiF,EAAG,KAAAC,MAAM,kDAAkDzG,KAAKa,mBAAkB,IAC/E2F,EAAA,YAAO+B,EAASE,aAAcF,EAASE,YAAc,KAAW,Q","ignoreList":[]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"p-B3dc8MoR.system.js","sources":["src/components/salla-offer/interfaces.ts","src/components/salla-offer/salla-offer.scss?tag=salla-offer","src/components/salla-offer/salla-offer.tsx"],"sourcesContent":["export enum PageType {\n ProductDetail = \"product.single\",\n Cart = \"cart\"\n}\n\nexport enum OfferType {\n Conditional = \"conditional\",\n PercentageOrFixed = \"fixed\",\n DiscountsTable = \"discounts_table\",\n Bank = \"bank\",\n BuyXGetY = \"buy_x_get_y\"\n}\n\n\nexport interface DiscountDetailFixed {\n discount_type: \"fixed\";\n min_spend: number;\n discount_value: number;\n}\n\nexport interface DiscountDetailFreeProduct {\n discount_type: \"free_product\";\n min_spend: number;\n discount_value: number;\n}\n\nexport interface DiscountDetailConditional extends Array<DiscountDetailFixed | DiscountDetailFreeProduct> {}\n\nexport interface DiscountDetailPercentageFixed {\n apply_to: \"all\" | \"products\" | \"categories\" | \"payment_methods\";\n targets: Array<string | number>;\n ends_at: number;\n min_spend: number;\n discount_value: number;\n}\n\nexport interface Discount {\n discounted_amount: any;\n quantity: number;\n percentage: number;\n}\n\nexport interface DiscountDetailTable {\n apply_to: \"all\" | \"products\" | \"categories\" | \"payment_methods\" | \"order\";\n discount_value: number;\n ends_at: string;\n min_items: number;\n min_spend: number;\n show_price_after_discount: boolean;\n discounts: Discount[];\n}\n\nexport interface BankOffer {\n logo: string;\n discount_value: number;\n discount_type: string;\n minimum_spend: number;\n payments: string[];\n}\n\nexport interface BuyXGetYDetail {\n ends_at: number;\n buy: {\n source: \"product\" | \"category\";\n source_value: number[];\n quantity: number;\n };\n get: {\n source: \"products\" | \"category\";\n source_value: number[];\n type: \"free_product\" | \"percentage\" | \"fixed\";\n value: number;\n products?: Product[];//we will set this dynamically\n categories?: Category[];//we will set this dynamically\n };\n}\n\nexport interface Offer {\n id: number;\n title: string;\n description: string;\n type: OfferType | \"conditional\" | \"fixed\" | \"discounts_table\" | \"bank\" | \"buy_x_get_y\";\n details: DiscountDetailConditional | DiscountDetailPercentageFixed | DiscountDetailTable | BankOffer | BuyXGetYDetail;\n}\n\nexport interface Product {\n id: number;\n type: string;\n status: string;\n is_available: boolean;\n sku: string;\n name: string;\n price: { amount: number; currency: string; };\n promotion: { title: string; sub_title: string; };\n sale_price: { amount: number; currency: string; };\n regular_price: { amount: number; currency: string; };\n currency: string;\n url: string;\n thumbnail: string;\n has_special_price: boolean;\n favorite?: any;\n}\n\nexport interface Category {\n id?: string;\n id_?: number;\n name?: string;\n url?: string;\n icon?: string;\n sub_categories?: Category[];\n items?: any[] | null;\n}\n\nexport interface Currency {\n code: string | 'SAR';\n name: string;\n symbol: string;\n amount?: number;\n country_code?: string;\n}\n",".s-offer-wrapper .s-slider-block__title {\n h2 {\n font-size: 1.125rem;\n line-height: 1.75rem;\n color: #f87171;\n\n &::before {\n font-family: \"sallaicons\";\n content: \"\\ee30\" !important;\n position: absolute;\n top: 1rem;\n font-size: 3rem;\n font-weight: 400;\n line-height: 1;\n color: #fef2f2;\n }\n }\n}\n\n.s-offer-bank-wrapper-sinlge-item{\n display: flex;\n align-items: center !important;\n gap: 14px;\n}\n\n.s-offer-bank-wrapper {\n display: flex !important;\n width: 100% !important;\n}\n\n// .s-offer-bank-wrapper {\n // \n// }","import { Component, Element, Prop, State, h } from '@stencil/core';\nimport { Offer, Category, Product, Discount, Currency, BuyXGetYDetail, PageType, OfferType, BankOffer, DiscountDetailTable } from './interfaces';\n\n\n/**\n * `salla-offer` is a StencilJS component that displays offers, categories, products, banks, and discount information.\n * It uses the `salla-slider` component for carousel functionality.\n *\n * @slot category - The slot for customizing the category entry layout.\n * \n * @csspart custom - Custom CSS part to target specific elements in the component.\n *\n * @example\n * <salla-offer product-id=\"123\"></salla-offer>\n */\n@Component({\n tag: 'salla-offer',\n styleUrl: 'salla-offer.scss',\n})\nexport class SallaOffer {\n\n constructor() {\n // Language\n salla.lang.onLoaded(() => {\n this.offer_with_price_text = salla.lang.get('pages.offer.with_price');\n this.with_discount_text = salla.lang.get('pages.products.with_a_discount');\n this.product_discount_text = salla.lang.get('pages.products.discount');\n this.special_offer_text = salla.lang.get('pages.products.special_offer');\n this.multipleBankOfferTitleText = salla.lang.get('pages.offer.multiple_bank_offers_title');\n this.multipleBankOfferTitleDescription = salla.lang.get('pages.offer.multiple_bank_offers_message');\n this.buy_quantity_text(0);\n })\n\n salla.onReady(() => {\n this.currentPage = salla.config.get('page.slug')\n this.userCurrency = salla.config.get('currencies')[salla.config.get('user.currency_code')].symbol\n });\n\n this.categorySlot = this.host.querySelector('[slot=\"category\"]')?.innerHTML || '<a href={url} class=\"s-offer-slide-cat-entry\"><i class={icon}></i><h4>{name}</h4></a>';\n }\n\n /**\n * Custom Card Component for the Salla Products List.\n *\n * This component allows you to customize the appearance of individual product cards within a Salla Products List.\n *\n * @example\n * <salla-products-list product-card-component=\"my-custom-card-style1\" ...\n * <salla-products-list product-card-component=\"my-custom-card-style2\" ...\n */\n @Prop() productCardComponent: string = 'custom-salla-product-card';\n\n // Declare component state variables\n @State() offersList: Offer[] = [];\n @State() userCurrency: Currency;\n @State() isMultipleBank: boolean = false;\n @State() title?: string;\n @State() currentPage: string;\n @State() hasCustomComponent: boolean;\n\n @State() isBankOffer: boolean = false;\n @State() canRender: boolean = false;\n @State() showOffer: boolean = salla.config.get('store.settings.product.show_special_offers');\n\n // Default translated texts\n @State() offer_with_price_text: string = salla.lang.get('pages.offer.with_price', { price: '' });\n @State() with_discount_text: string = salla.lang.get('pages.products.with_a_discount')\n @State() product_discount_text: string = salla.lang.get('pages.products.discount')\n @State() special_offer_text: string = salla.lang.get('pages.products.special_offer')\n @State() multipleBankOfferTitleText: string = salla.lang.get('pages.offer.multiple_bank_offers_title')\n @State() multipleBankOfferTitleDescription: string = salla.lang.get('pages.offer.multiple_bank_offers_message')\n @State() buy_quantity_text: (quantity: number) => string = (quantity) => salla.lang.get('pages.offer.buy_quantity', { quantity })\n\n // Reference to the host element\n @Element() host: HTMLElement;\n\n private categorySlot: string;\n\n private getEndpointByPageName(): string {\n return {\n [PageType.Cart]: `offers/cart/${salla.storage.get('cart.id')}`,\n [PageType.ProductDetail]: `offers/product/${salla.config.get('page.id')}`,\n }[this.currentPage] || \"offers\";\n }\n\n componentWillLoad() {\n this.hasCustomComponent = !!customElements.get(this.productCardComponent);\n // let offers = this.getOffersFromStorage();\n // if (offers) {\n // return offers.then(offersFromStorage => this.offersList = offersFromStorage);\n // }\n\n return (new Promise(resolve => salla.onReady(resolve)))\n .then(() => {\n this.showOffer = !salla.url.is_page('product.single') || salla.config.get('store.settings.product.show_special_offers')\n if (this.showOffer) {\n return;\n }\n throw new Error(\"Merchant disabled showing the offers on product page\");\n }\n )\n .then(() => salla.api.request(this.getEndpointByPageName()))\n .then((res) => {\n if (!(this.offersList = res.data).length) {\n throw new Error('salla-offers:: There is no offers!');\n }\n //we support these offers only\n const offer = this.offersList.find(offer => [OfferType.Bank, OfferType.BuyXGetY, OfferType.DiscountsTable].includes(offer.type as any));\n if (!offer) {\n throw new Error('salla-offers:: Offer type not supported yet!');\n }\n //because there is no need for special handling for discounts table, just skip the other cases\n if (offer.type === OfferType.DiscountsTable) {\n return this.offersList = [offer];\n }\n\n //if it's banks offer, we need to include the other banks overs\n if ((this.isBankOffer = offer.type === OfferType.Bank)) {\n this.offersList = this.offersList.filter(offer => offer.type === OfferType.Bank);\n this.isMultipleBank = this.offersList.length > 1;\n return this.offersList;\n }\n //BuyXGetY offers\n const getY = (offer.details as BuyXGetYDetail).get;\n\n return getY.source === 'products'\n //todo:: avoid this request, and the handling for the products, just use `salla-products-slider` and don't forget to pass the customcard\n ? salla.product.api.fetch({ source: \"selected\", source_value: getY.source_value })\n .then((response: any) => {\n getY.products = response.data;\n (offer.details as any).get = getY;\n return this.offersList = [offer];\n })//set the products\n : salla.product.api.categories()//get all categories in one query, then extract only the selected one, instead of sending multi requests\n .then((res) => {\n getY.categories = this.findCategories(res.data, getY.source_value);\n (offer.details as any).get = getY;\n return this.offersList = [offer];\n });\n })\n .then((offers: Offer[]) => {\n salla.storage.set(this.getStorageKey(), { offers, stored_at: new Date().getTime() });\n this.canRender = true;\n })\n .catch((error) => {\n salla.logger.warn(error)\n });\n }\n\n componentDidLoad() {\n let nav = this.host.querySelector('.s-slider-block__title-nav');\n nav?.classList.add(\"s-offer-bank-payment-nav\")\n }\n\n\n findCategories(categories: Category[], ids: any[]): Category[] {\n let found: Category[] = [];\n\n for (const category of categories) {\n if (ids.includes(category.id_ || category.id)) { //here we are using || because we are planning to drop `id_`\n found.push(category);\n }\n if (category.sub_categories?.length > 0) {\n found = found.concat(this.findCategories(category.sub_categories, ids));\n }\n }\n\n return found;\n }\n\n //todo::add to the key params, to make sure it will support multi offers in the same page if it's wanted\n getStorageKey(): string {\n try {\n const pageSlug = salla.config.get('page.slug').replace('.', '_');\n const locale = salla.lang.getLocale();\n const currencyCode = salla.config.currency().code;\n\n if (!pageSlug || !locale || !currencyCode) {\n throw new Error('Unable to get the storage key.');\n }\n\n return `s-offers-${pageSlug}-${salla.config.get('page.id')}-${locale}-${currencyCode}`;\n } catch (error) {\n return '';\n }\n }\n\n //@ts-ignore\n getOffersFromStorage(): null | Promise<Offer[]> {\n let storageOffers = salla.storage.get(this.getStorageKey());\n //if the offers not existed, or it has been stored before 10 minutes from now, ignore it;\n if (!storageOffers || storageOffers.stored_at < (new Date().getTime() - 10 * 60 * 1000)) {\n salla.storage.remove(this.getStorageKey());\n return null;\n }\n this.canRender = true;\n\n //return it as resolve to support .then\n return Promise.resolve(storageOffers.offers);\n }\n\n render() {\n if (!this.offersList.length || !this.canRender || !this.showOffer) return null;\n const offer: Offer = this.offersList[0];\n\n const blockTitle = this.isBankOffer ? (this.isMultipleBank ? this.multipleBankOfferTitleText : null) : offer.title;\n const blockSubTitle = this.isBankOffer ? (this.isMultipleBank ? this.multipleBankOfferTitleDescription : null) : offer.description;\n\n const titles = {\n 'block-title': blockTitle,\n 'block-subTitle': blockSubTitle,\n 'show-controls': this.isMultipleBank\n };\n\n return (\n <div class=\"s-offer-wrapper\">\n {<p class=\"s-offer-corner-badge\">{this.special_offer_text}</p>}\n {/* discounts table is not a slider, it's a table🤔 */}\n {/* single bank offer is not a slider, it's a dom without slider🤔 */}\n <salla-slider type=\"carousel\" id=\"offer-slider\" {...titles}>\n <div slot='items'>\n {this.renderSectionForOfferType(offer.type)}\n </div>\n </salla-slider>\n </div>\n );\n }\n\n private renderSectionForOfferType(offerType: OfferType | string) {\n if (this.isBankOffer) {\n return this.renderBankSection();\n }\n if (offerType == OfferType.BuyXGetY) {\n return this.renderBuyXGetYSection();\n }\n\n return this.renderDiscountTableSection();\n }\n\n /**\n * Generates content for the categories section.\n *\n * @param offeredCategories - An array of Category objects.\n * @returns An array of HTML elements representing categories.\n */\n private getCategoriesSection(category: Category) {\n return <div class=\"s-offer-slide-one-sixth swiper-slide\" innerHTML={this.categorySlot\n .replace(/\\{url\\}/g, category.url)\n .replace(/\\{icon\\}/g, category.icon || \"sicon-store\")\n .replace(/\\{name\\}/g, category.name)}></div>\n }\n\n private renderBuyXGetYSection() {\n const details = (this.offersList[0].details as BuyXGetYDetail)\n return [\n details.get.products?.map((product: Product) => (\n <div class=\"s-offer-slide-one-fourth\">\n {this.hasCustomComponent\n ? <this.productCardComponent product={product}></this.productCardComponent>\n : <salla-product-card shadow-on-hover product={product}></salla-product-card>}\n </div>\n )),\n details.get.categories?.map((category: Category) => this.getCategoriesSection(category))\n ];\n }\n\n /**\n * Generates content for the bank section.\n *\n * @param offeredBank - An array of Bank objects.\n * @param name - The title of the current offer.\n * @param description - The description of the current offer.\n * @returns An array of HTML elements representing banks.\n * \n * TODO: loop over the list and filter bank types and pass it to this function\n */\n private renderBankSection() {\n return this.offersList.map((bankOffer: Offer) => {\n return <div class={{ \"s-offer-slide-one-sixth\": this.isMultipleBank, \"s-offer-bank-wrapper-sinlge-item\": !this.isMultipleBank }}>\n <div class={{ \"s-offer-bank-wrapper\": true, \"s-offer-slide-one-sixth\": !this.isMultipleBank, \"s-offer-bank-wrapper-multi-spacer\": this.isMultipleBank }}>\n <div class=\"s-offer-bank-logo\">\n <img src={(bankOffer.details as BankOffer).logo || salla.url.cdn('images/s-empty.png')} data-src={(bankOffer.details as BankOffer).logo} alt={bankOffer.title + \" offer\"} />\n </div>\n <ul class=\"s-offer-bank-payment-wrapper\">\n {(bankOffer.details as BankOffer).payments.map((payment: string) => {\n return <li class=\"s-offer-bank-payment-single\">\n <img\n src={salla.url.cdn('images/payment/' + payment + '.png') || salla.url.cdn('images/s-empty.png')}\n data-src={salla.url.cdn('images/payment/' + payment + '.png')}\n alt=\"payment\" />\n </li>\n })}\n </ul>\n {this.isMultipleBank ?\n <p class=\"s-offer-bank-payment-discount-percent\">\n {`${this.product_discount_text} ${(bankOffer.details as BankOffer).discount_value}${(bankOffer.details as BankOffer).discount_type === \"percentage\" && '%'}`}\n </p>\n : \"\"}\n </div>\n {!this.isMultipleBank ?\n <div class=\"s-offer-bank-message s-offer-slide-one-fourth\">\n <h2>{this.offersList[0].title}</h2>\n <p innerHTML={this.generateBankDescription(this.offersList[0].description, (bankOffer.details as BankOffer).discount_value)}></p>\n </div>\n : \"\"}\n </div>\n })\n }\n\n private generateBankDescription(desc: string, value): string {\n return desc.replace(new RegExp(`${value} %`), `<span class=\"s-offer-bank-message-amount\">${value} %</span>`)\n }\n\n /**\n * Generates content for the discount table section.\n *\n * @param discountTable - An array of Discount objects.\n * @returns An array of HTML elements representing discounts_table.\n */\n private renderDiscountTableSection() {\n const offer: Offer = this.offersList[0];\n let show_discounted_price = (offer.details as DiscountDetailTable).show_price_after_discount;\n return (this.offersList[0].details as DiscountDetailTable).discounts?.map((discount: Discount) => <div class=\"s-offer-slide-one-fourth\">\n <div class=\"s-offer-slide-offer-entry\">\n <div class=\"s-offer-slide-offer-entry-price-quantity-container\">\n <p class=\"s-offer-slide-offer-entry-quantity\">{this.buy_quantity_text(discount.quantity)}</p>\n {show_discounted_price ?\n <div class=\"s-offer-slide-offer-entry-price\">\n <span>{this.offer_with_price_text}</span>\n <span class=\"s-offer-slide-offer-entry-price-amount\">{discount.discounted_amount}</span> <span>{this.userCurrency}</span>\n </div> : \"\"}\n </div>\n <p class=\"s-offer-slide-offer-entry-price-amount-percent\">{this.with_discount_text}\n (<span>{discount.percentage}{!!discount.percentage && '%'}</span>)</p>\n </div>\n </div>\n )\n }\n\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;YAAA,IAAY,QAGX;YAHD,CAAA,UAAY,QAAQ,EAAA;YAClB,IAAA,QAAA,CAAA,eAAA,CAAA,GAAA,gBAAgC;YAChC,IAAA,QAAA,CAAA,MAAA,CAAA,GAAA,MAAa;YACf,CAAC,EAHW,QAAQ,KAAR,QAAQ,GAGnB,EAAA,CAAA,CAAA;YAED,IAAY,SAMX;YAND,CAAA,UAAY,SAAS,EAAA;YACnB,IAAA,SAAA,CAAA,aAAA,CAAA,GAAA,aAA2B;YAC3B,IAAA,SAAA,CAAA,mBAAA,CAAA,GAAA,OAA2B;YAC3B,IAAA,SAAA,CAAA,gBAAA,CAAA,GAAA,iBAAkC;YAClC,IAAA,SAAA,CAAA,MAAA,CAAA,GAAA,MAAa;YACb,IAAA,SAAA,CAAA,UAAA,CAAA,GAAA,aAAwB;YAC1B,CAAC,EANW,SAAS,KAAT,SAAS,GAM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AAA,IAAI,CAAC,qBAAqB,CAAQ,EACzC,CAAA,CAAA,MAAA,EAAA,EAAM,KAAK,EAAC,wCAAwC,IAAE,QAAQ,CAAC,iBAAiB,CAAQ,OAAC,CAAO,CAAA,MAAA,EAAA,IAAA,EAAA,IAAI,CAAC,YAAY,CAAQ,CACrH,GAAG,EAAE,CACT,EACN,CAAG,CAAA,GAAA,EAAA,EAAA,KAAK,EAAC,gDAAgD,EAAA,EAAE,IAAI,CAAC,kBAAkB,OAC/E,CAAA,CAAA,MAAA,EAAA,IAAA,EAAO,QAAQ,CAAC,UAAU,EAAE,CAAC,CAAC,QAAQ,CAAC,UAAU,IAAI,GAAG,CAAQ,MAAK,CACpE,CACF,CACL;;;;;;;;;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"p-BkvW8UWg.system.js","sources":["src/components/salla-booking-field/salla-booking-field.scss?tag=salla-booking-field","src/components/salla-booking-field/salla-booking-field.tsx","src/components/salla-conditional-fields/salla-conditional-fields.tsx"],"sourcesContent":[":host {\n display: block;\n}\n","import { Component, Host, Prop, h, Element, State, Event, EventEmitter } from '@stencil/core';\nimport { Option, Reservation } from './interfaces';\nimport BookingTime from '../../assets/svg/calendar-time.svg';\nimport Calendar from '../../assets/svg/calendar.svg';\nimport TimeIcon from '../../assets/svg/time.svg';\n\n@Component({\n tag: 'salla-booking-field',\n styleUrl: 'salla-booking-field.scss',\n})\nexport class SallaBookingField {\n /**\n * The booking option configuration\n */\n @Prop() option: Option;\n /**\n * The ID of the product for which the booking is being made\n */\n @Prop() productId: number;\n @Element() host: HTMLElement;\n @State() bookNowLabel: string = salla.lang.get('pages.cart.book_an_appointment', 'حجز موعد');\n @State() editLabel: string = salla.lang.get('pages.cart.edit_an_appointment', 'تعديل الموعد');\n @State() bookedLabel: string = salla.lang.get('pages.cart.booked_successfully', 'تمت اضافة الموعد بنجاح');\n @State() selectDate: string = salla.lang.get('pages.cart.select_appointment_date', 'حدد تاريخ الموعد');\n @State() bookingUrl: string = '';\n @State() iframeReady: boolean = false;\n @State() reservations: Reservation[] = [];\n @State() reservationsInput: HTMLInputElement;\n\n /**\n * Event emitted when the input is invalid.\n */\n @Event() invalidInput: EventEmitter<any>;\n\n private modal: HTMLSallaModalElement;\n private iframe: HTMLIFrameElement;\n\n constructor() {\n // Load translations\n salla.lang.onLoaded(() => this.setTranslations());\n // Register event listeners\n Salla.event.on('booking::open', (data) => this.handleBookingOpen(data));\n }\n\n private async setTranslations() {\n const setNestedAsync = (lang, key, value) => {\n return new Promise((resolve) => {\n salla.helpers.setNested(salla.lang.messages[lang], key, value);\n resolve(true);\n });\n };\n\n await setNestedAsync('ar.trans', 'pages.cart.book_an_appointment', 'حجز موعد');\n await setNestedAsync('en.trans', 'pages.cart.book_an_appointment', 'Book an Appointment');\n await setNestedAsync('ar.trans', 'pages.cart.edit_an_appointment', 'تعديل الموعد');\n await setNestedAsync('en.trans', 'pages.cart.edit_an_appointment', 'Edit an Appointment');\n await setNestedAsync('ar.trans', 'pages.cart.booked_successfully', 'تمت اضافة الموعد بنجاح');\n await setNestedAsync('en.trans', 'pages.cart.booked_successfully', 'Booked Successfully');\n await setNestedAsync('ar.trans', 'pages.cart.select_appointment_date', 'حدد تاريخ الموعد');\n await setNestedAsync('en.trans', 'pages.cart.select_appointment_date', 'Select appointment date');\n\n this.bookNowLabel = salla.lang.get('pages.cart.book_an_appointment');\n this.editLabel = salla.lang.get('pages.cart.edit_an_appointment');\n this.bookedLabel = salla.lang.get('pages.cart.booked_successfully');\n this.selectDate = salla.lang.get('pages.cart.select_appointment_date');\n }\n\n private openBookingModal(event: any, afterReload = false) {\n if (afterReload && (!event.detail || typeof event.detail !== 'number' || event.detail !== this.productId)) {\n return;\n }\n if (salla.config.isGuest()) {\n this.setAfterReloadEvent('booking::open-after-reload', this.productId);\n salla.event.dispatch('login::open');\n return;\n }\n salla.booking.add(this.productId, false)\n .then((resp) => {\n if (resp.data.redirect.to !== 'booking') {\n throw new Error('Unexpected redirect!');\n }\n salla.event.dispatch('booking::open', { url: resp.data.redirect.url, id: this.productId });\n })\n .catch((error) => {\n salla.error(salla.lang.get('common.errors.error_occurred'));\n salla.logger.error(error.response || error);\n });\n }\n\n private handleBookingOpen(data) {\n if (data.id !== this.productId) return;\n this.bookingUrl = salla.url.addParamToUrl('product_id', data.id, data.url);\n this.iframeReady = true;\n setTimeout(() => {\n this.modal.setTitle(this.selectDate);\n this.modal.open();\n }, 100);\n }\n\n private setAfterReloadEvent(event, payload) {\n salla.storage.set('afterReloadEvent', { event, payload });\n }\n\n private emitAfterReloadEvent() {\n const eventDetails = salla.storage.get('afterReloadEvent');\n if (eventDetails && eventDetails.event) {\n const customEvent = new CustomEvent(eventDetails.event, {\n detail: eventDetails.payload\n });\n window.dispatchEvent(customEvent)\n salla.storage.remove('afterReloadEvent');\n }\n }\n\n componentWillLoad() {\n if (this.option && this.option.details.length) {\n this.reservations = this.option.details;\n }\n }\n\n componentDidLoad() {\n window.addEventListener('booking::open-after-reload', (event) => this.openBookingModal(event, true));\n this.emitAfterReloadEvent();\n window.addEventListener('message', this.handleMessageEvent.bind(this));\n this.reservationsInput.addEventListener('invalid', e => this.invalidInput.emit(e));\n this.reservationsInput.addEventListener('input', () => {\n this.reservationsInput.setCustomValidity('');\n this.reservationsInput.reportValidity();\n });\n }\n\n private handleMessageEvent(event) {\n if (event.data.source !== 'booking') return;\n const action = event.data.type;\n const value = event.data.message;\n if (localStorage.getItem('debug')) console.log(`Received an action:${action}`, event.data);\n\n if (action === 'error') {\n if (value.fields?.reservation) {\n salla.notify.error(value.fields.reservation[0]);\n return;\n }\n const errorList = Object.values(value.fields || [value.message]).flat().map(error => `<li>${error}</li>`).join('');\n salla.notify.error(`<ul>${errorList}</ul>`);\n }\n\n if (action === 'success') {\n if (Number(value.productId) !== Number(this.productId)) return;\n this.reservations = value.data.reservations.map(schedule => {\n if (schedule.time && schedule.time.length > 0) {\n const timeSlot = schedule.time[0];\n return {\n date: schedule.date,\n day: schedule.day,\n from_timestamp: timeSlot.from,\n to_timestamp: timeSlot.to,\n };\n }\n return null;\n }).filter(item => item !== null);\n\n salla.notify.success(this.bookedLabel);\n this.modal?.close();\n setTimeout(() => window.location.reload());\n }\n\n if (action === 'height') {\n this.iframe.height = value?.height + 'px';\n }\n }\n\n private bookingModal() {\n return (\n <salla-modal class=\"s-booking-field-modal\" ref={modal => (this.modal = modal)} width=\"md\" position=\"middle\" noPadding>\n <iframe ref={iframe => (this.iframe = iframe)} src={this.bookingUrl} frameborder=\"0\"></iframe>\n </salla-modal>\n );\n }\n\n renderReservationDate(reservation: Reservation) {\n return (\n <span class={reservation.from_timestamp ? 's-booking-field-reservations-has-time' : ''}>\n <i class=\"s-booking-field-reservations-icon\" innerHTML={Calendar}></i>\n {reservation.date}\n </span>\n );\n }\n\n renderReservationTime(reservation: Reservation) {\n if (!reservation.from_timestamp) return '';\n return (\n <span class=\"s-booking-field-reservations-time\">\n <i class=\"s-booking-field-reservations-icon\" innerHTML={TimeIcon}></i>\n <span>\n {reservation.from_timestamp} - {reservation.to_timestamp}\n </span>\n </span>\n );\n }\n\n render() {\n return (\n <Host>\n <div class=\"s-booking-field-main\">\n {this.option.required || this.reservations.length > 0 ? <div class=\"s-booking-field-price\">\n <span>{salla.money(this.option.price)}</span>\n </div> : ''}\n <salla-button class=\"s-booking-field-book-now\" size=\"small\" loaderPosition=\"center\" fill=\"outline\" onClick={event => this.openBookingModal(event, false)}>\n <span class=\"s-booking-field-book-now-content\">\n <span innerHTML={BookingTime}></span>\n {this.reservations.length ? this.editLabel : this.bookNowLabel}\n </span>\n </salla-button>\n </div>\n {this.reservations.length > 0 && (\n <div class=\"s-booking-field-reservations\">\n {this.reservations.map((reservation, index) => (\n <div key={index} class=\"s-booking-field-reservations-item\">\n {this.renderReservationDate(reservation)}\n {this.renderReservationTime(reservation)}\n </div>\n ))}\n </div>\n )}\n <input\n class=\"s-hidden\"\n name={this.option.name}\n required={this.option.required}\n value={JSON.stringify(this.reservations) === '[]' ? '' : JSON.stringify(this.reservations)}\n ref={reservations => this.reservationsInput = reservations}\n />\n {this.iframeReady && this.bookingModal()}\n </Host>\n );\n }\n}\n","import { Component, Element, Host, Listen, h } from '@stencil/core';\n\n/**\n * its to easy to use, currenlty its support select & checkbox input as trigger for show/hide the dom\n * the dom you can put it like this data-show-when=\"{name of the field} {= or !=} {value of the field}\"\n */\n@Component({\n tag: 'salla-conditional-fields'\n})\nexport class SallaConditionalFields {\n\n @Element() host: HTMLElement;\n\n private hideAllOptions(optionId) {\n this.host.querySelectorAll(`[data-show-when^=\"options[${optionId}\"]`).forEach((field: HTMLElement) => {\n field.classList.add('hidden');\n this.hideAllOptions(field.dataset.optionId);\n this.disableInputs(field);\n });\n }\n\n private disableInputs(field) {\n field.querySelectorAll('[name]').forEach((input) => {\n\n input.setAttribute('disabled', '');\n input.removeAttribute('required');\n if (input?.tagName?.toLowerCase() === 'select') {\n input.value = ''\n }\n if (['checkbox'].includes(input.getAttribute('type')) && input.hasOwnProperty('checked')) {\n // @ts-ignore\n input.checked = false;\n }\n });\n }\n \n @Listen('change')\n changeHandler(event) {\n salla.event.emit('salla-onditional-fields::change', event);\n salla.log('Received the change event: ', event);\n\n if (!event.target || !['SELECT'].includes(event.target.tagName) && !['checkbox', 'radio'].includes(event.target.getAttribute('type'))) {\n salla.log('Ignore the change because is not a supported input: ' + (event?.target?.tagName || 'N/A'));\n return;\n }\n\n let optionId = event.target.name.replace('[]', '');\n let isMultiple = event.target.getAttribute('type') === 'checkbox';\n let isRadio = event.target.getAttribute('type') === 'radio';\n\n salla.log('Trying to find all elements with condition:', `[data-show-when^=\"${optionId}\"]`);\n\n this.host.querySelectorAll(`[data-show-when^=\"${optionId}\"]`)\n .forEach((field: HTMLElement) => {\n let isEqual = !field?.dataset.showWhen.includes('!=');\n let value = field?.dataset.showWhen.replace(/(.*)(=|!=)(.*)/gm, '$3').trim();\n let isSelected;\n if (isMultiple) {\n let selectedValues = Array.from(this.host.querySelectorAll(`input[name=\"${event.target.name}\"]:checked`), e => (e as HTMLInputElement)?.value);\n isSelected = selectedValues.includes(value.toString());\n } else if (isRadio) {\n // Handle radio inputs.\n isSelected = event.target.checked && event.target.value === value;\n } else {\n isSelected = value === event.target.value;\n }\n\n salla.log('The input is ', isMultiple ? 'Multiple' : isRadio ? 'Radio' : 'Single', ' value:', isSelected);\n\n let showTheInput = (isEqual && isSelected) || (!isEqual && !isSelected);\n if (showTheInput) {\n field.classList.remove('hidden');\n field.querySelectorAll('[name]').forEach((input) => {\n input.removeAttribute('disabled');\n\n const closestProductOption = (input as HTMLInputElement).closest('.s-product-options-option') as HTMLElement;\n if (closestProductOption.dataset.optionRequired === 'true') {\n input.setAttribute('required', '');\n }\n\n if (input.getAttribute('type') === 'checkbox') {\n const checkboxes = Array.from(document.querySelectorAll(`input[type=\"checkbox\"][name=\"${input.getAttribute('name')}\"]`)) as HTMLInputElement[];\n const isAnyChecked = checkboxes.some((checkbox) => checkbox.checked);\n if (isAnyChecked) {\n checkboxes.forEach((checkbox) => {\n checkbox.removeAttribute('required');\n });\n }\n }\n });\n } else {\n this.hideAllOptions(field.dataset.optionId);\n field.classList.add('hidden');\n this.disableInputs(field);\n }\n });\n } \n\n componentDidRender() {\n this.host.querySelectorAll(`[data-show-when]`).forEach((field) => {\n // @ts-ignore\n let optionName = field?.dataset?.showWhen.replace(/(.*)(=|!=)(.*)/gm, '$1').trim();\n if (!optionName) {\n return;\n }\n\n this.changeHandler({\n target: this.host.querySelector('[name^=\"' + optionName + '\"]')\n })\n });\n }\n\n render() {\n return (\n <Host>\n <slot></slot>\n </Host>\n );\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAAA,MAAM,oBAAoB,GAAG,sBAAsB;;YCUtC,iBAAiB,kCAAA,MAAA;MA2B5B,IAAA,WAAA,CAAA,OAAA,EAAA;;;MAjBS,QAAA,IAAY,CAAA,YAAA,GAAW,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,gC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A,0CAAA,EAAA,EACH,CAAa,CAAA,MAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAA,CAAA,CACR;;;;;;;;;;;"}
@@ -1,5 +0,0 @@
1
- /*!
2
- * Crafted with ❤ by Salla
3
- */
4
- import{r as e,c as t,h as s,H as i}from"./p-EWYMQsdr.js";const a="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}";const c=class{constructor(s){e(this,s);this.prizeItemSelected=t(this,"prizeItemSelected")}onPrizeItemClick(){this.prizeItemSelected.emit(this.item)}render(){return s(i,{key:"5434064e3e54117f4df4e16282f70e81503d7489"},s("div",{key:"28b5a19dcd1f239a74d69e91a1cda66ae7521e8e",onClick:this.onPrizeItemClick.bind(this)},s("img",{key:"82917e0074006f4e462b2328405714a31d168c17",class:"s-loyalty-prize-item-image",src:this.item.image,alt:this.item.name}),s("div",{key:"089ac134ed2a0474067c79cd590154ca85a380c9",class:"s-loyalty-prize-item-title"},this.item.name),s("div",{key:"85d245c32c42701274fa29761c4345020532eac1",class:"s-loyalty-prize-item-subtitle"},this.item.description),s("div",{key:"5f37781c8c77998a0bb586ddcda4640741db0b6e",class:"s-loyalty-prize-item-points"},this.item.cost_points," Points")))}};c.style=a;export{c as salla_loyalty_prize_item};
5
- //# sourceMappingURL=p-a22b72f6.entry.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["sallaBookingFieldCss","SallaBookingField","exports","class_1","hostRef","_this","this","bookNowLabel","salla","lang","get","editLabel","bookedLabel","selectDate","bookingUrl","iframeReady","reservations","onLoaded","setTranslations","Salla","event","on","data","handleBookingOpen","prototype","setNestedAsync","key","value","Promise","resolve","helpers","setNested","messages","_c","sent","openBookingModal","afterReload","detail","productId","config","isGuest","setAfterReloadEvent","dispatch","booking","add","then","resp","redirect","to","Error","url","id","catch","error","logger","response","addParamToUrl","setTimeout","modal","setTitle","open","payload","storage","set","emitAfterReloadEvent","eventDetails","customEvent","CustomEvent","window","dispatchEvent","remove","componentWillLoad","option","details","length","componentDidLoad","addEventListener","handleMessageEvent","bind","reservationsInput","e","invalidInput","emit","setCustomValidity","reportValidity","source","action","type","message","localStorage","getItem","console","log","concat","_a","fields","reservation","notify","errorList","Object","values","flat","map","join","Number","schedule","time","timeSlot","date","day","from_timestamp","from","to_timestamp","filter","item","success","_b","close","location","reload","iframe","height","bookingModal","h","class","ref","width","position","noPadding","src","frameborder","renderReservationDate","innerHTML","Calendar","renderReservationTime","TimeIcon","render","Host","required","money","price","size","loaderPosition","fill","onClick","BookingTime","index","name","JSON","stringify","SallaConditionalFields","class_2","hideAllOptions","optionId","host","querySelectorAll","forEach","field","classList","dataset","disableInputs","input","setAttribute","removeAttribute","tagName","toLowerCase","includes","getAttribute","hasOwnProperty","checked","changeHandler","target","replace","isMultiple","isRadio","isEqual","showWhen","trim","isSelected","selectedValues","Array","toString","showTheInput","closestProductOption","closest","optionRequired","checkboxes","document","isAnyChecked","some","checkbox","componentDidRender","optionName","querySelector"],"sources":["src/components/salla-booking-field/salla-booking-field.scss?tag=salla-booking-field","src/components/salla-booking-field/salla-booking-field.tsx","src/components/salla-conditional-fields/salla-conditional-fields.tsx"],"sourcesContent":[":host {\n display: block;\n}\n","import { Component, Host, Prop, h, Element, State, Event, EventEmitter } from '@stencil/core';\nimport { Option, Reservation } from './interfaces';\nimport BookingTime from '../../assets/svg/calendar-time.svg';\nimport Calendar from '../../assets/svg/calendar.svg';\nimport TimeIcon from '../../assets/svg/time.svg';\n\n@Component({\n tag: 'salla-booking-field',\n styleUrl: 'salla-booking-field.scss',\n})\nexport class SallaBookingField {\n /**\n * The booking option configuration\n */\n @Prop() option: Option;\n /**\n * The ID of the product for which the booking is being made\n */\n @Prop() productId: number;\n @Element() host: HTMLElement;\n @State() bookNowLabel: string = salla.lang.get('pages.cart.book_an_appointment', 'حجز موعد');\n @State() editLabel: string = salla.lang.get('pages.cart.edit_an_appointment', 'تعديل الموعد');\n @State() bookedLabel: string = salla.lang.get('pages.cart.booked_successfully', 'تمت اضافة الموعد بنجاح');\n @State() selectDate: string = salla.lang.get('pages.cart.select_appointment_date', 'حدد تاريخ الموعد');\n @State() bookingUrl: string = '';\n @State() iframeReady: boolean = false;\n @State() reservations: Reservation[] = [];\n @State() reservationsInput: HTMLInputElement;\n\n /**\n * Event emitted when the input is invalid.\n */\n @Event() invalidInput: EventEmitter<any>;\n\n private modal: HTMLSallaModalElement;\n private iframe: HTMLIFrameElement;\n\n constructor() {\n // Load translations\n salla.lang.onLoaded(() => this.setTranslations());\n // Register event listeners\n Salla.event.on('booking::open', (data) => this.handleBookingOpen(data));\n }\n\n private async setTranslations() {\n const setNestedAsync = (lang, key, value) => {\n return new Promise((resolve) => {\n salla.helpers.setNested(salla.lang.messages[lang], key, value);\n resolve(true);\n });\n };\n\n await setNestedAsync('ar.trans', 'pages.cart.book_an_appointment', 'حجز موعد');\n await setNestedAsync('en.trans', 'pages.cart.book_an_appointment', 'Book an Appointment');\n await setNestedAsync('ar.trans', 'pages.cart.edit_an_appointment', 'تعديل الموعد');\n await setNestedAsync('en.trans', 'pages.cart.edit_an_appointment', 'Edit an Appointment');\n await setNestedAsync('ar.trans', 'pages.cart.booked_successfully', 'تمت اضافة الموعد بنجاح');\n await setNestedAsync('en.trans', 'pages.cart.booked_successfully', 'Booked Successfully');\n await setNestedAsync('ar.trans', 'pages.cart.select_appointment_date', 'حدد تاريخ الموعد');\n await setNestedAsync('en.trans', 'pages.cart.select_appointment_date', 'Select appointment date');\n\n this.bookNowLabel = salla.lang.get('pages.cart.book_an_appointment');\n this.editLabel = salla.lang.get('pages.cart.edit_an_appointment');\n this.bookedLabel = salla.lang.get('pages.cart.booked_successfully');\n this.selectDate = salla.lang.get('pages.cart.select_appointment_date');\n }\n\n private openBookingModal(event: any, afterReload = false) {\n if (afterReload && (!event.detail || typeof event.detail !== 'number' || event.detail !== this.productId)) {\n return;\n }\n if (salla.config.isGuest()) {\n this.setAfterReloadEvent('booking::open-after-reload', this.productId);\n salla.event.dispatch('login::open');\n return;\n }\n salla.booking.add(this.productId, false)\n .then((resp) => {\n if (resp.data.redirect.to !== 'booking') {\n throw new Error('Unexpected redirect!');\n }\n salla.event.dispatch('booking::open', { url: resp.data.redirect.url, id: this.productId });\n })\n .catch((error) => {\n salla.error(salla.lang.get('common.errors.error_occurred'));\n salla.logger.error(error.response || error);\n });\n }\n\n private handleBookingOpen(data) {\n if (data.id !== this.productId) return;\n this.bookingUrl = salla.url.addParamToUrl('product_id', data.id, data.url);\n this.iframeReady = true;\n setTimeout(() => {\n this.modal.setTitle(this.selectDate);\n this.modal.open();\n }, 100);\n }\n\n private setAfterReloadEvent(event, payload) {\n salla.storage.set('afterReloadEvent', { event, payload });\n }\n\n private emitAfterReloadEvent() {\n const eventDetails = salla.storage.get('afterReloadEvent');\n if (eventDetails && eventDetails.event) {\n const customEvent = new CustomEvent(eventDetails.event, {\n detail: eventDetails.payload\n });\n window.dispatchEvent(customEvent)\n salla.storage.remove('afterReloadEvent');\n }\n }\n\n componentWillLoad() {\n if (this.option && this.option.details.length) {\n this.reservations = this.option.details;\n }\n }\n\n componentDidLoad() {\n window.addEventListener('booking::open-after-reload', (event) => this.openBookingModal(event, true));\n this.emitAfterReloadEvent();\n window.addEventListener('message', this.handleMessageEvent.bind(this));\n this.reservationsInput.addEventListener('invalid', e => this.invalidInput.emit(e));\n this.reservationsInput.addEventListener('input', () => {\n this.reservationsInput.setCustomValidity('');\n this.reservationsInput.reportValidity();\n });\n }\n\n private handleMessageEvent(event) {\n if (event.data.source !== 'booking') return;\n const action = event.data.type;\n const value = event.data.message;\n if (localStorage.getItem('debug')) console.log(`Received an action:${action}`, event.data);\n\n if (action === 'error') {\n if (value.fields?.reservation) {\n salla.notify.error(value.fields.reservation[0]);\n return;\n }\n const errorList = Object.values(value.fields || [value.message]).flat().map(error => `<li>${error}</li>`).join('');\n salla.notify.error(`<ul>${errorList}</ul>`);\n }\n\n if (action === 'success') {\n if (Number(value.productId) !== Number(this.productId)) return;\n this.reservations = value.data.reservations.map(schedule => {\n if (schedule.time && schedule.time.length > 0) {\n const timeSlot = schedule.time[0];\n return {\n date: schedule.date,\n day: schedule.day,\n from_timestamp: timeSlot.from,\n to_timestamp: timeSlot.to,\n };\n }\n return null;\n }).filter(item => item !== null);\n\n salla.notify.success(this.bookedLabel);\n this.modal?.close();\n setTimeout(() => window.location.reload());\n }\n\n if (action === 'height') {\n this.iframe.height = value?.height + 'px';\n }\n }\n\n private bookingModal() {\n return (\n <salla-modal class=\"s-booking-field-modal\" ref={modal => (this.modal = modal)} width=\"md\" position=\"middle\" noPadding>\n <iframe ref={iframe => (this.iframe = iframe)} src={this.bookingUrl} frameborder=\"0\"></iframe>\n </salla-modal>\n );\n }\n\n renderReservationDate(reservation: Reservation) {\n return (\n <span class={reservation.from_timestamp ? 's-booking-field-reservations-has-time' : ''}>\n <i class=\"s-booking-field-reservations-icon\" innerHTML={Calendar}></i>\n {reservation.date}\n </span>\n );\n }\n\n renderReservationTime(reservation: Reservation) {\n if (!reservation.from_timestamp) return '';\n return (\n <span class=\"s-booking-field-reservations-time\">\n <i class=\"s-booking-field-reservations-icon\" innerHTML={TimeIcon}></i>\n <span>\n {reservation.from_timestamp} - {reservation.to_timestamp}\n </span>\n </span>\n );\n }\n\n render() {\n return (\n <Host>\n <div class=\"s-booking-field-main\">\n {this.option.required || this.reservations.length > 0 ? <div class=\"s-booking-field-price\">\n <span>{salla.money(this.option.price)}</span>\n </div> : ''}\n <salla-button class=\"s-booking-field-book-now\" size=\"small\" loaderPosition=\"center\" fill=\"outline\" onClick={event => this.openBookingModal(event, false)}>\n <span class=\"s-booking-field-book-now-content\">\n <span innerHTML={BookingTime}></span>\n {this.reservations.length ? this.editLabel : this.bookNowLabel}\n </span>\n </salla-button>\n </div>\n {this.reservations.length > 0 && (\n <div class=\"s-booking-field-reservations\">\n {this.reservations.map((reservation, index) => (\n <div key={index} class=\"s-booking-field-reservations-item\">\n {this.renderReservationDate(reservation)}\n {this.renderReservationTime(reservation)}\n </div>\n ))}\n </div>\n )}\n <input\n class=\"s-hidden\"\n name={this.option.name}\n required={this.option.required}\n value={JSON.stringify(this.reservations) === '[]' ? '' : JSON.stringify(this.reservations)}\n ref={reservations => this.reservationsInput = reservations}\n />\n {this.iframeReady && this.bookingModal()}\n </Host>\n );\n }\n}\n","import { Component, Element, Host, Listen, h } from '@stencil/core';\n\n/**\n * its to easy to use, currenlty its support select & checkbox input as trigger for show/hide the dom\n * the dom you can put it like this data-show-when=\"{name of the field} {= or !=} {value of the field}\"\n */\n@Component({\n tag: 'salla-conditional-fields'\n})\nexport class SallaConditionalFields {\n\n @Element() host: HTMLElement;\n\n private hideAllOptions(optionId) {\n this.host.querySelectorAll(`[data-show-when^=\"options[${optionId}\"]`).forEach((field: HTMLElement) => {\n field.classList.add('hidden');\n this.hideAllOptions(field.dataset.optionId);\n this.disableInputs(field);\n });\n }\n\n private disableInputs(field) {\n field.querySelectorAll('[name]').forEach((input) => {\n\n input.setAttribute('disabled', '');\n input.removeAttribute('required');\n if (input?.tagName?.toLowerCase() === 'select') {\n input.value = ''\n }\n if (['checkbox'].includes(input.getAttribute('type')) && input.hasOwnProperty('checked')) {\n // @ts-ignore\n input.checked = false;\n }\n });\n }\n \n @Listen('change')\n changeHandler(event) {\n salla.event.emit('salla-onditional-fields::change', event);\n salla.log('Received the change event: ', event);\n\n if (!event.target || !['SELECT'].includes(event.target.tagName) && !['checkbox', 'radio'].includes(event.target.getAttribute('type'))) {\n salla.log('Ignore the change because is not a supported input: ' + (event?.target?.tagName || 'N/A'));\n return;\n }\n\n let optionId = event.target.name.replace('[]', '');\n let isMultiple = event.target.getAttribute('type') === 'checkbox';\n let isRadio = event.target.getAttribute('type') === 'radio';\n\n salla.log('Trying to find all elements with condition:', `[data-show-when^=\"${optionId}\"]`);\n\n this.host.querySelectorAll(`[data-show-when^=\"${optionId}\"]`)\n .forEach((field: HTMLElement) => {\n let isEqual = !field?.dataset.showWhen.includes('!=');\n let value = field?.dataset.showWhen.replace(/(.*)(=|!=)(.*)/gm, '$3').trim();\n let isSelected;\n if (isMultiple) {\n let selectedValues = Array.from(this.host.querySelectorAll(`input[name=\"${event.target.name}\"]:checked`), e => (e as HTMLInputElement)?.value);\n isSelected = selectedValues.includes(value.toString());\n } else if (isRadio) {\n // Handle radio inputs.\n isSelected = event.target.checked && event.target.value === value;\n } else {\n isSelected = value === event.target.value;\n }\n\n salla.log('The input is ', isMultiple ? 'Multiple' : isRadio ? 'Radio' : 'Single', ' value:', isSelected);\n\n let showTheInput = (isEqual && isSelected) || (!isEqual && !isSelected);\n if (showTheInput) {\n field.classList.remove('hidden');\n field.querySelectorAll('[name]').forEach((input) => {\n input.removeAttribute('disabled');\n\n const closestProductOption = (input as HTMLInputElement).closest('.s-product-options-option') as HTMLElement;\n if (closestProductOption.dataset.optionRequired === 'true') {\n input.setAttribute('required', '');\n }\n\n if (input.getAttribute('type') === 'checkbox') {\n const checkboxes = Array.from(document.querySelectorAll(`input[type=\"checkbox\"][name=\"${input.getAttribute('name')}\"]`)) as HTMLInputElement[];\n const isAnyChecked = checkboxes.some((checkbox) => checkbox.checked);\n if (isAnyChecked) {\n checkboxes.forEach((checkbox) => {\n checkbox.removeAttribute('required');\n });\n }\n }\n });\n } else {\n this.hideAllOptions(field.dataset.optionId);\n field.classList.add('hidden');\n this.disableInputs(field);\n }\n });\n } \n\n componentDidRender() {\n this.host.querySelectorAll(`[data-show-when]`).forEach((field) => {\n // @ts-ignore\n let optionName = field?.dataset?.showWhen.replace(/(.*)(=|!=)(.*)/gm, '$1').trim();\n if (!optionName) {\n return;\n }\n\n this.changeHandler({\n target: this.host.querySelector('[name^=\"' + optionName + '\"]')\n })\n });\n }\n\n render() {\n return (\n <Host>\n <slot></slot>\n </Host>\n );\n }\n}\n"],"mappings":";;;+tFAAA,IAAMA,EAAuB,uB,ICUhBC,EAAiBC,EAAA,iCA2B5B,SAAAC,EAAA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AWG,MAAK,SAACC,GAAa,OAAAA,EAASrB,OAAT,IACnD,GAAImB,EAAc,CAChBF,EAAW9B,SAAQ,SAACkC,GAClBA,EAAS3B,gBAAgB,WAC3B,G,EAGN,G,KACK,CACL9J,EAAKmJ,eAAeK,EAAME,QAAQN,UAClCI,EAAMC,UAAUlH,IAAI,UACpBvC,EAAK2J,cAAcH,E,CAEvB,G,EAGJN,EAAA/H,UAAAuK,mBAAA,eAAA1L,EAAAC,KACEA,KAAKoJ,KAAKC,iBAAiB,oBAAoBC,SAAQ,SAACC,G,MAEtD,IAAImC,GAAalG,EAAA+D,IAAK,MAALA,SAAK,SAALA,EAAOE,WAAO,MAAAjE,SAAA,SAAAA,EAAEkF,SAASJ,QAAQ,mBAAoB,MAAMK,OAC5E,IAAKe,EAAY,CACf,M,CAGF3L,EAAKqK,cAAc,CACjBC,OAAQtK,EAAKqJ,KAAKuC,cAAc,WAAaD,EAAa,OAE9D,G,EAGFzC,EAAA/H,UAAAgH,OAAA,WACE,OACEb,EAACc,EAAI,CAAA/G,IAAA,4CACHiG,EAAa,QAAAjG,IAAA,6C,yHA1Gc,G","ignoreList":[]}
@@ -1,5 +0,0 @@
1
- /*!
2
- * Crafted with ❤ by Salla
3
- */
4
- System.register(["./p-BU23HIMq.system.js"],(function(s){"use strict";var e,r,t;return{setters:[function(s){e=s.r;r=s.h;t=s.g}],execute:function(){var a;(function(s){s["ProductDetail"]="product.single";s["Cart"]="cart"})(a||(a={}));var n;(function(s){s["Conditional"]="conditional";s["PercentageOrFixed"]="fixed";s["DiscountsTable"]="discounts_table";s["Bank"]="bank";s["BuyXGetY"]="buy_x_get_y"})(n||(n={}));var i='.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 l=s("salla_offer",function(){function s(s){var r=this;e(this,s);var t;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(s){return salla.lang.get("pages.offer.buy_quantity",{quantity:s})};salla.lang.onLoaded((function(){r.offer_with_price_text=salla.lang.get("pages.offer.with_price");r.with_discount_text=salla.lang.get("pages.products.with_a_discount");r.product_discount_text=salla.lang.get("pages.products.discount");r.special_offer_text=salla.lang.get("pages.products.special_offer");r.multipleBankOfferTitleText=salla.lang.get("pages.offer.multiple_bank_offers_title");r.multipleBankOfferTitleDescription=salla.lang.get("pages.offer.multiple_bank_offers_message");r.buy_quantity_text(0)}));salla.onReady((function(){r.currentPage=salla.config.get("page.slug");r.userCurrency=salla.config.get("currencies")[salla.config.get("user.currency_code")].symbol}));this.categorySlot=((t=this.host.querySelector('[slot="category"]'))===null||t===void 0?void 0:t.innerHTML)||'<a href={url} class="s-offer-slide-cat-entry"><i class={icon}></i><h4>{name}</h4></a>'}s.prototype.getEndpointByPageName=function(){var s;return(s={},s[a.Cart]="offers/cart/".concat(salla.storage.get("cart.id")),s[a.ProductDetail]="offers/product/".concat(salla.config.get("page.id")),s)[this.currentPage]||"offers"};s.prototype.componentWillLoad=function(){var s=this;this.hasCustomComponent=!!customElements.get(this.productCardComponent);return new Promise((function(s){return salla.onReady(s)})).then((function(){s.showOffer=!salla.url.is_page("product.single")||salla.config.get("store.settings.product.show_special_offers");if(s.showOffer){return}throw new Error("Merchant disabled showing the offers on product page")})).then((function(){return salla.api.request(s.getEndpointByPageName())})).then((function(e){if(!(s.offersList=e.data).length){throw new Error("salla-offers:: There is no offers!")}var r=s.offersList.find((function(s){return[n.Bank,n.BuyXGetY,n.DiscountsTable].includes(s.type)}));if(!r){throw new Error("salla-offers:: Offer type not supported yet!")}if(r.type===n.DiscountsTable){return s.offersList=[r]}if(s.isBankOffer=r.type===n.Bank){s.offersList=s.offersList.filter((function(s){return s.type===n.Bank}));s.isMultipleBank=s.offersList.length>1;return s.offersList}var t=r.details.get;return t.source==="products"?salla.product.api.fetch({source:"selected",source_value:t.source_value}).then((function(e){t.products=e.data;r.details.get=t;return s.offersList=[r]})):salla.product.api.categories().then((function(e){t.categories=s.findCategories(e.data,t.source_value);r.details.get=t;return s.offersList=[r]}))})).then((function(e){salla.storage.set(s.getStorageKey(),{offers:e,stored_at:(new Date).getTime()});s.canRender=true})).catch((function(s){salla.logger.warn(s)}))};s.prototype.componentDidLoad=function(){var s=this.host.querySelector(".s-slider-block__title-nav");s===null||s===void 0?void 0:s.classList.add("s-offer-bank-payment-nav")};s.prototype.findCategories=function(s,e){var r;var t=[];for(var a=0,n=s;a<n.length;a++){var i=n[a];if(e.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,e))}}return t};s.prototype.getStorageKey=function(){try{var s=salla.config.get("page.slug").replace(".","_");var e=salla.lang.getLocale();var r=salla.config.currency().code;if(!s||!e||!r){throw new Error("Unable to get the storage key.")}return"s-offers-".concat(s,"-").concat(salla.config.get("page.id"),"-").concat(e,"-").concat(r)}catch(s){return""}};s.prototype.getOffersFromStorage=function(){var s=salla.storage.get(this.getStorageKey());if(!s||s.stored_at<(new Date).getTime()-10*60*1e3){salla.storage.remove(this.getStorageKey());return null}this.canRender=true;return Promise.resolve(s.offers)};s.prototype.render=function(){if(!this.offersList.length||!this.canRender||!this.showOffer)return null;var s=this.offersList[0];var e=this.isBankOffer?this.isMultipleBank?this.multipleBankOfferTitleText:null:s.title;var t=this.isBankOffer?this.isMultipleBank?this.multipleBankOfferTitleDescription:null:s.description;var a={"block-title":e,"block-subTitle":t,"show-controls":this.isMultipleBank};return r("div",{class:"s-offer-wrapper"},r("p",{class:"s-offer-corner-badge"},this.special_offer_text),r("salla-slider",Object.assign({type:"carousel",id:"offer-slider"},a),r("div",{slot:"items"},this.renderSectionForOfferType(s.type))))};s.prototype.renderSectionForOfferType=function(s){if(this.isBankOffer){return this.renderBankSection()}if(s==n.BuyXGetY){return this.renderBuyXGetYSection()}return this.renderDiscountTableSection()};s.prototype.getCategoriesSection=function(s){return r("div",{class:"s-offer-slide-one-sixth swiper-slide",innerHTML:this.categorySlot.replace(/\{url\}/g,s.url).replace(/\{icon\}/g,s.icon||"sicon-store").replace(/\{name\}/g,s.name)})};s.prototype.renderBuyXGetYSection=function(){var s=this;var e,t;var a=this.offersList[0].details;return[(e=a.get.products)===null||e===void 0?void 0:e.map((function(e){return r("div",{class:"s-offer-slide-one-fourth"},s.hasCustomComponent?r(s.productCardComponent,{product:e}):r("salla-product-card",{"shadow-on-hover":true,product:e}))})),(t=a.get.categories)===null||t===void 0?void 0:t.map((function(e){return s.getCategoriesSection(e)}))]};s.prototype.renderBankSection=function(){var s=this;return this.offersList.map((function(e){return r("div",{class:{"s-offer-slide-one-sixth":s.isMultipleBank,"s-offer-bank-wrapper-sinlge-item":!s.isMultipleBank}},r("div",{class:{"s-offer-bank-wrapper":true,"s-offer-slide-one-sixth":!s.isMultipleBank,"s-offer-bank-wrapper-multi-spacer":s.isMultipleBank}},r("div",{class:"s-offer-bank-logo"},r("img",{src:e.details.logo||salla.url.cdn("images/s-empty.png"),"data-src":e.details.logo,alt:e.title+" offer"})),r("ul",{class:"s-offer-bank-payment-wrapper"},e.details.payments.map((function(s){return r("li",{class:"s-offer-bank-payment-single"},r("img",{src:salla.url.cdn("images/payment/"+s+".png")||salla.url.cdn("images/s-empty.png"),"data-src":salla.url.cdn("images/payment/"+s+".png"),alt:"payment"}))}))),s.isMultipleBank?r("p",{class:"s-offer-bank-payment-discount-percent"},"".concat(s.product_discount_text," ").concat(e.details.discount_value).concat(e.details.discount_type==="percentage"&&"%")):""),!s.isMultipleBank?r("div",{class:"s-offer-bank-message s-offer-slide-one-fourth"},r("h2",null,s.offersList[0].title),r("p",{innerHTML:s.generateBankDescription(s.offersList[0].description,e.details.discount_value)})):"")}))};s.prototype.generateBankDescription=function(s,e){return s.replace(new RegExp("".concat(e," %")),'<span class="s-offer-bank-message-amount">'.concat(e," %</span>"))};s.prototype.renderDiscountTableSection=function(){var s=this;var e;var t=this.offersList[0];var a=t.details.show_price_after_discount;return(e=this.offersList[0].details.discounts)===null||e===void 0?void 0:e.map((function(e){return r("div",{class:"s-offer-slide-one-fourth"},r("div",{class:"s-offer-slide-offer-entry"},r("div",{class:"s-offer-slide-offer-entry-price-quantity-container"},r("p",{class:"s-offer-slide-offer-entry-quantity"},s.buy_quantity_text(e.quantity)),a?r("div",{class:"s-offer-slide-offer-entry-price"},r("span",null,s.offer_with_price_text),r("span",{class:"s-offer-slide-offer-entry-price-amount"},e.discounted_amount)," ",r("span",null,s.userCurrency)):""),r("p",{class:"s-offer-slide-offer-entry-price-amount-percent"},s.with_discount_text,"(",r("span",null,e.percentage,!!e.percentage&&"%"),")")))}))};Object.defineProperty(s.prototype,"host",{get:function(){return t(this)},enumerable:false,configurable:true});return s}());l.style=i}}}));
5
- //# sourceMappingURL=p-d0122bff.system.entry.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["PageType","OfferType","sallaOfferCss","SallaOffer","exports","class_1","hostRef","_this","this","productCardComponent","offersList","isMultipleBank","isBankOffer","canRender","showOffer","salla","config","get","offer_with_price_text","lang","price","with_discount_text","product_discount_text","special_offer_text","multipleBankOfferTitleText","multipleBankOfferTitleDescription","buy_quantity_text","quantity","onLoaded","onReady","currentPage","userCurrency","symbol","categorySlot","_a","host","querySelector","innerHTML","prototype","getEndpointByPageName","_c","Cart","concat","storage","ProductDetail","componentWillLoad","hasCustomComponent","customElements","Promise","resolve","then","url","is_page","Error","api","request","res","data","length","offer","find","Bank","BuyXGetY","DiscountsTable","includes","type","filter","getY","details","source","product","fetch","source_value","response","products","categories","findCategories","offers","set","getStorageKey","stored_at","Date","getTime","catch","error","logger","warn","componentDidLoad","nav","classList","add","ids","found","_i","categories_1","category","id_","id","push","sub_categories","pageSlug","replace","locale","getLocale","currencyCode","currency","code","getOffersFromStorage","storageOffers","remove","render","blockTitle","title","blockSubTitle","description","titles","h","class","Object","assign","slot","renderSectionForOfferType","offerType","renderBankSection","renderBuyXGetYSection","renderDiscountTableSection","getCategoriesSection","icon","name","map","_b","bankOffer","src","logo","cdn","alt","payments","payment","discount_value","discount_type","generateBankDescription","desc","value","RegExp","show_discounted_price","show_price_after_discount","discounts","discount","discounted_amount","percentage"],"sources":["src/components/salla-offer/interfaces.ts","src/components/salla-offer/salla-offer.scss?tag=salla-offer","src/components/salla-offer/salla-offer.tsx"],"sourcesContent":["export enum PageType {\n ProductDetail = \"product.single\",\n Cart = \"cart\"\n}\n\nexport enum OfferType {\n Conditional = \"conditional\",\n PercentageOrFixed = \"fixed\",\n DiscountsTable = \"discounts_table\",\n Bank = \"bank\",\n BuyXGetY = \"buy_x_get_y\"\n}\n\n\nexport interface DiscountDetailFixed {\n discount_type: \"fixed\";\n min_spend: number;\n discount_value: number;\n}\n\nexport interface DiscountDetailFreeProduct {\n discount_type: \"free_product\";\n min_spend: number;\n discount_value: number;\n}\n\nexport interface DiscountDetailConditional extends Array<DiscountDetailFixed | DiscountDetailFreeProduct> {}\n\nexport interface DiscountDetailPercentageFixed {\n apply_to: \"all\" | \"products\" | \"categories\" | \"payment_methods\";\n targets: Array<string | number>;\n ends_at: number;\n min_spend: number;\n discount_value: number;\n}\n\nexport interface Discount {\n discounted_amount: any;\n quantity: number;\n percentage: number;\n}\n\nexport interface DiscountDetailTable {\n apply_to: \"all\" | \"products\" | \"categories\" | \"payment_methods\" | \"order\";\n discount_value: number;\n ends_at: string;\n min_items: number;\n min_spend: number;\n show_price_after_discount: boolean;\n discounts: Discount[];\n}\n\nexport interface BankOffer {\n logo: string;\n discount_value: number;\n discount_type: string;\n minimum_spend: number;\n payments: string[];\n}\n\nexport interface BuyXGetYDetail {\n ends_at: number;\n buy: {\n source: \"product\" | \"category\";\n source_value: number[];\n quantity: number;\n };\n get: {\n source: \"products\" | \"category\";\n source_value: number[];\n type: \"free_product\" | \"percentage\" | \"fixed\";\n value: number;\n products?: Product[];//we will set this dynamically\n categories?: Category[];//we will set this dynamically\n };\n}\n\nexport interface Offer {\n id: number;\n title: string;\n description: string;\n type: OfferType | \"conditional\" | \"fixed\" | \"discounts_table\" | \"bank\" | \"buy_x_get_y\";\n details: DiscountDetailConditional | DiscountDetailPercentageFixed | DiscountDetailTable | BankOffer | BuyXGetYDetail;\n}\n\nexport interface Product {\n id: number;\n type: string;\n status: string;\n is_available: boolean;\n sku: string;\n name: string;\n price: { amount: number; currency: string; };\n promotion: { title: string; sub_title: string; };\n sale_price: { amount: number; currency: string; };\n regular_price: { amount: number; currency: string; };\n currency: string;\n url: string;\n thumbnail: string;\n has_special_price: boolean;\n favorite?: any;\n}\n\nexport interface Category {\n id?: string;\n id_?: number;\n name?: string;\n url?: string;\n icon?: string;\n sub_categories?: Category[];\n items?: any[] | null;\n}\n\nexport interface Currency {\n code: string | 'SAR';\n name: string;\n symbol: string;\n amount?: number;\n country_code?: string;\n}\n",".s-offer-wrapper .s-slider-block__title {\n h2 {\n font-size: 1.125rem;\n line-height: 1.75rem;\n color: #f87171;\n\n &::before {\n font-family: \"sallaicons\";\n content: \"\\ee30\" !important;\n position: absolute;\n top: 1rem;\n font-size: 3rem;\n font-weight: 400;\n line-height: 1;\n color: #fef2f2;\n }\n }\n}\n\n.s-offer-bank-wrapper-sinlge-item{\n display: flex;\n align-items: center !important;\n gap: 14px;\n}\n\n.s-offer-bank-wrapper {\n display: flex !important;\n width: 100% !important;\n}\n\n// .s-offer-bank-wrapper {\n // \n// }","import { Component, Element, Prop, State, h } from '@stencil/core';\nimport { Offer, Category, Product, Discount, Currency, BuyXGetYDetail, PageType, OfferType, BankOffer, DiscountDetailTable } from './interfaces';\n\n\n/**\n * `salla-offer` is a StencilJS component that displays offers, categories, products, banks, and discount information.\n * It uses the `salla-slider` component for carousel functionality.\n *\n * @slot category - The slot for customizing the category entry layout.\n * \n * @csspart custom - Custom CSS part to target specific elements in the component.\n *\n * @example\n * <salla-offer product-id=\"123\"></salla-offer>\n */\n@Component({\n tag: 'salla-offer',\n styleUrl: 'salla-offer.scss',\n})\nexport class SallaOffer {\n\n constructor() {\n // Language\n salla.lang.onLoaded(() => {\n this.offer_with_price_text = salla.lang.get('pages.offer.with_price');\n this.with_discount_text = salla.lang.get('pages.products.with_a_discount');\n this.product_discount_text = salla.lang.get('pages.products.discount');\n this.special_offer_text = salla.lang.get('pages.products.special_offer');\n this.multipleBankOfferTitleText = salla.lang.get('pages.offer.multiple_bank_offers_title');\n this.multipleBankOfferTitleDescription = salla.lang.get('pages.offer.multiple_bank_offers_message');\n this.buy_quantity_text(0);\n })\n\n salla.onReady(() => {\n this.currentPage = salla.config.get('page.slug')\n this.userCurrency = salla.config.get('currencies')[salla.config.get('user.currency_code')].symbol\n });\n\n this.categorySlot = this.host.querySelector('[slot=\"category\"]')?.innerHTML || '<a href={url} class=\"s-offer-slide-cat-entry\"><i class={icon}></i><h4>{name}</h4></a>';\n }\n\n /**\n * Custom Card Component for the Salla Products List.\n *\n * This component allows you to customize the appearance of individual product cards within a Salla Products List.\n *\n * @example\n * <salla-products-list product-card-component=\"my-custom-card-style1\" ...\n * <salla-products-list product-card-component=\"my-custom-card-style2\" ...\n */\n @Prop() productCardComponent: string = 'custom-salla-product-card';\n\n // Declare component state variables\n @State() offersList: Offer[] = [];\n @State() userCurrency: Currency;\n @State() isMultipleBank: boolean = false;\n @State() title?: string;\n @State() currentPage: string;\n @State() hasCustomComponent: boolean;\n\n @State() isBankOffer: boolean = false;\n @State() canRender: boolean = false;\n @State() showOffer: boolean = salla.config.get('store.settings.product.show_special_offers');\n\n // Default translated texts\n @State() offer_with_price_text: string = salla.lang.get('pages.offer.with_price', { price: '' });\n @State() with_discount_text: string = salla.lang.get('pages.products.with_a_discount')\n @State() product_discount_text: string = salla.lang.get('pages.products.discount')\n @State() special_offer_text: string = salla.lang.get('pages.products.special_offer')\n @State() multipleBankOfferTitleText: string = salla.lang.get('pages.offer.multiple_bank_offers_title')\n @State() multipleBankOfferTitleDescription: string = salla.lang.get('pages.offer.multiple_bank_offers_message')\n @State() buy_quantity_text: (quantity: number) => string = (quantity) => salla.lang.get('pages.offer.buy_quantity', { quantity })\n\n // Reference to the host element\n @Element() host: HTMLElement;\n\n private categorySlot: string;\n\n private getEndpointByPageName(): string {\n return {\n [PageType.Cart]: `offers/cart/${salla.storage.get('cart.id')}`,\n [PageType.ProductDetail]: `offers/product/${salla.config.get('page.id')}`,\n }[this.currentPage] || \"offers\";\n }\n\n componentWillLoad() {\n this.hasCustomComponent = !!customElements.get(this.productCardComponent);\n // let offers = this.getOffersFromStorage();\n // if (offers) {\n // return offers.then(offersFromStorage => this.offersList = offersFromStorage);\n // }\n\n return (new Promise(resolve => salla.onReady(resolve)))\n .then(() => {\n this.showOffer = !salla.url.is_page('product.single') || salla.config.get('store.settings.product.show_special_offers')\n if (this.showOffer) {\n return;\n }\n throw new Error(\"Merchant disabled showing the offers on product page\");\n }\n )\n .then(() => salla.api.request(this.getEndpointByPageName()))\n .then((res) => {\n if (!(this.offersList = res.data).length) {\n throw new Error('salla-offers:: There is no offers!');\n }\n //we support these offers only\n const offer = this.offersList.find(offer => [OfferType.Bank, OfferType.BuyXGetY, OfferType.DiscountsTable].includes(offer.type as any));\n if (!offer) {\n throw new Error('salla-offers:: Offer type not supported yet!');\n }\n //because there is no need for special handling for discounts table, just skip the other cases\n if (offer.type === OfferType.DiscountsTable) {\n return this.offersList = [offer];\n }\n\n //if it's banks offer, we need to include the other banks overs\n if ((this.isBankOffer = offer.type === OfferType.Bank)) {\n this.offersList = this.offersList.filter(offer => offer.type === OfferType.Bank);\n this.isMultipleBank = this.offersList.length > 1;\n return this.offersList;\n }\n //BuyXGetY offers\n const getY = (offer.details as BuyXGetYDetail).get;\n\n return getY.source === 'products'\n //todo:: avoid this request, and the handling for the products, just use `salla-products-slider` and don't forget to pass the customcard\n ? salla.product.api.fetch({ source: \"selected\", source_value: getY.source_value })\n .then((response: any) => {\n getY.products = response.data;\n (offer.details as any).get = getY;\n return this.offersList = [offer];\n })//set the products\n : salla.product.api.categories()//get all categories in one query, then extract only the selected one, instead of sending multi requests\n .then((res) => {\n getY.categories = this.findCategories(res.data, getY.source_value);\n (offer.details as any).get = getY;\n return this.offersList = [offer];\n });\n })\n .then((offers: Offer[]) => {\n salla.storage.set(this.getStorageKey(), { offers, stored_at: new Date().getTime() });\n this.canRender = true;\n })\n .catch((error) => {\n salla.logger.warn(error)\n });\n }\n\n componentDidLoad() {\n let nav = this.host.querySelector('.s-slider-block__title-nav');\n nav?.classList.add(\"s-offer-bank-payment-nav\")\n }\n\n\n findCategories(categories: Category[], ids: any[]): Category[] {\n let found: Category[] = [];\n\n for (const category of categories) {\n if (ids.includes(category.id_ || category.id)) { //here we are using || because we are planning to drop `id_`\n found.push(category);\n }\n if (category.sub_categories?.length > 0) {\n found = found.concat(this.findCategories(category.sub_categories, ids));\n }\n }\n\n return found;\n }\n\n //todo::add to the key params, to make sure it will support multi offers in the same page if it's wanted\n getStorageKey(): string {\n try {\n const pageSlug = salla.config.get('page.slug').replace('.', '_');\n const locale = salla.lang.getLocale();\n const currencyCode = salla.config.currency().code;\n\n if (!pageSlug || !locale || !currencyCode) {\n throw new Error('Unable to get the storage key.');\n }\n\n return `s-offers-${pageSlug}-${salla.config.get('page.id')}-${locale}-${currencyCode}`;\n } catch (error) {\n return '';\n }\n }\n\n //@ts-ignore\n getOffersFromStorage(): null | Promise<Offer[]> {\n let storageOffers = salla.storage.get(this.getStorageKey());\n //if the offers not existed, or it has been stored before 10 minutes from now, ignore it;\n if (!storageOffers || storageOffers.stored_at < (new Date().getTime() - 10 * 60 * 1000)) {\n salla.storage.remove(this.getStorageKey());\n return null;\n }\n this.canRender = true;\n\n //return it as resolve to support .then\n return Promise.resolve(storageOffers.offers);\n }\n\n render() {\n if (!this.offersList.length || !this.canRender || !this.showOffer) return null;\n const offer: Offer = this.offersList[0];\n\n const blockTitle = this.isBankOffer ? (this.isMultipleBank ? this.multipleBankOfferTitleText : null) : offer.title;\n const blockSubTitle = this.isBankOffer ? (this.isMultipleBank ? this.multipleBankOfferTitleDescription : null) : offer.description;\n\n const titles = {\n 'block-title': blockTitle,\n 'block-subTitle': blockSubTitle,\n 'show-controls': this.isMultipleBank\n };\n\n return (\n <div class=\"s-offer-wrapper\">\n {<p class=\"s-offer-corner-badge\">{this.special_offer_text}</p>}\n {/* discounts table is not a slider, it's a table🤔 */}\n {/* single bank offer is not a slider, it's a dom without slider🤔 */}\n <salla-slider type=\"carousel\" id=\"offer-slider\" {...titles}>\n <div slot='items'>\n {this.renderSectionForOfferType(offer.type)}\n </div>\n </salla-slider>\n </div>\n );\n }\n\n private renderSectionForOfferType(offerType: OfferType | string) {\n if (this.isBankOffer) {\n return this.renderBankSection();\n }\n if (offerType == OfferType.BuyXGetY) {\n return this.renderBuyXGetYSection();\n }\n\n return this.renderDiscountTableSection();\n }\n\n /**\n * Generates content for the categories section.\n *\n * @param offeredCategories - An array of Category objects.\n * @returns An array of HTML elements representing categories.\n */\n private getCategoriesSection(category: Category) {\n return <div class=\"s-offer-slide-one-sixth swiper-slide\" innerHTML={this.categorySlot\n .replace(/\\{url\\}/g, category.url)\n .replace(/\\{icon\\}/g, category.icon || \"sicon-store\")\n .replace(/\\{name\\}/g, category.name)}></div>\n }\n\n private renderBuyXGetYSection() {\n const details = (this.offersList[0].details as BuyXGetYDetail)\n return [\n details.get.products?.map((product: Product) => (\n <div class=\"s-offer-slide-one-fourth\">\n {this.hasCustomComponent\n ? <this.productCardComponent product={product}></this.productCardComponent>\n : <salla-product-card shadow-on-hover product={product}></salla-product-card>}\n </div>\n )),\n details.get.categories?.map((category: Category) => this.getCategoriesSection(category))\n ];\n }\n\n /**\n * Generates content for the bank section.\n *\n * @param offeredBank - An array of Bank objects.\n * @param name - The title of the current offer.\n * @param description - The description of the current offer.\n * @returns An array of HTML elements representing banks.\n * \n * TODO: loop over the list and filter bank types and pass it to this function\n */\n private renderBankSection() {\n return this.offersList.map((bankOffer: Offer) => {\n return <div class={{ \"s-offer-slide-one-sixth\": this.isMultipleBank, \"s-offer-bank-wrapper-sinlge-item\": !this.isMultipleBank }}>\n <div class={{ \"s-offer-bank-wrapper\": true, \"s-offer-slide-one-sixth\": !this.isMultipleBank, \"s-offer-bank-wrapper-multi-spacer\": this.isMultipleBank }}>\n <div class=\"s-offer-bank-logo\">\n <img src={(bankOffer.details as BankOffer).logo || salla.url.cdn('images/s-empty.png')} data-src={(bankOffer.details as BankOffer).logo} alt={bankOffer.title + \" offer\"} />\n </div>\n <ul class=\"s-offer-bank-payment-wrapper\">\n {(bankOffer.details as BankOffer).payments.map((payment: string) => {\n return <li class=\"s-offer-bank-payment-single\">\n <img\n src={salla.url.cdn('images/payment/' + payment + '.png') || salla.url.cdn('images/s-empty.png')}\n data-src={salla.url.cdn('images/payment/' + payment + '.png')}\n alt=\"payment\" />\n </li>\n })}\n </ul>\n {this.isMultipleBank ?\n <p class=\"s-offer-bank-payment-discount-percent\">\n {`${this.product_discount_text} ${(bankOffer.details as BankOffer).discount_value}${(bankOffer.details as BankOffer).discount_type === \"percentage\" && '%'}`}\n </p>\n : \"\"}\n </div>\n {!this.isMultipleBank ?\n <div class=\"s-offer-bank-message s-offer-slide-one-fourth\">\n <h2>{this.offersList[0].title}</h2>\n <p innerHTML={this.generateBankDescription(this.offersList[0].description, (bankOffer.details as BankOffer).discount_value)}></p>\n </div>\n : \"\"}\n </div>\n })\n }\n\n private generateBankDescription(desc: string, value): string {\n return desc.replace(new RegExp(`${value} %`), `<span class=\"s-offer-bank-message-amount\">${value} %</span>`)\n }\n\n /**\n * Generates content for the discount table section.\n *\n * @param discountTable - An array of Discount objects.\n * @returns An array of HTML elements representing discounts_table.\n */\n private renderDiscountTableSection() {\n const offer: Offer = this.offersList[0];\n let show_discounted_price = (offer.details as DiscountDetailTable).show_price_after_discount;\n return (this.offersList[0].details as DiscountDetailTable).discounts?.map((discount: Discount) => <div class=\"s-offer-slide-one-fourth\">\n <div class=\"s-offer-slide-offer-entry\">\n <div class=\"s-offer-slide-offer-entry-price-quantity-container\">\n <p class=\"s-offer-slide-offer-entry-quantity\">{this.buy_quantity_text(discount.quantity)}</p>\n {show_discounted_price ?\n <div class=\"s-offer-slide-offer-entry-price\">\n <span>{this.offer_with_price_text}</span>\n <span class=\"s-offer-slide-offer-entry-price-amount\">{discount.discounted_amount}</span> <span>{this.userCurrency}</span>\n </div> : \"\"}\n </div>\n <p class=\"s-offer-slide-offer-entry-price-amount-percent\">{this.with_discount_text}\n (<span>{discount.percentage}{!!discount.percentage && '%'}</span>)</p>\n </div>\n </div>\n )\n }\n\n}\n"],"mappings":";;;kJAAA,IAAYA,GAAZ,SAAYA,GACVA,EAAA,kCACAA,EAAA,cACD,EAHD,CAAYA,MAGX,KAED,IAAYC,GAAZ,SAAYA,GACVA,EAAA,6BACAA,EAAA,6BACAA,EAAA,oCACAA,EAAA,eACAA,EAAA,yBACD,EAND,CAAYA,MAMX,KCXD,IAAMC,EAAgB,+gB,ICmBTC,EAAUC,EAAA,yBAErB,SAAAC,EAAAC,GAAA,IAAAC,EAAAC,K,gBA6BQA,KAAoBC,qBAAW,4BAG9BD,KAAUE,WAAY,GAEtBF,KAAcG,eAAY,MAK1BH,KAAWI,YAAY,MACvBJ,KAASK,UAAY,MACrBL,KAASM,UAAYC,MAAMC,OAAOC,IAAI,8CAGtCT,KAA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