@salla.sa/twilight-components 2.14.486 → 2.14.488

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 (353) hide show
  1. package/dist/cjs/{Helper-DvyEpCgx.js → Helper-B2B-kxAI.js} +7 -2
  2. package/dist/cjs/{filepond-BtDP9OW9.js → filepond-05NO31dc.js} +1 -1
  3. package/dist/cjs/{filepond-plugin-file-poster-CTf1Ej_n.js → filepond-plugin-file-poster-BSzyn1DL.js} +1 -1
  4. package/dist/cjs/{filepond-plugin-file-validate-size-_wVJpYXF.js → filepond-plugin-file-validate-size-DJKsosMa.js} +1 -1
  5. package/dist/cjs/{filepond-plugin-file-validate-type-DWoo5Lcs.js → filepond-plugin-file-validate-type-C0xLud1P.js} +1 -1
  6. package/dist/cjs/{filepond-plugin-image-edit-DBb_5aN9.js → filepond-plugin-image-edit-Dq1zXDYS.js} +1 -1
  7. package/dist/cjs/{filepond-plugin-image-exif-orientation-Nnwt-m9k.js → filepond-plugin-image-exif-orientation-B84Q7JSN.js} +1 -1
  8. package/dist/cjs/{filepond-plugin-image-preview-CjBwZm3E.js → filepond-plugin-image-preview-BaE9P79l.js} +1 -1
  9. package/dist/cjs/{functions-DkS9Jmao.js → functions-B-_Pnqnt.js} +1 -1
  10. package/dist/cjs/{index-C0yFagl6.js → index-BsvV4QQg.js} +1 -1
  11. package/dist/cjs/{index-C_WIlgE2.js → index-f6loD1zL.js} +10 -2
  12. package/dist/cjs/loader.cjs.js +2 -2
  13. package/dist/cjs/salla-accordion-body_2.cjs.entry.js +1 -1
  14. package/dist/cjs/salla-accordion_6.cjs.entry.js +4 -3
  15. package/dist/cjs/salla-add-product-button_5.cjs.entry.js +2 -2
  16. package/dist/cjs/salla-advertisement.cjs.entry.js +1 -1
  17. package/dist/cjs/salla-alert_2.cjs.entry.js +1 -1
  18. package/dist/cjs/salla-app-install-alert.cjs.entry.js +1 -1
  19. package/dist/cjs/salla-apps-icons.cjs.entry.js +1 -1
  20. package/dist/cjs/salla-badge.cjs.entry.js +1 -1
  21. package/dist/cjs/salla-booking-field_7.cjs.entry.js +11 -11
  22. package/dist/cjs/salla-bullet-delivery_2.cjs.entry.js +21 -13
  23. package/dist/cjs/salla-cart-coupons.cjs.entry.js +1 -1
  24. package/dist/cjs/salla-cart-item-offers_2.cjs.entry.js +1 -1
  25. package/dist/cjs/salla-cart-summary-card.cjs.entry.js +349 -0
  26. package/dist/cjs/salla-cashback-banner.cjs.entry.js +1 -1
  27. package/dist/cjs/salla-comment-form_8.cjs.entry.js +2 -2
  28. package/dist/cjs/salla-conditional-offer.cjs.entry.js +1 -1
  29. package/dist/cjs/salla-contacts.cjs.entry.js +1 -1
  30. package/dist/cjs/salla-cookies-bar.cjs.entry.js +1 -1
  31. package/dist/cjs/salla-count-down.cjs.entry.js +1 -1
  32. package/dist/cjs/salla-custom-fields.cjs.entry.js +1 -1
  33. package/dist/cjs/salla-delivery-promise.cjs.entry.js +1 -1
  34. package/dist/cjs/salla-edit-order-button.cjs.entry.js +1 -1
  35. package/dist/cjs/salla-filters-widget.cjs.entry.js +15 -8
  36. package/dist/cjs/salla-filters.cjs.entry.js +101 -13
  37. package/dist/cjs/salla-fulfillment-methods.cjs.entry.js +1 -1
  38. package/dist/cjs/salla-gifting.cjs.entry.js +1 -1
  39. package/dist/cjs/salla-hook.cjs.entry.js +1 -1
  40. package/dist/cjs/salla-infinite-scroll.cjs.entry.js +2 -2
  41. package/dist/cjs/salla-installment.cjs.entry.js +1 -1
  42. package/dist/cjs/salla-list-tile.cjs.entry.js +1 -1
  43. package/dist/cjs/salla-localization-modal.cjs.entry.js +1 -1
  44. package/dist/cjs/salla-login-modal.cjs.entry.js +1 -1
  45. package/dist/cjs/salla-loyalty-banner.cjs.entry.js +2 -2
  46. package/dist/cjs/salla-loyalty-hero_2.cjs.entry.js +2 -2
  47. package/dist/cjs/salla-loyalty-panel.cjs.entry.js +3 -3
  48. package/dist/cjs/salla-loyalty-points-banner.cjs.entry.js +1 -1
  49. package/dist/cjs/salla-loyalty-points-history.cjs.entry.js +1 -1
  50. package/dist/cjs/salla-loyalty-prize-item.cjs.entry.js +1 -1
  51. package/dist/cjs/salla-loyalty-program.cjs.entry.js +3 -3
  52. package/dist/cjs/salla-loyalty-reward.cjs.entry.js +2 -2
  53. package/dist/cjs/salla-loyalty.cjs.entry.js +1 -1
  54. package/dist/cjs/salla-maintenance-alert.cjs.entry.js +1 -1
  55. package/dist/cjs/salla-map_2.cjs.entry.js +1 -1
  56. package/dist/cjs/salla-menu.cjs.entry.js +1 -1
  57. package/dist/cjs/salla-metadata.cjs.entry.js +1 -1
  58. package/dist/cjs/salla-multiple-bundle-product-cart_2.cjs.entry.js +1 -1
  59. package/dist/cjs/salla-multiple-bundle-product-options-modal_2.cjs.entry.js +1 -1
  60. package/dist/cjs/salla-multiple-bundle-product.cjs.entry.js +1 -1
  61. package/dist/cjs/salla-next-order-coupon.cjs.entry.js +1 -1
  62. package/dist/cjs/salla-notification-item.cjs.entry.js +1 -1
  63. package/dist/cjs/salla-notifications.cjs.entry.js +2 -2
  64. package/dist/cjs/salla-offer-modal.cjs.entry.js +1 -1
  65. package/dist/cjs/salla-offer.cjs.entry.js +1 -1
  66. package/dist/cjs/salla-order-branch.cjs.entry.js +1 -1
  67. package/dist/cjs/salla-order-cancel.cjs.entry.js +296 -0
  68. package/dist/cjs/salla-order-details-multiple-bundle-product.cjs.entry.js +1 -1
  69. package/dist/cjs/salla-order-details-options.cjs.entry.js +1 -1
  70. package/dist/cjs/salla-order-details.cjs.entry.js +1 -1
  71. package/dist/cjs/salla-order-edit-item.cjs.entry.js +1 -1
  72. package/dist/cjs/salla-order-edit-product-card.cjs.entry.js +1 -1
  73. package/dist/cjs/salla-order-edit.cjs.entry.js +1 -1
  74. package/dist/cjs/salla-order-options-modal_3.cjs.entry.js +2 -2
  75. package/dist/cjs/salla-order-summary.cjs.entry.js +1 -1
  76. package/dist/cjs/salla-order-totals-card.cjs.entry.js +1 -1
  77. package/dist/cjs/salla-orders.cjs.entry.js +2 -2
  78. package/dist/cjs/salla-payments.cjs.entry.js +1 -1
  79. package/dist/cjs/salla-placeholder.cjs.entry.js +1 -1
  80. package/dist/cjs/salla-price-range.cjs.entry.js +1 -1
  81. package/dist/cjs/salla-product-card-embed.cjs.entry.js +1 -1
  82. package/dist/cjs/salla-product-size-guide.cjs.entry.js +1 -1
  83. package/dist/cjs/salla-products-list.cjs.entry.js +21 -9
  84. package/dist/cjs/salla-quick-order.cjs.entry.js +1 -1
  85. package/dist/cjs/salla-rating-modal.cjs.entry.js +2 -2
  86. package/dist/cjs/salla-reward-action_4.cjs.entry.js +3 -3
  87. package/dist/cjs/salla-scopes.cjs.entry.js +1 -1
  88. package/dist/cjs/salla-search.cjs.entry.js +2 -2
  89. package/dist/cjs/salla-skeleton.cjs.entry.js +1 -1
  90. package/dist/cjs/salla-slider.cjs.entry.js +1 -1
  91. package/dist/cjs/salla-social-share.cjs.entry.js +1 -1
  92. package/dist/cjs/salla-social.cjs.entry.js +1 -1
  93. package/dist/cjs/salla-tab-content_3.cjs.entry.js +1 -1
  94. package/dist/cjs/salla-tiered-offer.cjs.entry.js +1 -1
  95. package/dist/cjs/salla-tooltip.cjs.entry.js +1 -1
  96. package/dist/cjs/salla-trust-badges.cjs.entry.js +1 -1
  97. package/dist/cjs/salla-user-menu.cjs.entry.js +5 -2
  98. package/dist/cjs/salla-user-profile.cjs.entry.js +1 -1
  99. package/dist/cjs/salla-user-settings.cjs.entry.js +1 -1
  100. package/dist/cjs/salla-verify.cjs.entry.js +1 -1
  101. package/dist/cjs/salla-wallet.cjs.entry.js +1 -1
  102. package/dist/cjs/salla-wishlist-actions.cjs.entry.js +1 -1
  103. package/dist/cjs/{tracked-promise-TyxTPR6e.js → tracked-promise-We1h_qB4.js} +1 -1
  104. package/dist/cjs/twilight.cjs.js +2 -2
  105. package/dist/cjs/{vanilla-picker-DyJFw96R.js → vanilla-picker-Ck8OFt14.js} +1 -1
  106. package/dist/collection/Helpers/Helper.js +7 -2
  107. package/dist/collection/collection-manifest.json +2 -0
  108. package/dist/collection/components/salla-breadcrumb/salla-breadcrumb.js +2 -1
  109. package/dist/collection/components/salla-bullet-delivery/salla-bullet-delivery.js +20 -12
  110. package/dist/collection/components/salla-cart-summary-card/salla-cart-summary-card.js +401 -0
  111. package/dist/collection/components/salla-filters/salla-filters.css +5 -0
  112. package/dist/collection/components/salla-filters/salla-filters.js +101 -11
  113. package/dist/collection/components/salla-filters-widget/salla-filters-widget.js +13 -6
  114. package/dist/collection/components/salla-order-cancel/interfaces.js +1 -0
  115. package/dist/collection/components/salla-order-cancel/salla-order-cancel.css +17 -0
  116. package/dist/collection/components/salla-order-cancel/salla-order-cancel.js +366 -0
  117. package/dist/collection/components/salla-products-list/salla-products-list.js +19 -7
  118. package/dist/collection/components/salla-user-menu/salla-user-menu.js +4 -1
  119. package/dist/components/Helper.js +7 -2
  120. package/dist/components/index.js +2 -2
  121. package/dist/components/salla-breadcrumb.js +2 -1
  122. package/dist/components/salla-bullet-delivery.js +20 -12
  123. package/dist/components/salla-cart-summary-card.d.ts +11 -0
  124. package/dist/components/salla-cart-summary-card.js +404 -0
  125. package/dist/components/salla-filters-widget2.js +13 -6
  126. package/dist/components/salla-filters.js +101 -11
  127. package/dist/components/salla-order-cancel.d.ts +11 -0
  128. package/dist/components/salla-order-cancel.js +347 -0
  129. package/dist/components/salla-products-list2.js +19 -7
  130. package/dist/components/salla-user-menu.js +4 -1
  131. package/dist/esm/{Helper-CD8d-Brd.js → Helper-BQ9mvrt9.js} +7 -2
  132. package/dist/esm/{filepond-ZiatSU0Y.js → filepond-2lHD_yVt.js} +1 -1
  133. package/dist/esm/{filepond-plugin-file-poster-2WAWdRm2.js → filepond-plugin-file-poster-DIjVVIwh.js} +1 -1
  134. package/dist/esm/{filepond-plugin-file-validate-size-DhLjP7aF.js → filepond-plugin-file-validate-size-CfcICNJA.js} +1 -1
  135. package/dist/esm/{filepond-plugin-file-validate-type-HH8AZXAq.js → filepond-plugin-file-validate-type-DsvYMiJr.js} +1 -1
  136. package/dist/esm/{filepond-plugin-image-edit-BWBtBfk1.js → filepond-plugin-image-edit-B7K5Ib7q.js} +1 -1
  137. package/dist/esm/{filepond-plugin-image-exif-orientation-CQyPB3lV.js → filepond-plugin-image-exif-orientation-9iz6i-up.js} +1 -1
  138. package/dist/esm/{filepond-plugin-image-preview-D6MiVWr1.js → filepond-plugin-image-preview-C89IBH1s.js} +1 -1
  139. package/dist/esm/{functions-DflaFDbL.js → functions-CJdqLH4P.js} +1 -1
  140. package/dist/esm/{index-Co2lT5R8.js → index-D1YskPUH.js} +1 -1
  141. package/dist/esm/{index-BF901xIc.js → index-K0OclOPO.js} +10 -2
  142. package/dist/esm/loader.js +3 -3
  143. package/dist/esm/salla-accordion-body_2.entry.js +1 -1
  144. package/dist/esm/salla-accordion_6.entry.js +4 -3
  145. package/dist/esm/salla-add-product-button_5.entry.js +2 -2
  146. package/dist/esm/salla-advertisement.entry.js +1 -1
  147. package/dist/esm/salla-alert_2.entry.js +1 -1
  148. package/dist/esm/salla-app-install-alert.entry.js +1 -1
  149. package/dist/esm/salla-apps-icons.entry.js +1 -1
  150. package/dist/esm/salla-badge.entry.js +1 -1
  151. package/dist/esm/salla-booking-field_7.entry.js +11 -11
  152. package/dist/esm/salla-bullet-delivery_2.entry.js +21 -13
  153. package/dist/esm/salla-cart-coupons.entry.js +1 -1
  154. package/dist/esm/salla-cart-item-offers_2.entry.js +1 -1
  155. package/dist/esm/salla-cart-summary-card.entry.js +347 -0
  156. package/dist/esm/salla-cashback-banner.entry.js +1 -1
  157. package/dist/esm/salla-comment-form_8.entry.js +2 -2
  158. package/dist/esm/salla-conditional-offer.entry.js +1 -1
  159. package/dist/esm/salla-contacts.entry.js +1 -1
  160. package/dist/esm/salla-cookies-bar.entry.js +1 -1
  161. package/dist/esm/salla-count-down.entry.js +1 -1
  162. package/dist/esm/salla-custom-fields.entry.js +1 -1
  163. package/dist/esm/salla-delivery-promise.entry.js +1 -1
  164. package/dist/esm/salla-edit-order-button.entry.js +1 -1
  165. package/dist/esm/salla-filters-widget.entry.js +15 -8
  166. package/dist/esm/salla-filters.entry.js +101 -13
  167. package/dist/esm/salla-fulfillment-methods.entry.js +1 -1
  168. package/dist/esm/salla-gifting.entry.js +1 -1
  169. package/dist/esm/salla-hook.entry.js +1 -1
  170. package/dist/esm/salla-infinite-scroll.entry.js +2 -2
  171. package/dist/esm/salla-installment.entry.js +1 -1
  172. package/dist/esm/salla-list-tile.entry.js +1 -1
  173. package/dist/esm/salla-localization-modal.entry.js +1 -1
  174. package/dist/esm/salla-login-modal.entry.js +1 -1
  175. package/dist/esm/salla-loyalty-banner.entry.js +2 -2
  176. package/dist/esm/salla-loyalty-hero_2.entry.js +2 -2
  177. package/dist/esm/salla-loyalty-panel.entry.js +3 -3
  178. package/dist/esm/salla-loyalty-points-banner.entry.js +1 -1
  179. package/dist/esm/salla-loyalty-points-history.entry.js +1 -1
  180. package/dist/esm/salla-loyalty-prize-item.entry.js +1 -1
  181. package/dist/esm/salla-loyalty-program.entry.js +3 -3
  182. package/dist/esm/salla-loyalty-reward.entry.js +2 -2
  183. package/dist/esm/salla-loyalty.entry.js +1 -1
  184. package/dist/esm/salla-maintenance-alert.entry.js +1 -1
  185. package/dist/esm/salla-map_2.entry.js +1 -1
  186. package/dist/esm/salla-menu.entry.js +1 -1
  187. package/dist/esm/salla-metadata.entry.js +1 -1
  188. package/dist/esm/salla-multiple-bundle-product-cart_2.entry.js +1 -1
  189. package/dist/esm/salla-multiple-bundle-product-options-modal_2.entry.js +1 -1
  190. package/dist/esm/salla-multiple-bundle-product.entry.js +1 -1
  191. package/dist/esm/salla-next-order-coupon.entry.js +1 -1
  192. package/dist/esm/salla-notification-item.entry.js +1 -1
  193. package/dist/esm/salla-notifications.entry.js +2 -2
  194. package/dist/esm/salla-offer-modal.entry.js +1 -1
  195. package/dist/esm/salla-offer.entry.js +1 -1
  196. package/dist/esm/salla-order-branch.entry.js +1 -1
  197. package/dist/esm/salla-order-cancel.entry.js +294 -0
  198. package/dist/esm/salla-order-details-multiple-bundle-product.entry.js +1 -1
  199. package/dist/esm/salla-order-details-options.entry.js +1 -1
  200. package/dist/esm/salla-order-details.entry.js +1 -1
  201. package/dist/esm/salla-order-edit-item.entry.js +1 -1
  202. package/dist/esm/salla-order-edit-product-card.entry.js +1 -1
  203. package/dist/esm/salla-order-edit.entry.js +1 -1
  204. package/dist/esm/salla-order-options-modal_3.entry.js +2 -2
  205. package/dist/esm/salla-order-summary.entry.js +1 -1
  206. package/dist/esm/salla-order-totals-card.entry.js +1 -1
  207. package/dist/esm/salla-orders.entry.js +2 -2
  208. package/dist/esm/salla-payments.entry.js +1 -1
  209. package/dist/esm/salla-placeholder.entry.js +1 -1
  210. package/dist/esm/salla-price-range.entry.js +1 -1
  211. package/dist/esm/salla-product-card-embed.entry.js +1 -1
  212. package/dist/esm/salla-product-size-guide.entry.js +1 -1
  213. package/dist/esm/salla-products-list.entry.js +21 -9
  214. package/dist/esm/salla-quick-order.entry.js +1 -1
  215. package/dist/esm/salla-rating-modal.entry.js +2 -2
  216. package/dist/esm/salla-reward-action_4.entry.js +3 -3
  217. package/dist/esm/salla-scopes.entry.js +1 -1
  218. package/dist/esm/salla-search.entry.js +2 -2
  219. package/dist/esm/salla-skeleton.entry.js +1 -1
  220. package/dist/esm/salla-slider.entry.js +1 -1
  221. package/dist/esm/salla-social-share.entry.js +1 -1
  222. package/dist/esm/salla-social.entry.js +1 -1
  223. package/dist/esm/salla-tab-content_3.entry.js +1 -1
  224. package/dist/esm/salla-tiered-offer.entry.js +1 -1
  225. package/dist/esm/salla-tooltip.entry.js +1 -1
  226. package/dist/esm/salla-trust-badges.entry.js +1 -1
  227. package/dist/esm/salla-user-menu.entry.js +5 -2
  228. package/dist/esm/salla-user-profile.entry.js +1 -1
  229. package/dist/esm/salla-user-settings.entry.js +1 -1
  230. package/dist/esm/salla-verify.entry.js +1 -1
  231. package/dist/esm/salla-wallet.entry.js +1 -1
  232. package/dist/esm/salla-wishlist-actions.entry.js +1 -1
  233. package/dist/esm/{tracked-promise-CNdO8SSl.js → tracked-promise-yWzlErXb.js} +1 -1
  234. package/dist/esm/twilight.js +3 -3
  235. package/dist/esm/{vanilla-picker-YVpipuL-.js → vanilla-picker-Bwq5IBwq.js} +1 -1
  236. package/dist/twilight/{p-6976c445.entry.js → p-04612ed4.entry.js} +1 -1
  237. package/dist/twilight/{p-7ce2c5ca.entry.js → p-0be72b27.entry.js} +1 -1
  238. package/dist/twilight/{p-e692322c.entry.js → p-0f6a9e5e.entry.js} +1 -1
  239. package/dist/twilight/{p-9f6a0804.entry.js → p-12d485db.entry.js} +1 -1
  240. package/dist/twilight/{p-4b0aa371.entry.js → p-168bfefc.entry.js} +1 -1
  241. package/dist/twilight/{p-f4564fdc.entry.js → p-1695dd23.entry.js} +1 -1
  242. package/dist/twilight/p-18c99d79.entry.js +4 -0
  243. package/dist/twilight/{p-d4eeed4b.entry.js → p-1abccd80.entry.js} +1 -1
  244. package/dist/twilight/{p-fe69512c.entry.js → p-1ec309ad.entry.js} +1 -1
  245. package/dist/twilight/{p-f5e943bb.entry.js → p-2368ab21.entry.js} +1 -1
  246. package/dist/twilight/{p-b7b29da3.entry.js → p-24eb59ac.entry.js} +1 -1
  247. package/dist/twilight/{p-9b2f674f.entry.js → p-283b7a09.entry.js} +1 -1
  248. package/dist/twilight/{p-c5050e10.entry.js → p-28eea468.entry.js} +1 -1
  249. package/dist/twilight/{p-cd4b2301.entry.js → p-2ea6c5c6.entry.js} +1 -1
  250. package/dist/twilight/{p-f71a7a24.entry.js → p-30796ada.entry.js} +1 -1
  251. package/dist/twilight/{p-18ad7499.entry.js → p-327d33c2.entry.js} +1 -1
  252. package/dist/twilight/{p-0c36ee7c.entry.js → p-363417b6.entry.js} +1 -1
  253. package/dist/twilight/{p-bd0075c9.entry.js → p-387e06ce.entry.js} +1 -1
  254. package/dist/twilight/{p-67b225d5.entry.js → p-38c82b5b.entry.js} +1 -1
  255. package/dist/twilight/{p-DwHaUky6.js → p-3Yh5uCQZ.js} +1 -1
  256. package/dist/twilight/{p-02350ded.entry.js → p-3cee41e1.entry.js} +1 -1
  257. package/dist/twilight/p-3e9bba4f.entry.js +4 -0
  258. package/dist/twilight/{p-3eb54d75.entry.js → p-3f1913e0.entry.js} +1 -1
  259. package/dist/twilight/{p-a853a50f.entry.js → p-416e7ea9.entry.js} +1 -1
  260. package/dist/twilight/{p-beb2df03.entry.js → p-44819d23.entry.js} +1 -1
  261. package/dist/twilight/{p-a4107435.entry.js → p-44ed9315.entry.js} +1 -1
  262. package/dist/twilight/{p-DVM0Orh8.js → p-4Xs3NevL.js} +1 -1
  263. package/dist/twilight/{p-0e2a2a9a.entry.js → p-4bdd0eab.entry.js} +1 -1
  264. package/dist/twilight/{p-77b6fbf2.entry.js → p-4df90b34.entry.js} +1 -1
  265. package/dist/twilight/{p-ce8571e3.entry.js → p-4e16be16.entry.js} +1 -1
  266. package/dist/twilight/{p-134988db.entry.js → p-507e04b3.entry.js} +1 -1
  267. package/dist/twilight/{p-4544ca7d.entry.js → p-52df99a3.entry.js} +1 -1
  268. package/dist/twilight/{p-0fcc3b26.entry.js → p-54047fdd.entry.js} +1 -1
  269. package/dist/twilight/p-5dbdf0e7.entry.js +4 -0
  270. package/dist/twilight/{p-a7d99355.entry.js → p-5dc0f3c0.entry.js} +1 -1
  271. package/dist/twilight/{p-22405eaa.entry.js → p-5effd85b.entry.js} +2 -2
  272. package/dist/twilight/{p-8f9e0a7a.entry.js → p-62e99802.entry.js} +1 -1
  273. package/dist/twilight/{p-c590dcf0.entry.js → p-680e0dca.entry.js} +1 -1
  274. package/dist/twilight/{p-f32df318.entry.js → p-6e6f4879.entry.js} +1 -1
  275. package/dist/twilight/{p-KNG8mGcV.js → p-6iwUgroX.js} +1 -1
  276. package/dist/twilight/{p-f5e55c13.entry.js → p-72bc40b3.entry.js} +1 -1
  277. package/dist/twilight/{p-d3f904d0.entry.js → p-75345728.entry.js} +1 -1
  278. package/dist/twilight/{p-d2cc8587.entry.js → p-76f06b0a.entry.js} +1 -1
  279. package/dist/twilight/{p-43ab561c.entry.js → p-7a738892.entry.js} +1 -1
  280. package/dist/twilight/{p-e304cb5e.entry.js → p-7ab11977.entry.js} +1 -1
  281. package/dist/twilight/p-7cfe5dbf.entry.js +4 -0
  282. package/dist/twilight/{p-1d3efd00.entry.js → p-868b6dcc.entry.js} +1 -1
  283. package/dist/twilight/{p-a6afc8ab.entry.js → p-8878ec9e.entry.js} +1 -1
  284. package/dist/twilight/{p-9db7e318.entry.js → p-8a274920.entry.js} +1 -1
  285. package/dist/twilight/{p-2192d7c2.entry.js → p-8b2fb172.entry.js} +1 -1
  286. package/dist/twilight/{p-368d3b26.entry.js → p-8b45c13a.entry.js} +1 -1
  287. package/dist/twilight/{p-d1048676.entry.js → p-8ba7b32d.entry.js} +1 -1
  288. package/dist/twilight/{p-6b9780be.entry.js → p-8f204414.entry.js} +1 -1
  289. package/dist/twilight/{p-bcfe04fa.entry.js → p-906dfda7.entry.js} +1 -1
  290. package/dist/twilight/{p-4427e994.entry.js → p-90976775.entry.js} +1 -1
  291. package/dist/twilight/{p-4288893b.entry.js → p-917bae25.entry.js} +1 -1
  292. package/dist/twilight/{p-b8d180fe.entry.js → p-95c6ca83.entry.js} +1 -1
  293. package/dist/twilight/{p-b32e5ad7.entry.js → p-997a1fdf.entry.js} +1 -1
  294. package/dist/twilight/{p-dc093d27.entry.js → p-9cb07624.entry.js} +1 -1
  295. package/dist/twilight/{p-d6da8710.entry.js → p-9d51f43d.entry.js} +1 -1
  296. package/dist/twilight/{p-aa928350.entry.js → p-9dc6f28e.entry.js} +1 -1
  297. package/dist/twilight/{p-c01e3f1d.entry.js → p-9efc4b59.entry.js} +1 -1
  298. package/dist/twilight/{p-CMmiX5T8.js → p-BF7QVpUp.js} +1 -1
  299. package/dist/twilight/{p-gacShRe2.js → p-BHY6Sj5y.js} +1 -1
  300. package/dist/twilight/{p-BPGtYFVu.js → p-BZ24UYWJ.js} +1 -1
  301. package/dist/twilight/{p-BuOjsqYX.js → p-BgI56yKL.js} +1 -1
  302. package/dist/twilight/{p-CwLXCdYY.js → p-Bnnviqjp.js} +1 -1
  303. package/dist/twilight/{p-BrcsejOr.js → p-CJRTPVPy.js} +1 -1
  304. package/dist/twilight/{p-BEb9UIZ7.js → p-DTwxTvVu.js} +1 -1
  305. package/dist/twilight/{p-Bmy5YF6e.js → p-DZu6rifA.js} +1 -1
  306. package/dist/twilight/{p-BF901xIc.js → p-K0OclOPO.js} +1 -1
  307. package/dist/twilight/p-XnA1YTjA.js +4 -0
  308. package/dist/twilight/{p-1a8525af.entry.js → p-b2a12062.entry.js} +1 -1
  309. package/dist/twilight/{p-4b558e37.entry.js → p-b69cc47d.entry.js} +1 -1
  310. package/dist/twilight/{p-be632d40.entry.js → p-bb7d240f.entry.js} +1 -1
  311. package/dist/twilight/{p-5476bd33.entry.js → p-bd50d1c4.entry.js} +1 -1
  312. package/dist/twilight/{p-1c4e7c18.entry.js → p-c01100d0.entry.js} +1 -1
  313. package/dist/twilight/{p-04f5d67b.entry.js → p-c19cdf96.entry.js} +1 -1
  314. package/dist/twilight/{p-a5895e0f.entry.js → p-c1b56f08.entry.js} +1 -1
  315. package/dist/twilight/{p-2eb78125.entry.js → p-c1e7fe98.entry.js} +1 -1
  316. package/dist/twilight/{p-ce633fa0.entry.js → p-c497fa37.entry.js} +1 -1
  317. package/dist/twilight/p-c6026f2e.entry.js +4 -0
  318. package/dist/twilight/{p-4e2f144a.entry.js → p-cb475d27.entry.js} +1 -1
  319. package/dist/twilight/{p-ed1e0c2e.entry.js → p-cb9501dc.entry.js} +1 -1
  320. package/dist/twilight/{p-5c37420e.entry.js → p-ccbf4eea.entry.js} +1 -1
  321. package/dist/twilight/{p-a445225d.entry.js → p-cd11cafc.entry.js} +1 -1
  322. package/dist/twilight/{p-f3b24cce.entry.js → p-cdfe32c9.entry.js} +1 -1
  323. package/dist/twilight/{p-d92a7d91.entry.js → p-d1b3e98b.entry.js} +1 -1
  324. package/dist/twilight/{p-8f006eca.entry.js → p-d5bbdd47.entry.js} +1 -1
  325. package/dist/twilight/{p-518bab79.entry.js → p-d6ace1e8.entry.js} +1 -1
  326. package/dist/twilight/{p-85b235dc.entry.js → p-db3da75c.entry.js} +1 -1
  327. package/dist/twilight/p-df6739de.entry.js +4 -0
  328. package/dist/twilight/{p-ad5c8d34.entry.js → p-e10eed6e.entry.js} +1 -1
  329. package/dist/twilight/{p-2b58b700.entry.js → p-e30f415c.entry.js} +1 -1
  330. package/dist/twilight/{p-b2a11170.entry.js → p-e52bbc5f.entry.js} +1 -1
  331. package/dist/twilight/{p-a047ed06.entry.js → p-e9439252.entry.js} +1 -1
  332. package/dist/twilight/p-eeb0e354.entry.js +4 -0
  333. package/dist/twilight/{p-0d94f890.entry.js → p-f4b040f0.entry.js} +1 -1
  334. package/dist/twilight/{p-90c58cc5.entry.js → p-f5242092.entry.js} +1 -1
  335. package/dist/twilight/{p-506a2720.entry.js → p-f6c20f25.entry.js} +1 -1
  336. package/dist/twilight/{p-2e4fe427.entry.js → p-f97717b9.entry.js} +1 -1
  337. package/dist/twilight/{p-ce38e5a1.entry.js → p-fb9f7001.entry.js} +1 -1
  338. package/dist/twilight/{p-c92915e0.entry.js → p-fe6e676c.entry.js} +1 -1
  339. package/dist/twilight/twilight.esm.js +1 -1
  340. package/dist/types/components/salla-cart-summary-card/salla-cart-summary-card.d.ts +67 -0
  341. package/dist/types/components/salla-filters/salla-filters.d.ts +14 -0
  342. package/dist/types/components/salla-order-cancel/interfaces.d.ts +20 -0
  343. package/dist/types/components/salla-order-cancel/salla-order-cancel.d.ts +42 -0
  344. package/dist/types/components/salla-products-list/salla-products-list.d.ts +1 -0
  345. package/dist/types/components/salla-user-menu/salla-user-menu.d.ts +1 -0
  346. package/dist/types/components.d.ts +68 -0
  347. package/package.json +5 -5
  348. package/dist/twilight/p-2cc32d1f.entry.js +0 -4
  349. package/dist/twilight/p-3d732135.entry.js +0 -4
  350. package/dist/twilight/p-632766e3.entry.js +0 -4
  351. package/dist/twilight/p-C-3GuKNW.js +0 -4
  352. package/dist/twilight/p-a3a1bf15.entry.js +0 -4
  353. package/dist/twilight/p-d2cdd923.entry.js +0 -4
