@salla.sa/twilight-components 2.14.540 → 2.14.542

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 (399) hide show
  1. package/dist/cjs/{filepond-U8F_iDbp.js → filepond-B0aAvhFd.js} +1 -1
  2. package/dist/cjs/{filepond-plugin-file-poster-CAJAmCHU.js → filepond-plugin-file-poster-BFqqCNYU.js} +1 -1
  3. package/dist/cjs/{filepond-plugin-file-validate-size-Dxgl8Gdz.js → filepond-plugin-file-validate-size-BNcTcX1x.js} +1 -1
  4. package/dist/cjs/{filepond-plugin-file-validate-type-BPhw8zXs.js → filepond-plugin-file-validate-type-DAWd81u4.js} +1 -1
  5. package/dist/cjs/{filepond-plugin-image-edit-DNKfSuCy.js → filepond-plugin-image-edit-CIg9FEsX.js} +1 -1
  6. package/dist/cjs/{filepond-plugin-image-exif-orientation-NCmUtKOd.js → filepond-plugin-image-exif-orientation--VivPhX_.js} +1 -1
  7. package/dist/cjs/{filepond-plugin-image-preview-jRCd9jSG.js → filepond-plugin-image-preview-apJ7tv7p.js} +1 -1
  8. package/dist/cjs/helpers-ClOJIAG8.js +89 -0
  9. package/dist/cjs/{index-F_FURF-0.js → index-ufJ3UmgO.js} +18 -14
  10. package/dist/cjs/{intlTelInput-yt9noy9U.js → intlTelInput-1mNNQjMC.js} +1 -1
  11. package/dist/cjs/loader.cjs.js +2 -2
  12. package/dist/cjs/salla-accordion-body_2.cjs.entry.js +1 -1
  13. package/dist/cjs/salla-accordion_6.cjs.entry.js +1 -1
  14. package/dist/cjs/salla-add-product-button_5.cjs.entry.js +8 -2
  15. package/dist/cjs/salla-advertisement.cjs.entry.js +1 -1
  16. package/dist/cjs/salla-alert_2.cjs.entry.js +1 -1
  17. package/dist/cjs/salla-app-install-alert.cjs.entry.js +1 -1
  18. package/dist/cjs/salla-apps-icons.cjs.entry.js +1 -1
  19. package/dist/cjs/{salla-booking-field_7.cjs.entry.js → salla-attachment-view_9.cjs.entry.js} +1003 -40
  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_2.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 +2 -2
  28. package/dist/cjs/salla-comment-form_8.cjs.entry.js +14 -5
  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-gifting.cjs.entry.js +1 -1
  40. package/dist/cjs/salla-hook.cjs.entry.js +1 -1
  41. package/dist/cjs/salla-infinite-scroll.cjs.entry.js +1 -1
  42. package/dist/cjs/salla-installment.cjs.entry.js +1 -1
  43. package/dist/cjs/salla-list-tile.cjs.entry.js +1 -1
  44. package/dist/cjs/salla-localization-modal.cjs.entry.js +1 -1
  45. package/dist/cjs/salla-login-modal.cjs.entry.js +1 -1
  46. package/dist/cjs/salla-loyalty-banner_10.cjs.entry.js +1 -1
  47. package/dist/cjs/salla-loyalty-exchange-product-card.cjs.entry.js +1 -1
  48. package/dist/cjs/salla-loyalty-points-banner.cjs.entry.js +1 -1
  49. package/dist/cjs/salla-loyalty-points-history.cjs.entry.js +1 -1
  50. package/dist/cjs/salla-loyalty-prize-item.cjs.entry.js +1 -1
  51. package/dist/cjs/salla-loyalty.cjs.entry.js +1 -1
  52. package/dist/cjs/salla-maintenance-alert.cjs.entry.js +1 -1
  53. package/dist/cjs/salla-map_2.cjs.entry.js +1 -1
  54. package/dist/cjs/salla-menu.cjs.entry.js +1 -1
  55. package/dist/cjs/salla-metadata.cjs.entry.js +1 -1
  56. package/dist/cjs/salla-multiple-bundle-product-cart_2.cjs.entry.js +1 -1
  57. package/dist/cjs/salla-multiple-bundle-product-options-modal_2.cjs.entry.js +1 -1
  58. package/dist/cjs/salla-multiple-bundle-product.cjs.entry.js +1 -1
  59. package/dist/cjs/salla-next-order-coupon.cjs.entry.js +1 -1
  60. package/dist/cjs/salla-notification-item_2.cjs.entry.js +1 -1
  61. package/dist/cjs/salla-offer-modal.cjs.entry.js +1 -1
  62. package/dist/cjs/salla-offer.cjs.entry.js +1 -1
  63. package/dist/cjs/salla-order-branch.cjs.entry.js +1 -1
  64. package/dist/cjs/salla-order-cancel.cjs.entry.js +1 -1
  65. package/dist/cjs/salla-order-details-multiple-bundle-product.cjs.entry.js +1 -1
  66. package/dist/cjs/salla-order-details-options.cjs.entry.js +1 -1
  67. package/dist/cjs/salla-order-details.cjs.entry.js +1 -1
  68. package/dist/cjs/salla-order-edit-item.cjs.entry.js +1 -1
  69. package/dist/cjs/salla-order-edit-product-card.cjs.entry.js +1 -1
  70. package/dist/cjs/salla-order-edit.cjs.entry.js +1 -1
  71. package/dist/cjs/salla-order-options-modal_2.cjs.entry.js +1 -1
  72. package/dist/cjs/salla-order-shipments.cjs.entry.js +1 -1
  73. package/dist/cjs/salla-order-summary.cjs.entry.js +1 -1
  74. package/dist/cjs/salla-order-totals-card.cjs.entry.js +1 -1
  75. package/dist/cjs/salla-orders.cjs.entry.js +1 -1
  76. package/dist/cjs/salla-payments.cjs.entry.js +1 -1
  77. package/dist/cjs/salla-placeholder.cjs.entry.js +1 -1
  78. package/dist/cjs/salla-price-range.cjs.entry.js +1 -1
  79. package/dist/cjs/salla-product-card-embed.cjs.entry.js +1 -1
  80. package/dist/cjs/salla-product-size-guide.cjs.entry.js +1 -1
  81. package/dist/cjs/salla-products-list.cjs.entry.js +1 -1
  82. package/dist/cjs/salla-products-slider.cjs.entry.js +1 -1
  83. package/dist/cjs/salla-quick-order.cjs.entry.js +1 -1
  84. package/dist/cjs/salla-rating-modal-v2.cjs.entry.js +420 -84
  85. package/dist/cjs/salla-rating-modal.cjs.entry.js +3 -5
  86. package/dist/cjs/salla-review-factors-tags.cjs.entry.js +4 -83
  87. package/dist/cjs/salla-review-order-item.cjs.entry.js +125 -0
  88. package/dist/cjs/salla-scopes.cjs.entry.js +1 -1
  89. package/dist/cjs/salla-search.cjs.entry.js +1 -1
  90. package/dist/cjs/salla-skeleton.cjs.entry.js +1 -1
  91. package/dist/cjs/salla-slider.cjs.entry.js +1 -1
  92. package/dist/cjs/salla-social-share.cjs.entry.js +1 -1
  93. package/dist/cjs/salla-social.cjs.entry.js +1 -1
  94. package/dist/cjs/salla-tab-content_3.cjs.entry.js +1 -1
  95. package/dist/cjs/salla-tiered-offer.cjs.entry.js +1 -1
  96. package/dist/cjs/salla-tooltip.cjs.entry.js +1 -1
  97. package/dist/cjs/salla-trust-badges.cjs.entry.js +1 -1
  98. package/dist/cjs/salla-user-menu.cjs.entry.js +1 -1
  99. package/dist/cjs/salla-user-profile.cjs.entry.js +1 -1
  100. package/dist/cjs/salla-user-settings.cjs.entry.js +1 -1
  101. package/dist/cjs/salla-verify.cjs.entry.js +1 -1
  102. package/dist/cjs/salla-wallet.cjs.entry.js +1 -1
  103. package/dist/cjs/salla-wishlist-actions.cjs.entry.js +1 -1
  104. package/dist/cjs/twilight.cjs.js +2 -2
  105. package/dist/cjs/upload-limits-C3RarAPN.js +136 -0
  106. package/dist/cjs/{vanilla-picker-DXgSpklI.js → vanilla-picker-DvN9odkn.js} +1 -1
  107. package/dist/collection/collection-manifest.json +16 -11
  108. package/dist/collection/components/salla-attachment-view/salla-attachment-view.css +164 -0
  109. package/dist/collection/components/salla-attachment-view/salla-attachment-view.js +250 -0
  110. package/dist/collection/components/salla-attachments/salla-attachments.css +69 -0
  111. package/dist/collection/components/salla-attachments/salla-attachments.js +375 -0
  112. package/dist/collection/components/salla-comments/salla-comment-item.js +13 -3
  113. package/dist/collection/components/salla-comments/salla-comments.css +7 -0
  114. package/dist/collection/components/salla-datetime-picker/salla-datetime-picker.js +1 -1
  115. package/dist/collection/components/salla-file-upload/salla-file-upload.css +149 -0
  116. package/dist/collection/components/salla-file-upload/salla-file-upload.js +784 -42
  117. package/dist/collection/components/salla-file-upload/upload-limits.js +127 -0
  118. package/dist/collection/components/salla-product-options/salla-product-options.js +7 -1
  119. package/dist/collection/components/salla-products-slider/salla-products-slider.js +1 -1
  120. package/dist/collection/components/salla-rating-modal/rating-modal-media.js +85 -0
  121. package/dist/collection/components/salla-rating-modal/salla-rating-modal-v2.js +348 -85
  122. package/dist/collection/components/salla-rating-modal/salla-rating-modal.css +17 -7
  123. package/dist/collection/components/salla-rating-modal/salla-rating-modal.js +1 -3
  124. package/dist/collection/components/salla-review-factors-tags/helpers.js +8 -7
  125. package/dist/collection/components/salla-review-order-item/interfaces.js +1 -0
  126. package/dist/collection/components/salla-review-order-item/salla-review-order-item.js +154 -0
  127. package/dist/components/index.js +2 -2
  128. package/dist/components/salla-add-product-button2.js +40 -28
  129. package/dist/components/salla-attachment-view.d.ts +11 -0
  130. package/dist/components/salla-attachment-view.js +9 -0
  131. package/dist/components/salla-attachment-view2.js +323 -0
  132. package/dist/components/salla-attachments.d.ts +11 -0
  133. package/dist/components/salla-attachments.js +9 -0
  134. package/dist/components/salla-attachments2.js +232 -0
  135. package/dist/components/salla-basket-gap.js +46 -34
  136. package/dist/components/salla-breadcrumb.js +1 -1
  137. package/dist/components/salla-comment-factors2.js +1 -1
  138. package/dist/components/salla-comment-item2.js +26 -4
  139. package/dist/components/salla-comments.js +14 -2
  140. package/dist/components/salla-custom-fields.js +28 -4
  141. package/dist/components/salla-file-upload2.js +703 -31
  142. package/dist/components/salla-gifting.js +7 -1
  143. package/dist/components/salla-loyalty-exchange-product-card2.js +46 -34
  144. package/dist/components/salla-loyalty-panel.js +8 -2
  145. package/dist/components/salla-loyalty-program.js +8 -2
  146. package/dist/components/salla-multiple-bundle-product-cart2.js +40 -28
  147. package/dist/components/salla-multiple-bundle-product-details2.js +12 -6
  148. package/dist/components/salla-multiple-bundle-product-options-modal2.js +7 -1
  149. package/dist/components/salla-multiple-bundle-product-slider2.js +1 -1
  150. package/dist/components/salla-multiple-bundle-product.js +12 -6
  151. package/dist/components/salla-offer-modal.js +8 -2
  152. package/dist/components/salla-order-edit-item2.js +36 -24
  153. package/dist/components/salla-order-edit.js +42 -30
  154. package/dist/components/salla-order-options-modal2.js +34 -22
  155. package/dist/components/salla-product-card2.js +44 -32
  156. package/dist/components/salla-product-options2.js +39 -21
  157. package/dist/components/salla-products-slider2.js +8 -2
  158. package/dist/components/salla-quick-buy2.js +36 -24
  159. package/dist/components/salla-rating-modal-v22.js +449 -97
  160. package/dist/components/salla-rating-modal.js +30 -20
  161. package/dist/components/salla-review-factors-tags2.js +9 -8
  162. package/dist/components/salla-review-order-item.d.ts +11 -0
  163. package/dist/components/salla-review-order-item.js +196 -0
  164. package/dist/components/salla-reward-details2.js +8 -2
  165. package/dist/components/salla-slider2.js +1 -1
  166. package/dist/esm/{filepond-Bxzb6RRZ.js → filepond-BJvckaDn.js} +1 -1
  167. package/dist/esm/{filepond-plugin-file-poster-CZfrjnEX.js → filepond-plugin-file-poster-BJGjo9nD.js} +1 -1
  168. package/dist/esm/{filepond-plugin-file-validate-size-Dqa69lX7.js → filepond-plugin-file-validate-size-DLFBVAw5.js} +1 -1
  169. package/dist/esm/{filepond-plugin-file-validate-type-C_76nxDb.js → filepond-plugin-file-validate-type-Cl7gFtPR.js} +1 -1
  170. package/dist/esm/{filepond-plugin-image-edit-BvzVMeMY.js → filepond-plugin-image-edit-P-yC8gQP.js} +1 -1
  171. package/dist/esm/{filepond-plugin-image-exif-orientation-Br4ANTi7.js → filepond-plugin-image-exif-orientation-Ck7hEAD_.js} +1 -1
  172. package/dist/esm/{filepond-plugin-image-preview-e54xZ08P.js → filepond-plugin-image-preview-BSCNg5pC.js} +1 -1
  173. package/dist/esm/helpers-DqXpn47Z.js +85 -0
  174. package/dist/esm/{index-5UtJVEzd.js → index-DaGqpYdk.js} +18 -14
  175. package/dist/esm/{intlTelInput-BQXch__5.js → intlTelInput-CFalf-QE.js} +1 -1
  176. package/dist/esm/loader.js +3 -3
  177. package/dist/esm/salla-accordion-body_2.entry.js +1 -1
  178. package/dist/esm/salla-accordion_6.entry.js +1 -1
  179. package/dist/esm/salla-add-product-button_5.entry.js +8 -2
  180. package/dist/esm/salla-advertisement.entry.js +1 -1
  181. package/dist/esm/salla-alert_2.entry.js +1 -1
  182. package/dist/esm/salla-app-install-alert.entry.js +1 -1
  183. package/dist/esm/salla-apps-icons.entry.js +1 -1
  184. package/dist/esm/{salla-booking-field_7.entry.js → salla-attachment-view_9.entry.js} +1002 -41
  185. package/dist/esm/salla-badge.entry.js +1 -1
  186. package/dist/esm/salla-basket-gap.entry.js +1 -1
  187. package/dist/esm/salla-bullet-delivery_2.entry.js +1 -1
  188. package/dist/esm/salla-cart-coupons.entry.js +1 -1
  189. package/dist/esm/salla-cart-item-offers_2.entry.js +1 -1
  190. package/dist/esm/salla-cart-summary-card.entry.js +1 -1
  191. package/dist/esm/salla-cashback-banner.entry.js +1 -1
  192. package/dist/esm/salla-comment-factors.entry.js +2 -2
  193. package/dist/esm/salla-comment-form_8.entry.js +14 -5
  194. package/dist/esm/salla-conditional-offer.entry.js +1 -1
  195. package/dist/esm/salla-contacts.entry.js +1 -1
  196. package/dist/esm/salla-cookies-bar.entry.js +1 -1
  197. package/dist/esm/salla-count-down.entry.js +1 -1
  198. package/dist/esm/salla-custom-fields.entry.js +1 -1
  199. package/dist/esm/salla-delivery-promise.entry.js +1 -1
  200. package/dist/esm/salla-edit-order-button.entry.js +1 -1
  201. package/dist/esm/salla-filters-widget.entry.js +1 -1
  202. package/dist/esm/salla-filters.entry.js +1 -1
  203. package/dist/esm/salla-fulfillment-methods.entry.js +1 -1
  204. package/dist/esm/salla-gifting.entry.js +1 -1
  205. package/dist/esm/salla-hook.entry.js +1 -1
  206. package/dist/esm/salla-infinite-scroll.entry.js +1 -1
  207. package/dist/esm/salla-installment.entry.js +1 -1
  208. package/dist/esm/salla-list-tile.entry.js +1 -1
  209. package/dist/esm/salla-localization-modal.entry.js +1 -1
  210. package/dist/esm/salla-login-modal.entry.js +1 -1
  211. package/dist/esm/salla-loyalty-banner_10.entry.js +1 -1
  212. package/dist/esm/salla-loyalty-exchange-product-card.entry.js +1 -1
  213. package/dist/esm/salla-loyalty-points-banner.entry.js +1 -1
  214. package/dist/esm/salla-loyalty-points-history.entry.js +1 -1
  215. package/dist/esm/salla-loyalty-prize-item.entry.js +1 -1
  216. package/dist/esm/salla-loyalty.entry.js +1 -1
  217. package/dist/esm/salla-maintenance-alert.entry.js +1 -1
  218. package/dist/esm/salla-map_2.entry.js +1 -1
  219. package/dist/esm/salla-menu.entry.js +1 -1
  220. package/dist/esm/salla-metadata.entry.js +1 -1
  221. package/dist/esm/salla-multiple-bundle-product-cart_2.entry.js +1 -1
  222. package/dist/esm/salla-multiple-bundle-product-options-modal_2.entry.js +1 -1
  223. package/dist/esm/salla-multiple-bundle-product.entry.js +1 -1
  224. package/dist/esm/salla-next-order-coupon.entry.js +1 -1
  225. package/dist/esm/salla-notification-item_2.entry.js +1 -1
  226. package/dist/esm/salla-offer-modal.entry.js +1 -1
  227. package/dist/esm/salla-offer.entry.js +1 -1
  228. package/dist/esm/salla-order-branch.entry.js +1 -1
  229. package/dist/esm/salla-order-cancel.entry.js +1 -1
  230. package/dist/esm/salla-order-details-multiple-bundle-product.entry.js +1 -1
  231. package/dist/esm/salla-order-details-options.entry.js +1 -1
  232. package/dist/esm/salla-order-details.entry.js +1 -1
  233. package/dist/esm/salla-order-edit-item.entry.js +1 -1
  234. package/dist/esm/salla-order-edit-product-card.entry.js +1 -1
  235. package/dist/esm/salla-order-edit.entry.js +1 -1
  236. package/dist/esm/salla-order-options-modal_2.entry.js +1 -1
  237. package/dist/esm/salla-order-shipments.entry.js +1 -1
  238. package/dist/esm/salla-order-summary.entry.js +1 -1
  239. package/dist/esm/salla-order-totals-card.entry.js +1 -1
  240. package/dist/esm/salla-orders.entry.js +1 -1
  241. package/dist/esm/salla-payments.entry.js +1 -1
  242. package/dist/esm/salla-placeholder.entry.js +1 -1
  243. package/dist/esm/salla-price-range.entry.js +1 -1
  244. package/dist/esm/salla-product-card-embed.entry.js +1 -1
  245. package/dist/esm/salla-product-size-guide.entry.js +1 -1
  246. package/dist/esm/salla-products-list.entry.js +1 -1
  247. package/dist/esm/salla-products-slider.entry.js +1 -1
  248. package/dist/esm/salla-quick-order.entry.js +1 -1
  249. package/dist/esm/salla-rating-modal-v2.entry.js +420 -84
  250. package/dist/esm/salla-rating-modal.entry.js +3 -5
  251. package/dist/esm/salla-review-factors-tags.entry.js +2 -81
  252. package/dist/esm/salla-review-order-item.entry.js +123 -0
  253. package/dist/esm/salla-scopes.entry.js +1 -1
  254. package/dist/esm/salla-search.entry.js +1 -1
  255. package/dist/esm/salla-skeleton.entry.js +1 -1
  256. package/dist/esm/salla-slider.entry.js +1 -1
  257. package/dist/esm/salla-social-share.entry.js +1 -1
  258. package/dist/esm/salla-social.entry.js +1 -1
  259. package/dist/esm/salla-tab-content_3.entry.js +1 -1
  260. package/dist/esm/salla-tiered-offer.entry.js +1 -1
  261. package/dist/esm/salla-tooltip.entry.js +1 -1
  262. package/dist/esm/salla-trust-badges.entry.js +1 -1
  263. package/dist/esm/salla-user-menu.entry.js +1 -1
  264. package/dist/esm/salla-user-profile.entry.js +1 -1
  265. package/dist/esm/salla-user-settings.entry.js +1 -1
  266. package/dist/esm/salla-verify.entry.js +1 -1
  267. package/dist/esm/salla-wallet.entry.js +1 -1
  268. package/dist/esm/salla-wishlist-actions.entry.js +1 -1
  269. package/dist/esm/twilight.js +3 -3
  270. package/dist/esm/upload-limits-DrXX8XG8.js +121 -0
  271. package/dist/esm/{vanilla-picker-lLULIehu.js → vanilla-picker-BPvYmRRu.js} +1 -1
  272. package/dist/twilight/{p-1ee008c3.entry.js → p-06558ec3.entry.js} +1 -1
  273. package/dist/twilight/{p-18d7763b.entry.js → p-096b05e7.entry.js} +1 -1
  274. package/dist/twilight/p-09848b04.entry.js +4 -0
  275. package/dist/twilight/{p-f5747d3c.entry.js → p-0df4b2e1.entry.js} +1 -1
  276. package/dist/twilight/p-11347c90.entry.js +4 -0
  277. package/dist/twilight/{p-693d012f.entry.js → p-16c80467.entry.js} +1 -1
  278. package/dist/twilight/{p-3b0032e4.entry.js → p-17d19645.entry.js} +1 -1
  279. package/dist/twilight/{p-200a9c11.entry.js → p-1cfd78ce.entry.js} +1 -1
  280. package/dist/twilight/{p-582247b3.entry.js → p-1f63a8a3.entry.js} +1 -1
  281. package/dist/twilight/{p-3af52c82.entry.js → p-21ca76cd.entry.js} +1 -1
  282. package/dist/twilight/{p-d6b6f984.entry.js → p-243dc280.entry.js} +1 -1
  283. package/dist/twilight/{p-e6007706.entry.js → p-25b45505.entry.js} +1 -1
  284. package/dist/twilight/{p-900ee42a.entry.js → p-268a3562.entry.js} +1 -1
  285. package/dist/twilight/{p-ce941081.entry.js → p-26a4ab4b.entry.js} +1 -1
  286. package/dist/twilight/p-2996d4b7.entry.js +4 -0
  287. package/dist/twilight/{p-95224232.entry.js → p-29cddb02.entry.js} +1 -1
  288. package/dist/twilight/{p-088c1ab3.entry.js → p-30201fb9.entry.js} +1 -1
  289. package/dist/twilight/{p-66448f0f.entry.js → p-3282b3a6.entry.js} +1 -1
  290. package/dist/twilight/p-32ceb30c.entry.js +4 -0
  291. package/dist/twilight/{p-b9b32feb.entry.js → p-33a9c78a.entry.js} +1 -1
  292. package/dist/twilight/{p-49c2e935.entry.js → p-390d4d73.entry.js} +1 -1
  293. package/dist/twilight/{p-71731e63.entry.js → p-42dccb9d.entry.js} +1 -1
  294. package/dist/twilight/{p-4e2e4e92.entry.js → p-46e413e3.entry.js} +1 -1
  295. package/dist/twilight/p-4860edc2.entry.js +4 -0
  296. package/dist/twilight/{p-6c4cef7a.entry.js → p-494948d0.entry.js} +1 -1
  297. package/dist/twilight/{p-3136d942.entry.js → p-495b632f.entry.js} +1 -1
  298. package/dist/twilight/{p-fe222cbe.entry.js → p-4c30313e.entry.js} +1 -1
  299. package/dist/twilight/{p-66313db6.entry.js → p-4f59ac12.entry.js} +1 -1
  300. package/dist/twilight/{p-b16c1eac.entry.js → p-505ff5ef.entry.js} +1 -1
  301. package/dist/twilight/{p-21e9a475.entry.js → p-53735832.entry.js} +1 -1
  302. package/dist/twilight/{p-6e766b2a.entry.js → p-58d25433.entry.js} +1 -1
  303. package/dist/twilight/{p-ad54610c.entry.js → p-59c4876b.entry.js} +1 -1
  304. package/dist/twilight/{p-c224fa3a.entry.js → p-5c51b1a6.entry.js} +1 -1
  305. package/dist/twilight/p-61eeadbb.entry.js +4 -0
  306. package/dist/twilight/{p-497cc3a6.entry.js → p-6413aff2.entry.js} +1 -1
  307. package/dist/twilight/{p-4cff8533.entry.js → p-6794c97c.entry.js} +1 -1
  308. package/dist/twilight/{p-f27472f4.entry.js → p-684d6eb1.entry.js} +1 -1
  309. package/dist/twilight/{p-5f1b8510.entry.js → p-6972d948.entry.js} +1 -1
  310. package/dist/twilight/p-71ced4b7.entry.js +4 -0
  311. package/dist/twilight/{p-73607393.entry.js → p-72000ddb.entry.js} +1 -1
  312. package/dist/twilight/{p-891009e2.entry.js → p-72ae244c.entry.js} +1 -1
  313. package/dist/twilight/{p-ac9a54cc.entry.js → p-73edafaa.entry.js} +1 -1
  314. package/dist/twilight/{p-5cbbf472.entry.js → p-77391513.entry.js} +1 -1
  315. package/dist/twilight/p-7763e0be.entry.js +4 -0
  316. package/dist/twilight/{p-bb7bc52f.entry.js → p-77ba1fda.entry.js} +1 -1
  317. package/dist/twilight/{p-b639f062.entry.js → p-7a321b1c.entry.js} +1 -1
  318. package/dist/twilight/{p-acd1a9d8.entry.js → p-7bb14e7b.entry.js} +1 -1
  319. package/dist/twilight/{p-575b3b4c.entry.js → p-7bcd6e69.entry.js} +1 -1
  320. package/dist/twilight/{p-1c66fdb3.entry.js → p-7c61baf1.entry.js} +1 -1
  321. package/dist/twilight/{p-9af31040.entry.js → p-7d24fc33.entry.js} +1 -1
  322. package/dist/twilight/{p-524aabd2.entry.js → p-82fb654b.entry.js} +1 -1
  323. package/dist/twilight/{p-46d2375b.entry.js → p-8a12cb3e.entry.js} +1 -1
  324. package/dist/twilight/{p-ed9899c0.entry.js → p-8d4fe636.entry.js} +1 -1
  325. package/dist/twilight/{p-d8a69feb.entry.js → p-8d8fe545.entry.js} +1 -1
  326. package/dist/twilight/{p-4c34e1fd.entry.js → p-8e288b57.entry.js} +1 -1
  327. package/dist/twilight/{p-02e821a0.entry.js → p-930f7101.entry.js} +1 -1
  328. package/dist/twilight/{p-271a2d55.entry.js → p-96f7014a.entry.js} +1 -1
  329. package/dist/twilight/p-97ce9cb0.entry.js +4 -0
  330. package/dist/twilight/{p-1YJa6YaH.js → p-B-gnDFoe.js} +1 -1
  331. package/dist/twilight/{p-5njrWPq2.js → p-B0zeNMnk.js} +2 -2
  332. package/dist/twilight/{p-Dke2dnYe.js → p-BG6uSDFf.js} +1 -1
  333. package/dist/twilight/{p-CXv4fDWa.js → p-BQK0M8C7.js} +1 -1
  334. package/dist/twilight/{p-WDLGvEaR.js → p-BimR7cIN.js} +1 -1
  335. package/dist/twilight/{p-Cf5WZwC9.js → p-BqpEp7-e.js} +1 -1
  336. package/dist/twilight/{p-Dso9PQdO.js → p-Cv-hXjUb.js} +1 -1
  337. package/dist/twilight/{p-yEKxvrPt.js → p-DXvNz88d.js} +1 -1
  338. package/dist/twilight/{p-5UtJVEzd.js → p-DaGqpYdk.js} +1 -1
  339. package/dist/twilight/p-DqXpn47Z.js +4 -0
  340. package/dist/twilight/p-DrXX8XG8.js +4 -0
  341. package/dist/twilight/{p-CkJpLPBM.js → p-WLC9KdSz.js} +1 -1
  342. package/dist/twilight/{p-fb2c863d.entry.js → p-a08fb92b.entry.js} +1 -1
  343. package/dist/twilight/{p-5a26fb06.entry.js → p-a49c78f0.entry.js} +1 -1
  344. package/dist/twilight/{p-7a17138f.entry.js → p-a77540ee.entry.js} +1 -1
  345. package/dist/twilight/{p-2a9a4e12.entry.js → p-a89ae474.entry.js} +1 -1
  346. package/dist/twilight/{p-f3771ebc.entry.js → p-a9db1142.entry.js} +1 -1
  347. package/dist/twilight/{p-1bc7ab28.entry.js → p-ac7422d5.entry.js} +1 -1
  348. package/dist/twilight/{p-d4e1a8f7.entry.js → p-b13f73f7.entry.js} +1 -1
  349. package/dist/twilight/{p-b9477568.entry.js → p-b4db2812.entry.js} +1 -1
  350. package/dist/twilight/{p-e4cb5ee8.entry.js → p-b948c4e7.entry.js} +1 -1
  351. package/dist/twilight/{p-02df1c31.entry.js → p-c21a156c.entry.js} +1 -1
  352. package/dist/twilight/{p-8dab94d8.entry.js → p-c2b80e5c.entry.js} +1 -1
  353. package/dist/twilight/{p-b7f1bad9.entry.js → p-c34bf692.entry.js} +1 -1
  354. package/dist/twilight/{p-6757a647.entry.js → p-c55ce57e.entry.js} +1 -1
  355. package/dist/twilight/{p-64ee420e.entry.js → p-c7f384ba.entry.js} +1 -1
  356. package/dist/twilight/{p-1578cbe5.entry.js → p-ca56bdf4.entry.js} +1 -1
  357. package/dist/twilight/{p-40a0baa7.entry.js → p-cc80d691.entry.js} +1 -1
  358. package/dist/twilight/{p-913d4965.entry.js → p-cdaafc9b.entry.js} +1 -1
  359. package/dist/twilight/{p-c138132c.entry.js → p-ce868465.entry.js} +1 -1
  360. package/dist/twilight/{p-7e9d67f2.entry.js → p-d16998b0.entry.js} +1 -1
  361. package/dist/twilight/{p-397acd73.entry.js → p-d3ab94f2.entry.js} +1 -1
  362. package/dist/twilight/{p-963d34af.entry.js → p-d4ba3882.entry.js} +1 -1
  363. package/dist/twilight/{p-2d62c356.entry.js → p-d9ff0ef8.entry.js} +1 -1
  364. package/dist/twilight/{p-1c049149.entry.js → p-dd2f9c7d.entry.js} +1 -1
  365. package/dist/twilight/{p-a5afb821.entry.js → p-de002b09.entry.js} +1 -1
  366. package/dist/twilight/{p-a9e276fa.entry.js → p-e088823b.entry.js} +1 -1
  367. package/dist/twilight/{p-b5c90151.entry.js → p-e50e92d4.entry.js} +1 -1
  368. package/dist/twilight/{p-538a1642.entry.js → p-e5f6f36a.entry.js} +1 -1
  369. package/dist/twilight/{p-0ecbe43b.entry.js → p-e6090253.entry.js} +1 -1
  370. package/dist/twilight/{p-c8c36233.entry.js → p-e6e778d0.entry.js} +1 -1
  371. package/dist/twilight/{p-4e71dacc.entry.js → p-ea05a3b9.entry.js} +1 -1
  372. package/dist/twilight/{p-fbb156e8.entry.js → p-ec0d05d5.entry.js} +9 -9
  373. package/dist/twilight/{p-d505caaf.entry.js → p-ed7597fe.entry.js} +1 -1
  374. package/dist/twilight/{p-c05513ae.entry.js → p-f1077a6e.entry.js} +1 -1
  375. package/dist/twilight/{p-0895958b.entry.js → p-f1d5bc83.entry.js} +1 -1
  376. package/dist/twilight/twilight.esm.js +1 -1
  377. package/dist/types/components/salla-attachment-view/salla-attachment-view.d.ts +47 -0
  378. package/dist/types/components/salla-attachments/salla-attachments.d.ts +73 -0
  379. package/dist/types/components/salla-comments/interfaces.d.ts +1 -0
  380. package/dist/types/components/salla-comments/salla-comment-item.d.ts +3 -1
  381. package/dist/types/components/salla-file-upload/salla-file-upload.d.ts +127 -4
  382. package/dist/types/components/salla-file-upload/upload-limits.d.ts +49 -0
  383. package/dist/types/components/salla-rating-modal/rating-modal-media.d.ts +38 -0
  384. package/dist/types/components/salla-rating-modal/salla-rating-modal-v2.d.ts +30 -7
  385. package/dist/types/components/salla-review-factors-tags/helpers.d.ts +1 -1
  386. package/dist/types/components/salla-review-factors-tags/interfaces.d.ts +7 -0
  387. package/dist/types/components/salla-review-order-item/interfaces.d.ts +30 -0
  388. package/dist/types/components/salla-review-order-item/salla-review-order-item.d.ts +30 -0
  389. package/dist/types/components.d.ts +282 -7
  390. package/package.json +5 -5
  391. package/dist/twilight/p-0bc1c246.entry.js +0 -4
  392. package/dist/twilight/p-16c09de9.entry.js +0 -4
  393. package/dist/twilight/p-3024f859.entry.js +0 -4
  394. package/dist/twilight/p-3b821dc9.entry.js +0 -4
  395. package/dist/twilight/p-4dabd999.entry.js +0 -4
  396. package/dist/twilight/p-aaa37ca1.entry.js +0 -4
  397. package/dist/twilight/p-dcf53c45.entry.js +0 -4
  398. package/dist/twilight/p-f17fa83f.entry.js +0 -4
  399. package/dist/components/{keyboard_arrow_right.js → keyboard_arrow_left.js} +6 -6
