@salla.sa/twilight-components 2.14.602 → 2.14.603

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 (326) hide show
  1. package/dist/cjs/{filepond-BK4nhdz7.js → filepond-BdnuOx4F.js} +1 -1
  2. package/dist/cjs/{filepond-plugin-file-poster-4fVYpLZW.js → filepond-plugin-file-poster-BWYzr6My.js} +1 -1
  3. package/dist/cjs/{filepond-plugin-file-validate-size-DD9PE5ii.js → filepond-plugin-file-validate-size-DhAUcECh.js} +1 -1
  4. package/dist/cjs/{filepond-plugin-file-validate-type-Cu_qPxNI.js → filepond-plugin-file-validate-type-DoNn9iGj.js} +1 -1
  5. package/dist/cjs/{filepond-plugin-image-edit-DyMzowg7.js → filepond-plugin-image-edit-CNnXvpn8.js} +1 -1
  6. package/dist/cjs/{filepond-plugin-image-exif-orientation-CWPAUAU8.js → filepond-plugin-image-exif-orientation-C8nakD3j.js} +1 -1
  7. package/dist/cjs/{filepond-plugin-image-preview-B4owEvvd.js → filepond-plugin-image-preview-B3F5bMA_.js} +1 -1
  8. package/dist/cjs/{index-B6jjt620.js → index-BxbaPm5U.js} +2 -2
  9. package/dist/cjs/{intlTelInput-DDKMbp8H.js → intlTelInput-DNLLW1NL.js} +1 -1
  10. package/dist/cjs/loader.cjs.js +1 -1
  11. package/dist/cjs/salla-accordion-body_2.cjs.entry.js +1 -1
  12. package/dist/cjs/salla-accordion_6.cjs.entry.js +1 -1
  13. package/dist/cjs/salla-add-product-button_5.cjs.entry.js +3 -2
  14. package/dist/cjs/salla-advertisement.cjs.entry.js +1 -1
  15. package/dist/cjs/salla-alert_2.cjs.entry.js +1 -1
  16. package/dist/cjs/salla-app-install-alert.cjs.entry.js +1 -1
  17. package/dist/cjs/salla-applied-filters.cjs.entry.js +1 -1
  18. package/dist/cjs/salla-apps-icons.cjs.entry.js +1 -1
  19. package/dist/cjs/salla-attachment-view_9.cjs.entry.js +10 -10
  20. package/dist/cjs/salla-badge.cjs.entry.js +1 -1
  21. package/dist/cjs/salla-basket-gap.cjs.entry.js +1 -1
  22. package/dist/cjs/salla-bullet-delivery_3.cjs.entry.js +1 -1
  23. package/dist/cjs/salla-cart-coupons.cjs.entry.js +1 -1
  24. package/dist/cjs/salla-cart-item-offers_2.cjs.entry.js +1 -1
  25. package/dist/cjs/salla-cart-summary-card.cjs.entry.js +1 -1
  26. package/dist/cjs/salla-cashback-banner.cjs.entry.js +1 -1
  27. package/dist/cjs/salla-comment-factors.cjs.entry.js +1 -1
  28. package/dist/cjs/salla-comment-form_9.cjs.entry.js +1 -1
  29. package/dist/cjs/salla-conditional-offer.cjs.entry.js +1 -1
  30. package/dist/cjs/salla-contacts.cjs.entry.js +1 -1
  31. package/dist/cjs/salla-cookies-bar.cjs.entry.js +1 -1
  32. package/dist/cjs/salla-count-down.cjs.entry.js +1 -1
  33. package/dist/cjs/salla-custom-fields.cjs.entry.js +1 -1
  34. package/dist/cjs/salla-delivery-promise.cjs.entry.js +1 -1
  35. package/dist/cjs/salla-edit-order-button.cjs.entry.js +1 -1
  36. package/dist/cjs/salla-filters-widget.cjs.entry.js +1 -1
  37. package/dist/cjs/salla-filters.cjs.entry.js +1 -1
  38. package/dist/cjs/salla-fulfillment-methods.cjs.entry.js +1 -1
  39. package/dist/cjs/salla-gift-card-redeem_2.cjs.entry.js +1 -1
  40. package/dist/cjs/salla-gifting.cjs.entry.js +1 -1
  41. package/dist/cjs/salla-hook.cjs.entry.js +1 -1
  42. package/dist/cjs/salla-infinite-scroll.cjs.entry.js +1 -1
  43. package/dist/cjs/salla-installment.cjs.entry.js +1 -1
  44. package/dist/cjs/salla-list-tile.cjs.entry.js +1 -1
  45. package/dist/cjs/salla-localization-modal.cjs.entry.js +1 -1
  46. package/dist/cjs/salla-login-modal.cjs.entry.js +1 -1
  47. package/dist/cjs/salla-loyalty-banner_10.cjs.entry.js +1 -1
  48. package/dist/cjs/salla-loyalty-exchange-product-card.cjs.entry.js +1 -1
  49. package/dist/cjs/salla-loyalty-points-banner.cjs.entry.js +1 -1
  50. package/dist/cjs/salla-loyalty-points-history.cjs.entry.js +1 -1
  51. package/dist/cjs/salla-loyalty-prize-item.cjs.entry.js +1 -1
  52. package/dist/cjs/salla-loyalty.cjs.entry.js +1 -1
  53. package/dist/cjs/salla-maintenance-alert.cjs.entry.js +1 -1
  54. package/dist/cjs/salla-map_3.cjs.entry.js +1 -1
  55. package/dist/cjs/salla-menu.cjs.entry.js +1 -1
  56. package/dist/cjs/salla-metadata.cjs.entry.js +1 -1
  57. package/dist/cjs/salla-multiple-bundle-product-cart_2.cjs.entry.js +1 -1
  58. package/dist/cjs/salla-multiple-bundle-product-options-modal_2.cjs.entry.js +1 -1
  59. package/dist/cjs/salla-multiple-bundle-product.cjs.entry.js +1 -1
  60. package/dist/cjs/salla-next-order-coupon.cjs.entry.js +1 -1
  61. package/dist/cjs/salla-notification-item_2.cjs.entry.js +1 -1
  62. package/dist/cjs/salla-offer-modal.cjs.entry.js +1 -1
  63. package/dist/cjs/salla-offer.cjs.entry.js +1 -1
  64. package/dist/cjs/salla-order-branch.cjs.entry.js +1 -1
  65. package/dist/cjs/salla-order-cancel.cjs.entry.js +1 -1
  66. package/dist/cjs/salla-order-details-multiple-bundle-product.cjs.entry.js +1 -1
  67. package/dist/cjs/salla-order-details-options.cjs.entry.js +1 -1
  68. package/dist/cjs/salla-order-details.cjs.entry.js +1 -1
  69. package/dist/cjs/salla-order-edit-item.cjs.entry.js +1 -1
  70. package/dist/cjs/salla-order-edit-product-card.cjs.entry.js +1 -1
  71. package/dist/cjs/salla-order-edit.cjs.entry.js +1 -1
  72. package/dist/cjs/salla-order-options-modal.cjs.entry.js +1 -1
  73. package/dist/cjs/salla-order-shipments.cjs.entry.js +1 -1
  74. package/dist/cjs/salla-order-summary.cjs.entry.js +1 -1
  75. package/dist/cjs/salla-order-totals-card.cjs.entry.js +1 -1
  76. package/dist/cjs/salla-orders.cjs.entry.js +1 -1
  77. package/dist/cjs/salla-payments.cjs.entry.js +1 -1
  78. package/dist/cjs/salla-placeholder.cjs.entry.js +1 -1
  79. package/dist/cjs/salla-price-range.cjs.entry.js +1 -1
  80. package/dist/cjs/salla-product-card-embed.cjs.entry.js +1 -1
  81. package/dist/cjs/salla-product-card.cjs.entry.js +1 -1
  82. package/dist/cjs/salla-product-size-guide.cjs.entry.js +1 -1
  83. package/dist/cjs/salla-products-list.cjs.entry.js +1 -1
  84. package/dist/cjs/salla-products-slider.cjs.entry.js +1 -1
  85. package/dist/cjs/salla-quick-order.cjs.entry.js +1 -1
  86. package/dist/cjs/salla-rating-modal-v2.cjs.entry.js +1 -1
  87. package/dist/cjs/salla-rating-modal.cjs.entry.js +1 -1
  88. package/dist/cjs/salla-review-factors-tags.cjs.entry.js +1 -1
  89. package/dist/cjs/salla-review-order-item.cjs.entry.js +1 -1
  90. package/dist/cjs/salla-scopes.cjs.entry.js +1 -1
  91. package/dist/cjs/salla-search-product-card.cjs.entry.js +1 -1
  92. package/dist/cjs/salla-search.cjs.entry.js +1 -1
  93. package/dist/cjs/salla-skeleton.cjs.entry.js +1 -1
  94. package/dist/cjs/salla-social-share.cjs.entry.js +1 -1
  95. package/dist/cjs/salla-social.cjs.entry.js +1 -1
  96. package/dist/cjs/salla-tab-content_3.cjs.entry.js +1 -1
  97. package/dist/cjs/salla-tiered-offer.cjs.entry.js +1 -1
  98. package/dist/cjs/salla-trust-badges.cjs.entry.js +1 -1
  99. package/dist/cjs/salla-user-menu.cjs.entry.js +1 -1
  100. package/dist/cjs/salla-user-profile.cjs.entry.js +1 -1
  101. package/dist/cjs/salla-user-settings.cjs.entry.js +1 -1
  102. package/dist/cjs/salla-verify.cjs.entry.js +1 -1
  103. package/dist/cjs/salla-wallet.cjs.entry.js +1 -1
  104. package/dist/cjs/salla-wishlist-actions.cjs.entry.js +1 -1
  105. package/dist/cjs/salla-wishlist-summary.cjs.entry.js +1 -1
  106. package/dist/cjs/twilight.cjs.js +1 -1
  107. package/dist/cjs/{vanilla-picker-B1VZNdgU.js → vanilla-picker-CH_Iyxix.js} +1 -1
  108. package/dist/collection/components/salla-product-options/salla-product-options.js +2 -1
  109. package/dist/components/index.js +2 -2
  110. package/dist/components/salla-product-options2.js +2 -1
  111. package/dist/docs.json +1 -1
  112. package/dist/esm/{filepond-plugin-file-poster-jGgGDPBM.js → filepond-plugin-file-poster--16HTX86.js} +1 -1
  113. package/dist/esm/{filepond-plugin-file-validate-size-CMRY86Hb.js → filepond-plugin-file-validate-size-B5mzqY24.js} +1 -1
  114. package/dist/esm/{filepond-plugin-file-validate-type-BJT5d0-6.js → filepond-plugin-file-validate-type-I07woW17.js} +1 -1
  115. package/dist/esm/{filepond-plugin-image-edit-CUgUFKuf.js → filepond-plugin-image-edit-DXu1jmsW.js} +1 -1
  116. package/dist/esm/{filepond-plugin-image-exif-orientation-Cpgh0C9U.js → filepond-plugin-image-exif-orientation-Bc1VQAhJ.js} +1 -1
  117. package/dist/esm/{filepond-plugin-image-preview-Cdldbg2V.js → filepond-plugin-image-preview-BzP3T1zn.js} +1 -1
  118. package/dist/esm/{filepond-JvmG37vk.js → filepond-xXe4bB-l.js} +1 -1
  119. package/dist/esm/{index-DSmjBlMI.js → index-Z_0e-eaG.js} +2 -2
  120. package/dist/esm/{intlTelInput-rTSCUyZk.js → intlTelInput-BWfs2527.js} +1 -1
  121. package/dist/esm/loader.js +2 -2
  122. package/dist/esm/salla-accordion-body_2.entry.js +1 -1
  123. package/dist/esm/salla-accordion_6.entry.js +1 -1
  124. package/dist/esm/salla-add-product-button_5.entry.js +3 -2
  125. package/dist/esm/salla-advertisement.entry.js +1 -1
  126. package/dist/esm/salla-alert_2.entry.js +1 -1
  127. package/dist/esm/salla-app-install-alert.entry.js +1 -1
  128. package/dist/esm/salla-applied-filters.entry.js +1 -1
  129. package/dist/esm/salla-apps-icons.entry.js +1 -1
  130. package/dist/esm/salla-attachment-view_9.entry.js +10 -10
  131. package/dist/esm/salla-badge.entry.js +1 -1
  132. package/dist/esm/salla-basket-gap.entry.js +1 -1
  133. package/dist/esm/salla-bullet-delivery_3.entry.js +1 -1
  134. package/dist/esm/salla-cart-coupons.entry.js +1 -1
  135. package/dist/esm/salla-cart-item-offers_2.entry.js +1 -1
  136. package/dist/esm/salla-cart-summary-card.entry.js +1 -1
  137. package/dist/esm/salla-cashback-banner.entry.js +1 -1
  138. package/dist/esm/salla-comment-factors.entry.js +1 -1
  139. package/dist/esm/salla-comment-form_9.entry.js +1 -1
  140. package/dist/esm/salla-conditional-offer.entry.js +1 -1
  141. package/dist/esm/salla-contacts.entry.js +1 -1
  142. package/dist/esm/salla-cookies-bar.entry.js +1 -1
  143. package/dist/esm/salla-count-down.entry.js +1 -1
  144. package/dist/esm/salla-custom-fields.entry.js +1 -1
  145. package/dist/esm/salla-delivery-promise.entry.js +1 -1
  146. package/dist/esm/salla-edit-order-button.entry.js +1 -1
  147. package/dist/esm/salla-filters-widget.entry.js +1 -1
  148. package/dist/esm/salla-filters.entry.js +1 -1
  149. package/dist/esm/salla-fulfillment-methods.entry.js +1 -1
  150. package/dist/esm/salla-gift-card-redeem_2.entry.js +1 -1
  151. package/dist/esm/salla-gifting.entry.js +1 -1
  152. package/dist/esm/salla-hook.entry.js +1 -1
  153. package/dist/esm/salla-infinite-scroll.entry.js +1 -1
  154. package/dist/esm/salla-installment.entry.js +1 -1
  155. package/dist/esm/salla-list-tile.entry.js +1 -1
  156. package/dist/esm/salla-localization-modal.entry.js +1 -1
  157. package/dist/esm/salla-login-modal.entry.js +1 -1
  158. package/dist/esm/salla-loyalty-banner_10.entry.js +1 -1
  159. package/dist/esm/salla-loyalty-exchange-product-card.entry.js +1 -1
  160. package/dist/esm/salla-loyalty-points-banner.entry.js +1 -1
  161. package/dist/esm/salla-loyalty-points-history.entry.js +1 -1
  162. package/dist/esm/salla-loyalty-prize-item.entry.js +1 -1
  163. package/dist/esm/salla-loyalty.entry.js +1 -1
  164. package/dist/esm/salla-maintenance-alert.entry.js +1 -1
  165. package/dist/esm/salla-map_3.entry.js +1 -1
  166. package/dist/esm/salla-menu.entry.js +1 -1
  167. package/dist/esm/salla-metadata.entry.js +1 -1
  168. package/dist/esm/salla-multiple-bundle-product-cart_2.entry.js +1 -1
  169. package/dist/esm/salla-multiple-bundle-product-options-modal_2.entry.js +1 -1
  170. package/dist/esm/salla-multiple-bundle-product.entry.js +1 -1
  171. package/dist/esm/salla-next-order-coupon.entry.js +1 -1
  172. package/dist/esm/salla-notification-item_2.entry.js +1 -1
  173. package/dist/esm/salla-offer-modal.entry.js +1 -1
  174. package/dist/esm/salla-offer.entry.js +1 -1
  175. package/dist/esm/salla-order-branch.entry.js +1 -1
  176. package/dist/esm/salla-order-cancel.entry.js +1 -1
  177. package/dist/esm/salla-order-details-multiple-bundle-product.entry.js +1 -1
  178. package/dist/esm/salla-order-details-options.entry.js +1 -1
  179. package/dist/esm/salla-order-details.entry.js +1 -1
  180. package/dist/esm/salla-order-edit-item.entry.js +1 -1
  181. package/dist/esm/salla-order-edit-product-card.entry.js +1 -1
  182. package/dist/esm/salla-order-edit.entry.js +1 -1
  183. package/dist/esm/salla-order-options-modal.entry.js +1 -1
  184. package/dist/esm/salla-order-shipments.entry.js +1 -1
  185. package/dist/esm/salla-order-summary.entry.js +1 -1
  186. package/dist/esm/salla-order-totals-card.entry.js +1 -1
  187. package/dist/esm/salla-orders.entry.js +1 -1
  188. package/dist/esm/salla-payments.entry.js +1 -1
  189. package/dist/esm/salla-placeholder.entry.js +1 -1
  190. package/dist/esm/salla-price-range.entry.js +1 -1
  191. package/dist/esm/salla-product-card-embed.entry.js +1 -1
  192. package/dist/esm/salla-product-card.entry.js +1 -1
  193. package/dist/esm/salla-product-size-guide.entry.js +1 -1
  194. package/dist/esm/salla-products-list.entry.js +1 -1
  195. package/dist/esm/salla-products-slider.entry.js +1 -1
  196. package/dist/esm/salla-quick-order.entry.js +1 -1
  197. package/dist/esm/salla-rating-modal-v2.entry.js +1 -1
  198. package/dist/esm/salla-rating-modal.entry.js +1 -1
  199. package/dist/esm/salla-review-factors-tags.entry.js +1 -1
  200. package/dist/esm/salla-review-order-item.entry.js +1 -1
  201. package/dist/esm/salla-scopes.entry.js +1 -1
  202. package/dist/esm/salla-search-product-card.entry.js +1 -1
  203. package/dist/esm/salla-search.entry.js +1 -1
  204. package/dist/esm/salla-skeleton.entry.js +1 -1
  205. package/dist/esm/salla-social-share.entry.js +1 -1
  206. package/dist/esm/salla-social.entry.js +1 -1
  207. package/dist/esm/salla-tab-content_3.entry.js +1 -1
  208. package/dist/esm/salla-tiered-offer.entry.js +1 -1
  209. package/dist/esm/salla-trust-badges.entry.js +1 -1
  210. package/dist/esm/salla-user-menu.entry.js +1 -1
  211. package/dist/esm/salla-user-profile.entry.js +1 -1
  212. package/dist/esm/salla-user-settings.entry.js +1 -1
  213. package/dist/esm/salla-verify.entry.js +1 -1
  214. package/dist/esm/salla-wallet.entry.js +1 -1
  215. package/dist/esm/salla-wishlist-actions.entry.js +1 -1
  216. package/dist/esm/salla-wishlist-summary.entry.js +1 -1
  217. package/dist/esm/twilight.js +2 -2
  218. package/dist/esm/{vanilla-picker-iVAMFnQg.js → vanilla-picker-J18A-voz.js} +1 -1
  219. package/dist/twilight/{p-35c24f9b.entry.js → p-0b1e0a8d.entry.js} +1 -1
  220. package/dist/twilight/{p-5d6f3385.entry.js → p-0d4e0fb5.entry.js} +1 -1
  221. package/dist/twilight/{p-9bc7224c.entry.js → p-0fdf8008.entry.js} +1 -1
  222. package/dist/twilight/{p-b0fee4fb.entry.js → p-105f55a2.entry.js} +1 -1
  223. package/dist/twilight/{p-74adaa0a.entry.js → p-12e07c6c.entry.js} +1 -1
  224. package/dist/twilight/{p-abb407ae.entry.js → p-15319e31.entry.js} +1 -1
  225. package/dist/twilight/{p-eee8f72b.entry.js → p-1545c99f.entry.js} +1 -1
  226. package/dist/twilight/{p-f5b6fa9b.entry.js → p-19e9233d.entry.js} +1 -1
  227. package/dist/twilight/{p-ed565db7.entry.js → p-1acc6f56.entry.js} +1 -1
  228. package/dist/twilight/{p-755531d0.entry.js → p-1c5d0944.entry.js} +1 -1
  229. package/dist/twilight/{p-ee8320af.entry.js → p-225695d4.entry.js} +1 -1
  230. package/dist/twilight/{p-2f54b8ca.entry.js → p-238fb194.entry.js} +1 -1
  231. package/dist/twilight/{p-8ef1dc8b.entry.js → p-2aaa79f0.entry.js} +1 -1
  232. package/dist/twilight/{p-5350007d.entry.js → p-2b10a3ab.entry.js} +1 -1
  233. package/dist/twilight/{p-f0deaa3e.entry.js → p-2cf6fb59.entry.js} +1 -1
  234. package/dist/twilight/{p-f77eb8de.entry.js → p-2eb4c7be.entry.js} +1 -1
  235. package/dist/twilight/{p-b0c853b7.entry.js → p-377ba8f8.entry.js} +1 -1
  236. package/dist/twilight/{p-ae44240d.entry.js → p-3c5142ca.entry.js} +1 -1
  237. package/dist/twilight/{p-553c0419.entry.js → p-3d2a0139.entry.js} +1 -1
  238. package/dist/twilight/{p-41f562d9.entry.js → p-3d515755.entry.js} +1 -1
  239. package/dist/twilight/{p-92465380.entry.js → p-43d646ab.entry.js} +1 -1
  240. package/dist/twilight/{p-c4e8176e.entry.js → p-4c10d596.entry.js} +1 -1
  241. package/dist/twilight/{p-7907b963.entry.js → p-4c93fe19.entry.js} +1 -1
  242. package/dist/twilight/{p-2b7369bc.entry.js → p-4d734cab.entry.js} +1 -1
  243. package/dist/twilight/{p-31e7a0e2.entry.js → p-4eefd6ce.entry.js} +1 -1
  244. package/dist/twilight/{p-6a575b79.entry.js → p-51e83443.entry.js} +1 -1
  245. package/dist/twilight/{p-16e37ff7.entry.js → p-5304544d.entry.js} +1 -1
  246. package/dist/twilight/{p-62385bca.entry.js → p-53da81e4.entry.js} +1 -1
  247. package/dist/twilight/{p-13cdee67.entry.js → p-54e43cb7.entry.js} +1 -1
  248. package/dist/twilight/{p-bcdcd436.entry.js → p-5765a016.entry.js} +1 -1
  249. package/dist/twilight/{p-deea89b5.entry.js → p-5ba22cda.entry.js} +1 -1
  250. package/dist/twilight/{p-8980ba07.entry.js → p-5db3ccda.entry.js} +1 -1
  251. package/dist/twilight/{p-b76f6fc0.entry.js → p-60c4fcd8.entry.js} +1 -1
  252. package/dist/twilight/{p-13f398a0.entry.js → p-66a54ce6.entry.js} +1 -1
  253. package/dist/twilight/{p-f8dab034.entry.js → p-670a6d5d.entry.js} +1 -1
  254. package/dist/twilight/{p-5b34d547.entry.js → p-67c14cd2.entry.js} +1 -1
  255. package/dist/twilight/{p-198cb6fe.entry.js → p-6a4c670e.entry.js} +1 -1
  256. package/dist/twilight/{p-454937a1.entry.js → p-6a5cac73.entry.js} +1 -1
  257. package/dist/twilight/{p-1705a030.entry.js → p-6b0aacca.entry.js} +1 -1
  258. package/dist/twilight/{p-816f0d62.entry.js → p-74145595.entry.js} +1 -1
  259. package/dist/twilight/{p-9cfeb373.entry.js → p-7573f352.entry.js} +1 -1
  260. package/dist/twilight/{p-1f694f35.entry.js → p-75f4a9ef.entry.js} +1 -1
  261. package/dist/twilight/p-766fa83f.entry.js +4 -0
  262. package/dist/twilight/{p-dc2ec98d.entry.js → p-7849b724.entry.js} +1 -1
  263. package/dist/twilight/{p-f94f0b87.entry.js → p-795066f7.entry.js} +1 -1
  264. package/dist/twilight/{p-3efbe99f.entry.js → p-7aa443f6.entry.js} +1 -1
  265. package/dist/twilight/{p-7171284c.entry.js → p-7eaf3217.entry.js} +1 -1
  266. package/dist/twilight/{p-ae6681e4.entry.js → p-82887781.entry.js} +1 -1
  267. package/dist/twilight/{p-c0990882.entry.js → p-845fc00b.entry.js} +1 -1
  268. package/dist/twilight/{p-d960fb5d.entry.js → p-85bf3602.entry.js} +1 -1
  269. package/dist/twilight/{p-fc601cb7.entry.js → p-88838f90.entry.js} +1 -1
  270. package/dist/twilight/{p-49f793f5.entry.js → p-8fd45966.entry.js} +1 -1
  271. package/dist/twilight/{p-79d531c1.entry.js → p-8fdb99e3.entry.js} +1 -1
  272. package/dist/twilight/{p-10173408.entry.js → p-9439a31c.entry.js} +1 -1
  273. package/dist/twilight/{p-49f9674d.entry.js → p-95b9f420.entry.js} +1 -1
  274. package/dist/twilight/{p-d385497e.entry.js → p-9be52d88.entry.js} +1 -1
  275. package/dist/twilight/{p-91d886a4.entry.js → p-9c9cfc5b.entry.js} +1 -1
  276. package/dist/twilight/{p-BZAgJW8r.js → p-ARTVPDpi.js} +1 -1
  277. package/dist/twilight/{p-Cwn0juZl.js → p-C7e4koVc.js} +2 -2
  278. package/dist/twilight/{p-kJZlJJjc.js → p-CJQ21QXm.js} +1 -1
  279. package/dist/twilight/{p-DKq36Aat.js → p-CVAB0Gy1.js} +1 -1
  280. package/dist/twilight/{p-lcuQmP0A.js → p-CZ7D9I3L.js} +1 -1
  281. package/dist/twilight/{p-H48_b2OW.js → p-DBG3-uK6.js} +1 -1
  282. package/dist/twilight/{p-BdfIR_j4.js → p-DnaxNcAS.js} +1 -1
  283. package/dist/twilight/{p-CiToackV.js → p-DskB2ZaU.js} +1 -1
  284. package/dist/twilight/{p-DSmjBlMI.js → p-Z_0e-eaG.js} +1 -1
  285. package/dist/twilight/{p-bdc6aaf3.entry.js → p-a250d588.entry.js} +1 -1
  286. package/dist/twilight/{p-4b398039.entry.js → p-a2523582.entry.js} +1 -1
  287. package/dist/twilight/{p-e345dcc6.entry.js → p-a40faf66.entry.js} +1 -1
  288. package/dist/twilight/{p-f17570e7.entry.js → p-ae2df76a.entry.js} +1 -1
  289. package/dist/twilight/{p-3ab4a96c.entry.js → p-b5d49886.entry.js} +1 -1
  290. package/dist/twilight/{p-b996fb98.entry.js → p-b9eea7b7.entry.js} +1 -1
  291. package/dist/twilight/{p-1bca57e0.entry.js → p-ba33e7d0.entry.js} +1 -1
  292. package/dist/twilight/{p-f0812a46.entry.js → p-baa27a89.entry.js} +1 -1
  293. package/dist/twilight/{p-8db01cb9.entry.js → p-bda08bda.entry.js} +1 -1
  294. package/dist/twilight/{p-b8dcc622.entry.js → p-be4d41b6.entry.js} +1 -1
  295. package/dist/twilight/{p-3337976e.entry.js → p-c082649d.entry.js} +1 -1
  296. package/dist/twilight/{p-94f05c52.entry.js → p-c0c24914.entry.js} +1 -1
  297. package/dist/twilight/{p-9d458fdc.entry.js → p-c4b8d829.entry.js} +1 -1
  298. package/dist/twilight/{p-f7d7ffa2.entry.js → p-c6f8e7b2.entry.js} +1 -1
  299. package/dist/twilight/{p-754b773f.entry.js → p-c7680554.entry.js} +1 -1
  300. package/dist/twilight/{p-de8ff550.entry.js → p-cbdd7190.entry.js} +1 -1
  301. package/dist/twilight/{p-3af02a2e.entry.js → p-cc325559.entry.js} +1 -1
  302. package/dist/twilight/{p-106e4c00.entry.js → p-cd8c3792.entry.js} +1 -1
  303. package/dist/twilight/{p-269aaae6.entry.js → p-d08d194a.entry.js} +1 -1
  304. package/dist/twilight/{p-f220b5b5.entry.js → p-d11cd0e5.entry.js} +1 -1
  305. package/dist/twilight/{p-819ecf01.entry.js → p-d249e166.entry.js} +1 -1
  306. package/dist/twilight/{p-b90cc416.entry.js → p-d53bdb65.entry.js} +1 -1
  307. package/dist/twilight/{p-22d7efce.entry.js → p-d65485cf.entry.js} +1 -1
  308. package/dist/twilight/{p-7a3de00e.entry.js → p-d7d9bcf1.entry.js} +1 -1
  309. package/dist/twilight/{p-1e48420f.entry.js → p-d8dd3737.entry.js} +1 -1
  310. package/dist/twilight/{p-d9eb567c.entry.js → p-da6f9fcf.entry.js} +1 -1
  311. package/dist/twilight/{p-3deaae96.entry.js → p-de3548d9.entry.js} +1 -1
  312. package/dist/twilight/{p-2291b12c.entry.js → p-dffa5133.entry.js} +1 -1
  313. package/dist/twilight/{p-2b82b2e7.entry.js → p-e29a5e11.entry.js} +1 -1
  314. package/dist/twilight/{p-2f7cced2.entry.js → p-e83c621c.entry.js} +1 -1
  315. package/dist/twilight/{p-4deebc34.entry.js → p-e8ba21c3.entry.js} +1 -1
  316. package/dist/twilight/{p-b753bcde.entry.js → p-f1c0631e.entry.js} +1 -1
  317. package/dist/twilight/{p-5541311c.entry.js → p-f3400329.entry.js} +1 -1
  318. package/dist/twilight/{p-b3b5b350.entry.js → p-f9f758e6.entry.js} +1 -1
  319. package/dist/twilight/{p-c884d66b.entry.js → p-f9f89c27.entry.js} +1 -1
  320. package/dist/twilight/{p-DAZtN2b7.js → p-fYZlWuHl.js} +1 -1
  321. package/dist/twilight/{p-285e3792.entry.js → p-fb505973.entry.js} +1 -1
  322. package/dist/twilight/{p-b9c70014.entry.js → p-fd020871.entry.js} +1 -1
  323. package/dist/twilight/{p-7e65d967.entry.js → p-fded2f48.entry.js} +1 -1
  324. package/dist/twilight/twilight.esm.js +1 -1
  325. package/package.json +5 -5
  326. package/dist/twilight/p-3204cc50.entry.js +0 -4
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r as t,h as o,H as r,a}from"./p-DSmjBlMI.js";const s=class{constructor(o){t(this,o),this.availableCoupons=[],this.cartTotal=0,this.cartTotalReady=!1,this.currentCoupon="",this.couponInputValue="",this.couponError="",this.isApplying=!1,this.appliedCoupons=[],this.mergedCoupons=[],this.appliedCouponCards=[],this.orderLocked=!1,this.multiCoupon=!1,this.isHandlingInternalError=!1,this.cartUpdatedHandler=t=>{this.syncCartTotal(t),(this.multiCoupon?Array.isArray(t?.coupons):t&&("coupon"in t||"cashback_code"in t))?this.syncAppliedFromCart(t):this.multiCoupon&&t&&"cashback_code"in t&&this.mergeCashbackCodeChip(t.cashback_code),this.couponError=""},this.couponAddedHandler=()=>{this.isApplying||this.isHandlingInternalError||this.refreshFromServer()},this.couponAdditionFailedHandler=t=>{this.isApplying||this.isHandlingInternalError||this.showCouponError(t?.message||salla.lang.get("pages.cart.coupon_application_error"))},this.couponDeletedHandler=()=>{this.isApplying||this.isHandlingInternalError||this.refreshFromServer()},this.onKeyUp=t=>{"Enter"===t.key&&this.couponButtonRef?.click(),this.couponError=""},this.onInput=t=>{this.couponInputValue=t.target.value},this.mergedCashbackCode=""}async componentWillLoad(){await Salla.onReady(),await Salla.lang.onLoaded(),this.multiCoupon=!!salla.config.get("store.settings.cart.multi_coupon"),this.loadCouponsData(),this.seedFromStorage(),this.loadCartTotal(),this.setupCartEventListeners()}setupCartEventListeners(){salla.event.on("cart::updated",this.cartUpdatedHandler),salla.event.on("cart::coupon.added",this.couponAddedHandler),salla.event.on("cart::coupon.addition.failed",this.couponAdditionFailedHandler),salla.event.on("cart::coupon.deleted",this.couponDeletedHandler)}disconnectedCallback(){salla.event.off("cart::updated",this.cartUpdatedHandler),salla.event.off("cart::coupon.added",this.couponAddedHandler),salla.event.off("cart::coupon.addition.failed",this.couponAdditionFailedHandler),salla.event.off("cart::coupon.deleted",this.couponDeletedHandler)}async selectCoupon(t){const o=this.availableCoupons.find((o=>o.code===t));if(o){if(!this.isEligible(o))throw new Error("Coupon not eligible: minimum cart amount not met");try{await this.applyCoupon(t),this.host.dispatchEvent(new CustomEvent("salla::cart-coupons.coupon.selected",{detail:o,bubbles:!0}))}catch(t){throw t}}return o}async loadCouponsData(){try{const t=await salla.api.request("coupons"),o=t?.data,r=Array.isArray(o)?o:Array.isArray(o?.data)?o.data:[];this.availableCoupons=r}catch(t){console.warn("Failed to load coupons:",t),this.availableCoupons=[]}this.buildMergedCoupons()}async loadCartTotal(){await this.refreshFromServer()}seedFromStorage(){if(this.multiCoupon)return;const t=salla.storage.get("cart");t&&"object"==typeof t&&"coupon"in t&&this.applyCart(t),this.seedTotalsFromSummaryStorage()}seedTotalsFromSummaryStorage(){const t=salla.storage.get("cart.summary");t&&"object"==typeof t&&null!=t.sub_total&&(this.cartTotal=Number(t.sub_total),this.cartTotalReady=!0)}syncCartTotal(t){const o=t?.summary?.sub_total??t?.sub_total??t?.total;null!=o&&(this.cartTotal=Number(o),this.cartTotalReady=!0)}async refreshFromServer(){try{const t=await salla.cart.details(),o=t?.data?.cart??t?.data??t;if(o&&"object"==typeof o&&(Array.isArray(o.coupons)||"coupon"in o||"cashback_code"in o))return void this.applyCart(o)}catch(t){}const t=salla.storage.get("cart");t&&this.applyCart(t),this.seedTotalsFromSummaryStorage()}applyCart(t){this.syncCartTotal(t),this.syncAppliedFromCart(t)}mergeCashbackCodeChip(t){const o=(t||"").trim(),r=(this.mergedCashbackCode||"").trim();if(o.toLowerCase()===r.toLowerCase())return;const a=r?this.appliedCoupons.filter((t=>(t||"").toLowerCase()!==r.toLowerCase())):[...this.appliedCoupons],s=a.some((t=>(t||"").toLowerCase()===o.toLowerCase()));this.appliedCoupons=o&&!s?[...a,o]:a,this.mergedCashbackCode=o,r&&this.currentCoupon.toLowerCase()===r.toLowerCase()?this.currentCoupon=o:o&&(this.currentCoupon=this.currentCoupon||o),this.buildMergedCoupons()}syncAppliedFromCart(t){if(this.currentCoupon=t?.coupon||t?.cashback_code||"",this.mergedCashbackCode=(t?.cashback_code||"").trim(),this.multiCoupon){const o=Array.isArray(t?.coupons)?t.coupons:[t?.coupon];this.appliedCoupons=[...o,t?.cashback_code].filter(Boolean);const r=t?.applied_coupons;return this.appliedCouponCards=Array.isArray(r)?r.filter(Boolean):r&&"object"==typeof r?Object.values(r).filter(Boolean):[],void this.buildMergedCoupons()}this.couponInputValue=this.currentCoupon,this.appliedCoupons=this.currentCoupon?[this.currentCoupon]:[],this.buildMergedCoupons()}buildMergedCoupons(){if(!this.multiCoupon)return void(this.mergedCoupons=[]);const t=this.appliedCoupons.filter(Boolean),o=new Set(t),r=new Map(this.availableCoupons.map((t=>[t.code,t]))),a=new Map(r);this.appliedCouponCards.forEach((t=>{t?.code&&!a.has(t.code)&&a.set(t.code,t)}));const s=this.orderLocked?this.mergeIntoLockedOrder(t,r,(t=>o.has(t)||r.has(t))):[...t,...this.availableCoupons.map((t=>t.code)).filter((t=>!o.has(t)))];this.mergedCoupons=s.map((t=>({code:t,coupon:a.get(t)??null,applied:o.has(t)})))}mergeIntoLockedOrder(t,o,r){const a=this.mergedCoupons.map((t=>t.code)).filter(r),s=new Set(a),i=t.filter((t=>!s.has(t)));i.forEach((t=>s.add(t)));const e=[...o.keys()].filter((t=>!s.has(t)));return[...i,...a,...e]}lockOrder(){this.orderLocked=!0}async handleApplyClick(){if(this.isApplying)return;const t=this.couponInputValue.trim();if(t){this.lockOrder(),this.isApplying=!0,this.isHandlingInternalError=!0;try{await salla.cart.addCoupon(t),await this.refreshFromServer(),this.couponInputValue=""}catch(t){this.showCouponError(t.response?.data?.error?.message||salla.lang.get("pages.cart.coupon_application_error"))}finally{this.isApplying=!1,setTimeout((()=>{this.isHandlingInternalError=!1}),100)}}else this.showCouponError(salla.lang.get("pages.cart.enter_coupon_code"))}async handleCouponButtonClick(){if(this.isApplying)return;const t=!!this.currentCoupon;if(t||this.couponInputValue.trim()){this.isApplying=!0,this.isHandlingInternalError=!0;try{t?await salla.cart.deleteCoupon():await salla.cart.addCoupon(this.couponInputValue.trim()),await this.refreshFromServer()}catch(t){this.showCouponError(t.response?.data?.error?.message||salla.lang.get("pages.cart.coupon_application_error"))}finally{this.isApplying=!1,setTimeout((()=>{this.isHandlingInternalError=!1}),100)}}else this.showCouponError(salla.lang.get("pages.cart.enter_coupon_code"))}async removeCoupon(t){if(!this.isApplying){this.lockOrder(),this.isApplying=!0,this.isHandlingInternalError=!0;try{this.multiCoupon?await salla.cart.deleteCoupon(t):await salla.cart.deleteCoupon(),await this.refreshFromServer()}catch(t){this.showCouponError(t.response?.data?.error?.message||salla.lang.get("pages.cart.coupon_application_error"))}finally{this.isApplying=!1,setTimeout((()=>{this.isHandlingInternalError=!1}),100)}}}showCouponError(t){this.couponError=t}handleCouponClick(t){this.applyCoupon(t.code,!1).catch((()=>{}))}async applyCoupon(t,o=!0){if(this.isApplying){if(o)throw new Error("Coupon application already in progress")}else{this.lockOrder(),this.couponInputValue=t,this.couponError="",this.isApplying=!0,this.isHandlingInternalError=!0;try{await salla.cart.addCoupon(t.trim()),await this.refreshFromServer(),this.multiCoupon&&(this.couponInputValue="")}catch(t){if(this.showCouponError(t.response?.data?.error?.message||salla.lang.get("pages.cart.coupon_application_error")),o)throw t}finally{this.isApplying=!1,setTimeout((()=>{this.isHandlingInternalError=!1}),100)}}}formatMainAmount(t){if("percentage"===t.type)return`${salla.helpers.number("object"==typeof t.amount?t.amount.amount:t.amount)}%`;{const r="object"==typeof t.amount?t.amount:{amount:t.amount,currency:t.minimum_amount?.currency||salla.config.get("store.currency.code","SAR")};return o("span",{innerHTML:salla.money(r.amount,r.currency)})}}isEligible(t){return!this.cartTotalReady||!t.minimum_amount||this.cartTotal>=parseFloat(t.minimum_amount.amount)}renderCouponCard(t){const{coupon:r,applied:a,code:s}=t;if(!r)return this.renderMinimalCard(s);const i=this.isEligible(r);return o("div",{class:"s-cart-coupons-slide-one-fourth swiper-slide"},o("div",{class:`s-cart-coupons-card ${a?"s-cart-coupons-card--applied":""} ${a||i&&!this.isApplying?"":"s-cart-coupons-disabled"}`,onClick:()=>!a&&i&&!this.isApplying&&this.handleCouponClick(r)},o("div",{class:"s-cart-coupons-top-section"},o("div",{class:"s-cart-coupons-discount-values"},o("div",{class:"s-cart-coupons-main-amount"},this.formatMainAmount(r)),r.free_shipping?o("div",{class:"s-cart-coupons-secondary-info"},"+ ",salla.lang.get("pages.cart.free_shipping")):r.maximum_amount&&o("div",{class:"s-cart-coupons-secondary-info"},salla.lang.get("pages.cart.up_to")," ",o("span",{innerHTML:salla.money(r.maximum_amount.amount,r.maximum_amount.currency)}))),o("div",{class:"s-cart-coupons-code"},r.code)),o("div",{class:"s-cart-coupons-divider"}),o("div",{class:"s-cart-coupons-bottom-section"},o("div",{class:"s-cart-coupons-terms"},null!=r.remaining_days&&o("div",{class:"s-cart-coupons-expiry "+(r.remaining_days<=3?"s-cart-coupons-expiry-warning":"")},0===r.remaining_days?salla.lang.get("pages.cart.expires_today"):`${salla.lang.get("pages.cart.expires_after")} ${r.remaining_days} ${salla.lang.get("pages.cart.day")}`),r.minimum_amount&&parseFloat(r.minimum_amount.amount)>0&&o("div",{class:"s-cart-coupons-minimum"},salla.lang.get("pages.cart.minimum")," ",o("span",{innerHTML:salla.money(r.minimum_amount.amount,r.minimum_amount.currency)}))),o("div",{class:"s-cart-coupons-action"},a?this.renderAppliedAction(s):i?salla.lang.get("pages.cart.save_coupon"):salla.lang.get("pages.cart.coupon_not_compatible")))))}renderAppliedAction(t){return[o("span",{class:"s-cart-coupons-card-applied-label"},salla.lang.get("pages.cart.coupon_applied")),o("button",{type:"button",class:"s-cart-coupons-card-remove","aria-label":`${salla.lang.get("pages.cart.delete_coupon")} ${t}`,disabled:this.isApplying,onClick:o=>{o.stopPropagation(),this.removeCoupon(t)}},salla.lang.get("pages.cart.cancel"))]}renderMinimalCard(t){return o("div",{class:"s-cart-coupons-slide-one-fourth swiper-slide"},o("div",{class:"s-cart-coupons-card s-cart-coupons-card--applied s-cart-coupons-card--minimal"},o("div",{class:"s-cart-coupons-top-section"},o("div",{class:"s-cart-coupons-code s-cart-coupons-code--only"},t)),o("div",{class:"s-cart-coupons-divider"}),o("div",{class:"s-cart-coupons-bottom-section"},o("div",{class:"s-cart-coupons-action"},this.renderAppliedAction(t)))))}couponRow(){return this.multiCoupon?this.mergedCoupons:(this.availableCoupons||[]).map((t=>({code:t.code,coupon:t,applied:!1})))}render(){const t=this.couponRow();return o(r,{key:"79d820f5931ca33571e6897f4e5a09413e02cf96"},o("div",{key:"7c55aa93e8f4bc44c76606e1af4cb593cab0e7b2",class:"s-cart-coupons-wrapper"},o("div",{key:"7deee9dc280b91008c9f29eab2c7dbb42fb4d586",class:"s-cart-coupons-input-section"},o("label",{key:"f4362e77c3031c8bdacdbd0bd126f7df3c973583",htmlFor:"coupon-input",class:"s-cart-coupons-coupon-label"},salla.lang.get("pages.cart.have_coupon")),o("div",{key:"631dce1aeb71c6bfc80d00869c0974ffedb3f932",class:"s-cart-coupons-coupon-input-container"},this.multiCoupon?[o("input",{type:"text",id:"coupon-input",name:"coupon",class:"form-input "+(this.couponError?"s-coupon-input-error":""),placeholder:salla.lang.get("pages.cart.coupon_placeholder"),value:this.couponInputValue,disabled:this.isApplying,onInput:this.onInput,onKeyUp:this.onKeyUp,"aria-label":salla.lang.get("pages.cart.apply_coupon"),key:"coupon-input"}),o("salla-button",{ref:t=>this.couponButtonRef=t,class:"s-cart-coupons-coupon-button s-cart-coupons-coupon-button-apply",color:"primary",loading:this.isApplying,"loader-position":"center",onClick:()=>this.handleApplyClick(),key:"apply-button"},o("span",null,salla.lang.get("pages.cart.save_coupon")))]:[o("input",{type:"text",id:"coupon-input",name:"coupon",class:"form-input "+(this.couponError?"s-coupon-input-error":""),placeholder:salla.lang.get("pages.cart.coupon_placeholder"),value:this.couponInputValue,disabled:!!this.currentCoupon||this.isApplying,onInput:this.onInput,onKeyUp:this.onKeyUp,"aria-label":salla.lang.get("pages.cart.apply_coupon"),key:"coupon-input"}),o("salla-button",{ref:t=>this.couponButtonRef=t,class:"s-cart-coupons-coupon-button "+(this.currentCoupon?"s-cart-coupons-coupon-button-remove":"s-cart-coupons-coupon-button-apply"),color:this.currentCoupon?"danger":"primary",loading:this.isApplying,"loader-position":"center",onClick:()=>this.handleCouponButtonClick(),key:"apply-button"},this.currentCoupon?o("i",{class:"sicon-cancel"}):o("span",null,salla.lang.get("pages.cart.save_coupon")))]),this.couponError&&o("span",{key:"9713718d67c8c4ff4daeffc47572ac3cabea6905",class:"s-cart-coupons-coupon-error"},this.couponError)),t.length>0&&o("salla-slider",{type:"carousel",showControls:!1,class:"s-cart-coupons-slider",key:t.map((t=>t.code)).join("|")},o("div",{key:"4b96603ef79b45b312a87755850b3c81cc51deea",slot:"items"},t.map((t=>this.renderCouponCard(t)))))))}get host(){return a(this)}};s.style='/*!twlt*/@charset "UTF-8";.s-cart-coupons-card--applied{cursor:default}.s-cart-coupons-card--applied:hover{transform:none}.s-cart-coupons-card--applied .s-cart-coupons-top-section,.s-cart-coupons-card--applied .s-cart-coupons-bottom-section,.s-cart-coupons-card--applied .s-cart-coupons-divider{border-color:#d1d5db;border-color:color-mix(in srgb, var(--color-primary, #004d5a) 40%, transparent)}.s-cart-coupons-card--applied .s-cart-coupons-bottom-section{background:rgba(0, 0, 0, 0.04);background:color-mix(in srgb, var(--color-primary, #004d5a) 8%, transparent)}.s-cart-coupons-card--applied::before,.s-cart-coupons-card--applied::after{border-color:#d1d5db;border-color:color-mix(in srgb, var(--color-primary, #004d5a) 40%, transparent)}.s-cart-coupons-card--applied .s-cart-coupons-action{display:inline-flex;align-items:center;gap:10px}.s-cart-coupons-card--applied .s-cart-coupons-action{font-size:10px;font-weight:600;color:#4b5563}.s-cart-coupons-card-applied-label{color:#4b5563;color:var(--color-primary-dark, var(--color-primary, #4b5563))}.s-cart-coupons-card--applied .s-cart-coupons-action{min-width:0;max-width:100%}.s-cart-coupons-card-applied-label,.s-cart-coupons-card-remove{overflow:hidden;text-overflow:ellipsis}.s-cart-coupons-card--applied .s-cart-coupons-action,.s-cart-coupons-card--applied .s-cart-coupons-card-remove{pointer-events:auto}.s-cart-coupons-card-remove{flex:none;font-size:inherit;font-weight:inherit;color:#6b7280;background:transparent;border:0;padding:0;cursor:pointer;transition:color 0.15s ease}.s-cart-coupons-card-remove:hover{color:var(--color-danger, #ef4444)}.s-cart-coupons-card-remove:disabled{opacity:0.5;cursor:not-allowed}.s-cart-coupons-card--minimal .s-cart-coupons-bottom-section{justify-content:flex-end}.visible{visibility:visible}.fixed{position:fixed}.shrink{flex-shrink:1}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.form-input{height:2.5rem;width:100%;border-radius:0.375rem;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1));transition-property:color, background-color, border-color, text-decoration-color, fill, stroke;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:300ms}.form-input:focus{border-color:var(--color-primary);--tw-ring-color:transparent}.form-input:is(.dark *){--tw-border-opacity:1;border-color:rgb(75 85 99 / var(--tw-border-opacity, 1));--tw-bg-opacity:1;background-color:rgb(75 85 99 / var(--tw-bg-opacity, 1))}.form-input:focus:is(.dark *){border-color:var(--color-primary)}@media (min-width: 640px){.form-input{font-size:0.875rem;line-height:1.25rem}}.s-cart-coupons-wrapper{display:block;width:100%;padding-top:1.25rem;padding-bottom:1.25rem}.s-cart-coupons-input-section{margin-bottom:0.625rem}.s-cart-coupons-coupon-label{margin-bottom:0.625rem;display:block;font-size:0.875rem;line-height:1.25rem;--tw-text-opacity:1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.s-cart-coupons-coupon-input-container{position:relative;display:flex;align-items:stretch}.s-cart-coupons-coupon-input-container .form-input{height:auto;flex:1 1 0%}.s-cart-coupons-coupon-input-container .form-input:where([dir="ltr"],[dir="ltr"] *){border-top-left-radius:0.5rem;border-bottom-left-radius:0.5rem;border-top-right-radius:0px !important;border-bottom-right-radius:0px !important;border-right-width:0px}.s-cart-coupons-coupon-input-container .form-input:where([dir="rtl"],[dir="rtl"] *){border-top-right-radius:0.5rem;border-bottom-right-radius:0.5rem;border-top-left-radius:0px !important;border-bottom-left-radius:0px !important;border-left-width:0px}.s-cart-coupons-coupon-input-container .form-input:focus{position:relative;z-index:10}.s-cart-coupons-coupon-button:where([dir="ltr"],[dir="ltr"] *){border-top-right-radius:0.5rem;border-bottom-right-radius:0.5rem;border-top-left-radius:0px;border-bottom-left-radius:0px}.s-cart-coupons-coupon-button:where([dir="rtl"],[dir="rtl"] *){border-top-left-radius:0.5rem;border-bottom-left-radius:0.5rem;border-top-right-radius:0px;border-bottom-right-radius:0px}.s-cart-coupons-coupon-button-remove:where([dir="ltr"],[dir="ltr"] *){border-top-right-radius:0.5rem;border-bottom-right-radius:0.5rem;border-top-left-radius:0px !important;border-bottom-left-radius:0px !important}.s-cart-coupons-coupon-button-remove:where([dir="rtl"],[dir="rtl"] *){border-top-left-radius:0.5rem;border-bottom-left-radius:0.5rem;border-top-right-radius:0px !important;border-bottom-right-radius:0px !important}.s-cart-coupons-coupon-button-apply:where([dir="ltr"],[dir="ltr"] *){border-top-right-radius:0.5rem !important;border-bottom-right-radius:0.5rem !important;border-top-left-radius:0px !important;border-bottom-left-radius:0px !important}.s-cart-coupons-coupon-button-apply:where([dir="rtl"],[dir="rtl"] *){border-top-left-radius:0.5rem !important;border-bottom-left-radius:0.5rem !important;border-top-right-radius:0px !important;border-bottom-right-radius:0px !important}.s-cart-coupons-coupon-error{margin-top:0.5rem;display:block;font-size:10px;line-height:1rem;--tw-text-opacity:1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.s-cart-coupons-slider{width:100%;overflow:hidden;padding-left:0.375rem;padding-right:0.375rem}.s-cart-coupons-card{position:relative;cursor:pointer;overflow:hidden;--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1));transition-property:all;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:300ms}.s-cart-coupons-card:is(.dark *){--tw-bg-opacity:1;background-color:rgb(31 41 55 / var(--tw-bg-opacity, 1))}.s-cart-coupons-card:hover{--tw-translate-y:-0.125rem;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.s-cart-coupons-disabled{cursor:not-allowed;opacity:0.5}.s-cart-coupons-disabled:hover{transform:none;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1));--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}.s-cart-coupons-top-section{display:flex;height:60px;flex-direction:row;align-items:center;justify-content:space-between;border-top-left-radius:0.75rem;border-top-right-radius:0.75rem;border-width:1px;border-bottom-width:0px;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1));padding-top:1rem;padding-bottom:1rem;padding-left:0.75rem;padding-right:0.75rem}.s-cart-coupons-discount-values{display:flex;flex-direction:column;align-items:flex-start}.s-cart-coupons-discount-values .s-cart-coupons-main-amount{display:flex;align-items:center;gap:0.25rem;white-space:nowrap;font-size:1.25rem;line-height:1.75rem;font-weight:900;line-height:1;--tw-text-opacity:1;color:rgb(0 0 0 / var(--tw-text-opacity, 1))}.s-cart-coupons-discount-values .s-cart-coupons-secondary-info{margin:0px;font-size:10px;line-height:1rem}.s-cart-coupons-code{font-size:10px;font-weight:700;--tw-text-opacity:1;color:rgb(17 24 39 / var(--tw-text-opacity, 1))}.s-cart-coupons-divider{position:relative;z-index:10;margin:0px;border-bottom-width:1px;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1))}.s-cart-coupons-bottom-section{display:flex;min-height:44px;flex-direction:row;align-items:center;justify-content:space-between;border-bottom-right-radius:0.75rem;border-bottom-left-radius:0.75rem;border-width:1px;border-top-width:0px;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1));--tw-bg-opacity:1;background-color:rgb(249 250 251 / var(--tw-bg-opacity, 1));padding-top:0.25rem;padding-bottom:0.25rem;padding-left:0.75rem;padding-right:0.75rem}.s-cart-coupons-terms{display:flex;flex-direction:column;align-items:flex-start}.s-cart-coupons-terms .s-cart-coupons-expiry{margin:0px;font-size:10px;line-height:16px;--tw-text-opacity:1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.s-cart-coupons-terms .s-cart-coupons-minimum{margin:0px;font-size:10px;line-height:16px;--tw-text-opacity:1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.s-cart-coupons-terms .s-cart-coupons-expiry.s-cart-coupons-expiry-warning{font-weight:500;--tw-text-opacity:1;color:rgb(220 38 38 / var(--tw-text-opacity, 1))}.s-cart-coupons-action{cursor:pointer;white-space:nowrap;border-width:0px;background-color:transparent;padding:0px;font-size:9px;font-weight:700;--tw-text-opacity:1;color:rgb(17 24 39 / var(--tw-text-opacity, 1));transition-property:color, background-color, border-color, text-decoration-color, fill, stroke;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms}.s-cart-coupons-action:hover{--tw-text-opacity:1;color:rgb(59 130 246 / var(--tw-text-opacity, 1))}.s-cart-coupons-slide-one-fourth{width:calc(75% - 10px);min-width:200px !important;padding-left:5px !important;padding-right:5px !important;padding-top:2px !important}@media (min-width: 1024px){.s-cart-coupons-slide-one-fourth{width:calc(40% - 10px) !important}}.s-cart-coupons-card:before{pointer-events:none;position:absolute;right:-10px;top:60px;z-index:20;height:1.25rem;width:1.25rem;--tw-translate-y:-50%;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));border-radius:9999px;border-width:1px;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1));--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1));--tw-content:\'\';content:var(--tw-content)}.s-cart-coupons-card:is(.dark *):before{--tw-bg-opacity:1;background-color:rgb(31 41 55 / var(--tw-bg-opacity, 1))}.s-cart-coupons-card:after{pointer-events:none;position:absolute;left:-10px;top:60px;z-index:20;height:1.25rem;width:1.25rem;--tw-translate-y:-50%;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));border-radius:9999px;border-width:1px;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1));--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1));--tw-content:\'\';content:var(--tw-content)}.s-cart-coupons-card:is(.dark *):after{--tw-bg-opacity:1;background-color:rgb(31 41 55 / var(--tw-bg-opacity, 1))}.s-cart-coupons-coupon-input-container .form-input.s-coupon-input-error{--tw-shadow:0 0 0 3px rgba(239,68,68,0.1) !important;--tw-shadow-colored:0 0 0 3px var(--tw-shadow-color) !important;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow) !important}';export{s as salla_cart_coupons}
4
+ import{r as t,h as o,H as r,a}from"./p-Z_0e-eaG.js";const s=class{constructor(o){t(this,o),this.availableCoupons=[],this.cartTotal=0,this.cartTotalReady=!1,this.currentCoupon="",this.couponInputValue="",this.couponError="",this.isApplying=!1,this.appliedCoupons=[],this.mergedCoupons=[],this.appliedCouponCards=[],this.orderLocked=!1,this.multiCoupon=!1,this.isHandlingInternalError=!1,this.cartUpdatedHandler=t=>{this.syncCartTotal(t),(this.multiCoupon?Array.isArray(t?.coupons):t&&("coupon"in t||"cashback_code"in t))?this.syncAppliedFromCart(t):this.multiCoupon&&t&&"cashback_code"in t&&this.mergeCashbackCodeChip(t.cashback_code),this.couponError=""},this.couponAddedHandler=()=>{this.isApplying||this.isHandlingInternalError||this.refreshFromServer()},this.couponAdditionFailedHandler=t=>{this.isApplying||this.isHandlingInternalError||this.showCouponError(t?.message||salla.lang.get("pages.cart.coupon_application_error"))},this.couponDeletedHandler=()=>{this.isApplying||this.isHandlingInternalError||this.refreshFromServer()},this.onKeyUp=t=>{"Enter"===t.key&&this.couponButtonRef?.click(),this.couponError=""},this.onInput=t=>{this.couponInputValue=t.target.value},this.mergedCashbackCode=""}async componentWillLoad(){await Salla.onReady(),await Salla.lang.onLoaded(),this.multiCoupon=!!salla.config.get("store.settings.cart.multi_coupon"),this.loadCouponsData(),this.seedFromStorage(),this.loadCartTotal(),this.setupCartEventListeners()}setupCartEventListeners(){salla.event.on("cart::updated",this.cartUpdatedHandler),salla.event.on("cart::coupon.added",this.couponAddedHandler),salla.event.on("cart::coupon.addition.failed",this.couponAdditionFailedHandler),salla.event.on("cart::coupon.deleted",this.couponDeletedHandler)}disconnectedCallback(){salla.event.off("cart::updated",this.cartUpdatedHandler),salla.event.off("cart::coupon.added",this.couponAddedHandler),salla.event.off("cart::coupon.addition.failed",this.couponAdditionFailedHandler),salla.event.off("cart::coupon.deleted",this.couponDeletedHandler)}async selectCoupon(t){const o=this.availableCoupons.find((o=>o.code===t));if(o){if(!this.isEligible(o))throw new Error("Coupon not eligible: minimum cart amount not met");try{await this.applyCoupon(t),this.host.dispatchEvent(new CustomEvent("salla::cart-coupons.coupon.selected",{detail:o,bubbles:!0}))}catch(t){throw t}}return o}async loadCouponsData(){try{const t=await salla.api.request("coupons"),o=t?.data,r=Array.isArray(o)?o:Array.isArray(o?.data)?o.data:[];this.availableCoupons=r}catch(t){console.warn("Failed to load coupons:",t),this.availableCoupons=[]}this.buildMergedCoupons()}async loadCartTotal(){await this.refreshFromServer()}seedFromStorage(){if(this.multiCoupon)return;const t=salla.storage.get("cart");t&&"object"==typeof t&&"coupon"in t&&this.applyCart(t),this.seedTotalsFromSummaryStorage()}seedTotalsFromSummaryStorage(){const t=salla.storage.get("cart.summary");t&&"object"==typeof t&&null!=t.sub_total&&(this.cartTotal=Number(t.sub_total),this.cartTotalReady=!0)}syncCartTotal(t){const o=t?.summary?.sub_total??t?.sub_total??t?.total;null!=o&&(this.cartTotal=Number(o),this.cartTotalReady=!0)}async refreshFromServer(){try{const t=await salla.cart.details(),o=t?.data?.cart??t?.data??t;if(o&&"object"==typeof o&&(Array.isArray(o.coupons)||"coupon"in o||"cashback_code"in o))return void this.applyCart(o)}catch(t){}const t=salla.storage.get("cart");t&&this.applyCart(t),this.seedTotalsFromSummaryStorage()}applyCart(t){this.syncCartTotal(t),this.syncAppliedFromCart(t)}mergeCashbackCodeChip(t){const o=(t||"").trim(),r=(this.mergedCashbackCode||"").trim();if(o.toLowerCase()===r.toLowerCase())return;const a=r?this.appliedCoupons.filter((t=>(t||"").toLowerCase()!==r.toLowerCase())):[...this.appliedCoupons],s=a.some((t=>(t||"").toLowerCase()===o.toLowerCase()));this.appliedCoupons=o&&!s?[...a,o]:a,this.mergedCashbackCode=o,r&&this.currentCoupon.toLowerCase()===r.toLowerCase()?this.currentCoupon=o:o&&(this.currentCoupon=this.currentCoupon||o),this.buildMergedCoupons()}syncAppliedFromCart(t){if(this.currentCoupon=t?.coupon||t?.cashback_code||"",this.mergedCashbackCode=(t?.cashback_code||"").trim(),this.multiCoupon){const o=Array.isArray(t?.coupons)?t.coupons:[t?.coupon];this.appliedCoupons=[...o,t?.cashback_code].filter(Boolean);const r=t?.applied_coupons;return this.appliedCouponCards=Array.isArray(r)?r.filter(Boolean):r&&"object"==typeof r?Object.values(r).filter(Boolean):[],void this.buildMergedCoupons()}this.couponInputValue=this.currentCoupon,this.appliedCoupons=this.currentCoupon?[this.currentCoupon]:[],this.buildMergedCoupons()}buildMergedCoupons(){if(!this.multiCoupon)return void(this.mergedCoupons=[]);const t=this.appliedCoupons.filter(Boolean),o=new Set(t),r=new Map(this.availableCoupons.map((t=>[t.code,t]))),a=new Map(r);this.appliedCouponCards.forEach((t=>{t?.code&&!a.has(t.code)&&a.set(t.code,t)}));const s=this.orderLocked?this.mergeIntoLockedOrder(t,r,(t=>o.has(t)||r.has(t))):[...t,...this.availableCoupons.map((t=>t.code)).filter((t=>!o.has(t)))];this.mergedCoupons=s.map((t=>({code:t,coupon:a.get(t)??null,applied:o.has(t)})))}mergeIntoLockedOrder(t,o,r){const a=this.mergedCoupons.map((t=>t.code)).filter(r),s=new Set(a),i=t.filter((t=>!s.has(t)));i.forEach((t=>s.add(t)));const e=[...o.keys()].filter((t=>!s.has(t)));return[...i,...a,...e]}lockOrder(){this.orderLocked=!0}async handleApplyClick(){if(this.isApplying)return;const t=this.couponInputValue.trim();if(t){this.lockOrder(),this.isApplying=!0,this.isHandlingInternalError=!0;try{await salla.cart.addCoupon(t),await this.refreshFromServer(),this.couponInputValue=""}catch(t){this.showCouponError(t.response?.data?.error?.message||salla.lang.get("pages.cart.coupon_application_error"))}finally{this.isApplying=!1,setTimeout((()=>{this.isHandlingInternalError=!1}),100)}}else this.showCouponError(salla.lang.get("pages.cart.enter_coupon_code"))}async handleCouponButtonClick(){if(this.isApplying)return;const t=!!this.currentCoupon;if(t||this.couponInputValue.trim()){this.isApplying=!0,this.isHandlingInternalError=!0;try{t?await salla.cart.deleteCoupon():await salla.cart.addCoupon(this.couponInputValue.trim()),await this.refreshFromServer()}catch(t){this.showCouponError(t.response?.data?.error?.message||salla.lang.get("pages.cart.coupon_application_error"))}finally{this.isApplying=!1,setTimeout((()=>{this.isHandlingInternalError=!1}),100)}}else this.showCouponError(salla.lang.get("pages.cart.enter_coupon_code"))}async removeCoupon(t){if(!this.isApplying){this.lockOrder(),this.isApplying=!0,this.isHandlingInternalError=!0;try{this.multiCoupon?await salla.cart.deleteCoupon(t):await salla.cart.deleteCoupon(),await this.refreshFromServer()}catch(t){this.showCouponError(t.response?.data?.error?.message||salla.lang.get("pages.cart.coupon_application_error"))}finally{this.isApplying=!1,setTimeout((()=>{this.isHandlingInternalError=!1}),100)}}}showCouponError(t){this.couponError=t}handleCouponClick(t){this.applyCoupon(t.code,!1).catch((()=>{}))}async applyCoupon(t,o=!0){if(this.isApplying){if(o)throw new Error("Coupon application already in progress")}else{this.lockOrder(),this.couponInputValue=t,this.couponError="",this.isApplying=!0,this.isHandlingInternalError=!0;try{await salla.cart.addCoupon(t.trim()),await this.refreshFromServer(),this.multiCoupon&&(this.couponInputValue="")}catch(t){if(this.showCouponError(t.response?.data?.error?.message||salla.lang.get("pages.cart.coupon_application_error")),o)throw t}finally{this.isApplying=!1,setTimeout((()=>{this.isHandlingInternalError=!1}),100)}}}formatMainAmount(t){if("percentage"===t.type)return`${salla.helpers.number("object"==typeof t.amount?t.amount.amount:t.amount)}%`;{const r="object"==typeof t.amount?t.amount:{amount:t.amount,currency:t.minimum_amount?.currency||salla.config.get("store.currency.code","SAR")};return o("span",{innerHTML:salla.money(r.amount,r.currency)})}}isEligible(t){return!this.cartTotalReady||!t.minimum_amount||this.cartTotal>=parseFloat(t.minimum_amount.amount)}renderCouponCard(t){const{coupon:r,applied:a,code:s}=t;if(!r)return this.renderMinimalCard(s);const i=this.isEligible(r);return o("div",{class:"s-cart-coupons-slide-one-fourth swiper-slide"},o("div",{class:`s-cart-coupons-card ${a?"s-cart-coupons-card--applied":""} ${a||i&&!this.isApplying?"":"s-cart-coupons-disabled"}`,onClick:()=>!a&&i&&!this.isApplying&&this.handleCouponClick(r)},o("div",{class:"s-cart-coupons-top-section"},o("div",{class:"s-cart-coupons-discount-values"},o("div",{class:"s-cart-coupons-main-amount"},this.formatMainAmount(r)),r.free_shipping?o("div",{class:"s-cart-coupons-secondary-info"},"+ ",salla.lang.get("pages.cart.free_shipping")):r.maximum_amount&&o("div",{class:"s-cart-coupons-secondary-info"},salla.lang.get("pages.cart.up_to")," ",o("span",{innerHTML:salla.money(r.maximum_amount.amount,r.maximum_amount.currency)}))),o("div",{class:"s-cart-coupons-code"},r.code)),o("div",{class:"s-cart-coupons-divider"}),o("div",{class:"s-cart-coupons-bottom-section"},o("div",{class:"s-cart-coupons-terms"},null!=r.remaining_days&&o("div",{class:"s-cart-coupons-expiry "+(r.remaining_days<=3?"s-cart-coupons-expiry-warning":"")},0===r.remaining_days?salla.lang.get("pages.cart.expires_today"):`${salla.lang.get("pages.cart.expires_after")} ${r.remaining_days} ${salla.lang.get("pages.cart.day")}`),r.minimum_amount&&parseFloat(r.minimum_amount.amount)>0&&o("div",{class:"s-cart-coupons-minimum"},salla.lang.get("pages.cart.minimum")," ",o("span",{innerHTML:salla.money(r.minimum_amount.amount,r.minimum_amount.currency)}))),o("div",{class:"s-cart-coupons-action"},a?this.renderAppliedAction(s):i?salla.lang.get("pages.cart.save_coupon"):salla.lang.get("pages.cart.coupon_not_compatible")))))}renderAppliedAction(t){return[o("span",{class:"s-cart-coupons-card-applied-label"},salla.lang.get("pages.cart.coupon_applied")),o("button",{type:"button",class:"s-cart-coupons-card-remove","aria-label":`${salla.lang.get("pages.cart.delete_coupon")} ${t}`,disabled:this.isApplying,onClick:o=>{o.stopPropagation(),this.removeCoupon(t)}},salla.lang.get("pages.cart.cancel"))]}renderMinimalCard(t){return o("div",{class:"s-cart-coupons-slide-one-fourth swiper-slide"},o("div",{class:"s-cart-coupons-card s-cart-coupons-card--applied s-cart-coupons-card--minimal"},o("div",{class:"s-cart-coupons-top-section"},o("div",{class:"s-cart-coupons-code s-cart-coupons-code--only"},t)),o("div",{class:"s-cart-coupons-divider"}),o("div",{class:"s-cart-coupons-bottom-section"},o("div",{class:"s-cart-coupons-action"},this.renderAppliedAction(t)))))}couponRow(){return this.multiCoupon?this.mergedCoupons:(this.availableCoupons||[]).map((t=>({code:t.code,coupon:t,applied:!1})))}render(){const t=this.couponRow();return o(r,{key:"79d820f5931ca33571e6897f4e5a09413e02cf96"},o("div",{key:"7c55aa93e8f4bc44c76606e1af4cb593cab0e7b2",class:"s-cart-coupons-wrapper"},o("div",{key:"7deee9dc280b91008c9f29eab2c7dbb42fb4d586",class:"s-cart-coupons-input-section"},o("label",{key:"f4362e77c3031c8bdacdbd0bd126f7df3c973583",htmlFor:"coupon-input",class:"s-cart-coupons-coupon-label"},salla.lang.get("pages.cart.have_coupon")),o("div",{key:"631dce1aeb71c6bfc80d00869c0974ffedb3f932",class:"s-cart-coupons-coupon-input-container"},this.multiCoupon?[o("input",{type:"text",id:"coupon-input",name:"coupon",class:"form-input "+(this.couponError?"s-coupon-input-error":""),placeholder:salla.lang.get("pages.cart.coupon_placeholder"),value:this.couponInputValue,disabled:this.isApplying,onInput:this.onInput,onKeyUp:this.onKeyUp,"aria-label":salla.lang.get("pages.cart.apply_coupon"),key:"coupon-input"}),o("salla-button",{ref:t=>this.couponButtonRef=t,class:"s-cart-coupons-coupon-button s-cart-coupons-coupon-button-apply",color:"primary",loading:this.isApplying,"loader-position":"center",onClick:()=>this.handleApplyClick(),key:"apply-button"},o("span",null,salla.lang.get("pages.cart.save_coupon")))]:[o("input",{type:"text",id:"coupon-input",name:"coupon",class:"form-input "+(this.couponError?"s-coupon-input-error":""),placeholder:salla.lang.get("pages.cart.coupon_placeholder"),value:this.couponInputValue,disabled:!!this.currentCoupon||this.isApplying,onInput:this.onInput,onKeyUp:this.onKeyUp,"aria-label":salla.lang.get("pages.cart.apply_coupon"),key:"coupon-input"}),o("salla-button",{ref:t=>this.couponButtonRef=t,class:"s-cart-coupons-coupon-button "+(this.currentCoupon?"s-cart-coupons-coupon-button-remove":"s-cart-coupons-coupon-button-apply"),color:this.currentCoupon?"danger":"primary",loading:this.isApplying,"loader-position":"center",onClick:()=>this.handleCouponButtonClick(),key:"apply-button"},this.currentCoupon?o("i",{class:"sicon-cancel"}):o("span",null,salla.lang.get("pages.cart.save_coupon")))]),this.couponError&&o("span",{key:"9713718d67c8c4ff4daeffc47572ac3cabea6905",class:"s-cart-coupons-coupon-error"},this.couponError)),t.length>0&&o("salla-slider",{type:"carousel",showControls:!1,class:"s-cart-coupons-slider",key:t.map((t=>t.code)).join("|")},o("div",{key:"4b96603ef79b45b312a87755850b3c81cc51deea",slot:"items"},t.map((t=>this.renderCouponCard(t)))))))}get host(){return a(this)}};s.style='/*!twlt*/@charset "UTF-8";.s-cart-coupons-card--applied{cursor:default}.s-cart-coupons-card--applied:hover{transform:none}.s-cart-coupons-card--applied .s-cart-coupons-top-section,.s-cart-coupons-card--applied .s-cart-coupons-bottom-section,.s-cart-coupons-card--applied .s-cart-coupons-divider{border-color:#d1d5db;border-color:color-mix(in srgb, var(--color-primary, #004d5a) 40%, transparent)}.s-cart-coupons-card--applied .s-cart-coupons-bottom-section{background:rgba(0, 0, 0, 0.04);background:color-mix(in srgb, var(--color-primary, #004d5a) 8%, transparent)}.s-cart-coupons-card--applied::before,.s-cart-coupons-card--applied::after{border-color:#d1d5db;border-color:color-mix(in srgb, var(--color-primary, #004d5a) 40%, transparent)}.s-cart-coupons-card--applied .s-cart-coupons-action{display:inline-flex;align-items:center;gap:10px}.s-cart-coupons-card--applied .s-cart-coupons-action{font-size:10px;font-weight:600;color:#4b5563}.s-cart-coupons-card-applied-label{color:#4b5563;color:var(--color-primary-dark, var(--color-primary, #4b5563))}.s-cart-coupons-card--applied .s-cart-coupons-action{min-width:0;max-width:100%}.s-cart-coupons-card-applied-label,.s-cart-coupons-card-remove{overflow:hidden;text-overflow:ellipsis}.s-cart-coupons-card--applied .s-cart-coupons-action,.s-cart-coupons-card--applied .s-cart-coupons-card-remove{pointer-events:auto}.s-cart-coupons-card-remove{flex:none;font-size:inherit;font-weight:inherit;color:#6b7280;background:transparent;border:0;padding:0;cursor:pointer;transition:color 0.15s ease}.s-cart-coupons-card-remove:hover{color:var(--color-danger, #ef4444)}.s-cart-coupons-card-remove:disabled{opacity:0.5;cursor:not-allowed}.s-cart-coupons-card--minimal .s-cart-coupons-bottom-section{justify-content:flex-end}.visible{visibility:visible}.fixed{position:fixed}.shrink{flex-shrink:1}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.form-input{height:2.5rem;width:100%;border-radius:0.375rem;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1));transition-property:color, background-color, border-color, text-decoration-color, fill, stroke;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:300ms}.form-input:focus{border-color:var(--color-primary);--tw-ring-color:transparent}.form-input:is(.dark *){--tw-border-opacity:1;border-color:rgb(75 85 99 / var(--tw-border-opacity, 1));--tw-bg-opacity:1;background-color:rgb(75 85 99 / var(--tw-bg-opacity, 1))}.form-input:focus:is(.dark *){border-color:var(--color-primary)}@media (min-width: 640px){.form-input{font-size:0.875rem;line-height:1.25rem}}.s-cart-coupons-wrapper{display:block;width:100%;padding-top:1.25rem;padding-bottom:1.25rem}.s-cart-coupons-input-section{margin-bottom:0.625rem}.s-cart-coupons-coupon-label{margin-bottom:0.625rem;display:block;font-size:0.875rem;line-height:1.25rem;--tw-text-opacity:1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.s-cart-coupons-coupon-input-container{position:relative;display:flex;align-items:stretch}.s-cart-coupons-coupon-input-container .form-input{height:auto;flex:1 1 0%}.s-cart-coupons-coupon-input-container .form-input:where([dir="ltr"],[dir="ltr"] *){border-top-left-radius:0.5rem;border-bottom-left-radius:0.5rem;border-top-right-radius:0px !important;border-bottom-right-radius:0px !important;border-right-width:0px}.s-cart-coupons-coupon-input-container .form-input:where([dir="rtl"],[dir="rtl"] *){border-top-right-radius:0.5rem;border-bottom-right-radius:0.5rem;border-top-left-radius:0px !important;border-bottom-left-radius:0px !important;border-left-width:0px}.s-cart-coupons-coupon-input-container .form-input:focus{position:relative;z-index:10}.s-cart-coupons-coupon-button:where([dir="ltr"],[dir="ltr"] *){border-top-right-radius:0.5rem;border-bottom-right-radius:0.5rem;border-top-left-radius:0px;border-bottom-left-radius:0px}.s-cart-coupons-coupon-button:where([dir="rtl"],[dir="rtl"] *){border-top-left-radius:0.5rem;border-bottom-left-radius:0.5rem;border-top-right-radius:0px;border-bottom-right-radius:0px}.s-cart-coupons-coupon-button-remove:where([dir="ltr"],[dir="ltr"] *){border-top-right-radius:0.5rem;border-bottom-right-radius:0.5rem;border-top-left-radius:0px !important;border-bottom-left-radius:0px !important}.s-cart-coupons-coupon-button-remove:where([dir="rtl"],[dir="rtl"] *){border-top-left-radius:0.5rem;border-bottom-left-radius:0.5rem;border-top-right-radius:0px !important;border-bottom-right-radius:0px !important}.s-cart-coupons-coupon-button-apply:where([dir="ltr"],[dir="ltr"] *){border-top-right-radius:0.5rem !important;border-bottom-right-radius:0.5rem !important;border-top-left-radius:0px !important;border-bottom-left-radius:0px !important}.s-cart-coupons-coupon-button-apply:where([dir="rtl"],[dir="rtl"] *){border-top-left-radius:0.5rem !important;border-bottom-left-radius:0.5rem !important;border-top-right-radius:0px !important;border-bottom-right-radius:0px !important}.s-cart-coupons-coupon-error{margin-top:0.5rem;display:block;font-size:10px;line-height:1rem;--tw-text-opacity:1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.s-cart-coupons-slider{width:100%;overflow:hidden;padding-left:0.375rem;padding-right:0.375rem}.s-cart-coupons-card{position:relative;cursor:pointer;overflow:hidden;--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1));transition-property:all;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:300ms}.s-cart-coupons-card:is(.dark *){--tw-bg-opacity:1;background-color:rgb(31 41 55 / var(--tw-bg-opacity, 1))}.s-cart-coupons-card:hover{--tw-translate-y:-0.125rem;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.s-cart-coupons-disabled{cursor:not-allowed;opacity:0.5}.s-cart-coupons-disabled:hover{transform:none;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1));--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}.s-cart-coupons-top-section{display:flex;height:60px;flex-direction:row;align-items:center;justify-content:space-between;border-top-left-radius:0.75rem;border-top-right-radius:0.75rem;border-width:1px;border-bottom-width:0px;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1));padding-top:1rem;padding-bottom:1rem;padding-left:0.75rem;padding-right:0.75rem}.s-cart-coupons-discount-values{display:flex;flex-direction:column;align-items:flex-start}.s-cart-coupons-discount-values .s-cart-coupons-main-amount{display:flex;align-items:center;gap:0.25rem;white-space:nowrap;font-size:1.25rem;line-height:1.75rem;font-weight:900;line-height:1;--tw-text-opacity:1;color:rgb(0 0 0 / var(--tw-text-opacity, 1))}.s-cart-coupons-discount-values .s-cart-coupons-secondary-info{margin:0px;font-size:10px;line-height:1rem}.s-cart-coupons-code{font-size:10px;font-weight:700;--tw-text-opacity:1;color:rgb(17 24 39 / var(--tw-text-opacity, 1))}.s-cart-coupons-divider{position:relative;z-index:10;margin:0px;border-bottom-width:1px;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1))}.s-cart-coupons-bottom-section{display:flex;min-height:44px;flex-direction:row;align-items:center;justify-content:space-between;border-bottom-right-radius:0.75rem;border-bottom-left-radius:0.75rem;border-width:1px;border-top-width:0px;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1));--tw-bg-opacity:1;background-color:rgb(249 250 251 / var(--tw-bg-opacity, 1));padding-top:0.25rem;padding-bottom:0.25rem;padding-left:0.75rem;padding-right:0.75rem}.s-cart-coupons-terms{display:flex;flex-direction:column;align-items:flex-start}.s-cart-coupons-terms .s-cart-coupons-expiry{margin:0px;font-size:10px;line-height:16px;--tw-text-opacity:1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.s-cart-coupons-terms .s-cart-coupons-minimum{margin:0px;font-size:10px;line-height:16px;--tw-text-opacity:1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.s-cart-coupons-terms .s-cart-coupons-expiry.s-cart-coupons-expiry-warning{font-weight:500;--tw-text-opacity:1;color:rgb(220 38 38 / var(--tw-text-opacity, 1))}.s-cart-coupons-action{cursor:pointer;white-space:nowrap;border-width:0px;background-color:transparent;padding:0px;font-size:9px;font-weight:700;--tw-text-opacity:1;color:rgb(17 24 39 / var(--tw-text-opacity, 1));transition-property:color, background-color, border-color, text-decoration-color, fill, stroke;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms}.s-cart-coupons-action:hover{--tw-text-opacity:1;color:rgb(59 130 246 / var(--tw-text-opacity, 1))}.s-cart-coupons-slide-one-fourth{width:calc(75% - 10px);min-width:200px !important;padding-left:5px !important;padding-right:5px !important;padding-top:2px !important}@media (min-width: 1024px){.s-cart-coupons-slide-one-fourth{width:calc(40% - 10px) !important}}.s-cart-coupons-card:before{pointer-events:none;position:absolute;right:-10px;top:60px;z-index:20;height:1.25rem;width:1.25rem;--tw-translate-y:-50%;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));border-radius:9999px;border-width:1px;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1));--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1));--tw-content:\'\';content:var(--tw-content)}.s-cart-coupons-card:is(.dark *):before{--tw-bg-opacity:1;background-color:rgb(31 41 55 / var(--tw-bg-opacity, 1))}.s-cart-coupons-card:after{pointer-events:none;position:absolute;left:-10px;top:60px;z-index:20;height:1.25rem;width:1.25rem;--tw-translate-y:-50%;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));border-radius:9999px;border-width:1px;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1));--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1));--tw-content:\'\';content:var(--tw-content)}.s-cart-coupons-card:is(.dark *):after{--tw-bg-opacity:1;background-color:rgb(31 41 55 / var(--tw-bg-opacity, 1))}.s-cart-coupons-coupon-input-container .form-input.s-coupon-input-error{--tw-shadow:0 0 0 3px rgba(239,68,68,0.1) !important;--tw-shadow-colored:0 0 0 3px var(--tw-shadow-color) !important;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow) !important}';export{s as salla_cart_coupons}
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r as i,h as s,H as t}from"./p-DSmjBlMI.js";import{H as r}from"./p-00vBRoH3.js";import{H as e}from"./p-Brgf4SAC.js";import"./p-CgtvEd63.js";const a=class{constructor(s){i(this,s),this.isEnabled=!1,this.wishlistCount=0,this.wishlistLabel=salla.lang.get("common.titles.wishlist"),salla.wishlist.event.onAdded((()=>this.syncCount())),salla.wishlist.event.onRemoved((()=>this.syncCount())),salla.event.on("wishlist::storage.synced",(()=>this.syncCount()))}componentWillLoad(){return new Promise((i=>salla.onReady((()=>{const s=e.getPlanName();this.isEnabled=!!s&&["basic","plus"].includes(s),this.syncCount(),i()}))))}syncCount(){this.wishlistCount=(salla.storage.get("salla::wishlist",[])||[]).length}render(){const i=salla.config.isGuest();return!this.isEnabled||i?s(t,{hidden:!0}):s(t,null,s("a",{class:"s-wishlist-summary-wrapper",href:salla.url.get("account/wishlist"),"aria-label":this.wishlistLabel},s("i",{class:"s-wishlist-summary-icon",innerHTML:r}),this.wishlistCount>0&&s("span",{class:"s-wishlist-summary-count"},salla.helpers.number(this.wishlistCount))))}};a.style='/*!twlt*/:host{display:inline-flex;align-items:center;margin-inline-start:1rem}.hidden{display:none}.s-wishlist-summary-wrapper{position:relative;margin-inline-start:0.75rem;display:inline-flex;align-items:center;border-style:none;text-decoration-line:none;outline:2px solid transparent;outline-offset:2px;transition-property:opacity;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:200ms}.s-wishlist-summary-wrapper:hover{opacity:0.8}.s-wishlist-summary-icon{display:inline-flex;height:2.5rem;width:2.5rem;align-items:center;justify-content:center;border-radius:9999px;border-width:1px;border-color:var(--color-border,#e5e7eb);color:var(--color-text-primary,#374151)}.s-wishlist-summary-icon svg{height:1.25rem;width:1.25rem;fill:currentColor}.s-wishlist-summary-count{position:absolute;top:-4px;left:-6px;display:inline-flex;height:1.25rem;width:1.25rem;align-items:center;justify-content:center;border-radius:9999px;--tw-bg-opacity:1;background-color:rgb(248 113 113 / var(--tw-bg-opacity, 1));padding:0.25rem;font-size:0.75rem;line-height:1.25rem;--tw-text-opacity:1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.s-wishlist-summary-count:where([dir="rtl"],[dir="rtl"] *){left:unset;right:-6px}';export{a as salla_wishlist_summary}
4
+ import{r as i,h as s,H as t}from"./p-Z_0e-eaG.js";import{H as r}from"./p-00vBRoH3.js";import{H as e}from"./p-Brgf4SAC.js";import"./p-CgtvEd63.js";const a=class{constructor(s){i(this,s),this.isEnabled=!1,this.wishlistCount=0,this.wishlistLabel=salla.lang.get("common.titles.wishlist"),salla.wishlist.event.onAdded((()=>this.syncCount())),salla.wishlist.event.onRemoved((()=>this.syncCount())),salla.event.on("wishlist::storage.synced",(()=>this.syncCount()))}componentWillLoad(){return new Promise((i=>salla.onReady((()=>{const s=e.getPlanName();this.isEnabled=!!s&&["basic","plus"].includes(s),this.syncCount(),i()}))))}syncCount(){this.wishlistCount=(salla.storage.get("salla::wishlist",[])||[]).length}render(){const i=salla.config.isGuest();return!this.isEnabled||i?s(t,{hidden:!0}):s(t,null,s("a",{class:"s-wishlist-summary-wrapper",href:salla.url.get("account/wishlist"),"aria-label":this.wishlistLabel},s("i",{class:"s-wishlist-summary-icon",innerHTML:r}),this.wishlistCount>0&&s("span",{class:"s-wishlist-summary-count"},salla.helpers.number(this.wishlistCount))))}};a.style='/*!twlt*/:host{display:inline-flex;align-items:center;margin-inline-start:1rem}.hidden{display:none}.s-wishlist-summary-wrapper{position:relative;margin-inline-start:0.75rem;display:inline-flex;align-items:center;border-style:none;text-decoration-line:none;outline:2px solid transparent;outline-offset:2px;transition-property:opacity;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:200ms}.s-wishlist-summary-wrapper:hover{opacity:0.8}.s-wishlist-summary-icon{display:inline-flex;height:2.5rem;width:2.5rem;align-items:center;justify-content:center;border-radius:9999px;border-width:1px;border-color:var(--color-border,#e5e7eb);color:var(--color-text-primary,#374151)}.s-wishlist-summary-icon svg{height:1.25rem;width:1.25rem;fill:currentColor}.s-wishlist-summary-count{position:absolute;top:-4px;left:-6px;display:inline-flex;height:1.25rem;width:1.25rem;align-items:center;justify-content:center;border-radius:9999px;--tw-bg-opacity:1;background-color:rgb(248 113 113 / var(--tw-bg-opacity, 1));padding:0.25rem;font-size:0.75rem;line-height:1.25rem;--tw-text-opacity:1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.s-wishlist-summary-count:where([dir="rtl"],[dir="rtl"] *){left:unset;right:-6px}';export{a as salla_wishlist_summary}
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r,c as t,h as e,H as i,a as s}from"./p-DSmjBlMI.js";import{I as o}from"./p-Z7udRKSZ.js";import{M as a}from"./p-DmgxDvXL.js";import{C as n}from"./p-BsLF_HK7.js";const l=class{constructor(e){r(this,e),this.quickOrderSubmited=t(this,"quickOrderSubmited"),this.quickOrderTitle="ليش تنتظر؟",this.subTitle="احصل على المنتج مباشرة الآن",this.payButtonTitle="اطلب المنتج",this.confirmPayButtonTitle="اشتر الآن",this.agreementText=salla.lang.get("pages.checkout.show_full_agreement"),this.isEmailRequired=!1,this.quickOrderStyle="default",this.isAvailable=!1,this.oneClick=!1,this.expanded=!1,this.isTermsRequired=!1,this.countryCode=salla.config.get("user.country_code","SA")||"SA",this.submitSucess=!1,this.placeHolderEmail=salla.lang.get("common.elements.email"),this.emailOptional=salla.lang.get("common.elements.optional"),this.agreementShowText=salla.lang.get("pages.checkout.show_full_agreement"),this.agreementModalHead=salla.lang.get("pages.checkout.full_agreement"),this.userNameLabel=salla.lang.get("pages.products.your_name"),this.termsChecked=!1,salla.onReady((()=>{this.productId=this.productId||salla.config.get("page.id")}))}connectedCallback(){this.langUnsubscribe=salla.lang.subscribe((()=>{this.placeHolderEmail=salla.lang.get("common.elements.email"),this.emailOptional=salla.lang.get("common.elements.optional"),this.agreementShowText=salla.lang.get("pages.checkout.show_full_agreement"),this.agreementModalHead=salla.lang.get("pages.checkout.full_agreement"),this.userNameLabel=salla.lang.get("pages.products.your_name")}))}disconnectedCallback(){this.langUnsubscribe?.()}getBtnColor(){return"default"===this.quickOrderStyle?"light":"primary"}getErrorMessage(r,t){return"terms"==t?salla.lang.get("pages.checkout.check_agreement"):salla.lang.get(`common.errors.${r}`,{attribute:"name"==t?this.userNameLabel:this.placeHolderEmail})}handleInvalidInput(r){let t,e=r.target,i=e.validity;i.valueMissing?(t=this.getErrorMessage("field_required",e.name),console.log(this.getErrorMessage("field_required",e.name))):i.typeMismatch&&(t=this.getErrorMessage("invalid_value",e.name)),e.setCustomValidity(t)}async setWrapperHeight(){let r=this.host.querySelector(".s-quick-order-expandable");setTimeout((()=>{r.style.maxHeight=r.style.maxHeight||this.oneClick?null:r.scrollHeight+"px"}),50)}getDarkOrLight(){return"default"===this.quickOrderStyle&&salla.config.get("theme.color.is_dark")?"dark":"light"}getStyleColor(){return{gray:"#f3f3f3",white:"#ffffff",default:salla.config.get("theme.color.primary")}[this.quickOrderStyle]||"#f3f3f3"}async submit(r,t=!1){return r.preventDefault(),t&&!this.oneClick?(this.expanded=!this.expanded,void this.setWrapperHeight()):this.submitBtn.load().then((()=>this.getPayload())).then((r=>salla.api.cart.createQuickOrder(r))).then((()=>{setTimeout((()=>{this.submitBtn.stop(),this.submitSucess=!0,this.quickOrderSubmited.emit()}),200)})).catch((r=>r&&(console.error(r),this.submitBtn.stop())))}async getPayload(){return this.oneClick?{product_ids:[this.productId],agreement:!0}:{product_ids:[this.productId],email:this.emailInput?.value,phone:Number((await(this.phoneInput?.getValues()))?.phone),country_code:(await(this.phoneInput?.getValues()))?.countryCode||this.countryCode,name:this.nameInput?.value,agreement:this.termsChecked}}formatAgreementText(r,t=150){return r?r.length<=t?r:(new DOMParser).parseFromString(r,"text/html").documentElement.innerText.substring(0,t)+"...":""}loadQuickOrderSettings(){let r=salla.config.get("store.settings.quick_order");return r?(this.user=salla.config.get("user")||salla.storage.get("user")||{},this.countryCode=this.user?.country_code||this.countryCode,this.isEmailRequired=!this.user?.email&&this.isEmailRequired,this.oneClick=this.user?.email,this.initComponentData(r),Promise.resolve()):Promise.resolve()}initComponentData(r){this.quickOrderTitle=r.title,this.subTitle=r.sub_title,this.payButtonTitle=r.order_now_button,this.isEmailRequired=r.is_email_required,this.isTermsRequired=r.show_agreement,this.agreementText=r.agreement,this.confirmPayButtonTitle=r.confirm_button,this.thanksMessage=r.thanks_message,this.quickOrderStyle=r.style,this.isAvailable=!0,this.oneClick=this.oneClick&&!this.isTermsRequired}componentWillLoad(){return new Promise((r=>salla.onReady((()=>this.loadQuickOrderSettings().then(r)))))}render(){if(this.isAvailable)return this.submitSucess?e(i,{class:"s-quick-order"},e("div",{class:"s-quick-order-confirm",style:{backgroundColor:salla.config.get("theme.color.primary")+"10",borderColor:salla.config.get("theme.color.primary")+"10",color:salla.config.get("theme.color.primary")}},e("i",{innerHTML:'\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>party-horn</title>\n<path fill="currentColor" d="M5.333 4.013c0.736 0 1.333-0.596 1.333-1.333v-0.013c0-0.737-0.597-1.327-1.333-1.327s-1.333 0.603-1.333 1.34 0.597 1.333 1.333 1.333zM11.333 10c0.341 0 0.683-0.131 0.943-0.391 1.541-1.54 2.391-3.589 2.391-5.771v-2.505c0-0.737-0.597-1.333-1.333-1.333s-1.333 0.596-1.333 1.333v2.505c0 1.468-0.572 2.848-1.609 3.885-0.521 0.521-0.521 1.364 0 1.885 0.26 0.26 0.601 0.391 0.943 0.391zM18.667 9.993c0.319 0 0.639-0.115 0.895-0.345 0.383-0.347 0.684-0.325 1.497-0.22 0.923 0.124 2.319 0.307 3.636-0.887 1.293-1.172 1.303-2.54 1.308-3.539 0.005-0.887 0.043-1.228 0.432-1.581 0.361-0.327 0.621-0.335 1.493-0.216 0.923 0.12 2.317 0.307 3.635-0.884 0.545-0.495 0.587-1.337 0.093-1.883-0.493-0.547-1.336-0.589-1.884-0.093-0.361 0.325-0.621 0.333-1.493 0.216-0.921-0.119-2.317-0.305-3.635 0.884-1.293 1.173-1.303 2.541-1.308 3.54-0.005 0.885-0.043 1.227-0.432 1.58-0.383 0.348-0.683 0.327-1.497 0.22-0.924-0.124-2.32-0.305-3.636 0.887-0.545 0.495-0.587 1.339-0.092 1.884 0.264 0.291 0.625 0.437 0.988 0.437zM18.667 16.013c0.736 0 1.333-0.596 1.333-1.333v-0.013c0-0.737-0.597-1.327-1.333-1.327s-1.333 0.603-1.333 1.34 0.597 1.333 1.333 1.333zM30.667 17.333h-2.505c-2.179 0-4.228 0.849-5.771 2.391-0.521 0.521-0.521 1.364 0 1.885 0.26 0.26 0.603 0.391 0.944 0.391s0.683-0.131 0.943-0.391c1.023-1.023 2.439-1.609 3.884-1.609h2.505c0.736 0 1.333-0.596 1.333-1.333s-0.597-1.333-1.333-1.333zM30.667 10.66c-0.736 0-1.333 0.603-1.333 1.34s0.597 1.333 1.333 1.333 1.333-0.596 1.333-1.333v-0.013c0-0.736-0.597-1.327-1.333-1.327zM29.333 26.66c-0.736 0-1.333 0.603-1.333 1.34s0.597 1.333 1.333 1.333 1.333-0.596 1.333-1.333v-0.013c0-0.736-0.597-1.327-1.333-1.327zM7.456 11.057c-0.327-0.327-0.799-0.46-1.249-0.356-0.449 0.107-0.812 0.439-0.959 0.876l-5.036 15.113c-0.487 1.457-0.113 3.037 0.973 4.125 0.772 0.771 1.792 1.183 2.84 1.183 0.428 0 0.861-0.068 1.284-0.209l15.112-5.037c0.439-0.145 0.769-0.508 0.876-0.959 0.107-0.449-0.028-0.921-0.355-1.249zM4.467 29.259c-0.503 0.163-1.023 0.043-1.395-0.329-0.373-0.373-0.497-0.896-0.329-1.396l4.355-13.065 10.436 10.435z"></path>\n</svg>\n'}),e("span",null,this.thanksMessage))):e(i,{class:`s-quick-order s-quick-order-${this.getDarkOrLight()}`},e("div",{class:`s-quick-order-container s-quick-order-${this.quickOrderStyle}`,style:{backgroundColor:this.getStyleColor()}},e("div",{class:"s-quick-order-button-cont"},e("div",null,e("h3",null,this.quickOrderTitle),e("p",null,this.subTitle)),e("salla-button",{class:this.expanded?"s-quick-order-btn-close":"",onClick:r=>this.submit(r,!0),color:this.getBtnColor()},this.oneClick?this.confirmPayButtonTitle:this.expanded?e("i",{innerHTML:n}):this.confirmPayButtonTitle)),e("form",{onSubmit:r=>this.submit(r),class:"s-quick-order-expandable "+(this.expanded?"s-quick-order-shown":"")},Salla.config.isGuest()&&[e("div",{class:"s-form-group"},e("span",{innerHTML:'\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>portrait</title>\n<path d="M24 1.333h-16c-3.676 0-6.667 2.991-6.667 6.667v16c0 3.028 2.041 5.561 4.811 6.371 0.004 0.001 0.008 0.003 0.012 0.004 0.591 0.172 1.2 0.292 1.844 0.292h16c0.644 0 1.253-0.12 1.843-0.292 0.004-0.001 0.008-0.003 0.012-0.004 2.771-0.809 4.812-3.343 4.812-6.371v-16c0-3.676-2.991-6.667-6.667-6.667zM8.012 28c0.121-1.915 3.363-4 7.988-4s7.868 2.085 7.988 4zM28 24c0 1.24-0.579 2.335-1.467 3.069-0.768-3.288-5.112-5.736-10.533-5.736s-9.765 2.448-10.533 5.736c-0.888-0.735-1.467-1.829-1.467-3.069v-16c0-2.205 1.795-4 4-4h16c2.205 0 4 1.795 4 4zM16 6.667c-3.308 0-6 2.692-6 6s2.692 6 6 6 6-2.692 6-6-2.692-6-6-6zM16 16c-1.839 0-3.333-1.495-3.333-3.333s1.495-3.333 3.333-3.333 3.333 1.495 3.333 3.333-1.495 3.333-3.333 3.333z"></path>\n</svg>\n'}),e("input",{type:"text",required:!0,class:"s-form-control s-quick-order-phone-field",name:"name",placeholder:this.userNameLabel,ref:r=>this.nameInput=r})),e("div",{class:"s-quick-order-flex-input"},e("div",{class:"s-form-group"},e("span",{innerHTML:o}),e("salla-tel-input",{ref:r=>this.phoneInput=r})),e("div",{class:"s-form-group"},e("span",{innerHTML:a}),e("input",{type:"email",class:"s-form-control s-quick-order-email-field",name:"email",required:this.isEmailRequired,placeholder:this.placeHolderEmail+" "+(this.isEmailRequired?"":this.emailOptional),ref:r=>this.emailInput=r})))],this.isTermsRequired&&e("label",{htmlFor:"terms",class:"s-quick-order-terms"},e("input",{type:"checkbox",required:!0,name:"terms",id:"terms",ref:r=>this.termsInput=r,onChange:()=>this.termsChecked=this.termsInput.checked,class:"s-checkbox"}),e("span",{class:"s-form-label"}," ",e("div",{innerHTML:this.formatAgreementText(this.agreementText,150)},this.agreementText.length>150&&e("salla-button",{shape:"link",onClick:()=>this.agreementModal.open()},this.agreementShowText))," ")),e("salla-button",{type:"submit",color:this.getBtnColor(),width:"wide",ref:r=>this.submitBtn=r},this.payButtonTitle)),e("salla-modal",{"modal-title":this.agreementModalHead,ref:r=>this.agreementModal=r},e("article",{innerHTML:this.agreementText}))))}componentDidLoad(){this.host.querySelectorAll("input").forEach((r=>{r.addEventListener("invalid",(r=>{this.handleInvalidInput(r)})),r.addEventListener("input",(()=>{r.setCustomValidity(""),r.reportValidity()}))}))}get host(){return s(this)}};l.style='/*!twlt*/.s-quick-order-expandable:not(.s-quick-order-shown){overflow:hidden}.has-error .s-form-label{color:#ff443a}.has-error .s-form-control,.has-error .s-tel-input-control,.has-error .s-datetime-picker-input{border-color:#ff443a;color:#ff443a}.s-form-control{display:block;width:100%;border-radius:var(--s-radius, 0.25rem);border-width:1px;--tw-border-opacity:1;border-color:rgb(209 213 219 / var(--tw-border-opacity, 1));--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1));padding:0.5rem;font-size:0.875rem;line-height:1.25rem;--tw-text-opacity:1;color:rgb(17 24 39 / var(--tw-text-opacity, 1))}.s-form-control:focus{border-color:var(--color-primary);--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000)}.s-form-label{margin-bottom:0.25rem;display:block;font-size:0.875rem;line-height:1.25rem;font-weight:500;--tw-text-opacity:1;color:rgb(17 24 39 / var(--tw-text-opacity, 1))}.s-form-group{margin-top:0.75rem;margin-bottom:0.75rem}.s-checkbox{cursor:pointer;--tw-border-opacity:1;border-color:rgb(209 213 219 / var(--tw-border-opacity, 1));appearance:none;background-color:#fff;margin:0;width:18px;height:18px;border-width:1px;border-radius:4px;display:grid;place-content:center}.s-checkbox:before{width:10px;height:10px;clip-path:polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);transform:scale(0);transform-origin:bottom left;transition:120ms transform ease-in-out;box-shadow:inset 1em 1em #444;background-color:#444}.s-checkbox:checked:before{transform:scale(1)}.s-checkbox::before{--tw-content:\'\';content:var(--tw-content)}.s-quick-order-dark h1,.s-quick-order-dark p{color:#fff}.s-quick-order-container{margin-top:0.5rem;margin-bottom:0.5rem;border-radius:var(--s-radius, 0.25rem);padding:1rem}.s-quick-order-button-cont{margin-top:0.5rem;margin-bottom:0.5rem;display:flex;justify-content:space-between}.s-quick-order-checkbox-container{margin-top:0.5rem;margin-bottom:0.5rem;display:flex}.s-quick-order-checkbox-container input{margin-bottom:0.5rem;margin-left:0.5rem;height:2.5rem;width:100%;border-radius:var(--s-radius, 0.25rem);border-width:1px;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1));padding:0.5rem}.s-quick-order-expandable{max-height:0px;opacity:0;transition-property:all;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:100ms;transition-timing-function:cubic-bezier(0, 0, 0.2, 1)}.s-quick-order-expandable:not(.s-quick-order-shown){overflow:hidden}.s-quick-order-expandable.s-quick-order-shown{opacity:1}.s-quick-order-expandable .s-form-group{position:relative;flex-grow:1}.s-quick-order-expandable .s-form-group input{padding-left:35px}.s-quick-order-expandable .s-form-group input:where([dir="rtl"],[dir="rtl"] *){padding-right:35px}.s-quick-order-expandable .s-form-group>span{position:absolute;left:10px;top:30%;z-index:10}.s-quick-order-expandable .s-form-group>span:where([dir="rtl"],[dir="rtl"] *){left:auto;right:10px}.s-quick-order-expandable .s-form-group span svg{height:1rem;width:1rem;fill:#919191}.s-quick-order-flex-input{display:flex}.s-quick-order-flex-input>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-right:calc(0.5rem * var(--tw-space-x-reverse));margin-left:calc(0.5rem * calc(1 - var(--tw-space-x-reverse)))}.s-quick-order-flex-input:where([dir="rtl"],[dir="rtl"] *)>:not([hidden])~:not([hidden]){--tw-space-x-reverse:1}.s-quick-order-flex-input salla-tel-input{height:2.5rem;width:100%}.s-quick-order-errors p{font-size:0.875rem;line-height:1.25rem;--tw-text-opacity:1;color:rgb(185 28 28 / var(--tw-text-opacity, 1))}.s-quick-order-confirm{display:flex;align-items:center;justify-content:center;border-radius:var(--s-radius, 0.25rem);border-width:1px;padding:0.5rem}.s-quick-order-confirm span{margin-left:0.5rem;margin-right:0.5rem}.s-quick-order-confirm svg{height:1rem;width:1rem;fill:var(--color-primary)}.s-quick-order-terms .s-form-label{margin-bottom:0px !important;cursor:pointer}.s-quick-order-terms{margin-bottom:1rem;display:flex;align-items:center;justify-content:flex-start}.s-quick-order-terms>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-right:calc(0.375rem * var(--tw-space-x-reverse));margin-left:calc(0.375rem * calc(1 - var(--tw-space-x-reverse)))}.s-quick-order-terms:where([dir="rtl"],[dir="rtl"] *)>:not([hidden])~:not([hidden]){--tw-space-x-reverse:1}.s-quick-order-terms .s-checkbox::before{background-color:transparent;content:var(--tw-content);--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}.s-quick-order-terms .s-checkbox:focus{outline:2px solid transparent;outline-offset:2px;--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000);--tw-ring-offset-width:0px}.s-quick-order-btn-close button{border-radius:var(--s-radius, 0.25rem);padding:0.5rem !important}.s-quick-order-phone-field:where([dir="ltr"],[dir="ltr"] *){padding-left:28px !important;padding-right:87px}.s-quick-order-phone-field:where([dir="rtl"],[dir="rtl"] *){padding-right:28px !important;padding-left:87px}.s-quick-order-email-field:where([dir="ltr"],[dir="ltr"] *){padding-right:0px !important}.s-quick-order-email-field:where([dir="rtl"],[dir="rtl"] *){padding-left:0px !important}';export{l as salla_quick_order}
4
+ import{r,c as t,h as e,H as i,a as s}from"./p-Z_0e-eaG.js";import{I as o}from"./p-Z7udRKSZ.js";import{M as a}from"./p-DmgxDvXL.js";import{C as n}from"./p-BsLF_HK7.js";const l=class{constructor(e){r(this,e),this.quickOrderSubmited=t(this,"quickOrderSubmited"),this.quickOrderTitle="ليش تنتظر؟",this.subTitle="احصل على المنتج مباشرة الآن",this.payButtonTitle="اطلب المنتج",this.confirmPayButtonTitle="اشتر الآن",this.agreementText=salla.lang.get("pages.checkout.show_full_agreement"),this.isEmailRequired=!1,this.quickOrderStyle="default",this.isAvailable=!1,this.oneClick=!1,this.expanded=!1,this.isTermsRequired=!1,this.countryCode=salla.config.get("user.country_code","SA")||"SA",this.submitSucess=!1,this.placeHolderEmail=salla.lang.get("common.elements.email"),this.emailOptional=salla.lang.get("common.elements.optional"),this.agreementShowText=salla.lang.get("pages.checkout.show_full_agreement"),this.agreementModalHead=salla.lang.get("pages.checkout.full_agreement"),this.userNameLabel=salla.lang.get("pages.products.your_name"),this.termsChecked=!1,salla.onReady((()=>{this.productId=this.productId||salla.config.get("page.id")}))}connectedCallback(){this.langUnsubscribe=salla.lang.subscribe((()=>{this.placeHolderEmail=salla.lang.get("common.elements.email"),this.emailOptional=salla.lang.get("common.elements.optional"),this.agreementShowText=salla.lang.get("pages.checkout.show_full_agreement"),this.agreementModalHead=salla.lang.get("pages.checkout.full_agreement"),this.userNameLabel=salla.lang.get("pages.products.your_name")}))}disconnectedCallback(){this.langUnsubscribe?.()}getBtnColor(){return"default"===this.quickOrderStyle?"light":"primary"}getErrorMessage(r,t){return"terms"==t?salla.lang.get("pages.checkout.check_agreement"):salla.lang.get(`common.errors.${r}`,{attribute:"name"==t?this.userNameLabel:this.placeHolderEmail})}handleInvalidInput(r){let t,e=r.target,i=e.validity;i.valueMissing?(t=this.getErrorMessage("field_required",e.name),console.log(this.getErrorMessage("field_required",e.name))):i.typeMismatch&&(t=this.getErrorMessage("invalid_value",e.name)),e.setCustomValidity(t)}async setWrapperHeight(){let r=this.host.querySelector(".s-quick-order-expandable");setTimeout((()=>{r.style.maxHeight=r.style.maxHeight||this.oneClick?null:r.scrollHeight+"px"}),50)}getDarkOrLight(){return"default"===this.quickOrderStyle&&salla.config.get("theme.color.is_dark")?"dark":"light"}getStyleColor(){return{gray:"#f3f3f3",white:"#ffffff",default:salla.config.get("theme.color.primary")}[this.quickOrderStyle]||"#f3f3f3"}async submit(r,t=!1){return r.preventDefault(),t&&!this.oneClick?(this.expanded=!this.expanded,void this.setWrapperHeight()):this.submitBtn.load().then((()=>this.getPayload())).then((r=>salla.api.cart.createQuickOrder(r))).then((()=>{setTimeout((()=>{this.submitBtn.stop(),this.submitSucess=!0,this.quickOrderSubmited.emit()}),200)})).catch((r=>r&&(console.error(r),this.submitBtn.stop())))}async getPayload(){return this.oneClick?{product_ids:[this.productId],agreement:!0}:{product_ids:[this.productId],email:this.emailInput?.value,phone:Number((await(this.phoneInput?.getValues()))?.phone),country_code:(await(this.phoneInput?.getValues()))?.countryCode||this.countryCode,name:this.nameInput?.value,agreement:this.termsChecked}}formatAgreementText(r,t=150){return r?r.length<=t?r:(new DOMParser).parseFromString(r,"text/html").documentElement.innerText.substring(0,t)+"...":""}loadQuickOrderSettings(){let r=salla.config.get("store.settings.quick_order");return r?(this.user=salla.config.get("user")||salla.storage.get("user")||{},this.countryCode=this.user?.country_code||this.countryCode,this.isEmailRequired=!this.user?.email&&this.isEmailRequired,this.oneClick=this.user?.email,this.initComponentData(r),Promise.resolve()):Promise.resolve()}initComponentData(r){this.quickOrderTitle=r.title,this.subTitle=r.sub_title,this.payButtonTitle=r.order_now_button,this.isEmailRequired=r.is_email_required,this.isTermsRequired=r.show_agreement,this.agreementText=r.agreement,this.confirmPayButtonTitle=r.confirm_button,this.thanksMessage=r.thanks_message,this.quickOrderStyle=r.style,this.isAvailable=!0,this.oneClick=this.oneClick&&!this.isTermsRequired}componentWillLoad(){return new Promise((r=>salla.onReady((()=>this.loadQuickOrderSettings().then(r)))))}render(){if(this.isAvailable)return this.submitSucess?e(i,{class:"s-quick-order"},e("div",{class:"s-quick-order-confirm",style:{backgroundColor:salla.config.get("theme.color.primary")+"10",borderColor:salla.config.get("theme.color.primary")+"10",color:salla.config.get("theme.color.primary")}},e("i",{innerHTML:'\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>party-horn</title>\n<path fill="currentColor" d="M5.333 4.013c0.736 0 1.333-0.596 1.333-1.333v-0.013c0-0.737-0.597-1.327-1.333-1.327s-1.333 0.603-1.333 1.34 0.597 1.333 1.333 1.333zM11.333 10c0.341 0 0.683-0.131 0.943-0.391 1.541-1.54 2.391-3.589 2.391-5.771v-2.505c0-0.737-0.597-1.333-1.333-1.333s-1.333 0.596-1.333 1.333v2.505c0 1.468-0.572 2.848-1.609 3.885-0.521 0.521-0.521 1.364 0 1.885 0.26 0.26 0.601 0.391 0.943 0.391zM18.667 9.993c0.319 0 0.639-0.115 0.895-0.345 0.383-0.347 0.684-0.325 1.497-0.22 0.923 0.124 2.319 0.307 3.636-0.887 1.293-1.172 1.303-2.54 1.308-3.539 0.005-0.887 0.043-1.228 0.432-1.581 0.361-0.327 0.621-0.335 1.493-0.216 0.923 0.12 2.317 0.307 3.635-0.884 0.545-0.495 0.587-1.337 0.093-1.883-0.493-0.547-1.336-0.589-1.884-0.093-0.361 0.325-0.621 0.333-1.493 0.216-0.921-0.119-2.317-0.305-3.635 0.884-1.293 1.173-1.303 2.541-1.308 3.54-0.005 0.885-0.043 1.227-0.432 1.58-0.383 0.348-0.683 0.327-1.497 0.22-0.924-0.124-2.32-0.305-3.636 0.887-0.545 0.495-0.587 1.339-0.092 1.884 0.264 0.291 0.625 0.437 0.988 0.437zM18.667 16.013c0.736 0 1.333-0.596 1.333-1.333v-0.013c0-0.737-0.597-1.327-1.333-1.327s-1.333 0.603-1.333 1.34 0.597 1.333 1.333 1.333zM30.667 17.333h-2.505c-2.179 0-4.228 0.849-5.771 2.391-0.521 0.521-0.521 1.364 0 1.885 0.26 0.26 0.603 0.391 0.944 0.391s0.683-0.131 0.943-0.391c1.023-1.023 2.439-1.609 3.884-1.609h2.505c0.736 0 1.333-0.596 1.333-1.333s-0.597-1.333-1.333-1.333zM30.667 10.66c-0.736 0-1.333 0.603-1.333 1.34s0.597 1.333 1.333 1.333 1.333-0.596 1.333-1.333v-0.013c0-0.736-0.597-1.327-1.333-1.327zM29.333 26.66c-0.736 0-1.333 0.603-1.333 1.34s0.597 1.333 1.333 1.333 1.333-0.596 1.333-1.333v-0.013c0-0.736-0.597-1.327-1.333-1.327zM7.456 11.057c-0.327-0.327-0.799-0.46-1.249-0.356-0.449 0.107-0.812 0.439-0.959 0.876l-5.036 15.113c-0.487 1.457-0.113 3.037 0.973 4.125 0.772 0.771 1.792 1.183 2.84 1.183 0.428 0 0.861-0.068 1.284-0.209l15.112-5.037c0.439-0.145 0.769-0.508 0.876-0.959 0.107-0.449-0.028-0.921-0.355-1.249zM4.467 29.259c-0.503 0.163-1.023 0.043-1.395-0.329-0.373-0.373-0.497-0.896-0.329-1.396l4.355-13.065 10.436 10.435z"></path>\n</svg>\n'}),e("span",null,this.thanksMessage))):e(i,{class:`s-quick-order s-quick-order-${this.getDarkOrLight()}`},e("div",{class:`s-quick-order-container s-quick-order-${this.quickOrderStyle}`,style:{backgroundColor:this.getStyleColor()}},e("div",{class:"s-quick-order-button-cont"},e("div",null,e("h3",null,this.quickOrderTitle),e("p",null,this.subTitle)),e("salla-button",{class:this.expanded?"s-quick-order-btn-close":"",onClick:r=>this.submit(r,!0),color:this.getBtnColor()},this.oneClick?this.confirmPayButtonTitle:this.expanded?e("i",{innerHTML:n}):this.confirmPayButtonTitle)),e("form",{onSubmit:r=>this.submit(r),class:"s-quick-order-expandable "+(this.expanded?"s-quick-order-shown":"")},Salla.config.isGuest()&&[e("div",{class:"s-form-group"},e("span",{innerHTML:'\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>portrait</title>\n<path d="M24 1.333h-16c-3.676 0-6.667 2.991-6.667 6.667v16c0 3.028 2.041 5.561 4.811 6.371 0.004 0.001 0.008 0.003 0.012 0.004 0.591 0.172 1.2 0.292 1.844 0.292h16c0.644 0 1.253-0.12 1.843-0.292 0.004-0.001 0.008-0.003 0.012-0.004 2.771-0.809 4.812-3.343 4.812-6.371v-16c0-3.676-2.991-6.667-6.667-6.667zM8.012 28c0.121-1.915 3.363-4 7.988-4s7.868 2.085 7.988 4zM28 24c0 1.24-0.579 2.335-1.467 3.069-0.768-3.288-5.112-5.736-10.533-5.736s-9.765 2.448-10.533 5.736c-0.888-0.735-1.467-1.829-1.467-3.069v-16c0-2.205 1.795-4 4-4h16c2.205 0 4 1.795 4 4zM16 6.667c-3.308 0-6 2.692-6 6s2.692 6 6 6 6-2.692 6-6-2.692-6-6-6zM16 16c-1.839 0-3.333-1.495-3.333-3.333s1.495-3.333 3.333-3.333 3.333 1.495 3.333 3.333-1.495 3.333-3.333 3.333z"></path>\n</svg>\n'}),e("input",{type:"text",required:!0,class:"s-form-control s-quick-order-phone-field",name:"name",placeholder:this.userNameLabel,ref:r=>this.nameInput=r})),e("div",{class:"s-quick-order-flex-input"},e("div",{class:"s-form-group"},e("span",{innerHTML:o}),e("salla-tel-input",{ref:r=>this.phoneInput=r})),e("div",{class:"s-form-group"},e("span",{innerHTML:a}),e("input",{type:"email",class:"s-form-control s-quick-order-email-field",name:"email",required:this.isEmailRequired,placeholder:this.placeHolderEmail+" "+(this.isEmailRequired?"":this.emailOptional),ref:r=>this.emailInput=r})))],this.isTermsRequired&&e("label",{htmlFor:"terms",class:"s-quick-order-terms"},e("input",{type:"checkbox",required:!0,name:"terms",id:"terms",ref:r=>this.termsInput=r,onChange:()=>this.termsChecked=this.termsInput.checked,class:"s-checkbox"}),e("span",{class:"s-form-label"}," ",e("div",{innerHTML:this.formatAgreementText(this.agreementText,150)},this.agreementText.length>150&&e("salla-button",{shape:"link",onClick:()=>this.agreementModal.open()},this.agreementShowText))," ")),e("salla-button",{type:"submit",color:this.getBtnColor(),width:"wide",ref:r=>this.submitBtn=r},this.payButtonTitle)),e("salla-modal",{"modal-title":this.agreementModalHead,ref:r=>this.agreementModal=r},e("article",{innerHTML:this.agreementText}))))}componentDidLoad(){this.host.querySelectorAll("input").forEach((r=>{r.addEventListener("invalid",(r=>{this.handleInvalidInput(r)})),r.addEventListener("input",(()=>{r.setCustomValidity(""),r.reportValidity()}))}))}get host(){return s(this)}};l.style='/*!twlt*/.s-quick-order-expandable:not(.s-quick-order-shown){overflow:hidden}.has-error .s-form-label{color:#ff443a}.has-error .s-form-control,.has-error .s-tel-input-control,.has-error .s-datetime-picker-input{border-color:#ff443a;color:#ff443a}.s-form-control{display:block;width:100%;border-radius:var(--s-radius, 0.25rem);border-width:1px;--tw-border-opacity:1;border-color:rgb(209 213 219 / var(--tw-border-opacity, 1));--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1));padding:0.5rem;font-size:0.875rem;line-height:1.25rem;--tw-text-opacity:1;color:rgb(17 24 39 / var(--tw-text-opacity, 1))}.s-form-control:focus{border-color:var(--color-primary);--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000)}.s-form-label{margin-bottom:0.25rem;display:block;font-size:0.875rem;line-height:1.25rem;font-weight:500;--tw-text-opacity:1;color:rgb(17 24 39 / var(--tw-text-opacity, 1))}.s-form-group{margin-top:0.75rem;margin-bottom:0.75rem}.s-checkbox{cursor:pointer;--tw-border-opacity:1;border-color:rgb(209 213 219 / var(--tw-border-opacity, 1));appearance:none;background-color:#fff;margin:0;width:18px;height:18px;border-width:1px;border-radius:4px;display:grid;place-content:center}.s-checkbox:before{width:10px;height:10px;clip-path:polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);transform:scale(0);transform-origin:bottom left;transition:120ms transform ease-in-out;box-shadow:inset 1em 1em #444;background-color:#444}.s-checkbox:checked:before{transform:scale(1)}.s-checkbox::before{--tw-content:\'\';content:var(--tw-content)}.s-quick-order-dark h1,.s-quick-order-dark p{color:#fff}.s-quick-order-container{margin-top:0.5rem;margin-bottom:0.5rem;border-radius:var(--s-radius, 0.25rem);padding:1rem}.s-quick-order-button-cont{margin-top:0.5rem;margin-bottom:0.5rem;display:flex;justify-content:space-between}.s-quick-order-checkbox-container{margin-top:0.5rem;margin-bottom:0.5rem;display:flex}.s-quick-order-checkbox-container input{margin-bottom:0.5rem;margin-left:0.5rem;height:2.5rem;width:100%;border-radius:var(--s-radius, 0.25rem);border-width:1px;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1));padding:0.5rem}.s-quick-order-expandable{max-height:0px;opacity:0;transition-property:all;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:100ms;transition-timing-function:cubic-bezier(0, 0, 0.2, 1)}.s-quick-order-expandable:not(.s-quick-order-shown){overflow:hidden}.s-quick-order-expandable.s-quick-order-shown{opacity:1}.s-quick-order-expandable .s-form-group{position:relative;flex-grow:1}.s-quick-order-expandable .s-form-group input{padding-left:35px}.s-quick-order-expandable .s-form-group input:where([dir="rtl"],[dir="rtl"] *){padding-right:35px}.s-quick-order-expandable .s-form-group>span{position:absolute;left:10px;top:30%;z-index:10}.s-quick-order-expandable .s-form-group>span:where([dir="rtl"],[dir="rtl"] *){left:auto;right:10px}.s-quick-order-expandable .s-form-group span svg{height:1rem;width:1rem;fill:#919191}.s-quick-order-flex-input{display:flex}.s-quick-order-flex-input>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-right:calc(0.5rem * var(--tw-space-x-reverse));margin-left:calc(0.5rem * calc(1 - var(--tw-space-x-reverse)))}.s-quick-order-flex-input:where([dir="rtl"],[dir="rtl"] *)>:not([hidden])~:not([hidden]){--tw-space-x-reverse:1}.s-quick-order-flex-input salla-tel-input{height:2.5rem;width:100%}.s-quick-order-errors p{font-size:0.875rem;line-height:1.25rem;--tw-text-opacity:1;color:rgb(185 28 28 / var(--tw-text-opacity, 1))}.s-quick-order-confirm{display:flex;align-items:center;justify-content:center;border-radius:var(--s-radius, 0.25rem);border-width:1px;padding:0.5rem}.s-quick-order-confirm span{margin-left:0.5rem;margin-right:0.5rem}.s-quick-order-confirm svg{height:1rem;width:1rem;fill:var(--color-primary)}.s-quick-order-terms .s-form-label{margin-bottom:0px !important;cursor:pointer}.s-quick-order-terms{margin-bottom:1rem;display:flex;align-items:center;justify-content:flex-start}.s-quick-order-terms>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-right:calc(0.375rem * var(--tw-space-x-reverse));margin-left:calc(0.375rem * calc(1 - var(--tw-space-x-reverse)))}.s-quick-order-terms:where([dir="rtl"],[dir="rtl"] *)>:not([hidden])~:not([hidden]){--tw-space-x-reverse:1}.s-quick-order-terms .s-checkbox::before{background-color:transparent;content:var(--tw-content);--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}.s-quick-order-terms .s-checkbox:focus{outline:2px solid transparent;outline-offset:2px;--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000);--tw-ring-offset-width:0px}.s-quick-order-btn-close button{border-radius:var(--s-radius, 0.25rem);padding:0.5rem !important}.s-quick-order-phone-field:where([dir="ltr"],[dir="ltr"] *){padding-left:28px !important;padding-right:87px}.s-quick-order-phone-field:where([dir="rtl"],[dir="rtl"] *){padding-right:28px !important;padding-left:87px}.s-quick-order-email-field:where([dir="ltr"],[dir="ltr"] *){padding-right:0px !important}.s-quick-order-email-field:where([dir="rtl"],[dir="rtl"] *){padding-left:0px !important}';export{l as salla_quick_order}
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r as t,h as s,H as a}from"./p-DSmjBlMI.js";const l=class{constructor(s){t(this,s),this.order=null,this.loading=!0}async componentWillLoad(){await salla.onReady(),await this.loadOrder()}async onOrderIdChange(){this.loading=!0,this.order=null,await this.loadOrder()}get paymentUrl(){return this.order?.customer_editing?.payment_url}async loadOrder(){const t=this.orderId||salla.config.get("page.id");if(t)try{const s=await salla.order.api.getDetails(t);this.order=s?.data??s??null}catch(t){salla.logger?.warn?.("[salla-edit-order-button] failed to fetch order details",t),this.order=null}finally{this.loading=!1}else this.loading=!1}renderEditButton(){return s("salla-count-down",{prefixText:salla.lang.getWithDefault("pages.orders.edit_within","يمكنك التعديل خلال"),buttonHref:this.order?.edit_url,buttonText:salla.lang.getWithDefault("pages.orders.edit_order","تعديل الطلب"),buttonIcon:"sicon-edit",date:this.order?.editable_until,horizontal:!0,autoSegments:!0,withButton:!0,labeled:!1,size:"sm",color:"primary"})}render(){return this.loading||!this.order?null:this.order?.is_editable?s(a,null,this.renderEditButton()):this.paymentUrl?s(a,null,s("salla-button",{href:this.paymentUrl,color:"primary",size:"small"},s("i",{class:"sicon-wallet"}),salla.lang.getWithDefault("pages.orders.pay_difference","دفع فارق المبلغ"))):null}static get watchers(){return{orderId:["onOrderIdChange"]}}};l.style="/*!twlt*/:host{display:block}";export{l as salla_edit_order_button}
4
+ import{r as t,h as s,H as a}from"./p-Z_0e-eaG.js";const l=class{constructor(s){t(this,s),this.order=null,this.loading=!0}async componentWillLoad(){await salla.onReady(),await this.loadOrder()}async onOrderIdChange(){this.loading=!0,this.order=null,await this.loadOrder()}get paymentUrl(){return this.order?.customer_editing?.payment_url}async loadOrder(){const t=this.orderId||salla.config.get("page.id");if(t)try{const s=await salla.order.api.getDetails(t);this.order=s?.data??s??null}catch(t){salla.logger?.warn?.("[salla-edit-order-button] failed to fetch order details",t),this.order=null}finally{this.loading=!1}else this.loading=!1}renderEditButton(){return s("salla-count-down",{prefixText:salla.lang.getWithDefault("pages.orders.edit_within","يمكنك التعديل خلال"),buttonHref:this.order?.edit_url,buttonText:salla.lang.getWithDefault("pages.orders.edit_order","تعديل الطلب"),buttonIcon:"sicon-edit",date:this.order?.editable_until,horizontal:!0,autoSegments:!0,withButton:!0,labeled:!1,size:"sm",color:"primary"})}render(){return this.loading||!this.order?null:this.order?.is_editable?s(a,null,this.renderEditButton()):this.paymentUrl?s(a,null,s("salla-button",{href:this.paymentUrl,color:"primary",size:"small"},s("i",{class:"sicon-wallet"}),salla.lang.getWithDefault("pages.orders.pay_difference","دفع فارق المبلغ"))):null}static get watchers(){return{orderId:["onOrderIdChange"]}}};l.style="/*!twlt*/:host{display:block}";export{l as salla_edit_order_button}
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r as t,h as r,H as a,a as e}from"./p-DSmjBlMI.js";import{S as o}from"./p-D4oPi1Ov.js";import{C as c}from"./p-gFG8By9O.js";const i=class{constructor(r){t(this,r),this.hideAddBtn=!1,this.showDonationAmount=!1,this.remained="",this.outOfStock="",this.donationAmount="",this.startingPrice="",this.addToCart="",this.placeholder="",this.COMPACT_TITLE_MAX_LENGTH=90}parseProductData(t){if(t)try{return"object"==typeof t?t:JSON.parse(t)}catch(t){return void salla.log("Bad json passed via product prop")}}handleProductChange(t){this.productData=this.parseProductData(t)}async componentWillLoad(){this.productData=this.parseProductData(this.product),await Promise.all([salla.onReady(),salla.lang.onLoaded()]),this.placeholder=salla.url.asset(salla.config.get("theme.settings.placeholder")),this.remained=salla.lang.get("pages.products.remained"),this.donationAmount=salla.lang.get("pages.products.donation_amount"),this.startingPrice=salla.lang.get("pages.products.starting_price"),this.addToCart=salla.lang.get("pages.cart.add_to_cart"),this.outOfStock=salla.lang.get("pages.products.out_of_stock")}getDisplayTitle(){const t=this.productData?.name||"";return t.length<=this.COMPACT_TITLE_MAX_LENGTH?t:t.slice(0,this.COMPACT_TITLE_MAX_LENGTH).trimEnd()+"…"}getProductBadge(){return!this.productData?.is_available&&this.productData?.quantity?r("div",{class:"s-search-product-card-quantity"},this.remained," ",salla.helpers.number(this.productData?.quantity)):this.productData.promotion_title?r("div",{class:"s-search-product-card-promotion-title"},this.productData.promotion_title):null}renderAddToCartLabel(){return r("slot",{name:"add-to-cart-label"},r("span",{class:"s-search-product-card-add-to-cart-icon",innerHTML:c}))}getPriceFormat(t){return t&&0!=t?salla.money(t):salla.config.get("store.settings.product.show_price_as_dash")?"-":""}getProductPrice(){return this.productData.is_on_sale?r("div",{class:"s-search-product-card-sale-price"},r("p",{class:"s-search-product-card-price-value",innerHTML:this.getPriceFormat(this.productData.sale_price)}),r("span",{innerHTML:this.getPriceFormat(this.productData?.regular_price)})):this.productData.starting_price?r("div",{class:"s-search-product-card-starting-price"},r("p",null,this.startingPrice),r("h4",{innerHTML:this.getPriceFormat(this.productData?.starting_price)})):r("p",{class:"s-search-product-card-price-value",innerHTML:this.getPriceFormat(this.productData?.price)})}render(){const t={"s-search-product-card-entry":!0,"s-search-product-card-horizontal":!0,"s-search-product-card-compact":!0,"s-search-product-card-donation":this.productData?.donation},e=this.productData?.url?{href:this.productData.url}:{};return r(a,{key:"68ea949b11eefd54cdc6f98efdfca9b88118618d",id:`search-product-${this.productData?.id}`,class:t},this.productData?.url?r("a",{class:"s-search-product-card-overlay-link","aria-label":this.productData?.name,...e}):null,r("div",{key:"b6edf8d163728c4bf676ff762156206b12c3e412",class:"s-search-product-card-image"},r("img",{key:"49d70e57178065d4cd82ab9969ef1024e17da13f",class:`s-search-product-card-image-${salla.url.is_placeholder(this.productData?.image?.url)?"contain":"cover"} lazy`,src:this.placeholder,alt:this.productData?.image?.alt||this.productData?.name,"data-src":this.productData?.image?.url||this.productData?.thumbnail}),this.getProductBadge()),r("div",{key:"1828cfa687675c9e0db05f52790e14e47fc62276",class:"s-search-product-card-content"},r("div",{key:"4def9eb945cbbf9392a11ab917652f32b40e855d",class:"s-search-product-card-content-main"},r("h3",{key:"fac38036cd00252f8b2625b51b45edcb0f8f386e",class:"s-search-product-card-content-title"},this.getDisplayTitle()),this.productData?.subtitle?r("p",{class:"s-search-product-card-content-subtitle"},this.productData?.subtitle):null),this.showDonationAmount&&this.productData?.donation?[r("salla-progress-bar",{donation:this.productData?.donation}),r("div",{class:"s-search-product-card-donation-input"},this.productData?.donation?.can_donate?[r("label",{htmlFor:"donation-amount"},this.donationAmount," ",r("span",null,"*")),r("input",{type:"text",onInput:t=>{salla.helpers.inputDigitsOnly(t.target),this.addBtn&&(this.addBtn.donatingAmount=t.target.value)},id:"donation-amount",name:"donating_amount",class:"s-form-control",placeholder:this.donationAmount})]:null)]:null,r("div",{key:"8a6b30d272e21ec90223437c9e47ae416aa2299b",class:"s-search-product-card-content-sub"},this.getProductPrice(),this.productData?.is_out_of_stock?r("span",{class:"s-search-product-card-out-of-stock-label"},this.outOfStock):null),this.productData?.rating?.stars?r("div",{class:"s-search-product-card-rating"},r("span",{innerHTML:o}),r("span",null,this.productData.rating.stars)):null),this.hideAddBtn?null:r("div",{class:"s-search-product-card-content-footer"},r("salla-add-product-button",{ref:t=>this.addBtn=t,"product-id":this.productData.id,"product-status":this.productData.status,"product-type":this.productData.type,class:"s-add-product-button-compact"},this.renderAddToCartLabel())))}componentDidLoad(){document.lazyLoadInstance?.update(this.host?.querySelectorAll(".lazy"))}get host(){return e(this)}static get watchers(){return{product:["handleProductChange"]}}};i.style='/*!twlt*/.s-search-product-card-image::before{font-family:"sallaicons";content:"\\ec1f" !important}.grid{display:grid}.has-error .s-form-control,.has-error .s-tel-input-control,.has-error .s-datetime-picker-input{border-color:#ff443a;color:#ff443a}.s-form-control{display:block;width:100%;border-radius:var(--s-radius, 0.25rem);border-width:1px;--tw-border-opacity:1;border-color:rgb(209 213 219 / var(--tw-border-opacity, 1));--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1));padding:0.5rem;font-size:0.875rem;line-height:1.25rem;--tw-text-opacity:1;color:rgb(17 24 39 / var(--tw-text-opacity, 1))}.s-form-control:focus{border-color:var(--color-primary);--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000)}.s-search-product-card-entry{position:relative;display:flex;height:100%;justify-content:space-between;border-radius:var(--s-radius, 0.25rem);transition-property:box-shadow;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:300ms}.s-search-product-card-out-of-stock img.loaded{--tw-grayscale:grayscale(100%);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.s-search-product-card-quantity{position:absolute;bottom:0.25rem;left:50%;z-index:1;max-width:calc(100% - 60px);--tw-translate-x:-50%;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));border-radius:var(--s-radius, 0.25rem);--tw-bg-opacity:1;background-color:rgb(248 113 113 / var(--tw-bg-opacity, 1));padding-left:0.625rem;padding-right:0.625rem;padding-top:0.375rem;padding-bottom:0.375rem;font-size:0.75rem;line-height:1rem;font-weight:700;--tw-text-opacity:1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}@media (min-width: 768px){.s-search-product-card-quantity{padding-top:0.5rem;padding-bottom:0.5rem}}.s-search-product-card-promotion-title{position:absolute;top:1rem;left:0px;z-index:1;max-width:calc(100% - 60px);border-top-right-radius:var(--s-radius, 0.25rem);border-bottom-right-radius:var(--s-radius, 0.25rem);--tw-bg-opacity:1;background-color:rgb(248 113 113 / var(--tw-bg-opacity, 1));padding-left:0.625rem;padding-right:0.625rem;padding-top:0.375rem;padding-bottom:0.375rem;font-size:0.75rem;line-height:1rem;font-weight:700;--tw-text-opacity:1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}@media (min-width: 768px){.s-search-product-card-promotion-title{padding-top:0.5rem;padding-bottom:0.5rem}}.s-search-product-card-promotion-title:where([dir="rtl"],[dir="rtl"] *){right:0px;left:unset;border-top-left-radius:var(--s-radius, 0.25rem);border-bottom-left-radius:var(--s-radius, 0.25rem);border-top-right-radius:0px;border-bottom-right-radius:0px}.s-search-product-card-image{position:relative;height:100%;width:100%;flex-shrink:0;overflow:hidden;--tw-bg-opacity:1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.s-search-product-card-image::before{position:absolute;top:50%;left:50%;display:inline-block;--tw-translate-x:-50%;--tw-translate-y:-50%;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));font-size:1.875rem;line-height:2.25rem;content:var(--tw-content);--tw-text-opacity:1;color:rgb(229 231 235 / var(--tw-text-opacity, 1))}.s-search-product-card-image:hover{opacity:0.9}.s-search-product-card-image img{height:100%;width:100%;transition-property:opacity;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:500ms}.s-search-product-card-image img.lazy{opacity:0}.s-search-product-card-image img.loaded{position:relative;opacity:1}.s-search-product-card-content{position:relative;display:flex;flex-direction:column;padding:0.75rem}@media (min-width: 640px){.s-search-product-card-content{padding:1.25rem}}.s-search-product-card-content-title{margin-bottom:0.625rem;display:block;max-width:100%;text-align:start;font-size:0.875rem;font-weight:700;line-height:1.5rem;--tw-text-opacity:1;color:rgb(31 41 55 / var(--tw-text-opacity, 1))}.s-search-product-card-content-title:hover{color:var(--color-primary)}.s-search-product-card-content-subtitle{margin-bottom:0.625rem;font-size:0.875rem;line-height:1.5rem;--tw-text-opacity:1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.s-search-product-card-donation-input{position:relative;z-index:2;flex:1 1 0%}.s-search-product-card-donation-input label{margin-bottom:0.625rem;display:block;font-size:0.875rem;line-height:1.25rem}.s-search-product-card-donation-input label span{--tw-text-opacity:1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.s-search-product-card-overlay-link{position:absolute;inset:0px;z-index:1}.s-search-product-card-content-sub{margin-bottom:1.25rem;display:flex;width:100%;align-items:center;justify-content:space-between}.s-search-product-card-out-of-stock-label{font-size:0.75rem;line-height:1rem;font-weight:700;--tw-text-opacity:1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.s-search-product-card-rating{margin-top:0.5rem;display:flex;align-items:center}.s-search-product-card-rating>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-right:calc(0.25rem * var(--tw-space-x-reverse));margin-left:calc(0.25rem * calc(1 - var(--tw-space-x-reverse)))}.s-search-product-card-rating{font-size:0.875rem;line-height:1.25rem;--tw-text-opacity:1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.s-search-product-card-rating:where([dir="rtl"],[dir="rtl"] *)>:not([hidden])~:not([hidden]){--tw-space-x-reverse:1}.s-search-product-card-rating span svg{margin-bottom:3px;height:1rem;width:1rem;fill:#fbbf24}.s-search-product-card-content-footer{margin-top:auto;display:flex;align-items:center}.s-search-product-card-sale-price>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-right:calc(0.5rem * var(--tw-space-x-reverse));margin-left:calc(0.5rem * calc(1 - var(--tw-space-x-reverse)))}.s-search-product-card-sale-price:where([dir="rtl"],[dir="rtl"] *)>:not([hidden])~:not([hidden]){--tw-space-x-reverse:1}.s-search-product-card-sale-price span{font-size:0.875rem;line-height:1.25rem;--tw-text-opacity:1;color:rgb(156 163 175 / var(--tw-text-opacity, 1));text-decoration-line:line-through}.s-search-product-card-starting-price{display:flex;align-items:center;justify-content:space-between}.s-search-product-card-starting-price h4{display:inline-block;font-size:0.875rem;line-height:1.25rem;font-weight:700;--tw-text-opacity:1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.s-search-product-card-price-value{display:inline-block;font-size:0.875rem;line-height:1.25rem;font-weight:700;--tw-text-opacity:1;color:rgb(31 41 55 / var(--tw-text-opacity, 1))}.s-search-product-card-image-cover{object-fit:cover}.s-search-product-card-image-contain{object-fit:contain}.s-search-product-card-add-to-cart-icon svg{height:1rem;width:1rem;fill:currentColor}.s-search-product-card-horizontal .s-search-product-card-image{height:auto;width:8rem}@media (min-width: 640px){.s-search-product-card-horizontal .s-search-product-card-image{width:14rem}}.s-search-product-card-horizontal .s-search-product-card-image:where([dir="ltr"],[dir="ltr"] *){border-top-left-radius:var(--s-radius, 0.25rem);border-bottom-left-radius:var(--s-radius, 0.25rem)}.s-search-product-card-horizontal .s-search-product-card-image:where([dir="rtl"],[dir="rtl"] *){border-top-right-radius:var(--s-radius, 0.25rem);border-bottom-right-radius:var(--s-radius, 0.25rem)}.s-search-product-card-horizontal .s-search-product-card-quantity{max-width:unset}.s-search-product-card-horizontal .s-search-product-card-content-title{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:3}.s-search-product-card-horizontal .s-search-product-card-promotion-title{max-width:unset}.s-search-product-card-horizontal .s-search-product-card-content{margin-bottom:0.625rem;width:100%}.s-search-product-card-compact{display:flex;cursor:pointer;flex-direction:row;align-items:center;gap:0.75rem;padding-top:0.75rem;padding-bottom:0.75rem;padding-left:0px;padding-right:0px;transition-property:all;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:200ms}.s-search-product-card-compact .s-search-product-card-content-footer{position:relative;z-index:2;margin-top:0px;flex-shrink:0;gap:0.5rem}.s-search-product-card-compact .s-add-product-button-compact salla-button .s-button-btn{height:2rem;border-radius:0.375rem;border-width:1px;border-color:var(--color-primary);background-color:transparent;padding-left:0.75rem;padding-right:0.75rem;font-size:0.75rem;line-height:1rem;font-weight:500;color:var(--color-primary);transition-property:all;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:200ms}.s-search-product-card-compact .s-add-product-button-compact salla-button .s-button-btn:hover{border-color:var(--color-primary);background-color:var(--color-primary);--tw-bg-opacity:0.1;--tw-text-opacity:1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.s-search-product-card-compact .s-search-product-card-content{min-width:0px;flex:1 1 0%;padding:0px;text-align:right}.s-search-product-card-compact .s-search-product-card-content-title{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:3;font-size:0.875rem;line-height:1.25rem;font-weight:500;line-height:1.25;--tw-text-opacity:1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.s-search-product-card-compact .s-search-product-card-content-subtitle{margin-top:0.25rem;display:none;font-size:0.75rem;line-height:1rem;--tw-text-opacity:1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.s-search-product-card-compact .s-search-product-card-content-sub{margin-bottom:0px;display:flex;align-items:center;justify-content:flex-start;gap:0.5rem;font-size:0.75rem;line-height:1rem;--tw-text-opacity:1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.s-search-product-card-compact .s-search-product-card-content-sub h4{margin:0px}.s-search-product-card-compact .s-search-product-card-starting-price h4{font-weight:700}.s-search-product-card-compact .s-search-product-card-starting-price{justify-content:flex-start;gap:0.25rem}.s-search-product-card-compact .s-search-product-card-image{height:5rem;width:5rem;flex-shrink:0;border-radius:0.375rem}.s-search-product-card-compact .s-search-product-card-image img{height:100%;width:100%;border-radius:0.375rem;object-fit:cover}.s-search-product-card-compact .s-search-product-card-promotion-title{display:none}';export{i as salla_search_product_card}
4
+ import{r as t,h as r,H as a,a as e}from"./p-Z_0e-eaG.js";import{S as o}from"./p-D4oPi1Ov.js";import{C as c}from"./p-gFG8By9O.js";const i=class{constructor(r){t(this,r),this.hideAddBtn=!1,this.showDonationAmount=!1,this.remained="",this.outOfStock="",this.donationAmount="",this.startingPrice="",this.addToCart="",this.placeholder="",this.COMPACT_TITLE_MAX_LENGTH=90}parseProductData(t){if(t)try{return"object"==typeof t?t:JSON.parse(t)}catch(t){return void salla.log("Bad json passed via product prop")}}handleProductChange(t){this.productData=this.parseProductData(t)}async componentWillLoad(){this.productData=this.parseProductData(this.product),await Promise.all([salla.onReady(),salla.lang.onLoaded()]),this.placeholder=salla.url.asset(salla.config.get("theme.settings.placeholder")),this.remained=salla.lang.get("pages.products.remained"),this.donationAmount=salla.lang.get("pages.products.donation_amount"),this.startingPrice=salla.lang.get("pages.products.starting_price"),this.addToCart=salla.lang.get("pages.cart.add_to_cart"),this.outOfStock=salla.lang.get("pages.products.out_of_stock")}getDisplayTitle(){const t=this.productData?.name||"";return t.length<=this.COMPACT_TITLE_MAX_LENGTH?t:t.slice(0,this.COMPACT_TITLE_MAX_LENGTH).trimEnd()+"…"}getProductBadge(){return!this.productData?.is_available&&this.productData?.quantity?r("div",{class:"s-search-product-card-quantity"},this.remained," ",salla.helpers.number(this.productData?.quantity)):this.productData.promotion_title?r("div",{class:"s-search-product-card-promotion-title"},this.productData.promotion_title):null}renderAddToCartLabel(){return r("slot",{name:"add-to-cart-label"},r("span",{class:"s-search-product-card-add-to-cart-icon",innerHTML:c}))}getPriceFormat(t){return t&&0!=t?salla.money(t):salla.config.get("store.settings.product.show_price_as_dash")?"-":""}getProductPrice(){return this.productData.is_on_sale?r("div",{class:"s-search-product-card-sale-price"},r("p",{class:"s-search-product-card-price-value",innerHTML:this.getPriceFormat(this.productData.sale_price)}),r("span",{innerHTML:this.getPriceFormat(this.productData?.regular_price)})):this.productData.starting_price?r("div",{class:"s-search-product-card-starting-price"},r("p",null,this.startingPrice),r("h4",{innerHTML:this.getPriceFormat(this.productData?.starting_price)})):r("p",{class:"s-search-product-card-price-value",innerHTML:this.getPriceFormat(this.productData?.price)})}render(){const t={"s-search-product-card-entry":!0,"s-search-product-card-horizontal":!0,"s-search-product-card-compact":!0,"s-search-product-card-donation":this.productData?.donation},e=this.productData?.url?{href:this.productData.url}:{};return r(a,{key:"68ea949b11eefd54cdc6f98efdfca9b88118618d",id:`search-product-${this.productData?.id}`,class:t},this.productData?.url?r("a",{class:"s-search-product-card-overlay-link","aria-label":this.productData?.name,...e}):null,r("div",{key:"b6edf8d163728c4bf676ff762156206b12c3e412",class:"s-search-product-card-image"},r("img",{key:"49d70e57178065d4cd82ab9969ef1024e17da13f",class:`s-search-product-card-image-${salla.url.is_placeholder(this.productData?.image?.url)?"contain":"cover"} lazy`,src:this.placeholder,alt:this.productData?.image?.alt||this.productData?.name,"data-src":this.productData?.image?.url||this.productData?.thumbnail}),this.getProductBadge()),r("div",{key:"1828cfa687675c9e0db05f52790e14e47fc62276",class:"s-search-product-card-content"},r("div",{key:"4def9eb945cbbf9392a11ab917652f32b40e855d",class:"s-search-product-card-content-main"},r("h3",{key:"fac38036cd00252f8b2625b51b45edcb0f8f386e",class:"s-search-product-card-content-title"},this.getDisplayTitle()),this.productData?.subtitle?r("p",{class:"s-search-product-card-content-subtitle"},this.productData?.subtitle):null),this.showDonationAmount&&this.productData?.donation?[r("salla-progress-bar",{donation:this.productData?.donation}),r("div",{class:"s-search-product-card-donation-input"},this.productData?.donation?.can_donate?[r("label",{htmlFor:"donation-amount"},this.donationAmount," ",r("span",null,"*")),r("input",{type:"text",onInput:t=>{salla.helpers.inputDigitsOnly(t.target),this.addBtn&&(this.addBtn.donatingAmount=t.target.value)},id:"donation-amount",name:"donating_amount",class:"s-form-control",placeholder:this.donationAmount})]:null)]:null,r("div",{key:"8a6b30d272e21ec90223437c9e47ae416aa2299b",class:"s-search-product-card-content-sub"},this.getProductPrice(),this.productData?.is_out_of_stock?r("span",{class:"s-search-product-card-out-of-stock-label"},this.outOfStock):null),this.productData?.rating?.stars?r("div",{class:"s-search-product-card-rating"},r("span",{innerHTML:o}),r("span",null,this.productData.rating.stars)):null),this.hideAddBtn?null:r("div",{class:"s-search-product-card-content-footer"},r("salla-add-product-button",{ref:t=>this.addBtn=t,"product-id":this.productData.id,"product-status":this.productData.status,"product-type":this.productData.type,class:"s-add-product-button-compact"},this.renderAddToCartLabel())))}componentDidLoad(){document.lazyLoadInstance?.update(this.host?.querySelectorAll(".lazy"))}get host(){return e(this)}static get watchers(){return{product:["handleProductChange"]}}};i.style='/*!twlt*/.s-search-product-card-image::before{font-family:"sallaicons";content:"\\ec1f" !important}.grid{display:grid}.has-error .s-form-control,.has-error .s-tel-input-control,.has-error .s-datetime-picker-input{border-color:#ff443a;color:#ff443a}.s-form-control{display:block;width:100%;border-radius:var(--s-radius, 0.25rem);border-width:1px;--tw-border-opacity:1;border-color:rgb(209 213 219 / var(--tw-border-opacity, 1));--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1));padding:0.5rem;font-size:0.875rem;line-height:1.25rem;--tw-text-opacity:1;color:rgb(17 24 39 / var(--tw-text-opacity, 1))}.s-form-control:focus{border-color:var(--color-primary);--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000)}.s-search-product-card-entry{position:relative;display:flex;height:100%;justify-content:space-between;border-radius:var(--s-radius, 0.25rem);transition-property:box-shadow;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:300ms}.s-search-product-card-out-of-stock img.loaded{--tw-grayscale:grayscale(100%);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.s-search-product-card-quantity{position:absolute;bottom:0.25rem;left:50%;z-index:1;max-width:calc(100% - 60px);--tw-translate-x:-50%;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));border-radius:var(--s-radius, 0.25rem);--tw-bg-opacity:1;background-color:rgb(248 113 113 / var(--tw-bg-opacity, 1));padding-left:0.625rem;padding-right:0.625rem;padding-top:0.375rem;padding-bottom:0.375rem;font-size:0.75rem;line-height:1rem;font-weight:700;--tw-text-opacity:1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}@media (min-width: 768px){.s-search-product-card-quantity{padding-top:0.5rem;padding-bottom:0.5rem}}.s-search-product-card-promotion-title{position:absolute;top:1rem;left:0px;z-index:1;max-width:calc(100% - 60px);border-top-right-radius:var(--s-radius, 0.25rem);border-bottom-right-radius:var(--s-radius, 0.25rem);--tw-bg-opacity:1;background-color:rgb(248 113 113 / var(--tw-bg-opacity, 1));padding-left:0.625rem;padding-right:0.625rem;padding-top:0.375rem;padding-bottom:0.375rem;font-size:0.75rem;line-height:1rem;font-weight:700;--tw-text-opacity:1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}@media (min-width: 768px){.s-search-product-card-promotion-title{padding-top:0.5rem;padding-bottom:0.5rem}}.s-search-product-card-promotion-title:where([dir="rtl"],[dir="rtl"] *){right:0px;left:unset;border-top-left-radius:var(--s-radius, 0.25rem);border-bottom-left-radius:var(--s-radius, 0.25rem);border-top-right-radius:0px;border-bottom-right-radius:0px}.s-search-product-card-image{position:relative;height:100%;width:100%;flex-shrink:0;overflow:hidden;--tw-bg-opacity:1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.s-search-product-card-image::before{position:absolute;top:50%;left:50%;display:inline-block;--tw-translate-x:-50%;--tw-translate-y:-50%;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));font-size:1.875rem;line-height:2.25rem;content:var(--tw-content);--tw-text-opacity:1;color:rgb(229 231 235 / var(--tw-text-opacity, 1))}.s-search-product-card-image:hover{opacity:0.9}.s-search-product-card-image img{height:100%;width:100%;transition-property:opacity;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:500ms}.s-search-product-card-image img.lazy{opacity:0}.s-search-product-card-image img.loaded{position:relative;opacity:1}.s-search-product-card-content{position:relative;display:flex;flex-direction:column;padding:0.75rem}@media (min-width: 640px){.s-search-product-card-content{padding:1.25rem}}.s-search-product-card-content-title{margin-bottom:0.625rem;display:block;max-width:100%;text-align:start;font-size:0.875rem;font-weight:700;line-height:1.5rem;--tw-text-opacity:1;color:rgb(31 41 55 / var(--tw-text-opacity, 1))}.s-search-product-card-content-title:hover{color:var(--color-primary)}.s-search-product-card-content-subtitle{margin-bottom:0.625rem;font-size:0.875rem;line-height:1.5rem;--tw-text-opacity:1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.s-search-product-card-donation-input{position:relative;z-index:2;flex:1 1 0%}.s-search-product-card-donation-input label{margin-bottom:0.625rem;display:block;font-size:0.875rem;line-height:1.25rem}.s-search-product-card-donation-input label span{--tw-text-opacity:1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.s-search-product-card-overlay-link{position:absolute;inset:0px;z-index:1}.s-search-product-card-content-sub{margin-bottom:1.25rem;display:flex;width:100%;align-items:center;justify-content:space-between}.s-search-product-card-out-of-stock-label{font-size:0.75rem;line-height:1rem;font-weight:700;--tw-text-opacity:1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.s-search-product-card-rating{margin-top:0.5rem;display:flex;align-items:center}.s-search-product-card-rating>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-right:calc(0.25rem * var(--tw-space-x-reverse));margin-left:calc(0.25rem * calc(1 - var(--tw-space-x-reverse)))}.s-search-product-card-rating{font-size:0.875rem;line-height:1.25rem;--tw-text-opacity:1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.s-search-product-card-rating:where([dir="rtl"],[dir="rtl"] *)>:not([hidden])~:not([hidden]){--tw-space-x-reverse:1}.s-search-product-card-rating span svg{margin-bottom:3px;height:1rem;width:1rem;fill:#fbbf24}.s-search-product-card-content-footer{margin-top:auto;display:flex;align-items:center}.s-search-product-card-sale-price>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-right:calc(0.5rem * var(--tw-space-x-reverse));margin-left:calc(0.5rem * calc(1 - var(--tw-space-x-reverse)))}.s-search-product-card-sale-price:where([dir="rtl"],[dir="rtl"] *)>:not([hidden])~:not([hidden]){--tw-space-x-reverse:1}.s-search-product-card-sale-price span{font-size:0.875rem;line-height:1.25rem;--tw-text-opacity:1;color:rgb(156 163 175 / var(--tw-text-opacity, 1));text-decoration-line:line-through}.s-search-product-card-starting-price{display:flex;align-items:center;justify-content:space-between}.s-search-product-card-starting-price h4{display:inline-block;font-size:0.875rem;line-height:1.25rem;font-weight:700;--tw-text-opacity:1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.s-search-product-card-price-value{display:inline-block;font-size:0.875rem;line-height:1.25rem;font-weight:700;--tw-text-opacity:1;color:rgb(31 41 55 / var(--tw-text-opacity, 1))}.s-search-product-card-image-cover{object-fit:cover}.s-search-product-card-image-contain{object-fit:contain}.s-search-product-card-add-to-cart-icon svg{height:1rem;width:1rem;fill:currentColor}.s-search-product-card-horizontal .s-search-product-card-image{height:auto;width:8rem}@media (min-width: 640px){.s-search-product-card-horizontal .s-search-product-card-image{width:14rem}}.s-search-product-card-horizontal .s-search-product-card-image:where([dir="ltr"],[dir="ltr"] *){border-top-left-radius:var(--s-radius, 0.25rem);border-bottom-left-radius:var(--s-radius, 0.25rem)}.s-search-product-card-horizontal .s-search-product-card-image:where([dir="rtl"],[dir="rtl"] *){border-top-right-radius:var(--s-radius, 0.25rem);border-bottom-right-radius:var(--s-radius, 0.25rem)}.s-search-product-card-horizontal .s-search-product-card-quantity{max-width:unset}.s-search-product-card-horizontal .s-search-product-card-content-title{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:3}.s-search-product-card-horizontal .s-search-product-card-promotion-title{max-width:unset}.s-search-product-card-horizontal .s-search-product-card-content{margin-bottom:0.625rem;width:100%}.s-search-product-card-compact{display:flex;cursor:pointer;flex-direction:row;align-items:center;gap:0.75rem;padding-top:0.75rem;padding-bottom:0.75rem;padding-left:0px;padding-right:0px;transition-property:all;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:200ms}.s-search-product-card-compact .s-search-product-card-content-footer{position:relative;z-index:2;margin-top:0px;flex-shrink:0;gap:0.5rem}.s-search-product-card-compact .s-add-product-button-compact salla-button .s-button-btn{height:2rem;border-radius:0.375rem;border-width:1px;border-color:var(--color-primary);background-color:transparent;padding-left:0.75rem;padding-right:0.75rem;font-size:0.75rem;line-height:1rem;font-weight:500;color:var(--color-primary);transition-property:all;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:200ms}.s-search-product-card-compact .s-add-product-button-compact salla-button .s-button-btn:hover{border-color:var(--color-primary);background-color:var(--color-primary);--tw-bg-opacity:0.1;--tw-text-opacity:1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.s-search-product-card-compact .s-search-product-card-content{min-width:0px;flex:1 1 0%;padding:0px;text-align:right}.s-search-product-card-compact .s-search-product-card-content-title{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:3;font-size:0.875rem;line-height:1.25rem;font-weight:500;line-height:1.25;--tw-text-opacity:1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.s-search-product-card-compact .s-search-product-card-content-subtitle{margin-top:0.25rem;display:none;font-size:0.75rem;line-height:1rem;--tw-text-opacity:1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.s-search-product-card-compact .s-search-product-card-content-sub{margin-bottom:0px;display:flex;align-items:center;justify-content:flex-start;gap:0.5rem;font-size:0.75rem;line-height:1rem;--tw-text-opacity:1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.s-search-product-card-compact .s-search-product-card-content-sub h4{margin:0px}.s-search-product-card-compact .s-search-product-card-starting-price h4{font-weight:700}.s-search-product-card-compact .s-search-product-card-starting-price{justify-content:flex-start;gap:0.25rem}.s-search-product-card-compact .s-search-product-card-image{height:5rem;width:5rem;flex-shrink:0;border-radius:0.375rem}.s-search-product-card-compact .s-search-product-card-image img{height:100%;width:100%;border-radius:0.375rem;object-fit:cover}.s-search-product-card-compact .s-search-product-card-promotion-title{display:none}';export{i as salla_search_product_card}
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r as a,h as t,H as l,a as n}from"./p-DSmjBlMI.js";const s=class{constructor(t){a(this,t),this.pointsData=null,this.productId=null}async componentWillLoad(){try{if(await salla.onReady(),await salla.lang.onLoaded(),this.productId=this.host.dataset.productId||salla.config.get("page.id"),!this.productId)return;const a=await salla.api.request(`/loyalty/products/${this.productId}/points`).catch((()=>null));this.pointsData=a?.data||null}catch(a){salla?.logger?.warn?.("salla-loyalty-points-banner: init failed",a)}}render(){return this.productId&&this.pointsData?.points?t(l,null,t("div",{class:"s-loyalty-points-banner-container"},t("div",{class:"s-loyalty-points-banner-icon"},t("span",{class:"s-loyalty-points-banner-inner-icon",innerHTML:'<svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M8.76604 2.86201C9.31804 2.61001 9.93304 2.41501 10.611 2.27701C11.289 2.13901 12 2.07001 12.744 2.07001C13.572 2.07001 14.364 2.15401 15.12 2.32201C15.84 2.49001 16.356 2.81401 16.668 3.29401C16.932 3.70201 17.064 4.26001 17.064 4.96801V13.032C17.064 13.416 16.95 13.752 16.722 14.04C16.506 14.304 16.227 14.493 15.885 14.607C15.543 14.721 15.204 14.742 14.868 14.67C14.196 14.514 13.488 14.436 12.744 14.436C12.084 14.436 11.442 14.502 10.818 14.634C10.23 14.754 9.70204 14.922 9.23404 15.138C8.68204 15.39 8.06704 15.585 7.38904 15.723C6.71104 15.861 6.00004 15.93 5.25604 15.93C4.42804 15.93 3.63604 15.846 2.88004 15.678C2.18404 15.522 1.68004 15.21 1.36804 14.742C1.08004 14.322 0.936035 13.752 0.936035 13.032V4.96801C0.936035 4.58401 1.05004 4.24801 1.27804 3.96001C1.49404 3.69601 1.77304 3.50701 2.11504 3.39301C2.45704 3.27901 2.79604 3.25801 3.13204 3.33001C3.80404 3.48601 4.51204 3.56401 5.25604 3.56401C5.91604 3.56401 6.55804 3.49801 7.18204 3.36601C7.77004 3.24601 8.29804 3.07801 8.76604 2.86201ZM11.25 9.00001C11.25 8.59201 11.148 8.21701 10.944 7.87501C10.74 7.53301 10.467 7.26001 10.125 7.05601C9.78304 6.85201 9.40804 6.75001 9.00004 6.75001C8.59204 6.75001 8.21704 6.85201 7.87504 7.05601C7.53304 7.26001 7.26004 7.53301 7.05604 7.87501C6.85204 8.21701 6.75004 8.59201 6.75004 9.00001C6.75004 9.40801 6.85204 9.78301 7.05604 10.125C7.26004 10.467 7.53304 10.74 7.87504 10.944C8.21704 11.148 8.59204 11.25 9.00004 11.25C9.40804 11.25 9.78304 11.148 10.125 10.944C10.467 10.74 10.74 10.467 10.944 10.125C11.148 9.78301 11.25 9.40801 11.25 9.00001ZM14.328 7.79401C14.076 7.75801 13.812 7.73401 13.536 7.72201C13.38 7.71001 13.245 7.75501 13.131 7.85701C13.017 7.95901 12.954 8.08801 12.942 8.24401C12.93 8.40001 12.975 8.53501 13.077 8.64901C13.179 8.76301 13.308 8.82601 13.464 8.83801C13.704 8.85001 13.938 8.87401 14.166 8.91001C14.322 8.93401 14.463 8.90101 14.589 8.81101C14.715 8.72101 14.787 8.59801 14.805 8.44201C14.823 8.28601 14.787 8.14501 14.697 8.01901C14.607 7.89301 14.484 7.81801 14.328 7.79401ZM4.53604 9.16201C4.29604 9.15001 4.06204 9.12601 3.83404 9.09001C3.67804 9.06601 3.53704 9.09901 3.41104 9.18901C3.28504 9.27901 3.21304 9.40201 3.19504 9.55801C3.17704 9.71401 3.21304 9.85501 3.30304 9.98101C3.39304 10.107 3.51604 10.182 3.67204 10.206C3.92404 10.242 4.18804 10.266 4.46404 10.278C4.62004 10.29 4.75504 10.245 4.86904 10.143C4.98304 10.041 5.04604 9.91201 5.05804 9.75601C5.07004 9.60001 5.02504 9.46501 4.92304 9.35101C4.82104 9.23701 4.69204 9.17401 4.53604 9.16201Z" fill="white"/>\n</svg>\n'})),t("p",null,t("span",{class:"s-loyalty-points-banner-label"},salla.lang.get("pages.loyalty_program.earn")," "),t("span",{class:"s-loyalty-points-banner-label"},`+${this.pointsData.points}`," "),t("span",{class:"s-loyalty-points-banner-label"},salla.lang.get("pages.loyalty_program.loyalty_point")," "),t("span",{class:"s-loyalty-points-banner-description"},salla.lang.get("pages.loyalty_program.on_order_total_when_purchase"))))):null}get host(){return n(this)}};s.style="/*!twlt*/.s-loyalty-points-banner-container{margin-bottom:0.75rem;display:flex;width:100%;align-items:center;gap:0.5rem;border-radius:0.5rem;background-color:rgb(209 180 76 / var(--tw-bg-opacity, 1));--tw-bg-opacity:0.1;padding-left:0.75rem;padding-right:0.75rem;padding-top:0.5rem;padding-bottom:0.5rem}.s-loyalty-points-banner-icon{display:flex;height:2rem;width:2rem;flex-shrink:0;align-items:center;justify-content:center;border-radius:9999px;--tw-bg-opacity:1;background-color:rgb(209 180 76 / var(--tw-bg-opacity, 1))}.s-loyalty-points-banner-label{font-size:0.875rem;line-height:1.25rem;font-weight:700;--tw-text-opacity:1;color:rgb(209 180 76 / var(--tw-text-opacity, 1))}.s-loyalty-points-banner-description{font-size:0.875rem;line-height:1.25rem}";export{s as salla_loyalty_points_banner}
4
+ import{r as a,h as t,H as l,a as n}from"./p-Z_0e-eaG.js";const s=class{constructor(t){a(this,t),this.pointsData=null,this.productId=null}async componentWillLoad(){try{if(await salla.onReady(),await salla.lang.onLoaded(),this.productId=this.host.dataset.productId||salla.config.get("page.id"),!this.productId)return;const a=await salla.api.request(`/loyalty/products/${this.productId}/points`).catch((()=>null));this.pointsData=a?.data||null}catch(a){salla?.logger?.warn?.("salla-loyalty-points-banner: init failed",a)}}render(){return this.productId&&this.pointsData?.points?t(l,null,t("div",{class:"s-loyalty-points-banner-container"},t("div",{class:"s-loyalty-points-banner-icon"},t("span",{class:"s-loyalty-points-banner-inner-icon",innerHTML:'<svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M8.76604 2.86201C9.31804 2.61001 9.93304 2.41501 10.611 2.27701C11.289 2.13901 12 2.07001 12.744 2.07001C13.572 2.07001 14.364 2.15401 15.12 2.32201C15.84 2.49001 16.356 2.81401 16.668 3.29401C16.932 3.70201 17.064 4.26001 17.064 4.96801V13.032C17.064 13.416 16.95 13.752 16.722 14.04C16.506 14.304 16.227 14.493 15.885 14.607C15.543 14.721 15.204 14.742 14.868 14.67C14.196 14.514 13.488 14.436 12.744 14.436C12.084 14.436 11.442 14.502 10.818 14.634C10.23 14.754 9.70204 14.922 9.23404 15.138C8.68204 15.39 8.06704 15.585 7.38904 15.723C6.71104 15.861 6.00004 15.93 5.25604 15.93C4.42804 15.93 3.63604 15.846 2.88004 15.678C2.18404 15.522 1.68004 15.21 1.36804 14.742C1.08004 14.322 0.936035 13.752 0.936035 13.032V4.96801C0.936035 4.58401 1.05004 4.24801 1.27804 3.96001C1.49404 3.69601 1.77304 3.50701 2.11504 3.39301C2.45704 3.27901 2.79604 3.25801 3.13204 3.33001C3.80404 3.48601 4.51204 3.56401 5.25604 3.56401C5.91604 3.56401 6.55804 3.49801 7.18204 3.36601C7.77004 3.24601 8.29804 3.07801 8.76604 2.86201ZM11.25 9.00001C11.25 8.59201 11.148 8.21701 10.944 7.87501C10.74 7.53301 10.467 7.26001 10.125 7.05601C9.78304 6.85201 9.40804 6.75001 9.00004 6.75001C8.59204 6.75001 8.21704 6.85201 7.87504 7.05601C7.53304 7.26001 7.26004 7.53301 7.05604 7.87501C6.85204 8.21701 6.75004 8.59201 6.75004 9.00001C6.75004 9.40801 6.85204 9.78301 7.05604 10.125C7.26004 10.467 7.53304 10.74 7.87504 10.944C8.21704 11.148 8.59204 11.25 9.00004 11.25C9.40804 11.25 9.78304 11.148 10.125 10.944C10.467 10.74 10.74 10.467 10.944 10.125C11.148 9.78301 11.25 9.40801 11.25 9.00001ZM14.328 7.79401C14.076 7.75801 13.812 7.73401 13.536 7.72201C13.38 7.71001 13.245 7.75501 13.131 7.85701C13.017 7.95901 12.954 8.08801 12.942 8.24401C12.93 8.40001 12.975 8.53501 13.077 8.64901C13.179 8.76301 13.308 8.82601 13.464 8.83801C13.704 8.85001 13.938 8.87401 14.166 8.91001C14.322 8.93401 14.463 8.90101 14.589 8.81101C14.715 8.72101 14.787 8.59801 14.805 8.44201C14.823 8.28601 14.787 8.14501 14.697 8.01901C14.607 7.89301 14.484 7.81801 14.328 7.79401ZM4.53604 9.16201C4.29604 9.15001 4.06204 9.12601 3.83404 9.09001C3.67804 9.06601 3.53704 9.09901 3.41104 9.18901C3.28504 9.27901 3.21304 9.40201 3.19504 9.55801C3.17704 9.71401 3.21304 9.85501 3.30304 9.98101C3.39304 10.107 3.51604 10.182 3.67204 10.206C3.92404 10.242 4.18804 10.266 4.46404 10.278C4.62004 10.29 4.75504 10.245 4.86904 10.143C4.98304 10.041 5.04604 9.91201 5.05804 9.75601C5.07004 9.60001 5.02504 9.46501 4.92304 9.35101C4.82104 9.23701 4.69204 9.17401 4.53604 9.16201Z" fill="white"/>\n</svg>\n'})),t("p",null,t("span",{class:"s-loyalty-points-banner-label"},salla.lang.get("pages.loyalty_program.earn")," "),t("span",{class:"s-loyalty-points-banner-label"},`+${this.pointsData.points}`," "),t("span",{class:"s-loyalty-points-banner-label"},salla.lang.get("pages.loyalty_program.loyalty_point")," "),t("span",{class:"s-loyalty-points-banner-description"},salla.lang.get("pages.loyalty_program.on_order_total_when_purchase"))))):null}get host(){return n(this)}};s.style="/*!twlt*/.s-loyalty-points-banner-container{margin-bottom:0.75rem;display:flex;width:100%;align-items:center;gap:0.5rem;border-radius:0.5rem;background-color:rgb(209 180 76 / var(--tw-bg-opacity, 1));--tw-bg-opacity:0.1;padding-left:0.75rem;padding-right:0.75rem;padding-top:0.5rem;padding-bottom:0.5rem}.s-loyalty-points-banner-icon{display:flex;height:2rem;width:2rem;flex-shrink:0;align-items:center;justify-content:center;border-radius:9999px;--tw-bg-opacity:1;background-color:rgb(209 180 76 / var(--tw-bg-opacity, 1))}.s-loyalty-points-banner-label{font-size:0.875rem;line-height:1.25rem;font-weight:700;--tw-text-opacity:1;color:rgb(209 180 76 / var(--tw-text-opacity, 1))}.s-loyalty-points-banner-description{font-size:0.875rem;line-height:1.25rem}";export{s as salla_loyalty_points_banner}
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r as t,c as i,h as s,H as e,a as r}from"./p-DSmjBlMI.js";const a=class{constructor(s){t(this,s),this.giftCardRedeemed=i(this,"giftCardRedeemed"),this.code="",this.inlineForm=!1,this.pending=!1,this.error=null,this.redeemedOnce=!1,this.isDesktop=!1,this.modalView=null,this.result=null,this.mediaQueryList=null,this.mqlChangeHandler=t=>{this.isDesktop=t.matches,"form"===this.modalView&&this.isDesktop?(this.modalView=null,this.inlineForm=!0):this.inlineForm&&!this.isDesktop&&(this.inlineForm=!1,this.openModal("form"))},this.closeModal=()=>{this.modalView=null,this.modal?.close?.()},this.start=()=>{if(this.error=null,this.code="",this.isDesktop)return this.inlineForm=!0,void setTimeout((()=>this.field?.focus()),0);this.openModal("form")},this.cancel=()=>{this.inlineForm=!1,this.code="",this.error=null,this.closeModal()},this.handleInput=t=>{const i=t.target;this.code=(i.value||"").toUpperCase().replace(/[^A-Z0-9]/g,"").slice(0,16),i.value=this.code,this.error=null},this.onKeyUp=t=>{"Enter"===t.key&&(t.preventDefault(),this.redeem())},this.shopNow=()=>{this.closeModal(),window.location.href=salla.url.get("/")}}breakpointPx(){return 768}async componentWillLoad(){await salla.onReady(),this.mediaQueryList=window.matchMedia(`(min-width: ${this.breakpointPx()}px)`),this.isDesktop=this.mediaQueryList.matches,this.mediaQueryList.addEventListener?this.mediaQueryList.addEventListener("change",this.mqlChangeHandler):this.mediaQueryList.addListener&&this.mediaQueryList.addListener(this.mqlChangeHandler),await salla.lang.onLoaded()}disconnectedCallback(){this.mediaQueryList?.removeEventListener?this.mediaQueryList.removeEventListener("change",this.mqlChangeHandler):this.mediaQueryList?.removeListener&&this.mediaQueryList.removeListener(this.mqlChangeHandler)}tFirst(t,i){for(const s of t){const t=salla.lang.get(s,i);if(t&&t!==s)return t}return""}t(t,i){return this.tFirst([`pages.checkout.${t}`],i)}get canRedeem(){const t=salla.config.get("store.features",[]);return!salla.config.isGuest()&&t.includes("wallet-gift-card")&&t.includes("giftcard-redemption-form-enabled")}get isValidCode(){return/^[A-Z0-9]{16}$/.test(this.code)}get addLabel(){return this.t(this.redeemedOnce?"gift_card_add_another":"gift_card_add")}openModal(t){this.modalView=t,this.modal?.open?.(),"form"===t&&setTimeout((()=>this.field?.focus()),0)}toDate(t){if(!t)return null;const i="object"==typeof t?t.date??t.datetime??null:t;if("number"==typeof i){const t=new Date(i<1e12?1e3*i:i);return isNaN(t.getTime())?null:t}if("string"!=typeof i)return null;const s=new Date(i.replace(" ","T"));return isNaN(s.getTime())?null:s}expiryMonths(t){const i=this.toDate(t);if(!i)return null;const s=Math.round((i.getTime()-Date.now())/2630016e3);return s>0?s:null}formatMoney(t){try{return salla.money(t)||""}catch(t){return salla.logger?.warn?.("gift-card: could not format amount",t),""}}trackRedeem(t,i,s={}){salla.event.dispatch("giftcard::redeemed",{status:t,code:i?i.slice(0,4)+"X".repeat(Math.max(0,i.length-4)):"",...s})}async redeem(){if(this.pending||!this.isValidCode||!this.canRedeem)return;this.pending=!0,this.error=null;const t=this.code;try{const i=await salla.api.request("wallet/gift-card/redeem",{code:this.code},"post"),s=i?.data||{};this.code="",this.field&&(this.field.value=""),this.inlineForm=!1,this.redeemedOnce=!0,this.result=s,this.openModal("success"),this.giftCardRedeemed.emit(s),this.trackRedeem("success",t,{amount:s.amount,new_balance:s.new_balance,expires_at:s.expires_at})}catch(i){const s=i?.response?.data?.error?.fields;this.error=s?Object.values(s).flat().join(", "):i?.response?.data?.error?.message||this.t("gift_card_redeem_error"),this.inlineForm=!1,this.openModal("error"),this.trackRedeem("failed",t,{reason:this.error})}finally{this.pending=!1}}renderPrompt(){return s("div",{class:"s-gift-card-prompt"},s("div",{class:"s-gift-card-intro"},s("span",{class:"s-gift-card-mark"},s("i",{class:"sicon-gift","aria-hidden":"true"})),s("div",{class:"s-gift-card-copy"},s("p",{class:"s-gift-card-title"},this.t("gift_card_title")),s("p",{class:"s-gift-card-subtitle"},this.t("gift_card_subtitle")))),s("salla-button",{class:"s-gift-card-trigger",color:"primary",fill:"outline",onClick:this.start},s("span",null,this.addLabel)))}renderField(){return[s("label",{class:"s-gift-card-label",htmlFor:"gift_card_redeem_field"},this.tFirst(["pages.gift.code"])),s("input",{id:"gift_card_redeem_field",ref:t=>this.field=t,type:"text",maxlength:16,autocomplete:"off",class:"s-gift-card-input",value:this.code,disabled:this.pending,placeholder:this.t("gift_card_redeem_placeholder"),onInput:this.handleInput,onKeyUp:this.onKeyUp})]}renderSubmit(t=!1){return s("salla-button",{id:"gift_card_redeem_submit",color:"primary",width:t?"wide":"normal",loading:this.pending,"loader-position":"center",disabled:this.pending||!this.isValidCode,onClick:()=>this.redeem()},s("span",null,this.t("gift_card_redeem_confirm")))}renderInlineForm(){return s("div",{class:"s-gift-card-form"},s("div",{class:"s-gift-card-field"},this.renderField()),this.renderSubmit(),s("button",{type:"button",class:"s-gift-card-cancel",disabled:this.pending,onClick:this.cancel},this.t("gift_card_cancel")))}renderSheetForm(){return s("div",{class:"s-gift-card-sheet"},s("div",{class:"s-gift-card-field"},this.renderField()),this.renderSubmit(!0))}renderSuccess(){const t=this.formatMoney(this.result?.amount),i=this.expiryMonths(this.result?.expires_at),e=this.t("gift_card_success_title");return s("div",{class:"s-gift-card-result"},s("span",{class:"s-gift-card-result-mark s-gift-card-result-mark-success",innerHTML:'\n<svg viewBox="0 0 96 96" width="72" height="72" role="img" aria-hidden="true" xmlns="http://www.w3.org/2000/svg">\n \x3c!-- burst --\x3e\n <g fill="#F5C242">\n <path d="M48 8l3.2 7.6L59 18l-6.2 5.3L54 31l-6-4-6 4 1.2-7.7L37 18l7.8-2.4z"/>\n <path d="M71 26l1.9 4.4L77 32l-3.6 3 .7 4.5-4.1-2.3-4.1 2.3.7-4.5L63 32l4.1-1.6z"/>\n <path d="M25 26l1.9 4.4L31 32l-3.6 3 .7 4.5L24 37.2 19.9 39.5l.7-4.5L17 32l4.1-1.6z"/>\n </g>\n <g fill="#E4572E" opacity=".9">\n <circle cx="30" cy="18" r="2.4"/>\n <circle cx="66" cy="18" r="2.4"/>\n <circle cx="48" cy="44" r="2.2"/>\n </g>\n \x3c!-- lid --\x3e\n <rect x="20" y="46" width="56" height="12" rx="3" fill="#2E8B57"/>\n \x3c!-- box --\x3e\n <path d="M25 58h46v26a4 4 0 0 1-4 4H29a4 4 0 0 1-4-4z" fill="#3AA76D"/>\n \x3c!-- ribbon --\x3e\n <rect x="44" y="46" width="8" height="42" fill="#F5F7F6"/>\n <rect x="20" y="46" width="56" height="12" rx="3" fill="#2E8B57" opacity="0"/>\n <rect x="44" y="46" width="8" height="12" fill="#E9EFEB"/>\n</svg>\n'}),e&&s("h3",{class:"s-gift-card-result-title"},e),s("p",{class:"s-gift-card-result-text",innerHTML:i?this.tFirst(["pages.checkout.gift_card_success_body_expiring","pages.checkout.gift_card_success_body","pages.checkout.gift_card_redeem_success"],{amount:t,months:i}):this.tFirst(["pages.checkout.gift_card_success_body","pages.checkout.gift_card_redeem_success"],{amount:t})}),s("salla-button",{color:"primary",width:"wide",onClick:this.shopNow},s("span",null,this.tFirst(["pages.loyalty_program.shop_now"]))))}renderError(){return s("div",{class:"s-gift-card-result"},s("span",{class:"s-gift-card-result-mark s-gift-card-result-mark-error"},s("i",{class:"sicon-cancel","aria-hidden":"true"})),s("h3",{class:"s-gift-card-result-title"},this.tFirst(["pages.checkout.gift_card_failure_title","pages.checkout.gift_card_redeem_error"])),s("p",{class:"s-gift-card-result-text"},this.error))}render(){return this.canRedeem?s(e,{class:"s-gift-card"},s("div",{class:"s-gift-card-panel"},this.inlineForm&&this.isDesktop?this.renderInlineForm():this.renderPrompt()),s("salla-modal",{ref:t=>this.modal=t,class:"s-gift-card-modal",width:"sm",position:this.isDesktop?"middle":"bottom","modal-title":this.t("gift_card_redeem_label"),onModalVisibilityChanged:t=>{t.detail||(this.modalView=null)}},s("div",{class:"s-gift-card-modal-body"},"form"===this.modalView&&this.renderSheetForm(),"success"===this.modalView&&this.renderSuccess(),"error"===this.modalView&&this.renderError()))):null}};a.style='/*!twlt*/@charset "UTF-8";.s-gift-card{display:block;flex:1 1 auto;min-width:0}.s-gift-card-panel{height:100%;background:#fff;border-radius:12px;padding:20px;box-sizing:border-box}.s-gift-card-prompt{display:flex;flex-direction:column;align-items:stretch;gap:16px;height:100%}.s-gift-card-intro{display:flex;align-items:center;gap:12px}.s-gift-card-mark{flex:0 0 auto;width:48px;height:48px;border-radius:9999px;background:#fdecef;color:#e8637c;display:inline-flex;align-items:center;justify-content:center;font-size:22px}.s-gift-card-copy{min-width:0}.s-gift-card-title{margin:0;font-weight:700;font-size:15px;color:#1c1c1c}.s-gift-card-subtitle{margin:2px 0 0;font-size:12px;color:#9aa0a6}.s-gift-card-trigger{display:block}.s-gift-card-form{display:flex;align-items:flex-end;gap:12px}.s-gift-card-field{flex:1 1 auto;min-width:0}.s-gift-card-label{display:block;margin-bottom:6px;font-size:13px;font-weight:700;color:#1c1c1c}.s-gift-card-input{width:100%;height:44px;padding:0 14px;box-sizing:border-box;border:1px solid #e6e8eb;border-radius:8px;background:#fff;font-size:13px;color:#1c1c1c}.s-gift-card-input::placeholder{color:#b7bcc2}.s-gift-card-input:focus{outline:none;border-color:var(--color-primary, #2e8b57)}.s-gift-card-cancel{flex:0 0 auto;height:44px;padding:0 8px;border:0;background:none;color:#6b7280;font-size:13px;cursor:pointer}.s-gift-card-cancel:disabled{opacity:0.5;cursor:default}.s-gift-card-sheet{display:flex;flex-direction:column;gap:16px;padding-top:4px}.s-gift-card-result{display:flex;flex-direction:column;align-items:center;text-align:center;padding:12px 8px 8px}.s-gift-card-result-mark{width:120px;height:120px;border-radius:9999px;display:inline-flex;align-items:center;justify-content:center;margin-bottom:20px}.s-gift-card-result-mark-success{background:#eaf7f0}.s-gift-card-result-mark-error{background:#fdeaea;color:#fff;font-size:34px}.s-gift-card-result-mark-error i{width:72px;height:72px;border-radius:9999px;background:#ea4b4b;display:inline-flex;align-items:center;justify-content:center}.s-gift-card-result-title{margin:0 0 10px;font-size:19px;font-weight:700;color:#1c1c1c}.s-gift-card-result-text{margin:0 0 22px;font-size:13px;line-height:1.7;color:#6b7280}@media screen and (min-width: 768px){.s-gift-card-panel{padding:22px 24px;display:flex;align-items:center}.s-gift-card-prompt{flex-direction:row;align-items:center;justify-content:space-between;gap:24px;width:100%}.s-gift-card-trigger{flex:0 0 auto}.s-gift-card-form{width:100%}.s-gift-card-result{padding:8px 24px 16px}}.inline{display:inline}.contents{display:contents}.resize{resize:both}.uppercase{text-transform:uppercase}.outline{outline-style:solid}';const l=class{constructor(i){t(this,i),this.theme="default",this.show=!1,this.targetElement=null}handleMouseOver(t){this.targetElement&&this.targetElement.contains(t.target)&&(this.show=!0)}handleMouseOut(t){this.targetElement&&this.targetElement.contains(t.target)&&(this.show=!1)}componentDidLoad(){this.targetElement=document.getElementById(this.targetId)}render(){const t=["default","dark"].includes(this.theme)?this.theme:"default";return s("div",{key:"d689900a8fdad37c6396eb55d8140b48f3eda8b8",class:"s-tooltip-container"},s("div",{key:"0ae14c42d03c5f81ce4f19fa90b0260a21ac1c1e",class:`s-tooltip-item s-tooltip-item--${t}`,style:{display:this.show?"block":"none"}},this.text?s("span",null,this.text):s("slot",null)))}get el(){return r(this)}};l.style='/*!twlt*/.s-tooltip-container{position:relative;display:inline-block}.s-tooltip-item{position:absolute;transform:translateX(-63%) translateY(-50%);background-color:var(--color-primary);color:var(--color-primary-reverse);bottom:100%;left:50%;text-align:center;border-radius:5px;z-index:1;white-space:nowrap;transition:opacity 0.3s;pointer-events:none;margin:0 0 16px 8px;padding:12px;max-width:150px;width:190px;white-space:normal;opacity:1}.s-tooltip-item::after{content:"";position:absolute;bottom:-10px;left:50%;margin-left:-5px;border-width:5px;border-style:solid;border-color:var(--color-primary) transparent transparent transparent}.s-tooltip-item:dir(ltr){transform:translateX(-72%)}.s-tooltip-item--dark{background-color:#555555;color:white;padding:5px 15px;border-radius:8px;font-size:12px;font-weight:normal;max-width:330px;width:max-content}.s-tooltip-item--dark::after{border-color:#555555 transparent transparent transparent}.block{display:block}.shadow{--tw-shadow:0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}';export{a as salla_gift_card_redeem,l as salla_tooltip}
4
+ import{r as t,c as i,h as s,H as e,a as r}from"./p-Z_0e-eaG.js";const a=class{constructor(s){t(this,s),this.giftCardRedeemed=i(this,"giftCardRedeemed"),this.code="",this.inlineForm=!1,this.pending=!1,this.error=null,this.redeemedOnce=!1,this.isDesktop=!1,this.modalView=null,this.result=null,this.mediaQueryList=null,this.mqlChangeHandler=t=>{this.isDesktop=t.matches,"form"===this.modalView&&this.isDesktop?(this.modalView=null,this.inlineForm=!0):this.inlineForm&&!this.isDesktop&&(this.inlineForm=!1,this.openModal("form"))},this.closeModal=()=>{this.modalView=null,this.modal?.close?.()},this.start=()=>{if(this.error=null,this.code="",this.isDesktop)return this.inlineForm=!0,void setTimeout((()=>this.field?.focus()),0);this.openModal("form")},this.cancel=()=>{this.inlineForm=!1,this.code="",this.error=null,this.closeModal()},this.handleInput=t=>{const i=t.target;this.code=(i.value||"").toUpperCase().replace(/[^A-Z0-9]/g,"").slice(0,16),i.value=this.code,this.error=null},this.onKeyUp=t=>{"Enter"===t.key&&(t.preventDefault(),this.redeem())},this.shopNow=()=>{this.closeModal(),window.location.href=salla.url.get("/")}}breakpointPx(){return 768}async componentWillLoad(){await salla.onReady(),this.mediaQueryList=window.matchMedia(`(min-width: ${this.breakpointPx()}px)`),this.isDesktop=this.mediaQueryList.matches,this.mediaQueryList.addEventListener?this.mediaQueryList.addEventListener("change",this.mqlChangeHandler):this.mediaQueryList.addListener&&this.mediaQueryList.addListener(this.mqlChangeHandler),await salla.lang.onLoaded()}disconnectedCallback(){this.mediaQueryList?.removeEventListener?this.mediaQueryList.removeEventListener("change",this.mqlChangeHandler):this.mediaQueryList?.removeListener&&this.mediaQueryList.removeListener(this.mqlChangeHandler)}tFirst(t,i){for(const s of t){const t=salla.lang.get(s,i);if(t&&t!==s)return t}return""}t(t,i){return this.tFirst([`pages.checkout.${t}`],i)}get canRedeem(){const t=salla.config.get("store.features",[]);return!salla.config.isGuest()&&t.includes("wallet-gift-card")&&t.includes("giftcard-redemption-form-enabled")}get isValidCode(){return/^[A-Z0-9]{16}$/.test(this.code)}get addLabel(){return this.t(this.redeemedOnce?"gift_card_add_another":"gift_card_add")}openModal(t){this.modalView=t,this.modal?.open?.(),"form"===t&&setTimeout((()=>this.field?.focus()),0)}toDate(t){if(!t)return null;const i="object"==typeof t?t.date??t.datetime??null:t;if("number"==typeof i){const t=new Date(i<1e12?1e3*i:i);return isNaN(t.getTime())?null:t}if("string"!=typeof i)return null;const s=new Date(i.replace(" ","T"));return isNaN(s.getTime())?null:s}expiryMonths(t){const i=this.toDate(t);if(!i)return null;const s=Math.round((i.getTime()-Date.now())/2630016e3);return s>0?s:null}formatMoney(t){try{return salla.money(t)||""}catch(t){return salla.logger?.warn?.("gift-card: could not format amount",t),""}}trackRedeem(t,i,s={}){salla.event.dispatch("giftcard::redeemed",{status:t,code:i?i.slice(0,4)+"X".repeat(Math.max(0,i.length-4)):"",...s})}async redeem(){if(this.pending||!this.isValidCode||!this.canRedeem)return;this.pending=!0,this.error=null;const t=this.code;try{const i=await salla.api.request("wallet/gift-card/redeem",{code:this.code},"post"),s=i?.data||{};this.code="",this.field&&(this.field.value=""),this.inlineForm=!1,this.redeemedOnce=!0,this.result=s,this.openModal("success"),this.giftCardRedeemed.emit(s),this.trackRedeem("success",t,{amount:s.amount,new_balance:s.new_balance,expires_at:s.expires_at})}catch(i){const s=i?.response?.data?.error?.fields;this.error=s?Object.values(s).flat().join(", "):i?.response?.data?.error?.message||this.t("gift_card_redeem_error"),this.inlineForm=!1,this.openModal("error"),this.trackRedeem("failed",t,{reason:this.error})}finally{this.pending=!1}}renderPrompt(){return s("div",{class:"s-gift-card-prompt"},s("div",{class:"s-gift-card-intro"},s("span",{class:"s-gift-card-mark"},s("i",{class:"sicon-gift","aria-hidden":"true"})),s("div",{class:"s-gift-card-copy"},s("p",{class:"s-gift-card-title"},this.t("gift_card_title")),s("p",{class:"s-gift-card-subtitle"},this.t("gift_card_subtitle")))),s("salla-button",{class:"s-gift-card-trigger",color:"primary",fill:"outline",onClick:this.start},s("span",null,this.addLabel)))}renderField(){return[s("label",{class:"s-gift-card-label",htmlFor:"gift_card_redeem_field"},this.tFirst(["pages.gift.code"])),s("input",{id:"gift_card_redeem_field",ref:t=>this.field=t,type:"text",maxlength:16,autocomplete:"off",class:"s-gift-card-input",value:this.code,disabled:this.pending,placeholder:this.t("gift_card_redeem_placeholder"),onInput:this.handleInput,onKeyUp:this.onKeyUp})]}renderSubmit(t=!1){return s("salla-button",{id:"gift_card_redeem_submit",color:"primary",width:t?"wide":"normal",loading:this.pending,"loader-position":"center",disabled:this.pending||!this.isValidCode,onClick:()=>this.redeem()},s("span",null,this.t("gift_card_redeem_confirm")))}renderInlineForm(){return s("div",{class:"s-gift-card-form"},s("div",{class:"s-gift-card-field"},this.renderField()),this.renderSubmit(),s("button",{type:"button",class:"s-gift-card-cancel",disabled:this.pending,onClick:this.cancel},this.t("gift_card_cancel")))}renderSheetForm(){return s("div",{class:"s-gift-card-sheet"},s("div",{class:"s-gift-card-field"},this.renderField()),this.renderSubmit(!0))}renderSuccess(){const t=this.formatMoney(this.result?.amount),i=this.expiryMonths(this.result?.expires_at),e=this.t("gift_card_success_title");return s("div",{class:"s-gift-card-result"},s("span",{class:"s-gift-card-result-mark s-gift-card-result-mark-success",innerHTML:'\n<svg viewBox="0 0 96 96" width="72" height="72" role="img" aria-hidden="true" xmlns="http://www.w3.org/2000/svg">\n \x3c!-- burst --\x3e\n <g fill="#F5C242">\n <path d="M48 8l3.2 7.6L59 18l-6.2 5.3L54 31l-6-4-6 4 1.2-7.7L37 18l7.8-2.4z"/>\n <path d="M71 26l1.9 4.4L77 32l-3.6 3 .7 4.5-4.1-2.3-4.1 2.3.7-4.5L63 32l4.1-1.6z"/>\n <path d="M25 26l1.9 4.4L31 32l-3.6 3 .7 4.5L24 37.2 19.9 39.5l.7-4.5L17 32l4.1-1.6z"/>\n </g>\n <g fill="#E4572E" opacity=".9">\n <circle cx="30" cy="18" r="2.4"/>\n <circle cx="66" cy="18" r="2.4"/>\n <circle cx="48" cy="44" r="2.2"/>\n </g>\n \x3c!-- lid --\x3e\n <rect x="20" y="46" width="56" height="12" rx="3" fill="#2E8B57"/>\n \x3c!-- box --\x3e\n <path d="M25 58h46v26a4 4 0 0 1-4 4H29a4 4 0 0 1-4-4z" fill="#3AA76D"/>\n \x3c!-- ribbon --\x3e\n <rect x="44" y="46" width="8" height="42" fill="#F5F7F6"/>\n <rect x="20" y="46" width="56" height="12" rx="3" fill="#2E8B57" opacity="0"/>\n <rect x="44" y="46" width="8" height="12" fill="#E9EFEB"/>\n</svg>\n'}),e&&s("h3",{class:"s-gift-card-result-title"},e),s("p",{class:"s-gift-card-result-text",innerHTML:i?this.tFirst(["pages.checkout.gift_card_success_body_expiring","pages.checkout.gift_card_success_body","pages.checkout.gift_card_redeem_success"],{amount:t,months:i}):this.tFirst(["pages.checkout.gift_card_success_body","pages.checkout.gift_card_redeem_success"],{amount:t})}),s("salla-button",{color:"primary",width:"wide",onClick:this.shopNow},s("span",null,this.tFirst(["pages.loyalty_program.shop_now"]))))}renderError(){return s("div",{class:"s-gift-card-result"},s("span",{class:"s-gift-card-result-mark s-gift-card-result-mark-error"},s("i",{class:"sicon-cancel","aria-hidden":"true"})),s("h3",{class:"s-gift-card-result-title"},this.tFirst(["pages.checkout.gift_card_failure_title","pages.checkout.gift_card_redeem_error"])),s("p",{class:"s-gift-card-result-text"},this.error))}render(){return this.canRedeem?s(e,{class:"s-gift-card"},s("div",{class:"s-gift-card-panel"},this.inlineForm&&this.isDesktop?this.renderInlineForm():this.renderPrompt()),s("salla-modal",{ref:t=>this.modal=t,class:"s-gift-card-modal",width:"sm",position:this.isDesktop?"middle":"bottom","modal-title":this.t("gift_card_redeem_label"),onModalVisibilityChanged:t=>{t.detail||(this.modalView=null)}},s("div",{class:"s-gift-card-modal-body"},"form"===this.modalView&&this.renderSheetForm(),"success"===this.modalView&&this.renderSuccess(),"error"===this.modalView&&this.renderError()))):null}};a.style='/*!twlt*/@charset "UTF-8";.s-gift-card{display:block;flex:1 1 auto;min-width:0}.s-gift-card-panel{height:100%;background:#fff;border-radius:12px;padding:20px;box-sizing:border-box}.s-gift-card-prompt{display:flex;flex-direction:column;align-items:stretch;gap:16px;height:100%}.s-gift-card-intro{display:flex;align-items:center;gap:12px}.s-gift-card-mark{flex:0 0 auto;width:48px;height:48px;border-radius:9999px;background:#fdecef;color:#e8637c;display:inline-flex;align-items:center;justify-content:center;font-size:22px}.s-gift-card-copy{min-width:0}.s-gift-card-title{margin:0;font-weight:700;font-size:15px;color:#1c1c1c}.s-gift-card-subtitle{margin:2px 0 0;font-size:12px;color:#9aa0a6}.s-gift-card-trigger{display:block}.s-gift-card-form{display:flex;align-items:flex-end;gap:12px}.s-gift-card-field{flex:1 1 auto;min-width:0}.s-gift-card-label{display:block;margin-bottom:6px;font-size:13px;font-weight:700;color:#1c1c1c}.s-gift-card-input{width:100%;height:44px;padding:0 14px;box-sizing:border-box;border:1px solid #e6e8eb;border-radius:8px;background:#fff;font-size:13px;color:#1c1c1c}.s-gift-card-input::placeholder{color:#b7bcc2}.s-gift-card-input:focus{outline:none;border-color:var(--color-primary, #2e8b57)}.s-gift-card-cancel{flex:0 0 auto;height:44px;padding:0 8px;border:0;background:none;color:#6b7280;font-size:13px;cursor:pointer}.s-gift-card-cancel:disabled{opacity:0.5;cursor:default}.s-gift-card-sheet{display:flex;flex-direction:column;gap:16px;padding-top:4px}.s-gift-card-result{display:flex;flex-direction:column;align-items:center;text-align:center;padding:12px 8px 8px}.s-gift-card-result-mark{width:120px;height:120px;border-radius:9999px;display:inline-flex;align-items:center;justify-content:center;margin-bottom:20px}.s-gift-card-result-mark-success{background:#eaf7f0}.s-gift-card-result-mark-error{background:#fdeaea;color:#fff;font-size:34px}.s-gift-card-result-mark-error i{width:72px;height:72px;border-radius:9999px;background:#ea4b4b;display:inline-flex;align-items:center;justify-content:center}.s-gift-card-result-title{margin:0 0 10px;font-size:19px;font-weight:700;color:#1c1c1c}.s-gift-card-result-text{margin:0 0 22px;font-size:13px;line-height:1.7;color:#6b7280}@media screen and (min-width: 768px){.s-gift-card-panel{padding:22px 24px;display:flex;align-items:center}.s-gift-card-prompt{flex-direction:row;align-items:center;justify-content:space-between;gap:24px;width:100%}.s-gift-card-trigger{flex:0 0 auto}.s-gift-card-form{width:100%}.s-gift-card-result{padding:8px 24px 16px}}.inline{display:inline}.contents{display:contents}.resize{resize:both}.uppercase{text-transform:uppercase}.outline{outline-style:solid}';const l=class{constructor(i){t(this,i),this.theme="default",this.show=!1,this.targetElement=null}handleMouseOver(t){this.targetElement&&this.targetElement.contains(t.target)&&(this.show=!0)}handleMouseOut(t){this.targetElement&&this.targetElement.contains(t.target)&&(this.show=!1)}componentDidLoad(){this.targetElement=document.getElementById(this.targetId)}render(){const t=["default","dark"].includes(this.theme)?this.theme:"default";return s("div",{key:"d689900a8fdad37c6396eb55d8140b48f3eda8b8",class:"s-tooltip-container"},s("div",{key:"0ae14c42d03c5f81ce4f19fa90b0260a21ac1c1e",class:`s-tooltip-item s-tooltip-item--${t}`,style:{display:this.show?"block":"none"}},this.text?s("span",null,this.text):s("slot",null)))}get el(){return r(this)}};l.style='/*!twlt*/.s-tooltip-container{position:relative;display:inline-block}.s-tooltip-item{position:absolute;transform:translateX(-63%) translateY(-50%);background-color:var(--color-primary);color:var(--color-primary-reverse);bottom:100%;left:50%;text-align:center;border-radius:5px;z-index:1;white-space:nowrap;transition:opacity 0.3s;pointer-events:none;margin:0 0 16px 8px;padding:12px;max-width:150px;width:190px;white-space:normal;opacity:1}.s-tooltip-item::after{content:"";position:absolute;bottom:-10px;left:50%;margin-left:-5px;border-width:5px;border-style:solid;border-color:var(--color-primary) transparent transparent transparent}.s-tooltip-item:dir(ltr){transform:translateX(-72%)}.s-tooltip-item--dark{background-color:#555555;color:white;padding:5px 15px;border-radius:8px;font-size:12px;font-weight:normal;max-width:330px;width:max-content}.s-tooltip-item--dark::after{border-color:#555555 transparent transparent transparent}.block{display:block}.shadow{--tw-shadow:0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}';export{a as salla_gift_card_redeem,l as salla_tooltip}
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r as t,h as r,H as e,a as o}from"./p-DSmjBlMI.js";import{H as i}from"./p-Brgf4SAC.js";import"./p-CgtvEd63.js";const n=class{constructor(r){t(this,r),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")}connectedCallback(){this.langUnsubscribe=salla.lang.subscribe((()=>{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")}))}disconnectedCallback(){this.langUnsubscribe?.()}loading(t=!0){let r=this.status.querySelector(".s-button-text");i.toggleElementClassIf(r,"s-button-hide","s-button-show",(()=>t)),this.btnLoader.style.display=t?"inherit":"none"}render(){return this.nextPage.length>1?r(e,{class:"s-infinite-scroll-container"},r("slot",null)):""}componentDidLoad(){if(0===this.nextPage.length)return;this.host.insertAdjacentElement("afterend",this.status);let t=this,r=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 t.nextPage.replace(/page\=(\d)/g,"page="+(this.loadCount+2))}}).on("request",(()=>this.loading())).on("load",(()=>{this.loading(!1),2==r.pageIndex&&r.option({loadOnScroll:!1}),3==r.pageIndex&&r.option({loadOnScroll:!0})})).on("error",(()=>this.loading(!1)))}get host(){return o(this)}};n.style="/*!twlt*/.s-button-btn{position:relative;display:inline-flex;flex:1 1 0%;user-select:none;flex-direction:row-reverse;align-items:center;justify-content:center;white-space:nowrap;border-radius:var(--s-radius, 0.25rem);border-style:solid;padding-left:1.5rem;padding-right:1.5rem;padding-bottom:0.625rem;padding-top:0.5rem;font-size:0.875rem;line-height:1.25rem;font-weight:700;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:300ms}.s-button-btn:hover{opacity:0.8}.s-button-primary{border-width:1px;border-color:var(--color-primary);background-color:var(--color-primary);color:var(--color-primary-reverse)}.s-button-primary:hover{background-color:var(--color-primary-dark)}.s-button-text{pointer-events:none;align-items:center;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;transition-property:opacity;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:300ms}.s-button-loader{margin-left:0.5rem;margin-right:0.5rem;display:flex;align-items:center;justify-content:center;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms}.s-button-loader::before{display:inline-block;height:1rem;content:var(--tw-content);width:1rem}@keyframes spin{to{content:var(--tw-content);transform:rotate(360deg)}}.s-button-loader::before{animation:spin 1s linear infinite;border-radius:9999px;border-width:2px;border-style:solid;border-top-color:var(--color-primary);border-left-color:var(--color-primary);border-bottom-color:rgb(243 244 246 / var(--tw-border-opacity, 1));--tw-border-opacity:1;border-right-color:rgb(243 244 246 / var(--tw-border-opacity, 1));--tw-content:'';content:var(--tw-content)}.s-button-loader-center .s-button-loader{position:absolute;top:50%;left:50%;margin:0px !important;--tw-translate-y:-50%;--tw-translate-x:-50%;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.s-comments-item-like-btn .s-button-text{display:flex;flex-direction:row-reverse;gap:0.5rem}.s-infinite-scroll-wrapper{margin-top:1rem;text-align:center}.s-infinite-scroll-last{margin:0px;text-align:center}.s-infinite-scroll-error{margin:0px;text-align:center}";export{n as salla_infinite_scroll}
4
+ import{r as t,h as r,H as e,a as o}from"./p-Z_0e-eaG.js";import{H as i}from"./p-Brgf4SAC.js";import"./p-CgtvEd63.js";const n=class{constructor(r){t(this,r),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")}connectedCallback(){this.langUnsubscribe=salla.lang.subscribe((()=>{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")}))}disconnectedCallback(){this.langUnsubscribe?.()}loading(t=!0){let r=this.status.querySelector(".s-button-text");i.toggleElementClassIf(r,"s-button-hide","s-button-show",(()=>t)),this.btnLoader.style.display=t?"inherit":"none"}render(){return this.nextPage.length>1?r(e,{class:"s-infinite-scroll-container"},r("slot",null)):""}componentDidLoad(){if(0===this.nextPage.length)return;this.host.insertAdjacentElement("afterend",this.status);let t=this,r=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 t.nextPage.replace(/page\=(\d)/g,"page="+(this.loadCount+2))}}).on("request",(()=>this.loading())).on("load",(()=>{this.loading(!1),2==r.pageIndex&&r.option({loadOnScroll:!1}),3==r.pageIndex&&r.option({loadOnScroll:!0})})).on("error",(()=>this.loading(!1)))}get host(){return o(this)}};n.style="/*!twlt*/.s-button-btn{position:relative;display:inline-flex;flex:1 1 0%;user-select:none;flex-direction:row-reverse;align-items:center;justify-content:center;white-space:nowrap;border-radius:var(--s-radius, 0.25rem);border-style:solid;padding-left:1.5rem;padding-right:1.5rem;padding-bottom:0.625rem;padding-top:0.5rem;font-size:0.875rem;line-height:1.25rem;font-weight:700;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:300ms}.s-button-btn:hover{opacity:0.8}.s-button-primary{border-width:1px;border-color:var(--color-primary);background-color:var(--color-primary);color:var(--color-primary-reverse)}.s-button-primary:hover{background-color:var(--color-primary-dark)}.s-button-text{pointer-events:none;align-items:center;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;transition-property:opacity;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:300ms}.s-button-loader{margin-left:0.5rem;margin-right:0.5rem;display:flex;align-items:center;justify-content:center;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms}.s-button-loader::before{display:inline-block;height:1rem;content:var(--tw-content);width:1rem}@keyframes spin{to{content:var(--tw-content);transform:rotate(360deg)}}.s-button-loader::before{animation:spin 1s linear infinite;border-radius:9999px;border-width:2px;border-style:solid;border-top-color:var(--color-primary);border-left-color:var(--color-primary);border-bottom-color:rgb(243 244 246 / var(--tw-border-opacity, 1));--tw-border-opacity:1;border-right-color:rgb(243 244 246 / var(--tw-border-opacity, 1));--tw-content:'';content:var(--tw-content)}.s-button-loader-center .s-button-loader{position:absolute;top:50%;left:50%;margin:0px !important;--tw-translate-y:-50%;--tw-translate-x:-50%;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.s-comments-item-like-btn .s-button-text{display:flex;flex-direction:row-reverse;gap:0.5rem}.s-infinite-scroll-wrapper{margin-top:1rem;text-align:center}.s-infinite-scroll-last{margin:0px;text-align:center}.s-infinite-scroll-error{margin:0px;text-align:center}";export{n as salla_infinite_scroll}
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r as e,h as t,H as r}from"./p-DSmjBlMI.js";import{H as a,F as i}from"./p-Brgf4SAC.js";import"./p-CgtvEd63.js";const l=class{constructor(t){e(this,t),this.filters=[],this.filtersData={},this.clearAllLabel="",this.removeLabel="",this.translationDefaults={"pages.categories.clear_all_filters":{ar:"إزالة التصفية",en:"Clear All"},"common.elements.delete":{ar:"حذف",en:"Delete"}}}async componentWillLoad(){salla.event.on("filters::fetched",(({filters:e})=>{this.filters=a.resolveFilterLabels(e),this.syncFiltersDataFromFiltersElement()})),salla.event.on("filters::hidden",(()=>{this.filters=[]})),salla.event.on("salla-filters::changed",(e=>{this.filtersData={...e}})),salla.event.on("salla-filters::reset",(()=>{this.filtersData={}})),salla.lang.onLoaded((()=>{this.registerTranslationDefaults(),this.loadTranslations()})),this.getInitialFiltersData()}getInitialFiltersData(){const e=new URLSearchParams(window.location.search);this.filtersData=a.extractFiltersFromUrl(e)}syncFiltersDataFromFiltersElement(){setTimeout((async()=>{const e=await(this.getFiltersElement()?.getFilters());e&&(this.filtersData={...e})}))}registerTranslationDefaults(){const e=Object.entries(this.translationDefaults).reduce(((e,[t,r])=>(salla.lang.get(t)===t&&(e[t]=r),e)),{});Object.keys(e).length&&salla.lang.addBulk(e)}loadTranslations(){this.clearAllLabel=salla.lang.get("pages.categories.clear_all_filters"),this.removeLabel=salla.lang.get("common.elements.delete")}getAppliedFilters(){const e=[],t=this.filtersData||{};for(const r of Object.keys(t)){if("variants"===r){const a=this.filters?.find((e=>e.type===i.VARIANTS));for(const l of Object.keys(t.variants||{})){const s=t.variants[l],o=a?.values?.find((e=>(e.key||e.value)==s));o&&e.push({key:r,variantKey:l,value:s,type:i.VARIANTS,groupLabel:a?.label,optionLabel:o.value})}continue}const a=this.filters?.find((e=>e.key===r));if(!a)continue;const l=t[r];if(a.type===i.RANGE||l&&"object"==typeof l&&!Array.isArray(l)){e.push({key:r,value:l,type:i.RANGE,groupLabel:a.label,optionLabel:`${l.min} - ${l.max}`});continue}if("category_id"===r&&!Array.isArray(l)&&"product.index"==salla.config.get("page.slug")&&l==salla.config.get("page.id"))continue;const s=Array.isArray(l)?l:[l];for(const t of s){const i=a.values?.find((e=>("number"==typeof e?e:e.key||e.value)==t)),l="rating"===a.key?`${t}`:i&&"number"!=typeof i?i.value:void 0;null!=l&&e.push({key:r,value:t,type:a.type,groupLabel:a.label,optionLabel:l})}}return e}getFiltersElement(){return document.querySelector("salla-filters")}removeFilter(e){this.getFiltersElement()?.removeFilter(e)}clearAll(){this.getFiltersElement()?.resetFilters()}render(){const e=this.getAppliedFilters();return e.length?t(r,{class:"s-applied-filters-wrapper"},t("div",{class:"s-applied-filters-tags"},e.map((e=>t("div",{class:"s-applied-filters-tag"},t("span",{class:"s-applied-filters-tag-name"},e.groupLabel,": ",e.optionLabel),t("button",{type:"button",class:"s-applied-filters-tag-remove","aria-label":`${this.removeLabel} ${e.groupLabel}: ${e.optionLabel}`,onClick:()=>this.removeFilter(e)},t("i",{class:"sicon-cancel","aria-hidden":"true"}))))),t("button",{type:"button",class:"s-applied-filters-clear-tag",onClick:()=>this.clearAll()},t("span",null,this.clearAllLabel)))):null}};l.style="/*!twlt*/:host{display:block}.s-applied-filters-tags{display:flex;flex-wrap:wrap;align-items:center;gap:0.5rem;margin-bottom:1rem}.s-applied-filters-tag{display:inline-flex;align-items:center;gap:0.4rem;border-radius:999px;border:1px solid #e8e8e8;background:rgba(255, 255, 255, 0.3);color:var(--main-text-color);font-size:0.85rem;line-height:1;padding:0.4rem 0.65rem}.s-applied-filters-tag-remove{display:inline-flex;align-items:center;justify-content:center;border:0;padding:0;background:transparent;color:inherit;font-size:0.75rem;cursor:pointer}.s-applied-filters-clear-tag{display:inline-flex;align-items:center;gap:0.4rem;border-radius:999px;border:1px solid var(--color-danger, #dc3545);background:transparent;color:var(--color-danger, #dc3545);font-size:0.85rem;line-height:1;padding:0.4rem 0.65rem;cursor:pointer}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.s-applied-filters-wrapper{display:block}.s-applied-filters-tags{margin-bottom:1rem;display:flex;flex-direction:row;flex-wrap:wrap;align-items:center;gap:0.5rem}.s-applied-filters-tag{display:inline-flex;align-items:center;gap:0.375rem;border-radius:9999px;border-width:1px;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1));background-color:rgb(255 255 255 / 0.3);padding-top:0.375rem;padding-bottom:0.375rem;padding-left:0.625rem;padding-right:0.625rem;font-size:0.875rem;line-height:1.25rem;color:var(--main-text-color)}.s-applied-filters-tag-name{color:inherit}.s-applied-filters-tag-remove{display:inline-flex;cursor:pointer;align-items:center;justify-content:center;border-width:0px;background-color:transparent;padding:0px;font-size:0.75rem;line-height:1rem;color:inherit}.s-applied-filters-clear-tag{display:inline-flex;cursor:pointer;align-items:center;gap:0.375rem;border-radius:9999px;border-width:1px;--tw-border-opacity:1;border-color:rgb(248 113 113 / var(--tw-border-opacity, 1));background-color:transparent;padding-top:0.375rem;padding-bottom:0.375rem;padding-left:0.625rem;padding-right:0.625rem;font-size:0.875rem;line-height:1.25rem;--tw-text-opacity:1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}";export{l as salla_applied_filters}
4
+ import{r as e,h as t,H as r}from"./p-Z_0e-eaG.js";import{H as a,F as i}from"./p-Brgf4SAC.js";import"./p-CgtvEd63.js";const l=class{constructor(t){e(this,t),this.filters=[],this.filtersData={},this.clearAllLabel="",this.removeLabel="",this.translationDefaults={"pages.categories.clear_all_filters":{ar:"إزالة التصفية",en:"Clear All"},"common.elements.delete":{ar:"حذف",en:"Delete"}}}async componentWillLoad(){salla.event.on("filters::fetched",(({filters:e})=>{this.filters=a.resolveFilterLabels(e),this.syncFiltersDataFromFiltersElement()})),salla.event.on("filters::hidden",(()=>{this.filters=[]})),salla.event.on("salla-filters::changed",(e=>{this.filtersData={...e}})),salla.event.on("salla-filters::reset",(()=>{this.filtersData={}})),salla.lang.onLoaded((()=>{this.registerTranslationDefaults(),this.loadTranslations()})),this.getInitialFiltersData()}getInitialFiltersData(){const e=new URLSearchParams(window.location.search);this.filtersData=a.extractFiltersFromUrl(e)}syncFiltersDataFromFiltersElement(){setTimeout((async()=>{const e=await(this.getFiltersElement()?.getFilters());e&&(this.filtersData={...e})}))}registerTranslationDefaults(){const e=Object.entries(this.translationDefaults).reduce(((e,[t,r])=>(salla.lang.get(t)===t&&(e[t]=r),e)),{});Object.keys(e).length&&salla.lang.addBulk(e)}loadTranslations(){this.clearAllLabel=salla.lang.get("pages.categories.clear_all_filters"),this.removeLabel=salla.lang.get("common.elements.delete")}getAppliedFilters(){const e=[],t=this.filtersData||{};for(const r of Object.keys(t)){if("variants"===r){const a=this.filters?.find((e=>e.type===i.VARIANTS));for(const l of Object.keys(t.variants||{})){const s=t.variants[l],o=a?.values?.find((e=>(e.key||e.value)==s));o&&e.push({key:r,variantKey:l,value:s,type:i.VARIANTS,groupLabel:a?.label,optionLabel:o.value})}continue}const a=this.filters?.find((e=>e.key===r));if(!a)continue;const l=t[r];if(a.type===i.RANGE||l&&"object"==typeof l&&!Array.isArray(l)){e.push({key:r,value:l,type:i.RANGE,groupLabel:a.label,optionLabel:`${l.min} - ${l.max}`});continue}if("category_id"===r&&!Array.isArray(l)&&"product.index"==salla.config.get("page.slug")&&l==salla.config.get("page.id"))continue;const s=Array.isArray(l)?l:[l];for(const t of s){const i=a.values?.find((e=>("number"==typeof e?e:e.key||e.value)==t)),l="rating"===a.key?`${t}`:i&&"number"!=typeof i?i.value:void 0;null!=l&&e.push({key:r,value:t,type:a.type,groupLabel:a.label,optionLabel:l})}}return e}getFiltersElement(){return document.querySelector("salla-filters")}removeFilter(e){this.getFiltersElement()?.removeFilter(e)}clearAll(){this.getFiltersElement()?.resetFilters()}render(){const e=this.getAppliedFilters();return e.length?t(r,{class:"s-applied-filters-wrapper"},t("div",{class:"s-applied-filters-tags"},e.map((e=>t("div",{class:"s-applied-filters-tag"},t("span",{class:"s-applied-filters-tag-name"},e.groupLabel,": ",e.optionLabel),t("button",{type:"button",class:"s-applied-filters-tag-remove","aria-label":`${this.removeLabel} ${e.groupLabel}: ${e.optionLabel}`,onClick:()=>this.removeFilter(e)},t("i",{class:"sicon-cancel","aria-hidden":"true"}))))),t("button",{type:"button",class:"s-applied-filters-clear-tag",onClick:()=>this.clearAll()},t("span",null,this.clearAllLabel)))):null}};l.style="/*!twlt*/:host{display:block}.s-applied-filters-tags{display:flex;flex-wrap:wrap;align-items:center;gap:0.5rem;margin-bottom:1rem}.s-applied-filters-tag{display:inline-flex;align-items:center;gap:0.4rem;border-radius:999px;border:1px solid #e8e8e8;background:rgba(255, 255, 255, 0.3);color:var(--main-text-color);font-size:0.85rem;line-height:1;padding:0.4rem 0.65rem}.s-applied-filters-tag-remove{display:inline-flex;align-items:center;justify-content:center;border:0;padding:0;background:transparent;color:inherit;font-size:0.75rem;cursor:pointer}.s-applied-filters-clear-tag{display:inline-flex;align-items:center;gap:0.4rem;border-radius:999px;border:1px solid var(--color-danger, #dc3545);background:transparent;color:var(--color-danger, #dc3545);font-size:0.85rem;line-height:1;padding:0.4rem 0.65rem;cursor:pointer}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.s-applied-filters-wrapper{display:block}.s-applied-filters-tags{margin-bottom:1rem;display:flex;flex-direction:row;flex-wrap:wrap;align-items:center;gap:0.5rem}.s-applied-filters-tag{display:inline-flex;align-items:center;gap:0.375rem;border-radius:9999px;border-width:1px;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1));background-color:rgb(255 255 255 / 0.3);padding-top:0.375rem;padding-bottom:0.375rem;padding-left:0.625rem;padding-right:0.625rem;font-size:0.875rem;line-height:1.25rem;color:var(--main-text-color)}.s-applied-filters-tag-name{color:inherit}.s-applied-filters-tag-remove{display:inline-flex;cursor:pointer;align-items:center;justify-content:center;border-width:0px;background-color:transparent;padding:0px;font-size:0.75rem;line-height:1rem;color:inherit}.s-applied-filters-clear-tag{display:inline-flex;cursor:pointer;align-items:center;gap:0.375rem;border-radius:9999px;border-width:1px;--tw-border-opacity:1;border-color:rgb(248 113 113 / var(--tw-border-opacity, 1));background-color:transparent;padding-top:0.375rem;padding-bottom:0.375rem;padding-left:0.625rem;padding-right:0.625rem;font-size:0.875rem;line-height:1.25rem;--tw-text-opacity:1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}";export{l as salla_applied_filters}
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r as t,h as e,F as i}from"./p-DSmjBlMI.js";const r=class{constructor(e){t(this,e),this.source="header",this.useReactLink=!1,this.menus=[],this.displayAllText=""}async componentWillLoad(){return salla.onReady((()=>{if(this.displayAllText=salla.lang.get("blocks.home.display_all"),!this.sourceValue||"json"!==this.source)return this.getMenuItems();this.menus="string"==typeof this.sourceValue?JSON.parse(this.sourceValue):this.sourceValue||[]}))}getMenuItems(){return salla.api.component.getMenus(this.source).then((async({data:t})=>{this.menus=t,await salla.hooks.call("salla-menu","afterFetchMenuItems",this)})).catch((t=>{salla.logger.error("salla-menu::Error fetching menus",t)}))}hasChildren(t){return t?.children?.length>0}hasProducts(t){return t?.products?.length>0}getDesktopClasses(t,e){return`!hidden lg:!block ${e?"root-level lg:!inline-block":"relative"} ${t.products?" mega-menu":""}\n ${this.hasChildren(t)?"has-children":""}`}getAttributes(t){return t.trim().split(" ").reduce(((t,e)=>{let[i,r]=e.split("=");return t[i]=r.replace(/"/g,""),t}),{})}getMobileMenu(t,r){const l=t.image?e("img",{src:t.image,class:"rounded-full",width:"48",height:"48",alt:t.title}):null;return e("li",{class:"lg:hidden text-sm font-bold",...this.getAttributes(t.attrs)},this.hasChildren(t)?e(i,null,e("span",{class:t.image?"!py-3":""},l,t.title),e("ul",null,e("li",{class:"text-sm font-bold"},e("a",{href:t.url,class:"text-gray-500"},r)),t.children.map((t=>this.getMobileMenu(t,r))))):e("a",{href:t.url,"aria-label":t.title||"category",class:"text-gray-500 "+(t.image?"!py-3":""),...this.getAttributes(t.link_attrs)},l,e("span",null,t.title||"")))}getDesktopMenu(t,i){return e("li",{class:this.getDesktopClasses(t,i),...this.getAttributes(t.attrs)},e("a",{href:t.url,"aria-label":t.title||"category",...this.getAttributes(t.link_attrs)},e("span",null,t.title)),this.hasChildren(t)?e("div",{class:"sub-menu shadow-default "+(this.hasProducts(t)?"w-full left-0 flex":"w-56")},e("ul",{class:this.hasProducts(t)?"w-56 shrink-0 m-8 rtl:ml-0 ltr:mr-0":""},t.children.map((t=>this.getDesktopMenu(t,!1)))),this.hasProducts(t)?e("salla-products-list",{source:"selected","shadow-on-hover":!0,"source-value":`[${t.products}]`}):null):null)}getFooterMenu(t){const i=this.topnav||this.limit?t.slice(0,this.limit||3):t;return e("div",null,e("div",{class:{"s-menu-footer-list":!this.topnav,"s-menu-topnav-list":this.topnav}},i.map((t=>e("a",{key:t.id,href:t.url,target:t.target,class:{"s-menu-footer-item":!this.topnav,"s-menu-topnav-item topnav-link-item right-side":this.topnav},...t.callback?{onClick:t.callback}:{}},t.title)))))}getHeaderMenu(t){return t.map((t=>[this.getMobileMenu(t,this.displayAllText),this.getDesktopMenu(t,!0)]))}render(){return"footer"===this.source?this.getFooterMenu(this.menus):[e("nav",{key:"main-nav",id:"mobile-menu",class:"mobile-menu"},e("ul",{class:"main-menu"},this.getHeaderMenu(this.menus)),e("button",{class:"btn--close close-mobile-menu sicon-cancel lg:hidden"})),e("button",{key:"close-btn",class:"btn--close-sm close-mobile-menu sicon-cancel hidden"})]}};r.style='/*!twlt*/:host{display:block}.relative{position:relative}.left-0{left:0px}.m-8{margin:2rem}.flex{display:flex}.\\!hidden{display:none !important}.hidden{display:none}.w-56{width:14rem}.w-full{width:100%}.shrink-0{flex-shrink:0}.rounded-full{border-radius:9999px}.\\!py-3{padding-top:0.75rem !important;padding-bottom:0.75rem !important}.text-sm{font-size:0.875rem;line-height:1.25rem}.font-bold{font-weight:700}.text-gray-500{--tw-text-opacity:1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.shadow-default{--tw-shadow:5px 10px 30px #2B2D340D;--tw-shadow-colored:5px 10px 30px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}.s-menu-item{display:none !important}@media (min-width: 1024px){.s-menu-item{display:block !important}.s-menu-root-level{display:inline-block !important}}.s-menu-non-root-level{position:relative}.s-menu-products-wrapper{flex-grow:1;padding:2rem}.s-menu-products-container{display:grid;grid-template-columns:repeat(4, minmax(0, 1fr));gap:1rem}.s-menu-submenu-unordered-list{margin:2rem;width:14rem;flex-shrink:0}.s-menu-submenu-unordered-list:where([dir="ltr"],[dir="ltr"] *){margin-right:0px}.s-menu-submenu-unordered-list:where([dir="rtl"],[dir="rtl"] *){margin-left:0px}.s-menu-submenu-with-product{left:0px;display:flex;width:100%}.s-menu-submenu-without-product{width:14rem}.s-menu-footer-item{margin-bottom:1.25rem;display:block;font-size:0.875rem;line-height:1.25rem;line-height:1}.s-menu-footer-item:last-child{margin-bottom:0px}.s-menu-topnav-list{display:none;align-items:center;white-space:nowrap}@media (min-width: 1024px){.s-menu-topnav-list{display:flex}}.s-menu-topnav-list:where([dir="ltr"],[dir="ltr"] *){padding-right:1rem}.s-menu-topnav-list:where([dir="rtl"],[dir="rtl"] *){padding-left:1rem}.s-menu-topnav-item{display:inline-block;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1));padding-left:1rem;padding-right:1rem;padding-top:1px;padding-bottom:1px;font-size:0.875rem;line-height:1.25rem;line-height:1;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:300ms}.s-menu-topnav-item:hover{opacity:0.8}.s-menu-topnav-item:where([dir="ltr"],[dir="ltr"] *){border-right-width:1px}.s-menu-topnav-item:first-child:where([dir="ltr"],[dir="ltr"] *){padding-left:0px}.s-menu-topnav-item:last-child:where([dir="ltr"],[dir="ltr"] *){border-width:0px;padding-right:0px}.s-menu-topnav-item:where([dir="rtl"],[dir="rtl"] *){border-left-width:1px}.s-menu-topnav-item:first-child:where([dir="rtl"],[dir="rtl"] *){padding-right:0px}.s-menu-topnav-item:last-child:where([dir="rtl"],[dir="rtl"] *){border-width:0px;padding-left:0px}@media (min-width: 1024px){.lg\\:\\!block{display:block !important}.lg\\:\\!inline-block{display:inline-block !important}.lg\\:hidden{display:none}}.ltr\\:mr-0:where([dir="ltr"],[dir="ltr"] *){margin-right:0px}.rtl\\:ml-0:where([dir="rtl"],[dir="rtl"] *){margin-left:0px}';export{r as salla_menu}
4
+ import{r as t,h as e,F as i}from"./p-Z_0e-eaG.js";const r=class{constructor(e){t(this,e),this.source="header",this.useReactLink=!1,this.menus=[],this.displayAllText=""}async componentWillLoad(){return salla.onReady((()=>{if(this.displayAllText=salla.lang.get("blocks.home.display_all"),!this.sourceValue||"json"!==this.source)return this.getMenuItems();this.menus="string"==typeof this.sourceValue?JSON.parse(this.sourceValue):this.sourceValue||[]}))}getMenuItems(){return salla.api.component.getMenus(this.source).then((async({data:t})=>{this.menus=t,await salla.hooks.call("salla-menu","afterFetchMenuItems",this)})).catch((t=>{salla.logger.error("salla-menu::Error fetching menus",t)}))}hasChildren(t){return t?.children?.length>0}hasProducts(t){return t?.products?.length>0}getDesktopClasses(t,e){return`!hidden lg:!block ${e?"root-level lg:!inline-block":"relative"} ${t.products?" mega-menu":""}\n ${this.hasChildren(t)?"has-children":""}`}getAttributes(t){return t.trim().split(" ").reduce(((t,e)=>{let[i,r]=e.split("=");return t[i]=r.replace(/"/g,""),t}),{})}getMobileMenu(t,r){const l=t.image?e("img",{src:t.image,class:"rounded-full",width:"48",height:"48",alt:t.title}):null;return e("li",{class:"lg:hidden text-sm font-bold",...this.getAttributes(t.attrs)},this.hasChildren(t)?e(i,null,e("span",{class:t.image?"!py-3":""},l,t.title),e("ul",null,e("li",{class:"text-sm font-bold"},e("a",{href:t.url,class:"text-gray-500"},r)),t.children.map((t=>this.getMobileMenu(t,r))))):e("a",{href:t.url,"aria-label":t.title||"category",class:"text-gray-500 "+(t.image?"!py-3":""),...this.getAttributes(t.link_attrs)},l,e("span",null,t.title||"")))}getDesktopMenu(t,i){return e("li",{class:this.getDesktopClasses(t,i),...this.getAttributes(t.attrs)},e("a",{href:t.url,"aria-label":t.title||"category",...this.getAttributes(t.link_attrs)},e("span",null,t.title)),this.hasChildren(t)?e("div",{class:"sub-menu shadow-default "+(this.hasProducts(t)?"w-full left-0 flex":"w-56")},e("ul",{class:this.hasProducts(t)?"w-56 shrink-0 m-8 rtl:ml-0 ltr:mr-0":""},t.children.map((t=>this.getDesktopMenu(t,!1)))),this.hasProducts(t)?e("salla-products-list",{source:"selected","shadow-on-hover":!0,"source-value":`[${t.products}]`}):null):null)}getFooterMenu(t){const i=this.topnav||this.limit?t.slice(0,this.limit||3):t;return e("div",null,e("div",{class:{"s-menu-footer-list":!this.topnav,"s-menu-topnav-list":this.topnav}},i.map((t=>e("a",{key:t.id,href:t.url,target:t.target,class:{"s-menu-footer-item":!this.topnav,"s-menu-topnav-item topnav-link-item right-side":this.topnav},...t.callback?{onClick:t.callback}:{}},t.title)))))}getHeaderMenu(t){return t.map((t=>[this.getMobileMenu(t,this.displayAllText),this.getDesktopMenu(t,!0)]))}render(){return"footer"===this.source?this.getFooterMenu(this.menus):[e("nav",{key:"main-nav",id:"mobile-menu",class:"mobile-menu"},e("ul",{class:"main-menu"},this.getHeaderMenu(this.menus)),e("button",{class:"btn--close close-mobile-menu sicon-cancel lg:hidden"})),e("button",{key:"close-btn",class:"btn--close-sm close-mobile-menu sicon-cancel hidden"})]}};r.style='/*!twlt*/:host{display:block}.relative{position:relative}.left-0{left:0px}.m-8{margin:2rem}.flex{display:flex}.\\!hidden{display:none !important}.hidden{display:none}.w-56{width:14rem}.w-full{width:100%}.shrink-0{flex-shrink:0}.rounded-full{border-radius:9999px}.\\!py-3{padding-top:0.75rem !important;padding-bottom:0.75rem !important}.text-sm{font-size:0.875rem;line-height:1.25rem}.font-bold{font-weight:700}.text-gray-500{--tw-text-opacity:1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.shadow-default{--tw-shadow:5px 10px 30px #2B2D340D;--tw-shadow-colored:5px 10px 30px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}.s-menu-item{display:none !important}@media (min-width: 1024px){.s-menu-item{display:block !important}.s-menu-root-level{display:inline-block !important}}.s-menu-non-root-level{position:relative}.s-menu-products-wrapper{flex-grow:1;padding:2rem}.s-menu-products-container{display:grid;grid-template-columns:repeat(4, minmax(0, 1fr));gap:1rem}.s-menu-submenu-unordered-list{margin:2rem;width:14rem;flex-shrink:0}.s-menu-submenu-unordered-list:where([dir="ltr"],[dir="ltr"] *){margin-right:0px}.s-menu-submenu-unordered-list:where([dir="rtl"],[dir="rtl"] *){margin-left:0px}.s-menu-submenu-with-product{left:0px;display:flex;width:100%}.s-menu-submenu-without-product{width:14rem}.s-menu-footer-item{margin-bottom:1.25rem;display:block;font-size:0.875rem;line-height:1.25rem;line-height:1}.s-menu-footer-item:last-child{margin-bottom:0px}.s-menu-topnav-list{display:none;align-items:center;white-space:nowrap}@media (min-width: 1024px){.s-menu-topnav-list{display:flex}}.s-menu-topnav-list:where([dir="ltr"],[dir="ltr"] *){padding-right:1rem}.s-menu-topnav-list:where([dir="rtl"],[dir="rtl"] *){padding-left:1rem}.s-menu-topnav-item{display:inline-block;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1));padding-left:1rem;padding-right:1rem;padding-top:1px;padding-bottom:1px;font-size:0.875rem;line-height:1.25rem;line-height:1;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:300ms}.s-menu-topnav-item:hover{opacity:0.8}.s-menu-topnav-item:where([dir="ltr"],[dir="ltr"] *){border-right-width:1px}.s-menu-topnav-item:first-child:where([dir="ltr"],[dir="ltr"] *){padding-left:0px}.s-menu-topnav-item:last-child:where([dir="ltr"],[dir="ltr"] *){border-width:0px;padding-right:0px}.s-menu-topnav-item:where([dir="rtl"],[dir="rtl"] *){border-left-width:1px}.s-menu-topnav-item:first-child:where([dir="rtl"],[dir="rtl"] *){padding-right:0px}.s-menu-topnav-item:last-child:where([dir="rtl"],[dir="rtl"] *){border-width:0px;padding-left:0px}@media (min-width: 1024px){.lg\\:\\!block{display:block !important}.lg\\:\\!inline-block{display:inline-block !important}.lg\\:hidden{display:none}}.ltr\\:mr-0:where([dir="ltr"],[dir="ltr"] *){margin-right:0px}.rtl\\:ml-0:where([dir="rtl"],[dir="rtl"] *){margin-left:0px}';export{r as salla_menu}