@salla.sa/twilight-components 2.14.422 → 2.14.423

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 (325) hide show
  1. package/dist/cjs/{filepond-Bj2Lr664.js → filepond-Do86Z81F.js} +1 -1
  2. package/dist/cjs/{filepond-plugin-file-poster-D6zjqOTW.js → filepond-plugin-file-poster-BltmTwcK.js} +1 -1
  3. package/dist/cjs/{filepond-plugin-file-validate-size-DW2JtTpK.js → filepond-plugin-file-validate-size-D6qDjnWw.js} +1 -1
  4. package/dist/cjs/{filepond-plugin-file-validate-type-Cm_dx5vR.js → filepond-plugin-file-validate-type-BTcaw3yC.js} +1 -1
  5. package/dist/cjs/{filepond-plugin-image-edit-CyB1FduP.js → filepond-plugin-image-edit-BfSALTq0.js} +1 -1
  6. package/dist/cjs/{filepond-plugin-image-exif-orientation-CxcuYrF1.js → filepond-plugin-image-exif-orientation-YyoN3ZPE.js} +1 -1
  7. package/dist/cjs/{filepond-plugin-image-preview-CXF_Kqyu.js → filepond-plugin-image-preview-DPZhJU-S.js} +1 -1
  8. package/dist/cjs/{functions-QULFiarR.js → functions-Vqr_tH33.js} +1 -1
  9. package/dist/cjs/{index-C-KeWKxB.js → index-BKsfuSTK.js} +1 -1
  10. package/dist/cjs/{index-CSI6rnkc.js → index-B_ubSXmY.js} +12 -8
  11. package/dist/cjs/loader.cjs.js +2 -2
  12. package/dist/cjs/salla-accordion-body_2.cjs.entry.js +1 -1
  13. package/dist/cjs/salla-accordion_6.cjs.entry.js +1 -1
  14. package/dist/cjs/salla-add-product-button_5.cjs.entry.js +1 -1
  15. package/dist/cjs/salla-advertisement.cjs.entry.js +1 -1
  16. package/dist/cjs/salla-alert_2.cjs.entry.js +1 -1
  17. package/dist/cjs/salla-app-install-alert.cjs.entry.js +1 -1
  18. package/dist/cjs/salla-apps-icons.cjs.entry.js +1 -1
  19. package/dist/cjs/salla-badge.cjs.entry.js +1 -1
  20. package/dist/cjs/salla-booking-field_7.cjs.entry.js +10 -10
  21. package/dist/cjs/salla-bullet-delivery.cjs.entry.js +1 -1
  22. package/dist/cjs/salla-cart-coupons.cjs.entry.js +1 -1
  23. package/dist/cjs/salla-cart-item-offers_2.cjs.entry.js +3 -9
  24. package/dist/cjs/salla-comment-form_8.cjs.entry.js +1 -1
  25. package/dist/cjs/salla-conditional-offer.cjs.entry.js +1 -1
  26. package/dist/cjs/salla-contacts.cjs.entry.js +1 -1
  27. package/dist/cjs/salla-cookies-bar.cjs.entry.js +20 -1
  28. package/dist/cjs/salla-count-down.cjs.entry.js +1 -1
  29. package/dist/cjs/salla-custom-fields.cjs.entry.js +1 -1
  30. package/dist/cjs/salla-delivery-promise.cjs.entry.js +1 -1
  31. package/dist/cjs/salla-edit-order-button.cjs.entry.js +1 -1
  32. package/dist/cjs/salla-filters-widget.cjs.entry.js +1 -1
  33. package/dist/cjs/salla-filters.cjs.entry.js +1 -1
  34. package/dist/cjs/salla-fulfillment-methods.cjs.entry.js +1 -1
  35. package/dist/cjs/salla-gifting.cjs.entry.js +1 -1
  36. package/dist/cjs/salla-hook.cjs.entry.js +1 -1
  37. package/dist/cjs/salla-infinite-scroll.cjs.entry.js +1 -1
  38. package/dist/cjs/salla-installment.cjs.entry.js +1 -1
  39. package/dist/cjs/salla-list-tile.cjs.entry.js +1 -1
  40. package/dist/cjs/salla-localization-modal.cjs.entry.js +1 -1
  41. package/dist/cjs/salla-login-modal.cjs.entry.js +1 -1
  42. package/dist/cjs/salla-loyalty-banner.cjs.entry.js +2 -2
  43. package/dist/cjs/salla-loyalty-hero_2.cjs.entry.js +2 -2
  44. package/dist/cjs/salla-loyalty-panel.cjs.entry.js +3 -3
  45. package/dist/cjs/salla-loyalty-prize-item.cjs.entry.js +1 -1
  46. package/dist/cjs/salla-loyalty-program.cjs.entry.js +3 -3
  47. package/dist/cjs/salla-loyalty-reward.cjs.entry.js +2 -2
  48. package/dist/cjs/salla-loyalty.cjs.entry.js +1 -1
  49. package/dist/cjs/salla-maintenance-alert.cjs.entry.js +1 -1
  50. package/dist/cjs/salla-map.cjs.entry.js +1 -1
  51. package/dist/cjs/salla-menu.cjs.entry.js +14 -2
  52. package/dist/cjs/salla-metadata.cjs.entry.js +1 -1
  53. package/dist/cjs/salla-multiple-bundle-product-cart_2.cjs.entry.js +1 -1
  54. package/dist/cjs/salla-multiple-bundle-product-options-modal_2.cjs.entry.js +1 -1
  55. package/dist/cjs/salla-multiple-bundle-product.cjs.entry.js +1 -1
  56. package/dist/cjs/salla-next-order-coupon.cjs.entry.js +126 -0
  57. package/dist/cjs/salla-notification-item.cjs.entry.js +1 -1
  58. package/dist/cjs/salla-notifications.cjs.entry.js +1 -1
  59. package/dist/cjs/salla-offer-modal.cjs.entry.js +1 -1
  60. package/dist/cjs/salla-offer.cjs.entry.js +1 -1
  61. package/dist/cjs/salla-order-details-multiple-bundle-product.cjs.entry.js +1 -1
  62. package/dist/cjs/salla-order-details-options.cjs.entry.js +1 -1
  63. package/dist/cjs/salla-order-details.cjs.entry.js +1 -1
  64. package/dist/cjs/salla-order-edit-item.cjs.entry.js +1 -1
  65. package/dist/cjs/salla-order-edit-product-card.cjs.entry.js +1 -1
  66. package/dist/cjs/salla-order-edit.cjs.entry.js +1 -1
  67. package/dist/cjs/salla-order-summary.cjs.entry.js +3 -9
  68. package/dist/cjs/salla-order-totals-card.cjs.entry.js +1 -1
  69. package/dist/cjs/salla-orders.cjs.entry.js +1 -1
  70. package/dist/cjs/salla-payments.cjs.entry.js +1 -1
  71. package/dist/cjs/salla-placeholder.cjs.entry.js +1 -1
  72. package/dist/cjs/salla-price-range.cjs.entry.js +1 -1
  73. package/dist/cjs/salla-product-card_2.cjs.entry.js +1 -1
  74. package/dist/cjs/salla-product-size-guide.cjs.entry.js +1 -1
  75. package/dist/cjs/salla-products-list.cjs.entry.js +1 -1
  76. package/dist/cjs/salla-progress-bar.cjs.entry.js +1 -1
  77. package/dist/cjs/salla-quick-order.cjs.entry.js +1 -1
  78. package/dist/cjs/salla-rating-modal.cjs.entry.js +1 -1
  79. package/dist/cjs/salla-reward-action_4.cjs.entry.js +10 -7
  80. package/dist/cjs/salla-scopes.cjs.entry.js +1 -1
  81. package/dist/cjs/salla-search.cjs.entry.js +1 -1
  82. package/dist/cjs/salla-skeleton.cjs.entry.js +1 -1
  83. package/dist/cjs/salla-slider.cjs.entry.js +1 -1
  84. package/dist/cjs/salla-social-share.cjs.entry.js +1 -1
  85. package/dist/cjs/salla-social.cjs.entry.js +1 -1
  86. package/dist/cjs/salla-tab-content_3.cjs.entry.js +1 -1
  87. package/dist/cjs/salla-tiered-offer.cjs.entry.js +1 -1
  88. package/dist/cjs/salla-tooltip.cjs.entry.js +1 -1
  89. package/dist/cjs/salla-trust-badges.cjs.entry.js +1 -1
  90. package/dist/cjs/salla-user-menu.cjs.entry.js +1 -1
  91. package/dist/cjs/salla-user-profile.cjs.entry.js +1 -1
  92. package/dist/cjs/salla-user-settings.cjs.entry.js +1 -1
  93. package/dist/cjs/salla-verify.cjs.entry.js +1 -1
  94. package/dist/cjs/salla-wallet.cjs.entry.js +1 -1
  95. package/dist/cjs/swap-stroke-CYGxjKIS.js +13 -0
  96. package/dist/cjs/tag-money-Cuohw_4j.js +13 -0
  97. package/dist/cjs/{tracked-promise-DTPdQpTt.js → tracked-promise-DfEtIz3d.js} +1 -1
  98. package/dist/cjs/twilight.cjs.js +2 -2
  99. package/dist/cjs/{vanilla-picker-CmTZhXxo.js → vanilla-picker-n2ZBl__a.js} +1 -1
  100. package/dist/collection/collection-manifest.json +6 -0
  101. package/dist/collection/components/salla-cookies-bar/salla-cookies-bar.js +40 -0
  102. package/dist/collection/components/salla-loyalty-program/salla-reward-details.js +7 -4
  103. package/dist/collection/components/salla-menu/salla-menu.js +35 -2
  104. package/dist/collection/components/salla-next-order-coupon/interfaces.js +1 -0
  105. package/dist/collection/components/salla-next-order-coupon/salla-next-order-coupon.css +3 -0
  106. package/dist/collection/components/salla-next-order-coupon/salla-next-order-coupon.js +142 -0
  107. package/dist/components/index.js +2 -2
  108. package/dist/components/salla-cart-item-offers.js +1 -7
  109. package/dist/components/salla-cookies-bar.js +21 -1
  110. package/dist/components/salla-menu.js +16 -2
  111. package/dist/components/salla-next-order-coupon.d.ts +11 -0
  112. package/dist/components/salla-next-order-coupon.js +165 -0
  113. package/dist/components/salla-order-summary.js +1 -7
  114. package/dist/components/salla-reward-details2.js +7 -4
  115. package/dist/components/swap-stroke.js +11 -0
  116. package/dist/components/tag-money.js +11 -0
  117. package/dist/esm/{filepond-CaO0jWZe.js → filepond-C27NJlHY.js} +1 -1
  118. package/dist/esm/{filepond-plugin-file-poster-x8WSmS0o.js → filepond-plugin-file-poster-CbA3Ow5D.js} +1 -1
  119. package/dist/esm/{filepond-plugin-file-validate-size-CxlH6WN0.js → filepond-plugin-file-validate-size-DeVDysqG.js} +1 -1
  120. package/dist/esm/{filepond-plugin-file-validate-type-qw3WFgZc.js → filepond-plugin-file-validate-type-Bk2vWN-H.js} +1 -1
  121. package/dist/esm/{filepond-plugin-image-edit-DuhPVO0a.js → filepond-plugin-image-edit-MZT3Vams.js} +1 -1
  122. package/dist/esm/{filepond-plugin-image-exif-orientation-BffsImgy.js → filepond-plugin-image-exif-orientation-CUi24gW6.js} +1 -1
  123. package/dist/esm/{filepond-plugin-image-preview-VZtiw7aM.js → filepond-plugin-image-preview-DNteLpdV.js} +1 -1
  124. package/dist/esm/{functions-DQPUS1s5.js → functions-WZTrXRSI.js} +1 -1
  125. package/dist/esm/{index-DcQSprhU.js → index-Z9TEkBrE.js} +12 -8
  126. package/dist/esm/{index-CDqmBYQb.js → index-xqn3qtN8.js} +1 -1
  127. package/dist/esm/loader.js +3 -3
  128. package/dist/esm/salla-accordion-body_2.entry.js +1 -1
  129. package/dist/esm/salla-accordion_6.entry.js +1 -1
  130. package/dist/esm/salla-add-product-button_5.entry.js +1 -1
  131. package/dist/esm/salla-advertisement.entry.js +1 -1
  132. package/dist/esm/salla-alert_2.entry.js +1 -1
  133. package/dist/esm/salla-app-install-alert.entry.js +1 -1
  134. package/dist/esm/salla-apps-icons.entry.js +1 -1
  135. package/dist/esm/salla-badge.entry.js +1 -1
  136. package/dist/esm/salla-booking-field_7.entry.js +10 -10
  137. package/dist/esm/salla-bullet-delivery.entry.js +1 -1
  138. package/dist/esm/salla-cart-coupons.entry.js +1 -1
  139. package/dist/esm/salla-cart-item-offers_2.entry.js +2 -8
  140. package/dist/esm/salla-comment-form_8.entry.js +1 -1
  141. package/dist/esm/salla-conditional-offer.entry.js +1 -1
  142. package/dist/esm/salla-contacts.entry.js +1 -1
  143. package/dist/esm/salla-cookies-bar.entry.js +20 -1
  144. package/dist/esm/salla-count-down.entry.js +1 -1
  145. package/dist/esm/salla-custom-fields.entry.js +1 -1
  146. package/dist/esm/salla-delivery-promise.entry.js +1 -1
  147. package/dist/esm/salla-edit-order-button.entry.js +1 -1
  148. package/dist/esm/salla-filters-widget.entry.js +1 -1
  149. package/dist/esm/salla-filters.entry.js +1 -1
  150. package/dist/esm/salla-fulfillment-methods.entry.js +1 -1
  151. package/dist/esm/salla-gifting.entry.js +1 -1
  152. package/dist/esm/salla-hook.entry.js +1 -1
  153. package/dist/esm/salla-infinite-scroll.entry.js +1 -1
  154. package/dist/esm/salla-installment.entry.js +1 -1
  155. package/dist/esm/salla-list-tile.entry.js +1 -1
  156. package/dist/esm/salla-localization-modal.entry.js +1 -1
  157. package/dist/esm/salla-login-modal.entry.js +1 -1
  158. package/dist/esm/salla-loyalty-banner.entry.js +2 -2
  159. package/dist/esm/salla-loyalty-hero_2.entry.js +2 -2
  160. package/dist/esm/salla-loyalty-panel.entry.js +3 -3
  161. package/dist/esm/salla-loyalty-prize-item.entry.js +1 -1
  162. package/dist/esm/salla-loyalty-program.entry.js +3 -3
  163. package/dist/esm/salla-loyalty-reward.entry.js +2 -2
  164. package/dist/esm/salla-loyalty.entry.js +1 -1
  165. package/dist/esm/salla-maintenance-alert.entry.js +1 -1
  166. package/dist/esm/salla-map.entry.js +1 -1
  167. package/dist/esm/salla-menu.entry.js +14 -2
  168. package/dist/esm/salla-metadata.entry.js +1 -1
  169. package/dist/esm/salla-multiple-bundle-product-cart_2.entry.js +1 -1
  170. package/dist/esm/salla-multiple-bundle-product-options-modal_2.entry.js +1 -1
  171. package/dist/esm/salla-multiple-bundle-product.entry.js +1 -1
  172. package/dist/esm/salla-next-order-coupon.entry.js +124 -0
  173. package/dist/esm/salla-notification-item.entry.js +1 -1
  174. package/dist/esm/salla-notifications.entry.js +1 -1
  175. package/dist/esm/salla-offer-modal.entry.js +1 -1
  176. package/dist/esm/salla-offer.entry.js +1 -1
  177. package/dist/esm/salla-order-details-multiple-bundle-product.entry.js +1 -1
  178. package/dist/esm/salla-order-details-options.entry.js +1 -1
  179. package/dist/esm/salla-order-details.entry.js +1 -1
  180. package/dist/esm/salla-order-edit-item.entry.js +1 -1
  181. package/dist/esm/salla-order-edit-product-card.entry.js +1 -1
  182. package/dist/esm/salla-order-edit.entry.js +1 -1
  183. package/dist/esm/salla-order-summary.entry.js +2 -8
  184. package/dist/esm/salla-order-totals-card.entry.js +1 -1
  185. package/dist/esm/salla-orders.entry.js +1 -1
  186. package/dist/esm/salla-payments.entry.js +1 -1
  187. package/dist/esm/salla-placeholder.entry.js +1 -1
  188. package/dist/esm/salla-price-range.entry.js +1 -1
  189. package/dist/esm/salla-product-card_2.entry.js +1 -1
  190. package/dist/esm/salla-product-size-guide.entry.js +1 -1
  191. package/dist/esm/salla-products-list.entry.js +1 -1
  192. package/dist/esm/salla-progress-bar.entry.js +1 -1
  193. package/dist/esm/salla-quick-order.entry.js +1 -1
  194. package/dist/esm/salla-rating-modal.entry.js +1 -1
  195. package/dist/esm/salla-reward-action_4.entry.js +10 -7
  196. package/dist/esm/salla-scopes.entry.js +1 -1
  197. package/dist/esm/salla-search.entry.js +1 -1
  198. package/dist/esm/salla-skeleton.entry.js +1 -1
  199. package/dist/esm/salla-slider.entry.js +1 -1
  200. package/dist/esm/salla-social-share.entry.js +1 -1
  201. package/dist/esm/salla-social.entry.js +1 -1
  202. package/dist/esm/salla-tab-content_3.entry.js +1 -1
  203. package/dist/esm/salla-tiered-offer.entry.js +1 -1
  204. package/dist/esm/salla-tooltip.entry.js +1 -1
  205. package/dist/esm/salla-trust-badges.entry.js +1 -1
  206. package/dist/esm/salla-user-menu.entry.js +1 -1
  207. package/dist/esm/salla-user-profile.entry.js +1 -1
  208. package/dist/esm/salla-user-settings.entry.js +1 -1
  209. package/dist/esm/salla-verify.entry.js +1 -1
  210. package/dist/esm/salla-wallet.entry.js +1 -1
  211. package/dist/esm/swap-stroke-DqDX5na4.js +11 -0
  212. package/dist/esm/tag-money-CJUR4sUM.js +11 -0
  213. package/dist/esm/{tracked-promise-CjUGdQ4e.js → tracked-promise-9ayPcQ9V.js} +1 -1
  214. package/dist/esm/twilight.js +3 -3
  215. package/dist/esm/{vanilla-picker-71UAczkS.js → vanilla-picker-DU5T_3-T.js} +1 -1
  216. package/dist/twilight/{p-32a76526.entry.js → p-10311a85.entry.js} +1 -1
  217. package/dist/twilight/{p-28cd5556.entry.js → p-132d5758.entry.js} +1 -1
  218. package/dist/twilight/{p-c13164b8.entry.js → p-1357f11f.entry.js} +1 -1
  219. package/dist/twilight/{p-97a43989.entry.js → p-15b8af3d.entry.js} +1 -1
  220. package/dist/twilight/{p-452d8cd0.entry.js → p-15d242d1.entry.js} +1 -1
  221. package/dist/twilight/{p-d188ddc3.entry.js → p-1aa4f79a.entry.js} +1 -1
  222. package/dist/twilight/{p-8eebefe9.entry.js → p-1daa9a08.entry.js} +1 -1
  223. package/dist/twilight/{p-8ec0ba5b.entry.js → p-1e6a741d.entry.js} +1 -1
  224. package/dist/twilight/{p-a2fcbc1a.entry.js → p-1f3d64f3.entry.js} +1 -1
  225. package/dist/twilight/{p-b3a731c1.entry.js → p-25a9da9c.entry.js} +1 -1
  226. package/dist/twilight/{p-868e3de6.entry.js → p-268c86dd.entry.js} +1 -1
  227. package/dist/twilight/{p-c9b8eaa4.entry.js → p-296b7778.entry.js} +1 -1
  228. package/dist/twilight/{p-e2e790c2.entry.js → p-2e69e2a7.entry.js} +1 -1
  229. package/dist/twilight/p-3175cab9.entry.js +4 -0
  230. package/dist/twilight/{p-061c3ad0.entry.js → p-31cdb580.entry.js} +1 -1
  231. package/dist/twilight/{p-3115fa6f.entry.js → p-321d4374.entry.js} +1 -1
  232. package/dist/twilight/{p-00031f8b.entry.js → p-38eb6f08.entry.js} +1 -1
  233. package/dist/twilight/{p-e8a3af2d.entry.js → p-4208c68b.entry.js} +1 -1
  234. package/dist/twilight/{p-38ce7612.entry.js → p-475bfa77.entry.js} +1 -1
  235. package/dist/twilight/{p-d65db41e.entry.js → p-51ccd249.entry.js} +1 -1
  236. package/dist/twilight/p-51eb69d7.entry.js +4 -0
  237. package/dist/twilight/{p-1cf5f505.entry.js → p-58f17ecc.entry.js} +1 -1
  238. package/dist/twilight/{p-b3d565bd.entry.js → p-598c73c9.entry.js} +1 -1
  239. package/dist/twilight/{p-7282ff57.entry.js → p-5bd92466.entry.js} +1 -1
  240. package/dist/twilight/{p-63d47b05.entry.js → p-612f2099.entry.js} +1 -1
  241. package/dist/twilight/{p-80865031.entry.js → p-61b6fac2.entry.js} +1 -1
  242. package/dist/twilight/{p-fa5cfbbb.entry.js → p-647a76d0.entry.js} +1 -1
  243. package/dist/twilight/p-69d98642.entry.js +4 -0
  244. package/dist/twilight/{p-f2476ba0.entry.js → p-6ab7c83d.entry.js} +1 -1
  245. package/dist/twilight/{p-d46ab245.entry.js → p-6d4850df.entry.js} +1 -1
  246. package/dist/twilight/{p-a147d986.entry.js → p-735e5378.entry.js} +1 -1
  247. package/dist/twilight/{p-f0f5e269.entry.js → p-74362d6a.entry.js} +1 -1
  248. package/dist/twilight/{p-0217da98.entry.js → p-75066345.entry.js} +1 -1
  249. package/dist/twilight/{p-192e2bc3.entry.js → p-75826fc3.entry.js} +1 -1
  250. package/dist/twilight/{p-6ccbe91b.entry.js → p-776a0bda.entry.js} +1 -1
  251. package/dist/twilight/{p-8101bf16.entry.js → p-777a765e.entry.js} +1 -1
  252. package/dist/twilight/{p-5e5ccdab.entry.js → p-79340697.entry.js} +1 -1
  253. package/dist/twilight/{p-e08d36d6.entry.js → p-79d9b828.entry.js} +1 -1
  254. package/dist/twilight/{p-a44f888a.entry.js → p-7d2ec078.entry.js} +1 -1
  255. package/dist/twilight/{p-6c98089b.entry.js → p-7d4c5da3.entry.js} +1 -1
  256. package/dist/twilight/{p-8ad13a15.entry.js → p-8138fe7c.entry.js} +1 -1
  257. package/dist/twilight/{p-f161933c.entry.js → p-847d884f.entry.js} +1 -1
  258. package/dist/twilight/{p-63e1b828.entry.js → p-8631c200.entry.js} +1 -1
  259. package/dist/twilight/{p-e4f154ee.entry.js → p-872b6790.entry.js} +1 -1
  260. package/dist/twilight/{p-ea4ded2f.entry.js → p-88c6e6ec.entry.js} +1 -1
  261. package/dist/twilight/{p-acb769ec.entry.js → p-8b15a7c2.entry.js} +1 -1
  262. package/dist/twilight/p-93221e58.entry.js +4 -0
  263. package/dist/twilight/{p-a6282734.entry.js → p-93715135.entry.js} +1 -1
  264. package/dist/twilight/{p-062ce0be.entry.js → p-9410f28a.entry.js} +1 -1
  265. package/dist/twilight/{p-4f6bff26.entry.js → p-97033016.entry.js} +1 -1
  266. package/dist/twilight/{p-50b449bd.entry.js → p-9b64e741.entry.js} +1 -1
  267. package/dist/twilight/{p-a4c32f61.entry.js → p-9c36f5f1.entry.js} +1 -1
  268. package/dist/twilight/{p-69b6a7e6.entry.js → p-9d30457e.entry.js} +1 -1
  269. package/dist/twilight/{p-l-JdSat8.js → p-B7NkulJ-.js} +1 -1
  270. package/dist/twilight/{p-BTAUEZcN.js → p-BDJ2Ykel.js} +1 -1
  271. package/dist/twilight/{p-BHk2Uou3.js → p-BlcvrTiO.js} +1 -1
  272. package/dist/twilight/{p-DeBNbBwy.js → p-BswrPpfs.js} +1 -1
  273. package/dist/twilight/{p-CT3zVv2d.js → p-C9yU50YT.js} +1 -1
  274. package/dist/twilight/p-CJUR4sUM.js +4 -0
  275. package/dist/twilight/{p-Ca8b1Y6p.js → p-CmoDOvZI.js} +1 -1
  276. package/dist/twilight/{p-BCVUxip0.js → p-CxlEUP15.js} +1 -1
  277. package/dist/twilight/{p-DgJJBXMW.js → p-DG0XMtHg.js} +1 -1
  278. package/dist/twilight/p-DqDX5na4.js +4 -0
  279. package/dist/twilight/{p-CN2sY_Li.js → p-DqwP0D-u.js} +1 -1
  280. package/dist/twilight/{p-CRRWZbuL.js → p-EhkdtrLx.js} +1 -1
  281. package/dist/twilight/{p-DcQSprhU.js → p-Z9TEkBrE.js} +1 -1
  282. package/dist/twilight/{p-Cs04GLEl.js → p-ZJAW9yxk.js} +1 -1
  283. package/dist/twilight/{p-77d1859e.entry.js → p-a6429df2.entry.js} +1 -1
  284. package/dist/twilight/p-a9f85080.entry.js +4 -0
  285. package/dist/twilight/{p-c34b5d8a.entry.js → p-aba22621.entry.js} +1 -1
  286. package/dist/twilight/{p-957bffb4.entry.js → p-b253d360.entry.js} +1 -1
  287. package/dist/twilight/{p-9cb39e42.entry.js → p-b5c33519.entry.js} +1 -1
  288. package/dist/twilight/{p-013cfbf0.entry.js → p-b785d75d.entry.js} +1 -1
  289. package/dist/twilight/{p-e79d468d.entry.js → p-b7aa5623.entry.js} +1 -1
  290. package/dist/twilight/{p-14805623.entry.js → p-be58b3a7.entry.js} +1 -1
  291. package/dist/twilight/{p-ecb69641.entry.js → p-c038e432.entry.js} +1 -1
  292. package/dist/twilight/{p-9924b574.entry.js → p-c19887c7.entry.js} +1 -1
  293. package/dist/twilight/{p-9170fe95.entry.js → p-c2dd5774.entry.js} +1 -1
  294. package/dist/twilight/{p-300dae0b.entry.js → p-c4a80854.entry.js} +1 -1
  295. package/dist/twilight/{p-b0b2aeda.entry.js → p-c4bb47b0.entry.js} +1 -1
  296. package/dist/twilight/{p-587d6230.entry.js → p-c763b517.entry.js} +1 -1
  297. package/dist/twilight/p-c77bcf09.entry.js +4 -0
  298. package/dist/twilight/{p-deffef72.entry.js → p-c7b15f0a.entry.js} +1 -1
  299. package/dist/twilight/{p-6d5b28c5.entry.js → p-cb476df4.entry.js} +1 -1
  300. package/dist/twilight/{p-6587c7d9.entry.js → p-d049f98a.entry.js} +1 -1
  301. package/dist/twilight/{p-5637acc5.entry.js → p-d0898538.entry.js} +1 -1
  302. package/dist/twilight/{p-3f01ef83.entry.js → p-d8d62f74.entry.js} +1 -1
  303. package/dist/twilight/{p-c49b9285.entry.js → p-dc1b4da2.entry.js} +1 -1
  304. package/dist/twilight/{p-4a8e7f09.entry.js → p-ea0b6753.entry.js} +1 -1
  305. package/dist/twilight/{p-c2a2158a.entry.js → p-eed5585b.entry.js} +1 -1
  306. package/dist/twilight/{p-cfac18e6.entry.js → p-ef60225f.entry.js} +1 -1
  307. package/dist/twilight/{p-e87d2534.entry.js → p-f087988a.entry.js} +1 -1
  308. package/dist/twilight/{p-503f9bbf.entry.js → p-f423f1cf.entry.js} +1 -1
  309. package/dist/twilight/{p-f6ed04b2.entry.js → p-f4582cc9.entry.js} +1 -1
  310. package/dist/twilight/{p-3a3dd27f.entry.js → p-f45efc0c.entry.js} +1 -1
  311. package/dist/twilight/p-f82d4a36.entry.js +4 -0
  312. package/dist/twilight/{p-64f577be.entry.js → p-fae2be1f.entry.js} +1 -1
  313. package/dist/twilight/twilight.esm.js +1 -1
  314. package/dist/types/components/salla-cookies-bar/salla-cookies-bar.d.ts +6 -0
  315. package/dist/types/components/salla-menu/salla-menu.d.ts +6 -0
  316. package/dist/types/components/salla-next-order-coupon/interfaces.d.ts +11 -0
  317. package/dist/types/components/salla-next-order-coupon/salla-next-order-coupon.d.ts +24 -0
  318. package/dist/types/components.d.ts +27 -0
  319. package/package.json +5 -5
  320. package/dist/twilight/p-27cc8fc7.entry.js +0 -4
  321. package/dist/twilight/p-489cca66.entry.js +0 -4
  322. package/dist/twilight/p-497b058a.entry.js +0 -4
  323. package/dist/twilight/p-4c759f75.entry.js +0 -4
  324. package/dist/twilight/p-81f18d48.entry.js +0 -4
  325. package/dist/twilight/p-f77d4659.entry.js +0 -4
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{d as e}from"./p-DcQSprhU.js";function E(e,E){return E.forEach((function(E){E&&"string"!=typeof E&&!Array.isArray(E)&&Object.keys(E).forEach((function(i){if("default"!==i&&!(i in e)){var _=Object.getOwnPropertyDescriptor(E,i);Object.defineProperty(e,i,_.get?_:{enumerable:!0,get:function(){return E[i]}})}}))})),Object.freeze(e)}var i,_,l={exports:{}},n=i?l.exports:(i=1,l.exports=(_=function(e){var E=e.addFilter,i=e.utils,_=i.Type,l=i.replaceInString,n=i.toNaturalFileSize;return E("ALLOW_HOPPER_ITEM",(function(e,E){var i=E.query;if(!i("GET_ALLOW_FILE_SIZE_VALIDATION"))return!0;var _=i("GET_MAX_FILE_SIZE");if(null!==_&&e.size>_)return!1;var l=i("GET_MIN_FILE_SIZE");return!(null!==l&&e.size<l)})),E("LOAD_FILE",(function(e,E){var i=E.query;return new Promise((function(E,_){if(!i("GET_ALLOW_FILE_SIZE_VALIDATION"))return E(e);var t=i("GET_FILE_VALIDATE_SIZE_FILTER");if(t&&!t(e))return E(e);var I=i("GET_MAX_FILE_SIZE");if(null!==I&&e.size>I)_({status:{main:i("GET_LABEL_MAX_FILE_SIZE_EXCEEDED"),sub:l(i("GET_LABEL_MAX_FILE_SIZE"),{filesize:n(I,".",i("GET_FILE_SIZE_BASE"),i("GET_FILE_SIZE_LABELS",i))})}});else{var L=i("GET_MIN_FILE_SIZE");if(null!==L&&e.size<L)_({status:{main:i("GET_LABEL_MIN_FILE_SIZE_EXCEEDED"),sub:l(i("GET_LABEL_MIN_FILE_SIZE"),{filesize:n(L,".",i("GET_FILE_SIZE_BASE"),i("GET_FILE_SIZE_LABELS",i))})}});else{var a=i("GET_MAX_TOTAL_FILE_SIZE");if(null!==a&&i("GET_ACTIVE_ITEMS").reduce((function(e,E){return e+E.fileSize}),0)>a)return void _({status:{main:i("GET_LABEL_MAX_TOTAL_FILE_SIZE_EXCEEDED"),sub:l(i("GET_LABEL_MAX_TOTAL_FILE_SIZE"),{filesize:n(a,".",i("GET_FILE_SIZE_BASE"),i("GET_FILE_SIZE_LABELS",i))})}});E(e)}}}))})),{options:{allowFileSizeValidation:[!0,_.BOOLEAN],maxFileSize:[null,_.INT],minFileSize:[null,_.INT],maxTotalFileSize:[null,_.INT],fileValidateSizeFilter:[null,_.FUNCTION],labelMinFileSizeExceeded:["File is too small",_.STRING],labelMinFileSize:["Minimum file size is {filesize}",_.STRING],labelMaxFileSizeExceeded:["File is too large",_.STRING],labelMaxFileSize:["Maximum file size is {filesize}",_.STRING],labelMaxTotalFileSizeExceeded:["Maximum total size exceeded",_.STRING],labelMaxTotalFileSize:["Maximum total file size is {filesize}",_.STRING]}}},"undefined"!=typeof window&&void 0!==window.document&&document.dispatchEvent(new CustomEvent("FilePond:pluginloaded",{detail:_})),_)),t=E({__proto__:null,default:e(n)},[n]);
4
+ import{d as e}from"./p-Z9TEkBrE.js";function E(e,E){return E.forEach((function(E){E&&"string"!=typeof E&&!Array.isArray(E)&&Object.keys(E).forEach((function(i){if("default"!==i&&!(i in e)){var _=Object.getOwnPropertyDescriptor(E,i);Object.defineProperty(e,i,_.get?_:{enumerable:!0,get:function(){return E[i]}})}}))})),Object.freeze(e)}var i,_,l={exports:{}},n=i?l.exports:(i=1,l.exports=(_=function(e){var E=e.addFilter,i=e.utils,_=i.Type,l=i.replaceInString,n=i.toNaturalFileSize;return E("ALLOW_HOPPER_ITEM",(function(e,E){var i=E.query;if(!i("GET_ALLOW_FILE_SIZE_VALIDATION"))return!0;var _=i("GET_MAX_FILE_SIZE");if(null!==_&&e.size>_)return!1;var l=i("GET_MIN_FILE_SIZE");return!(null!==l&&e.size<l)})),E("LOAD_FILE",(function(e,E){var i=E.query;return new Promise((function(E,_){if(!i("GET_ALLOW_FILE_SIZE_VALIDATION"))return E(e);var t=i("GET_FILE_VALIDATE_SIZE_FILTER");if(t&&!t(e))return E(e);var I=i("GET_MAX_FILE_SIZE");if(null!==I&&e.size>I)_({status:{main:i("GET_LABEL_MAX_FILE_SIZE_EXCEEDED"),sub:l(i("GET_LABEL_MAX_FILE_SIZE"),{filesize:n(I,".",i("GET_FILE_SIZE_BASE"),i("GET_FILE_SIZE_LABELS",i))})}});else{var L=i("GET_MIN_FILE_SIZE");if(null!==L&&e.size<L)_({status:{main:i("GET_LABEL_MIN_FILE_SIZE_EXCEEDED"),sub:l(i("GET_LABEL_MIN_FILE_SIZE"),{filesize:n(L,".",i("GET_FILE_SIZE_BASE"),i("GET_FILE_SIZE_LABELS",i))})}});else{var a=i("GET_MAX_TOTAL_FILE_SIZE");if(null!==a&&i("GET_ACTIVE_ITEMS").reduce((function(e,E){return e+E.fileSize}),0)>a)return void _({status:{main:i("GET_LABEL_MAX_TOTAL_FILE_SIZE_EXCEEDED"),sub:l(i("GET_LABEL_MAX_TOTAL_FILE_SIZE"),{filesize:n(a,".",i("GET_FILE_SIZE_BASE"),i("GET_FILE_SIZE_LABELS",i))})}});E(e)}}}))})),{options:{allowFileSizeValidation:[!0,_.BOOLEAN],maxFileSize:[null,_.INT],minFileSize:[null,_.INT],maxTotalFileSize:[null,_.INT],fileValidateSizeFilter:[null,_.FUNCTION],labelMinFileSizeExceeded:["File is too small",_.STRING],labelMinFileSize:["Minimum file size is {filesize}",_.STRING],labelMaxFileSizeExceeded:["File is too large",_.STRING],labelMaxFileSize:["Maximum file size is {filesize}",_.STRING],labelMaxTotalFileSizeExceeded:["Maximum total size exceeded",_.STRING],labelMaxTotalFileSize:["Maximum total file size is {filesize}",_.STRING]}}},"undefined"!=typeof window&&void 0!==window.document&&document.dispatchEvent(new CustomEvent("FilePond:pluginloaded",{detail:_})),_)),t=E({__proto__:null,default:e(n)},[n]);
5
5
  /*!
6
6
  * FilePondPluginFileValidateSize 2.2.8
7
7
  * Licensed under MIT, https://opensource.org/licenses/MIT/
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r as s,h as e,H as t}from"./p-DcQSprhU.js";const a=class{constructor(e){s(this,e),this.type="normal",this.width="100%",this.height="100%"}render(){return e(t,{key:"9f9448d939ba69f60eca8dc6ea2ff98a047d6770",class:"s-skeleton-wrapper",style:{width:this.width,height:this.height}},e("div",{key:"3b43bb472316b5541a90081a5f3cb6ef91558212",class:{"s-skeleton-item":!0,"s-skeleton-item-circular":"circle"==this.type}}," "))}};a.style=":host{display:block}";export{a as salla_skeleton}
4
+ import{r as s,h as e,H as t}from"./p-Z9TEkBrE.js";const a=class{constructor(e){s(this,e),this.type="normal",this.width="100%",this.height="100%"}render(){return e(t,{key:"9f9448d939ba69f60eca8dc6ea2ff98a047d6770",class:"s-skeleton-wrapper",style:{width:this.width,height:this.height}},e("div",{key:"3b43bb472316b5541a90081a5f3cb6ef91558212",class:{"s-skeleton-item":!0,"s-skeleton-item-circular":"circle"==this.type}}," "))}};a.style=":host{display:block}";export{a as salla_skeleton}
@@ -0,0 +1,4 @@
1
+ /*!
2
+ * Crafted with ❤ by Salla
3
+ */
4
+ import{r as s,h as t,H as a,a as e}from"./p-Z9TEkBrE.js";import{S as i}from"./p-Ctkfc4K-.js";import{S as c}from"./p-CXRKXFgT.js";import{T as r}from"./p-CJUR4sUM.js";import{A as o}from"./p-DCZbpt2a.js";import{P as n}from"./p-DY4LZmNP.js";import{a as l}from"./p-CgtvEd63.js";const h=class{constructor(t){s(this,t),this.internalOffers=[],this.showAll=!1,this.freeLabel="",this.receivedOffer="",this.discountAmountLabel="",this.showMoreOffers="",this.icons={DiscountCouponIcon:'\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>discount-coupon</title>\n<path d="M27 28h-22c-0.552 0-1-0.448-1-1v0c0-1.657-1.343-3-3-3v0c-0.552 0-1-0.448-1-1v0-12c0-0.552 0.448-1 1-1v0c1.657 0 3-1.343 3-3v0c0-0.552 0.448-1 1-1v0h22c0.552 0 1 0.448 1 1v0c0 1.657 1.343 3 3 3v0c0.552 0 1 0.448 1 1v0 12c0 0.552-0.448 1-1 1v0c-1.657 0-3 1.343-3 3v0c0 0.552-0.448 1-1 1v0zM5.9 26h20.2c0.415-1.964 1.936-3.485 3.867-3.894l0.033-0.006v-10.2c-1.964-0.415-3.485-1.936-3.894-3.867l-0.006-0.033h-20.2c-0.415 1.964-1.936 3.485-3.867 3.894l-0.033 0.006v10.2c1.964 0.415 3.485 1.936 3.894 3.867l0.006 0.033zM20 7h2v3h-2v-3zM20 12h2v4h-2v-4zM20 18h2v4h-2v-4zM20 24h2v3h-2v-3zM9 16c-1.657 0-3-1.343-3-3s1.343-3 3-3c1.657 0 3 1.343 3 3v0c0 1.657-1.343 3-3 3v0zM9 12c-0.552 0-1 0.448-1 1s0.448 1 1 1c0.552 0 1-0.448 1-1v0c0-0.552-0.448-1-1-1v0zM15 24c-1.657 0-3-1.343-3-3s1.343-3 3-3c1.657 0 3 1.343 3 3v0c0 1.657-1.343 3-3 3v0zM15 20c-0.552 0-1 0.448-1 1s0.448 1 1 1c0.552 0 1-0.448 1-1v0c0-0.552-0.448-1-1-1v0zM7 24c-0.552-0-1-0.448-1-1 0-0.244 0.088-0.468 0.233-0.642l-0.001 0.002 10-12c0.185-0.221 0.461-0.36 0.769-0.36 0.553 0 1.001 0.448 1.001 1.001 0 0.245-0.088 0.469-0.233 0.643l0.001-0.002-10 12c-0.185 0.22-0.46 0.358-0.767 0.358-0.001 0-0.002 0-0.003 0h0z"></path>\n</svg>\n',GiftIcon:c,FireIcon:'\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>fire</title>\n<path d="M21.56 3.009c-0.052-0.047-0.116-0.065-0.173-0.103-0.073-0.048-0.143-0.1-0.223-0.132-0.083-0.033-0.165-0.047-0.252-0.063-0.081-0.016-0.16-0.035-0.243-0.035-0.089 0-0.172 0.020-0.26 0.037-0.080 0.016-0.159 0.028-0.236 0.059-0.084 0.035-0.157 0.088-0.235 0.14-0.053 0.036-0.115 0.053-0.165 0.097-0.049 0.044-0.988 0.895-2.288 2.255-2.364-2.839-4.476-4.815-4.576-4.908-0.056-0.052-0.127-0.075-0.188-0.115-0.075-0.049-0.143-0.105-0.224-0.137-0.080-0.032-0.163-0.041-0.245-0.057-0.085-0.016-0.167-0.040-0.252-0.040-0.084 0-0.163 0.023-0.245 0.039-0.087 0.016-0.172 0.025-0.253 0.059-0.080 0.032-0.147 0.087-0.22 0.135-0.063 0.041-0.133 0.064-0.189 0.116-0.453 0.423-11.092 10.408-11.092 18.095 0 7.977 4.935 13.549 12 13.549h8.667c6.673 0 11.333-5.115 11.333-12.439 0-7.052-10.013-16.167-10.44-16.552zM20.667 29.333h-7.777c-2.924 0-4.889-2.044-4.889-5.084 0-2.317 2.816-6.441 4.888-8.887 0.76 0.909 2.755 3.397 3.969 5.869 0.212 0.431 0.639 0.715 1.117 0.743 0.489 0.031 0.937-0.203 1.197-0.605 0.552-0.849 1.109-1.596 1.497-2.093 1.491 1.897 3.331 4.78 3.331 6.399 0 2.188-1.34 3.659-3.333 3.659zM26.537 27.052c0.081-0.44 0.129-0.899 0.129-1.377 0-3.269-3.713-7.847-4.46-8.735l-0.523-0.617c-0.507-0.599-1.528-0.599-2.035 0l-0.531 0.627c-0.147 0.175-0.495 0.599-0.936 1.187-1.595-2.597-3.495-4.776-3.595-4.889l-0.697-0.793c-0.507-0.577-1.499-0.577-2.004 0l-0.697 0.795c-0.6 0.684-5.856 6.803-5.856 11.001 0 0.881 0.127 1.712 0.356 2.484-1.896-1.933-3.023-4.821-3.023-8.283 0-4.915 6.073-11.997 9.329-15.255 1.001 1.008 2.692 2.789 4.368 4.927 0.243 0.309 0.609 0.496 1.001 0.509h0.048c0.376 0 0.735-0.159 0.988-0.439 0.889-0.981 1.693-1.795 2.269-2.359 3.051 2.965 8.663 9.323 8.663 13.727 0 3.171-1.031 5.769-2.796 7.491z"></path>\n</svg>\n',SpecialDiscountIcon:i,TagMoneyIcon:r},this.visibleOffersCount=3,this.handleCartItemUpdated=s=>{const t=s.data?.cart?.items?.find((s=>String(s.id)===String(this.itemId)));t&&(this.internalQuantity=t.quantity,this.internalOffers=t.detailed_offers||[],this.internalProductPrice=t.product_price)},this.toggleShowAll=()=>{this.showAll=!this.showAll}}async componentWillLoad(){await Salla.onReady(),await salla.lang.onLoaded((()=>{this.freeLabel=salla.lang.get("common.elements.freeExclam"),this.receivedOffer=salla.lang.get("pages.cart.received_offer"),this.discountAmountLabel=salla.lang.get("pages.cart.discount_amount"),this.showMoreOffers=salla.lang.get("pages.cart.show_more_offers")})),this.internalQuantity=this.quantity,this.internalOffers=this.parseOffers(this.offers),this.internalProductPrice=this.productPrice}componentDidLoad(){Salla.cart.event.onLatestFetched(this.handleCartItemUpdated),Salla.cart.event.onItemUpdated(this.handleCartItemUpdated),Salla.cart.event.onCouponAdded(this.handleCartItemUpdated),Salla.cart.event.onCouponDeleted(this.handleCartItemUpdated)}parseOffers(s){try{if("string"!=typeof s)return console.warn("Offers is not a string. Returning as-is.",s),Array.isArray(s)?s:[];const t=JSON.parse(s||"[]");return Array.isArray(t)?t:[]}catch(s){return console.error("Failed to parse offers",s),[]}}get visibleOffers(){return this.internalOffers.slice(0,this.visibleOffersCount)}get hiddenOffers(){return this.internalOffers.slice(this.visibleOffersCount)}getPaidQty(s,t){return s-t.free_quantity}renderOffer(s,a){const e=this.getPaidQty(s,a);return t("div",{class:"s-cart-item-offers-box"},a.free_quantity>0&&e>0&&t("div",{class:"s-cart-item-offers-paid-free"},t("div",{class:"s-cart-item-offers-line"},salla.helpers.number(e)," × ",t("span",{innerHTML:salla.money(this.internalProductPrice)})),t("div",{class:"s-cart-item-offers-line"},salla.helpers.number(a.free_quantity)," ×",t("span",{class:"s-cart-item-offers-regular-price",innerHTML:salla.money(this.internalProductPrice)}),t("span",{class:"s-cart-item-offers-free-label"},this.freeLabel))),t("div",{class:"s-cart-item-offers-details"},t("span",{class:"s-cart-item-offers-icon",innerHTML:this.icons[a.discount_icon]||""}),t("div",null,t("p",{class:"s-cart-item-offers-title"},this.receivedOffer.replace(":offer",a.offer_name)),t("p",{class:"s-cart-item-offers-discount"},t("span",{innerHTML:this.discountAmountLabel.replace(":amount",salla.money(a.discount_amount.toFixed(2)))})))))}render(){return this.internalOffers?.length?t("div",{class:"s-cart-item-offers-container",id:`offers_list_${this.itemId}`},this.visibleOffers.map((s=>this.renderOffer(this.internalQuantity,s))),this.internalOffers?.length>this.visibleOffersCount&&t("div",{class:"s-cart-item-offers-show-more"},t("button",{class:"s-cart-item-offers-show-more-btn",onClick:this.toggleShowAll,type:"button"},t("span",{class:"s-cart-item-offers-show-more-label"},"+",this.hiddenOffers.length," ",this.showMoreOffers,t("span",{innerHTML:o,class:{"s-cart-item-offers-arrow-icon":!0,"s-cart-item-offers-arrow-open":this.showAll}})))),this.showAll&&t("div",{class:"s-cart-item-offers-collapsed",id:`offers_${this.itemId}`},this.hiddenOffers.map((s=>this.renderOffer(this.internalQuantity,s))))):null}};h.style=":host{display:block}";const f=class{constructor(t){s(this,t),this.cartSummaryCount=salla.storage.get("cart.summary.count")||0,this.cartSummaryTotal=salla.storage.get("cart.summary.total")||0,this.cartLabel="ar"===salla.config.get("user.language_code")?"السلة":"Cart",salla.cart.event.onUpdated((s=>{this.cartSummaryCount=s.count||0,this.cartSummaryTotal=s.total||0}))}async animateToCart(s){if(document.querySelectorAll(".s-cart-thumb").forEach((s=>s.remove())),!s?.src)return void salla.log("Failed to get the img element");let t=this.host.querySelector("#s-cart-icon"),a=t.getBoundingClientRect(),e=a.top+window.scrollY,i=a.left+window.scrollX,c=s.getBoundingClientRect(),r=s.offsetWidth+"px",o=s.offsetHeight+"px",n=c.top,h=c.left,f=document.createElement("img");f.src=s.getAttribute("src"),f.className="s-cart-thumb",f.setAttribute("style","object-fit:cover; width:"+r+"; height:"+o+"; top:"+n+"px; left:"+h+"px;z-index:99999999; "),document.body.append(f);let d=document.querySelector(".s-cart-thumb");t.classList.remove("animated","rubberBand"),(new l.timeline).add({targets:d,width:[150,30],height:[150,30],top:[n,window.scrollY>0?e-window.scrollY-40:e-40],left:[h,i],borderRadius:["20%","50%"],easing:"easeOutExpo",duration:1200},"+=200").add({targets:d,width:[30,0],height:[30,0],opacity:[1,0],easing:"easeOutExpo",top:[window.scrollY>0?e-window.scrollY-40:e-40,window.scrollY>0?e-window.scrollY+10:e+10],left:[i,i+10]},"-=500").add({complete:function(){t.classList.add("animated","rubberBand"),d.remove()}},"-=1700")}componentWillLoad(){return new Promise((s=>salla.onReady(s)))}getCartLink(){let s=salla.url.get("cart");const t=salla.storage.get("scope")||salla.config.get("store.scope");if(t&&t.id)try{const a=new URL(s);return a.searchParams.set("scope",t.id),t.allocation_type&&a.searchParams.set("allocation_type",t.allocation_type),t.allocation_id&&a.searchParams.set("allocation_id",t.allocation_id),a.toString()}catch(a){const e=s.includes("?")?"&":"?",i=new URLSearchParams;return i.set("scope",String(t.id)),t.allocation_type&&i.set("allocation_type",t.allocation_type),t.allocation_id&&i.set("allocation_id",t.allocation_id),`${s}${e}${i.toString()}`}return s}render(){return t(a,{key:"4d80eb7d5ea545740fd4c631b98297164e4afded"},t("a",{key:"f32a160c33514e98a35067eb8dc07aa15b7ddb9b",class:"s-cart-summary-wrapper",href:this.getCartLink()},t("div",{key:"b8ab102d86c3448d03403bade826d42c2fcee681",id:"s-cart-icon"},t("slot",{key:"2dae30fcc74ef4c6e74d25f745aea0893cdb87c9",name:"icon"},t("i",{key:"df69ad3f3e7affe12ce26d6e16aa2e9e4670f2fc",class:"s-cart-summary-icon",innerHTML:n}))),t("span",{key:"98927818c1f6b6e7138a8f818da96054c2d44b62",class:"s-cart-summary-count"},salla.helpers.number(this.cartSummaryCount)),t("p",{key:"71a40df1d13608e4c9a988ee927ae5ebf1482635",class:"s-cart-summary-content"},this.showCartLabel&&t("span",{key:"9e8e2c66c3784ccebfc4bfba5ab2554a927b172c",class:"s-cart-summary-label"},this.cartLabel),t("b",{key:"bbc35cf2a4e793c3cf4d1a637740683569fd306d",class:"s-cart-summary-total",innerHTML:salla.money(this.cartSummaryTotal)}))))}get host(){return e(this)}};f.style="";export{h as salla_cart_item_offers,f as salla_cart_summary}
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r as t,h as i,H as e}from"./p-DcQSprhU.js";var s,a;!function(t){t.PERCENTAGE="percentage",t.FIXED="fixed",t.FREE_PRODUCT="free_product"}(s||(s={})),function(t){t.PRODUCT_COUNT="products_count",t.PRODUCT_PURCHASE="order_amount"}(a||(a={}));const l=class{constructor(i){t(this,i),this.offer=null,this.products={},this.isLoading=!1,this.canRender=!0}componentWillLoad(){salla.onReady().then((()=>{if(!salla.config.get("store.features")?.includes("conditional-offer")||""!==salla.storage.get("cart")&&!salla.storage.get("cart")?.summary?.count)throw new Error("feature or cart object does not existed")})).then((()=>salla.api.cart.offers())).then((({data:t})=>{if(this.offer=t.find((t=>"conditional"===t.type)),this.offer)return this.isLoading=!0,this.offer.details.discounts.unshift({value:0,min_spend:0}),this.updateInitialOfferValue();this.canRender=!1})).then((()=>{if(this.offer)return this.getProducts()})).then((()=>{this.offer&&salla.event.on("cart::updated",(t=>this.updateOfferValues(t)))})).catch((t=>{this.canRender=!1,salla.logger.warn("salla-conditional-offer:: ",t)})).finally((()=>{this.isLoading=!1}))}getProducts(){const t=this.offer.details.discounts.filter((({type:t})=>t===s.FREE_PRODUCT)).map((({value:t})=>t)).filter(Boolean);if(t.length>0)return salla.product.fetch({source:"selected",source_value:t}).then((t=>{const i=t?.data;if(i&&Array.isArray(i)){const t={...this.products};i.forEach((({id:i,url:e,image:s,name:a,price:l})=>{i&&a&&s?.url&&e&&void 0!==l&&(t[i]={url:e,image:s,name:a,price:l})})),this.products=t}}))}updateInitialOfferValue(){return salla.api.cart.details().then((({data:{cart:t}})=>this.updateOfferValues(t)))}updateOfferValues({items:t,sub_total:i}){const e=this.offer.details.based_on===a.PRODUCT_COUNT?t?.reduce(((t,{quantity:i})=>t+i),0)??0:i;return this.offer={...this.offer,details:{...this.offer?.details,current_value:e}},this.offer}renderTooltip(t){const e=t.value,s=this.products[e];return s?i("salla-tooltip",{class:"absolute left-0 -top-2",targetId:`avatar-product-${e}`,theme:"dark"},i("div",{class:"flex gap-3 text-start"},s?.image?.url&&i("img",{src:s.image.url,alt:s?.image?.alt||s.name||"",class:"w-12 h-12 object-cover rounded-lg flex-shrink-0",loading:"lazy",decoding:"async"}),i("div",{class:"flex-1"},i("div",{class:"leading-tight mb-1"},s.name),i("div",{class:"text-xs text-gray-300",innerHTML:salla.money(s.price)})))):(salla.logger.error(`salla-conditional-offer:: there is no product with id (${t.value})!`),null)}getCheckpointContent(t){if(t.type===s.PERCENTAGE)return`${t.value}%`;if(t.type===s.FIXED)return i("span",{innerHTML:salla.money(t.value)});if(t.type!==s.FREE_PRODUCT)return salla.logger.error(`salla-conditional-offer:: unexpected type (${t.type})!`),"";const e=this.products[t.value];return e?i("a",{class:"s-conditional-offer-product-link",href:e.url},i("img",{class:"s-conditional-offer-checkpoint-image-content",loading:"lazy",decoding:"async",alt:e?.image?.alt||"",src:e?.image?.url})):(salla.logger.error(`salla-conditional-offer:: there is no product with id (${t.value})!`),"")}getOfferType(t){const i=this.offer.details?.based_on;if(i===a.PRODUCT_COUNT)try{return salla.lang.choice("blocks.header.products_count",t.min_spend)}catch(i){return salla.logger.warn("salla-conditional-offer:: invalid products_count interval",i),`${t.min_spend}`}return i===a.PRODUCT_PURCHASE?salla.money(t.min_spend):(salla.logger.warn(`salla-conditional-offer:: Unexpected offer detail's based_on value: ${i}`),`${t.min_spend}`)}clamp(t,i,e){return Math.max(i,Math.min(t,e))}mapValueRanges(t,i,e,s,a){const l=(t-i)*(a-s)/(e-i)+s;return l===Number.POSITIVE_INFINITY?100:l===Number.NEGATIVE_INFINITY?0:this.clamp(l,0,100)}getCheckPointView(t,e){const a=this.offer.details.discounts.findIndex((({min_spend:i})=>i===t.min_spend)),l=this.mapValueRanges(this.offer.details.current_value,this.offer.details.discounts[a-1]?.min_spend??0,t.min_spend,0,100),n=t.min_spend<=this.offer.details.current_value;return i("div",{class:"s-conditional-offer-checkpoint-container"},e>0?[i("div",{key:"progress-line",class:"s-conditional-offer-progress-line-container"},i("div",{class:"s-conditional-offer-progress-line-inactive"}),i("div",{class:"s-conditional-offer-progress-line-active",style:{width:`${l}%`}})),i("div",{key:"checkpoint",class:"s-conditional-offer-checkpoint "+(n?"s-conditional-offer-active-checkpoint":"")},i("div",{class:"s-conditional-offer-item-avatar-content "+(n?"active":""),id:t.type===s.FREE_PRODUCT?`avatar-product-${t.value}`:`avatar-${t.value??e}`},this.products&&this.getCheckpointContent(t)),this.products&&t.type===s.FREE_PRODUCT&&this.renderTooltip(t),i("div",{class:"s-conditional-offer-checkpoint-label "+(n?"active":""),innerHTML:this.getOfferType(t)}))]:i("div",{key:"label",class:{"s-conditional-offer-checkpoint-label":!0,"first-checkpoint":0===e,active:n,hidden:0===e,"sm:block":0===e},innerHTML:this.getOfferType(t)}))}getLoadingSkeletonView(){return i(e,{class:"s-conditional-offer-container"},i("div",{class:"s-conditional-offer-skeleton-inner-container"},i("div",{class:"s-conditional-offer-skeleton-subtitle"},i("salla-skeleton",{height:"16px",width:"30%"})),i("div",{class:"s-conditional-offer-skeleton-subtitle"},i("salla-skeleton",{height:"16px",width:"35%"})),i("div",{class:"s-conditional-offer-skeleton-checkpoints-wrapper"},Array(3).fill(null).map((()=>[i("salla-skeleton",{key:"checkpoint-line",height:"8px"}),i("div",{key:"checkpoint"},i("salla-skeleton",{height:"60px",width:"60px",type:"circle"}))])))))}render(){return this.canRender?this.isLoading?this.getLoadingSkeletonView():this.offer?i(e,{class:"s-conditional-offer-container"},i("div",{class:"s-conditional-offer-title-wrapper"},i("div",{class:"s-conditional-offer-title"},this.offer.title),this.offer.description?i("div",{class:"s-conditional-offer-subtitle"},this.offer.description," ",i("i",{class:"sicon-information"})):null),i("div",{class:"s-conditional-offer-progress-container"},this.offer.details.discounts.map(((t,e)=>i("div",{class:{"flex-1":e>0},key:t.min_spend},this.getCheckPointView(t,e)))))):null:null}};l.style=":host{display:block}";export{l as salla_conditional_offer}
4
+ import{r as t,h as i,H as e}from"./p-Z9TEkBrE.js";var s,a;!function(t){t.PERCENTAGE="percentage",t.FIXED="fixed",t.FREE_PRODUCT="free_product"}(s||(s={})),function(t){t.PRODUCT_COUNT="products_count",t.PRODUCT_PURCHASE="order_amount"}(a||(a={}));const l=class{constructor(i){t(this,i),this.offer=null,this.products={},this.isLoading=!1,this.canRender=!0}componentWillLoad(){salla.onReady().then((()=>{if(!salla.config.get("store.features")?.includes("conditional-offer")||""!==salla.storage.get("cart")&&!salla.storage.get("cart")?.summary?.count)throw new Error("feature or cart object does not existed")})).then((()=>salla.api.cart.offers())).then((({data:t})=>{if(this.offer=t.find((t=>"conditional"===t.type)),this.offer)return this.isLoading=!0,this.offer.details.discounts.unshift({value:0,min_spend:0}),this.updateInitialOfferValue();this.canRender=!1})).then((()=>{if(this.offer)return this.getProducts()})).then((()=>{this.offer&&salla.event.on("cart::updated",(t=>this.updateOfferValues(t)))})).catch((t=>{this.canRender=!1,salla.logger.warn("salla-conditional-offer:: ",t)})).finally((()=>{this.isLoading=!1}))}getProducts(){const t=this.offer.details.discounts.filter((({type:t})=>t===s.FREE_PRODUCT)).map((({value:t})=>t)).filter(Boolean);if(t.length>0)return salla.product.fetch({source:"selected",source_value:t}).then((t=>{const i=t?.data;if(i&&Array.isArray(i)){const t={...this.products};i.forEach((({id:i,url:e,image:s,name:a,price:l})=>{i&&a&&s?.url&&e&&void 0!==l&&(t[i]={url:e,image:s,name:a,price:l})})),this.products=t}}))}updateInitialOfferValue(){return salla.api.cart.details().then((({data:{cart:t}})=>this.updateOfferValues(t)))}updateOfferValues({items:t,sub_total:i}){const e=this.offer.details.based_on===a.PRODUCT_COUNT?t?.reduce(((t,{quantity:i})=>t+i),0)??0:i;return this.offer={...this.offer,details:{...this.offer?.details,current_value:e}},this.offer}renderTooltip(t){const e=t.value,s=this.products[e];return s?i("salla-tooltip",{class:"absolute left-0 -top-2",targetId:`avatar-product-${e}`,theme:"dark"},i("div",{class:"flex gap-3 text-start"},s?.image?.url&&i("img",{src:s.image.url,alt:s?.image?.alt||s.name||"",class:"w-12 h-12 object-cover rounded-lg flex-shrink-0",loading:"lazy",decoding:"async"}),i("div",{class:"flex-1"},i("div",{class:"leading-tight mb-1"},s.name),i("div",{class:"text-xs text-gray-300",innerHTML:salla.money(s.price)})))):(salla.logger.error(`salla-conditional-offer:: there is no product with id (${t.value})!`),null)}getCheckpointContent(t){if(t.type===s.PERCENTAGE)return`${t.value}%`;if(t.type===s.FIXED)return i("span",{innerHTML:salla.money(t.value)});if(t.type!==s.FREE_PRODUCT)return salla.logger.error(`salla-conditional-offer:: unexpected type (${t.type})!`),"";const e=this.products[t.value];return e?i("a",{class:"s-conditional-offer-product-link",href:e.url},i("img",{class:"s-conditional-offer-checkpoint-image-content",loading:"lazy",decoding:"async",alt:e?.image?.alt||"",src:e?.image?.url})):(salla.logger.error(`salla-conditional-offer:: there is no product with id (${t.value})!`),"")}getOfferType(t){const i=this.offer.details?.based_on;if(i===a.PRODUCT_COUNT)try{return salla.lang.choice("blocks.header.products_count",t.min_spend)}catch(i){return salla.logger.warn("salla-conditional-offer:: invalid products_count interval",i),`${t.min_spend}`}return i===a.PRODUCT_PURCHASE?salla.money(t.min_spend):(salla.logger.warn(`salla-conditional-offer:: Unexpected offer detail's based_on value: ${i}`),`${t.min_spend}`)}clamp(t,i,e){return Math.max(i,Math.min(t,e))}mapValueRanges(t,i,e,s,a){const l=(t-i)*(a-s)/(e-i)+s;return l===Number.POSITIVE_INFINITY?100:l===Number.NEGATIVE_INFINITY?0:this.clamp(l,0,100)}getCheckPointView(t,e){const a=this.offer.details.discounts.findIndex((({min_spend:i})=>i===t.min_spend)),l=this.mapValueRanges(this.offer.details.current_value,this.offer.details.discounts[a-1]?.min_spend??0,t.min_spend,0,100),n=t.min_spend<=this.offer.details.current_value;return i("div",{class:"s-conditional-offer-checkpoint-container"},e>0?[i("div",{key:"progress-line",class:"s-conditional-offer-progress-line-container"},i("div",{class:"s-conditional-offer-progress-line-inactive"}),i("div",{class:"s-conditional-offer-progress-line-active",style:{width:`${l}%`}})),i("div",{key:"checkpoint",class:"s-conditional-offer-checkpoint "+(n?"s-conditional-offer-active-checkpoint":"")},i("div",{class:"s-conditional-offer-item-avatar-content "+(n?"active":""),id:t.type===s.FREE_PRODUCT?`avatar-product-${t.value}`:`avatar-${t.value??e}`},this.products&&this.getCheckpointContent(t)),this.products&&t.type===s.FREE_PRODUCT&&this.renderTooltip(t),i("div",{class:"s-conditional-offer-checkpoint-label "+(n?"active":""),innerHTML:this.getOfferType(t)}))]:i("div",{key:"label",class:{"s-conditional-offer-checkpoint-label":!0,"first-checkpoint":0===e,active:n,hidden:0===e,"sm:block":0===e},innerHTML:this.getOfferType(t)}))}getLoadingSkeletonView(){return i(e,{class:"s-conditional-offer-container"},i("div",{class:"s-conditional-offer-skeleton-inner-container"},i("div",{class:"s-conditional-offer-skeleton-subtitle"},i("salla-skeleton",{height:"16px",width:"30%"})),i("div",{class:"s-conditional-offer-skeleton-subtitle"},i("salla-skeleton",{height:"16px",width:"35%"})),i("div",{class:"s-conditional-offer-skeleton-checkpoints-wrapper"},Array(3).fill(null).map((()=>[i("salla-skeleton",{key:"checkpoint-line",height:"8px"}),i("div",{key:"checkpoint"},i("salla-skeleton",{height:"60px",width:"60px",type:"circle"}))])))))}render(){return this.canRender?this.isLoading?this.getLoadingSkeletonView():this.offer?i(e,{class:"s-conditional-offer-container"},i("div",{class:"s-conditional-offer-title-wrapper"},i("div",{class:"s-conditional-offer-title"},this.offer.title),this.offer.description?i("div",{class:"s-conditional-offer-subtitle"},this.offer.description," ",i("i",{class:"sicon-information"})):null),i("div",{class:"s-conditional-offer-progress-container"},this.offer.details.discounts.map(((t,e)=>i("div",{class:{"flex-1":e>0},key:t.min_spend},this.getCheckPointView(t,e)))))):null:null}};l.style=":host{display:block}";export{l as salla_conditional_offer}
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r as a,h as s,a as t}from"./p-DcQSprhU.js";import{a as c}from"./p-CgtvEd63.js";import{f as e,t as l}from"./p-CO-PeZ27.js";import{S as i}from"./p-DLNIOD9t.js";import{S as n}from"./p-8Tsmrwno.js";var o;!function(a){a.FACEBOOK="facebook",a.TWITTER="twitter",a.WHATSAPP="whatsapp",a.EMAIL="email",a.COPY_LINK="copy_link"}(o||(o={}));const r=class{constructor(s){a(this,s),this.opened=!1,this.allPlatforms=[o.WHATSAPP,o.FACEBOOK,o.TWITTER,o.EMAIL,o.COPY_LINK],this.platformIcons=[{icon:'\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>whatsapp</title>\n<path d="M16 32c-0.008 0-0.018 0-0.028 0-3.1 0-5.993-0.887-8.439-2.421l0.066 0.039-7.2 2.3 2.336-6.964c-1.713-2.492-2.736-5.575-2.736-8.897 0-0.020 0-0.040 0-0.060v0.003c0.009-8.833 7.167-15.991 15.999-16h0.001c8.837 0 16 7.163 16 16s-7.163 16-16 16v0zM7.906 27.424l0.4 0.264c2.169 1.449 4.837 2.312 7.707 2.312 7.732 0 14-6.268 14-14s-6.268-14-14-14c-0.004 0-0.009 0-0.013 0h0.001c-7.729 0.008-13.992 6.271-14 13.999v0.001c-0 0.010-0 0.021-0 0.032 0 3.072 1 5.909 2.693 8.206l-0.027-0.038 0.304 0.416-1.4 4.2zM20.716 24.958c-1.684-0.131-3.237-0.574-4.641-1.271l0.073 0.033c-3.098-1.456-5.634-3.668-7.438-6.405l-0.042-0.067c-1.102-1.357-1.819-3.067-1.962-4.938l-0.002-0.030c-0.001-0.036-0.001-0.078-0.001-0.12 0-1.575 0.66-2.995 1.719-4l0.002-0.002c0.547-0.52 1.289-0.839 2.105-0.839 0.033 0 0.066 0.001 0.099 0.002l-0.005-0c0.2 0 0.378 0 0.542 0.018 0.016-0.001 0.035-0.001 0.054-0.001 0.815 0 1.502 0.549 1.711 1.298l0.003 0.012 0.324 0.782c0.376 0.906 0.858 2.068 0.942 2.244 0.144 0.251 0.23 0.552 0.23 0.873 0 0.286-0.068 0.557-0.188 0.797l0.005-0.010c-0.149 0.307-0.332 0.57-0.55 0.802l0.002-0.002c-0.148 0.168-0.248 0.274-0.346 0.378s-0.172 0.18-0.26 0.284c0.575 0.92 1.237 1.713 1.992 2.406l0.008 0.008c0.829 0.758 1.802 1.373 2.872 1.8l0.064 0.022c0.369-0.266 0.672-0.6 0.896-0.985l0.008-0.015 0.174-0.232c0.328-0.484 0.875-0.798 1.495-0.798 0.249 0 0.487 0.051 0.703 0.142l-0.012-0.004c0.492 0.168 2.922 1.372 2.946 1.384l0.228 0.11c0.415 0.149 0.758 0.417 0.996 0.763l0.004 0.007c0.107 0.349 0.169 0.75 0.169 1.166 0 0.591-0.125 1.153-0.349 1.661l0.010-0.026c-0.702 1.368-1.983 2.353-3.511 2.637l-0.031 0.005c-0.309 0.071-0.663 0.112-1.028 0.112-0.004 0-0.007 0-0.011 0h0.001zM10.632 9.318c-0.028-0.002-0.062-0.004-0.095-0.004-0.245 0-0.472 0.076-0.659 0.206l0.004-0.002c-0.726 0.651-1.18 1.591-1.18 2.638 0 0.044 0.001 0.087 0.002 0.13l-0-0.006c0.122 1.404 0.662 2.662 1.495 3.671l-0.009-0.011 0.12 0.168c1.627 2.491 3.865 4.46 6.504 5.723l0.096 0.041c3.136 1.288 3.916 1.124 4.426 1.014 0.87-0.159 1.601-0.656 2.067-1.347l0.007-0.011c0.12-0.316 0.204-0.682 0.237-1.063l0.001-0.015-0.040-0.018-0.256-0.124c-0.8-0.4-2.46-1.2-2.734-1.292l-0.058 0.184c-0.346 0.501-0.684 0.934-1.045 1.347l0.015-0.017c-0.344 0.349-0.821 0.565-1.349 0.565-0.28 0-0.546-0.061-0.785-0.17l0.012 0.005c-1.403-0.547-2.609-1.301-3.646-2.239l0.010 0.009c-0.975-0.891-1.81-1.912-2.486-3.039l-0.034-0.061c-0.152-0.244-0.242-0.54-0.242-0.857 0-0.463 0.191-0.88 0.499-1.178l0-0c0.13-0.162 0.264-0.302 0.4-0.444l0.236-0.256c0.091-0.096 0.177-0.201 0.254-0.311l0.006-0.009c-0.158-0.36-0.622-1.472-0.988-2.352l-0.322-0.772-0.038-0.086c-0.188-0.010-0.302-0.016-0.426-0.016zM12.462 12.442v0.012z"></path>\n</svg>\n',name:o.WHATSAPP},{icon:e,name:o.FACEBOOK},{icon:l,name:o.TWITTER},{icon:i,name:o.EMAIL},{icon:'\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>link</title>\n<path d="M19.247 23.019l-4.189 4.189c-2.831 2.831-7.435 2.831-10.265 0-1.371-1.372-2.125-3.193-2.125-5.132s0.755-3.761 2.125-5.133l4.189-4.191c0.521-0.521 0.521-1.364 0-1.885s-1.364-0.521-1.885 0l-4.189 4.191c-1.875 1.875-2.907 4.367-2.907 7.019s1.032 5.143 2.907 7.017 4.368 2.907 7.019 2.907 5.143-1.032 7.017-2.908l4.189-4.189c0.521-0.521 0.521-1.364 0-1.885s-1.364-0.52-1.885 0.001zM22.276 9.724c-0.521-0.521-1.364-0.521-1.885 0l-10.667 10.667c-0.521 0.521-0.521 1.364 0 1.885 0.26 0.26 0.601 0.391 0.943 0.391s0.683-0.131 0.943-0.391l10.667-10.667c0.521-0.521 0.521-1.364 0-1.885zM29.093 2.908c-1.875-1.876-4.368-2.908-7.019-2.908s-5.143 1.032-7.017 2.908l-4.189 4.188c-0.521 0.521-0.521 1.364 0 1.885s1.364 0.521 1.885 0l4.189-4.189c2.831-2.831 7.435-2.831 10.265 0 1.371 1.372 2.125 3.193 2.125 5.132s-0.755 3.761-2.125 5.133l-4.189 4.191c-0.521 0.521-0.521 1.364 0 1.885 0.26 0.26 0.601 0.391 0.943 0.391s0.683-0.131 0.943-0.391l4.189-4.191c1.875-1.875 2.907-4.367 2.907-7.019s-1.032-5.143-2.907-7.016z"></path>\n</svg>\n',name:o.COPY_LINK}],this.convertedPlatforms=[],this.url="",this.urlName="",this.platforms="facebook,twitter,whatsapp,email,copy_link"}componentWillLoad(){if(this.host.hasAttribute("aria-label")&&this.host.removeAttribute("aria-label"),document.getElementById("a2a-script"))return;const a=document.createElement("script");a.src="https://static.addtoany.com/menu/page.js",a.setAttribute("id","a2a-script"),a.async=!0,a.onload=function(){window.a2a_config.locale=salla.config.get("user.language_code",salla.lang.getLocale()),window.a2a_config.callbacks=window.a2a_config.callbacks||[],window.a2a_config.callbacks.push({share:a=>{const s={share_via:a.service.toLowerCase(),url:a.url,title:a.title};salla.event.emit("share-element",s)}})},document.body.appendChild(a)}async open(){const a=(new c.timeline).add({targets:this.shareMenu,translateY:[-50,0],opacity:[0,1],duration:300,podding:"0",easing:"easeInOutSine"});a.add({targets:this.shareMenu.children,translateZ:0,translateY:[-30,0],scaleY:[0,1],opacity:[0,1],duration:1400,delay:c.stagger(100)},"-=200"),this.opened=!this.opened,this.opened?this.shareMenu.classList.add("opened"):(a.pause(),a.seek(0),this.shareMenu.classList.remove("opened"))}async refresh(){window.a2a?.init("page")}render(){return s("div",{key:"b3e61354de13c16f9bce1dd4cd397375d9a42da9",class:"s-social-share-wrapper"},s("slot",{key:"ef44d8cda6967977a59a0fe85777add8a73ffa59",name:"widget"},s("salla-button",{key:"243916c3a241c9dceb11a406faabe033c71820d2","aria-label":"Share",onClick:()=>this.open(),class:"s-social-share-btn",shape:"icon",fill:"outline",color:"light"},s("span",{key:"a6fd2be4e2990f285960308cfd985d37e464d205",innerHTML:this.opened?n:'\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>share-alt</title>\n<path d="M26.667 21.333c-1.699 0-3.196 0.812-4.173 2.052l-11.912-5.211c0.044-0.276 0.085-0.553 0.085-0.841 0-0.472-0.081-0.923-0.197-1.359l12.361-6.952c0.971 1.009 2.328 1.644 3.836 1.644 2.941 0 5.333-2.392 5.333-5.333s-2.392-5.333-5.333-5.333-5.333 2.392-5.333 5.333c0 0.472 0.081 0.923 0.197 1.359l-12.361 6.952c-0.971-1.009-2.328-1.644-3.836-1.644-2.941 0-5.333 2.392-5.333 5.333s2.392 5.333 5.333 5.333c1.699 0 3.196-0.812 4.173-2.052l11.912 5.211c-0.044 0.276-0.085 0.553-0.085 0.841 0 2.941 2.392 5.333 5.333 5.333s5.333-2.392 5.333-5.333-2.392-5.333-5.333-5.333zM26.667 2.667c1.471 0 2.667 1.196 2.667 2.667s-1.196 2.667-2.667 2.667-2.667-1.196-2.667-2.667 1.196-2.667 2.667-2.667zM5.333 20c-1.471 0-2.667-1.196-2.667-2.667s1.196-2.667 2.667-2.667 2.667 1.196 2.667 2.667-1.196 2.667-2.667 2.667zM26.667 29.333c-1.471 0-2.667-1.196-2.667-2.667s1.196-2.667 2.667-2.667 2.667 1.196 2.667 2.667-1.196 2.667-2.667 2.667z"></path>\n</svg>\n'}))),s("ul",{key:"27fa3a6ae2306cb61d97e71bb6591dd3614b5977",ref:a=>this.shareMenu=a,class:"s-social-share-list a2a_kit share","data-a2a-url":this.url?this.url:window.location.href,"data-a2a-title":this.urlName?this.urlName:document.title},this.platforms.split(",").map((a=>s("li",null,s("a",{class:`a2a_button_${a}`,"aria-label":`Share Via ${a}`},this.platformIcons.map((t=>{if(t.name===a)return s("span",{class:"s-social-share-icon",innerHTML:t.icon})}))))))))}get host(){return t(this)}};r.style="";export{r as salla_social_share}
4
+ import{r as a,h as s,a as t}from"./p-Z9TEkBrE.js";import{a as c}from"./p-CgtvEd63.js";import{f as e,t as l}from"./p-CO-PeZ27.js";import{S as i}from"./p-DLNIOD9t.js";import{S as n}from"./p-8Tsmrwno.js";var o;!function(a){a.FACEBOOK="facebook",a.TWITTER="twitter",a.WHATSAPP="whatsapp",a.EMAIL="email",a.COPY_LINK="copy_link"}(o||(o={}));const r=class{constructor(s){a(this,s),this.opened=!1,this.allPlatforms=[o.WHATSAPP,o.FACEBOOK,o.TWITTER,o.EMAIL,o.COPY_LINK],this.platformIcons=[{icon:'\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>whatsapp</title>\n<path d="M16 32c-0.008 0-0.018 0-0.028 0-3.1 0-5.993-0.887-8.439-2.421l0.066 0.039-7.2 2.3 2.336-6.964c-1.713-2.492-2.736-5.575-2.736-8.897 0-0.020 0-0.040 0-0.060v0.003c0.009-8.833 7.167-15.991 15.999-16h0.001c8.837 0 16 7.163 16 16s-7.163 16-16 16v0zM7.906 27.424l0.4 0.264c2.169 1.449 4.837 2.312 7.707 2.312 7.732 0 14-6.268 14-14s-6.268-14-14-14c-0.004 0-0.009 0-0.013 0h0.001c-7.729 0.008-13.992 6.271-14 13.999v0.001c-0 0.010-0 0.021-0 0.032 0 3.072 1 5.909 2.693 8.206l-0.027-0.038 0.304 0.416-1.4 4.2zM20.716 24.958c-1.684-0.131-3.237-0.574-4.641-1.271l0.073 0.033c-3.098-1.456-5.634-3.668-7.438-6.405l-0.042-0.067c-1.102-1.357-1.819-3.067-1.962-4.938l-0.002-0.030c-0.001-0.036-0.001-0.078-0.001-0.12 0-1.575 0.66-2.995 1.719-4l0.002-0.002c0.547-0.52 1.289-0.839 2.105-0.839 0.033 0 0.066 0.001 0.099 0.002l-0.005-0c0.2 0 0.378 0 0.542 0.018 0.016-0.001 0.035-0.001 0.054-0.001 0.815 0 1.502 0.549 1.711 1.298l0.003 0.012 0.324 0.782c0.376 0.906 0.858 2.068 0.942 2.244 0.144 0.251 0.23 0.552 0.23 0.873 0 0.286-0.068 0.557-0.188 0.797l0.005-0.010c-0.149 0.307-0.332 0.57-0.55 0.802l0.002-0.002c-0.148 0.168-0.248 0.274-0.346 0.378s-0.172 0.18-0.26 0.284c0.575 0.92 1.237 1.713 1.992 2.406l0.008 0.008c0.829 0.758 1.802 1.373 2.872 1.8l0.064 0.022c0.369-0.266 0.672-0.6 0.896-0.985l0.008-0.015 0.174-0.232c0.328-0.484 0.875-0.798 1.495-0.798 0.249 0 0.487 0.051 0.703 0.142l-0.012-0.004c0.492 0.168 2.922 1.372 2.946 1.384l0.228 0.11c0.415 0.149 0.758 0.417 0.996 0.763l0.004 0.007c0.107 0.349 0.169 0.75 0.169 1.166 0 0.591-0.125 1.153-0.349 1.661l0.010-0.026c-0.702 1.368-1.983 2.353-3.511 2.637l-0.031 0.005c-0.309 0.071-0.663 0.112-1.028 0.112-0.004 0-0.007 0-0.011 0h0.001zM10.632 9.318c-0.028-0.002-0.062-0.004-0.095-0.004-0.245 0-0.472 0.076-0.659 0.206l0.004-0.002c-0.726 0.651-1.18 1.591-1.18 2.638 0 0.044 0.001 0.087 0.002 0.13l-0-0.006c0.122 1.404 0.662 2.662 1.495 3.671l-0.009-0.011 0.12 0.168c1.627 2.491 3.865 4.46 6.504 5.723l0.096 0.041c3.136 1.288 3.916 1.124 4.426 1.014 0.87-0.159 1.601-0.656 2.067-1.347l0.007-0.011c0.12-0.316 0.204-0.682 0.237-1.063l0.001-0.015-0.040-0.018-0.256-0.124c-0.8-0.4-2.46-1.2-2.734-1.292l-0.058 0.184c-0.346 0.501-0.684 0.934-1.045 1.347l0.015-0.017c-0.344 0.349-0.821 0.565-1.349 0.565-0.28 0-0.546-0.061-0.785-0.17l0.012 0.005c-1.403-0.547-2.609-1.301-3.646-2.239l0.010 0.009c-0.975-0.891-1.81-1.912-2.486-3.039l-0.034-0.061c-0.152-0.244-0.242-0.54-0.242-0.857 0-0.463 0.191-0.88 0.499-1.178l0-0c0.13-0.162 0.264-0.302 0.4-0.444l0.236-0.256c0.091-0.096 0.177-0.201 0.254-0.311l0.006-0.009c-0.158-0.36-0.622-1.472-0.988-2.352l-0.322-0.772-0.038-0.086c-0.188-0.010-0.302-0.016-0.426-0.016zM12.462 12.442v0.012z"></path>\n</svg>\n',name:o.WHATSAPP},{icon:e,name:o.FACEBOOK},{icon:l,name:o.TWITTER},{icon:i,name:o.EMAIL},{icon:'\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>link</title>\n<path d="M19.247 23.019l-4.189 4.189c-2.831 2.831-7.435 2.831-10.265 0-1.371-1.372-2.125-3.193-2.125-5.132s0.755-3.761 2.125-5.133l4.189-4.191c0.521-0.521 0.521-1.364 0-1.885s-1.364-0.521-1.885 0l-4.189 4.191c-1.875 1.875-2.907 4.367-2.907 7.019s1.032 5.143 2.907 7.017 4.368 2.907 7.019 2.907 5.143-1.032 7.017-2.908l4.189-4.189c0.521-0.521 0.521-1.364 0-1.885s-1.364-0.52-1.885 0.001zM22.276 9.724c-0.521-0.521-1.364-0.521-1.885 0l-10.667 10.667c-0.521 0.521-0.521 1.364 0 1.885 0.26 0.26 0.601 0.391 0.943 0.391s0.683-0.131 0.943-0.391l10.667-10.667c0.521-0.521 0.521-1.364 0-1.885zM29.093 2.908c-1.875-1.876-4.368-2.908-7.019-2.908s-5.143 1.032-7.017 2.908l-4.189 4.188c-0.521 0.521-0.521 1.364 0 1.885s1.364 0.521 1.885 0l4.189-4.189c2.831-2.831 7.435-2.831 10.265 0 1.371 1.372 2.125 3.193 2.125 5.132s-0.755 3.761-2.125 5.133l-4.189 4.191c-0.521 0.521-0.521 1.364 0 1.885 0.26 0.26 0.601 0.391 0.943 0.391s0.683-0.131 0.943-0.391l4.189-4.191c1.875-1.875 2.907-4.367 2.907-7.019s-1.032-5.143-2.907-7.016z"></path>\n</svg>\n',name:o.COPY_LINK}],this.convertedPlatforms=[],this.url="",this.urlName="",this.platforms="facebook,twitter,whatsapp,email,copy_link"}componentWillLoad(){if(this.host.hasAttribute("aria-label")&&this.host.removeAttribute("aria-label"),document.getElementById("a2a-script"))return;const a=document.createElement("script");a.src="https://static.addtoany.com/menu/page.js",a.setAttribute("id","a2a-script"),a.async=!0,a.onload=function(){window.a2a_config.locale=salla.config.get("user.language_code",salla.lang.getLocale()),window.a2a_config.callbacks=window.a2a_config.callbacks||[],window.a2a_config.callbacks.push({share:a=>{const s={share_via:a.service.toLowerCase(),url:a.url,title:a.title};salla.event.emit("share-element",s)}})},document.body.appendChild(a)}async open(){const a=(new c.timeline).add({targets:this.shareMenu,translateY:[-50,0],opacity:[0,1],duration:300,podding:"0",easing:"easeInOutSine"});a.add({targets:this.shareMenu.children,translateZ:0,translateY:[-30,0],scaleY:[0,1],opacity:[0,1],duration:1400,delay:c.stagger(100)},"-=200"),this.opened=!this.opened,this.opened?this.shareMenu.classList.add("opened"):(a.pause(),a.seek(0),this.shareMenu.classList.remove("opened"))}async refresh(){window.a2a?.init("page")}render(){return s("div",{key:"b3e61354de13c16f9bce1dd4cd397375d9a42da9",class:"s-social-share-wrapper"},s("slot",{key:"ef44d8cda6967977a59a0fe85777add8a73ffa59",name:"widget"},s("salla-button",{key:"243916c3a241c9dceb11a406faabe033c71820d2","aria-label":"Share",onClick:()=>this.open(),class:"s-social-share-btn",shape:"icon",fill:"outline",color:"light"},s("span",{key:"a6fd2be4e2990f285960308cfd985d37e464d205",innerHTML:this.opened?n:'\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>share-alt</title>\n<path d="M26.667 21.333c-1.699 0-3.196 0.812-4.173 2.052l-11.912-5.211c0.044-0.276 0.085-0.553 0.085-0.841 0-0.472-0.081-0.923-0.197-1.359l12.361-6.952c0.971 1.009 2.328 1.644 3.836 1.644 2.941 0 5.333-2.392 5.333-5.333s-2.392-5.333-5.333-5.333-5.333 2.392-5.333 5.333c0 0.472 0.081 0.923 0.197 1.359l-12.361 6.952c-0.971-1.009-2.328-1.644-3.836-1.644-2.941 0-5.333 2.392-5.333 5.333s2.392 5.333 5.333 5.333c1.699 0 3.196-0.812 4.173-2.052l11.912 5.211c-0.044 0.276-0.085 0.553-0.085 0.841 0 2.941 2.392 5.333 5.333 5.333s5.333-2.392 5.333-5.333-2.392-5.333-5.333-5.333zM26.667 2.667c1.471 0 2.667 1.196 2.667 2.667s-1.196 2.667-2.667 2.667-2.667-1.196-2.667-2.667 1.196-2.667 2.667-2.667zM5.333 20c-1.471 0-2.667-1.196-2.667-2.667s1.196-2.667 2.667-2.667 2.667 1.196 2.667 2.667-1.196 2.667-2.667 2.667zM26.667 29.333c-1.471 0-2.667-1.196-2.667-2.667s1.196-2.667 2.667-2.667 2.667 1.196 2.667 2.667-1.196 2.667-2.667 2.667z"></path>\n</svg>\n'}))),s("ul",{key:"27fa3a6ae2306cb61d97e71bb6591dd3614b5977",ref:a=>this.shareMenu=a,class:"s-social-share-list a2a_kit share","data-a2a-url":this.url?this.url:window.location.href,"data-a2a-title":this.urlName?this.urlName:document.title},this.platforms.split(",").map((a=>s("li",null,s("a",{class:`a2a_button_${a}`,"aria-label":`Share Via ${a}`},this.platformIcons.map((t=>{if(t.name===a)return s("span",{class:"s-social-share-icon",innerHTML:t.icon})}))))))))}get host(){return t(this)}};r.style="";export{r as salla_social_share}
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r as a,h as t,H as s,a as e}from"./p-DcQSprhU.js";const i=class{constructor(t){if(a(this,t),this.entity="product",this.specs=[],this.download=salla.lang.get("pages.thank_you.download"),this.entityId)try{return void(this.entityId=Array.isArray(this.entityId)?this.entityId:JSON.parse(this.entityId))}catch(a){salla.log("Bad json passed via entityId prop")}}getValue(a){if("file"===a.type)return`<a href="${a.value}" class="text-primary" target="_blank"><span class="sicon-download"></span> ${this.download}</a>`;if("url"===a.type)return`<a href="${a.value}" class="text-blue-700 underline" target="_blank">${a.value}</a>`;if("date"===a.type){const t=new Date(a.value);return`${String(t.getDate()).padStart(2,"0")}/${String(t.getMonth()+1).padStart(2,"0")}/${t.getFullYear()}`}return a.value}async componentWillLoad(){if(await salla.onReady(),!salla.config.get("store.features")?.includes("custom-fields"))return salla.logger.error("feature custom-fields is not activated");if(this.entityId||!salla.url.is_page("product.single")&&!salla.url.is_page("product.showNewUrls")||(this.entityId=salla.config.get("page.id")),!this.entityId)return salla.logger.error("can't render salla-metadata without enity-id prop!");await salla.lang.onLoaded(),this.download=salla.lang.get("pages.thank_you.download");const a=await Salla.api.metadata.fetchValues(this.entity,this.entityId);this.specs=a.data[0]?.sections}render(){if(this.specs.length)return t(s,{class:"s-metadata-wrapper"},this.specs.map((a=>t("div",{class:"s-metadata-box"},t("div",{class:"s-metadata-box-header"},t("i",{class:"sicon-list"}),a.name),a.fields.map((a=>t("div",{class:"s-metadata-row"},t("p",{class:"s-metadata-row-name"},a.name),t("p",{class:"s-metadata-row-value",innerHTML:this.getValue(a)}))))))))}get host(){return e(this)}};i.style="";export{i as salla_metadata}
4
+ import{r as a,h as t,H as s,a as e}from"./p-Z9TEkBrE.js";const i=class{constructor(t){if(a(this,t),this.entity="product",this.specs=[],this.download=salla.lang.get("pages.thank_you.download"),this.entityId)try{return void(this.entityId=Array.isArray(this.entityId)?this.entityId:JSON.parse(this.entityId))}catch(a){salla.log("Bad json passed via entityId prop")}}getValue(a){if("file"===a.type)return`<a href="${a.value}" class="text-primary" target="_blank"><span class="sicon-download"></span> ${this.download}</a>`;if("url"===a.type)return`<a href="${a.value}" class="text-blue-700 underline" target="_blank">${a.value}</a>`;if("date"===a.type){const t=new Date(a.value);return`${String(t.getDate()).padStart(2,"0")}/${String(t.getMonth()+1).padStart(2,"0")}/${t.getFullYear()}`}return a.value}async componentWillLoad(){if(await salla.onReady(),!salla.config.get("store.features")?.includes("custom-fields"))return salla.logger.error("feature custom-fields is not activated");if(this.entityId||!salla.url.is_page("product.single")&&!salla.url.is_page("product.showNewUrls")||(this.entityId=salla.config.get("page.id")),!this.entityId)return salla.logger.error("can't render salla-metadata without enity-id prop!");await salla.lang.onLoaded(),this.download=salla.lang.get("pages.thank_you.download");const a=await Salla.api.metadata.fetchValues(this.entity,this.entityId);this.specs=a.data[0]?.sections}render(){if(this.specs.length)return t(s,{class:"s-metadata-wrapper"},this.specs.map((a=>t("div",{class:"s-metadata-box"},t("div",{class:"s-metadata-box-header"},t("i",{class:"sicon-list"}),a.name),a.fields.map((a=>t("div",{class:"s-metadata-row"},t("p",{class:"s-metadata-row-name"},a.name),t("p",{class:"s-metadata-row-value",innerHTML:this.getValue(a)}))))))))}get host(){return e(this)}};i.style="";export{i as salla_metadata}
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r as t,c as s,h as e,H as i,a}from"./p-DcQSprhU.js";import{F as l}from"./p-DL4h2bc3.js";import{H as r}from"./p-CHf8XdiS.js";import"./p-CgtvEd63.js";const o=class{constructor(e){t(this,e),this.changed=s(this,"changed"),this.isReady=!1,this.filtersData={},salla.event.on("filters::hidden",(()=>this.host.style.display="none")),salla.lang.onLoaded((()=>{this.apply=salla.lang.get("pages.checkout.apply"),this.reset=salla.lang.get("pages.categories.filters_reset")})),salla.event.on("filters::fetched",(({filters:t})=>{this.host.style.display="";let s={};this.filters=t.map((t=>{if(t.label={category_id:salla.lang.get("common.titles.categories"),brand_id:salla.lang.get("common.titles.brands"),rating:salla.lang.get("pages.categories.filter_rating"),price:salla.lang.get("pages.categories.filter_price")}[t.key]||t.label,"rating"==t.key){t.type=l.VALUES;let{max:s,min:e}=t.values;t.values=[5,4,3,2,1].filter((t=>t>=e||t<=s))}this.filtersData.variants&&t.type==l.VARIANTS&&(s.variants=this.filtersData.variants),this.filtersData[t.key]&&t.type!==l.VARIANTS&&(s[t.key]=this.filtersData[t.key]);let e=new URLSearchParams(window.location.search),i=!1;for(let t of e.keys())if(t.includes("filters")){i=!0;break}if("product.index"==salla.config.get("page.slug")&&0==Object.keys(s).length&&!i){let t=window.location.href,e=salla.config.get("page.id"),i=-1!==t.indexOf("?")?"&":"?",a=t+i+"filters[category_id]="+e;s.category_id=e,window.history.pushState({path:a},"",a)}return t})),this.filtersData=s,this.host.childNodes.forEach((async t=>t.setWidgetHeight&&await t.setWidgetHeight()))}))}async componentWillLoad(){try{const t=new URLSearchParams(window.location.search);this.filtersData=await r.extractFiltersFromUrl(t)}catch(t){console.warn("failed to get filters from URL",t.message)}}async getFilters(){return this.filtersData}async applyFilters(){if(!this.isReady)return;let t=Object.keys(this.filtersData).length>0;setTimeout((()=>{if(t){let t=new URL(window.location.href);for(const[s]of t.searchParams.entries())s.startsWith("filters")&&t.searchParams.delete(s);let s=this.encodeFilters(this.filtersData),e=t.search.split("&").filter((t=>!t.includes("filters"))).join("&");t.search=e?t.search.split("&filters")[0]+"&"+s:`?${s}`,window.history.pushState({},"",t.href)}else{let t=new URL(window.location.href);t.searchParams?.delete("filters"),window.history.pushState({},"",t.toString())}salla.event.emit("salla-filters::changed",this.filtersData),this.changed.emit(this.filtersData)}),300)}encodeFilters(t,s="filters"){const e=[];for(const i in t)if(Object.prototype.hasOwnProperty.call(t,i)){const a=t[i],l=s?`${s}[${i}]`:i;if(Array.isArray(a))for(let t=0;t<a.length;t++)e.push(`${l}[${t}]=${a[t]}`);else e.push("object"==typeof a&&null!==a?this.encodeFilters(a,l):`${l}=${a}`)}return e.join("&")}async resetFilters(){return this.removeFiltersQueryParams(),this.filtersData={},this.host.childNodes.forEach((t=>t.reset&&t.reset())),salla.event.emit("salla-filters::reset"),this.applyFilters()}removeFiltersQueryParams(){const t=new URLSearchParams(window.location.search),s=Array.from(t.keys()).filter((t=>!t.startsWith("filters["))).map((s=>`${encodeURIComponent(s)}=${encodeURIComponent(t.get(s))}`)).join("&"),e=s?`${window.location.pathname}?${s}`:window.location.pathname;window.history.pushState({},"",e)}handleOptionChange(t,s,e){s.type===l.RANGE&&(this.filtersData[s.key]=e);let i=t.target.checked;s.type===l.VARIANTS?(this.filtersData.variants=this.filtersData.variants||{},i&&(this.filtersData.variants[s.key]=e),i||delete this.filtersData.variants[s.key]):"radio"==t.target.type?(i&&(this.filtersData[s.key]=e),i||delete this.filtersData[s.key]):"checkbox"==t.target.type&&(this.filtersData[s.key]=this.filtersData[s.key]||[],i&&this.filtersData[s.key].push(e),this.filtersData[s.key]=this.filtersData[s.key].filter((t=>t!=e))),this.applyFilters()}render(){return e(i,{key:"b41c36d8512dcac97dbe3a75e5c1e0373673913d"},this.filters?.map((t=>e("salla-filters-widget",{option:t,filtersData:this.filtersData,onChanged:({detail:{event:t,option:s,value:e}})=>{this.handleOptionChange(t,s,e)}}))),this.filters?.length?e("div",{class:"s-filters-footer"},e("salla-button",{color:"gray",fill:"outline",onClick:()=>this.resetFilters()},this.reset)):"")}componentDidLoad(){this.isReady=!0}get host(){return a(this)}};o.style=":host{display:block}.s-rating-stars-small{line-height:12px}.s-filters-radio{background-image:none !important}";export{o as salla_filters}
4
+ import{r as t,c as s,h as e,H as i,a}from"./p-Z9TEkBrE.js";import{F as l}from"./p-DL4h2bc3.js";import{H as r}from"./p-CHf8XdiS.js";import"./p-CgtvEd63.js";const o=class{constructor(e){t(this,e),this.changed=s(this,"changed"),this.isReady=!1,this.filtersData={},salla.event.on("filters::hidden",(()=>this.host.style.display="none")),salla.lang.onLoaded((()=>{this.apply=salla.lang.get("pages.checkout.apply"),this.reset=salla.lang.get("pages.categories.filters_reset")})),salla.event.on("filters::fetched",(({filters:t})=>{this.host.style.display="";let s={};this.filters=t.map((t=>{if(t.label={category_id:salla.lang.get("common.titles.categories"),brand_id:salla.lang.get("common.titles.brands"),rating:salla.lang.get("pages.categories.filter_rating"),price:salla.lang.get("pages.categories.filter_price")}[t.key]||t.label,"rating"==t.key){t.type=l.VALUES;let{max:s,min:e}=t.values;t.values=[5,4,3,2,1].filter((t=>t>=e||t<=s))}this.filtersData.variants&&t.type==l.VARIANTS&&(s.variants=this.filtersData.variants),this.filtersData[t.key]&&t.type!==l.VARIANTS&&(s[t.key]=this.filtersData[t.key]);let e=new URLSearchParams(window.location.search),i=!1;for(let t of e.keys())if(t.includes("filters")){i=!0;break}if("product.index"==salla.config.get("page.slug")&&0==Object.keys(s).length&&!i){let t=window.location.href,e=salla.config.get("page.id"),i=-1!==t.indexOf("?")?"&":"?",a=t+i+"filters[category_id]="+e;s.category_id=e,window.history.pushState({path:a},"",a)}return t})),this.filtersData=s,this.host.childNodes.forEach((async t=>t.setWidgetHeight&&await t.setWidgetHeight()))}))}async componentWillLoad(){try{const t=new URLSearchParams(window.location.search);this.filtersData=await r.extractFiltersFromUrl(t)}catch(t){console.warn("failed to get filters from URL",t.message)}}async getFilters(){return this.filtersData}async applyFilters(){if(!this.isReady)return;let t=Object.keys(this.filtersData).length>0;setTimeout((()=>{if(t){let t=new URL(window.location.href);for(const[s]of t.searchParams.entries())s.startsWith("filters")&&t.searchParams.delete(s);let s=this.encodeFilters(this.filtersData),e=t.search.split("&").filter((t=>!t.includes("filters"))).join("&");t.search=e?t.search.split("&filters")[0]+"&"+s:`?${s}`,window.history.pushState({},"",t.href)}else{let t=new URL(window.location.href);t.searchParams?.delete("filters"),window.history.pushState({},"",t.toString())}salla.event.emit("salla-filters::changed",this.filtersData),this.changed.emit(this.filtersData)}),300)}encodeFilters(t,s="filters"){const e=[];for(const i in t)if(Object.prototype.hasOwnProperty.call(t,i)){const a=t[i],l=s?`${s}[${i}]`:i;if(Array.isArray(a))for(let t=0;t<a.length;t++)e.push(`${l}[${t}]=${a[t]}`);else e.push("object"==typeof a&&null!==a?this.encodeFilters(a,l):`${l}=${a}`)}return e.join("&")}async resetFilters(){return this.removeFiltersQueryParams(),this.filtersData={},this.host.childNodes.forEach((t=>t.reset&&t.reset())),salla.event.emit("salla-filters::reset"),this.applyFilters()}removeFiltersQueryParams(){const t=new URLSearchParams(window.location.search),s=Array.from(t.keys()).filter((t=>!t.startsWith("filters["))).map((s=>`${encodeURIComponent(s)}=${encodeURIComponent(t.get(s))}`)).join("&"),e=s?`${window.location.pathname}?${s}`:window.location.pathname;window.history.pushState({},"",e)}handleOptionChange(t,s,e){s.type===l.RANGE&&(this.filtersData[s.key]=e);let i=t.target.checked;s.type===l.VARIANTS?(this.filtersData.variants=this.filtersData.variants||{},i&&(this.filtersData.variants[s.key]=e),i||delete this.filtersData.variants[s.key]):"radio"==t.target.type?(i&&(this.filtersData[s.key]=e),i||delete this.filtersData[s.key]):"checkbox"==t.target.type&&(this.filtersData[s.key]=this.filtersData[s.key]||[],i&&this.filtersData[s.key].push(e),this.filtersData[s.key]=this.filtersData[s.key].filter((t=>t!=e))),this.applyFilters()}render(){return e(i,{key:"b41c36d8512dcac97dbe3a75e5c1e0373673913d"},this.filters?.map((t=>e("salla-filters-widget",{option:t,filtersData:this.filtersData,onChanged:({detail:{event:t,option:s,value:e}})=>{this.handleOptionChange(t,s,e)}}))),this.filters?.length?e("div",{class:"s-filters-footer"},e("salla-button",{color:"gray",fill:"outline",onClick:()=>this.resetFilters()},this.reset)):"")}componentDidLoad(){this.isReady=!0}get host(){return a(this)}};o.style=":host{display:block}.s-rating-stars-small{line-height:12px}.s-filters-radio{background-image:none !important}";export{o as salla_filters}
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r as a,h as l,a as s}from"./p-DcQSprhU.js";const i=class{constructor(l){a(this,l),this.languageNames={ar:"العربية",en:"English",sq:"shqip",hy:"հայերէն",bg:"български",zh:"汉语",hr:"hrvatski",cs:"čeština",da:"dansk",nl:"dutch",et:"eesti keel",fi:"suomen kieli",fr:"Français",de:"Deutsch",el:"Ελληνικά",hi:"हिन्दी",hu:"magyar",ind:"bahasa Indonesia",ga:"Gaeilge",it:"Italiano",ja:"日本語",ko:"한국어",lv:"latviešu",mt:"Maltese",fa:"فارسی",pl:"Polish",pt:"português",ro:"română",ru:"русский",sl:"slovenščina",es:"Español",sv:"svenska",tl:"Tagalog (Filipino)",tr:"Türkçe",uk:"украї́нська",ur:"اُردُو",ms:"Bahasa Malaysia"},this.currenciesList={SAR:{en:"Saudi Riyal",ar:"ريال سعودي",symbol:"ر.س"},USD:{en:"US Dollar",ar:"دولار أمريكي",symbol:"$"},EUR:{en:"Euro",ar:"يورو",symbol:"€"},AED:{en:"UAE Dirham",ar:"درهم اماراتي",symbol:"د.إ"},KWD:{en:"Kuwaiti Dinar",ar:"دينار كويتي",symbol:"د.ك"},BHD:{en:"Bahraini Dinar",ar:"دينار بحريني",symbol:"د.ب"},QAR:{en:"Qatari Riyal",ar:"ريال قطري",symbol:"ر.ق"},OMR:{en:"Omani Rial",ar:"ريال عماني",symbol:"ر.ع"},AUD:{en:"Australian Dollar",ar:"دولار استرالي",symbol:"$"},CAD:{en:"Canadian Dollar",ar:"دولار كندي",symbol:"$"},CNY:{en:"Renminbi",ar:"رنمينبي",symbol:"¥"},EGP:{en:"Egyptian Pound",ar:"جنيه مصري",symbol:"ج.م"},GBP:{en:"Pound Sterling",ar:"جنيه استرليني",symbol:"£"},IDR:{en:"Indonesian Rupiah",ar:"روبية إندونيسية",symbol:"Rp"},INR:{en:"Indian Rupee",ar:"روبية هندية",symbol:"₹"},JPY:{en:"Japanese Yen",ar:"ين ياباني",symbol:"¥"},MYR:{en:"Malaysian Ringgit",ar:"رينغيت ماليزي",symbol:"RM"},PKR:{en:"Pakistani Rupee",ar:"روبية باكستانية",symbol:"Rs."},SEK:{en:"Swedish Krona",ar:"كرونة سويدية",symbol:"kr"},SGD:{en:"Singapore Dollar",ar:"دولار سنغافوري",symbol:"$"},TRY:{en:"Turkish Lira",ar:"ليرة تركية",symbol:"₺"},IQD:{en:"Iraqi Dinar",ar:"دينار عراقي",symbol:"د.ع"},LBP:{en:"Lebanese Pound",ar:"ليرة لبنانية",symbol:"ل.ل"},MRO:{en:"Mauritanian Ouguiya",ar:"أوقية موريتانية",symbol:"UM"},SDG:{en:"Sudanese Pound",ar:"جنيه سوداني",symbol:"SDG"},SYP:{en:"Syrian Pound",ar:"ليرة سورية",symbol:"ل.س"},TND:{en:"Tunisian Dinar",ar:"دينار تونسي",symbol:"د.ت"},JOD:{en:"Jordanian Dinar",ar:"دينار أردني",symbol:"JOD"},DZD:{en:"Algerian Dinar",ar:"دينار جزائري",symbol:"دج"},MAD:{en:"Moroccan Dirham",ar:"درهم مغربي",symbol:"د.م."},LYD:{en:"Libyan Dinar",ar:"دينار ليبي",symbol:"LD"},YER:{en:"Yemeni Riyal",ar:"ريال يمني",symbol:"ر.ي"}},this.arabicCurrencies=["SAR","AED","KWD","BHD","QAR","OMR","EGP","IQD","LBP","SYP","TND","DZD","MAD","YER"],this.languages=[],this.currencies=[],this.hasError=!1,this.showTrigger=!1,this.languageSlot=this.host.querySelector('[slot="language"]')?.innerHTML||'<label class="s-localization-modal-label" for="lang-{code}"><span>{name}</span></label>',this.currencySlot=this.host.querySelector('[slot="currency"]')?.innerHTML||'<label class="s-localization-modal-label" for="currency-{code}"><span>{name}</span><small class="s-localization-modal-currency">{symbol}</small></label>'}async componentWillLoad(){await Salla.onReady(),await Salla.lang.onLoaded(),Salla.event.on("localization::open",(()=>this.open())),this.language||(this.language=Salla.config.get("user.language_code")),this.currency||(this.currency=Salla.config.get("user.currency_code"))}async open(){return this.modal.open(),await Salla.api.withoutNotifier((()=>this.getLanguages())).then((()=>this.getCurrencies())).then((()=>{this.languages.length<2&&this.currencies.length<2&&this.modal.close()})).catch((a=>{console.log(a),this.hasError=!0,this.errorMessage=a.response?.data?.error?.message||a.response?.data})).finally((()=>this.modal.stopLoading()))}async close(){return this.modal.close()}getCurrency(a){return this.currenciesList[a||this.currency]||{en:"Saudi Riyal",ar:"ريال سعودي",symbol:"ر.س"}}getLanguageName(){return this.languageNames[this.language]||this.language||""}getCurrencySymbol(a){return"SAR"===(a=a||this.currency)?'<i class="sicon-sar"></i>':"ar"!==this.language&&this.arabicCurrencies.includes(a)?a:this.getCurrency(a).symbol}getCurrencyName(a){return"ar"===this.language?this.getCurrency(a).ar:this.getCurrency(a).en}async getLanguages(){return this.languages.length>1?null:await Salla.config.languages().then((a=>this.languages=a))}async getCurrencies(){return this.currencies.length>1?null:await Salla.config.currencies().then((a=>this.currencies=Object.values(a||{})))}onChangeCurrency(a){this.currency=a.target.value}onChangeLanguage(a){this.language=a.target.value}async submit(){let a;this.btn.load().then((()=>{if(this.currency){if(this.currency!==Salla.config.get("user.currency_code","SAR"))return a=window.location.href,Salla.currency.api.change(this.currency)}else Salla.log("There is no currency!")})).then((()=>{this.language!==Salla.config.get("user.language_code","ar")&&(a=Salla.helpers.addParamToUrl("lang",this.language))})).then((()=>{Salla.cookie.set("s-lang",this.language),Salla.cookie.set("s-curr",this.currency)})).then((()=>this.btn.stop())).then((()=>this.close())).then((()=>{a&&(window.location.href=a.replace(`/${Salla.config.get("user.language_code")}/`,`/${this.language}/`))}))}render(){return[this.showTrigger?l("button",{type:"button",onClick:()=>this.open(),class:"s-localization-modal-trigger-btn"},l("span",null,this.getLanguageName()),l("span",{class:"s-localization-modal-trigger-separator"},"|")," ",l("span",{innerHTML:this.getCurrencySymbol()})):"",l("salla-modal",{key:"13b805dc33b57d433d4c35ad8217adef60b99ad5",isLoading:!0,class:"s-hidden",ref:a=>this.modal=a,width:"xs"},l("div",{key:"b30239d0a20d15baccb6a5017493d91ae96c350c",slot:"loading"},l("div",{key:"94f7df4044f94612413f4818b110abae3c251075",class:"s-localization-modal-skeleton"},l("salla-skeleton",{key:"63008e2fd90cfa4ce9ddbf313ffe718c520853ce",width:"25%",height:"15px"}),l("div",{key:"97f64f98e99c3cc2f099fa02469a2000c7eefc4c",class:"s-localization-modal-skeleton-content"},[...Array(4)].map((()=>l("div",{class:"s-localization-modal-skeleton-item"},l("div",{class:"s-localization-modal-skeleton-item-flex"},l("salla-skeleton",{type:"circle",height:"16px",width:"16px"}),l("salla-skeleton",{height:"10px",width:"100px"})),l("salla-skeleton",{height:"15px",width:"20px"}))))),l("salla-skeleton",{key:"230480a6cfaddab7fbe70a16041cf5fb8903c64a",width:"25%",height:"15px"}),l("div",{key:"caf3e79cdbd04d5374365173212792abfe3d465b",class:"s-localization-modal-skeleton-content"},[...Array(4)].map((()=>l("div",{class:"s-localization-modal-skeleton-item"},l("div",{class:"s-localization-modal-skeleton-item-flex"},l("salla-skeleton",{type:"circle",height:"16px",width:"16px"}),l("salla-skeleton",{height:"10px",width:"100px"})),l("salla-skeleton",{height:"15px",width:"20px"}))))),l("salla-skeleton",{key:"b48d02c6e7febad77dbd0d37e540d02d26265e8b",height:"40px",width:"100%"}))),this.hasError?l("salla-placeholder",{alignment:"center"},l("span",{slot:"description"},this.errorMessage)):l("div",{class:"s-localization-modal-inner"},this.languages.length>1?l("div",{class:"s-localization-modal-section"},l("label",{class:"s-localization-modal-title"},Salla.lang.get("common.titles.language")),l("div",{class:"s-localization-modal-section-inner"},this.languages.length<6?this.languages.map((a=>l("div",{class:"s-localization-modal-item"},l("input",{class:"s-localization-modal-input",type:"radio",checked:this.language==a.iso_code,onChange:()=>this.language=a.iso_code,name:"language",id:"lang-"+a.code.toLowerCase(),value:a.code}),l("div",{class:"s-localization-modal-label-slot",id:"language-slot",innerHTML:this.languageSlot.replace(/\{name\}/g,a.name).replace(/\{code\}/g,a.code).replace(/\{country_code\}/g,a.country_code)})))):l("select",{class:"s-localization-modal-select",name:"language",onChange:a=>this.onChangeLanguage(a)},this.languages.map((a=>l("option",{value:a.code,selected:this.language==a.code},a.name)))))):"",this.currencies.length>1?l("div",{class:"s-localization-modal-section"},l("label",{class:"s-localization-modal-title"},Salla.lang.get("common.titles.currency")),l("div",{class:"s-localization-modal-section-inner"},this.currencies.length<6?this.currencies.map((a=>l("div",{class:"s-localization-modal-item"},l("input",{class:"s-localization-modal-input",type:"radio",name:"currency",checked:this.currency==a.code,onChange:()=>this.currency=a.code,id:"currency-"+a.code,value:a.code}),l("div",{class:"s-localization-modal-label-slot",id:"currency-slot",innerHTML:this.currencySlot.replace(/\{name\}/g,this.getCurrencyName(a.code)).replace(/\{code\}/g,a.code).replace(/\{symbol\}/g,this.getCurrencySymbol(a.code)).replace(/\{country_code\}/g,a.country_code)})))):l("select",{class:"s-localization-modal-select",name:"currency",onChange:a=>this.onChangeCurrency(a)},this.currencies.map((a=>l("option",{value:a.code,selected:this.currency==a.code},a.name)))))):"",l("salla-button",{width:"wide",ref:a=>this.btn=a,onClick:()=>this.submit()},Salla.lang.get("common.elements.ok"))))]}componentDidRender(){this.host.querySelectorAll("#currency-slot").forEach((a=>a.replaceWith(a.firstChild))),this.host.querySelectorAll("#language-slot").forEach((a=>a.replaceWith(a.firstChild)))}get host(){return s(this)}};export{i as salla_localization_modal}
4
+ import{r as a,h as l,a as s}from"./p-Z9TEkBrE.js";const i=class{constructor(l){a(this,l),this.languageNames={ar:"العربية",en:"English",sq:"shqip",hy:"հայերէն",bg:"български",zh:"汉语",hr:"hrvatski",cs:"čeština",da:"dansk",nl:"dutch",et:"eesti keel",fi:"suomen kieli",fr:"Français",de:"Deutsch",el:"Ελληνικά",hi:"हिन्दी",hu:"magyar",ind:"bahasa Indonesia",ga:"Gaeilge",it:"Italiano",ja:"日本語",ko:"한국어",lv:"latviešu",mt:"Maltese",fa:"فارسی",pl:"Polish",pt:"português",ro:"română",ru:"русский",sl:"slovenščina",es:"Español",sv:"svenska",tl:"Tagalog (Filipino)",tr:"Türkçe",uk:"украї́нська",ur:"اُردُو",ms:"Bahasa Malaysia"},this.currenciesList={SAR:{en:"Saudi Riyal",ar:"ريال سعودي",symbol:"ر.س"},USD:{en:"US Dollar",ar:"دولار أمريكي",symbol:"$"},EUR:{en:"Euro",ar:"يورو",symbol:"€"},AED:{en:"UAE Dirham",ar:"درهم اماراتي",symbol:"د.إ"},KWD:{en:"Kuwaiti Dinar",ar:"دينار كويتي",symbol:"د.ك"},BHD:{en:"Bahraini Dinar",ar:"دينار بحريني",symbol:"د.ب"},QAR:{en:"Qatari Riyal",ar:"ريال قطري",symbol:"ر.ق"},OMR:{en:"Omani Rial",ar:"ريال عماني",symbol:"ر.ع"},AUD:{en:"Australian Dollar",ar:"دولار استرالي",symbol:"$"},CAD:{en:"Canadian Dollar",ar:"دولار كندي",symbol:"$"},CNY:{en:"Renminbi",ar:"رنمينبي",symbol:"¥"},EGP:{en:"Egyptian Pound",ar:"جنيه مصري",symbol:"ج.م"},GBP:{en:"Pound Sterling",ar:"جنيه استرليني",symbol:"£"},IDR:{en:"Indonesian Rupiah",ar:"روبية إندونيسية",symbol:"Rp"},INR:{en:"Indian Rupee",ar:"روبية هندية",symbol:"₹"},JPY:{en:"Japanese Yen",ar:"ين ياباني",symbol:"¥"},MYR:{en:"Malaysian Ringgit",ar:"رينغيت ماليزي",symbol:"RM"},PKR:{en:"Pakistani Rupee",ar:"روبية باكستانية",symbol:"Rs."},SEK:{en:"Swedish Krona",ar:"كرونة سويدية",symbol:"kr"},SGD:{en:"Singapore Dollar",ar:"دولار سنغافوري",symbol:"$"},TRY:{en:"Turkish Lira",ar:"ليرة تركية",symbol:"₺"},IQD:{en:"Iraqi Dinar",ar:"دينار عراقي",symbol:"د.ع"},LBP:{en:"Lebanese Pound",ar:"ليرة لبنانية",symbol:"ل.ل"},MRO:{en:"Mauritanian Ouguiya",ar:"أوقية موريتانية",symbol:"UM"},SDG:{en:"Sudanese Pound",ar:"جنيه سوداني",symbol:"SDG"},SYP:{en:"Syrian Pound",ar:"ليرة سورية",symbol:"ل.س"},TND:{en:"Tunisian Dinar",ar:"دينار تونسي",symbol:"د.ت"},JOD:{en:"Jordanian Dinar",ar:"دينار أردني",symbol:"JOD"},DZD:{en:"Algerian Dinar",ar:"دينار جزائري",symbol:"دج"},MAD:{en:"Moroccan Dirham",ar:"درهم مغربي",symbol:"د.م."},LYD:{en:"Libyan Dinar",ar:"دينار ليبي",symbol:"LD"},YER:{en:"Yemeni Riyal",ar:"ريال يمني",symbol:"ر.ي"}},this.arabicCurrencies=["SAR","AED","KWD","BHD","QAR","OMR","EGP","IQD","LBP","SYP","TND","DZD","MAD","YER"],this.languages=[],this.currencies=[],this.hasError=!1,this.showTrigger=!1,this.languageSlot=this.host.querySelector('[slot="language"]')?.innerHTML||'<label class="s-localization-modal-label" for="lang-{code}"><span>{name}</span></label>',this.currencySlot=this.host.querySelector('[slot="currency"]')?.innerHTML||'<label class="s-localization-modal-label" for="currency-{code}"><span>{name}</span><small class="s-localization-modal-currency">{symbol}</small></label>'}async componentWillLoad(){await Salla.onReady(),await Salla.lang.onLoaded(),Salla.event.on("localization::open",(()=>this.open())),this.language||(this.language=Salla.config.get("user.language_code")),this.currency||(this.currency=Salla.config.get("user.currency_code"))}async open(){return this.modal.open(),await Salla.api.withoutNotifier((()=>this.getLanguages())).then((()=>this.getCurrencies())).then((()=>{this.languages.length<2&&this.currencies.length<2&&this.modal.close()})).catch((a=>{console.log(a),this.hasError=!0,this.errorMessage=a.response?.data?.error?.message||a.response?.data})).finally((()=>this.modal.stopLoading()))}async close(){return this.modal.close()}getCurrency(a){return this.currenciesList[a||this.currency]||{en:"Saudi Riyal",ar:"ريال سعودي",symbol:"ر.س"}}getLanguageName(){return this.languageNames[this.language]||this.language||""}getCurrencySymbol(a){return"SAR"===(a=a||this.currency)?'<i class="sicon-sar"></i>':"ar"!==this.language&&this.arabicCurrencies.includes(a)?a:this.getCurrency(a).symbol}getCurrencyName(a){return"ar"===this.language?this.getCurrency(a).ar:this.getCurrency(a).en}async getLanguages(){return this.languages.length>1?null:await Salla.config.languages().then((a=>this.languages=a))}async getCurrencies(){return this.currencies.length>1?null:await Salla.config.currencies().then((a=>this.currencies=Object.values(a||{})))}onChangeCurrency(a){this.currency=a.target.value}onChangeLanguage(a){this.language=a.target.value}async submit(){let a;this.btn.load().then((()=>{if(this.currency){if(this.currency!==Salla.config.get("user.currency_code","SAR"))return a=window.location.href,Salla.currency.api.change(this.currency)}else Salla.log("There is no currency!")})).then((()=>{this.language!==Salla.config.get("user.language_code","ar")&&(a=Salla.helpers.addParamToUrl("lang",this.language))})).then((()=>{Salla.cookie.set("s-lang",this.language),Salla.cookie.set("s-curr",this.currency)})).then((()=>this.btn.stop())).then((()=>this.close())).then((()=>{a&&(window.location.href=a.replace(`/${Salla.config.get("user.language_code")}/`,`/${this.language}/`))}))}render(){return[this.showTrigger?l("button",{type:"button",onClick:()=>this.open(),class:"s-localization-modal-trigger-btn"},l("span",null,this.getLanguageName()),l("span",{class:"s-localization-modal-trigger-separator"},"|")," ",l("span",{innerHTML:this.getCurrencySymbol()})):"",l("salla-modal",{key:"13b805dc33b57d433d4c35ad8217adef60b99ad5",isLoading:!0,class:"s-hidden",ref:a=>this.modal=a,width:"xs"},l("div",{key:"b30239d0a20d15baccb6a5017493d91ae96c350c",slot:"loading"},l("div",{key:"94f7df4044f94612413f4818b110abae3c251075",class:"s-localization-modal-skeleton"},l("salla-skeleton",{key:"63008e2fd90cfa4ce9ddbf313ffe718c520853ce",width:"25%",height:"15px"}),l("div",{key:"97f64f98e99c3cc2f099fa02469a2000c7eefc4c",class:"s-localization-modal-skeleton-content"},[...Array(4)].map((()=>l("div",{class:"s-localization-modal-skeleton-item"},l("div",{class:"s-localization-modal-skeleton-item-flex"},l("salla-skeleton",{type:"circle",height:"16px",width:"16px"}),l("salla-skeleton",{height:"10px",width:"100px"})),l("salla-skeleton",{height:"15px",width:"20px"}))))),l("salla-skeleton",{key:"230480a6cfaddab7fbe70a16041cf5fb8903c64a",width:"25%",height:"15px"}),l("div",{key:"caf3e79cdbd04d5374365173212792abfe3d465b",class:"s-localization-modal-skeleton-content"},[...Array(4)].map((()=>l("div",{class:"s-localization-modal-skeleton-item"},l("div",{class:"s-localization-modal-skeleton-item-flex"},l("salla-skeleton",{type:"circle",height:"16px",width:"16px"}),l("salla-skeleton",{height:"10px",width:"100px"})),l("salla-skeleton",{height:"15px",width:"20px"}))))),l("salla-skeleton",{key:"b48d02c6e7febad77dbd0d37e540d02d26265e8b",height:"40px",width:"100%"}))),this.hasError?l("salla-placeholder",{alignment:"center"},l("span",{slot:"description"},this.errorMessage)):l("div",{class:"s-localization-modal-inner"},this.languages.length>1?l("div",{class:"s-localization-modal-section"},l("label",{class:"s-localization-modal-title"},Salla.lang.get("common.titles.language")),l("div",{class:"s-localization-modal-section-inner"},this.languages.length<6?this.languages.map((a=>l("div",{class:"s-localization-modal-item"},l("input",{class:"s-localization-modal-input",type:"radio",checked:this.language==a.iso_code,onChange:()=>this.language=a.iso_code,name:"language",id:"lang-"+a.code.toLowerCase(),value:a.code}),l("div",{class:"s-localization-modal-label-slot",id:"language-slot",innerHTML:this.languageSlot.replace(/\{name\}/g,a.name).replace(/\{code\}/g,a.code).replace(/\{country_code\}/g,a.country_code)})))):l("select",{class:"s-localization-modal-select",name:"language",onChange:a=>this.onChangeLanguage(a)},this.languages.map((a=>l("option",{value:a.code,selected:this.language==a.code},a.name)))))):"",this.currencies.length>1?l("div",{class:"s-localization-modal-section"},l("label",{class:"s-localization-modal-title"},Salla.lang.get("common.titles.currency")),l("div",{class:"s-localization-modal-section-inner"},this.currencies.length<6?this.currencies.map((a=>l("div",{class:"s-localization-modal-item"},l("input",{class:"s-localization-modal-input",type:"radio",name:"currency",checked:this.currency==a.code,onChange:()=>this.currency=a.code,id:"currency-"+a.code,value:a.code}),l("div",{class:"s-localization-modal-label-slot",id:"currency-slot",innerHTML:this.currencySlot.replace(/\{name\}/g,this.getCurrencyName(a.code)).replace(/\{code\}/g,a.code).replace(/\{symbol\}/g,this.getCurrencySymbol(a.code)).replace(/\{country_code\}/g,a.country_code)})))):l("select",{class:"s-localization-modal-select",name:"currency",onChange:a=>this.onChangeCurrency(a)},this.currencies.map((a=>l("option",{value:a.code,selected:this.currency==a.code},a.name)))))):"",l("salla-button",{width:"wide",ref:a=>this.btn=a,onClick:()=>this.submit()},Salla.lang.get("common.elements.ok"))))]}componentDidRender(){this.host.querySelectorAll("#currency-slot").forEach((a=>a.replaceWith(a.firstChild))),this.host.querySelectorAll("#language-slot").forEach((a=>a.replaceWith(a.firstChild)))}get host(){return s(this)}};export{i as salla_localization_modal}
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r as s,h as e,a as t}from"./p-DcQSprhU.js";var o,i;!function(s){s.ProductDetail="product.single",s.Cart="cart"}(o||(o={})),function(s){s.Conditional="conditional",s.PercentageOrFixed="fixed",s.DiscountsTable="discounts_table",s.Bank="bank",s.BuyXGetY="buy_x_get_y",s.SpecialPrice="special_price",s.Percentage="percentage",s.FixedAmount="fixed_amount"}(i||(i={}));const r=class{constructor(e){s(this,e),this.productCardComponent="salla-product-card",this.offersList=[],this.canRender=!1,this.showOffer=salla.config.get("store.settings.product.show_special_offers"),this.showAllOffersModal=!1,this.showProductsModal=!1,this.selectedOfferProducts=[],this.collapsedOffers={},this.expandedCategories={},this.productsLoaded=!1,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.buy_quantity_text=s=>salla.lang.get("pages.offer.buy_quantity",{quantity:s}),this.products_link_text=salla.lang.get("pages.offer.included_products","المنتجات المشمولة"),this.min_spend_text=(s,e)=>salla.lang.get("pages.offer.min_spend_amount",{amount:s,currency:e},`بحد أدنى ${s} ${e} من مبلغ الشراء`),this.min_items_text=s=>salla.lang.get("pages.offer.min_items",{items:s},`بحد أدنى ${s} منتجات`),this.product_text=salla.lang.get("common.elements.product","منتج"),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.buy_quantity_text(0),this.products_link_text=salla.lang.get("pages.offer.included_products","المنتجات المشمولة"),this.min_spend_text=(s,e)=>salla.lang.get("pages.offer.min_spend_amount",{amount:s,currency:e},`بحد أدنى ${s} ${e} من مبلغ الشراء`),this.min_items_text=s=>salla.lang.get("pages.offer.min_items",{items:s},`بحد أدنى ${s} منتجات`),this.product_text=salla.lang.get("common.elements.product","منتج")})),salla.onReady((()=>{this.currentPage=salla.config.get("page.slug");const s=salla.config.get("currencies")||{},e=salla.config.get("user.currency_code");this.userCurrency=s[e]||{symbol:"",code:e||"SAR",name:""}}))}async getEndpointByPageName(){return this.currentPage==o.Cart?`offers/cart/${await Salla.cart.getCurrentCartId()}`:this.currentPage==o.ProductDetail?`offers/product/${salla.config.get("page.id")}`:"offers"}emitPromotionViewed(){if(!(this.offersList.length&&this.canRender&&this.showOffer))return;const s=this.offersList.slice(0,5).map(((s,e)=>({id:s.id,name:s.title,creative:s.description||"",position:e+1})));salla.event.emit("salla::offer.promotion.viewed",s)}emitPromotionClicked(s,e=1){if(!(this.offersList.length&&this.canRender&&this.showOffer))return;const t=s||this.offersList[0];salla.event.emit("salla::offer.promotion.clicked",[{id:t.id,name:t.title,creative:t.description||"",position:e}])}componentWillLoad(){return this.hasCustomComponent=!!customElements.get(this.productCardComponent),new Promise((s=>salla.onReady(s))).then((()=>{if(this.showOffer=!salla.url.is_page("product.single")||salla.config.get("store.settings.product.show_special_offers"),!this.showOffer)throw new Error("Merchant disabled showing the offers on product page")})).then((async()=>salla.api.request(await this.getEndpointByPageName()))).then((async s=>{if(!(this.offersList=s.data).length)throw new Error("salla-offers:: There is no offers!");if(this.offersList=this.offersList.filter((s=>[i.SpecialPrice,i.Bank,i.BuyXGetY,i.DiscountsTable,i.PercentageOrFixed,i.Percentage,i.FixedAmount].includes(s.type))),!this.offersList.length)throw new Error("salla-offers:: No supported offer types found!");let e=null;this.offersList.some((s=>{const e=s.details;return"category"===e.apply_to&&e.targets||"categories"===e.apply_to&&e.targets||s.type===i.BuyXGetY&&("categories"===e.get?.source||"category"===e.get?.source)}))&&(e=(await salla.product.api.categories()).data);const t=new Set;for(const s of this.offersList){const e=s.details;"product"!==e.apply_to&&"products"!==e.apply_to||!e.targets||e.targets.forEach((s=>t.add(s))),s.type===i.BuyXGetY&&"products"===e.get?.source&&e.get?.source_value&&e.get.source_value.forEach((s=>t.add(s))),s.type!==i.BuyXGetY||"products"!==e.buy?.source&&"product"!==e.buy?.source||!e.buy?.source_value||e.buy.source_value.forEach((s=>t.add(s)))}let o={};if(t.size>0)try{const s=await salla.product.api.fetch({source:"selected",source_value:Array.from(t)});o=Object.fromEntries(s.data.map((s=>[s.id,s])))}catch(s){o={}}for(const s of this.offersList){const t=s.details;if(("category"===t.apply_to&&t.targets||"categories"===t.apply_to&&t.targets)&&e&&(t.categories=this.findCategories(e,t.targets)),"product"!==t.apply_to&&"products"!==t.apply_to||!t.targets||(t.products=t.targets.map((s=>o[s])).filter(Boolean)),"brand"===t.apply_to&&t.targets&&(t.brands=t.targets),"tag"===t.apply_to&&t.targets&&(t.tags=t.targets),s.type===i.BuyXGetY&&t.get){const s=t.get;"products"===s.source&&s.source_value?s.products=s.source_value.map((s=>o[s])).filter(Boolean):("categories"===s.source||"category"===s.source)&&e&&s.source_value&&(s.categories=this.findCategories(e,s.source_value),t.categories=s.categories)}if(s.type===i.BuyXGetY&&t.buy){const s=t.buy;"products"!==s.source&&"product"!==s.source||!s.source_value||(s.products=s.source_value.map((s=>o[s])).filter(Boolean))}}return this.offersList})).then((()=>{this.canRender=!0})).catch((s=>{salla.logger.warn(s)}))}componentDidLoad(){let s=this.host.querySelector(".s-slider-block__title-nav");s?.classList.add("s-offer-bank-payment-nav"),this.emitPromotionViewed()}findCategories(s,e){let t=[];for(const o of s)e.includes(o.id_||o.id)&&t.push(o),o.sub_categories?.length>0&&(t=t.concat(this.findCategories(o.sub_categories,e)));return t}render(){if(!this.offersList.length||!this.canRender||!this.showOffer)return null;const s=salla.lang.get("pages.offer.offers_title","عروض المنتج"),t=salla.lang.get("pages.offer.offers_subtitle","احصل على المنتج بسعر مخفض مع أفضل العروض");return[e("div",{class:"s-offer-wrapper"},e("salla-slider",{type:"carousel",id:"offers-slider","block-title":s,"block-subTitle":t,"show-controls":this.offersList.length>1},e("div",{slot:"items"},this.offersList.slice(0,5).map(((s,e)=>this.renderOfferCard(s,e+1))),this.offersList.length>5&&this.renderShowMoreCard()))),this.renderAllOffersModal(),this.renderProductsModal()]}renderShowMoreCard(){return e("div",{class:"s-offer-slide-one-fourth swiper-slide",onClick:s=>{s.preventDefault(),s.stopPropagation(),this.openAllOffersModal()}},e("div",{class:"s-offer-card s-offer-show-more-card"},e("i",{class:"sicon-add s-offer-show-more-icon"}),e("h3",{class:"s-offer-show-more-title"},salla.lang.get("pages.offer.show_more_offers","عرض المزيد من العروض"))))}openAllOffersModal(){this.showAllOffersModal=!0}closeAllOffersModal(){this.showAllOffersModal=!1}closeProductsModal(){this.showProductsModal=!1,this.selectedOfferProducts=[],this.productsLoaded=!1}handleAccordionToggle(s,e){this.collapsedOffers={...this.collapsedOffers,[s]:e}}getOfferProducts(s){const e=s.details;return e.products&&e.products.length>0?e.products:s.type===i.BuyXGetY&&e.get?.products?e.get.products:[]}renderProductsLinkForModalCard(s,t){const o=this.getOfferProducts(s);return o&&0!==o.length?e("div",{class:"s-offer-products-link",onClick:s=>{s.stopPropagation(),this.selectedOfferProducts=o,this.showProductsModal=!0}},e("span",{class:"s-offer-products-link-text"},this.products_link_text),t&&e("i",{class:"sicon-keyboard_arrow_down s-offer-products-link-icon"})):null}renderAllOffersModal(){return e("salla-drawer",{visible:this.showAllOffersModal,position:"right",width:"md","no-padding":!0,"drawer-title":salla.lang.get("pages.offer.all_offers_title","جميع العروض"),onDrawerVisibilityChanged:s=>!s.detail&&this.closeAllOffersModal()},e("div",{class:"s-offer-drawer-content"},this.offersList.map(((s,e)=>this.renderModalOfferCard(s,e+1)))))}renderProductsModal(){return e("salla-drawer",{visible:this.showProductsModal,width:"md",position:"right","no-padding":!0,"drawer-title":this.products_link_text,onDrawerVisibilityChanged:s=>!s.detail&&this.closeProductsModal()},e("div",{class:"s-offer-products-drawer-content"},this.selectedOfferProducts?.length>0?e("div",null,!this.productsLoaded&&e("div",{class:"flex items-center justify-center p-8"},e("salla-loading",{size:"24"})),e("salla-products-list",{source:"selected","source-value":JSON.stringify(this.selectedOfferProducts.map((s=>s.id))),"product-card-component":this.productCardComponent,"horizontal-cards":!0,"compact-cards":!0,includes:["images"],onProductsFetched:()=>this.productsLoaded=!0})):e("div",{class:"p-4 text-center text-gray-500"},salla.lang.get("blocks.products.no_products_found","لا توجد منتجات"))))}renderModalOfferCard(s,t=1){const o=this.getOfferProducts(s),r=o&&o.length>0,a=!1!==this.collapsedOffers[s.id];return e("div",{class:"s-offer-drawer-card"},e("div",{class:"s-offer-card-main",onClick:()=>this.emitPromotionClicked(s,t)},e("div",{class:"s-offer-card-icon"},this.getOfferIcon(s.type)),e("div",{class:"s-offer-card-content"},e("h3",{class:"s-offer-card-title",title:s.title},s.title),s.description&&e("p",{class:"s-offer-card-description"},s.description),s.type===i.DiscountsTable?e("div",{class:"s-offer-card-details"},this.renderDiscountTableOfferContent(s)):s.type===i.PercentageOrFixed||s.type===i.Percentage||s.type===i.FixedAmount?e("div",{class:"s-offer-card-details"},this.renderPercentageOrFixedOfferContent(s),this.renderOfferCategories(s),this.renderOfferBrands(s),this.renderOfferTags(s)):e("div",{class:"s-offer-card-details"},this.renderOfferCategories(s),this.renderOfferBrands(s),this.renderOfferTags(s)))),r&&e("salla-accordion",{collapsed:a,collapsible:!0,size:"sm",onClick:s=>s.stopPropagation(),onAccordionToggle:e=>this.handleAccordionToggle(s.id,e.detail.payload.collapsed)},e("salla-accordion-head",{collapsible:!0,collapsed:a},e("div",{slot:"title",class:"s-offer-products-thumbnails"},e("span",{class:"s-offer-products-title"},this.products_link_text,e("i",{class:`sicon-keyboard_arrow_${a?"down":"up"} s-offer-products-link-icon`})),e("div",{class:"s-offer-products-thumbnails-stack"},o.slice(0,3).map(((s,t)=>e("div",{class:"s-offer-product-thumbnail",style:{zIndex:`${t+1}`}},e("img",{src:s.thumbnail||s.image?.url||salla.url.cdn("images/s-empty.png"),alt:s.name})))),o.length>3&&e("div",{class:"s-offer-products-more-count",style:{zIndex:"7"}},"+",o.length-3)))),e("salla-accordion-body",null,e("div",{class:"s-offer-products-content"},e("salla-products-list",{source:"selected","source-value":JSON.stringify(o.map((s=>s.id))),"product-card-component":this.productCardComponent,"horizontal-cards":!0,"compact-cards":!0,includes:["images"]})))))}renderOfferCard(s,t=1){return e("div",{class:"s-offer-slide-one-fourth swiper-slide",onClick:()=>this.emitPromotionClicked(s,t)},e("div",{class:"s-offer-card"},e("div",{class:"s-offer-card-icon"},this.getOfferIcon(s.type)),e("div",{class:"s-offer-card-content"},e("h3",{class:"s-offer-card-title",title:s.title},s.title),s.description&&e("p",{class:"s-offer-card-description"},s.description),e("div",{class:"s-offer-card-details"},s.type===i.DiscountsTable?this.renderDiscountTableOfferContent(s):s.type===i.PercentageOrFixed||s.type===i.Percentage||s.type===i.FixedAmount?[this.renderPercentageOrFixedOfferContent(s),this.renderOfferCategories(s),this.renderOfferBrands(s),this.renderOfferTags(s)]:[this.renderOfferCategories(s),this.renderOfferBrands(s),this.renderOfferTags(s)],this.renderProductsLinkForModalCard(s,!1)))))}getOfferIcon(s){return e("i",{class:{[i.DiscountsTable]:"sicon-discount-calculator",[i.Bank]:"sicon-bank",[i.SpecialPrice]:"sicon-fire",[i.BuyXGetY]:"sicon-gift",[i.PercentageOrFixed]:"sicon-special-discount",[i.Percentage]:"sicon-special-discount",[i.FixedAmount]:"sicon-special-discount"}[s]||"sicon-discount"})}renderDiscountTableOfferContent(s){const t=s.details.discounts||[];return t.length?e("div",null,e("div",{class:"s-offer-card-description"},salla.lang.get("pages.offer.discount_table_subtitle","وفر اكتر بشراء منتجات أكثر")),e("table",{class:"s-offer-discount-table"},e("tbody",null,this.groupDiscountsByRows(t,3).map(((s,t)=>e("tr",{key:t},s.map(((s,t)=>e("td",{key:t},e("div",{class:"s-offer-discount-percentage"},s.percentage,"%"),e("div",{class:"s-offer-discount-condition"},this.formatDiscountCondition(s))))))))))):null}renderPercentageOrFixedOfferContent(s){const t=s.details;return t.discount_value||t.min_spend>0||t.min_items>0?e("div",{class:"s-offer-percentage-fixed-content"},t.min_spend>0&&e("div",{class:"s-offer-min-spend"},this.min_spend_text(t.min_spend,this.userCurrency?.symbol||"")),t.min_items>0&&e("div",{class:"s-offer-min-items"},this.min_items_text(t.min_items))):null}groupDiscountsByRows(s,e){const t=[];for(let o=0;o<s.length;o+=e)t.push(s.slice(o,o+e));return t}formatDiscountCondition(s){return s.discounted_amount?`${s.discounted_amount} ${this.userCurrency?.symbol||""}`:null!=s.quantity?this.buy_quantity_text(s.quantity):`1 ${this.product_text}`}renderOfferCategories(s){const t=s.details;let o=t.categories||[];if(s.type===i.BuyXGetY&&t.get?.categories&&(o=t.get.categories),!o.length)return null;const r=this.expandedCategories[s.id],a=o.length>3,l=r?o:o.slice(0,3);return e("div",{class:"s-offer-categories"},e("div",{class:"s-offer-categories-list"},l.map(((s,t)=>e("a",{key:t,class:"s-offer-category-item",href:s.url||salla.url.create("categories",s.id||s.id_)},s.name))),a&&e("span",{class:"s-offer-categories-toggle",onClick:e=>{e.preventDefault(),e.stopPropagation(),this.toggleCategoryExpansion(s.id)}},r?e("span",null,e("i",{class:"sicon-keyboard_arrow_up"})," ",salla.lang.get("common.elements.hide","إخفاء")):e("span",null,salla.lang.get("common.elements.show","عرض")," ","+"+(o.length-3)," ",e("i",{class:"sicon-keyboard_arrow_down"})))))}renderOfferBrands(s){const t=s.details.brands||[];if(!t.length)return null;const o=this.expandedCategories[s.id],i=t.length>3,r=o?t:t.slice(0,3);return e("div",{class:"s-offer-categories"},e("div",{class:"s-offer-categories-list"},r.map(((s,t)=>e("a",{key:t,class:"s-offer-category-item",href:s.url},s.name))),i&&e("span",{class:"s-offer-categories-toggle",onClick:e=>{e.preventDefault(),e.stopPropagation(),this.toggleCategoryExpansion(s.id)}},o?e("span",null,e("i",{class:"sicon-keyboard_arrow_up"})," ",salla.lang.get("common.elements.hide","إخفاء")):e("span",null,salla.lang.get("common.elements.show","عرض")," ","+"+(t.length-3)," ",e("i",{class:"sicon-keyboard_arrow_down"})))))}renderOfferTags(s){const t=s.details.tags||[];if(!t.length)return null;const o=this.expandedCategories[s.id],i=t.length>3,r=o?t:t.slice(0,3);return e("div",{class:"s-offer-categories"},e("div",{class:"s-offer-categories-list"},r.map(((s,t)=>e("a",{key:t,class:"s-offer-category-item",href:s.url||salla.url.create("tags",s.id)},s.name))),i&&e("span",{class:"s-offer-categories-toggle",onClick:e=>{e.preventDefault(),e.stopPropagation(),this.toggleCategoryExpansion(s.id)}},o?e("span",null,e("i",{class:"sicon-keyboard_arrow_up"})," ",salla.lang.get("common.elements.hide","إخفاء")):e("span",null,salla.lang.get("common.elements.show","عرض")," ","+"+(t.length-3)," ",e("i",{class:"sicon-keyboard_arrow_down"})))))}toggleCategoryExpansion(s){this.expandedCategories={...this.expandedCategories,[s]:!this.expandedCategories[s]}}get host(){return t(this)}};r.style=":host .s-drawer-close:where([dir=rtl],[dir=rtl] *){left:0}";export{r as salla_offer}
4
+ import{r as s,h as e,a as t}from"./p-Z9TEkBrE.js";var o,i;!function(s){s.ProductDetail="product.single",s.Cart="cart"}(o||(o={})),function(s){s.Conditional="conditional",s.PercentageOrFixed="fixed",s.DiscountsTable="discounts_table",s.Bank="bank",s.BuyXGetY="buy_x_get_y",s.SpecialPrice="special_price",s.Percentage="percentage",s.FixedAmount="fixed_amount"}(i||(i={}));const r=class{constructor(e){s(this,e),this.productCardComponent="salla-product-card",this.offersList=[],this.canRender=!1,this.showOffer=salla.config.get("store.settings.product.show_special_offers"),this.showAllOffersModal=!1,this.showProductsModal=!1,this.selectedOfferProducts=[],this.collapsedOffers={},this.expandedCategories={},this.productsLoaded=!1,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.buy_quantity_text=s=>salla.lang.get("pages.offer.buy_quantity",{quantity:s}),this.products_link_text=salla.lang.get("pages.offer.included_products","المنتجات المشمولة"),this.min_spend_text=(s,e)=>salla.lang.get("pages.offer.min_spend_amount",{amount:s,currency:e},`بحد أدنى ${s} ${e} من مبلغ الشراء`),this.min_items_text=s=>salla.lang.get("pages.offer.min_items",{items:s},`بحد أدنى ${s} منتجات`),this.product_text=salla.lang.get("common.elements.product","منتج"),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.buy_quantity_text(0),this.products_link_text=salla.lang.get("pages.offer.included_products","المنتجات المشمولة"),this.min_spend_text=(s,e)=>salla.lang.get("pages.offer.min_spend_amount",{amount:s,currency:e},`بحد أدنى ${s} ${e} من مبلغ الشراء`),this.min_items_text=s=>salla.lang.get("pages.offer.min_items",{items:s},`بحد أدنى ${s} منتجات`),this.product_text=salla.lang.get("common.elements.product","منتج")})),salla.onReady((()=>{this.currentPage=salla.config.get("page.slug");const s=salla.config.get("currencies")||{},e=salla.config.get("user.currency_code");this.userCurrency=s[e]||{symbol:"",code:e||"SAR",name:""}}))}async getEndpointByPageName(){return this.currentPage==o.Cart?`offers/cart/${await Salla.cart.getCurrentCartId()}`:this.currentPage==o.ProductDetail?`offers/product/${salla.config.get("page.id")}`:"offers"}emitPromotionViewed(){if(!(this.offersList.length&&this.canRender&&this.showOffer))return;const s=this.offersList.slice(0,5).map(((s,e)=>({id:s.id,name:s.title,creative:s.description||"",position:e+1})));salla.event.emit("salla::offer.promotion.viewed",s)}emitPromotionClicked(s,e=1){if(!(this.offersList.length&&this.canRender&&this.showOffer))return;const t=s||this.offersList[0];salla.event.emit("salla::offer.promotion.clicked",[{id:t.id,name:t.title,creative:t.description||"",position:e}])}componentWillLoad(){return this.hasCustomComponent=!!customElements.get(this.productCardComponent),new Promise((s=>salla.onReady(s))).then((()=>{if(this.showOffer=!salla.url.is_page("product.single")||salla.config.get("store.settings.product.show_special_offers"),!this.showOffer)throw new Error("Merchant disabled showing the offers on product page")})).then((async()=>salla.api.request(await this.getEndpointByPageName()))).then((async s=>{if(!(this.offersList=s.data).length)throw new Error("salla-offers:: There is no offers!");if(this.offersList=this.offersList.filter((s=>[i.SpecialPrice,i.Bank,i.BuyXGetY,i.DiscountsTable,i.PercentageOrFixed,i.Percentage,i.FixedAmount].includes(s.type))),!this.offersList.length)throw new Error("salla-offers:: No supported offer types found!");let e=null;this.offersList.some((s=>{const e=s.details;return"category"===e.apply_to&&e.targets||"categories"===e.apply_to&&e.targets||s.type===i.BuyXGetY&&("categories"===e.get?.source||"category"===e.get?.source)}))&&(e=(await salla.product.api.categories()).data);const t=new Set;for(const s of this.offersList){const e=s.details;"product"!==e.apply_to&&"products"!==e.apply_to||!e.targets||e.targets.forEach((s=>t.add(s))),s.type===i.BuyXGetY&&"products"===e.get?.source&&e.get?.source_value&&e.get.source_value.forEach((s=>t.add(s))),s.type!==i.BuyXGetY||"products"!==e.buy?.source&&"product"!==e.buy?.source||!e.buy?.source_value||e.buy.source_value.forEach((s=>t.add(s)))}let o={};if(t.size>0)try{const s=await salla.product.api.fetch({source:"selected",source_value:Array.from(t)});o=Object.fromEntries(s.data.map((s=>[s.id,s])))}catch(s){o={}}for(const s of this.offersList){const t=s.details;if(("category"===t.apply_to&&t.targets||"categories"===t.apply_to&&t.targets)&&e&&(t.categories=this.findCategories(e,t.targets)),"product"!==t.apply_to&&"products"!==t.apply_to||!t.targets||(t.products=t.targets.map((s=>o[s])).filter(Boolean)),"brand"===t.apply_to&&t.targets&&(t.brands=t.targets),"tag"===t.apply_to&&t.targets&&(t.tags=t.targets),s.type===i.BuyXGetY&&t.get){const s=t.get;"products"===s.source&&s.source_value?s.products=s.source_value.map((s=>o[s])).filter(Boolean):("categories"===s.source||"category"===s.source)&&e&&s.source_value&&(s.categories=this.findCategories(e,s.source_value),t.categories=s.categories)}if(s.type===i.BuyXGetY&&t.buy){const s=t.buy;"products"!==s.source&&"product"!==s.source||!s.source_value||(s.products=s.source_value.map((s=>o[s])).filter(Boolean))}}return this.offersList})).then((()=>{this.canRender=!0})).catch((s=>{salla.logger.warn(s)}))}componentDidLoad(){let s=this.host.querySelector(".s-slider-block__title-nav");s?.classList.add("s-offer-bank-payment-nav"),this.emitPromotionViewed()}findCategories(s,e){let t=[];for(const o of s)e.includes(o.id_||o.id)&&t.push(o),o.sub_categories?.length>0&&(t=t.concat(this.findCategories(o.sub_categories,e)));return t}render(){if(!this.offersList.length||!this.canRender||!this.showOffer)return null;const s=salla.lang.get("pages.offer.offers_title","عروض المنتج"),t=salla.lang.get("pages.offer.offers_subtitle","احصل على المنتج بسعر مخفض مع أفضل العروض");return[e("div",{class:"s-offer-wrapper"},e("salla-slider",{type:"carousel",id:"offers-slider","block-title":s,"block-subTitle":t,"show-controls":this.offersList.length>1},e("div",{slot:"items"},this.offersList.slice(0,5).map(((s,e)=>this.renderOfferCard(s,e+1))),this.offersList.length>5&&this.renderShowMoreCard()))),this.renderAllOffersModal(),this.renderProductsModal()]}renderShowMoreCard(){return e("div",{class:"s-offer-slide-one-fourth swiper-slide",onClick:s=>{s.preventDefault(),s.stopPropagation(),this.openAllOffersModal()}},e("div",{class:"s-offer-card s-offer-show-more-card"},e("i",{class:"sicon-add s-offer-show-more-icon"}),e("h3",{class:"s-offer-show-more-title"},salla.lang.get("pages.offer.show_more_offers","عرض المزيد من العروض"))))}openAllOffersModal(){this.showAllOffersModal=!0}closeAllOffersModal(){this.showAllOffersModal=!1}closeProductsModal(){this.showProductsModal=!1,this.selectedOfferProducts=[],this.productsLoaded=!1}handleAccordionToggle(s,e){this.collapsedOffers={...this.collapsedOffers,[s]:e}}getOfferProducts(s){const e=s.details;return e.products&&e.products.length>0?e.products:s.type===i.BuyXGetY&&e.get?.products?e.get.products:[]}renderProductsLinkForModalCard(s,t){const o=this.getOfferProducts(s);return o&&0!==o.length?e("div",{class:"s-offer-products-link",onClick:s=>{s.stopPropagation(),this.selectedOfferProducts=o,this.showProductsModal=!0}},e("span",{class:"s-offer-products-link-text"},this.products_link_text),t&&e("i",{class:"sicon-keyboard_arrow_down s-offer-products-link-icon"})):null}renderAllOffersModal(){return e("salla-drawer",{visible:this.showAllOffersModal,position:"right",width:"md","no-padding":!0,"drawer-title":salla.lang.get("pages.offer.all_offers_title","جميع العروض"),onDrawerVisibilityChanged:s=>!s.detail&&this.closeAllOffersModal()},e("div",{class:"s-offer-drawer-content"},this.offersList.map(((s,e)=>this.renderModalOfferCard(s,e+1)))))}renderProductsModal(){return e("salla-drawer",{visible:this.showProductsModal,width:"md",position:"right","no-padding":!0,"drawer-title":this.products_link_text,onDrawerVisibilityChanged:s=>!s.detail&&this.closeProductsModal()},e("div",{class:"s-offer-products-drawer-content"},this.selectedOfferProducts?.length>0?e("div",null,!this.productsLoaded&&e("div",{class:"flex items-center justify-center p-8"},e("salla-loading",{size:"24"})),e("salla-products-list",{source:"selected","source-value":JSON.stringify(this.selectedOfferProducts.map((s=>s.id))),"product-card-component":this.productCardComponent,"horizontal-cards":!0,"compact-cards":!0,includes:["images"],onProductsFetched:()=>this.productsLoaded=!0})):e("div",{class:"p-4 text-center text-gray-500"},salla.lang.get("blocks.products.no_products_found","لا توجد منتجات"))))}renderModalOfferCard(s,t=1){const o=this.getOfferProducts(s),r=o&&o.length>0,a=!1!==this.collapsedOffers[s.id];return e("div",{class:"s-offer-drawer-card"},e("div",{class:"s-offer-card-main",onClick:()=>this.emitPromotionClicked(s,t)},e("div",{class:"s-offer-card-icon"},this.getOfferIcon(s.type)),e("div",{class:"s-offer-card-content"},e("h3",{class:"s-offer-card-title",title:s.title},s.title),s.description&&e("p",{class:"s-offer-card-description"},s.description),s.type===i.DiscountsTable?e("div",{class:"s-offer-card-details"},this.renderDiscountTableOfferContent(s)):s.type===i.PercentageOrFixed||s.type===i.Percentage||s.type===i.FixedAmount?e("div",{class:"s-offer-card-details"},this.renderPercentageOrFixedOfferContent(s),this.renderOfferCategories(s),this.renderOfferBrands(s),this.renderOfferTags(s)):e("div",{class:"s-offer-card-details"},this.renderOfferCategories(s),this.renderOfferBrands(s),this.renderOfferTags(s)))),r&&e("salla-accordion",{collapsed:a,collapsible:!0,size:"sm",onClick:s=>s.stopPropagation(),onAccordionToggle:e=>this.handleAccordionToggle(s.id,e.detail.payload.collapsed)},e("salla-accordion-head",{collapsible:!0,collapsed:a},e("div",{slot:"title",class:"s-offer-products-thumbnails"},e("span",{class:"s-offer-products-title"},this.products_link_text,e("i",{class:`sicon-keyboard_arrow_${a?"down":"up"} s-offer-products-link-icon`})),e("div",{class:"s-offer-products-thumbnails-stack"},o.slice(0,3).map(((s,t)=>e("div",{class:"s-offer-product-thumbnail",style:{zIndex:`${t+1}`}},e("img",{src:s.thumbnail||s.image?.url||salla.url.cdn("images/s-empty.png"),alt:s.name})))),o.length>3&&e("div",{class:"s-offer-products-more-count",style:{zIndex:"7"}},"+",o.length-3)))),e("salla-accordion-body",null,e("div",{class:"s-offer-products-content"},e("salla-products-list",{source:"selected","source-value":JSON.stringify(o.map((s=>s.id))),"product-card-component":this.productCardComponent,"horizontal-cards":!0,"compact-cards":!0,includes:["images"]})))))}renderOfferCard(s,t=1){return e("div",{class:"s-offer-slide-one-fourth swiper-slide",onClick:()=>this.emitPromotionClicked(s,t)},e("div",{class:"s-offer-card"},e("div",{class:"s-offer-card-icon"},this.getOfferIcon(s.type)),e("div",{class:"s-offer-card-content"},e("h3",{class:"s-offer-card-title",title:s.title},s.title),s.description&&e("p",{class:"s-offer-card-description"},s.description),e("div",{class:"s-offer-card-details"},s.type===i.DiscountsTable?this.renderDiscountTableOfferContent(s):s.type===i.PercentageOrFixed||s.type===i.Percentage||s.type===i.FixedAmount?[this.renderPercentageOrFixedOfferContent(s),this.renderOfferCategories(s),this.renderOfferBrands(s),this.renderOfferTags(s)]:[this.renderOfferCategories(s),this.renderOfferBrands(s),this.renderOfferTags(s)],this.renderProductsLinkForModalCard(s,!1)))))}getOfferIcon(s){return e("i",{class:{[i.DiscountsTable]:"sicon-discount-calculator",[i.Bank]:"sicon-bank",[i.SpecialPrice]:"sicon-fire",[i.BuyXGetY]:"sicon-gift",[i.PercentageOrFixed]:"sicon-special-discount",[i.Percentage]:"sicon-special-discount",[i.FixedAmount]:"sicon-special-discount"}[s]||"sicon-discount"})}renderDiscountTableOfferContent(s){const t=s.details.discounts||[];return t.length?e("div",null,e("div",{class:"s-offer-card-description"},salla.lang.get("pages.offer.discount_table_subtitle","وفر اكتر بشراء منتجات أكثر")),e("table",{class:"s-offer-discount-table"},e("tbody",null,this.groupDiscountsByRows(t,3).map(((s,t)=>e("tr",{key:t},s.map(((s,t)=>e("td",{key:t},e("div",{class:"s-offer-discount-percentage"},s.percentage,"%"),e("div",{class:"s-offer-discount-condition"},this.formatDiscountCondition(s))))))))))):null}renderPercentageOrFixedOfferContent(s){const t=s.details;return t.discount_value||t.min_spend>0||t.min_items>0?e("div",{class:"s-offer-percentage-fixed-content"},t.min_spend>0&&e("div",{class:"s-offer-min-spend"},this.min_spend_text(t.min_spend,this.userCurrency?.symbol||"")),t.min_items>0&&e("div",{class:"s-offer-min-items"},this.min_items_text(t.min_items))):null}groupDiscountsByRows(s,e){const t=[];for(let o=0;o<s.length;o+=e)t.push(s.slice(o,o+e));return t}formatDiscountCondition(s){return s.discounted_amount?`${s.discounted_amount} ${this.userCurrency?.symbol||""}`:null!=s.quantity?this.buy_quantity_text(s.quantity):`1 ${this.product_text}`}renderOfferCategories(s){const t=s.details;let o=t.categories||[];if(s.type===i.BuyXGetY&&t.get?.categories&&(o=t.get.categories),!o.length)return null;const r=this.expandedCategories[s.id],a=o.length>3,l=r?o:o.slice(0,3);return e("div",{class:"s-offer-categories"},e("div",{class:"s-offer-categories-list"},l.map(((s,t)=>e("a",{key:t,class:"s-offer-category-item",href:s.url||salla.url.create("categories",s.id||s.id_)},s.name))),a&&e("span",{class:"s-offer-categories-toggle",onClick:e=>{e.preventDefault(),e.stopPropagation(),this.toggleCategoryExpansion(s.id)}},r?e("span",null,e("i",{class:"sicon-keyboard_arrow_up"})," ",salla.lang.get("common.elements.hide","إخفاء")):e("span",null,salla.lang.get("common.elements.show","عرض")," ","+"+(o.length-3)," ",e("i",{class:"sicon-keyboard_arrow_down"})))))}renderOfferBrands(s){const t=s.details.brands||[];if(!t.length)return null;const o=this.expandedCategories[s.id],i=t.length>3,r=o?t:t.slice(0,3);return e("div",{class:"s-offer-categories"},e("div",{class:"s-offer-categories-list"},r.map(((s,t)=>e("a",{key:t,class:"s-offer-category-item",href:s.url},s.name))),i&&e("span",{class:"s-offer-categories-toggle",onClick:e=>{e.preventDefault(),e.stopPropagation(),this.toggleCategoryExpansion(s.id)}},o?e("span",null,e("i",{class:"sicon-keyboard_arrow_up"})," ",salla.lang.get("common.elements.hide","إخفاء")):e("span",null,salla.lang.get("common.elements.show","عرض")," ","+"+(t.length-3)," ",e("i",{class:"sicon-keyboard_arrow_down"})))))}renderOfferTags(s){const t=s.details.tags||[];if(!t.length)return null;const o=this.expandedCategories[s.id],i=t.length>3,r=o?t:t.slice(0,3);return e("div",{class:"s-offer-categories"},e("div",{class:"s-offer-categories-list"},r.map(((s,t)=>e("a",{key:t,class:"s-offer-category-item",href:s.url||salla.url.create("tags",s.id)},s.name))),i&&e("span",{class:"s-offer-categories-toggle",onClick:e=>{e.preventDefault(),e.stopPropagation(),this.toggleCategoryExpansion(s.id)}},o?e("span",null,e("i",{class:"sicon-keyboard_arrow_up"})," ",salla.lang.get("common.elements.hide","إخفاء")):e("span",null,salla.lang.get("common.elements.show","عرض")," ","+"+(t.length-3)," ",e("i",{class:"sicon-keyboard_arrow_down"})))))}toggleCategoryExpansion(s){this.expandedCategories={...this.expandedCategories,[s]:!this.expandedCategories[s]}}get host(){return t(this)}};r.style=":host .s-drawer-close:where([dir=rtl],[dir=rtl] *){left:0}";export{r as salla_offer}
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r as e,h as s,H as a}from"./p-DcQSprhU.js";const r=class{constructor(s){e(this,s),this.dark=!1,this.commercialRegisterLabel="",this.freelanceLabel=""}componentWillLoad(){this.initializeTranslations()}initializeTranslations(){salla.lang.onLoaded((()=>{const e=(e,s,a)=>{salla.helpers.setNested(salla.lang.messages[e],s,a)};e("ar.trans","blocks.footer.commercial_register","السجل التجاري"),e("en.trans","blocks.footer.commercial_register","Commercial Register"),e("ar.trans","blocks.footer.freelance","وثيقة العمل الحر"),e("en.trans","blocks.footer.freelance","Freelance Certificate"),this.commercialRegisterLabel=salla.lang.getWithDefault("blocks.footer.commercial_register","السجل التجاري"),this.freelanceLabel=salla.lang.getWithDefault("blocks.footer.freelance","وثيقة العمل الحر")}))}getBadgeData(){const e=salla.config.get("store.settings.commercial_number"),s=salla.config.get("store.settings.freelance_number");return e?{number:e,label:this.commercialRegisterLabel||"السجل التجاري",imageUrl:salla.url.cdn("images/commercial-register.png",70,70),type:"commercial"}:s?{number:s,label:this.freelanceLabel||"وثيقة العمل الحر",imageUrl:this.dark?salla.url.cdn("images/freelance-white.png"):salla.url.cdn("images/freelance.png"),type:"freelance"}:null}render(){const e=this.getBadgeData();return e?s(a,{class:"s-trust-badges-wrapper "+(this.dark?"dark":"")},s("img",{class:"s-trust-badges-image",width:"55",height:"55",src:e.imageUrl,alt:e.label}),s("div",{class:"s-trust-badges-content"},s("p",{class:"s-trust-badges-label"},e.label),s("b",{class:"s-trust-badges-number"},e.number))):null}};r.style="";export{r as salla_trust_badges}
4
+ import{r as e,h as s,H as a}from"./p-Z9TEkBrE.js";const r=class{constructor(s){e(this,s),this.dark=!1,this.commercialRegisterLabel="",this.freelanceLabel=""}componentWillLoad(){this.initializeTranslations()}initializeTranslations(){salla.lang.onLoaded((()=>{const e=(e,s,a)=>{salla.helpers.setNested(salla.lang.messages[e],s,a)};e("ar.trans","blocks.footer.commercial_register","السجل التجاري"),e("en.trans","blocks.footer.commercial_register","Commercial Register"),e("ar.trans","blocks.footer.freelance","وثيقة العمل الحر"),e("en.trans","blocks.footer.freelance","Freelance Certificate"),this.commercialRegisterLabel=salla.lang.getWithDefault("blocks.footer.commercial_register","السجل التجاري"),this.freelanceLabel=salla.lang.getWithDefault("blocks.footer.freelance","وثيقة العمل الحر")}))}getBadgeData(){const e=salla.config.get("store.settings.commercial_number"),s=salla.config.get("store.settings.freelance_number");return e?{number:e,label:this.commercialRegisterLabel||"السجل التجاري",imageUrl:salla.url.cdn("images/commercial-register.png",70,70),type:"commercial"}:s?{number:s,label:this.freelanceLabel||"وثيقة العمل الحر",imageUrl:this.dark?salla.url.cdn("images/freelance-white.png"):salla.url.cdn("images/freelance.png"),type:"freelance"}:null}render(){const e=this.getBadgeData();return e?s(a,{class:"s-trust-badges-wrapper "+(this.dark?"dark":"")},s("img",{class:"s-trust-badges-image",width:"55",height:"55",src:e.imageUrl,alt:e.label}),s("div",{class:"s-trust-badges-content"},s("p",{class:"s-trust-badges-label"},e.label),s("b",{class:"s-trust-badges-number"},e.number))):null}};r.style="";export{r as salla_trust_badges}