@@ -0,0 +1,4 @@
1
+ /*!
2
+ * Crafted with ❤ by Salla
3
+ */
4
+ const r=new Map,t=new Map;function n(r){return r?Array.isArray(r)?r:Object.values(r):[]}function e(r){return r?[...n(r.product),...n(r.products)]:[]}function u(r,t,n,u){const a=function(r,t,n,e){return r.find((r=>!(!t||Number(r.id??r.feedback_id)!==Number(t))||!(!e||Number(r.order_item_id)!==Number(e))||!(!n||Number(r.product_id??r.product?.id)!==Number(n))))}(e(r?.rating),t,n,u);return function(r){if(!r)return[];for(const t of["factor_reviews","review_factors","factors"]){const n=r[t];if(Array.isArray(n)&&n.length)return n}return[]}(a)}async function a(n){if(null==n||""===n)return null;const e=String(n),u=r.get(e);if(u&&Date.now()-u.timestamp<=3e5)return u.data;const a=t.get(e);if(a)return a;const c=(async()=>{try{const t=await salla.api.request(`orders/${n}`,"","get"),u=t?.data??t;return r.set(e,{data:u,timestamp:Date.now()}),u}catch(t){throw r.delete(e),t}finally{t.delete(e)}})();return t.set(e,c),c}export{a as f,e as g,u as r}
@@ -0,0 +1,4 @@
1
+ /*!
2
+ * Crafted with ❤ by Salla
3
+ */
4
+ function n(n,t){const e=[];return n&&e.push("image/png, image/jpeg, image/jpg"),t&&e.push("video/mp4, video/quicktime, video/x-msvideo, video/x-matroska, video/webm, .mp4, .mov, .avi, .mkv, .webm"),e.join(", ")}function t(n,t){return null!=n||null!=t}function e(n){return n??0}function i(n){return n??0}function o(n,o,r){return t(o,r)?e(o)+i(r):n}function r(n,t){return!!n?.startsWith("video/")||!(!t||!/\.(mp4|webm|mov|avi|mkv)$/i.test(t))}function u(n,t){return!!n?.startsWith("image/")||!(!t||!/\.(png|jpe?g|gif|webp|heic|heif)$/i.test(t))}function a(n){const t=n.match(/^(\d+(?:\.\d+)?)\s*(KB|MB)$/i);if(!t)return 0;const e=parseFloat(t[1]);return"MB"===t[2].toUpperCase()?1024*e*1024:1024*e}function s(n){return n>=1048576?`${Math.round(n/1048576)}MB`:`${Math.round(n/1024)}KB`}function c(n){const t=Math.floor(n/60),e=Math.floor(n%60);return t>0?`${t}:${e.toString().padStart(2,"0")}`:`${e}s`}function f(n,t,e){const i=[t?`${t}KB`:n,e].filter(Boolean).map((n=>a(n)));return i.length?s(Math.max(...i)):null}function m(n,t){if(function(n){const t=(n.body||"").toLowerCase();return"size"===n.type||t.includes("too large")||t.includes("max file size")||t.includes("file is too big")||t.includes("exceeds")}(n)){if(t.isVideo){const n=t.maxVideoFileSizeLabel||(t.maxVideoBytes?s(t.maxVideoBytes):"");return t.videoTooLarge(n)}return t.tooLargeLabel}return function(n){const t=(n.body||"").toLowerCase();return"type"===n.type||t.includes("invalid type")||t.includes("not allowed")||t.includes("file type")}(n)?t.invalidTypeLabel:n.body?n.body:t.genericErrorLabel}function l(n){return 8!==n&&6!==n}function p(n){return!!l(n)&&7!==n&&1!==n}export{u as a,n as b,i as c,o as d,f as e,m as f,e as g,s as h,r as i,c as j,p as k,a as p,l as s,t as u}
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{d as e}from"./p-5UtJVEzd.js";function E(e,E){return E.forEach((function(E){E&&"string"!=typeof E&&!Array.isArray(E)&&Object.keys(E).forEach((function(i){if("default"!==i&&!(i in e)){var _=Object.getOwnPropertyDescriptor(E,i);Object.defineProperty(e,i,_.get?_:{enumerable:!0,get:function(){return E[i]}})}}))})),Object.freeze(e)}var i,_,l={exports:{}},n=i?l.exports:(i=1,l.exports=(_=function(e){var E=e.addFilter,i=e.utils,_=i.Type,l=i.replaceInString,n=i.toNaturalFileSize;return E("ALLOW_HOPPER_ITEM",(function(e,E){var i=E.query;if(!i("GET_ALLOW_FILE_SIZE_VALIDATION"))return!0;var _=i("GET_MAX_FILE_SIZE");if(null!==_&&e.size>_)return!1;var l=i("GET_MIN_FILE_SIZE");return!(null!==l&&e.size<l)})),E("LOAD_FILE",(function(e,E){var i=E.query;return new Promise((function(E,_){if(!i("GET_ALLOW_FILE_SIZE_VALIDATION"))return E(e);var t=i("GET_FILE_VALIDATE_SIZE_FILTER");if(t&&!t(e))return E(e);var I=i("GET_MAX_FILE_SIZE");if(null!==I&&e.size>I)_({status:{main:i("GET_LABEL_MAX_FILE_SIZE_EXCEEDED"),sub:l(i("GET_LABEL_MAX_FILE_SIZE"),{filesize:n(I,".",i("GET_FILE_SIZE_BASE"),i("GET_FILE_SIZE_LABELS",i))})}});else{var L=i("GET_MIN_FILE_SIZE");if(null!==L&&e.size<L)_({status:{main:i("GET_LABEL_MIN_FILE_SIZE_EXCEEDED"),sub:l(i("GET_LABEL_MIN_FILE_SIZE"),{filesize:n(L,".",i("GET_FILE_SIZE_BASE"),i("GET_FILE_SIZE_LABELS",i))})}});else{var a=i("GET_MAX_TOTAL_FILE_SIZE");if(null!==a&&i("GET_ACTIVE_ITEMS").reduce((function(e,E){return e+E.fileSize}),0)>a)return void _({status:{main:i("GET_LABEL_MAX_TOTAL_FILE_SIZE_EXCEEDED"),sub:l(i("GET_LABEL_MAX_TOTAL_FILE_SIZE"),{filesize:n(a,".",i("GET_FILE_SIZE_BASE"),i("GET_FILE_SIZE_LABELS",i))})}});E(e)}}}))})),{options:{allowFileSizeValidation:[!0,_.BOOLEAN],maxFileSize:[null,_.INT],minFileSize:[null,_.INT],maxTotalFileSize:[null,_.INT],fileValidateSizeFilter:[null,_.FUNCTION],labelMinFileSizeExceeded:["File is too small",_.STRING],labelMinFileSize:["Minimum file size is {filesize}",_.STRING],labelMaxFileSizeExceeded:["File is too large",_.STRING],labelMaxFileSize:["Maximum file size is {filesize}",_.STRING],labelMaxTotalFileSizeExceeded:["Maximum total size exceeded",_.STRING],labelMaxTotalFileSize:["Maximum total file size is {filesize}",_.STRING]}}},"undefined"!=typeof window&&void 0!==window.document&&document.dispatchEvent(new CustomEvent("FilePond:pluginloaded",{detail:_})),_)),t=E({__proto__:null,default:e(n)},[n]);
4
+ import{d as e}from"./p-DaGqpYdk.js";function E(e,E){return E.forEach((function(E){E&&"string"!=typeof E&&!Array.isArray(E)&&Object.keys(E).forEach((function(i){if("default"!==i&&!(i in e)){var _=Object.getOwnPropertyDescriptor(E,i);Object.defineProperty(e,i,_.get?_:{enumerable:!0,get:function(){return E[i]}})}}))})),Object.freeze(e)}var i,_,l={exports:{}},n=i?l.exports:(i=1,l.exports=(_=function(e){var E=e.addFilter,i=e.utils,_=i.Type,l=i.replaceInString,n=i.toNaturalFileSize;return E("ALLOW_HOPPER_ITEM",(function(e,E){var i=E.query;if(!i("GET_ALLOW_FILE_SIZE_VALIDATION"))return!0;var _=i("GET_MAX_FILE_SIZE");if(null!==_&&e.size>_)return!1;var l=i("GET_MIN_FILE_SIZE");return!(null!==l&&e.size<l)})),E("LOAD_FILE",(function(e,E){var i=E.query;return new Promise((function(E,_){if(!i("GET_ALLOW_FILE_SIZE_VALIDATION"))return E(e);var t=i("GET_FILE_VALIDATE_SIZE_FILTER");if(t&&!t(e))return E(e);var I=i("GET_MAX_FILE_SIZE");if(null!==I&&e.size>I)_({status:{main:i("GET_LABEL_MAX_FILE_SIZE_EXCEEDED"),sub:l(i("GET_LABEL_MAX_FILE_SIZE"),{filesize:n(I,".",i("GET_FILE_SIZE_BASE"),i("GET_FILE_SIZE_LABELS",i))})}});else{var a=i("GET_MIN_FILE_SIZE");if(null!==a&&e.size<a)_({status:{main:i("GET_LABEL_MIN_FILE_SIZE_EXCEEDED"),sub:l(i("GET_LABEL_MIN_FILE_SIZE"),{filesize:n(a,".",i("GET_FILE_SIZE_BASE"),i("GET_FILE_SIZE_LABELS",i))})}});else{var L=i("GET_MAX_TOTAL_FILE_SIZE");if(null!==L&&i("GET_ACTIVE_ITEMS").reduce((function(e,E){return e+E.fileSize}),0)>L)return void _({status:{main:i("GET_LABEL_MAX_TOTAL_FILE_SIZE_EXCEEDED"),sub:l(i("GET_LABEL_MAX_TOTAL_FILE_SIZE"),{filesize:n(L,".",i("GET_FILE_SIZE_BASE"),i("GET_FILE_SIZE_LABELS",i))})}});E(e)}}}))})),{options:{allowFileSizeValidation:[!0,_.BOOLEAN],maxFileSize:[null,_.INT],minFileSize:[null,_.INT],maxTotalFileSize:[null,_.INT],fileValidateSizeFilter:[null,_.FUNCTION],labelMinFileSizeExceeded:["File is too small",_.STRING],labelMinFileSize:["Minimum file size is {filesize}",_.STRING],labelMaxFileSizeExceeded:["File is too large",_.STRING],labelMaxFileSize:["Maximum file size is {filesize}",_.STRING],labelMaxTotalFileSizeExceeded:["Maximum total size exceeded",_.STRING],labelMaxTotalFileSize:["Maximum total file size is {filesize}",_.STRING]}}},"undefined"!=typeof window&&void 0!==window.document&&document.dispatchEvent(new CustomEvent("FilePond:pluginloaded",{detail:_})),_)),t=E({__proto__:null,default:e(n)},[n]);
5
5
  /*!
6
6
  * FilePondPluginFileValidateSize 2.2.8
7
7
  * Licensed under MIT, https://opensource.org/licenses/MIT/
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r as t,h as i}from"./p-5UtJVEzd.js";import{a as e}from"./p-CgtvEd63.js";import{a as s}from"./p-BedNk7k1.js";import{C as r}from"./p-BsLF_HK7.js";import{G as a}from"./p-DxkgAGoT.js";const o=class{constructor(i){t(this,i),this.defaultEvent="gifting:open",this.selectImageForYourGift=salla.lang.get("blocks.buy_as_gift.select_image_for_your_gift"),this.currentStep=1,this.showCalendar=!1,this.showGiftText=!1,this.currentLang="",this.parentClass="is-current-step-1",this.errors={},this.gift=void 0,this.selectedGiftTextOption=void 0,this.selectedCountryId=void 0,this.selectedCountryCode=void 0,this.loadingCities=!1,this.loadingRegions=!1,this.regions=[],this.selectedRegionId=void 0,this.isKSA=!1,this.selectedCountry=null,this.selectedRegion=null,this.displayedCities=[],this.selectedCity=null,this.searchingCities=!1,this.enableCityAjaxSearch=!1,this.citySearchQuery="",this.step2Animated=!1,this.citySearchTimer=null,this.citySearchCounter=0,this.locationRequestCounter=0,this.showTextArea=!1,this.selectedImage=void 0,this.uploadedImage=void 0,this.selectedText=void 0,this.hasError=!1,this.timeZone=null,this.receiverCountryCode=salla.config.get("store.scope.countries")?.[0]||salla.config.get("store.store_country")||"SA",this.hostId=`salla-gifting-${Math.random().toString(36).slice(2,10)}`,this.disableClass=this.gift?.show_image_upload?"":"pointer-events-none",this.formSelector="form.product-form, form.form--product-options",this.handleCitySearch=t=>{if(this.citySearchQuery=t,!this.enableCityAjaxSearch)return;this.citySearchTimer&&clearTimeout(this.citySearchTimer);const i=++this.citySearchCounter;this.citySearchTimer=setTimeout((async()=>{this.searchingCities=!0;try{const e=await this.fetchCities(t);i===this.citySearchCounter&&(this.displayedCities=e)}catch(t){i===this.citySearchCounter&&(this.displayedCities=[])}finally{i===this.citySearchCounter&&(this.searchingCities=!1)}}),o.CITY_SEARCH_DEBOUNCE_MS)},this.handleCitySelected=t=>{this.selectedCity=t,this.receiverCity=String(t.id),this.clearError("receiver.city_id")},this.handleCityDropdownClosed=()=>{this.citySearchQuery="",this.citySearchTimer&&(clearTimeout(this.citySearchTimer),this.citySearchTimer=null),++this.citySearchCounter,this.displayedCities=this.gift?.cities??[],this.searchingCities=!1},this.handleCountryDropdownClosed=()=>{},this.handleRegionDropdownClosed=()=>{},salla.lang.onLoaded((()=>{this.selectImageOrUpload=salla.lang.get("blocks.buy_as_gift.select_image_or_upload"),this.selectImageForYourGift=salla.lang.get("blocks.buy_as_gift.select_image_for_your_gift"),this.sectionTitle=salla.lang.get("blocks.buy_as_gift.gift_the_one_you_love"),this.sectionSubtitle=salla.lang.get("blocks.buy_as_gift.gift_the_one_you_love_message"),this.sectionBtnText=salla.lang.get("blocks.buy_as_gift.send_as_a_gift"),this.giftDetails=salla.lang.get("blocks.buy_as_gift.gift_details"),this.selectGiftMessage=salla.lang.get("blocks.buy_as_gift.select_gift_message"),this.giftText=salla.lang.get("blocks.buy_as_gift.gift_text"),this.giftCustomText=salla.lang.get("blocks.buy_as_gift.gift_custom_text"),this.textId=salla.lang.get("blocks.buy_as_gift.text_id"),this.incorrectGiftText=salla.lang.get("blocks.buy_as_gift.incorrect_gift_text"),this.nextStep=salla.lang.get("blocks.buy_as_gift.next_step"),this.senderNameLabel=salla.lang.get("blocks.buy_as_gift.sender_name"),this.receiverNameFieldLabel=salla.lang.get("blocks.buy_as_gift.receiver_name"),this.receiverMobileFieldLabel=salla.lang.get("blocks.buy_as_gift.receiver_mobile"),this.receiverCountryFieldLabel=salla.lang.get("blocks.buy_as_gift.receiver_country"),this.ksa=salla.lang.get("pages.checkout.ksa"),this.selectCity=salla.lang.get("pages.checkout.select_city"),this.selectCountry=salla.lang.get("pages.checkout.select_country"),this.selectCityInfo=salla.lang.get("blocks.buy_as_gift.city_info"),this.cityChangeNotice=salla.lang.get("blocks.buy_as_gift.city_change_notice"),this.receiverCityFieldLabel=salla.lang.get("blocks.buy_as_gift.receiver_city"),this.receiverRegionFieldLabel=salla.lang.get("blocks.buy_as_gift.receiver_region")||salla.lang.get("pages.checkout.region"),this.selectRegion=salla.lang.get("pages.checkout.select_region"),this.receiverEmailFieldLabel=salla.lang.get("blocks.buy_as_gift.receiver_email"),this.emailPlaceholder=salla.lang.get("common.elements.email_placeholder"),this.sendLater=salla.lang.get("blocks.buy_as_gift.send_later"),this.selectSendDateAndTime=salla.lang.get("blocks.buy_as_gift.select_send_date_and_time"),this.canNotEditOrderAfterSelectDate=salla.lang.get("blocks.buy_as_gift.can_not_edit_order_after_select_date"),this.sendGift=salla.lang.get("blocks.buy_as_gift.send_gift"),this.donationRequired=salla.lang.get("pages.products.donation_amount_required"),this.currentLang=salla.lang.locale})),salla.event.on(this.defaultEvent,(()=>{this.open()}))}isPhysical(){return this.physicalProducts||this.physical}cityNoticeText(){return this.gift?.recipient_can_change_address?this.gift?.allows_different_shipping_cost?null:this.cityChangeNotice:this.selectCityInfo}componentDidLoad(){salla.event.product.onPriceUpdated((()=>{const t=document.querySelector(".s-quantity-input-input");this.quantity=t?.value}))}getFormDataFromForm(){if(!this.formSelector)return null;const t=document.querySelector(this.formSelector);return t?new FormData(t):null}mergeObjectToFormData(t,i,e){for(let s in t){if(!t.hasOwnProperty(s)||null==t[s])continue;const r=e?`${e}[${s}]`:s;"object"!=typeof t[s]||null===t[s]||t[s]instanceof File?i.set(r,t[s]):this.mergeObjectToFormData(t[s],i,r)}return i}async open(){if(salla.config.isGuest())return salla.api.auth.setAfterLoginEvent(this.defaultEvent),void salla.event.dispatch("login::open",{withoutReload:!0});this.resetStepsAnimation(),this.currentStep=1,this.parentClass="is-current-step-1",this.step2Animated=!1,this.stepsWrapper?.style.removeProperty("height"),await this.modal.open();const t=this.productId?()=>salla.product.getGiftProductDetails(this.productId):()=>salla.cart.getGiftCartDetails();return await salla.api.withoutNotifier(t).then((t=>{this.gift=t.data,this.senderName=this.gift.sender_name,this.disableClass=this.gift?.show_image_upload?"":"pointer-events-none",this.gift.show_texts||(this.selectedGiftTextOption=void 0,this.selectedText=void 0),this.gift.show_images||(this.selectedImage=void 0,this.uploadedImage=void 0),this.skipStep1()&&(this.currentStep=2,this.parentClass="is-current-step-2",this.step2Animated=!0)})).catch((t=>{this.hasError=!0,this.errorMessage=t.response?.data?.error?.message||t.response?.data})).finally((()=>this.modal.stopLoading()))}skipStep1(){return!!this.gift&&!this.gift.show_images&&!this.gift.show_texts}resetStepsAnimation(){[this.step1Elems,this.step2Elems].forEach((t=>{t?.querySelectorAll(".anime-item").forEach((t=>t.removeAttribute("style")))})),this.step1Elems?.removeAttribute("style"),this.step2Elems&&!this.skipStep1()&&(this.step2Elems.style.removeProperty("opacity"),this.step2Elems.style.removeProperty("transform"))}async close(){return this.modal.close()}async setWrapperHeight(t=1,i=250,e=0,s=0){let r=document.querySelector(`#${this.hostId} .gift-step-${t}`);const a=()=>{this.stepsWrapper.style.height=s?`${s}px`:r.offsetHeight+e+"px"};this.step2Animated&&2===t?requestAnimationFrame(a):setTimeout(a,i)}toggleCalendar(){this.showCalendar=!this.showCalendar,this.setWrapperHeight(2,150,0)}toggleGiftText(t){this.textSelect?.classList.remove("s-form-has-error");let i=t.target.children[t.target.selectedIndex].getAttribute("data-id"),e="custom"==i;const s=this.showGiftText!==e;this.showGiftText=e,i?(this.selectedGiftTextOption=i,this.selectedText=e?void 0:t.target.value):(this.textArea.value="",this.selectedText=void 0,this.selectedGiftTextOption=void 0),s&&this.setWrapperHeight(1,150,5)}async goToStep2(t=!0){this.step1Elems&&(t&&!this.validateStep1()||(this.stepsWrapper&&this.step1Elems&&(this.stepsWrapper.style.height=`${this.step1Elems.offsetHeight}px`),this.setWrapperHeight(2,50,0),(new e.timeline).add({targets:this.step1Elems.querySelectorAll(`#${this.hostId} .anime-item`),opacity:[1,0],translateX:[0,50],delay:e.stagger(70),duration:1200}).add({targets:".gift-step-2",translateX:["-110%",0],opacity:[0,1]},"-=1800").add({targets:this.step2Elems.querySelectorAll(`#${this.hostId} .anime-item`),opacity:[0,1],translateX:[-50,0],delay:e.stagger(70),duration:1200,complete:()=>{this.step2Elems.querySelectorAll(`#${this.hostId} .anime-item`).forEach((t=>{t.classList.remove("opacity-0"),t.removeAttribute("style")})),this.step2Animated=!0}},"-=1200"),this.currentStep=2,this.parentClass=`is-current-step-${this.currentStep}`))}validateStep1(){return!(this.gift?.show_texts&&(this.selectedGiftTextOption?"custom"!=this.selectedGiftTextOption||this.selectedText?(this.textSelect?.classList.remove("s-form-has-error"),this.customTextArea?.classList.remove("s-form-has-error"),0):(this.textSelect?.classList.remove("s-form-has-error"),this.customTextArea?.classList.add("s-form-has-error"),1):(this.textSelect?.classList.add("s-form-has-error"),this.customTextArea?.classList.remove("s-form-has-error"),1)))}goToStep1(t){t.preventDefault();let i=new e.timeline({autoplay:!1});i.add({targets:this.step2Elems.querySelectorAll(`#${this.hostId} .anime-item`),opacity:[1,0],translateX:[0,-50],delay:e.stagger(70),duration:1200}).add({targets:".gift-step-1",translateX:["110%",0],opacity:[0,1]},"-=1800").add({targets:this.step1Elems.querySelectorAll(`#${this.hostId} .anime-item`),opacity:[0,1],translateX:[50,0],delay:e.stagger(70),duration:1200,complete:()=>{this.step1Elems.querySelectorAll(`#${this.hostId} .anime-item`).forEach((t=>{t.classList.remove("opacity-0"),t.removeAttribute("style")}))}},"-=1200"),i.play(),this.step2Animated=!1,this.setWrapperHeight(1,600,0),this.currentStep=1,this.parentClass=`is-current-step-${this.currentStep}`}getFilepondPlaceholder(){return`<div class="s-gifting-filepond-placeholder"><span class="s-gifting-filepond-placeholder-icon"><svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>images</title>\n<path d="M22.667 29.333h-13.333c-3.676 0-6.667-2.991-6.667-6.667v-13.333c0-0.737-0.597-1.333-1.333-1.333s-1.333 0.596-1.333 1.333v13.333c0 5.145 4.187 9.333 9.333 9.333h13.333c0.736 0 1.333-0.596 1.333-1.333s-0.597-1.333-1.333-1.333zM22.667 5.333c-2.205 0-4 1.795-4 4s1.795 4 4 4 4-1.795 4-4-1.795-4-4-4zM22.667 10.667c-0.735 0-1.333-0.597-1.333-1.333s0.599-1.333 1.333-1.333 1.333 0.597 1.333 1.333-0.599 1.333-1.333 1.333zM25.333 0h-13.333c-3.676 0-6.667 2.991-6.667 6.667v13.333c0 1.055 0.268 2.040 0.707 2.927 0.039 0.099 0.088 0.188 0.151 0.277 1.137 2.053 3.301 3.463 5.809 3.463h13.333c3.676 0 6.667-2.991 6.667-6.667v-13.333c0-3.676-2.991-6.667-6.667-6.667zM12 24c-1.244 0-2.344-0.583-3.077-1.476l5.721-7.047 6.629 8.523zM29.333 20c0 2.205-1.795 4-4 4h-0.68l-8.933-11.485c-0.251-0.32-0.633-0.511-1.039-0.515h-0.015c-0.401 0-0.781 0.181-1.035 0.492l-5.632 6.935v-12.76c0-2.205 1.795-4 4-4h13.333c2.205 0 4 1.795 4 4z"></path>\n</svg>\n</span><p class="s-gifting-filepond-placeholder-text">${this.selectImageOrUpload&&this.gift.show_image_upload?this.selectImageOrUpload:this.selectImageForYourGift}</p></div>`}setPreview(t){this.uploader?.classList.add("has-bg");var i=document.querySelector(`#${this.hostId}.filepond-bg`)?document.querySelector(`#${this.hostId} .filepond-bg`):document.createElement("div");i.classList.add("filepond-bg"),i.classList.remove("s-hidden"),i.style.backgroundImage="url('"+t.url+"')",this.uploader?.querySelector(".filepond--root")?.appendChild(i),this.uploadedImage=t.url,this.gift&&this.gift.gift_images?.length&&this.setWrapperHeight(1,150,0)}removePreview(){this.uploader.classList.remove("has-bg");let t=document.querySelector(`#${this.hostId} .filepond-bg`);t.removeAttribute("style"),t.classList.add("s-hidden"),this.handleRemoveImage()}handleTextAreaChange(t){this.selectedText=t.target.value,this.customTextArea?.classList.remove("s-form-has-error")}clearError(t){if(this.errors?.[t]){const{[t]:i,...e}=this.errors;this.errors=e}}handleSenderName(t){this.senderName=t.target.value,this.clearError("sender_name")}handleReceiverName(t){this.receiverName=t.target.value,this.clearError("receiver.name")}resetCityState(){this.citySearchTimer&&(clearTimeout(this.citySearchTimer),this.citySearchTimer=null),++this.citySearchCounter,this.gift={...this.gift,cities:[]},this.displayedCities=[],this.receiverCity=void 0,this.selectedCity=null,this.citySearchQuery="",this.searchingCities=!1,this.enableCityAjaxSearch=!1}setInitialCities(t){this.gift={...this.gift,cities:t},this.displayedCities=t,this.enableCityAjaxSearch=t.length>=o.CITY_AJAX_THRESHOLD}async fetchCities(t=""){if(!this.selectedCountryId)return[];if(this.isKSA&&!this.selectedRegionId)return[];const i=["for_branch=0",`country_id=${this.selectedCountryId}`];this.isKSA&&this.selectedRegionId&&i.push(`region_id=${this.selectedRegionId}`),t?.trim()&&i.push(`query=${encodeURIComponent(t.trim())}`);const e=await salla.api.request(`shipping/cities?${i.join("&")}`);return e?.data??[]}async handleCountrySelected(t){const i=t?.id;this.selectedCountry=t??null,this.selectedCountryId=i,this.selectedCountryCode=t?.country_code,this.isKSA="SA"===t?.country_code,this.clearError("receiver.country"),this.regions=[],this.selectedRegionId=void 0,this.selectedRegion=null,this.resetCityState();const e=++this.locationRequestCounter;if(!i)return this.selectedCountryCode=void 0,this.isKSA=!1,void this.setWrapperHeight(2,0,0);if(this.isKSA){this.loadingRegions=!0,this.setWrapperHeight(2,0,0);try{const t=await salla.api.request(`shipping/countries/${i}/regions`);if(e!==this.locationRequestCounter)return;t&&t.data&&(this.regions=t.data)}catch(t){if(e!==this.locationRequestCounter)return;console.error("Error fetching regions:",t)}finally{e===this.locationRequestCounter&&(this.loadingRegions=!1,this.setWrapperHeight(2,0,0))}}else{this.loadingCities=!0,this.setWrapperHeight(2,0,0);try{const t=await this.fetchCities();if(e!==this.locationRequestCounter)return;this.setInitialCities(t)}catch(t){if(e!==this.locationRequestCounter)return;console.error("Error fetching cities:",t)}finally{e===this.locationRequestCounter&&(this.loadingCities=!1)}}}async handleRegionSelected(t){const i=t?.id;this.selectedRegion=t??null,this.selectedRegionId=i,this.clearError("receiver.region"),this.resetCityState();const e=++this.locationRequestCounter;if(i){this.loadingCities=!0;try{const t=await this.fetchCities();if(e!==this.locationRequestCounter)return;this.setInitialCities(t)}catch(t){if(e!==this.locationRequestCounter)return;console.error("Error fetching cities:",t)}finally{e===this.locationRequestCounter&&(this.loadingCities=!1,this.setWrapperHeight(2,0,0))}}}handleUploadImage(t){this.uploadedImage=t,this.gift&&this.gift.gift_images?.length&&this.setWrapperHeight(1,150,0)}handleRemoveImage(){this.uploadedImage="",this.gift&&this.gift.gift_images?.length&&this.setWrapperHeight(1,150,0)}handlePhoneInputChange(t){let i=t.detail;this.receiverMobile=i.number,this.receiverCountryCode=i.country_code,this.clearError("receiver.mobile")}handleDateTimePicker(t){this.deliveryDate=t.detail}getCalendarClasses(){return{"s-form-group":!0,"anime-item":!0,"s-gifting-calendar":!0,shown:this.showCalendar,hide:!this.showCalendar,"s-form-has-error":!!this.errors&&this.errors.deliver_at}}async submitForm(){const t=document.querySelector("#donating-amount")?.value;if(this.calendarFormGroup.classList.remove("s-form-has-error"),this.errors&&(this.errors={},this.setWrapperHeight(2,150,0)),this.showCalendar&&!this.deliveryDate)return void this.calendarFormGroup.classList.add("s-form-has-error");const i=[{key:"sender_name",value:this.senderName,label:this.senderNameLabel},{key:"receiver.name",value:this.receiverName,label:this.receiverNameFieldLabel},{key:"receiver.mobile",value:this.receiverMobile,label:this.receiverMobileFieldLabel},...this.isPhysical()?[{key:"receiver.country",value:this.selectedCountryId,label:this.receiverCountryFieldLabel},...this.isKSA?[{key:"receiver.region",value:this.selectedRegionId,label:this.receiverRegionFieldLabel}]:[],{key:"receiver.city_id",value:this.receiverCity,label:this.receiverCityFieldLabel}]:[]],e={};if(i.forEach((({key:t,value:i,label:s})=>{i||(e[t]=salla.lang.get("common.errors.field_required",{attribute:s}))})),Object.keys(e).length)return this.errors=e,void this.setWrapperHeight(2,150,0);const s="custom"===this.selectedGiftTextOption,r={text:s?this.selectedText:void 0,text_id:!s&&this.selectedGiftTextOption?Number(this.selectedGiftTextOption):void 0,sender_name:this.senderName,quantity:this.quantity,deliver_at:this.showCalendar?this.deliveryDate:null,image_url:this.uploadedImage??this.selectedImage,donation_amount:t||null,receiver:{name:this.receiverName,mobile_country_code:this.receiverCountryCode,mobile:this.receiverMobile,...this.isPhysical()&&this.selectedCountryCode?{country_code:this.selectedCountryCode}:{},...this.isPhysical()&&this.selectedRegionId?{region_id:this.selectedRegionId}:{},...this.receiverCity&&this.isPhysical()?{city_id:this.receiverCity}:{}},has_apple_pay:salla.helpers.hasApplePay()};let a;this.productId&&this.formSelector&&(a=this.getFormDataFromForm()||new FormData,a=this.mergeObjectToFormData(r,a));const o=this.productId?()=>salla.product.addProductGiftToCart(this.productId,a,!0):()=>salla.cart.addCartGiftToCart(r,!0);return await o().then((()=>this.modal.close())).catch((t=>{t.response&&422==t.response.status?this.errors=t.response.data.error.fields:console.log(t),this.setWrapperHeight(2,150,0)}))}step2ItemClass(t=""){const i="anime-item"+(this.step2Animated?"":" opacity-0");return t?`${t} ${i}`:i}generateClass(){return{"s-gifting-widget":!0,"s-gifting-widget-vertical":!!this.vertical,"s-gifting-widget-horizontal":!this.vertical}}async handleGiftButtonClick(){if(this.productId&&this.formSelector){const t=document.querySelector(this.formSelector);if(!t)return void console.error("SallaGifting:: Form not found in the document!");if(!(t instanceof HTMLFormElement))return void console.error("SallaGifting:: The specified selector does not correspond to a form tag!");if(!t.reportValidity())return console.error("SallaGifting:: Form is not valid!"),void salla.error(salla.lang.get("common.messages.required_fields"))}const t=document.querySelector(`salla-product-options[product-id="${this.productId}"]`);!t||await t.reportValidity()?this.open():salla.error(salla.lang.get("common.messages.required_fields"))}render(){return[i("div",{key:"b4d479166a0a7a8b7bf4d66fd39399eef0bbe1d8"},i("salla-list-tile",{key:"a526748e500753bc4e132b6d8cc5fe56d276378c",class:this.generateClass()},i("div",{key:"3756943a7292552172dfe5fe112a987f9dff2128",slot:"title"},this.vertical?i("span",{innerHTML:a}):"",i("h3",{key:"769df65a33828cdb51270438885bd7554a93b18b"},this.widgetTitle?this.widgetTitle:this.sectionTitle)),i("div",{key:"69c51851715c12002d0d70f936852bf6b6a064a4",slot:"subtitle"},i("div",{key:"ee7979030a5756a4ad74c87cebdb595decc12d48"},this.widgetSubtitle?this.widgetSubtitle:this.sectionSubtitle)),i("div",{key:"374d33078ca9e9f4d26bc801abcb50d8271887bf",slot:"action"},i("salla-button",{key:"f5c53ce21a6e058e484f941d356e1c74bf337b5f",color:"primary",fill:"outline",width:"wide",class:"s-gifting-widget-action",onClick:()=>this.handleGiftButtonClick()},i("slot",{key:"2b57632750b91dc720605c181e19a0329c8db3e9",name:"widget-btn-content"},i("div",{key:"1d43f1351bc3323118c8eace681f382b753d009b",class:"s-gifting-widget-action-content"},i("span",{key:"f62808df38d07bf5db9d54f24a64c103dbcca3c2",innerHTML:a}),"  ",i("span",{key:"d22429956200e68c8d588d0daddae201963ba47a"},this.sectionBtnText)))))),i("salla-modal",{key:"0e1614ad210647ac77bbeb7e19104f5b9ce3b6b3",id:this.hostId,isLoading:!0,class:"s-gifting-modal",width:"sm",ref:t=>this.modal=t},i("div",{key:"230c00dd750aa31d20e450086b26c11094305e0f",slot:"loading"},i("div",{key:"cb48aec5cf71db50ba003cb3607c27e7a629e9be",class:"s-gifting-skeleton"},i("div",{key:"e7aa596896cb841628bf35b4b5d8c9d22ed84dae",class:"s-gifting-modal-header"},i("salla-skeleton",{key:"8e6dff5462dc1644bd89e56d51b3a353341b1741",type:"circle",height:"5rem",width:"5rem"}),i("h2",{key:"5bdf4f1266938b319a5d4642773cb0e8fa772f88",class:"s-gifting-modal-title"},i("div",{key:"2e3ea0e2589152059ec71f0e0a0b6537b0d32d8f",class:"s-gifting-modal-badge-wrapper"},i("salla-skeleton",{key:"7cf08110d0535ec7b719251cf54f3a83d940772f",height:"15px",width:"150px"})))),i("div",{key:"3e341993dd31be4bfbcc272877c8167f50233dd0",class:"s-gifting-skeleton-content"},i("salla-skeleton",{key:"74b584687ed715146e84a7107fb69f18ea78f31d",height:"10px",width:"150px"}),i("salla-skeleton",{key:"8acfdd240b397ea8e0d6c93c745786c68eb34f25",height:"230px"}),i("salla-skeleton",{key:"c92cef763f9d2857429919434a56bbc9686d6a3a",height:"10px",width:"150px"}),i("salla-skeleton",{key:"22e6c56dbabf3f90fa608dcd42d11b463ae86a1c",height:"30px"}),i("salla-skeleton",{key:"8093fcbc09362879ac5afb38f1910bdddfd41390",height:"40px"})))),i("slot",{key:"10842023d5a5861fa1562784c77f718c8e257d80",name:"header"}),this.hasError?i("salla-placeholder",{alignment:"center"},i("span",{slot:"title"},this.errorMessage||salla.lang.get("common.errors.empty_results")),i("span",{slot:"description"}," ")):[i("div",{class:"s-gifting-modal-header"},i("span",{class:"s-gifting-modal-icon"},i("span",{innerHTML:a})),i("h2",{class:"s-gifting-modal-title"},i("div",{class:"s-gifting-modal-badge-wrapper"},!this.skipStep1()&&i("div",{class:"s-gifting-modal-badge"},i("span",null,i("span",null,this.currentStep),"/2")),i("span",null,this.giftDetails)))),i("div",{class:"s-gifting-steps-wrapper "+this.parentClass,ref:t=>this.stepsWrapper=t},!this.skipStep1()&&i("div",{class:"s-gifting-step-one gift-step-1",ref:t=>this.step1Elems=t},this.gift&&this.gift.show_images&&i("div",{class:"s-gifting-modal-uploader-title anime-item"},this.selectImageForYourGift),this.gift&&this.gift.show_images&&i("div",{class:"s-gifting-image-section"},i("div",{class:`s-gifting-modal-uploader anime-item ${this.disableClass}`,ref:t=>this.uploader=t},i("span",{class:"s-gifting-remove-preview pointer-events-auto",onClick:()=>this.removePreview(),innerHTML:r}),this.selectImageOrUpload&&this.gift&&i("salla-file-upload",{"instant-upload":!0,name:"image_url",url:salla.url.api(salla.product.api.getUrl("giftImage")),onUploaded:t=>this.handleUploadImage(t.detail),labelIdle:this.getFilepondPlaceholder(),onRemoved:()=>this.handleRemoveImage()})),i("div",{class:"anime-item"},!this.uploadedImage&&this.gift&&this.gift.gift_images&&this.gift.gift_images.length>0?i("salla-slider",{id:"gifting-slider",loop:!1,"controls-outer":!0,class:"s-gifting-slider",type:"carousel"},i("div",{slot:"items"},this.gift&&this.gift.gift_images?this.gift?.gift_images.map((t=>i("a",{class:"s-gifting-clickable s-gifting-image",onClick:()=>this.setPreview(t)},i("img",{src:t.url,alt:`${t.id}`})))):"")):"")),this.gift&&this.gift.show_texts?i("div",{class:"anime-item"},i("div",{class:"s-gifting-modal-uploader-title s-gifting-text-title"},this.giftText),i("div",{class:"s-form-group s-gifting-selectText",ref:t=>this.textSelect=t},i("select",{id:"gift-text-selection",name:"gift-text-selection",class:"s-form-control s-gifting-select",onChange:t=>this.toggleGiftText(t)},i("option",{"data-id":null,selected:!this.selectedGiftTextOption},this.selectGiftMessage),this.gift&&this.gift.gift_texts?this.gift?.gift_texts.map((t=>i("option",{"data-id":t.id,value:t.text,key:t.id,selected:String(this.selectedGiftTextOption)===String(t.id)},t.text))):"",this.gift&&this.gift.show_custom_text?i("option",{"data-id":"custom",selected:"custom"===this.selectedGiftTextOption},this.giftCustomText):null)),i("div",{class:this.showGiftText&&this.gift&&this.gift.show_custom_text?"s-form-group s-gifting-textarea shown":"s-form-group s-gifting-textarea hide",ref:t=>this.customTextArea=t},i("label",{htmlFor:"gift-custom-text",class:"s-form-label"},this.giftCustomText),i("div",{class:"mt-1"},i("textarea",{onInput:t=>this.handleTextAreaChange(t),rows:4,ref:t=>this.textArea=t,name:"gift-custom-text",id:"gift-custom-text",class:"s-form-control"})))):null,i("div",{class:"anime-item"},i("salla-button",{color:"primary",width:"wide",onClick:()=>this.goToStep2(!!this.gift?.show_texts)},i("span",null,this.nextStep)))),i("div",{class:"s-gifting-step-two gift-step-2",style:this.skipStep1()?{opacity:"1",transform:"translateX(0)",position:"relative"}:void 0,ref:t=>this.step2Elems=t},i("div",{class:this.step2ItemClass(this.errors?.sender_name?"s-form-group s-form-has-error":"s-form-group")},i("label",{htmlFor:"sender_name",class:"s-form-label"},this.senderNameLabel),i("input",{type:"text",class:"s-form-control",name:"sender_name",id:"sender_name",value:this.senderName,onInput:t=>this.handleSenderName(t),placeholder:""}),this.errors&&this.errors.sender_name?i("span",{class:"s-gifting-error"},this.errors.sender_name):""),i("div",{class:this.step2ItemClass(this.errors?.["receiver.name"]?"s-form-group s-form-has-error":"s-form-group")},i("label",{htmlFor:"receiver_name",class:"s-form-label"},this.receiverNameFieldLabel),i("input",{type:"text",class:"s-form-control",name:"receiver_name",id:"receiver_name",value:"",onInput:t=>this.handleReceiverName(t),placeholder:""}),this.errors&&this.errors["receiver.name"]?i("span",{class:"s-gifting-error"},this.errors["receiver.name"]):""),i("div",{class:this.step2ItemClass(this.errors?.["receiver.mobile"]?"s-form-group s-form-has-error":"s-form-group")},i("label",{class:"s-form-label"},this.receiverMobileFieldLabel),i("salla-tel-input",{class:"s-gifting-tel-input",phone:this.receiverMobile,countryCode:this.receiverCountryCode,onPhoneEntered:t=>this.handlePhoneInputChange(t)}),this.errors&&this.errors["receiver.mobile"]?i("span",{class:"s-gifting-error"},this.errors["receiver.mobile"]):""),this.isPhysical()&&i("div",{class:this.step2ItemClass(this.errors?.["receiver.country"]?"s-form-group s-form-has-error":"s-form-group")},i("label",{class:"s-form-label",htmlFor:`${this.hostId}-country`},this.receiverCountryFieldLabel),i("salla-searchable-dropdown",{placeholder:this.selectCountry,items:this.gift?.countries??[],selectedItem:this.selectedCountry,disabled:!this.gift?.countries?.length,required:!0,inputId:`${this.hostId}-country`,searchable:!1,keepParentScroll:!0,onItemSelected:t=>this.handleCountrySelected(t.detail),onDropdownClosed:()=>this.handleCountryDropdownClosed()}),this.errors&&this.errors["receiver.country"]?i("span",{class:"s-gifting-error"},this.errors["receiver.country"]):""),this.isPhysical()&&this.isKSA&&i("div",{class:this.step2ItemClass(this.errors?.["receiver.region"]?"s-form-group s-form-has-error":"s-form-group")},i("label",{class:"s-form-label",htmlFor:`${this.hostId}-region`},this.receiverRegionFieldLabel),i("salla-searchable-dropdown",{placeholder:this.selectRegion,items:this.regions??[],selectedItem:this.selectedRegion,loading:this.loadingRegions,disabled:this.loadingRegions||!this.regions?.length,required:!0,inputId:`${this.hostId}-region`,searchable:!1,keepParentScroll:!0,onItemSelected:t=>this.handleRegionSelected(t.detail),onDropdownClosed:()=>this.handleRegionDropdownClosed()}),this.errors&&this.errors["receiver.region"]?i("span",{class:"s-gifting-error"},this.errors["receiver.region"]):""),this.isPhysical()&&i("div",{class:this.step2ItemClass(this.errors?.["receiver.city_id"]?"s-form-group s-form-has-error":"s-form-group")},i("label",{class:"s-form-label",htmlFor:`${this.hostId}-city`},this.receiverCityFieldLabel),i("salla-searchable-dropdown",{placeholder:this.selectCity,items:this.displayedCities,selectedItem:this.selectedCity,loading:this.loadingCities,searching:this.searchingCities,disabled:this.loadingCities||this.isKSA&&!this.selectedRegionId,required:!0,inputId:`${this.hostId}-city`,searchQuery:this.citySearchQuery,clientSearch:!this.enableCityAjaxSearch,dropUp:!0,keepParentScroll:!0,onItemSelected:t=>this.handleCitySelected(t.detail),onSearchInput:t=>this.handleCitySearch(t.detail),onDropdownClosed:()=>this.handleCityDropdownClosed()}),this.errors&&this.errors["receiver.city_id"]?i("span",{class:"s-gifting-error"},this.errors["receiver.city_id"]):""),this.isPhysical()&&this.cityNoticeText()&&i("div",{class:this.step2ItemClass("s-gifting-info")},i("span",{innerHTML:'\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>alert</title>\n<path d="M16 13.333c-0.736 0-1.333 0.597-1.333 1.333v8c0 0.736 0.597 1.333 1.333 1.333s1.333-0.597 1.333-1.333v-8c0-0.736-0.597-1.333-1.333-1.333zM16 9.327c-0.736 0-1.333 0.604-1.333 1.34s0.597 1.333 1.333 1.333 1.333-0.597 1.333-1.333v-0.013c0-0.736-0.597-1.327-1.333-1.327zM27.313 4.687c-6.237-6.237-16.389-6.239-22.628 0-6.237 6.239-6.237 16.389 0 22.628 3.119 3.119 7.216 4.679 11.313 4.679s8.195-1.559 11.313-4.679c6.24-6.239 6.24-16.391 0.001-22.628zM25.428 25.428c-5.199 5.197-13.657 5.197-18.857 0-5.197-5.199-5.197-13.659 0-18.857 5.199-5.197 13.659-5.197 18.857 0 5.199 5.2 5.199 13.659 0 18.857z"></path>\n</svg>\n'}),i("span",null,this.cityNoticeText())),!this.isPhysical()&&i("div",{class:this.step2ItemClass()},i("label",{class:"s-gifting-schedule s-gifting-clickable",htmlFor:`schedule-${this.hostId}`},i("input",{type:"checkbox",name:"schedule",id:`schedule-${this.hostId}`,onChange:()=>this.toggleCalendar(),class:"s-checkbox"}),i("span",{class:"s-form-label"}," ",this.sendLater," "))),i("div",{class:this.getCalendarClasses(),ref:t=>this.calendarFormGroup=t},i("label",{class:"s-form-label"},this.selectSendDateAndTime),i("salla-datetime-picker",{value:this.deliveryDate,placeholder:this.selectSendDateAndTime,"enable-time":!0,"date-format":"Y-m-d h:i K",onPicked:t=>this.handleDateTimePicker(t)}),i("span",{class:"s-gifting-calendar-hint"},this.canNotEditOrderAfterSelectDate)),i("div",{class:this.step2ItemClass("s-gifting-step-two-footer")},!this.skipStep1()&&i("a",{href:"#!",innerHTML:s,onClick:t=>this.goToStep1(t)}),i("salla-button",{onClick:()=>this.submitForm(),color:"primary",width:"wide"},i("span",null,this.sendGift)))))],i("slot",{key:"ba5b5cc6e2b20d756ed5149757b23239455939f7",name:"footer"})))]}};o.CITY_AJAX_THRESHOLD=400,o.CITY_SEARCH_DEBOUNCE_MS=100,o.style='/*!twlt*/.s-gifting-steps-wrapper{transition:height 0.8s cubic-bezier(0.55, 0, 0.1, 1) 0s}.s-gifting-select{background-image:url("data:image/svg+xml;utf8,<svg version=\'1.1\' fill=\'gray\' xmlns=\'http://www.w3.org/2000/svg\' width=\'32\' height=\'32\' viewBox=\'0 0 32 32\'><title>keyboard_arrow_down</title><path d=\'M9.875 11.104l6.125 6.125 6.125-6.125 1.875 1.875-8 8-8-8z\'></path></svg>");background-size:24px;background-repeat:no-repeat;background-position:99%;appearance:none}[dir=rtl] .s-gifting-select{background-position:5px}.s-gifting-widget-vertical .s-list-tile-item [slot=title]{display:flex;align-items:center;gap:1.5rem}.s-gifting-widget-vertical .s-list-tile-item-content{width:100%}.s-gifting-modal .s-searchable-dropdown-trigger{border-color:#d1d5db}.s-gifting-modal .s-searchable-dropdown-trigger:hover:not(.s-searchable-dropdown-trigger--disabled){border-color:#d1d5db}.s-gifting-modal .s-searchable-dropdown-trigger--open,.s-gifting-modal .s-searchable-dropdown-trigger:focus{border-color:var(--color-primary, #00897b);box-shadow:0 0 0 1px var(--color-primary, #00897b)}.s-gifting-modal .s-searchable-dropdown-trigger-placeholder{color:#000}.s-gifting-modal .s-gifting-image-section{margin-bottom:1.5rem}.s-gifting-modal .s-gifting-slider{margin-bottom:0.5rem}.s-gifting-modal .s-gifting-image{display:block}.s-gifting-modal .s-gifting-image img{display:block;width:auto;height:100px;object-fit:contain}.s-gifting-modal .s-gifting-image-section+.anime-item .s-gifting-text-title{margin-top:1rem}.pointer-events-none{pointer-events:none}.pointer-events-auto{pointer-events:auto}.static{position:static}.fixed{position:fixed}.relative{position:relative}.mt-1{margin-top:0.25rem}.inline{display:inline}.hidden{display:none}.grow{flex-grow:1}.transform{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))}.resize{resize:both}.opacity-0{opacity:0}.outline{outline-style:solid}.transition{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-hidden{display:none}.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-hidden{display:none}.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-form-has-error .s-form-label{color:#ff443a}.s-form-has-error .s-form-control,.s-form-has-error .s-tel-input-control,.s-form-has-error .s-datetime-picker-input{border-color:#ff443a;color:#ff443a}.s-gifting-widget .s-list-tile-item-icon{display:none}.s-gifting-widget-vertical .s-list-tile-item-icon{display:block}.s-gifting-widget-vertical .s-list-tile-item-title svg{fill:var(--color-primary)}.s-gifting-widget-vertical .s-list-tile-item-subtitle{padding-right:3.5rem;font-size:0.75rem;line-height:1rem;--tw-text-opacity:1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.s-gifting-widget-vertical .s-list-tile-item{flex-wrap:wrap;padding:0px}@media (min-width: 1024px){.s-gifting-widget-vertical .s-list-tile-item-action{flex:1 1 0%}}.s-gifting-widget-vertical .widget-icon{--tw-translate-y:0.625rem;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;color:var(--color-primary)}.s-gifting-widget .s-button-text{display:flex}.s-gifting-widget .s-list-tile-item{flex-direction:column;justify-content:space-between;gap:1rem;border-radius:0.75rem;border-width:1px;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1));padding:1.25rem;text-align:center}@media (min-width: 768px){.s-gifting-widget .s-list-tile-item{text-align:left}}@media (min-width: 1024px){.s-gifting-widget .s-list-tile-item{flex-direction:row}}@media (min-width: 768px){.s-gifting-widget .s-list-tile-item:where([dir="rtl"],[dir="rtl"] *){text-align:right}}.s-gifting-widget-horizontal .s-gifting-widget-action button{padding-left:2rem;padding-right:2rem;font-weight:400}.s-gifting-info{display:flex;align-items:center;gap:0.5rem;border-radius:0.5rem;--tw-border-opacity:1;border-color:rgb(191 219 254 / var(--tw-border-opacity, 1));--tw-bg-opacity:1;background-color:rgb(219 234 254 / var(--tw-bg-opacity, 1));padding:1rem;font-size:0.875rem;line-height:1.25rem;--tw-text-opacity:1;color:rgb(29 78 216 / var(--tw-text-opacity, 1))}.s-gifting-info svg{height:1.25rem;width:1.25rem;fill:#1d4ed8}.s-gifting-error{font-size:0.75rem;line-height:1rem;--tw-text-opacity:1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.s-gifting-info span{font-size:0.75rem;line-height:1rem}.s-gifting-widget-action-content{display:flex;align-items:center}.s-gifting-widget-action-content svg{margin-left:0.5rem;margin-right:0.5rem}.s-gifting-modal-header{margin-bottom:1.25rem;display:flex;flex-direction:column;align-items:center;justify-content:center}.s-gifting-modal .s-modal-header{display:block}.s-gifting-modal .s-modal-body{position:relative !important;left:unset !important;bottom:unset !important;padding-bottom:2rem}@media (min-width: 640px){.s-gifting-modal .s-modal-body{padding-bottom:1.5rem}}.s-gifting-modal-icon{margin-bottom:1.25rem;display:flex;height:5rem;width:5rem;flex-direction:row;align-items:center;justify-content:center;border-radius:9999px;border-width:1px;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1));font-size:1.875rem;line-height:2.25rem}.s-gifting-modal-title{display:flex;width:100%;align-items:center;justify-content:space-between}.s-gifting-modal-title::before{display:block;height:1px;flex:1 1 auto;--tw-bg-opacity:1;background-color:rgb(229 231 235 / var(--tw-bg-opacity, 1));--tw-content:\'\';content:var(--tw-content)}.s-gifting-modal-title::after{display:block;height:1px;flex:1 1 auto;--tw-bg-opacity:1;background-color:rgb(229 231 235 / var(--tw-bg-opacity, 1));--tw-content:\'\';content:var(--tw-content)}.s-gifting-modal-badge-wrapper{display:flex;align-items:center;padding-left:0.75rem;padding-right:0.75rem}.s-gifting-modal-badge{margin-right:0.5rem;border-radius:0.5rem;--tw-bg-opacity:1;background-color:rgb(229 231 235 / var(--tw-bg-opacity, 1));padding-left:0.5rem;padding-right:0.5rem;padding-top:0.25rem;padding-bottom:0.25rem;font-size:0.875rem;line-height:1.25rem}.s-gifting-modal-badge:where([dir="rtl"],[dir="rtl"] *){margin-right:0px;margin-left:0.5rem}.s-gifting-modal-uploader.has-bg{position:relative}.s-gifting-modal-uploader.has-bg .s-gifting-remove-preview{pointer-events:auto;--tw-scale-x:1;--tw-scale-y:1;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));opacity:1}.s-gifting-modal-uploader-title{margin-bottom:0.5rem;font-size:0.875rem;line-height:1.25rem}.s-gifting-steps-wrapper{position:relative}.s-gifting-steps-wrapper .s-button-wrap{pointer-events:auto !important}.is-current-step-2 .gift-step-1,.is-current-step-1 .gift-step-2{pointer-events:none;z-index:-1}.s-gifting-step-one{padding-top:1.25rem}.s-gifting-step-two{position:absolute;top:0px;left:0px;margin-left:auto;margin-right:auto;display:flex;width:100%;--tw-translate-x:-105%;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));flex-direction:column;opacity:0}.s-gifting-step-one .swiper-wrapper{height:100px}.s-gifting-step-one .swiper-slide{width:auto !important}.s-gifting-step-one .filepond--list-scroller{overflow-y:hidden}.s-gifting-step-one .swiper-wrapper img{border-radius:0.375rem;object-fit:cover}.s-gifting-step-one .filepond--root{height:230px}.s-gifting-step-one .filepond--list{left:0px !important;height:100% !important}.s-gifting-step-one .filepond-bg{position:absolute;top:0px;z-index:10;height:100%;width:100%;border-radius:var(--s-radius, 0.25rem);--tw-bg-opacity:1;background-color:rgb(55 65 81 / var(--tw-bg-opacity, 1));background-size:cover}.s-gifting-step-one .s-slider-button-next{top:35% !important}.s-gifting-step-one .s-slider-button-next button{height:35px;width:35px;--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)}.s-gifting-step-one .s-slider-button-prev{top:35% !important}.s-gifting-step-one .s-slider-button-prev button{height:35px;width:35px;--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)}.s-gifting-tel-input .s-tel-input-control{--tw-border-opacity:1;border-color:rgb(209 213 219 / var(--tw-border-opacity, 1))}.s-gifting-tel-input .s-tel-input-error-msg{display:none}.s-gifting-step-two-footer{margin-top:1.25rem;display:flex;flex-direction:row;align-items:center;justify-content:center}.s-gifting-step-two-footer>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-right:calc(0.625rem * var(--tw-space-x-reverse));margin-left:calc(0.625rem * calc(1 - var(--tw-space-x-reverse)))}.s-gifting-step-two-footer:where([dir="rtl"],[dir="rtl"] *){flex-direction:row-reverse}.s-gifting-step-two-footer a{border-radius:0.375rem;border-width:1px;border-color:var(--color-primary);fill:var(--color-primary);padding-top:8px;padding-bottom:8px;padding-left:25px;padding-right:25px}.s-gifting-step-two-footer a svg{height:1.25rem;width:1.25rem}.s-gifting-step-two .s-form-group.s-form-has-error .s-tel-input-control{--tw-border-opacity:1 !important;border-color:rgb(255 68 58 / var(--tw-border-opacity, 1)) !important}.s-gifting-selectText{margin-bottom:20px !important}.s-gifting-schedule .s-form-label{margin-bottom:0px !important}.s-gifting-schedule{margin-bottom:0.5rem;display:flex;align-items:center;justify-content:flex-start}.s-gifting-schedule>: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-gifting-schedule:where([dir="rtl"],[dir="rtl"] *)>:not([hidden])~:not([hidden]){--tw-space-x-reverse:1}.s-gifting-clickable{cursor:pointer}.s-gifting-remove-preview{pointer-events:none;position:absolute;top:-7px;left:-7px;z-index:10;display:flex;height:1.25rem;width:1.25rem;--tw-scale-x:0;--tw-scale-y:0;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));cursor:pointer;align-items:center;justify-content:center;border-radius:9999px;--tw-bg-opacity:1;background-color:rgb(185 28 28 / var(--tw-bg-opacity, 1));text-align:center;font-size:1rem;line-height:1.5rem;--tw-text-opacity:1;color:rgb(255 255 255 / var(--tw-text-opacity, 1));opacity:0;transition-property:all;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:300ms}.s-gifting-remove-preview:where([dir="rtl"],[dir="rtl"] *){left:unset;right:-7px}.s-gifting-remove-preview svg{height:100%;width:15px;fill:#fff}.s-gifting-textarea{transition-property:all;transition-duration:200ms;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1)}.s-gifting-calendar-hint{font-size:0.75rem;line-height:1rem;--tw-text-opacity:1;color:rgb(220 38 38 / var(--tw-text-opacity, 1))}.s-gifting-calendar.shown{margin-top:0.75rem;height:75px;opacity:1}.s-gifting-textarea.shown{height:122px;opacity:1}.s-gifting-calendar.hide{pointer-events:none;visibility:hidden;margin:0px;height:0px;opacity:0}.s-gifting-textarea.hide{pointer-events:none;visibility:hidden;margin:0px;height:0px;opacity:0}.s-gifting-filepond-placeholder-icon svg{margin-top:12px;margin-bottom:12px;margin-left:auto;margin-right:auto;height:4rem;width:3rem;fill:#e5e7eb}.s-gifting-filepond-placeholder-text{margin-left:auto;margin-right:auto;width:65%;min-width:18rem;font-size:0.75rem !important;line-height:1rem !important;--tw-text-opacity:1;color:rgb(107 114 128 / var(--tw-text-opacity, 1));margin-top:0.75rem;margin-bottom:0.75rem;font-family:var(--font-main), -apple-system, BlinkMacSystemFont}.s-gifting-skeleton-content salla-skeleton:nth-child(1){margin-bottom:0.75rem}.s-gifting-skeleton-content salla-skeleton:nth-child(2){margin-bottom:1.25rem}.s-gifting-skeleton-content salla-skeleton:nth-child(3){margin-bottom:0.75rem}.s-gifting-skeleton-content salla-skeleton:nth-child(4){margin-bottom:1.25rem}.s-gifting-skeleton .s-gifting-modal-header salla-skeleton{margin-bottom:1.25rem}.s-gifting-skeleton .s-gifting-modal-title{margin-bottom:1.25rem}.s-gifting-image{margin-left:5px;margin-right:5px}';export{o as salla_gifting}
4
+ import{r as t,h as i}from"./p-DaGqpYdk.js";import{a as e}from"./p-CgtvEd63.js";import{a as s}from"./p-BedNk7k1.js";import{C as r}from"./p-BsLF_HK7.js";import{G as a}from"./p-DxkgAGoT.js";const o=class{constructor(i){t(this,i),this.defaultEvent="gifting:open",this.selectImageForYourGift=salla.lang.get("blocks.buy_as_gift.select_image_for_your_gift"),this.currentStep=1,this.showCalendar=!1,this.showGiftText=!1,this.currentLang="",this.parentClass="is-current-step-1",this.errors={},this.gift=void 0,this.selectedGiftTextOption=void 0,this.selectedCountryId=void 0,this.selectedCountryCode=void 0,this.loadingCities=!1,this.loadingRegions=!1,this.regions=[],this.selectedRegionId=void 0,this.isKSA=!1,this.selectedCountry=null,this.selectedRegion=null,this.displayedCities=[],this.selectedCity=null,this.searchingCities=!1,this.enableCityAjaxSearch=!1,this.citySearchQuery="",this.step2Animated=!1,this.citySearchTimer=null,this.citySearchCounter=0,this.locationRequestCounter=0,this.showTextArea=!1,this.selectedImage=void 0,this.uploadedImage=void 0,this.selectedText=void 0,this.hasError=!1,this.timeZone=null,this.receiverCountryCode=salla.config.get("store.scope.countries")?.[0]||salla.config.get("store.store_country")||"SA",this.hostId=`salla-gifting-${Math.random().toString(36).slice(2,10)}`,this.disableClass=this.gift?.show_image_upload?"":"pointer-events-none",this.formSelector="form.product-form, form.form--product-options",this.handleCitySearch=t=>{if(this.citySearchQuery=t,!this.enableCityAjaxSearch)return;this.citySearchTimer&&clearTimeout(this.citySearchTimer);const i=++this.citySearchCounter;this.citySearchTimer=setTimeout((async()=>{this.searchingCities=!0;try{const e=await this.fetchCities(t);i===this.citySearchCounter&&(this.displayedCities=e)}catch(t){i===this.citySearchCounter&&(this.displayedCities=[])}finally{i===this.citySearchCounter&&(this.searchingCities=!1)}}),o.CITY_SEARCH_DEBOUNCE_MS)},this.handleCitySelected=t=>{this.selectedCity=t,this.receiverCity=String(t.id),this.clearError("receiver.city_id")},this.handleCityDropdownClosed=()=>{this.citySearchQuery="",this.citySearchTimer&&(clearTimeout(this.citySearchTimer),this.citySearchTimer=null),++this.citySearchCounter,this.displayedCities=this.gift?.cities??[],this.searchingCities=!1},this.handleCountryDropdownClosed=()=>{},this.handleRegionDropdownClosed=()=>{},salla.lang.onLoaded((()=>{this.selectImageOrUpload=salla.lang.get("blocks.buy_as_gift.select_image_or_upload"),this.selectImageForYourGift=salla.lang.get("blocks.buy_as_gift.select_image_for_your_gift"),this.sectionTitle=salla.lang.get("blocks.buy_as_gift.gift_the_one_you_love"),this.sectionSubtitle=salla.lang.get("blocks.buy_as_gift.gift_the_one_you_love_message"),this.sectionBtnText=salla.lang.get("blocks.buy_as_gift.send_as_a_gift"),this.giftDetails=salla.lang.get("blocks.buy_as_gift.gift_details"),this.selectGiftMessage=salla.lang.get("blocks.buy_as_gift.select_gift_message"),this.giftText=salla.lang.get("blocks.buy_as_gift.gift_text"),this.giftCustomText=salla.lang.get("blocks.buy_as_gift.gift_custom_text"),this.textId=salla.lang.get("blocks.buy_as_gift.text_id"),this.incorrectGiftText=salla.lang.get("blocks.buy_as_gift.incorrect_gift_text"),this.nextStep=salla.lang.get("blocks.buy_as_gift.next_step"),this.senderNameLabel=salla.lang.get("blocks.buy_as_gift.sender_name"),this.receiverNameFieldLabel=salla.lang.get("blocks.buy_as_gift.receiver_name"),this.receiverMobileFieldLabel=salla.lang.get("blocks.buy_as_gift.receiver_mobile"),this.receiverCountryFieldLabel=salla.lang.get("blocks.buy_as_gift.receiver_country"),this.ksa=salla.lang.get("pages.checkout.ksa"),this.selectCity=salla.lang.get("pages.checkout.select_city"),this.selectCountry=salla.lang.get("pages.checkout.select_country"),this.selectCityInfo=salla.lang.get("blocks.buy_as_gift.city_info"),this.cityChangeNotice=salla.lang.get("blocks.buy_as_gift.city_change_notice"),this.receiverCityFieldLabel=salla.lang.get("blocks.buy_as_gift.receiver_city"),this.receiverRegionFieldLabel=salla.lang.get("blocks.buy_as_gift.receiver_region")||salla.lang.get("pages.checkout.region"),this.selectRegion=salla.lang.get("pages.checkout.select_region"),this.receiverEmailFieldLabel=salla.lang.get("blocks.buy_as_gift.receiver_email"),this.emailPlaceholder=salla.lang.get("common.elements.email_placeholder"),this.sendLater=salla.lang.get("blocks.buy_as_gift.send_later"),this.selectSendDateAndTime=salla.lang.get("blocks.buy_as_gift.select_send_date_and_time"),this.canNotEditOrderAfterSelectDate=salla.lang.get("blocks.buy_as_gift.can_not_edit_order_after_select_date"),this.sendGift=salla.lang.get("blocks.buy_as_gift.send_gift"),this.donationRequired=salla.lang.get("pages.products.donation_amount_required"),this.currentLang=salla.lang.locale})),salla.event.on(this.defaultEvent,(()=>{this.open()}))}isPhysical(){return this.physicalProducts||this.physical}cityNoticeText(){return this.gift?.recipient_can_change_address?this.gift?.allows_different_shipping_cost?null:this.cityChangeNotice:this.selectCityInfo}componentDidLoad(){salla.event.product.onPriceUpdated((()=>{const t=document.querySelector(".s-quantity-input-input");this.quantity=t?.value}))}getFormDataFromForm(){if(!this.formSelector)return null;const t=document.querySelector(this.formSelector);return t?new FormData(t):null}mergeObjectToFormData(t,i,e){for(let s in t){if(!t.hasOwnProperty(s)||null==t[s])continue;const r=e?`${e}[${s}]`:s;"object"!=typeof t[s]||null===t[s]||t[s]instanceof File?i.set(r,t[s]):this.mergeObjectToFormData(t[s],i,r)}return i}async open(){if(salla.config.isGuest())return salla.api.auth.setAfterLoginEvent(this.defaultEvent),void salla.event.dispatch("login::open",{withoutReload:!0});this.resetStepsAnimation(),this.currentStep=1,this.parentClass="is-current-step-1",this.step2Animated=!1,this.stepsWrapper?.style.removeProperty("height"),await this.modal.open();const t=this.productId?()=>salla.product.getGiftProductDetails(this.productId):()=>salla.cart.getGiftCartDetails();return await salla.api.withoutNotifier(t).then((t=>{this.gift=t.data,this.senderName=this.gift.sender_name,this.disableClass=this.gift?.show_image_upload?"":"pointer-events-none",this.gift.show_texts||(this.selectedGiftTextOption=void 0,this.selectedText=void 0),this.gift.show_images||(this.selectedImage=void 0,this.uploadedImage=void 0),this.skipStep1()&&(this.currentStep=2,this.parentClass="is-current-step-2",this.step2Animated=!0)})).catch((t=>{this.hasError=!0,this.errorMessage=t.response?.data?.error?.message||t.response?.data})).finally((()=>this.modal.stopLoading()))}skipStep1(){return!!this.gift&&!this.gift.show_images&&!this.gift.show_texts}resetStepsAnimation(){[this.step1Elems,this.step2Elems].forEach((t=>{t?.querySelectorAll(".anime-item").forEach((t=>t.removeAttribute("style")))})),this.step1Elems?.removeAttribute("style"),this.step2Elems&&!this.skipStep1()&&(this.step2Elems.style.removeProperty("opacity"),this.step2Elems.style.removeProperty("transform"))}async close(){return this.modal.close()}async setWrapperHeight(t=1,i=250,e=0,s=0){let r=document.querySelector(`#${this.hostId} .gift-step-${t}`);const a=()=>{this.stepsWrapper.style.height=s?`${s}px`:r.offsetHeight+e+"px"};this.step2Animated&&2===t?requestAnimationFrame(a):setTimeout(a,i)}toggleCalendar(){this.showCalendar=!this.showCalendar,this.setWrapperHeight(2,150,0)}toggleGiftText(t){this.textSelect?.classList.remove("s-form-has-error");let i=t.target.children[t.target.selectedIndex].getAttribute("data-id"),e="custom"==i;const s=this.showGiftText!==e;this.showGiftText=e,i?(this.selectedGiftTextOption=i,this.selectedText=e?void 0:t.target.value):(this.textArea.value="",this.selectedText=void 0,this.selectedGiftTextOption=void 0),s&&this.setWrapperHeight(1,150,5)}async goToStep2(t=!0){this.step1Elems&&(t&&!this.validateStep1()||(this.stepsWrapper&&this.step1Elems&&(this.stepsWrapper.style.height=`${this.step1Elems.offsetHeight}px`),this.setWrapperHeight(2,50,0),(new e.timeline).add({targets:this.step1Elems.querySelectorAll(`#${this.hostId} .anime-item`),opacity:[1,0],translateX:[0,50],delay:e.stagger(70),duration:1200}).add({targets:".gift-step-2",translateX:["-110%",0],opacity:[0,1]},"-=1800").add({targets:this.step2Elems.querySelectorAll(`#${this.hostId} .anime-item`),opacity:[0,1],translateX:[-50,0],delay:e.stagger(70),duration:1200,complete:()=>{this.step2Elems.querySelectorAll(`#${this.hostId} .anime-item`).forEach((t=>{t.classList.remove("opacity-0"),t.removeAttribute("style")})),this.step2Animated=!0}},"-=1200"),this.currentStep=2,this.parentClass=`is-current-step-${this.currentStep}`))}validateStep1(){return!(this.gift?.show_texts&&(this.selectedGiftTextOption?"custom"!=this.selectedGiftTextOption||this.selectedText?(this.textSelect?.classList.remove("s-form-has-error"),this.customTextArea?.classList.remove("s-form-has-error"),0):(this.textSelect?.classList.remove("s-form-has-error"),this.customTextArea?.classList.add("s-form-has-error"),1):(this.textSelect?.classList.add("s-form-has-error"),this.customTextArea?.classList.remove("s-form-has-error"),1)))}goToStep1(t){t.preventDefault();let i=new e.timeline({autoplay:!1});i.add({targets:this.step2Elems.querySelectorAll(`#${this.hostId} .anime-item`),opacity:[1,0],translateX:[0,-50],delay:e.stagger(70),duration:1200}).add({targets:".gift-step-1",translateX:["110%",0],opacity:[0,1]},"-=1800").add({targets:this.step1Elems.querySelectorAll(`#${this.hostId} .anime-item`),opacity:[0,1],translateX:[50,0],delay:e.stagger(70),duration:1200,complete:()=>{this.step1Elems.querySelectorAll(`#${this.hostId} .anime-item`).forEach((t=>{t.classList.remove("opacity-0"),t.removeAttribute("style")}))}},"-=1200"),i.play(),this.step2Animated=!1,this.setWrapperHeight(1,600,0),this.currentStep=1,this.parentClass=`is-current-step-${this.currentStep}`}getFilepondPlaceholder(){return`<div class="s-gifting-filepond-placeholder"><span class="s-gifting-filepond-placeholder-icon"><svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>images</title>\n<path d="M22.667 29.333h-13.333c-3.676 0-6.667-2.991-6.667-6.667v-13.333c0-0.737-0.597-1.333-1.333-1.333s-1.333 0.596-1.333 1.333v13.333c0 5.145 4.187 9.333 9.333 9.333h13.333c0.736 0 1.333-0.596 1.333-1.333s-0.597-1.333-1.333-1.333zM22.667 5.333c-2.205 0-4 1.795-4 4s1.795 4 4 4 4-1.795 4-4-1.795-4-4-4zM22.667 10.667c-0.735 0-1.333-0.597-1.333-1.333s0.599-1.333 1.333-1.333 1.333 0.597 1.333 1.333-0.599 1.333-1.333 1.333zM25.333 0h-13.333c-3.676 0-6.667 2.991-6.667 6.667v13.333c0 1.055 0.268 2.040 0.707 2.927 0.039 0.099 0.088 0.188 0.151 0.277 1.137 2.053 3.301 3.463 5.809 3.463h13.333c3.676 0 6.667-2.991 6.667-6.667v-13.333c0-3.676-2.991-6.667-6.667-6.667zM12 24c-1.244 0-2.344-0.583-3.077-1.476l5.721-7.047 6.629 8.523zM29.333 20c0 2.205-1.795 4-4 4h-0.68l-8.933-11.485c-0.251-0.32-0.633-0.511-1.039-0.515h-0.015c-0.401 0-0.781 0.181-1.035 0.492l-5.632 6.935v-12.76c0-2.205 1.795-4 4-4h13.333c2.205 0 4 1.795 4 4z"></path>\n</svg>\n</span><p class="s-gifting-filepond-placeholder-text">${this.selectImageOrUpload&&this.gift.show_image_upload?this.selectImageOrUpload:this.selectImageForYourGift}</p></div>`}setPreview(t){this.uploader?.classList.add("has-bg");var i=document.querySelector(`#${this.hostId}.filepond-bg`)?document.querySelector(`#${this.hostId} .filepond-bg`):document.createElement("div");i.classList.add("filepond-bg"),i.classList.remove("s-hidden"),i.style.backgroundImage="url('"+t.url+"')",this.uploader?.querySelector(".filepond--root")?.appendChild(i),this.uploadedImage=t.url,this.gift&&this.gift.gift_images?.length&&this.setWrapperHeight(1,150,0)}removePreview(){this.uploader.classList.remove("has-bg");let t=document.querySelector(`#${this.hostId} .filepond-bg`);t.removeAttribute("style"),t.classList.add("s-hidden"),this.handleRemoveImage()}handleTextAreaChange(t){this.selectedText=t.target.value,this.customTextArea?.classList.remove("s-form-has-error")}clearError(t){if(this.errors?.[t]){const{[t]:i,...e}=this.errors;this.errors=e}}handleSenderName(t){this.senderName=t.target.value,this.clearError("sender_name")}handleReceiverName(t){this.receiverName=t.target.value,this.clearError("receiver.name")}resetCityState(){this.citySearchTimer&&(clearTimeout(this.citySearchTimer),this.citySearchTimer=null),++this.citySearchCounter,this.gift={...this.gift,cities:[]},this.displayedCities=[],this.receiverCity=void 0,this.selectedCity=null,this.citySearchQuery="",this.searchingCities=!1,this.enableCityAjaxSearch=!1}setInitialCities(t){this.gift={...this.gift,cities:t},this.displayedCities=t,this.enableCityAjaxSearch=t.length>=o.CITY_AJAX_THRESHOLD}async fetchCities(t=""){if(!this.selectedCountryId)return[];if(this.isKSA&&!this.selectedRegionId)return[];const i=["for_branch=0",`country_id=${this.selectedCountryId}`];this.isKSA&&this.selectedRegionId&&i.push(`region_id=${this.selectedRegionId}`),t?.trim()&&i.push(`query=${encodeURIComponent(t.trim())}`);const e=await salla.api.request(`shipping/cities?${i.join("&")}`);return e?.data??[]}async handleCountrySelected(t){const i=t?.id;this.selectedCountry=t??null,this.selectedCountryId=i,this.selectedCountryCode=t?.country_code,this.isKSA="SA"===t?.country_code,this.clearError("receiver.country"),this.regions=[],this.selectedRegionId=void 0,this.selectedRegion=null,this.resetCityState();const e=++this.locationRequestCounter;if(!i)return this.selectedCountryCode=void 0,this.isKSA=!1,void this.setWrapperHeight(2,0,0);if(this.isKSA){this.loadingRegions=!0,this.setWrapperHeight(2,0,0);try{const t=await salla.api.request(`shipping/countries/${i}/regions`);if(e!==this.locationRequestCounter)return;t&&t.data&&(this.regions=t.data)}catch(t){if(e!==this.locationRequestCounter)return;console.error("Error fetching regions:",t)}finally{e===this.locationRequestCounter&&(this.loadingRegions=!1,this.setWrapperHeight(2,0,0))}}else{this.loadingCities=!0,this.setWrapperHeight(2,0,0);try{const t=await this.fetchCities();if(e!==this.locationRequestCounter)return;this.setInitialCities(t)}catch(t){if(e!==this.locationRequestCounter)return;console.error("Error fetching cities:",t)}finally{e===this.locationRequestCounter&&(this.loadingCities=!1)}}}async handleRegionSelected(t){const i=t?.id;this.selectedRegion=t??null,this.selectedRegionId=i,this.clearError("receiver.region"),this.resetCityState();const e=++this.locationRequestCounter;if(i){this.loadingCities=!0;try{const t=await this.fetchCities();if(e!==this.locationRequestCounter)return;this.setInitialCities(t)}catch(t){if(e!==this.locationRequestCounter)return;console.error("Error fetching cities:",t)}finally{e===this.locationRequestCounter&&(this.loadingCities=!1,this.setWrapperHeight(2,0,0))}}}handleUploadImage(t){this.uploadedImage=t,this.gift&&this.gift.gift_images?.length&&this.setWrapperHeight(1,150,0)}handleRemoveImage(){this.uploadedImage="",this.gift&&this.gift.gift_images?.length&&this.setWrapperHeight(1,150,0)}handlePhoneInputChange(t){let i=t.detail;this.receiverMobile=i.number,this.receiverCountryCode=i.country_code,this.clearError("receiver.mobile")}handleDateTimePicker(t){this.deliveryDate=t.detail}getCalendarClasses(){return{"s-form-group":!0,"anime-item":!0,"s-gifting-calendar":!0,shown:this.showCalendar,hide:!this.showCalendar,"s-form-has-error":!!this.errors&&this.errors.deliver_at}}async submitForm(){const t=document.querySelector("#donating-amount")?.value;if(this.calendarFormGroup.classList.remove("s-form-has-error"),this.errors&&(this.errors={},this.setWrapperHeight(2,150,0)),this.showCalendar&&!this.deliveryDate)return void this.calendarFormGroup.classList.add("s-form-has-error");const i=[{key:"sender_name",value:this.senderName,label:this.senderNameLabel},{key:"receiver.name",value:this.receiverName,label:this.receiverNameFieldLabel},{key:"receiver.mobile",value:this.receiverMobile,label:this.receiverMobileFieldLabel},...this.isPhysical()?[{key:"receiver.country",value:this.selectedCountryId,label:this.receiverCountryFieldLabel},...this.isKSA?[{key:"receiver.region",value:this.selectedRegionId,label:this.receiverRegionFieldLabel}]:[],{key:"receiver.city_id",value:this.receiverCity,label:this.receiverCityFieldLabel}]:[]],e={};if(i.forEach((({key:t,value:i,label:s})=>{i||(e[t]=salla.lang.get("common.errors.field_required",{attribute:s}))})),Object.keys(e).length)return this.errors=e,void this.setWrapperHeight(2,150,0);const s="custom"===this.selectedGiftTextOption,r={text:s?this.selectedText:void 0,text_id:!s&&this.selectedGiftTextOption?Number(this.selectedGiftTextOption):void 0,sender_name:this.senderName,quantity:this.quantity,deliver_at:this.showCalendar?this.deliveryDate:null,image_url:this.uploadedImage??this.selectedImage,donation_amount:t||null,receiver:{name:this.receiverName,mobile_country_code:this.receiverCountryCode,mobile:this.receiverMobile,...this.isPhysical()&&this.selectedCountryCode?{country_code:this.selectedCountryCode}:{},...this.isPhysical()&&this.selectedRegionId?{region_id:this.selectedRegionId}:{},...this.receiverCity&&this.isPhysical()?{city_id:this.receiverCity}:{}},has_apple_pay:salla.helpers.hasApplePay()};let a;this.productId&&this.formSelector&&(a=this.getFormDataFromForm()||new FormData,a=this.mergeObjectToFormData(r,a));const o=this.productId?()=>salla.product.addProductGiftToCart(this.productId,a,!0):()=>salla.cart.addCartGiftToCart(r,!0);return await o().then((()=>this.modal.close())).catch((t=>{t.response&&422==t.response.status?this.errors=t.response.data.error.fields:console.log(t),this.setWrapperHeight(2,150,0)}))}step2ItemClass(t=""){const i="anime-item"+(this.step2Animated?"":" opacity-0");return t?`${t} ${i}`:i}generateClass(){return{"s-gifting-widget":!0,"s-gifting-widget-vertical":!!this.vertical,"s-gifting-widget-horizontal":!this.vertical}}async handleGiftButtonClick(){if(this.productId&&this.formSelector){const t=document.querySelector(this.formSelector);if(!t)return void console.error("SallaGifting:: Form not found in the document!");if(!(t instanceof HTMLFormElement))return void console.error("SallaGifting:: The specified selector does not correspond to a form tag!");if(!t.reportValidity())return console.error("SallaGifting:: Form is not valid!"),void salla.error(salla.lang.get("common.messages.required_fields"))}const t=document.querySelector(`salla-product-options[product-id="${this.productId}"]`);!t||await t.reportValidity()?this.open():salla.error(salla.lang.get("common.messages.required_fields"))}render(){return[i("div",{key:"b4d479166a0a7a8b7bf4d66fd39399eef0bbe1d8"},i("salla-list-tile",{key:"a526748e500753bc4e132b6d8cc5fe56d276378c",class:this.generateClass()},i("div",{key:"3756943a7292552172dfe5fe112a987f9dff2128",slot:"title"},this.vertical?i("span",{innerHTML:a}):"",i("h3",{key:"769df65a33828cdb51270438885bd7554a93b18b"},this.widgetTitle?this.widgetTitle:this.sectionTitle)),i("div",{key:"69c51851715c12002d0d70f936852bf6b6a064a4",slot:"subtitle"},i("div",{key:"ee7979030a5756a4ad74c87cebdb595decc12d48"},this.widgetSubtitle?this.widgetSubtitle:this.sectionSubtitle)),i("div",{key:"374d33078ca9e9f4d26bc801abcb50d8271887bf",slot:"action"},i("salla-button",{key:"f5c53ce21a6e058e484f941d356e1c74bf337b5f",color:"primary",fill:"outline",width:"wide",class:"s-gifting-widget-action",onClick:()=>this.handleGiftButtonClick()},i("slot",{key:"2b57632750b91dc720605c181e19a0329c8db3e9",name:"widget-btn-content"},i("div",{key:"1d43f1351bc3323118c8eace681f382b753d009b",class:"s-gifting-widget-action-content"},i("span",{key:"f62808df38d07bf5db9d54f24a64c103dbcca3c2",innerHTML:a}),"  ",i("span",{key:"d22429956200e68c8d588d0daddae201963ba47a"},this.sectionBtnText)))))),i("salla-modal",{key:"0e1614ad210647ac77bbeb7e19104f5b9ce3b6b3",id:this.hostId,isLoading:!0,class:"s-gifting-modal",width:"sm",ref:t=>this.modal=t},i("div",{key:"230c00dd750aa31d20e450086b26c11094305e0f",slot:"loading"},i("div",{key:"cb48aec5cf71db50ba003cb3607c27e7a629e9be",class:"s-gifting-skeleton"},i("div",{key:"e7aa596896cb841628bf35b4b5d8c9d22ed84dae",class:"s-gifting-modal-header"},i("salla-skeleton",{key:"8e6dff5462dc1644bd89e56d51b3a353341b1741",type:"circle",height:"5rem",width:"5rem"}),i("h2",{key:"5bdf4f1266938b319a5d4642773cb0e8fa772f88",class:"s-gifting-modal-title"},i("div",{key:"2e3ea0e2589152059ec71f0e0a0b6537b0d32d8f",class:"s-gifting-modal-badge-wrapper"},i("salla-skeleton",{key:"7cf08110d0535ec7b719251cf54f3a83d940772f",height:"15px",width:"150px"})))),i("div",{key:"3e341993dd31be4bfbcc272877c8167f50233dd0",class:"s-gifting-skeleton-content"},i("salla-skeleton",{key:"74b584687ed715146e84a7107fb69f18ea78f31d",height:"10px",width:"150px"}),i("salla-skeleton",{key:"8acfdd240b397ea8e0d6c93c745786c68eb34f25",height:"230px"}),i("salla-skeleton",{key:"c92cef763f9d2857429919434a56bbc9686d6a3a",height:"10px",width:"150px"}),i("salla-skeleton",{key:"22e6c56dbabf3f90fa608dcd42d11b463ae86a1c",height:"30px"}),i("salla-skeleton",{key:"8093fcbc09362879ac5afb38f1910bdddfd41390",height:"40px"})))),i("slot",{key:"10842023d5a5861fa1562784c77f718c8e257d80",name:"header"}),this.hasError?i("salla-placeholder",{alignment:"center"},i("span",{slot:"title"},this.errorMessage||salla.lang.get("common.errors.empty_results")),i("span",{slot:"description"}," ")):[i("div",{class:"s-gifting-modal-header"},i("span",{class:"s-gifting-modal-icon"},i("span",{innerHTML:a})),i("h2",{class:"s-gifting-modal-title"},i("div",{class:"s-gifting-modal-badge-wrapper"},!this.skipStep1()&&i("div",{class:"s-gifting-modal-badge"},i("span",null,i("span",null,this.currentStep),"/2")),i("span",null,this.giftDetails)))),i("div",{class:"s-gifting-steps-wrapper "+this.parentClass,ref:t=>this.stepsWrapper=t},!this.skipStep1()&&i("div",{class:"s-gifting-step-one gift-step-1",ref:t=>this.step1Elems=t},this.gift&&this.gift.show_images&&i("div",{class:"s-gifting-modal-uploader-title anime-item"},this.selectImageForYourGift),this.gift&&this.gift.show_images&&i("div",{class:"s-gifting-image-section"},i("div",{class:`s-gifting-modal-uploader anime-item ${this.disableClass}`,ref:t=>this.uploader=t},i("span",{class:"s-gifting-remove-preview pointer-events-auto",onClick:()=>this.removePreview(),innerHTML:r}),this.selectImageOrUpload&&this.gift&&i("salla-file-upload",{"instant-upload":!0,name:"image_url",url:salla.url.api(salla.product.api.getUrl("giftImage")),onUploaded:t=>this.handleUploadImage(t.detail),labelIdle:this.getFilepondPlaceholder(),onRemoved:()=>this.handleRemoveImage()})),i("div",{class:"anime-item"},!this.uploadedImage&&this.gift&&this.gift.gift_images&&this.gift.gift_images.length>0?i("salla-slider",{id:"gifting-slider",loop:!1,"controls-outer":!0,class:"s-gifting-slider",type:"carousel"},i("div",{slot:"items"},this.gift&&this.gift.gift_images?this.gift?.gift_images.map((t=>i("a",{class:"s-gifting-clickable s-gifting-image",onClick:()=>this.setPreview(t)},i("img",{src:t.url,alt:`${t.id}`})))):"")):"")),this.gift&&this.gift.show_texts?i("div",{class:"anime-item"},i("div",{class:"s-gifting-modal-uploader-title s-gifting-text-title"},this.giftText),i("div",{class:"s-form-group s-gifting-selectText",ref:t=>this.textSelect=t},i("select",{id:"gift-text-selection",name:"gift-text-selection",class:"s-form-control s-gifting-select",onChange:t=>this.toggleGiftText(t)},i("option",{"data-id":null,selected:!this.selectedGiftTextOption},this.selectGiftMessage),this.gift&&this.gift.gift_texts?this.gift?.gift_texts.map((t=>i("option",{"data-id":t.id,value:t.text,key:t.id,selected:String(this.selectedGiftTextOption)===String(t.id)},t.text))):"",this.gift&&this.gift.show_custom_text?i("option",{"data-id":"custom",selected:"custom"===this.selectedGiftTextOption},this.giftCustomText):null)),i("div",{class:this.showGiftText&&this.gift&&this.gift.show_custom_text?"s-form-group s-gifting-textarea shown":"s-form-group s-gifting-textarea hide",ref:t=>this.customTextArea=t},i("label",{htmlFor:"gift-custom-text",class:"s-form-label"},this.giftCustomText),i("div",{class:"mt-1"},i("textarea",{onInput:t=>this.handleTextAreaChange(t),rows:4,ref:t=>this.textArea=t,name:"gift-custom-text",id:"gift-custom-text",class:"s-form-control"})))):null,i("div",{class:"anime-item"},i("salla-button",{color:"primary",width:"wide",onClick:()=>this.goToStep2(!!this.gift?.show_texts)},i("span",null,this.nextStep)))),i("div",{class:"s-gifting-step-two gift-step-2",style:this.skipStep1()?{opacity:"1",transform:"translateX(0)",position:"relative"}:void 0,ref:t=>this.step2Elems=t},i("div",{class:this.step2ItemClass(this.errors?.sender_name?"s-form-group s-form-has-error":"s-form-group")},i("label",{htmlFor:"sender_name",class:"s-form-label"},this.senderNameLabel),i("input",{type:"text",class:"s-form-control",name:"sender_name",id:"sender_name",value:this.senderName,onInput:t=>this.handleSenderName(t),placeholder:""}),this.errors&&this.errors.sender_name?i("span",{class:"s-gifting-error"},this.errors.sender_name):""),i("div",{class:this.step2ItemClass(this.errors?.["receiver.name"]?"s-form-group s-form-has-error":"s-form-group")},i("label",{htmlFor:"receiver_name",class:"s-form-label"},this.receiverNameFieldLabel),i("input",{type:"text",class:"s-form-control",name:"receiver_name",id:"receiver_name",value:"",onInput:t=>this.handleReceiverName(t),placeholder:""}),this.errors&&this.errors["receiver.name"]?i("span",{class:"s-gifting-error"},this.errors["receiver.name"]):""),i("div",{class:this.step2ItemClass(this.errors?.["receiver.mobile"]?"s-form-group s-form-has-error":"s-form-group")},i("label",{class:"s-form-label"},this.receiverMobileFieldLabel),i("salla-tel-input",{class:"s-gifting-tel-input",phone:this.receiverMobile,countryCode:this.receiverCountryCode,onPhoneEntered:t=>this.handlePhoneInputChange(t)}),this.errors&&this.errors["receiver.mobile"]?i("span",{class:"s-gifting-error"},this.errors["receiver.mobile"]):""),this.isPhysical()&&i("div",{class:this.step2ItemClass(this.errors?.["receiver.country"]?"s-form-group s-form-has-error":"s-form-group")},i("label",{class:"s-form-label",htmlFor:`${this.hostId}-country`},this.receiverCountryFieldLabel),i("salla-searchable-dropdown",{placeholder:this.selectCountry,items:this.gift?.countries??[],selectedItem:this.selectedCountry,disabled:!this.gift?.countries?.length,required:!0,inputId:`${this.hostId}-country`,searchable:!1,keepParentScroll:!0,onItemSelected:t=>this.handleCountrySelected(t.detail),onDropdownClosed:()=>this.handleCountryDropdownClosed()}),this.errors&&this.errors["receiver.country"]?i("span",{class:"s-gifting-error"},this.errors["receiver.country"]):""),this.isPhysical()&&this.isKSA&&i("div",{class:this.step2ItemClass(this.errors?.["receiver.region"]?"s-form-group s-form-has-error":"s-form-group")},i("label",{class:"s-form-label",htmlFor:`${this.hostId}-region`},this.receiverRegionFieldLabel),i("salla-searchable-dropdown",{placeholder:this.selectRegion,items:this.regions??[],selectedItem:this.selectedRegion,loading:this.loadingRegions,disabled:this.loadingRegions||!this.regions?.length,required:!0,inputId:`${this.hostId}-region`,searchable:!1,keepParentScroll:!0,onItemSelected:t=>this.handleRegionSelected(t.detail),onDropdownClosed:()=>this.handleRegionDropdownClosed()}),this.errors&&this.errors["receiver.region"]?i("span",{class:"s-gifting-error"},this.errors["receiver.region"]):""),this.isPhysical()&&i("div",{class:this.step2ItemClass(this.errors?.["receiver.city_id"]?"s-form-group s-form-has-error":"s-form-group")},i("label",{class:"s-form-label",htmlFor:`${this.hostId}-city`},this.receiverCityFieldLabel),i("salla-searchable-dropdown",{placeholder:this.selectCity,items:this.displayedCities,selectedItem:this.selectedCity,loading:this.loadingCities,searching:this.searchingCities,disabled:this.loadingCities||this.isKSA&&!this.selectedRegionId,required:!0,inputId:`${this.hostId}-city`,searchQuery:this.citySearchQuery,clientSearch:!this.enableCityAjaxSearch,dropUp:!0,keepParentScroll:!0,onItemSelected:t=>this.handleCitySelected(t.detail),onSearchInput:t=>this.handleCitySearch(t.detail),onDropdownClosed:()=>this.handleCityDropdownClosed()}),this.errors&&this.errors["receiver.city_id"]?i("span",{class:"s-gifting-error"},this.errors["receiver.city_id"]):""),this.isPhysical()&&this.cityNoticeText()&&i("div",{class:this.step2ItemClass("s-gifting-info")},i("span",{innerHTML:'\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>alert</title>\n<path d="M16 13.333c-0.736 0-1.333 0.597-1.333 1.333v8c0 0.736 0.597 1.333 1.333 1.333s1.333-0.597 1.333-1.333v-8c0-0.736-0.597-1.333-1.333-1.333zM16 9.327c-0.736 0-1.333 0.604-1.333 1.34s0.597 1.333 1.333 1.333 1.333-0.597 1.333-1.333v-0.013c0-0.736-0.597-1.327-1.333-1.327zM27.313 4.687c-6.237-6.237-16.389-6.239-22.628 0-6.237 6.239-6.237 16.389 0 22.628 3.119 3.119 7.216 4.679 11.313 4.679s8.195-1.559 11.313-4.679c6.24-6.239 6.24-16.391 0.001-22.628zM25.428 25.428c-5.199 5.197-13.657 5.197-18.857 0-5.197-5.199-5.197-13.659 0-18.857 5.199-5.197 13.659-5.197 18.857 0 5.199 5.2 5.199 13.659 0 18.857z"></path>\n</svg>\n'}),i("span",null,this.cityNoticeText())),!this.isPhysical()&&i("div",{class:this.step2ItemClass()},i("label",{class:"s-gifting-schedule s-gifting-clickable",htmlFor:`schedule-${this.hostId}`},i("input",{type:"checkbox",name:"schedule",id:`schedule-${this.hostId}`,onChange:()=>this.toggleCalendar(),class:"s-checkbox"}),i("span",{class:"s-form-label"}," ",this.sendLater," "))),i("div",{class:this.getCalendarClasses(),ref:t=>this.calendarFormGroup=t},i("label",{class:"s-form-label"},this.selectSendDateAndTime),i("salla-datetime-picker",{value:this.deliveryDate,placeholder:this.selectSendDateAndTime,"enable-time":!0,"date-format":"Y-m-d h:i K",onPicked:t=>this.handleDateTimePicker(t)}),i("span",{class:"s-gifting-calendar-hint"},this.canNotEditOrderAfterSelectDate)),i("div",{class:this.step2ItemClass("s-gifting-step-two-footer")},!this.skipStep1()&&i("a",{href:"#!",innerHTML:s,onClick:t=>this.goToStep1(t)}),i("salla-button",{onClick:()=>this.submitForm(),color:"primary",width:"wide"},i("span",null,this.sendGift)))))],i("slot",{key:"ba5b5cc6e2b20d756ed5149757b23239455939f7",name:"footer"})))]}};o.CITY_AJAX_THRESHOLD=400,o.CITY_SEARCH_DEBOUNCE_MS=100,o.style='/*!twlt*/.s-gifting-steps-wrapper{transition:height 0.8s cubic-bezier(0.55, 0, 0.1, 1) 0s}.s-gifting-select{background-image:url("data:image/svg+xml;utf8,<svg version=\'1.1\' fill=\'gray\' xmlns=\'http://www.w3.org/2000/svg\' width=\'32\' height=\'32\' viewBox=\'0 0 32 32\'><title>keyboard_arrow_down</title><path d=\'M9.875 11.104l6.125 6.125 6.125-6.125 1.875 1.875-8 8-8-8z\'></path></svg>");background-size:24px;background-repeat:no-repeat;background-position:99%;appearance:none}[dir=rtl] .s-gifting-select{background-position:5px}.s-gifting-widget-vertical .s-list-tile-item [slot=title]{display:flex;align-items:center;gap:1.5rem}.s-gifting-widget-vertical .s-list-tile-item-content{width:100%}.s-gifting-modal .s-searchable-dropdown-trigger{border-color:#d1d5db}.s-gifting-modal .s-searchable-dropdown-trigger:hover:not(.s-searchable-dropdown-trigger--disabled){border-color:#d1d5db}.s-gifting-modal .s-searchable-dropdown-trigger--open,.s-gifting-modal .s-searchable-dropdown-trigger:focus{border-color:var(--color-primary, #00897b);box-shadow:0 0 0 1px var(--color-primary, #00897b)}.s-gifting-modal .s-searchable-dropdown-trigger-placeholder{color:#000}.s-gifting-modal .s-gifting-image-section{margin-bottom:1.5rem}.s-gifting-modal .s-gifting-slider{margin-bottom:0.5rem}.s-gifting-modal .s-gifting-image{display:block}.s-gifting-modal .s-gifting-image img{display:block;width:auto;height:100px;object-fit:contain}.s-gifting-modal .s-gifting-image-section+.anime-item .s-gifting-text-title{margin-top:1rem}.pointer-events-none{pointer-events:none}.pointer-events-auto{pointer-events:auto}.static{position:static}.fixed{position:fixed}.relative{position:relative}.mt-1{margin-top:0.25rem}.inline{display:inline}.hidden{display:none}.grow{flex-grow:1}.transform{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))}.resize{resize:both}.opacity-0{opacity:0}.outline{outline-style:solid}.transition{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-hidden{display:none}.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-hidden{display:none}.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-form-has-error .s-form-label{color:#ff443a}.s-form-has-error .s-form-control,.s-form-has-error .s-tel-input-control,.s-form-has-error .s-datetime-picker-input{border-color:#ff443a;color:#ff443a}.s-gifting-widget .s-list-tile-item-icon{display:none}.s-gifting-widget-vertical .s-list-tile-item-icon{display:block}.s-gifting-widget-vertical .s-list-tile-item-title svg{fill:var(--color-primary)}.s-gifting-widget-vertical .s-list-tile-item-subtitle{padding-right:3.5rem;font-size:0.75rem;line-height:1rem;--tw-text-opacity:1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.s-gifting-widget-vertical .s-list-tile-item{flex-wrap:wrap;padding:0px}@media (min-width: 1024px){.s-gifting-widget-vertical .s-list-tile-item-action{flex:1 1 0%}}.s-gifting-widget-vertical .widget-icon{--tw-translate-y:0.625rem;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;color:var(--color-primary)}.s-gifting-widget .s-button-text{display:flex}.s-gifting-widget .s-list-tile-item{flex-direction:column;justify-content:space-between;gap:1rem;border-radius:0.75rem;border-width:1px;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1));padding:1.25rem;text-align:center}@media (min-width: 768px){.s-gifting-widget .s-list-tile-item{text-align:left}}@media (min-width: 1024px){.s-gifting-widget .s-list-tile-item{flex-direction:row}}@media (min-width: 768px){.s-gifting-widget .s-list-tile-item:where([dir="rtl"],[dir="rtl"] *){text-align:right}}.s-gifting-widget-horizontal .s-gifting-widget-action button{padding-left:2rem;padding-right:2rem;font-weight:400}.s-gifting-info{display:flex;align-items:center;gap:0.5rem;border-radius:0.5rem;--tw-border-opacity:1;border-color:rgb(191 219 254 / var(--tw-border-opacity, 1));--tw-bg-opacity:1;background-color:rgb(219 234 254 / var(--tw-bg-opacity, 1));padding:1rem;font-size:0.875rem;line-height:1.25rem;--tw-text-opacity:1;color:rgb(29 78 216 / var(--tw-text-opacity, 1))}.s-gifting-info svg{height:1.25rem;width:1.25rem;fill:#1d4ed8}.s-gifting-error{font-size:0.75rem;line-height:1rem;--tw-text-opacity:1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.s-gifting-info span{font-size:0.75rem;line-height:1rem}.s-gifting-widget-action-content{display:flex;align-items:center}.s-gifting-widget-action-content svg{margin-left:0.5rem;margin-right:0.5rem}.s-gifting-modal-header{margin-bottom:1.25rem;display:flex;flex-direction:column;align-items:center;justify-content:center}.s-gifting-modal .s-modal-header{display:block}.s-gifting-modal .s-modal-body{position:relative !important;left:unset !important;bottom:unset !important;padding-bottom:2rem}@media (min-width: 640px){.s-gifting-modal .s-modal-body{padding-bottom:1.5rem}}.s-gifting-modal-icon{margin-bottom:1.25rem;display:flex;height:5rem;width:5rem;flex-direction:row;align-items:center;justify-content:center;border-radius:9999px;border-width:1px;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1));font-size:1.875rem;line-height:2.25rem}.s-gifting-modal-title{display:flex;width:100%;align-items:center;justify-content:space-between}.s-gifting-modal-title::before{display:block;height:1px;flex:1 1 auto;--tw-bg-opacity:1;background-color:rgb(229 231 235 / var(--tw-bg-opacity, 1));--tw-content:\'\';content:var(--tw-content)}.s-gifting-modal-title::after{display:block;height:1px;flex:1 1 auto;--tw-bg-opacity:1;background-color:rgb(229 231 235 / var(--tw-bg-opacity, 1));--tw-content:\'\';content:var(--tw-content)}.s-gifting-modal-badge-wrapper{display:flex;align-items:center;padding-left:0.75rem;padding-right:0.75rem}.s-gifting-modal-badge{margin-right:0.5rem;border-radius:0.5rem;--tw-bg-opacity:1;background-color:rgb(229 231 235 / var(--tw-bg-opacity, 1));padding-left:0.5rem;padding-right:0.5rem;padding-top:0.25rem;padding-bottom:0.25rem;font-size:0.875rem;line-height:1.25rem}.s-gifting-modal-badge:where([dir="rtl"],[dir="rtl"] *){margin-right:0px;margin-left:0.5rem}.s-gifting-modal-uploader.has-bg{position:relative}.s-gifting-modal-uploader.has-bg .s-gifting-remove-preview{pointer-events:auto;--tw-scale-x:1;--tw-scale-y:1;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));opacity:1}.s-gifting-modal-uploader-title{margin-bottom:0.5rem;font-size:0.875rem;line-height:1.25rem}.s-gifting-steps-wrapper{position:relative}.s-gifting-steps-wrapper .s-button-wrap{pointer-events:auto !important}.is-current-step-2 .gift-step-1,.is-current-step-1 .gift-step-2{pointer-events:none;z-index:-1}.s-gifting-step-one{padding-top:1.25rem}.s-gifting-step-two{position:absolute;top:0px;left:0px;margin-left:auto;margin-right:auto;display:flex;width:100%;--tw-translate-x:-105%;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));flex-direction:column;opacity:0}.s-gifting-step-one .swiper-wrapper{height:100px}.s-gifting-step-one .swiper-slide{width:auto !important}.s-gifting-step-one .filepond--list-scroller{overflow-y:hidden}.s-gifting-step-one .swiper-wrapper img{border-radius:0.375rem;object-fit:cover}.s-gifting-step-one .filepond--root{height:230px}.s-gifting-step-one .filepond--list{left:0px !important;height:100% !important}.s-gifting-step-one .filepond-bg{position:absolute;top:0px;z-index:10;height:100%;width:100%;border-radius:var(--s-radius, 0.25rem);--tw-bg-opacity:1;background-color:rgb(55 65 81 / var(--tw-bg-opacity, 1));background-size:cover}.s-gifting-step-one .s-slider-button-next{top:35% !important}.s-gifting-step-one .s-slider-button-next button{height:35px;width:35px;--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)}.s-gifting-step-one .s-slider-button-prev{top:35% !important}.s-gifting-step-one .s-slider-button-prev button{height:35px;width:35px;--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)}.s-gifting-tel-input .s-tel-input-control{--tw-border-opacity:1;border-color:rgb(209 213 219 / var(--tw-border-opacity, 1))}.s-gifting-tel-input .s-tel-input-error-msg{display:none}.s-gifting-step-two-footer{margin-top:1.25rem;display:flex;flex-direction:row;align-items:center;justify-content:center}.s-gifting-step-two-footer>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-right:calc(0.625rem * var(--tw-space-x-reverse));margin-left:calc(0.625rem * calc(1 - var(--tw-space-x-reverse)))}.s-gifting-step-two-footer:where([dir="rtl"],[dir="rtl"] *){flex-direction:row-reverse}.s-gifting-step-two-footer a{border-radius:0.375rem;border-width:1px;border-color:var(--color-primary);fill:var(--color-primary);padding-top:8px;padding-bottom:8px;padding-left:25px;padding-right:25px}.s-gifting-step-two-footer a svg{height:1.25rem;width:1.25rem}.s-gifting-step-two .s-form-group.s-form-has-error .s-tel-input-control{--tw-border-opacity:1 !important;border-color:rgb(255 68 58 / var(--tw-border-opacity, 1)) !important}.s-gifting-selectText{margin-bottom:20px !important}.s-gifting-schedule .s-form-label{margin-bottom:0px !important}.s-gifting-schedule{margin-bottom:0.5rem;display:flex;align-items:center;justify-content:flex-start}.s-gifting-schedule>: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-gifting-schedule:where([dir="rtl"],[dir="rtl"] *)>:not([hidden])~:not([hidden]){--tw-space-x-reverse:1}.s-gifting-clickable{cursor:pointer}.s-gifting-remove-preview{pointer-events:none;position:absolute;top:-7px;left:-7px;z-index:10;display:flex;height:1.25rem;width:1.25rem;--tw-scale-x:0;--tw-scale-y:0;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));cursor:pointer;align-items:center;justify-content:center;border-radius:9999px;--tw-bg-opacity:1;background-color:rgb(185 28 28 / var(--tw-bg-opacity, 1));text-align:center;font-size:1rem;line-height:1.5rem;--tw-text-opacity:1;color:rgb(255 255 255 / var(--tw-text-opacity, 1));opacity:0;transition-property:all;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:300ms}.s-gifting-remove-preview:where([dir="rtl"],[dir="rtl"] *){left:unset;right:-7px}.s-gifting-remove-preview svg{height:100%;width:15px;fill:#fff}.s-gifting-textarea{transition-property:all;transition-duration:200ms;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1)}.s-gifting-calendar-hint{font-size:0.75rem;line-height:1rem;--tw-text-opacity:1;color:rgb(220 38 38 / var(--tw-text-opacity, 1))}.s-gifting-calendar.shown{margin-top:0.75rem;height:75px;opacity:1}.s-gifting-textarea.shown{height:122px;opacity:1}.s-gifting-calendar.hide{pointer-events:none;visibility:hidden;margin:0px;height:0px;opacity:0}.s-gifting-textarea.hide{pointer-events:none;visibility:hidden;margin:0px;height:0px;opacity:0}.s-gifting-filepond-placeholder-icon svg{margin-top:12px;margin-bottom:12px;margin-left:auto;margin-right:auto;height:4rem;width:3rem;fill:#e5e7eb}.s-gifting-filepond-placeholder-text{margin-left:auto;margin-right:auto;width:65%;min-width:18rem;font-size:0.75rem !important;line-height:1rem !important;--tw-text-opacity:1;color:rgb(107 114 128 / var(--tw-text-opacity, 1));margin-top:0.75rem;margin-bottom:0.75rem;font-family:var(--font-main), -apple-system, BlinkMacSystemFont}.s-gifting-skeleton-content salla-skeleton:nth-child(1){margin-bottom:0.75rem}.s-gifting-skeleton-content salla-skeleton:nth-child(2){margin-bottom:1.25rem}.s-gifting-skeleton-content salla-skeleton:nth-child(3){margin-bottom:0.75rem}.s-gifting-skeleton-content salla-skeleton:nth-child(4){margin-bottom:1.25rem}.s-gifting-skeleton .s-gifting-modal-header salla-skeleton{margin-bottom:1.25rem}.s-gifting-skeleton .s-gifting-modal-title{margin-bottom:1.25rem}.s-gifting-image{margin-left:5px;margin-right:5px}';export{o as salla_gifting}
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r as t,c as s,h as i,H as e,a as n}from"./p-5UtJVEzd.js";import{A as o,a as l}from"./p-Vqpj4CWE.js";const d=class{constructor(i){t(this,i),this.optionsSaved=s(this,"optionsSaved"),this.productSelected=s(this,"productSelected"),this.product=null,this.sectionId=null,this.sectionIndex=0,this.productIndex=0,this.selectedOptions={},this.optionsResetTokens={},this.isLoading=!1,this.hasUnsavedChanges=!1,this.validationErrors=[],this.isProductAlreadySelected=!1}generateCacheKey(t,s,i){return`${t||"unknown"}-${s||0}-${i||"unknown"}`}handleProductChange(t){setTimeout((()=>{this.modal&&t&&this.modal.setTitle(t.name||"")}),100),this.validationErrors=[],this.hasUnsavedChanges=!1}async open(){this.modal?(this.isLoading=!0,this.product?.name&&this.modal.setTitle(this.product.name),this.modal.open(),setTimeout((async()=>{this.product?.id&&await this.initializeSelectedOptions(),this.product?.name&&this.modal.setTitle(this.product.name),this.modal.stopLoading(),this.isLoading=!1}),300)):requestAnimationFrame((()=>this.open()))}async close(){this.modal&&this.modal.close()}async refreshOptionsState(){this.selectedOptions={...this.selectedOptions}}componentDidLoad(){this.modalOpenListener=t=>{this.product=t.product,this.sectionId=t.sectionId||null,this.sectionIndex=t.sectionIndex||0,this.productIndex=t.productIndex||0,this.isProductAlreadySelected=!!t.isProductAlreadySelected,this.open()},salla.event.on("multiple-bundle-product-modal::open",this.modalOpenListener),this.clearOptionsListener=t=>{t&&t.productId&&this.clearProductOptions(t.productId,t.sectionId,t.productIndex)},salla.event.on("multiple-bundle-product-modal::clear-options",this.clearOptionsListener),this.optionChangeListener=t=>{const s=t.detail||t,{option:i,detail:e}=s,n=i||s.option_id&&this.product?.options?.find((t=>t.id===s.option_id||String(t.id)===String(s.option_id))),o=e||(s.id?s:null);this.product?.id&&n&&this.handleOptionChange(Number(this.product.id),n,o)},salla.event.on("product-options::change",this.optionChangeListener),this.checkboxChangeListener=t=>{const s=t.target;if(s&&"checkbox"===s.type&&s.name&&s.name.includes("bundle[")&&s.name.includes("][id]")){const t=s.name.match(/^bundle\[([^\]]+)\]\[([^\]]+)\]\[id\]$/);if(t&&!s.checked){if("true"===s.getAttribute("data-selection-locked"))return void(s.checked=!0);const[,i,e]=t,n=s.value,o=this.host.closest("form");this.cleanupProductDeselection({sectionId:i,productIndex:parseInt(e,10),productId:n,form:o,uncheckedInput:s})}}},document.addEventListener("change",this.checkboxChangeListener)}disconnectedCallback(){this.checkboxChangeListener&&document.removeEventListener("change",this.checkboxChangeListener),this.optionChangeListener&&salla.event.off("product-options::change",this.optionChangeListener),this.modalOpenListener&&salla.event.off("multiple-bundle-product-modal::open",this.modalOpenListener),this.clearOptionsListener&&salla.event.off("multiple-bundle-product-modal::clear-options",this.clearOptionsListener)}cleanupProductDeselection(t){const{sectionId:s,productIndex:i,productId:e,form:n,uncheckedInput:o}=t;if(this.clearProductOptions(e,s,i),n){const t=`bundle[${s}][${i}]`;Array.from(n.querySelectorAll(`input[name^="${t}"]`)).forEach((s=>{if(s===o)return;const i="hidden"===s.type,n=s.getAttribute("data-product-id")===String(e)&&s.name?.startsWith(t);(i||n)&&s.remove()})),requestAnimationFrame((()=>{const t=new window.Event("change",{bubbles:!0});n.dispatchEvent(t)}))}}generateFormInputName(t,s,i){return`bundle[${t}][${s}][options][${i}]`}async initializeSelectedOptions(){if(!this.product?.id)return;const t=this.product.id,s=this.generateCacheKey(this.sectionId,this.productIndex,t),i=document.querySelector(`salla-product-options[product-id="${t}"]`);if(i)try{const t=await i.getSelectedOptions();t&&t.length>0&&(this.selectedOptions={...this.selectedOptions,[s]:t})}catch(t){console.warn("Could not initialize selected options:",t)}}clearProductOptions(t,s,i){const e={...this.selectedOptions};if(null==s||null==i||Number.isNaN(i)){const s=`-${String(t)}`,i=[];Object.keys(e).forEach((t=>{t.endsWith(s)&&(delete e[t],i.push(t))})),i.forEach((t=>this.bumpOptionsResetToken(t)))}else{const n=this.generateCacheKey(s,i,t);delete e[n],this.bumpOptionsResetToken(n)}this.selectedOptions=e,this.validationErrors=[],this.hasUnsavedChanges=!1}bumpOptionsResetToken(t){t&&(this.optionsResetTokens={...this.optionsResetTokens,[t]:(this.optionsResetTokens[t]||0)+1})}async handleOptionChange(t,s,i){const e=this.generateCacheKey(this.sectionId,this.productIndex,t),n=document.querySelector(`salla-product-options[product-id="${t}"]`);let o=[];if(n)try{o=await n.getSelectedOptions()||[]}catch(t){console.warn("Could not get current selections from component:",t)}if(o.length>0)this.selectedOptions={...this.selectedOptions,[e]:o};else if(this.selectedOptions[e]&&this.selectedOptions[e].length>0){const t=[...this.selectedOptions[e]||[]],n=t.findIndex((t=>t.option_id===s.id));n>-1?i&&null!=i.id?t[n]={...i,option_id:s.id}:t.splice(n,1):i&&null!=i.id&&t.push({...i,option_id:s.id}),this.selectedOptions={...this.selectedOptions,[e]:t}}else i&&null!=i.id&&(this.selectedOptions={...this.selectedOptions,[e]:[{...i,option_id:s.id}]});this.hasUnsavedChanges=!0,this.validationErrors=[]}async validateOptions(){if(!this.product?.options)return!0;const t=[],s=this.product.id,i=this.generateCacheKey(this.sectionId,this.productIndex,s),e=document.querySelector(`salla-product-options[product-id="${s}"]`);let n=[];if(e)try{n=await e.getSelectedOptions()||[];const t=this.selectedOptions[i]||[];(t.length>n.length||0===n.length&&t.length>0)&&(n=t)}catch(t){n=this.selectedOptions[i]||[]}else n=this.selectedOptions[i]||[];return 0===n.length&&t.push(salla.lang.get("pages.products.no_options_selected")),this.product.options.forEach((s=>{s.required&&(n.some((t=>t.option_id==s.id))||t.push(salla.lang.get("pages.products.required_option_missing",{option:s.name})))})),this.validationErrors=t,0===t.length}async onSave(t){t.preventDefault();const s=this.product?.id;if(!s)return;const i=this.generateCacheKey(this.sectionId,this.productIndex,s);if(await new Promise((t=>setTimeout(t,100))),await this.validateOptions()){if(!this.isProductAlreadySelected&&null!=this.sectionId){const t=this.host.closest("salla-multiple-bundle-product-details");if(!await(t?.canSelectBundleProduct(this.sectionId,s)))return void salla.notify.error(salla.lang.getWithDefault("pages.products.bundle_selection_limit_reached","لا يمكنك اختيار المزيد من المنتجات في هذا القسم"))}this.isLoading=!0;try{const t=document.querySelector(`salla-product-options[product-id="${s}"]`);let e=await(t?.getSelectedOptions());if((!e||0===e.length)&&this.selectedOptions[i]?.length>0&&(e=this.selectedOptions[i]),!e||0===e.length)return void(this.isLoading=!1);this.selectedOptions={...this.selectedOptions,[i]:e};const n=this.host.closest("form");if(!n)return void(this.isLoading=!1);const o=`bundle[${this.sectionId}][${this.productIndex}]`;Array.from(n.querySelectorAll(`input[name^="${o}"][type="hidden"]`)).forEach((t=>t.remove())),Array.from(n.querySelectorAll(`[data-product-id="${s}"][name^="${o}"]`)).forEach((t=>t.remove()));const l=`bundle[${this.sectionId}][${this.productIndex}][id]`,d=document.getElementById(l);if(d)d.checked=!0;else{const t=document.createElement("input");t.type="hidden",t.name=`bundle[${this.sectionId}][${this.productIndex}][id]`,t.value=String(s),t.dataset.productId=String(s),n.appendChild(t)}e.forEach((t=>{const i=t.option_id,e=document.createElement("input");e.type="hidden",e.name=this.generateFormInputName(this.sectionId,this.productIndex??0,i),e.value=String(t.id),e.dataset.productId=String(s),n.appendChild(e)}));const a=new window.Event("change",{bubbles:!0});n.dispatchEvent(a),this.optionsSaved.emit({productId:Number(s),selectedOptions:e,sectionId:this.sectionId,productIndex:this.productIndex}),this.sectionId&&this.productSelected.emit({productId:Number(s),sectionId:this.sectionId,product:this.product,fromModal:!0}),salla.notify.success(salla.lang.get("pages.products.options_saved")),this.hasUnsavedChanges=!1,this.validationErrors=[],this.modal.close()}catch(t){salla.notify.error(salla.lang.get("pages.products.options_save_error"))}finally{this.isLoading=!1}}else salla.notify.error(this.validationErrors.join(", "))}getOptionsWithSelectedState(){if(!this.product?.options)return[];const t=this.generateCacheKey(this.sectionId,this.productIndex,this.product.id),s=this.selectedOptions[t]||[];return this.product.options.map((t=>({...t,details:t.details.map((t=>{const i=s.some((s=>s.id===t.id));return{...t,is_selected:i}}))})))}render(){const t=this.product?.id,s=this.getOptionsWithSelectedState(),n=this.generateCacheKey(this.sectionId,this.productIndex,t),o=this.optionsResetTokens[n]||0,l=this.isLoading||s.some((t=>t.details.some((t=>t.is_selected&&!0===t.is_out))));return i(e,{key:"610ae038d4f9db109e3f25830e82b39a2b07a010"},i("salla-modal",{key:"b06c130448cd1862d2e879a0285fd385395cc11b",isLoading:this.isLoading,ref:t=>this.modal=t,width:"md",centered:!1,id:`s-multiple-bundle-product-options-modal-options-${t}`,class:"s-multiple-bundle-product-options-modal-wrapper"},i("div",{key:"1f8b9ffa80a40f8240ede4b8996943f7eecf4098",slot:"loading"},i("salla-skeleton",{key:"26463b16022e1f66fd66f4e9cd8907521352bac1",height:"100%",width:"100%"})),this.product?.images&&this.product?.images.length>0&&i("salla-slider",{key:"bae60782cbe4ac7dc325fd666258198cd871a52e",id:`details-slider-${this.product?.id}`,type:"thumbs",loop:!1,"auto-height":!0,"listen-to-thumbnails-option":!0,showThumbsControls:!1,controlsOuter:!1,showControls:!1,class:"s-multiple-bundle-product-options-modal-slider",verticalThumbs:!0,thumbsConfig:{centeredSlides:!0,centeredSlidesBounds:!0,slidesPerView:Math.min(5,Math.max(1,this.product?.images.length)),watchOverflow:!0,watchSlidesProgress:!0,direction:"vertical",spaceBetween:10}},i("div",{key:"998afc3297e89df7e0a6b2514a6d5f4f75152492",slot:"items"},this.product?.images&&this.product?.images.map(((t,s)=>i("div",{key:s,class:"swiper-slide"},i("img",{src:t.url,alt:t.alt||`${this.product?.name} - Image ${s+1}`,loading:"lazy",onError:t=>{t.target.style.display="none"}}))))),this.product?.images&&this.product?.images.length>1&&i("div",{key:"935a3d01a417926e904507d0a64da43c84924068",slot:"thumbs"},this.product?.images&&this.product?.images.map(((t,s)=>i("div",{key:s,"data-caption":`${this.product?.name} - Image ${s+1}`},i("img",{src:t.url,loading:"eager",class:"s-multiple-bundle-product-options-modal-slider-thumb",title:`${this.product?.name} - ${s+1}`,alt:t.alt||`${this.product?.name} - ${s+1}`,onError:t=>{t.target.style.display="none"}})))))),i("salla-product-options",{options:JSON.stringify(s),key:`${n}-reset-${o}`,"product-id":t,"unique-key":`${n}-reset-${o}`}),i("div",{key:"eeb710a27917f6134a2595ebb8e4ec485bb26254",slot:"footer"},i("div",{key:"2ae3d47c461b68d61fcaa1d8f279ae6402aedf2e",class:"s-multiple-bundle-product-options-modal-footer"},i("salla-button",{key:"436f64a89183f0e6d56b6800ad031449c49cc751",onClick:t=>this.onSave(t),loading:this.isLoading,disabled:l},this.isLoading?salla.lang.get("common.elements.saving"):salla.lang.get("common.elements.save"))))))}get host(){return n(this)}static get watchers(){return{product:["handleProductChange"]}}};d.style=":host{display:block}";const a=class{constructor(i){t(this,i),this.productSelected=s(this,"productSelected"),this.productOptionsSelected=s(this,"productOptionsSelected"),this.selectedProducts={},this.isSelectionLocked=!1,this.selectionLimit=0,this.savedOptionsByInstance={},this.handleProductClick=(t,s)=>{const i=this.selectedProducts[this.section.id]?.has(t.id)||!1,e=this.getCheckbox(this.section.id,s);if(i&&this.isSelectionLocked)return void(e&&(e.checked=!0));if(!i&&this.isMaxSelectionReached()&&1!==this.selectionLimit)return;if(1===this.selectionLimit&&!i)return void this.productSelected.emit({product:t,sectionId:this.section.id});if(!e)return;const n=!e.checked;n||(this.dispatchClearOptionsEvent(t,s),this.clearSavedOptionsState(this.section.id,s)),e.checked=n,requestAnimationFrame((()=>{const t=new window.Event("change",{bubbles:!0});e.dispatchEvent(t)})),this.productSelected.emit({product:t,sectionId:this.section.id})},this.handleOptionsClick=t=>{!this.selectedProducts[this.section.id]?.has(t.id)&&this.isMaxSelectionReached()&&1!==this.selectionLimit||this.productOptionsSelected.emit({product:t,sectionId:this.section.id})}}getSelectedCount(){return this.selectedProducts[this.section?.id]?.size??0}isMaxSelectionReached(){return this.selectionLimit>1&&this.getSelectedCount()>=this.selectionLimit}isProductSelectionDisabled(t,s){return 0===t.quantity||!s&&this.isMaxSelectionReached()}getProductInstanceKey(t,s){return`${t}::${s}`}dispatchClearOptionsEvent(t,s){salla.event.dispatch("multiple-bundle-product-modal::clear-options",{productId:t.id,sectionId:this.section.id,sectionIndex:this.sectionIndex,productIndex:s})}handleOptionsSaved(t){const s=t.detail;if(!s)return;const{sectionId:i,productIndex:e,selectedOptions:n}=s;if(null==i||i!==this.section?.id)return;if(null==e||Number.isNaN(e))return;const o=this.getProductInstanceKey(i,e);if(n?.length)this.savedOptionsByInstance={...this.savedOptionsByInstance,[o]:!0};else if(this.savedOptionsByInstance[o]){const t={...this.savedOptionsByInstance};delete t[o],this.savedOptionsByInstance=t}}clearSavedOptionsState(t,s){const i=this.getProductInstanceKey(t,s);if(!this.savedOptionsByInstance[i])return;const e={...this.savedOptionsByInstance};delete e[i],this.savedOptionsByInstance=e}generateEventName(t,s){return`bundle[${t}][${s}][id]`}getCheckbox(t,s){const i=this.generateEventName(t,s);return this.host.querySelector(`input.s-multiple-bundle-product-checkbox[name="${i}"]`)}preventLockedDeselect(t,s){if(!this.isSelectionLocked||!s)return;t.preventDefault(),t.stopPropagation();const i=t.target;"checkbox"===i?.type&&(i.checked=!0)}render(){return i(e,{key:"e473b6089ee0e7026dfec042462ed827dabd0083"},i("salla-slider",{key:"492187e1a1c105c21c48543aa227888d122cfa20",type:"carousel",controlsOuter:!1,showControls:!1,id:`accordion-multiple-bundle-product-${this.section.id}`,pagination:!0,class:"s-multiple-bundle-product-wrapper-slider",sliderConfig:{spaceBetween:0}},i("div",{key:"e40e816439f3b3e1bee12ebdcea60438a45fec12",slot:"items"},this?.section?.products?.map(((t,s)=>{const e=this.selectedProducts[this.section.id]?.has(t.id)||!1,n=e&&this.isSelectionLocked,d=this.isProductSelectionDisabled(t,e),a=this.savedOptionsByInstance[this.getProductInstanceKey(this.section.id,s)]?salla.lang.getWithDefault("pages.products.edit_selected_options","تعديل الخيارات"):salla.lang.get("pages.products.choose_from_options");let c=salla.config.get("theme.is_rtl",!0)?o:l;return i("div",{class:"s-multiple-bundle-product-slide-one-third"+(d?" s-multiple-bundle-product-slide-one-third-disabled":""),key:t.id},i("div",{class:"s-multiple-bundle-product-card"},i("div",{class:"s-multiple-bundle-product-image-wrapper",onClick:()=>this.handleProductClick(t,s)},i("input",{id:this.generateEventName(this.section.id,s),type:"checkbox",class:"s-multiple-bundle-product-checkbox",checked:e,"data-selection-locked":n?"true":void 0,name:this.generateEventName(this.section.id,s),value:t.id,onClick:t=>this.preventLockedDeselect(t,e),onChange:t=>this.preventLockedDeselect(t,e)}),i("img",{src:t.image.url||salla.url.cdn("images/s-empty.png"),loading:"lazy",alt:t.image.alt||t.name,class:"s-multiple-bundle-product-image"})),i("div",{class:"s-multiple-bundle-product-content-wrapper"},i("div",{class:"s-multiple-bundle-product-content"},i("div",{class:"s-multiple-bundle-product-details"},i("div",{class:"s-multiple-bundle-product-title-wrapper"},i("h2",{class:"s-multiple-bundle-product-title"},i("a",{href:t?.url||"#",target:"_blank",rel:"noopener noreferrer"},t.name))),i("div",{class:"s-multiple-bundle-product-price-wrapper"},i("span",{class:"s-multiple-bundle-product-price"},i("span",{innerHTML:salla.money(t.price)})),t.sale_price>0&&i("span",{class:"s-multiple-bundle-product-price-discount"},i("span",{innerHTML:salla.money(t.regular_price)})))),t.quantity_in_group>0&&0!==t.quantity&&i("span",{class:"s-multiple-bundle-product-badge"},salla.lang.get("pages.products.pieces"),i("span",null,t.quantity_in_group)),0===t.quantity&&i("span",{class:"s-multiple-bundle-product-badge"},salla.lang.get("pages.products.quantity_in_group_finished"))),t.options?.length>0&&i("button",{class:"s-multiple-bundle-product-button",onClick:()=>this.handleOptionsClick(t),type:"button"},a,i("span",{class:"s-multiple-bundle-product-button-icon",innerHTML:c})))))})))))}get host(){return n(this)}};a.style="";export{d as salla_multiple_bundle_product_options_modal,a as salla_multiple_bundle_product_slider}
4
+ import{r as t,c as s,h as i,H as e,a as n}from"./p-DaGqpYdk.js";import{A as o,a as l}from"./p-Vqpj4CWE.js";const d=class{constructor(i){t(this,i),this.optionsSaved=s(this,"optionsSaved"),this.productSelected=s(this,"productSelected"),this.product=null,this.sectionId=null,this.sectionIndex=0,this.productIndex=0,this.selectedOptions={},this.optionsResetTokens={},this.isLoading=!1,this.hasUnsavedChanges=!1,this.validationErrors=[],this.isProductAlreadySelected=!1}generateCacheKey(t,s,i){return`${t||"unknown"}-${s||0}-${i||"unknown"}`}handleProductChange(t){setTimeout((()=>{this.modal&&t&&this.modal.setTitle(t.name||"")}),100),this.validationErrors=[],this.hasUnsavedChanges=!1}async open(){this.modal?(this.isLoading=!0,this.product?.name&&this.modal.setTitle(this.product.name),this.modal.open(),setTimeout((async()=>{this.product?.id&&await this.initializeSelectedOptions(),this.product?.name&&this.modal.setTitle(this.product.name),this.modal.stopLoading(),this.isLoading=!1}),300)):requestAnimationFrame((()=>this.open()))}async close(){this.modal&&this.modal.close()}async refreshOptionsState(){this.selectedOptions={...this.selectedOptions}}componentDidLoad(){this.modalOpenListener=t=>{this.product=t.product,this.sectionId=t.sectionId||null,this.sectionIndex=t.sectionIndex||0,this.productIndex=t.productIndex||0,this.isProductAlreadySelected=!!t.isProductAlreadySelected,this.open()},salla.event.on("multiple-bundle-product-modal::open",this.modalOpenListener),this.clearOptionsListener=t=>{t&&t.productId&&this.clearProductOptions(t.productId,t.sectionId,t.productIndex)},salla.event.on("multiple-bundle-product-modal::clear-options",this.clearOptionsListener),this.optionChangeListener=t=>{const s=t.detail||t,{option:i,detail:e}=s,n=i||s.option_id&&this.product?.options?.find((t=>t.id===s.option_id||String(t.id)===String(s.option_id))),o=e||(s.id?s:null);this.product?.id&&n&&this.handleOptionChange(Number(this.product.id),n,o)},salla.event.on("product-options::change",this.optionChangeListener),this.checkboxChangeListener=t=>{const s=t.target;if(s&&"checkbox"===s.type&&s.name&&s.name.includes("bundle[")&&s.name.includes("][id]")){const t=s.name.match(/^bundle\[([^\]]+)\]\[([^\]]+)\]\[id\]$/);if(t&&!s.checked){if("true"===s.getAttribute("data-selection-locked"))return void(s.checked=!0);const[,i,e]=t,n=s.value,o=this.host.closest("form");this.cleanupProductDeselection({sectionId:i,productIndex:parseInt(e,10),productId:n,form:o,uncheckedInput:s})}}},document.addEventListener("change",this.checkboxChangeListener)}disconnectedCallback(){this.checkboxChangeListener&&document.removeEventListener("change",this.checkboxChangeListener),this.optionChangeListener&&salla.event.off("product-options::change",this.optionChangeListener),this.modalOpenListener&&salla.event.off("multiple-bundle-product-modal::open",this.modalOpenListener),this.clearOptionsListener&&salla.event.off("multiple-bundle-product-modal::clear-options",this.clearOptionsListener)}cleanupProductDeselection(t){const{sectionId:s,productIndex:i,productId:e,form:n,uncheckedInput:o}=t;if(this.clearProductOptions(e,s,i),n){const t=`bundle[${s}][${i}]`;Array.from(n.querySelectorAll(`input[name^="${t}"]`)).forEach((s=>{if(s===o)return;const i="hidden"===s.type,n=s.getAttribute("data-product-id")===String(e)&&s.name?.startsWith(t);(i||n)&&s.remove()})),requestAnimationFrame((()=>{const t=new window.Event("change",{bubbles:!0});n.dispatchEvent(t)}))}}generateFormInputName(t,s,i){return`bundle[${t}][${s}][options][${i}]`}async initializeSelectedOptions(){if(!this.product?.id)return;const t=this.product.id,s=this.generateCacheKey(this.sectionId,this.productIndex,t),i=document.querySelector(`salla-product-options[product-id="${t}"]`);if(i)try{const t=await i.getSelectedOptions();t&&t.length>0&&(this.selectedOptions={...this.selectedOptions,[s]:t})}catch(t){console.warn("Could not initialize selected options:",t)}}clearProductOptions(t,s,i){const e={...this.selectedOptions};if(null==s||null==i||Number.isNaN(i)){const s=`-${String(t)}`,i=[];Object.keys(e).forEach((t=>{t.endsWith(s)&&(delete e[t],i.push(t))})),i.forEach((t=>this.bumpOptionsResetToken(t)))}else{const n=this.generateCacheKey(s,i,t);delete e[n],this.bumpOptionsResetToken(n)}this.selectedOptions=e,this.validationErrors=[],this.hasUnsavedChanges=!1}bumpOptionsResetToken(t){t&&(this.optionsResetTokens={...this.optionsResetTokens,[t]:(this.optionsResetTokens[t]||0)+1})}async handleOptionChange(t,s,i){const e=this.generateCacheKey(this.sectionId,this.productIndex,t),n=document.querySelector(`salla-product-options[product-id="${t}"]`);let o=[];if(n)try{o=await n.getSelectedOptions()||[]}catch(t){console.warn("Could not get current selections from component:",t)}if(o.length>0)this.selectedOptions={...this.selectedOptions,[e]:o};else if(this.selectedOptions[e]&&this.selectedOptions[e].length>0){const t=[...this.selectedOptions[e]||[]],n=t.findIndex((t=>t.option_id===s.id));n>-1?i&&null!=i.id?t[n]={...i,option_id:s.id}:t.splice(n,1):i&&null!=i.id&&t.push({...i,option_id:s.id}),this.selectedOptions={...this.selectedOptions,[e]:t}}else i&&null!=i.id&&(this.selectedOptions={...this.selectedOptions,[e]:[{...i,option_id:s.id}]});this.hasUnsavedChanges=!0,this.validationErrors=[]}async validateOptions(){if(!this.product?.options)return!0;const t=[],s=this.product.id,i=this.generateCacheKey(this.sectionId,this.productIndex,s),e=document.querySelector(`salla-product-options[product-id="${s}"]`);let n=[];if(e)try{n=await e.getSelectedOptions()||[];const t=this.selectedOptions[i]||[];(t.length>n.length||0===n.length&&t.length>0)&&(n=t)}catch(t){n=this.selectedOptions[i]||[]}else n=this.selectedOptions[i]||[];return 0===n.length&&t.push(salla.lang.get("pages.products.no_options_selected")),this.product.options.forEach((s=>{s.required&&(n.some((t=>t.option_id==s.id))||t.push(salla.lang.get("pages.products.required_option_missing",{option:s.name})))})),this.validationErrors=t,0===t.length}async onSave(t){t.preventDefault();const s=this.product?.id;if(!s)return;const i=this.generateCacheKey(this.sectionId,this.productIndex,s);if(await new Promise((t=>setTimeout(t,100))),await this.validateOptions()){if(!this.isProductAlreadySelected&&null!=this.sectionId){const t=this.host.closest("salla-multiple-bundle-product-details");if(!await(t?.canSelectBundleProduct(this.sectionId,s)))return void salla.notify.error(salla.lang.getWithDefault("pages.products.bundle_selection_limit_reached","لا يمكنك اختيار المزيد من المنتجات في هذا القسم"))}this.isLoading=!0;try{const t=document.querySelector(`salla-product-options[product-id="${s}"]`);let e=await(t?.getSelectedOptions());if((!e||0===e.length)&&this.selectedOptions[i]?.length>0&&(e=this.selectedOptions[i]),!e||0===e.length)return void(this.isLoading=!1);this.selectedOptions={...this.selectedOptions,[i]:e};const n=this.host.closest("form");if(!n)return void(this.isLoading=!1);const o=`bundle[${this.sectionId}][${this.productIndex}]`;Array.from(n.querySelectorAll(`input[name^="${o}"][type="hidden"]`)).forEach((t=>t.remove())),Array.from(n.querySelectorAll(`[data-product-id="${s}"][name^="${o}"]`)).forEach((t=>t.remove()));const l=`bundle[${this.sectionId}][${this.productIndex}][id]`,d=document.getElementById(l);if(d)d.checked=!0;else{const t=document.createElement("input");t.type="hidden",t.name=`bundle[${this.sectionId}][${this.productIndex}][id]`,t.value=String(s),t.dataset.productId=String(s),n.appendChild(t)}e.forEach((t=>{const i=t.option_id,e=document.createElement("input");e.type="hidden",e.name=this.generateFormInputName(this.sectionId,this.productIndex??0,i),e.value=String(t.id),e.dataset.productId=String(s),n.appendChild(e)}));const a=new window.Event("change",{bubbles:!0});n.dispatchEvent(a),this.optionsSaved.emit({productId:Number(s),selectedOptions:e,sectionId:this.sectionId,productIndex:this.productIndex}),this.sectionId&&this.productSelected.emit({productId:Number(s),sectionId:this.sectionId,product:this.product,fromModal:!0}),salla.notify.success(salla.lang.get("pages.products.options_saved")),this.hasUnsavedChanges=!1,this.validationErrors=[],this.modal.close()}catch(t){salla.notify.error(salla.lang.get("pages.products.options_save_error"))}finally{this.isLoading=!1}}else salla.notify.error(this.validationErrors.join(", "))}getOptionsWithSelectedState(){if(!this.product?.options)return[];const t=this.generateCacheKey(this.sectionId,this.productIndex,this.product.id),s=this.selectedOptions[t]||[];return this.product.options.map((t=>({...t,details:t.details.map((t=>{const i=s.some((s=>s.id===t.id));return{...t,is_selected:i}}))})))}render(){const t=this.product?.id,s=this.getOptionsWithSelectedState(),n=this.generateCacheKey(this.sectionId,this.productIndex,t),o=this.optionsResetTokens[n]||0,l=this.isLoading||s.some((t=>t.details.some((t=>t.is_selected&&!0===t.is_out))));return i(e,{key:"610ae038d4f9db109e3f25830e82b39a2b07a010"},i("salla-modal",{key:"b06c130448cd1862d2e879a0285fd385395cc11b",isLoading:this.isLoading,ref:t=>this.modal=t,width:"md",centered:!1,id:`s-multiple-bundle-product-options-modal-options-${t}`,class:"s-multiple-bundle-product-options-modal-wrapper"},i("div",{key:"1f8b9ffa80a40f8240ede4b8996943f7eecf4098",slot:"loading"},i("salla-skeleton",{key:"26463b16022e1f66fd66f4e9cd8907521352bac1",height:"100%",width:"100%"})),this.product?.images&&this.product?.images.length>0&&i("salla-slider",{key:"bae60782cbe4ac7dc325fd666258198cd871a52e",id:`details-slider-${this.product?.id}`,type:"thumbs",loop:!1,"auto-height":!0,"listen-to-thumbnails-option":!0,showThumbsControls:!1,controlsOuter:!1,showControls:!1,class:"s-multiple-bundle-product-options-modal-slider",verticalThumbs:!0,thumbsConfig:{centeredSlides:!0,centeredSlidesBounds:!0,slidesPerView:Math.min(5,Math.max(1,this.product?.images.length)),watchOverflow:!0,watchSlidesProgress:!0,direction:"vertical",spaceBetween:10}},i("div",{key:"998afc3297e89df7e0a6b2514a6d5f4f75152492",slot:"items"},this.product?.images&&this.product?.images.map(((t,s)=>i("div",{key:s,class:"swiper-slide"},i("img",{src:t.url,alt:t.alt||`${this.product?.name} - Image ${s+1}`,loading:"lazy",onError:t=>{t.target.style.display="none"}}))))),this.product?.images&&this.product?.images.length>1&&i("div",{key:"935a3d01a417926e904507d0a64da43c84924068",slot:"thumbs"},this.product?.images&&this.product?.images.map(((t,s)=>i("div",{key:s,"data-caption":`${this.product?.name} - Image ${s+1}`},i("img",{src:t.url,loading:"eager",class:"s-multiple-bundle-product-options-modal-slider-thumb",title:`${this.product?.name} - ${s+1}`,alt:t.alt||`${this.product?.name} - ${s+1}`,onError:t=>{t.target.style.display="none"}})))))),i("salla-product-options",{options:JSON.stringify(s),key:`${n}-reset-${o}`,"product-id":t,"unique-key":`${n}-reset-${o}`}),i("div",{key:"eeb710a27917f6134a2595ebb8e4ec485bb26254",slot:"footer"},i("div",{key:"2ae3d47c461b68d61fcaa1d8f279ae6402aedf2e",class:"s-multiple-bundle-product-options-modal-footer"},i("salla-button",{key:"436f64a89183f0e6d56b6800ad031449c49cc751",onClick:t=>this.onSave(t),loading:this.isLoading,disabled:l},this.isLoading?salla.lang.get("common.elements.saving"):salla.lang.get("common.elements.save"))))))}get host(){return n(this)}static get watchers(){return{product:["handleProductChange"]}}};d.style=":host{display:block}";const a=class{constructor(i){t(this,i),this.productSelected=s(this,"productSelected"),this.productOptionsSelected=s(this,"productOptionsSelected"),this.selectedProducts={},this.isSelectionLocked=!1,this.selectionLimit=0,this.savedOptionsByInstance={},this.handleProductClick=(t,s)=>{const i=this.selectedProducts[this.section.id]?.has(t.id)||!1,e=this.getCheckbox(this.section.id,s);if(i&&this.isSelectionLocked)return void(e&&(e.checked=!0));if(!i&&this.isMaxSelectionReached()&&1!==this.selectionLimit)return;if(1===this.selectionLimit&&!i)return void this.productSelected.emit({product:t,sectionId:this.section.id});if(!e)return;const n=!e.checked;n||(this.dispatchClearOptionsEvent(t,s),this.clearSavedOptionsState(this.section.id,s)),e.checked=n,requestAnimationFrame((()=>{const t=new window.Event("change",{bubbles:!0});e.dispatchEvent(t)})),this.productSelected.emit({product:t,sectionId:this.section.id})},this.handleOptionsClick=t=>{!this.selectedProducts[this.section.id]?.has(t.id)&&this.isMaxSelectionReached()&&1!==this.selectionLimit||this.productOptionsSelected.emit({product:t,sectionId:this.section.id})}}getSelectedCount(){return this.selectedProducts[this.section?.id]?.size??0}isMaxSelectionReached(){return this.selectionLimit>1&&this.getSelectedCount()>=this.selectionLimit}isProductSelectionDisabled(t,s){return 0===t.quantity||!s&&this.isMaxSelectionReached()}getProductInstanceKey(t,s){return`${t}::${s}`}dispatchClearOptionsEvent(t,s){salla.event.dispatch("multiple-bundle-product-modal::clear-options",{productId:t.id,sectionId:this.section.id,sectionIndex:this.sectionIndex,productIndex:s})}handleOptionsSaved(t){const s=t.detail;if(!s)return;const{sectionId:i,productIndex:e,selectedOptions:n}=s;if(null==i||i!==this.section?.id)return;if(null==e||Number.isNaN(e))return;const o=this.getProductInstanceKey(i,e);if(n?.length)this.savedOptionsByInstance={...this.savedOptionsByInstance,[o]:!0};else if(this.savedOptionsByInstance[o]){const t={...this.savedOptionsByInstance};delete t[o],this.savedOptionsByInstance=t}}clearSavedOptionsState(t,s){const i=this.getProductInstanceKey(t,s);if(!this.savedOptionsByInstance[i])return;const e={...this.savedOptionsByInstance};delete e[i],this.savedOptionsByInstance=e}generateEventName(t,s){return`bundle[${t}][${s}][id]`}getCheckbox(t,s){const i=this.generateEventName(t,s);return this.host.querySelector(`input.s-multiple-bundle-product-checkbox[name="${i}"]`)}preventLockedDeselect(t,s){if(!this.isSelectionLocked||!s)return;t.preventDefault(),t.stopPropagation();const i=t.target;"checkbox"===i?.type&&(i.checked=!0)}render(){return i(e,{key:"e473b6089ee0e7026dfec042462ed827dabd0083"},i("salla-slider",{key:"492187e1a1c105c21c48543aa227888d122cfa20",type:"carousel",controlsOuter:!1,showControls:!1,id:`accordion-multiple-bundle-product-${this.section.id}`,pagination:!0,class:"s-multiple-bundle-product-wrapper-slider",sliderConfig:{spaceBetween:0}},i("div",{key:"e40e816439f3b3e1bee12ebdcea60438a45fec12",slot:"items"},this?.section?.products?.map(((t,s)=>{const e=this.selectedProducts[this.section.id]?.has(t.id)||!1,n=e&&this.isSelectionLocked,d=this.isProductSelectionDisabled(t,e),a=this.savedOptionsByInstance[this.getProductInstanceKey(this.section.id,s)]?salla.lang.getWithDefault("pages.products.edit_selected_options","تعديل الخيارات"):salla.lang.get("pages.products.choose_from_options");let c=salla.config.get("theme.is_rtl",!0)?o:l;return i("div",{class:"s-multiple-bundle-product-slide-one-third"+(d?" s-multiple-bundle-product-slide-one-third-disabled":""),key:t.id},i("div",{class:"s-multiple-bundle-product-card"},i("div",{class:"s-multiple-bundle-product-image-wrapper",onClick:()=>this.handleProductClick(t,s)},i("input",{id:this.generateEventName(this.section.id,s),type:"checkbox",class:"s-multiple-bundle-product-checkbox",checked:e,"data-selection-locked":n?"true":void 0,name:this.generateEventName(this.section.id,s),value:t.id,onClick:t=>this.preventLockedDeselect(t,e),onChange:t=>this.preventLockedDeselect(t,e)}),i("img",{src:t.image.url||salla.url.cdn("images/s-empty.png"),loading:"lazy",alt:t.image.alt||t.name,class:"s-multiple-bundle-product-image"})),i("div",{class:"s-multiple-bundle-product-content-wrapper"},i("div",{class:"s-multiple-bundle-product-content"},i("div",{class:"s-multiple-bundle-product-details"},i("div",{class:"s-multiple-bundle-product-title-wrapper"},i("h2",{class:"s-multiple-bundle-product-title"},i("a",{href:t?.url||"#",target:"_blank",rel:"noopener noreferrer"},t.name))),i("div",{class:"s-multiple-bundle-product-price-wrapper"},i("span",{class:"s-multiple-bundle-product-price"},i("span",{innerHTML:salla.money(t.price)})),t.sale_price>0&&i("span",{class:"s-multiple-bundle-product-price-discount"},i("span",{innerHTML:salla.money(t.regular_price)})))),t.quantity_in_group>0&&0!==t.quantity&&i("span",{class:"s-multiple-bundle-product-badge"},salla.lang.get("pages.products.pieces"),i("span",null,t.quantity_in_group)),0===t.quantity&&i("span",{class:"s-multiple-bundle-product-badge"},salla.lang.get("pages.products.quantity_in_group_finished"))),t.options?.length>0&&i("button",{class:"s-multiple-bundle-product-button",onClick:()=>this.handleOptionsClick(t),type:"button"},a,i("span",{class:"s-multiple-bundle-product-button-icon",innerHTML:c})))))})))))}get host(){return n(this)}};a.style="";export{d as salla_multiple_bundle_product_options_modal,a as salla_multiple_bundle_product_slider}
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r as t,h as o,H as i}from"./p-5UtJVEzd.js";import{l as a}from"./p-BChI23pG.js";const l=t=>t?new Date(Number(t)).toLocaleDateString(salla.lang.locale,{weekday:"long",year:"numeric",month:"long",day:"numeric",hour:"numeric"}):"",s=class{constructor(o){t(this,o),this.loyaltyPointsArray=[],this.balance=0,this.isLoadingLoyalty=!1,this.nextPageUrlLoyalty="",this.handleClick=()=>{this.loadMoreLoyaltyPoints()}}async componentWillLoad(){try{await salla.onReady(),await salla.lang.onLoaded(),await this.loadLoyaltyPoints()}catch(t){salla?.logger?.warn?.("salla-loyalty-points-history: init failed",t)}}async loadLoyaltyPoints(){this.isLoadingLoyalty=!0;try{let t="/balance/points?page=1",o=await salla.api.request(t);this.loyaltyPointsArray=o.data,this.balance=o.balance,this.nextPageUrlLoyalty=o.cursor.next}catch(t){console.error("Error loading loyalty points transactions",t)}finally{this.isLoadingLoyalty=!1}}async loadMoreLoyaltyPoints(){if(this.nextPageUrlLoyalty){this.isLoadingLoyalty=!0;try{let t=await salla.api.request(this.nextPageUrlLoyalty);this.loyaltyPointsArray=[...this.loyaltyPointsArray,...t.data],this.nextPageUrlLoyalty=t.cursor?.next||""}catch(t){console.error("Error loading more loyalty points",t)}finally{this.isLoadingLoyalty=!1}}}render(){return o(i,{key:"2727e153c078533fa8fa48fa4b7349d5e7115b2b"},o("div",{key:"24fa22fc520b8bb53d49a8f5ca1014fe01e60fb2"},this.isLoadingLoyalty?o("salla-loading",null):o("div",null,o("table",{class:"s-loyalty-points-history-table"},o("tbody",null,o("tr",null,o("td",null,o("div",{class:"s-loyalty-points-history-balance-container"},o("i",{class:"s-loyalty-points-history-balance-icon sicon-gift"}),o("div",null,o("div",{class:"s-loyalty-points-history-balance-value"},this.balance," ",salla.lang.get("pages.loyalty_program.point")),o("div",{class:"s-loyalty-points-history-balance-label"},salla.lang.get("pages.loyalty_program.your_points")))))))),this.loyaltyPointsArray.length>0?o("div",null,o("table",{class:"s-loyalty-points-history-table"},o("thead",{class:"s-loyalty-points-history-table-head"},o("tr",null,o("th",{scope:"col",class:"s-loyalty-points-history-table-head-tr-th"},salla.lang.get("pages.wallet.points")),o("th",{scope:"col",class:"s-loyalty-points-history-table-head-tr-th"},salla.lang.get("pages.wallet.date")),o("th",{scope:"col",class:"s-loyalty-points-history-table-head-tr-th"},salla.lang.get("pages.wallet.expiry_date")),o("th",{scope:"col",class:"s-loyalty-points-history-table-head-tr-th"},salla.lang.get("common.elements.note")),o("th",{scope:"col",class:"s-loyalty-points-history-table-head-tr-th"},salla.lang.get("common.elements.status")))),o("tbody",null,this.loyaltyPointsArray.map((t=>o("tr",{class:"s-loyalty-points-history-table-tbody-tr"},o("td",{class:"s-loyalty-points-history-table-tbody-tr-td"},o("div",{class:"s-loyalty-points-history-table-tbody-tr-td-content"},o("span",{class:"s-loyalty-points-history-mobile-title"},salla.lang.get("pages.wallet.points"),":"),o("span",null,"plus"===t?.type?"+":"",t?.amount||""," ",salla.lang.get("pages.loyalty_program.point")))),o("td",{class:"s-loyalty-points-history-table-tbody-tr-td"},o("div",{class:"s-loyalty-points-history-table-tbody-tr-td-content"},o("span",{class:"s-loyalty-points-history-mobile-title"},salla.lang.get("pages.wallet.date"),":"),o("span",null,l(t?.created_at?1e3*Number(t.created_at):void 0)))),o("td",{class:"s-loyalty-points-history-table-tbody-tr-td"},o("div",{class:"s-loyalty-points-history-table-tbody-tr-td-content"},o("span",{class:"s-loyalty-points-history-mobile-title"},salla.lang.get("pages.wallet.expiry_date"),":"),o("span",null,l(t?.expires_at?1e3*Number(t.expires_at):void 0)))),o("td",{class:"s-loyalty-points-history-table-tbody-tr-td"},o("div",{class:"s-loyalty-points-history-table-tbody-tr-td-content"},o("span",{class:"s-loyalty-points-history-mobile-title"},salla.lang.get("common.elements.note"),":"),o("span",null,(t=>{if(!t)return"";try{const o=t.toLowerCase(),i=salla.lang.get(`pages.loyalty_program.${o}`);return i===`pages.loyalty_program.${o}`?t:i}catch{return t}})(t?.key)))),o("td",{class:"s-loyalty-points-history-table-tbody-tr-td"},o("div",{class:"s-loyalty-points-history-table-tbody-tr-td-content"},o("span",{class:"s-loyalty-points-history-mobile-title"},salla.lang.get("common.elements.status"),":"),o("div",{class:{"s-loyalty-points-history-table-transaction-status":!0,"s-loyalty-points-history-table-transaction-status-pending":"pending"===t?.status_key,"s-loyalty-points-history-table-transaction-status-revoked":"revoked"===t?.status_key,"s-loyalty-points-history-table-transaction-status-used":"used"===t?.status_key,"s-loyalty-points-history-table-transaction-status-expired":"expired"===t?.status_key}},t?.status)))))))),o("div",{class:"s-loyalty-points-history-load-more"},!!this.nextPageUrlLoyalty&&o("salla-button",{onClick:this.handleClick,loading:this.isLoadingLoyalty},salla.lang.get("common.elements.load_more")))):o("div",{class:"s-loyalty-points-history-table-empty-state"},o("span",{innerHTML:a}),o("div",{class:"s-loyalty-points-history-table-placeholder-title"},salla.lang.get("pages.loyalty_program.no_loyality_points_title")),o("div",{class:"s-loyalty-points-history-table-placeholder-sub-title"},salla.lang.get("pages.loyalty_program.no_loyality_points_sub_title"))))))}};s.style='/*!twlt*/:host{display:block}.table{display:table}.s-loyalty-points-history-balance-container{display:flex;align-items:center;justify-content:flex-start;gap:1rem}.s-loyalty-points-history-balance-value{font-size:1.25rem;line-height:1.75rem;font-weight:600}.s-loyalty-points-history-balance-label{font-weight:400;--tw-text-opacity:1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.s-loyalty-points-history-balance-icon{height:52px;width:52px;border-radius:9999px;background-color:var(--color-primary-reverse);padding-top:16px;padding-bottom:16px;padding-left:13px;padding-right:13px;font-size:25px;color:var(--color-primary)}.s-loyalty-points-history-container>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(0.625rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(0.625rem * var(--tw-space-y-reverse))}@media (min-width: 768px){.s-loyalty-points-history-container>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(1.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.25rem * var(--tw-space-y-reverse))}}.s-loyalty-points-history-mobile-title{display:inline-block;width:8rem;font-weight:400;--tw-text-opacity:1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}@media (min-width: 768px){.s-loyalty-points-history-mobile-title{display:none}}.s-loyalty-points-history-reference-id{display:none}@media (min-width: 768px){.s-loyalty-points-history-reference-id{display:inline-block}}.s-loyalty-points-history-buy-as-gift-icon{margin-left:0.25rem;margin-right:0.25rem;display:inline-block;color:var(--color-primary)}.s-loyalty-points-history-copy-to-clipboard-button{display:flex;align-items:center}@media (min-width: 768px){.s-loyalty-points-history-copy-to-clipboard-button{display:none}}.s-loyalty-points-history-copy-to-clipboard-button salla-button{position:relative}.s-loyalty-points-history-copy-to-clipboard-button-icon{pointer-events:none;font-size:0.75rem;line-height:1rem}.s-loyalty-points-history-copy-to-clipboard-button-icon:where([dir="ltr"],[dir="ltr"] *){margin-left:0.25rem}.s-loyalty-points-history-copy-to-clipboard-button-icon:where([dir="rtl"],[dir="rtl"] *){margin-right:0.25rem}@media (min-width: 768px){.s-loyalty-points-history-status-container{margin-left:0px;margin-right:0px}}.s-loyalty-points-history-status-container:where([dir="ltr"],[dir="ltr"] *){margin-left:auto}.s-loyalty-points-history-status-container:where([dir="rtl"],[dir="rtl"] *){margin-right:auto}.s-loyalty-points-history-status-container i{margin-top:0.25rem}.s-loyalty-points-history-status-container i:where([dir="ltr"],[dir="ltr"] *){margin-right:0.25rem}.s-loyalty-points-history-status-container i:where([dir="rtl"],[dir="rtl"] *){margin-left:0.25rem}.s-loyalty-points-history-rated-text{--tw-text-opacity:1;color:rgb(251 191 36 / var(--tw-text-opacity, 1))}.s-loyalty-points-history-unrated-text{--tw-text-opacity:1;color:rgb(229 231 235 / var(--tw-text-opacity, 1))}.s-loyalty-points-history-no-content{display:flex;height:100%;flex-direction:column;align-items:center;justify-content:center;padding-top:2.5rem;padding-bottom:5rem;--tw-text-opacity:1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.s-loyalty-points-history-no-content .icon{margin-bottom:1rem;display:flex;height:8rem;width:8rem;align-items:center;justify-content:center;border-radius:9999px;--tw-bg-opacity:1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1));font-size:3rem;line-height:1;--tw-text-opacity:1;color:rgb(209 213 219 / var(--tw-text-opacity, 1))}.s-loyalty-points-history-no-content p{margin-bottom:1rem;font-size:1rem;line-height:1.5rem;--tw-text-opacity:1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.s-loyalty-points-history-table{min-width:100%;border-collapse:separate}@media (min-width: 768px){.s-loyalty-points-history-table{margin-bottom:-0.75rem;--tw-border-spacing-y:1.25rem;border-spacing:var(--tw-border-spacing-x) var(--tw-border-spacing-y)}}.s-loyalty-points-history-table-head{margin-bottom:1.25rem;display:none;--tw-bg-opacity:1;background-color:rgb(249 250 251 / var(--tw-bg-opacity, 1))}@media (min-width: 768px){.s-loyalty-points-history-table-head{display:table-header-group}}.s-loyalty-points-history-table-head-tr-th{padding-left:1.5rem;padding-right:1.5rem;text-align:start;font-size:0.875rem;line-height:1.25rem;font-weight:500;text-transform:uppercase;letter-spacing:0.05em}.s-loyalty-points-history-table-head-tr-th:where([dir="ltr"],[dir="ltr"] *){text-align:left}.s-loyalty-points-history-table-head-tr-th:last-child:where([dir="ltr"],[dir="ltr"] *){text-align:right}.s-loyalty-points-history-table-head-tr-th:where([dir="rtl"],[dir="rtl"] *){text-align:right}.s-loyalty-points-history-table-head-tr-th:last-child:where([dir="rtl"],[dir="rtl"] *){text-align:left}.s-loyalty-points-history-table-tbody-tr{position:relative;display:flex;flex-direction:row;flex-wrap:wrap;overflow:hidden;border-radius:var(--s-radius, 0.25rem);border-bottom-width:8px;border-top-width:8px;--tw-border-opacity:1;border-color:rgb(249 250 251 / var(--tw-border-opacity, 1));--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1));padding:0.5rem;transition-property:box-shadow;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:500ms}@media (min-width: 768px){.s-loyalty-points-history-table-tbody-tr{display:table-row;flex-direction:row;flex-wrap:nowrap;padding:0px}}.s-loyalty-points-history-table-tbody-tr-td{width:100%;white-space:nowrap;font-size:0.875rem;line-height:1.25rem}.s-loyalty-points-history-table-tbody-tr-td:first-child{font-weight:700}@media (min-width: 768px){.s-loyalty-points-history-table-tbody-tr-td{height:5rem;width:auto}.s-loyalty-points-history-table-tbody-tr-td:last-child{text-align:end}.s-loyalty-points-history-table-tbody-tr-td:first-child:where([dir="ltr"],[dir="ltr"] *){border-top-left-radius:0.375rem;border-bottom-left-radius:0.375rem}.s-loyalty-points-history-table-tbody-tr-td:first-child:where([dir="rtl"],[dir="rtl"] *){border-top-right-radius:0.375rem;border-bottom-right-radius:0.375rem}}.s-loyalty-points-history-table-tbody-tr-td:first-child{font-weight:700}.s-loyalty-points-history-table-tbody-tr-td-content{position:relative;display:flex;align-items:center;justify-content:space-between;padding-left:0.5rem;padding-right:0.5rem;padding-top:0.25rem;padding-bottom:0.25rem;font-size:0.75rem;line-height:1rem}@media (min-width: 768px){.s-loyalty-points-history-table-tbody-tr-td-content{padding-left:1.5rem;padding-right:1.5rem;padding-top:1.5rem;padding-bottom:1.5rem}}.s-loyalty-points-history-table-tbody-tr-td-content:where([dir="ltr"],[dir="ltr"] *){padding-right:0.5rem}.s-loyalty-points-history-table-tbody-tr-td-content:where([dir="rtl"],[dir="rtl"] *){padding-left:0.5rem}.s-loyalty-points-history-table-tbody-tr a{position:absolute;top:0px;bottom:0px;display:block;width:100%}.s-loyalty-points-history-table-tbody-tr a:where([dir="ltr"],[dir="ltr"] *){left:0px}.s-loyalty-points-history-table-tbody-tr a:where([dir="rtl"],[dir="rtl"] *){right:0px}.s-loyalty-points-history-table-empty-state{display:flex;flex-direction:column;align-items:center;font-size:80px}.s-loyalty-points-history-table-empty-state i{margin-bottom:2rem;margin-top:4rem;font-size:80px;color:var(--infinte-color)}.s-loyalty-points-history-table-placeholder-title{padding:0.75rem;text-align:center;font-size:1.25rem;line-height:1.75rem;font-weight:700}.s-loyalty-points-history-table-placeholder-sub-title{text-align:center;font-size:0.875rem;line-height:1.25rem;font-weight:400;--tw-text-opacity:1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.s-loyalty-points-history-load-more{margin-top:1rem;display:flex;justify-content:center}.s-loyalty-points-history-table-transaction-status{display:flex;width:max-content;align-items:center;border-radius:20px;--tw-bg-opacity:1;background-color:rgb(255 246 235 / var(--tw-bg-opacity, 1));padding-top:6px;padding-bottom:6px;padding-left:19px;padding-right:19px;--tw-text-opacity:1;color:rgb(164 111 41 / var(--tw-text-opacity, 1))}.s-loyalty-points-history-table-transaction-status-pending{--tw-bg-opacity:1;background-color:rgb(255 246 235 / var(--tw-bg-opacity, 1));--tw-text-opacity:1;color:rgb(164 111 41 / var(--tw-text-opacity, 1))}.s-loyalty-points-history-table-transaction-status-used{--tw-bg-opacity:1;background-color:rgb(239 251 246 / var(--tw-bg-opacity, 1));--tw-text-opacity:1;color:rgb(0 175 108 / var(--tw-text-opacity, 1))}.s-loyalty-points-history-table-transaction-status-revoked{--tw-bg-opacity:1;background-color:rgb(254 236 236 / var(--tw-bg-opacity, 1));--tw-text-opacity:1;color:rgb(245 81 87 / var(--tw-text-opacity, 1))}.s-loyalty-points-history-table-transaction-status-expired{--tw-bg-opacity:1;background-color:rgb(245 245 245 / var(--tw-bg-opacity, 1));--tw-text-opacity:1;color:rgb(158 158 158 / var(--tw-text-opacity, 1))}';export{s as salla_loyalty_points_history}
4
+ import{r as t,h as o,H as i}from"./p-DaGqpYdk.js";import{l as a}from"./p-BChI23pG.js";const l=t=>t?new Date(Number(t)).toLocaleDateString(salla.lang.locale,{weekday:"long",year:"numeric",month:"long",day:"numeric",hour:"numeric"}):"",s=class{constructor(o){t(this,o),this.loyaltyPointsArray=[],this.balance=0,this.isLoadingLoyalty=!1,this.nextPageUrlLoyalty="",this.handleClick=()=>{this.loadMoreLoyaltyPoints()}}async componentWillLoad(){try{await salla.onReady(),await salla.lang.onLoaded(),await this.loadLoyaltyPoints()}catch(t){salla?.logger?.warn?.("salla-loyalty-points-history: init failed",t)}}async loadLoyaltyPoints(){this.isLoadingLoyalty=!0;try{let t="/balance/points?page=1",o=await salla.api.request(t);this.loyaltyPointsArray=o.data,this.balance=o.balance,this.nextPageUrlLoyalty=o.cursor.next}catch(t){console.error("Error loading loyalty points transactions",t)}finally{this.isLoadingLoyalty=!1}}async loadMoreLoyaltyPoints(){if(this.nextPageUrlLoyalty){this.isLoadingLoyalty=!0;try{let t=await salla.api.request(this.nextPageUrlLoyalty);this.loyaltyPointsArray=[...this.loyaltyPointsArray,...t.data],this.nextPageUrlLoyalty=t.cursor?.next||""}catch(t){console.error("Error loading more loyalty points",t)}finally{this.isLoadingLoyalty=!1}}}render(){return o(i,{key:"2727e153c078533fa8fa48fa4b7349d5e7115b2b"},o("div",{key:"24fa22fc520b8bb53d49a8f5ca1014fe01e60fb2"},this.isLoadingLoyalty?o("salla-loading",null):o("div",null,o("table",{class:"s-loyalty-points-history-table"},o("tbody",null,o("tr",null,o("td",null,o("div",{class:"s-loyalty-points-history-balance-container"},o("i",{class:"s-loyalty-points-history-balance-icon sicon-gift"}),o("div",null,o("div",{class:"s-loyalty-points-history-balance-value"},this.balance," ",salla.lang.get("pages.loyalty_program.point")),o("div",{class:"s-loyalty-points-history-balance-label"},salla.lang.get("pages.loyalty_program.your_points")))))))),this.loyaltyPointsArray.length>0?o("div",null,o("table",{class:"s-loyalty-points-history-table"},o("thead",{class:"s-loyalty-points-history-table-head"},o("tr",null,o("th",{scope:"col",class:"s-loyalty-points-history-table-head-tr-th"},salla.lang.get("pages.wallet.points")),o("th",{scope:"col",class:"s-loyalty-points-history-table-head-tr-th"},salla.lang.get("pages.wallet.date")),o("th",{scope:"col",class:"s-loyalty-points-history-table-head-tr-th"},salla.lang.get("pages.wallet.expiry_date")),o("th",{scope:"col",class:"s-loyalty-points-history-table-head-tr-th"},salla.lang.get("common.elements.note")),o("th",{scope:"col",class:"s-loyalty-points-history-table-head-tr-th"},salla.lang.get("common.elements.status")))),o("tbody",null,this.loyaltyPointsArray.map((t=>o("tr",{class:"s-loyalty-points-history-table-tbody-tr"},o("td",{class:"s-loyalty-points-history-table-tbody-tr-td"},o("div",{class:"s-loyalty-points-history-table-tbody-tr-td-content"},o("span",{class:"s-loyalty-points-history-mobile-title"},salla.lang.get("pages.wallet.points"),":"),o("span",null,"plus"===t?.type?"+":"",t?.amount||""," ",salla.lang.get("pages.loyalty_program.point")))),o("td",{class:"s-loyalty-points-history-table-tbody-tr-td"},o("div",{class:"s-loyalty-points-history-table-tbody-tr-td-content"},o("span",{class:"s-loyalty-points-history-mobile-title"},salla.lang.get("pages.wallet.date"),":"),o("span",null,l(t?.created_at?1e3*Number(t.created_at):void 0)))),o("td",{class:"s-loyalty-points-history-table-tbody-tr-td"},o("div",{class:"s-loyalty-points-history-table-tbody-tr-td-content"},o("span",{class:"s-loyalty-points-history-mobile-title"},salla.lang.get("pages.wallet.expiry_date"),":"),o("span",null,l(t?.expires_at?1e3*Number(t.expires_at):void 0)))),o("td",{class:"s-loyalty-points-history-table-tbody-tr-td"},o("div",{class:"s-loyalty-points-history-table-tbody-tr-td-content"},o("span",{class:"s-loyalty-points-history-mobile-title"},salla.lang.get("common.elements.note"),":"),o("span",null,(t=>{if(!t)return"";try{const o=t.toLowerCase(),i=salla.lang.get(`pages.loyalty_program.${o}`);return i===`pages.loyalty_program.${o}`?t:i}catch{return t}})(t?.key)))),o("td",{class:"s-loyalty-points-history-table-tbody-tr-td"},o("div",{class:"s-loyalty-points-history-table-tbody-tr-td-content"},o("span",{class:"s-loyalty-points-history-mobile-title"},salla.lang.get("common.elements.status"),":"),o("div",{class:{"s-loyalty-points-history-table-transaction-status":!0,"s-loyalty-points-history-table-transaction-status-pending":"pending"===t?.status_key,"s-loyalty-points-history-table-transaction-status-revoked":"revoked"===t?.status_key,"s-loyalty-points-history-table-transaction-status-used":"used"===t?.status_key,"s-loyalty-points-history-table-transaction-status-expired":"expired"===t?.status_key}},t?.status)))))))),o("div",{class:"s-loyalty-points-history-load-more"},!!this.nextPageUrlLoyalty&&o("salla-button",{onClick:this.handleClick,loading:this.isLoadingLoyalty},salla.lang.get("common.elements.load_more")))):o("div",{class:"s-loyalty-points-history-table-empty-state"},o("span",{innerHTML:a}),o("div",{class:"s-loyalty-points-history-table-placeholder-title"},salla.lang.get("pages.loyalty_program.no_loyality_points_title")),o("div",{class:"s-loyalty-points-history-table-placeholder-sub-title"},salla.lang.get("pages.loyalty_program.no_loyality_points_sub_title"))))))}};s.style='/*!twlt*/:host{display:block}.table{display:table}.s-loyalty-points-history-balance-container{display:flex;align-items:center;justify-content:flex-start;gap:1rem}.s-loyalty-points-history-balance-value{font-size:1.25rem;line-height:1.75rem;font-weight:600}.s-loyalty-points-history-balance-label{font-weight:400;--tw-text-opacity:1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.s-loyalty-points-history-balance-icon{height:52px;width:52px;border-radius:9999px;background-color:var(--color-primary-reverse);padding-top:16px;padding-bottom:16px;padding-left:13px;padding-right:13px;font-size:25px;color:var(--color-primary)}.s-loyalty-points-history-container>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(0.625rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(0.625rem * var(--tw-space-y-reverse))}@media (min-width: 768px){.s-loyalty-points-history-container>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(1.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.25rem * var(--tw-space-y-reverse))}}.s-loyalty-points-history-mobile-title{display:inline-block;width:8rem;font-weight:400;--tw-text-opacity:1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}@media (min-width: 768px){.s-loyalty-points-history-mobile-title{display:none}}.s-loyalty-points-history-reference-id{display:none}@media (min-width: 768px){.s-loyalty-points-history-reference-id{display:inline-block}}.s-loyalty-points-history-buy-as-gift-icon{margin-left:0.25rem;margin-right:0.25rem;display:inline-block;color:var(--color-primary)}.s-loyalty-points-history-copy-to-clipboard-button{display:flex;align-items:center}@media (min-width: 768px){.s-loyalty-points-history-copy-to-clipboard-button{display:none}}.s-loyalty-points-history-copy-to-clipboard-button salla-button{position:relative}.s-loyalty-points-history-copy-to-clipboard-button-icon{pointer-events:none;font-size:0.75rem;line-height:1rem}.s-loyalty-points-history-copy-to-clipboard-button-icon:where([dir="ltr"],[dir="ltr"] *){margin-left:0.25rem}.s-loyalty-points-history-copy-to-clipboard-button-icon:where([dir="rtl"],[dir="rtl"] *){margin-right:0.25rem}@media (min-width: 768px){.s-loyalty-points-history-status-container{margin-left:0px;margin-right:0px}}.s-loyalty-points-history-status-container:where([dir="ltr"],[dir="ltr"] *){margin-left:auto}.s-loyalty-points-history-status-container:where([dir="rtl"],[dir="rtl"] *){margin-right:auto}.s-loyalty-points-history-status-container i{margin-top:0.25rem}.s-loyalty-points-history-status-container i:where([dir="ltr"],[dir="ltr"] *){margin-right:0.25rem}.s-loyalty-points-history-status-container i:where([dir="rtl"],[dir="rtl"] *){margin-left:0.25rem}.s-loyalty-points-history-rated-text{--tw-text-opacity:1;color:rgb(251 191 36 / var(--tw-text-opacity, 1))}.s-loyalty-points-history-unrated-text{--tw-text-opacity:1;color:rgb(229 231 235 / var(--tw-text-opacity, 1))}.s-loyalty-points-history-no-content{display:flex;height:100%;flex-direction:column;align-items:center;justify-content:center;padding-top:2.5rem;padding-bottom:5rem;--tw-text-opacity:1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.s-loyalty-points-history-no-content .icon{margin-bottom:1rem;display:flex;height:8rem;width:8rem;align-items:center;justify-content:center;border-radius:9999px;--tw-bg-opacity:1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1));font-size:3rem;line-height:1;--tw-text-opacity:1;color:rgb(209 213 219 / var(--tw-text-opacity, 1))}.s-loyalty-points-history-no-content p{margin-bottom:1rem;font-size:1rem;line-height:1.5rem;--tw-text-opacity:1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.s-loyalty-points-history-table{min-width:100%;border-collapse:separate}@media (min-width: 768px){.s-loyalty-points-history-table{margin-bottom:-0.75rem;--tw-border-spacing-y:1.25rem;border-spacing:var(--tw-border-spacing-x) var(--tw-border-spacing-y)}}.s-loyalty-points-history-table-head{margin-bottom:1.25rem;display:none;--tw-bg-opacity:1;background-color:rgb(249 250 251 / var(--tw-bg-opacity, 1))}@media (min-width: 768px){.s-loyalty-points-history-table-head{display:table-header-group}}.s-loyalty-points-history-table-head-tr-th{padding-left:1.5rem;padding-right:1.5rem;text-align:start;font-size:0.875rem;line-height:1.25rem;font-weight:500;text-transform:uppercase;letter-spacing:0.05em}.s-loyalty-points-history-table-head-tr-th:where([dir="ltr"],[dir="ltr"] *){text-align:left}.s-loyalty-points-history-table-head-tr-th:last-child:where([dir="ltr"],[dir="ltr"] *){text-align:right}.s-loyalty-points-history-table-head-tr-th:where([dir="rtl"],[dir="rtl"] *){text-align:right}.s-loyalty-points-history-table-head-tr-th:last-child:where([dir="rtl"],[dir="rtl"] *){text-align:left}.s-loyalty-points-history-table-tbody-tr{position:relative;display:flex;flex-direction:row;flex-wrap:wrap;overflow:hidden;border-radius:var(--s-radius, 0.25rem);border-bottom-width:8px;border-top-width:8px;--tw-border-opacity:1;border-color:rgb(249 250 251 / var(--tw-border-opacity, 1));--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1));padding:0.5rem;transition-property:box-shadow;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:500ms}@media (min-width: 768px){.s-loyalty-points-history-table-tbody-tr{display:table-row;flex-direction:row;flex-wrap:nowrap;padding:0px}}.s-loyalty-points-history-table-tbody-tr-td{width:100%;white-space:nowrap;font-size:0.875rem;line-height:1.25rem}.s-loyalty-points-history-table-tbody-tr-td:first-child{font-weight:700}@media (min-width: 768px){.s-loyalty-points-history-table-tbody-tr-td{height:5rem;width:auto}.s-loyalty-points-history-table-tbody-tr-td:last-child{text-align:end}.s-loyalty-points-history-table-tbody-tr-td:first-child:where([dir="ltr"],[dir="ltr"] *){border-top-left-radius:0.375rem;border-bottom-left-radius:0.375rem}.s-loyalty-points-history-table-tbody-tr-td:first-child:where([dir="rtl"],[dir="rtl"] *){border-top-right-radius:0.375rem;border-bottom-right-radius:0.375rem}}.s-loyalty-points-history-table-tbody-tr-td:first-child{font-weight:700}.s-loyalty-points-history-table-tbody-tr-td-content{position:relative;display:flex;align-items:center;justify-content:space-between;padding-left:0.5rem;padding-right:0.5rem;padding-top:0.25rem;padding-bottom:0.25rem;font-size:0.75rem;line-height:1rem}@media (min-width: 768px){.s-loyalty-points-history-table-tbody-tr-td-content{padding-left:1.5rem;padding-right:1.5rem;padding-top:1.5rem;padding-bottom:1.5rem}}.s-loyalty-points-history-table-tbody-tr-td-content:where([dir="ltr"],[dir="ltr"] *){padding-right:0.5rem}.s-loyalty-points-history-table-tbody-tr-td-content:where([dir="rtl"],[dir="rtl"] *){padding-left:0.5rem}.s-loyalty-points-history-table-tbody-tr a{position:absolute;top:0px;bottom:0px;display:block;width:100%}.s-loyalty-points-history-table-tbody-tr a:where([dir="ltr"],[dir="ltr"] *){left:0px}.s-loyalty-points-history-table-tbody-tr a:where([dir="rtl"],[dir="rtl"] *){right:0px}.s-loyalty-points-history-table-empty-state{display:flex;flex-direction:column;align-items:center;font-size:80px}.s-loyalty-points-history-table-empty-state i{margin-bottom:2rem;margin-top:4rem;font-size:80px;color:var(--infinte-color)}.s-loyalty-points-history-table-placeholder-title{padding:0.75rem;text-align:center;font-size:1.25rem;line-height:1.75rem;font-weight:700}.s-loyalty-points-history-table-placeholder-sub-title{text-align:center;font-size:0.875rem;line-height:1.25rem;font-weight:400;--tw-text-opacity:1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.s-loyalty-points-history-load-more{margin-top:1rem;display:flex;justify-content:center}.s-loyalty-points-history-table-transaction-status{display:flex;width:max-content;align-items:center;border-radius:20px;--tw-bg-opacity:1;background-color:rgb(255 246 235 / var(--tw-bg-opacity, 1));padding-top:6px;padding-bottom:6px;padding-left:19px;padding-right:19px;--tw-text-opacity:1;color:rgb(164 111 41 / var(--tw-text-opacity, 1))}.s-loyalty-points-history-table-transaction-status-pending{--tw-bg-opacity:1;background-color:rgb(255 246 235 / var(--tw-bg-opacity, 1));--tw-text-opacity:1;color:rgb(164 111 41 / var(--tw-text-opacity, 1))}.s-loyalty-points-history-table-transaction-status-used{--tw-bg-opacity:1;background-color:rgb(239 251 246 / var(--tw-bg-opacity, 1));--tw-text-opacity:1;color:rgb(0 175 108 / var(--tw-text-opacity, 1))}.s-loyalty-points-history-table-transaction-status-revoked{--tw-bg-opacity:1;background-color:rgb(254 236 236 / var(--tw-bg-opacity, 1));--tw-text-opacity:1;color:rgb(245 81 87 / var(--tw-text-opacity, 1))}.s-loyalty-points-history-table-transaction-status-expired{--tw-bg-opacity:1;background-color:rgb(245 245 245 / var(--tw-bg-opacity, 1));--tw-text-opacity:1;color:rgb(158 158 158 / var(--tw-text-opacity, 1))}';export{s as salla_loyalty_points_history}
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r as e,h as i}from"./p-5UtJVEzd.js";import{G as s}from"./p-OF8QcbMM.js";const l=class{constructor(i){e(this,i),this.minAge=10,this.isEditable=!0,this.disableAction=!1,this.isLoading=!0,this.first_name_trans=salla.lang.get("pages.profile.first_name"),this.last_name_trans=salla.lang.get("pages.profile.last_name"),this.birthday_trans=salla.lang.get("pages.profile.birthday"),this.birthday_placeholder_trans=salla.lang.get("pages.profile.birthday_placeholder"),this.gender_trans=salla.lang.get("pages.profile.gender"),this.gender_placeholder_trans=salla.lang.get("pages.profile.gender_placeholder"),this.male_trans=salla.lang.get("pages.profile.male"),this.female_trans=salla.lang.get("pages.profile.female"),this.email_trans=salla.lang.get("common.elements.email"),this.mobile_trans=salla.lang.get("common.elements.mobile"),this.save_btn_trans=salla.lang.get("common.elements.save"),this.drag_and_drop_trans=salla.lang.get("common.uploader.drag_and_drop"),this.browse_trans=salla.lang.get("common.uploader.browse"),this.email_required_trans=salla.lang.get("pages.checkout.email_required"),this.invalid_email_trans=salla.lang.get("pages.error.invalid_value",{attribute:"email"}),salla.lang.onLoaded((()=>{this.first_name_trans=salla.lang.get("pages.profile.first_name"),this.last_name_trans=salla.lang.get("pages.profile.last_name"),this.birthday_trans=salla.lang.get("pages.profile.birthday"),this.birthday_placeholder_trans=salla.lang.get("pages.profile.birthday_placeholder"),this.gender_trans=salla.lang.get("pages.profile.gender"),this.gender_placeholder_trans=salla.lang.get("pages.profile.gender_placeholder"),this.male_trans=salla.lang.get("pages.profile.male"),this.female_trans=salla.lang.get("pages.profile.female"),this.email_trans=salla.lang.get("common.elements.email"),this.mobile_trans=salla.lang.get("common.elements.mobile"),this.save_btn_trans=salla.lang.get("common.elements.save"),this.drag_and_drop_trans=salla.lang.get("common.uploader.drag_and_drop"),this.browse_trans=salla.lang.get("common.uploader.browse"),this.email_required_trans=salla.lang.get("pages.checkout.email_required"),this.invalid_email_trans=salla.lang.get("pages.error.invalid_value",{attribute:"email"})}))}phoneNumberFieldEventHandler(e){e.detail.number?(this.userData.phone.number=Number.parseInt(e.detail.number),this.userData.phone.country=e.detail.country_code,this.disableAction=!1):this.disableAction=!0}handleFieldChange(e,i,s=!1){i.target.value?(this.userData[e]=i.target.value,this.disableAction=!1):s&&(this.disableAction=!0)}handleEmailInput(e,i){const s=document.getElementById("email-error"),l=i.target.value;if(!l)return this.disableAction=!0,void(s.textContent=this.email_required_trans);/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i.test(l)||(this.disableAction=!0,s.textContent=this.invalid_email_trans),s.textContent="",this.userData[e]=l,this.disableAction=!1}submitForm(e){e.preventDefault(),this.disableAction=!0;const i=Object.assign({},this.userData);i.phone=void 0,i.phone=this.userData.phone.number,i.country_code=this.userData.phone.country,salla.api.profile.update(i).finally((()=>{this.disableAction=!1}))}getBirthDateRestriction(){const e=new Date,i=e.getFullYear()-this.minAge;return e.setFullYear(i),e}fetchData(){return salla.api.profile.info().then((e=>{this.userData=e.data})).finally((()=>{this.isLoading=!1,this.isEditable=!Salla.config.get("store.features").includes("sso-login")}))}renderLoadingSection(){return i("div",{class:"s-user-profile-skeleton-wrapper"},Array.from({length:6},((e,s)=>i("salla-skeleton",{class:"skeleton-item",width:"100%",height:"50px",key:s}))))}componentWillLoad(){Salla.onReady().then((()=>this.fetchData()))}render(){return this.isLoading?this.renderLoadingSection():i("form",{onSubmit:e=>this.submitForm(e)},i("div",{class:"s-user-profile-wrapper"},i("div",{class:"s-user-profile-field"},i("label",{htmlFor:"first-name",class:"s-user-profile-field-label"},this.first_name_trans),i("input",{disabled:!this.isEditable,type:"text",name:"first_name",value:this.userData.first_name,id:"first-name",required:!0,autocomplete:"first_name",class:"form-input",onChange:e=>this.handleFieldChange("first_name",e)})),i("div",{class:"s-user-profile-field"},i("label",{htmlFor:"last-name",class:"s-user-profile-field-label"},this.last_name_trans),i("input",{disabled:!this.isEditable,type:"text",name:"last_name",value:this.userData.last_name,id:"last-name",required:!0,autocomplete:"last_name",class:"form-input",onChange:e=>this.handleFieldChange("last_name",e)})),i("div",{class:"s-user-profile-field"},i("label",{htmlFor:"birthday",class:"s-user-profile-field-label"},this.birthday_trans),i("salla-datetime-picker",{disabled:!this.isEditable,dateFormat:"Y-m-d",value:this.userData.birthday,placeholder:this.birthday_placeholder_trans,required:!0,maxDate:this.getBirthDateRestriction(),name:"birthday",onPicked:e=>this.handleFieldChange("birthday",e)})),i("div",{class:"s-user-profile-field"},i("label",{htmlFor:"gender",class:"s-user-profile-field-label"},this.gender_trans),i("select",{disabled:!this.isEditable,class:"form-input",name:"gender",required:!0,onChange:e=>this.handleFieldChange("gender",e)},i("option",{value:""},this.gender_placeholder_trans),i("option",{value:s.Male,selected:this.userData.gender===s.Male},this.male_trans),i("option",{value:s.Female,selected:this.userData.gender===s.Female},this.female_trans))),i("div",{class:"s-user-profile-field"},i("label",{htmlFor:"email",class:"s-user-profile-field-label"},this.email_trans),i("input",{disabled:!this.isEditable,type:"email",name:"email",value:this.userData.email,id:"email",class:"form-input",required:!0,onInput:e=>this.handleEmailInput("email",e)}),i("p",{id:"email-error",class:"s-user-profile-field-error"})),i("div",{class:"s-user-profile-field"},i("label",{htmlFor:"international-mobile",class:"s-user-profile-field-label"},this.mobile_trans),i("salla-tel-input",{disabled:!this.isEditable,name:"international-mobile","country-code":this.userData.phone.country,phone:`${this.userData.phone.number}`,onPhoneEntered:e=>this.phoneNumberFieldEventHandler(e)}))),i("salla-button",{type:"submit",loading:this.disableAction,disabled:this.disableAction||!this.isEditable,"loader-position":"end",class:"s-user-profile-submit"},this.save_btn_trans))}};l.style="/*!twlt*/:host{display:block}.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-user-profile-wrapper{display:grid;grid-template-columns:repeat(1, minmax(0, 1fr));gap:1.5rem}@media (min-width: 640px){.s-user-profile-wrapper{grid-template-columns:repeat(2, minmax(0, 1fr));gap:2rem}}.s-user-profile-field-label{margin-bottom:0.5rem;display:block;font-size:0.875rem;line-height:1.25rem;font-weight:700;--tw-text-opacity:1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.s-user-profile-field-error{--tw-text-opacity:1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.s-user-profile-submit{margin-top:1.5rem;width:100%}.s-user-profile-filepond-placeholder{display:flex;flex-direction:column;align-items:center;justify-content:center}.s-user-profile-filepond-placeholder-icon{margin-bottom:0.25rem}.s-user-profile-filepond-placeholder-icon svg{height:1.5rem;width:1.5rem;fill:#7c8082}.s-user-profile-skeleton-wrapper{display:grid;grid-template-columns:repeat(2, minmax(0, 1fr));grid-template-rows:repeat(3, minmax(0, 1fr));gap:3rem}";export{l as salla_user_profile}
4
+ import{r as e,h as i}from"./p-DaGqpYdk.js";import{G as s}from"./p-OF8QcbMM.js";const l=class{constructor(i){e(this,i),this.minAge=10,this.isEditable=!0,this.disableAction=!1,this.isLoading=!0,this.first_name_trans=salla.lang.get("pages.profile.first_name"),this.last_name_trans=salla.lang.get("pages.profile.last_name"),this.birthday_trans=salla.lang.get("pages.profile.birthday"),this.birthday_placeholder_trans=salla.lang.get("pages.profile.birthday_placeholder"),this.gender_trans=salla.lang.get("pages.profile.gender"),this.gender_placeholder_trans=salla.lang.get("pages.profile.gender_placeholder"),this.male_trans=salla.lang.get("pages.profile.male"),this.female_trans=salla.lang.get("pages.profile.female"),this.email_trans=salla.lang.get("common.elements.email"),this.mobile_trans=salla.lang.get("common.elements.mobile"),this.save_btn_trans=salla.lang.get("common.elements.save"),this.drag_and_drop_trans=salla.lang.get("common.uploader.drag_and_drop"),this.browse_trans=salla.lang.get("common.uploader.browse"),this.email_required_trans=salla.lang.get("pages.checkout.email_required"),this.invalid_email_trans=salla.lang.get("pages.error.invalid_value",{attribute:"email"}),salla.lang.onLoaded((()=>{this.first_name_trans=salla.lang.get("pages.profile.first_name"),this.last_name_trans=salla.lang.get("pages.profile.last_name"),this.birthday_trans=salla.lang.get("pages.profile.birthday"),this.birthday_placeholder_trans=salla.lang.get("pages.profile.birthday_placeholder"),this.gender_trans=salla.lang.get("pages.profile.gender"),this.gender_placeholder_trans=salla.lang.get("pages.profile.gender_placeholder"),this.male_trans=salla.lang.get("pages.profile.male"),this.female_trans=salla.lang.get("pages.profile.female"),this.email_trans=salla.lang.get("common.elements.email"),this.mobile_trans=salla.lang.get("common.elements.mobile"),this.save_btn_trans=salla.lang.get("common.elements.save"),this.drag_and_drop_trans=salla.lang.get("common.uploader.drag_and_drop"),this.browse_trans=salla.lang.get("common.uploader.browse"),this.email_required_trans=salla.lang.get("pages.checkout.email_required"),this.invalid_email_trans=salla.lang.get("pages.error.invalid_value",{attribute:"email"})}))}phoneNumberFieldEventHandler(e){e.detail.number?(this.userData.phone.number=Number.parseInt(e.detail.number),this.userData.phone.country=e.detail.country_code,this.disableAction=!1):this.disableAction=!0}handleFieldChange(e,i,s=!1){i.target.value?(this.userData[e]=i.target.value,this.disableAction=!1):s&&(this.disableAction=!0)}handleEmailInput(e,i){const s=document.getElementById("email-error"),l=i.target.value;if(!l)return this.disableAction=!0,void(s.textContent=this.email_required_trans);/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i.test(l)||(this.disableAction=!0,s.textContent=this.invalid_email_trans),s.textContent="",this.userData[e]=l,this.disableAction=!1}submitForm(e){e.preventDefault(),this.disableAction=!0;const i=Object.assign({},this.userData);i.phone=void 0,i.phone=this.userData.phone.number,i.country_code=this.userData.phone.country,salla.api.profile.update(i).finally((()=>{this.disableAction=!1}))}getBirthDateRestriction(){const e=new Date,i=e.getFullYear()-this.minAge;return e.setFullYear(i),e}fetchData(){return salla.api.profile.info().then((e=>{this.userData=e.data})).finally((()=>{this.isLoading=!1,this.isEditable=!Salla.config.get("store.features").includes("sso-login")}))}renderLoadingSection(){return i("div",{class:"s-user-profile-skeleton-wrapper"},Array.from({length:6},((e,s)=>i("salla-skeleton",{class:"skeleton-item",width:"100%",height:"50px",key:s}))))}componentWillLoad(){Salla.onReady().then((()=>this.fetchData()))}render(){return this.isLoading?this.renderLoadingSection():i("form",{onSubmit:e=>this.submitForm(e)},i("div",{class:"s-user-profile-wrapper"},i("div",{class:"s-user-profile-field"},i("label",{htmlFor:"first-name",class:"s-user-profile-field-label"},this.first_name_trans),i("input",{disabled:!this.isEditable,type:"text",name:"first_name",value:this.userData.first_name,id:"first-name",required:!0,autocomplete:"first_name",class:"form-input",onChange:e=>this.handleFieldChange("first_name",e)})),i("div",{class:"s-user-profile-field"},i("label",{htmlFor:"last-name",class:"s-user-profile-field-label"},this.last_name_trans),i("input",{disabled:!this.isEditable,type:"text",name:"last_name",value:this.userData.last_name,id:"last-name",required:!0,autocomplete:"last_name",class:"form-input",onChange:e=>this.handleFieldChange("last_name",e)})),i("div",{class:"s-user-profile-field"},i("label",{htmlFor:"birthday",class:"s-user-profile-field-label"},this.birthday_trans),i("salla-datetime-picker",{disabled:!this.isEditable,dateFormat:"Y-m-d",value:this.userData.birthday,placeholder:this.birthday_placeholder_trans,required:!0,maxDate:this.getBirthDateRestriction(),name:"birthday",onPicked:e=>this.handleFieldChange("birthday",e)})),i("div",{class:"s-user-profile-field"},i("label",{htmlFor:"gender",class:"s-user-profile-field-label"},this.gender_trans),i("select",{disabled:!this.isEditable,class:"form-input",name:"gender",required:!0,onChange:e=>this.handleFieldChange("gender",e)},i("option",{value:""},this.gender_placeholder_trans),i("option",{value:s.Male,selected:this.userData.gender===s.Male},this.male_trans),i("option",{value:s.Female,selected:this.userData.gender===s.Female},this.female_trans))),i("div",{class:"s-user-profile-field"},i("label",{htmlFor:"email",class:"s-user-profile-field-label"},this.email_trans),i("input",{disabled:!this.isEditable,type:"email",name:"email",value:this.userData.email,id:"email",class:"form-input",required:!0,onInput:e=>this.handleEmailInput("email",e)}),i("p",{id:"email-error",class:"s-user-profile-field-error"})),i("div",{class:"s-user-profile-field"},i("label",{htmlFor:"international-mobile",class:"s-user-profile-field-label"},this.mobile_trans),i("salla-tel-input",{disabled:!this.isEditable,name:"international-mobile","country-code":this.userData.phone.country,phone:`${this.userData.phone.number}`,onPhoneEntered:e=>this.phoneNumberFieldEventHandler(e)}))),i("salla-button",{type:"submit",loading:this.disableAction,disabled:this.disableAction||!this.isEditable,"loader-position":"end",class:"s-user-profile-submit"},this.save_btn_trans))}};l.style="/*!twlt*/:host{display:block}.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-user-profile-wrapper{display:grid;grid-template-columns:repeat(1, minmax(0, 1fr));gap:1.5rem}@media (min-width: 640px){.s-user-profile-wrapper{grid-template-columns:repeat(2, minmax(0, 1fr));gap:2rem}}.s-user-profile-field-label{margin-bottom:0.5rem;display:block;font-size:0.875rem;line-height:1.25rem;font-weight:700;--tw-text-opacity:1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.s-user-profile-field-error{--tw-text-opacity:1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.s-user-profile-submit{margin-top:1.5rem;width:100%}.s-user-profile-filepond-placeholder{display:flex;flex-direction:column;align-items:center;justify-content:center}.s-user-profile-filepond-placeholder-icon{margin-bottom:0.25rem}.s-user-profile-filepond-placeholder-icon svg{height:1.5rem;width:1.5rem;fill:#7c8082}.s-user-profile-skeleton-wrapper{display:grid;grid-template-columns:repeat(2, minmax(0, 1fr));grid-template-rows:repeat(3, minmax(0, 1fr));gap:3rem}";export{l as salla_user_profile}
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r as t,h as e,H as r}from"./p-5UtJVEzd.js";const i=class{constructor(e){t(this,e),this.parsedSections=[]}parseProducts(t){let e=[];if("string"==typeof t)try{const r=JSON.parse(t);e=this.extractSections(r)}catch(r){console.error("Invalid JSON passed to bundleSections prop:",t),e=[]}else t&&(e=this.extractSections(t));this.parsedSections=e}extractSections(t){return t.bundle&&t.bundle.sections&&Array.isArray(t.bundle.sections)?t.bundle.sections:Array.isArray(t)?t:t.sections&&Array.isArray(t.sections)?t.sections:(console.warn("No valid sections found in data:",t),[])}isCartPage(){return salla.url.is_page("cart")}renderCartPage(){return e("salla-multiple-bundle-product-cart",{sections:this.parsedSections})}renderDetailsPage(){return e("salla-multiple-bundle-product-details",{sections:this.parsedSections})}componentWillLoad(){this.parseProducts(this.bundleSections)}render(){return e(r,{key:"db7efe81ce29dd1bc45cc5f1dbd45b6b03e31de8",class:"s-multiple-bundle-product-wrapper"},this.isCartPage()?this.renderCartPage():this.renderDetailsPage())}static get watchers(){return{bundleSections:["parseProducts"]}}};i.style="/*!twlt*/:host{display:block}.visible{visibility:visible}.hidden{display:none}.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)}.outline{outline-style:solid}.btn{display:inline-flex;flex:1 1 0%;align-items:center;justify-content:center;white-space:nowrap;border-radius:0.375rem;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}.btn:hover{opacity:0.8}.s-multiple-bundle-product-wrapper{margin-bottom:1.25rem;display:block}.s-multiple-bundle-product-wrapper-sections{display:flex;flex-direction:column;gap:1rem}.s-multiple-bundle-product-wrapper-slider .swiper{display:block !important}.s-multiple-bundle-product-wrapper-slider .swiper-pagination{position:static}.s-multiple-bundle-product-wrapper-slider .swiper-pagination .swiper-pagination-bullet{height:8px;width:8px}.s-multiple-bundle-product-slide-one-third{height:auto;width:100% !important}@media (min-width: 640px){.s-multiple-bundle-product-slide-one-third{width:100% !important}}@media (min-width: 768px){.s-multiple-bundle-product-slide-one-third{width:50% !important}}@media (min-width: 1024px){.s-multiple-bundle-product-slide-one-third{width:35.7% !important}}.s-multiple-bundle-product-slide-one-third-disabled{pointer-events:none;cursor:not-allowed}.s-multiple-bundle-product-slide-one-third-disabled .s-multiple-bundle-product-image-wrapper{opacity:0.5}.s-multiple-bundle-product-slide-one-third-disabled .s-multiple-bundle-product-button{--tw-text-opacity:1;color:rgb(229 231 235 / var(--tw-text-opacity, 1))}.s-multiple-bundle-product-card{position:relative;display:flex;height:100%;width:100%;flex-direction:column;overflow:hidden;border-radius:0.5rem;border-width:1px;border-style:solid;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1))}.s-multiple-bundle-product-checkbox{position:absolute;top:0.25rem;right:0.5rem;height:1rem;width:1rem;border-radius:var(--s-radius, 0.25rem);--tw-border-opacity:1;border-color:rgb(209 213 219 / var(--tw-border-opacity, 1));accent-color:#16a34a}.s-multiple-bundle-product-image-wrapper{display:flex;height:200px;justify-content:center}.s-multiple-bundle-product-image{width:100%;object-fit:cover}.s-multiple-bundle-product-content-wrapper{padding:0.5rem;line-height:1rem}.s-multiple-bundle-product-content{display:flex;align-items:flex-start;justify-content:space-between;gap:0.5rem}.s-multiple-bundle-product-details{display:flex;flex-direction:column}.s-multiple-bundle-product-title-wrapper{flex:1 1 0%}.s-multiple-bundle-product-title{font-size:9px;font-weight:500;line-height:1rem;--tw-text-opacity:1;color:rgb(29 78 216 / var(--tw-text-opacity, 1))}.s-multiple-bundle-product-price-wrapper{display:flex;align-items:center;gap:0.25rem}.s-multiple-bundle-product-price{font-size:9px;font-weight:700;--tw-text-opacity:1;color:rgb(31 41 55 / var(--tw-text-opacity, 1))}.s-multiple-bundle-product-price-discount{margin-left:0.5rem;font-size:8px;--tw-text-opacity:1;color:rgb(107 114 128 / var(--tw-text-opacity, 1));text-decoration-line:line-through}.s-multiple-bundle-product-button{display:flex;align-items:center;gap:0.25rem;border-radius:0.5rem;border-width:0px;text-align:start;font-size:10px;font-weight:700;--tw-text-opacity:1;color:rgb(22 163 74 / var(--tw-text-opacity, 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:150ms}.s-multiple-bundle-product-button:hover{--tw-text-opacity:1;color:rgb(59 130 246 / var(--tw-text-opacity, 1))}.s-multiple-bundle-product-button-icon{font-size:10px;font-weight:700}.s-multiple-bundle-product-button-icon svg{height:1rem;width:1rem;fill:#16a34a}.s-multiple-bundle-product-button-disabled-icon{pointer-events:none;opacity:0.5}.s-multiple-bundle-product-badge{display:flex;flex-shrink:0;align-items:center;gap:0.25rem;border-radius:9999px;--tw-bg-opacity:1;background-color:rgb(229 231 235 / var(--tw-bg-opacity, 1));padding-left:0.5rem;padding-right:0.5rem;font-size:7px;--tw-text-opacity:1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.s-multiple-bundle-product-options-modal-footer{display:flex;justify-content:flex-end}.s-multiple-bundle-product-options-modal-slider{margin-top:1.25rem;display:flex;gap:1.25rem}.s-multiple-bundle-product-options-modal-slider .s-slider-container .swiper-slide{display:flex;align-items:center;justify-content:center}.s-multiple-bundle-product-options-modal-slider .s-slider-thumbs{margin-top:0px !important}.s-multiple-bundle-product-options-modal-slider .s-slider-thumbs-container{position:static;margin:0px !important;width:40px !important;transform:none !important;padding-left:0px !important;padding-right:0px !important;padding-top:0.5rem !important;padding-bottom:0.5rem !important}.s-multiple-bundle-product-options-modal-slider .s-slider-thumbs-container .swiper-slide{margin-top:0px !important;display:flex !important;height:40px !important;width:100%;align-items:center;justify-content:center;padding:0.25rem}.s-multiple-bundle-product-cart-header-wrapper{width:100%}.s-multiple-bundle-product-cart-header{display:flex;align-items:center;gap:1rem}.s-multiple-bundle-product-cart-header-no-options{justify-content:space-between}.s-multiple-bundle-product-cart-header-content{display:flex;align-items:center;gap:1rem}.s-multiple-bundle-product-cart-header-remove-button{display:flex;align-items:center;gap:0.25rem}.s-multiple-bundle-product-cart-body-remove-button{display:flex;align-items:center;justify-content:flex-end;gap:0.25rem}.s-multiple-bundle-product-cart-header-image-wrapper{position:relative;flex-shrink:0;overflow:hidden}.s-multiple-bundle-product-cart-header-image{height:4rem;width:4rem;flex:none;border-radius:0.375rem;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(243 244 246 / var(--tw-bg-opacity, 1));object-fit:cover;object-position:center}.s-multiple-bundle-product-cart-header-content-details>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(0.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(0.25rem * var(--tw-space-y-reverse))}.s-multiple-bundle-product-cart-header-content-details-title{font-size:1rem;font-weight:500;line-height:1.5rem;--tw-text-opacity:1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.s-multiple-bundle-product-cart-header-content-details-price{display:flex;align-items:center;gap:0.25rem}.s-multiple-bundle-product-cart-header-content-details-price-regular{font-size:0.75rem;line-height:1rem;font-weight:700;--tw-text-opacity:1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.s-multiple-bundle-product-cart-header-content-details-price-sale{font-size:0.75rem;line-height:1rem;--tw-text-opacity:1;color:rgb(107 114 128 / var(--tw-text-opacity, 1));text-decoration-line:line-through}.s-multiple-bundle-product-cart-header-content-details-quantity{display:flex;align-items:center;gap:0.25rem;font-size:0.75rem;line-height:1rem;--tw-text-opacity:1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.s-multiple-bundle-product-cart-header-content-details-title-link{font-size:1rem;line-height:1.5rem;font-weight:500}.s-multiple-bundle-product-options-modal-slider-thumb{height:100%;width:100%;overflow:hidden;border-radius:0.375rem;--tw-bg-opacity:1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1));object-fit:cover}";export{i as salla_multiple_bundle_product}
4
+ import{r as t,h as e,H as r}from"./p-DaGqpYdk.js";const i=class{constructor(e){t(this,e),this.parsedSections=[]}parseProducts(t){let e=[];if("string"==typeof t)try{const r=JSON.parse(t);e=this.extractSections(r)}catch(r){console.error("Invalid JSON passed to bundleSections prop:",t),e=[]}else t&&(e=this.extractSections(t));this.parsedSections=e}extractSections(t){return t.bundle&&t.bundle.sections&&Array.isArray(t.bundle.sections)?t.bundle.sections:Array.isArray(t)?t:t.sections&&Array.isArray(t.sections)?t.sections:(console.warn("No valid sections found in data:",t),[])}isCartPage(){return salla.url.is_page("cart")}renderCartPage(){return e("salla-multiple-bundle-product-cart",{sections:this.parsedSections})}renderDetailsPage(){return e("salla-multiple-bundle-product-details",{sections:this.parsedSections})}componentWillLoad(){this.parseProducts(this.bundleSections)}render(){return e(r,{key:"db7efe81ce29dd1bc45cc5f1dbd45b6b03e31de8",class:"s-multiple-bundle-product-wrapper"},this.isCartPage()?this.renderCartPage():this.renderDetailsPage())}static get watchers(){return{bundleSections:["parseProducts"]}}};i.style="/*!twlt*/:host{display:block}.visible{visibility:visible}.hidden{display:none}.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)}.outline{outline-style:solid}.btn{display:inline-flex;flex:1 1 0%;align-items:center;justify-content:center;white-space:nowrap;border-radius:0.375rem;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}.btn:hover{opacity:0.8}.s-multiple-bundle-product-wrapper{margin-bottom:1.25rem;display:block}.s-multiple-bundle-product-wrapper-sections{display:flex;flex-direction:column;gap:1rem}.s-multiple-bundle-product-wrapper-slider .swiper{display:block !important}.s-multiple-bundle-product-wrapper-slider .swiper-pagination{position:static}.s-multiple-bundle-product-wrapper-slider .swiper-pagination .swiper-pagination-bullet{height:8px;width:8px}.s-multiple-bundle-product-slide-one-third{height:auto;width:100% !important}@media (min-width: 640px){.s-multiple-bundle-product-slide-one-third{width:100% !important}}@media (min-width: 768px){.s-multiple-bundle-product-slide-one-third{width:50% !important}}@media (min-width: 1024px){.s-multiple-bundle-product-slide-one-third{width:35.7% !important}}.s-multiple-bundle-product-slide-one-third-disabled{pointer-events:none;cursor:not-allowed}.s-multiple-bundle-product-slide-one-third-disabled .s-multiple-bundle-product-image-wrapper{opacity:0.5}.s-multiple-bundle-product-slide-one-third-disabled .s-multiple-bundle-product-button{--tw-text-opacity:1;color:rgb(229 231 235 / var(--tw-text-opacity, 1))}.s-multiple-bundle-product-card{position:relative;display:flex;height:100%;width:100%;flex-direction:column;overflow:hidden;border-radius:0.5rem;border-width:1px;border-style:solid;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1))}.s-multiple-bundle-product-checkbox{position:absolute;top:0.25rem;right:0.5rem;height:1rem;width:1rem;border-radius:var(--s-radius, 0.25rem);--tw-border-opacity:1;border-color:rgb(209 213 219 / var(--tw-border-opacity, 1));accent-color:#16a34a}.s-multiple-bundle-product-image-wrapper{display:flex;height:200px;justify-content:center}.s-multiple-bundle-product-image{width:100%;object-fit:cover}.s-multiple-bundle-product-content-wrapper{padding:0.5rem;line-height:1rem}.s-multiple-bundle-product-content{display:flex;align-items:flex-start;justify-content:space-between;gap:0.5rem}.s-multiple-bundle-product-details{display:flex;flex-direction:column}.s-multiple-bundle-product-title-wrapper{flex:1 1 0%}.s-multiple-bundle-product-title{font-size:9px;font-weight:500;line-height:1rem;--tw-text-opacity:1;color:rgb(29 78 216 / var(--tw-text-opacity, 1))}.s-multiple-bundle-product-price-wrapper{display:flex;align-items:center;gap:0.25rem}.s-multiple-bundle-product-price{font-size:9px;font-weight:700;--tw-text-opacity:1;color:rgb(31 41 55 / var(--tw-text-opacity, 1))}.s-multiple-bundle-product-price-discount{margin-left:0.5rem;font-size:8px;--tw-text-opacity:1;color:rgb(107 114 128 / var(--tw-text-opacity, 1));text-decoration-line:line-through}.s-multiple-bundle-product-button{display:flex;align-items:center;gap:0.25rem;border-radius:0.5rem;border-width:0px;text-align:start;font-size:10px;font-weight:700;--tw-text-opacity:1;color:rgb(22 163 74 / var(--tw-text-opacity, 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:150ms}.s-multiple-bundle-product-button:hover{--tw-text-opacity:1;color:rgb(59 130 246 / var(--tw-text-opacity, 1))}.s-multiple-bundle-product-button-icon{font-size:10px;font-weight:700}.s-multiple-bundle-product-button-icon svg{height:1rem;width:1rem;fill:#16a34a}.s-multiple-bundle-product-button-disabled-icon{pointer-events:none;opacity:0.5}.s-multiple-bundle-product-badge{display:flex;flex-shrink:0;align-items:center;gap:0.25rem;border-radius:9999px;--tw-bg-opacity:1;background-color:rgb(229 231 235 / var(--tw-bg-opacity, 1));padding-left:0.5rem;padding-right:0.5rem;font-size:7px;--tw-text-opacity:1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.s-multiple-bundle-product-options-modal-footer{display:flex;justify-content:flex-end}.s-multiple-bundle-product-options-modal-slider{margin-top:1.25rem;display:flex;gap:1.25rem}.s-multiple-bundle-product-options-modal-slider .s-slider-container .swiper-slide{display:flex;align-items:center;justify-content:center}.s-multiple-bundle-product-options-modal-slider .s-slider-thumbs{margin-top:0px !important}.s-multiple-bundle-product-options-modal-slider .s-slider-thumbs-container{position:static;margin:0px !important;width:40px !important;transform:none !important;padding-left:0px !important;padding-right:0px !important;padding-top:0.5rem !important;padding-bottom:0.5rem !important}.s-multiple-bundle-product-options-modal-slider .s-slider-thumbs-container .swiper-slide{margin-top:0px !important;display:flex !important;height:40px !important;width:100%;align-items:center;justify-content:center;padding:0.25rem}.s-multiple-bundle-product-cart-header-wrapper{width:100%}.s-multiple-bundle-product-cart-header{display:flex;align-items:center;gap:1rem}.s-multiple-bundle-product-cart-header-no-options{justify-content:space-between}.s-multiple-bundle-product-cart-header-content{display:flex;align-items:center;gap:1rem}.s-multiple-bundle-product-cart-header-remove-button{display:flex;align-items:center;gap:0.25rem}.s-multiple-bundle-product-cart-body-remove-button{display:flex;align-items:center;justify-content:flex-end;gap:0.25rem}.s-multiple-bundle-product-cart-header-image-wrapper{position:relative;flex-shrink:0;overflow:hidden}.s-multiple-bundle-product-cart-header-image{height:4rem;width:4rem;flex:none;border-radius:0.375rem;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(243 244 246 / var(--tw-bg-opacity, 1));object-fit:cover;object-position:center}.s-multiple-bundle-product-cart-header-content-details>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(0.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(0.25rem * var(--tw-space-y-reverse))}.s-multiple-bundle-product-cart-header-content-details-title{font-size:1rem;font-weight:500;line-height:1.5rem;--tw-text-opacity:1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.s-multiple-bundle-product-cart-header-content-details-price{display:flex;align-items:center;gap:0.25rem}.s-multiple-bundle-product-cart-header-content-details-price-regular{font-size:0.75rem;line-height:1rem;font-weight:700;--tw-text-opacity:1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.s-multiple-bundle-product-cart-header-content-details-price-sale{font-size:0.75rem;line-height:1rem;--tw-text-opacity:1;color:rgb(107 114 128 / var(--tw-text-opacity, 1));text-decoration-line:line-through}.s-multiple-bundle-product-cart-header-content-details-quantity{display:flex;align-items:center;gap:0.25rem;font-size:0.75rem;line-height:1rem;--tw-text-opacity:1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.s-multiple-bundle-product-cart-header-content-details-title-link{font-size:1rem;line-height:1.5rem;font-weight:500}.s-multiple-bundle-product-options-modal-slider-thumb{height:100%;width:100%;overflow:hidden;border-radius:0.375rem;--tw-bg-opacity:1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1));object-fit:cover}";export{i as salla_multiple_bundle_product}
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r as a,h as t,H as s,a as e}from"./p-5UtJVEzd.js";const r=class{constructor(t){a(this,t),this.cashbackData=void 0,this.productId=null,this.handlePriceUpdated=(a,t)=>{if(String(t)!==String(this.productId))return;const s=a?.data?.cashback;void 0!==s&&(this.cashbackData=s)}}async componentWillLoad(){try{if(this.productId=this.host.dataset.productId||salla.config.get("page.id"),this.productId&&salla.event.on("product::price.updated",this.handlePriceUpdated),await salla.onReady(),await salla.lang.onLoaded(),!this.productId)return;const a=await salla.api.request(`/products/${this.productId}/cashback-offer`).catch((()=>null));void 0===this.cashbackData&&(this.cashbackData=a?.data??null)}catch(a){salla?.logger?.warn?.("salla-cashback-banner: init failed",a)}}disconnectedCallback(){salla.event.off("product::price.updated",this.handlePriceUpdated)}getPaymentMethodsText(a=[]){return a.map((a=>String(a||"").trim())).filter(Boolean).map((a=>salla.lang.get(`pages.checkout.${a}`)||a)).join(", ")}getCashbackMessage(){const a=this.cashbackData?.payment_method_restrictions?.included??[];return a.length?salla.lang.get("pages.loyalty_program.cashback_when_buying_product_payment_method",{payment_method:this.getPaymentMethodsText(a)}):salla.lang.get("pages.loyalty_program.cashback_when_buying_product")}render(){const a=this.cashbackData;if(!this.productId||!a||!Number(a.amount))return null;const e=a.amount,r=a.currency,n=this.getCashbackMessage(),i=a.offer_type;return t(s,null,t("div",{class:"s-cashback-banner-container"},t("div",{class:"s-cashback-banner-icon"},t("span",{class:"s-cashback-banner-inner-icon",innerHTML:'<svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg">\n<g clip-path="url(#clip0_5667_2008)">\n<path d="M9.00003 0.935974C9.37203 0.935974 9.72003 1.06797 10.044 1.33197C10.344 1.57197 10.596 1.90797 10.8 2.33997L12.114 5.00397C12.174 5.09997 12.27 5.19897 12.402 5.30097C12.534 5.40297 12.66 5.46597 12.78 5.48997L15.174 5.88597C15.618 5.95797 15.996 6.10197 16.308 6.31797C16.644 6.54597 16.869 6.83697 16.983 7.19097C17.097 7.54497 17.082 7.91397 16.938 8.29797C16.806 8.64597 16.578 8.98797 16.254 9.32397L14.4 11.196C14.316 11.28 14.247 11.409 14.193 11.583C14.139 11.757 14.13 11.91 14.166 12.042L14.688 14.364C14.808 14.88 14.832 15.342 14.76 15.75C14.676 16.206 14.475 16.551 14.157 16.785C13.839 17.019 13.452 17.106 12.996 17.046C12.588 16.998 12.156 16.836 11.7 16.56L9.45003 15.21C9.34203 15.15 9.19203 15.12 9.00003 15.12C8.80803 15.12 8.65803 15.15 8.55003 15.21L6.30003 16.56C5.84403 16.836 5.41203 16.998 5.00403 17.046C4.54803 17.106 4.16103 17.016 3.84303 16.776C3.52503 16.536 3.32403 16.194 3.24003 15.75C3.16803 15.342 3.19203 14.88 3.31203 14.364L3.83403 12.042C3.85803 11.91 3.84603 11.757 3.79803 11.583C3.75003 11.409 3.68403 11.28 3.60003 11.196L1.74603 9.32397C1.41003 8.98797 1.18203 8.64597 1.06203 8.29797C0.918027 7.91397 0.900027 7.54497 1.00803 7.19097C1.11603 6.83697 1.34403 6.54597 1.69203 6.31797C1.99203 6.10197 2.37003 5.95797 2.82603 5.88597L5.22003 5.48997C5.32803 5.46597 5.45103 5.40297 5.58903 5.30097C5.72703 5.19897 5.82003 5.09997 5.86803 5.00397L7.18203 2.33997C7.39803 1.90797 7.65603 1.57197 7.95603 1.33197C8.28003 1.06797 8.62803 0.935974 9.00003 0.935974Z" fill="white"/>\n</g>\n<defs>\n<clipPath id="clip0_5667_2008">\n<rect width="18" height="18" fill="white"/>\n</clipPath>\n</defs>\n</svg>\n'})),t("p",null,t("span",{class:"s-cashback-banner-label"},salla.lang.get("pages.loyalty_program.earn")," "),t("span",{class:"s-cashback-banner-value"},"percentage"===i?"+":"",e," ",["SAR","ر.س"].includes(r)?t("i",{class:"sicon-sar"}):r," "),t("span",{class:"s-cashback-banner-label"},n))))}get host(){return e(this)}};r.style="/*!twlt*/.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-cashback-banner-container{margin-bottom:0.75rem;display:flex;width:100%;align-items:center;gap:0.5rem;border-radius:0.5rem;background-color:rgb(46 16 101 / 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-cashback-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(46 16 101 / var(--tw-bg-opacity, 1))}.s-cashback-banner-label{font-size:0.875rem;line-height:1.25rem}.s-cashback-banner-value{font-size:0.875rem;line-height:1.25rem;font-weight:700;--tw-text-opacity:1;color:rgb(46 16 101 / var(--tw-text-opacity, 1))}";export{r as salla_cashback_banner}
4
+ import{r as a,h as t,H as s,a as e}from"./p-DaGqpYdk.js";const r=class{constructor(t){a(this,t),this.cashbackData=void 0,this.productId=null,this.handlePriceUpdated=(a,t)=>{if(String(t)!==String(this.productId))return;const s=a?.data?.cashback;void 0!==s&&(this.cashbackData=s)}}async componentWillLoad(){try{if(this.productId=this.host.dataset.productId||salla.config.get("page.id"),this.productId&&salla.event.on("product::price.updated",this.handlePriceUpdated),await salla.onReady(),await salla.lang.onLoaded(),!this.productId)return;const a=await salla.api.request(`/products/${this.productId}/cashback-offer`).catch((()=>null));void 0===this.cashbackData&&(this.cashbackData=a?.data??null)}catch(a){salla?.logger?.warn?.("salla-cashback-banner: init failed",a)}}disconnectedCallback(){salla.event.off("product::price.updated",this.handlePriceUpdated)}getPaymentMethodsText(a=[]){return a.map((a=>String(a||"").trim())).filter(Boolean).map((a=>salla.lang.get(`pages.checkout.${a}`)||a)).join(", ")}getCashbackMessage(){const a=this.cashbackData?.payment_method_restrictions?.included??[];return a.length?salla.lang.get("pages.loyalty_program.cashback_when_buying_product_payment_method",{payment_method:this.getPaymentMethodsText(a)}):salla.lang.get("pages.loyalty_program.cashback_when_buying_product")}render(){const a=this.cashbackData;if(!this.productId||!a||!Number(a.amount))return null;const e=a.amount,r=a.currency,n=this.getCashbackMessage(),i=a.offer_type;return t(s,null,t("div",{class:"s-cashback-banner-container"},t("div",{class:"s-cashback-banner-icon"},t("span",{class:"s-cashback-banner-inner-icon",innerHTML:'<svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg">\n<g clip-path="url(#clip0_5667_2008)">\n<path d="M9.00003 0.935974C9.37203 0.935974 9.72003 1.06797 10.044 1.33197C10.344 1.57197 10.596 1.90797 10.8 2.33997L12.114 5.00397C12.174 5.09997 12.27 5.19897 12.402 5.30097C12.534 5.40297 12.66 5.46597 12.78 5.48997L15.174 5.88597C15.618 5.95797 15.996 6.10197 16.308 6.31797C16.644 6.54597 16.869 6.83697 16.983 7.19097C17.097 7.54497 17.082 7.91397 16.938 8.29797C16.806 8.64597 16.578 8.98797 16.254 9.32397L14.4 11.196C14.316 11.28 14.247 11.409 14.193 11.583C14.139 11.757 14.13 11.91 14.166 12.042L14.688 14.364C14.808 14.88 14.832 15.342 14.76 15.75C14.676 16.206 14.475 16.551 14.157 16.785C13.839 17.019 13.452 17.106 12.996 17.046C12.588 16.998 12.156 16.836 11.7 16.56L9.45003 15.21C9.34203 15.15 9.19203 15.12 9.00003 15.12C8.80803 15.12 8.65803 15.15 8.55003 15.21L6.30003 16.56C5.84403 16.836 5.41203 16.998 5.00403 17.046C4.54803 17.106 4.16103 17.016 3.84303 16.776C3.52503 16.536 3.32403 16.194 3.24003 15.75C3.16803 15.342 3.19203 14.88 3.31203 14.364L3.83403 12.042C3.85803 11.91 3.84603 11.757 3.79803 11.583C3.75003 11.409 3.68403 11.28 3.60003 11.196L1.74603 9.32397C1.41003 8.98797 1.18203 8.64597 1.06203 8.29797C0.918027 7.91397 0.900027 7.54497 1.00803 7.19097C1.11603 6.83697 1.34403 6.54597 1.69203 6.31797C1.99203 6.10197 2.37003 5.95797 2.82603 5.88597L5.22003 5.48997C5.32803 5.46597 5.45103 5.40297 5.58903 5.30097C5.72703 5.19897 5.82003 5.09997 5.86803 5.00397L7.18203 2.33997C7.39803 1.90797 7.65603 1.57197 7.95603 1.33197C8.28003 1.06797 8.62803 0.935974 9.00003 0.935974Z" fill="white"/>\n</g>\n<defs>\n<clipPath id="clip0_5667_2008">\n<rect width="18" height="18" fill="white"/>\n</clipPath>\n</defs>\n</svg>\n'})),t("p",null,t("span",{class:"s-cashback-banner-label"},salla.lang.get("pages.loyalty_program.earn")," "),t("span",{class:"s-cashback-banner-value"},"percentage"===i?"+":"",e," ",["SAR","ر.س"].includes(r)?t("i",{class:"sicon-sar"}):r," "),t("span",{class:"s-cashback-banner-label"},n))))}get host(){return e(this)}};r.style="/*!twlt*/.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-cashback-banner-container{margin-bottom:0.75rem;display:flex;width:100%;align-items:center;gap:0.5rem;border-radius:0.5rem;background-color:rgb(46 16 101 / 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-cashback-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(46 16 101 / var(--tw-bg-opacity, 1))}.s-cashback-banner-label{font-size:0.875rem;line-height:1.25rem}.s-cashback-banner-value{font-size:0.875rem;line-height:1.25rem;font-weight:700;--tw-text-opacity:1;color:rgb(46 16 101 / var(--tw-text-opacity, 1))}";export{r as salla_cashback_banner}