@salla.sa/twilight-components 2.14.393 → 2.14.394

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 (555) hide show
  1. package/dist/cjs/{filepond-D7RVR_w_.js → filepond-C_gLbAbF.js} +1 -1
  2. package/dist/cjs/{filepond-plugin-file-poster-DTuZK2ot.js → filepond-plugin-file-poster-DXWo2FUU.js} +2 -2
  3. package/dist/cjs/{filepond-plugin-file-validate-size-DHc6pF_j.js → filepond-plugin-file-validate-size-fBXMP7ez.js} +1 -1
  4. package/dist/cjs/{filepond-plugin-file-validate-type-DnkcvJVc.js → filepond-plugin-file-validate-type-DEo7juC7.js} +1 -1
  5. package/dist/cjs/{filepond-plugin-image-edit-vrZ1s7kw.js → filepond-plugin-image-edit-4j4e1VEp.js} +1 -1
  6. package/dist/cjs/{filepond-plugin-image-exif-orientation-Bn5JSzQK.js → filepond-plugin-image-exif-orientation-DWqiXxv1.js} +1 -1
  7. package/dist/cjs/{filepond-plugin-image-preview-8qWUFe9n.js → filepond-plugin-image-preview-emT_teia.js} +1 -1
  8. package/dist/cjs/{index-C5VeFDQ0.js → index-B03mYCWz.js} +547 -780
  9. package/dist/cjs/{index-CwD81m7i.js → index-Y-2uyQDK.js} +1 -1
  10. package/dist/cjs/loader.cjs.js +3 -4
  11. package/dist/cjs/salla-accordion-body_2.cjs.entry.js +5 -5
  12. package/dist/cjs/salla-accordion_6.cjs.entry.js +15 -19
  13. package/dist/cjs/salla-add-product-button_4.cjs.entry.js +10 -12
  14. package/dist/cjs/salla-advertisement.cjs.entry.js +3 -3
  15. package/dist/cjs/salla-alert_2.cjs.entry.js +5 -5
  16. package/dist/cjs/salla-app-install-alert.cjs.entry.js +3 -3
  17. package/dist/cjs/salla-apps-icons.cjs.entry.js +3 -3
  18. package/dist/cjs/salla-booking-field_7.cjs.entry.js +23 -25
  19. package/dist/cjs/salla-bullet-delivery.cjs.entry.js +3 -3
  20. package/dist/cjs/salla-cart-coupons.cjs.entry.js +3 -3
  21. package/dist/cjs/salla-cart-item-offers_2.cjs.entry.js +5 -5
  22. package/dist/cjs/salla-comment-form_8.cjs.entry.js +17 -17
  23. package/dist/cjs/salla-conditional-offer.cjs.entry.js +3 -3
  24. package/dist/cjs/salla-contacts.cjs.entry.js +3 -3
  25. package/dist/cjs/salla-cookies-bar.cjs.entry.js +3 -3
  26. package/dist/cjs/salla-count-down.cjs.entry.js +3 -3
  27. package/dist/cjs/salla-custom-fields.cjs.entry.js +3 -3
  28. package/dist/cjs/salla-delivery-promise.cjs.entry.js +1 -1
  29. package/dist/cjs/salla-filters-widget.cjs.entry.js +3 -3
  30. package/dist/cjs/salla-filters.cjs.entry.js +3 -3
  31. package/dist/cjs/salla-fulfillment-methods.cjs.entry.js +1 -1
  32. package/dist/cjs/salla-gifting.cjs.entry.js +3 -3
  33. package/dist/cjs/salla-hook.cjs.entry.js +2 -5
  34. package/dist/cjs/salla-infinite-scroll.cjs.entry.js +3 -3
  35. package/dist/cjs/salla-installment.cjs.entry.js +3 -3
  36. package/dist/cjs/salla-list-tile.cjs.entry.js +3 -3
  37. package/dist/cjs/salla-localization-modal.cjs.entry.js +1 -1
  38. package/dist/cjs/salla-login-modal.cjs.entry.js +3 -3
  39. package/dist/cjs/salla-loyalty-prize-item.cjs.entry.js +3 -3
  40. package/dist/cjs/salla-loyalty-program.cjs.entry.js +3 -3
  41. package/dist/cjs/salla-loyalty.cjs.entry.js +3 -3
  42. package/dist/cjs/salla-maintenance-alert.cjs.entry.js +3 -3
  43. package/dist/cjs/salla-map.cjs.entry.js +3 -3
  44. package/dist/cjs/salla-menu.cjs.entry.js +3 -3
  45. package/dist/cjs/salla-metadata.cjs.entry.js +3 -3
  46. package/dist/cjs/salla-multiple-bundle-product-cart_2.cjs.entry.js +5 -5
  47. package/dist/cjs/salla-multiple-bundle-product-options-modal_2.cjs.entry.js +6 -8
  48. package/dist/cjs/salla-multiple-bundle-product.cjs.entry.js +4 -6
  49. package/dist/cjs/salla-notification-item.cjs.entry.js +3 -3
  50. package/dist/cjs/salla-notifications.cjs.entry.js +3 -3
  51. package/dist/cjs/salla-offer-modal.cjs.entry.js +3 -3
  52. package/dist/cjs/salla-offer.cjs.entry.js +3 -3
  53. package/dist/cjs/salla-order-details-multiple-bundle-product.cjs.entry.js +3 -3
  54. package/dist/cjs/salla-order-details-options.cjs.entry.js +3 -3
  55. package/dist/cjs/salla-order-details.cjs.entry.js +4 -6
  56. package/dist/cjs/salla-order-edit-item.cjs.entry.js +3 -3
  57. package/dist/cjs/salla-order-edit.cjs.entry.js +3 -3
  58. package/dist/cjs/salla-order-summary.cjs.entry.js +3 -3
  59. package/dist/cjs/salla-order-totals-card.cjs.entry.js +4 -6
  60. package/dist/cjs/salla-orders.cjs.entry.js +3 -3
  61. package/dist/cjs/salla-payments.cjs.entry.js +3 -3
  62. package/dist/cjs/salla-placeholder.cjs.entry.js +3 -3
  63. package/dist/cjs/salla-price-range.cjs.entry.js +3 -3
  64. package/dist/cjs/salla-product-card.cjs.entry.js +3 -3
  65. package/dist/cjs/salla-product-size-guide.cjs.entry.js +3 -3
  66. package/dist/cjs/salla-products-list.cjs.entry.js +3 -3
  67. package/dist/cjs/salla-products-slider.cjs.entry.js +3 -3
  68. package/dist/cjs/salla-progress-bar.cjs.entry.js +3 -3
  69. package/dist/cjs/salla-quick-order.cjs.entry.js +3 -3
  70. package/dist/cjs/salla-rating-modal.cjs.entry.js +3 -3
  71. package/dist/cjs/salla-scopes.cjs.entry.js +3 -3
  72. package/dist/cjs/salla-search.cjs.entry.js +4 -6
  73. package/dist/cjs/salla-skeleton.cjs.entry.js +3 -3
  74. package/dist/cjs/salla-slider.cjs.entry.js +3 -3
  75. package/dist/cjs/salla-social-share.cjs.entry.js +3 -3
  76. package/dist/cjs/salla-social.cjs.entry.js +3 -3
  77. package/dist/cjs/salla-tab-content_3.cjs.entry.js +7 -7
  78. package/dist/cjs/salla-tiered-offer.cjs.entry.js +3 -3
  79. package/dist/cjs/salla-tooltip.cjs.entry.js +3 -3
  80. package/dist/cjs/salla-trust-badges.cjs.entry.js +3 -3
  81. package/dist/cjs/salla-user-menu.cjs.entry.js +3 -3
  82. package/dist/cjs/salla-user-profile.cjs.entry.js +3 -3
  83. package/dist/cjs/salla-user-settings.cjs.entry.js +3 -3
  84. package/dist/cjs/salla-verify.cjs.entry.js +3 -3
  85. package/dist/cjs/salla-wallet.cjs.entry.js +3 -3
  86. package/dist/cjs/twilight.cjs.js +4 -5
  87. package/dist/cjs/{vanilla-picker-yKERbLpx.js → vanilla-picker-CKZvBtHS.js} +1 -1
  88. package/dist/collection/collection-manifest.json +2 -3
  89. package/dist/collection/components/salla-accordion/salla-accordion-head.js +2 -2
  90. package/dist/collection/components/salla-accordion/salla-accordion.js +4 -4
  91. package/dist/collection/components/salla-add-product-button/salla-add-product-button.js +19 -19
  92. package/dist/collection/components/salla-alert/salla-alert.js +5 -5
  93. package/dist/collection/components/salla-apps-icons/salla-apps-icons.js +6 -6
  94. package/dist/collection/components/salla-booking-field/salla-booking-field.js +4 -4
  95. package/dist/collection/components/salla-bottom-alert/salla-bottom-alert.js +9 -9
  96. package/dist/collection/components/salla-bullet-delivery/salla-bullet-delivery.js +3 -6
  97. package/dist/collection/components/salla-button/salla-button.js +11 -11
  98. package/dist/collection/components/salla-cart-coupons/salla-cart-coupons.js +1 -2
  99. package/dist/collection/components/salla-cart-item-offers/salla-cart-item-offers.js +8 -8
  100. package/dist/collection/components/salla-cart-summary/salla-cart-summary.js +2 -2
  101. package/dist/collection/components/salla-color-picker/salla-color-picker.js +14 -20
  102. package/dist/collection/components/salla-comment-form/salla-comment-form.js +6 -6
  103. package/dist/collection/components/salla-comments/salla-comment-item.js +3 -2
  104. package/dist/collection/components/salla-comments/salla-comments.js +17 -18
  105. package/dist/collection/components/salla-contacts/salla-contacts.js +10 -10
  106. package/dist/collection/components/salla-count-down/salla-count-down.js +34 -34
  107. package/dist/collection/components/salla-custom-fields/salla-custom-fields.js +7 -9
  108. package/dist/collection/components/salla-datetime-picker/salla-datetime-picker.js +65 -69
  109. package/dist/collection/components/salla-drawer/salla-drawer.js +11 -11
  110. package/dist/collection/components/salla-file-upload/salla-file-upload.js +84 -85
  111. package/dist/collection/components/salla-filters/salla-filters.js +2 -2
  112. package/dist/collection/components/salla-filters-widget/salla-filters-widget.js +5 -4
  113. package/dist/collection/components/salla-gifting/salla-gifting.js +11 -11
  114. package/dist/collection/components/salla-hook/salla-hook.js +2 -2
  115. package/dist/collection/components/salla-infinite-scroll/salla-infinite-scroll.js +6 -6
  116. package/dist/collection/components/salla-installment/salla-installment.js +5 -5
  117. package/dist/collection/components/salla-list-tile/salla-list-tile.js +2 -2
  118. package/dist/collection/components/salla-loading/salla-loading.js +4 -4
  119. package/dist/collection/components/salla-localization-modal/salla-localization-modal.js +5 -5
  120. package/dist/collection/components/salla-login-modal/salla-login-modal.js +14 -14
  121. package/dist/collection/components/salla-loyalty/salla-loyalty-prize-item.js +3 -4
  122. package/dist/collection/components/salla-loyalty/salla-loyalty.js +12 -13
  123. package/dist/collection/components/salla-map/salla-map.js +14 -14
  124. package/dist/collection/components/salla-menu/salla-menu.js +9 -10
  125. package/dist/collection/components/salla-metadata/salla-metadata.js +3 -3
  126. package/dist/collection/components/salla-modal/salla-modal.js +11 -11
  127. package/dist/collection/components/salla-multiple-bundle-product/components/salla-multiple-bundle-product-cart.js +2 -2
  128. package/dist/collection/components/salla-multiple-bundle-product/components/salla-multiple-bundle-product-details.js +2 -2
  129. package/dist/collection/components/salla-multiple-bundle-product/components/salla-multiple-bundle-product-options-modal.js +2 -4
  130. package/dist/collection/components/salla-multiple-bundle-product/components/salla-multiple-bundle-product-slider.js +7 -8
  131. package/dist/collection/components/salla-multiple-bundle-product/salla-multiple-bundle-product.js +2 -2
  132. package/dist/collection/components/salla-notifications/salla-notification-item.js +2 -2
  133. package/dist/collection/components/salla-notifications/salla-notifications.js +3 -3
  134. package/dist/collection/components/salla-offer/salla-offer.js +1 -1
  135. package/dist/collection/components/salla-order-details/salla-order-details-multiple-bundle-product.js +5 -5
  136. package/dist/collection/components/salla-order-details/salla-order-details-options.js +5 -6
  137. package/dist/collection/components/salla-order-details/salla-order-details.js +3 -4
  138. package/dist/collection/components/salla-order-edit/salla-order-edit-item.js +4 -4
  139. package/dist/collection/components/salla-order-edit/salla-order-edit.js +4 -4
  140. package/dist/collection/components/salla-order-summary/salla-order-summary.js +2 -2
  141. package/dist/collection/components/salla-order-totals-card/salla-order-totals-card.js +3 -4
  142. package/dist/collection/components/salla-orders/salla-orders.js +4 -4
  143. package/dist/collection/components/salla-payments/salla-payments.js +1 -0
  144. package/dist/collection/components/salla-placeholder/salla-placeholder.js +3 -3
  145. package/dist/collection/components/salla-price-range/salla-price-range.js +8 -8
  146. package/dist/collection/components/salla-product-availability/salla-product-availability.js +6 -6
  147. package/dist/collection/components/salla-product-card/salla-product-card.js +18 -18
  148. package/dist/collection/components/salla-product-options/salla-product-options.js +13 -15
  149. package/dist/collection/components/salla-products-list/salla-products-list.js +21 -20
  150. package/dist/collection/components/salla-products-slider/salla-products-slider.js +23 -22
  151. package/dist/collection/components/salla-progress-bar/salla-progress-bar.js +20 -21
  152. package/dist/collection/components/salla-quantity-input/salla-quantity-input.js +2 -2
  153. package/dist/collection/components/salla-quick-buy/salla-quick-buy.js +17 -16
  154. package/dist/collection/components/salla-quick-order/salla-quick-order.js +11 -11
  155. package/dist/collection/components/salla-rating-modal/salla-rating-modal.js +2 -2
  156. package/dist/collection/components/salla-rating-stars/salla-rating-stars.js +8 -8
  157. package/dist/collection/components/salla-review-card/salla-review-card.js +3 -3
  158. package/dist/collection/components/salla-reviews/salla-reviews.js +13 -16
  159. package/dist/collection/components/salla-reviews-summary/salla-reviews-summary.js +2 -2
  160. package/dist/collection/components/salla-scopes/salla-scopes.js +2 -2
  161. package/dist/collection/components/salla-search/salla-search.js +6 -6
  162. package/dist/collection/components/salla-skeleton/salla-skeleton.js +3 -3
  163. package/dist/collection/components/salla-slider/salla-slider.js +25 -25
  164. package/dist/collection/components/salla-social-share/salla-social-share.js +3 -3
  165. package/dist/collection/components/salla-tabs/salla-tab-content.js +2 -2
  166. package/dist/collection/components/salla-tabs/salla-tab-header.js +5 -5
  167. package/dist/collection/components/salla-tabs/salla-tabs.js +2 -2
  168. package/dist/collection/components/salla-tel-input/salla-tel-input.js +8 -9
  169. package/dist/collection/components/salla-tooltip/salla-tooltip.js +5 -5
  170. package/dist/collection/components/salla-trust-badges/salla-trust-badges.js +1 -1
  171. package/dist/collection/components/salla-user-menu/salla-user-menu.js +5 -5
  172. package/dist/collection/components/salla-user-profile/salla-user-profile.js +1 -1
  173. package/dist/collection/components/salla-verify/salla-verify.js +4 -4
  174. package/dist/components/Helper.js +432 -1
  175. package/dist/components/_commonjsHelpers.js +7 -1
  176. package/dist/components/anime.es.js +1310 -1
  177. package/dist/components/arrow-left.js +8 -1
  178. package/dist/components/axios.js +4240 -2
  179. package/dist/components/bell-ring.js +8 -1
  180. package/dist/components/camera.js +8 -1
  181. package/dist/components/cancel.js +8 -1
  182. package/dist/components/cart.js +8 -1
  183. package/dist/components/check-circle2.js +15 -1
  184. package/dist/components/check.js +8 -1
  185. package/dist/components/facebook.js +10 -1
  186. package/dist/components/filepond-plugin-file-poster.js +662 -2
  187. package/dist/components/filepond-plugin-file-validate-size.js +204 -2
  188. package/dist/components/filepond-plugin-file-validate-type.js +262 -2
  189. package/dist/components/filepond-plugin-image-edit.js +487 -2
  190. package/dist/components/filepond-plugin-image-exif-orientation.js +214 -2
  191. package/dist/components/filepond-plugin-image-preview.js +2237 -2
  192. package/dist/components/filepond.js +11286 -2
  193. package/dist/components/gift.js +8 -1
  194. package/dist/components/image.js +8 -1
  195. package/dist/components/index.d.ts +0 -2
  196. package/dist/components/index.js +8220 -1
  197. package/dist/components/index2.js +1709 -1
  198. package/dist/components/index3.js +2550 -1
  199. package/dist/components/interfaces.js +12 -1
  200. package/dist/components/isObject.js +292 -1
  201. package/dist/components/keyboard_arrow_down.js +8 -1
  202. package/dist/components/keyboard_arrow_right.js +15 -1
  203. package/dist/components/location.js +11 -1
  204. package/dist/components/mail.js +8 -1
  205. package/dist/components/minus.js +15 -1
  206. package/dist/components/salla-accordion-body.js +6 -1
  207. package/dist/components/salla-accordion-body2.js +30 -1
  208. package/dist/components/salla-accordion-head.js +6 -1
  209. package/dist/components/salla-accordion-head2.js +63 -1
  210. package/dist/components/salla-accordion.js +6 -1
  211. package/dist/components/salla-accordion2.js +68 -1
  212. package/dist/components/salla-add-product-button.js +6 -1
  213. package/dist/components/salla-add-product-button2.js +306 -1
  214. package/dist/components/salla-advertisement.js +155 -1
  215. package/dist/components/salla-alert.js +59 -1
  216. package/dist/components/salla-app-install-alert.js +91 -1
  217. package/dist/components/salla-apps-icons.js +63 -1
  218. package/dist/components/salla-booking-field.js +6 -1
  219. package/dist/components/salla-booking-field2.js +221 -1
  220. package/dist/components/salla-bottom-alert.js +214 -1
  221. package/dist/components/salla-breadcrumb.js +226 -1
  222. package/dist/components/salla-bullet-delivery.js +2114 -1
  223. package/dist/components/salla-button.js +6 -1
  224. package/dist/components/salla-button2.js +174 -1
  225. package/dist/components/salla-cart-coupons.js +284 -1
  226. package/dist/components/salla-cart-item-offers.js +143 -1
  227. package/dist/components/salla-cart-summary.js +136 -1
  228. package/dist/components/salla-color-picker.js +6 -1
  229. package/dist/components/salla-color-picker2.js +260 -1
  230. package/dist/components/salla-comment-form.js +6 -1
  231. package/dist/components/salla-comment-form2.js +64 -1
  232. package/dist/components/salla-comment-item.js +6 -1
  233. package/dist/components/salla-comment-item2.js +217 -1
  234. package/dist/components/salla-comments.js +395 -1
  235. package/dist/components/salla-conditional-fields.js +6 -1
  236. package/dist/components/salla-conditional-fields2.js +137 -1
  237. package/dist/components/salla-conditional-offer.js +194 -1
  238. package/dist/components/salla-contacts.js +125 -1
  239. package/dist/components/salla-cookies-bar.js +107 -1
  240. package/dist/components/salla-count-down.js +6 -1
  241. package/dist/components/salla-count-down2.js +271 -1
  242. package/dist/components/salla-custom-fields.js +175 -1
  243. package/dist/components/salla-datetime-picker.js +6 -1
  244. package/dist/components/salla-datetime-picker2.js +342 -1
  245. package/dist/components/salla-delivery-promise.js +263 -1
  246. package/dist/components/salla-drawer.js +6 -1
  247. package/dist/components/salla-drawer2.js +214 -1
  248. package/dist/components/salla-file-upload.js +6 -1
  249. package/dist/components/salla-file-upload2.js +583 -1
  250. package/dist/components/salla-filters-widget.js +6 -1
  251. package/dist/components/salla-filters-widget2.js +245 -1
  252. package/dist/components/salla-filters.js +253 -1
  253. package/dist/components/salla-fulfillment-methods.js +61 -1
  254. package/dist/components/salla-gifting.js +732 -1
  255. package/dist/components/salla-hook.js +47 -1
  256. package/dist/components/salla-infinite-scroll.js +112 -1
  257. package/dist/components/salla-installment.js +306 -1
  258. package/dist/components/salla-list-tile.js +6 -1
  259. package/dist/components/salla-list-tile2.js +47 -1
  260. package/dist/components/salla-loading.js +6 -1
  261. package/dist/components/salla-loading2.js +51 -1
  262. package/dist/components/salla-localization-modal.js +296 -1
  263. package/dist/components/salla-login-modal.js +6 -1
  264. package/dist/components/salla-login-modal2.js +359 -1
  265. package/dist/components/salla-loyalty-prize-item.js +39 -1
  266. package/dist/components/salla-loyalty-program.js +115 -1
  267. package/dist/components/salla-loyalty.js +304 -1
  268. package/dist/components/salla-maintenance-alert.js +57 -1
  269. package/dist/components/salla-map.js +6 -1
  270. package/dist/components/salla-map2.js +766 -1
  271. package/dist/components/salla-menu.js +165 -1
  272. package/dist/components/salla-metadata.js +97 -1
  273. package/dist/components/salla-modal.js +6 -1
  274. package/dist/components/salla-modal2.js +215 -1
  275. package/dist/components/salla-multiple-bundle-product-cart.js +6 -1
  276. package/dist/components/salla-multiple-bundle-product-cart2.js +151 -1
  277. package/dist/components/salla-multiple-bundle-product-details.js +6 -1
  278. package/dist/components/salla-multiple-bundle-product-details2.js +296 -1
  279. package/dist/components/salla-multiple-bundle-product-options-modal.js +6 -1
  280. package/dist/components/salla-multiple-bundle-product-options-modal2.js +598 -1
  281. package/dist/components/salla-multiple-bundle-product-slider.js +6 -1
  282. package/dist/components/salla-multiple-bundle-product-slider2.js +136 -1
  283. package/dist/components/salla-multiple-bundle-product.js +207 -1
  284. package/dist/components/salla-notification-item.js +6 -1
  285. package/dist/components/salla-notification-item2.js +32 -1
  286. package/dist/components/salla-notifications.js +190 -1
  287. package/dist/components/salla-offer-modal.js +328 -1
  288. package/dist/components/salla-offer.js +478 -1
  289. package/dist/components/salla-order-details-multiple-bundle-product.js +6 -1
  290. package/dist/components/salla-order-details-multiple-bundle-product2.js +122 -1
  291. package/dist/components/salla-order-details-options.js +6 -1
  292. package/dist/components/salla-order-details-options2.js +140 -1
  293. package/dist/components/salla-order-details.js +122 -1
  294. package/dist/components/salla-order-edit-item.js +6 -1
  295. package/dist/components/salla-order-edit-item2.js +181 -1
  296. package/dist/components/salla-order-edit.js +288 -1
  297. package/dist/components/salla-order-summary.js +132 -1
  298. package/dist/components/salla-order-totals-card.js +87 -1
  299. package/dist/components/salla-orders.js +271 -1
  300. package/dist/components/salla-payments.js +76 -1
  301. package/dist/components/salla-placeholder.js +6 -1
  302. package/dist/components/salla-placeholder2.js +66 -1
  303. package/dist/components/salla-price-range.js +6 -1
  304. package/dist/components/salla-price-range2.js +204 -1
  305. package/dist/components/salla-product-availability.js +6 -1
  306. package/dist/components/salla-product-availability2.js +206 -1
  307. package/dist/components/salla-product-card.js +6 -1
  308. package/dist/components/salla-product-card2.js +241 -1
  309. package/dist/components/salla-product-options.js +6 -1
  310. package/dist/components/salla-product-options2.js +962 -1
  311. package/dist/components/salla-product-size-guide.js +130 -1
  312. package/dist/components/salla-products-list.js +6 -1
  313. package/dist/components/salla-products-list2.js +812 -1
  314. package/dist/components/salla-products-slider.js +6 -1
  315. package/dist/components/salla-products-slider2.js +215 -1
  316. package/dist/components/salla-progress-bar.js +6 -1
  317. package/dist/components/salla-progress-bar2.js +94 -1
  318. package/dist/components/salla-quantity-input.js +6 -1
  319. package/dist/components/salla-quantity-input2.js +127 -1
  320. package/dist/components/salla-quick-buy.js +6 -1
  321. package/dist/components/salla-quick-buy2.js +1181 -1
  322. package/dist/components/salla-quick-order.js +299 -1
  323. package/dist/components/salla-rating-modal.js +530 -1
  324. package/dist/components/salla-rating-stars.js +6 -1
  325. package/dist/components/salla-rating-stars2.js +162 -1
  326. package/dist/components/salla-review-card.js +6 -1
  327. package/dist/components/salla-review-card2.js +198 -1
  328. package/dist/components/salla-reviews-page.js +726 -1
  329. package/dist/components/salla-reviews-summary.js +6 -1
  330. package/dist/components/salla-reviews-summary2.js +132 -1
  331. package/dist/components/salla-reviews.js +143 -1
  332. package/dist/components/salla-scopes.js +249 -1
  333. package/dist/components/salla-search.js +213 -1
  334. package/dist/components/salla-skeleton.js +6 -1
  335. package/dist/components/salla-skeleton2.js +50 -1
  336. package/dist/components/salla-slider.js +6 -1
  337. package/dist/components/salla-slider2.js +10489 -1
  338. package/dist/components/salla-social-share.js +194 -1
  339. package/dist/components/salla-social.js +89 -1
  340. package/dist/components/salla-tab-content.js +6 -1
  341. package/dist/components/salla-tab-content2.js +55 -1
  342. package/dist/components/salla-tab-header.js +6 -1
  343. package/dist/components/salla-tab-header2.js +85 -1
  344. package/dist/components/salla-tabs.js +6 -1
  345. package/dist/components/salla-tabs2.js +75 -1
  346. package/dist/components/salla-tel-input.js +6 -1
  347. package/dist/components/salla-tel-input2.js +168 -1
  348. package/dist/components/salla-tiered-offer.js +366 -1
  349. package/dist/components/salla-tooltip.js +6 -1
  350. package/dist/components/salla-tooltip2.js +57 -1
  351. package/dist/components/salla-trust-badges.js +90 -1
  352. package/dist/components/salla-user-menu.js +344 -1
  353. package/dist/components/salla-user-profile.js +203 -1
  354. package/dist/components/salla-user-settings.js +139 -1
  355. package/dist/components/salla-verify.js +303 -1
  356. package/dist/components/salla-wallet.js +114 -1
  357. package/dist/components/search.js +8 -1
  358. package/dist/components/shopping-bag.js +8 -1
  359. package/dist/components/special-discount.js +8 -1
  360. package/dist/components/star.js +8 -1
  361. package/dist/components/star2.js +8 -1
  362. package/dist/components/vanilla-picker.js +1034 -2
  363. package/dist/components/whatsapp2.js +8 -1
  364. package/dist/esm/{filepond-DlGaLh8N.js → filepond-Be7JObSq.js} +1 -1
  365. package/dist/esm/{filepond-plugin-file-poster-BTVFYcQx.js → filepond-plugin-file-poster-DF0NWKCQ.js} +2 -2
  366. package/dist/esm/{filepond-plugin-file-validate-size-DGryLmWv.js → filepond-plugin-file-validate-size-DJFlJHtE.js} +1 -1
  367. package/dist/esm/{filepond-plugin-file-validate-type-DxKfCD0V.js → filepond-plugin-file-validate-type-DykpLW1Z.js} +1 -1
  368. package/dist/esm/{filepond-plugin-image-edit-2W7pu9hn.js → filepond-plugin-image-edit-CyIHxrnW.js} +1 -1
  369. package/dist/esm/{filepond-plugin-image-exif-orientation-OQu-IvPH.js → filepond-plugin-image-exif-orientation-DbCOAhSu.js} +1 -1
  370. package/dist/esm/{filepond-plugin-image-preview-DEW_tSNR.js → filepond-plugin-image-preview-CGRGZcft.js} +1 -1
  371. package/dist/esm/{index-DYB20YqN.js → index-Cz6cYzxG.js} +547 -780
  372. package/dist/esm/{index-BDqMkCqE.js → index-_kPnZdm0.js} +1 -1
  373. package/dist/esm/loader.js +3 -4
  374. package/dist/esm/salla-accordion-body_2.entry.js +5 -5
  375. package/dist/esm/salla-accordion_6.entry.js +15 -19
  376. package/dist/esm/salla-add-product-button_4.entry.js +10 -12
  377. package/dist/esm/salla-advertisement.entry.js +3 -3
  378. package/dist/esm/salla-alert_2.entry.js +5 -5
  379. package/dist/esm/salla-app-install-alert.entry.js +3 -3
  380. package/dist/esm/salla-apps-icons.entry.js +3 -3
  381. package/dist/esm/salla-booking-field_7.entry.js +23 -25
  382. package/dist/esm/salla-bullet-delivery.entry.js +3 -3
  383. package/dist/esm/salla-cart-coupons.entry.js +3 -3
  384. package/dist/esm/salla-cart-item-offers_2.entry.js +5 -5
  385. package/dist/esm/salla-comment-form_8.entry.js +17 -17
  386. package/dist/esm/salla-conditional-offer.entry.js +3 -3
  387. package/dist/esm/salla-contacts.entry.js +3 -3
  388. package/dist/esm/salla-cookies-bar.entry.js +3 -3
  389. package/dist/esm/salla-count-down.entry.js +3 -3
  390. package/dist/esm/salla-custom-fields.entry.js +3 -3
  391. package/dist/esm/salla-delivery-promise.entry.js +1 -1
  392. package/dist/esm/salla-filters-widget.entry.js +3 -3
  393. package/dist/esm/salla-filters.entry.js +3 -3
  394. package/dist/esm/salla-fulfillment-methods.entry.js +1 -1
  395. package/dist/esm/salla-gifting.entry.js +3 -3
  396. package/dist/esm/salla-hook.entry.js +2 -5
  397. package/dist/esm/salla-infinite-scroll.entry.js +3 -3
  398. package/dist/esm/salla-installment.entry.js +3 -3
  399. package/dist/esm/salla-list-tile.entry.js +3 -3
  400. package/dist/esm/salla-localization-modal.entry.js +1 -1
  401. package/dist/esm/salla-login-modal.entry.js +3 -3
  402. package/dist/esm/salla-loyalty-prize-item.entry.js +3 -3
  403. package/dist/esm/salla-loyalty-program.entry.js +3 -3
  404. package/dist/esm/salla-loyalty.entry.js +3 -3
  405. package/dist/esm/salla-maintenance-alert.entry.js +3 -3
  406. package/dist/esm/salla-map.entry.js +3 -3
  407. package/dist/esm/salla-menu.entry.js +3 -3
  408. package/dist/esm/salla-metadata.entry.js +3 -3
  409. package/dist/esm/salla-multiple-bundle-product-cart_2.entry.js +5 -5
  410. package/dist/esm/salla-multiple-bundle-product-options-modal_2.entry.js +6 -8
  411. package/dist/esm/salla-multiple-bundle-product.entry.js +4 -6
  412. package/dist/esm/salla-notification-item.entry.js +3 -3
  413. package/dist/esm/salla-notifications.entry.js +3 -3
  414. package/dist/esm/salla-offer-modal.entry.js +3 -3
  415. package/dist/esm/salla-offer.entry.js +3 -3
  416. package/dist/esm/salla-order-details-multiple-bundle-product.entry.js +3 -3
  417. package/dist/esm/salla-order-details-options.entry.js +3 -3
  418. package/dist/esm/salla-order-details.entry.js +4 -6
  419. package/dist/esm/salla-order-edit-item.entry.js +3 -3
  420. package/dist/esm/salla-order-edit.entry.js +3 -3
  421. package/dist/esm/salla-order-summary.entry.js +3 -3
  422. package/dist/esm/salla-order-totals-card.entry.js +4 -6
  423. package/dist/esm/salla-orders.entry.js +3 -3
  424. package/dist/esm/salla-payments.entry.js +3 -3
  425. package/dist/esm/salla-placeholder.entry.js +3 -3
  426. package/dist/esm/salla-price-range.entry.js +3 -3
  427. package/dist/esm/salla-product-card.entry.js +3 -3
  428. package/dist/esm/salla-product-size-guide.entry.js +3 -3
  429. package/dist/esm/salla-products-list.entry.js +3 -3
  430. package/dist/esm/salla-products-slider.entry.js +3 -3
  431. package/dist/esm/salla-progress-bar.entry.js +3 -3
  432. package/dist/esm/salla-quick-order.entry.js +3 -3
  433. package/dist/esm/salla-rating-modal.entry.js +3 -3
  434. package/dist/esm/salla-scopes.entry.js +3 -3
  435. package/dist/esm/salla-search.entry.js +4 -6
  436. package/dist/esm/salla-skeleton.entry.js +3 -3
  437. package/dist/esm/salla-slider.entry.js +3 -3
  438. package/dist/esm/salla-social-share.entry.js +3 -3
  439. package/dist/esm/salla-social.entry.js +3 -3
  440. package/dist/esm/salla-tab-content_3.entry.js +7 -7
  441. package/dist/esm/salla-tiered-offer.entry.js +3 -3
  442. package/dist/esm/salla-tooltip.entry.js +3 -3
  443. package/dist/esm/salla-trust-badges.entry.js +3 -3
  444. package/dist/esm/salla-user-menu.entry.js +3 -3
  445. package/dist/esm/salla-user-profile.entry.js +3 -3
  446. package/dist/esm/salla-user-settings.entry.js +3 -3
  447. package/dist/esm/salla-verify.entry.js +3 -3
  448. package/dist/esm/salla-wallet.entry.js +3 -3
  449. package/dist/esm/twilight.js +4 -5
  450. package/dist/esm/{vanilla-picker-Dt9vZPZF.js → vanilla-picker-C_YV5LtA.js} +1 -1
  451. package/dist/twilight/{p-33779828.entry.js → p-0200cddd.entry.js} +1 -1
  452. package/dist/twilight/p-04dc0b71.entry.js +4 -0
  453. package/dist/twilight/{p-105b1dab.entry.js → p-0bac200e.entry.js} +1 -1
  454. package/dist/twilight/{p-ccfe5308.entry.js → p-0ef99df1.entry.js} +1 -1
  455. package/dist/twilight/{p-647b6d76.entry.js → p-1087f0dd.entry.js} +1 -1
  456. package/dist/twilight/{p-1875537e.entry.js → p-17dd8b68.entry.js} +1 -1
  457. package/dist/twilight/{p-aa7c5de0.entry.js → p-25a9bf1b.entry.js} +1 -1
  458. package/dist/twilight/{p-34b670fc.entry.js → p-2602927d.entry.js} +1 -1
  459. package/dist/twilight/p-268695ff.entry.js +4 -0
  460. package/dist/twilight/{p-aaa0c743.entry.js → p-34920aac.entry.js} +1 -1
  461. package/dist/twilight/{p-817b8ba5.entry.js → p-3656b48d.entry.js} +1 -1
  462. package/dist/twilight/{p-4932857d.entry.js → p-3857beb4.entry.js} +1 -1
  463. package/dist/twilight/{p-af3c74f4.entry.js → p-39c601e3.entry.js} +1 -1
  464. package/dist/twilight/{p-b598c0f7.entry.js → p-3c810881.entry.js} +1 -1
  465. package/dist/twilight/{p-d371d450.entry.js → p-3cf5c61f.entry.js} +1 -1
  466. package/dist/twilight/{p-3ccc532d.entry.js → p-413a7236.entry.js} +1 -1
  467. package/dist/twilight/{p-f176d41d.entry.js → p-42778349.entry.js} +1 -1
  468. package/dist/twilight/{p-b17d055d.entry.js → p-45e4f6f4.entry.js} +1 -1
  469. package/dist/twilight/{p-2abaa633.entry.js → p-4680956b.entry.js} +1 -1
  470. package/dist/twilight/{p-96a20515.entry.js → p-468b999f.entry.js} +1 -1
  471. package/dist/twilight/{p-df6853b5.entry.js → p-46d1823f.entry.js} +1 -1
  472. package/dist/twilight/{p-c87951a2.entry.js → p-49db497f.entry.js} +1 -1
  473. package/dist/twilight/{p-18bb0181.entry.js → p-4b033276.entry.js} +1 -1
  474. package/dist/twilight/{p-296d2dd0.entry.js → p-4f7bc9c3.entry.js} +1 -1
  475. package/dist/twilight/{p-4fa4547a.entry.js → p-543ee624.entry.js} +1 -1
  476. package/dist/twilight/{p-2fe01e44.entry.js → p-5957f774.entry.js} +1 -1
  477. package/dist/twilight/{p-96e78428.entry.js → p-5a4f0b99.entry.js} +1 -1
  478. package/dist/twilight/{p-87c0ca91.entry.js → p-5a8c0fd2.entry.js} +1 -1
  479. package/dist/twilight/{p-e28c0773.entry.js → p-5ab7a295.entry.js} +1 -1
  480. package/dist/twilight/{p-542d3277.entry.js → p-5e496aaa.entry.js} +1 -1
  481. package/dist/twilight/{p-c3ffb88a.entry.js → p-5f440956.entry.js} +1 -1
  482. package/dist/twilight/{p-94dbc1e9.entry.js → p-60fafcd9.entry.js} +1 -1
  483. package/dist/twilight/{p-1ef2602d.entry.js → p-708f02db.entry.js} +1 -1
  484. package/dist/twilight/{p-b64f3155.entry.js → p-7829ea8a.entry.js} +1 -1
  485. package/dist/twilight/{p-7093a427.entry.js → p-7d3e592a.entry.js} +1 -1
  486. package/dist/twilight/{p-96d03a28.entry.js → p-81876026.entry.js} +1 -1
  487. package/dist/twilight/{p-d9f5a8cd.entry.js → p-8306ef5e.entry.js} +1 -1
  488. package/dist/twilight/{p-d4a242f8.entry.js → p-8403cd93.entry.js} +1 -1
  489. package/dist/twilight/{p-7abddca8.entry.js → p-8474c4f6.entry.js} +1 -1
  490. package/dist/twilight/p-8552160a.entry.js +4 -0
  491. package/dist/twilight/p-8c9b0e2a.entry.js +4 -0
  492. package/dist/twilight/{p-2881bb33.entry.js → p-8f2dfc57.entry.js} +1 -1
  493. package/dist/twilight/{p-c091e2dc.entry.js → p-94b1a2ae.entry.js} +1 -1
  494. package/dist/twilight/{p-ede67a08.entry.js → p-95dad1af.entry.js} +1 -1
  495. package/dist/twilight/{p-eac718cd.entry.js → p-964b7db9.entry.js} +1 -1
  496. package/dist/twilight/{p-e3b8e0e1.entry.js → p-99735748.entry.js} +1 -1
  497. package/dist/twilight/{p-X6Yi3bYP.js → p-BZKDQg1s.js} +1 -1
  498. package/dist/twilight/{p-Cw3UBzjl.js → p-B_sN7OnY.js} +1 -1
  499. package/dist/twilight/{p-8r0S6BcZ.js → p-Bpi0aG1F.js} +1 -1
  500. package/dist/twilight/{p-BkClxrC4.js → p-CP8rFQ5n.js} +1 -1
  501. package/dist/twilight/{p-bNzv71Xl.js → p-CfmIbM8B.js} +1 -1
  502. package/dist/twilight/{p-bScl0xMh.js → p-CpO1SrBd.js} +1 -1
  503. package/dist/twilight/p-Cz6cYzxG.js +5 -0
  504. package/dist/twilight/p-Do4hSOGo.js +9 -0
  505. package/dist/twilight/{p-Ck4zxCil.js → p-JJmlh-ji.js} +1 -1
  506. package/dist/twilight/{p-dd2bd5dc.entry.js → p-a4aedcfe.entry.js} +1 -1
  507. package/dist/twilight/{p-06fa7327.entry.js → p-b0d01f9f.entry.js} +1 -1
  508. package/dist/twilight/p-b8404cfb.entry.js +4 -0
  509. package/dist/twilight/{p-108d8c8b.entry.js → p-b8e3e180.entry.js} +1 -1
  510. package/dist/twilight/{p-ad07f67a.entry.js → p-bd687cd0.entry.js} +1 -1
  511. package/dist/twilight/{p-44fa7521.entry.js → p-c0037fac.entry.js} +1 -1
  512. package/dist/twilight/{p-293c6cf3.entry.js → p-c121f8e4.entry.js} +1 -1
  513. package/dist/twilight/{p-a01f1992.entry.js → p-c29907df.entry.js} +1 -1
  514. package/dist/twilight/p-c39675ef.entry.js +4 -0
  515. package/dist/twilight/{p-bff4c7b3.entry.js → p-cb7a985e.entry.js} +1 -1
  516. package/dist/twilight/p-cbe620c4.entry.js +4 -0
  517. package/dist/twilight/{p-6f36541a.entry.js → p-d2fd79b4.entry.js} +1 -1
  518. package/dist/twilight/{p-d337c399.entry.js → p-d6cf0ffd.entry.js} +1 -1
  519. package/dist/twilight/{p-748df7e6.entry.js → p-d8f60f2f.entry.js} +1 -1
  520. package/dist/twilight/p-d99610f9.entry.js +4 -0
  521. package/dist/twilight/{p-e6bbf50d.entry.js → p-dc897bdd.entry.js} +1 -1
  522. package/dist/twilight/{p-f7999a6d.entry.js → p-dca46236.entry.js} +1 -1
  523. package/dist/twilight/{p-e94f217b.entry.js → p-e48853c9.entry.js} +1 -1
  524. package/dist/twilight/{p-09d39785.entry.js → p-e4fdb206.entry.js} +1 -1
  525. package/dist/twilight/p-ed913ae7.entry.js +4 -0
  526. package/dist/twilight/p-f067fcd6.entry.js +4 -0
  527. package/dist/twilight/{p-57ff1f25.entry.js → p-f2cd6975.entry.js} +1 -1
  528. package/dist/twilight/{p-ad041ab5.entry.js → p-f2ffbfbb.entry.js} +1 -1
  529. package/dist/twilight/{p-f5d15e71.entry.js → p-f3166e60.entry.js} +1 -1
  530. package/dist/twilight/{p-59ae82bd.entry.js → p-f8fcc8f4.entry.js} +1 -1
  531. package/dist/twilight/{p-c1fd45b1.entry.js → p-f9e52fd9.entry.js} +1 -1
  532. package/dist/twilight/p-fcddbfc3.entry.js +4 -0
  533. package/dist/twilight/{p-41c733c2.entry.js → p-fe7ac9bb.entry.js} +1 -1
  534. package/dist/twilight/{p-0add06f9.entry.js → p-ff14dca3.entry.js} +1 -1
  535. package/dist/twilight/{p-BZnoSB1s.js → p-mlFGjxcj.js} +1 -1
  536. package/dist/twilight/twilight.esm.js +1 -1
  537. package/dist/types/components.d.ts +177 -763
  538. package/dist/types/stencil-public-runtime.d.ts +11 -169
  539. package/package.json +5 -5
  540. package/dist/cjs/app-globals-oehrC7QI.js +0 -39
  541. package/dist/esm/app-globals-BFryt7-C.js +0 -37
  542. package/dist/twilight/p-1daeed6e.entry.js +0 -4
  543. package/dist/twilight/p-2ddb3fce.entry.js +0 -4
  544. package/dist/twilight/p-34968e31.entry.js +0 -4
  545. package/dist/twilight/p-665189b4.entry.js +0 -4
  546. package/dist/twilight/p-776c9d33.entry.js +0 -4
  547. package/dist/twilight/p-7b8313ef.entry.js +0 -4
  548. package/dist/twilight/p-7bd0ede5.entry.js +0 -4
  549. package/dist/twilight/p-8e8d9d7d.entry.js +0 -4
  550. package/dist/twilight/p-D1vqXXNX.js +0 -9
  551. package/dist/twilight/p-DYB20YqN.js +0 -5
  552. package/dist/twilight/p-Vl6qpttb.js +0 -4
  553. package/dist/twilight/p-af60e72a.entry.js +0 -4
  554. package/dist/twilight/p-e679884a.entry.js +0 -4
  555. package/dist/twilight/p-efab88c5.entry.js +0 -4
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r as s,c as t,h as i,H as e,g as h}from"./p-DYB20YqN.js";import{H as a}from"./p-CHf8XdiS.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:"e93cfb9f1f6daeb8a2121ccb36a3cf135a55e902",class:"s-filters-widget-container"},i("h3",{key:"d5ef45d78e0119e2ac997ded417e310c0a797c34",class:"s-filters-widget-title",onClick:()=>this.toggleWidget()},i("span",{key:"fe4df56fad0d290395d78588456fb7d00a20ed43"},this.option.label),i("span",{key:"c961f86b5e06437dfdd145e164da5fe326500032",class:"s-filters-widget-plusminus "+(this.isOpen?"s-filters-widget-plusminus-active":"")})),i("div",{key:"7cf1ed1b562bf16acc481f682965567d8bc1813c",class:"s-filters-widget-content",ref:s=>this.widgetContent=s},Array.isArray(this.option.values)&&this.option.values.length>5&&i("div",{key:"275427371f48fdfc8ef8b80b9d3e11fa247f7d7a",class:"s-filters-widget-search-wrapper",style:{padding:"8px 0",marginBottom:"8px"}},i("input",{key:"473c082ed9f7415beba445d36a121027eaadbbe1",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:"e45654731cdd801345acc5b3311d9ddab3020035",class:"s-filters-widget-values",ref:s=>this.widgetValues=s},i("slot",{key:"5ae673157a4b579a000901b04db8e375a52565e7"}),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:"8ec08429d8fb31b338e6f9f9cf455b5ba2155cb8",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}
4
+ import{r as s,c as t,h as i,H as e,a as h}from"./p-Cz6cYzxG.js";import{H as a}from"./p-CHf8XdiS.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:"e93cfb9f1f6daeb8a2121ccb36a3cf135a55e902",class:"s-filters-widget-container"},i("h3",{key:"d5ef45d78e0119e2ac997ded417e310c0a797c34",class:"s-filters-widget-title",onClick:()=>this.toggleWidget()},i("span",{key:"fe4df56fad0d290395d78588456fb7d00a20ed43"},this.option.label),i("span",{key:"c961f86b5e06437dfdd145e164da5fe326500032",class:"s-filters-widget-plusminus "+(this.isOpen?"s-filters-widget-plusminus-active":"")})),i("div",{key:"7cf1ed1b562bf16acc481f682965567d8bc1813c",class:"s-filters-widget-content",ref:s=>this.widgetContent=s},Array.isArray(this.option.values)&&this.option.values.length>5&&i("div",{key:"275427371f48fdfc8ef8b80b9d3e11fa247f7d7a",class:"s-filters-widget-search-wrapper",style:{padding:"8px 0",marginBottom:"8px"}},i("input",{key:"473c082ed9f7415beba445d36a121027eaadbbe1",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:"e45654731cdd801345acc5b3311d9ddab3020035",class:"s-filters-widget-values",ref:s=>this.widgetValues=s},i("slot",{key:"5ae673157a4b579a000901b04db8e375a52565e7"}),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:"8ec08429d8fb31b338e6f9f9cf455b5ba2155cb8",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}
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r as a,h as c,H as s,c as e,g as t}from"./p-DYB20YqN.js";import{p as d,m as o}from"./p-DfeagqF1.js";const i=class{constructor(c){a(this,c)}render(){return c(s,{key:"298d42a5bf1bcefdb181ec35060220cf749b56ed",class:"s-accordion-body-wrapper"},c("slot",{key:"6ab081e8b71b5dc69fb66fbdec82b4725ab53b0d"}))}};i.style="";const r=class{constructor(c){a(this,c),this.accordionToggle=e(this,"accordionToggle"),this.collapsible=!1,this.collapsed=!0}emitCollapsePanel(){this.accordionToggle.emit({payload:{collapsed:this.collapsed}})}toggleCollapse(){this.collapsible&&(this.collapsed=!this.collapsed,this.host.parentElement?.setAttribute("data-collapsed",this.collapsed.toString()),this.host.parentElement?.querySelector("salla-accordion-body")?.setAttribute("data-collapsed",this.collapsed.toString()),this.emitCollapsePanel())}render(){return c(s,{key:"9d88d243306cdf451c20d7068fbb9f48807b22e9","data-collapsed":this.collapsed.toString(),onClick:()=>this.toggleCollapse(),class:"s-accordion-head-wrapper"},c("div",{key:"bad4c5a913ce1c4581b09c0b6d96fcbdb4236638",class:"s-accordion-head-wrapper-start"},c("slot",{key:"acb83cec8cbca5771a9f84e81c0b955c3edad731",name:"title"}),c("slot",{key:"a4ad42ea6fad4f452c4c218a9ee02dca0adb4a67",name:"progress"}),c("slot",{key:"96ab95d413dc906ac299079f4008816f01881990",name:"html"})),(this.collapsible||this.host.querySelector('[slot="note"]'))&&c("div",{key:"8f9666a5038cd7b1ac6e357c6920ea26d31c5f03",class:"s-accordion-head-wrapper-end"},c("slot",{key:"14895e8c1385e91c14f046c9ae38ce5e4a4c9a60",name:"note"}),this.collapsible&&c("button",{key:"97dc7fabbb207fcc8b68ebf0a86f6c8a980dca13",class:{"s-accordion-head-wrapper-toggle":!0,active:!this.collapsed},onClick:a=>{a.stopPropagation(),this.toggleCollapse()}},c("span",{key:"3b24faf71dcd332663a354310b2ce09f7879eddc",class:"s-accordion-head-wrapper-toggle-icon",innerHTML:this.collapsed?d:o}))))}get host(){return t(this)}};r.style="";export{i as salla_accordion_body,r as salla_accordion_head}
4
+ import{r as a,h as c,H as s,c as e,a as t}from"./p-Cz6cYzxG.js";import{p as d,m as o}from"./p-DfeagqF1.js";const i=class{constructor(c){a(this,c)}render(){return c(s,{key:"298d42a5bf1bcefdb181ec35060220cf749b56ed",class:"s-accordion-body-wrapper"},c("slot",{key:"6ab081e8b71b5dc69fb66fbdec82b4725ab53b0d"}))}};i.style="";const r=class{constructor(c){a(this,c),this.accordionToggle=e(this,"accordionToggle"),this.collapsible=!1,this.collapsed=!0}emitCollapsePanel(){this.accordionToggle.emit({payload:{collapsed:this.collapsed}})}toggleCollapse(){this.collapsible&&(this.collapsed=!this.collapsed,this.host.parentElement?.setAttribute("data-collapsed",this.collapsed.toString()),this.host.parentElement?.querySelector("salla-accordion-body")?.setAttribute("data-collapsed",this.collapsed.toString()),this.emitCollapsePanel())}render(){return c(s,{key:"9d88d243306cdf451c20d7068fbb9f48807b22e9","data-collapsed":this.collapsed.toString(),onClick:()=>this.toggleCollapse(),class:"s-accordion-head-wrapper"},c("div",{key:"bad4c5a913ce1c4581b09c0b6d96fcbdb4236638",class:"s-accordion-head-wrapper-start"},c("slot",{key:"acb83cec8cbca5771a9f84e81c0b955c3edad731",name:"title"}),c("slot",{key:"a4ad42ea6fad4f452c4c218a9ee02dca0adb4a67",name:"progress"}),c("slot",{key:"96ab95d413dc906ac299079f4008816f01881990",name:"html"})),(this.collapsible||this.host.querySelector('[slot="note"]'))&&c("div",{key:"8f9666a5038cd7b1ac6e357c6920ea26d31c5f03",class:"s-accordion-head-wrapper-end"},c("slot",{key:"14895e8c1385e91c14f046c9ae38ce5e4a4c9a60",name:"note"}),this.collapsible&&c("button",{key:"97dc7fabbb207fcc8b68ebf0a86f6c8a980dca13",class:{"s-accordion-head-wrapper-toggle":!0,active:!this.collapsed},onClick:a=>{a.stopPropagation(),this.toggleCollapse()}},c("span",{key:"3b24faf71dcd332663a354310b2ce09f7879eddc",class:"s-accordion-head-wrapper-toggle-icon",innerHTML:this.collapsed?d:o}))))}get host(){return t(this)}};r.style="";export{i as salla_accordion_body,r as salla_accordion_head}
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r as t,c as s,h as i,H as e,g as n}from"./p-DYB20YqN.js";import{A as o,a as l}from"./p-Vqpj4CWE.js";const d=class{constructor(i){t(this,i),this.optionsSaved=s(this,"optionsSaved"),this.productSelected=s(this,"productSelected"),this.product=null,this.sectionId=null,this.sectionIndex=0,this.productIndex=0,this.selectedOptions={},this.optionsResetTokens={},this.isLoading=!1,this.hasUnsavedChanges=!1,this.validationErrors=[]}generateCacheKey(t,s,i){return`${t||"unknown"}-${s||0}-${i||"unknown"}`}handleProductChange(t){setTimeout((()=>{this.modal&&t&&this.modal.setTitle(t.name||"")}),100),this.validationErrors=[],this.hasUnsavedChanges=!1}async open(){this.modal?(this.isLoading=!0,this.product?.name&&this.modal.setTitle(this.product.name),this.modal.open(),setTimeout((async()=>{this.product?.id&&await this.initializeSelectedOptions(),this.product?.name&&this.modal.setTitle(this.product.name),this.modal.stopLoading(),this.isLoading=!1}),300)):requestAnimationFrame((()=>this.open()))}async close(){this.modal&&this.modal.close()}async refreshOptionsState(){this.selectedOptions={...this.selectedOptions}}componentDidLoad(){this.modalOpenListener=t=>{this.product=t.product,this.sectionId=t.sectionId||null,this.sectionIndex=t.sectionIndex||0,this.productIndex=t.productIndex||0,this.open()},salla.event.on("multiple-bundle-product-modal::open",this.modalOpenListener),this.clearOptionsListener=t=>{t&&t.productId&&this.clearProductOptions(t.productId,t.sectionId,t.productIndex)},salla.event.on("multiple-bundle-product-modal::clear-options",this.clearOptionsListener),this.optionChangeListener=t=>{const s=t.detail||t,{option:i,detail:e}=s,n=i||s.option_id&&this.product?.options?.find((t=>t.id===s.option_id||String(t.id)===String(s.option_id))),o=e||(s.id?s:null);this.product?.id&&n&&this.handleOptionChange(Number(this.product.id),n,o)},salla.event.on("product-options::change",this.optionChangeListener),this.checkboxChangeListener=t=>{const s=t.target;if(s&&"checkbox"===s.type&&s.name&&s.name.includes("bundle[")&&s.name.includes("][id]")){const t=s.name.match(/^bundle\[([^\]]+)\]\[([^\]]+)\]\[id\]$/);if(t&&!s.checked){const[,i,e]=t,n=s.value,o=this.host.closest("form");this.cleanupProductDeselection({sectionId:i,productIndex:parseInt(e,10),productId:n,form:o,uncheckedInput:s})}}},document.addEventListener("change",this.checkboxChangeListener)}disconnectedCallback(){this.checkboxChangeListener&&document.removeEventListener("change",this.checkboxChangeListener),this.optionChangeListener&&salla.event.off("product-options::change",this.optionChangeListener),this.modalOpenListener&&salla.event.off("multiple-bundle-product-modal::open",this.modalOpenListener),this.clearOptionsListener&&salla.event.off("multiple-bundle-product-modal::clear-options",this.clearOptionsListener)}cleanupProductDeselection(t){const{sectionId:s,productIndex:i,productId:e,form:n,uncheckedInput:o}=t;if(this.clearProductOptions(e,s,i),n){const t=`bundle[${s}][${i}]`;Array.from(n.querySelectorAll(`input[name^="${t}"]`)).forEach((s=>{if(s===o)return;const i="hidden"===s.type,n=s.getAttribute("data-product-id")===String(e)&&s.name?.startsWith(t);(i||n)&&s.remove()})),requestAnimationFrame((()=>{const t=new window.Event("change",{bubbles:!0});n.dispatchEvent(t)}))}}generateFormInputName(t,s,i){return`bundle[${t}][${s}][options][${i}]`}async initializeSelectedOptions(){if(!this.product?.id)return;const t=this.product.id,s=this.generateCacheKey(this.sectionId,this.productIndex,t),i=document.querySelector(`salla-product-options[product-id="${t}"]`);if(i)try{const t=await i.getSelectedOptions();t&&t.length>0&&(this.selectedOptions={...this.selectedOptions,[s]:t})}catch(t){console.warn("Could not initialize selected options:",t)}}clearProductOptions(t,s,i){const e={...this.selectedOptions};if(null==s||null==i||Number.isNaN(i)){const s=`-${String(t)}`,i=[];Object.keys(e).forEach((t=>{t.endsWith(s)&&(delete e[t],i.push(t))})),i.forEach((t=>this.bumpOptionsResetToken(t)))}else{const n=this.generateCacheKey(s,i,t);delete e[n],this.bumpOptionsResetToken(n)}this.selectedOptions=e,this.validationErrors=[],this.hasUnsavedChanges=!1}bumpOptionsResetToken(t){t&&(this.optionsResetTokens={...this.optionsResetTokens,[t]:(this.optionsResetTokens[t]||0)+1})}async handleOptionChange(t,s,i){const e=this.generateCacheKey(this.sectionId,this.productIndex,t),n=document.querySelector(`salla-product-options[product-id="${t}"]`);let o=[];if(n)try{o=await n.getSelectedOptions()||[]}catch(t){console.warn("Could not get current selections from component:",t)}if(o.length>0)this.selectedOptions={...this.selectedOptions,[e]:o};else if(this.selectedOptions[e]&&this.selectedOptions[e].length>0){const t=[...this.selectedOptions[e]||[]],n=t.findIndex((t=>t.option_id===s.id));n>-1?i&&null!=i.id?t[n]={...i,option_id:s.id}:t.splice(n,1):i&&null!=i.id&&t.push({...i,option_id:s.id}),this.selectedOptions={...this.selectedOptions,[e]:t}}else i&&null!=i.id&&(this.selectedOptions={...this.selectedOptions,[e]:[{...i,option_id:s.id}]});this.hasUnsavedChanges=!0,this.validationErrors=[]}async validateOptions(){if(!this.product?.options)return!0;const t=[],s=this.product.id,i=this.generateCacheKey(this.sectionId,this.productIndex,s),e=document.querySelector(`salla-product-options[product-id="${s}"]`);let n=[];if(e)try{n=await e.getSelectedOptions()||[];const t=this.selectedOptions[i]||[];(t.length>n.length||0===n.length&&t.length>0)&&(n=t)}catch(t){n=this.selectedOptions[i]||[]}else n=this.selectedOptions[i]||[];return 0===n.length&&t.push(salla.lang.get("pages.products.no_options_selected")),this.product.options.forEach((s=>{s.required&&(n.some((t=>t.option_id==s.id))||t.push(salla.lang.get("pages.products.required_option_missing",{option:s.name})))})),this.validationErrors=t,0===t.length}async onSave(t){t.preventDefault();const s=this.product?.id;if(!s)return;const i=this.generateCacheKey(this.sectionId,this.productIndex,s);if(await new Promise((t=>setTimeout(t,100))),await this.validateOptions()){this.isLoading=!0;try{const t=document.querySelector(`salla-product-options[product-id="${s}"]`);let e=await(t?.getSelectedOptions());if((!e||0===e.length)&&this.selectedOptions[i]?.length>0&&(e=this.selectedOptions[i]),!e||0===e.length)return void(this.isLoading=!1);this.selectedOptions={...this.selectedOptions,[i]:e};const n=this.host.closest("form");if(!n)return void(this.isLoading=!1);const o=`bundle[${this.sectionId}][${this.productIndex}]`;Array.from(n.querySelectorAll(`input[name^="${o}"][type="hidden"]`)).forEach((t=>t.remove())),Array.from(n.querySelectorAll(`[data-product-id="${s}"][name^="${o}"]`)).forEach((t=>t.remove()));const l=`bundle[${this.sectionId}][${this.productIndex}][id]`,d=document.getElementById(l);if(d)d.checked=!0;else{const t=document.createElement("input");t.type="hidden",t.name=`bundle[${this.sectionId}][${this.productIndex}][id]`,t.value=String(s),t.dataset.productId=String(s),n.appendChild(t)}e.forEach((t=>{const i=t.option_id,e=document.createElement("input");e.type="hidden",e.name=this.generateFormInputName(this.sectionId,this.productIndex??0,i),e.value=String(t.id),e.dataset.productId=String(s),n.appendChild(e)}));const a=new window.Event("change",{bubbles:!0});n.dispatchEvent(a),this.optionsSaved.emit({productId:Number(s),selectedOptions:e,sectionId:this.sectionId,productIndex:this.productIndex}),this.sectionId&&this.productSelected.emit({productId:Number(s),sectionId:this.sectionId,product:this.product,fromModal:!0}),salla.notify.success(salla.lang.get("pages.products.options_saved")),this.hasUnsavedChanges=!1,this.validationErrors=[],this.modal.close()}catch(t){salla.notify.error(salla.lang.get("pages.products.options_save_error"))}finally{this.isLoading=!1}}else salla.notify.error(this.validationErrors.join(", "))}getOptionsWithSelectedState(){if(!this.product?.options)return[];const t=this.generateCacheKey(this.sectionId,this.productIndex,this.product.id),s=this.selectedOptions[t]||[];return this.product.options.map((t=>({...t,details:t.details.map((t=>{const i=s.some((s=>s.id===t.id));return{...t,is_selected:i}}))})))}render(){const t=this.product?.id,s=this.getOptionsWithSelectedState(),n=this.generateCacheKey(this.sectionId,this.productIndex,t),o=this.optionsResetTokens[n]||0,l=this.isLoading||s.some((t=>t.details.some((t=>t.is_selected&&!0===t.is_out))));return i(e,{key:"2daff50a76067220f79c498bf756db36aec2996f"},i("salla-modal",{key:"3ed6ec8860016d10cec0ee5d4bf55125fc3e44f0",isLoading:this.isLoading,ref:t=>this.modal=t,width:"md",centered:!1,id:`s-multiple-bundle-product-options-modal-options-${t}`,class:"s-multiple-bundle-product-options-modal-wrapper"},i("div",{key:"9896b07b43cf0e8191d3c7e1ba6d0613d31f08f3",slot:"loading"},i("salla-skeleton",{key:"cdf032bdbaebc1e54136b5380a10f9077a781ab0",height:"100%",width:"100%"})),this.product?.images&&this.product?.images.length>0&&i("salla-slider",{key:"5df7c6e1868f3b3ca8983ff1baa43ad3351aeca2",id:`details-slider-${this.product?.id}`,type:"thumbs",loop:!1,"auto-height":!0,"listen-to-thumbnails-option":!0,showThumbsControls:!1,controlsOuter:!1,showControls:!1,class:"s-multiple-bundle-product-options-modal-slider",verticalThumbs:!0,thumbsConfig:{centeredSlides:!0,centeredSlidesBounds:!0,slidesPerView:Math.min(5,Math.max(1,this.product?.images.length)),watchOverflow:!0,watchSlidesProgress:!0,direction:"vertical",spaceBetween:10}},i("div",{key:"190198c7256c9669c25d0cd587cf5193bd75c57e",slot:"items"},this.product?.images&&this.product?.images.map(((t,s)=>i("div",{key:s,class:"swiper-slide"},i("img",{src:t.url,alt:t.alt||`${this.product?.name} - Image ${s+1}`,loading:"lazy",onError:t=>{t.target.style.display="none"}}))))),this.product?.images&&this.product?.images.length>1&&i("div",{key:"1c8d14ffc416800d19ac3cc87b463da2acede83e",slot:"thumbs"},this.product?.images&&this.product?.images.map(((t,s)=>i("div",{key:s,"data-caption":`${this.product?.name} - Image ${s+1}`},i("img",{src:t.url,loading:"eager",class:"s-multiple-bundle-product-options-modal-slider-thumb",title:`${this.product?.name} - ${s+1}`,alt:t.alt||`${this.product?.name} - ${s+1}`,onError:t=>{t.target.style.display="none"}})))))),i("salla-product-options",{options:JSON.stringify(s),key:`${n}-reset-${o}`,"product-id":t,"unique-key":`${n}-reset-${o}`}),i("div",{key:"52dd62ee4b96b11a10981cccd301ad199adfa61e",slot:"footer"},i("div",{key:"c846f4d9099936f41872fe99f3d0b8a789f90c01",class:"s-multiple-bundle-product-options-modal-footer"},i("salla-button",{key:"40d0742d67f6ab45deace262dbd085feba3d8980",onClick:t=>this.onSave(t),loading:this.isLoading,disabled:l},this.isLoading?salla.lang.get("common.elements.saving"):salla.lang.get("common.elements.save"))))))}get host(){return n(this)}static get watchers(){return{product:[{handleProductChange:0}]}}};d.style=":host{display:block}";const a=class{constructor(i){t(this,i),this.productSelected=s(this,"productSelected"),this.productOptionsSelected=s(this,"productOptionsSelected"),this.selectedProducts={},this.savedOptionsByInstance={},this.handleProductClick=(t,s)=>{const i=this.generateEventName(this.section.id,s),e=document.getElementById(i);if(e){if(e){const i=!e.checked;i||(this.dispatchClearOptionsEvent(t,s),this.clearSavedOptionsState(this.section.id,s)),e.checked=i,requestAnimationFrame((()=>{const t=new window.Event("change",{bubbles:!0});e.dispatchEvent(t)}))}this.productSelected.emit({product:t,sectionId:this.section.id})}},this.handleOptionsClick=t=>{this.productOptionsSelected.emit({product:t,sectionId:this.section.id})}}getProductInstanceKey(t,s){return`${t}::${s}`}dispatchClearOptionsEvent(t,s){salla.event.dispatch("multiple-bundle-product-modal::clear-options",{productId:t.id,sectionId:this.section.id,sectionIndex:this.sectionIndex,productIndex:s})}handleOptionsSaved(t){const s=t.detail;if(!s)return;const{sectionId:i,productIndex:e,selectedOptions:n}=s;if(null==i||i!==this.section?.id)return;if(null==e||Number.isNaN(e))return;const o=this.getProductInstanceKey(i,e);if(n?.length)this.savedOptionsByInstance={...this.savedOptionsByInstance,[o]:!0};else if(this.savedOptionsByInstance[o]){const t={...this.savedOptionsByInstance};delete t[o],this.savedOptionsByInstance=t}}clearSavedOptionsState(t,s){const i=this.getProductInstanceKey(t,s);if(!this.savedOptionsByInstance[i])return;const e={...this.savedOptionsByInstance};delete e[i],this.savedOptionsByInstance=e}generateEventName(t,s){return`bundle[${t}][${s}][id]`}render(){return i(e,{key:"df82c8c561e6ef9718a179be2815ed01789700a0"},i("salla-slider",{key:"b7b96681ce045a2dad72edf9cdbda7ea1b3f3c2e",type:"carousel",controlsOuter:!1,showControls:!1,id:`accordion-multiple-bundle-product-${this.section.id}`,pagination:!0,class:"s-multiple-bundle-product-wrapper-slider",sliderConfig:{spaceBetween:0}},i("div",{key:"9762b78a8c67586f2455632632a1e97eefcddbaf",slot:"items"},this?.section?.products?.map(((t,s)=>{const e=this.selectedProducts[this.section.id]?.has(t.id)||!1,n=this.savedOptionsByInstance[this.getProductInstanceKey(this.section.id,s)]?salla.lang.getWithDefault("pages.products.edit_selected_options","تعديل الخيارات"):salla.lang.get("pages.products.choose_from_options");let d=salla.config.get("theme.is_rtl",!0)?o:l;return i("div",{class:"s-multiple-bundle-product-slide-one-third "+(0==t.quantity?"s-multiple-bundle-product-slide-one-third-disabled":""),key:t.id},i("div",{class:"s-multiple-bundle-product-card"},i("div",{class:"s-multiple-bundle-product-image-wrapper",onClick:()=>this.handleProductClick(t,s)},i("input",{id:this.generateEventName(this.section.id,s),type:"checkbox",class:"s-multiple-bundle-product-checkbox",checked:e,name:this.generateEventName(this.section.id,s),value:t.id}),i("img",{src:t.image.url||salla.url.cdn("images/s-empty.png"),loading:"lazy",alt:t.image.alt||t.name,class:"s-multiple-bundle-product-image"})),i("div",{class:"s-multiple-bundle-product-content-wrapper"},i("div",{class:"s-multiple-bundle-product-content"},i("div",{class:"s-multiple-bundle-product-details"},i("div",{class:"s-multiple-bundle-product-title-wrapper"},i("h2",{class:"s-multiple-bundle-product-title"},i("a",{href:t?.url||"#",target:"_blank",rel:"noopener noreferrer"},t.name))),i("div",{class:"s-multiple-bundle-product-price-wrapper"},i("span",{class:"s-multiple-bundle-product-price"},i("span",{innerHTML:salla.money(t.price)})),t.sale_price>0&&i("span",{class:"s-multiple-bundle-product-price-discount"},i("span",{innerHTML:salla.money(t.regular_price)})))),t.quantity_in_group>0&&0!==t.quantity&&i("span",{class:"s-multiple-bundle-product-badge"},salla.lang.get("pages.products.pieces"),i("span",null,t.quantity_in_group)),0===t.quantity&&i("span",{class:"s-multiple-bundle-product-badge"},salla.lang.get("pages.products.quantity_in_group_finished"))),t.options?.length>0&&i("button",{class:"s-multiple-bundle-product-button",onClick:()=>this.handleOptionsClick(t),type:"button"},n,i("span",{class:"s-multiple-bundle-product-button-icon",innerHTML:d})))))})))))}get host(){return n(this)}};a.style="";export{d as salla_multiple_bundle_product_options_modal,a as salla_multiple_bundle_product_slider}
4
+ import{r as t,c as s,h as i,H as e,a as n}from"./p-Cz6cYzxG.js";import{A as o,a as l}from"./p-Vqpj4CWE.js";const d=class{constructor(i){t(this,i),this.optionsSaved=s(this,"optionsSaved"),this.productSelected=s(this,"productSelected"),this.product=null,this.sectionId=null,this.sectionIndex=0,this.productIndex=0,this.selectedOptions={},this.optionsResetTokens={},this.isLoading=!1,this.hasUnsavedChanges=!1,this.validationErrors=[]}generateCacheKey(t,s,i){return`${t||"unknown"}-${s||0}-${i||"unknown"}`}handleProductChange(t){setTimeout((()=>{this.modal&&t&&this.modal.setTitle(t.name||"")}),100),this.validationErrors=[],this.hasUnsavedChanges=!1}async open(){this.modal?(this.isLoading=!0,this.product?.name&&this.modal.setTitle(this.product.name),this.modal.open(),setTimeout((async()=>{this.product?.id&&await this.initializeSelectedOptions(),this.product?.name&&this.modal.setTitle(this.product.name),this.modal.stopLoading(),this.isLoading=!1}),300)):requestAnimationFrame((()=>this.open()))}async close(){this.modal&&this.modal.close()}async refreshOptionsState(){this.selectedOptions={...this.selectedOptions}}componentDidLoad(){this.modalOpenListener=t=>{this.product=t.product,this.sectionId=t.sectionId||null,this.sectionIndex=t.sectionIndex||0,this.productIndex=t.productIndex||0,this.open()},salla.event.on("multiple-bundle-product-modal::open",this.modalOpenListener),this.clearOptionsListener=t=>{t&&t.productId&&this.clearProductOptions(t.productId,t.sectionId,t.productIndex)},salla.event.on("multiple-bundle-product-modal::clear-options",this.clearOptionsListener),this.optionChangeListener=t=>{const s=t.detail||t,{option:i,detail:e}=s,n=i||s.option_id&&this.product?.options?.find((t=>t.id===s.option_id||String(t.id)===String(s.option_id))),o=e||(s.id?s:null);this.product?.id&&n&&this.handleOptionChange(Number(this.product.id),n,o)},salla.event.on("product-options::change",this.optionChangeListener),this.checkboxChangeListener=t=>{const s=t.target;if(s&&"checkbox"===s.type&&s.name&&s.name.includes("bundle[")&&s.name.includes("][id]")){const t=s.name.match(/^bundle\[([^\]]+)\]\[([^\]]+)\]\[id\]$/);if(t&&!s.checked){const[,i,e]=t,n=s.value,o=this.host.closest("form");this.cleanupProductDeselection({sectionId:i,productIndex:parseInt(e,10),productId:n,form:o,uncheckedInput:s})}}},document.addEventListener("change",this.checkboxChangeListener)}disconnectedCallback(){this.checkboxChangeListener&&document.removeEventListener("change",this.checkboxChangeListener),this.optionChangeListener&&salla.event.off("product-options::change",this.optionChangeListener),this.modalOpenListener&&salla.event.off("multiple-bundle-product-modal::open",this.modalOpenListener),this.clearOptionsListener&&salla.event.off("multiple-bundle-product-modal::clear-options",this.clearOptionsListener)}cleanupProductDeselection(t){const{sectionId:s,productIndex:i,productId:e,form:n,uncheckedInput:o}=t;if(this.clearProductOptions(e,s,i),n){const t=`bundle[${s}][${i}]`;Array.from(n.querySelectorAll(`input[name^="${t}"]`)).forEach((s=>{if(s===o)return;const i="hidden"===s.type,n=s.getAttribute("data-product-id")===String(e)&&s.name?.startsWith(t);(i||n)&&s.remove()})),requestAnimationFrame((()=>{const t=new window.Event("change",{bubbles:!0});n.dispatchEvent(t)}))}}generateFormInputName(t,s,i){return`bundle[${t}][${s}][options][${i}]`}async initializeSelectedOptions(){if(!this.product?.id)return;const t=this.product.id,s=this.generateCacheKey(this.sectionId,this.productIndex,t),i=document.querySelector(`salla-product-options[product-id="${t}"]`);if(i)try{const t=await i.getSelectedOptions();t&&t.length>0&&(this.selectedOptions={...this.selectedOptions,[s]:t})}catch(t){console.warn("Could not initialize selected options:",t)}}clearProductOptions(t,s,i){const e={...this.selectedOptions};if(null==s||null==i||Number.isNaN(i)){const s=`-${String(t)}`,i=[];Object.keys(e).forEach((t=>{t.endsWith(s)&&(delete e[t],i.push(t))})),i.forEach((t=>this.bumpOptionsResetToken(t)))}else{const n=this.generateCacheKey(s,i,t);delete e[n],this.bumpOptionsResetToken(n)}this.selectedOptions=e,this.validationErrors=[],this.hasUnsavedChanges=!1}bumpOptionsResetToken(t){t&&(this.optionsResetTokens={...this.optionsResetTokens,[t]:(this.optionsResetTokens[t]||0)+1})}async handleOptionChange(t,s,i){const e=this.generateCacheKey(this.sectionId,this.productIndex,t),n=document.querySelector(`salla-product-options[product-id="${t}"]`);let o=[];if(n)try{o=await n.getSelectedOptions()||[]}catch(t){console.warn("Could not get current selections from component:",t)}if(o.length>0)this.selectedOptions={...this.selectedOptions,[e]:o};else if(this.selectedOptions[e]&&this.selectedOptions[e].length>0){const t=[...this.selectedOptions[e]||[]],n=t.findIndex((t=>t.option_id===s.id));n>-1?i&&null!=i.id?t[n]={...i,option_id:s.id}:t.splice(n,1):i&&null!=i.id&&t.push({...i,option_id:s.id}),this.selectedOptions={...this.selectedOptions,[e]:t}}else i&&null!=i.id&&(this.selectedOptions={...this.selectedOptions,[e]:[{...i,option_id:s.id}]});this.hasUnsavedChanges=!0,this.validationErrors=[]}async validateOptions(){if(!this.product?.options)return!0;const t=[],s=this.product.id,i=this.generateCacheKey(this.sectionId,this.productIndex,s),e=document.querySelector(`salla-product-options[product-id="${s}"]`);let n=[];if(e)try{n=await e.getSelectedOptions()||[];const t=this.selectedOptions[i]||[];(t.length>n.length||0===n.length&&t.length>0)&&(n=t)}catch(t){n=this.selectedOptions[i]||[]}else n=this.selectedOptions[i]||[];return 0===n.length&&t.push(salla.lang.get("pages.products.no_options_selected")),this.product.options.forEach((s=>{s.required&&(n.some((t=>t.option_id==s.id))||t.push(salla.lang.get("pages.products.required_option_missing",{option:s.name})))})),this.validationErrors=t,0===t.length}async onSave(t){t.preventDefault();const s=this.product?.id;if(!s)return;const i=this.generateCacheKey(this.sectionId,this.productIndex,s);if(await new Promise((t=>setTimeout(t,100))),await this.validateOptions()){this.isLoading=!0;try{const t=document.querySelector(`salla-product-options[product-id="${s}"]`);let e=await(t?.getSelectedOptions());if((!e||0===e.length)&&this.selectedOptions[i]?.length>0&&(e=this.selectedOptions[i]),!e||0===e.length)return void(this.isLoading=!1);this.selectedOptions={...this.selectedOptions,[i]:e};const n=this.host.closest("form");if(!n)return void(this.isLoading=!1);const o=`bundle[${this.sectionId}][${this.productIndex}]`;Array.from(n.querySelectorAll(`input[name^="${o}"][type="hidden"]`)).forEach((t=>t.remove())),Array.from(n.querySelectorAll(`[data-product-id="${s}"][name^="${o}"]`)).forEach((t=>t.remove()));const l=`bundle[${this.sectionId}][${this.productIndex}][id]`,d=document.getElementById(l);if(d)d.checked=!0;else{const t=document.createElement("input");t.type="hidden",t.name=`bundle[${this.sectionId}][${this.productIndex}][id]`,t.value=String(s),t.dataset.productId=String(s),n.appendChild(t)}e.forEach((t=>{const i=t.option_id,e=document.createElement("input");e.type="hidden",e.name=this.generateFormInputName(this.sectionId,this.productIndex??0,i),e.value=String(t.id),e.dataset.productId=String(s),n.appendChild(e)}));const a=new window.Event("change",{bubbles:!0});n.dispatchEvent(a),this.optionsSaved.emit({productId:Number(s),selectedOptions:e,sectionId:this.sectionId,productIndex:this.productIndex}),this.sectionId&&this.productSelected.emit({productId:Number(s),sectionId:this.sectionId,product:this.product,fromModal:!0}),salla.notify.success(salla.lang.get("pages.products.options_saved")),this.hasUnsavedChanges=!1,this.validationErrors=[],this.modal.close()}catch(t){salla.notify.error(salla.lang.get("pages.products.options_save_error"))}finally{this.isLoading=!1}}else salla.notify.error(this.validationErrors.join(", "))}getOptionsWithSelectedState(){if(!this.product?.options)return[];const t=this.generateCacheKey(this.sectionId,this.productIndex,this.product.id),s=this.selectedOptions[t]||[];return this.product.options.map((t=>({...t,details:t.details.map((t=>{const i=s.some((s=>s.id===t.id));return{...t,is_selected:i}}))})))}render(){const t=this.product?.id,s=this.getOptionsWithSelectedState(),n=this.generateCacheKey(this.sectionId,this.productIndex,t),o=this.optionsResetTokens[n]||0,l=this.isLoading||s.some((t=>t.details.some((t=>t.is_selected&&!0===t.is_out))));return i(e,{key:"2daff50a76067220f79c498bf756db36aec2996f"},i("salla-modal",{key:"3ed6ec8860016d10cec0ee5d4bf55125fc3e44f0",isLoading:this.isLoading,ref:t=>this.modal=t,width:"md",centered:!1,id:`s-multiple-bundle-product-options-modal-options-${t}`,class:"s-multiple-bundle-product-options-modal-wrapper"},i("div",{key:"9896b07b43cf0e8191d3c7e1ba6d0613d31f08f3",slot:"loading"},i("salla-skeleton",{key:"cdf032bdbaebc1e54136b5380a10f9077a781ab0",height:"100%",width:"100%"})),this.product?.images&&this.product?.images.length>0&&i("salla-slider",{key:"5df7c6e1868f3b3ca8983ff1baa43ad3351aeca2",id:`details-slider-${this.product?.id}`,type:"thumbs",loop:!1,"auto-height":!0,"listen-to-thumbnails-option":!0,showThumbsControls:!1,controlsOuter:!1,showControls:!1,class:"s-multiple-bundle-product-options-modal-slider",verticalThumbs:!0,thumbsConfig:{centeredSlides:!0,centeredSlidesBounds:!0,slidesPerView:Math.min(5,Math.max(1,this.product?.images.length)),watchOverflow:!0,watchSlidesProgress:!0,direction:"vertical",spaceBetween:10}},i("div",{key:"190198c7256c9669c25d0cd587cf5193bd75c57e",slot:"items"},this.product?.images&&this.product?.images.map(((t,s)=>i("div",{key:s,class:"swiper-slide"},i("img",{src:t.url,alt:t.alt||`${this.product?.name} - Image ${s+1}`,loading:"lazy",onError:t=>{t.target.style.display="none"}}))))),this.product?.images&&this.product?.images.length>1&&i("div",{key:"1c8d14ffc416800d19ac3cc87b463da2acede83e",slot:"thumbs"},this.product?.images&&this.product?.images.map(((t,s)=>i("div",{key:s,"data-caption":`${this.product?.name} - Image ${s+1}`},i("img",{src:t.url,loading:"eager",class:"s-multiple-bundle-product-options-modal-slider-thumb",title:`${this.product?.name} - ${s+1}`,alt:t.alt||`${this.product?.name} - ${s+1}`,onError:t=>{t.target.style.display="none"}})))))),i("salla-product-options",{options:JSON.stringify(s),key:`${n}-reset-${o}`,"product-id":t,"unique-key":`${n}-reset-${o}`}),i("div",{key:"52dd62ee4b96b11a10981cccd301ad199adfa61e",slot:"footer"},i("div",{key:"c846f4d9099936f41872fe99f3d0b8a789f90c01",class:"s-multiple-bundle-product-options-modal-footer"},i("salla-button",{key:"40d0742d67f6ab45deace262dbd085feba3d8980",onClick:t=>this.onSave(t),loading:this.isLoading,disabled:l},this.isLoading?salla.lang.get("common.elements.saving"):salla.lang.get("common.elements.save"))))))}get host(){return n(this)}static get watchers(){return{product:["handleProductChange"]}}};d.style=":host{display:block}";const a=class{constructor(i){t(this,i),this.productSelected=s(this,"productSelected"),this.productOptionsSelected=s(this,"productOptionsSelected"),this.selectedProducts={},this.savedOptionsByInstance={},this.handleProductClick=(t,s)=>{const i=this.generateEventName(this.section.id,s),e=document.getElementById(i);if(e){if(e){const i=!e.checked;i||(this.dispatchClearOptionsEvent(t,s),this.clearSavedOptionsState(this.section.id,s)),e.checked=i,requestAnimationFrame((()=>{const t=new window.Event("change",{bubbles:!0});e.dispatchEvent(t)}))}this.productSelected.emit({product:t,sectionId:this.section.id})}},this.handleOptionsClick=t=>{this.productOptionsSelected.emit({product:t,sectionId:this.section.id})}}getProductInstanceKey(t,s){return`${t}::${s}`}dispatchClearOptionsEvent(t,s){salla.event.dispatch("multiple-bundle-product-modal::clear-options",{productId:t.id,sectionId:this.section.id,sectionIndex:this.sectionIndex,productIndex:s})}handleOptionsSaved(t){const s=t.detail;if(!s)return;const{sectionId:i,productIndex:e,selectedOptions:n}=s;if(null==i||i!==this.section?.id)return;if(null==e||Number.isNaN(e))return;const o=this.getProductInstanceKey(i,e);if(n?.length)this.savedOptionsByInstance={...this.savedOptionsByInstance,[o]:!0};else if(this.savedOptionsByInstance[o]){const t={...this.savedOptionsByInstance};delete t[o],this.savedOptionsByInstance=t}}clearSavedOptionsState(t,s){const i=this.getProductInstanceKey(t,s);if(!this.savedOptionsByInstance[i])return;const e={...this.savedOptionsByInstance};delete e[i],this.savedOptionsByInstance=e}generateEventName(t,s){return`bundle[${t}][${s}][id]`}render(){return i(e,{key:"df82c8c561e6ef9718a179be2815ed01789700a0"},i("salla-slider",{key:"b7b96681ce045a2dad72edf9cdbda7ea1b3f3c2e",type:"carousel",controlsOuter:!1,showControls:!1,id:`accordion-multiple-bundle-product-${this.section.id}`,pagination:!0,class:"s-multiple-bundle-product-wrapper-slider",sliderConfig:{spaceBetween:0}},i("div",{key:"9762b78a8c67586f2455632632a1e97eefcddbaf",slot:"items"},this?.section?.products?.map(((t,s)=>{const e=this.selectedProducts[this.section.id]?.has(t.id)||!1,n=this.savedOptionsByInstance[this.getProductInstanceKey(this.section.id,s)]?salla.lang.getWithDefault("pages.products.edit_selected_options","تعديل الخيارات"):salla.lang.get("pages.products.choose_from_options");let d=salla.config.get("theme.is_rtl",!0)?o:l;return i("div",{class:"s-multiple-bundle-product-slide-one-third "+(0==t.quantity?"s-multiple-bundle-product-slide-one-third-disabled":""),key:t.id},i("div",{class:"s-multiple-bundle-product-card"},i("div",{class:"s-multiple-bundle-product-image-wrapper",onClick:()=>this.handleProductClick(t,s)},i("input",{id:this.generateEventName(this.section.id,s),type:"checkbox",class:"s-multiple-bundle-product-checkbox",checked:e,name:this.generateEventName(this.section.id,s),value:t.id}),i("img",{src:t.image.url||salla.url.cdn("images/s-empty.png"),loading:"lazy",alt:t.image.alt||t.name,class:"s-multiple-bundle-product-image"})),i("div",{class:"s-multiple-bundle-product-content-wrapper"},i("div",{class:"s-multiple-bundle-product-content"},i("div",{class:"s-multiple-bundle-product-details"},i("div",{class:"s-multiple-bundle-product-title-wrapper"},i("h2",{class:"s-multiple-bundle-product-title"},i("a",{href:t?.url||"#",target:"_blank",rel:"noopener noreferrer"},t.name))),i("div",{class:"s-multiple-bundle-product-price-wrapper"},i("span",{class:"s-multiple-bundle-product-price"},i("span",{innerHTML:salla.money(t.price)})),t.sale_price>0&&i("span",{class:"s-multiple-bundle-product-price-discount"},i("span",{innerHTML:salla.money(t.regular_price)})))),t.quantity_in_group>0&&0!==t.quantity&&i("span",{class:"s-multiple-bundle-product-badge"},salla.lang.get("pages.products.pieces"),i("span",null,t.quantity_in_group)),0===t.quantity&&i("span",{class:"s-multiple-bundle-product-badge"},salla.lang.get("pages.products.quantity_in_group_finished"))),t.options?.length>0&&i("button",{class:"s-multiple-bundle-product-button",onClick:()=>this.handleOptionsClick(t),type:"button"},n,i("span",{class:"s-multiple-bundle-product-button-icon",innerHTML:d})))))})))))}get host(){return n(this)}};a.style="";export{d as salla_multiple_bundle_product_options_modal,a as salla_multiple_bundle_product_slider}
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r as i,h as a}from"./p-DYB20YqN.js";const t=class{constructor(a){i(this,a)}render(){return a("a",{key:"c568ebb15db1854f8f32ffa406f4751b16e67e4d",href:this.notification.url,class:{"s-notifications-item":!0,"s-notifications-item-shadow":!0,"s-notifications-item-read":!this.notification.is_new}},a("span",{key:"af8ce6607fb53b0459673aec66d4e4453fa13f94",class:"s-notifications-item-icon"},a("i",{key:"9a55f3c72eb6bef64f58e24395bab8f787c084ed",class:{"s-notifications-item-icon sicon-bell-ring":!0,"s-notifications-item-icon-new":this.notification.is_new}})),a("div",{key:"20559c46d9087d602c83f82f409c5fa43966a8de",class:"s-notifications-item-content"},a("div",{key:"22a21adb2253a0db5d9d404ba196fe1a2094c7ff",class:"s-notifications-item-content-leading"},a("h4",{key:"3a07031fe0e697a4c818dece184623bd13249f30"},this.notification.title),a("p",{key:"a481734126292bbb2b22f4a326d7a489131a0828"},this.notification.sub_title)),a("span",{key:"adad90fe0b72bd92363d53c8ffcc39602da00399",class:"s-notifications-item-content-trailing"},a("i",{key:"65401a987fd64c6647f1cabc4d802f6c835f0e61",class:"sicon-time s-notifications-item-content-trailing-icon"}),a("span",{key:"1c73bdb085cb3e5c3ecaea7352d3112b9facdf38"},this.notification.date))))}};t.style="";export{t as salla_notification_item}
4
+ import{r as i,h as a}from"./p-Cz6cYzxG.js";const t=class{constructor(a){i(this,a)}render(){return a("a",{key:"c568ebb15db1854f8f32ffa406f4751b16e67e4d",href:this.notification.url,class:{"s-notifications-item":!0,"s-notifications-item-shadow":!0,"s-notifications-item-read":!this.notification.is_new}},a("span",{key:"af8ce6607fb53b0459673aec66d4e4453fa13f94",class:"s-notifications-item-icon"},a("i",{key:"9a55f3c72eb6bef64f58e24395bab8f787c084ed",class:{"s-notifications-item-icon sicon-bell-ring":!0,"s-notifications-item-icon-new":this.notification.is_new}})),a("div",{key:"20559c46d9087d602c83f82f409c5fa43966a8de",class:"s-notifications-item-content"},a("div",{key:"22a21adb2253a0db5d9d404ba196fe1a2094c7ff",class:"s-notifications-item-content-leading"},a("h4",{key:"3a07031fe0e697a4c818dece184623bd13249f30"},this.notification.title),a("p",{key:"a481734126292bbb2b22f4a326d7a489131a0828"},this.notification.sub_title)),a("span",{key:"adad90fe0b72bd92363d53c8ffcc39602da00399",class:"s-notifications-item-content-trailing"},a("i",{key:"65401a987fd64c6647f1cabc4d802f6c835f0e61",class:"sicon-time s-notifications-item-content-trailing-icon"}),a("span",{key:"1c73bdb085cb3e5c3ecaea7352d3112b9facdf38"},this.notification.date))))}};t.style="";export{t as salla_notification_item}
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r as t,h as a,F as s,g as e}from"./p-DYB20YqN.js";const i=class{constructor(a){t(this,a),this.isMobileAllowed=!0,this.isEmailRequired=!1,this.supportWebAuth=!0,this.withoutReload=!1,this.source="",this.htmlElement=document.documentElement,this.messages=[],this.isClosable=!0,this.iframeLoaded=!1,this.scrolling="no",this.direction=document.dir,this.canRenderIframe=!1,salla.event.on("login::open",(t=>{this.isEmailAllowed||this.isMobileAllowed?(this.source=t?.source??!1,this.withoutReload=t?.withoutReload??this.withoutReload,this.open(t),this.openModal()):salla.logger.warn("Please enable atleast one login type to use this component.")})),salla.event.on("modal::close",(t=>{this.iframe&&this.sendMessageToIframe({source:"login",type:"modal_closed",data:t})})),salla.onReady((()=>{this.api=salla.config.get("store.api"),this.storeId=salla.config.get("store.id")}))}componentDidLoad(){window.addEventListener("message",(t=>{if("login"!=t.data.source)return;if(!this.inline&&!this.canRenderIframe)return;salla.log("salla-account:: recived an event",t.data);let a=t.data?.type?.replace("iframe::",""),s=t.data.message;if("ready"==a)return s.isPasskeyPage?void this.createPassKey.postMessage({source:"login",type:"init_passkey_page",data:{token:salla.storage.get("token"),store_id:salla.config.get("store.id"),locale:salla.config.get("user.language_code"),redirect:salla.config.get("store.url")}},salla.config.get("login.url")):void this.handleIframeReadyAction();if("height"==a)return this.iframe.height=s?.height+"px";if("storage"==a)return this.handleIframeStorageAction(s);if("scrolling"==a)return this.scrolling=s,void(this.isClosable=!1);if("direction"==a)return document.dir=this.direction=s?"rtl":"ltr";if("notify"==a)return salla.notify[s.type](s.message);if("authenticated"==a||"authenticated_web_auth"==a)return!s?.withoutClose&&this.close(),salla.auth.api.handlAfterAuthenticatedResponse(s,this.supportWebAuth).then((()=>!(s?.withoutReload||this.withoutReload)&&setTimeout((()=>window.location.reload()),1e3)));if("dispatchEvent"!=a||"auth::verified"!=s.event){if("dispatchEvent"==a)return salla.event.emit(s.event,...s.payload);if("reload"==a)return s?.withClose&&this.modal.close(),window.location.reload();if("open_page"===a)return window.location.href=s.url;if("open_passkey_page"!==a)return"guest-checkout"===a?this.handleGuestCheckout():void("close"==a&&this.close());this.createPassKey=window.open(`${salla.config.get("login.url")}/create-passkey`)}else salla.log("Ignored dispatchEvent `auth::verified` from iframe")})),this.observeDarkModeChanges(),setTimeout((()=>Salla.event.emit("salla-login::ready")),1)}async open(t=null){return salla.config.isGuest()?this.modal.open():this.withoutReload?void 0:location.reload()}close(){Salla.event.emit("salla-login::closing"),this.modal.close(),this.iframeLoaded=!1,this.canRenderIframe=!1,this.host.dispatchEvent(new CustomEvent("salla-login:closed",{cancelable:!0,bubbles:!0,detail:null})),Salla.event.emit("salla-login::closed")}handleIframeReadyAction(){this.sendInitMessage(),this.sendMessageToIframe({source:"login",type:"width",data:document.body.clientWidth})}observeDarkModeChanges(){new MutationObserver((t=>{t.forEach((t=>{"class"===t.attributeName&&this.sendMessageToIframe({source:"login",type:"darkMode",data:{isDark:!!this.htmlElement.classList.contains("dark")}})}))})).observe(this.htmlElement,{attributes:!0})}async handleIframeStorageAction(t){let a,s=salla.storage.get("cart.user_id"),e=!1;if(Object.entries(t).filter((t=>!Salla.storage.get(t[0]))).forEach((([t,i])=>{salla.log("Shared storage from accounts domain",t,i);let l="string"==typeof i?i?.replace(/^"|"$/g,""):i;salla.storage.set(t,l),"token"===t&&(a=l),"user"===t&&s&&l.id!==s&&(e=!0)})),a){this.modal.close(),Salla.auth.event.tokenFetched(a);try{await Salla.api.cart.assign()}catch(t){Salla.log("Error on assign after handle iframe",t)}e&&Salla.cart.reset();try{!Salla.auth.api.isSessionless()&&await Salla.auth.api.request("auth/jwt"),Salla.auth.api.canRedirect()?setTimeout((()=>window.location.reload()),100):await Salla.auth.event.loggedIn({data:{token:a}}).then((()=>Salla.auth.api.afterUserLogin()))}catch(t){this.modal.open(),Salla.log("Error on request auth/jwt after handle iframe",t)}}else e&&Salla.cart.reset()}sendMessageToIframe(t){if(this.iframe)return this.iframe.contentWindow.postMessage(t,"*")}sendInitMessage(){let t=this.headers;try{t="string"==typeof t?JSON.parse(t):t}catch(a){console.error("Failed to parse headers!",this.headers,a),t=void 0}const a={user:salla.storage.get("user"),s_translations:salla.storage.get("s_translations"),token:salla.storage.get("token")};a.user||delete a.user,a.s_translations||delete a.s_translations,a.token||delete a.token,this.sendMessageToIframe({source:"login",type:"init",data:{id:this.storeId,lang:salla.lang.locale,isDark:!!this.htmlElement.classList.contains("dark"),apiUrl:this.api?.replace(/\/+$/,""),supportWebAuth:this.supportWebAuth,withoutReload:this.withoutReload,inline:this.inline,settings:salla.config.all(),headers:t,storage:a}})}async handleGuestCheckout(){if(this.modal.close(),salla.config.isGuest())return salla.cart.submit(!1,!0)}openModal(){this.canRenderIframe||(this.canRenderIframe=!0),this.modal.open()}render(){return this.inline?this.getLoginDom():a("salla-modal",{class:"s-login-modal",ref:t=>this.modal=t,width:"xs"},this.getLoginDom())}getLoginDom(){if(this.canRenderIframe)return a(s,null,a("iframe",{src:`${salla.config.get("login.url","https://accounts.salla.com")}?src=${this.source}`,title:"Salla Login",class:"hide-scroll",loading:"lazy",ref:t=>{this.iframe=t},allow:"publickey-credentials-get; publickey-credentials-create",scrolling:this.scrolling,frameborder:"0",width:"100%"}))}get host(){return e(this)}};i.style="iframe{-moz-transition:height 0.3s;-ms-transition:height 0.3s;-o-transition:height 0.3s;-webkit-transition:height 0.3s;transition:height 0.3s;width:100%}";export{i as salla_login_modal}
4
+ import{r as t,h as a,F as s,a as e}from"./p-Cz6cYzxG.js";const i=class{constructor(a){t(this,a),this.isMobileAllowed=!0,this.isEmailRequired=!1,this.supportWebAuth=!0,this.withoutReload=!1,this.source="",this.htmlElement=document.documentElement,this.messages=[],this.isClosable=!0,this.iframeLoaded=!1,this.scrolling="no",this.direction=document.dir,this.canRenderIframe=!1,salla.event.on("login::open",(t=>{this.isEmailAllowed||this.isMobileAllowed?(this.source=t?.source??!1,this.withoutReload=t?.withoutReload??this.withoutReload,this.open(t),this.openModal()):salla.logger.warn("Please enable atleast one login type to use this component.")})),salla.event.on("modal::close",(t=>{this.iframe&&this.sendMessageToIframe({source:"login",type:"modal_closed",data:t})})),salla.onReady((()=>{this.api=salla.config.get("store.api"),this.storeId=salla.config.get("store.id")}))}componentDidLoad(){window.addEventListener("message",(t=>{if("login"!=t.data.source)return;if(!this.inline&&!this.canRenderIframe)return;salla.log("salla-account:: recived an event",t.data);let a=t.data?.type?.replace("iframe::",""),s=t.data.message;if("ready"==a)return s.isPasskeyPage?void this.createPassKey.postMessage({source:"login",type:"init_passkey_page",data:{token:salla.storage.get("token"),store_id:salla.config.get("store.id"),locale:salla.config.get("user.language_code"),redirect:salla.config.get("store.url")}},salla.config.get("login.url")):void this.handleIframeReadyAction();if("height"==a)return this.iframe.height=s?.height+"px";if("storage"==a)return this.handleIframeStorageAction(s);if("scrolling"==a)return this.scrolling=s,void(this.isClosable=!1);if("direction"==a)return document.dir=this.direction=s?"rtl":"ltr";if("notify"==a)return salla.notify[s.type](s.message);if("authenticated"==a||"authenticated_web_auth"==a)return!s?.withoutClose&&this.close(),salla.auth.api.handlAfterAuthenticatedResponse(s,this.supportWebAuth).then((()=>!(s?.withoutReload||this.withoutReload)&&setTimeout((()=>window.location.reload()),1e3)));if("dispatchEvent"!=a||"auth::verified"!=s.event){if("dispatchEvent"==a)return salla.event.emit(s.event,...s.payload);if("reload"==a)return s?.withClose&&this.modal.close(),window.location.reload();if("open_page"===a)return window.location.href=s.url;if("open_passkey_page"!==a)return"guest-checkout"===a?this.handleGuestCheckout():void("close"==a&&this.close());this.createPassKey=window.open(`${salla.config.get("login.url")}/create-passkey`)}else salla.log("Ignored dispatchEvent `auth::verified` from iframe")})),this.observeDarkModeChanges(),setTimeout((()=>Salla.event.emit("salla-login::ready")),1)}async open(t=null){return salla.config.isGuest()?this.modal.open():this.withoutReload?void 0:location.reload()}close(){Salla.event.emit("salla-login::closing"),this.modal.close(),this.iframeLoaded=!1,this.canRenderIframe=!1,this.host.dispatchEvent(new CustomEvent("salla-login:closed",{cancelable:!0,bubbles:!0,detail:null})),Salla.event.emit("salla-login::closed")}handleIframeReadyAction(){this.sendInitMessage(),this.sendMessageToIframe({source:"login",type:"width",data:document.body.clientWidth})}observeDarkModeChanges(){new MutationObserver((t=>{t.forEach((t=>{"class"===t.attributeName&&this.sendMessageToIframe({source:"login",type:"darkMode",data:{isDark:!!this.htmlElement.classList.contains("dark")}})}))})).observe(this.htmlElement,{attributes:!0})}async handleIframeStorageAction(t){let a,s=salla.storage.get("cart.user_id"),e=!1;if(Object.entries(t).filter((t=>!Salla.storage.get(t[0]))).forEach((([t,i])=>{salla.log("Shared storage from accounts domain",t,i);let l="string"==typeof i?i?.replace(/^"|"$/g,""):i;salla.storage.set(t,l),"token"===t&&(a=l),"user"===t&&s&&l.id!==s&&(e=!0)})),a){this.modal.close(),Salla.auth.event.tokenFetched(a);try{await Salla.api.cart.assign()}catch(t){Salla.log("Error on assign after handle iframe",t)}e&&Salla.cart.reset();try{!Salla.auth.api.isSessionless()&&await Salla.auth.api.request("auth/jwt"),Salla.auth.api.canRedirect()?setTimeout((()=>window.location.reload()),100):await Salla.auth.event.loggedIn({data:{token:a}}).then((()=>Salla.auth.api.afterUserLogin()))}catch(t){this.modal.open(),Salla.log("Error on request auth/jwt after handle iframe",t)}}else e&&Salla.cart.reset()}sendMessageToIframe(t){if(this.iframe)return this.iframe.contentWindow.postMessage(t,"*")}sendInitMessage(){let t=this.headers;try{t="string"==typeof t?JSON.parse(t):t}catch(a){console.error("Failed to parse headers!",this.headers,a),t=void 0}const a={user:salla.storage.get("user"),s_translations:salla.storage.get("s_translations"),token:salla.storage.get("token")};a.user||delete a.user,a.s_translations||delete a.s_translations,a.token||delete a.token,this.sendMessageToIframe({source:"login",type:"init",data:{id:this.storeId,lang:salla.lang.locale,isDark:!!this.htmlElement.classList.contains("dark"),apiUrl:this.api?.replace(/\/+$/,""),supportWebAuth:this.supportWebAuth,withoutReload:this.withoutReload,inline:this.inline,settings:salla.config.all(),headers:t,storage:a}})}async handleGuestCheckout(){if(this.modal.close(),salla.config.isGuest())return salla.cart.submit(!1,!0)}openModal(){this.canRenderIframe||(this.canRenderIframe=!0),this.modal.open()}render(){return this.inline?this.getLoginDom():a("salla-modal",{class:"s-login-modal",ref:t=>this.modal=t,width:"xs"},this.getLoginDom())}getLoginDom(){if(this.canRenderIframe)return a(s,null,a("iframe",{src:`${salla.config.get("login.url","https://accounts.salla.com")}?src=${this.source}`,title:"Salla Login",class:"hide-scroll",loading:"lazy",ref:t=>{this.iframe=t},allow:"publickey-credentials-get; publickey-credentials-create",scrolling:this.scrolling,frameborder:"0",width:"100%"}))}get host(){return e(this)}};i.style="iframe{-moz-transition:height 0.3s;-ms-transition:height 0.3s;-o-transition:height 0.3s;-webkit-transition:height 0.3s;transition:height 0.3s;width:100%}";export{i as salla_login_modal}
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r as a,h as s,H as o,g as t}from"./p-DYB20YqN.js";const n=class{constructor(s){a(this,s)}async mount(a){this.host.before(a)}render(){return s(o,{key:"618467f6911198a5cbf4270694544575e585af27"})}async componentDidLoad(){await Salla.hooks.registerComponent("salla-hook",this)}get host(){return t(this)}};n.style=":host {\n all: unset;\n display: none; /* marker only */\n }";export{n as salla_hook}
4
+ import{r as a,h as s,H as o,a as t}from"./p-Cz6cYzxG.js";const n=class{constructor(s){a(this,s)}async mount(a){this.host.before(a)}render(){return s(o,{key:"618467f6911198a5cbf4270694544575e585af27"})}async componentDidLoad(){await Salla.hooks.registerComponent("salla-hook",this)}get host(){return t(this)}};n.style=":host {\n all: unset;\n display: none; /* marker only */\n }";export{n as salla_hook}
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r as s,h as i,H as e,g as t}from"./p-DYB20YqN.js";const l=class{constructor(i){s(this,i),this.cities=[],this.filteredCities=[],this.selectedCity=null,this.deliveryMessage=null,this.isLoadingCities=!1,this.isLoadingPromises=!1,this.isDropdownOpen=!1,this.searchQuery="",this.hasError=!1,this.errorMessage="",this.labels={deliveryTo:"توصيل إلى",pickupFromBranch:"الاستلام من فرع",searchPlaceholder:"بحث...",noResults:"لا توجد نتائج",selectCity:"اختر المدينة"},this.canRender=!1,this.requiresShipping=!1,this.productId=void 0,this.onClickOutside=s=>{this.host.contains(s.target)||(this.isDropdownOpen=!1,window.removeEventListener("click",this.onClickOutside))}}setLabels(){this.labels={deliveryTo:salla.lang.getWithDefault("pages.products.promise_deliver_to","توصيل إلى"),pickupFromBranch:salla.lang.getWithDefault("pages.products.promise_pickup_from_branch","الاستلام من فرع"),searchPlaceholder:salla.lang.getWithDefault("blocks.header.search_placeholder","بحث..."),noResults:salla.lang.getWithDefault("common.elements.no_options","لا توجد نتائج"),selectCity:salla.lang.getWithDefault("common.elements.select_city","اختر المدينة")}}logger(s,i){localStorage.getItem("salla-delivery-promise-debug")&&(i?console.log(s,i):console.log(s))}async componentDidLoad(){if(await salla.onReady(),await salla.lang.onLoaded(),this.setLabels(),this.requiresShipping=salla.url.is_page("product.single")&&salla.config.get("store.features",[]).includes("delivery-promises"),!this.requiresShipping)return this.canRender=!1,void this.logger("not requiresShipping",{is_product_single:salla.url.is_page("product.single"),includesDeliveryPromises:salla.config.get("store.features",[]).includes("delivery-promises")});this.logger("requiresShipping",this.requiresShipping),this.productId=salla.config.get("page.id"),this.logger("productId",this.productId),await this.fetchCities()}async fetchCities(){this.logger("start startfetchCities"),this.isLoadingCities=!0,this.hasError=!1;try{const s=await salla.api.request(salla.url.api(`products/${this.productId}/delivery-promises/cities`));if(s.success&&Array.isArray(s.data)&&s.data.length>0){this.logger("fetchCities success",{cities:s.data}),this.cities=this.sortCities(s.data),this.filteredCities=[...this.cities];let i=this.cities.find((s=>s.is_selected));i?(this.logger("selectedCity",i),this.selectedCity=i,await this.fetchDeliveryMessage(i.id)):this.logger("no selectedCity from API response"),this.canRender=!0}else this.logger("no data returned from fetchCities",{response:s}),this.canRender=!1}catch(s){this.logger("fetchCities error",{error:s.message}),this.hasError=!0,this.errorMessage=s.message||"Failed to load cities",this.canRender=!1}finally{this.isLoadingCities=!1}}async fetchDeliveryMessage(s){this.logger("start fetchDeliveryMessage",{cityId:s}),this.isLoadingPromises=!0,this.hasError=!1,this.deliveryMessage=null;try{const i=await salla.api.withoutNotifier((()=>salla.api.request(salla.url.api(`products/${this.productId}/delivery-promises?city_id=${s}`))));if(i.success&&i.data?.message){const s=i.data.message.trim();this.logger("fetchDeliveryMessage success",{message:s}),this.deliveryMessage=s||null}else this.logger("deliveryMessage not valid",{response:i})}catch(s){this.logger("fetchDeliveryMessage error",{error:s.message}),this.hasError=!0,this.errorMessage=s.message||"Failed to load delivery message"}finally{this.isLoadingPromises=!1}}toggleDropdown(s){s?.stopPropagation(),this.isDropdownOpen=!this.isDropdownOpen,this.isDropdownOpen?(window.addEventListener("click",this.onClickOutside),this.searchInputRef&&setTimeout((()=>this.searchInputRef.focus()),100)):window.removeEventListener("click",this.onClickOutside)}disconnectedCallback(){window.removeEventListener("click",this.onClickOutside)}sortCities(s){return[...s].sort(((s,i)=>-1===s.id?1:-1===i.id?-1:0))}handleSearch(s){const i=s.target.value.toLowerCase();this.searchQuery=i,this.filteredCities=i.length>0?this.cities.filter((s=>s.name.toLowerCase()?.includes(i)||(s.name_en||"").toLowerCase()?.includes(i))):[...this.cities]}async selectCity(s){this.logger("selectCity",{city:s}),this.selectedCity=s,this.isDropdownOpen=!1,window.removeEventListener("click",this.onClickOutside),this.searchQuery="",this.filteredCities=[...this.cities],await this.fetchDeliveryMessage(s.id)}renderDropdown(){return i("div",{class:"s-delivery-promise-dropdown"},i("div",{class:"s-delivery-promise-dropdown-search"},i("i",{class:"sicon-search"}),i("input",{type:"text",placeholder:this.labels.searchPlaceholder,value:this.searchQuery,onInput:s=>this.handleSearch(s),ref:s=>this.searchInputRef=s})),i("div",{class:"s-delivery-promise-dropdown-list"},0===this.filteredCities.length?i("div",{class:"s-delivery-promise-dropdown-empty"},this.labels.noResults):this.filteredCities.map((s=>i("div",{key:s.id,class:"s-delivery-promise-dropdown-item "+(this.selectedCity?.id===s.id?"selected":""),onClick:()=>this.selectCity(s)},i("span",{class:"s-delivery-promise-city-name"},s.name),this.selectedCity?.id===s.id&&i("i",{class:"sicon-check"}))))))}renderInitialLoadingSkeleton(){return i(e,{class:"s-delivery-promise-wrapper s-delivery-promise-skeleton"},i("div",{class:"s-delivery-promise-container"},i("div",{class:"s-delivery-promise-header s-delivery-promise-header-skeleton"},i("div",{class:"s-delivery-promise-location"},i("salla-skeleton",{height:"14px",width:"180px"})),i("salla-skeleton",{height:"18px",width:"18px"})),i("div",{class:"s-delivery-promise-loading"},i("salla-skeleton",{height:"20px",width:"80%"}))))}renderDeliveryMessage(){return this.isLoadingPromises?i("div",{class:"s-delivery-promise-loading"},i("salla-skeleton",{height:"20px",width:"80%"})):this.deliveryMessage?i("div",{class:"s-delivery-promise-message"},this.deliveryMessage):null}render(){return this.requiresShipping?this.isLoadingCities?this.renderInitialLoadingSkeleton():this.canRender&&0!==this.cities.length?i(e,{class:"s-delivery-promise-wrapper"},i("div",{class:"s-delivery-promise-container"},i("div",{class:"s-delivery-promise-header",onClick:s=>this.toggleDropdown(s)},i("div",{class:"s-delivery-promise-location"},i("span",{class:"s-delivery-promise-title"},this.labels.deliveryTo," ",this.selectedCity?.name||this.labels.selectCity)),i("i",{class:"sicon-keyboard_arrow_down s-delivery-promise-arrow "+(this.isDropdownOpen?"open":"")})),this.hasError&&i("div",{class:"s-delivery-promise-error"},this.errorMessage),this.isDropdownOpen&&this.renderDropdown(),!this.hasError&&this.renderDeliveryMessage())):null:null}get host(){return t(this)}};export{l as salla_delivery_promise}
4
+ import{r as s,h as i,H as e,a as t}from"./p-Cz6cYzxG.js";const l=class{constructor(i){s(this,i),this.cities=[],this.filteredCities=[],this.selectedCity=null,this.deliveryMessage=null,this.isLoadingCities=!1,this.isLoadingPromises=!1,this.isDropdownOpen=!1,this.searchQuery="",this.hasError=!1,this.errorMessage="",this.labels={deliveryTo:"توصيل إلى",pickupFromBranch:"الاستلام من فرع",searchPlaceholder:"بحث...",noResults:"لا توجد نتائج",selectCity:"اختر المدينة"},this.canRender=!1,this.requiresShipping=!1,this.productId=void 0,this.onClickOutside=s=>{this.host.contains(s.target)||(this.isDropdownOpen=!1,window.removeEventListener("click",this.onClickOutside))}}setLabels(){this.labels={deliveryTo:salla.lang.getWithDefault("pages.products.promise_deliver_to","توصيل إلى"),pickupFromBranch:salla.lang.getWithDefault("pages.products.promise_pickup_from_branch","الاستلام من فرع"),searchPlaceholder:salla.lang.getWithDefault("blocks.header.search_placeholder","بحث..."),noResults:salla.lang.getWithDefault("common.elements.no_options","لا توجد نتائج"),selectCity:salla.lang.getWithDefault("common.elements.select_city","اختر المدينة")}}logger(s,i){localStorage.getItem("salla-delivery-promise-debug")&&(i?console.log(s,i):console.log(s))}async componentDidLoad(){if(await salla.onReady(),await salla.lang.onLoaded(),this.setLabels(),this.requiresShipping=salla.url.is_page("product.single")&&salla.config.get("store.features",[]).includes("delivery-promises"),!this.requiresShipping)return this.canRender=!1,void this.logger("not requiresShipping",{is_product_single:salla.url.is_page("product.single"),includesDeliveryPromises:salla.config.get("store.features",[]).includes("delivery-promises")});this.logger("requiresShipping",this.requiresShipping),this.productId=salla.config.get("page.id"),this.logger("productId",this.productId),await this.fetchCities()}async fetchCities(){this.logger("start startfetchCities"),this.isLoadingCities=!0,this.hasError=!1;try{const s=await salla.api.request(salla.url.api(`products/${this.productId}/delivery-promises/cities`));if(s.success&&Array.isArray(s.data)&&s.data.length>0){this.logger("fetchCities success",{cities:s.data}),this.cities=this.sortCities(s.data),this.filteredCities=[...this.cities];let i=this.cities.find((s=>s.is_selected));i?(this.logger("selectedCity",i),this.selectedCity=i,await this.fetchDeliveryMessage(i.id)):this.logger("no selectedCity from API response"),this.canRender=!0}else this.logger("no data returned from fetchCities",{response:s}),this.canRender=!1}catch(s){this.logger("fetchCities error",{error:s.message}),this.hasError=!0,this.errorMessage=s.message||"Failed to load cities",this.canRender=!1}finally{this.isLoadingCities=!1}}async fetchDeliveryMessage(s){this.logger("start fetchDeliveryMessage",{cityId:s}),this.isLoadingPromises=!0,this.hasError=!1,this.deliveryMessage=null;try{const i=await salla.api.withoutNotifier((()=>salla.api.request(salla.url.api(`products/${this.productId}/delivery-promises?city_id=${s}`))));if(i.success&&i.data?.message){const s=i.data.message.trim();this.logger("fetchDeliveryMessage success",{message:s}),this.deliveryMessage=s||null}else this.logger("deliveryMessage not valid",{response:i})}catch(s){this.logger("fetchDeliveryMessage error",{error:s.message}),this.hasError=!0,this.errorMessage=s.message||"Failed to load delivery message"}finally{this.isLoadingPromises=!1}}toggleDropdown(s){s?.stopPropagation(),this.isDropdownOpen=!this.isDropdownOpen,this.isDropdownOpen?(window.addEventListener("click",this.onClickOutside),this.searchInputRef&&setTimeout((()=>this.searchInputRef.focus()),100)):window.removeEventListener("click",this.onClickOutside)}disconnectedCallback(){window.removeEventListener("click",this.onClickOutside)}sortCities(s){return[...s].sort(((s,i)=>-1===s.id?1:-1===i.id?-1:0))}handleSearch(s){const i=s.target.value.toLowerCase();this.searchQuery=i,this.filteredCities=i.length>0?this.cities.filter((s=>s.name.toLowerCase()?.includes(i)||(s.name_en||"").toLowerCase()?.includes(i))):[...this.cities]}async selectCity(s){this.logger("selectCity",{city:s}),this.selectedCity=s,this.isDropdownOpen=!1,window.removeEventListener("click",this.onClickOutside),this.searchQuery="",this.filteredCities=[...this.cities],await this.fetchDeliveryMessage(s.id)}renderDropdown(){return i("div",{class:"s-delivery-promise-dropdown"},i("div",{class:"s-delivery-promise-dropdown-search"},i("i",{class:"sicon-search"}),i("input",{type:"text",placeholder:this.labels.searchPlaceholder,value:this.searchQuery,onInput:s=>this.handleSearch(s),ref:s=>this.searchInputRef=s})),i("div",{class:"s-delivery-promise-dropdown-list"},0===this.filteredCities.length?i("div",{class:"s-delivery-promise-dropdown-empty"},this.labels.noResults):this.filteredCities.map((s=>i("div",{key:s.id,class:"s-delivery-promise-dropdown-item "+(this.selectedCity?.id===s.id?"selected":""),onClick:()=>this.selectCity(s)},i("span",{class:"s-delivery-promise-city-name"},s.name),this.selectedCity?.id===s.id&&i("i",{class:"sicon-check"}))))))}renderInitialLoadingSkeleton(){return i(e,{class:"s-delivery-promise-wrapper s-delivery-promise-skeleton"},i("div",{class:"s-delivery-promise-container"},i("div",{class:"s-delivery-promise-header s-delivery-promise-header-skeleton"},i("div",{class:"s-delivery-promise-location"},i("salla-skeleton",{height:"14px",width:"180px"})),i("salla-skeleton",{height:"18px",width:"18px"})),i("div",{class:"s-delivery-promise-loading"},i("salla-skeleton",{height:"20px",width:"80%"}))))}renderDeliveryMessage(){return this.isLoadingPromises?i("div",{class:"s-delivery-promise-loading"},i("salla-skeleton",{height:"20px",width:"80%"})):this.deliveryMessage?i("div",{class:"s-delivery-promise-message"},this.deliveryMessage):null}render(){return this.requiresShipping?this.isLoadingCities?this.renderInitialLoadingSkeleton():this.canRender&&0!==this.cities.length?i(e,{class:"s-delivery-promise-wrapper"},i("div",{class:"s-delivery-promise-container"},i("div",{class:"s-delivery-promise-header",onClick:s=>this.toggleDropdown(s)},i("div",{class:"s-delivery-promise-location"},i("span",{class:"s-delivery-promise-title"},this.labels.deliveryTo," ",this.selectedCity?.name||this.labels.selectCity)),i("i",{class:"sicon-keyboard_arrow_down s-delivery-promise-arrow "+(this.isDropdownOpen?"open":"")})),this.hasError&&i("div",{class:"s-delivery-promise-error"},this.errorMessage),this.isDropdownOpen&&this.renderDropdown(),!this.hasError&&this.renderDeliveryMessage())):null:null}get host(){return t(this)}};export{l as salla_delivery_promise}
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r as s,h as t,H as i,g as r}from"./p-DYB20YqN.js";import{H as e}from"./p-CHf8XdiS.js";import"./p-CgtvEd63.js";const l=class{constructor(t){s(this,t),this.productCardComponent="custom-salla-product-card",this.apiUrl=""}componentWillLoad(){return salla.onReady().then((()=>{if(this.includes=e.parseJson(this.includes||this.host.getAttribute("includes")),Array.isArray(this.includes)||(this.includes=null),e.setIncludes(this.includes),this.sourceValueIsValid=!(!this.getSourceValue()&&!this.isSourceWithoutValue()),this.sourceValueIsValid){if(this.hasCustomComponent=!!customElements.get(this.productCardComponent),"json"===this.source)return this.productsData=this.getSourceValue(),void(this.isReady=!0);if("related"!=this.getSource()||salla.config.get("store.settings.product.related_products_enabled"))return salla.api.withoutNotifier((()=>salla.product.api.fetch({source:e.getApiSource(this.getSource()),source_value:this.getSourceValue(),limit:this.limit}))).then((s=>e.injectExtraFieldsToResponse(s))).then((s=>{this.productsData=s.data,this.isReady=!0,s.source=this.getSource(),s.sourceValue=this.getSourceValue(),salla.event.emit("salla-products-slider::products.fetched",s.data)}));this.isReady=!1}else salla.logger.warn(`source-value prop is required for source [${this.getSource()}]`)}))}componentDidRender(){let s=0;const t=setInterval((()=>{this.host.querySelectorAll('[loading="lazy"]')?.forEach((s=>s.removeAttribute("loading"))),s++,s>=10&&clearInterval(t)}),1e3)}async componentDidLoad(){await Salla.hooks.registerComponent("salla-products-slider",this)}isSourceWithoutValue(){return["offers","latest","sales","top-rated"].includes(this.getSource())}getItemHTML(s){const i="landing-page"===this.getSource();i&&(s.url="");const r=i?void 0:()=>{e.saveProductSource(this.getSource())};if(this.hasCustomComponent&&"custom-salla-product-card"==this.productCardComponent.toLowerCase())return t("div",{class:"s-products-slider-card",onClick:r},t("custom-salla-product-card",{product:s,source:this.getSource(),"source-value":this.getSourceValue()}));if(this.hasCustomComponent){const i=document.createElement(this.productCardComponent);return i.setAttribute("product",JSON.stringify(s)),i.setAttribute("source",this.getSource()),i.setAttribute("source-value",this.getSourceValue()),t("div",{class:"s-products-slider-card",onClick:r,innerHTML:i.outerHTML})}return t("div",{class:"s-products-slider-card",onClick:r},t("salla-product-card",{"show-quantity":i,"hide-add-btn":i,"shadow-on-hover":!0,product:s}))}canRender(){return this.sourceValueIsValid&&this.isReady}getSource(){return e.getProductsSource(this.source)}getSourceValue(){return e.getProductsSourceValue(this.source,this.sourceValue)}render(){if(this.canRender())return t(i,{class:"s-products-slider-wrapper"},t("salla-slider",{class:"s-products-slider-slider",id:this.sliderId||`s-products-slider-${Math.random().toString(36).substr(2,9)}`,...this.sliderProps||{},"auto-play":this.autoplay,type:"carousel","block-title":this.blockTitle,"block-subTitle":this.subTitle,"display-all-url":this.displayAllUrl,sliderConfig:this.sliderConfig?this.sliderConfig:null},t("div",{slot:"items"},this.productsData?.map((s=>this.getItemHTML(s))))))}get host(){return r(this)}};l.style="";export{l as salla_products_slider}
4
+ import{r as s,h as t,H as i,a as r}from"./p-Cz6cYzxG.js";import{H as e}from"./p-CHf8XdiS.js";import"./p-CgtvEd63.js";const l=class{constructor(t){s(this,t),this.productCardComponent="custom-salla-product-card",this.apiUrl=""}componentWillLoad(){return salla.onReady().then((()=>{if(this.includes=e.parseJson(this.includes||this.host.getAttribute("includes")),Array.isArray(this.includes)||(this.includes=null),e.setIncludes(this.includes),this.sourceValueIsValid=!(!this.getSourceValue()&&!this.isSourceWithoutValue()),this.sourceValueIsValid){if(this.hasCustomComponent=!!customElements.get(this.productCardComponent),"json"===this.source)return this.productsData=this.getSourceValue(),void(this.isReady=!0);if("related"!=this.getSource()||salla.config.get("store.settings.product.related_products_enabled"))return salla.api.withoutNotifier((()=>salla.product.api.fetch({source:e.getApiSource(this.getSource()),source_value:this.getSourceValue(),limit:this.limit}))).then((s=>e.injectExtraFieldsToResponse(s))).then((s=>{this.productsData=s.data,this.isReady=!0,s.source=this.getSource(),s.sourceValue=this.getSourceValue(),salla.event.emit("salla-products-slider::products.fetched",s.data)}));this.isReady=!1}else salla.logger.warn(`source-value prop is required for source [${this.getSource()}]`)}))}componentDidRender(){let s=0;const t=setInterval((()=>{this.host.querySelectorAll('[loading="lazy"]')?.forEach((s=>s.removeAttribute("loading"))),s++,s>=10&&clearInterval(t)}),1e3)}async componentDidLoad(){await Salla.hooks.registerComponent("salla-products-slider",this)}isSourceWithoutValue(){return["offers","latest","sales","top-rated"].includes(this.getSource())}getItemHTML(s){const i="landing-page"===this.getSource();i&&(s.url="");const r=i?void 0:()=>{e.saveProductSource(this.getSource())};if(this.hasCustomComponent&&"custom-salla-product-card"==this.productCardComponent.toLowerCase())return t("div",{class:"s-products-slider-card",onClick:r},t("custom-salla-product-card",{product:s,source:this.getSource(),"source-value":this.getSourceValue()}));if(this.hasCustomComponent){const i=document.createElement(this.productCardComponent);return i.setAttribute("product",JSON.stringify(s)),i.setAttribute("source",this.getSource()),i.setAttribute("source-value",this.getSourceValue()),t("div",{class:"s-products-slider-card",onClick:r,innerHTML:i.outerHTML})}return t("div",{class:"s-products-slider-card",onClick:r},t("salla-product-card",{"show-quantity":i,"hide-add-btn":i,"shadow-on-hover":!0,product:s}))}canRender(){return this.sourceValueIsValid&&this.isReady}getSource(){return e.getProductsSource(this.source)}getSourceValue(){return e.getProductsSourceValue(this.source,this.sourceValue)}render(){if(this.canRender())return t(i,{class:"s-products-slider-wrapper"},t("salla-slider",{class:"s-products-slider-slider",id:this.sliderId||`s-products-slider-${Math.random().toString(36).substr(2,9)}`,...this.sliderProps||{},"auto-play":this.autoplay,type:"carousel","block-title":this.blockTitle,"block-subTitle":this.subTitle,"display-all-url":this.displayAllUrl,sliderConfig:this.sliderConfig?this.sliderConfig:null},t("div",{slot:"items"},this.productsData?.map((s=>this.getItemHTML(s))))))}get host(){return r(this)}};l.style="";export{l as salla_products_slider}
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r as a,h as l,H as t}from"./p-DYB20YqN.js";import{l as s}from"./p-BChI23pG.js";const o=a=>a?new Date(Number(a)).toLocaleDateString(salla.lang.locale,{weekday:"long",year:"numeric",month:"long",day:"numeric",hour:"numeric"}):"",r=a=>{if(!a)return"";try{const l=a.toLowerCase(),t=salla.lang.get(`pages.loyalty_program.${l}`);return t===`pages.loyalty_program.${l}`?a:t}catch{return a}},e=class{constructor(l){a(this,l),this.loyaltyPointsArray=[],this.isLoadingLoyalty=!1,this.nextPageUrlLoyalty="",this.handleClick=()=>{this.loadMoreLoyaltyPoints()}}componentWillLoad(){return salla.onReady().then((()=>{this.loadLoyaltyPoints()}))}async loadLoyaltyPoints(){this.isLoadingLoyalty=!0;try{let a="/balance/points?page=1",l=await salla.api.request(a);this.loyaltyPointsArray=l.data,this.nextPageUrlLoyalty=l.cursor.next}catch(a){console.error("Error loading loyalty points transactions",a)}finally{this.isLoadingLoyalty=!1}}async loadMoreLoyaltyPoints(){if(this.nextPageUrlLoyalty){this.isLoadingLoyalty=!0;try{let a=await salla.api.request(this.nextPageUrlLoyalty);this.loyaltyPointsArray=[...this.loyaltyPointsArray,...a.data],this.nextPageUrlLoyalty=a.cursor?.next||""}catch(a){console.error("Error loading more loyalty points",a)}finally{this.isLoadingLoyalty=!1}}}render(){return l(t,{key:"4a8cb15322b005a124eb5792044d6435fd52922e"},l("div",{key:"54a08cfdb24116455b8c137d20ec5ef22a34ff85"},this.isLoadingLoyalty?l("salla-loading",null):l("div",null,this.loyaltyPointsArray.length>0?l("div",null,l("table",{class:"s-loyalty-program-table"},l("thead",{class:"s-loyalty-program-table-head"},l("tr",{class:"s-loyalty-program-table-head-tr"},l("th",{scope:"col",class:"s-loyalty-program-table-head-tr-th"},salla.lang.get("pages.wallet.points")),l("th",{scope:"col",class:"s-loyalty-program-table-head-tr-th"},salla.lang.get("pages.wallet.date")),l("th",{scope:"col",class:"s-loyalty-program-table-head-tr-th"},salla.lang.get("pages.wallet.expiry_date")),l("th",{scope:"col",class:"s-loyalty-program-table-head-tr-th"},salla.lang.get("common.elements.note")),l("th",{scope:"col",class:"s-loyalty-program-table-head-tr-th"},salla.lang.get("common.elements.status")))),l("tbody",{class:"s-loyalty-program-table-tbody"},this.loyaltyPointsArray.map((a=>l("tr",{class:"s-loyalty-program-table-tbody-tr"},l("td",{class:"s-loyalty-program-table-tbody-tr-td"},"plus"===a?.type?"+":"",a?.points||""," ",salla.lang.get("pages.loyalty_program.point")),l("td",{class:"s-loyalty-program-table-tbody-tr-td"},o(a?.created_at?1e3*Number(a.created_at):void 0)),l("td",{class:"s-loyalty-program-table-tbody-tr-td"},o(a?.points_expire_date)),l("td",{class:"s-loyalty-program-table-tbody-tr-td"},r(a?.key)),l("td",{class:"s-loyalty-program-table-tbody-tr-td"},r(a?.status_key))))))),l("div",{class:"s-infinite-scroll-wrapper"},!!this.nextPageUrlLoyalty&&l("salla-button",{onClick:this.handleClick,loading:this.isLoadingLoyalty},salla.lang.get("common.elements.load_more")))):l("div",null,l("div",{class:"s-loyalty-program-table-empty-state"},l("span",{innerHTML:s}),l("div",{class:"s-loyalty-program-table-placeholder-title"},salla.lang.get("pages.loyalty_program.no_loyality_points_title")),l("div",{class:"s-loyalty-program-table-placeholder-sub-title"},salla.lang.get("pages.loyalty_program.no_loyality_points_sub_title")))))))}};e.style="";export{e as salla_loyalty_program}
4
+ import{r as a,h as l,H as t}from"./p-Cz6cYzxG.js";import{l as s}from"./p-BChI23pG.js";const o=a=>a?new Date(Number(a)).toLocaleDateString(salla.lang.locale,{weekday:"long",year:"numeric",month:"long",day:"numeric",hour:"numeric"}):"",r=a=>{if(!a)return"";try{const l=a.toLowerCase(),t=salla.lang.get(`pages.loyalty_program.${l}`);return t===`pages.loyalty_program.${l}`?a:t}catch{return a}},e=class{constructor(l){a(this,l),this.loyaltyPointsArray=[],this.isLoadingLoyalty=!1,this.nextPageUrlLoyalty="",this.handleClick=()=>{this.loadMoreLoyaltyPoints()}}componentWillLoad(){return salla.onReady().then((()=>{this.loadLoyaltyPoints()}))}async loadLoyaltyPoints(){this.isLoadingLoyalty=!0;try{let a="/balance/points?page=1",l=await salla.api.request(a);this.loyaltyPointsArray=l.data,this.nextPageUrlLoyalty=l.cursor.next}catch(a){console.error("Error loading loyalty points transactions",a)}finally{this.isLoadingLoyalty=!1}}async loadMoreLoyaltyPoints(){if(this.nextPageUrlLoyalty){this.isLoadingLoyalty=!0;try{let a=await salla.api.request(this.nextPageUrlLoyalty);this.loyaltyPointsArray=[...this.loyaltyPointsArray,...a.data],this.nextPageUrlLoyalty=a.cursor?.next||""}catch(a){console.error("Error loading more loyalty points",a)}finally{this.isLoadingLoyalty=!1}}}render(){return l(t,{key:"4a8cb15322b005a124eb5792044d6435fd52922e"},l("div",{key:"54a08cfdb24116455b8c137d20ec5ef22a34ff85"},this.isLoadingLoyalty?l("salla-loading",null):l("div",null,this.loyaltyPointsArray.length>0?l("div",null,l("table",{class:"s-loyalty-program-table"},l("thead",{class:"s-loyalty-program-table-head"},l("tr",{class:"s-loyalty-program-table-head-tr"},l("th",{scope:"col",class:"s-loyalty-program-table-head-tr-th"},salla.lang.get("pages.wallet.points")),l("th",{scope:"col",class:"s-loyalty-program-table-head-tr-th"},salla.lang.get("pages.wallet.date")),l("th",{scope:"col",class:"s-loyalty-program-table-head-tr-th"},salla.lang.get("pages.wallet.expiry_date")),l("th",{scope:"col",class:"s-loyalty-program-table-head-tr-th"},salla.lang.get("common.elements.note")),l("th",{scope:"col",class:"s-loyalty-program-table-head-tr-th"},salla.lang.get("common.elements.status")))),l("tbody",{class:"s-loyalty-program-table-tbody"},this.loyaltyPointsArray.map((a=>l("tr",{class:"s-loyalty-program-table-tbody-tr"},l("td",{class:"s-loyalty-program-table-tbody-tr-td"},"plus"===a?.type?"+":"",a?.points||""," ",salla.lang.get("pages.loyalty_program.point")),l("td",{class:"s-loyalty-program-table-tbody-tr-td"},o(a?.created_at?1e3*Number(a.created_at):void 0)),l("td",{class:"s-loyalty-program-table-tbody-tr-td"},o(a?.points_expire_date)),l("td",{class:"s-loyalty-program-table-tbody-tr-td"},r(a?.key)),l("td",{class:"s-loyalty-program-table-tbody-tr-td"},r(a?.status_key))))))),l("div",{class:"s-infinite-scroll-wrapper"},!!this.nextPageUrlLoyalty&&l("salla-button",{onClick:this.handleClick,loading:this.isLoadingLoyalty},salla.lang.get("common.elements.load_more")))):l("div",null,l("div",{class:"s-loyalty-program-table-empty-state"},l("span",{innerHTML:s}),l("div",{class:"s-loyalty-program-table-placeholder-title"},salla.lang.get("pages.loyalty_program.no_loyality_points_title")),l("div",{class:"s-loyalty-program-table-placeholder-sub-title"},salla.lang.get("pages.loyalty_program.no_loyality_points_sub_title")))))))}};e.style="";export{e as salla_loyalty_program}
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r as s,h as t,H as a,g as i}from"./p-DYB20YqN.js";const l=class{constructor(t){s(this,t),this.isVisible=!0,this.isMobile=!1,this.mobileBreakpoint=768,this.mobileQueryHandler=s=>this.isMobile=s.matches}async componentWillLoad(){await Salla.onReady(),await Salla.lang.onLoaded(),this.loadTranslations(),Salla.storage.get("cookies-consent")&&(this.isVisible=!1)}loadTranslations(){this.messageLabel=Salla.lang.get("common.cookies.message"),this.linkLabel=Salla.lang.get("common.cookies.link"),this.acceptLabel=Salla.lang.get("common.cookies.accept"),this.rejectLabel=Salla.lang.get("common.cookies.reject")}componentDidLoad(){this.mobileQuery=window.matchMedia(`(max-width: ${this.mobileBreakpoint-1}px)`),this.isMobile=this.mobileQuery.matches,this.mobileQuery.addEventListener("change",this.mobileQueryHandler)}disconnectedCallback(){this.mobileQuery?.removeEventListener("change",this.mobileQueryHandler)}async accept(){return this.isVisible=!1,Salla.event.emit("salla-cookies-bar::accepted"),Salla.storage.set("cookies-consent","accepted"),this.host}async reject(){return this.isVisible=!1,Salla.event.emit("salla-cookies-bar::rejected"),Salla.storage.set("cookies-consent","rejected"),this.host}isRtl(){return Salla.config.get("theme.is_rtl",!0)}render(){return this.isVisible?t(a,null,t("div",{dir:this.isRtl()?"rtl":"ltr",class:"s-cookies-bar fixed bottom-0 inset-x-0 z-50 bg-white p-4"},t("div",{class:"s-cookies-bar-content flex flex-col justify-center gap-6 max-w-screen-xl mx-auto px-4"},t("p",{class:"s-cookies-bar-message text-sm font-medium leading-relaxed text-gray-500 m-0"},this.messageLabel,Salla.config.get("policy_url")&&t("a",{href:Salla.config.get("policy_url"),target:"_blank",class:"s-cookies-bar-link text-primary ms-1"},this.linkLabel)),t("div",{class:"s-cookies-bar-actions flex flex-row gap-2 shrink-0"},t("salla-button",{class:"s-cookies-bar-btn--accept",color:"primary",fill:"solid",type:"button",size:this.isMobile?"small":"medium",onClick:()=>this.accept()},this.acceptLabel),t("salla-button",{class:"s-cookies-bar-btn--reject",fill:"outline",type:"button",size:this.isMobile?"small":"medium",onClick:()=>this.reject()},this.rejectLabel))))):t(a,null)}get host(){return i(this)}};l.style=":host{display:block;overflow:visible}.s-cookies-bar{box-shadow:0 0 20px 4px rgba(0, 0, 0, 0.15)}";export{l as salla_cookies_bar}
4
+ import{r as s,h as t,H as a,a as i}from"./p-Cz6cYzxG.js";const l=class{constructor(t){s(this,t),this.isVisible=!0,this.isMobile=!1,this.mobileBreakpoint=768,this.mobileQueryHandler=s=>this.isMobile=s.matches}async componentWillLoad(){await Salla.onReady(),await Salla.lang.onLoaded(),this.loadTranslations(),Salla.storage.get("cookies-consent")&&(this.isVisible=!1)}loadTranslations(){this.messageLabel=Salla.lang.get("common.cookies.message"),this.linkLabel=Salla.lang.get("common.cookies.link"),this.acceptLabel=Salla.lang.get("common.cookies.accept"),this.rejectLabel=Salla.lang.get("common.cookies.reject")}componentDidLoad(){this.mobileQuery=window.matchMedia(`(max-width: ${this.mobileBreakpoint-1}px)`),this.isMobile=this.mobileQuery.matches,this.mobileQuery.addEventListener("change",this.mobileQueryHandler)}disconnectedCallback(){this.mobileQuery?.removeEventListener("change",this.mobileQueryHandler)}async accept(){return this.isVisible=!1,Salla.event.emit("salla-cookies-bar::accepted"),Salla.storage.set("cookies-consent","accepted"),this.host}async reject(){return this.isVisible=!1,Salla.event.emit("salla-cookies-bar::rejected"),Salla.storage.set("cookies-consent","rejected"),this.host}isRtl(){return Salla.config.get("theme.is_rtl",!0)}render(){return this.isVisible?t(a,null,t("div",{dir:this.isRtl()?"rtl":"ltr",class:"s-cookies-bar fixed bottom-0 inset-x-0 z-50 bg-white p-4"},t("div",{class:"s-cookies-bar-content flex flex-col justify-center gap-6 max-w-screen-xl mx-auto px-4"},t("p",{class:"s-cookies-bar-message text-sm font-medium leading-relaxed text-gray-500 m-0"},this.messageLabel,Salla.config.get("policy_url")&&t("a",{href:Salla.config.get("policy_url"),target:"_blank",class:"s-cookies-bar-link text-primary ms-1"},this.linkLabel)),t("div",{class:"s-cookies-bar-actions flex flex-row gap-2 shrink-0"},t("salla-button",{class:"s-cookies-bar-btn--accept",color:"primary",fill:"solid",type:"button",size:this.isMobile?"small":"medium",onClick:()=>this.accept()},this.acceptLabel),t("salla-button",{class:"s-cookies-bar-btn--reject",fill:"outline",type:"button",size:this.isMobile?"small":"medium",onClick:()=>this.reject()},this.rejectLabel))))):t(a,null)}get host(){return i(this)}};l.style=":host{display:block;overflow:visible}.s-cookies-bar{box-shadow:0 0 20px 4px rgba(0, 0, 0, 0.15)}";export{l as salla_cookies_bar}
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r as e,c as a,h as t,H as s}from"./p-DYB20YqN.js";const i=class{constructor(t){e(this,t),this.prizeItemSelected=a(this,"prizeItemSelected")}onPrizeItemClick(){this.prizeItemSelected.emit(this.item)}render(){return t(s,{key:"91162ebf1e2f76c4b90df9518d57a136e71fa573"},t("div",{key:"80416871b0f60857b3279525bdaa87327b75890a",onClick:this.onPrizeItemClick.bind(this)},t("img",{key:"d7afdc106a822c0f7640136bec591bfa48fe1802",class:"s-loyalty-prize-item-image",src:this.item.image,alt:this.item.name}),t("div",{key:"727f131b7fa00b75aab57f2bb5ea4616f0d3929a",class:"s-loyalty-prize-item-title"},this.item.name),t("div",{key:"6e2b9263b7d2c1b7a9e372ede63a6b10a23b0d1d",class:"s-loyalty-prize-item-subtitle"},this.item.description),t("div",{key:"97b7710e76e3d73afe68abe6e8094483960884da",class:"s-loyalty-prize-item-points"},this.item.cost_points," ",salla.lang.get("pages.loyalty_program.point"))))}};i.style="salla-loyalty-prize-item:hover{box-shadow:0 5px 15px 1px rgba(0, 0, 0, 0.04) !important}";export{i as salla_loyalty_prize_item}
4
+ import{r as e,c as a,h as t,H as s}from"./p-Cz6cYzxG.js";const i=class{constructor(t){e(this,t),this.prizeItemSelected=a(this,"prizeItemSelected")}onPrizeItemClick(){this.prizeItemSelected.emit(this.item)}render(){return t(s,{key:"91162ebf1e2f76c4b90df9518d57a136e71fa573"},t("div",{key:"80416871b0f60857b3279525bdaa87327b75890a",onClick:this.onPrizeItemClick.bind(this)},t("img",{key:"d7afdc106a822c0f7640136bec591bfa48fe1802",class:"s-loyalty-prize-item-image",src:this.item.image,alt:this.item.name}),t("div",{key:"727f131b7fa00b75aab57f2bb5ea4616f0d3929a",class:"s-loyalty-prize-item-title"},this.item.name),t("div",{key:"6e2b9263b7d2c1b7a9e372ede63a6b10a23b0d1d",class:"s-loyalty-prize-item-subtitle"},this.item.description),t("div",{key:"97b7710e76e3d73afe68abe6e8094483960884da",class:"s-loyalty-prize-item-points"},this.item.cost_points," ",salla.lang.get("pages.loyalty_program.point"))))}};i.style="salla-loyalty-prize-item:hover{box-shadow:0 5px 15px 1px rgba(0, 0, 0, 0.04) !important}";export{i as salla_loyalty_prize_item}
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r as s,h as t,H as e}from"./p-DYB20YqN.js";import{S as l}from"./p-BscTeWDc.js";var a;!function(s){s.DEFAULT="default",s.AVAILABILITY="availability"}(a||(a={}));const i=class{constructor(t){s(this,t),this.loadedScopes={[a.DEFAULT]:null,[a.AVAILABILITY]:null},this.translationLoaded=!1,this.mode=a.DEFAULT,this.scopes=[],this.originalScopesList=[],this.isOpenedBefore=salla.storage.get("branch-choosed-before"),this.hasError=!1,this.loading=!1,this.selection="optional",this.searchDisplayLimit=6,this.getFormTitle=()=>{if(this.originalScopesList?.length<2)return"";const s=salla.config.get("store.features")?.includes("multi-countries");return this.mode===a.DEFAULT?salla.lang.get(s?"blocks.scope.shopping_from_another_market":"blocks.scope.shopping_from_another_branch"):salla.lang.get("blocks.scope.search_for_availability_in_other_branches")},salla.event.on("scopes::open",(({mode:s=null,product_id:t=null})=>{this.open(s,t)})),salla.lang.onLoaded((()=>{this.translationLoaded=!0}))}async close(){return await(this.modal?.close())}async open(s=a.DEFAULT,t=null){return this.hasError=!1,this.mode=[a.AVAILABILITY,a.DEFAULT].includes(s)?s:a.DEFAULT,this.loading=!this.loadedScopes[this.mode],this.setScopeValues([]),salla.log("SallaScope:: opened"),this.modal.open(),this.loading?await salla.api.withoutNotifier((()=>s==a.AVAILABILITY?salla.scope.getProductAvailability(t):salla.scope.get())).then((t=>{if(s==a.AVAILABILITY)return this.setScopeValues(this.loadedScopes[a.AVAILABILITY]=t.data);this.setScopeValues(this.loadedScopes[this.mode]=t.data.scopes)})).catch((s=>{console.log(s),this.hasError=!0})).finally((()=>{this.modal.stopLoading(),this.loading=!1})):(this.setScopeValues(this.loadedScopes[this.mode]),this.modal.stopLoading())}async handleSubmit(){let s={id:this.current_scope.id};return this.changeBtn.load(),await salla.scope.change(s).then((()=>{salla.storage.set("branch-choosed-before",!0),salla.storage.set("scope",{type:this.current_scope.type,id:this.current_scope.id}),salla.cart.reset(),window.location.replace(salla.helpers.addParamToUrl("scope",this.current_scope.id))})).catch((s=>console.log(s))).finally((()=>{this.changeBtn.stop()}))}setScopeValues(s){this.scopes=s,this.originalScopesList=s,1==s?.length?(this.current_scope=s[0],this.selected_scope=s[0],this.scopes=[s[0]]):(this.current_scope=s?.find((s=>s.selected)),this.selected_scope=s?.find((s=>s.selected)))}handleSearchFieldTyping(s){let t=s.target.value.toLocaleLowerCase();this.scopes=t?this.originalScopesList.filter((s=>s.name.toLowerCase().includes(t))):this.originalScopesList}handleScopeSelection(s){this.current_scope=this.scopes?.find((t=>t.id==s.target.value))}placeholderContent(){return t("salla-placeholder",{alignment:"center",class:"s-scopes-placeholder"},t("span",{slot:"title"},salla.lang.get("blocks.scope.branch_looking_for_not_found")),t("span",{slot:"description"},salla.lang.get("blocks.scope.our_services_not_available_in_this_branch")))}defaultContent(){return[t("div",{class:"s-scopes-container s-scrollbar"},this.scopes?.map((s=>t("div",{class:"s-scopes-input-wrap","data-selection":this.selection},t("input",{id:`${this.selection} + '_scope_' + ${s.id}`,name:"lang",type:"radio",value:s.id,onChange:s=>this.handleScopeSelection(s),class:"s-scopes-input",checked:!!this.current_scope&&this.current_scope.id==s.id}),t("label",{htmlFor:`${this.selection} + '_scope_' + ${s.id}`,class:"s-scopes-label s-scopes-clickable"},t("span",null,s.name)))))),this.footerContent()]}availabilityContent(){return t("div",{class:"s-scopes-container"},this.scopes?.map((s=>t("div",{class:"s-scopes-input-wrap","data-selection":this.selection},t("h2",{class:{"s-scopes-label":!0,"s-scopes-clickable":this.mode===a.DEFAULT}},t("span",null,s.name)),t("h2",{style:{color:s?.availability?.color},class:`s-scopes-${s?.availability?.key}`},s?.availability?.label)))))}footerContent(){return t("div",{class:"s-scopes-footer"},t("slot",{name:"footer"},t("salla-button",{ref:s=>this.changeBtn=s,disabled:!this.current_scope,onClick:()=>this.handleSubmit(),class:"s-scopes-submit","loader-position":"center",width:"wide"},salla.lang.get("common.elements.confirm"))))}componentWillLoad(){return salla.onReady()}render(){return t(e,{key:"0f85dc5ec5bed28a4087226cff76eb63c70b83a4"},t("salla-modal",{key:"cdb992873dfac3920a9884ab088679687833118a",ref:s=>this.modal=s,isClosable:!(!this.isOpenedBefore&&"optional"!=this.selection),class:"s-scopes-modal",isLoading:this.loading,"has-skeleton":!0},this.loading?t("div",{slot:"loading"},t("div",{class:"s-scopes-skeleton"},t("salla-list-tile",{class:"s-scopes-header"},t("div",{slot:"icon",class:"s-scopes-header-icon"},t("salla-skeleton",{type:"circle"})),t("div",{slot:"title",class:"s-scopes-header-title mb-5"},t("salla-skeleton",{height:"15px",width:"50%"})),t("div",{slot:"subtitle",class:"s-scopes-header-subtitle"},t("salla-skeleton",{height:"10px"}),t("salla-skeleton",{height:"10px",width:"75%"}))),t("div",{class:"s-scopes-skeleton-search"},t("salla-skeleton",{height:"10px",width:"50%"}),t("salla-skeleton",{height:"30px",width:"100%"})),t("div",{class:"s-scopes-skeleton-scopes"},t("salla-skeleton",{height:"10px",width:"30%"}),t("salla-skeleton",{height:"10px",width:"25%"}),t("salla-skeleton",{height:"10px",width:"30%"}),t("salla-skeleton",{height:"10px",width:"25%"}),t("salla-skeleton",{height:"10px",width:"30%"}),t("salla-skeleton",{height:"10px",width:"25%"}),t("salla-skeleton",{height:"10px",width:"30%"}),t("salla-skeleton",{height:"10px",width:"25%"})),t("div",{class:"s-scopes-skeleton-btn"},t("salla-skeleton",{height:"40px",width:"100%"})))):[t("salla-list-tile",{class:this.originalScopesList?.length?"s-scopes-header block":"s-hidden"},t("div",{slot:"icon",class:"s-scopes-header-icon",innerHTML:'\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>store-alt</title>\n<path d="M6.667 24h5.333c0.736 0 1.333-0.596 1.333-1.333s-0.597-1.333-1.333-1.333h-5.333c-0.736 0-1.333 0.596-1.333 1.333s0.597 1.333 1.333 1.333zM31.86 10.071l-4-8c-0.227-0.452-0.688-0.737-1.193-0.737h-21.333c-0.505 0-0.967 0.285-1.193 0.737l-4 8c-0.092 0.184-0.14 0.389-0.14 0.596v18.667c0 0.737 0.597 1.333 1.333 1.333h29.333c0.736 0 1.333-0.596 1.333-1.333v-18.667c0-0.207-0.048-0.412-0.14-0.596zM6.157 4h19.685l3.333 6.667h-26.352zM24 28h-5.333v-9.333h5.333zM29.333 28h-2.667v-10.667c0-0.737-0.597-1.333-1.333-1.333h-8c-0.736 0-1.333 0.596-1.333 1.333v10.667h-13.333v-14.667h26.667zM6.667 18.667h5.333c0.736 0 1.333-0.596 1.333-1.333s-0.597-1.333-1.333-1.333h-5.333c-0.736 0-1.333 0.596-1.333 1.333s0.597 1.333 1.333 1.333z"></path>\n</svg>\n'}),t("div",{slot:"title",class:"s-scopes-header-title"},salla.lang.get("blocks.scope.you_are_browse_store_from")),t("div",{slot:"subtitle",class:"s-scopes-header-subtitle"},this.selected_scope?this.selected_scope.name:"")),t("div",{class:"s-scopes-wrap"},!!this.originalScopesList?.length&&t("h4",{class:"s-scopes-title"},this.getFormTitle()),this.originalScopesList?.length>this.searchDisplayLimit?t("div",{class:"s-scopes-search-wrapper"},t("div",{class:"s-scopes-search-icon",innerHTML:l}),t("input",{type:"text",class:"s-scopes-search-input",onInput:s=>this.handleSearchFieldTyping(s),enterkeyhint:"search",placeholder:salla.lang.get("blocks.scope.searching_for_a_branch")})):"",this.hasError||!this.originalScopesList?.length&&this.mode!==a.AVAILABILITY?this.placeholderContent():this.mode===a.DEFAULT?this.defaultContent():this.availabilityContent())]))}async componentDidLoad(){await Salla.hooks.registerComponent("salla-scopes",this),salla.config.isMobileApp()||this.isOpenedBefore||"mandatory"!=this.selection||this.open()}};i.style=".s-scopes-availability-content{display:flex;justify-content:center;align-items:center}.s-scopes-placeholder{flex:0 0 85%}";export{i as salla_scopes}
4
+ import{r as s,h as t,H as e}from"./p-Cz6cYzxG.js";import{S as l}from"./p-BscTeWDc.js";var a;!function(s){s.DEFAULT="default",s.AVAILABILITY="availability"}(a||(a={}));const i=class{constructor(t){s(this,t),this.loadedScopes={[a.DEFAULT]:null,[a.AVAILABILITY]:null},this.translationLoaded=!1,this.mode=a.DEFAULT,this.scopes=[],this.originalScopesList=[],this.isOpenedBefore=salla.storage.get("branch-choosed-before"),this.hasError=!1,this.loading=!1,this.selection="optional",this.searchDisplayLimit=6,this.getFormTitle=()=>{if(this.originalScopesList?.length<2)return"";const s=salla.config.get("store.features")?.includes("multi-countries");return this.mode===a.DEFAULT?salla.lang.get(s?"blocks.scope.shopping_from_another_market":"blocks.scope.shopping_from_another_branch"):salla.lang.get("blocks.scope.search_for_availability_in_other_branches")},salla.event.on("scopes::open",(({mode:s=null,product_id:t=null})=>{this.open(s,t)})),salla.lang.onLoaded((()=>{this.translationLoaded=!0}))}async close(){return await(this.modal?.close())}async open(s=a.DEFAULT,t=null){return this.hasError=!1,this.mode=[a.AVAILABILITY,a.DEFAULT].includes(s)?s:a.DEFAULT,this.loading=!this.loadedScopes[this.mode],this.setScopeValues([]),salla.log("SallaScope:: opened"),this.modal.open(),this.loading?await salla.api.withoutNotifier((()=>s==a.AVAILABILITY?salla.scope.getProductAvailability(t):salla.scope.get())).then((t=>{if(s==a.AVAILABILITY)return this.setScopeValues(this.loadedScopes[a.AVAILABILITY]=t.data);this.setScopeValues(this.loadedScopes[this.mode]=t.data.scopes)})).catch((s=>{console.log(s),this.hasError=!0})).finally((()=>{this.modal.stopLoading(),this.loading=!1})):(this.setScopeValues(this.loadedScopes[this.mode]),this.modal.stopLoading())}async handleSubmit(){let s={id:this.current_scope.id};return this.changeBtn.load(),await salla.scope.change(s).then((()=>{salla.storage.set("branch-choosed-before",!0),salla.storage.set("scope",{type:this.current_scope.type,id:this.current_scope.id}),salla.cart.reset(),window.location.replace(salla.helpers.addParamToUrl("scope",this.current_scope.id))})).catch((s=>console.log(s))).finally((()=>{this.changeBtn.stop()}))}setScopeValues(s){this.scopes=s,this.originalScopesList=s,1==s?.length?(this.current_scope=s[0],this.selected_scope=s[0],this.scopes=[s[0]]):(this.current_scope=s?.find((s=>s.selected)),this.selected_scope=s?.find((s=>s.selected)))}handleSearchFieldTyping(s){let t=s.target.value.toLocaleLowerCase();this.scopes=t?this.originalScopesList.filter((s=>s.name.toLowerCase().includes(t))):this.originalScopesList}handleScopeSelection(s){this.current_scope=this.scopes?.find((t=>t.id==s.target.value))}placeholderContent(){return t("salla-placeholder",{alignment:"center",class:"s-scopes-placeholder"},t("span",{slot:"title"},salla.lang.get("blocks.scope.branch_looking_for_not_found")),t("span",{slot:"description"},salla.lang.get("blocks.scope.our_services_not_available_in_this_branch")))}defaultContent(){return[t("div",{class:"s-scopes-container s-scrollbar"},this.scopes?.map((s=>t("div",{class:"s-scopes-input-wrap","data-selection":this.selection},t("input",{id:`${this.selection} + '_scope_' + ${s.id}`,name:"lang",type:"radio",value:s.id,onChange:s=>this.handleScopeSelection(s),class:"s-scopes-input",checked:!!this.current_scope&&this.current_scope.id==s.id}),t("label",{htmlFor:`${this.selection} + '_scope_' + ${s.id}`,class:"s-scopes-label s-scopes-clickable"},t("span",null,s.name)))))),this.footerContent()]}availabilityContent(){return t("div",{class:"s-scopes-container"},this.scopes?.map((s=>t("div",{class:"s-scopes-input-wrap","data-selection":this.selection},t("h2",{class:{"s-scopes-label":!0,"s-scopes-clickable":this.mode===a.DEFAULT}},t("span",null,s.name)),t("h2",{style:{color:s?.availability?.color},class:`s-scopes-${s?.availability?.key}`},s?.availability?.label)))))}footerContent(){return t("div",{class:"s-scopes-footer"},t("slot",{name:"footer"},t("salla-button",{ref:s=>this.changeBtn=s,disabled:!this.current_scope,onClick:()=>this.handleSubmit(),class:"s-scopes-submit","loader-position":"center",width:"wide"},salla.lang.get("common.elements.confirm"))))}componentWillLoad(){return salla.onReady()}render(){return t(e,{key:"0f85dc5ec5bed28a4087226cff76eb63c70b83a4"},t("salla-modal",{key:"cdb992873dfac3920a9884ab088679687833118a",ref:s=>this.modal=s,isClosable:!(!this.isOpenedBefore&&"optional"!=this.selection),class:"s-scopes-modal",isLoading:this.loading,"has-skeleton":!0},this.loading?t("div",{slot:"loading"},t("div",{class:"s-scopes-skeleton"},t("salla-list-tile",{class:"s-scopes-header"},t("div",{slot:"icon",class:"s-scopes-header-icon"},t("salla-skeleton",{type:"circle"})),t("div",{slot:"title",class:"s-scopes-header-title mb-5"},t("salla-skeleton",{height:"15px",width:"50%"})),t("div",{slot:"subtitle",class:"s-scopes-header-subtitle"},t("salla-skeleton",{height:"10px"}),t("salla-skeleton",{height:"10px",width:"75%"}))),t("div",{class:"s-scopes-skeleton-search"},t("salla-skeleton",{height:"10px",width:"50%"}),t("salla-skeleton",{height:"30px",width:"100%"})),t("div",{class:"s-scopes-skeleton-scopes"},t("salla-skeleton",{height:"10px",width:"30%"}),t("salla-skeleton",{height:"10px",width:"25%"}),t("salla-skeleton",{height:"10px",width:"30%"}),t("salla-skeleton",{height:"10px",width:"25%"}),t("salla-skeleton",{height:"10px",width:"30%"}),t("salla-skeleton",{height:"10px",width:"25%"}),t("salla-skeleton",{height:"10px",width:"30%"}),t("salla-skeleton",{height:"10px",width:"25%"})),t("div",{class:"s-scopes-skeleton-btn"},t("salla-skeleton",{height:"40px",width:"100%"})))):[t("salla-list-tile",{class:this.originalScopesList?.length?"s-scopes-header block":"s-hidden"},t("div",{slot:"icon",class:"s-scopes-header-icon",innerHTML:'\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>store-alt</title>\n<path d="M6.667 24h5.333c0.736 0 1.333-0.596 1.333-1.333s-0.597-1.333-1.333-1.333h-5.333c-0.736 0-1.333 0.596-1.333 1.333s0.597 1.333 1.333 1.333zM31.86 10.071l-4-8c-0.227-0.452-0.688-0.737-1.193-0.737h-21.333c-0.505 0-0.967 0.285-1.193 0.737l-4 8c-0.092 0.184-0.14 0.389-0.14 0.596v18.667c0 0.737 0.597 1.333 1.333 1.333h29.333c0.736 0 1.333-0.596 1.333-1.333v-18.667c0-0.207-0.048-0.412-0.14-0.596zM6.157 4h19.685l3.333 6.667h-26.352zM24 28h-5.333v-9.333h5.333zM29.333 28h-2.667v-10.667c0-0.737-0.597-1.333-1.333-1.333h-8c-0.736 0-1.333 0.596-1.333 1.333v10.667h-13.333v-14.667h26.667zM6.667 18.667h5.333c0.736 0 1.333-0.596 1.333-1.333s-0.597-1.333-1.333-1.333h-5.333c-0.736 0-1.333 0.596-1.333 1.333s0.597 1.333 1.333 1.333z"></path>\n</svg>\n'}),t("div",{slot:"title",class:"s-scopes-header-title"},salla.lang.get("blocks.scope.you_are_browse_store_from")),t("div",{slot:"subtitle",class:"s-scopes-header-subtitle"},this.selected_scope?this.selected_scope.name:"")),t("div",{class:"s-scopes-wrap"},!!this.originalScopesList?.length&&t("h4",{class:"s-scopes-title"},this.getFormTitle()),this.originalScopesList?.length>this.searchDisplayLimit?t("div",{class:"s-scopes-search-wrapper"},t("div",{class:"s-scopes-search-icon",innerHTML:l}),t("input",{type:"text",class:"s-scopes-search-input",onInput:s=>this.handleSearchFieldTyping(s),enterkeyhint:"search",placeholder:salla.lang.get("blocks.scope.searching_for_a_branch")})):"",this.hasError||!this.originalScopesList?.length&&this.mode!==a.AVAILABILITY?this.placeholderContent():this.mode===a.DEFAULT?this.defaultContent():this.availabilityContent())]))}async componentDidLoad(){await Salla.hooks.registerComponent("salla-scopes",this),salla.config.isMobileApp()||this.isOpenedBefore||"mandatory"!=this.selection||this.open()}};i.style=".s-scopes-availability-content{display:flex;justify-content:center;align-items:center}.s-scopes-placeholder{flex:0 0 85%}";export{i as salla_scopes}
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r as s,h as e,H as t}from"./p-DYB20YqN.js";const c=class{constructor(e){s(this,e),this.type="normal",this.width="100%",this.height="100%"}render(){return e(t,{key:"366d9fcd96b22edc9b5cdc07f8d8367fdbc5c574",class:"s-skeleton-wrapper",style:{width:this.width,height:this.height}},e("div",{key:"b4ad9adc7d8ce69aeaeaa1cf287726fa69018730",class:{"s-skeleton-item":!0,"s-skeleton-item-circular":"circle"==this.type}}," "))}};c.style=":host{display:block}";export{c as salla_skeleton}
4
+ import{r as s,h as e,H as t}from"./p-Cz6cYzxG.js";const c=class{constructor(e){s(this,e),this.type="normal",this.width="100%",this.height="100%"}render(){return e(t,{key:"366d9fcd96b22edc9b5cdc07f8d8367fdbc5c574",class:"s-skeleton-wrapper",style:{width:this.width,height:this.height}},e("div",{key:"b4ad9adc7d8ce69aeaeaa1cf287726fa69018730",class:{"s-skeleton-item":!0,"s-skeleton-item-circular":"circle"==this.type}}," "))}};c.style=":host{display:block}";export{c as salla_skeleton}
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r as s,h as l,H as t}from"./p-DYB20YqN.js";const i=class{constructor(l){s(this,l),this.methods=[],this.shouldRender=!1}async componentDidLoad(){await Salla.onReady(),await Salla.lang.onLoaded(),Salla.config.get("store.support_pickup")&&(this.shouldRender=!0,this.setLabels())}setLabels(){this.methods=[{id:"delivery",title:Salla.lang.getWithDefault("pages.products.promise_delivery_title","متاح للتوصيل"),subtitle:Salla.lang.getWithDefault("pages.products.promise_delivery_subtitle","طلبك يوصلك لباب البيت بسهولة."),iconClass:"sicon-location"},{id:"pickup",title:Salla.lang.getWithDefault("pages.products.promise_pickup_title","متاح للاستلام"),subtitle:Salla.lang.getWithDefault("pages.products.promise_pickup_subtitle","استلام فوري من أقرب فرع."),iconClass:"sicon-store"}]}render(){return this.shouldRender?l(t,{class:"s-fulfillment-methods"},l("div",{class:"s-fulfillment-methods-list"},this.methods.map((s=>l("div",{key:s.id,class:"s-fulfillment-methods-card"},l("div",{class:"s-fulfillment-methods-content"},l("div",{class:"s-fulfillment-methods-icon-wrap"},l("i",{class:`${s.iconClass} s-fulfillment-methods-icon`})),l("div",{class:"s-fulfillment-methods-text"},l("span",{class:"s-fulfillment-methods-title"},s.title),l("span",{class:"s-fulfillment-methods-subtitle"},s.subtitle)))))))):null}};export{i as salla_fulfillment_methods}
4
+ import{r as s,h as l,H as t}from"./p-Cz6cYzxG.js";const i=class{constructor(l){s(this,l),this.methods=[],this.shouldRender=!1}async componentDidLoad(){await Salla.onReady(),await Salla.lang.onLoaded(),Salla.config.get("store.support_pickup")&&(this.shouldRender=!0,this.setLabels())}setLabels(){this.methods=[{id:"delivery",title:Salla.lang.getWithDefault("pages.products.promise_delivery_title","متاح للتوصيل"),subtitle:Salla.lang.getWithDefault("pages.products.promise_delivery_subtitle","طلبك يوصلك لباب البيت بسهولة."),iconClass:"sicon-location"},{id:"pickup",title:Salla.lang.getWithDefault("pages.products.promise_pickup_title","متاح للاستلام"),subtitle:Salla.lang.getWithDefault("pages.products.promise_pickup_subtitle","استلام فوري من أقرب فرع."),iconClass:"sicon-store"}]}render(){return this.shouldRender?l(t,{class:"s-fulfillment-methods"},l("div",{class:"s-fulfillment-methods-list"},this.methods.map((s=>l("div",{key:s.id,class:"s-fulfillment-methods-card"},l("div",{class:"s-fulfillment-methods-content"},l("div",{class:"s-fulfillment-methods-icon-wrap"},l("i",{class:`${s.iconClass} s-fulfillment-methods-icon`})),l("div",{class:"s-fulfillment-methods-text"},l("span",{class:"s-fulfillment-methods-title"},s.title),l("span",{class:"s-fulfillment-methods-subtitle"},s.subtitle)))))))):null}};export{i as salla_fulfillment_methods}
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r as s,h as t,H as a,g as e}from"./p-DYB20YqN.js";import{S as c}from"./p-Ctkfc4K-.js";import{l as i}from"./p-BChI23pG.js";import{A as r}from"./p-DCZbpt2a.js";import{P as o}from"./p-DY4LZmNP.js";import{a as n}from"./p-CgtvEd63.js";const l=class{constructor(t){s(this,t),this.internalOffers=[],this.showAll=!1,this.freeLabel="",this.receivedOffer="",this.discountAmountLabel="",this.showMoreOffers="",this.icons={DiscountCouponIcon:'\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>discount-coupon</title>\n<path d="M27 28h-22c-0.552 0-1-0.448-1-1v0c0-1.657-1.343-3-3-3v0c-0.552 0-1-0.448-1-1v0-12c0-0.552 0.448-1 1-1v0c1.657 0 3-1.343 3-3v0c0-0.552 0.448-1 1-1v0h22c0.552 0 1 0.448 1 1v0c0 1.657 1.343 3 3 3v0c0.552 0 1 0.448 1 1v0 12c0 0.552-0.448 1-1 1v0c-1.657 0-3 1.343-3 3v0c0 0.552-0.448 1-1 1v0zM5.9 26h20.2c0.415-1.964 1.936-3.485 3.867-3.894l0.033-0.006v-10.2c-1.964-0.415-3.485-1.936-3.894-3.867l-0.006-0.033h-20.2c-0.415 1.964-1.936 3.485-3.867 3.894l-0.033 0.006v10.2c1.964 0.415 3.485 1.936 3.894 3.867l0.006 0.033zM20 7h2v3h-2v-3zM20 12h2v4h-2v-4zM20 18h2v4h-2v-4zM20 24h2v3h-2v-3zM9 16c-1.657 0-3-1.343-3-3s1.343-3 3-3c1.657 0 3 1.343 3 3v0c0 1.657-1.343 3-3 3v0zM9 12c-0.552 0-1 0.448-1 1s0.448 1 1 1c0.552 0 1-0.448 1-1v0c0-0.552-0.448-1-1-1v0zM15 24c-1.657 0-3-1.343-3-3s1.343-3 3-3c1.657 0 3 1.343 3 3v0c0 1.657-1.343 3-3 3v0zM15 20c-0.552 0-1 0.448-1 1s0.448 1 1 1c0.552 0 1-0.448 1-1v0c0-0.552-0.448-1-1-1v0zM7 24c-0.552-0-1-0.448-1-1 0-0.244 0.088-0.468 0.233-0.642l-0.001 0.002 10-12c0.185-0.221 0.461-0.36 0.769-0.36 0.553 0 1.001 0.448 1.001 1.001 0 0.245-0.088 0.469-0.233 0.643l0.001-0.002-10 12c-0.185 0.22-0.46 0.358-0.767 0.358-0.001 0-0.002 0-0.003 0h0z"></path>\n</svg>\n',GiftIcon:i,FireIcon:'\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>fire</title>\n<path d="M21.56 3.009c-0.052-0.047-0.116-0.065-0.173-0.103-0.073-0.048-0.143-0.1-0.223-0.132-0.083-0.033-0.165-0.047-0.252-0.063-0.081-0.016-0.16-0.035-0.243-0.035-0.089 0-0.172 0.020-0.26 0.037-0.080 0.016-0.159 0.028-0.236 0.059-0.084 0.035-0.157 0.088-0.235 0.14-0.053 0.036-0.115 0.053-0.165 0.097-0.049 0.044-0.988 0.895-2.288 2.255-2.364-2.839-4.476-4.815-4.576-4.908-0.056-0.052-0.127-0.075-0.188-0.115-0.075-0.049-0.143-0.105-0.224-0.137-0.080-0.032-0.163-0.041-0.245-0.057-0.085-0.016-0.167-0.040-0.252-0.040-0.084 0-0.163 0.023-0.245 0.039-0.087 0.016-0.172 0.025-0.253 0.059-0.080 0.032-0.147 0.087-0.22 0.135-0.063 0.041-0.133 0.064-0.189 0.116-0.453 0.423-11.092 10.408-11.092 18.095 0 7.977 4.935 13.549 12 13.549h8.667c6.673 0 11.333-5.115 11.333-12.439 0-7.052-10.013-16.167-10.44-16.552zM20.667 29.333h-7.777c-2.924 0-4.889-2.044-4.889-5.084 0-2.317 2.816-6.441 4.888-8.887 0.76 0.909 2.755 3.397 3.969 5.869 0.212 0.431 0.639 0.715 1.117 0.743 0.489 0.031 0.937-0.203 1.197-0.605 0.552-0.849 1.109-1.596 1.497-2.093 1.491 1.897 3.331 4.78 3.331 6.399 0 2.188-1.34 3.659-3.333 3.659zM26.537 27.052c0.081-0.44 0.129-0.899 0.129-1.377 0-3.269-3.713-7.847-4.46-8.735l-0.523-0.617c-0.507-0.599-1.528-0.599-2.035 0l-0.531 0.627c-0.147 0.175-0.495 0.599-0.936 1.187-1.595-2.597-3.495-4.776-3.595-4.889l-0.697-0.793c-0.507-0.577-1.499-0.577-2.004 0l-0.697 0.795c-0.6 0.684-5.856 6.803-5.856 11.001 0 0.881 0.127 1.712 0.356 2.484-1.896-1.933-3.023-4.821-3.023-8.283 0-4.915 6.073-11.997 9.329-15.255 1.001 1.008 2.692 2.789 4.368 4.927 0.243 0.309 0.609 0.496 1.001 0.509h0.048c0.376 0 0.735-0.159 0.988-0.439 0.889-0.981 1.693-1.795 2.269-2.359 3.051 2.965 8.663 9.323 8.663 13.727 0 3.171-1.031 5.769-2.796 7.491z"></path>\n</svg>\n',SpecialDiscountIcon:c,TagMoneyIcon:'\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>tag-money</title>\n<path d="M20.567 11.433c-0.521-0.521-1.364-0.521-1.885 0l-0.524 0.524c-1.28-0.819-3.091-0.681-4.191 0.419-0.631 0.631-0.976 1.468-0.976 2.359 0 0.889 0.347 1.727 0.976 2.357l0.943 0.943c0.171 0.171 0.195 0.368 0.195 0.472s-0.025 0.301-0.196 0.472c-0.169 0.169-0.367 0.195-0.471 0.195s-0.301-0.025-0.472-0.195l-2.357-2.357c-0.521-0.521-1.364-0.521-1.885 0s-0.521 1.364 0 1.885l0.944 0.941-0.472 0.472c-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.391l0.519-0.519c0.54 0.359 1.173 0.553 1.837 0.553 0.892 0 1.729-0.348 2.357-0.976 0.631-0.631 0.976-1.467 0.976-2.357s-0.347-1.727-0.976-2.357l-0.943-0.943c-0.26-0.26-0.26-0.684 0-0.944 0.259-0.259 0.683-0.261 0.944 0l1.885 1.887c0.521 0.521 1.364 0.521 1.885 0 0.521-0.52 0.521-1.364 0-1.885l-0.472-0.472 0.472-0.472c0.521-0.521 0.521-1.365 0.001-1.887zM28 0h-9.344c-1.059 0-2.056 0.411-2.809 1.153l-14.673 14.456c-1.56 1.56-1.561 4.097-0.001 5.657l9.56 9.56c0.755 0.755 1.76 1.172 2.828 1.173h0.003c1.068 0 2.072-0.416 2.833-1.179l14.451-14.668c0.743-0.753 1.153-1.751 1.153-2.809v-9.344c0-2.205-1.795-4-4-4zM29.333 13.344c0 0.353-0.137 0.685-0.385 0.937l-14.444 14.661c-0.252 0.252-0.587 0.391-0.941 0.391-0.001 0-0.001 0-0.001 0-0.356-0.001-0.691-0.139-0.943-0.392l-9.561-9.56c-0.52-0.52-0.52-1.365-0.005-1.88l14.667-14.449c0.253-0.248 0.585-0.385 0.937-0.385h9.344c0.736 0 1.333 0.597 1.333 1.333zM24 6.673c-0.737 0-1.333 0.604-1.333 1.341s0.596 1.333 1.333 1.333 1.333-0.596 1.333-1.333v-0.015c0-0.737-0.596-1.327-1.333-1.327z"></path>\n</svg>\n'},this.visibleOffersCount=3,this.handleCartItemUpdated=s=>{const t=s.data.cart.items.find((s=>s.id===this.itemId));t?.id===this.itemId&&(this.internalQuantity=t.quantity,this.internalOffers=t.detailed_offers||[],this.internalProductPrice=t.product_price)},this.toggleShowAll=()=>{this.showAll=!this.showAll}}async componentWillLoad(){await Salla.onReady(),await salla.lang.onLoaded((()=>{this.freeLabel=salla.lang.get("common.elements.freeExclam"),this.receivedOffer=salla.lang.get("pages.cart.received_offer"),this.discountAmountLabel=salla.lang.get("pages.cart.discount_amount"),this.showMoreOffers=salla.lang.get("pages.cart.show_more_offers")})),this.internalQuantity=this.quantity,this.internalOffers=this.parseOffers(this.offers),this.internalProductPrice=this.productPrice}componentDidLoad(){salla.event.on("cart::item.updated",(s=>this.handleCartItemUpdated(s)))}parseOffers(s){try{return"string"!=typeof s?(console.warn("Offers is not a string. Returning as-is.",s),Array.isArray(s)?s:[]):JSON.parse(s||"[]")}catch(s){return console.error("Failed to parse offers",s),[]}}get visibleOffers(){return this.internalOffers.slice(0,this.visibleOffersCount)}get hiddenOffers(){return this.internalOffers.slice(this.visibleOffersCount)}getPaidQty(s,t){return s-t.free_quantity}renderOffer(s,a){const e=this.getPaidQty(s,a);return t("div",{class:"s-cart-item-offers-box"},a.free_quantity>0&&e>0&&t("div",{class:"s-cart-item-offers-paid-free"},t("div",{class:"s-cart-item-offers-line"},salla.helpers.number(e)," × ",t("span",{innerHTML:salla.money(this.internalProductPrice)})),t("div",{class:"s-cart-item-offers-line"},salla.helpers.number(a.free_quantity)," ×",t("span",{class:"s-cart-item-offers-regular-price",innerHTML:salla.money(this.internalProductPrice)}),t("span",{class:"s-cart-item-offers-free-label"},this.freeLabel))),t("div",{class:"s-cart-item-offers-details"},t("span",{class:"s-cart-item-offers-icon",innerHTML:this.icons[a.discount_icon]||""}),t("div",null,t("p",{class:"s-cart-item-offers-title"},this.receivedOffer.replace(":offer",a.offer_name)),t("p",{class:"s-cart-item-offers-discount"},t("span",{innerHTML:this.discountAmountLabel.replace(":amount",salla.money(a.discount_amount.toFixed(2)))})))))}render(){return this.internalOffers?.length?t("div",{class:"s-cart-item-offers-container",id:`offers_list_${this.itemId}`},this.visibleOffers.map((s=>this.renderOffer(this.internalQuantity,s))),this.internalOffers?.length>this.visibleOffersCount&&t("div",{class:"s-cart-item-offers-show-more"},t("button",{class:"s-cart-item-offers-show-more-btn",onClick:this.toggleShowAll,type:"button"},t("span",{class:"s-cart-item-offers-show-more-label"},"+",this.hiddenOffers.length," ",this.showMoreOffers,t("span",{innerHTML:r,class:{"s-cart-item-offers-arrow-icon":!0,"s-cart-item-offers-arrow-open":this.showAll}})))),this.showAll&&t("div",{class:"s-cart-item-offers-collapsed",id:`offers_${this.itemId}`},this.hiddenOffers.map((s=>this.renderOffer(this.internalQuantity,s))))):null}};l.style=":host{display:block}";const h=class{constructor(t){s(this,t),this.cartSummaryCount=salla.storage.get("cart.summary.count")||0,this.cartSummaryTotal=salla.storage.get("cart.summary.total")||0,this.cartLabel="ar"===salla.config.get("user.language_code")?"السلة":"Cart",salla.cart.event.onUpdated((s=>{this.cartSummaryCount=s.count||0,this.cartSummaryTotal=s.total||0}))}async animateToCart(s){if(document.querySelectorAll(".s-cart-thumb").forEach((s=>s.remove())),!s?.src)return void salla.log("Failed to get the img element");let t=this.host.querySelector("#s-cart-icon"),a=t.getBoundingClientRect(),e=a.top+window.scrollY,c=a.left+window.scrollX,i=s.getBoundingClientRect(),r=s.offsetWidth+"px",o=s.offsetHeight+"px",l=i.top,h=i.left,d=document.createElement("img");d.src=s.getAttribute("src"),d.className="s-cart-thumb",d.setAttribute("style","object-fit:cover; width:"+r+"; height:"+o+"; top:"+l+"px; left:"+h+"px;z-index:99999999; "),document.body.append(d);let f=document.querySelector(".s-cart-thumb");t.classList.remove("animated","rubberBand"),(new n.timeline).add({targets:f,width:[150,30],height:[150,30],top:[l,window.scrollY>0?e-window.scrollY-40:e-40],left:[h,c],borderRadius:["20%","50%"],easing:"easeOutExpo",duration:1200},"+=200").add({targets:f,width:[30,0],height:[30,0],opacity:[1,0],easing:"easeOutExpo",top:[window.scrollY>0?e-window.scrollY-40:e-40,window.scrollY>0?e-window.scrollY+10:e+10],left:[c,c+10]},"-=500").add({complete:function(){t.classList.add("animated","rubberBand"),f.remove()}},"-=1700")}componentWillLoad(){return new Promise((s=>salla.onReady(s)))}getCartLink(){let s=salla.url.get("cart");const t=salla.storage.get("scope")||salla.config.get("store.scope");if(t&&t.id)try{const a=new URL(s);return a.searchParams.set("scope",t.id),t.allocation_type&&a.searchParams.set("allocation_type",t.allocation_type),t.allocation_id&&a.searchParams.set("allocation_id",t.allocation_id),a.toString()}catch(a){const e=s.includes("?")?"&":"?",c=new URLSearchParams;return c.set("scope",String(t.id)),t.allocation_type&&c.set("allocation_type",t.allocation_type),t.allocation_id&&c.set("allocation_id",t.allocation_id),`${s}${e}${c.toString()}`}return s}render(){return t(a,{key:"918f027fd28cd25d653b8419f97223daaf22d428"},t("a",{key:"b74a2724ada356a01b915044d56dfb0f9953338e",class:"s-cart-summary-wrapper",href:this.getCartLink()},t("div",{key:"b9332fe1b66b895c1e9950efaa548f04eb053d46",id:"s-cart-icon"},t("slot",{key:"2b5c1cf8dea4ca23a54beeb83cfad44538ca3ab7",name:"icon"},t("i",{key:"f3145ed4a994762441d925280a3234d78c378bef",class:"s-cart-summary-icon",innerHTML:o}))),t("span",{key:"26a78adf9b279019504e995216ea5373b6866876",class:"s-cart-summary-count"},salla.helpers.number(this.cartSummaryCount)),t("p",{key:"60ad091221ed5cd3e2ac0d27ebc53ec9917ccd64",class:"s-cart-summary-content"},this.showCartLabel&&t("span",{key:"66819086b9ed7f6f21be2cd5e8baf0bc88021e40",class:"s-cart-summary-label"},this.cartLabel),t("b",{key:"a07c85971e50add3cdd5b51942e642d4daf19d82",class:"s-cart-summary-total",innerHTML:salla.money(this.cartSummaryTotal)}))))}get host(){return e(this)}};h.style="";export{l as salla_cart_item_offers,h as salla_cart_summary}
4
+ import{r as s,h as t,H as a,a as e}from"./p-Cz6cYzxG.js";import{S as c}from"./p-Ctkfc4K-.js";import{l as i}from"./p-BChI23pG.js";import{A as r}from"./p-DCZbpt2a.js";import{P as o}from"./p-DY4LZmNP.js";import{a as n}from"./p-CgtvEd63.js";const l=class{constructor(t){s(this,t),this.internalOffers=[],this.showAll=!1,this.freeLabel="",this.receivedOffer="",this.discountAmountLabel="",this.showMoreOffers="",this.icons={DiscountCouponIcon:'\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>discount-coupon</title>\n<path d="M27 28h-22c-0.552 0-1-0.448-1-1v0c0-1.657-1.343-3-3-3v0c-0.552 0-1-0.448-1-1v0-12c0-0.552 0.448-1 1-1v0c1.657 0 3-1.343 3-3v0c0-0.552 0.448-1 1-1v0h22c0.552 0 1 0.448 1 1v0c0 1.657 1.343 3 3 3v0c0.552 0 1 0.448 1 1v0 12c0 0.552-0.448 1-1 1v0c-1.657 0-3 1.343-3 3v0c0 0.552-0.448 1-1 1v0zM5.9 26h20.2c0.415-1.964 1.936-3.485 3.867-3.894l0.033-0.006v-10.2c-1.964-0.415-3.485-1.936-3.894-3.867l-0.006-0.033h-20.2c-0.415 1.964-1.936 3.485-3.867 3.894l-0.033 0.006v10.2c1.964 0.415 3.485 1.936 3.894 3.867l0.006 0.033zM20 7h2v3h-2v-3zM20 12h2v4h-2v-4zM20 18h2v4h-2v-4zM20 24h2v3h-2v-3zM9 16c-1.657 0-3-1.343-3-3s1.343-3 3-3c1.657 0 3 1.343 3 3v0c0 1.657-1.343 3-3 3v0zM9 12c-0.552 0-1 0.448-1 1s0.448 1 1 1c0.552 0 1-0.448 1-1v0c0-0.552-0.448-1-1-1v0zM15 24c-1.657 0-3-1.343-3-3s1.343-3 3-3c1.657 0 3 1.343 3 3v0c0 1.657-1.343 3-3 3v0zM15 20c-0.552 0-1 0.448-1 1s0.448 1 1 1c0.552 0 1-0.448 1-1v0c0-0.552-0.448-1-1-1v0zM7 24c-0.552-0-1-0.448-1-1 0-0.244 0.088-0.468 0.233-0.642l-0.001 0.002 10-12c0.185-0.221 0.461-0.36 0.769-0.36 0.553 0 1.001 0.448 1.001 1.001 0 0.245-0.088 0.469-0.233 0.643l0.001-0.002-10 12c-0.185 0.22-0.46 0.358-0.767 0.358-0.001 0-0.002 0-0.003 0h0z"></path>\n</svg>\n',GiftIcon:i,FireIcon:'\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>fire</title>\n<path d="M21.56 3.009c-0.052-0.047-0.116-0.065-0.173-0.103-0.073-0.048-0.143-0.1-0.223-0.132-0.083-0.033-0.165-0.047-0.252-0.063-0.081-0.016-0.16-0.035-0.243-0.035-0.089 0-0.172 0.020-0.26 0.037-0.080 0.016-0.159 0.028-0.236 0.059-0.084 0.035-0.157 0.088-0.235 0.14-0.053 0.036-0.115 0.053-0.165 0.097-0.049 0.044-0.988 0.895-2.288 2.255-2.364-2.839-4.476-4.815-4.576-4.908-0.056-0.052-0.127-0.075-0.188-0.115-0.075-0.049-0.143-0.105-0.224-0.137-0.080-0.032-0.163-0.041-0.245-0.057-0.085-0.016-0.167-0.040-0.252-0.040-0.084 0-0.163 0.023-0.245 0.039-0.087 0.016-0.172 0.025-0.253 0.059-0.080 0.032-0.147 0.087-0.22 0.135-0.063 0.041-0.133 0.064-0.189 0.116-0.453 0.423-11.092 10.408-11.092 18.095 0 7.977 4.935 13.549 12 13.549h8.667c6.673 0 11.333-5.115 11.333-12.439 0-7.052-10.013-16.167-10.44-16.552zM20.667 29.333h-7.777c-2.924 0-4.889-2.044-4.889-5.084 0-2.317 2.816-6.441 4.888-8.887 0.76 0.909 2.755 3.397 3.969 5.869 0.212 0.431 0.639 0.715 1.117 0.743 0.489 0.031 0.937-0.203 1.197-0.605 0.552-0.849 1.109-1.596 1.497-2.093 1.491 1.897 3.331 4.78 3.331 6.399 0 2.188-1.34 3.659-3.333 3.659zM26.537 27.052c0.081-0.44 0.129-0.899 0.129-1.377 0-3.269-3.713-7.847-4.46-8.735l-0.523-0.617c-0.507-0.599-1.528-0.599-2.035 0l-0.531 0.627c-0.147 0.175-0.495 0.599-0.936 1.187-1.595-2.597-3.495-4.776-3.595-4.889l-0.697-0.793c-0.507-0.577-1.499-0.577-2.004 0l-0.697 0.795c-0.6 0.684-5.856 6.803-5.856 11.001 0 0.881 0.127 1.712 0.356 2.484-1.896-1.933-3.023-4.821-3.023-8.283 0-4.915 6.073-11.997 9.329-15.255 1.001 1.008 2.692 2.789 4.368 4.927 0.243 0.309 0.609 0.496 1.001 0.509h0.048c0.376 0 0.735-0.159 0.988-0.439 0.889-0.981 1.693-1.795 2.269-2.359 3.051 2.965 8.663 9.323 8.663 13.727 0 3.171-1.031 5.769-2.796 7.491z"></path>\n</svg>\n',SpecialDiscountIcon:c,TagMoneyIcon:'\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>tag-money</title>\n<path d="M20.567 11.433c-0.521-0.521-1.364-0.521-1.885 0l-0.524 0.524c-1.28-0.819-3.091-0.681-4.191 0.419-0.631 0.631-0.976 1.468-0.976 2.359 0 0.889 0.347 1.727 0.976 2.357l0.943 0.943c0.171 0.171 0.195 0.368 0.195 0.472s-0.025 0.301-0.196 0.472c-0.169 0.169-0.367 0.195-0.471 0.195s-0.301-0.025-0.472-0.195l-2.357-2.357c-0.521-0.521-1.364-0.521-1.885 0s-0.521 1.364 0 1.885l0.944 0.941-0.472 0.472c-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.391l0.519-0.519c0.54 0.359 1.173 0.553 1.837 0.553 0.892 0 1.729-0.348 2.357-0.976 0.631-0.631 0.976-1.467 0.976-2.357s-0.347-1.727-0.976-2.357l-0.943-0.943c-0.26-0.26-0.26-0.684 0-0.944 0.259-0.259 0.683-0.261 0.944 0l1.885 1.887c0.521 0.521 1.364 0.521 1.885 0 0.521-0.52 0.521-1.364 0-1.885l-0.472-0.472 0.472-0.472c0.521-0.521 0.521-1.365 0.001-1.887zM28 0h-9.344c-1.059 0-2.056 0.411-2.809 1.153l-14.673 14.456c-1.56 1.56-1.561 4.097-0.001 5.657l9.56 9.56c0.755 0.755 1.76 1.172 2.828 1.173h0.003c1.068 0 2.072-0.416 2.833-1.179l14.451-14.668c0.743-0.753 1.153-1.751 1.153-2.809v-9.344c0-2.205-1.795-4-4-4zM29.333 13.344c0 0.353-0.137 0.685-0.385 0.937l-14.444 14.661c-0.252 0.252-0.587 0.391-0.941 0.391-0.001 0-0.001 0-0.001 0-0.356-0.001-0.691-0.139-0.943-0.392l-9.561-9.56c-0.52-0.52-0.52-1.365-0.005-1.88l14.667-14.449c0.253-0.248 0.585-0.385 0.937-0.385h9.344c0.736 0 1.333 0.597 1.333 1.333zM24 6.673c-0.737 0-1.333 0.604-1.333 1.341s0.596 1.333 1.333 1.333 1.333-0.596 1.333-1.333v-0.015c0-0.737-0.596-1.327-1.333-1.327z"></path>\n</svg>\n'},this.visibleOffersCount=3,this.handleCartItemUpdated=s=>{const t=s.data.cart.items.find((s=>s.id===this.itemId));t?.id===this.itemId&&(this.internalQuantity=t.quantity,this.internalOffers=t.detailed_offers||[],this.internalProductPrice=t.product_price)},this.toggleShowAll=()=>{this.showAll=!this.showAll}}async componentWillLoad(){await Salla.onReady(),await salla.lang.onLoaded((()=>{this.freeLabel=salla.lang.get("common.elements.freeExclam"),this.receivedOffer=salla.lang.get("pages.cart.received_offer"),this.discountAmountLabel=salla.lang.get("pages.cart.discount_amount"),this.showMoreOffers=salla.lang.get("pages.cart.show_more_offers")})),this.internalQuantity=this.quantity,this.internalOffers=this.parseOffers(this.offers),this.internalProductPrice=this.productPrice}componentDidLoad(){salla.event.on("cart::item.updated",(s=>this.handleCartItemUpdated(s)))}parseOffers(s){try{return"string"!=typeof s?(console.warn("Offers is not a string. Returning as-is.",s),Array.isArray(s)?s:[]):JSON.parse(s||"[]")}catch(s){return console.error("Failed to parse offers",s),[]}}get visibleOffers(){return this.internalOffers.slice(0,this.visibleOffersCount)}get hiddenOffers(){return this.internalOffers.slice(this.visibleOffersCount)}getPaidQty(s,t){return s-t.free_quantity}renderOffer(s,a){const e=this.getPaidQty(s,a);return t("div",{class:"s-cart-item-offers-box"},a.free_quantity>0&&e>0&&t("div",{class:"s-cart-item-offers-paid-free"},t("div",{class:"s-cart-item-offers-line"},salla.helpers.number(e)," × ",t("span",{innerHTML:salla.money(this.internalProductPrice)})),t("div",{class:"s-cart-item-offers-line"},salla.helpers.number(a.free_quantity)," ×",t("span",{class:"s-cart-item-offers-regular-price",innerHTML:salla.money(this.internalProductPrice)}),t("span",{class:"s-cart-item-offers-free-label"},this.freeLabel))),t("div",{class:"s-cart-item-offers-details"},t("span",{class:"s-cart-item-offers-icon",innerHTML:this.icons[a.discount_icon]||""}),t("div",null,t("p",{class:"s-cart-item-offers-title"},this.receivedOffer.replace(":offer",a.offer_name)),t("p",{class:"s-cart-item-offers-discount"},t("span",{innerHTML:this.discountAmountLabel.replace(":amount",salla.money(a.discount_amount.toFixed(2)))})))))}render(){return this.internalOffers?.length?t("div",{class:"s-cart-item-offers-container",id:`offers_list_${this.itemId}`},this.visibleOffers.map((s=>this.renderOffer(this.internalQuantity,s))),this.internalOffers?.length>this.visibleOffersCount&&t("div",{class:"s-cart-item-offers-show-more"},t("button",{class:"s-cart-item-offers-show-more-btn",onClick:this.toggleShowAll,type:"button"},t("span",{class:"s-cart-item-offers-show-more-label"},"+",this.hiddenOffers.length," ",this.showMoreOffers,t("span",{innerHTML:r,class:{"s-cart-item-offers-arrow-icon":!0,"s-cart-item-offers-arrow-open":this.showAll}})))),this.showAll&&t("div",{class:"s-cart-item-offers-collapsed",id:`offers_${this.itemId}`},this.hiddenOffers.map((s=>this.renderOffer(this.internalQuantity,s))))):null}};l.style=":host{display:block}";const h=class{constructor(t){s(this,t),this.cartSummaryCount=salla.storage.get("cart.summary.count")||0,this.cartSummaryTotal=salla.storage.get("cart.summary.total")||0,this.cartLabel="ar"===salla.config.get("user.language_code")?"السلة":"Cart",salla.cart.event.onUpdated((s=>{this.cartSummaryCount=s.count||0,this.cartSummaryTotal=s.total||0}))}async animateToCart(s){if(document.querySelectorAll(".s-cart-thumb").forEach((s=>s.remove())),!s?.src)return void salla.log("Failed to get the img element");let t=this.host.querySelector("#s-cart-icon"),a=t.getBoundingClientRect(),e=a.top+window.scrollY,c=a.left+window.scrollX,i=s.getBoundingClientRect(),r=s.offsetWidth+"px",o=s.offsetHeight+"px",l=i.top,h=i.left,d=document.createElement("img");d.src=s.getAttribute("src"),d.className="s-cart-thumb",d.setAttribute("style","object-fit:cover; width:"+r+"; height:"+o+"; top:"+l+"px; left:"+h+"px;z-index:99999999; "),document.body.append(d);let f=document.querySelector(".s-cart-thumb");t.classList.remove("animated","rubberBand"),(new n.timeline).add({targets:f,width:[150,30],height:[150,30],top:[l,window.scrollY>0?e-window.scrollY-40:e-40],left:[h,c],borderRadius:["20%","50%"],easing:"easeOutExpo",duration:1200},"+=200").add({targets:f,width:[30,0],height:[30,0],opacity:[1,0],easing:"easeOutExpo",top:[window.scrollY>0?e-window.scrollY-40:e-40,window.scrollY>0?e-window.scrollY+10:e+10],left:[c,c+10]},"-=500").add({complete:function(){t.classList.add("animated","rubberBand"),f.remove()}},"-=1700")}componentWillLoad(){return new Promise((s=>salla.onReady(s)))}getCartLink(){let s=salla.url.get("cart");const t=salla.storage.get("scope")||salla.config.get("store.scope");if(t&&t.id)try{const a=new URL(s);return a.searchParams.set("scope",t.id),t.allocation_type&&a.searchParams.set("allocation_type",t.allocation_type),t.allocation_id&&a.searchParams.set("allocation_id",t.allocation_id),a.toString()}catch(a){const e=s.includes("?")?"&":"?",c=new URLSearchParams;return c.set("scope",String(t.id)),t.allocation_type&&c.set("allocation_type",t.allocation_type),t.allocation_id&&c.set("allocation_id",t.allocation_id),`${s}${e}${c.toString()}`}return s}render(){return t(a,{key:"918f027fd28cd25d653b8419f97223daaf22d428"},t("a",{key:"b74a2724ada356a01b915044d56dfb0f9953338e",class:"s-cart-summary-wrapper",href:this.getCartLink()},t("div",{key:"b9332fe1b66b895c1e9950efaa548f04eb053d46",id:"s-cart-icon"},t("slot",{key:"2b5c1cf8dea4ca23a54beeb83cfad44538ca3ab7",name:"icon"},t("i",{key:"f3145ed4a994762441d925280a3234d78c378bef",class:"s-cart-summary-icon",innerHTML:o}))),t("span",{key:"26a78adf9b279019504e995216ea5373b6866876",class:"s-cart-summary-count"},salla.helpers.number(this.cartSummaryCount)),t("p",{key:"60ad091221ed5cd3e2ac0d27ebc53ec9917ccd64",class:"s-cart-summary-content"},this.showCartLabel&&t("span",{key:"66819086b9ed7f6f21be2cd5e8baf0bc88021e40",class:"s-cart-summary-label"},this.cartLabel),t("b",{key:"a07c85971e50add3cdd5b51942e642d4daf19d82",class:"s-cart-summary-total",innerHTML:salla.money(this.cartSummaryTotal)}))))}get host(){return e(this)}};h.style="";export{l as salla_cart_item_offers,h as salla_cart_summary}