@salla.sa/twilight-components 2.14.445 → 2.14.446

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 (306) hide show
  1. package/dist/cjs/{filepond-plugin-file-poster-BXm87rQo.js → filepond-plugin-file-poster-DXUkwq91.js} +1 -1
  2. package/dist/cjs/{filepond-plugin-file-validate-size-C5UIq4A2.js → filepond-plugin-file-validate-size-CmWT-l1o.js} +1 -1
  3. package/dist/cjs/{filepond-plugin-file-validate-type-DuhBUbfK.js → filepond-plugin-file-validate-type-CI-SRLe5.js} +1 -1
  4. package/dist/cjs/{filepond-plugin-image-edit-B9-VYsWc.js → filepond-plugin-image-edit-D0ccVwFm.js} +1 -1
  5. package/dist/cjs/{filepond-plugin-image-exif-orientation-DMpSTznq.js → filepond-plugin-image-exif-orientation-CC7CmDIV.js} +1 -1
  6. package/dist/cjs/{filepond-plugin-image-preview-CMGkdkZi.js → filepond-plugin-image-preview-DOMTJIsr.js} +1 -1
  7. package/dist/cjs/{filepond-DHzf3TcL.js → filepond-rDr-05NK.js} +1 -1
  8. package/dist/cjs/{functions-9Nj0nrLx.js → functions-BrD7nRK2.js} +1 -1
  9. package/dist/cjs/{index-rElwQMYM.js → index-BBFmWakU.js} +1 -1
  10. package/dist/cjs/{index-DQZXng_4.js → index-DA8jhZqT.js} +2 -2
  11. package/dist/cjs/loader.cjs.js +1 -1
  12. package/dist/cjs/salla-accordion-body_2.cjs.entry.js +1 -1
  13. package/dist/cjs/salla-accordion_6.cjs.entry.js +1 -1
  14. package/dist/cjs/salla-add-product-button_5.cjs.entry.js +2 -2
  15. package/dist/cjs/salla-advertisement.cjs.entry.js +1 -1
  16. package/dist/cjs/salla-alert_2.cjs.entry.js +1 -1
  17. package/dist/cjs/salla-app-install-alert.cjs.entry.js +1 -1
  18. package/dist/cjs/salla-apps-icons.cjs.entry.js +1 -1
  19. package/dist/cjs/salla-badge.cjs.entry.js +1 -1
  20. package/dist/cjs/salla-booking-field_7.cjs.entry.js +10 -10
  21. package/dist/cjs/salla-bullet-delivery_2.cjs.entry.js +1 -1
  22. package/dist/cjs/salla-cart-coupons.cjs.entry.js +1 -1
  23. package/dist/cjs/salla-cart-item-offers_2.cjs.entry.js +1 -1
  24. package/dist/cjs/salla-cashback-banner.cjs.entry.js +1 -1
  25. package/dist/cjs/salla-comment-form_8.cjs.entry.js +1 -1
  26. package/dist/cjs/salla-conditional-offer.cjs.entry.js +1 -1
  27. package/dist/cjs/salla-contacts.cjs.entry.js +1 -1
  28. package/dist/cjs/salla-cookies-bar.cjs.entry.js +1 -1
  29. package/dist/cjs/salla-count-down.cjs.entry.js +1 -1
  30. package/dist/cjs/salla-custom-fields.cjs.entry.js +1 -1
  31. package/dist/cjs/salla-delivery-promise.cjs.entry.js +1 -1
  32. package/dist/cjs/salla-edit-order-button.cjs.entry.js +1 -1
  33. package/dist/cjs/salla-filters-widget.cjs.entry.js +1 -1
  34. package/dist/cjs/salla-filters.cjs.entry.js +1 -1
  35. package/dist/cjs/salla-fulfillment-methods.cjs.entry.js +1 -1
  36. package/dist/cjs/salla-gifting.cjs.entry.js +1 -1
  37. package/dist/cjs/salla-hook.cjs.entry.js +1 -1
  38. package/dist/cjs/salla-infinite-scroll.cjs.entry.js +1 -1
  39. package/dist/cjs/salla-installment.cjs.entry.js +1 -1
  40. package/dist/cjs/salla-list-tile.cjs.entry.js +1 -1
  41. package/dist/cjs/salla-localization-modal.cjs.entry.js +1 -1
  42. package/dist/cjs/salla-login-modal.cjs.entry.js +1 -1
  43. package/dist/cjs/salla-loyalty-banner.cjs.entry.js +2 -2
  44. package/dist/cjs/salla-loyalty-hero_2.cjs.entry.js +2 -2
  45. package/dist/cjs/salla-loyalty-panel.cjs.entry.js +3 -3
  46. package/dist/cjs/salla-loyalty-points-banner.cjs.entry.js +1 -1
  47. package/dist/cjs/salla-loyalty-prize-item.cjs.entry.js +1 -1
  48. package/dist/cjs/salla-loyalty-program.cjs.entry.js +3 -3
  49. package/dist/cjs/salla-loyalty-reward.cjs.entry.js +2 -2
  50. package/dist/cjs/salla-loyalty.cjs.entry.js +1 -1
  51. package/dist/cjs/salla-maintenance-alert.cjs.entry.js +1 -1
  52. package/dist/cjs/salla-map.cjs.entry.js +1 -1
  53. package/dist/cjs/salla-menu.cjs.entry.js +1 -1
  54. package/dist/cjs/salla-metadata.cjs.entry.js +1 -1
  55. package/dist/cjs/salla-multiple-bundle-product-cart_2.cjs.entry.js +1 -1
  56. package/dist/cjs/salla-multiple-bundle-product-options-modal_2.cjs.entry.js +1 -1
  57. package/dist/cjs/salla-multiple-bundle-product.cjs.entry.js +1 -1
  58. package/dist/cjs/salla-next-order-coupon.cjs.entry.js +1 -1
  59. package/dist/cjs/salla-notification-item.cjs.entry.js +1 -1
  60. package/dist/cjs/salla-notifications.cjs.entry.js +1 -1
  61. package/dist/cjs/salla-offer-modal.cjs.entry.js +1 -1
  62. package/dist/cjs/salla-offer.cjs.entry.js +1 -1
  63. package/dist/cjs/salla-order-details-multiple-bundle-product.cjs.entry.js +1 -1
  64. package/dist/cjs/salla-order-details-options.cjs.entry.js +1 -1
  65. package/dist/cjs/salla-order-details.cjs.entry.js +1 -1
  66. package/dist/cjs/salla-order-edit-item.cjs.entry.js +1 -1
  67. package/dist/cjs/salla-order-edit-product-card.cjs.entry.js +1 -1
  68. package/dist/cjs/salla-order-edit.cjs.entry.js +1 -1
  69. package/dist/cjs/salla-order-summary.cjs.entry.js +1 -1
  70. package/dist/cjs/salla-order-totals-card.cjs.entry.js +1 -1
  71. package/dist/cjs/salla-orders.cjs.entry.js +1 -1
  72. package/dist/cjs/salla-payments.cjs.entry.js +1 -1
  73. package/dist/cjs/salla-placeholder.cjs.entry.js +1 -1
  74. package/dist/cjs/salla-price-range.cjs.entry.js +1 -1
  75. package/dist/cjs/salla-product-card-embed.cjs.entry.js +1 -1
  76. package/dist/cjs/salla-product-card_2.cjs.entry.js +1 -1
  77. package/dist/cjs/salla-product-size-guide.cjs.entry.js +1 -1
  78. package/dist/cjs/salla-products-list.cjs.entry.js +1 -1
  79. package/dist/cjs/salla-progress-bar.cjs.entry.js +1 -1
  80. package/dist/cjs/salla-quick-order.cjs.entry.js +1 -1
  81. package/dist/cjs/salla-rating-modal.cjs.entry.js +1 -1
  82. package/dist/cjs/salla-reward-action_4.cjs.entry.js +3 -3
  83. package/dist/cjs/salla-scopes.cjs.entry.js +1 -1
  84. package/dist/cjs/salla-search.cjs.entry.js +1 -1
  85. package/dist/cjs/salla-skeleton.cjs.entry.js +1 -1
  86. package/dist/cjs/salla-slider.cjs.entry.js +1 -1
  87. package/dist/cjs/salla-social-share.cjs.entry.js +1 -1
  88. package/dist/cjs/salla-social.cjs.entry.js +1 -1
  89. package/dist/cjs/salla-tab-content_3.cjs.entry.js +1 -1
  90. package/dist/cjs/salla-tiered-offer.cjs.entry.js +1 -1
  91. package/dist/cjs/salla-tooltip.cjs.entry.js +1 -1
  92. package/dist/cjs/salla-trust-badges.cjs.entry.js +1 -1
  93. package/dist/cjs/salla-user-menu.cjs.entry.js +1 -1
  94. package/dist/cjs/salla-user-profile.cjs.entry.js +1 -1
  95. package/dist/cjs/salla-user-settings.cjs.entry.js +1 -1
  96. package/dist/cjs/salla-verify.cjs.entry.js +1 -1
  97. package/dist/cjs/salla-wallet.cjs.entry.js +1 -1
  98. package/dist/cjs/{tracked-promise-YvbHmmFp.js → tracked-promise-vD81wqoM.js} +1 -1
  99. package/dist/cjs/twilight.cjs.js +1 -1
  100. package/dist/cjs/{vanilla-picker-C02drqC1.js → vanilla-picker-Dc4-oPc4.js} +1 -1
  101. package/dist/collection/components/salla-bought-together/salla-bought-together.js +1 -1
  102. package/dist/components/index.js +2 -2
  103. package/dist/components/salla-bought-together.js +1 -1
  104. package/dist/esm/{filepond-D3RXwxDJ.js → filepond-CpYF7JQY.js} +1 -1
  105. package/dist/esm/{filepond-plugin-file-poster-Bn0h-4qC.js → filepond-plugin-file-poster-ob6i92P3.js} +1 -1
  106. package/dist/esm/{filepond-plugin-file-validate-size-CN-3nZup.js → filepond-plugin-file-validate-size-h8AHfyQH.js} +1 -1
  107. package/dist/esm/{filepond-plugin-file-validate-type-BbLjL14b.js → filepond-plugin-file-validate-type-BPLx-hfr.js} +1 -1
  108. package/dist/esm/{filepond-plugin-image-edit-Dr_0Kpj1.js → filepond-plugin-image-edit-B7wPe8-3.js} +1 -1
  109. package/dist/esm/{filepond-plugin-image-exif-orientation-Bo8gf--w.js → filepond-plugin-image-exif-orientation-e7W60Y2D.js} +1 -1
  110. package/dist/esm/{filepond-plugin-image-preview-CkgdmQBn.js → filepond-plugin-image-preview-DOov9hTx.js} +1 -1
  111. package/dist/esm/{functions-CsLl2GF-.js → functions-BRfvCQ-R.js} +1 -1
  112. package/dist/esm/{index-DNtvpIPH.js → index-DryPCgN9.js} +2 -2
  113. package/dist/esm/{index-BZR5x5kv.js → index-nKWbBz_d.js} +1 -1
  114. package/dist/esm/loader.js +2 -2
  115. package/dist/esm/salla-accordion-body_2.entry.js +1 -1
  116. package/dist/esm/salla-accordion_6.entry.js +1 -1
  117. package/dist/esm/salla-add-product-button_5.entry.js +2 -2
  118. package/dist/esm/salla-advertisement.entry.js +1 -1
  119. package/dist/esm/salla-alert_2.entry.js +1 -1
  120. package/dist/esm/salla-app-install-alert.entry.js +1 -1
  121. package/dist/esm/salla-apps-icons.entry.js +1 -1
  122. package/dist/esm/salla-badge.entry.js +1 -1
  123. package/dist/esm/salla-booking-field_7.entry.js +10 -10
  124. package/dist/esm/salla-bullet-delivery_2.entry.js +1 -1
  125. package/dist/esm/salla-cart-coupons.entry.js +1 -1
  126. package/dist/esm/salla-cart-item-offers_2.entry.js +1 -1
  127. package/dist/esm/salla-cashback-banner.entry.js +1 -1
  128. package/dist/esm/salla-comment-form_8.entry.js +1 -1
  129. package/dist/esm/salla-conditional-offer.entry.js +1 -1
  130. package/dist/esm/salla-contacts.entry.js +1 -1
  131. package/dist/esm/salla-cookies-bar.entry.js +1 -1
  132. package/dist/esm/salla-count-down.entry.js +1 -1
  133. package/dist/esm/salla-custom-fields.entry.js +1 -1
  134. package/dist/esm/salla-delivery-promise.entry.js +1 -1
  135. package/dist/esm/salla-edit-order-button.entry.js +1 -1
  136. package/dist/esm/salla-filters-widget.entry.js +1 -1
  137. package/dist/esm/salla-filters.entry.js +1 -1
  138. package/dist/esm/salla-fulfillment-methods.entry.js +1 -1
  139. package/dist/esm/salla-gifting.entry.js +1 -1
  140. package/dist/esm/salla-hook.entry.js +1 -1
  141. package/dist/esm/salla-infinite-scroll.entry.js +1 -1
  142. package/dist/esm/salla-installment.entry.js +1 -1
  143. package/dist/esm/salla-list-tile.entry.js +1 -1
  144. package/dist/esm/salla-localization-modal.entry.js +1 -1
  145. package/dist/esm/salla-login-modal.entry.js +1 -1
  146. package/dist/esm/salla-loyalty-banner.entry.js +2 -2
  147. package/dist/esm/salla-loyalty-hero_2.entry.js +2 -2
  148. package/dist/esm/salla-loyalty-panel.entry.js +3 -3
  149. package/dist/esm/salla-loyalty-points-banner.entry.js +1 -1
  150. package/dist/esm/salla-loyalty-prize-item.entry.js +1 -1
  151. package/dist/esm/salla-loyalty-program.entry.js +3 -3
  152. package/dist/esm/salla-loyalty-reward.entry.js +2 -2
  153. package/dist/esm/salla-loyalty.entry.js +1 -1
  154. package/dist/esm/salla-maintenance-alert.entry.js +1 -1
  155. package/dist/esm/salla-map.entry.js +1 -1
  156. package/dist/esm/salla-menu.entry.js +1 -1
  157. package/dist/esm/salla-metadata.entry.js +1 -1
  158. package/dist/esm/salla-multiple-bundle-product-cart_2.entry.js +1 -1
  159. package/dist/esm/salla-multiple-bundle-product-options-modal_2.entry.js +1 -1
  160. package/dist/esm/salla-multiple-bundle-product.entry.js +1 -1
  161. package/dist/esm/salla-next-order-coupon.entry.js +1 -1
  162. package/dist/esm/salla-notification-item.entry.js +1 -1
  163. package/dist/esm/salla-notifications.entry.js +1 -1
  164. package/dist/esm/salla-offer-modal.entry.js +1 -1
  165. package/dist/esm/salla-offer.entry.js +1 -1
  166. package/dist/esm/salla-order-details-multiple-bundle-product.entry.js +1 -1
  167. package/dist/esm/salla-order-details-options.entry.js +1 -1
  168. package/dist/esm/salla-order-details.entry.js +1 -1
  169. package/dist/esm/salla-order-edit-item.entry.js +1 -1
  170. package/dist/esm/salla-order-edit-product-card.entry.js +1 -1
  171. package/dist/esm/salla-order-edit.entry.js +1 -1
  172. package/dist/esm/salla-order-summary.entry.js +1 -1
  173. package/dist/esm/salla-order-totals-card.entry.js +1 -1
  174. package/dist/esm/salla-orders.entry.js +1 -1
  175. package/dist/esm/salla-payments.entry.js +1 -1
  176. package/dist/esm/salla-placeholder.entry.js +1 -1
  177. package/dist/esm/salla-price-range.entry.js +1 -1
  178. package/dist/esm/salla-product-card-embed.entry.js +1 -1
  179. package/dist/esm/salla-product-card_2.entry.js +1 -1
  180. package/dist/esm/salla-product-size-guide.entry.js +1 -1
  181. package/dist/esm/salla-products-list.entry.js +1 -1
  182. package/dist/esm/salla-progress-bar.entry.js +1 -1
  183. package/dist/esm/salla-quick-order.entry.js +1 -1
  184. package/dist/esm/salla-rating-modal.entry.js +1 -1
  185. package/dist/esm/salla-reward-action_4.entry.js +3 -3
  186. package/dist/esm/salla-scopes.entry.js +1 -1
  187. package/dist/esm/salla-search.entry.js +1 -1
  188. package/dist/esm/salla-skeleton.entry.js +1 -1
  189. package/dist/esm/salla-slider.entry.js +1 -1
  190. package/dist/esm/salla-social-share.entry.js +1 -1
  191. package/dist/esm/salla-social.entry.js +1 -1
  192. package/dist/esm/salla-tab-content_3.entry.js +1 -1
  193. package/dist/esm/salla-tiered-offer.entry.js +1 -1
  194. package/dist/esm/salla-tooltip.entry.js +1 -1
  195. package/dist/esm/salla-trust-badges.entry.js +1 -1
  196. package/dist/esm/salla-user-menu.entry.js +1 -1
  197. package/dist/esm/salla-user-profile.entry.js +1 -1
  198. package/dist/esm/salla-user-settings.entry.js +1 -1
  199. package/dist/esm/salla-verify.entry.js +1 -1
  200. package/dist/esm/salla-wallet.entry.js +1 -1
  201. package/dist/esm/{tracked-promise-BnC5Z9K7.js → tracked-promise-x7FFO6oF.js} +1 -1
  202. package/dist/esm/twilight.js +2 -2
  203. package/dist/esm/{vanilla-picker-CF_W6ne1.js → vanilla-picker-WM2eU5Jq.js} +1 -1
  204. package/dist/twilight/{p-455c6c0b.entry.js → p-02281f9b.entry.js} +1 -1
  205. package/dist/twilight/{p-c86c3e12.entry.js → p-02be2d0d.entry.js} +1 -1
  206. package/dist/twilight/{p-318e0847.entry.js → p-04bf282e.entry.js} +1 -1
  207. package/dist/twilight/{p-3da82405.entry.js → p-06254080.entry.js} +1 -1
  208. package/dist/twilight/{p-2fb3d665.entry.js → p-0fbc1adc.entry.js} +1 -1
  209. package/dist/twilight/{p-14b4b77f.entry.js → p-1a8ffb6a.entry.js} +1 -1
  210. package/dist/twilight/{p-08344e0e.entry.js → p-25b0ee17.entry.js} +1 -1
  211. package/dist/twilight/{p-589b4b5e.entry.js → p-27954727.entry.js} +1 -1
  212. package/dist/twilight/{p-56bdf925.entry.js → p-306017cc.entry.js} +1 -1
  213. package/dist/twilight/{p-c81203f3.entry.js → p-3158d2a9.entry.js} +1 -1
  214. package/dist/twilight/{p-67a36054.entry.js → p-362d1920.entry.js} +1 -1
  215. package/dist/twilight/{p-108fff84.entry.js → p-372ff04c.entry.js} +1 -1
  216. package/dist/twilight/{p-b25fd2a3.entry.js → p-38334780.entry.js} +1 -1
  217. package/dist/twilight/{p-86be6cee.entry.js → p-385277f9.entry.js} +1 -1
  218. package/dist/twilight/{p-062e5544.entry.js → p-38c40f88.entry.js} +1 -1
  219. package/dist/twilight/{p-34c2e75f.entry.js → p-392bac91.entry.js} +1 -1
  220. package/dist/twilight/{p-ada82ecc.entry.js → p-39e59627.entry.js} +1 -1
  221. package/dist/twilight/{p-73409575.entry.js → p-3c8531fd.entry.js} +1 -1
  222. package/dist/twilight/{p-fa350b8c.entry.js → p-3ea0a5bb.entry.js} +1 -1
  223. package/dist/twilight/{p-df7d2c53.entry.js → p-4139872a.entry.js} +1 -1
  224. package/dist/twilight/{p-7f805c47.entry.js → p-41b5d22c.entry.js} +1 -1
  225. package/dist/twilight/{p-554e905e.entry.js → p-426a869c.entry.js} +1 -1
  226. package/dist/twilight/{p-ccf623d3.entry.js → p-43420d4d.entry.js} +1 -1
  227. package/dist/twilight/{p-6c45e8fa.entry.js → p-43e5cb00.entry.js} +1 -1
  228. package/dist/twilight/{p-819992c7.entry.js → p-46b2f44a.entry.js} +1 -1
  229. package/dist/twilight/{p-dd706055.entry.js → p-47ac0d89.entry.js} +1 -1
  230. package/dist/twilight/{p-83a08f07.entry.js → p-4b0747a1.entry.js} +1 -1
  231. package/dist/twilight/{p-dfc9dac3.entry.js → p-4e8a8906.entry.js} +1 -1
  232. package/dist/twilight/{p-16e2e0a8.entry.js → p-4eb51d3e.entry.js} +1 -1
  233. package/dist/twilight/{p-68fa49cc.entry.js → p-56af742e.entry.js} +1 -1
  234. package/dist/twilight/{p-2134195f.entry.js → p-56f5aac9.entry.js} +1 -1
  235. package/dist/twilight/{p-717782f4.entry.js → p-57e63e76.entry.js} +1 -1
  236. package/dist/twilight/{p-52d2d246.entry.js → p-5f08f47d.entry.js} +1 -1
  237. package/dist/twilight/{p-561b7f43.entry.js → p-63dd5a3c.entry.js} +1 -1
  238. package/dist/twilight/{p-5da3194a.entry.js → p-65421b04.entry.js} +1 -1
  239. package/dist/twilight/{p-788c870c.entry.js → p-66b9efc0.entry.js} +1 -1
  240. package/dist/twilight/{p-45f78030.entry.js → p-691abee2.entry.js} +1 -1
  241. package/dist/twilight/{p-f48a00a8.entry.js → p-6b2d84be.entry.js} +1 -1
  242. package/dist/twilight/{p-4168d56d.entry.js → p-6c25d9f0.entry.js} +1 -1
  243. package/dist/twilight/{p-ee83c195.entry.js → p-6e33dad3.entry.js} +1 -1
  244. package/dist/twilight/{p-46bd695f.entry.js → p-70e5fcb0.entry.js} +1 -1
  245. package/dist/twilight/{p-e902b0b4.entry.js → p-740ccc8e.entry.js} +1 -1
  246. package/dist/twilight/{p-ab565608.entry.js → p-7447b19b.entry.js} +1 -1
  247. package/dist/twilight/{p-06496953.entry.js → p-752c4d55.entry.js} +1 -1
  248. package/dist/twilight/{p-c583a907.entry.js → p-7b91245f.entry.js} +1 -1
  249. package/dist/twilight/{p-69498df8.entry.js → p-85911960.entry.js} +1 -1
  250. package/dist/twilight/{p-beb60b7e.entry.js → p-86e3a8fc.entry.js} +1 -1
  251. package/dist/twilight/{p-058d72ba.entry.js → p-891d0baa.entry.js} +1 -1
  252. package/dist/twilight/{p-8d942086.entry.js → p-96ce2dbc.entry.js} +1 -1
  253. package/dist/twilight/{p-J5XAqGwq.js → p-B09zahHa.js} +1 -1
  254. package/dist/twilight/{p-6Cm0Ixpa.js → p-CW4u-F7Z.js} +2 -2
  255. package/dist/twilight/{p-Bc7fLLSC.js → p-Cqvb5bEk.js} +1 -1
  256. package/dist/twilight/{p-C5-SqAXv.js → p-D0NjtBeS.js} +1 -1
  257. package/dist/twilight/{p-BxtnkpUH.js → p-DfQlAXmu.js} +1 -1
  258. package/dist/twilight/{p-CCzp4vsg.js → p-DkfNyQIQ.js} +1 -1
  259. package/dist/twilight/{p-NWWejksc.js → p-DnhZebll.js} +1 -1
  260. package/dist/twilight/{p-DNtvpIPH.js → p-DryPCgN9.js} +1 -1
  261. package/dist/twilight/p-Dv6JHEwK.js +4 -0
  262. package/dist/twilight/{p-BGCZ19oG.js → p-W3jneIaI.js} +1 -1
  263. package/dist/twilight/{p-DEbQVTrF.js → p-_2O7LkzU.js} +1 -1
  264. package/dist/twilight/{p-38c677fb.entry.js → p-a09118de.entry.js} +1 -1
  265. package/dist/twilight/{p-43e90789.entry.js → p-a35822f5.entry.js} +1 -1
  266. package/dist/twilight/{p-8f0d2c32.entry.js → p-acef8c7b.entry.js} +1 -1
  267. package/dist/twilight/{p-3af39ede.entry.js → p-b51a70cc.entry.js} +1 -1
  268. package/dist/twilight/{p-13cbd6eb.entry.js → p-b607e474.entry.js} +1 -1
  269. package/dist/twilight/{p-9e1f454d.entry.js → p-be360c44.entry.js} +1 -1
  270. package/dist/twilight/p-c1b9517f.entry.js +4 -0
  271. package/dist/twilight/{p-be76e4e7.entry.js → p-c22a3b11.entry.js} +1 -1
  272. package/dist/twilight/{p-185b629e.entry.js → p-c312d0db.entry.js} +1 -1
  273. package/dist/twilight/{p-7ffd3938.entry.js → p-c81c589b.entry.js} +1 -1
  274. package/dist/twilight/{p-564007ad.entry.js → p-cc65c26b.entry.js} +1 -1
  275. package/dist/twilight/{p-87978156.entry.js → p-cfa852cf.entry.js} +1 -1
  276. package/dist/twilight/{p-d8c3e606.entry.js → p-d520bdb9.entry.js} +1 -1
  277. package/dist/twilight/{p-09aa60ca.entry.js → p-d6ceeb02.entry.js} +1 -1
  278. package/dist/twilight/{p-d618c0ee.entry.js → p-d72ac224.entry.js} +1 -1
  279. package/dist/twilight/{p-28e39ff0.entry.js → p-d9adeaf2.entry.js} +1 -1
  280. package/dist/twilight/{p-42e59b60.entry.js → p-da8058f3.entry.js} +1 -1
  281. package/dist/twilight/{p-db06baf6.entry.js → p-db288463.entry.js} +1 -1
  282. package/dist/twilight/{p-d6dba947.entry.js → p-dc0d3911.entry.js} +1 -1
  283. package/dist/twilight/{p-0418d2eb.entry.js → p-e00cbb9e.entry.js} +1 -1
  284. package/dist/twilight/{p-ecb8c538.entry.js → p-e114505e.entry.js} +1 -1
  285. package/dist/twilight/{p-3953d2cc.entry.js → p-e1176fed.entry.js} +1 -1
  286. package/dist/twilight/{p-a8aea13b.entry.js → p-e20e9fcc.entry.js} +1 -1
  287. package/dist/twilight/{p-ed107904.entry.js → p-e290b5c5.entry.js} +1 -1
  288. package/dist/twilight/{p-2b9deb4c.entry.js → p-e450e794.entry.js} +1 -1
  289. package/dist/twilight/{p-ab4d2172.entry.js → p-e5cfb673.entry.js} +1 -1
  290. package/dist/twilight/{p-89bdd5e6.entry.js → p-e84c62f7.entry.js} +1 -1
  291. package/dist/twilight/{p-53c2b30e.entry.js → p-eb3ef9e4.entry.js} +1 -1
  292. package/dist/twilight/{p-bb2ecab7.entry.js → p-ec145c3d.entry.js} +1 -1
  293. package/dist/twilight/{p-d34e48ce.entry.js → p-f196f804.entry.js} +1 -1
  294. package/dist/twilight/p-f2563e2b.entry.js +4 -0
  295. package/dist/twilight/{p-eb8a0d2f.entry.js → p-f2f152fc.entry.js} +1 -1
  296. package/dist/twilight/{p-2282abc4.entry.js → p-f38b7948.entry.js} +1 -1
  297. package/dist/twilight/{p-0aea9987.entry.js → p-f6d9edd5.entry.js} +1 -1
  298. package/dist/twilight/{p-46f82b50.entry.js → p-f7b7ea3d.entry.js} +1 -1
  299. package/dist/twilight/{p-007bf4b3.entry.js → p-f974d986.entry.js} +1 -1
  300. package/dist/twilight/{p-186df566.entry.js → p-ffe84d46.entry.js} +1 -1
  301. package/dist/twilight/{p-D_Gt_HbS.js → p-k4lInm67.js} +1 -1
  302. package/dist/twilight/twilight.esm.js +1 -1
  303. package/package.json +5 -5
  304. package/dist/twilight/p-52686e7d.entry.js +0 -4
  305. package/dist/twilight/p-9b4d472b.entry.js +0 -4
  306. package/dist/twilight/p-D9eZofcJ.js +0 -4
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r as t,h as a,H as i,a as s}from"./p-DNtvpIPH.js";const e=class{constructor(a){t(this,a),this.tabbyBorderRemoved=!1,this.tabbyRemoveBorderTries=0,this.language=salla.config.get("user.language_code"),this.currency=salla.config.get("user.currency_code"),this.country=salla.config.get("user.country_code"),this.installment_sheria_text=(t,a)=>salla.lang.get(t,a)}async componentWillLoad(){await salla.onReady(),await salla.lang.onLoaded(),this.currency=salla.config.get("user.currency_code")||"SAR",this.language=salla.config.get("user.language_code")||"ar",this.country=salla.config.get("user.country_code")||"SA",[{key:"pages.products.installments",installments:3},{key:"pages.products.installments_emkan",installments:5}].forEach((t=>{this.installment_sheria_text(t.key,{payment:salla.money(parseFloat(this.price)),amount:salla.money((parseFloat(this.price)/t.installments).toFixed(2)).replace(/\.00$/,""),installments:t.installments})}));const t=salla.config.get("store.settings.installments");t&&(this.tamaraIsActive=t.tamara,this.tabbyIsActive=t.tabby,this.spotiiIsActive=t.spotii,this.mispayActive=t.mispay,this.emkanIsActive=t.emkan,this.madfuActive=t.madfu,this.rajehiIsActive=t.mokafaa_alrajhi,this.klarnaIsActive=t.klarna),salla.event.on("product::price.updated",(({data:t})=>{t.price&&t.price!=this.price&&(this.price=t.price,this.renderInstallments(!0))}))}componentDidLoad(){this.renderInstallments()}render(){const t="SAR"===this.currency;return this.isValidPrice(this.price)?a(i,null,this.tamaraIsActive&&(this.tamaraIsActive?.publicKey?a("div",{class:"mb-5"},a("tamara-widget",{type:"tamara-summary","inline-type":"2",amount:this.price})):a("div",{class:"tamara-product-widget","data-price":this.price,"data-currency":this.currency,"data-lang":this.language,"data-payment-type":"installment"})),this.tabbyIsActive?a("div",{id:"tabbyPromoWrapper"},a("div",{id:"tabbyPromo"})):"",this.spotiiIsActive?a("div",{class:"spotii-wrapper"},a("div",{class:"spotii-promo"})):"",this.shouldShowMispay()&&(this.mispayActive.publicKey?a("div",{class:"mb-5"},a("mispay-widget",{amount:this.price,lang:this.language})):a("div",{class:"s-installment-mispay-wrapper"},a("div",{class:"s-installment-mispay-content"},a("img",{src:salla.url.cdn("images/payment/png/mispay.png"),alt:"mispay"}),a("span",{class:"s-installment-mispay-content-text",innerHTML:this.installment_sheria_text("pages.products.installments",{payment:salla.money(parseFloat(this.price)),amount:salla.money((parseFloat(this.price)/4).toFixed(2)),installments:4})})))),this.emkanIsActive&&"SAR"===this.currency?a("div",{class:"s-installment-emkan-wrapper"},a("div",{class:"s-installment-emkan-content"},a("img",{src:salla.url.cdn("images/payment/png/emkan.png"),alt:"emkan"}),a("span",{class:"s-installment-emkan-content-text",innerHTML:this.installment_sheria_text("pages.products.installments_emkan",{payment:salla.money(parseFloat(this.price)),installments:5})}))):"",this.madfuActive&&"SAR"===this.currency?a("div",{class:"s-installment-madfu-wrapper"},a("div",{class:"s-installment-madfu-content"},a("img",{src:salla.url.cdn("images/payment/png/madfu.png"),alt:"madfu"}),a("span",{class:"s-installment-madfu-content-text"},salla.lang.get("pages.products.installments_madfu")))):"",t&&this.rajehiIsActive?a("div",{class:"s-installment-rajehi-wrapper"},a("div",{class:"s-installment-rajehi-content"},a("img",{src:salla.url.cdn("images/payment/png/mokafaa_alrajhi_loyalty.png"),alt:"mokafaa_alrajhi_loyalty"}),a("span",{class:"s-installment-rajehi-content-text"},salla.lang.get("pages.products.rajahi_earn_points",{points:Math.floor(+this.price*this.rajehiIsActive.pointsPerRiyal)})))):"",this.klarnaIsActive&&this.klarnaIsActive.locales?.length>0&&a("div",{class:"s-installment-klarna-wrapper"},a("klarna-placement",{"data-key":this.klarnaIsActive.dataKey||"credit-promotion-badge","data-locale":this.getKlarnaLocale(),"data-purchase-amount":String(Math.round(100*parseFloat(this.price)))}))):""}renderInstallments(t=!1){if(this.isValidPrice(this.price)){if(this.tamaraIsActive&&this.loadTamara({isUpdating:t}),this.tabbyIsActive){if(t){var a=this.host.querySelector("#tabbyPromoWrapper");a&&a.remove();var i=document.createElement("div");i.setAttribute("id","tabbyPromoWrapper");var s=document.createElement("div");s.setAttribute("id","tabbyPromo"),i.appendChild(s),this.host.appendChild(i);var e=document.querySelector('script[src="https://checkout.tabby.ai/tabby-promo.js"]');e&&e.remove()}var r=document.createElement("script");r.setAttribute("src","https://checkout.tabby.ai/tabby-promo.js"),document.head.appendChild(r),r.onload=()=>{new(0,window.TabbyPromo)({selector:"#tabbyPromo",currency:this.currency,price:this.price,lang:this.language,publicKey:salla.config.get("store.settings.installments.tabby.publicKey"),merchantCode:salla.config.get("store.settings.installments.tabby.merchantCode")}),document.querySelectorAll(".tabby-promo-snippet__logo").forEach((function(t){t.setAttribute("aria-label","Tabby Logo")}))},this.removeTabbyBorder()}if(this.spotiiIsActive){if(t){var n=this.host.querySelector(".spotii-wrapper");n&&n.remove();var o=document.createElement("div");o.classList.add("spotii-wrapper");var l=document.createElement("div");l.classList.add("spotii-promo"),o.appendChild(l),this.host.appendChild(o);var p=document.querySelector('script[src="'+salla.url.cdn("js/price-widget-ar-salla.js")+'"]');p&&p.remove()}let a=salla.money((Number(this.price)/3).toFixed(2),!1),i=salla.config.get("theme.is_rtl",!0);window.spotiiConfig={targetXPath:[".spotii-wrapper"],renderToPath:[".spotii-promo"],numberOfPayment:3,currency:this.currency,templateLine:"${textOne} ${number} ${textTwo} "+a+"${logo} ${info}",textOne:i?"جزء الدفع على":"Split it into",textTwo:i?"أقساط متساوية بدون تكاليف اضافية بقيمة":"payments of",textThree:"مع",price:this.price};var m=document.createElement("script");m.setAttribute("src",salla.url.cdn("js/price-widget-ar-salla.js")),document.head.appendChild(m)}this.klarnaIsActive&&this.klarnaIsActive.locales?.length>0&&this.loadKlarna(t),this.shouldShowMispay()&&this.mispayActive.publicKey&&this.loadExternalScript({position:"head",src:`https://widget.mispay.co/v1/sdk.js?authorize=${this.mispayActive.publicKey}`})}}isValidPrice(t){const a=/^\d+(\.\d{1,3})?$/.test(t),i=parseFloat(t)>0;return a&&i}loadExternalScript({src:t,onLoad:a,position:i}){const s=document.createElement("script");s.src=t,s.onload=a,document[i].appendChild(s)}loadTamara({isUpdating:t}){const a=!!this.tamaraIsActive?.publicKey;if(t)setTimeout((()=>{if(a)return window.TamaraWidgetV2?.refresh();window.TamaraProductWidget?.render()}),300);else if(a){const t=salla.config.get("user.language_code"),a=["ar","en"].includes(t)?t:"ar",i=this.currency?.slice(0,-1),s=["SA","AE","KW","BH","OM","QA"].includes(i)?i:null;s?(window.tamaraWidgetConfig={lang:a,country:s,publicKey:this.tamaraIsActive.publicKey,style:{fontSize:"14px"}},this.loadExternalScript({position:"head",src:"https://cdn.tamara.co/widget-v2/tamara-widget.js"})):console.error("Tamara: Country code is not supported",i)}else this.loadExternalScript({position:"head",src:"https://cdn.tamara.co/widget/product-widget.min.js",onLoad:()=>{window.TamaraProductWidget.init({lang:this.language}),setTimeout((()=>{window.TamaraProductWidget.render()}),300)}})}loadKlarna(t){if(window.KlarnaOnsiteService=window.KlarnaOnsiteService||[],t){const t=this.host.querySelector("klarna-placement");t&&(t.setAttribute("data-purchase-amount",String(Math.round(100*parseFloat(this.price)))),window.KlarnaOnsiteService.push({eventName:"refresh-placements"}))}else if(document.querySelector('script[src="https://js.klarna.com/web-sdk/v1/klarna.js"]'))window.KlarnaOnsiteService.push({eventName:"refresh-placements"});else{var a=document.createElement("script");a.async=!0,a.setAttribute("src","https://js.klarna.com/web-sdk/v1/klarna.js"),a.setAttribute("data-client-id",this.klarnaIsActive.clientId),a.onload=()=>{window.KlarnaOnsiteService.push({eventName:"refresh-placements"})},document.body.appendChild(a)}}getKlarnaLocale(){const t=this.klarnaIsActive?.locales||[];if(!t.length)return null;const a=new Map(t?.map((t=>[t.split("-")[0],t])));return a.get(this.language)??a.get("en")??t[0]}shouldShowMispay(){return"SAR"===this.currency&&this.mispayActive}removeTabbyBorder(){this.tabbyBorderRemoved||this.tabbyRemoveBorderTries>5||(this.tabbyRemoveBorderTries++,setTimeout((()=>{let t=document.querySelector("#tabbyPromo>div>div");t=t&&t.shadowRoot?t.shadowRoot.querySelector('div[class^="styles__tabby-promo-snippet--"]'):null,t?(t.style="border: none; margin: 15px 0!important;",this.tabbyBorderRemoved=!0):this.removeTabbyBorder()}),500*this.tabbyRemoveBorderTries))}get host(){return s(this)}};e.style="salla-installment:empty{display:none}#tabbyPromoWrapper{background:white;border-radius:0.375rem;transition:box-shadow 0.5s cubic-bezier(0.4, 0, 0.2, 1);margin-bottom:20px;border:unset !important;font-weight:500}.salla-y #tabbyPromoWrapper{border:1px solid var(--color-grey-dark);border-radius:12px}#tabbyPromoWrapper:hover{box-shadow:0 0 rgba(0, 0, 0, 0), 0 0 rgba(0, 0, 0, 0), 5px 10px 30px rgba(43, 45, 52, 0.0509803922)}#tabbyPromoWrapper #tabbyPromo *{font-family:var(--font-main)}#tabbyPromoWrapper #tabbyPromo>div>div{max-width:none;box-shadow:none;border:none}#tabbyPromoWrapper #tabbyPromo .tabby-promo-snippet{max-width:100%;min-height:100px;padding:18px 20px;border:none !important}#tabbyPromoWrapper #tabbyPromo .tabby-promo-snippet__text,#tabbyPromoWrapper #tabbyPromo .tabby-promo-snippet__link{font-size:var(--font-sm);color:var(--color-text) !important}#tabbyPromoWrapper #tabbyPromo .tabby-promo-snippet__link{font-weight:bold}.tabby-promo-wrapper #tabby-promo{font-family:var(--font-main) !important}.tabby-promo-wrapper #tabby-promo .tabby-promo__feature-title{font-size:var(--font-md)}.tabby-promo-wrapper #tabby-promo .tabby-promo__feature-desc{font-size:var(--font-sm);line-height:20px}.tamara-product-widget{margin-bottom:20px}.tamara-product-widget,.spotii-wrapper{min-height:100px;position:relative;color:var(--main-text-color);font-size:var(--font-sm);line-height:1.25;padding:20px 20px 20px 115px !important;background:white;border-radius:0.375rem;transition:box-shadow 0.5s cubic-bezier(0.4, 0, 0.2, 1);border:unset !important;font-family:inherit !important;font-weight:500}.salla-y .tamara-product-widget,.salla-y .spotii-wrapper{border-radius:12px;border:1px solid var(--color-grey-dark)}.tamara-product-widget:hover,.spotii-wrapper:hover{box-shadow:0 0 rgba(0, 0, 0, 0), 0 0 rgba(0, 0, 0, 0), 5px 10px 30px rgba(43, 45, 52, 0.0509803922)}.tamara-product-widget .spotii-logo,.spotii-wrapper .spotii-logo{float:left;margin:0 0 0 -75px}.ltr .tamara-product-widget,.ltr .spotii-wrapper{text-align:left;padding:18px 100px 18px 20px !important}.ltr .tamara-product-widget .spotii-logo,.ltr .spotii-wrapper .spotii-logo{float:right;margin:0 -75px 0 0}.ltr .tamara-product-widget .spotii-product-widget,.ltr .spotii-wrapper .spotii-product-widget{text-align:left !important}.spotii-wrapper{margin-bottom:20px}.spotii-wrapper .spotii-promo{font-size:var(--font-md)}.spotii-wrapper .spotii-product-widget{font-size:var(--font-sm) !important;margin-top:10px}.tamara-product-widget .tamara-logo{position:absolute;left:20px !important;top:35px !important;margin:0 !important;height:24px !important}.ltr .tamara-product-widget .tamara-logo{right:20px !important;left:auto !important}.tamara-product-widget span{font-family:var(--font-main);font-size:var(--font-sm);color:var(--color-text)}.tamara-product-widget span:last-child{display:block;position:relative;margin-top:8px}.tamara-popup__wrap{overflow:auto !important}.s-installment-mispay-wrapper,.s-installment-madfu-wrapper,.s-installment-emkan-wrapper,.s-installment-rajehi-wrapper{font-size:14px;text-align:right;padding:20px;gap:42px;line-height:22px;color:rgb(0, 0, 0);min-width:100%;box-sizing:border-box;position:relative;background-color:white;border-radius:10px;margin:15px 0;display:flex;transition:box-shadow 0.5s cubic-bezier(0.4, 0, 0.2, 1)}.s-installment-mispay-wrapper:hover,.s-installment-madfu-wrapper:hover,.s-installment-emkan-wrapper:hover,.s-installment-rajehi-wrapper:hover{box-shadow:0 0 rgba(0, 0, 0, 0), 0 0 rgba(0, 0, 0, 0), 5px 10px 30px rgba(43, 45, 52, 0.0509803922)}.s-installment-mispay-content,.s-installment-madfu-content,.s-installment-emkan-content,.s-installment-rajehi-content{display:flex;flex-direction:row-reverse;width:100%;justify-content:space-between;align-items:center;gap:1rem}.s-installment-mispay-content-text,.s-installment-madfu-content-text,.s-installment-emkan-content-text,.s-installment-rajehi-content-text{color:var(--main-text-color);font-size:14px;font-weight:500;margin:0 16px 0 0;width:80%;left:14px;text-align:left}.s-installment-mispay-content img,.s-installment-madfu-content img,.s-installment-emkan-content img,.s-installment-rajehi-content img{height:28px;width:70px;display:inline-block;max-height:100%;vertical-align:middle;fill:none;stroke:unset;width:auto}.rtl .s-installment-mispay-content-text,.rtl .s-installment-madfu-content-text,.rtl .s-installment-emkan-content-text,.rtl .s-installment-rajehi-content-text{right:14px;text-align:right;margin:0 0 0 16px}.rtl .s-installment-mispay-content img,.rtl .s-installment-madfu-content img,.rtl .s-installment-emkan-content img,.rtl .s-installment-rajehi-content img{left:14px !important}.ltr .s-installment-mispay-content img,.ltr .s-installment-madfu-content img,.ltr .s-installment-emkan-content img,.ltr .s-installment-rajehi-content img{right:14px !important}.s-installment-rajehi-content img{width:70px !important;height:40px !important}.s-installment-emkan-content img{height:35px !important}.s-installment-klarna-wrapper{background:white;border-radius:0.375rem;transition:box-shadow 0.5s cubic-bezier(0.4, 0, 0.2, 1);margin-bottom:20px;padding:10px}.salla-y .s-installment-klarna-wrapper{border:1px solid var(--color-grey-dark);border-radius:12px}.s-installment-klarna-wrapper:hover{box-shadow:0 0 rgba(0, 0, 0, 0), 0 0 rgba(0, 0, 0, 0), 5px 10px 30px rgba(43, 45, 52, 0.0509803922)}";export{e as salla_installment}
4
+ import{r as t,h as a,H as i,a as s}from"./p-DryPCgN9.js";const e=class{constructor(a){t(this,a),this.tabbyBorderRemoved=!1,this.tabbyRemoveBorderTries=0,this.language=salla.config.get("user.language_code"),this.currency=salla.config.get("user.currency_code"),this.country=salla.config.get("user.country_code"),this.installment_sheria_text=(t,a)=>salla.lang.get(t,a)}async componentWillLoad(){await salla.onReady(),await salla.lang.onLoaded(),this.currency=salla.config.get("user.currency_code")||"SAR",this.language=salla.config.get("user.language_code")||"ar",this.country=salla.config.get("user.country_code")||"SA",[{key:"pages.products.installments",installments:3},{key:"pages.products.installments_emkan",installments:5}].forEach((t=>{this.installment_sheria_text(t.key,{payment:salla.money(parseFloat(this.price)),amount:salla.money((parseFloat(this.price)/t.installments).toFixed(2)).replace(/\.00$/,""),installments:t.installments})}));const t=salla.config.get("store.settings.installments");t&&(this.tamaraIsActive=t.tamara,this.tabbyIsActive=t.tabby,this.spotiiIsActive=t.spotii,this.mispayActive=t.mispay,this.emkanIsActive=t.emkan,this.madfuActive=t.madfu,this.rajehiIsActive=t.mokafaa_alrajhi,this.klarnaIsActive=t.klarna),salla.event.on("product::price.updated",(({data:t})=>{t.price&&t.price!=this.price&&(this.price=t.price,this.renderInstallments(!0))}))}componentDidLoad(){this.renderInstallments()}render(){const t="SAR"===this.currency;return this.isValidPrice(this.price)?a(i,null,this.tamaraIsActive&&(this.tamaraIsActive?.publicKey?a("div",{class:"mb-5"},a("tamara-widget",{type:"tamara-summary","inline-type":"2",amount:this.price})):a("div",{class:"tamara-product-widget","data-price":this.price,"data-currency":this.currency,"data-lang":this.language,"data-payment-type":"installment"})),this.tabbyIsActive?a("div",{id:"tabbyPromoWrapper"},a("div",{id:"tabbyPromo"})):"",this.spotiiIsActive?a("div",{class:"spotii-wrapper"},a("div",{class:"spotii-promo"})):"",this.shouldShowMispay()&&(this.mispayActive.publicKey?a("div",{class:"mb-5"},a("mispay-widget",{amount:this.price,lang:this.language})):a("div",{class:"s-installment-mispay-wrapper"},a("div",{class:"s-installment-mispay-content"},a("img",{src:salla.url.cdn("images/payment/png/mispay.png"),alt:"mispay"}),a("span",{class:"s-installment-mispay-content-text",innerHTML:this.installment_sheria_text("pages.products.installments",{payment:salla.money(parseFloat(this.price)),amount:salla.money((parseFloat(this.price)/4).toFixed(2)),installments:4})})))),this.emkanIsActive&&"SAR"===this.currency?a("div",{class:"s-installment-emkan-wrapper"},a("div",{class:"s-installment-emkan-content"},a("img",{src:salla.url.cdn("images/payment/png/emkan.png"),alt:"emkan"}),a("span",{class:"s-installment-emkan-content-text",innerHTML:this.installment_sheria_text("pages.products.installments_emkan",{payment:salla.money(parseFloat(this.price)),installments:5})}))):"",this.madfuActive&&"SAR"===this.currency?a("div",{class:"s-installment-madfu-wrapper"},a("div",{class:"s-installment-madfu-content"},a("img",{src:salla.url.cdn("images/payment/png/madfu.png"),alt:"madfu"}),a("span",{class:"s-installment-madfu-content-text"},salla.lang.get("pages.products.installments_madfu")))):"",t&&this.rajehiIsActive?a("div",{class:"s-installment-rajehi-wrapper"},a("div",{class:"s-installment-rajehi-content"},a("img",{src:salla.url.cdn("images/payment/png/mokafaa_alrajhi_loyalty.png"),alt:"mokafaa_alrajhi_loyalty"}),a("span",{class:"s-installment-rajehi-content-text"},salla.lang.get("pages.products.rajahi_earn_points",{points:Math.floor(+this.price*this.rajehiIsActive.pointsPerRiyal)})))):"",this.klarnaIsActive&&this.klarnaIsActive.locales?.length>0&&a("div",{class:"s-installment-klarna-wrapper"},a("klarna-placement",{"data-key":this.klarnaIsActive.dataKey||"credit-promotion-badge","data-locale":this.getKlarnaLocale(),"data-purchase-amount":String(Math.round(100*parseFloat(this.price)))}))):""}renderInstallments(t=!1){if(this.isValidPrice(this.price)){if(this.tamaraIsActive&&this.loadTamara({isUpdating:t}),this.tabbyIsActive){if(t){var a=this.host.querySelector("#tabbyPromoWrapper");a&&a.remove();var i=document.createElement("div");i.setAttribute("id","tabbyPromoWrapper");var s=document.createElement("div");s.setAttribute("id","tabbyPromo"),i.appendChild(s),this.host.appendChild(i);var e=document.querySelector('script[src="https://checkout.tabby.ai/tabby-promo.js"]');e&&e.remove()}var r=document.createElement("script");r.setAttribute("src","https://checkout.tabby.ai/tabby-promo.js"),document.head.appendChild(r),r.onload=()=>{new(0,window.TabbyPromo)({selector:"#tabbyPromo",currency:this.currency,price:this.price,lang:this.language,publicKey:salla.config.get("store.settings.installments.tabby.publicKey"),merchantCode:salla.config.get("store.settings.installments.tabby.merchantCode")}),document.querySelectorAll(".tabby-promo-snippet__logo").forEach((function(t){t.setAttribute("aria-label","Tabby Logo")}))},this.removeTabbyBorder()}if(this.spotiiIsActive){if(t){var n=this.host.querySelector(".spotii-wrapper");n&&n.remove();var o=document.createElement("div");o.classList.add("spotii-wrapper");var l=document.createElement("div");l.classList.add("spotii-promo"),o.appendChild(l),this.host.appendChild(o);var p=document.querySelector('script[src="'+salla.url.cdn("js/price-widget-ar-salla.js")+'"]');p&&p.remove()}let a=salla.money((Number(this.price)/3).toFixed(2),!1),i=salla.config.get("theme.is_rtl",!0);window.spotiiConfig={targetXPath:[".spotii-wrapper"],renderToPath:[".spotii-promo"],numberOfPayment:3,currency:this.currency,templateLine:"${textOne} ${number} ${textTwo} "+a+"${logo} ${info}",textOne:i?"جزء الدفع على":"Split it into",textTwo:i?"أقساط متساوية بدون تكاليف اضافية بقيمة":"payments of",textThree:"مع",price:this.price};var m=document.createElement("script");m.setAttribute("src",salla.url.cdn("js/price-widget-ar-salla.js")),document.head.appendChild(m)}this.klarnaIsActive&&this.klarnaIsActive.locales?.length>0&&this.loadKlarna(t),this.shouldShowMispay()&&this.mispayActive.publicKey&&this.loadExternalScript({position:"head",src:`https://widget.mispay.co/v1/sdk.js?authorize=${this.mispayActive.publicKey}`})}}isValidPrice(t){const a=/^\d+(\.\d{1,3})?$/.test(t),i=parseFloat(t)>0;return a&&i}loadExternalScript({src:t,onLoad:a,position:i}){const s=document.createElement("script");s.src=t,s.onload=a,document[i].appendChild(s)}loadTamara({isUpdating:t}){const a=!!this.tamaraIsActive?.publicKey;if(t)setTimeout((()=>{if(a)return window.TamaraWidgetV2?.refresh();window.TamaraProductWidget?.render()}),300);else if(a){const t=salla.config.get("user.language_code"),a=["ar","en"].includes(t)?t:"ar",i=this.currency?.slice(0,-1),s=["SA","AE","KW","BH","OM","QA"].includes(i)?i:null;s?(window.tamaraWidgetConfig={lang:a,country:s,publicKey:this.tamaraIsActive.publicKey,style:{fontSize:"14px"}},this.loadExternalScript({position:"head",src:"https://cdn.tamara.co/widget-v2/tamara-widget.js"})):console.error("Tamara: Country code is not supported",i)}else this.loadExternalScript({position:"head",src:"https://cdn.tamara.co/widget/product-widget.min.js",onLoad:()=>{window.TamaraProductWidget.init({lang:this.language}),setTimeout((()=>{window.TamaraProductWidget.render()}),300)}})}loadKlarna(t){if(window.KlarnaOnsiteService=window.KlarnaOnsiteService||[],t){const t=this.host.querySelector("klarna-placement");t&&(t.setAttribute("data-purchase-amount",String(Math.round(100*parseFloat(this.price)))),window.KlarnaOnsiteService.push({eventName:"refresh-placements"}))}else if(document.querySelector('script[src="https://js.klarna.com/web-sdk/v1/klarna.js"]'))window.KlarnaOnsiteService.push({eventName:"refresh-placements"});else{var a=document.createElement("script");a.async=!0,a.setAttribute("src","https://js.klarna.com/web-sdk/v1/klarna.js"),a.setAttribute("data-client-id",this.klarnaIsActive.clientId),a.onload=()=>{window.KlarnaOnsiteService.push({eventName:"refresh-placements"})},document.body.appendChild(a)}}getKlarnaLocale(){const t=this.klarnaIsActive?.locales||[];if(!t.length)return null;const a=new Map(t?.map((t=>[t.split("-")[0],t])));return a.get(this.language)??a.get("en")??t[0]}shouldShowMispay(){return"SAR"===this.currency&&this.mispayActive}removeTabbyBorder(){this.tabbyBorderRemoved||this.tabbyRemoveBorderTries>5||(this.tabbyRemoveBorderTries++,setTimeout((()=>{let t=document.querySelector("#tabbyPromo>div>div");t=t&&t.shadowRoot?t.shadowRoot.querySelector('div[class^="styles__tabby-promo-snippet--"]'):null,t?(t.style="border: none; margin: 15px 0!important;",this.tabbyBorderRemoved=!0):this.removeTabbyBorder()}),500*this.tabbyRemoveBorderTries))}get host(){return s(this)}};e.style="salla-installment:empty{display:none}#tabbyPromoWrapper{background:white;border-radius:0.375rem;transition:box-shadow 0.5s cubic-bezier(0.4, 0, 0.2, 1);margin-bottom:20px;border:unset !important;font-weight:500}.salla-y #tabbyPromoWrapper{border:1px solid var(--color-grey-dark);border-radius:12px}#tabbyPromoWrapper:hover{box-shadow:0 0 rgba(0, 0, 0, 0), 0 0 rgba(0, 0, 0, 0), 5px 10px 30px rgba(43, 45, 52, 0.0509803922)}#tabbyPromoWrapper #tabbyPromo *{font-family:var(--font-main)}#tabbyPromoWrapper #tabbyPromo>div>div{max-width:none;box-shadow:none;border:none}#tabbyPromoWrapper #tabbyPromo .tabby-promo-snippet{max-width:100%;min-height:100px;padding:18px 20px;border:none !important}#tabbyPromoWrapper #tabbyPromo .tabby-promo-snippet__text,#tabbyPromoWrapper #tabbyPromo .tabby-promo-snippet__link{font-size:var(--font-sm);color:var(--color-text) !important}#tabbyPromoWrapper #tabbyPromo .tabby-promo-snippet__link{font-weight:bold}.tabby-promo-wrapper #tabby-promo{font-family:var(--font-main) !important}.tabby-promo-wrapper #tabby-promo .tabby-promo__feature-title{font-size:var(--font-md)}.tabby-promo-wrapper #tabby-promo .tabby-promo__feature-desc{font-size:var(--font-sm);line-height:20px}.tamara-product-widget{margin-bottom:20px}.tamara-product-widget,.spotii-wrapper{min-height:100px;position:relative;color:var(--main-text-color);font-size:var(--font-sm);line-height:1.25;padding:20px 20px 20px 115px !important;background:white;border-radius:0.375rem;transition:box-shadow 0.5s cubic-bezier(0.4, 0, 0.2, 1);border:unset !important;font-family:inherit !important;font-weight:500}.salla-y .tamara-product-widget,.salla-y .spotii-wrapper{border-radius:12px;border:1px solid var(--color-grey-dark)}.tamara-product-widget:hover,.spotii-wrapper:hover{box-shadow:0 0 rgba(0, 0, 0, 0), 0 0 rgba(0, 0, 0, 0), 5px 10px 30px rgba(43, 45, 52, 0.0509803922)}.tamara-product-widget .spotii-logo,.spotii-wrapper .spotii-logo{float:left;margin:0 0 0 -75px}.ltr .tamara-product-widget,.ltr .spotii-wrapper{text-align:left;padding:18px 100px 18px 20px !important}.ltr .tamara-product-widget .spotii-logo,.ltr .spotii-wrapper .spotii-logo{float:right;margin:0 -75px 0 0}.ltr .tamara-product-widget .spotii-product-widget,.ltr .spotii-wrapper .spotii-product-widget{text-align:left !important}.spotii-wrapper{margin-bottom:20px}.spotii-wrapper .spotii-promo{font-size:var(--font-md)}.spotii-wrapper .spotii-product-widget{font-size:var(--font-sm) !important;margin-top:10px}.tamara-product-widget .tamara-logo{position:absolute;left:20px !important;top:35px !important;margin:0 !important;height:24px !important}.ltr .tamara-product-widget .tamara-logo{right:20px !important;left:auto !important}.tamara-product-widget span{font-family:var(--font-main);font-size:var(--font-sm);color:var(--color-text)}.tamara-product-widget span:last-child{display:block;position:relative;margin-top:8px}.tamara-popup__wrap{overflow:auto !important}.s-installment-mispay-wrapper,.s-installment-madfu-wrapper,.s-installment-emkan-wrapper,.s-installment-rajehi-wrapper{font-size:14px;text-align:right;padding:20px;gap:42px;line-height:22px;color:rgb(0, 0, 0);min-width:100%;box-sizing:border-box;position:relative;background-color:white;border-radius:10px;margin:15px 0;display:flex;transition:box-shadow 0.5s cubic-bezier(0.4, 0, 0.2, 1)}.s-installment-mispay-wrapper:hover,.s-installment-madfu-wrapper:hover,.s-installment-emkan-wrapper:hover,.s-installment-rajehi-wrapper:hover{box-shadow:0 0 rgba(0, 0, 0, 0), 0 0 rgba(0, 0, 0, 0), 5px 10px 30px rgba(43, 45, 52, 0.0509803922)}.s-installment-mispay-content,.s-installment-madfu-content,.s-installment-emkan-content,.s-installment-rajehi-content{display:flex;flex-direction:row-reverse;width:100%;justify-content:space-between;align-items:center;gap:1rem}.s-installment-mispay-content-text,.s-installment-madfu-content-text,.s-installment-emkan-content-text,.s-installment-rajehi-content-text{color:var(--main-text-color);font-size:14px;font-weight:500;margin:0 16px 0 0;width:80%;left:14px;text-align:left}.s-installment-mispay-content img,.s-installment-madfu-content img,.s-installment-emkan-content img,.s-installment-rajehi-content img{height:28px;width:70px;display:inline-block;max-height:100%;vertical-align:middle;fill:none;stroke:unset;width:auto}.rtl .s-installment-mispay-content-text,.rtl .s-installment-madfu-content-text,.rtl .s-installment-emkan-content-text,.rtl .s-installment-rajehi-content-text{right:14px;text-align:right;margin:0 0 0 16px}.rtl .s-installment-mispay-content img,.rtl .s-installment-madfu-content img,.rtl .s-installment-emkan-content img,.rtl .s-installment-rajehi-content img{left:14px !important}.ltr .s-installment-mispay-content img,.ltr .s-installment-madfu-content img,.ltr .s-installment-emkan-content img,.ltr .s-installment-rajehi-content img{right:14px !important}.s-installment-rajehi-content img{width:70px !important;height:40px !important}.s-installment-emkan-content img{height:35px !important}.s-installment-klarna-wrapper{background:white;border-radius:0.375rem;transition:box-shadow 0.5s cubic-bezier(0.4, 0, 0.2, 1);margin-bottom:20px;padding:10px}.salla-y .s-installment-klarna-wrapper{border:1px solid var(--color-grey-dark);border-radius:12px}.s-installment-klarna-wrapper:hover{box-shadow:0 0 rgba(0, 0, 0, 0), 0 0 rgba(0, 0, 0, 0), 5px 10px 30px rgba(43, 45, 52, 0.0509803922)}";export{e as salla_installment}
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r as e,h as a,a as s}from"./p-DNtvpIPH.js";const l=class{constructor(a){e(this,a),this.hasError=!1,salla.event.on("size-guide::open",(e=>this.open(e))),salla.lang.onLoaded((()=>{this.placeholder_title=salla.lang.get("pages.products.size_guide_placeholder"),this.placeholder_description=salla.lang.get("pages.products.size_guide_placeholder_info"),this.modal_title=salla.lang.get("pages.products.size_guides")}))}async open(e){return this.modal.setTitle(this.modal_title),this.modal.open(),await salla.api.withoutNotifier((()=>salla.product.getSizeGuides(e))).then((e=>{this.guides=e.data})).catch((e=>{console.log(e),this.hasError=!0,this.placeholder_description=e.response?.data?.error?.message||e.response?.data})).finally((()=>this.modal.stopLoading()))}async close(){return this.modal.close()}showPlaceholder(){return a("salla-placeholder",{alignment:"center",iconSize:"xl"},a("div",{slot:"title"},this.placeholder_title),a("div",{slot:"description"},this.placeholder_description))}render(){return a("salla-modal",{key:"ad8cbc23e60bc0d463f5b94febeab699dd96e2b4",class:"s-product-size-guide-wrapper",id:"salla-product-size-guide-modal",isLoading:!0,"has-skeleton":!0,width:"md",ref:e=>this.modal=e},a("span",{key:"b3dc61221d36a2680f74280e5fdb7601e5e70e62",slot:"icon",class:"s-product-size-guide-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>pencil-ruler</title>\n<path d="M3.057 11.609c0.26 0.26 0.601 0.391 0.943 0.391s0.683-0.131 0.943-0.391l6.667-6.667c0.521-0.521 0.521-1.364 0-1.885l-1.285-1.285c-1.143-1.143-2.661-1.772-4.276-1.772-1.616 0-3.135 0.629-4.276 1.772-1.143 1.141-1.772 2.66-1.772 4.276 0 1.615 0.629 3.135 1.772 4.276zM3.657 3.657c1.277-1.277 3.504-1.277 4.781 0l0.343 0.343-4.781 4.781-0.343-0.343c-0.639-0.639-0.991-1.488-0.991-2.391s0.352-1.752 0.991-2.391zM29.317 20.972c-0.2-0.707-0.932-1.119-1.645-0.921-0.709 0.2-1.121 0.937-0.921 1.645l1.987 7.041-7.041-1.987c-0.707-0.195-1.444 0.213-1.645 0.921-0.2 0.708 0.212 1.445 0.921 1.645l9.333 2.633c0.119 0.032 0.24 0.049 0.361 0.049 0.349 0 0.689-0.137 0.943-0.391 0.341-0.341 0.472-0.84 0.34-1.305zM31.609 8.772l-8.381-8.381c-0.5-0.5-1.385-0.5-1.885 0l-8.171 8.171s-0.001 0-0.001 0.001 0 0.001-0.001 0.001l-4.607 4.607s0 0-0.001 0 0 0 0 0.001l-8.171 8.171c-0.251 0.249-0.391 0.588-0.391 0.943 0 0.353 0.14 0.693 0.391 0.943l8.381 8.381c0.249 0.251 0.589 0.391 0.943 0.391s0.693-0.14 0.943-0.391l20.952-20.952c0.521-0.521 0.521-1.365 0-1.885zM9.715 28.781l-6.495-6.496 1.676-1.676 1.851 1.851c0.26 0.26 0.601 0.391 0.943 0.391s0.683-0.131 0.943-0.391c0.521-0.521 0.521-1.364 0-1.885l-1.851-1.851 2.724-2.724 3.008 3.008c0.26 0.26 0.601 0.391 0.943 0.391s0.683-0.131 0.943-0.391c0.521-0.521 0.521-1.364 0-1.885l-3.008-3.008 2.724-2.724 1.851 1.851c0.26 0.26 0.601 0.391 0.943 0.391s0.683-0.131 0.943-0.391c0.521-0.52 0.521-1.364 0-1.885l-1.851-1.851 2.724-2.724 3.008 3.008c0.26 0.26 0.601 0.391 0.943 0.391s0.683-0.131 0.943-0.391c0.521-0.521 0.521-1.365 0-1.885l-3.008-3.008 1.677-1.677 6.496 6.496z"></path>\n</svg>\n'}),a("div",{key:"9735c6681e3e7c15c5d346f6cfca4c7d34542061",slot:"loading"},a("div",{key:"65224399d086d931c5c978dd00cf2d4d1ec3c082",class:"s-product-size-guide-skeleton"},a("salla-skeleton",{key:"05c0eda8bc21f5a2e2a89424bed145e61cd5a29e",height:"15px",width:"25%"}),a("div",{key:"af0e4801d3e27f664b38577c61ae3fc15e4c5c95",class:"s-product-size-guide-skeleton-header"},a("salla-skeleton",{key:"614ad02c61d7c44ec768a060cf7a25f04b618056",height:"40px"}),a("salla-skeleton",{key:"a4da4e2fa6ded411938fd90c4e11d368baadf03e",height:"40px"}),a("salla-skeleton",{key:"fb2fc13e520d704ad02d9c90f3678d7ec18e89f9",height:"40px"}),a("salla-skeleton",{key:"8b4723988f62458876f4b915f11df73bbf7717a8",height:"40px"})),a("div",{key:"9ae65ff980ee9458d1c2996465dcd7815bae0c1f",class:"s-product-size-guide-skeleton-content"},a("salla-skeleton",{key:"9d970f8d2d116845a902f7bcab944b48c781024f",height:"15px",width:"25%"}),a("salla-skeleton",{key:"a8150338ad24a94552796f948b4dddfd280179aa",height:"10px",width:"75%"}),a("salla-skeleton",{key:"34446a9a1948c7c006f6e13b26cacd7e20d16238",height:"10px",width:"50%"}),a("salla-skeleton",{key:"8838c419ac7f384861188d7ab96e8f42473c04c0",height:"10px",width:"75%"}),a("salla-skeleton",{key:"21f8e182ba77e35b0f02f1cbcd21ee8effd94ac0",height:"10px",width:"100%"}),a("salla-skeleton",{key:"5391e8a3a133dd2ccf7087590113391da080ca8a",height:"10px",width:"25%"}),a("salla-skeleton",{key:"743ba490362dd541229cb5c60feb0b6dc5750714",height:"10px",width:"60%"}),a("salla-skeleton",{key:"58e6839c74e13e11f4ef84fa4ec85e1f2f9868f4",height:"10px",width:"45%"}),a("salla-skeleton",{key:"a6f771e12046112b282dede2d759ed3d019bedcc",height:"10px",width:"30%"})))),a("slot",{key:"3ed1875a19be5a65afbf912fb0819dd92ded3062",name:"header"}),!this.hasError&&this.guides?[a("salla-tabs",null,this.guides.map((e=>a("salla-tab-header",{slot:"header",name:e.name},a("span",null,e.name)))),this.guides.map((e=>a("salla-tab-content",{slot:"content",name:e.name},a("div",{innerHTML:e.description})))))]:this.showPlaceholder(),a("slot",{key:"ca9526f3f95675dab2a38d2715ed3cf842d93174",name:"footer"}))}get host(){return s(this)}};l.style="";export{l as salla_product_size_guide}
4
+ import{r as e,h as a,a as s}from"./p-DryPCgN9.js";const l=class{constructor(a){e(this,a),this.hasError=!1,salla.event.on("size-guide::open",(e=>this.open(e))),salla.lang.onLoaded((()=>{this.placeholder_title=salla.lang.get("pages.products.size_guide_placeholder"),this.placeholder_description=salla.lang.get("pages.products.size_guide_placeholder_info"),this.modal_title=salla.lang.get("pages.products.size_guides")}))}async open(e){return this.modal.setTitle(this.modal_title),this.modal.open(),await salla.api.withoutNotifier((()=>salla.product.getSizeGuides(e))).then((e=>{this.guides=e.data})).catch((e=>{console.log(e),this.hasError=!0,this.placeholder_description=e.response?.data?.error?.message||e.response?.data})).finally((()=>this.modal.stopLoading()))}async close(){return this.modal.close()}showPlaceholder(){return a("salla-placeholder",{alignment:"center",iconSize:"xl"},a("div",{slot:"title"},this.placeholder_title),a("div",{slot:"description"},this.placeholder_description))}render(){return a("salla-modal",{key:"ad8cbc23e60bc0d463f5b94febeab699dd96e2b4",class:"s-product-size-guide-wrapper",id:"salla-product-size-guide-modal",isLoading:!0,"has-skeleton":!0,width:"md",ref:e=>this.modal=e},a("span",{key:"b3dc61221d36a2680f74280e5fdb7601e5e70e62",slot:"icon",class:"s-product-size-guide-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>pencil-ruler</title>\n<path d="M3.057 11.609c0.26 0.26 0.601 0.391 0.943 0.391s0.683-0.131 0.943-0.391l6.667-6.667c0.521-0.521 0.521-1.364 0-1.885l-1.285-1.285c-1.143-1.143-2.661-1.772-4.276-1.772-1.616 0-3.135 0.629-4.276 1.772-1.143 1.141-1.772 2.66-1.772 4.276 0 1.615 0.629 3.135 1.772 4.276zM3.657 3.657c1.277-1.277 3.504-1.277 4.781 0l0.343 0.343-4.781 4.781-0.343-0.343c-0.639-0.639-0.991-1.488-0.991-2.391s0.352-1.752 0.991-2.391zM29.317 20.972c-0.2-0.707-0.932-1.119-1.645-0.921-0.709 0.2-1.121 0.937-0.921 1.645l1.987 7.041-7.041-1.987c-0.707-0.195-1.444 0.213-1.645 0.921-0.2 0.708 0.212 1.445 0.921 1.645l9.333 2.633c0.119 0.032 0.24 0.049 0.361 0.049 0.349 0 0.689-0.137 0.943-0.391 0.341-0.341 0.472-0.84 0.34-1.305zM31.609 8.772l-8.381-8.381c-0.5-0.5-1.385-0.5-1.885 0l-8.171 8.171s-0.001 0-0.001 0.001 0 0.001-0.001 0.001l-4.607 4.607s0 0-0.001 0 0 0 0 0.001l-8.171 8.171c-0.251 0.249-0.391 0.588-0.391 0.943 0 0.353 0.14 0.693 0.391 0.943l8.381 8.381c0.249 0.251 0.589 0.391 0.943 0.391s0.693-0.14 0.943-0.391l20.952-20.952c0.521-0.521 0.521-1.365 0-1.885zM9.715 28.781l-6.495-6.496 1.676-1.676 1.851 1.851c0.26 0.26 0.601 0.391 0.943 0.391s0.683-0.131 0.943-0.391c0.521-0.521 0.521-1.364 0-1.885l-1.851-1.851 2.724-2.724 3.008 3.008c0.26 0.26 0.601 0.391 0.943 0.391s0.683-0.131 0.943-0.391c0.521-0.521 0.521-1.364 0-1.885l-3.008-3.008 2.724-2.724 1.851 1.851c0.26 0.26 0.601 0.391 0.943 0.391s0.683-0.131 0.943-0.391c0.521-0.52 0.521-1.364 0-1.885l-1.851-1.851 2.724-2.724 3.008 3.008c0.26 0.26 0.601 0.391 0.943 0.391s0.683-0.131 0.943-0.391c0.521-0.521 0.521-1.365 0-1.885l-3.008-3.008 1.677-1.677 6.496 6.496z"></path>\n</svg>\n'}),a("div",{key:"9735c6681e3e7c15c5d346f6cfca4c7d34542061",slot:"loading"},a("div",{key:"65224399d086d931c5c978dd00cf2d4d1ec3c082",class:"s-product-size-guide-skeleton"},a("salla-skeleton",{key:"05c0eda8bc21f5a2e2a89424bed145e61cd5a29e",height:"15px",width:"25%"}),a("div",{key:"af0e4801d3e27f664b38577c61ae3fc15e4c5c95",class:"s-product-size-guide-skeleton-header"},a("salla-skeleton",{key:"614ad02c61d7c44ec768a060cf7a25f04b618056",height:"40px"}),a("salla-skeleton",{key:"a4da4e2fa6ded411938fd90c4e11d368baadf03e",height:"40px"}),a("salla-skeleton",{key:"fb2fc13e520d704ad02d9c90f3678d7ec18e89f9",height:"40px"}),a("salla-skeleton",{key:"8b4723988f62458876f4b915f11df73bbf7717a8",height:"40px"})),a("div",{key:"9ae65ff980ee9458d1c2996465dcd7815bae0c1f",class:"s-product-size-guide-skeleton-content"},a("salla-skeleton",{key:"9d970f8d2d116845a902f7bcab944b48c781024f",height:"15px",width:"25%"}),a("salla-skeleton",{key:"a8150338ad24a94552796f948b4dddfd280179aa",height:"10px",width:"75%"}),a("salla-skeleton",{key:"34446a9a1948c7c006f6e13b26cacd7e20d16238",height:"10px",width:"50%"}),a("salla-skeleton",{key:"8838c419ac7f384861188d7ab96e8f42473c04c0",height:"10px",width:"75%"}),a("salla-skeleton",{key:"21f8e182ba77e35b0f02f1cbcd21ee8effd94ac0",height:"10px",width:"100%"}),a("salla-skeleton",{key:"5391e8a3a133dd2ccf7087590113391da080ca8a",height:"10px",width:"25%"}),a("salla-skeleton",{key:"743ba490362dd541229cb5c60feb0b6dc5750714",height:"10px",width:"60%"}),a("salla-skeleton",{key:"58e6839c74e13e11f4ef84fa4ec85e1f2f9868f4",height:"10px",width:"45%"}),a("salla-skeleton",{key:"a6f771e12046112b282dede2d759ed3d019bedcc",height:"10px",width:"30%"})))),a("slot",{key:"3ed1875a19be5a65afbf912fb0819dd92ded3062",name:"header"}),!this.hasError&&this.guides?[a("salla-tabs",null,this.guides.map((e=>a("salla-tab-header",{slot:"header",name:e.name},a("span",null,e.name)))),this.guides.map((e=>a("salla-tab-content",{slot:"content",name:e.name},a("div",{innerHTML:e.description})))))]:this.showPlaceholder(),a("slot",{key:"ca9526f3f95675dab2a38d2715ed3cf842d93174",name:"footer"}))}get host(){return s(this)}};l.style="";export{l as salla_product_size_guide}
@@ -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}from"./p-DNtvpIPH.js";import{g as e,a,c as r,u as d,r as o,m as l,b as n,f as h,d as c,e as u,h as m,i as p}from"./p-C8xwacGT.js";import"./p-CoQJOPRz.js";const f=class{constructor(t){s(this,t),this.loading=!0,this.saveLoading=!1,this.payload={items:{update:[],remove:[],add:[]}},this.expired=!1,this.editPreview=null,this.productSearchQuery="",this.productsListKey=0,this.productsListSource="latest",this.productsListSourceValue="",this.selectedProductToAdd=null,this.addProductQuantity=1,this.addProductLoading=!1,this.addProductConfirmLoading=!1,this.mobileProductsModalMounted=!1,this.isMobileViewport=!1,this.isRTL=!0,this.mobileProductsListLoading=!1,this.confirming=!1,this.handleMobileProductSelected=s=>{s.stopPropagation(),this.handleProductSelected(s)},this.productsPanelMobileQuery="(max-width: 768px)",this.handleProductsPanelViewportChange=s=>{this.isMobileViewport=s.matches},this.hasProductTypeFilter=s=>{const t=s.indexOf("?"),i=(t>=0?s.slice(t+1):s).split("#")[0];return Array.from(new URLSearchParams(i)).some((([s,t])=>"product"===t&&/^filters\[types\](?:\[(?:\d*)\])?$/.test(s)))},this.hasExcludedCategoriesFilter=s=>{const t=s.indexOf("?"),i=(t>=0?s.slice(t+1):s).split("#")[0];return Array.from(new URLSearchParams(i)).some((([s])=>/^filters(?:\[|%5B)excluded_categories(?:\]|%5D)(?:\[|%5B)(?:\d*)(?:\]|%5D)$/.test(s)))},this.normalizeProductsListArrayParams=s=>s.replace(/(^|[?&])(includes|source_value|filters(?:\[|%5B)[^&=\]%]+?(?:\]|%5D))(\[|%5B)\d+(\]|%5D)(?==)/gi,((s,t,i,e,a)=>`${t}${i}${e}${a}`)),this.handleBeforeBuildListUrl=s=>{if("salla-order-edit-product-card"!==s.component?.productCardComponent||"string"!=typeof s.url)return;s.url=this.normalizeProductsListArrayParams(s.url),this.hasProductTypeFilter(s.url)||(s.url+=(s.url.includes("?")?"&":"?")+"filters[types][]=product");const t=this.getParsedExcludedCategories();if(t.length>0&&!this.hasExcludedCategoriesFilter(s.url)){const i=t.map((s=>`filters[excluded_categories][]=${encodeURIComponent(s)}`)).join("&");s.url+=`${s.url.includes("?")?"&":"?"}${i}`}},this.defaultProductsListSource="latest",this.debouncedProductSearch=salla.helpers.debounce((s=>this.applyProductSearch(s)),500),salla.onReady((()=>{this.isRTL=salla.config.get("theme.is_rtl",!0)}))}getParsedExcludedCategories(){if(!this.excludedCategories)return[];try{const s="string"==typeof this.excludedCategories?JSON.parse(this.excludedCategories):this.excludedCategories;return Array.isArray(s)?s.filter((s=>Number.isInteger(s)&&s>0)):[]}catch{return[]}}async componentWillLoad(){this.setupProductsPanelViewportQuery(),await salla.onReady(),this.unregisterBeforeBuildListUrlHook=salla.hooks.registerHook("salla-products-list","beforeBuildListUrl",this.handleBeforeBuildListUrl),this.loadFromProp(),this.startExpiryCheck()}disconnectedCallback(){clearInterval(this.expiryInterval),this.unregisterBeforeBuildListUrlHook?.(),this.productsPanelViewportQuery?.removeEventListener("change",this.handleProductsPanelViewportChange),this.mobileProductsModal?.removeEventListener("orderEditProductSelected",this.handleMobileProductSelected)}setupProductsPanelViewportQuery(){"undefined"!=typeof window&&"function"==typeof window.matchMedia&&(this.productsPanelViewportQuery=window.matchMedia(this.productsPanelMobileQuery),this.isMobileViewport=this.productsPanelViewportQuery.matches,this.productsPanelViewportQuery.addEventListener("change",this.handleProductsPanelViewportChange))}startExpiryCheck(){const s=this.order?.customer_editing_session?.ends_at;if(!s)return;const t=()=>new Date(`${s.replace(" ","T")}+03:00`).getTime()<=Date.now();t()?this.expired=!0:this.expiryInterval=setInterval((()=>{t()&&(this.expired=!0,clearInterval(this.expiryInterval))}),1e3)}loadFromProp(){try{if(!this.orderData)return void(this.error=salla.lang.getWithDefault("pages.orders.order_not_found","الطلب غير موجود"));const s="string"==typeof this.orderData?JSON.parse(this.orderData):this.orderData;this.order={...s,items:s.items.map((s=>({...s,selectedOptions:e(s)})))}}catch(s){this.error=salla.lang.getWithDefault("pages.orders.order_not_found","الطلب غير موجود")}finally{this.loading=!1}}applyProductSearch(s){const t=s?.trim()||"",i=t?"search":this.defaultProductsListSource,e="search"===i?JSON.stringify(t):"";this.productsListSource===i&&this.productsListSourceValue===e||(this.productsListSource=i,this.productsListSourceValue=e,this.productsListKey+=1)}handleProductSearch(s){const t=s.target?.value||"";this.productSearchQuery=t,this.debouncedProductSearch(t)}getProductsListKey(s){return`${s}-${this.productsListSource}-${this.productsListSourceValue}-${this.productsListKey}`}handleMobileProductsScroll(s){const t=s.currentTarget;if(t.scrollHeight-t.scrollTop-t.clientHeight>200||this.mobileProductsListLoading)return;const i=t.querySelector("salla-products-list");i&&(this.mobileProductsListLoading=!0,i.loadMore().finally((()=>{this.mobileProductsListLoading=!1})))}waitForNextFrame(){return new Promise((s=>requestAnimationFrame((()=>s(void 0)))))}async openMobileProductsModal(){this.mobileProductsModalMounted||(this.mobileProductsModalMounted=!0,await this.waitForNextFrame()),await(this.mobileProductsModal?.open?.())}setMobileProductsModal(s){this.mobileProductsModal!==s&&(this.mobileProductsModal?.removeEventListener("orderEditProductSelected",this.handleMobileProductSelected),this.mobileProductsModal=s,this.mobileProductsModal?.addEventListener("orderEditProductSelected",this.handleMobileProductSelected))}resetAddProductDrawer(){this.selectedProductToAdd=null,this.addProductQuantity=1,this.addProductLoading=!1,this.addProductConfirmLoading=!1,this.addProductOptions=null}getAddProductMaxQuantity(s=this.selectedProductToAdd){return a(s)}clampAddProductQuantity(s,t=this.selectedProductToAdd){return r(s,this.getAddProductMaxQuantity(t))}getApiErrorMessage(s){return s?.response?.data?.error?.message||s?.response?.data?.message}notifyApiError(s){const t=this.getApiErrorMessage(s);t&&salla.notify.error(t)}async validateAddProductOptions(){return!this.selectedProductToAdd?.options?.length||!!this.addProductOptions&&(await(this.addProductOptions.validateAndScroll?.())??await(this.addProductOptions.reportValidity?.())??!1)}updateLocalOrderItem(s,t,i,e){this.order={...this.order,items:d(this.order.items,s,t,i,e)}}removeLocalOrderItem(s){this.order={...this.order,items:o(this.order.items,s)}}setPayloadItems(s){this.payload={...this.payload,items:l(this.payload.items,s)}}handleAddProductQuantityChange(s){const t=s.detail,i=t?.quantity??parseInt(s.target?.value,10);isNaN(i)||i<1||(this.addProductQuantity=this.clampAddProductQuantity(i))}async handleProductSelected(s){const t=s.detail?.product;if(t?.id&&!this.addProductLoading){this.addProductLoading=!0;try{this.selectedProductToAdd=n(t),this.addProductQuantity=1,await(this.mobileProductsModal?.close?.()),await this.waitForNextFrame(),await(this.addProductDrawer?.open?.())}catch(s){this.notifyApiError(s)}finally{this.addProductLoading=!1}}}async confirmAddProduct(){if(this.selectedProductToAdd?.id&&!this.addProductConfirmLoading){this.addProductConfirmLoading=!0;try{const s=this.getAddProductMaxQuantity(),t=this.clampAddProductQuantity(this.addProductQuantity);t!==this.addProductQuantity&&(this.addProductQuantity=t);const i=this.addProductOptions;if(!await this.validateAddProductOptions())return void salla.notify.error(salla.lang.getWithDefault("common.messages.required_fields","يرجى تعبئة الحقول المطلوبة"));const e=await(i?.getSelectedOptionsData?.())||{},a=await(i?.getOptionsData?.())||this.selectedProductToAdd.options||[],d=h(this.order?.items,this.selectedProductToAdd.id,e);if(d){const i=r(d.quantity+t,s);return this.updateLocalOrderItem(d.id,i,a,e),this.setPayloadItems(d.isNew?{add:c(this.payload.items.add,d.id,i,e)}:{update:u(this.payload.items.update,d.id,i,e)}),void await(this.addProductDrawer?.close?.())}const o=m(this.selectedProductToAdd,t,a,e),l={itemId:o.id,product_id:this.selectedProductToAdd.id,quantity:t,options:e};this.order={...this.order,items:[...this.order.items,o]},this.setPayloadItems({add:[...this.payload.items.add,l]}),await(this.addProductDrawer?.close?.())}catch(s){this.notifyApiError(s)}finally{this.addProductConfirmLoading=!1}}}handleItemUpdated(s){if(!this.order)return;const{itemId:t,quantity:i,options:e,optionDefinitions:d}=s.detail,o=this.order.items.find((s=>s.id===t));if(!o)return;const l=r(i,a(o.product));if(o.isNew)return this.setPayloadItems({add:c(this.payload.items.add,t,l,e)}),void this.updateLocalOrderItem(t,l,d,e);this.setPayloadItems({update:u(this.payload.items.update,t,l,e??{})}),this.updateLocalOrderItem(t,l,d,e)}handleItemRemoved(s){if(!this.order)return;if(this.order.items.length<=1)return void salla.notify.error(salla.lang.getWithDefault("pages.orders.order_cannot_be_empty","لا يمكن إزالة جميع المنتجات من الطلب"));const{itemId:t}=s.detail,i=this.order.items.find((s=>s.id===t));if(i){if(i.isNew)return this.setPayloadItems({add:this.payload.items.add.filter((s=>s.itemId!==t))}),void this.removeLocalOrderItem(t);this.setPayloadItems({update:this.payload.items.update.filter((s=>s.id!==t)),remove:[...this.payload.items.remove,t]}),this.removeLocalOrderItem(t)}}get hasChanges(){return this.payload.items.update.length>0||this.payload.items.remove.length>0||this.payload.items.add.length>0}async saveOrder(){if(this.hasChanges){this.saveLoading=!0;try{const s=await salla.order.api.editOrder(this.orderId,p(this.payload));this.editPreview=s?.data?.data||s?.data,await(this.saveModal?.open?.())}catch(s){this.notifyApiError(s)}finally{this.saveLoading=!1}}}navigateToOrder(){const s=new URL(window.location.href);s.pathname=s.pathname.replace(/\/edit\/?$/,""),s.search="",window.location.href=s.href}handleConfirm(){this.confirming=!0,this.editPreview?.payment?.required&&this.editPreview.payment.payment_url?window.location.href=this.editPreview.payment.payment_url:this.navigateToOrder()}returnToOrderDetails(){this.confirming=!0,this.navigateToOrder()}getConfirmButtonIconClass(){return this.isRTL?"sicon-keyboard_arrow_left":"sicon-keyboard_arrow_right"}async cancelEditSession(){try{await salla.order.api.cancelEditSession(this.orderId),this.navigateToOrder()}catch(s){this.notifyApiError(s)}}renderProductsPanel(){const s=salla.lang.getWithDefault("pages.orders.add_product_to_order","أضف منتج للطلب");return t("section",{class:"s-order-edit-products-panel"},t("div",{class:"s-order-edit-products-header"},t("h2",{class:"s-order-edit-products-title"},s)),this.renderProductsPickerContent("panel"))}renderProductsPickerContent(s){return t("div",{class:{"s-order-edit-products-picker":!0,"s-order-edit-products-modal-content":"modal"===s}},t("label",{class:"s-order-edit-products-search"},t("i",{class:"sicon-search"}),t("input",{type:"search",class:"s-order-edit-products-search-input",placeholder:salla.lang.getWithDefault("pages.products.search_for_product","ابحث عن منتج"),value:this.productSearchQuery,onInput:s=>this.handleProductSearch(s)})),t("div",{class:"s-order-edit-products-list",onScroll:"modal"===s?s=>this.handleMobileProductsScroll(s):void 0},t("salla-products-list",{key:this.getProductsListKey(s),includes:["options"],source:this.productsListSource,"source-value":this.productsListSourceValue,autoload:!0,"product-card-component":"salla-order-edit-product-card"})))}renderMobileProductsModal(){return t("salla-modal",{ref:s=>this.setMobileProductsModal(s),width:"md",class:"s-order-edit-mobile-products-modal","modal-title":salla.lang.getWithDefault("pages.orders.add_product_to_order","أضف منتج للطلب"),onModalVisibilityChanged:s=>{s.detail||(this.mobileProductsModalMounted=!1)}},this.mobileProductsModalMounted?this.renderProductsPickerContent("modal"):null)}renderAddProductDrawer(){const s=this.selectedProductToAdd,i=s?.name||salla.lang.getWithDefault("common.elements.product","منتج"),e=s?.price,a=this.getAddProductMaxQuantity(s),r=s?`order-edit-add-${s.id}`:"order-edit-add",d={value:this.clampAddProductQuantity(this.addProductQuantity,s)};return a&&(d.max=a),t("salla-modal",{ref:s=>this.addProductDrawer=s,width:"md","modal-title":salla.lang.getWithDefault("pages.orders.add_product_to_order","أضف منتج للطلب"),onModalVisibilityChanged:s=>{s.detail||this.resetAddProductDrawer()}},t("div",{class:"s-order-edit-add-modal"},this.addProductLoading?t("div",{class:"s-order-edit-add-modal-loading"},t("salla-loading",null)):s?t("div",{class:"s-order-edit-add-modal-content"},t("div",{class:"s-order-edit-add-modal-header"},t("div",{class:"s-order-edit-add-modal-media"},s.image?.url&&t("img",{src:s.image.url,alt:s.image.alt||i,class:"s-order-edit-add-modal-image"}),t("div",{class:"s-order-edit-add-modal-details"},t("h3",{class:"s-order-edit-add-modal-name"},i),null!=e&&t("span",{class:"s-order-edit-add-modal-price",innerHTML:salla.money(e)})))),t("div",{class:"s-order-edit-add-modal-quantity"},t("h3",{class:"s-order-edit-add-modal-section-title"},salla.lang.getWithDefault("common.elements.quantity","الكمية")),t("div",{class:"s-order-edit-add-modal-quantity-input"},t("salla-quantity-input",{...d,onChange:s=>this.handleAddProductQuantityChange(s)}))),s.options?.length>0&&t("form",{onSubmit:s=>s.preventDefault()},t("salla-product-options",{ref:s=>this.addProductOptions=s,"product-id":s.id,"unique-key":r,options:JSON.stringify(s.options),key:`${r}-options`})),t("div",{class:"s-order-edit-add-modal-actions"},t("salla-button",{onClick:()=>this.confirmAddProduct(),loading:this.addProductConfirmLoading},salla.lang.getWithDefault("common.elements.confirm","تأكيد")),t("salla-button",{color:"gray",fill:"outline",onClick:()=>this.addProductDrawer?.close?.()},salla.lang.getWithDefault("common.elements.cancel","الغاء")))):null))}renderSaveModal(){const s=this.editPreview,i=s?.totals?.remaining_amount?.amount>0,e=s?.totals?.refund_amount?.amount>0,a=s?.totals?.tax?.amount?.amount;return t("salla-modal",{ref:s=>this.saveModal=s,width:"md",isClosable:!1,onModalVisibilityChanged:async s=>{s.detail||(this.editPreview=null,this.confirming||await this.cancelEditSession(),this.confirming=!1)}},t("div",{class:"s-order-edit-modal"},t("h2",{class:"s-order-edit-modal-title"},salla.lang.getWithDefault("pages.orders.edit_summary_title","ملخص الطلب بعد التعديل")),t("p",{class:"s-order-edit-modal-subtitle"},salla.lang.getWithDefault("pages.orders.cart_edits_saved","Your cart edits have been saved")),s?.items?.length>0&&t("div",{class:"s-order-edit-modal-items"},s.items.map((s=>{const i=this.order?.items?.find((t=>t.id==s.id)),e=i?.product?.image?.url,a=s.options?.join("/ ");return t("div",{class:"s-order-edit-modal-item"},t("div",{class:"s-order-edit-modal-item-start"},e&&t("img",{src:e,alt:s.name,class:"s-order-edit-modal-item-image"}),t("div",null,t("p",{class:"s-order-edit-modal-item-name"},s.name),a&&t("span",{class:"s-order-edit-modal-item-options"},a))),t("div",{class:"s-order-edit-modal-item-end"},t("span",{class:"s-order-edit-modal-item-quantity",dir:"ltr",innerHTML:s.quantity+" x "+s.price.amount}),t("span",{class:"s-order-edit-modal-item-price",innerHTML:salla.money(s.price.amount*s.quantity)})))}))),s?.totals?.updated_products_total&&t("div",{class:"s-order-edit-modal-row"},t("span",{class:"s-order-edit-modal-row-label"},salla.lang.getWithDefault("pages.orders.modified_products_total","مجموع المنتجات المعدلة")),t("span",{class:"s-order-edit-modal-row-value",innerHTML:salla.money(s.totals.updated_products_total.amount)})),a>0&&t("div",{class:"s-order-edit-modal-row"},t("span",{class:"s-order-edit-modal-tax-label"},t("i",{class:"sicon-info-circle s-order-edit-modal-tax-icon"}),salla.lang.getWithDefault("pages.orders.vat","ضريبة القيمة المضافة")),t("span",{class:"s-order-edit-modal-row-value",innerHTML:salla.money(a)})),s?.totals?.total&&t("div",{class:"s-order-edit-modal-total"},t("span",{class:"s-order-edit-modal-total-label"},salla.lang.getWithDefault("pages.orders.order_total","اجمالي الطلب")),t("span",{class:"s-order-edit-modal-total-value",innerHTML:salla.money(s.totals.total.amount)})),e&&t("div",{class:"s-order-edit-modal-refund"},t("i",{class:"sicon-info-circle s-order-edit-modal-refund-icon"}),t("p",{class:"s-order-edit-modal-refund-text"},salla.lang.getWithDefault("pages.orders.refund_message","سيتم تحويل فارق المبلغ على نفس وسيلة الدفع"))),t("div",{class:"s-order-edit-modal-btn-wrapper"},t("salla-button",{onClick:()=>this.handleConfirm()},i?salla.lang.getWithDefault("pages.orders.pay_difference","دفع فارق المبلغ"):e?salla.lang.getWithDefault("pages.orders.confirm_and_receive_difference","تأكيد واستلام فارق المبلغ"):salla.lang.getWithDefault("pages.orders.confirm_changes","تأكيد التعديلات"),t("i",{class:`${this.getConfirmButtonIconClass()} s-order-edit-modal-btn-icon`})),t("salla-button",{color:"gray",fill:"outline",onClick:()=>this.returnToOrderDetails()},salla.lang.getWithDefault("pages.orders.back_to_order_details","العودة إلى تفاصيل الطلب")))))}render(){if(this.loading)return t(i,null,t("salla-loading",null));if(this.expired)return t(i,null,t("div",{class:"s-order-edit-expired"},t("p",null,salla.lang.getWithDefault("pages.orders.edit_session_expired","انتهت مدة التعديل المتاحة")),t("salla-button",{onClick:()=>this.navigateToOrder()},salla.lang.getWithDefault("pages.orders.back_to_order","العودة إلى تفاصيل الطلب"))));if(this.error||!this.order)return t(i,null,t("div",{class:"s-order-edit-no-content-placeholder"},t("i",{class:"sicon-shopping-bag icon"}),t("p",null,this.error)));const s=this.order.items&&this.order.items.length>0,e=this.order.customer_editing_session?.ends_at;return t(i,null,e&&t("div",{class:"s-order-edit-timer-wrapper"},t("salla-count-down",{prefixText:salla.lang.getWithDefault("pages.orders.edit_within","يمكنك التعديل خلال"),date:e,horizontal:!0,withButton:!0,autoSegments:!0,labeled:!1,size:"sm",color:"primary"})),t("div",{class:"s-order-edit-layout"},this.isMobileViewport?null:this.renderProductsPanel(),t("section",{class:"s-order-edit-order-panel"},t("div",{class:"s-order-edit-items-wrapper"},t("h2",{class:"s-order-edit-items-title"},salla.lang.getWithDefault("pages.orders.order_products","منتجات الطلب")),s?this.order.items.map(((s,i)=>[t("salla-order-edit-item",{key:s.id,item:s,orderId:this.orderId}),i<this.order.items.length-1?t("div",{class:"s-order-edit-items-divider"}):null])):t("div",{class:"s-order-edit-no-content-placeholder"},t("i",{class:"sicon-shopping-bag icon"}),t("p",null,salla.lang.getWithDefault("common.elements.no_items","لا توجد عناصر")))),t("div",{class:"s-order-edit-actions"},t("salla-button",{class:"s-order-edit-mobile-products-trigger",color:"gray",size:"small",fill:"outline",onClick:()=>this.openMobileProductsModal()},t("i",{class:"sicon-add s-order-edit-mobile-products-trigger-icon"}),salla.lang.getWithDefault("pages.orders.add_product","إضافة منتج")),t("salla-button",{onClick:()=>this.saveOrder(),loading:this.saveLoading,size:"small",disabled:!this.hasChanges},salla.lang.getWithDefault("pages.orders.save_changes","حفظ التعديلات")),t("salla-button",{size:"small",color:"gray",fill:"outline",onClick:()=>this.cancelEditSession()},salla.lang.getWithDefault("common.elements.cancel","الغاء"))))),this.renderMobileProductsModal(),this.renderAddProductDrawer(),this.renderSaveModal())}};f.style=":host{display:block}";export{f as salla_order_edit}
4
+ import{r as s,h as t,H as i}from"./p-DryPCgN9.js";import{g as e,a,c as r,u as d,r as o,m as l,b as n,f as h,d as c,e as u,h as m,i as p}from"./p-C8xwacGT.js";import"./p-CoQJOPRz.js";const f=class{constructor(t){s(this,t),this.loading=!0,this.saveLoading=!1,this.payload={items:{update:[],remove:[],add:[]}},this.expired=!1,this.editPreview=null,this.productSearchQuery="",this.productsListKey=0,this.productsListSource="latest",this.productsListSourceValue="",this.selectedProductToAdd=null,this.addProductQuantity=1,this.addProductLoading=!1,this.addProductConfirmLoading=!1,this.mobileProductsModalMounted=!1,this.isMobileViewport=!1,this.isRTL=!0,this.mobileProductsListLoading=!1,this.confirming=!1,this.handleMobileProductSelected=s=>{s.stopPropagation(),this.handleProductSelected(s)},this.productsPanelMobileQuery="(max-width: 768px)",this.handleProductsPanelViewportChange=s=>{this.isMobileViewport=s.matches},this.hasProductTypeFilter=s=>{const t=s.indexOf("?"),i=(t>=0?s.slice(t+1):s).split("#")[0];return Array.from(new URLSearchParams(i)).some((([s,t])=>"product"===t&&/^filters\[types\](?:\[(?:\d*)\])?$/.test(s)))},this.hasExcludedCategoriesFilter=s=>{const t=s.indexOf("?"),i=(t>=0?s.slice(t+1):s).split("#")[0];return Array.from(new URLSearchParams(i)).some((([s])=>/^filters(?:\[|%5B)excluded_categories(?:\]|%5D)(?:\[|%5B)(?:\d*)(?:\]|%5D)$/.test(s)))},this.normalizeProductsListArrayParams=s=>s.replace(/(^|[?&])(includes|source_value|filters(?:\[|%5B)[^&=\]%]+?(?:\]|%5D))(\[|%5B)\d+(\]|%5D)(?==)/gi,((s,t,i,e,a)=>`${t}${i}${e}${a}`)),this.handleBeforeBuildListUrl=s=>{if("salla-order-edit-product-card"!==s.component?.productCardComponent||"string"!=typeof s.url)return;s.url=this.normalizeProductsListArrayParams(s.url),this.hasProductTypeFilter(s.url)||(s.url+=(s.url.includes("?")?"&":"?")+"filters[types][]=product");const t=this.getParsedExcludedCategories();if(t.length>0&&!this.hasExcludedCategoriesFilter(s.url)){const i=t.map((s=>`filters[excluded_categories][]=${encodeURIComponent(s)}`)).join("&");s.url+=`${s.url.includes("?")?"&":"?"}${i}`}},this.defaultProductsListSource="latest",this.debouncedProductSearch=salla.helpers.debounce((s=>this.applyProductSearch(s)),500),salla.onReady((()=>{this.isRTL=salla.config.get("theme.is_rtl",!0)}))}getParsedExcludedCategories(){if(!this.excludedCategories)return[];try{const s="string"==typeof this.excludedCategories?JSON.parse(this.excludedCategories):this.excludedCategories;return Array.isArray(s)?s.filter((s=>Number.isInteger(s)&&s>0)):[]}catch{return[]}}async componentWillLoad(){this.setupProductsPanelViewportQuery(),await salla.onReady(),this.unregisterBeforeBuildListUrlHook=salla.hooks.registerHook("salla-products-list","beforeBuildListUrl",this.handleBeforeBuildListUrl),this.loadFromProp(),this.startExpiryCheck()}disconnectedCallback(){clearInterval(this.expiryInterval),this.unregisterBeforeBuildListUrlHook?.(),this.productsPanelViewportQuery?.removeEventListener("change",this.handleProductsPanelViewportChange),this.mobileProductsModal?.removeEventListener("orderEditProductSelected",this.handleMobileProductSelected)}setupProductsPanelViewportQuery(){"undefined"!=typeof window&&"function"==typeof window.matchMedia&&(this.productsPanelViewportQuery=window.matchMedia(this.productsPanelMobileQuery),this.isMobileViewport=this.productsPanelViewportQuery.matches,this.productsPanelViewportQuery.addEventListener("change",this.handleProductsPanelViewportChange))}startExpiryCheck(){const s=this.order?.customer_editing_session?.ends_at;if(!s)return;const t=()=>new Date(`${s.replace(" ","T")}+03:00`).getTime()<=Date.now();t()?this.expired=!0:this.expiryInterval=setInterval((()=>{t()&&(this.expired=!0,clearInterval(this.expiryInterval))}),1e3)}loadFromProp(){try{if(!this.orderData)return void(this.error=salla.lang.getWithDefault("pages.orders.order_not_found","الطلب غير موجود"));const s="string"==typeof this.orderData?JSON.parse(this.orderData):this.orderData;this.order={...s,items:s.items.map((s=>({...s,selectedOptions:e(s)})))}}catch(s){this.error=salla.lang.getWithDefault("pages.orders.order_not_found","الطلب غير موجود")}finally{this.loading=!1}}applyProductSearch(s){const t=s?.trim()||"",i=t?"search":this.defaultProductsListSource,e="search"===i?JSON.stringify(t):"";this.productsListSource===i&&this.productsListSourceValue===e||(this.productsListSource=i,this.productsListSourceValue=e,this.productsListKey+=1)}handleProductSearch(s){const t=s.target?.value||"";this.productSearchQuery=t,this.debouncedProductSearch(t)}getProductsListKey(s){return`${s}-${this.productsListSource}-${this.productsListSourceValue}-${this.productsListKey}`}handleMobileProductsScroll(s){const t=s.currentTarget;if(t.scrollHeight-t.scrollTop-t.clientHeight>200||this.mobileProductsListLoading)return;const i=t.querySelector("salla-products-list");i&&(this.mobileProductsListLoading=!0,i.loadMore().finally((()=>{this.mobileProductsListLoading=!1})))}waitForNextFrame(){return new Promise((s=>requestAnimationFrame((()=>s(void 0)))))}async openMobileProductsModal(){this.mobileProductsModalMounted||(this.mobileProductsModalMounted=!0,await this.waitForNextFrame()),await(this.mobileProductsModal?.open?.())}setMobileProductsModal(s){this.mobileProductsModal!==s&&(this.mobileProductsModal?.removeEventListener("orderEditProductSelected",this.handleMobileProductSelected),this.mobileProductsModal=s,this.mobileProductsModal?.addEventListener("orderEditProductSelected",this.handleMobileProductSelected))}resetAddProductDrawer(){this.selectedProductToAdd=null,this.addProductQuantity=1,this.addProductLoading=!1,this.addProductConfirmLoading=!1,this.addProductOptions=null}getAddProductMaxQuantity(s=this.selectedProductToAdd){return a(s)}clampAddProductQuantity(s,t=this.selectedProductToAdd){return r(s,this.getAddProductMaxQuantity(t))}getApiErrorMessage(s){return s?.response?.data?.error?.message||s?.response?.data?.message}notifyApiError(s){const t=this.getApiErrorMessage(s);t&&salla.notify.error(t)}async validateAddProductOptions(){return!this.selectedProductToAdd?.options?.length||!!this.addProductOptions&&(await(this.addProductOptions.validateAndScroll?.())??await(this.addProductOptions.reportValidity?.())??!1)}updateLocalOrderItem(s,t,i,e){this.order={...this.order,items:d(this.order.items,s,t,i,e)}}removeLocalOrderItem(s){this.order={...this.order,items:o(this.order.items,s)}}setPayloadItems(s){this.payload={...this.payload,items:l(this.payload.items,s)}}handleAddProductQuantityChange(s){const t=s.detail,i=t?.quantity??parseInt(s.target?.value,10);isNaN(i)||i<1||(this.addProductQuantity=this.clampAddProductQuantity(i))}async handleProductSelected(s){const t=s.detail?.product;if(t?.id&&!this.addProductLoading){this.addProductLoading=!0;try{this.selectedProductToAdd=n(t),this.addProductQuantity=1,await(this.mobileProductsModal?.close?.()),await this.waitForNextFrame(),await(this.addProductDrawer?.open?.())}catch(s){this.notifyApiError(s)}finally{this.addProductLoading=!1}}}async confirmAddProduct(){if(this.selectedProductToAdd?.id&&!this.addProductConfirmLoading){this.addProductConfirmLoading=!0;try{const s=this.getAddProductMaxQuantity(),t=this.clampAddProductQuantity(this.addProductQuantity);t!==this.addProductQuantity&&(this.addProductQuantity=t);const i=this.addProductOptions;if(!await this.validateAddProductOptions())return void salla.notify.error(salla.lang.getWithDefault("common.messages.required_fields","يرجى تعبئة الحقول المطلوبة"));const e=await(i?.getSelectedOptionsData?.())||{},a=await(i?.getOptionsData?.())||this.selectedProductToAdd.options||[],d=h(this.order?.items,this.selectedProductToAdd.id,e);if(d){const i=r(d.quantity+t,s);return this.updateLocalOrderItem(d.id,i,a,e),this.setPayloadItems(d.isNew?{add:c(this.payload.items.add,d.id,i,e)}:{update:u(this.payload.items.update,d.id,i,e)}),void await(this.addProductDrawer?.close?.())}const o=m(this.selectedProductToAdd,t,a,e),l={itemId:o.id,product_id:this.selectedProductToAdd.id,quantity:t,options:e};this.order={...this.order,items:[...this.order.items,o]},this.setPayloadItems({add:[...this.payload.items.add,l]}),await(this.addProductDrawer?.close?.())}catch(s){this.notifyApiError(s)}finally{this.addProductConfirmLoading=!1}}}handleItemUpdated(s){if(!this.order)return;const{itemId:t,quantity:i,options:e,optionDefinitions:d}=s.detail,o=this.order.items.find((s=>s.id===t));if(!o)return;const l=r(i,a(o.product));if(o.isNew)return this.setPayloadItems({add:c(this.payload.items.add,t,l,e)}),void this.updateLocalOrderItem(t,l,d,e);this.setPayloadItems({update:u(this.payload.items.update,t,l,e??{})}),this.updateLocalOrderItem(t,l,d,e)}handleItemRemoved(s){if(!this.order)return;if(this.order.items.length<=1)return void salla.notify.error(salla.lang.getWithDefault("pages.orders.order_cannot_be_empty","لا يمكن إزالة جميع المنتجات من الطلب"));const{itemId:t}=s.detail,i=this.order.items.find((s=>s.id===t));if(i){if(i.isNew)return this.setPayloadItems({add:this.payload.items.add.filter((s=>s.itemId!==t))}),void this.removeLocalOrderItem(t);this.setPayloadItems({update:this.payload.items.update.filter((s=>s.id!==t)),remove:[...this.payload.items.remove,t]}),this.removeLocalOrderItem(t)}}get hasChanges(){return this.payload.items.update.length>0||this.payload.items.remove.length>0||this.payload.items.add.length>0}async saveOrder(){if(this.hasChanges){this.saveLoading=!0;try{const s=await salla.order.api.editOrder(this.orderId,p(this.payload));this.editPreview=s?.data?.data||s?.data,await(this.saveModal?.open?.())}catch(s){this.notifyApiError(s)}finally{this.saveLoading=!1}}}navigateToOrder(){const s=new URL(window.location.href);s.pathname=s.pathname.replace(/\/edit\/?$/,""),s.search="",window.location.href=s.href}handleConfirm(){this.confirming=!0,this.editPreview?.payment?.required&&this.editPreview.payment.payment_url?window.location.href=this.editPreview.payment.payment_url:this.navigateToOrder()}returnToOrderDetails(){this.confirming=!0,this.navigateToOrder()}getConfirmButtonIconClass(){return this.isRTL?"sicon-keyboard_arrow_left":"sicon-keyboard_arrow_right"}async cancelEditSession(){try{await salla.order.api.cancelEditSession(this.orderId),this.navigateToOrder()}catch(s){this.notifyApiError(s)}}renderProductsPanel(){const s=salla.lang.getWithDefault("pages.orders.add_product_to_order","أضف منتج للطلب");return t("section",{class:"s-order-edit-products-panel"},t("div",{class:"s-order-edit-products-header"},t("h2",{class:"s-order-edit-products-title"},s)),this.renderProductsPickerContent("panel"))}renderProductsPickerContent(s){return t("div",{class:{"s-order-edit-products-picker":!0,"s-order-edit-products-modal-content":"modal"===s}},t("label",{class:"s-order-edit-products-search"},t("i",{class:"sicon-search"}),t("input",{type:"search",class:"s-order-edit-products-search-input",placeholder:salla.lang.getWithDefault("pages.products.search_for_product","ابحث عن منتج"),value:this.productSearchQuery,onInput:s=>this.handleProductSearch(s)})),t("div",{class:"s-order-edit-products-list",onScroll:"modal"===s?s=>this.handleMobileProductsScroll(s):void 0},t("salla-products-list",{key:this.getProductsListKey(s),includes:["options"],source:this.productsListSource,"source-value":this.productsListSourceValue,autoload:!0,"product-card-component":"salla-order-edit-product-card"})))}renderMobileProductsModal(){return t("salla-modal",{ref:s=>this.setMobileProductsModal(s),width:"md",class:"s-order-edit-mobile-products-modal","modal-title":salla.lang.getWithDefault("pages.orders.add_product_to_order","أضف منتج للطلب"),onModalVisibilityChanged:s=>{s.detail||(this.mobileProductsModalMounted=!1)}},this.mobileProductsModalMounted?this.renderProductsPickerContent("modal"):null)}renderAddProductDrawer(){const s=this.selectedProductToAdd,i=s?.name||salla.lang.getWithDefault("common.elements.product","منتج"),e=s?.price,a=this.getAddProductMaxQuantity(s),r=s?`order-edit-add-${s.id}`:"order-edit-add",d={value:this.clampAddProductQuantity(this.addProductQuantity,s)};return a&&(d.max=a),t("salla-modal",{ref:s=>this.addProductDrawer=s,width:"md","modal-title":salla.lang.getWithDefault("pages.orders.add_product_to_order","أضف منتج للطلب"),onModalVisibilityChanged:s=>{s.detail||this.resetAddProductDrawer()}},t("div",{class:"s-order-edit-add-modal"},this.addProductLoading?t("div",{class:"s-order-edit-add-modal-loading"},t("salla-loading",null)):s?t("div",{class:"s-order-edit-add-modal-content"},t("div",{class:"s-order-edit-add-modal-header"},t("div",{class:"s-order-edit-add-modal-media"},s.image?.url&&t("img",{src:s.image.url,alt:s.image.alt||i,class:"s-order-edit-add-modal-image"}),t("div",{class:"s-order-edit-add-modal-details"},t("h3",{class:"s-order-edit-add-modal-name"},i),null!=e&&t("span",{class:"s-order-edit-add-modal-price",innerHTML:salla.money(e)})))),t("div",{class:"s-order-edit-add-modal-quantity"},t("h3",{class:"s-order-edit-add-modal-section-title"},salla.lang.getWithDefault("common.elements.quantity","الكمية")),t("div",{class:"s-order-edit-add-modal-quantity-input"},t("salla-quantity-input",{...d,onChange:s=>this.handleAddProductQuantityChange(s)}))),s.options?.length>0&&t("form",{onSubmit:s=>s.preventDefault()},t("salla-product-options",{ref:s=>this.addProductOptions=s,"product-id":s.id,"unique-key":r,options:JSON.stringify(s.options),key:`${r}-options`})),t("div",{class:"s-order-edit-add-modal-actions"},t("salla-button",{onClick:()=>this.confirmAddProduct(),loading:this.addProductConfirmLoading},salla.lang.getWithDefault("common.elements.confirm","تأكيد")),t("salla-button",{color:"gray",fill:"outline",onClick:()=>this.addProductDrawer?.close?.()},salla.lang.getWithDefault("common.elements.cancel","الغاء")))):null))}renderSaveModal(){const s=this.editPreview,i=s?.totals?.remaining_amount?.amount>0,e=s?.totals?.refund_amount?.amount>0,a=s?.totals?.tax?.amount?.amount;return t("salla-modal",{ref:s=>this.saveModal=s,width:"md",isClosable:!1,onModalVisibilityChanged:async s=>{s.detail||(this.editPreview=null,this.confirming||await this.cancelEditSession(),this.confirming=!1)}},t("div",{class:"s-order-edit-modal"},t("h2",{class:"s-order-edit-modal-title"},salla.lang.getWithDefault("pages.orders.edit_summary_title","ملخص الطلب بعد التعديل")),t("p",{class:"s-order-edit-modal-subtitle"},salla.lang.getWithDefault("pages.orders.cart_edits_saved","Your cart edits have been saved")),s?.items?.length>0&&t("div",{class:"s-order-edit-modal-items"},s.items.map((s=>{const i=this.order?.items?.find((t=>t.id==s.id)),e=i?.product?.image?.url,a=s.options?.join("/ ");return t("div",{class:"s-order-edit-modal-item"},t("div",{class:"s-order-edit-modal-item-start"},e&&t("img",{src:e,alt:s.name,class:"s-order-edit-modal-item-image"}),t("div",null,t("p",{class:"s-order-edit-modal-item-name"},s.name),a&&t("span",{class:"s-order-edit-modal-item-options"},a))),t("div",{class:"s-order-edit-modal-item-end"},t("span",{class:"s-order-edit-modal-item-quantity",dir:"ltr",innerHTML:s.quantity+" x "+s.price.amount}),t("span",{class:"s-order-edit-modal-item-price",innerHTML:salla.money(s.price.amount*s.quantity)})))}))),s?.totals?.updated_products_total&&t("div",{class:"s-order-edit-modal-row"},t("span",{class:"s-order-edit-modal-row-label"},salla.lang.getWithDefault("pages.orders.modified_products_total","مجموع المنتجات المعدلة")),t("span",{class:"s-order-edit-modal-row-value",innerHTML:salla.money(s.totals.updated_products_total.amount)})),a>0&&t("div",{class:"s-order-edit-modal-row"},t("span",{class:"s-order-edit-modal-tax-label"},t("i",{class:"sicon-info-circle s-order-edit-modal-tax-icon"}),salla.lang.getWithDefault("pages.orders.vat","ضريبة القيمة المضافة")),t("span",{class:"s-order-edit-modal-row-value",innerHTML:salla.money(a)})),s?.totals?.total&&t("div",{class:"s-order-edit-modal-total"},t("span",{class:"s-order-edit-modal-total-label"},salla.lang.getWithDefault("pages.orders.order_total","اجمالي الطلب")),t("span",{class:"s-order-edit-modal-total-value",innerHTML:salla.money(s.totals.total.amount)})),e&&t("div",{class:"s-order-edit-modal-refund"},t("i",{class:"sicon-info-circle s-order-edit-modal-refund-icon"}),t("p",{class:"s-order-edit-modal-refund-text"},salla.lang.getWithDefault("pages.orders.refund_message","سيتم تحويل فارق المبلغ على نفس وسيلة الدفع"))),t("div",{class:"s-order-edit-modal-btn-wrapper"},t("salla-button",{onClick:()=>this.handleConfirm()},i?salla.lang.getWithDefault("pages.orders.pay_difference","دفع فارق المبلغ"):e?salla.lang.getWithDefault("pages.orders.confirm_and_receive_difference","تأكيد واستلام فارق المبلغ"):salla.lang.getWithDefault("pages.orders.confirm_changes","تأكيد التعديلات"),t("i",{class:`${this.getConfirmButtonIconClass()} s-order-edit-modal-btn-icon`})),t("salla-button",{color:"gray",fill:"outline",onClick:()=>this.returnToOrderDetails()},salla.lang.getWithDefault("pages.orders.back_to_order_details","العودة إلى تفاصيل الطلب")))))}render(){if(this.loading)return t(i,null,t("salla-loading",null));if(this.expired)return t(i,null,t("div",{class:"s-order-edit-expired"},t("p",null,salla.lang.getWithDefault("pages.orders.edit_session_expired","انتهت مدة التعديل المتاحة")),t("salla-button",{onClick:()=>this.navigateToOrder()},salla.lang.getWithDefault("pages.orders.back_to_order","العودة إلى تفاصيل الطلب"))));if(this.error||!this.order)return t(i,null,t("div",{class:"s-order-edit-no-content-placeholder"},t("i",{class:"sicon-shopping-bag icon"}),t("p",null,this.error)));const s=this.order.items&&this.order.items.length>0,e=this.order.customer_editing_session?.ends_at;return t(i,null,e&&t("div",{class:"s-order-edit-timer-wrapper"},t("salla-count-down",{prefixText:salla.lang.getWithDefault("pages.orders.edit_within","يمكنك التعديل خلال"),date:e,horizontal:!0,withButton:!0,autoSegments:!0,labeled:!1,size:"sm",color:"primary"})),t("div",{class:"s-order-edit-layout"},this.isMobileViewport?null:this.renderProductsPanel(),t("section",{class:"s-order-edit-order-panel"},t("div",{class:"s-order-edit-items-wrapper"},t("h2",{class:"s-order-edit-items-title"},salla.lang.getWithDefault("pages.orders.order_products","منتجات الطلب")),s?this.order.items.map(((s,i)=>[t("salla-order-edit-item",{key:s.id,item:s,orderId:this.orderId}),i<this.order.items.length-1?t("div",{class:"s-order-edit-items-divider"}):null])):t("div",{class:"s-order-edit-no-content-placeholder"},t("i",{class:"sicon-shopping-bag icon"}),t("p",null,salla.lang.getWithDefault("common.elements.no_items","لا توجد عناصر")))),t("div",{class:"s-order-edit-actions"},t("salla-button",{class:"s-order-edit-mobile-products-trigger",color:"gray",size:"small",fill:"outline",onClick:()=>this.openMobileProductsModal()},t("i",{class:"sicon-add s-order-edit-mobile-products-trigger-icon"}),salla.lang.getWithDefault("pages.orders.add_product","إضافة منتج")),t("salla-button",{onClick:()=>this.saveOrder(),loading:this.saveLoading,size:"small",disabled:!this.hasChanges},salla.lang.getWithDefault("pages.orders.save_changes","حفظ التعديلات")),t("salla-button",{size:"small",color:"gray",fill:"outline",onClick:()=>this.cancelEditSession()},salla.lang.getWithDefault("common.elements.cancel","الغاء"))))),this.renderMobileProductsModal(),this.renderAddProductDrawer(),this.renderSaveModal())}};f.style=":host{display:block}";export{f as salla_order_edit}
@@ -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,a as n}from"./p-DNtvpIPH.js";import{H as l}from"./p-CHf8XdiS.js";import"./p-CgtvEd63.js";const e=class{constructor(t){s(this,t),this.nextPage="",this.autoload=!1,this.container="salla-infinite-scroll",this.item="salla-infinite-scroll > *",this.status=document.createElement("div"),this.status.className="s-infinite-scroll-wrapper",this.status.innerHTML=`<div class="s-infinite-scroll-status" style="display:none">\n <p class="s-infinite-scroll-last infinite-scroll-last"></p>\n <p class="s-infinite-scroll-error infinite-scroll-error"></p>\n </div>\n <a href="${this.nextPage}" class="s-infinite-scroll-btn s-button-btn s-button-primary">\n <span class="s-button-text s-infinite-scroll-btn-text">${this.loadMoreText?this.loadMoreText:salla.lang.get("common.elements.load_more")}</span>\n <span class="s-button-loader s-button-loader-center s-infinite-scroll-btn-loader" style="display: none"></span>\n </a>`,this.btnLoader=this.status.querySelector(".s-button-loader"),salla.lang.onLoaded((()=>{this.status.querySelector(".s-button-text").innerHTML=this.loadMoreText?this.loadMoreText:salla.lang.get("common.elements.load_more"),this.status.querySelector(".s-infinite-scroll-last").innerHTML=salla.lang.get("common.elements.end_of_content"),this.status.querySelector(".s-infinite-scroll-error").innerHTML=salla.lang.get("common.elements.failed_to_load_more")}))}loading(s=!0){let t=this.status.querySelector(".s-button-text");l.toggleElementClassIf(t,"s-button-hide","s-button-show",(()=>s)),this.btnLoader.style.display=s?"inherit":"none"}render(){return this.nextPage.length>1?t(i,{class:"s-infinite-scroll-container"},t("slot",null)):""}componentDidLoad(){if(0===this.nextPage.length)return;this.host.insertAdjacentElement("afterend",this.status);let s=this,t=salla.infiniteScroll.initiate(this.container,{history:!!this.autoload&&"push",scrollThreshold:!!this.autoload&&400,nextPage:this.nextPage,checkLastPage:'salla-infinite-scroll[next-page*=":"],salla-infinite-scroll[next-page*="."]',status:".s-infinite-scroll-status",button:this.status.querySelector(".s-button-btn"),append:this.item,path:function(){return s.nextPage.replace(/page\=(\d)/g,"page="+(this.loadCount+2))}}).on("request",(()=>this.loading())).on("load",(()=>{this.loading(!1),2==t.pageIndex&&t.option({loadOnScroll:!1}),3==t.pageIndex&&t.option({loadOnScroll:!0})})).on("error",(()=>this.loading(!1)))}get host(){return n(this)}};e.style="";export{e as salla_infinite_scroll}
4
+ import{r as s,h as t,H as i,a as n}from"./p-DryPCgN9.js";import{H as l}from"./p-CHf8XdiS.js";import"./p-CgtvEd63.js";const e=class{constructor(t){s(this,t),this.nextPage="",this.autoload=!1,this.container="salla-infinite-scroll",this.item="salla-infinite-scroll > *",this.status=document.createElement("div"),this.status.className="s-infinite-scroll-wrapper",this.status.innerHTML=`<div class="s-infinite-scroll-status" style="display:none">\n <p class="s-infinite-scroll-last infinite-scroll-last"></p>\n <p class="s-infinite-scroll-error infinite-scroll-error"></p>\n </div>\n <a href="${this.nextPage}" class="s-infinite-scroll-btn s-button-btn s-button-primary">\n <span class="s-button-text s-infinite-scroll-btn-text">${this.loadMoreText?this.loadMoreText:salla.lang.get("common.elements.load_more")}</span>\n <span class="s-button-loader s-button-loader-center s-infinite-scroll-btn-loader" style="display: none"></span>\n </a>`,this.btnLoader=this.status.querySelector(".s-button-loader"),salla.lang.onLoaded((()=>{this.status.querySelector(".s-button-text").innerHTML=this.loadMoreText?this.loadMoreText:salla.lang.get("common.elements.load_more"),this.status.querySelector(".s-infinite-scroll-last").innerHTML=salla.lang.get("common.elements.end_of_content"),this.status.querySelector(".s-infinite-scroll-error").innerHTML=salla.lang.get("common.elements.failed_to_load_more")}))}loading(s=!0){let t=this.status.querySelector(".s-button-text");l.toggleElementClassIf(t,"s-button-hide","s-button-show",(()=>s)),this.btnLoader.style.display=s?"inherit":"none"}render(){return this.nextPage.length>1?t(i,{class:"s-infinite-scroll-container"},t("slot",null)):""}componentDidLoad(){if(0===this.nextPage.length)return;this.host.insertAdjacentElement("afterend",this.status);let s=this,t=salla.infiniteScroll.initiate(this.container,{history:!!this.autoload&&"push",scrollThreshold:!!this.autoload&&400,nextPage:this.nextPage,checkLastPage:'salla-infinite-scroll[next-page*=":"],salla-infinite-scroll[next-page*="."]',status:".s-infinite-scroll-status",button:this.status.querySelector(".s-button-btn"),append:this.item,path:function(){return s.nextPage.replace(/page\=(\d)/g,"page="+(this.loadCount+2))}}).on("request",(()=>this.loading())).on("load",(()=>{this.loading(!1),2==t.pageIndex&&t.option({loadOnScroll:!1}),3==t.pageIndex&&t.option({loadOnScroll:!0})})).on("error",(()=>this.loading(!1)))}get host(){return n(this)}};e.style="";export{e as salla_infinite_scroll}
@@ -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,a as e}from"./p-DNtvpIPH.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(){if(!Salla.config.isUser())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-DryPCgN9.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(){if(!Salla.config.isUser())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 e,c as a,h as t,H as s}from"./p-DNtvpIPH.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:"601dbcf73e68678eecc912c14c2b1be612a78551"},t("div",{key:"074f8b4cb736bfabd5885d9df77bf74e7c4829a1",onClick:this.onPrizeItemClick.bind(this)},t("img",{key:"4bec672992f7e998bde639295831a5c9ad5f5088",class:"s-loyalty-prize-item-image",src:this.item.image,alt:this.item.name}),t("div",{key:"c8f858a7f406fe8e9123c57df627a4b6a2cbd719",class:"s-loyalty-prize-item-title"},this.item.name),t("div",{key:"81b954aa730e07c7f32ee538692581dede3543db",class:"s-loyalty-prize-item-subtitle"},this.item.description),t("div",{key:"b7baeada2da364fec6ee7bd606b595b1f652d8a8",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-DryPCgN9.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:"601dbcf73e68678eecc912c14c2b1be612a78551"},t("div",{key:"074f8b4cb736bfabd5885d9df77bf74e7c4829a1",onClick:this.onPrizeItemClick.bind(this)},t("img",{key:"4bec672992f7e998bde639295831a5c9ad5f5088",class:"s-loyalty-prize-item-image",src:this.item.image,alt:this.item.name}),t("div",{key:"c8f858a7f406fe8e9123c57df627a4b6a2cbd719",class:"s-loyalty-prize-item-title"},this.item.name),t("div",{key:"81b954aa730e07c7f32ee538692581dede3543db",class:"s-loyalty-prize-item-subtitle"},this.item.description),t("div",{key:"b7baeada2da364fec6ee7bd606b595b1f652d8a8",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 e,h as a,H as t,a as n}from"./p-DNtvpIPH.js";import{S as i}from"./p-8Tsmrwno.js";const r=class{constructor(a){e(this,a)}componentWillLoad(){this.title=salla.config.get("maintenance_details.title"),this.message=salla.config.get("maintenance_details.message");const e="undefined"!=typeof window&&!window.matchMedia("(min-width: 768px)").matches;this.buttonTitle=e?salla.config.get("maintenance_details.button_title"):salla.config.get("maintenance_details.button_full_title")}closeAlert(){salla.storage.set("hide_salla-maintenance-alert_at",Date.now()),this.host.style.display="none"}render(){return a(t,{key:"e1a1d166cb1be3f24820517a902d0a0559634a80",class:"s-maintenance-alert-wrapper"},a("button",{key:"c59d166fca18b0da876bd6c8b24af2bd2db18aba",class:"s-maintenance-alert-close",innerHTML:i,onClick:()=>this.closeAlert()}),a("div",{key:"1706aa47265a29485b48ad7be1cebc98b8e735ec",class:"s-maintenance-alert-content"},a("div",{key:"0ba2feded17c0dfd1a129f11cf7f393a1737055b",class:"s-maintenance-alert-container"},a("div",{key:"509a81ace0c168f42e5391b5d4b1e04337b2c6fb",class:"s-maintenance-alert-icon"},a("img",{key:"97598847825b9d4c1c8d06e0001c7d669c0dac4b",src:salla.url.cdn("images/alert.png"),alt:"Alert"})),a("div",{key:"9bb8eac957668568262b9c59fd20bcff5240566f",class:"s-maintenance-alert-text"},a("h2",{key:"ac424443f1c28002a1e00305f240741c7b6bed4f"},this.title),a("p",{key:"7d0dd3556640386b01877369a840ce1bedf5c647"},this.message))),a("div",{key:"fdbc31b011bc8c067046a57721344cd57554f5d8"},a("a",{key:"6efb57a978e9fe03474451c464e85626974e476a",class:"s-maintenance-alert-btn",href:salla.config.get("maintenance_details.button_url")},this.buttonTitle))))}componentDidLoad(){let e=salla.storage.get("hide_salla-maintenance-alert_at");e&&(Date.now()-e)/1e3/60<60&&this.closeAlert()}get host(){return n(this)}};r.style=".s-maintenance-alert-wrapper{display:flex;min-height:40px;width:100%;flex-direction:row;align-items:center;justify-content:center;--tw-bg-opacity:1;background-color:rgba(26, 38, 61, var(--tw-bg-opacity));padding:0.25rem 0.5rem;--tw-text-opacity:1;color:rgba(255, 255, 255, var(--tw-text-opacity))}.s-maintenance-alert-wrapper a{transition:0.35s cubic-bezier(0.2, 1, 0.3, 1)}.s-maintenance-alert-wrapper *{color:inherit}@media (min-width: 640px){.s-maintenance-alert-wrapper{padding-left:2rem;padding-right:2rem}}.s-maintenance-alert-content{margin-top:1rem;margin-bottom:1rem;display:flex;width:100%;align-items:center;justify-content:space-between}@media (min-width: 640px){.s-maintenance-alert-content{padding-left:2rem;padding-right:2rem}}.s-maintenance-alert-container{display:flex;align-items:center}.s-maintenance-alert-icon{margin-right:1.25rem;display:none}@media (min-width: 640px){.s-maintenance-alert-icon{display:block}}.s-maintenance-alert-text h2{margin-bottom:0.5rem;font-size:0.875rem;font-weight:700;line-height:1.4}@media (min-width: 640px){.s-maintenance-alert-text h2{font-size:1.5rem;line-height:2rem}}.s-maintenance-alert-text p{margin:0px;text-align:right;font-size:10px;line-height:1.2}@media (min-width: 640px){.s-maintenance-alert-text p{text-align:center;font-size:0.75rem;line-height:1}}.s-maintenance-alert-btn{position:relative;margin-left:4px;margin-right:4px;display:inline-block;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;user-select:none;white-space:nowrap;border-radius:0.125rem;border-width:1px;--tw-border-opacity:1;border-color:rgba(93, 213, 196, var(--tw-border-opacity));--tw-bg-opacity:1;background-color:rgba(93, 213, 196, var(--tw-bg-opacity));padding:0.5rem;text-align:center;vertical-align:middle;font-size:0.875rem;font-weight:400;line-height:1.4;--tw-text-opacity:1;color:rgba(255, 255, 255, var(--tw-text-opacity))}.s-maintenance-alert-btn:hover{--tw-bg-opacity:1;background-color:rgba(53, 203, 181, var(--tw-bg-opacity))}.s-maintenance-alert-btn *{pointer-events:none}[dir=rtl] .s-maintenance-alert-btn{margin-left:1.25rem;margin-right:0}@media (min-width: 640px){.s-maintenance-alert-btn{padding:0.5rem 1rem}}";export{r as salla_maintenance_alert}
4
+ import{r as e,h as a,H as t,a as n}from"./p-DryPCgN9.js";import{S as i}from"./p-8Tsmrwno.js";const r=class{constructor(a){e(this,a)}componentWillLoad(){this.title=salla.config.get("maintenance_details.title"),this.message=salla.config.get("maintenance_details.message");const e="undefined"!=typeof window&&!window.matchMedia("(min-width: 768px)").matches;this.buttonTitle=e?salla.config.get("maintenance_details.button_title"):salla.config.get("maintenance_details.button_full_title")}closeAlert(){salla.storage.set("hide_salla-maintenance-alert_at",Date.now()),this.host.style.display="none"}render(){return a(t,{key:"e1a1d166cb1be3f24820517a902d0a0559634a80",class:"s-maintenance-alert-wrapper"},a("button",{key:"c59d166fca18b0da876bd6c8b24af2bd2db18aba",class:"s-maintenance-alert-close",innerHTML:i,onClick:()=>this.closeAlert()}),a("div",{key:"1706aa47265a29485b48ad7be1cebc98b8e735ec",class:"s-maintenance-alert-content"},a("div",{key:"0ba2feded17c0dfd1a129f11cf7f393a1737055b",class:"s-maintenance-alert-container"},a("div",{key:"509a81ace0c168f42e5391b5d4b1e04337b2c6fb",class:"s-maintenance-alert-icon"},a("img",{key:"97598847825b9d4c1c8d06e0001c7d669c0dac4b",src:salla.url.cdn("images/alert.png"),alt:"Alert"})),a("div",{key:"9bb8eac957668568262b9c59fd20bcff5240566f",class:"s-maintenance-alert-text"},a("h2",{key:"ac424443f1c28002a1e00305f240741c7b6bed4f"},this.title),a("p",{key:"7d0dd3556640386b01877369a840ce1bedf5c647"},this.message))),a("div",{key:"fdbc31b011bc8c067046a57721344cd57554f5d8"},a("a",{key:"6efb57a978e9fe03474451c464e85626974e476a",class:"s-maintenance-alert-btn",href:salla.config.get("maintenance_details.button_url")},this.buttonTitle))))}componentDidLoad(){let e=salla.storage.get("hide_salla-maintenance-alert_at");e&&(Date.now()-e)/1e3/60<60&&this.closeAlert()}get host(){return n(this)}};r.style=".s-maintenance-alert-wrapper{display:flex;min-height:40px;width:100%;flex-direction:row;align-items:center;justify-content:center;--tw-bg-opacity:1;background-color:rgba(26, 38, 61, var(--tw-bg-opacity));padding:0.25rem 0.5rem;--tw-text-opacity:1;color:rgba(255, 255, 255, var(--tw-text-opacity))}.s-maintenance-alert-wrapper a{transition:0.35s cubic-bezier(0.2, 1, 0.3, 1)}.s-maintenance-alert-wrapper *{color:inherit}@media (min-width: 640px){.s-maintenance-alert-wrapper{padding-left:2rem;padding-right:2rem}}.s-maintenance-alert-content{margin-top:1rem;margin-bottom:1rem;display:flex;width:100%;align-items:center;justify-content:space-between}@media (min-width: 640px){.s-maintenance-alert-content{padding-left:2rem;padding-right:2rem}}.s-maintenance-alert-container{display:flex;align-items:center}.s-maintenance-alert-icon{margin-right:1.25rem;display:none}@media (min-width: 640px){.s-maintenance-alert-icon{display:block}}.s-maintenance-alert-text h2{margin-bottom:0.5rem;font-size:0.875rem;font-weight:700;line-height:1.4}@media (min-width: 640px){.s-maintenance-alert-text h2{font-size:1.5rem;line-height:2rem}}.s-maintenance-alert-text p{margin:0px;text-align:right;font-size:10px;line-height:1.2}@media (min-width: 640px){.s-maintenance-alert-text p{text-align:center;font-size:0.75rem;line-height:1}}.s-maintenance-alert-btn{position:relative;margin-left:4px;margin-right:4px;display:inline-block;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;user-select:none;white-space:nowrap;border-radius:0.125rem;border-width:1px;--tw-border-opacity:1;border-color:rgba(93, 213, 196, var(--tw-border-opacity));--tw-bg-opacity:1;background-color:rgba(93, 213, 196, var(--tw-bg-opacity));padding:0.5rem;text-align:center;vertical-align:middle;font-size:0.875rem;font-weight:400;line-height:1.4;--tw-text-opacity:1;color:rgba(255, 255, 255, var(--tw-text-opacity))}.s-maintenance-alert-btn:hover{--tw-bg-opacity:1;background-color:rgba(53, 203, 181, var(--tw-bg-opacity))}.s-maintenance-alert-btn *{pointer-events:none}[dir=rtl] .s-maintenance-alert-btn{margin-left:1.25rem;margin-right:0}@media (min-width: 640px){.s-maintenance-alert-btn{padding:0.5rem 1rem}}";export{r as salla_maintenance_alert}
@@ -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,a}from"./p-DNtvpIPH.js";import{H as h}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,h.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:"a3377234cae7a9565f403d859e60ee71cb9b9e00",class:"s-filters-widget-container"},i("h3",{key:"d797565b06c795a6b19d5fa6c93da583e291cc01",class:"s-filters-widget-title",onClick:()=>this.toggleWidget()},i("span",{key:"35e933096973744c332cfb3a0346b57f7dd28a76"},this.option.label),i("span",{key:"2c27dacf5242da14f2cddca9f99af09bb9cb3bea",class:"s-filters-widget-plusminus "+(this.isOpen?"s-filters-widget-plusminus-active":"")})),i("div",{key:"6f85c5af558a2b47e9779225d2fb9b99d2dd78e5",class:"s-filters-widget-content",ref:s=>this.widgetContent=s},Array.isArray(this.option.values)&&this.option.values.length>5&&i("div",{key:"d6c9fe9baf08d095346d52e5e6836ca7a26dae7f",class:"s-filters-widget-search-wrapper",style:{padding:"8px 0",marginBottom:"8px"}},i("input",{key:"44ac9fc9e7488165acccbac8a7bd95a3f863dab8",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:"a8350384975504985098f0b9f1ae6c086537886b",class:"s-filters-widget-values",ref:s=>this.widgetValues=s},i("slot",{key:"20acece0e29070b6f1359ab1d3f16e928d461742"}),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:"a628397d54fc254fe36458c4bbdca0dad0a0e6ad",class:"s-filters-widget-more",onClick:()=>this.showMore()},this.isShowMore?this.showLessLabel:this.showMoreLabel)))}get host(){return a(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}from"./p-DryPCgN9.js";import{H as h}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,h.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:"a3377234cae7a9565f403d859e60ee71cb9b9e00",class:"s-filters-widget-container"},i("h3",{key:"d797565b06c795a6b19d5fa6c93da583e291cc01",class:"s-filters-widget-title",onClick:()=>this.toggleWidget()},i("span",{key:"35e933096973744c332cfb3a0346b57f7dd28a76"},this.option.label),i("span",{key:"2c27dacf5242da14f2cddca9f99af09bb9cb3bea",class:"s-filters-widget-plusminus "+(this.isOpen?"s-filters-widget-plusminus-active":"")})),i("div",{key:"6f85c5af558a2b47e9779225d2fb9b99d2dd78e5",class:"s-filters-widget-content",ref:s=>this.widgetContent=s},Array.isArray(this.option.values)&&this.option.values.length>5&&i("div",{key:"d6c9fe9baf08d095346d52e5e6836ca7a26dae7f",class:"s-filters-widget-search-wrapper",style:{padding:"8px 0",marginBottom:"8px"}},i("input",{key:"44ac9fc9e7488165acccbac8a7bd95a3f863dab8",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:"a8350384975504985098f0b9f1ae6c086537886b",class:"s-filters-widget-values",ref:s=>this.widgetValues=s},i("slot",{key:"20acece0e29070b6f1359ab1d3f16e928d461742"}),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:"a628397d54fc254fe36458c4bbdca0dad0a0e6ad",class:"s-filters-widget-more",onClick:()=>this.showMore()},this.isShowMore?this.showLessLabel:this.showMoreLabel)))}get host(){return a(this)}};r.style=":host{display:block}";export{r as salla_filters_widget}