@@ -0,0 +1,67 @@
1
+ /**
2
+ * Cart summary card. Inline on desktop (≥1024px), sticky bar with
3
+ * collapsible sheet on mobile.
4
+ */
5
+ export declare class SallaCartSummaryCard {
6
+ host: HTMLElement;
7
+ validateForms: boolean;
8
+ cartCount: number;
9
+ cartTotal: number;
10
+ cartTotalDiscount: number;
11
+ cartSubTotal: number;
12
+ cartOptionsTotal: number;
13
+ cartShippingCost: number;
14
+ cartTaxAmount: number;
15
+ cartHasShipping: boolean;
16
+ isOpen: boolean;
17
+ isDesktop: boolean;
18
+ /** True until the first cart payload (API response or cart event) arrives. */
19
+ isLoading: boolean;
20
+ summaryLabel: string;
21
+ itemsTotalLabel: string;
22
+ itemsTotalNoTaxLabel: string;
23
+ optionsTotalLabel: string;
24
+ shippingCostLabel: string;
25
+ vatTaxLabel: string;
26
+ savedLabel: string;
27
+ discountBadge: string;
28
+ finalTotalLabel: string;
29
+ pricesTaxedLabel: string;
30
+ completeOrderLabel: string;
31
+ openSummaryLabel: string;
32
+ closeSummaryLabel: string;
33
+ /** Template with `:count` placeholder — interpolated per-render by getItemsLabel. */
34
+ itemsCountTemplate: string;
35
+ componentWillLoad(): void;
36
+ private init;
37
+ private loadTranslations;
38
+ /** Coerces PHP cart values: numbers, strings, and Money/MoneyTaxable objects. */
39
+ private num;
40
+ private originalParent;
41
+ private originalNextSibling;
42
+ private bodyObserver;
43
+ private mediaQueryList;
44
+ private submitObserver;
45
+ private submitObserverTimeout?;
46
+ private isSubmitting;
47
+ private breakpointPx;
48
+ private desktopMediaQuery;
49
+ private mqlChangeHandler;
50
+ private cartEventNames;
51
+ private cartEventHandler;
52
+ componentDidLoad(): void;
53
+ private applyMode;
54
+ private pinToBodyEnd;
55
+ disconnectedCallback(): void;
56
+ private fetchCart;
57
+ private applyCachedSummary;
58
+ private extractCart;
59
+ private applyCartData;
60
+ private toggleSheet;
61
+ private validateCartForms;
62
+ private handleSubmit;
63
+ private money;
64
+ private getItemsLabel;
65
+ private renderSkeleton;
66
+ render(): any;
67
+ }
@@ -9,10 +9,13 @@ export declare class SallaFilters {
9
9
  */
10
10
  filters?: Filter[];
11
11
  private isReady;
12
+ private isInitialFetch;
12
13
  isSidebarOpen: boolean;
13
14
  filtersData: object | any;
14
15
  apply: string;
15
16
  reset: string;
17
+ selectedTitle: string;
18
+ appliedOpen: boolean;
16
19
  /**
17
20
  * Custom event fired when the selected filters are changed.
18
21
  */
@@ -38,6 +41,17 @@ export declare class SallaFilters {
38
41
  * @private
39
42
  */
40
43
  private handleOptionChange;
44
+ /**
45
+ * Flatten the selected filtersData into displayable chips, resolving the
46
+ * human label for each group + option from `this.filters`. Selections that
47
+ * can't be resolved to a known option (e.g. the auto-added base category)
48
+ * are skipped.
49
+ */
50
+ private getAppliedFilters;
51
+ /**
52
+ * Remove a single applied filter — the direct inverse of handleOptionChange.
53
+ */
54
+ private removeFilter;
41
55
  render(): any;
42
56
  componentDidLoad(): void;
43
57
  }
@@ -0,0 +1,20 @@
1
+ export interface CancellationReason {
2
+ id: number;
3
+ name: string;
4
+ type: 'system' | 'custom';
5
+ slug: string | null;
6
+ sort?: number;
7
+ is_active?: boolean;
8
+ translations?: Record<string, {
9
+ name: string;
10
+ }>;
11
+ }
12
+ export interface CancelOrderPayload {
13
+ reasons: string[];
14
+ reason_note?: string;
15
+ }
16
+ export type CancelledBy = 'customer' | 'merchant';
17
+ export interface OrderCancelledReason {
18
+ cancelled_by: CancelledBy;
19
+ reasons: string[];
20
+ }
@@ -0,0 +1,42 @@
1
+ import type { CancellationReason } from './interfaces';
2
+ /** Modal cancellation + cancelled-order header; reads order from salla-order-totals-card. */
3
+ export declare class SallaOrderCancel {
4
+ constructor();
5
+ orderId?: string | number;
6
+ cancellationReasons?: string | CancellationReason[];
7
+ reasons: CancellationReason[];
8
+ selectedReasonId: number | null;
9
+ reasonNote: string;
10
+ confirmLoading: boolean;
11
+ loading: boolean;
12
+ private modalTitleLabel;
13
+ private questionLabel;
14
+ private subtitleLabel;
15
+ private confirmLabel;
16
+ private backLabel;
17
+ private notePlaceholder;
18
+ private charLimitLabel;
19
+ private modal;
20
+ private pageOrder?;
21
+ private orderCancelledReason?;
22
+ onCancellationReasonsChange(): void;
23
+ componentWillLoad(): Promise<void>;
24
+ private refreshLabels;
25
+ private get resolvedOrderId();
26
+ private readPageOrder;
27
+ private waitForPageOrder;
28
+ private cancelledByLabel;
29
+ private mountCancelledHeader;
30
+ private purgeLegacyModal;
31
+ private applyPageOrder;
32
+ private load;
33
+ private reasonLabel;
34
+ private get hasOtherSelected();
35
+ private get canConfirm();
36
+ private selectReason;
37
+ private resetForm;
38
+ private setReasonNote;
39
+ private onKeyActivate;
40
+ private confirmCancel;
41
+ render(): any;
42
+ }
@@ -194,6 +194,7 @@ export declare class SallaProductsList {
194
194
  * must not set `response.title` — only the main catalog grid should update the listing title.
195
195
  */
196
196
  private isAuxiliaryProductsListSource;
197
+ private toCategoryIdFilter;
197
198
  private getSourceValue;
198
199
  private logFetchError;
199
200
  private appendDataLayer;
@@ -48,6 +48,7 @@ export declare class SallaUserMenu {
48
48
  private onClickOutside;
49
49
  profileUrl: string;
50
50
  OrderUpdate: number;
51
+ private accountPrefixedKeys;
51
52
  private items;
52
53
  componentWillLoad(): Promise<void>;
53
54
  private loadTranslations;
@@ -20,6 +20,7 @@ import { Point, Prize } from "./components/salla-loyalty-program/interfaces";
20
20
  import { Sources } from "./components/salla-menu/interfaces";
21
21
  import { BundleProduct, BundleSection, SelectedOption } from "./components/salla-multiple-bundle-product/interfaces";
22
22
  import { Notification } from "./components/salla-notifications/interfaces";
23
+ import { CancellationReason } from "./components/salla-order-cancel/interfaces";
23
24
  import { OrderProduct, ProductOption } from "./components/salla-order-details/interfaces";
24
25
  import { OrderEditItem, OrderEditProductOption, OrderEditSelectedOptions } from "./components/salla-order-edit/interfaces";
25
26
  import { Product } from "@salla.sa/twilight/types/common";
@@ -46,6 +47,7 @@ export { Point, Prize } from "./components/salla-loyalty-program/interfaces";
46
47
  export { Sources } from "./components/salla-menu/interfaces";
47
48
  export { BundleProduct, BundleSection, SelectedOption } from "./components/salla-multiple-bundle-product/interfaces";
48
49
  export { Notification } from "./components/salla-notifications/interfaces";
50
+ export { CancellationReason } from "./components/salla-order-cancel/interfaces";
49
51
  export { OrderProduct, ProductOption } from "./components/salla-order-details/interfaces";
50
52
  export { OrderEditItem, OrderEditProductOption, OrderEditSelectedOptions } from "./components/salla-order-edit/interfaces";
51
53
  export { Product } from "@salla.sa/twilight/types/common";
@@ -375,6 +377,16 @@ export namespace Components {
375
377
  */
376
378
  "showCartLabel": boolean;
377
379
  }
380
+ /**
381
+ * Cart summary card. Inline on desktop (≥1024px), sticky bar with
382
+ * collapsible sheet on mobile.
383
+ */
384
+ interface SallaCartSummaryCard {
385
+ /**
386
+ * @default true
387
+ */
388
+ "validateForms": boolean;
389
+ }
378
390
  interface SallaCashbackBanner {
379
391
  }
380
392
  interface SallaColorPicker {
@@ -1934,6 +1946,13 @@ export namespace Components {
1934
1946
  */
1935
1947
  "stackCards": boolean;
1936
1948
  }
1949
+ /**
1950
+ * Modal cancellation + cancelled-order header; reads order from salla-order-totals-card.
1951
+ */
1952
+ interface SallaOrderCancel {
1953
+ "cancellationReasons"?: string | CancellationReason[];
1954
+ "orderId"?: string | number;
1955
+ }
1937
1956
  /**
1938
1957
  * @salla /ui-components
1939
1958
  * The `salla-order-details` component renders a collapsible summary for an order product with optional options list.
@@ -3658,6 +3677,16 @@ declare global {
3658
3677
  prototype: HTMLSallaCartSummaryElement;
3659
3678
  new (): HTMLSallaCartSummaryElement;
3660
3679
  };
3680
+ /**
3681
+ * Cart summary card. Inline on desktop (≥1024px), sticky bar with
3682
+ * collapsible sheet on mobile.
3683
+ */
3684
+ interface HTMLSallaCartSummaryCardElement extends Components.SallaCartSummaryCard, HTMLStencilElement {
3685
+ }
3686
+ var HTMLSallaCartSummaryCardElement: {
3687
+ prototype: HTMLSallaCartSummaryCardElement;
3688
+ new (): HTMLSallaCartSummaryCardElement;
3689
+ };
3661
3690
  interface HTMLSallaCashbackBannerElement extends Components.SallaCashbackBanner, HTMLStencilElement {
3662
3691
  }
3663
3692
  var HTMLSallaCashbackBannerElement: {
@@ -4227,6 +4256,15 @@ declare global {
4227
4256
  prototype: HTMLSallaOrderBranchElement;
4228
4257
  new (): HTMLSallaOrderBranchElement;
4229
4258
  };
4259
+ /**
4260
+ * Modal cancellation + cancelled-order header; reads order from salla-order-totals-card.
4261
+ */
4262
+ interface HTMLSallaOrderCancelElement extends Components.SallaOrderCancel, HTMLStencilElement {
4263
+ }
4264
+ var HTMLSallaOrderCancelElement: {
4265
+ prototype: HTMLSallaOrderCancelElement;
4266
+ new (): HTMLSallaOrderCancelElement;
4267
+ };
4230
4268
  /**
4231
4269
  * @salla /ui-components
4232
4270
  * The `salla-order-details` component renders a collapsible summary for an order product with optional options list.
@@ -4824,6 +4862,7 @@ declare global {
4824
4862
  "salla-cart-coupons": HTMLSallaCartCouponsElement;
4825
4863
  "salla-cart-item-offers": HTMLSallaCartItemOffersElement;
4826
4864
  "salla-cart-summary": HTMLSallaCartSummaryElement;
4865
+ "salla-cart-summary-card": HTMLSallaCartSummaryCardElement;
4827
4866
  "salla-cashback-banner": HTMLSallaCashbackBannerElement;
4828
4867
  "salla-color-picker": HTMLSallaColorPickerElement;
4829
4868
  "salla-comment-form": HTMLSallaCommentFormElement;
@@ -4877,6 +4916,7 @@ declare global {
4877
4916
  "salla-offer": HTMLSallaOfferElement;
4878
4917
  "salla-offer-modal": HTMLSallaOfferModalElement;
4879
4918
  "salla-order-branch": HTMLSallaOrderBranchElement;
4919
+ "salla-order-cancel": HTMLSallaOrderCancelElement;
4880
4920
  "salla-order-details": HTMLSallaOrderDetailsElement;
4881
4921
  "salla-order-details-multiple-bundle-product": HTMLSallaOrderDetailsMultipleBundleProductElement;
4882
4922
  "salla-order-details-options": HTMLSallaOrderDetailsOptionsElement;
@@ -5249,6 +5289,16 @@ declare namespace LocalJSX {
5249
5289
  */
5250
5290
  "showCartLabel"?: boolean;
5251
5291
  }
5292
+ /**
5293
+ * Cart summary card. Inline on desktop (≥1024px), sticky bar with
5294
+ * collapsible sheet on mobile.
5295
+ */
5296
+ interface SallaCartSummaryCard {
5297
+ /**
5298
+ * @default true
5299
+ */
5300
+ "validateForms"?: boolean;
5301
+ }
5252
5302
  interface SallaCashbackBanner {
5253
5303
  }
5254
5304
  interface SallaColorPicker {
@@ -6732,6 +6782,13 @@ declare namespace LocalJSX {
6732
6782
  */
6733
6783
  "stackCards"?: boolean;
6734
6784
  }
6785
+ /**
6786
+ * Modal cancellation + cancelled-order header; reads order from salla-order-totals-card.
6787
+ */
6788
+ interface SallaOrderCancel {
6789
+ "cancellationReasons"?: string | CancellationReason[];
6790
+ "orderId"?: string | number;
6791
+ }
6735
6792
  /**
6736
6793
  * @salla /ui-components
6737
6794
  * The `salla-order-details` component renders a collapsible summary for an order product with optional options list.
@@ -8002,6 +8059,7 @@ declare namespace LocalJSX {
8002
8059
  "salla-cart-coupons": SallaCartCoupons;
8003
8060
  "salla-cart-item-offers": SallaCartItemOffers;
8004
8061
  "salla-cart-summary": SallaCartSummary;
8062
+ "salla-cart-summary-card": SallaCartSummaryCard;
8005
8063
  "salla-cashback-banner": SallaCashbackBanner;
8006
8064
  "salla-color-picker": SallaColorPicker;
8007
8065
  "salla-comment-form": SallaCommentForm;
@@ -8055,6 +8113,7 @@ declare namespace LocalJSX {
8055
8113
  "salla-offer": SallaOffer;
8056
8114
  "salla-offer-modal": SallaOfferModal;
8057
8115
  "salla-order-branch": SallaOrderBranch;
8116
+ "salla-order-cancel": SallaOrderCancel;
8058
8117
  "salla-order-details": SallaOrderDetails;
8059
8118
  "salla-order-details-multiple-bundle-product": SallaOrderDetailsMultipleBundleProduct;
8060
8119
  "salla-order-details-options": SallaOrderDetailsOptions;
@@ -8156,6 +8215,11 @@ declare module "@stencil/core" {
8156
8215
  "salla-cart-coupons": LocalJSX.SallaCartCoupons & JSXBase.HTMLAttributes<HTMLSallaCartCouponsElement>;
8157
8216
  "salla-cart-item-offers": LocalJSX.SallaCartItemOffers & JSXBase.HTMLAttributes<HTMLSallaCartItemOffersElement>;
8158
8217
  "salla-cart-summary": LocalJSX.SallaCartSummary & JSXBase.HTMLAttributes<HTMLSallaCartSummaryElement>;
8218
+ /**
8219
+ * Cart summary card. Inline on desktop (≥1024px), sticky bar with
8220
+ * collapsible sheet on mobile.
8221
+ */
8222
+ "salla-cart-summary-card": LocalJSX.SallaCartSummaryCard & JSXBase.HTMLAttributes<HTMLSallaCartSummaryCardElement>;
8159
8223
  "salla-cashback-banner": LocalJSX.SallaCashbackBanner & JSXBase.HTMLAttributes<HTMLSallaCashbackBannerElement>;
8160
8224
  "salla-color-picker": LocalJSX.SallaColorPicker & JSXBase.HTMLAttributes<HTMLSallaColorPickerElement>;
8161
8225
  "salla-comment-form": LocalJSX.SallaCommentForm & JSXBase.HTMLAttributes<HTMLSallaCommentFormElement>;
@@ -8262,6 +8326,10 @@ declare module "@stencil/core" {
8262
8326
  * The `salla-order-branch` component renders pickup branch details for thank-you pages.
8263
8327
  */
8264
8328
  "salla-order-branch": LocalJSX.SallaOrderBranch & JSXBase.HTMLAttributes<HTMLSallaOrderBranchElement>;
8329
+ /**
8330
+ * Modal cancellation + cancelled-order header; reads order from salla-order-totals-card.
8331
+ */
8332
+ "salla-order-cancel": LocalJSX.SallaOrderCancel & JSXBase.HTMLAttributes<HTMLSallaOrderCancelElement>;
8265
8333
  /**
8266
8334
  * @salla /ui-components
8267
8335
  * The `salla-order-details` component renders a collapsible summary for an order product with optional options list.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salla.sa/twilight-components",
3
- "version": "2.14.486",
3
+ "version": "2.14.488",
4
4
  "license": "GPL-3.0",
5
5
  "author": "Salla Team <support@salla.dev> (https://salla.dev)",
6
6
  "bugs": {
@@ -81,9 +81,9 @@
81
81
  },
82
82
  "dependencies": {
83
83
  "@googlemaps/markerclusterer": "2.6.2",
84
- "@salla.sa/applepay": "2.14.486",
85
- "@salla.sa/twilight": "2.14.486",
86
- "@salla.sa/twilight-tailwind-theme": "2.14.486",
84
+ "@salla.sa/applepay": "2.14.488",
85
+ "@salla.sa/twilight": "2.14.488",
86
+ "@salla.sa/twilight-tailwind-theme": "2.14.488",
87
87
  "@salla.sa/ui-address-autocomplete-widget": "1.2.1",
88
88
  "@salla.sa/ui-google-map-render": "1.2.1",
89
89
  "@types/node": "^20.4.8",
@@ -104,5 +104,5 @@
104
104
  "vanilla-lazyload": "^17.8.5",
105
105
  "vanilla-picker": "^2.12.2"
106
106
  },
107
- "gitHead": "c3c03bf2bc14539fa632040d55b8be749b6b6395"
107
+ "gitHead": "8b68f85d4e2cf055dd1af016456effee931fe0b4"
108
108
  }
@@ -1,4 +0,0 @@
1
- /*!
2
- * Crafted with ❤ by Salla
3
- */
4
- import{r as t,c as s,h as i,H as e,a as r}from"./p-BF901xIc.js";import{a as o}from"./p-CgtvEd63.js";import{S as a}from"./p-DiKTtDW5.js";import{H as l}from"./p-C-3GuKNW.js";const n=class{constructor(i){t(this,i),this.productsFetched=s(this,"productsFetched"),this.selectionChanged=s(this,"selectionChanged"),this.autoload=!1,this.productCardComponent="custom-salla-product-card",this.selectable=!1,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.selectedProducts=new Map,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.onWishlistItemRemoved=(t,s)=>{if("wishlist"!==this.getSource()||!this.wrapper)return;const i=String(s),e=this.hasCustomComponent?this.productCardComponent:"salla-product-card";for(const t of Array.from(this.wrapper.children)){const s=t,r=t.querySelector(e),o=s.product?.id??r?.product?.id;if(null!=o&&String(o)===i){t.remove();break}}for(const t of Array.from(this.wrapper.children)){if(!t.classList.contains("s-products-list-selectable-item"))continue;const s=t;if(null!=s.product?.id&&String(s.product.id)===i&&!t.querySelector(e)){t.remove();break}}if(this.selectable){for(const t of Array.from(this.selectedProducts.keys()))String(t)===i&&this.selectedProducts.delete(t);this.emitSelection()}},this.onWishlistStorageSynced=()=>l.syncWishlistIcons(this.wrapper,`${this.productCardComponent}, salla-product-card`),this.includes=l.parseJson(this.includes||this.host.getAttribute("includes")),Array.isArray(this.includes)||(this.includes=null),l.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))),salla.event.on("wishlist::removed",this.onWishlistItemRemoved),salla.event.on("wishlist::storage.synced",this.onWishlistStorageSynced)}disconnectedCallback(){window.removeEventListener("DOMContentLoaded",this.boundScrollToLastViewedProduct),window.removeEventListener("scroll",this.boundHandleScroll),salla.event.off("wishlist::removed",this.onWishlistItemRemoved),salla.event.off("wishlist::storage.synced",this.onWishlistStorageSynced)}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)),"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),await 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}getCachedFilters(){return Array.isArray(this.filtersSnapshot)&&this.filtersSnapshot.length?JSON.parse(JSON.stringify(this.filtersSnapshot)):null}emitFilters(t){if(!this.isFilterable())return;if(t.filters)return this.filtersResults=!0,this.filtersSnapshot=JSON.parse(JSON.stringify(t.filters)),void salla.event.emit("filters::fetched",{filters:t.filters});const s=t.cursor?.current>1?this.getCachedFilters():null;if(s)return this.filtersResults=!0,void salla.event.emit("filters::fetched",{filters:s});this.filtersSnapshot=[],salla.event.emit("filters::hidden")}isSourceWithoutValue(){const t=this.getSource();if("wishlist"===t){const t=new URLSearchParams(window.location.search);return!(t.has("source_value")||t.has("source_value[]")||this.sourceValue)}return["offers","latest","sales","top-rated","reorder"].includes(t)}animateItems(){o({targets:"salla-products-list salla-product-card",opacity:[0,1],duration:1200,translateY:[20,0],delay:function(t,s){return 100*s}})}async 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("source_value"!==t&&"source_value[]"!==t)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)}`;this.nextPage=await this.applyBeforeBuildListUrl(this.nextPage)}async 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(await 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")&&(l.saveProductSource(this.getSource()),this.hasInfiniteScroll&&(this.takeStateSnapshot(),sessionStorage.setItem(this.lastViewedProductKey,t.id)))})),this.selectable?this.wrapSelectableItem(s,t):s}wrapSelectableItem(t,s){const i=document.createElement("div");i.className="s-products-list-selectable-item",i.product=s;const e=this.selectedProducts.has(s.id);e&&i.classList.add("s-products-list-item-selected");const r=document.createElement("label");r.className="s-products-list-select-control",r.setAttribute("aria-label",salla.lang.get("common.elements.select","تحديد"));const o=document.createElement("input");return o.type="checkbox",o.className="s-products-list-select-checkbox",o.checked=e,o.addEventListener("change",(()=>this.toggleSelection(s,i,o.checked))),r.appendChild(o),i.appendChild(r),i.appendChild(t),i}toggleSelection(t,s,i){i?(this.selectedProducts.set(t.id,t),s?.classList.add("s-products-list-item-selected")):(this.selectedProducts.delete(t.id),s?.classList.remove("s-products-list-item-selected")),this.emitSelection()}emitSelection(){const t=Array.from(this.selectedProducts.values()),s=Array.from(this.selectedProducts.keys()),i={ids:s,products:t,count:s.length};this.selectionChanged.emit(i),salla.event.emit("salla-products-list::selection.changed",i)}appendProductCards(t){this.wrapper&&((Array.isArray(t)?t:[t]).forEach((t=>this.wrapper.append(t))),this.onWishlistStorageSynced())}refreshWishlistIconsAfterHydration(){return salla.wishlist.api.syncStorageFromServer()}onSelectableChanged(t,s){t!==s&&this.isReady&&this.wrapper&&(t||(this.selectedProducts.clear(),this.emitSelection()),this.reload())}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,i=null;return new Promise((e=>{let r;const o=()=>{clearTimeout(s),clearTimeout(i),r.disconnect(),e(null)};r=new MutationObserver((()=>{clearTimeout(s),s=setTimeout(o,160)})),r.observe(t,{childList:!0,subtree:!0,attributes:!0}),i=setTimeout(o,1e3)}))}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,r=salla.config.get("page.id"),o=salla.url.is_page("index"),a=salla.url.is_page("product.single"),l=e?i!==e:i!==String(r);if(i&&l&&!o&&!a||o&&!this.hasInfiniteScroll)return this.removeScrollRestorationSession(),this.switchToNormalBehavior=!0,!1;if(a)return this.switchToNormalBehavior=!0,!1;if(t)try{const{pageIndex:i,nextPage:e,currentPageData:r}=JSON.parse(t);if(s&&"undefined"!==s){const t=JSON.parse(s);this.filtersSnapshot=JSON.parse(JSON.stringify(t)),salla.event.emit("filters::fetched",{filters:t})}return this.page=i,this.nextPage=e,this.appendProductCards(r.map((t=>this.getItemHTML(t)))),!0}catch(t){console.error("Failed to load stored scroll state:",t),this.removeScrollRestorationSession()}return!1}getSource(){return l.getProductsSource(this.source)}isAuxiliaryProductsListSource(){return["json","selected","related","landing-page","recently"].includes(this.getSource())}getSourceValue(){if("wishlist"===this.getSource()){const t=new URLSearchParams(window.location.search),s=t.getAll("source_value[]").length?t.getAll("source_value[]"):t.getAll("source_value");if(s.length)return s}return this.currentCategoryIdFilter?this.currentCategoryIdFilter:l.getProductsSourceValue(this.source,this.sourceValue)}logFetchError(t,s,i,e,r){try{const o=r&&"object"==typeof r?r:null,a=this.getSourceValue();salla.analytics?.log("salla::products.list.fetch.error",{errorPhase:t,source:this.getSource(),sourceValue:"string"==typeof a&&a.length>200?`${a.slice(0,200)}…`:Array.isArray(a)?{length:a.length}:a,pageIndex:this.infiniteScroll?.pageIndex,fetchPath:i,httpStatus:e?.status,httpStatusText:e?.statusText,responseUrl:e?.url,...o&&{dataCount:Array.isArray(o.data)?o.data.length:void 0,responseKeys:Object.keys(o).slice(0,15),filtersCount:Array.isArray(o.filters)?o.filters.length:void 0},errorMessage:s instanceof Error?s.message:String(s),..."processing"===t&&s instanceof Error&&s.stack?{errorStack:s.stack.slice(0,500)}:{}})}catch{}}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,s,i)=>{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=await this.handleResponse(t);this.infiniteScroll.appendItems(s),this.onWishlistStorageSynced(),2===this.infiniteScroll.pageIndex&&(!this.autoload&&this.nextPage&&(this.loadMoreWrapper.style.display="block"),this.animateItems(),this.refreshInfiniteScrollMeasurements())}catch(e){console.error("Error during load:",e),this.logFetchError("processing",e,"string"==typeof s?s:void 0,i,t)}finally{this.isProcessing=!1}}})),this.infiniteScroll?.on("error",((t,s,i)=>{const e=i;this.status.querySelector(".s-infinite-scroll-error").classList.remove("s-hidden"),this.placeholderLoader&&this.placeholderLoader.remove(),this.loading(!1),this.isProcessing=!1,this.logFetchError("fetch",t,s,e)})),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()}refreshInfiniteScrollMeasurements(){this.autoload&&this.infiniteScroll?.updateMeasurements&&this.waitForStableLayout(document.body).then((()=>this.infiniteScroll?.updateMeasurements?.()))}async applyBeforeBuildListUrl(t){try{const s={component:this,url:t};return await salla.hooks.call("salla-products-list","beforeBuildListUrl",s),s.url}catch(s){return salla.logger.warn("beforeBuildListUrl hook failed",s?.message),t}}async resolveNextPageFromCursor(t){return t.cursor?t.cursor.next?await this.applyBeforeBuildListUrl(t.cursor.next):t.cursor.next:this.nextPage}async injectAndProcessData(t){try{await l.injectExtraFieldsToResponse(t)}catch(t){console.error("Error injecting data:",t)}}getInitialData(){return this.loading(),salla.api.withoutNotifier((()=>salla.product.api.fetch({source:l.getApiSource(this.getSource()),source_value:this.getSourceValue(),limit:this.limit}).then((async t=>t.data.length?(await l.injectExtraFieldsToResponse(t),this.firstPageResponse?void this.appendProductCards(await this.handleResponse(t)):(this.firstPageResponse=t,void(this.nextPage=await this.resolveNextPageFromCursor(t)))):(this.showPlaceholder=!0,this.placeholderLoader&&this.placeholderLoader.remove(),void this.loading(!1))))))}async loadMore(){this.infiniteScroll?.loadNextPage()}async getSelected(){return{ids:Array.from(this.selectedProducts.keys()),products:Array.from(this.selectedProducts.values())}}async getLoadedProducts(){const t=[];if(!this.wrapper)return t;for(let s=0;s<this.wrapper.children.length;s++){const i=this.wrapper.children[s];i?.product&&t.push(i.product)}return t}async selectAll(){if(this.selectable&&this.wrapper){for(let t=0;t<this.wrapper.children.length;t++){const s=this.wrapper.children[t];if(s?.product){this.selectedProducts.set(s.product.id,s.product),s.classList.add("s-products-list-item-selected");const t=s.querySelector(".s-products-list-select-checkbox");t&&(t.checked=!0)}}this.emitSelection()}}async clearSelection(){this.selectedProducts.clear(),this.wrapper&&(this.wrapper.querySelectorAll(".s-products-list-select-checkbox").forEach((t=>t.checked=!1)),this.wrapper.querySelectorAll(".s-products-list-item-selected").forEach((t=>t.classList.remove("s-products-list-item-selected")))),this.emitSelection()}componentWillLoad(){return salla.onReady().then((async()=>{this.hasCustomComponent=!!customElements.get(this.productCardComponent),this.sourceValueIsValid=!(!this.getSourceValue()&&!this.isSourceWithoutValue()),this.hasInfiniteScroll=!this.isAuxiliaryProductsListSource()&&!this.limit;let t=new URLSearchParams(window.location.search);try{this.sortBy=this.sortBy||t.get("sort")||t.get("by"),this.parsedFilters=l.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(await 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.appendProductCards(this.getSourceValue().map((t=>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.refreshInfiniteScrollMeasurements()):!this.firstPageResponse&&this.switchToNormalBehavior?this.getInitialData().then((async()=>{this.firstPageResponse?(this.appendProductCards(await this.handleResponse(this.firstPageResponse,!1)),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.appendProductCards(await this.handleResponse(this.firstPageResponse,!1)),await this.refreshWishlistIconsAfterHydration()}canRender(){return this.sourceValueIsValid&&this.isReady}render(){return this.canRender()?this.showPlaceholder?i("div",{class:"s-products-list-placeholder"},i("span",{innerHTML:a}),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()}async handleResponse(t,s=!0){if(!t)return[];let i=this.getSource();if(1===t.cursor?.current){if(!this.isAuxiliaryProductsListSource()){let s=l.getPageTitleForSource(i);try{if("search"===this.getSource())s=salla.lang.get("common.elements.search_about",{word:this.getSourceValue()});else if(!s){let i=this.parsedFilters.category_id||this.getSourceValue()[0];s=t.filters?.find((t=>"category_id"===t.key))?.values?.find((t=>t.key===i))?.value??""}s+=(s?" - ":"")+salla.lang.choice("blocks.header.products_count",t.data?.length),15===t.data.length&&(s=s.replace(t.data.length,salla.lang.get("common.elements.more_than")+" "+t.data.length)),t.title=s}catch(t){salla.logger.error("Error::falid to handle response",t)}}l.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),this.emitFilters(t),s&&(this.nextPage=await this.resolveNextPageFromCursor(t)),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 e=[];for(let s=0;s<t.data.length;s++)e.push(this.getItemHTML(t.data?.[s]));return e}get host(){return r(this)}static get watchers(){return{selectable:["onSelectableChanged"]}}};n.style='.s-products-list-selectable-item{position:relative;border-radius:0.5rem;transition:box-shadow 0.15s ease-in-out}.s-products-list-item-selected{box-shadow:0 0 0 2px var(--color-primary)}.s-products-list-select-control{position:absolute;top:10px;inset-inline-start:10px;z-index:5;display:inline-flex;align-items:center;justify-content:center;cursor:pointer}.s-products-list-select-checkbox{appearance:none;-webkit-appearance:none;-moz-appearance:none;position:relative;width:22px;height:22px;margin:0;cursor:pointer;color:var(--color-primary);border:1px solid rgba(0, 0, 0, 0.15);border-radius:6px;background-color:#fff;box-shadow:0 1px 3px rgba(0, 0, 0, 0.2);transition:background-color 0.15s ease-in-out, border-color 0.15s ease-in-out}.s-products-list-select-checkbox:hover{border-color:var(--color-primary)}.s-products-list-select-checkbox:focus,.s-products-list-select-checkbox:focus-visible{outline:none;border-color:var(--color-primary);box-shadow:0 1px 3px rgba(0, 0, 0, 0.2), 0 0 0 3px color-mix(in srgb, var(--color-primary) 30%, transparent)}.s-products-list-select-checkbox:checked,.s-products-list-select-checkbox:checked:hover,.s-products-list-select-checkbox:checked:focus{background-color:var(--color-primary);border-color:var(--color-primary)}.s-products-list-select-checkbox:checked::after{content:"";position:absolute;top:50%;left:50%;width:5px;height:10px;border:solid #fff;border-width:0 2px 2px 0;transform:translate(-50%, -60%) rotate(45deg)}.s-products-list-row-cards .s-products-list-select-control{top:50%;inset-inline-start:14px;transform:translateY(-50%)}.s-products-list-row-cards .s-products-list-selectable-item>:not(.s-products-list-select-control){padding-inline-start:2.75rem}';export{n as salla_products_list}
@@ -1,4 +0,0 @@
1
- /*!
2
- * Crafted with ❤ by Salla
3
- */
4
- import{r as t,c as s,h as e,H as i,a}from"./p-BF901xIc.js";import{F as l}from"./p-DL4h2bc3.js";import{H as r}from"./p-C-3GuKNW.js";import"./p-CgtvEd63.js";const o=class{constructor(e){t(this,e),this.changed=s(this,"changed"),this.isReady=!1,this.filtersData={},salla.event.on("filters::hidden",(()=>this.host.style.display="none")),salla.lang.onLoaded((()=>{this.apply=salla.lang.get("pages.checkout.apply"),this.reset=salla.lang.get("pages.categories.filters_reset")})),salla.event.on("filters::fetched",(({filters:t})=>{this.host.style.display="";let s={};this.filters=t.map((t=>{if(t.label={category_id:salla.lang.get("common.titles.categories"),brand_id:salla.lang.get("common.titles.brands"),rating:salla.lang.get("pages.categories.filter_rating"),price:salla.lang.get("pages.categories.filter_price")}[t.key]||t.label,"rating"==t.key){t.type=l.VALUES;let{max:s,min:e}=t.values;t.values=[5,4,3,2,1].filter((t=>t>=e||t<=s))}this.filtersData.variants&&t.type==l.VARIANTS&&(s.variants=this.filtersData.variants),this.filtersData[t.key]&&t.type!==l.VARIANTS&&(s[t.key]=this.filtersData[t.key]);let e=new URLSearchParams(window.location.search),i=!1;for(let t of e.keys())if(t.includes("filters")){i=!0;break}if("product.index"==salla.config.get("page.slug")&&0==Object.keys(s).length&&!i){let t=window.location.href,e=salla.config.get("page.id"),i=-1!==t.indexOf("?")?"&":"?",a=t+i+"filters[category_id]="+e;s.category_id=e,window.history.pushState({path:a},"",a)}return t})),this.filtersData=s,this.host.childNodes.forEach((async t=>t.setWidgetHeight&&await t.setWidgetHeight()))}))}async componentWillLoad(){try{const t=new URLSearchParams(window.location.search);this.filtersData=await r.extractFiltersFromUrl(t)}catch(t){console.warn("failed to get filters from URL",t.message)}}async getFilters(){return this.filtersData}async applyFilters(){if(!this.isReady)return;let t=Object.keys(this.filtersData).length>0;setTimeout((()=>{if(t){let t=new URL(window.location.href);for(const[s]of t.searchParams.entries())s.startsWith("filters")&&t.searchParams.delete(s);let s=this.encodeFilters(this.filtersData),e=t.search.split("&").filter((t=>!t.includes("filters"))).join("&");t.search=e?t.search.split("&filters")[0]+"&"+s:`?${s}`,window.history.pushState({},"",t.href)}else{let t=new URL(window.location.href);t.searchParams?.delete("filters"),window.history.pushState({},"",t.toString())}salla.event.emit("salla-filters::changed",this.filtersData),this.changed.emit(this.filtersData)}),300)}encodeFilters(t,s="filters"){const e=[];for(const i in t)if(Object.prototype.hasOwnProperty.call(t,i)){const a=t[i],l=s?`${s}[${i}]`:i;if(Array.isArray(a))for(let t=0;t<a.length;t++)e.push(`${l}[${t}]=${a[t]}`);else e.push("object"==typeof a&&null!==a?this.encodeFilters(a,l):`${l}=${a}`)}return e.join("&")}async resetFilters(){return this.removeFiltersQueryParams(),this.filtersData={},this.host.childNodes.forEach((t=>t.reset&&t.reset())),salla.event.emit("salla-filters::reset"),this.applyFilters()}removeFiltersQueryParams(){const t=new URLSearchParams(window.location.search),s=Array.from(t.keys()).filter((t=>!t.startsWith("filters["))).map((s=>`${encodeURIComponent(s)}=${encodeURIComponent(t.get(s))}`)).join("&"),e=s?`${window.location.pathname}?${s}`:window.location.pathname;window.history.pushState({},"",e)}handleOptionChange(t,s,e){s.type===l.RANGE&&(this.filtersData[s.key]=e);let i=t.target.checked;s.type===l.VARIANTS?(this.filtersData.variants=this.filtersData.variants||{},i&&(this.filtersData.variants[s.key]=e),i||delete this.filtersData.variants[s.key]):"radio"==t.target.type?(i&&(this.filtersData[s.key]=e),i||delete this.filtersData[s.key]):"checkbox"==t.target.type&&(this.filtersData[s.key]=this.filtersData[s.key]||[],i&&this.filtersData[s.key].push(e),this.filtersData[s.key]=this.filtersData[s.key].filter((t=>t!=e))),this.applyFilters()}render(){return e(i,{key:"f94496fa176d99cf04b98fea8732b7c7c5912159"},this.filters?.map((t=>e("salla-filters-widget",{option:t,filtersData:this.filtersData,onChanged:({detail:{event:t,option:s,value:e}})=>{this.handleOptionChange(t,s,e)}}))),this.filters?.length?e("div",{class:"s-filters-footer"},e("salla-button",{color:"gray",fill:"outline",onClick:()=>this.resetFilters()},this.reset)):"")}componentDidLoad(){this.isReady=!0}get host(){return a(this)}};o.style=":host{display:block}.s-rating-stars-small{line-height:12px}.s-filters-radio{background-image:none !important}";export{o as salla_filters}
@@ -1,4 +0,0 @@
1
- /*!
2
- * Crafted with ❤ by Salla
3
- */
4
- import{r as s,h as t,H as i,a as e,c as a}from"./p-BF901xIc.js";import{A as r,a as l}from"./p-Vqpj4CWE.js";import{S as o}from"./p-8Tsmrwno.js";import{C as n}from"./p-BV4kqbdL.js";import{H as d}from"./p-C-3GuKNW.js";import"./p-CgtvEd63.js";const h=class{constructor(t){s(this,t),this.collapsible=!0,this.bordered=!1,this.size="md",this.collapsed=!0,this.dir=document.dir||"rtl"}directionChangedHandler(s){this.dir=s.detail.dir}handleCollapse(s){this.collapsed=s.detail.payload.collapsed}setcollapsibleProp(){const s=this.host.querySelector("salla-accordion-head");this.collapsible&&s&&(s.setAttribute("collapsible","true"),s.setAttribute("collapsed",this.collapsed.toString()))}componentDidRender(){this.setcollapsibleProp();const s=this.host.querySelector("salla-accordion-body");this.collapsible&&(this.host.setAttribute("data-collapsed",this.collapsed.toString()),s?.setAttribute("data-collapsed",this.collapsed.toString()))}render(){return t(i,{key:"1ea35adcb3558cad1c5e675ed7330e3859c31d20",class:`s-accordion-wrapper ${this.dir} ${this.bordered?"s-accordion-wrapper-bordered":""} ${this.size?`size-${this.size}`:""}`,"data-collapsed":this.collapsed.toString()},t("slot",{key:"596f47501e2080874cd28a304bc55b88409699cf"}))}get host(){return e(this)}};h.style="";const c=class{constructor(t){s(this,t),this.sessionStorageKey="breadcrumb_snapshot",this.itemSlot=this.host.querySelector('[slot="item"]')?.outerHTML||'<li class="s-breadcrumb-item"><a href={url}>{title}</a></li>',this.iconSlot=this.host.querySelector('[slot="icon"]')?.outerHTML}componentWillLoad(){return new Promise((s=>salla.onReady((()=>salla.lang.onLoaded(s))))).then((()=>{if(salla.url.is_page("index"))throw new Error("salla-breadcrumb:: breadcrumb not supported on home page")})).then((()=>{const s=salla.config.get("page");if("wishlist"===s?.slug)return void(this.breadcrumbs=[]);if(!salla.config.get("theme.settings.is_breadcrumbs_enabled",!0))throw new Error("salla-breadcrumb:: merchant disabled the feature");if(!s||!s.slug)return salla.logger.error('salla-breadcrumbs:: page object not existed on salla.config.get("page")!'),void(this.breadcrumbs=[]);let t=this.getSessionBreadcrumbs(),i=t[t.length-1];return"product.single"===s.slug&&t&&t.length>0&&i?.url&&s.parent?.url&&i.url===s.parent.url?(t.push({title:s.title,url:s.url}),this.breadcrumbs=this.setBreadcrumbsFromArray(t),this.storeBreadcrumbSnapshot()):t&&t.length>0?this.isNewPage(s,t)?(this.breadcrumbs=this.generateBreadcrumbs(s),this.storeBreadcrumbSnapshot()):this.breadcrumbs=this.setBreadcrumbsFromArray(t):(this.breadcrumbs=this.generateBreadcrumbs(s),this.storeBreadcrumbSnapshot()),this.breadcrumbs?.length&&(this.breadcrumbs[this.breadcrumbs.length-1].is_last=!0),this.breadcrumbs})).catch((s=>{salla.logger.error("salla-breadcrumb:: unexpected error!",s),this.breadcrumbs=[]}))}getSessionBreadcrumbs(){return"search-bar"===new URLSearchParams(window.location.search).get("from")?[]:JSON.parse(sessionStorage.getItem(this.sessionStorageKey)||"[]")}isNewPage(s,t){const i=t[t.length-1];return i?.url!==s.url}setBreadcrumbsFromArray(s){return s.map(((t,i)=>({...t,is_last:i===s.length-1})))}sanitizeBreadcrumbTitle(s,t=1){if(!s.includes("|"))return s.trim();const i=s.split("|").map((s=>s.trim())).filter(Boolean);return i[t]||i[0]||s.replace(/\|/g,"").trim()}generateBreadcrumbs(s){let t=[];if("product.single"===s.slug){const t=this.getSessionBreadcrumbs(),i=t[t.length-1];if(t.length>0&&i?.url&&s.parent?.url&&i.url===s.parent.url)return this.setBreadcrumbsFromArray([...t,{title:s.title,url:s.url}])}let i=s;for(;i;)i.title&&t.unshift({title:i.title,url:i.url}),i=i.parent;return s.slug.includes("customer")&&"customer.profile"!==s.slug&&t.unshift({title:salla.lang.get("common.titles.profile"),url:salla.url.get("profile")}),s.slug.includes("blog")&&t.unshift({title:salla.lang.get("blocks.footer.blog"),url:salla.url.get("blog")}),"brands.single"===s.slug&&t.unshift({title:salla.lang.get("common.titles.brands"),url:salla.url.get("brands")}),s.title||"loyalty"!==s.slug||t.unshift({title:salla.lang.get("common.titles.loyalty_program"),url:salla.url.get("loyalty")}),t.unshift({title:salla.lang.get("common.titles.home"),url:salla.url.get("")}),t}storeBreadcrumbSnapshot(){try{const s=salla.config.get("page");if("product.single"===s?.slug||"wishlist"===s?.slug)return;const t=[...this.breadcrumbs],i=t.length-1;i>=0&&(t[i].url=window.location.href);const e=JSON.stringify(t);sessionStorage.setItem(this.sessionStorageKey,e)}catch(s){salla.logger.error("salla-breadcrumb:: Failed to store breadcrumb snapshot in sessionStorage.",s)}}render(){if(this.breadcrumbs.length<=1)return salla.log("salla-breadcrumb:: There is no breadcrumbs!"),null;if("wishlist"===salla.config.get("page.slug"))return null;const s="product.single"===salla.config.get("page.slug");return[t("ol",{class:{"s-breadcrumb-wrapper":!0,"s-breadcrumb-dark":salla.url.is_page("loyalty"),"s-breadcrumb-primary-reverse":salla.config.get("page.slug").includes("customer")}},this.breadcrumbs.map((i=>{const e=s&&i.is_last?i.title:this.sanitizeBreadcrumbTitle(i.title),a=this.itemSlot.replace(/\{url\}/g,i.url).replace(/\{title\}/g,e);return[t("div",{class:"s-breadcrumb-slot",innerHTML:a}),this.getArrowDomForItem(i)]}))),t("script",{type:"application/ld+json",innerHTML:this.getJsonLd(s)})]}getJsonLd(s){const t=this.breadcrumbs.map(((t,i)=>{const e={"@type":"ListItem",position:i+1,name:s&&t.is_last?t.title:this.sanitizeBreadcrumbTitle(t.title)};return!t.is_last&&t.url&&(e.item=this.toAbsoluteUrl(t.url)),e}));return JSON.stringify({"@context":"https://schema.org","@type":"BreadcrumbList",itemListElement:t}).replace(/</g,"\\u003c")}toAbsoluteUrl(s){try{return new URL(s,window.location.origin).href}catch{return s}}getArrowDomForItem(s){if(s.is_last)return"";let i=this.iconSlot||(salla.config.get("theme.is_rtl",!0)?r:l);return t("li",{class:"s-breadcrumb-arrow"},t("div",{class:{"s-breadcrumb-icon-slot":!0,"s-breadcrumb-default-icon":!this.iconSlot},innerHTML:i}))}componentDidRender(){this.host.querySelectorAll(".s-breadcrumb-slot").forEach((s=>s.replaceWith(s.firstChild))),this.host.querySelectorAll(".s-breadcrumb-icon-slot.s-breadcrumb-default-icon").forEach((s=>s.replaceWith(s.querySelector("svg")))),this.host.querySelector('[slot="item"]')?.remove(),this.host.querySelector('[slot="icon"]')?.remove();let s=this.host.querySelectorAll(".s-breadcrumb-item")[this.breadcrumbs.length-1]?.querySelector("a");s&&s.replaceWith(s.firstChild)}componentDidLoad(){"wishlist"===salla.config.get("page.slug")&&document.getElementById("page-main-title")?.remove()}get host(){return e(this)}};c.style=":host{display:block}";const u=class{constructor(t){s(this,t),this.shape="btn",this.color="primary",this.fill="solid",this.size="medium",this.width="normal",this.loading=!1,this.disabled=!1,this.loaderPosition="after",this.type="button"}async load(){return"center"==this.loaderPosition&&this.text.classList.add("s-button-hide"),this.host.setAttribute("loading",""),this.host}async stop(){return this.host.removeAttribute("loading"),this.host.querySelector("button").removeAttribute("loading"),"center"==this.loaderPosition&&this.text.classList.remove("s-button-hide"),this.host}async setText(s){return this.text.innerHTML=s,this.host}async disable(){return this.host.setAttribute("disabled",""),this.host}async enable(){return this.host.removeAttribute("disabled"),this.host}getBtnAttributes(){const s={};for(let t=0;t<this.host.attributes.length;t++)["color","fill","size","width","id"].includes(this.host.attributes[t].name)||(s[this.host.attributes[t].name]=this.host.attributes[t].value);s.type=s.type||this.type;const t=s.class||"";return s.class=t+" s-button-element s-button-"+this.shape+" s-button-"+("none"==this.fill?"fill-none":this.fill)+("medium"!=this.size?" s-button-"+this.size:"")+("normal"!=this.width?" s-button-"+this.width:"")+("link"==this.shape?" s-button-"+this.color+"-link":"")+("link"!=this.shape&&"outline"!=this.fill?" s-button-"+this.color:"")+("outline"==this.fill?" s-button-"+this.color+"-outline":"")+(this.disabled?" s-button-disabled ":"")+("icon"==this.shape?" s-button-loader-center":" s-button-loader-"+this.loaderPosition),s["aria-label"]||s["aria-labelledby"]||(this.host.textContent||"").trim()||(t.includes("btn--wishlist")||t.includes("wishlist")?s["aria-label"]=salla.lang.getWithDefault("pages.products.add_to_wishlist","Add or remove to wishlist"):"icon"===this.shape&&console.warn("Icon button is missing aria-label attribute")),s}button(){return t("button",{...this.getBtnAttributes(),disabled:this.disabled},t("span",{class:"s-button-text",ref:s=>this.text=s},t("slot",null)),this.loading?t("span",{class:"s-button-loader"}):"")}render(){return this.host.closest(".swiper-slide")?.classList.contains("swiper-slide-duplicate")?"":t(i,{class:"s-button-wrap"},this.href?t("a",{href:this.href},this.button()):this.button())}get host(){return e(this)}};u.style="";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>alert-engine</title>\n<path d="M16 18.673c-0.736 0-1.333 0.604-1.333 1.34s0.597 1.333 1.333 1.333 1.333-0.597 1.333-1.333v-0.013c0-0.736-0.597-1.327-1.333-1.327zM2.667 16c0-3.092 1.083-6.105 3.047-8.484 0.469-0.568 0.389-1.408-0.179-1.877-0.568-0.468-1.408-0.388-1.877 0.179-2.359 2.857-3.657 6.473-3.657 10.183s1.299 7.325 3.657 10.183c0.264 0.319 0.645 0.484 1.029 0.484 0.299 0 0.6-0.1 0.848-0.305 0.568-0.469 0.648-1.309 0.179-1.877-1.964-2.379-3.047-5.392-3.047-8.484zM16 10.667c-0.736 0-1.333 0.597-1.333 1.333v4c0 0.736 0.597 1.333 1.333 1.333s1.333-0.597 1.333-1.333v-4c0-0.736-0.597-1.333-1.333-1.333zM16 5.333c-5.881 0-10.667 4.785-10.667 10.667s4.785 10.667 10.667 10.667 10.667-4.785 10.667-10.667-4.785-10.667-10.667-10.667zM16 24c-4.412 0-8-3.588-8-8s3.588-8 8-8 8 3.588 8 8-3.588 8-8 8zM28.343 5.817c-0.469-0.567-1.307-0.647-1.877-0.179-0.568 0.469-0.648 1.309-0.179 1.877 1.964 2.379 3.047 5.392 3.047 8.484s-1.083 6.105-3.047 8.484c-0.469 0.568-0.389 1.408 0.179 1.877 0.249 0.205 0.549 0.305 0.848 0.305 0.384 0 0.765-0.165 1.028-0.484 2.36-2.857 3.659-6.473 3.659-10.183s-1.299-7.325-3.657-10.183z"></path>\n</svg>\n';const b=class{constructor(t){s(this,t),this.drawerVisibilityChanged=a(this,"drawerVisibilityChanged"),this.isClosable=!0,this.width="md",this.position="right",this.visible=!1,this.hasSkeleton=!1,this.isLoading=!1,this.subTitleFirst=!1,this.noPadding=!1,this.subTitle="",this.centered=!1,this.iconStyle=void 0,salla.event.on("drawer::open",(s=>s==this.host.id&&this.open())),salla.event.on("drawer::close",(s=>s==this.host.id&&this.close())),this.drawerTitle=this.host.getAttribute("drawer-title")}handleVisible(s){if(!s)return this.drawerVisibilityChanged.emit(!1),void this.toggleDrawer(!1);this.drawerVisibilityChanged.emit(!0),this.host.classList.remove("s-hidden"),setTimeout((()=>this.toggleDrawer(!0)))}handleKeyUp(s){"Escape"===s.key&&this.closeDrawer()}async open(){return this.host.setAttribute("visible",""),this.handleAutoFocus(),this.host}async close(){return this.host.removeAttribute("visible"),this.host}async setTitle(s){return this.drawerTitle=s,this.host}async loading(){return this.isLoading=!0,this.host}async stopLoading(){return this.isLoading=!1,this.host}handleAutoFocus(){const s=this.host.querySelector("input, textarea, select");s&&setTimeout((()=>{s.focus()}),100)}toggleDrawer(s){const t=this.host.querySelector(".s-drawer-body");d.toggleElementClassIf(t,"s-drawer-entering","s-drawer-leaving",(()=>s)).toggleElementClassIf(this.overlay,"s-drawer-entering","s-drawer-overlay-leaving",(()=>s)).toggleElementClassIf(document.body,"drawer-is-open","drawer-is-closed",(()=>s)),s||setTimeout((()=>this.host.classList.add("s-hidden")),350)}closeDrawer(s){this.isClosable&&(salla.event.dispatch("drawer::close",{reason:s}),this.host.removeAttribute("visible"))}iconBlockClasses(){return{"s-drawer-icon":!0,"s-drawer-bg-error":"error"==this.iconStyle,"s-drawer-bg-success":"success"==this.iconStyle,"s-drawer-bg-normal":!this.iconStyle,"s-drawer-bg-primary":"primary"==this.iconStyle}}getWidth(){return this.isLoading?this.hasSkeleton?"md":"xs":this.width}render(){return this.host.id=this.host.id||"salla-drawer",this.isLoading?t(i,{class:"salla-drawer s-drawer s-drawer-container s-hidden","aria-modal":"true",role:"dialog",onKeyUp:s=>this.handleKeyUp(s)},t("div",{class:"s-drawer-overlay s-drawer-overlay-leaving",ref:s=>this.overlay=s,onClick:()=>this.closeDrawer("backdropClick")}),t("div",{class:"s-drawer-wrapper s-drawer-wrapper-"+this.position},t("div",{class:"s-drawer-body flex justify-center s-drawer-leaving s-drawer-"+this.position+" s-drawer-"+this.getWidth()+(this.noPadding?" s-drawer-nopadding":" s-drawer-padding")},t("slot",{name:"loading"},t("salla-loading",null)),t("div",{class:"s-hidden"},t("slot",null))))):t(i,{class:"salla-drawer s-drawer s-drawer-container s-hidden","aria-modal":"true",role:"dialog"},t("div",{class:"s-drawer-overlay s-drawer-overlay-leaving",ref:s=>this.overlay=s,onClick:()=>this.closeDrawer("backdropClick")}),t("div",{class:"s-drawer-wrapper s-drawer-wrapper-"+this.position},t("div",{class:"s-drawer-body s-drawer-leaving s-drawer-"+this.position+" s-drawer-"+this.getWidth()+(this.noPadding?" s-drawer-nopadding":" s-drawer-padding")},t("div",{class:{"s-drawer-header":!0,"s-drawer-is-center":this.centered}},this.isClosable?t("button",{class:"s-drawer-close",onClick:()=>this.closeDrawer("closeButtonClick"),type:"button"},t("span",{innerHTML:o})):"",this.drawerTitle||this.subTitle?t("div",{class:"s-drawer-header-inner"},t("slot",{name:"icon"},this.iconStyle?t("div",{class:this.iconBlockClasses(),innerHTML:"error"==this.iconStyle?m:n}):""),t("div",{class:"s-drawer-header-content"},this.drawerTitle?t("div",{class:{"s-drawer-title":!0,"s-drawer-title-below":this.subTitleFirst},innerHTML:this.drawerTitle}):"",this.subTitle?t("p",{class:{"s-drawer-sub-title":!0},innerHTML:this.subTitle}):"")):""),t("slot",null),t("slot",{name:"footer"}))))}componentDidLoad(){document.body.append(this.host)}get host(){return e(this)}static get watchers(){return{visible:["handleVisible"]}}};b.style="";const p=class{constructor(t){s(this,t),this.size=32,this.width=2,this.color=void 0,this.bgColor="#e5e7eb"}render(){return t(i,{key:"a3ab1e66f7b26628e7bfb1f5560127d042203cf3",class:"s-loading-container"},t("svg",{key:"e33089cee347160eaea4ded8ab8a5543a91f5ea1","aria-hidden":"true",style:{width:`${this.size}px`,height:`${this.size}px`,fill:this.color,color:this.bgColor},class:"s-loading",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg"},t("path",{key:"8163f98231203552ea3f514ac3b8cd16a8d9426c",d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),t("path",{key:"959ea259b039d16be8b9dc39a2fb2e409bfffe0e",d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"})))}};p.style=".s-loading{animation:spin 1s linear infinite;fill:var(--color-primary)}.s-loading-container{display:flex;justify-content:center;align-items:center}@keyframes spin{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}";const g=class{constructor(t){s(this,t),this.modalVisibilityChanged=a(this,"modalVisibilityChanged"),this.isClosable=!0,this.width="md",this.position="middle",this.visible=!1,this.hasSkeleton=!1,this.isLoading=!1,this.subTitleFirst=!1,this.noPadding=!1,this.subTitle="",this.centered=!1,this.iconStyle=void 0,salla.event.on("modal::open",(s=>s==this.host.id&&this.open())),salla.event.on("modal::close",(s=>s==this.host.id&&this.close())),this.modalTitle=this.host.getAttribute("modal-title")}handleVisible(s){if(!s)return this.modalVisibilityChanged.emit(!1),void this.toggleModal(!1);this.modalVisibilityChanged.emit(!0),this.host.classList.remove("s-hidden"),setTimeout((()=>this.toggleModal(!0)))}handleKeyUp(s){"KeyUp"===s.key&&this.closeModal()}async open(){return this.host.setAttribute("visible",""),this.handleAutoFocus(),this.host}async close(){return this.host.removeAttribute("visible"),this.host}async setTitle(s){return this.modalTitle=s,this.host}async loading(){return this.isLoading=!0,this.host}async stopLoading(){return this.isLoading=!1,this.host}handleAutoFocus(){const s=this.host.querySelector("input, textarea, select");s&&setTimeout((()=>{s.focus()}),100)}toggleModal(s){const t=this.host.querySelector(".s-modal-body");d.toggleElementClassIf(t,"s-modal-entering","s-modal-leaving",(()=>s)).toggleElementClassIf(this.overlay,"s-modal-entering","s-modal-overlay-leaving",(()=>s)).toggleElementClassIf(document.body,"modal-is-open","modal-is-closed",(()=>s)),s||setTimeout((()=>this.host.classList.add("s-hidden")),350)}closeModal(s){this.isClosable&&(salla.event.dispatch("modal::close",{reason:s}),this.host.removeAttribute("visible"))}iconBlockClasses(){return{"s-modal-icon":!0,"s-modal-bg-error":"error"==this.iconStyle,"s-modal-bg-success":"success"==this.iconStyle,"s-modal-bg-normal":!this.iconStyle,"s-modal-bg-primary":"primary"==this.iconStyle}}getWidth(){return this.isLoading?this.hasSkeleton?"md":"xs":this.width}render(){return this.host.id=this.host.id||"salla-modal",this.isLoading?t(i,{class:"salla-modal s-modal s-modal-container s-hidden","aria-modal":"true",role:"dialog",onKeyUp:s=>this.handleKeyUp(s)},t("div",{class:"s-modal-overlay",ref:s=>this.overlay=s,onClick:()=>this.closeModal("backdropClick")}),t("div",{class:"s-modal-wrapper"},t("span",{class:"s-modal-spacer s-modal-align-"+this.position},"​"),t("div",{class:"s-modal-body s-modal-align-"+this.position+" s-modal-"+this.getWidth()+(this.noPadding?" s-modal-nopadding":" s-modal-padding")},t("slot",{name:"loading"},t("salla-loading",null)),t("div",{class:"s-hidden"},t("slot",null))))):t(i,{class:"salla-modal s-modal s-modal-container s-hidden","aria-modal":"true",role:"dialog"},t("div",{class:"s-modal-overlay",ref:s=>this.overlay=s,onClick:()=>this.closeModal("backdropClick")}),t("div",{class:"s-modal-wrapper"},t("span",{class:"s-modal-spacer s-modal-align-"+this.position},"​"),t("div",{class:"s-modal-body s-modal-align-"+this.position+" s-modal-"+this.getWidth()+(this.noPadding?" s-modal-nopadding":" s-modal-padding")},t("div",{class:{"s-modal-header":!0,"s-modal-is-center":this.centered}},this.isClosable?t("button",{class:"s-modal-close",onClick:()=>this.closeModal("closeButtonClick"),type:"button"},t("span",{innerHTML:o})):"",this.modalTitle||this.subTitle?t("div",{class:"s-modal-header-inner"},t("slot",{name:"icon"},this.iconStyle?t("div",{class:this.iconBlockClasses(),innerHTML:"error"==this.iconStyle?m:n}):""),t("div",{class:"s-modal-header-content"},this.modalTitle?t("div",{class:{"s-modal-title":!0,"s-modal-title-below":this.subTitleFirst},innerHTML:this.modalTitle}):"",this.subTitle?t("p",{class:{"s-modal-sub-title":!0},innerHTML:this.subTitle}):"")):""),t("slot",null),t("slot",{name:"footer"}))))}componentDidLoad(){document.body.append(this.host)}get host(){return e(this)}static get watchers(){return{visible:["handleVisible"]}}};g.style="@media screen and (max-width: 470px){.modal-is-open{position:fixed;width:100%}}";export{h as salla_accordion,c as salla_breadcrumb,u as salla_button,b as salla_drawer,p as salla_loading,g as salla_modal}
@@ -1,4 +0,0 @@
1
- /*!
2
- * Crafted with ❤ by Salla
3
- */
4
- import{a as e}from"./p-CgtvEd63.js";salla.event.setMaxListeners(100);var t=new class{setIncludes(e){return this.includes=e,this}toggleElementClassIf(e,t,r,a){t=Array.isArray(t)?t:t.split(" "),r=Array.isArray(r)?r:r.split(" ");let s=a(e);return e?.classList.remove(...s?r:t),e?.classList.add(...s?t:r),this}toggleClassIf(e,t,r,a){return document.querySelectorAll(e).forEach((e=>this.toggleElementClassIf(e,t,r,a))),this}isValidEmail(e){return/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(String(e).toLowerCase())}filterEmojies(e){return e.replace(/(?:[\u2700-\u27bf]|(?:\ud83c[\udde6-\uddff]){2}|[\ud800-\udbff][\udc00-\udfff]|[\u0023-\u0039]\ufe0f?\u20e3|\u3299|\u3297|\u303d|\u3030|\u24c2|\ud83c[\udd70-\udd71]|\ud83c[\udd7e-\udd7f]|\ud83c\udd8e|\ud83c[\udd91-\udd9a]|\ud83c[\udde6-\uddff]|\ud83c[\ude01-\ude02]|\ud83c\ude1a|\ud83c\ude2f|\ud83c[\ude32-\ude3a]|\ud83c[\ude50-\ude51]|\u203c|\u2049|[\u25aa-\u25ab]|\u25b6|\u25c0|[\u25fb-\u25fe]|\u00a9|\u00ae|\u2122|\u2139|\ud83c\udc04|[\u2600-\u26FF]|\u2b05|\u2b06|\u2b07|\u2b1b|\u2b1c|\u2b50|\u2b55|\u231a|\u231b|\u2328|\u23cf|[\u23e9-\u23f3]|[\u23f8-\u23fa]|\ud83c\udccf|\u2934|\u2935|[\u2190-\u21ff])/g,"")}debounce(e,...t){return this.debounce_||(this.debounce_=salla.helpers.debounce(((e,...t)=>e(...t)),500)),this.debounce_(e,...t)}getProductsSource(e){return{"brands.single":"brands","product.index":"categories","product.index.latest":"latest","product.index.offers":"offers","product.index.search":"search","customer.wishlist":"wishlist","landing-page":"landing-page","product.index.tag":"tags","product.index.sales":"sales","components.most_sales_products":"sales"}[e||salla.config.get("page.slug")]||e||"latest"}getApiSource(e){return{recently:"selected"}[e]||e}getPageTitleForSource(e){return(e={brands:"common.titles.brands",latest:"blocks.home.latest_products",offers:"common.titles.discounts",reorder:"common.titles.products",sales:"common.titles.most_sales"}[e])?salla.lang.get(e):""}getProductsSourceValue(e,t){const r=this.getProductsSource(e);let a=null;if(t)try{a="string"==typeof t?JSON.parse(t):t}catch(e){console.error("Failed to parse JSON string in sourceValue:",e)}if(!["search","json","offers","latest","sales","related"].includes(r)){if(Array.isArray(a)&&a.length)return a;if(Array.isArray(a)&&!a.length)return"";if("number"==typeof a)return[a];if(!t&&["categories","tags","brands"].includes(e))return[salla.config.get("page.id")]}return a||t?a||t:"search"===r?new URLSearchParams(window.location.search).get("q")||"":salla.config.get("page.id")}extractFiltersFromUrl(e){let t={};return e.forEach(((e,r)=>{const a=r.match(/^filters\[(.*?)\](\[(.*?)\])?$/u);if(a){const r=a[1],s=a[3];s?(t[r]=t[r]||{},t[r][s]=e):t[r]=e}else{const a=r.match(/^(.*?)$/u);a&&(t[a[1]]=e)}})),t}async injectExtraFieldsToResponse(e){if(!e||!this.includes)return e;const t=e.data.map((e=>e.id));try{const{data:r}=await this.fetchImagesAndOptions(t);if(this.injectOptionsAndImages(e.data,r),!this.includes.includes("metadata"))return e;const a=await salla.api.metadata.fetchValues("product",t);return e.data.forEach((e=>{e.metadata=a.data.find((t=>parseInt(t.entity_id)===parseInt(e.id)))})),e}catch(e){throw console.error("Error in injectExtraFieldsToResponse:",e),e}}fetchImagesAndOptions(e){return this.productsIncludes().length?salla.api.product.fetchOptions(e,{with:this.productsIncludes()}):Promise.resolve({data:[]})}injectOptionsAndImages(e,t){return t.length?e.map((e=>(this.includes.filter((e=>"metadata"!==e)).forEach((r=>{const a=t.find((t=>parseInt(t.id)===parseInt(e.id)));e[r]=a?a[r]:null})),e))):null}productsIncludes(){return this.includes?.filter((e=>"metadata"!=e))}saveSource(e,t){if(t)try{sessionStorage.setItem(e,t)}catch(e){salla.logger.warn("Error saving source to session storage")}}saveProductSource(e){this.saveSource("s-viewed-source",e)}saveAddToCartSource(e){this.saveSource("s-add-to-cart-source",e)}parseJson(e){if("string"!=typeof e)return e;try{return JSON.parse(e)}catch(e){salla.logger.error("Failed to parse includes as JSON:",e)}return null}getProductSchemaMarkupScript(e){const t=document.createElement("script");return t.type="application/ld+json",t.text=JSON.stringify({"@context":"http://schema.org","@type":"Product",name:e?.name,image:e?.image?.url||e?.thumbnail,description:e?.description,brand:{"@type":"Brand",logo:e?.brand?.logo},offers:{"@type":"Offer",price:e?.price}}),t}createProductSchema(e,t){let r={productID:`${e.id}`,"@type":"Product",name:e.name,url:e.url,image:e.image.url||e.image,description:e.description||e.subtitle||e.name,...e.sku&&e.sku.length>0&&{sku:e.sku},offers:{"@type":"Offer",url:e.url,priceCurrency:e.currency,price:e.price,itemCondition:"NewCondition",availability:e.is_available?"InStock":"OutOfStock",priceValidUntil:e.discount_ends||new Date((new Date).setDate((new Date).getDate()+7)).toISOString().split("T")[0],priceSpecification:{"@type":"PriceSpecification",price:e.regular_price,priceCurrency:e.currency,valueAddedTaxIncluded:e.is_taxable},seller:{"@type":"Organization",name:salla.config.get("store.name")},shippingDetails:{"@type":"OfferShippingDetails",shippingRate:{"@type":"MonetaryAmount",value:"0",currency:e.currency||"SAR"},deliveryTime:{"@type":"ShippingDeliveryTime",businessDays:{"@type":"OpeningHoursSpecification",dayOfWeek:["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"]},cutoffTime:"14:00"}},hasMerchantReturnPolicy:{"@type":"MerchantReturnPolicy",returnPolicyCategory:"https://schema.org/MerchantReturnFiniteReturnWindow",merchantReturnDays:30,returnMethod:"https://schema.org/ReturnByMail",returnFees:"https://schema.org/FreeReturn"}}};return e.rating?.stars&&(r.aggregateRating={"@type":"AggregateRating",ratingValue:e.rating.stars,reviewCount:e.rating.count}),{"@type":"ListItem",position:t,item:r}}generateProductSchema(e){const t="salla-product-schema-script";if(document.getElementById(t))return void salla.logger.warn(`already added schema-script with id (${t})!`);const r=document.createElement("script");r.type="application/ld+json",r.id=t;const a={"@context":"https://schema.org","@type":"ItemList",name:salla.config.get("page.title"),itemListElement:e.map(((e,t)=>this.createProductSchema(e,t+1)))};r.textContent=JSON.stringify(a),document.head.appendChild(r)}formatDateFromString(e,t,r="en"){const a={en:"Invalid Date",ar:"تاريخ غير صالح"};if(!e||"string"!=typeof e||""===e.trim())return a[r];let s;if(/^\d+$/.test(e)){const t=parseInt(e);s=new Date(t>1e12?t:1e3*t)}else s=new Date(e);return isNaN(s.getTime())?a[r]:`${{en:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],ar:["الأحد","الاثنين","الثلاثاء","الأربعاء","الخميس","الجمعة","السبت"]}[r][s.getDay()]} ${t(s.getDate(),"en"===r)} ${{en:["January","February","March","April","May","June","July","August","September","October","November","December"],ar:["يناير","فبراير","مارس","أبريل","مايو","يونيو","يوليو","أغسطس","سبتمبر","أكتوبر","نوفمبر","ديسمبر"]}[r][s.getMonth()]} ${t(s.getFullYear(),"en"===r)}`}copyToClipboard(e){var t=e.target.innerText;navigator.clipboard.writeText(t).then((()=>{console.log("Text copied to clipboard: "+t)})).catch((e=>{console.error("Unable to copy text to clipboard",e)}))}animateItems(t){t&&e({targets:t,opacity:[0,1],duration:1200,translateY:[20,0],delay:function(e,t){return 100*t},easing:"easeOutExpo",complete:function(){t.forEach((e=>{e.classList.add("animated")}))}})}createReviewObject(e){return{"@type":"Review",author:{"@type":"Person",name:e.name},reviewBody:e.content,reviewRating:{"@type":"Rating",bestRating:"5",ratingValue:e.stars,worstRating:"1"}}}generateReviewSchema(e){const t=document.createElement("script");t.type="application/ld+json";const r={"@context":"http://schema.org/","@type":"Store",name:salla.config.get("store.name"),url:salla.config.get("store.url"),address:"الرياض",review:e.map((e=>this.createReviewObject(e))),aggregateRating:{"@type":"AggregateRating",ratingValue:e.reduce(((e,t)=>e+t.stars),0)/e.length,reviewCount:e.length}};t.textContent=JSON.stringify(r),document.head.appendChild(t)}availabilityChannels(){let e=salla.config.get("store.settings.product.availability_notify");if(!e)return"";let t=[];return e.email&&t.push("email"),(e.sms||e.mobile||e.whatsapp)&&t.push("sms"),t.join(",")}syncWishlistIcons(e,t){e?.querySelectorAll(t).forEach((e=>{const t=e.product?.id,r="number"==typeof t?t:Number(t);if(Number.isNaN(r))return;const a=salla.wishlist.api.has(r);e.querySelectorAll(".s-product-card-wishlist-btn, .btn--wishlist").forEach((e=>{e.classList.toggle("s-product-card-wishlist-added",a),e.classList.toggle("wishlist-added",a)}))}))}};export{t as H}
@@ -1,4 +0,0 @@
1
- /*!
2
- * Crafted with ❤ by Salla
3
- */
4
- import{r as s,h as t,H as e,a as l}from"./p-BF901xIc.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 c}from"./p-D4oPi1Ov.js";import{S as h}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_points=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_points:h,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=c),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_points=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_points"===s?"loyalty":s)}}getMenuItem([s,e],l){if(("wallet"!==s||window.can_access_wallet)&&("loyalty_points"!==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})))}async componentDidLoad(){await Salla.hooks.registerComponent("salla-user-menu",this),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}
@@ -1,4 +0,0 @@
1
- /*!
2
- * Crafted with ❤ by Salla
3
- */
4
- import{r as s,c as t,h as i,H as e,a as h}from"./p-BF901xIc.js";import{H as a}from"./p-C-3GuKNW.js";import{F as l}from"./p-DL4h2bc3.js";import"./p-CgtvEd63.js";const r=class{constructor(i){s(this,i),this.changed=t(this,"changed"),this.initialItemCount=10,this.expandedItemCount=15,this.calculatedInitialHeight=0,this.calculatedExpandedHeight=0,this.isOpen=!0,this.isShowMore=!1,this.showMoreLabel="عرض المزيد",this.showLessLabel="عرض أقل",this.page=salla.config.get("page"),this.searchQuery="",this.filteredCount=0}connectedCallback(){this.withLoadMore="price"!=this.option.key&&Array.isArray(this.option.values)&&this.option.values.length>this.initialItemCount,salla.onReady((()=>{this.page=salla.config.get("page")})),salla.lang.onLoaded((()=>{this.showMoreLabel=salla.lang.getWithDefault("common.titles.more",this.showMoreLabel),this.showLessLabel=salla.lang.getWithDefault("common.elements.show_less",this.showLessLabel)}))}componentDidLoad(){const s=this.widgetValues.querySelectorAll(".s-filters-label");if(s.length>0){const t=Math.min(this.initialItemCount,s.length);this.calculatedInitialHeight=35*this.initialItemCount,this.calculatedExpandedHeight=s.length>this.initialItemCount?35*this.expandedItemCount:35*t}this.widgetValues.scrollHeight<this.calculatedInitialHeight&&(this.withLoadMore=!1),this.withLoadMore&&this.widgetValues&&(this.widgetValues.style.maxHeight=`${this.calculatedInitialHeight}px`),this.widgetContent.style.height=`${this.widgetContent.scrollHeight}px`}async setWidgetHeight(s=250){this.widgetContent.removeAttribute("style"),setTimeout((()=>{this.widgetContent.style.height=this.widgetContent.scrollHeight+"px"}),s)}async reset(){this.option.type===l.RANGE&&this.priceRange.reset(),Array.from(this.host.querySelectorAll("input")).forEach((s=>s.checked=!1))}async showMore(){this.isShowMore=!this.isShowMore,this.widgetContent.style.height="auto",this.isShowMore||(this.widgetValues.scrollTop=0);const s=this.isShowMore?this.calculatedExpandedHeight:this.calculatedInitialHeight,t=this.searchQuery?this.filteredCount:Array.isArray(this.option.values)?this.option.values.length:0;this.widgetValues.style.maxHeight=`${s}px`,this.widgetValues.style.overflowY=this.isShowMore&&t>this.expandedItemCount?"auto":"hidden",setTimeout((()=>{this.widgetContent.style.height=`${this.widgetContent.scrollHeight}px`}),400)}async toggleWidget(){this.isOpen=!this.isOpen,a.toggleElementClassIf(this.widgetContent,"s-filters-widget-opened","s-filters-widget-closed",(()=>this.isOpen))}renderFilterOption(s){if(![l.VALUES,l.MINIMUM,l.VARIANTS].includes(s.type))return"";const t=s.values.filter((s=>{if(!this.searchQuery)return!0;const t="number"==typeof s?String(s):s?.value||s?.key||"";return String(t).toLowerCase().includes(this.searchQuery.toLowerCase())}));return this.filteredCount=t.length,0===t.length?i("div",{class:"s-filters-widget-empty-state"},salla.lang.get("common.elements.no_options")||"لا توجد نتائج"):t.map((t=>{let e="number"==typeof t?t:t.key||t.value;return i("label",{class:"s-filters-label",htmlFor:`${s.key}-option-${e}`,key:`${s.key}-option-${e}`},i("input",{id:`${s.key}-option-${e}`,name:s.key,type:"radio",checked:this.isSelectedOption(s,e),class:"s-filters-radio",onChange:t=>this.changed.emit({event:t,option:s,value:e})}),this.getOptionLabel(s,t))}))}isSelectedOption(s,t){return s.type===l.MINIMUM?this.filtersData[s.key]==t:s.type===l.VARIANTS?this.filtersData[s.type]&&this.filtersData[s.type][Object.keys(this.filtersData[s.type])[0]]==t:s.type===l.RANGE?this.filtersData[s.key]&&this.filtersData[s.key].min==t.min&&this.filtersData[s.key].max==t.max:s.type===l.VALUES&&this.filtersData[s.key]&&Number(this.filtersData[s.key])==Number(t)}getOptionLabel(s,t){return"rating"==s.key?i("salla-rating-stars",{size:"small",value:t}):i("span",{class:"s-filters-option-name"},t.value||"null")}render(){return i(e,{key:"2cdd3bbc88b473e9b5d52bf5e95de16f9ad47a51",class:"s-filters-widget-container"},i("h3",{key:"4d3d522469681c5d7cde040938b0ce15324d7cc3",class:"s-filters-widget-title",onClick:()=>this.toggleWidget()},i("span",{key:"60fa18c667a1b00f03e8eebc484da68e78fa8d90"},this.option.label),i("span",{key:"ac8cff411fbb76c43e0134b0c7381b682a8afcd0",class:"s-filters-widget-plusminus "+(this.isOpen?"s-filters-widget-plusminus-active":"")})),i("div",{key:"5705ab244d712512e156994bbf21d9bb49dbb43b",class:"s-filters-widget-content",ref:s=>this.widgetContent=s},Array.isArray(this.option.values)&&this.option.values.length>5&&i("div",{key:"a59f45a5fbd803dcd65f0a5b40060a1dcfed00e0",class:"s-filters-widget-search-wrapper",style:{padding:"8px 0",marginBottom:"8px"}},i("input",{key:"3275790105bfe9b84df564b9385c4a9556c2f03a",type:"text",class:"s-filters-widget-search-input",placeholder:salla.lang.get("blocks.header.search_placeholder")||"بحث...",value:this.searchQuery,onInput:s=>this.searchQuery=s.target.value})),i("div",{key:"70d57184a8089422d96ea62ddaa7697f7f207441",class:"s-filters-widget-values",ref:s=>this.widgetValues=s},i("slot",{key:"959512d2256b5a29236572fc8078c5baa5d9a571"}),this.option.type!==l.RANGE?this.renderFilterOption(this.option):i("salla-price-range",{onChanged:s=>{this.changed.emit(s.detail)},ref:s=>this.priceRange=s,filtersData:this.filtersData,option:this.option})),this.withLoadMore&&(!this.searchQuery||this.filteredCount>this.initialItemCount)&&i("a",{key:"305b4a155c2b3705bcf139c81b5f8bcb3d744d05",class:"s-filters-widget-more",onClick:()=>this.showMore()},this.isShowMore?this.showLessLabel:this.showMoreLabel)))}get host(){return h(this)}};r.style=":host{display:block}";export{r as salla_filters_widget}