@salla.sa/twilight-components 2.14.402 → 2.14.403

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 (521) hide show
  1. package/dist/cjs/calendar-D-PUoCDH.js +13 -0
  2. package/dist/cjs/{cancel-De6vslRA.js → cancel-B5SbMYEk.js} +2 -2
  3. package/dist/cjs/cart2-B98PSAFN.js +13 -0
  4. package/dist/cjs/{check-x3w3-gpj.js → check-BnVBPQNp.js} +2 -2
  5. package/dist/cjs/{filepond-PWJcd3M3.js → filepond-CHgj_x6Q.js} +1 -1
  6. package/dist/cjs/{filepond-plugin-file-poster-Bt4qeA2f.js → filepond-plugin-file-poster-BM8akyHG.js} +1 -1
  7. package/dist/cjs/{filepond-plugin-file-validate-size-C-9PDDsS.js → filepond-plugin-file-validate-size-COf4Mbms.js} +1 -1
  8. package/dist/cjs/{filepond-plugin-file-validate-type-tA2SP9JO.js → filepond-plugin-file-validate-type-Mc6-vU_9.js} +1 -1
  9. package/dist/cjs/{filepond-plugin-image-edit-jcfxLe8v.js → filepond-plugin-image-edit-Cegsph-w.js} +1 -1
  10. package/dist/cjs/{filepond-plugin-image-exif-orientation-DVDjcytZ.js → filepond-plugin-image-exif-orientation-Ca7MqBpy.js} +1 -1
  11. package/dist/cjs/{filepond-plugin-image-preview-CenIamTW.js → filepond-plugin-image-preview-C58SPQ5e.js} +1 -1
  12. package/dist/cjs/functions-DyPV5TVV.js +74 -0
  13. package/dist/{esm/gift-BChI23pG.js → cjs/gift-DbNivqYO.js} +4 -2
  14. package/dist/cjs/gift-sharing-BE0uszUm.js +13 -0
  15. package/dist/cjs/{index-ZlRhYmjA.js → index-DagepTOF.js} +1 -1
  16. package/dist/cjs/{index-Cuq57q32.js → index-DdhkQnYm.js} +61 -26
  17. package/dist/cjs/iphone-x-qC21wCLj.js +13 -0
  18. package/dist/cjs/loader.cjs.js +2 -2
  19. package/dist/cjs/{mail-CO8cFZH7.js → mail-Bgvt2hc9.js} +2 -2
  20. package/dist/cjs/percentage-Fs83gq6Q.js +21 -0
  21. package/dist/cjs/salla-accordion-body_2.cjs.entry.js +1 -1
  22. package/dist/cjs/salla-accordion_6.cjs.entry.js +5 -5
  23. package/dist/cjs/salla-add-product-button_4.cjs.entry.js +5 -5
  24. package/dist/cjs/salla-advertisement.cjs.entry.js +1 -1
  25. package/dist/cjs/salla-alert_2.cjs.entry.js +3 -3
  26. package/dist/cjs/salla-app-install-alert.cjs.entry.js +1 -1
  27. package/dist/cjs/salla-apps-icons.cjs.entry.js +1 -1
  28. package/dist/cjs/salla-badge.cjs.entry.js +95 -0
  29. package/dist/cjs/salla-booking-field_7.cjs.entry.js +20 -26
  30. package/dist/cjs/salla-bullet-delivery.cjs.entry.js +2 -2
  31. package/dist/cjs/salla-cart-coupons.cjs.entry.js +2 -2
  32. package/dist/cjs/salla-cart-item-offers_2.cjs.entry.js +4 -4
  33. package/dist/cjs/salla-comment-form_8.cjs.entry.js +11 -11
  34. package/dist/cjs/salla-conditional-offer.cjs.entry.js +1 -1
  35. package/dist/cjs/salla-contacts.cjs.entry.js +3 -3
  36. package/dist/cjs/salla-cookies-bar.cjs.entry.js +1 -1
  37. package/dist/cjs/salla-count-down.cjs.entry.js +2 -2
  38. package/dist/cjs/salla-custom-fields.cjs.entry.js +1 -1
  39. package/dist/cjs/salla-delivery-promise.cjs.entry.js +1 -1
  40. package/dist/cjs/salla-edit-order-button.cjs.entry.js +65 -0
  41. package/dist/cjs/salla-filters-widget.cjs.entry.js +3 -3
  42. package/dist/cjs/salla-filters.cjs.entry.js +2 -2
  43. package/dist/cjs/salla-fulfillment-methods.cjs.entry.js +1 -1
  44. package/dist/cjs/salla-gifting.cjs.entry.js +7 -13
  45. package/dist/cjs/salla-hook.cjs.entry.js +2 -2
  46. package/dist/cjs/salla-infinite-scroll.cjs.entry.js +1 -1
  47. package/dist/cjs/salla-installment.cjs.entry.js +1 -1
  48. package/dist/cjs/salla-list-tile.cjs.entry.js +2 -2
  49. package/dist/cjs/salla-localization-modal.cjs.entry.js +2 -2
  50. package/dist/cjs/salla-login-modal.cjs.entry.js +1 -1
  51. package/dist/cjs/salla-loyalty-banner.cjs.entry.js +69 -0
  52. package/dist/cjs/salla-loyalty-hero_2.cjs.entry.js +239 -0
  53. package/dist/cjs/salla-loyalty-panel.cjs.entry.js +103 -0
  54. package/dist/cjs/salla-loyalty-prize-item.cjs.entry.js +2 -2
  55. package/dist/cjs/salla-loyalty-program.cjs.entry.js +108 -64
  56. package/dist/cjs/salla-loyalty-reward.cjs.entry.js +54 -0
  57. package/dist/cjs/salla-loyalty.cjs.entry.js +3 -3
  58. package/dist/cjs/salla-maintenance-alert.cjs.entry.js +3 -3
  59. package/dist/cjs/salla-map.cjs.entry.js +4 -4
  60. package/dist/cjs/salla-menu.cjs.entry.js +1 -1
  61. package/dist/cjs/salla-metadata.cjs.entry.js +1 -1
  62. package/dist/cjs/salla-multiple-bundle-product-cart_2.cjs.entry.js +4 -4
  63. package/dist/cjs/salla-multiple-bundle-product-options-modal_2.cjs.entry.js +6 -6
  64. package/dist/cjs/salla-multiple-bundle-product.cjs.entry.js +2 -2
  65. package/dist/cjs/salla-notification-item.cjs.entry.js +2 -2
  66. package/dist/cjs/salla-notifications.cjs.entry.js +1 -1
  67. package/dist/cjs/salla-offer-modal.cjs.entry.js +5 -16
  68. package/dist/cjs/salla-offer.cjs.entry.js +1 -1
  69. package/dist/cjs/salla-order-details-multiple-bundle-product.cjs.entry.js +1 -1
  70. package/dist/cjs/salla-order-details-options.cjs.entry.js +1 -1
  71. package/dist/cjs/salla-order-details.cjs.entry.js +2 -2
  72. package/dist/cjs/salla-order-edit-item.cjs.entry.js +1 -1
  73. package/dist/cjs/salla-order-edit.cjs.entry.js +1 -1
  74. package/dist/cjs/salla-order-summary.cjs.entry.js +4 -4
  75. package/dist/cjs/salla-order-totals-card.cjs.entry.js +1 -1
  76. package/dist/cjs/salla-orders.cjs.entry.js +1 -1
  77. package/dist/cjs/salla-payments.cjs.entry.js +3 -3
  78. package/dist/cjs/salla-placeholder.cjs.entry.js +2 -2
  79. package/dist/cjs/salla-price-range.cjs.entry.js +3 -3
  80. package/dist/cjs/{salla-product-card.cjs.entry.js → salla-product-card_2.cjs.entry.js} +120 -6
  81. package/dist/cjs/salla-product-size-guide.cjs.entry.js +3 -3
  82. package/dist/cjs/salla-products-list.cjs.entry.js +1 -1
  83. package/dist/cjs/salla-progress-bar.cjs.entry.js +1 -1
  84. package/dist/cjs/salla-quick-order.cjs.entry.js +6 -12
  85. package/dist/cjs/salla-rating-modal.cjs.entry.js +3 -3
  86. package/dist/cjs/salla-reward-action_4.cjs.entry.js +243 -0
  87. package/dist/cjs/salla-scopes.cjs.entry.js +2 -2
  88. package/dist/cjs/salla-search.cjs.entry.js +6 -6
  89. package/dist/cjs/salla-skeleton.cjs.entry.js +2 -2
  90. package/dist/cjs/salla-slider.cjs.entry.js +1 -1
  91. package/dist/cjs/salla-social-share.cjs.entry.js +5 -5
  92. package/dist/cjs/salla-social.cjs.entry.js +2 -2
  93. package/dist/cjs/salla-tab-content_3.cjs.entry.js +4 -4
  94. package/dist/cjs/salla-tiered-offer.cjs.entry.js +1 -1
  95. package/dist/cjs/salla-tooltip.cjs.entry.js +2 -2
  96. package/dist/cjs/salla-trust-badges.cjs.entry.js +1 -1
  97. package/dist/cjs/salla-user-menu.cjs.entry.js +5 -5
  98. package/dist/cjs/salla-user-profile.cjs.entry.js +1 -1
  99. package/dist/cjs/salla-user-settings.cjs.entry.js +2 -2
  100. package/dist/cjs/salla-verify.cjs.entry.js +3 -3
  101. package/dist/cjs/salla-wallet.cjs.entry.js +1 -1
  102. package/dist/cjs/shipping-CPYcgyCL.js +13 -0
  103. package/dist/cjs/tag-D-PcUR33.js +12 -0
  104. package/dist/cjs/tracked-promise-6pAeDi6L.js +31 -0
  105. package/dist/cjs/translations-DMwpLvqi.js +294 -0
  106. package/dist/cjs/twilight.cjs.js +2 -2
  107. package/dist/cjs/user-add-BCGrddZS.js +13 -0
  108. package/dist/cjs/{vanilla-picker-C8OtoDdM.js → vanilla-picker-BMBx7QVh.js} +1 -1
  109. package/dist/collection/assets/images/prize-image.svg +1 -0
  110. package/dist/collection/collection-manifest.json +11 -0
  111. package/dist/collection/components/salla-badge/salla-badge.css +0 -0
  112. package/dist/collection/components/salla-badge/salla-badge.js +117 -0
  113. package/dist/collection/components/salla-booking-field/salla-booking-field.js +1 -1
  114. package/dist/collection/components/salla-bottom-alert/salla-bottom-alert.js +2 -2
  115. package/dist/collection/components/salla-bullet-delivery/salla-bullet-delivery.js +1 -1
  116. package/dist/collection/components/salla-cart-coupons/salla-cart-coupons.js +1 -1
  117. package/dist/collection/components/salla-cart-summary/salla-cart-summary.js +1 -1
  118. package/dist/collection/components/salla-color-picker/salla-color-picker.js +1 -1
  119. package/dist/collection/components/salla-comment-form/salla-comment-form.js +1 -1
  120. package/dist/collection/components/salla-comments/salla-comment-item.js +3 -3
  121. package/dist/collection/components/salla-conditional-fields/salla-conditional-fields.js +1 -1
  122. package/dist/collection/components/salla-count-down/salla-count-down.js +1 -1
  123. package/dist/collection/components/salla-datetime-picker/salla-datetime-picker.js +1 -1
  124. package/dist/collection/components/salla-edit-order-button/salla-edit-order-button.css +3 -0
  125. package/dist/collection/components/salla-edit-order-button/salla-edit-order-button.js +99 -0
  126. package/dist/collection/components/salla-file-upload/salla-file-upload.js +2 -2
  127. package/dist/collection/components/salla-filters/salla-filters.js +1 -1
  128. package/dist/collection/components/salla-filters-widget/salla-filters-widget.js +2 -2
  129. package/dist/collection/components/salla-gifting/salla-gifting.js +2 -2
  130. package/dist/collection/components/salla-hook/salla-hook.js +1 -1
  131. package/dist/collection/components/salla-list-tile/salla-list-tile.js +1 -1
  132. package/dist/collection/components/salla-loading/salla-loading.js +1 -1
  133. package/dist/collection/components/salla-localization-modal/salla-localization-modal.js +1 -1
  134. package/dist/collection/components/salla-loyalty/salla-loyalty-prize-item.js +1 -1
  135. package/dist/collection/components/salla-loyalty-program/functions.js +53 -0
  136. package/dist/collection/components/salla-loyalty-program/interfaces.js +8 -1
  137. package/dist/collection/components/salla-loyalty-program/salla-loyalty-banner.js +69 -0
  138. package/dist/collection/components/salla-loyalty-program/salla-loyalty-hero.js +87 -0
  139. package/dist/collection/components/salla-loyalty-program/salla-loyalty-panel.js +171 -0
  140. package/dist/collection/components/salla-loyalty-program/salla-loyalty-point.js +219 -0
  141. package/dist/collection/components/salla-loyalty-program/salla-loyalty-program.js +104 -65
  142. package/dist/collection/components/salla-loyalty-program/salla-loyalty-reward.js +166 -0
  143. package/dist/collection/components/salla-loyalty-program/salla-reward-action.js +93 -0
  144. package/dist/collection/components/salla-loyalty-program/salla-reward-card.js +92 -0
  145. package/dist/collection/components/salla-loyalty-program/salla-reward-details.js +206 -0
  146. package/dist/collection/components/salla-loyalty-program/salla-reward-exchange.js +109 -0
  147. package/dist/collection/components/salla-loyalty-program/translations.js +290 -0
  148. package/dist/collection/components/salla-maintenance-alert/salla-maintenance-alert.js +1 -1
  149. package/dist/collection/components/salla-map/salla-map.js +3 -3
  150. package/dist/collection/components/salla-multiple-bundle-product/components/salla-multiple-bundle-product-cart.js +1 -1
  151. package/dist/collection/components/salla-multiple-bundle-product/components/salla-multiple-bundle-product-details.js +2 -2
  152. package/dist/collection/components/salla-multiple-bundle-product/components/salla-multiple-bundle-product-options-modal.js +4 -4
  153. package/dist/collection/components/salla-multiple-bundle-product/components/salla-multiple-bundle-product-slider.js +1 -1
  154. package/dist/collection/components/salla-multiple-bundle-product/salla-multiple-bundle-product.js +1 -1
  155. package/dist/collection/components/salla-notifications/salla-notification-item.js +1 -1
  156. package/dist/collection/components/salla-offer-modal/salla-offer-modal.js +1 -1
  157. package/dist/collection/components/salla-order-details/salla-order-details.js +1 -1
  158. package/dist/collection/components/salla-order-summary/salla-order-summary.js +1 -1
  159. package/dist/collection/components/salla-payments/salla-payments.js +2 -2
  160. package/dist/collection/components/salla-placeholder/salla-placeholder.js +1 -1
  161. package/dist/collection/components/salla-price-range/salla-price-range.js +2 -2
  162. package/dist/collection/components/salla-product-availability/salla-product-availability.js +1 -1
  163. package/dist/collection/components/salla-product-card/salla-product-card.js +5 -5
  164. package/dist/collection/components/salla-product-size-guide/salla-product-size-guide.js +2 -2
  165. package/dist/collection/components/salla-quantity-input/salla-quantity-input.js +1 -1
  166. package/dist/collection/components/salla-quick-buy/salla-quick-buy.js +1 -1
  167. package/dist/collection/components/salla-review-card/salla-review-card.js +1 -1
  168. package/dist/collection/components/salla-reviews/salla-reviews.js +1 -1
  169. package/dist/collection/components/salla-reviews-page/salla-reviews-page.js +1 -1
  170. package/dist/collection/components/salla-scopes/salla-scopes.js +1 -1
  171. package/dist/collection/components/salla-search/salla-search.js +5 -5
  172. package/dist/collection/components/salla-skeleton/salla-skeleton.js +1 -1
  173. package/dist/collection/components/salla-social/salla-social.js +1 -1
  174. package/dist/collection/components/salla-social-share/salla-social-share.js +1 -1
  175. package/dist/collection/components/salla-tabs/salla-tab-content.js +1 -1
  176. package/dist/collection/components/salla-tabs/salla-tab-header.js +1 -1
  177. package/dist/collection/components/salla-tabs/salla-tabs.js +1 -1
  178. package/dist/collection/components/salla-tel-input/salla-tel-input.js +1 -1
  179. package/dist/collection/components/salla-tooltip/salla-tooltip.js +1 -1
  180. package/dist/collection/components/salla-user-settings/salla-user-settings.js +1 -1
  181. package/dist/components/calendar.js +11 -0
  182. package/dist/components/cart2.js +11 -0
  183. package/dist/components/functions.js +68 -0
  184. package/dist/components/gift-sharing.js +11 -0
  185. package/dist/components/index.js +2 -2
  186. package/dist/components/iphone-x.js +11 -0
  187. package/dist/components/percentage.js +18 -0
  188. package/dist/components/salla-badge.d.ts +11 -0
  189. package/dist/components/salla-badge.js +9 -0
  190. package/dist/components/salla-badge2.js +112 -0
  191. package/dist/components/salla-booking-field2.js +3 -9
  192. package/dist/components/salla-bottom-alert.js +2 -2
  193. package/dist/components/salla-bullet-delivery.js +1 -1
  194. package/dist/components/salla-cart-coupons.js +1 -1
  195. package/dist/components/salla-cart-summary.js +1 -1
  196. package/dist/components/salla-color-picker2.js +1 -1
  197. package/dist/components/salla-comment-form2.js +1 -1
  198. package/dist/components/salla-comment-item2.js +3 -3
  199. package/dist/components/salla-conditional-fields2.js +1 -1
  200. package/dist/components/salla-count-down2.js +1 -1
  201. package/dist/components/salla-datetime-picker2.js +1 -1
  202. package/dist/components/salla-edit-order-button.d.ts +11 -0
  203. package/dist/components/salla-edit-order-button.js +99 -0
  204. package/dist/components/salla-file-upload2.js +2 -2
  205. package/dist/components/salla-filters-widget2.js +2 -2
  206. package/dist/components/salla-filters.js +1 -1
  207. package/dist/components/salla-gifting.js +4 -10
  208. package/dist/components/salla-hook.js +1 -1
  209. package/dist/components/salla-list-tile2.js +1 -1
  210. package/dist/components/salla-loading2.js +1 -1
  211. package/dist/components/salla-localization-modal.js +1 -1
  212. package/dist/components/salla-loyalty-banner.d.ts +11 -0
  213. package/dist/components/salla-loyalty-banner.js +103 -0
  214. package/dist/components/salla-loyalty-hero.d.ts +11 -0
  215. package/dist/components/salla-loyalty-hero.js +9 -0
  216. package/dist/components/salla-loyalty-hero2.js +43 -0
  217. package/dist/components/salla-loyalty-panel.d.ts +11 -0
  218. package/dist/components/salla-loyalty-panel.js +250 -0
  219. package/dist/components/salla-loyalty-point.d.ts +11 -0
  220. package/dist/components/salla-loyalty-point.js +9 -0
  221. package/dist/components/salla-loyalty-point2.js +259 -0
  222. package/dist/components/salla-loyalty-prize-item.js +1 -1
  223. package/dist/components/salla-loyalty-program.js +233 -70
  224. package/dist/components/salla-loyalty-reward.d.ts +11 -0
  225. package/dist/components/salla-loyalty-reward.js +80 -0
  226. package/dist/components/salla-maintenance-alert.js +1 -1
  227. package/dist/components/salla-map2.js +3 -3
  228. package/dist/components/salla-multiple-bundle-product-cart2.js +1 -1
  229. package/dist/components/salla-multiple-bundle-product-details2.js +2 -2
  230. package/dist/components/salla-multiple-bundle-product-options-modal2.js +4 -4
  231. package/dist/components/salla-multiple-bundle-product-slider2.js +1 -1
  232. package/dist/components/salla-multiple-bundle-product.js +1 -1
  233. package/dist/components/salla-notification-item2.js +1 -1
  234. package/dist/components/salla-offer-modal.js +3 -14
  235. package/dist/components/salla-order-details.js +1 -1
  236. package/dist/components/salla-order-summary.js +1 -1
  237. package/dist/components/salla-payments.js +2 -2
  238. package/dist/components/salla-placeholder2.js +1 -1
  239. package/dist/components/salla-price-range2.js +2 -2
  240. package/dist/components/salla-product-availability2.js +1 -1
  241. package/dist/components/salla-product-card2.js +5 -5
  242. package/dist/components/salla-product-size-guide.js +2 -2
  243. package/dist/components/salla-quantity-input2.js +1 -1
  244. package/dist/components/salla-quick-buy2.js +1 -1
  245. package/dist/components/salla-quick-order.js +1 -7
  246. package/dist/components/salla-review-card2.js +1 -1
  247. package/dist/components/salla-reviews-page.js +1 -1
  248. package/dist/components/salla-reviews.js +1 -1
  249. package/dist/components/salla-reward-action.d.ts +11 -0
  250. package/dist/components/salla-reward-action.js +9 -0
  251. package/dist/components/salla-reward-action2.js +56 -0
  252. package/dist/components/salla-reward-card.d.ts +11 -0
  253. package/dist/components/salla-reward-card.js +9 -0
  254. package/dist/components/salla-reward-card2.js +44 -0
  255. package/dist/components/salla-reward-details.d.ts +11 -0
  256. package/dist/components/salla-reward-details.js +9 -0
  257. package/dist/components/salla-reward-details2.js +266 -0
  258. package/dist/components/salla-reward-exchange.d.ts +11 -0
  259. package/dist/components/salla-reward-exchange.js +9 -0
  260. package/dist/components/salla-reward-exchange2.js +81 -0
  261. package/dist/components/salla-scopes.js +1 -1
  262. package/dist/components/salla-search.js +5 -5
  263. package/dist/components/salla-skeleton2.js +1 -1
  264. package/dist/components/salla-social-share.js +1 -1
  265. package/dist/components/salla-social.js +1 -1
  266. package/dist/components/salla-tab-content2.js +1 -1
  267. package/dist/components/salla-tab-header2.js +1 -1
  268. package/dist/components/salla-tabs2.js +1 -1
  269. package/dist/components/salla-tel-input2.js +1 -1
  270. package/dist/components/salla-tooltip2.js +1 -1
  271. package/dist/components/salla-user-settings.js +1 -1
  272. package/dist/components/shipping.js +11 -0
  273. package/dist/components/tag.js +10 -0
  274. package/dist/components/tracked-promise.js +29 -0
  275. package/dist/components/translations.js +292 -0
  276. package/dist/esm/calendar-BkmanTR_.js +11 -0
  277. package/dist/esm/{cancel-BsLF_HK7.js → cancel-8Tsmrwno.js} +2 -2
  278. package/dist/esm/cart2-D1s2kXqL.js +11 -0
  279. package/dist/esm/{check-BsXh13x8.js → check-BZp0rKEO.js} +2 -2
  280. package/dist/esm/{filepond-kua7JWt0.js → filepond-DSnpVe64.js} +1 -1
  281. package/dist/esm/{filepond-plugin-file-poster-D9ZjwPcg.js → filepond-plugin-file-poster-CIjT2DkD.js} +1 -1
  282. package/dist/esm/{filepond-plugin-file-validate-size-BVMhUXTI.js → filepond-plugin-file-validate-size-DfnQ9yTM.js} +1 -1
  283. package/dist/esm/{filepond-plugin-file-validate-type-CkwmRCJd.js → filepond-plugin-file-validate-type-BFqVzf03.js} +1 -1
  284. package/dist/esm/{filepond-plugin-image-edit-YEt9I2Ff.js → filepond-plugin-image-edit-CFSURdY1.js} +1 -1
  285. package/dist/esm/{filepond-plugin-image-exif-orientation-B5Q7AlDn.js → filepond-plugin-image-exif-orientation-Df4vxbTN.js} +1 -1
  286. package/dist/esm/{filepond-plugin-image-preview-B3J-p8BK.js → filepond-plugin-image-preview-BP5v9jJo.js} +1 -1
  287. package/dist/esm/functions-B0QFNVX_.js +68 -0
  288. package/dist/{cjs/gift-CJ-3Yw_x.js → esm/gift-CXRKXFgT.js} +2 -4
  289. package/dist/esm/gift-sharing-0-eTJXSD.js +11 -0
  290. package/dist/esm/{index-BYCfehfD.js → index-Noi8jmqR.js} +61 -27
  291. package/dist/esm/{index-Qfjn4tFb.js → index-dal1uM4i.js} +1 -1
  292. package/dist/esm/iphone-x-CciN5Q_x.js +11 -0
  293. package/dist/esm/loader.js +3 -3
  294. package/dist/esm/{mail-DmgxDvXL.js → mail-DLNIOD9t.js} +2 -2
  295. package/dist/esm/percentage-Bs6JxDkg.js +18 -0
  296. package/dist/esm/salla-accordion-body_2.entry.js +1 -1
  297. package/dist/esm/salla-accordion_6.entry.js +5 -5
  298. package/dist/esm/salla-add-product-button_4.entry.js +5 -5
  299. package/dist/esm/salla-advertisement.entry.js +1 -1
  300. package/dist/esm/salla-alert_2.entry.js +3 -3
  301. package/dist/esm/salla-app-install-alert.entry.js +1 -1
  302. package/dist/esm/salla-apps-icons.entry.js +1 -1
  303. package/dist/esm/salla-badge.entry.js +93 -0
  304. package/dist/esm/salla-booking-field_7.entry.js +20 -26
  305. package/dist/esm/salla-bullet-delivery.entry.js +2 -2
  306. package/dist/esm/salla-cart-coupons.entry.js +2 -2
  307. package/dist/esm/salla-cart-item-offers_2.entry.js +4 -4
  308. package/dist/esm/salla-comment-form_8.entry.js +11 -11
  309. package/dist/esm/salla-conditional-offer.entry.js +1 -1
  310. package/dist/esm/salla-contacts.entry.js +3 -3
  311. package/dist/esm/salla-cookies-bar.entry.js +1 -1
  312. package/dist/esm/salla-count-down.entry.js +2 -2
  313. package/dist/esm/salla-custom-fields.entry.js +1 -1
  314. package/dist/esm/salla-delivery-promise.entry.js +1 -1
  315. package/dist/esm/salla-edit-order-button.entry.js +63 -0
  316. package/dist/esm/salla-filters-widget.entry.js +3 -3
  317. package/dist/esm/salla-filters.entry.js +2 -2
  318. package/dist/esm/salla-fulfillment-methods.entry.js +1 -1
  319. package/dist/esm/salla-gifting.entry.js +7 -13
  320. package/dist/esm/salla-hook.entry.js +2 -2
  321. package/dist/esm/salla-infinite-scroll.entry.js +1 -1
  322. package/dist/esm/salla-installment.entry.js +1 -1
  323. package/dist/esm/salla-list-tile.entry.js +2 -2
  324. package/dist/esm/salla-localization-modal.entry.js +2 -2
  325. package/dist/esm/salla-login-modal.entry.js +1 -1
  326. package/dist/esm/salla-loyalty-banner.entry.js +67 -0
  327. package/dist/esm/salla-loyalty-hero_2.entry.js +236 -0
  328. package/dist/esm/salla-loyalty-panel.entry.js +101 -0
  329. package/dist/esm/salla-loyalty-prize-item.entry.js +2 -2
  330. package/dist/esm/salla-loyalty-program.entry.js +108 -64
  331. package/dist/esm/salla-loyalty-reward.entry.js +52 -0
  332. package/dist/esm/salla-loyalty.entry.js +3 -3
  333. package/dist/esm/salla-maintenance-alert.entry.js +3 -3
  334. package/dist/esm/salla-map.entry.js +4 -4
  335. package/dist/esm/salla-menu.entry.js +1 -1
  336. package/dist/esm/salla-metadata.entry.js +1 -1
  337. package/dist/esm/salla-multiple-bundle-product-cart_2.entry.js +4 -4
  338. package/dist/esm/salla-multiple-bundle-product-options-modal_2.entry.js +6 -6
  339. package/dist/esm/salla-multiple-bundle-product.entry.js +2 -2
  340. package/dist/esm/salla-notification-item.entry.js +2 -2
  341. package/dist/esm/salla-notifications.entry.js +1 -1
  342. package/dist/esm/salla-offer-modal.entry.js +5 -16
  343. package/dist/esm/salla-offer.entry.js +1 -1
  344. package/dist/esm/salla-order-details-multiple-bundle-product.entry.js +1 -1
  345. package/dist/esm/salla-order-details-options.entry.js +1 -1
  346. package/dist/esm/salla-order-details.entry.js +2 -2
  347. package/dist/esm/salla-order-edit-item.entry.js +1 -1
  348. package/dist/esm/salla-order-edit.entry.js +1 -1
  349. package/dist/esm/salla-order-summary.entry.js +4 -4
  350. package/dist/esm/salla-order-totals-card.entry.js +1 -1
  351. package/dist/esm/salla-orders.entry.js +1 -1
  352. package/dist/esm/salla-payments.entry.js +3 -3
  353. package/dist/esm/salla-placeholder.entry.js +2 -2
  354. package/dist/esm/salla-price-range.entry.js +3 -3
  355. package/dist/esm/{salla-product-card.entry.js → salla-product-card_2.entry.js} +120 -7
  356. package/dist/esm/salla-product-size-guide.entry.js +3 -3
  357. package/dist/esm/salla-products-list.entry.js +1 -1
  358. package/dist/esm/salla-progress-bar.entry.js +1 -1
  359. package/dist/esm/salla-quick-order.entry.js +6 -12
  360. package/dist/esm/salla-rating-modal.entry.js +3 -3
  361. package/dist/esm/salla-reward-action_4.entry.js +238 -0
  362. package/dist/esm/salla-scopes.entry.js +2 -2
  363. package/dist/esm/salla-search.entry.js +6 -6
  364. package/dist/esm/salla-skeleton.entry.js +2 -2
  365. package/dist/esm/salla-slider.entry.js +1 -1
  366. package/dist/esm/salla-social-share.entry.js +5 -5
  367. package/dist/esm/salla-social.entry.js +2 -2
  368. package/dist/esm/salla-tab-content_3.entry.js +4 -4
  369. package/dist/esm/salla-tiered-offer.entry.js +1 -1
  370. package/dist/esm/salla-tooltip.entry.js +2 -2
  371. package/dist/esm/salla-trust-badges.entry.js +1 -1
  372. package/dist/esm/salla-user-menu.entry.js +5 -5
  373. package/dist/esm/salla-user-profile.entry.js +1 -1
  374. package/dist/esm/salla-user-settings.entry.js +2 -2
  375. package/dist/esm/salla-verify.entry.js +3 -3
  376. package/dist/esm/salla-wallet.entry.js +1 -1
  377. package/dist/esm/shipping-CZRcMGA9.js +11 -0
  378. package/dist/esm/tag-cgSL_BIo.js +10 -0
  379. package/dist/esm/tracked-promise-CjeRn_A-.js +29 -0
  380. package/dist/esm/translations-B-Rj6b9M.js +292 -0
  381. package/dist/esm/twilight.js +3 -3
  382. package/dist/esm/user-add-QpH8MU22.js +11 -0
  383. package/dist/esm/{vanilla-picker-B4glVCCp.js → vanilla-picker-DRn4hnB9.js} +1 -1
  384. package/dist/twilight/p-0-eTJXSD.js +4 -0
  385. package/dist/twilight/{p-5fe6bb62.entry.js → p-024459e9.entry.js} +1 -1
  386. package/dist/twilight/{p-2edec63c.entry.js → p-04d8a7e5.entry.js} +1 -1
  387. package/dist/twilight/p-0a91929a.entry.js +4 -0
  388. package/dist/twilight/{p-24b86104.entry.js → p-0ad91621.entry.js} +1 -1
  389. package/dist/twilight/{p-1819894b.entry.js → p-0dce57b2.entry.js} +1 -1
  390. package/dist/twilight/{p-28fba512.entry.js → p-145858ca.entry.js} +1 -1
  391. package/dist/twilight/p-1613629f.entry.js +4 -0
  392. package/dist/twilight/{p-ec873193.entry.js → p-1762cd5c.entry.js} +1 -1
  393. package/dist/twilight/p-246bb9c3.entry.js +4 -0
  394. package/dist/twilight/{p-97aad44a.entry.js → p-2502deb6.entry.js} +1 -1
  395. package/dist/twilight/{p-3df24aaf.entry.js → p-256bd7e3.entry.js} +1 -1
  396. package/dist/twilight/{p-65928570.entry.js → p-2f27a79c.entry.js} +1 -1
  397. package/dist/twilight/{p-64fe6c2f.entry.js → p-301bdc8d.entry.js} +1 -1
  398. package/dist/twilight/{p-5871fc28.entry.js → p-3317da8e.entry.js} +1 -1
  399. package/dist/twilight/{p-15d44ede.entry.js → p-36e2d55f.entry.js} +1 -1
  400. package/dist/twilight/{p-2a19f553.entry.js → p-394e59f9.entry.js} +1 -1
  401. package/dist/twilight/{p-e5ccdc1d.entry.js → p-39595f4a.entry.js} +1 -1
  402. package/dist/twilight/{p-09fcfe8f.entry.js → p-3f6e4760.entry.js} +1 -1
  403. package/dist/twilight/{p-156660b7.entry.js → p-40936925.entry.js} +1 -1
  404. package/dist/twilight/{p-887c9a29.entry.js → p-40ac70b9.entry.js} +1 -1
  405. package/dist/twilight/{p-5ca700cd.entry.js → p-425ca86a.entry.js} +1 -1
  406. package/dist/twilight/p-426919ba.entry.js +4 -0
  407. package/dist/twilight/p-46e0817d.entry.js +4 -0
  408. package/dist/twilight/{p-4797dab5.entry.js → p-4886611c.entry.js} +1 -1
  409. package/dist/twilight/p-4bacc97f.entry.js +4 -0
  410. package/dist/twilight/{p-90045f50.entry.js → p-503a7446.entry.js} +1 -1
  411. package/dist/twilight/{p-ba128435.entry.js → p-55585695.entry.js} +1 -1
  412. package/dist/twilight/{p-60aa25f0.entry.js → p-56b2316e.entry.js} +1 -1
  413. package/dist/twilight/p-57fc6135.entry.js +4 -0
  414. package/dist/twilight/p-589db188.entry.js +4 -0
  415. package/dist/twilight/{p-62b949f1.entry.js → p-594a2cfc.entry.js} +1 -1
  416. package/dist/twilight/p-5b134612.entry.js +4 -0
  417. package/dist/twilight/{p-cd9f175a.entry.js → p-5d101927.entry.js} +1 -1
  418. package/dist/twilight/{p-b80c87f3.entry.js → p-5f05afcf.entry.js} +1 -1
  419. package/dist/twilight/{p-ee14a23d.entry.js → p-6b402aa3.entry.js} +1 -1
  420. package/dist/twilight/{p-3ed67200.entry.js → p-6ec4bce3.entry.js} +1 -1
  421. package/dist/twilight/{p-2f060d69.entry.js → p-779aaac4.entry.js} +1 -1
  422. package/dist/twilight/p-78a7f098.entry.js +4 -0
  423. package/dist/twilight/{p-140f5001.entry.js → p-78cc7185.entry.js} +1 -1
  424. package/dist/twilight/{p-f8183098.entry.js → p-79db938f.entry.js} +1 -1
  425. package/dist/twilight/{p-955aab42.entry.js → p-7cff302c.entry.js} +1 -1
  426. package/dist/twilight/{p-f8527980.entry.js → p-7f1e3e62.entry.js} +1 -1
  427. package/dist/twilight/{p-8d9b1865.entry.js → p-82785312.entry.js} +1 -1
  428. package/dist/twilight/{p-af6a34af.entry.js → p-83d63cf3.entry.js} +1 -1
  429. package/dist/twilight/{p-e23cc9c1.entry.js → p-8740d9b0.entry.js} +1 -1
  430. package/dist/twilight/{p-BsLF_HK7.js → p-8Tsmrwno.js} +1 -1
  431. package/dist/twilight/{p-72487957.entry.js → p-8bef56d7.entry.js} +1 -1
  432. package/dist/twilight/{p-d93e90fb.entry.js → p-8c95bcba.entry.js} +1 -1
  433. package/dist/twilight/{p-0cfd333a.entry.js → p-91005fdc.entry.js} +1 -1
  434. package/dist/twilight/{p-67f20b74.entry.js → p-96e09525.entry.js} +1 -1
  435. package/dist/twilight/{p-6cf0e5f0.entry.js → p-9a1dbe0b.entry.js} +1 -1
  436. package/dist/twilight/p-9ab9e4fe.entry.js +4 -0
  437. package/dist/twilight/{p-f4c6434f.entry.js → p-9ff6dbba.entry.js} +1 -1
  438. package/dist/twilight/p-B-Rj6b9M.js +4 -0
  439. package/dist/twilight/{p-D2bKqo2L.js → p-BCRhp4ZP.js} +1 -1
  440. package/dist/twilight/{p-DPak7cFa.js → p-BOikoFVU.js} +1 -1
  441. package/dist/twilight/{p-Wts3eSQu.js → p-BVmlhqyN.js} +1 -1
  442. package/dist/twilight/p-BX5898Au.js +4 -0
  443. package/dist/twilight/{p-BsXh13x8.js → p-BZp0rKEO.js} +1 -1
  444. package/dist/twilight/{p-DtXQ785R.js → p-Bdj8c3JN.js} +1 -1
  445. package/dist/twilight/p-BkmanTR_.js +4 -0
  446. package/dist/twilight/{p-a8mIwFp8.js → p-BlpVxOSF.js} +1 -1
  447. package/dist/twilight/p-Bs6JxDkg.js +4 -0
  448. package/dist/twilight/{p-BChI23pG.js → p-CXRKXFgT.js} +1 -1
  449. package/dist/twilight/p-CZRcMGA9.js +4 -0
  450. package/dist/twilight/p-CciN5Q_x.js +4 -0
  451. package/dist/twilight/p-D1s2kXqL.js +4 -0
  452. package/dist/twilight/{p-C45ROGL4.js → p-DIVFpxqq.js} +1 -1
  453. package/dist/twilight/{p-DmgxDvXL.js → p-DLNIOD9t.js} +1 -1
  454. package/dist/twilight/{p-Dx9FGzIq.js → p-D_bFmrB0.js} +1 -1
  455. package/dist/twilight/{p-CVG84YNJ.js → p-DbwYqKTo.js} +1 -1
  456. package/dist/twilight/p-DnvK1zqm.js +4 -0
  457. package/dist/twilight/{p-BYCfehfD.js → p-Noi8jmqR.js} +2 -2
  458. package/dist/twilight/p-QpH8MU22.js +4 -0
  459. package/dist/twilight/p-a139776f.entry.js +4 -0
  460. package/dist/twilight/p-a23e6051.entry.js +4 -0
  461. package/dist/twilight/p-a34a0037.entry.js +4 -0
  462. package/dist/twilight/{p-4e941f6a.entry.js → p-b9bc75ad.entry.js} +1 -1
  463. package/dist/twilight/{p-32a21d3e.entry.js → p-bb02c0fd.entry.js} +1 -1
  464. package/dist/twilight/{p-d112b260.entry.js → p-c3418320.entry.js} +1 -1
  465. package/dist/twilight/{p-011ff091.entry.js → p-c5214df3.entry.js} +1 -1
  466. package/dist/twilight/{p-5381a86d.entry.js → p-cc8b8f84.entry.js} +1 -1
  467. package/dist/twilight/p-cgSL_BIo.js +4 -0
  468. package/dist/twilight/p-d4a62692.entry.js +4 -0
  469. package/dist/twilight/{p-d130f149.entry.js → p-d6d0a9b8.entry.js} +1 -1
  470. package/dist/twilight/{p-ebb782d3.entry.js → p-d8389555.entry.js} +1 -1
  471. package/dist/twilight/{p-63778992.entry.js → p-d8d5d1f4.entry.js} +1 -1
  472. package/dist/twilight/{p-7c78c1a5.entry.js → p-da642a9a.entry.js} +1 -1
  473. package/dist/twilight/{p-f68e2787.entry.js → p-dce9ced4.entry.js} +1 -1
  474. package/dist/twilight/{p-f136e41b.entry.js → p-df8e08af.entry.js} +1 -1
  475. package/dist/twilight/{p-30695c34.entry.js → p-e0619a5d.entry.js} +1 -1
  476. package/dist/twilight/p-e25aaae6.entry.js +4 -0
  477. package/dist/twilight/{p-99aa0a59.entry.js → p-e270154b.entry.js} +1 -1
  478. package/dist/twilight/{p-f4060b10.entry.js → p-e3da6c85.entry.js} +1 -1
  479. package/dist/twilight/{p-ea0c19be.entry.js → p-e5a47190.entry.js} +1 -1
  480. package/dist/twilight/{p-6f0a262a.entry.js → p-ec5b3bd6.entry.js} +1 -1
  481. package/dist/twilight/p-f294b1e5.entry.js +4 -0
  482. package/dist/twilight/p-f2ed8e2a.entry.js +4 -0
  483. package/dist/twilight/{p-c5ab5c1b.entry.js → p-f4c1f034.entry.js} +1 -1
  484. package/dist/twilight/{p-0b265c17.entry.js → p-fbfe1cf4.entry.js} +1 -1
  485. package/dist/twilight/{p-ac973857.entry.js → p-fe4d55ce.entry.js} +1 -1
  486. package/dist/twilight/{p-c5a12dde.entry.js → p-feacde76.entry.js} +1 -1
  487. package/dist/twilight/{p-d9b8aa69.entry.js → p-ff3ae289.entry.js} +1 -1
  488. package/dist/twilight/{p-164ae46f.entry.js → p-ff47b12d.entry.js} +1 -1
  489. package/dist/twilight/{p-9XUl8eNt.js → p-iornn-Hi.js} +1 -1
  490. package/dist/twilight/twilight.esm.js +1 -1
  491. package/dist/types/components/salla-badge/salla-badge.d.ts +15 -0
  492. package/dist/types/components/salla-edit-order-button/salla-edit-order-button.d.ts +25 -0
  493. package/dist/types/components/salla-loyalty-program/functions.d.ts +67 -0
  494. package/dist/types/components/salla-loyalty-program/interfaces.d.ts +125 -0
  495. package/dist/types/components/salla-loyalty-program/salla-loyalty-banner.d.ts +20 -0
  496. package/dist/types/components/salla-loyalty-program/salla-loyalty-hero.d.ts +15 -0
  497. package/dist/types/components/salla-loyalty-program/salla-loyalty-panel.d.ts +45 -0
  498. package/dist/types/components/salla-loyalty-program/salla-loyalty-point.d.ts +11 -0
  499. package/dist/types/components/salla-loyalty-program/salla-loyalty-program.d.ts +25 -8
  500. package/dist/types/components/salla-loyalty-program/salla-loyalty-reward.d.ts +13 -0
  501. package/dist/types/components/salla-loyalty-program/salla-reward-action.d.ts +9 -0
  502. package/dist/types/components/salla-loyalty-program/salla-reward-card.d.ts +17 -0
  503. package/dist/types/components/salla-loyalty-program/salla-reward-details.d.ts +22 -0
  504. package/dist/types/components/salla-loyalty-program/salla-reward-exchange.d.ts +11 -0
  505. package/dist/types/components/salla-loyalty-program/translations.d.ts +1 -0
  506. package/dist/types/components.d.ts +341 -0
  507. package/package.json +6 -5
  508. package/dist/cjs/salla-products-slider.cjs.entry.js +0 -121
  509. package/dist/esm/salla-products-slider.entry.js +0 -119
  510. package/dist/twilight/p-078c884b.entry.js +0 -4
  511. package/dist/twilight/p-336f0f06.entry.js +0 -4
  512. package/dist/twilight/p-39ad489e.entry.js +0 -4
  513. package/dist/twilight/p-470433cb.entry.js +0 -4
  514. package/dist/twilight/p-52192d08.entry.js +0 -4
  515. package/dist/twilight/p-54c7e570.entry.js +0 -4
  516. package/dist/twilight/p-a0171740.entry.js +0 -4
  517. package/dist/twilight/p-c65832b1.entry.js +0 -4
  518. package/dist/twilight/p-d3a119aa.entry.js +0 -4
  519. package/dist/twilight/p-d4f3797c.entry.js +0 -4
  520. package/dist/twilight/p-fa3ceb7c.entry.js +0 -4
  521. package/dist/twilight/p-fa44f874.entry.js +0 -4
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r as t,h as e,H as s,a as l,F as d}from"./p-BYCfehfD.js";const o=class{constructor(e){t(this,e),this.sections=[],this.itemNumber=""}deleteItem(t,e){const s=this.host.closest("form");if(s){const l=s.getAttribute("id");if(l&&"string"==typeof l){const s=l.match(/item-(\d+)/)?.[1];this.itemNumber=s||"";const d=this.host.querySelector(`#accordion-${e.id}`);salla.cart.deleteItem(`${this.itemNumber}?product_id=${e.id}&section_id=${t}`).then((()=>d?.remove()))}}}renderRemoveButton(t,s,l=!1){return e("salla-button",{type:"button",shape:l?"btn":"icon",fill:l?"outline":"solid",size:"small",color:"danger","aria-label":"Remove from the cart",onClick:()=>this.deleteItem(t,s)},l?salla.lang.get("common.elements.delete"):e("i",{class:"sicon-cancel"}))}renderAccordionHeader(t,s){const l=s?.options&&s?.options?.length>0;return e("div",{slot:"html",class:"s-multiple-bundle-product-cart-header-wrapper"},e("div",{class:"s-multiple-bundle-product-cart-header "+(l?"":"s-multiple-bundle-product-cart-header-no-options")},e("div",{class:"s-multiple-bundle-product-cart-header-content"},e("a",{href:s?.url,class:"s-multiple-bundle-product-cart-header-image-wrapper"},e("img",{src:s?.image?.url,alt:s?.image?.alt||s?.name,class:"s-multiple-bundle-product-cart-header-image"})),e("div",{class:"s-multiple-bundle-product-cart-header-content-details"},e("h2",{class:"s-multiple-bundle-product-cart-header-content-details-title"},e("a",{href:s?.url,class:"s-multiple-bundle-product-cart-header-content-details-title-link"},s?.name)),e("div",{class:"s-multiple-bundle-product-cart-header-content-details-price"},e("span",{class:"s-multiple-bundle-product-cart-header-content-details-price-regular"},e("span",{innerHTML:s?.price?salla.money(s?.price):""})),s?.sale_price>0&&e("span",{class:"s-multiple-bundle-product-cart-header-content-details-price-sale"},e("span",{innerHTML:salla.money(s?.sale_price)}))),s?.quantity_in_group>0&&0!==s?.quantity&&e("p",{class:"s-multiple-bundle-product-cart-header-content-details-quantity"},e("span",null,salla.lang.get("pages.products.number_of_pieces")),e("span",null,s?.quantity_in_group)))),!l&&e("div",{class:"s-multiple-bundle-product-cart-header-remove-button"},this.renderRemoveButton(t,s,!1))))}render(){return e(s,{key:"df5a1f17db16a85222a239fa507912f38749909a",class:"s-multiple-bundle-product-wrapper"},e("div",{key:"52a0c1480c1ac65225491eea9f467a35677365f2",class:"s-multiple-bundle-product-wrapper-sections"},this.sections.map(((t,s)=>t.products.map((l=>{const d={sectionId:t.id,sectionIndex:s,productId:l.id};return e("salla-accordion",{key:l.id,collapsed:!1,bordered:!0,collapsible:!!(l.options&&l.options.length>0),size:"sm",id:`accordion-${l.id}`},e("salla-accordion-head",null,this.renderAccordionHeader(String(t.id),l)),l.options&&l.options.length>0&&e("salla-accordion-body",null,e("salla-product-options",{options:JSON.stringify(l.options),key:`${l.id}-persistent`,"product-id":l.id,"bundle-context":JSON.stringify(d)}),e("div",{class:"s-multiple-bundle-product-cart-body-remove-button"},this.renderRemoveButton(String(t.id),l,!0))))}))))))}get host(){return l(this)}};o.style="";const a=class{constructor(e){t(this,e),this.sections=[],this.selectedProducts={},this.productSelectedHandler=null,this.onSelectProduct=(t,e)=>{this.selectedProducts={...this.selectedProducts,[t]:new Set(this.selectedProducts[t]||[])};const s=e.id,l=this.selectedProducts[t].has(s);l?(this.selectedProducts[t].delete(s),this.clearProductFormData(s,t),this.clearProductModalOptions(s,t)):this.selectedProducts[t].add(s),this.selectedProducts={...this.selectedProducts},salla.event.dispatch("on-bundle-product-selected",{id:e.id,name:e.name,options:e.options,wasSelected:l,isSelected:!l})},this.ensureProductSelected=(t,e)=>{this.selectedProducts={...this.selectedProducts,[t]:new Set(this.selectedProducts[t]||[])};const s=e.id;this.selectedProducts[t].has(s)||(this.selectedProducts[t].add(s),this.selectedProducts={...this.selectedProducts},salla.event.dispatch("on-bundle-product-selected",{id:e.id,name:e.name,options:e.options}))},this.onSelectProductOptions=(t,e)=>{const s=this.sections.findIndex((t=>t.id==e)),l=this.sections.find((t=>t.id==e)),d=l?.products?.findIndex((e=>e.id==t.id))??0;salla.event.dispatch("multiple-bundle-product-modal::open",{product:t,sectionId:e,sectionIndex:s,productIndex:d})},this.handleBundleSliderProductSelected=t=>{const{product:e,sectionId:s}=t.detail;this.onSelectProduct(s,e)},this.handleBundleSliderProductOptionsSelected=t=>{const{product:e,sectionId:s}=t.detail;this.onSelectProductOptions(e,s)}}clearProductFormData(t,e){const s=this.host.closest("form");if(e){const l=`bundle[${e}][`;Array.from(s.querySelectorAll("input")).filter((e=>e.getAttribute("data-product-id")===String(t)&&e.name&&e.name.startsWith(l))).forEach((t=>t.remove()))}else s.querySelectorAll(`[data-product-id="${t}"]`).forEach((t=>t.remove()))}clearProductModalOptions(t,e){let s=null,l=null;if(null!=e&&(s=this.sections.findIndex((t=>t.id==e)),s>-1)){const e=this.sections[s];if(e){const s=e.products?.findIndex((e=>e.id==t));l="number"==typeof s&&s>-1?s:null}}salla.event.dispatch("multiple-bundle-product-modal::clear-options",{productId:t,sectionId:e,sectionIndex:s,productIndex:l})}renderAccordionHeader(t,s){return e(d,null,e("h2",{slot:"title"},t?.name),t?.obligatory_products?e("span",{slot:"note"},salla.lang.get("pages.products.obligatory_products",{count:t?.obligatory_products||0})):"",e("span",{slot:"progress"},s,"/",t?.products?.length||0))}componentDidLoad(){const t=this.host.querySelector("salla-multiple-bundle-product-options-modal");t&&(this.productSelectedHandler=t=>{const{productId:e,sectionId:s,product:l,fromModal:d}=t.detail;d?this.ensureProductSelected(s,l||{id:e}):this.onSelectProduct(s,l||{id:e})},t.addEventListener("productSelected",this.productSelectedHandler))}disconnectedCallback(){if(this.productSelectedHandler){const t=this.host.querySelector("salla-multiple-bundle-product-options-modal");t&&t.removeEventListener("productSelected",this.productSelectedHandler),this.productSelectedHandler=null}}render(){return e(s,{key:"25ed3fad5e1252a6a22739927c209689c111ef8b",class:"s-multiple-bundle-product-wrapper"},e("div",{key:"e2738635e77e740c47307130efff6c6d8d7dbb1e",class:"s-multiple-bundle-product-wrapper-sections"},this.sections.map(((t,s)=>e("salla-accordion",{key:t.id,collapsed:0!==s},e("salla-accordion-head",null,this.renderAccordionHeader(t,this.selectedProducts[t.id]?.size||0)),e("salla-accordion-body",null,e("salla-multiple-bundle-product-slider",{section:t,sectionIndex:s,selectedProducts:this.selectedProducts,onProductSelected:this.handleBundleSliderProductSelected,onProductOptionsSelected:this.handleBundleSliderProductOptionsSelected})))))),e("salla-multiple-bundle-product-options-modal",{key:"6359eb293af8feb486884f4d7d3182543c062430"}))}get host(){return l(this)}};a.style="";export{o as salla_multiple_bundle_product_cart,a as salla_multiple_bundle_product_details}
4
+ import{r as t,h as e,H as s,a as l,F as d}from"./p-Noi8jmqR.js";const o=class{constructor(e){t(this,e),this.sections=[],this.itemNumber=""}deleteItem(t,e){const s=this.host.closest("form");if(s){const l=s.getAttribute("id");if(l&&"string"==typeof l){const s=l.match(/item-(\d+)/)?.[1];this.itemNumber=s||"";const d=this.host.querySelector(`#accordion-${e.id}`);salla.cart.deleteItem(`${this.itemNumber}?product_id=${e.id}&section_id=${t}`).then((()=>d?.remove()))}}}renderRemoveButton(t,s,l=!1){return e("salla-button",{type:"button",shape:l?"btn":"icon",fill:l?"outline":"solid",size:"small",color:"danger","aria-label":"Remove from the cart",onClick:()=>this.deleteItem(t,s)},l?salla.lang.get("common.elements.delete"):e("i",{class:"sicon-cancel"}))}renderAccordionHeader(t,s){const l=s?.options&&s?.options?.length>0;return e("div",{slot:"html",class:"s-multiple-bundle-product-cart-header-wrapper"},e("div",{class:"s-multiple-bundle-product-cart-header "+(l?"":"s-multiple-bundle-product-cart-header-no-options")},e("div",{class:"s-multiple-bundle-product-cart-header-content"},e("a",{href:s?.url,class:"s-multiple-bundle-product-cart-header-image-wrapper"},e("img",{src:s?.image?.url,alt:s?.image?.alt||s?.name,class:"s-multiple-bundle-product-cart-header-image"})),e("div",{class:"s-multiple-bundle-product-cart-header-content-details"},e("h2",{class:"s-multiple-bundle-product-cart-header-content-details-title"},e("a",{href:s?.url,class:"s-multiple-bundle-product-cart-header-content-details-title-link"},s?.name)),e("div",{class:"s-multiple-bundle-product-cart-header-content-details-price"},e("span",{class:"s-multiple-bundle-product-cart-header-content-details-price-regular"},e("span",{innerHTML:s?.price?salla.money(s?.price):""})),s?.sale_price>0&&e("span",{class:"s-multiple-bundle-product-cart-header-content-details-price-sale"},e("span",{innerHTML:salla.money(s?.sale_price)}))),s?.quantity_in_group>0&&0!==s?.quantity&&e("p",{class:"s-multiple-bundle-product-cart-header-content-details-quantity"},e("span",null,salla.lang.get("pages.products.number_of_pieces")),e("span",null,s?.quantity_in_group)))),!l&&e("div",{class:"s-multiple-bundle-product-cart-header-remove-button"},this.renderRemoveButton(t,s,!1))))}render(){return e(s,{key:"d584e8fca258d4be9c50fe6e4094aa274ff64d14",class:"s-multiple-bundle-product-wrapper"},e("div",{key:"55a444d53317e17a7ef9a286089f85e2def128c8",class:"s-multiple-bundle-product-wrapper-sections"},this.sections.map(((t,s)=>t.products.map((l=>{const d={sectionId:t.id,sectionIndex:s,productId:l.id};return e("salla-accordion",{key:l.id,collapsed:!1,bordered:!0,collapsible:!!(l.options&&l.options.length>0),size:"sm",id:`accordion-${l.id}`},e("salla-accordion-head",null,this.renderAccordionHeader(String(t.id),l)),l.options&&l.options.length>0&&e("salla-accordion-body",null,e("salla-product-options",{options:JSON.stringify(l.options),key:`${l.id}-persistent`,"product-id":l.id,"bundle-context":JSON.stringify(d)}),e("div",{class:"s-multiple-bundle-product-cart-body-remove-button"},this.renderRemoveButton(String(t.id),l,!0))))}))))))}get host(){return l(this)}};o.style="";const a=class{constructor(e){t(this,e),this.sections=[],this.selectedProducts={},this.productSelectedHandler=null,this.onSelectProduct=(t,e)=>{this.selectedProducts={...this.selectedProducts,[t]:new Set(this.selectedProducts[t]||[])};const s=e.id,l=this.selectedProducts[t].has(s);l?(this.selectedProducts[t].delete(s),this.clearProductFormData(s,t),this.clearProductModalOptions(s,t)):this.selectedProducts[t].add(s),this.selectedProducts={...this.selectedProducts},salla.event.dispatch("on-bundle-product-selected",{id:e.id,name:e.name,options:e.options,wasSelected:l,isSelected:!l})},this.ensureProductSelected=(t,e)=>{this.selectedProducts={...this.selectedProducts,[t]:new Set(this.selectedProducts[t]||[])};const s=e.id;this.selectedProducts[t].has(s)||(this.selectedProducts[t].add(s),this.selectedProducts={...this.selectedProducts},salla.event.dispatch("on-bundle-product-selected",{id:e.id,name:e.name,options:e.options}))},this.onSelectProductOptions=(t,e)=>{const s=this.sections.findIndex((t=>t.id==e)),l=this.sections.find((t=>t.id==e)),d=l?.products?.findIndex((e=>e.id==t.id))??0;salla.event.dispatch("multiple-bundle-product-modal::open",{product:t,sectionId:e,sectionIndex:s,productIndex:d})},this.handleBundleSliderProductSelected=t=>{const{product:e,sectionId:s}=t.detail;this.onSelectProduct(s,e)},this.handleBundleSliderProductOptionsSelected=t=>{const{product:e,sectionId:s}=t.detail;this.onSelectProductOptions(e,s)}}clearProductFormData(t,e){const s=this.host.closest("form");if(e){const l=`bundle[${e}][`;Array.from(s.querySelectorAll("input")).filter((e=>e.getAttribute("data-product-id")===String(t)&&e.name&&e.name.startsWith(l))).forEach((t=>t.remove()))}else s.querySelectorAll(`[data-product-id="${t}"]`).forEach((t=>t.remove()))}clearProductModalOptions(t,e){let s=null,l=null;if(null!=e&&(s=this.sections.findIndex((t=>t.id==e)),s>-1)){const e=this.sections[s];if(e){const s=e.products?.findIndex((e=>e.id==t));l="number"==typeof s&&s>-1?s:null}}salla.event.dispatch("multiple-bundle-product-modal::clear-options",{productId:t,sectionId:e,sectionIndex:s,productIndex:l})}renderAccordionHeader(t,s){return e(d,null,e("h2",{slot:"title"},t?.name),t?.obligatory_products?e("span",{slot:"note"},salla.lang.get("pages.products.obligatory_products",{count:t?.obligatory_products||0})):"",e("span",{slot:"progress"},s,"/",t?.products?.length||0))}componentDidLoad(){const t=this.host.querySelector("salla-multiple-bundle-product-options-modal");t&&(this.productSelectedHandler=t=>{const{productId:e,sectionId:s,product:l,fromModal:d}=t.detail;d?this.ensureProductSelected(s,l||{id:e}):this.onSelectProduct(s,l||{id:e})},t.addEventListener("productSelected",this.productSelectedHandler))}disconnectedCallback(){if(this.productSelectedHandler){const t=this.host.querySelector("salla-multiple-bundle-product-options-modal");t&&t.removeEventListener("productSelected",this.productSelectedHandler),this.productSelectedHandler=null}}render(){return e(s,{key:"07ca2849aa860c68213f61ffdca521cc1c41b6f9",class:"s-multiple-bundle-product-wrapper"},e("div",{key:"b810754688575d2a6418f9f2089ca65aa7981a58",class:"s-multiple-bundle-product-wrapper-sections"},this.sections.map(((t,s)=>e("salla-accordion",{key:t.id,collapsed:0!==s},e("salla-accordion-head",null,this.renderAccordionHeader(t,this.selectedProducts[t.id]?.size||0)),e("salla-accordion-body",null,e("salla-multiple-bundle-product-slider",{section:t,sectionIndex:s,selectedProducts:this.selectedProducts,onProductSelected:this.handleBundleSliderProductSelected,onProductOptionsSelected:this.handleBundleSliderProductOptionsSelected})))))),e("salla-multiple-bundle-product-options-modal",{key:"7b7373564360e33bf005a5854acd84b61cdd3b05"}))}get host(){return l(this)}};a.style="";export{o as salla_multiple_bundle_product_cart,a as salla_multiple_bundle_product_details}
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r as t,c as s,h as i,H as e,a}from"./p-BYCfehfD.js";import{a as o}from"./p-CgtvEd63.js";import{S as r}from"./p-DiKTtDW5.js";import{H as h}from"./p-CHf8XdiS.js";const l=class{constructor(i){t(this,i),this.productsFetched=s(this,"productsFetched"),this.autoload=!1,this.productCardComponent="custom-salla-product-card",this.page=1,this.placeholderText=salla.lang.get("pages.categories.no_products"),this.endOfText=salla.lang.get("common.elements.end_of_content"),this.failedLoadMore=salla.lang.get("common.elements.failed_to_load_more"),this.currentPage=salla.config.get("page"),this.filtersSnapshot=[],this.lastViewedProductKey="lastViewedProductId",this.filtersKey="filters",this.infiniteScrollStateKey="infiniteScrollState",this.prevCategoryIdKey="prevCategoryId",this.isProcessing=!1,this.scrollTimeout=null,this.boundScrollToLastViewedProduct=()=>this.scrollToLastViewedProduct(),this.boundHandleScroll=()=>this.handleScroll(),this.specialPagesWithoutIds={"product.index.latest":"latest","product.index.offers":"offers","product.index.search":"search","product.index.sales":"sales"},this.includes=h.parseJson(this.includes||this.host.getAttribute("includes")),Array.isArray(this.includes)||(this.includes=null),h.setIncludes(this.includes),salla.lang.onLoaded((()=>{this.placeholderText=salla.lang.get("pages.categories.no_products"),this.endOfText=salla.lang.get("common.elements.end_of_content"),this.failedLoadMore=salla.lang.get("common.elements.failed_to_load_more"),this.currentPage=salla.config.get("page")}))}connectedCallback(){"scrollRestoration"in history&&(history.scrollRestoration="manual"),window.addEventListener("DOMContentLoaded",this.boundScrollToLastViewedProduct),salla.event.on("salla-filters::changed",(t=>this.setFilters(t)))}disconnectedCallback(){window.removeEventListener("DOMContentLoaded",this.boundScrollToLastViewedProduct),window.removeEventListener("scroll",this.boundHandleScroll)}async setFilters(t){if(t&&JSON.stringify(t)!==JSON.stringify(this.parsedFilters))return window.scrollTo({top:0,behavior:"smooth"}),this.parsedFilters=JSON.parse(JSON.stringify(t)),this.filtersSnapshot=this.parsedFilters,"product.index"==this.currentPage?.slug&&this.parsedFilters&&this.parsedFilters.category_id&&(this.currentCategoryIdFilter=[this.parsedFilters.category_id]),this.reload()}async reload(){!this.autoload&&this.loadMoreWrapper&&(this.loadMoreWrapper.style.display="none"),this.hasInfiniteScroll&&salla.infiniteScroll.destroy(this.infiniteScroll),this.buildNextPageUrl(),this.wrapper.innerHTML="",this.hasInfiniteScroll?this.init():this.getInitialData(),this.showPlaceholder&&(this.showPlaceholder=!1,this.placeholderLoader=document.createElement("div"),this.placeholderLoader.classList.add("s-products-list-loading-wrapper"),this.placeholderLoader.style.display="inherit",this.placeholderLoader.innerHTML='<span class="s-button-loader s-button-loader-center s-infinite-scroll-btn-loader"></span>',this.host.insertAdjacentElement("afterend",this.placeholderLoader))}isFilterable(){return salla.config.get("store.settings.product.filters")&&this.filtersResults}isSourceWithoutValue(){return["offers","latest","sales","wishlist","top-rated","reorder"].includes(this.getSource())}animateItems(){o({targets:"salla-products-list salla-product-card",opacity:[0,1],duration:1200,translateY:[20,0],delay:function(t,s){return 100*s}})}initBaseNextPageUrl(t){this.nextPage=salla.url.api(`products?source=${t}`),this.includes?.length&&(this.nextPage+=`&includes[]=${this.includes.join("&includes[]=")}`),this.limit&&(this.nextPage+=`&per_page=${this.limit>32?32:this.limit}`),this.sortBy&&(this.nextPage+=`&sort=${this.sortBy}`),"preview"===salla.config.get("theme.mode")&&(this.nextPage+="&use_username_url=1"),this.nextPage+="&filterable=1";for(const[t,s]of Object.entries(this.parsedFilters||{}))if(["string","number"].includes(typeof s))this.nextPage+=`&filters[${encodeURIComponent(t)}]=${encodeURIComponent(s)}`;else if(Array.isArray(s))s.forEach((s=>this.nextPage+=`&filters[${encodeURIComponent(t)}][]=${encodeURIComponent(s)}`));else if("object"==typeof s)for(const[i,e]of Object.entries(s))this.nextPage+=`&filters[${encodeURIComponent(t)}][${encodeURIComponent(i)}]=${encodeURIComponent(e)}`}buildNextPageUrl(){let t=this.getSource();if("json"===t)return;const s=sessionStorage.getItem(this.infiniteScrollStateKey);if(s){const{nextPage:t}=JSON.parse(s);if(!t)return}if(this.initBaseNextPageUrl(t),!this.isSourceWithoutValue())if(["search","related","landing-page"].includes(t))this.nextPage+=`&source_value=${this.getSourceValue()}`;else try{this.nextPage+=`&source_value[]=${this.getSourceValue().join("&source_value[]=")}`}catch(s){salla.logger.warn(`source-value prop should be array of ids ex source-value="[1,2,3]" for the source [${t}]`),this.sourceValueIsValid=!1}}loading(t=!0,s=!1){if(t){let t=s&&!this.autoload?this.btnLoader:this.loader;t&&(t.style.display="inherit")}else this.autoload||this.btnLoader&&(this.btnLoader.style.display="none"),this.loader&&(this.loader.style.display="none")}getItemHTML(t){"landing-page"===this.getSource()&&(t.url="");const s=document.createElement(this.hasCustomComponent?this.productCardComponent:"salla-product-card");return s.product=t,this.compactCards&&(s.compact=!0,s.toggleAttribute("compact",!0)),this.applyLandingPageStyles(s),this.applyHorizontalCardStyles(s),s.addEventListener("click",(s=>{s.target.closest("a")&&(h.saveProductSource(this.getSource()),this.hasInfiniteScroll&&(this.takeStateSnapshot(),sessionStorage.setItem(this.lastViewedProductKey,t.id)))})),s}applyLandingPageStyles(t){"landing-page"!==this.getSource()||this.hasCustomComponent||(t.toggleAttribute("hide-add-btn",!0),t.classList.add("s-product-card-fit-height"))}applyHorizontalCardStyles(t){this.horizontalCards&&(t.toggleAttribute("horizontal",!0),this.hasCustomComponent||t.toggleAttribute("shadow-on-hover",!0))}waitForResizing(t){let s=null;return new Promise((i=>{const e=new ResizeObserver((()=>{clearTimeout(s),s=setTimeout((()=>{e.disconnect(),i(null)}),160)}));e.observe(t)}))}waitForLayoutStable(t){let s=null;return new Promise((i=>{const e=new MutationObserver((()=>{clearTimeout(s),s=setTimeout((()=>{e.disconnect(),i(null)}),160)}));e.observe(t,{childList:!0,subtree:!0,attributes:!0})}))}async waitForStableLayout(t){return await Promise.allSettled([this.waitForResizing(t),this.waitForLayoutStable(t)])}scrollToLastViewedProduct(){const t=sessionStorage.getItem(this.lastViewedProductKey);t&&!salla.url.is_page("product.single")&&this.isElementLoaded(`[id*="${t}"]`).then((()=>{const s=this.wrapper?.querySelector(`[id*="${t}"]`);if(!s)return;const i=()=>{const t=()=>{s.scrollIntoView({block:"start",behavior:"instant"});const t=matchMedia("(max-width: 1024px)").matches?"header .inner":"ul.main-menu",i=window?.header_is_sticky?document.querySelector(t)?.getBoundingClientRect()?.height??56:0,e=parseInt(getComputedStyle(this.wrapper).rowGap)??16;scrollBy({top:-1*(i+e),behavior:"instant"})};requestAnimationFrame(t),s.querySelectorAll("img.lazy").forEach((s=>{const i=s,e=()=>{requestAnimationFrame(t),i.onload=i.onerror=null};i.onload=e,i.onerror=e})),this.removeScrollRestorationSession()};this.waitForStableLayout(this.host).then((()=>requestAnimationFrame(i)))}))}isElementLoaded(t){return new Promise((s=>{const i=setInterval((()=>{if(document.querySelector(t))return clearInterval(i),s(document.querySelector(t))}),50)}))}takeStateSnapshot(){const t=[];for(let s=0;s<this.wrapper.children.length;s++){const i=this.wrapper.children?.[s];t.push(i.product)}const s={pageIndex:Math.max((this.infiniteScroll?.pageIndex??1)-1,1),nextPage:this.nextPage,currentPageData:t};if(this.isFilterable()){const t=sessionStorage.getItem(this.filtersKey);sessionStorage.setItem(this.filtersKey,t||JSON.stringify(this.filtersSnapshot))}sessionStorage.setItem(this.infiniteScrollStateKey,JSON.stringify(s));let i=salla.config.get("page.id");const e=Object.keys(this.specialPagesWithoutIds).find((t=>salla.url.is_page(t)));e?i=this.specialPagesWithoutIds[e]:null!==i&&(i=String(i)),sessionStorage.setItem(this.prevCategoryIdKey,i)}removeScrollRestorationSession(){this.isFilterable()||sessionStorage.removeItem(this.filtersKey),sessionStorage.removeItem(this.infiniteScrollStateKey),sessionStorage.removeItem(this.lastViewedProductKey),sessionStorage.removeItem(this.prevCategoryIdKey)}loadStoredScrollState(){const t=sessionStorage.getItem(this.infiniteScrollStateKey),s=sessionStorage.getItem(this.filtersKey),i=sessionStorage.getItem(this.prevCategoryIdKey),e=this.specialPagesWithoutIds[salla.config.get("page.slug")]||null,a=salla.config.get("page.id"),o=salla.url.is_page("index"),r=salla.url.is_page("product.single"),h=e?i!==e:i!==String(a);if(i&&h&&!o&&!r||o&&!this.hasInfiniteScroll)return this.removeScrollRestorationSession(),this.switchToNormalBehavior=!0,!1;if(r)return this.switchToNormalBehavior=!0,!1;if(t)try{const{pageIndex:i,nextPage:e,currentPageData:a}=JSON.parse(t);if("undefined"!==s){const t=JSON.parse(s);salla.event.emit("filters::fetched",{filters:t})}this.page=i,this.nextPage=e;for(let t=0;t<a.length;t++)this.wrapper.append(this.getItemHTML(a?.[t]));return!0}catch(t){console.error("Failed to load stored scroll state:",t),this.removeScrollRestorationSession()}return!1}getSource(){return h.getProductsSource(this.source)}getSourceValue(){return this.currentCategoryIdFilter?this.currentCategoryIdFilter:h.getProductsSourceValue(this.source,this.sourceValue)}appendDataLayer(t){"object"==typeof dataLayer&&Array.isArray(dataLayer)&&dataLayer.push({event:"impressions",ecommerce:{currencyCode:salla.config.currency().code,impressions:t.map(((t,s)=>({id:t.id,name:t.name,price:t.price,brand:t.brand?.name||"",quantity:t.quantity,categories:[{name:t.category?.name||salla.config.get("page.title"),id:salla.config.get("page.id")}],category:t.category?.name||salla.config.get("page.title"),position:s+1})))}})}initiateInfiniteScroll(){if(!this.hasInfiniteScroll)return;const t=this.autoload&&this.includes&&this.includes.length>0;this.infiniteScroll=salla.infiniteScroll.initiate(this.wrapper,this.wrapper,{path:()=>this.nextPage,history:!1,nextPage:this.nextPage,scrollThreshold:!t&&!!this.autoload&&100,loadOnScroll:!t&&this.autoload},!0),this.infiniteScroll.pageIndex=this.page,this.infiniteScroll?.on("request",(()=>{this.loading(!0,!this.autoload)})),t&&window.addEventListener("scroll",this.boundHandleScroll),this.infiniteScroll?.on("load",(async t=>{if(!this.isProcessing){this.isProcessing=!0;try{if(!t.data?.length&&2===this.infiniteScroll.pageIndex)return this.showPlaceholder=!0,salla.infiniteScroll.destroy(this.infiniteScroll),this.loading(!1),void(this.placeholderLoader&&this.placeholderLoader.remove());this.includes&&await this.injectAndProcessData(t);const s=this.handleResponse(t);this.infiniteScroll.appendItems(s),2===this.infiniteScroll.pageIndex&&(!this.autoload&&this.nextPage&&(this.loadMoreWrapper.style.display="block"),this.animateItems())}catch(t){console.error("Error during load:",t)}finally{this.isProcessing=!1}}})),this.infiniteScroll?.on("error",(()=>{console.log("Error occurred during request"),this.status.querySelector(".s-infinite-scroll-error").classList.remove("s-hidden"),this.placeholderLoader&&this.placeholderLoader.remove(),this.loading(!1),this.isProcessing=!1})),salla.onReady((()=>{sessionStorage.getItem(this.infiniteScrollStateKey)||this.manualLoadNextPage()}))}handleScroll(){this.isProcessing||this.scrollTimeout||(this.scrollTimeout=setTimeout((()=>{this.scrollTimeout=null,requestAnimationFrame((()=>{const t=this.wrapper.getBoundingClientRect(),s=window.innerHeight;t.bottom-s<=200&&!this.isProcessing&&this.nextPage&&this.manualLoadNextPage()}))}),200))}manualLoadNextPage(){this.nextPage&&this.infiniteScroll.loadNextPage()}async injectAndProcessData(t){try{await h.injectExtraFieldsToResponse(t)}catch(t){console.error("Error injecting data:",t)}}getInitialData(){return this.loading(),salla.api.withoutNotifier((()=>salla.product.api.fetch({source:h.getApiSource(this.getSource()),source_value:this.getSourceValue(),limit:this.limit}).then((async t=>t.data.length?(await h.injectExtraFieldsToResponse(t),this.firstPageResponse?void this.handleResponse(t).forEach((t=>this.wrapper.append(t))):(this.firstPageResponse=t,void(this.nextPage=t.cursor?t.cursor.next:this.nextPage))):(this.showPlaceholder=!0,this.placeholderLoader&&this.placeholderLoader.remove(),void this.loading(!1))))))}async loadMore(){this.infiniteScroll?.loadNextPage()}componentWillLoad(){return salla.onReady().then((()=>{this.hasCustomComponent=!!customElements.get(this.productCardComponent),this.sourceValueIsValid=!(!this.getSourceValue()&&!this.isSourceWithoutValue()),this.hasInfiniteScroll=!["json","selected","related","landing-page","recently"].includes(this.getSource())&&!this.limit;let t=new URLSearchParams(window.location.search);try{this.sortBy=this.sortBy||t.get("sort")||t.get("by"),this.parsedFilters=h.extractFiltersFromUrl(t),this.parsedFilters&&this.parsedFilters.category_id&&(this.currentCategoryIdFilter=[this.parsedFilters.category_id])}catch(t){salla.logger.warn("failed to get filters from url",t.message)}if(this.buildNextPageUrl(),this.isReady=!0,!sessionStorage.getItem(this.infiniteScrollStateKey))if(this.sourceValueIsValid){if(!this.hasInfiniteScroll){if("json"===this.getSource())return this.getSourceValue().length?void setTimeout((()=>{this.getSourceValue().map((t=>this.wrapper.append(this.getItemHTML(t))))})):void(this.showPlaceholder=!0);if("selected"!==this.getSource()||this.getSourceValue().length)return this.getInitialData();this.showPlaceholder=!0}}else salla.logger.warn(`source-value prop is required for source [${this.getSource()}]`)}))}async componentDidLoad(){this.hasInfiniteScroll&&this.init(),await Salla.hooks.registerComponent("salla-products-list",this),this.loadStoredScrollState()?(this.autoload?!this.nextPage&&this.loading(!1):this.nextPage?this.loadMoreWrapper&&(this.loadMoreWrapper.style.display="block"):(this.loadMoreWrapper&&(this.loadMoreWrapper.style.display="none"),this.status.querySelector(".s-infinite-scroll-last").classList.remove("s-hidden")),this.scrollToLastViewedProduct()):!this.firstPageResponse&&this.switchToNormalBehavior?this.getInitialData().then((()=>{this.firstPageResponse?(this.handleResponse(this.firstPageResponse,!1).forEach((t=>{this.wrapper.append(t)})),setTimeout((()=>{if(!this.autoload&&this.nextPage&&1==this.infiniteScroll.pageIndex){const t=this.host.querySelector(".s-infinite-scroll-wrapper");t&&(t.style.display="block")}}))):console.error("No response received after getInitialData.")})).catch((t=>{console.error("Error during initial data fetch:",t)})):this.firstPageResponse&&this.handleResponse(this.firstPageResponse,!1).forEach((t=>this.wrapper.append(t)))}canRender(){return this.sourceValueIsValid&&this.isReady}render(){return this.canRender()?this.showPlaceholder?i("div",{class:"s-products-list-placeholder"},i("span",{innerHTML:r}),i("p",null,this.placeholderText)):i(e,{class:"s-products-list"},i("div",{class:{"s-products-list-wrapper":!0,"s-products-list-horizontal-cards":this.horizontalCards&&!this.filtersResults,"s-products-list-vertical-cards":!this.horizontalCards&&!this.rowCards&&!this.filtersResults,"s-products-list-row-cards":this.rowCards,"s-products-list-compact-cards":this.compactCards,"s-products-list-filters-results":this.filtersResults},ref:t=>this.wrapper=t}),i("div",{class:"s-infinite-scroll-status",ref:t=>this.status=t},i("p",{class:"s-infinite-scroll-last infinite-scroll-last s-hidden"},this.endOfText),i("p",{class:"s-infinite-scroll-error infinite-scroll-error s-hidden"},this.failedLoadMore)),this.autoload&&i("div",{class:"s-products-list-loading-wrapper",style:{display:"none"},ref:t=>this.loader=t},i("span",{class:"s-button-loader s-button-loader-center s-infinite-scroll-btn-loader"})),this.hasInfiniteScroll&&this.nextPage&&!this.autoload?i("div",{class:"s-infinite-scroll-wrapper",style:{display:"none"},ref:t=>this.loadMoreWrapper=t},i("button",{onClick:()=>this.loadMore(),class:"s-infinite-scroll-btn s-button-btn s-button-primary"},i("span",{class:"s-button-text s-infinite-scroll-btn-text"},this.loadMoreText?this.loadMoreText:salla.lang.get("common.elements.load_more")),i("span",{class:"s-button-loader s-button-loader-center s-infinite-scroll-btn-loader",ref:t=>this.btnLoader=t,style:{display:"none"}}))):""):""}init(){this.initiateInfiniteScroll(),this.loading()}handleResponse(t,s=!0){if(!t)return[];let i=this.getSource(),e="";if(1===t.cursor?.current){e=h.getPageTitleForSource(i);try{if("search"===this.getSource())e=salla.lang.get("common.elements.search_about",{word:this.getSourceValue()});else if(!e){let s=this.parsedFilters.category_id||this.getSourceValue()[0];e=t.filters?.find((t=>"category_id"===t.key))?.values?.find((t=>t.key===s))?.value??"",this.filtersSnapshot=t.filters}e+=(e?" - ":"")+salla.lang.choice("blocks.header.products_count",t.data?.length),15===t.data.length&&(e=e.replace(t.data.length,salla.lang.get("common.elements.more_than")+" "+t.data.length)),t.title=e}catch(t){salla.logger.error("Error::falid to handle response",t)}h.generateProductSchema(t.data)}this.appendDataLayer(t.data),t.nextPage=this.nextPage,t.source=this.getSource(),t.sourceValue=this.getSourceValue(),salla.event.emit("salla-products-list::products.fetched",t),this.productsFetched.emit(t),t.filters&&this.isFilterable()?(this.filtersResults=!0,this.filtersSnapshot=JSON.parse(JSON.stringify(t.filters)),salla.event.emit("filters::fetched",{filters:t.filters})):this.isFilterable()&&salla.event.emit("filters::hidden"),s&&(this.nextPage=t.cursor?t.cursor.next:this.nextPage),this.loading(!1),this.placeholderLoader&&this.placeholderLoader.remove(),this.hasInfiniteScroll&&!this.nextPage&&(this.infiniteScroll.option({scrollThreshold:!1,loadOnScroll:!1}),this.status.querySelector(".s-infinite-scroll-last").classList.remove("s-hidden"));const a=[];for(let s=0;s<t.data.length;s++)a.push(this.getItemHTML(t.data?.[s]));return a}get host(){return a(this)}};l.style="";export{l as salla_products_list}
4
+ import{r as t,c as s,h as i,H as e,a}from"./p-Noi8jmqR.js";import{a as o}from"./p-CgtvEd63.js";import{S as r}from"./p-DiKTtDW5.js";import{H as h}from"./p-CHf8XdiS.js";const l=class{constructor(i){t(this,i),this.productsFetched=s(this,"productsFetched"),this.autoload=!1,this.productCardComponent="custom-salla-product-card",this.page=1,this.placeholderText=salla.lang.get("pages.categories.no_products"),this.endOfText=salla.lang.get("common.elements.end_of_content"),this.failedLoadMore=salla.lang.get("common.elements.failed_to_load_more"),this.currentPage=salla.config.get("page"),this.filtersSnapshot=[],this.lastViewedProductKey="lastViewedProductId",this.filtersKey="filters",this.infiniteScrollStateKey="infiniteScrollState",this.prevCategoryIdKey="prevCategoryId",this.isProcessing=!1,this.scrollTimeout=null,this.boundScrollToLastViewedProduct=()=>this.scrollToLastViewedProduct(),this.boundHandleScroll=()=>this.handleScroll(),this.specialPagesWithoutIds={"product.index.latest":"latest","product.index.offers":"offers","product.index.search":"search","product.index.sales":"sales"},this.includes=h.parseJson(this.includes||this.host.getAttribute("includes")),Array.isArray(this.includes)||(this.includes=null),h.setIncludes(this.includes),salla.lang.onLoaded((()=>{this.placeholderText=salla.lang.get("pages.categories.no_products"),this.endOfText=salla.lang.get("common.elements.end_of_content"),this.failedLoadMore=salla.lang.get("common.elements.failed_to_load_more"),this.currentPage=salla.config.get("page")}))}connectedCallback(){"scrollRestoration"in history&&(history.scrollRestoration="manual"),window.addEventListener("DOMContentLoaded",this.boundScrollToLastViewedProduct),salla.event.on("salla-filters::changed",(t=>this.setFilters(t)))}disconnectedCallback(){window.removeEventListener("DOMContentLoaded",this.boundScrollToLastViewedProduct),window.removeEventListener("scroll",this.boundHandleScroll)}async setFilters(t){if(t&&JSON.stringify(t)!==JSON.stringify(this.parsedFilters))return window.scrollTo({top:0,behavior:"smooth"}),this.parsedFilters=JSON.parse(JSON.stringify(t)),this.filtersSnapshot=this.parsedFilters,"product.index"==this.currentPage?.slug&&this.parsedFilters&&this.parsedFilters.category_id&&(this.currentCategoryIdFilter=[this.parsedFilters.category_id]),this.reload()}async reload(){!this.autoload&&this.loadMoreWrapper&&(this.loadMoreWrapper.style.display="none"),this.hasInfiniteScroll&&salla.infiniteScroll.destroy(this.infiniteScroll),this.buildNextPageUrl(),this.wrapper.innerHTML="",this.hasInfiniteScroll?this.init():this.getInitialData(),this.showPlaceholder&&(this.showPlaceholder=!1,this.placeholderLoader=document.createElement("div"),this.placeholderLoader.classList.add("s-products-list-loading-wrapper"),this.placeholderLoader.style.display="inherit",this.placeholderLoader.innerHTML='<span class="s-button-loader s-button-loader-center s-infinite-scroll-btn-loader"></span>',this.host.insertAdjacentElement("afterend",this.placeholderLoader))}isFilterable(){return salla.config.get("store.settings.product.filters")&&this.filtersResults}isSourceWithoutValue(){return["offers","latest","sales","wishlist","top-rated","reorder"].includes(this.getSource())}animateItems(){o({targets:"salla-products-list salla-product-card",opacity:[0,1],duration:1200,translateY:[20,0],delay:function(t,s){return 100*s}})}initBaseNextPageUrl(t){this.nextPage=salla.url.api(`products?source=${t}`),this.includes?.length&&(this.nextPage+=`&includes[]=${this.includes.join("&includes[]=")}`),this.limit&&(this.nextPage+=`&per_page=${this.limit>32?32:this.limit}`),this.sortBy&&(this.nextPage+=`&sort=${this.sortBy}`),"preview"===salla.config.get("theme.mode")&&(this.nextPage+="&use_username_url=1"),this.nextPage+="&filterable=1";for(const[t,s]of Object.entries(this.parsedFilters||{}))if(["string","number"].includes(typeof s))this.nextPage+=`&filters[${encodeURIComponent(t)}]=${encodeURIComponent(s)}`;else if(Array.isArray(s))s.forEach((s=>this.nextPage+=`&filters[${encodeURIComponent(t)}][]=${encodeURIComponent(s)}`));else if("object"==typeof s)for(const[i,e]of Object.entries(s))this.nextPage+=`&filters[${encodeURIComponent(t)}][${encodeURIComponent(i)}]=${encodeURIComponent(e)}`}buildNextPageUrl(){let t=this.getSource();if("json"===t)return;const s=sessionStorage.getItem(this.infiniteScrollStateKey);if(s){const{nextPage:t}=JSON.parse(s);if(!t)return}if(this.initBaseNextPageUrl(t),!this.isSourceWithoutValue())if(["search","related","landing-page"].includes(t))this.nextPage+=`&source_value=${this.getSourceValue()}`;else try{this.nextPage+=`&source_value[]=${this.getSourceValue().join("&source_value[]=")}`}catch(s){salla.logger.warn(`source-value prop should be array of ids ex source-value="[1,2,3]" for the source [${t}]`),this.sourceValueIsValid=!1}}loading(t=!0,s=!1){if(t){let t=s&&!this.autoload?this.btnLoader:this.loader;t&&(t.style.display="inherit")}else this.autoload||this.btnLoader&&(this.btnLoader.style.display="none"),this.loader&&(this.loader.style.display="none")}getItemHTML(t){"landing-page"===this.getSource()&&(t.url="");const s=document.createElement(this.hasCustomComponent?this.productCardComponent:"salla-product-card");return s.product=t,this.compactCards&&(s.compact=!0,s.toggleAttribute("compact",!0)),this.applyLandingPageStyles(s),this.applyHorizontalCardStyles(s),s.addEventListener("click",(s=>{s.target.closest("a")&&(h.saveProductSource(this.getSource()),this.hasInfiniteScroll&&(this.takeStateSnapshot(),sessionStorage.setItem(this.lastViewedProductKey,t.id)))})),s}applyLandingPageStyles(t){"landing-page"!==this.getSource()||this.hasCustomComponent||(t.toggleAttribute("hide-add-btn",!0),t.classList.add("s-product-card-fit-height"))}applyHorizontalCardStyles(t){this.horizontalCards&&(t.toggleAttribute("horizontal",!0),this.hasCustomComponent||t.toggleAttribute("shadow-on-hover",!0))}waitForResizing(t){let s=null;return new Promise((i=>{const e=new ResizeObserver((()=>{clearTimeout(s),s=setTimeout((()=>{e.disconnect(),i(null)}),160)}));e.observe(t)}))}waitForLayoutStable(t){let s=null;return new Promise((i=>{const e=new MutationObserver((()=>{clearTimeout(s),s=setTimeout((()=>{e.disconnect(),i(null)}),160)}));e.observe(t,{childList:!0,subtree:!0,attributes:!0})}))}async waitForStableLayout(t){return await Promise.allSettled([this.waitForResizing(t),this.waitForLayoutStable(t)])}scrollToLastViewedProduct(){const t=sessionStorage.getItem(this.lastViewedProductKey);t&&!salla.url.is_page("product.single")&&this.isElementLoaded(`[id*="${t}"]`).then((()=>{const s=this.wrapper?.querySelector(`[id*="${t}"]`);if(!s)return;const i=()=>{const t=()=>{s.scrollIntoView({block:"start",behavior:"instant"});const t=matchMedia("(max-width: 1024px)").matches?"header .inner":"ul.main-menu",i=window?.header_is_sticky?document.querySelector(t)?.getBoundingClientRect()?.height??56:0,e=parseInt(getComputedStyle(this.wrapper).rowGap)??16;scrollBy({top:-1*(i+e),behavior:"instant"})};requestAnimationFrame(t),s.querySelectorAll("img.lazy").forEach((s=>{const i=s,e=()=>{requestAnimationFrame(t),i.onload=i.onerror=null};i.onload=e,i.onerror=e})),this.removeScrollRestorationSession()};this.waitForStableLayout(this.host).then((()=>requestAnimationFrame(i)))}))}isElementLoaded(t){return new Promise((s=>{const i=setInterval((()=>{if(document.querySelector(t))return clearInterval(i),s(document.querySelector(t))}),50)}))}takeStateSnapshot(){const t=[];for(let s=0;s<this.wrapper.children.length;s++){const i=this.wrapper.children?.[s];t.push(i.product)}const s={pageIndex:Math.max((this.infiniteScroll?.pageIndex??1)-1,1),nextPage:this.nextPage,currentPageData:t};if(this.isFilterable()){const t=sessionStorage.getItem(this.filtersKey);sessionStorage.setItem(this.filtersKey,t||JSON.stringify(this.filtersSnapshot))}sessionStorage.setItem(this.infiniteScrollStateKey,JSON.stringify(s));let i=salla.config.get("page.id");const e=Object.keys(this.specialPagesWithoutIds).find((t=>salla.url.is_page(t)));e?i=this.specialPagesWithoutIds[e]:null!==i&&(i=String(i)),sessionStorage.setItem(this.prevCategoryIdKey,i)}removeScrollRestorationSession(){this.isFilterable()||sessionStorage.removeItem(this.filtersKey),sessionStorage.removeItem(this.infiniteScrollStateKey),sessionStorage.removeItem(this.lastViewedProductKey),sessionStorage.removeItem(this.prevCategoryIdKey)}loadStoredScrollState(){const t=sessionStorage.getItem(this.infiniteScrollStateKey),s=sessionStorage.getItem(this.filtersKey),i=sessionStorage.getItem(this.prevCategoryIdKey),e=this.specialPagesWithoutIds[salla.config.get("page.slug")]||null,a=salla.config.get("page.id"),o=salla.url.is_page("index"),r=salla.url.is_page("product.single"),h=e?i!==e:i!==String(a);if(i&&h&&!o&&!r||o&&!this.hasInfiniteScroll)return this.removeScrollRestorationSession(),this.switchToNormalBehavior=!0,!1;if(r)return this.switchToNormalBehavior=!0,!1;if(t)try{const{pageIndex:i,nextPage:e,currentPageData:a}=JSON.parse(t);if("undefined"!==s){const t=JSON.parse(s);salla.event.emit("filters::fetched",{filters:t})}this.page=i,this.nextPage=e;for(let t=0;t<a.length;t++)this.wrapper.append(this.getItemHTML(a?.[t]));return!0}catch(t){console.error("Failed to load stored scroll state:",t),this.removeScrollRestorationSession()}return!1}getSource(){return h.getProductsSource(this.source)}getSourceValue(){return this.currentCategoryIdFilter?this.currentCategoryIdFilter:h.getProductsSourceValue(this.source,this.sourceValue)}appendDataLayer(t){"object"==typeof dataLayer&&Array.isArray(dataLayer)&&dataLayer.push({event:"impressions",ecommerce:{currencyCode:salla.config.currency().code,impressions:t.map(((t,s)=>({id:t.id,name:t.name,price:t.price,brand:t.brand?.name||"",quantity:t.quantity,categories:[{name:t.category?.name||salla.config.get("page.title"),id:salla.config.get("page.id")}],category:t.category?.name||salla.config.get("page.title"),position:s+1})))}})}initiateInfiniteScroll(){if(!this.hasInfiniteScroll)return;const t=this.autoload&&this.includes&&this.includes.length>0;this.infiniteScroll=salla.infiniteScroll.initiate(this.wrapper,this.wrapper,{path:()=>this.nextPage,history:!1,nextPage:this.nextPage,scrollThreshold:!t&&!!this.autoload&&100,loadOnScroll:!t&&this.autoload},!0),this.infiniteScroll.pageIndex=this.page,this.infiniteScroll?.on("request",(()=>{this.loading(!0,!this.autoload)})),t&&window.addEventListener("scroll",this.boundHandleScroll),this.infiniteScroll?.on("load",(async t=>{if(!this.isProcessing){this.isProcessing=!0;try{if(!t.data?.length&&2===this.infiniteScroll.pageIndex)return this.showPlaceholder=!0,salla.infiniteScroll.destroy(this.infiniteScroll),this.loading(!1),void(this.placeholderLoader&&this.placeholderLoader.remove());this.includes&&await this.injectAndProcessData(t);const s=this.handleResponse(t);this.infiniteScroll.appendItems(s),2===this.infiniteScroll.pageIndex&&(!this.autoload&&this.nextPage&&(this.loadMoreWrapper.style.display="block"),this.animateItems())}catch(t){console.error("Error during load:",t)}finally{this.isProcessing=!1}}})),this.infiniteScroll?.on("error",(()=>{console.log("Error occurred during request"),this.status.querySelector(".s-infinite-scroll-error").classList.remove("s-hidden"),this.placeholderLoader&&this.placeholderLoader.remove(),this.loading(!1),this.isProcessing=!1})),salla.onReady((()=>{sessionStorage.getItem(this.infiniteScrollStateKey)||this.manualLoadNextPage()}))}handleScroll(){this.isProcessing||this.scrollTimeout||(this.scrollTimeout=setTimeout((()=>{this.scrollTimeout=null,requestAnimationFrame((()=>{const t=this.wrapper.getBoundingClientRect(),s=window.innerHeight;t.bottom-s<=200&&!this.isProcessing&&this.nextPage&&this.manualLoadNextPage()}))}),200))}manualLoadNextPage(){this.nextPage&&this.infiniteScroll.loadNextPage()}async injectAndProcessData(t){try{await h.injectExtraFieldsToResponse(t)}catch(t){console.error("Error injecting data:",t)}}getInitialData(){return this.loading(),salla.api.withoutNotifier((()=>salla.product.api.fetch({source:h.getApiSource(this.getSource()),source_value:this.getSourceValue(),limit:this.limit}).then((async t=>t.data.length?(await h.injectExtraFieldsToResponse(t),this.firstPageResponse?void this.handleResponse(t).forEach((t=>this.wrapper.append(t))):(this.firstPageResponse=t,void(this.nextPage=t.cursor?t.cursor.next:this.nextPage))):(this.showPlaceholder=!0,this.placeholderLoader&&this.placeholderLoader.remove(),void this.loading(!1))))))}async loadMore(){this.infiniteScroll?.loadNextPage()}componentWillLoad(){return salla.onReady().then((()=>{this.hasCustomComponent=!!customElements.get(this.productCardComponent),this.sourceValueIsValid=!(!this.getSourceValue()&&!this.isSourceWithoutValue()),this.hasInfiniteScroll=!["json","selected","related","landing-page","recently"].includes(this.getSource())&&!this.limit;let t=new URLSearchParams(window.location.search);try{this.sortBy=this.sortBy||t.get("sort")||t.get("by"),this.parsedFilters=h.extractFiltersFromUrl(t),this.parsedFilters&&this.parsedFilters.category_id&&(this.currentCategoryIdFilter=[this.parsedFilters.category_id])}catch(t){salla.logger.warn("failed to get filters from url",t.message)}if(this.buildNextPageUrl(),this.isReady=!0,!sessionStorage.getItem(this.infiniteScrollStateKey))if(this.sourceValueIsValid){if(!this.hasInfiniteScroll){if("json"===this.getSource())return this.getSourceValue().length?void setTimeout((()=>{this.getSourceValue().map((t=>this.wrapper.append(this.getItemHTML(t))))})):void(this.showPlaceholder=!0);if("selected"!==this.getSource()||this.getSourceValue().length)return this.getInitialData();this.showPlaceholder=!0}}else salla.logger.warn(`source-value prop is required for source [${this.getSource()}]`)}))}async componentDidLoad(){this.hasInfiniteScroll&&this.init(),await Salla.hooks.registerComponent("salla-products-list",this),this.loadStoredScrollState()?(this.autoload?!this.nextPage&&this.loading(!1):this.nextPage?this.loadMoreWrapper&&(this.loadMoreWrapper.style.display="block"):(this.loadMoreWrapper&&(this.loadMoreWrapper.style.display="none"),this.status.querySelector(".s-infinite-scroll-last").classList.remove("s-hidden")),this.scrollToLastViewedProduct()):!this.firstPageResponse&&this.switchToNormalBehavior?this.getInitialData().then((()=>{this.firstPageResponse?(this.handleResponse(this.firstPageResponse,!1).forEach((t=>{this.wrapper.append(t)})),setTimeout((()=>{if(!this.autoload&&this.nextPage&&1==this.infiniteScroll.pageIndex){const t=this.host.querySelector(".s-infinite-scroll-wrapper");t&&(t.style.display="block")}}))):console.error("No response received after getInitialData.")})).catch((t=>{console.error("Error during initial data fetch:",t)})):this.firstPageResponse&&this.handleResponse(this.firstPageResponse,!1).forEach((t=>this.wrapper.append(t)))}canRender(){return this.sourceValueIsValid&&this.isReady}render(){return this.canRender()?this.showPlaceholder?i("div",{class:"s-products-list-placeholder"},i("span",{innerHTML:r}),i("p",null,this.placeholderText)):i(e,{class:"s-products-list"},i("div",{class:{"s-products-list-wrapper":!0,"s-products-list-horizontal-cards":this.horizontalCards&&!this.filtersResults,"s-products-list-vertical-cards":!this.horizontalCards&&!this.rowCards&&!this.filtersResults,"s-products-list-row-cards":this.rowCards,"s-products-list-compact-cards":this.compactCards,"s-products-list-filters-results":this.filtersResults},ref:t=>this.wrapper=t}),i("div",{class:"s-infinite-scroll-status",ref:t=>this.status=t},i("p",{class:"s-infinite-scroll-last infinite-scroll-last s-hidden"},this.endOfText),i("p",{class:"s-infinite-scroll-error infinite-scroll-error s-hidden"},this.failedLoadMore)),this.autoload&&i("div",{class:"s-products-list-loading-wrapper",style:{display:"none"},ref:t=>this.loader=t},i("span",{class:"s-button-loader s-button-loader-center s-infinite-scroll-btn-loader"})),this.hasInfiniteScroll&&this.nextPage&&!this.autoload?i("div",{class:"s-infinite-scroll-wrapper",style:{display:"none"},ref:t=>this.loadMoreWrapper=t},i("button",{onClick:()=>this.loadMore(),class:"s-infinite-scroll-btn s-button-btn s-button-primary"},i("span",{class:"s-button-text s-infinite-scroll-btn-text"},this.loadMoreText?this.loadMoreText:salla.lang.get("common.elements.load_more")),i("span",{class:"s-button-loader s-button-loader-center s-infinite-scroll-btn-loader",ref:t=>this.btnLoader=t,style:{display:"none"}}))):""):""}init(){this.initiateInfiniteScroll(),this.loading()}handleResponse(t,s=!0){if(!t)return[];let i=this.getSource(),e="";if(1===t.cursor?.current){e=h.getPageTitleForSource(i);try{if("search"===this.getSource())e=salla.lang.get("common.elements.search_about",{word:this.getSourceValue()});else if(!e){let s=this.parsedFilters.category_id||this.getSourceValue()[0];e=t.filters?.find((t=>"category_id"===t.key))?.values?.find((t=>t.key===s))?.value??"",this.filtersSnapshot=t.filters}e+=(e?" - ":"")+salla.lang.choice("blocks.header.products_count",t.data?.length),15===t.data.length&&(e=e.replace(t.data.length,salla.lang.get("common.elements.more_than")+" "+t.data.length)),t.title=e}catch(t){salla.logger.error("Error::falid to handle response",t)}h.generateProductSchema(t.data)}this.appendDataLayer(t.data),t.nextPage=this.nextPage,t.source=this.getSource(),t.sourceValue=this.getSourceValue(),salla.event.emit("salla-products-list::products.fetched",t),this.productsFetched.emit(t),t.filters&&this.isFilterable()?(this.filtersResults=!0,this.filtersSnapshot=JSON.parse(JSON.stringify(t.filters)),salla.event.emit("filters::fetched",{filters:t.filters})):this.isFilterable()&&salla.event.emit("filters::hidden"),s&&(this.nextPage=t.cursor?t.cursor.next:this.nextPage),this.loading(!1),this.placeholderLoader&&this.placeholderLoader.remove(),this.hasInfiniteScroll&&!this.nextPage&&(this.infiniteScroll.option({scrollThreshold:!1,loadOnScroll:!1}),this.status.querySelector(".s-infinite-scroll-last").classList.remove("s-hidden"));const a=[];for(let s=0;s<t.data.length;s++)a.push(this.getItemHTML(t.data?.[s]));return a}get host(){return a(this)}};l.style="";export{l as salla_products_list}
@@ -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-BYCfehfD.js";const t=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}};t.style="";export{t as salla_trust_badges}
4
+ import{r as e,h as s,H as a}from"./p-Noi8jmqR.js";const t=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}};t.style="";export{t as salla_trust_badges}
@@ -0,0 +1,4 @@
1
+ /*!
2
+ * Crafted with ❤ by Salla
3
+ */
4
+ import{r as a,h as t,a as s}from"./p-Noi8jmqR.js";import{s as l}from"./p-B-Rj6b9M.js";import{S as r}from"./p-CXRKXFgT.js";import{T as e}from"./p-BX5898Au.js";const o=class{constructor(t){a(this,t)}get productId(){return this.host.dataset.productId||salla.config.get("page.id")}componentWillLoad(){return salla.onReady().then((()=>salla.lang.onLoaded())).then((()=>l())).then((()=>this.prize())).catch((a=>salla.logger.error(a)))}handleClick(){salla.config.isGuest()?salla.event.dispatch("login::open"):this.exchangeModal.open()}render(){return"success"===this.prize.status&&this.productId?t("div",{class:"s-loyalty-program-banner-container"},t("div",null,t("p",{class:"s-loyalty-program-banner-container-banner-title"},salla.lang.get("pages.loyalty_program.want_to_redeem_free_product")),t("p",{class:"s-loyalty-program-banner-container-banner-subtitle"},salla.lang.get("pages.loyalty_program.exchange_points_for_free_product",{points:this.prize.data.cost_points}))),t("button",{onClick:()=>this.handleClick()},t("span",{innerHTML:r}),t("span",null,salla.lang.get("pages.loyalty_program.exchange_points"))),t("salla-modal",{ref:a=>this.exchangeModal=a,width:"sm"},this.prize.data?t("salla-reward-exchange",{productId:Number(this.productId),prize:this.prize.data}):"")):null}get host(){return s(this)}};(function(a,t,s,l){var r,e=arguments.length,o=e<3?t:null===l?l=Object.getOwnPropertyDescriptor(t,s):l;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(a,t,s,l);else for(var n=a.length-1;n>=0;n--)(r=a[n])&&(o=(e<3?r(o):e>3?r(t,s,o):r(t,s))||o);e>3&&o&&Object.defineProperty(t,s,o)})([e((async function(){if(!(salla.config.get("store.features")||[]).includes("loyalty-system"))return Promise.reject("Loyalty system is not enabled for merchant");const{loyalty_prize:a}=await salla.product.api.getDetails(this.productId);return a||Promise.reject("no loyalty prize for this product")}))],o.prototype,"prize",void 0),o.style="";export{o as salla_loyalty_banner}
@@ -0,0 +1,4 @@
1
+ /*!
2
+ * Crafted with ❤ by Salla
3
+ */
4
+ import{r as s,c as t,h as i,H as e,a as r}from"./p-Noi8jmqR.js";import{S as a}from"./p-CciN5Q_x.js";import{S as l}from"./p-DLNIOD9t.js";import{S as h}from"./p-8Tsmrwno.js";const o=class{constructor(i){s(this,i),this.quickOrderSubmited=t(this,"quickOrderSubmited"),this.quickOrderTitle="ليش تنتظر؟",this.subTitle="احصل على المنتج مباشرة الآن",this.payButtonTitle="اطلب المنتج",this.confirmPayButtonTitle="اشتر الآن",this.agreementText=salla.lang.get("pages.checkout.show_full_agreement"),this.isEmailRequired=!1,this.quickOrderStyle="default",this.isAvailable=!1,this.oneClick=!1,this.expanded=!1,this.isTermsRequired=!1,this.countryCode=salla.config.get("user.country_code","SA")||"SA",this.submitSucess=!1,this.placeHolderEmail=salla.lang.get("common.elements.email"),this.emailOptional=salla.lang.get("common.elements.optional"),this.agreementShowText=salla.lang.get("pages.checkout.show_full_agreement"),this.agreementModalHead=salla.lang.get("pages.checkout.full_agreement"),this.userNameLabel=salla.lang.get("pages.products.your_name"),this.termsChecked=!1,salla.onReady((()=>{this.productId=this.productId||salla.config.get("page.id")})),salla.lang.onLoaded((()=>{this.placeHolderEmail=salla.lang.get("common.elements.email"),this.emailOptional=salla.lang.get("common.elements.optional"),this.agreementShowText=salla.lang.get("pages.checkout.show_full_agreement"),this.agreementModalHead=salla.lang.get("pages.checkout.full_agreement"),this.userNameLabel=salla.lang.get("pages.products.your_name")}))}getBtnColor(){return"default"===this.quickOrderStyle?"light":"primary"}getErrorMessage(s,t){return"terms"==t?salla.lang.get("pages.checkout.check_agreement"):salla.lang.get(`common.errors.${s}`,{attribute:"name"==t?this.userNameLabel:this.placeHolderEmail})}handleInvalidInput(s){let t,i=s.target,e=i.validity;e.valueMissing?(t=this.getErrorMessage("field_required",i.name),console.log(this.getErrorMessage("field_required",i.name))):e.typeMismatch&&(t=this.getErrorMessage("invalid_value",i.name)),i.setCustomValidity(t)}async setWrapperHeight(){let s=this.host.querySelector(".s-quick-order-expandable");setTimeout((()=>{s.style.maxHeight=s.style.maxHeight||this.oneClick?null:s.scrollHeight+"px"}),50)}getDarkOrLight(){return"default"===this.quickOrderStyle&&salla.config.get("theme.color.is_dark")?"dark":"light"}getStyleColor(){return{gray:"#f3f3f3",white:"#ffffff",default:salla.config.get("theme.color.primary")}[this.quickOrderStyle]||"#f3f3f3"}async submit(s,t=!1){return s.preventDefault(),t&&!this.oneClick?(this.expanded=!this.expanded,void this.setWrapperHeight()):this.submitBtn.load().then((()=>this.getPayload())).then((s=>salla.api.cart.createQuickOrder(s))).then((()=>{setTimeout((()=>{this.submitBtn.stop(),this.submitSucess=!0,this.quickOrderSubmited.emit()}),200)})).catch((s=>s&&(console.error(s),this.submitBtn.stop())))}async getPayload(){return this.oneClick?{product_ids:[this.productId],agreement:!0}:{product_ids:[this.productId],email:this.emailInput?.value,phone:Number((await(this.phoneInput?.getValues()))?.phone),country_code:(await(this.phoneInput?.getValues()))?.countryCode||this.countryCode,name:this.nameInput?.value,agreement:this.termsChecked}}formatAgreementText(s,t=150){return s?s.length<=t?s:(new DOMParser).parseFromString(s,"text/html").documentElement.innerText.substring(0,t)+"...":""}loadQuickOrderSettings(){let s=salla.config.get("store.settings.quick_order");return s?(this.user=salla.config.get("user")||salla.storage.get("user")||{},this.countryCode=this.user?.country_code||this.countryCode,this.isEmailRequired=!this.user?.email&&this.isEmailRequired,this.oneClick=this.user?.email,this.initComponentData(s),Promise.resolve()):Promise.resolve()}initComponentData(s){this.quickOrderTitle=s.title,this.subTitle=s.sub_title,this.payButtonTitle=s.order_now_button,this.isEmailRequired=s.is_email_required,this.isTermsRequired=s.show_agreement,this.agreementText=s.agreement,this.confirmPayButtonTitle=s.confirm_button,this.thanksMessage=s.thanks_message,this.quickOrderStyle=s.style,this.isAvailable=!0,this.oneClick=this.oneClick&&!this.isTermsRequired}componentWillLoad(){return new Promise((s=>salla.onReady((()=>this.loadQuickOrderSettings().then(s)))))}render(){if(this.isAvailable)return this.submitSucess?i(e,{class:"s-quick-order"},i("div",{class:"s-quick-order-confirm",style:{backgroundColor:salla.config.get("theme.color.primary")+"10",borderColor:salla.config.get("theme.color.primary")+"10",color:salla.config.get("theme.color.primary")}},i("i",{innerHTML:'\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>party-horn</title>\n<path fill="currentColor" d="M5.333 4.013c0.736 0 1.333-0.596 1.333-1.333v-0.013c0-0.737-0.597-1.327-1.333-1.327s-1.333 0.603-1.333 1.34 0.597 1.333 1.333 1.333zM11.333 10c0.341 0 0.683-0.131 0.943-0.391 1.541-1.54 2.391-3.589 2.391-5.771v-2.505c0-0.737-0.597-1.333-1.333-1.333s-1.333 0.596-1.333 1.333v2.505c0 1.468-0.572 2.848-1.609 3.885-0.521 0.521-0.521 1.364 0 1.885 0.26 0.26 0.601 0.391 0.943 0.391zM18.667 9.993c0.319 0 0.639-0.115 0.895-0.345 0.383-0.347 0.684-0.325 1.497-0.22 0.923 0.124 2.319 0.307 3.636-0.887 1.293-1.172 1.303-2.54 1.308-3.539 0.005-0.887 0.043-1.228 0.432-1.581 0.361-0.327 0.621-0.335 1.493-0.216 0.923 0.12 2.317 0.307 3.635-0.884 0.545-0.495 0.587-1.337 0.093-1.883-0.493-0.547-1.336-0.589-1.884-0.093-0.361 0.325-0.621 0.333-1.493 0.216-0.921-0.119-2.317-0.305-3.635 0.884-1.293 1.173-1.303 2.541-1.308 3.54-0.005 0.885-0.043 1.227-0.432 1.58-0.383 0.348-0.683 0.327-1.497 0.22-0.924-0.124-2.32-0.305-3.636 0.887-0.545 0.495-0.587 1.339-0.092 1.884 0.264 0.291 0.625 0.437 0.988 0.437zM18.667 16.013c0.736 0 1.333-0.596 1.333-1.333v-0.013c0-0.737-0.597-1.327-1.333-1.327s-1.333 0.603-1.333 1.34 0.597 1.333 1.333 1.333zM30.667 17.333h-2.505c-2.179 0-4.228 0.849-5.771 2.391-0.521 0.521-0.521 1.364 0 1.885 0.26 0.26 0.603 0.391 0.944 0.391s0.683-0.131 0.943-0.391c1.023-1.023 2.439-1.609 3.884-1.609h2.505c0.736 0 1.333-0.596 1.333-1.333s-0.597-1.333-1.333-1.333zM30.667 10.66c-0.736 0-1.333 0.603-1.333 1.34s0.597 1.333 1.333 1.333 1.333-0.596 1.333-1.333v-0.013c0-0.736-0.597-1.327-1.333-1.327zM29.333 26.66c-0.736 0-1.333 0.603-1.333 1.34s0.597 1.333 1.333 1.333 1.333-0.596 1.333-1.333v-0.013c0-0.736-0.597-1.327-1.333-1.327zM7.456 11.057c-0.327-0.327-0.799-0.46-1.249-0.356-0.449 0.107-0.812 0.439-0.959 0.876l-5.036 15.113c-0.487 1.457-0.113 3.037 0.973 4.125 0.772 0.771 1.792 1.183 2.84 1.183 0.428 0 0.861-0.068 1.284-0.209l15.112-5.037c0.439-0.145 0.769-0.508 0.876-0.959 0.107-0.449-0.028-0.921-0.355-1.249zM4.467 29.259c-0.503 0.163-1.023 0.043-1.395-0.329-0.373-0.373-0.497-0.896-0.329-1.396l4.355-13.065 10.436 10.435z"></path>\n</svg>\n'}),i("span",null,this.thanksMessage))):i(e,{class:`s-quick-order s-quick-order-${this.getDarkOrLight()}`},i("div",{class:`s-quick-order-container s-quick-order-${this.quickOrderStyle}`,style:{backgroundColor:this.getStyleColor()}},i("div",{class:"s-quick-order-button-cont"},i("div",null,i("h3",null,this.quickOrderTitle),i("p",null,this.subTitle)),i("salla-button",{class:this.expanded?"s-quick-order-btn-close":"",onClick:s=>this.submit(s,!0),color:this.getBtnColor()},this.oneClick?this.confirmPayButtonTitle:this.expanded?i("i",{innerHTML:h}):this.confirmPayButtonTitle)),i("form",{onSubmit:s=>this.submit(s),class:"s-quick-order-expandable "+(this.expanded?"s-quick-order-shown":"")},Salla.config.isGuest()&&[i("div",{class:"s-form-group"},i("span",{innerHTML:'\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>portrait</title>\n<path d="M24 1.333h-16c-3.676 0-6.667 2.991-6.667 6.667v16c0 3.028 2.041 5.561 4.811 6.371 0.004 0.001 0.008 0.003 0.012 0.004 0.591 0.172 1.2 0.292 1.844 0.292h16c0.644 0 1.253-0.12 1.843-0.292 0.004-0.001 0.008-0.003 0.012-0.004 2.771-0.809 4.812-3.343 4.812-6.371v-16c0-3.676-2.991-6.667-6.667-6.667zM8.012 28c0.121-1.915 3.363-4 7.988-4s7.868 2.085 7.988 4zM28 24c0 1.24-0.579 2.335-1.467 3.069-0.768-3.288-5.112-5.736-10.533-5.736s-9.765 2.448-10.533 5.736c-0.888-0.735-1.467-1.829-1.467-3.069v-16c0-2.205 1.795-4 4-4h16c2.205 0 4 1.795 4 4zM16 6.667c-3.308 0-6 2.692-6 6s2.692 6 6 6 6-2.692 6-6-2.692-6-6-6zM16 16c-1.839 0-3.333-1.495-3.333-3.333s1.495-3.333 3.333-3.333 3.333 1.495 3.333 3.333-1.495 3.333-3.333 3.333z"></path>\n</svg>\n'}),i("input",{type:"text",required:!0,class:"s-form-control s-quick-order-phone-field",name:"name",placeholder:this.userNameLabel,ref:s=>this.nameInput=s})),i("div",{class:"s-quick-order-flex-input"},i("div",{class:"s-form-group"},i("span",{innerHTML:a}),i("salla-tel-input",{ref:s=>this.phoneInput=s})),i("div",{class:"s-form-group"},i("span",{innerHTML:l}),i("input",{type:"email",class:"s-form-control s-quick-order-email-field",name:"email",required:this.isEmailRequired,placeholder:this.placeHolderEmail+" "+(this.isEmailRequired?"":this.emailOptional),ref:s=>this.emailInput=s})))],this.isTermsRequired&&i("label",{htmlFor:"terms",class:"s-quick-order-terms"},i("input",{type:"checkbox",required:!0,name:"terms",id:"terms",ref:s=>this.termsInput=s,onChange:()=>this.termsChecked=this.termsInput.checked,class:"s-checkbox"}),i("span",{class:"s-form-label"}," ",i("div",{innerHTML:this.formatAgreementText(this.agreementText,150)},this.agreementText.length>150&&i("salla-button",{shape:"link",onClick:()=>this.agreementModal.open()},this.agreementShowText))," ")),i("salla-button",{type:"submit",color:this.getBtnColor(),width:"wide",ref:s=>this.submitBtn=s},this.payButtonTitle)),i("salla-modal",{"modal-title":this.agreementModalHead,ref:s=>this.agreementModal=s},i("article",{innerHTML:this.agreementText}))))}componentDidLoad(){this.host.querySelectorAll("input").forEach((s=>{s.addEventListener("invalid",(s=>{this.handleInvalidInput(s)})),s.addEventListener("input",(()=>{s.setCustomValidity(""),s.reportValidity()}))}))}get host(){return r(this)}};o.style=".s-quick-order-expandable:not(.s-quick-order-shown){overflow:hidden}";export{o as salla_quick_order}
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r as s,h as t,H as e,a as l}from"./p-BYCfehfD.js";import{A as i}from"./p-DCZbpt2a.js";import{B as a}from"./p-D3mWkc-3.js";import{P as o}from"./p-DY4LZmNP.js";import{W as n}from"./p-ZT7ehBBk.js";import{C as r}from"./p-BsLF_HK7.js";import{S as h}from"./p-D4oPi1Ov.js";import{l as c}from"./p-BChI23pG.js";var m='\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>user-circle</title>\n<path d="M16 22.964c-4.525 0-8.447 1.713-9.993 4.365-0.371 0.636-0.156 1.452 0.48 1.823s1.453 0.156 1.823-0.48c0.855-1.465 3.624-3.041 7.689-3.041s6.835 1.576 7.689 3.041c0.249 0.424 0.696 0.661 1.155 0.661 0.228 0 0.459-0.059 0.669-0.181 0.637-0.371 0.852-1.187 0.48-1.823-1.545-2.652-5.467-4.365-9.992-4.365zM22.667 13.631c0-3.676-2.991-6.667-6.667-6.667s-6.667 2.991-6.667 6.667 2.991 6.667 6.667 6.667 6.667-2.992 6.667-6.667zM12 13.631c0-2.205 1.795-4 4-4s4 1.795 4 4-1.795 4-4 4-4-1.795-4-4zM16 0.297c-8.823 0-16 7.177-16 16 0 2.941 0.821 5.831 2.373 8.357 0.252 0.411 0.689 0.636 1.137 0.636 0.239 0 0.479-0.064 0.696-0.197 0.628-0.385 0.824-1.207 0.439-1.833-1.295-2.108-1.979-4.516-1.979-6.963 0-7.352 5.981-13.333 13.333-13.333s13.333 5.981 13.333 13.333c0 2.448-0.684 4.856-1.979 6.961-0.385 0.628-0.189 1.448 0.437 1.835 0.627 0.384 1.448 0.189 1.835-0.437 1.553-2.527 2.373-5.416 2.373-8.359 0-8.823-7.177-16-16-16z"></path>\n</svg>\n';const u=class{constructor(t){s(this,t),this.accountLoading=!1,this.opened=!1,this.notifications=salla.lang.get("common.titles.notifications"),this.orders=salla.lang.get("common.titles.orders"),this.pending_orders=salla.lang.get("common.titles.pending_orders"),this.wishlist=salla.lang.get("common.titles.wishlist"),this.profile=salla.lang.get("common.titles.profile"),this.rating=salla.lang.get("common.titles.rating"),this.wallet=salla.lang.get("common.titles.wallet"),this.settings=salla.lang.get("common.titles.settings"),this.loyalty_program=salla.lang.get("pages.loyalty_program.loyalty_points"),this.logout=salla.lang.get("blocks.header.logout"),this.hello=salla.lang.get("pages.checkout.hello"),this.first_name=salla.storage.get("user.first_name")||"",this.last_name=salla.storage.get("user.last_name")||"",this.avatar=salla.storage.get("user.avatar")||salla.url.cdn("images/avatar.png",40,40),this.badges={notifications:salla.helpers.number(salla.storage.get("user.notifications")||0),pending_orders:salla.helpers.number(salla.storage.get("user.pending_orders")||0)},this.sallaAccountEnabled=!1,this.hasBadges=Number(salla.storage.get("user.pending_orders"))>0||Number(salla.storage.get("user.notifications"))>0,this.inline=!1,this.avatarOnly=!1,this.showHeader=!1,this.relativeDropdown=!1,this.showTrigger=!1,this.onClickOutside=()=>{this.opened=!1},this.OrderUpdate=0,this.items={notifications:a,orders:'\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>box-bankers</title>\n<path d="M28 1.333h-24c-2.205 0-4 1.795-4 4v5.333c0 0.736 0.597 1.333 1.333 1.333v14.667c0 2.205 1.795 4 4 4h21.333c2.205 0 4-1.795 4-4v-14.667c0.736 0 1.333-0.597 1.333-1.333v-5.333c0-2.205-1.795-4-4-4zM28 26.667c0 0.735-0.599 1.333-1.333 1.333h-21.333c-0.735 0-1.333-0.599-1.333-1.333v-14.667h5.333v2.667c0 1.471 1.196 2.667 2.667 2.667h8c1.471 0 2.667-1.196 2.667-2.667v-2.667h5.333zM12 14.667v-2.667h8v2.667zM29.333 9.333h-26.667v-4c0-0.735 0.599-1.333 1.333-1.333h24c0.735 0 1.333 0.599 1.333 1.333z"></path>\n</svg>\n',pending_orders:o,wishlist:n,wallet:'\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>wallet</title>\n<path d="M28 6.667h-24c-0.736 0-1.333-0.597-1.333-1.333s0.597-1.333 1.333-1.333h24c0.737 0 1.333-0.596 1.333-1.333s-0.596-1.333-1.333-1.333h-24c-2.204 0-3.999 1.793-4 3.997v18.669c0 3.676 2.991 6.667 6.667 6.667h21.333c2.205 0 4-1.795 4-4v-16c0-2.205-1.795-4-4-4zM29.333 26.667c0 0.736-0.597 1.333-1.333 1.333h-21.333c-2.205 0-4-1.795-4-4v-14.895c0.416 0.147 0.865 0.228 1.333 0.228h24c0.736 0 1.333 0.597 1.333 1.333zM22.667 14.667c-2.205 0-4 1.795-4 4s1.795 4 4 4 4-1.795 4-4-1.795-4-4-4zM22.667 20c-0.736 0-1.333-0.597-1.333-1.333s0.597-1.333 1.333-1.333 1.333 0.597 1.333 1.333-0.597 1.333-1.333 1.333z"></path>\n</svg>\n',loyalty_program:c,profile:m}}async componentWillLoad(){await salla.onReady(),await salla.lang.onLoaded(),this.loadTranslations(),this.initiate(),Salla.event.on("api::token.injected",(s=>this.profileUrl=this.buildProfileUrl(s))),this.sallaAccountEnabled=Salla.config.get("store.features")?.includes("salla-account"),this.items=this.sallaAccountEnabled?{...this.items,settings:'\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>settings</title>\n<path d="M29.717 19.037l-1.817-1.499c0.067-0.512 0.1-1.028 0.1-1.539s-0.033-1.027-0.1-1.54l1.817-1.499c1.177-0.969 1.479-2.633 0.716-3.956l-1.159-2.009c-0.761-1.324-2.349-1.895-3.784-1.359l-2.212 0.829c-0.817-0.627-1.704-1.139-2.649-1.535l-0.388-2.332c-0.251-1.507-1.54-2.6-3.067-2.6h-2.319c-1.525 0-2.815 1.093-3.065 2.6l-0.388 2.332c-0.945 0.396-1.833 0.909-2.649 1.535l-2.212-0.829c-1.428-0.533-3.021 0.036-3.783 1.359l-1.16 2.011c-0.763 1.323-0.46 2.985 0.716 3.955l1.817 1.499c-0.067 0.513-0.1 1.029-0.1 1.54s0.033 1.027 0.1 1.539l-1.819 1.5c-1.176 0.971-1.476 2.635-0.715 3.955l1.159 2.011c0.763 1.324 2.356 1.899 3.784 1.36l2.212-0.831c0.816 0.625 1.703 1.139 2.649 1.535l0.388 2.332c0.251 1.507 1.54 2.6 3.067 2.6h2.319c1.527 0 2.816-1.093 3.065-2.6l0.389-2.332c0.947-0.396 1.833-0.909 2.649-1.535l2.212 0.831c1.432 0.539 3.023-0.035 3.783-1.36l1.16-2.011c0.76-1.32 0.459-2.984-0.717-3.956zM28.123 21.663l-1.16 2.011c-0.108 0.188-0.336 0.267-0.536 0.193l-2.931-1.1c-0.459-0.173-0.979-0.079-1.349 0.248-0.923 0.811-1.979 1.423-3.139 1.819-0.464 0.157-0.804 0.559-0.885 1.043l-0.515 3.087c-0.033 0.215-0.216 0.371-0.433 0.371h-2.319c-0.217 0-0.4-0.156-0.436-0.371l-0.513-3.087c-0.080-0.484-0.42-0.884-0.885-1.043-1.16-0.396-2.216-1.008-3.139-1.819-0.248-0.217-0.561-0.332-0.88-0.332-0.157 0-0.316 0.028-0.469 0.084l-2.931 1.1c-0.199 0.079-0.428-0.004-0.537-0.193l-1.159-2.011c-0.109-0.191-0.067-0.428 0.101-0.568l2.409-1.985c0.379-0.312 0.555-0.807 0.46-1.288-0.119-0.605-0.179-1.219-0.179-1.821 0-0.604 0.060-1.217 0.181-1.823 0.095-0.481-0.081-0.976-0.46-1.288l-2.409-1.985c-0.168-0.139-0.211-0.376-0.101-0.567l1.16-2.011c0.107-0.188 0.332-0.268 0.536-0.193l2.931 1.1c0.459 0.172 0.979 0.079 1.348-0.247 0.924-0.812 1.98-1.424 3.139-1.817 0.465-0.159 0.805-0.559 0.885-1.044l0.513-3.088c0.036-0.215 0.219-0.371 0.436-0.371h2.319c0.217 0 0.4 0.156 0.436 0.371l0.515 3.088c0.081 0.484 0.42 0.885 0.885 1.044 1.157 0.393 2.213 1.005 3.139 1.817 0.371 0.325 0.889 0.42 1.349 0.247l2.929-1.099c0.203-0.076 0.428 0.005 0.537 0.193l1.159 2.009c0.109 0.191 0.067 0.428-0.101 0.567l-2.409 1.985c-0.379 0.312-0.555 0.807-0.46 1.288 0.119 0.605 0.179 1.219 0.179 1.823 0 0.603-0.060 1.216-0.181 1.821-0.095 0.48 0.081 0.975 0.46 1.288l2.408 1.984c0.169 0.141 0.212 0.379 0.103 0.569zM16.016 10.667c-2.941 0-5.333 2.392-5.333 5.333s2.392 5.333 5.333 5.333 5.333-2.392 5.333-5.333-2.392-5.333-5.333-5.333zM16.016 18.667c-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'}:this.items,this.host.hasAttribute("with-rating")&&(this.items.rating=h),this.items.logout='\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>send-out</title>\n<path d="M16 26.667h-9.333c-0.736 0-1.333-0.597-1.333-1.333v-18.667c0-0.736 0.597-1.333 1.333-1.333h9.333c0.737 0 1.333-0.596 1.333-1.333s-0.596-1.333-1.333-1.333h-9.333c-2.205 0-4 1.795-4 4v18.667c0 2.205 1.795 4 4 4h9.333c0.737 0 1.333-0.596 1.333-1.333s-0.596-1.333-1.333-1.333zM29.231 15.491c-0.068-0.164-0.167-0.312-0.289-0.436l-5.332-5.332c-0.521-0.521-1.364-0.521-1.885 0s-0.521 1.364 0 1.885l3.057 3.059h-12.781c-0.737 0-1.333 0.596-1.333 1.333s0.596 1.333 1.333 1.333h12.781l-3.057 3.057c-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.391l5.332-5.332c0.124-0.123 0.221-0.271 0.289-0.435 0.135-0.325 0.135-0.693 0-1.019z"></path>\n</svg>\n';let s=Salla.storage.get("token");s||(s=""),this.profileUrl=this.buildProfileUrl(s);const t=this.host.querySelector('[slot="trigger"]');this.triggerSlot='<div class="s-user-menu-trigger"><div class="s-user-menu-avatar-wrap"><img class="s-user-menu-trigger-avatar" src="{avatar}" alt="{first_name}{last_name}" /></div><div class="s-user-menu-trigger-content"><span class="s-user-menu-trigger-hello">{hello}</span><p class="s-user-menu-trigger-name">{first_name} {last_name}</p></div> <i class="s-user-menu-trigger-icon">{icon}</i></div>',t&&(this.triggerSlot=t.innerHTML,t.innerHTML=this.replaceParams(t.innerHTML))}loadTranslations(){this.notifications=Salla.lang.get("common.titles.notifications"),this.orders=Salla.lang.get("common.titles.orders"),this.pending_orders=Salla.lang.get("common.titles.pending_orders"),this.wishlist=Salla.lang.get("common.titles.wishlist"),this.profile=Salla.lang.get("common.titles.profile"),this.hello=Salla.lang.get("pages.checkout.hello"),this.rating=Salla.lang.get("common.titles.rating"),this.wallet=Salla.lang.get("common.titles.wallet"),this.settings=Salla.lang.get("common.titles.settings"),this.loyalty_program=Salla.lang.get("pages.loyalty_program.loyalty_points"),this.logout=Salla.lang.get("blocks.header.logout")}initiate(){return Salla.config.isGuest()?this.autoMountLoginModal():(this.is_loggedIn=!0,!this.inline&&(salla.url.is_page("customer.notifications")||salla.url.is_page("customer.orders.index.pending")||salla.url.is_page("customer.profile")||(Date.now()-(salla.storage.get("user.fetched_at")||0))/1e3/60>30)?this.fetchFreshProfile():void salla.event.on("profile::info.fetched",(s=>{this.updateProfileState(s)})))}autoMountLoginModal(){this.showTrigger&&(document.querySelector("salla-login-modal")||Salla.hooks.mount("body:end",document.createElement("salla-login-modal")))}fetchFreshProfile(){salla.api.token?salla.profile.api.info().then((s=>{this.updateProfileState(s)})):salla.log("trying to fetchFreshProfile before injected the token!!")}updateProfileState(s){this.badges={notifications:salla.helpers.number(s.data.notifications||0),pending_orders:salla.helpers.number(s.data.pending_orders||0)},this.hasBadges=Number(s.data.pending_orders)>0||Number(s.data.notifications)>0,this.first_name=s.data.first_name,this.last_name=s.data.last_name,this.avatar=s.data.avatar||salla.url.cdn("images/avatar.png",40,40)}async open(s){this.opened=!this.opened,s.stopPropagation(),this.opened&&window.addEventListener("click",this.onClickOutside)}menuItemClicked(s,t){"logout"===t&&(s.preventDefault(),salla.auth.logout("sall-user-menu"))}replaceParams(s){return s.replace(/\{hello\}/g,this.hello).replace(/\{first_name\}/g,this.first_name).replace(/\{last_name\}/g,this.last_name).replace(/\{avatar\}/g,this.avatar).replace(/\{icon\}/g,i)}getTheHeader(){return t("div",{class:{"s-user-menu-trigger-slot":!0,"s-user-menu-red-dot":this.hasBadges,"s-user-menu-trigger-avatar-only":this.avatarOnly},id:"trigger-slot",onClick:s=>this.open(s),onKeyUp:s=>this.open(s),innerHTML:this.replaceParams(this.triggerSlot)})}getItemAnchorLinkAttrs(s){return"profile"===s&&this.profileUrl&&this.sallaAccountEnabled?{href:this.profileUrl,target:"_blank",rel:"noopener noreferrer"}:{href:Salla.url.get("loyalty_program"===s?"loyalty":s)}}getMenuItem([s,e],l){if(("wallet"!==s||window.can_access_wallet)&&("loyalty_program"!==s||Salla.config.get("store.features").includes("loyalty-system")))return t("li",{class:{"s-user-menu-dropdown-item":!0,"s-user-menu-dropdown-item-logout":l+1===Object.entries(this.items).length}},t("a",{...this.getItemAnchorLinkAttrs(s),class:"s-user-menu-dropdown-item-link",onClick:t=>this.menuItemClicked(t,s)},t("i",{class:"s-user-menu-dropdown-item-prefix",innerHTML:e}),t("span",{class:"s-user-menu-dropdown-item-title"},this[s]),["٠","0",void 0].includes(this.badges[s])?"":t("span",{class:"s-user-menu-dropdown-item-badge"},this.badges[s])))}componentShouldUpdate(){this.opened||window.removeEventListener("click",this.onClickOutside)}render(){return t(e,null,this.is_loggedIn?this.inline?t("ul",{class:"s-user-menu-inline"},Object.entries(this.items).map(((s,t)=>this.getMenuItem(s,t)))):t("div",{class:{"s-user-menu-wrapper":!0,"s-user-menu-relative-dropdown":this.relativeDropdown}},this.getTheHeader(),t("div",{class:{"s-user-menu-toggler":!0,opened:this.opened}},t("div",{class:"s-user-menu-dropdown",onClick:s=>s.stopPropagation(),onKeyUp:s=>s.stopPropagation()},this.showHeader?t("div",{class:"s-user-menu-dropdown-header"},t("img",{src:this.avatar,alt:`${this.first_name} ${this.last_name}`}),t("div",{class:"s-user-menu-dropdown-header-content"},t("span",null,this.hello),t("p",null,this.first_name," ",this.last_name)),t("button",{type:"button",class:"s-user-menu-dropdown-header-close",innerHTML:r,onClick:()=>{this.opened=!1}})):"",t("ul",{class:"s-user-menu-dropdown-list"},Object.entries(this.items).map(((s,t)=>this.getMenuItem(s,t))))))):t("slot",{name:"login-btn"},t("button",{type:"button",class:"s-user-menu-login-btn",onClick:()=>salla.event.dispatch("login::open"),innerHTML:m})))}componentDidLoad(){document.lazyLoadInstance?.update(this.host.querySelectorAll(".lazy"))}buildProfileUrl(s){return`${Salla.config.get("account.url","https://accounts.salla.com")}/${salla.config.get("user.language_code")}/user?store=${Salla.config.get("store.id")}&info=${encodeURIComponent(s)}`}get host(){return l(this)}};u.style="";export{u as salla_user_menu}
4
+ import{r as s,h as t,H as e,a as l}from"./p-Noi8jmqR.js";import{A as i}from"./p-DCZbpt2a.js";import{B as a}from"./p-D3mWkc-3.js";import{P as o}from"./p-DY4LZmNP.js";import{W as n}from"./p-ZT7ehBBk.js";import{S as r}from"./p-8Tsmrwno.js";import{S as h}from"./p-D4oPi1Ov.js";import{S as c}from"./p-CXRKXFgT.js";var m='\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>user-circle</title>\n<path d="M16 22.964c-4.525 0-8.447 1.713-9.993 4.365-0.371 0.636-0.156 1.452 0.48 1.823s1.453 0.156 1.823-0.48c0.855-1.465 3.624-3.041 7.689-3.041s6.835 1.576 7.689 3.041c0.249 0.424 0.696 0.661 1.155 0.661 0.228 0 0.459-0.059 0.669-0.181 0.637-0.371 0.852-1.187 0.48-1.823-1.545-2.652-5.467-4.365-9.992-4.365zM22.667 13.631c0-3.676-2.991-6.667-6.667-6.667s-6.667 2.991-6.667 6.667 2.991 6.667 6.667 6.667 6.667-2.992 6.667-6.667zM12 13.631c0-2.205 1.795-4 4-4s4 1.795 4 4-1.795 4-4 4-4-1.795-4-4zM16 0.297c-8.823 0-16 7.177-16 16 0 2.941 0.821 5.831 2.373 8.357 0.252 0.411 0.689 0.636 1.137 0.636 0.239 0 0.479-0.064 0.696-0.197 0.628-0.385 0.824-1.207 0.439-1.833-1.295-2.108-1.979-4.516-1.979-6.963 0-7.352 5.981-13.333 13.333-13.333s13.333 5.981 13.333 13.333c0 2.448-0.684 4.856-1.979 6.961-0.385 0.628-0.189 1.448 0.437 1.835 0.627 0.384 1.448 0.189 1.835-0.437 1.553-2.527 2.373-5.416 2.373-8.359 0-8.823-7.177-16-16-16z"></path>\n</svg>\n';const u=class{constructor(t){s(this,t),this.accountLoading=!1,this.opened=!1,this.notifications=salla.lang.get("common.titles.notifications"),this.orders=salla.lang.get("common.titles.orders"),this.pending_orders=salla.lang.get("common.titles.pending_orders"),this.wishlist=salla.lang.get("common.titles.wishlist"),this.profile=salla.lang.get("common.titles.profile"),this.rating=salla.lang.get("common.titles.rating"),this.wallet=salla.lang.get("common.titles.wallet"),this.settings=salla.lang.get("common.titles.settings"),this.loyalty_program=salla.lang.get("pages.loyalty_program.loyalty_points"),this.logout=salla.lang.get("blocks.header.logout"),this.hello=salla.lang.get("pages.checkout.hello"),this.first_name=salla.storage.get("user.first_name")||"",this.last_name=salla.storage.get("user.last_name")||"",this.avatar=salla.storage.get("user.avatar")||salla.url.cdn("images/avatar.png",40,40),this.badges={notifications:salla.helpers.number(salla.storage.get("user.notifications")||0),pending_orders:salla.helpers.number(salla.storage.get("user.pending_orders")||0)},this.sallaAccountEnabled=!1,this.hasBadges=Number(salla.storage.get("user.pending_orders"))>0||Number(salla.storage.get("user.notifications"))>0,this.inline=!1,this.avatarOnly=!1,this.showHeader=!1,this.relativeDropdown=!1,this.showTrigger=!1,this.onClickOutside=()=>{this.opened=!1},this.OrderUpdate=0,this.items={notifications:a,orders:'\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>box-bankers</title>\n<path d="M28 1.333h-24c-2.205 0-4 1.795-4 4v5.333c0 0.736 0.597 1.333 1.333 1.333v14.667c0 2.205 1.795 4 4 4h21.333c2.205 0 4-1.795 4-4v-14.667c0.736 0 1.333-0.597 1.333-1.333v-5.333c0-2.205-1.795-4-4-4zM28 26.667c0 0.735-0.599 1.333-1.333 1.333h-21.333c-0.735 0-1.333-0.599-1.333-1.333v-14.667h5.333v2.667c0 1.471 1.196 2.667 2.667 2.667h8c1.471 0 2.667-1.196 2.667-2.667v-2.667h5.333zM12 14.667v-2.667h8v2.667zM29.333 9.333h-26.667v-4c0-0.735 0.599-1.333 1.333-1.333h24c0.735 0 1.333 0.599 1.333 1.333z"></path>\n</svg>\n',pending_orders:o,wishlist:n,wallet:'\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>wallet</title>\n<path d="M28 6.667h-24c-0.736 0-1.333-0.597-1.333-1.333s0.597-1.333 1.333-1.333h24c0.737 0 1.333-0.596 1.333-1.333s-0.596-1.333-1.333-1.333h-24c-2.204 0-3.999 1.793-4 3.997v18.669c0 3.676 2.991 6.667 6.667 6.667h21.333c2.205 0 4-1.795 4-4v-16c0-2.205-1.795-4-4-4zM29.333 26.667c0 0.736-0.597 1.333-1.333 1.333h-21.333c-2.205 0-4-1.795-4-4v-14.895c0.416 0.147 0.865 0.228 1.333 0.228h24c0.736 0 1.333 0.597 1.333 1.333zM22.667 14.667c-2.205 0-4 1.795-4 4s1.795 4 4 4 4-1.795 4-4-1.795-4-4-4zM22.667 20c-0.736 0-1.333-0.597-1.333-1.333s0.597-1.333 1.333-1.333 1.333 0.597 1.333 1.333-0.597 1.333-1.333 1.333z"></path>\n</svg>\n',loyalty_program:c,profile:m}}async componentWillLoad(){await salla.onReady(),await salla.lang.onLoaded(),this.loadTranslations(),this.initiate(),Salla.event.on("api::token.injected",(s=>this.profileUrl=this.buildProfileUrl(s))),this.sallaAccountEnabled=Salla.config.get("store.features")?.includes("salla-account"),this.items=this.sallaAccountEnabled?{...this.items,settings:'\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>settings</title>\n<path d="M29.717 19.037l-1.817-1.499c0.067-0.512 0.1-1.028 0.1-1.539s-0.033-1.027-0.1-1.54l1.817-1.499c1.177-0.969 1.479-2.633 0.716-3.956l-1.159-2.009c-0.761-1.324-2.349-1.895-3.784-1.359l-2.212 0.829c-0.817-0.627-1.704-1.139-2.649-1.535l-0.388-2.332c-0.251-1.507-1.54-2.6-3.067-2.6h-2.319c-1.525 0-2.815 1.093-3.065 2.6l-0.388 2.332c-0.945 0.396-1.833 0.909-2.649 1.535l-2.212-0.829c-1.428-0.533-3.021 0.036-3.783 1.359l-1.16 2.011c-0.763 1.323-0.46 2.985 0.716 3.955l1.817 1.499c-0.067 0.513-0.1 1.029-0.1 1.54s0.033 1.027 0.1 1.539l-1.819 1.5c-1.176 0.971-1.476 2.635-0.715 3.955l1.159 2.011c0.763 1.324 2.356 1.899 3.784 1.36l2.212-0.831c0.816 0.625 1.703 1.139 2.649 1.535l0.388 2.332c0.251 1.507 1.54 2.6 3.067 2.6h2.319c1.527 0 2.816-1.093 3.065-2.6l0.389-2.332c0.947-0.396 1.833-0.909 2.649-1.535l2.212 0.831c1.432 0.539 3.023-0.035 3.783-1.36l1.16-2.011c0.76-1.32 0.459-2.984-0.717-3.956zM28.123 21.663l-1.16 2.011c-0.108 0.188-0.336 0.267-0.536 0.193l-2.931-1.1c-0.459-0.173-0.979-0.079-1.349 0.248-0.923 0.811-1.979 1.423-3.139 1.819-0.464 0.157-0.804 0.559-0.885 1.043l-0.515 3.087c-0.033 0.215-0.216 0.371-0.433 0.371h-2.319c-0.217 0-0.4-0.156-0.436-0.371l-0.513-3.087c-0.080-0.484-0.42-0.884-0.885-1.043-1.16-0.396-2.216-1.008-3.139-1.819-0.248-0.217-0.561-0.332-0.88-0.332-0.157 0-0.316 0.028-0.469 0.084l-2.931 1.1c-0.199 0.079-0.428-0.004-0.537-0.193l-1.159-2.011c-0.109-0.191-0.067-0.428 0.101-0.568l2.409-1.985c0.379-0.312 0.555-0.807 0.46-1.288-0.119-0.605-0.179-1.219-0.179-1.821 0-0.604 0.060-1.217 0.181-1.823 0.095-0.481-0.081-0.976-0.46-1.288l-2.409-1.985c-0.168-0.139-0.211-0.376-0.101-0.567l1.16-2.011c0.107-0.188 0.332-0.268 0.536-0.193l2.931 1.1c0.459 0.172 0.979 0.079 1.348-0.247 0.924-0.812 1.98-1.424 3.139-1.817 0.465-0.159 0.805-0.559 0.885-1.044l0.513-3.088c0.036-0.215 0.219-0.371 0.436-0.371h2.319c0.217 0 0.4 0.156 0.436 0.371l0.515 3.088c0.081 0.484 0.42 0.885 0.885 1.044 1.157 0.393 2.213 1.005 3.139 1.817 0.371 0.325 0.889 0.42 1.349 0.247l2.929-1.099c0.203-0.076 0.428 0.005 0.537 0.193l1.159 2.009c0.109 0.191 0.067 0.428-0.101 0.567l-2.409 1.985c-0.379 0.312-0.555 0.807-0.46 1.288 0.119 0.605 0.179 1.219 0.179 1.823 0 0.603-0.060 1.216-0.181 1.821-0.095 0.48 0.081 0.975 0.46 1.288l2.408 1.984c0.169 0.141 0.212 0.379 0.103 0.569zM16.016 10.667c-2.941 0-5.333 2.392-5.333 5.333s2.392 5.333 5.333 5.333 5.333-2.392 5.333-5.333-2.392-5.333-5.333-5.333zM16.016 18.667c-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'}:this.items,this.host.hasAttribute("with-rating")&&(this.items.rating=h),this.items.logout='\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>send-out</title>\n<path d="M16 26.667h-9.333c-0.736 0-1.333-0.597-1.333-1.333v-18.667c0-0.736 0.597-1.333 1.333-1.333h9.333c0.737 0 1.333-0.596 1.333-1.333s-0.596-1.333-1.333-1.333h-9.333c-2.205 0-4 1.795-4 4v18.667c0 2.205 1.795 4 4 4h9.333c0.737 0 1.333-0.596 1.333-1.333s-0.596-1.333-1.333-1.333zM29.231 15.491c-0.068-0.164-0.167-0.312-0.289-0.436l-5.332-5.332c-0.521-0.521-1.364-0.521-1.885 0s-0.521 1.364 0 1.885l3.057 3.059h-12.781c-0.737 0-1.333 0.596-1.333 1.333s0.596 1.333 1.333 1.333h12.781l-3.057 3.057c-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.391l5.332-5.332c0.124-0.123 0.221-0.271 0.289-0.435 0.135-0.325 0.135-0.693 0-1.019z"></path>\n</svg>\n';let s=Salla.storage.get("token");s||(s=""),this.profileUrl=this.buildProfileUrl(s);const t=this.host.querySelector('[slot="trigger"]');this.triggerSlot='<div class="s-user-menu-trigger"><div class="s-user-menu-avatar-wrap"><img class="s-user-menu-trigger-avatar" src="{avatar}" alt="{first_name}{last_name}" /></div><div class="s-user-menu-trigger-content"><span class="s-user-menu-trigger-hello">{hello}</span><p class="s-user-menu-trigger-name">{first_name} {last_name}</p></div> <i class="s-user-menu-trigger-icon">{icon}</i></div>',t&&(this.triggerSlot=t.innerHTML,t.innerHTML=this.replaceParams(t.innerHTML))}loadTranslations(){this.notifications=Salla.lang.get("common.titles.notifications"),this.orders=Salla.lang.get("common.titles.orders"),this.pending_orders=Salla.lang.get("common.titles.pending_orders"),this.wishlist=Salla.lang.get("common.titles.wishlist"),this.profile=Salla.lang.get("common.titles.profile"),this.hello=Salla.lang.get("pages.checkout.hello"),this.rating=Salla.lang.get("common.titles.rating"),this.wallet=Salla.lang.get("common.titles.wallet"),this.settings=Salla.lang.get("common.titles.settings"),this.loyalty_program=Salla.lang.get("pages.loyalty_program.loyalty_points"),this.logout=Salla.lang.get("blocks.header.logout")}initiate(){return Salla.config.isGuest()?this.autoMountLoginModal():(this.is_loggedIn=!0,!this.inline&&(salla.url.is_page("customer.notifications")||salla.url.is_page("customer.orders.index.pending")||salla.url.is_page("customer.profile")||(Date.now()-(salla.storage.get("user.fetched_at")||0))/1e3/60>30)?this.fetchFreshProfile():void salla.event.on("profile::info.fetched",(s=>{this.updateProfileState(s)})))}autoMountLoginModal(){this.showTrigger&&(document.querySelector("salla-login-modal")||Salla.hooks.mount("body:end",document.createElement("salla-login-modal")))}fetchFreshProfile(){salla.api.token?salla.profile.api.info().then((s=>{this.updateProfileState(s)})):salla.log("trying to fetchFreshProfile before injected the token!!")}updateProfileState(s){this.badges={notifications:salla.helpers.number(s.data.notifications||0),pending_orders:salla.helpers.number(s.data.pending_orders||0)},this.hasBadges=Number(s.data.pending_orders)>0||Number(s.data.notifications)>0,this.first_name=s.data.first_name,this.last_name=s.data.last_name,this.avatar=s.data.avatar||salla.url.cdn("images/avatar.png",40,40)}async open(s){this.opened=!this.opened,s.stopPropagation(),this.opened&&window.addEventListener("click",this.onClickOutside)}menuItemClicked(s,t){"logout"===t&&(s.preventDefault(),salla.auth.logout("sall-user-menu"))}replaceParams(s){return s.replace(/\{hello\}/g,this.hello).replace(/\{first_name\}/g,this.first_name).replace(/\{last_name\}/g,this.last_name).replace(/\{avatar\}/g,this.avatar).replace(/\{icon\}/g,i)}getTheHeader(){return t("div",{class:{"s-user-menu-trigger-slot":!0,"s-user-menu-red-dot":this.hasBadges,"s-user-menu-trigger-avatar-only":this.avatarOnly},id:"trigger-slot",onClick:s=>this.open(s),onKeyUp:s=>this.open(s),innerHTML:this.replaceParams(this.triggerSlot)})}getItemAnchorLinkAttrs(s){return"profile"===s&&this.profileUrl&&this.sallaAccountEnabled?{href:this.profileUrl,target:"_blank",rel:"noopener noreferrer"}:{href:Salla.url.get("loyalty_program"===s?"loyalty":s)}}getMenuItem([s,e],l){if(("wallet"!==s||window.can_access_wallet)&&("loyalty_program"!==s||Salla.config.get("store.features").includes("loyalty-system")))return t("li",{class:{"s-user-menu-dropdown-item":!0,"s-user-menu-dropdown-item-logout":l+1===Object.entries(this.items).length}},t("a",{...this.getItemAnchorLinkAttrs(s),class:"s-user-menu-dropdown-item-link",onClick:t=>this.menuItemClicked(t,s)},t("i",{class:"s-user-menu-dropdown-item-prefix",innerHTML:e}),t("span",{class:"s-user-menu-dropdown-item-title"},this[s]),["٠","0",void 0].includes(this.badges[s])?"":t("span",{class:"s-user-menu-dropdown-item-badge"},this.badges[s])))}componentShouldUpdate(){this.opened||window.removeEventListener("click",this.onClickOutside)}render(){return t(e,null,this.is_loggedIn?this.inline?t("ul",{class:"s-user-menu-inline"},Object.entries(this.items).map(((s,t)=>this.getMenuItem(s,t)))):t("div",{class:{"s-user-menu-wrapper":!0,"s-user-menu-relative-dropdown":this.relativeDropdown}},this.getTheHeader(),t("div",{class:{"s-user-menu-toggler":!0,opened:this.opened}},t("div",{class:"s-user-menu-dropdown",onClick:s=>s.stopPropagation(),onKeyUp:s=>s.stopPropagation()},this.showHeader?t("div",{class:"s-user-menu-dropdown-header"},t("img",{src:this.avatar,alt:`${this.first_name} ${this.last_name}`}),t("div",{class:"s-user-menu-dropdown-header-content"},t("span",null,this.hello),t("p",null,this.first_name," ",this.last_name)),t("button",{type:"button",class:"s-user-menu-dropdown-header-close",innerHTML:r,onClick:()=>{this.opened=!1}})):"",t("ul",{class:"s-user-menu-dropdown-list"},Object.entries(this.items).map(((s,t)=>this.getMenuItem(s,t))))))):t("slot",{name:"login-btn"},t("button",{type:"button",class:"s-user-menu-login-btn",onClick:()=>salla.event.dispatch("login::open"),innerHTML:m})))}componentDidLoad(){document.lazyLoadInstance?.update(this.host.querySelectorAll(".lazy"))}buildProfileUrl(s){return`${Salla.config.get("account.url","https://accounts.salla.com")}/${salla.config.get("user.language_code")}/user?store=${Salla.config.get("store.id")}&info=${encodeURIComponent(s)}`}get host(){return l(this)}};u.style="";export{u as salla_user_menu}
@@ -0,0 +1,4 @@
1
+ /*!
2
+ * Crafted with ❤ by Salla
3
+ */
4
+ import{r as e,h as s,a as t}from"./p-Noi8jmqR.js";import{S as a}from"./p-Ctkfc4K-.js";import{S as l}from"./p-cgSL_BIo.js";import{S as o}from"./p-D1s2kXqL.js";const i=class{constructor(s){e(this,s),this.offer=null,this.hasError=!1,this.translationLoaded=!1,this.addToCartLabel=salla.lang.get("pages.cart.add_to_cart"),salla.event.on("offer-modal::open",(e=>this.open(e))),salla.lang.onLoaded((()=>{this.addToCartLabel=salla.lang.get("pages.cart.add_to_cart"),this.translationLoaded=!0})),this.categorySlot=this.host.querySelector('[slot="category"]')?.innerHTML||'<span class="s-offer-modal-badge-icon">{tagIcon}</span><span class="s-offer-modal-badge-text">{name}</span>',salla.event.on("offer-modal::open",(e=>this.open(e))),salla.product.event.onOfferExisted((e=>{salla.storage.get("remember-offer-"+e.id)?salla.log("User selected to don't show this offer again."):this.open(e.product_id)}))}emitPromotionViewed(e){e&&salla.event.emit("promotion::viewed",[{id:e.id?.toString(),creative:e.message,name:e.name,position:`${this.offer_type}_offer_modal`}])}emitPromotionClicked(e){e&&salla.event.emit("promotion::clicked",[{id:e.id?.toString(),creative:e.message,name:e.name,position:`${this.offer_type}_offer_modal`}])}async open(e){return this.productID=e,this.hasError=!1,this.modal.loading(),await salla.api.withoutNotifier((()=>salla.product.offers(e))).then((e=>{e.data&&e.data.length&&(this.modal.open(),this.showOffer(e.data[0]))})).catch((e=>{this.hasError=!0,this.errorMessage=e.response?.data?.error?.message||e.response?.data,this.modal.open()})).finally((()=>{this.modal.visible&&setTimeout((()=>this.modal.stopLoading()),1e3)}))}async showOffer(e){this.offer=e,this.offer_name=e.name,this.offer_message=e.message,this.offer.get.discounts_table?this.offer_type="discounts-table":this.offer.get.products?.length?this.offer_type="products":this.offer.get.categories?.length?this.offer_type="categories":this.offer.get.brands?.length&&(this.offer_type="brands"),this.modal.setTitle(this.offer_name),this.emitPromotionViewed(this.offer)}rememberMe(e){salla.storage.set("remember-offer-"+this.offer.id,e.target.checked)}addToCart(e){this.emitPromotionClicked(this.offer),salla.api.withoutNotifier((()=>salla.cart.quickAdd(this.productID,e,this.offer_type))).then((()=>this.modal.close()))}getOfferContent(){if(this.offer.get.discounts_table)return s("div",{class:"s-offer-modal-discount-table"},s("table",null,s("tbody",null,this.offer.get.discounts_table?.map((e=>s("tr",null,s("td",null,e.text),s("td",{class:"s-offer-modal-discount-table-cell"},s("salla-button",{fill:"outline",shape:"btn",color:"primary",size:"medium",width:"normal",onClick:()=>this.addToCart(e.quantity)},this.addToCartLabel))))))));if(this.offer.get.products?.length){const e=this.offer.get.products?.length||0,t={slidesPerView:"auto",spaceBetween:16,breakpoints:{768:{slidesPerView:Math.min(2,e),spaceBetween:16},1024:{slidesPerView:Math.min(3,e),spaceBetween:16}}};return s("salla-products-slider",{key:(this.offer.get.products?.map((e=>e.id))||[]).join(","),source:"selected","source-value":`[${(this.offer.get.products?.map((e=>e.id))||[]).join(",")}]`,"slider-config":JSON.stringify(t)})}return this.offer.get.categories?.length?s("salla-slider",{type:"carousel",class:{"s-offer-modal-slider-centered":this.offer.get.categories?.length<=2,"s-offer-modal-slider":!0},id:"offer-modal-slider","controls-outer":!0,"show-controls":this.offer.get.categories?.length<=2?"false":"true"},s("div",{slot:"items"},this.offer.get.categories.map((e=>s("a",{href:e.urls.customer,class:"s-offer-modal-badge s-offer-modal-slider-item s-offer-modal-cat-item",innerHTML:this.categorySlot.replace(/\{tagIcon\}/g,l).replace(/\{name\}/g,e.name).replace(/\{url\}/g,e.urls.customer)}))))):this.offer.get.brands?.length?s("salla-slider",{type:"carousel",class:{"s-offer-modal-slider-centered":this.offer.get.brands?.length<=2,"s-offer-modal-slider":!0},id:"offer-modal-slider","controls-outer":!0,"show-controls":this.offer.get.brands?.length<=2?"false":"true"},s("div",{slot:"items"},this.offer.get.brands.map((e=>s("a",{href:e.url||salla.url.create("brands",e.id),class:"s-offer-modal-badge s-offer-modal-slider-item s-offer-modal-brand-item"},s("div",{class:"s-offer-modal-brand-logo"},s("img",{src:e.logo,alt:e.name})),s("span",{class:"s-offer-modal-badge-text"},e.name)))))):void 0}render(){return s("salla-modal",{key:"8be68e5882a9cbb1f4286f765f5db3ce88689c16","has-skeleton":!0,"sub-title":this.offer_message,ref:e=>this.modal=e,isLoading:!0,class:`s-offer-modal-type-${this.offer_type?this.offer_type:""}`},s("div",{key:"570bcafe6a1a00534b26ee25aa154e46594cb662",slot:"loading"},s("div",{key:"baee23d1ad4429e8663fcf043004bf0747fe47de",class:"s-offer-modal-skeleton"},s("div",{key:"1c6967ecfb17092c48247c17c2ce86b8ca048c77",class:"s-offer-modal-skeleton-header"},s("salla-skeleton",{key:"a6ce5a415d4e6350c2467d7d3c070fddaeccd074",type:"circle",height:"80px",width:"80px"}),s("salla-skeleton",{key:"2d65ed027b9fff7eae7ecbb372f9e584a0334cf5",height:"15px",width:"50%"}),s("salla-skeleton",{key:"247706c9ddf7d2b9f96c7ea2deac960de3449017",height:"10px",width:"30%"})),s("div",{key:"b5c9fec6565313706e2d6b73e2f060e4b216ffbc",class:"s-offer-modal-skeleton-items"},[...Array(3)].map((()=>s("div",{class:"s-offer-modal-skeleton-item"},s("salla-skeleton",{height:"9rem"}),s("div",{class:"s-offer-modal-skeleton-item-title"},s("salla-skeleton",{height:"15px",width:"100%"})),s("div",{class:"s-offer-modal-skeleton-item-subtitle"},s("salla-skeleton",{height:"9px",width:"50%"}),s("div",{innerHTML:o})))))),s("div",{key:"58e2d38061e8e4434113b1fc16f3601969e342da",class:"s-offer-modal-skeleton-footer"},s("salla-skeleton",{key:"c388e246236e4849e5d97592ea6a803e6409083f",height:"15px",width:"50%"}),s("salla-skeleton",{key:"4ccd783b15647cf62f1b5b4d760f3e7feead7bfb",height:"15px",width:"30%"})))),this.hasError||null===this.offer?s("salla-placeholder",{class:"s-loyalty-placeholder",alignment:"center"},this.errorMessage?s("span",{slot:"description"},this.errorMessage):""):[s("span",{slot:"icon",class:"s-offer-modal-header-icon",innerHTML:a}),this.getOfferContent(),s("div",{class:"s-offer-modal-footer",slot:"footer"},this.offer.formatted_date?s("p",{class:"s-offer-modal-expiry"},salla.lang.get("pages.products.offer_expires_in")," ",this.offer.formatted_date):"",s("label",{class:"s-offer-modal-remember-label"},s("input",{type:"checkbox",onChange:e=>this.rememberMe(e),class:"s-offer-modal-remember-input"}),"  ",salla.lang.get("common.elements.remember_my_choice")))])}get host(){return t(this)}};i.style=".s-offer-modal-type-products .s-modal-body{min-height:690px;position:relative}";export{i as salla_offer_modal}
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r as e,h as s}from"./p-BYCfehfD.js";import{G as l}from"./p-OF8QcbMM.js";const a=class{constructor(s){e(this,s),this.minAge=10,this.isEditable=!0,this.disableAction=!1,this.isLoading=!0,this.first_name_trans=salla.lang.get("pages.profile.first_name"),this.last_name_trans=salla.lang.get("pages.profile.last_name"),this.birthday_trans=salla.lang.get("pages.profile.birthday"),this.birthday_placeholder_trans=salla.lang.get("pages.profile.birthday_placeholder"),this.gender_trans=salla.lang.get("pages.profile.gender"),this.gender_placeholder_trans=salla.lang.get("pages.profile.gender_placeholder"),this.male_trans=salla.lang.get("pages.profile.male"),this.female_trans=salla.lang.get("pages.profile.female"),this.email_trans=salla.lang.get("common.elements.email"),this.mobile_trans=salla.lang.get("common.elements.mobile"),this.save_btn_trans=salla.lang.get("common.elements.save"),this.drag_and_drop_trans=salla.lang.get("common.uploader.drag_and_drop"),this.browse_trans=salla.lang.get("common.uploader.browse"),this.email_required_trans=salla.lang.get("pages.checkout.email_required"),this.invalid_email_trans=salla.lang.get("pages.error.invalid_value",{attribute:"email"}),salla.lang.onLoaded((()=>{this.first_name_trans=salla.lang.get("pages.profile.first_name"),this.last_name_trans=salla.lang.get("pages.profile.last_name"),this.birthday_trans=salla.lang.get("pages.profile.birthday"),this.birthday_placeholder_trans=salla.lang.get("pages.profile.birthday_placeholder"),this.gender_trans=salla.lang.get("pages.profile.gender"),this.gender_placeholder_trans=salla.lang.get("pages.profile.gender_placeholder"),this.male_trans=salla.lang.get("pages.profile.male"),this.female_trans=salla.lang.get("pages.profile.female"),this.email_trans=salla.lang.get("common.elements.email"),this.mobile_trans=salla.lang.get("common.elements.mobile"),this.save_btn_trans=salla.lang.get("common.elements.save"),this.drag_and_drop_trans=salla.lang.get("common.uploader.drag_and_drop"),this.browse_trans=salla.lang.get("common.uploader.browse"),this.email_required_trans=salla.lang.get("pages.checkout.email_required"),this.invalid_email_trans=salla.lang.get("pages.error.invalid_value",{attribute:"email"})}))}phoneNumberFieldEventHandler(e){e.detail.number?(this.userData.phone.number=Number.parseInt(e.detail.number),this.userData.phone.country=e.detail.country_code,this.disableAction=!1):this.disableAction=!0}handleFieldChange(e,s,l=!1){s.target.value?(this.userData[e]=s.target.value,this.disableAction=!1):l&&(this.disableAction=!0)}handleEmailInput(e,s){const l=document.getElementById("email-error"),a=s.target.value;if(!a)return this.disableAction=!0,void(l.textContent=this.email_required_trans);/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i.test(a)||(this.disableAction=!0,l.textContent=this.invalid_email_trans),l.textContent="",this.userData[e]=a,this.disableAction=!1}submitForm(e){e.preventDefault(),this.disableAction=!0;const s=Object.assign({},this.userData);s.phone=void 0,s.phone=this.userData.phone.number,s.country_code=this.userData.phone.country,salla.api.profile.update(s).finally((()=>{this.disableAction=!1}))}getBirthDateRestriction(){const e=new Date,s=e.getFullYear()-this.minAge;return e.setFullYear(s),e}fetchData(){return salla.api.profile.info().then((e=>{this.userData=e.data})).finally((()=>{this.isLoading=!1,this.isEditable=!Salla.config.get("store.features").includes("sso-login")}))}renderLoadingSection(){return s("div",{class:"s-user-profile-skeleton-wrapper"},Array.from({length:6},((e,l)=>s("salla-skeleton",{class:"skeleton-item",width:"100%",height:"50px",key:l}))))}componentWillLoad(){Salla.onReady().then((()=>this.fetchData()))}render(){return this.isLoading?this.renderLoadingSection():s("form",{onSubmit:e=>this.submitForm(e)},s("div",{class:"s-user-profile-wrapper"},s("div",{class:"s-user-profile-field"},s("label",{htmlFor:"first-name",class:"s-user-profile-field-label"},this.first_name_trans),s("input",{disabled:!this.isEditable,type:"text",name:"first_name",value:this.userData.first_name,id:"first-name",required:!0,autocomplete:"first_name",class:"form-input",onChange:e=>this.handleFieldChange("first_name",e)})),s("div",{class:"s-user-profile-field"},s("label",{htmlFor:"last-name",class:"s-user-profile-field-label"},this.last_name_trans),s("input",{disabled:!this.isEditable,type:"text",name:"last_name",value:this.userData.last_name,id:"last-name",required:!0,autocomplete:"last_name",class:"form-input",onChange:e=>this.handleFieldChange("last_name",e)})),s("div",{class:"s-user-profile-field"},s("label",{htmlFor:"birthday",class:"s-user-profile-field-label"},this.birthday_trans),s("salla-datetime-picker",{disabled:!this.isEditable,dateFormat:"Y-m-d",value:this.userData.birthday,placeholder:this.birthday_placeholder_trans,required:!0,maxDate:this.getBirthDateRestriction(),name:"birthday",onPicked:e=>this.handleFieldChange("birthday",e)})),s("div",{class:"s-user-profile-field"},s("label",{htmlFor:"gender",class:"s-user-profile-field-label"},this.gender_trans),s("select",{disabled:!this.isEditable,class:"form-input",name:"gender",required:!0,onChange:e=>this.handleFieldChange("gender",e)},s("option",{value:""},this.gender_placeholder_trans),s("option",{value:l.Male,selected:this.userData.gender===l.Male},this.male_trans),s("option",{value:l.Female,selected:this.userData.gender===l.Female},this.female_trans))),s("div",{class:"s-user-profile-field"},s("label",{htmlFor:"email",class:"s-user-profile-field-label"},this.email_trans),s("input",{disabled:!this.isEditable,type:"email",name:"email",value:this.userData.email,id:"email",class:"form-input",required:!0,onInput:e=>this.handleEmailInput("email",e)}),s("p",{id:"email-error",class:"s-user-profile-field-error"})),s("div",{class:"s-user-profile-field"},s("label",{htmlFor:"international-mobile",class:"s-user-profile-field-label"},this.mobile_trans),s("salla-tel-input",{disabled:!this.isEditable,name:"international-mobile","country-code":this.userData.phone.country,phone:`${this.userData.phone.number}`,onPhoneEntered:e=>this.phoneNumberFieldEventHandler(e)}))),s("salla-button",{type:"submit",loading:this.disableAction,disabled:this.disableAction||!this.isEditable,"loader-position":"end",class:"s-user-profile-submit"},this.save_btn_trans))}};a.style=":host{display:block}";export{a as salla_user_profile}
4
+ import{r as e,h as s}from"./p-Noi8jmqR.js";import{G as l}from"./p-OF8QcbMM.js";const a=class{constructor(s){e(this,s),this.minAge=10,this.isEditable=!0,this.disableAction=!1,this.isLoading=!0,this.first_name_trans=salla.lang.get("pages.profile.first_name"),this.last_name_trans=salla.lang.get("pages.profile.last_name"),this.birthday_trans=salla.lang.get("pages.profile.birthday"),this.birthday_placeholder_trans=salla.lang.get("pages.profile.birthday_placeholder"),this.gender_trans=salla.lang.get("pages.profile.gender"),this.gender_placeholder_trans=salla.lang.get("pages.profile.gender_placeholder"),this.male_trans=salla.lang.get("pages.profile.male"),this.female_trans=salla.lang.get("pages.profile.female"),this.email_trans=salla.lang.get("common.elements.email"),this.mobile_trans=salla.lang.get("common.elements.mobile"),this.save_btn_trans=salla.lang.get("common.elements.save"),this.drag_and_drop_trans=salla.lang.get("common.uploader.drag_and_drop"),this.browse_trans=salla.lang.get("common.uploader.browse"),this.email_required_trans=salla.lang.get("pages.checkout.email_required"),this.invalid_email_trans=salla.lang.get("pages.error.invalid_value",{attribute:"email"}),salla.lang.onLoaded((()=>{this.first_name_trans=salla.lang.get("pages.profile.first_name"),this.last_name_trans=salla.lang.get("pages.profile.last_name"),this.birthday_trans=salla.lang.get("pages.profile.birthday"),this.birthday_placeholder_trans=salla.lang.get("pages.profile.birthday_placeholder"),this.gender_trans=salla.lang.get("pages.profile.gender"),this.gender_placeholder_trans=salla.lang.get("pages.profile.gender_placeholder"),this.male_trans=salla.lang.get("pages.profile.male"),this.female_trans=salla.lang.get("pages.profile.female"),this.email_trans=salla.lang.get("common.elements.email"),this.mobile_trans=salla.lang.get("common.elements.mobile"),this.save_btn_trans=salla.lang.get("common.elements.save"),this.drag_and_drop_trans=salla.lang.get("common.uploader.drag_and_drop"),this.browse_trans=salla.lang.get("common.uploader.browse"),this.email_required_trans=salla.lang.get("pages.checkout.email_required"),this.invalid_email_trans=salla.lang.get("pages.error.invalid_value",{attribute:"email"})}))}phoneNumberFieldEventHandler(e){e.detail.number?(this.userData.phone.number=Number.parseInt(e.detail.number),this.userData.phone.country=e.detail.country_code,this.disableAction=!1):this.disableAction=!0}handleFieldChange(e,s,l=!1){s.target.value?(this.userData[e]=s.target.value,this.disableAction=!1):l&&(this.disableAction=!0)}handleEmailInput(e,s){const l=document.getElementById("email-error"),a=s.target.value;if(!a)return this.disableAction=!0,void(l.textContent=this.email_required_trans);/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i.test(a)||(this.disableAction=!0,l.textContent=this.invalid_email_trans),l.textContent="",this.userData[e]=a,this.disableAction=!1}submitForm(e){e.preventDefault(),this.disableAction=!0;const s=Object.assign({},this.userData);s.phone=void 0,s.phone=this.userData.phone.number,s.country_code=this.userData.phone.country,salla.api.profile.update(s).finally((()=>{this.disableAction=!1}))}getBirthDateRestriction(){const e=new Date,s=e.getFullYear()-this.minAge;return e.setFullYear(s),e}fetchData(){return salla.api.profile.info().then((e=>{this.userData=e.data})).finally((()=>{this.isLoading=!1,this.isEditable=!Salla.config.get("store.features").includes("sso-login")}))}renderLoadingSection(){return s("div",{class:"s-user-profile-skeleton-wrapper"},Array.from({length:6},((e,l)=>s("salla-skeleton",{class:"skeleton-item",width:"100%",height:"50px",key:l}))))}componentWillLoad(){Salla.onReady().then((()=>this.fetchData()))}render(){return this.isLoading?this.renderLoadingSection():s("form",{onSubmit:e=>this.submitForm(e)},s("div",{class:"s-user-profile-wrapper"},s("div",{class:"s-user-profile-field"},s("label",{htmlFor:"first-name",class:"s-user-profile-field-label"},this.first_name_trans),s("input",{disabled:!this.isEditable,type:"text",name:"first_name",value:this.userData.first_name,id:"first-name",required:!0,autocomplete:"first_name",class:"form-input",onChange:e=>this.handleFieldChange("first_name",e)})),s("div",{class:"s-user-profile-field"},s("label",{htmlFor:"last-name",class:"s-user-profile-field-label"},this.last_name_trans),s("input",{disabled:!this.isEditable,type:"text",name:"last_name",value:this.userData.last_name,id:"last-name",required:!0,autocomplete:"last_name",class:"form-input",onChange:e=>this.handleFieldChange("last_name",e)})),s("div",{class:"s-user-profile-field"},s("label",{htmlFor:"birthday",class:"s-user-profile-field-label"},this.birthday_trans),s("salla-datetime-picker",{disabled:!this.isEditable,dateFormat:"Y-m-d",value:this.userData.birthday,placeholder:this.birthday_placeholder_trans,required:!0,maxDate:this.getBirthDateRestriction(),name:"birthday",onPicked:e=>this.handleFieldChange("birthday",e)})),s("div",{class:"s-user-profile-field"},s("label",{htmlFor:"gender",class:"s-user-profile-field-label"},this.gender_trans),s("select",{disabled:!this.isEditable,class:"form-input",name:"gender",required:!0,onChange:e=>this.handleFieldChange("gender",e)},s("option",{value:""},this.gender_placeholder_trans),s("option",{value:l.Male,selected:this.userData.gender===l.Male},this.male_trans),s("option",{value:l.Female,selected:this.userData.gender===l.Female},this.female_trans))),s("div",{class:"s-user-profile-field"},s("label",{htmlFor:"email",class:"s-user-profile-field-label"},this.email_trans),s("input",{disabled:!this.isEditable,type:"email",name:"email",value:this.userData.email,id:"email",class:"form-input",required:!0,onInput:e=>this.handleEmailInput("email",e)}),s("p",{id:"email-error",class:"s-user-profile-field-error"})),s("div",{class:"s-user-profile-field"},s("label",{htmlFor:"international-mobile",class:"s-user-profile-field-label"},this.mobile_trans),s("salla-tel-input",{disabled:!this.isEditable,name:"international-mobile","country-code":this.userData.phone.country,phone:`${this.userData.phone.number}`,onPhoneEntered:e=>this.phoneNumberFieldEventHandler(e)}))),s("salla-button",{type:"submit",loading:this.disableAction,disabled:this.disableAction||!this.isEditable,"loader-position":"end",class:"s-user-profile-submit"},this.save_btn_trans))}};a.style=":host{display:block}";export{a as salla_user_profile}
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r as s,h as t,F as e,H as r}from"./p-BYCfehfD.js";const a=class{constructor(t){s(this,t)}parseOrderDetailsData(s){this.parsedOrderDetailsData=s,this.parsedOrderDetailsData="string"==typeof this.orderDetails?JSON.parse(s):s}componentWillLoad(){this.parseOrderDetailsData(this.orderDetails),console.log("Parent componentWillLoad - parsedOrderDetailsData:",this.parsedOrderDetailsData)}renderOrderDetailsContent(){return this.parsedOrderDetailsData?[this.parsedOrderDetailsData.options&&this.parsedOrderDetailsData.options.length>0&&t("salla-order-details-options",{options:this.parsedOrderDetailsData.options}),this.parsedOrderDetailsData.sub_products&&this.parsedOrderDetailsData.sub_products.length>0&&t(e,null,t("h2",{class:"s-order-details-bundle-title"},salla.lang.get("pages.orders.sub_products")),t("div",{class:"s-order-details-bundle-content"},this.parsedOrderDetailsData.sub_products.map((s=>t("salla-order-details-multiple-bundle-product",{key:s?.id,productDetails:s})))))]:(console.warn("No parsedOrderDetailsData available"),null)}render(){return t(r,{key:"880b4567c82b94af07c1bcb0303c64516fb0791b",class:"s-order-details-wrapper"},this.renderOrderDetailsContent())}static get watchers(){return{orderDetails:["parseOrderDetailsData"]}}};a.style="";export{a as salla_order_details}
4
+ import{r as s,h as t,F as e,H as r}from"./p-Noi8jmqR.js";const a=class{constructor(t){s(this,t)}parseOrderDetailsData(s){this.parsedOrderDetailsData=s,this.parsedOrderDetailsData="string"==typeof this.orderDetails?JSON.parse(s):s}componentWillLoad(){this.parseOrderDetailsData(this.orderDetails),console.log("Parent componentWillLoad - parsedOrderDetailsData:",this.parsedOrderDetailsData)}renderOrderDetailsContent(){return this.parsedOrderDetailsData?[this.parsedOrderDetailsData.options&&this.parsedOrderDetailsData.options.length>0&&t("salla-order-details-options",{options:this.parsedOrderDetailsData.options}),this.parsedOrderDetailsData.sub_products&&this.parsedOrderDetailsData.sub_products.length>0&&t(e,null,t("h2",{class:"s-order-details-bundle-title"},salla.lang.get("pages.orders.sub_products")),t("div",{class:"s-order-details-bundle-content"},this.parsedOrderDetailsData.sub_products.map((s=>t("salla-order-details-multiple-bundle-product",{key:s?.id,productDetails:s})))))]:(console.warn("No parsedOrderDetailsData available"),null)}render(){return t(r,{key:"41599687bddf4d4b9eda3572ce39b93a0d8f596d",class:"s-order-details-wrapper"},this.renderOrderDetailsContent())}static get watchers(){return{orderDetails:["parseOrderDetailsData"]}}};a.style="";export{a as salla_order_details}
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r as s,h as i,H as e,a as t}from"./p-BYCfehfD.js";const l=class{constructor(i){s(this,i),this.cities=[],this.filteredCities=[],this.selectedCity=null,this.deliveryMessage=null,this.isLoadingCities=!1,this.isLoadingPromises=!1,this.isDropdownOpen=!1,this.searchQuery="",this.hasError=!1,this.errorMessage="",this.labels={deliveryTo:"توصيل إلى",pickupFromBranch:"الاستلام من فرع",searchPlaceholder:"بحث...",noResults:"لا توجد نتائج",selectCity:"اختر المدينة"},this.canRender=!1,this.requiresShipping=!1,this.productId=void 0,this.onClickOutside=s=>{this.host.contains(s.target)||(this.isDropdownOpen=!1,window.removeEventListener("click",this.onClickOutside))}}setLabels(){this.labels={deliveryTo:salla.lang.getWithDefault("pages.products.promise_deliver_to","توصيل إلى"),pickupFromBranch:salla.lang.getWithDefault("pages.products.promise_pickup_from_branch","الاستلام من فرع"),searchPlaceholder:salla.lang.getWithDefault("blocks.header.search_placeholder","بحث..."),noResults:salla.lang.getWithDefault("common.elements.no_options","لا توجد نتائج"),selectCity:salla.lang.getWithDefault("common.elements.select_city","اختر المدينة")}}logger(s,i){localStorage.getItem("salla-delivery-promise-debug")&&(i?console.log(s,i):console.log(s))}async componentDidLoad(){if(await salla.onReady(),await salla.lang.onLoaded(),this.setLabels(),this.requiresShipping=salla.url.is_page("product.single")&&salla.config.get("store.features",[]).includes("delivery-promises"),!this.requiresShipping)return this.canRender=!1,void this.logger("not requiresShipping",{is_product_single:salla.url.is_page("product.single"),includesDeliveryPromises:salla.config.get("store.features",[]).includes("delivery-promises")});this.logger("requiresShipping",this.requiresShipping),this.productId=salla.config.get("page.id"),this.logger("productId",this.productId),await this.fetchCities()}async fetchCities(){this.logger("start startfetchCities"),this.isLoadingCities=!0,this.hasError=!1;try{const s=await salla.api.request(salla.url.api(`products/${this.productId}/delivery-promises/cities`));if(s.success&&Array.isArray(s.data)&&s.data.length>0){this.logger("fetchCities success",{cities:s.data}),this.cities=this.sortCities(s.data),this.filteredCities=[...this.cities];let i=this.cities.find((s=>s.is_selected));i?(this.logger("selectedCity",i),this.selectedCity=i,await this.fetchDeliveryMessage(i.id)):this.logger("no selectedCity from API response"),this.canRender=!0}else this.logger("no data returned from fetchCities",{response:s}),this.canRender=!1}catch(s){this.logger("fetchCities error",{error:s.message}),this.hasError=!0,this.errorMessage=s.message||"Failed to load cities",this.canRender=!1}finally{this.isLoadingCities=!1}}async fetchDeliveryMessage(s){this.logger("start fetchDeliveryMessage",{cityId:s}),this.isLoadingPromises=!0,this.hasError=!1,this.deliveryMessage=null;try{const i=await salla.api.withoutNotifier((()=>salla.api.request(salla.url.api(`products/${this.productId}/delivery-promises?city_id=${s}`))));if(i.success&&i.data?.message){const s=i.data.message.trim();this.logger("fetchDeliveryMessage success",{message:s}),this.deliveryMessage=s||null}else this.logger("deliveryMessage not valid",{response:i})}catch(s){this.logger("fetchDeliveryMessage error",{error:s.message}),this.hasError=!0,this.errorMessage=s.message||"Failed to load delivery message"}finally{this.isLoadingPromises=!1}}toggleDropdown(s){s?.stopPropagation(),this.isDropdownOpen=!this.isDropdownOpen,this.isDropdownOpen?(window.addEventListener("click",this.onClickOutside),this.searchInputRef&&setTimeout((()=>this.searchInputRef.focus()),100)):window.removeEventListener("click",this.onClickOutside)}disconnectedCallback(){window.removeEventListener("click",this.onClickOutside)}sortCities(s){return[...s].sort(((s,i)=>-1===s.id?1:-1===i.id?-1:0))}handleSearch(s){const i=s.target.value.toLowerCase();this.searchQuery=i,this.filteredCities=i.length>0?this.cities.filter((s=>s.name.toLowerCase()?.includes(i)||(s.name_en||"").toLowerCase()?.includes(i))):[...this.cities]}async selectCity(s){this.logger("selectCity",{city:s}),this.selectedCity=s,this.isDropdownOpen=!1,window.removeEventListener("click",this.onClickOutside),this.searchQuery="",this.filteredCities=[...this.cities],await this.fetchDeliveryMessage(s.id)}renderDropdown(){return i("div",{class:"s-delivery-promise-dropdown"},i("div",{class:"s-delivery-promise-dropdown-search"},i("i",{class:"sicon-search"}),i("input",{type:"text",placeholder:this.labels.searchPlaceholder,value:this.searchQuery,onInput:s=>this.handleSearch(s),ref:s=>this.searchInputRef=s})),i("div",{class:"s-delivery-promise-dropdown-list"},0===this.filteredCities.length?i("div",{class:"s-delivery-promise-dropdown-empty"},this.labels.noResults):this.filteredCities.map((s=>i("div",{key:s.id,class:"s-delivery-promise-dropdown-item "+(this.selectedCity?.id===s.id?"selected":""),onClick:()=>this.selectCity(s)},i("span",{class:"s-delivery-promise-city-name"},s.name),this.selectedCity?.id===s.id&&i("i",{class:"sicon-check"}))))))}renderInitialLoadingSkeleton(){return i(e,{class:"s-delivery-promise-wrapper s-delivery-promise-skeleton"},i("div",{class:"s-delivery-promise-container"},i("div",{class:"s-delivery-promise-header s-delivery-promise-header-skeleton"},i("div",{class:"s-delivery-promise-location"},i("salla-skeleton",{height:"14px",width:"180px"})),i("salla-skeleton",{height:"18px",width:"18px"})),i("div",{class:"s-delivery-promise-loading"},i("salla-skeleton",{height:"20px",width:"80%"}))))}renderDeliveryMessage(){return this.isLoadingPromises?i("div",{class:"s-delivery-promise-loading"},i("salla-skeleton",{height:"20px",width:"80%"})):this.deliveryMessage?i("div",{class:"s-delivery-promise-message"},this.deliveryMessage):null}render(){return this.requiresShipping?this.isLoadingCities?this.renderInitialLoadingSkeleton():this.canRender&&0!==this.cities.length?i(e,{class:"s-delivery-promise-wrapper"},i("div",{class:"s-delivery-promise-container"},i("div",{class:"s-delivery-promise-header",onClick:s=>this.toggleDropdown(s)},i("div",{class:"s-delivery-promise-location"},i("span",{class:"s-delivery-promise-title"},this.labels.deliveryTo," ",this.selectedCity?.name||this.labels.selectCity)),i("i",{class:"sicon-keyboard_arrow_down s-delivery-promise-arrow "+(this.isDropdownOpen?"open":"")})),this.hasError&&i("div",{class:"s-delivery-promise-error"},this.errorMessage),this.isDropdownOpen&&this.renderDropdown(),!this.hasError&&this.renderDeliveryMessage())):null:null}get host(){return t(this)}};export{l as salla_delivery_promise}
4
+ import{r as s,h as i,H as e,a as t}from"./p-Noi8jmqR.js";const l=class{constructor(i){s(this,i),this.cities=[],this.filteredCities=[],this.selectedCity=null,this.deliveryMessage=null,this.isLoadingCities=!1,this.isLoadingPromises=!1,this.isDropdownOpen=!1,this.searchQuery="",this.hasError=!1,this.errorMessage="",this.labels={deliveryTo:"توصيل إلى",pickupFromBranch:"الاستلام من فرع",searchPlaceholder:"بحث...",noResults:"لا توجد نتائج",selectCity:"اختر المدينة"},this.canRender=!1,this.requiresShipping=!1,this.productId=void 0,this.onClickOutside=s=>{this.host.contains(s.target)||(this.isDropdownOpen=!1,window.removeEventListener("click",this.onClickOutside))}}setLabels(){this.labels={deliveryTo:salla.lang.getWithDefault("pages.products.promise_deliver_to","توصيل إلى"),pickupFromBranch:salla.lang.getWithDefault("pages.products.promise_pickup_from_branch","الاستلام من فرع"),searchPlaceholder:salla.lang.getWithDefault("blocks.header.search_placeholder","بحث..."),noResults:salla.lang.getWithDefault("common.elements.no_options","لا توجد نتائج"),selectCity:salla.lang.getWithDefault("common.elements.select_city","اختر المدينة")}}logger(s,i){localStorage.getItem("salla-delivery-promise-debug")&&(i?console.log(s,i):console.log(s))}async componentDidLoad(){if(await salla.onReady(),await salla.lang.onLoaded(),this.setLabels(),this.requiresShipping=salla.url.is_page("product.single")&&salla.config.get("store.features",[]).includes("delivery-promises"),!this.requiresShipping)return this.canRender=!1,void this.logger("not requiresShipping",{is_product_single:salla.url.is_page("product.single"),includesDeliveryPromises:salla.config.get("store.features",[]).includes("delivery-promises")});this.logger("requiresShipping",this.requiresShipping),this.productId=salla.config.get("page.id"),this.logger("productId",this.productId),await this.fetchCities()}async fetchCities(){this.logger("start startfetchCities"),this.isLoadingCities=!0,this.hasError=!1;try{const s=await salla.api.request(salla.url.api(`products/${this.productId}/delivery-promises/cities`));if(s.success&&Array.isArray(s.data)&&s.data.length>0){this.logger("fetchCities success",{cities:s.data}),this.cities=this.sortCities(s.data),this.filteredCities=[...this.cities];let i=this.cities.find((s=>s.is_selected));i?(this.logger("selectedCity",i),this.selectedCity=i,await this.fetchDeliveryMessage(i.id)):this.logger("no selectedCity from API response"),this.canRender=!0}else this.logger("no data returned from fetchCities",{response:s}),this.canRender=!1}catch(s){this.logger("fetchCities error",{error:s.message}),this.hasError=!0,this.errorMessage=s.message||"Failed to load cities",this.canRender=!1}finally{this.isLoadingCities=!1}}async fetchDeliveryMessage(s){this.logger("start fetchDeliveryMessage",{cityId:s}),this.isLoadingPromises=!0,this.hasError=!1,this.deliveryMessage=null;try{const i=await salla.api.withoutNotifier((()=>salla.api.request(salla.url.api(`products/${this.productId}/delivery-promises?city_id=${s}`))));if(i.success&&i.data?.message){const s=i.data.message.trim();this.logger("fetchDeliveryMessage success",{message:s}),this.deliveryMessage=s||null}else this.logger("deliveryMessage not valid",{response:i})}catch(s){this.logger("fetchDeliveryMessage error",{error:s.message}),this.hasError=!0,this.errorMessage=s.message||"Failed to load delivery message"}finally{this.isLoadingPromises=!1}}toggleDropdown(s){s?.stopPropagation(),this.isDropdownOpen=!this.isDropdownOpen,this.isDropdownOpen?(window.addEventListener("click",this.onClickOutside),this.searchInputRef&&setTimeout((()=>this.searchInputRef.focus()),100)):window.removeEventListener("click",this.onClickOutside)}disconnectedCallback(){window.removeEventListener("click",this.onClickOutside)}sortCities(s){return[...s].sort(((s,i)=>-1===s.id?1:-1===i.id?-1:0))}handleSearch(s){const i=s.target.value.toLowerCase();this.searchQuery=i,this.filteredCities=i.length>0?this.cities.filter((s=>s.name.toLowerCase()?.includes(i)||(s.name_en||"").toLowerCase()?.includes(i))):[...this.cities]}async selectCity(s){this.logger("selectCity",{city:s}),this.selectedCity=s,this.isDropdownOpen=!1,window.removeEventListener("click",this.onClickOutside),this.searchQuery="",this.filteredCities=[...this.cities],await this.fetchDeliveryMessage(s.id)}renderDropdown(){return i("div",{class:"s-delivery-promise-dropdown"},i("div",{class:"s-delivery-promise-dropdown-search"},i("i",{class:"sicon-search"}),i("input",{type:"text",placeholder:this.labels.searchPlaceholder,value:this.searchQuery,onInput:s=>this.handleSearch(s),ref:s=>this.searchInputRef=s})),i("div",{class:"s-delivery-promise-dropdown-list"},0===this.filteredCities.length?i("div",{class:"s-delivery-promise-dropdown-empty"},this.labels.noResults):this.filteredCities.map((s=>i("div",{key:s.id,class:"s-delivery-promise-dropdown-item "+(this.selectedCity?.id===s.id?"selected":""),onClick:()=>this.selectCity(s)},i("span",{class:"s-delivery-promise-city-name"},s.name),this.selectedCity?.id===s.id&&i("i",{class:"sicon-check"}))))))}renderInitialLoadingSkeleton(){return i(e,{class:"s-delivery-promise-wrapper s-delivery-promise-skeleton"},i("div",{class:"s-delivery-promise-container"},i("div",{class:"s-delivery-promise-header s-delivery-promise-header-skeleton"},i("div",{class:"s-delivery-promise-location"},i("salla-skeleton",{height:"14px",width:"180px"})),i("salla-skeleton",{height:"18px",width:"18px"})),i("div",{class:"s-delivery-promise-loading"},i("salla-skeleton",{height:"20px",width:"80%"}))))}renderDeliveryMessage(){return this.isLoadingPromises?i("div",{class:"s-delivery-promise-loading"},i("salla-skeleton",{height:"20px",width:"80%"})):this.deliveryMessage?i("div",{class:"s-delivery-promise-message"},this.deliveryMessage):null}render(){return this.requiresShipping?this.isLoadingCities?this.renderInitialLoadingSkeleton():this.canRender&&0!==this.cities.length?i(e,{class:"s-delivery-promise-wrapper"},i("div",{class:"s-delivery-promise-container"},i("div",{class:"s-delivery-promise-header",onClick:s=>this.toggleDropdown(s)},i("div",{class:"s-delivery-promise-location"},i("span",{class:"s-delivery-promise-title"},this.labels.deliveryTo," ",this.selectedCity?.name||this.labels.selectCity)),i("i",{class:"sicon-keyboard_arrow_down s-delivery-promise-arrow "+(this.isDropdownOpen?"open":"")})),this.hasError&&i("div",{class:"s-delivery-promise-error"},this.errorMessage),this.isDropdownOpen&&this.renderDropdown(),!this.hasError&&this.renderDeliveryMessage())):null:null}get host(){return t(this)}};export{l as salla_delivery_promise}
@@ -0,0 +1,4 @@
1
+ /*!
2
+ * Crafted with ❤ by Salla
3
+ */
4
+ import{r as a,c as s,h as e}from"./p-Noi8jmqR.js";import{c as r}from"./p-DnvK1zqm.js";import{S as t}from"./p-CXRKXFgT.js";const d=class{constructor(e){a(this,e),this.rewardModalOpen=s(this,"rewardModalOpen"),this.confirmModalOpen=s(this,"confirmModalOpen"),this.size="md",this.isActionClickable=a=>"free_product"!==a.key?.toLowerCase()||a.is_product_available,this.handleActionArea=()=>{this.rewardModalOpen.emit(this.prize)},this.handleAction=()=>{this.isActionClickable(this.prize)&&(salla.config.isUser()?this.confirmModalOpen.emit(this.prize):r((()=>salla.event.dispatch("login::open"))))}}render(){return e("div",{key:"38c63e250c45badf03516c87496619152b9a0af8",class:{"s-loyalty-program-reward-container":!0,"s-loyalty-program-reward-xs":"xs"===this.size}},e("div",{key:"93e11a5c458aa3112b00bea4bc845733d8bf4415",onClick:this.handleActionArea,role:"button"},e("div",{key:"67f5cfe1a3551832548d95bda9c6bcc6cdd26119",class:"s-loyalty-program-reward-img"},e("img",{key:"36f6dc13da2b7c844d2318d4e9bafeb96d960f11",src:this.prize.image,class:"s-loyalty-program-rewards-img",alt:""})),e("div",{key:"c953cfeebaabdad22fba498903936e170aadcebe",class:"s-loyalty-program-reward-content"},e("div",{key:"68f33aba783ffaef38ea9e4a3f9063b2f68bb2b1",class:"s-loyalty-program-reward-points"},e("salla-badge",{key:"bdac8babbf1bbabeec37e92053c4c7eab178a06f",size:"xs"},e("span",{key:"367f3f154a6079781cece4018337b09996229001",innerHTML:t}),e("span",{key:"fd8cdd6bafe8a8f5f45f7a4e6df2f074ab2b5961",class:"s-loyalty-program-rewards-points"},this.prize.cost_points," ",salla.lang.get("pages.loyalty_program.points")))),e("div",{key:"84f6dbc80ecaa12ab9dacf48ec289bb3f5bdfc84",class:"s-loyalty-program-reward-title"},e("span",{key:"1505f38884417eee9f266ab3ddb2f57096f6d0da"},this.group)),e("div",{key:"82ced1df7118958153868c15c193ac03783dc383",class:"s-loyalty-program-reward-name"},e("div",{key:"a853fc37628c02ffe064608f6e52725d664fc259",class:"s-loyalty-program-rewards-name",id:`prize-${this.prize.id}`},this.prize.name)))),e("div",{key:"584d6db1edfafc846eb8908d2762483d5e590296",class:"p-4"},e("button",{key:"ac0962db5b5d3121b4c6197c4c378db76a963950",onClick:this.handleAction,disabled:!this.isActionClickable(this.prize),class:{"s-loyalty-program-rewards-action-base":!0,"s-loyalty-program-rewards-action-on":this.isActionClickable(this.prize),"s-loyalty-program-rewards-action-off":!this.isActionClickable(this.prize)}},this.isActionClickable(this.prize)?salla.lang.get("pages.loyalty_program.redeem_reward"):salla.lang.get("pages.loyalty_program.out_of_stock"))))}};d.style="";export{d as salla_loyalty_reward}
@@ -0,0 +1,4 @@
1
+ /*!
2
+ * Crafted with ❤ by Salla
3
+ */
4
+ import{r as e,c as t,h as s,H as i}from"./p-Noi8jmqR.js";import{a}from"./p-BedNk7k1.js";const l=class{constructor(s){e(this,s),this.changed=t(this,"changed"),this.min=0,this.max=1e4,this.moreThanLabel="أكثر من",this.lessThanLabel="أقل من",this.toLabel="الى",this.fromLabel="من",this.typing=!1,this.isMin=!1,this.isRTL=salla.config.get("theme.is_rtl",!0),this.filterValues=[]}connectedCallback(){if(this.filtersData&&this.filtersData?.price&&(this.minPrice=this.filtersData.price.min,this.maxPrice=this.filtersData.price.max),salla.lang.onLoaded((()=>{this.moreThanLabel=salla.lang.getWithDefault("common.elements.more_than",this.moreThanLabel),this.lessThanLabel=salla.lang.getWithDefault("common.elements.less_than",this.lessThanLabel),this.toLabel=salla.lang.getWithDefault("common.elements.to",this.toLabel),this.fromLabel=salla.lang.getWithDefault("common.elements.from",this.fromLabel)})),1==this.option.values.length)return;if(this.option.values.length<=5)return void(this.filterValues=this.option.values);const e=Math.ceil(this.option.values.length/5);for(let t=0;t<this.option.values.length;t+=e)this.filterValues.push(this.option.values.slice(t,t+e).reduce(((e,t)=>(e.to=t.to,e.count+=t.count,e))))}async reset(){this.minInput.value=null,this.maxInput.value=null,this.minPrice=null,this.maxPrice=null}getPriceLabel(e){return isNaN(e.from)||e.from<1?`${this.lessThanLabel} ${salla.money(e.to)}`:isNaN(e.to)||e.to<1?`${this.moreThanLabel} ${salla.money(e.from)}`:`${salla.money(e.from)} ${this.toLabel} ${salla.money(e.to)}`}minInputValidation(e){e&&(e>this.max||this.maxPrice&&e>this.maxPrice)||(e<this.min?this.minPrice=this.min:e&&(this.minPrice=e))}maxInputValidation(e){e&&(e<this.min||this.minPrice&&e<this.minPrice)||e>this.max&&(this.maxPrice=this.max)}async changedEventHandler(e){salla.helpers.inputDigitsOnly(this.minInput),salla.helpers.inputDigitsOnly(this.maxInput);const t=this.minPrice?1*+this.minPrice:null,s=this.maxPrice?1*+this.maxPrice:null;this.maxPrice||(this.maxPrice=""),this.isMin?this.minInputValidation(t):(this.minPrice||(this.minPrice=0),this.maxInputValidation(s)),this.isReady&&this.changed.emit({event:e,option:this.option,value:{max:this.maxPrice,min:this.minPrice}})}handleMinMaxPrice(e,t){this.minPrice=t.from,this.maxPrice="*"!==t.to?t.to:"",this.changedEventHandler(e)}isChecked(e){return!(!this.minPrice&&!this.maxPrice)&&(((e.from<1||"*"==e.from)&&0==this.minPrice||e.from==this.minPrice)&&("*"==e.to||!e.to||e.to==this.maxPrice))}handleMinPrice(e){this.isMin=!0;const t=e.target.value;this.minPrice=""===t?0:t}handleMaxPrice(e){this.isMin=!1;const t=e.target.value;this.maxPrice=void 0===t?"":t}render(){return s(i,{key:"996f527f5a36ea273b0d8c195e35dc3efbdf62f2"},this.filterValues.map(((e,t)=>s("label",{class:"s-filters-label",htmlFor:`${this.option.key}-${t}`,key:t},s("input",{id:`${this.option.key}-${t}`,name:"price",type:"radio",checked:this.isChecked(e),class:"s-filters-radio",onChange:t=>this.handleMinMaxPrice(t,e)}),s("span",{innerHTML:this.getPriceLabel(e)})))),s("div",{key:"bfa8f970eb1e9c5d2b9678e5271aa04208b39289",class:"flex justify-center items-center"},s("div",{key:"59cd51f388f36a38e2bd036d27b7abe001fed9d0",class:"relative max-w-xl w-full"},s("div",{key:"226bd18705572502c7da11022a8ce02dc08d4d21",class:"s-price-range-inputs"},s("div",{key:"0ebfdced114308e82075cd153bef0020daa15bf6",class:"s-price-range-relative"},s("div",{key:"c3dacef6133e2b05eca8d643d1c8ce3f5b991548",class:"s-price-range-currency"}," ",salla.config.currency().symbol),s("input",{key:"b2451e091d93f85f268fc80e30e24f5f71c2628c",type:"number",maxlength:"5",ref:e=>this.minInput=e,onBlur:e=>this.handleMinPrice(e),value:this.minPrice,placeholder:this.fromLabel,class:"s-price-range-number-input"})),s("div",{key:"00c07380972b65eac5fac5688b99d21277f65d39",class:"s-price-range-gray-text"}," -"),s("div",{key:"403e98ad682f08946ccd191715ff37401a376722",class:"s-price-range-relative"},s("div",{key:"a1b0729fc40c17b9be68dd2c76a3afa1e99d8a62",class:"s-price-range-currency"}," ",salla.config.currency().symbol),s("input",{key:"5f5e5a202f4b11cde88ae954fa352b71886fe30e",type:"number",maxlength:"5",ref:e=>this.maxInput=e,onBlur:e=>this.handleMaxPrice(e),value:this.maxPrice,placeholder:this.toLabel,class:"s-price-range-number-input","aria-describedby":"price-currency"})),s("salla-button",{key:"dd4899512e03f10c18e74f4d2434406dc6922a50",color:"gray",shape:"icon",size:"small",fill:"outline",onClick:e=>this.changedEventHandler(e)},s("span",{key:"98d023ccfe7e26278259bf690a1d7a4323a704fc",innerHTML:this.isRTL?a:'\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>arrow-right</title>\n<path d="M29.217 15.465c-0.019-0.044-0.056-0.077-0.080-0.119-0.067-0.116-0.139-0.227-0.236-0.317-0.011-0.009-0.013-0.024-0.024-0.033l-10.667-9.333c-0.553-0.484-1.396-0.429-1.881 0.125-0.484 0.555-0.428 1.396 0.127 1.881l7.996 6.997h-20.452c-0.737 0-1.333 0.597-1.333 1.333s0.596 1.333 1.333 1.333h20.452l-7.996 6.997c-0.555 0.485-0.611 1.327-0.127 1.881 0.264 0.3 0.633 0.455 1.004 0.455 0.312 0 0.625-0.109 0.877-0.331l10.667-9.333c0.011-0.009 0.015-0.024 0.024-0.033 0.097-0.091 0.169-0.201 0.236-0.317 0.024-0.041 0.060-0.075 0.080-0.119 0.073-0.163 0.116-0.343 0.116-0.533s-0.043-0.371-0.116-0.535z"></path>\n</svg>\n'}))))))}componentDidLoad(){this.isReady=!0}};l.style=":host{display:block}.rtl .rtl-range-slider,[dir=rtl] .rtl-range-slider{transform:rotateY(180deg)}.rtl .rtl-range-numbers,[dir=rtl] .rtl-range-numbers{flex-direction:row-reverse}.rtl .form-select,.rtl select,[dir=rtl] .form-select,[dir=rtl] select{background-position:left 0.5rem center;padding-right:12px}.rtl .menu-divide li:not(:last-child):after,[dir=rtl] .menu-divide li:not(:last-child):after{left:0;right:auto}input[type=range]::-webkit-slider-thumb{pointer-events:all;width:24px;height:24px;-webkit-appearance:none}[type=checkbox]:checked{background-size:80%}";export{l as salla_price_range}
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r as a,h as t,H as l}from"./p-BYCfehfD.js";const s=class{constructor(t){a(this,t),this.isLoading=!1,this.nextPageUrl="",this.handleClick=()=>{this.loadMoreTransactions()}}componentWillLoad(){return salla.onReady().then((()=>this.loadTransactions()))}async loadTransactions(){this.isLoading=!0;try{let a="/balance/wallet?per_page=10&page=1",t=await salla.api.request(a);this.nextPageUrl=t.data.transactions.next_page_url,this.transactionsArray=t.data.transactions,this.balance=t.data.balance}catch(a){console.error("Error loading wallet transactions",a)}finally{this.isLoading=!1}}async loadMoreTransactions(){this.isLoading=!0;try{let a=this.nextPageUrl||"/balance/wallet?page=2&per_page=10",t=await salla.api.request(a);this.nextPageUrl=t.data.transactions.next_page_url,this.transactionsArray.push(...t.data.transactions.data),this.balance=t.data.balance}catch(a){console.error("Error loading wallet transactions",a)}finally{this.isLoading=!1}}render(){return this.transactionsArray.length>0?t(l,null,t("table",{class:"s-wallet-table"},t("tbody",{class:"s-wallet-table-tbody"},t("tr",{class:"s-table__tr"},t("td",null,t("div",{class:"s-wallet-table-balance-container"},t("i",{class:"s-wallet-table-balance-icon sicon-wallet"}),t("div",null,t("div",{innerHTML:salla.money(this.balance)}),t("div",{class:"font-normal text-gray-400"}," ",salla.lang.get("pages.wallet.balance")))))))),t("h2",{style:{"margin-top":"32px"}},salla.lang.get("pages.wallet.title")),t("table",{class:"s-wallet-table"},t("thead",{class:"s-wallet-table-head"},t("tr",{class:"s-wallet-table-head-tr"},t("th",{scope:"col"},salla.lang.get("pages.wallet.transaction_number")),t("th",{scope:"col",class:"s-wallet-table-head-tr-th"},salla.lang.get("pages.wallet.amount")),t("th",{scope:"col",class:"s-wallet-table-head-tr-th"},salla.lang.get("pages.wallet.date")),t("th",{scope:"col",class:"s-wallet-table-head-tr-th"},salla.lang.get("pages.wallet.order_no")),t("th",{scope:"col",class:"s-wallet-table-head-tr-th"},salla.lang.get("pages.wallet.expiry_date")),t("th",{scope:"col",class:"s-wallet-table-head-tr-th"},salla.lang.get("pages.wallet.transaction_type")," "))),t("tbody",{class:"s-wallet-table-tbody"},this.transactionsArray.map((a=>t("tr",{class:"s-wallet-table-tbody-tr s-wallet-table-tbody-tr-shadow animated"},t("td",{class:"s-wallet-table-tbody-tr-td"},t("div",{class:"s-wallet-table-tbody-tr-td-content"},t("span",{class:"s-wallet-mobile-title"},salla.lang.get("pages.wallet.transaction_number"),":"),a.id&&t("span",{class:"hidden md:inline-block"},"#",a.id),t("div",{class:"flex items-center md:hidden"},t("salla-button",{class:"relative",color:"dark",shape:"link","data-content":a.order_id},a.order_id&&t("span",null,"#",a.order_id))))),t("td",{id:"main123",class:"s-wallet-table-tbody-tr-td"},t("div",{id:"main124",class:"s-wallet-table-tbody-tr-td-content"},t("span",{id:"main125",class:"s-wallet-mobile-title"},salla.lang.get("pages.wallet.amount"),":"),t("div",{innerHTML:salla.money(a.amount)}))),t("td",{class:"s-wallet-table-tbody-tr-td"},t("div",{class:"s-wallet-table-tbody-tr-td-content"},t("span",{class:"s-wallet-mobile-title"},salla.lang.get("pages.wallet.date"),":"),a.created_at&&new Date(1e3*a.created_at).toLocaleDateString(salla.lang.locale,{weekday:"long",year:"numeric",month:"long",day:"numeric",hour:"numeric"}))),t("td",{id:"main133",class:"s-wallet-table-tbody-tr-td"},t("div",{id:"main134",class:"s-wallet-table-tbody-tr-td-content"},t("span",{id:"main135",class:"s-wallet-mobile-title"},salla.lang.get("pages.wallet.order_no"),":"),t("span",{class:"rtl:mr-auto ltr:ml-auto md:mx-0"},a.order_id&&t("span",null,"#",a.order_id)))),t("td",{id:"main143",class:"s-wallet-table-tbody-tr-td"},t("div",{id:"main144",class:"s-wallet-table-tbody-tr-td-content"},t("span",{id:"main145",class:"s-wallet-mobile-title"},salla.lang.get("pages.wallet.expiry_date"),":"),t("span",null,a.expired_at&&new Date(1e3*a.expired_at).toLocaleDateString(salla.lang.locale,{weekday:"long",year:"numeric",month:"long",day:"numeric",hour:"numeric"})))),t("td",{class:"s-wallet-table-tbody-tr-td"},t("div",{class:"s-wallet-table-tbody-tr-td-content"},t("div",null,t("span",{class:"s-wallet-mobile-title"},salla.lang.get("pages.wallet.transaction_type"),":")),t("div",{class:{"s-wallet-table-transaction-status-default":!0,"s-wallet-table-transaction-status-cashback":"cashback"===a.action_type,"s-wallet-table-transaction-status-refund":"refund"===a.action_type,"s-wallet-table-transaction-status-purchase":"purchase_by_wallet"===a.action_type}},!!a.description&&t("i",{id:a.id.toString(),class:"sicon-information text-lg rtl:ml-4 ltr:mr-4 s-wallet-table-transaction-status-icon-success"}),!!a.description&&t("salla-tooltip",{text:a.description,targetId:a.id.toString()}),t("span",null,a.title))))))))),t("div",{class:"s-infinite-scroll-wrapper"},!!this.nextPageUrl&&t("salla-button",{onClick:this.handleClick,loading:this.isLoading},salla.lang.get("common.elements.load_more")))):t(l,null,t("h2",{style:{"margin-top":"32px"}},salla.lang.get("pages.wallet.title")),t("div",{class:"s-wallet-table-empty-state"},t("i",{class:"sicon-full-wallet"}),t("div",{class:"text-center p-3 text-xl font-bold "},salla.lang.get("pages.wallet.no_transactions")),t("div",{class:"text-center text-gray-400 text-sm font-normal "},salla.lang.get("pages.wallet.zero_balance")," ")))}};s.style=".s-wallet-table{min-width:100%}.s-wallet-table-balance-container{display:flex !important;align-items:center !important;justify-content:flex-start !important;gap:1rem}.s-wallet-table-balance-icon{border-radius:50%;width:52px;height:52px;font-size:25px;padding:16px 13px;background:var(--color-primary-reverse);color:var(--color-primary)}.s-wallet-table-empty-state{display:flex;flex-direction:column;align-items:center}.s-wallet-table-empty-state i{font-size:80px;margin:4rem 0 2rem;color:var(--infinte-color)}.s-wallet-table-transaction-status{padding:6px 19px !important;border-radius:20px;width:max-content;display:flex;align-items:center}.s-wallet-table-transaction-status-default{background:#fff6eb;color:#a46f29}.s-wallet-table-transaction-status-cashback{background:#effbf6;color:#00af6c}.s-wallet-table-transaction-status-refund{background:#ecf3fe;color:#5196f3}.s-wallet-table-transaction-status-purchase{background:#feecec;color:#f55157}.s-wallet-table-transaction-status-icons-success{color:#00af6c}";export{s as salla_wallet}
4
+ import{r as a,h as t,H as l}from"./p-Noi8jmqR.js";const s=class{constructor(t){a(this,t),this.isLoading=!1,this.nextPageUrl="",this.handleClick=()=>{this.loadMoreTransactions()}}componentWillLoad(){return salla.onReady().then((()=>this.loadTransactions()))}async loadTransactions(){this.isLoading=!0;try{let a="/balance/wallet?per_page=10&page=1",t=await salla.api.request(a);this.nextPageUrl=t.data.transactions.next_page_url,this.transactionsArray=t.data.transactions,this.balance=t.data.balance}catch(a){console.error("Error loading wallet transactions",a)}finally{this.isLoading=!1}}async loadMoreTransactions(){this.isLoading=!0;try{let a=this.nextPageUrl||"/balance/wallet?page=2&per_page=10",t=await salla.api.request(a);this.nextPageUrl=t.data.transactions.next_page_url,this.transactionsArray.push(...t.data.transactions.data),this.balance=t.data.balance}catch(a){console.error("Error loading wallet transactions",a)}finally{this.isLoading=!1}}render(){return this.transactionsArray.length>0?t(l,null,t("table",{class:"s-wallet-table"},t("tbody",{class:"s-wallet-table-tbody"},t("tr",{class:"s-table__tr"},t("td",null,t("div",{class:"s-wallet-table-balance-container"},t("i",{class:"s-wallet-table-balance-icon sicon-wallet"}),t("div",null,t("div",{innerHTML:salla.money(this.balance)}),t("div",{class:"font-normal text-gray-400"}," ",salla.lang.get("pages.wallet.balance")))))))),t("h2",{style:{"margin-top":"32px"}},salla.lang.get("pages.wallet.title")),t("table",{class:"s-wallet-table"},t("thead",{class:"s-wallet-table-head"},t("tr",{class:"s-wallet-table-head-tr"},t("th",{scope:"col"},salla.lang.get("pages.wallet.transaction_number")),t("th",{scope:"col",class:"s-wallet-table-head-tr-th"},salla.lang.get("pages.wallet.amount")),t("th",{scope:"col",class:"s-wallet-table-head-tr-th"},salla.lang.get("pages.wallet.date")),t("th",{scope:"col",class:"s-wallet-table-head-tr-th"},salla.lang.get("pages.wallet.order_no")),t("th",{scope:"col",class:"s-wallet-table-head-tr-th"},salla.lang.get("pages.wallet.expiry_date")),t("th",{scope:"col",class:"s-wallet-table-head-tr-th"},salla.lang.get("pages.wallet.transaction_type")," "))),t("tbody",{class:"s-wallet-table-tbody"},this.transactionsArray.map((a=>t("tr",{class:"s-wallet-table-tbody-tr s-wallet-table-tbody-tr-shadow animated"},t("td",{class:"s-wallet-table-tbody-tr-td"},t("div",{class:"s-wallet-table-tbody-tr-td-content"},t("span",{class:"s-wallet-mobile-title"},salla.lang.get("pages.wallet.transaction_number"),":"),a.id&&t("span",{class:"hidden md:inline-block"},"#",a.id),t("div",{class:"flex items-center md:hidden"},t("salla-button",{class:"relative",color:"dark",shape:"link","data-content":a.order_id},a.order_id&&t("span",null,"#",a.order_id))))),t("td",{id:"main123",class:"s-wallet-table-tbody-tr-td"},t("div",{id:"main124",class:"s-wallet-table-tbody-tr-td-content"},t("span",{id:"main125",class:"s-wallet-mobile-title"},salla.lang.get("pages.wallet.amount"),":"),t("div",{innerHTML:salla.money(a.amount)}))),t("td",{class:"s-wallet-table-tbody-tr-td"},t("div",{class:"s-wallet-table-tbody-tr-td-content"},t("span",{class:"s-wallet-mobile-title"},salla.lang.get("pages.wallet.date"),":"),a.created_at&&new Date(1e3*a.created_at).toLocaleDateString(salla.lang.locale,{weekday:"long",year:"numeric",month:"long",day:"numeric",hour:"numeric"}))),t("td",{id:"main133",class:"s-wallet-table-tbody-tr-td"},t("div",{id:"main134",class:"s-wallet-table-tbody-tr-td-content"},t("span",{id:"main135",class:"s-wallet-mobile-title"},salla.lang.get("pages.wallet.order_no"),":"),t("span",{class:"rtl:mr-auto ltr:ml-auto md:mx-0"},a.order_id&&t("span",null,"#",a.order_id)))),t("td",{id:"main143",class:"s-wallet-table-tbody-tr-td"},t("div",{id:"main144",class:"s-wallet-table-tbody-tr-td-content"},t("span",{id:"main145",class:"s-wallet-mobile-title"},salla.lang.get("pages.wallet.expiry_date"),":"),t("span",null,a.expired_at&&new Date(1e3*a.expired_at).toLocaleDateString(salla.lang.locale,{weekday:"long",year:"numeric",month:"long",day:"numeric",hour:"numeric"})))),t("td",{class:"s-wallet-table-tbody-tr-td"},t("div",{class:"s-wallet-table-tbody-tr-td-content"},t("div",null,t("span",{class:"s-wallet-mobile-title"},salla.lang.get("pages.wallet.transaction_type"),":")),t("div",{class:{"s-wallet-table-transaction-status-default":!0,"s-wallet-table-transaction-status-cashback":"cashback"===a.action_type,"s-wallet-table-transaction-status-refund":"refund"===a.action_type,"s-wallet-table-transaction-status-purchase":"purchase_by_wallet"===a.action_type}},!!a.description&&t("i",{id:a.id.toString(),class:"sicon-information text-lg rtl:ml-4 ltr:mr-4 s-wallet-table-transaction-status-icon-success"}),!!a.description&&t("salla-tooltip",{text:a.description,targetId:a.id.toString()}),t("span",null,a.title))))))))),t("div",{class:"s-infinite-scroll-wrapper"},!!this.nextPageUrl&&t("salla-button",{onClick:this.handleClick,loading:this.isLoading},salla.lang.get("common.elements.load_more")))):t(l,null,t("h2",{style:{"margin-top":"32px"}},salla.lang.get("pages.wallet.title")),t("div",{class:"s-wallet-table-empty-state"},t("i",{class:"sicon-full-wallet"}),t("div",{class:"text-center p-3 text-xl font-bold "},salla.lang.get("pages.wallet.no_transactions")),t("div",{class:"text-center text-gray-400 text-sm font-normal "},salla.lang.get("pages.wallet.zero_balance")," ")))}};s.style=".s-wallet-table{min-width:100%}.s-wallet-table-balance-container{display:flex !important;align-items:center !important;justify-content:flex-start !important;gap:1rem}.s-wallet-table-balance-icon{border-radius:50%;width:52px;height:52px;font-size:25px;padding:16px 13px;background:var(--color-primary-reverse);color:var(--color-primary)}.s-wallet-table-empty-state{display:flex;flex-direction:column;align-items:center}.s-wallet-table-empty-state i{font-size:80px;margin:4rem 0 2rem;color:var(--infinte-color)}.s-wallet-table-transaction-status{padding:6px 19px !important;border-radius:20px;width:max-content;display:flex;align-items:center}.s-wallet-table-transaction-status-default{background:#fff6eb;color:#a46f29}.s-wallet-table-transaction-status-cashback{background:#effbf6;color:#00af6c}.s-wallet-table-transaction-status-refund{background:#ecf3fe;color:#5196f3}.s-wallet-table-transaction-status-purchase{background:#feecec;color:#f55157}.s-wallet-table-transaction-status-icons-success{color:#00af6c}";export{s as salla_wallet}
@@ -0,0 +1,4 @@
1
+ /*!
2
+ * Crafted with ❤ by Salla
3
+ */
4
+ import{r as i,h as c}from"./p-Noi8jmqR.js";const t=class{constructor(c){i(this,c)}render(){return c("a",{key:"c134f5fc8901762ed8fa4a53aed5fd5ec62df689",href:this.notification.url,class:{"s-notifications-item":!0,"s-notifications-item-shadow":!0,"s-notifications-item-read":!this.notification.is_new}},c("span",{key:"78fbafd1dd2998dba7e3a1ad8b34cbeb9e962cf2",class:"s-notifications-item-icon"},c("i",{key:"61357a8087938b3ffae36387a6d8b79979704dba",class:{"s-notifications-item-icon sicon-bell-ring":!0,"s-notifications-item-icon-new":this.notification.is_new}})),c("div",{key:"67c85332e868f4dbb2099524e441d64211d1ba1f",class:"s-notifications-item-content"},c("div",{key:"c7f79cb902edd54f171b8e3c089aa0f6795ca2a2",class:"s-notifications-item-content-leading"},c("h4",{key:"078d34e4cc8093ded2dc3c948100337acfe0101e"},this.notification.title),c("p",{key:"30c20f5308761bcd4011052b2fc8c6f87698a8f9"},this.notification.sub_title)),c("span",{key:"db1f387f53c747bccb3836cf8622f9f67af3a654",class:"s-notifications-item-content-trailing"},c("i",{key:"2f662b2dbff1487831681586c15d17c1a2e68eaa",class:"sicon-time s-notifications-item-content-trailing-icon"}),c("span",{key:"119e37704dc78372f3340fc33df69e20b666a7c5"},this.notification.date))))}};t.style="";export{t as salla_notification_item}