@salla.sa/twilight-components 2.14.393 → 2.14.394

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (555) hide show
  1. package/dist/cjs/{filepond-D7RVR_w_.js → filepond-C_gLbAbF.js} +1 -1
  2. package/dist/cjs/{filepond-plugin-file-poster-DTuZK2ot.js → filepond-plugin-file-poster-DXWo2FUU.js} +2 -2
  3. package/dist/cjs/{filepond-plugin-file-validate-size-DHc6pF_j.js → filepond-plugin-file-validate-size-fBXMP7ez.js} +1 -1
  4. package/dist/cjs/{filepond-plugin-file-validate-type-DnkcvJVc.js → filepond-plugin-file-validate-type-DEo7juC7.js} +1 -1
  5. package/dist/cjs/{filepond-plugin-image-edit-vrZ1s7kw.js → filepond-plugin-image-edit-4j4e1VEp.js} +1 -1
  6. package/dist/cjs/{filepond-plugin-image-exif-orientation-Bn5JSzQK.js → filepond-plugin-image-exif-orientation-DWqiXxv1.js} +1 -1
  7. package/dist/cjs/{filepond-plugin-image-preview-8qWUFe9n.js → filepond-plugin-image-preview-emT_teia.js} +1 -1
  8. package/dist/cjs/{index-C5VeFDQ0.js → index-B03mYCWz.js} +547 -780
  9. package/dist/cjs/{index-CwD81m7i.js → index-Y-2uyQDK.js} +1 -1
  10. package/dist/cjs/loader.cjs.js +3 -4
  11. package/dist/cjs/salla-accordion-body_2.cjs.entry.js +5 -5
  12. package/dist/cjs/salla-accordion_6.cjs.entry.js +15 -19
  13. package/dist/cjs/salla-add-product-button_4.cjs.entry.js +10 -12
  14. package/dist/cjs/salla-advertisement.cjs.entry.js +3 -3
  15. package/dist/cjs/salla-alert_2.cjs.entry.js +5 -5
  16. package/dist/cjs/salla-app-install-alert.cjs.entry.js +3 -3
  17. package/dist/cjs/salla-apps-icons.cjs.entry.js +3 -3
  18. package/dist/cjs/salla-booking-field_7.cjs.entry.js +23 -25
  19. package/dist/cjs/salla-bullet-delivery.cjs.entry.js +3 -3
  20. package/dist/cjs/salla-cart-coupons.cjs.entry.js +3 -3
  21. package/dist/cjs/salla-cart-item-offers_2.cjs.entry.js +5 -5
  22. package/dist/cjs/salla-comment-form_8.cjs.entry.js +17 -17
  23. package/dist/cjs/salla-conditional-offer.cjs.entry.js +3 -3
  24. package/dist/cjs/salla-contacts.cjs.entry.js +3 -3
  25. package/dist/cjs/salla-cookies-bar.cjs.entry.js +3 -3
  26. package/dist/cjs/salla-count-down.cjs.entry.js +3 -3
  27. package/dist/cjs/salla-custom-fields.cjs.entry.js +3 -3
  28. package/dist/cjs/salla-delivery-promise.cjs.entry.js +1 -1
  29. package/dist/cjs/salla-filters-widget.cjs.entry.js +3 -3
  30. package/dist/cjs/salla-filters.cjs.entry.js +3 -3
  31. package/dist/cjs/salla-fulfillment-methods.cjs.entry.js +1 -1
  32. package/dist/cjs/salla-gifting.cjs.entry.js +3 -3
  33. package/dist/cjs/salla-hook.cjs.entry.js +2 -5
  34. package/dist/cjs/salla-infinite-scroll.cjs.entry.js +3 -3
  35. package/dist/cjs/salla-installment.cjs.entry.js +3 -3
  36. package/dist/cjs/salla-list-tile.cjs.entry.js +3 -3
  37. package/dist/cjs/salla-localization-modal.cjs.entry.js +1 -1
  38. package/dist/cjs/salla-login-modal.cjs.entry.js +3 -3
  39. package/dist/cjs/salla-loyalty-prize-item.cjs.entry.js +3 -3
  40. package/dist/cjs/salla-loyalty-program.cjs.entry.js +3 -3
  41. package/dist/cjs/salla-loyalty.cjs.entry.js +3 -3
  42. package/dist/cjs/salla-maintenance-alert.cjs.entry.js +3 -3
  43. package/dist/cjs/salla-map.cjs.entry.js +3 -3
  44. package/dist/cjs/salla-menu.cjs.entry.js +3 -3
  45. package/dist/cjs/salla-metadata.cjs.entry.js +3 -3
  46. package/dist/cjs/salla-multiple-bundle-product-cart_2.cjs.entry.js +5 -5
  47. package/dist/cjs/salla-multiple-bundle-product-options-modal_2.cjs.entry.js +6 -8
  48. package/dist/cjs/salla-multiple-bundle-product.cjs.entry.js +4 -6
  49. package/dist/cjs/salla-notification-item.cjs.entry.js +3 -3
  50. package/dist/cjs/salla-notifications.cjs.entry.js +3 -3
  51. package/dist/cjs/salla-offer-modal.cjs.entry.js +3 -3
  52. package/dist/cjs/salla-offer.cjs.entry.js +3 -3
  53. package/dist/cjs/salla-order-details-multiple-bundle-product.cjs.entry.js +3 -3
  54. package/dist/cjs/salla-order-details-options.cjs.entry.js +3 -3
  55. package/dist/cjs/salla-order-details.cjs.entry.js +4 -6
  56. package/dist/cjs/salla-order-edit-item.cjs.entry.js +3 -3
  57. package/dist/cjs/salla-order-edit.cjs.entry.js +3 -3
  58. package/dist/cjs/salla-order-summary.cjs.entry.js +3 -3
  59. package/dist/cjs/salla-order-totals-card.cjs.entry.js +4 -6
  60. package/dist/cjs/salla-orders.cjs.entry.js +3 -3
  61. package/dist/cjs/salla-payments.cjs.entry.js +3 -3
  62. package/dist/cjs/salla-placeholder.cjs.entry.js +3 -3
  63. package/dist/cjs/salla-price-range.cjs.entry.js +3 -3
  64. package/dist/cjs/salla-product-card.cjs.entry.js +3 -3
  65. package/dist/cjs/salla-product-size-guide.cjs.entry.js +3 -3
  66. package/dist/cjs/salla-products-list.cjs.entry.js +3 -3
  67. package/dist/cjs/salla-products-slider.cjs.entry.js +3 -3
  68. package/dist/cjs/salla-progress-bar.cjs.entry.js +3 -3
  69. package/dist/cjs/salla-quick-order.cjs.entry.js +3 -3
  70. package/dist/cjs/salla-rating-modal.cjs.entry.js +3 -3
  71. package/dist/cjs/salla-scopes.cjs.entry.js +3 -3
  72. package/dist/cjs/salla-search.cjs.entry.js +4 -6
  73. package/dist/cjs/salla-skeleton.cjs.entry.js +3 -3
  74. package/dist/cjs/salla-slider.cjs.entry.js +3 -3
  75. package/dist/cjs/salla-social-share.cjs.entry.js +3 -3
  76. package/dist/cjs/salla-social.cjs.entry.js +3 -3
  77. package/dist/cjs/salla-tab-content_3.cjs.entry.js +7 -7
  78. package/dist/cjs/salla-tiered-offer.cjs.entry.js +3 -3
  79. package/dist/cjs/salla-tooltip.cjs.entry.js +3 -3
  80. package/dist/cjs/salla-trust-badges.cjs.entry.js +3 -3
  81. package/dist/cjs/salla-user-menu.cjs.entry.js +3 -3
  82. package/dist/cjs/salla-user-profile.cjs.entry.js +3 -3
  83. package/dist/cjs/salla-user-settings.cjs.entry.js +3 -3
  84. package/dist/cjs/salla-verify.cjs.entry.js +3 -3
  85. package/dist/cjs/salla-wallet.cjs.entry.js +3 -3
  86. package/dist/cjs/twilight.cjs.js +4 -5
  87. package/dist/cjs/{vanilla-picker-yKERbLpx.js → vanilla-picker-CKZvBtHS.js} +1 -1
  88. package/dist/collection/collection-manifest.json +2 -3
  89. package/dist/collection/components/salla-accordion/salla-accordion-head.js +2 -2
  90. package/dist/collection/components/salla-accordion/salla-accordion.js +4 -4
  91. package/dist/collection/components/salla-add-product-button/salla-add-product-button.js +19 -19
  92. package/dist/collection/components/salla-alert/salla-alert.js +5 -5
  93. package/dist/collection/components/salla-apps-icons/salla-apps-icons.js +6 -6
  94. package/dist/collection/components/salla-booking-field/salla-booking-field.js +4 -4
  95. package/dist/collection/components/salla-bottom-alert/salla-bottom-alert.js +9 -9
  96. package/dist/collection/components/salla-bullet-delivery/salla-bullet-delivery.js +3 -6
  97. package/dist/collection/components/salla-button/salla-button.js +11 -11
  98. package/dist/collection/components/salla-cart-coupons/salla-cart-coupons.js +1 -2
  99. package/dist/collection/components/salla-cart-item-offers/salla-cart-item-offers.js +8 -8
  100. package/dist/collection/components/salla-cart-summary/salla-cart-summary.js +2 -2
  101. package/dist/collection/components/salla-color-picker/salla-color-picker.js +14 -20
  102. package/dist/collection/components/salla-comment-form/salla-comment-form.js +6 -6
  103. package/dist/collection/components/salla-comments/salla-comment-item.js +3 -2
  104. package/dist/collection/components/salla-comments/salla-comments.js +17 -18
  105. package/dist/collection/components/salla-contacts/salla-contacts.js +10 -10
  106. package/dist/collection/components/salla-count-down/salla-count-down.js +34 -34
  107. package/dist/collection/components/salla-custom-fields/salla-custom-fields.js +7 -9
  108. package/dist/collection/components/salla-datetime-picker/salla-datetime-picker.js +65 -69
  109. package/dist/collection/components/salla-drawer/salla-drawer.js +11 -11
  110. package/dist/collection/components/salla-file-upload/salla-file-upload.js +84 -85
  111. package/dist/collection/components/salla-filters/salla-filters.js +2 -2
  112. package/dist/collection/components/salla-filters-widget/salla-filters-widget.js +5 -4
  113. package/dist/collection/components/salla-gifting/salla-gifting.js +11 -11
  114. package/dist/collection/components/salla-hook/salla-hook.js +2 -2
  115. package/dist/collection/components/salla-infinite-scroll/salla-infinite-scroll.js +6 -6
  116. package/dist/collection/components/salla-installment/salla-installment.js +5 -5
  117. package/dist/collection/components/salla-list-tile/salla-list-tile.js +2 -2
  118. package/dist/collection/components/salla-loading/salla-loading.js +4 -4
  119. package/dist/collection/components/salla-localization-modal/salla-localization-modal.js +5 -5
  120. package/dist/collection/components/salla-login-modal/salla-login-modal.js +14 -14
  121. package/dist/collection/components/salla-loyalty/salla-loyalty-prize-item.js +3 -4
  122. package/dist/collection/components/salla-loyalty/salla-loyalty.js +12 -13
  123. package/dist/collection/components/salla-map/salla-map.js +14 -14
  124. package/dist/collection/components/salla-menu/salla-menu.js +9 -10
  125. package/dist/collection/components/salla-metadata/salla-metadata.js +3 -3
  126. package/dist/collection/components/salla-modal/salla-modal.js +11 -11
  127. package/dist/collection/components/salla-multiple-bundle-product/components/salla-multiple-bundle-product-cart.js +2 -2
  128. package/dist/collection/components/salla-multiple-bundle-product/components/salla-multiple-bundle-product-details.js +2 -2
  129. package/dist/collection/components/salla-multiple-bundle-product/components/salla-multiple-bundle-product-options-modal.js +2 -4
  130. package/dist/collection/components/salla-multiple-bundle-product/components/salla-multiple-bundle-product-slider.js +7 -8
  131. package/dist/collection/components/salla-multiple-bundle-product/salla-multiple-bundle-product.js +2 -2
  132. package/dist/collection/components/salla-notifications/salla-notification-item.js +2 -2
  133. package/dist/collection/components/salla-notifications/salla-notifications.js +3 -3
  134. package/dist/collection/components/salla-offer/salla-offer.js +1 -1
  135. package/dist/collection/components/salla-order-details/salla-order-details-multiple-bundle-product.js +5 -5
  136. package/dist/collection/components/salla-order-details/salla-order-details-options.js +5 -6
  137. package/dist/collection/components/salla-order-details/salla-order-details.js +3 -4
  138. package/dist/collection/components/salla-order-edit/salla-order-edit-item.js +4 -4
  139. package/dist/collection/components/salla-order-edit/salla-order-edit.js +4 -4
  140. package/dist/collection/components/salla-order-summary/salla-order-summary.js +2 -2
  141. package/dist/collection/components/salla-order-totals-card/salla-order-totals-card.js +3 -4
  142. package/dist/collection/components/salla-orders/salla-orders.js +4 -4
  143. package/dist/collection/components/salla-payments/salla-payments.js +1 -0
  144. package/dist/collection/components/salla-placeholder/salla-placeholder.js +3 -3
  145. package/dist/collection/components/salla-price-range/salla-price-range.js +8 -8
  146. package/dist/collection/components/salla-product-availability/salla-product-availability.js +6 -6
  147. package/dist/collection/components/salla-product-card/salla-product-card.js +18 -18
  148. package/dist/collection/components/salla-product-options/salla-product-options.js +13 -15
  149. package/dist/collection/components/salla-products-list/salla-products-list.js +21 -20
  150. package/dist/collection/components/salla-products-slider/salla-products-slider.js +23 -22
  151. package/dist/collection/components/salla-progress-bar/salla-progress-bar.js +20 -21
  152. package/dist/collection/components/salla-quantity-input/salla-quantity-input.js +2 -2
  153. package/dist/collection/components/salla-quick-buy/salla-quick-buy.js +17 -16
  154. package/dist/collection/components/salla-quick-order/salla-quick-order.js +11 -11
  155. package/dist/collection/components/salla-rating-modal/salla-rating-modal.js +2 -2
  156. package/dist/collection/components/salla-rating-stars/salla-rating-stars.js +8 -8
  157. package/dist/collection/components/salla-review-card/salla-review-card.js +3 -3
  158. package/dist/collection/components/salla-reviews/salla-reviews.js +13 -16
  159. package/dist/collection/components/salla-reviews-summary/salla-reviews-summary.js +2 -2
  160. package/dist/collection/components/salla-scopes/salla-scopes.js +2 -2
  161. package/dist/collection/components/salla-search/salla-search.js +6 -6
  162. package/dist/collection/components/salla-skeleton/salla-skeleton.js +3 -3
  163. package/dist/collection/components/salla-slider/salla-slider.js +25 -25
  164. package/dist/collection/components/salla-social-share/salla-social-share.js +3 -3
  165. package/dist/collection/components/salla-tabs/salla-tab-content.js +2 -2
  166. package/dist/collection/components/salla-tabs/salla-tab-header.js +5 -5
  167. package/dist/collection/components/salla-tabs/salla-tabs.js +2 -2
  168. package/dist/collection/components/salla-tel-input/salla-tel-input.js +8 -9
  169. package/dist/collection/components/salla-tooltip/salla-tooltip.js +5 -5
  170. package/dist/collection/components/salla-trust-badges/salla-trust-badges.js +1 -1
  171. package/dist/collection/components/salla-user-menu/salla-user-menu.js +5 -5
  172. package/dist/collection/components/salla-user-profile/salla-user-profile.js +1 -1
  173. package/dist/collection/components/salla-verify/salla-verify.js +4 -4
  174. package/dist/components/Helper.js +432 -1
  175. package/dist/components/_commonjsHelpers.js +7 -1
  176. package/dist/components/anime.es.js +1310 -1
  177. package/dist/components/arrow-left.js +8 -1
  178. package/dist/components/axios.js +4240 -2
  179. package/dist/components/bell-ring.js +8 -1
  180. package/dist/components/camera.js +8 -1
  181. package/dist/components/cancel.js +8 -1
  182. package/dist/components/cart.js +8 -1
  183. package/dist/components/check-circle2.js +15 -1
  184. package/dist/components/check.js +8 -1
  185. package/dist/components/facebook.js +10 -1
  186. package/dist/components/filepond-plugin-file-poster.js +662 -2
  187. package/dist/components/filepond-plugin-file-validate-size.js +204 -2
  188. package/dist/components/filepond-plugin-file-validate-type.js +262 -2
  189. package/dist/components/filepond-plugin-image-edit.js +487 -2
  190. package/dist/components/filepond-plugin-image-exif-orientation.js +214 -2
  191. package/dist/components/filepond-plugin-image-preview.js +2237 -2
  192. package/dist/components/filepond.js +11286 -2
  193. package/dist/components/gift.js +8 -1
  194. package/dist/components/image.js +8 -1
  195. package/dist/components/index.d.ts +0 -2
  196. package/dist/components/index.js +8220 -1
  197. package/dist/components/index2.js +1709 -1
  198. package/dist/components/index3.js +2550 -1
  199. package/dist/components/interfaces.js +12 -1
  200. package/dist/components/isObject.js +292 -1
  201. package/dist/components/keyboard_arrow_down.js +8 -1
  202. package/dist/components/keyboard_arrow_right.js +15 -1
  203. package/dist/components/location.js +11 -1
  204. package/dist/components/mail.js +8 -1
  205. package/dist/components/minus.js +15 -1
  206. package/dist/components/salla-accordion-body.js +6 -1
  207. package/dist/components/salla-accordion-body2.js +30 -1
  208. package/dist/components/salla-accordion-head.js +6 -1
  209. package/dist/components/salla-accordion-head2.js +63 -1
  210. package/dist/components/salla-accordion.js +6 -1
  211. package/dist/components/salla-accordion2.js +68 -1
  212. package/dist/components/salla-add-product-button.js +6 -1
  213. package/dist/components/salla-add-product-button2.js +306 -1
  214. package/dist/components/salla-advertisement.js +155 -1
  215. package/dist/components/salla-alert.js +59 -1
  216. package/dist/components/salla-app-install-alert.js +91 -1
  217. package/dist/components/salla-apps-icons.js +63 -1
  218. package/dist/components/salla-booking-field.js +6 -1
  219. package/dist/components/salla-booking-field2.js +221 -1
  220. package/dist/components/salla-bottom-alert.js +214 -1
  221. package/dist/components/salla-breadcrumb.js +226 -1
  222. package/dist/components/salla-bullet-delivery.js +2114 -1
  223. package/dist/components/salla-button.js +6 -1
  224. package/dist/components/salla-button2.js +174 -1
  225. package/dist/components/salla-cart-coupons.js +284 -1
  226. package/dist/components/salla-cart-item-offers.js +143 -1
  227. package/dist/components/salla-cart-summary.js +136 -1
  228. package/dist/components/salla-color-picker.js +6 -1
  229. package/dist/components/salla-color-picker2.js +260 -1
  230. package/dist/components/salla-comment-form.js +6 -1
  231. package/dist/components/salla-comment-form2.js +64 -1
  232. package/dist/components/salla-comment-item.js +6 -1
  233. package/dist/components/salla-comment-item2.js +217 -1
  234. package/dist/components/salla-comments.js +395 -1
  235. package/dist/components/salla-conditional-fields.js +6 -1
  236. package/dist/components/salla-conditional-fields2.js +137 -1
  237. package/dist/components/salla-conditional-offer.js +194 -1
  238. package/dist/components/salla-contacts.js +125 -1
  239. package/dist/components/salla-cookies-bar.js +107 -1
  240. package/dist/components/salla-count-down.js +6 -1
  241. package/dist/components/salla-count-down2.js +271 -1
  242. package/dist/components/salla-custom-fields.js +175 -1
  243. package/dist/components/salla-datetime-picker.js +6 -1
  244. package/dist/components/salla-datetime-picker2.js +342 -1
  245. package/dist/components/salla-delivery-promise.js +263 -1
  246. package/dist/components/salla-drawer.js +6 -1
  247. package/dist/components/salla-drawer2.js +214 -1
  248. package/dist/components/salla-file-upload.js +6 -1
  249. package/dist/components/salla-file-upload2.js +583 -1
  250. package/dist/components/salla-filters-widget.js +6 -1
  251. package/dist/components/salla-filters-widget2.js +245 -1
  252. package/dist/components/salla-filters.js +253 -1
  253. package/dist/components/salla-fulfillment-methods.js +61 -1
  254. package/dist/components/salla-gifting.js +732 -1
  255. package/dist/components/salla-hook.js +47 -1
  256. package/dist/components/salla-infinite-scroll.js +112 -1
  257. package/dist/components/salla-installment.js +306 -1
  258. package/dist/components/salla-list-tile.js +6 -1
  259. package/dist/components/salla-list-tile2.js +47 -1
  260. package/dist/components/salla-loading.js +6 -1
  261. package/dist/components/salla-loading2.js +51 -1
  262. package/dist/components/salla-localization-modal.js +296 -1
  263. package/dist/components/salla-login-modal.js +6 -1
  264. package/dist/components/salla-login-modal2.js +359 -1
  265. package/dist/components/salla-loyalty-prize-item.js +39 -1
  266. package/dist/components/salla-loyalty-program.js +115 -1
  267. package/dist/components/salla-loyalty.js +304 -1
  268. package/dist/components/salla-maintenance-alert.js +57 -1
  269. package/dist/components/salla-map.js +6 -1
  270. package/dist/components/salla-map2.js +766 -1
  271. package/dist/components/salla-menu.js +165 -1
  272. package/dist/components/salla-metadata.js +97 -1
  273. package/dist/components/salla-modal.js +6 -1
  274. package/dist/components/salla-modal2.js +215 -1
  275. package/dist/components/salla-multiple-bundle-product-cart.js +6 -1
  276. package/dist/components/salla-multiple-bundle-product-cart2.js +151 -1
  277. package/dist/components/salla-multiple-bundle-product-details.js +6 -1
  278. package/dist/components/salla-multiple-bundle-product-details2.js +296 -1
  279. package/dist/components/salla-multiple-bundle-product-options-modal.js +6 -1
  280. package/dist/components/salla-multiple-bundle-product-options-modal2.js +598 -1
  281. package/dist/components/salla-multiple-bundle-product-slider.js +6 -1
  282. package/dist/components/salla-multiple-bundle-product-slider2.js +136 -1
  283. package/dist/components/salla-multiple-bundle-product.js +207 -1
  284. package/dist/components/salla-notification-item.js +6 -1
  285. package/dist/components/salla-notification-item2.js +32 -1
  286. package/dist/components/salla-notifications.js +190 -1
  287. package/dist/components/salla-offer-modal.js +328 -1
  288. package/dist/components/salla-offer.js +478 -1
  289. package/dist/components/salla-order-details-multiple-bundle-product.js +6 -1
  290. package/dist/components/salla-order-details-multiple-bundle-product2.js +122 -1
  291. package/dist/components/salla-order-details-options.js +6 -1
  292. package/dist/components/salla-order-details-options2.js +140 -1
  293. package/dist/components/salla-order-details.js +122 -1
  294. package/dist/components/salla-order-edit-item.js +6 -1
  295. package/dist/components/salla-order-edit-item2.js +181 -1
  296. package/dist/components/salla-order-edit.js +288 -1
  297. package/dist/components/salla-order-summary.js +132 -1
  298. package/dist/components/salla-order-totals-card.js +87 -1
  299. package/dist/components/salla-orders.js +271 -1
  300. package/dist/components/salla-payments.js +76 -1
  301. package/dist/components/salla-placeholder.js +6 -1
  302. package/dist/components/salla-placeholder2.js +66 -1
  303. package/dist/components/salla-price-range.js +6 -1
  304. package/dist/components/salla-price-range2.js +204 -1
  305. package/dist/components/salla-product-availability.js +6 -1
  306. package/dist/components/salla-product-availability2.js +206 -1
  307. package/dist/components/salla-product-card.js +6 -1
  308. package/dist/components/salla-product-card2.js +241 -1
  309. package/dist/components/salla-product-options.js +6 -1
  310. package/dist/components/salla-product-options2.js +962 -1
  311. package/dist/components/salla-product-size-guide.js +130 -1
  312. package/dist/components/salla-products-list.js +6 -1
  313. package/dist/components/salla-products-list2.js +812 -1
  314. package/dist/components/salla-products-slider.js +6 -1
  315. package/dist/components/salla-products-slider2.js +215 -1
  316. package/dist/components/salla-progress-bar.js +6 -1
  317. package/dist/components/salla-progress-bar2.js +94 -1
  318. package/dist/components/salla-quantity-input.js +6 -1
  319. package/dist/components/salla-quantity-input2.js +127 -1
  320. package/dist/components/salla-quick-buy.js +6 -1
  321. package/dist/components/salla-quick-buy2.js +1181 -1
  322. package/dist/components/salla-quick-order.js +299 -1
  323. package/dist/components/salla-rating-modal.js +530 -1
  324. package/dist/components/salla-rating-stars.js +6 -1
  325. package/dist/components/salla-rating-stars2.js +162 -1
  326. package/dist/components/salla-review-card.js +6 -1
  327. package/dist/components/salla-review-card2.js +198 -1
  328. package/dist/components/salla-reviews-page.js +726 -1
  329. package/dist/components/salla-reviews-summary.js +6 -1
  330. package/dist/components/salla-reviews-summary2.js +132 -1
  331. package/dist/components/salla-reviews.js +143 -1
  332. package/dist/components/salla-scopes.js +249 -1
  333. package/dist/components/salla-search.js +213 -1
  334. package/dist/components/salla-skeleton.js +6 -1
  335. package/dist/components/salla-skeleton2.js +50 -1
  336. package/dist/components/salla-slider.js +6 -1
  337. package/dist/components/salla-slider2.js +10489 -1
  338. package/dist/components/salla-social-share.js +194 -1
  339. package/dist/components/salla-social.js +89 -1
  340. package/dist/components/salla-tab-content.js +6 -1
  341. package/dist/components/salla-tab-content2.js +55 -1
  342. package/dist/components/salla-tab-header.js +6 -1
  343. package/dist/components/salla-tab-header2.js +85 -1
  344. package/dist/components/salla-tabs.js +6 -1
  345. package/dist/components/salla-tabs2.js +75 -1
  346. package/dist/components/salla-tel-input.js +6 -1
  347. package/dist/components/salla-tel-input2.js +168 -1
  348. package/dist/components/salla-tiered-offer.js +366 -1
  349. package/dist/components/salla-tooltip.js +6 -1
  350. package/dist/components/salla-tooltip2.js +57 -1
  351. package/dist/components/salla-trust-badges.js +90 -1
  352. package/dist/components/salla-user-menu.js +344 -1
  353. package/dist/components/salla-user-profile.js +203 -1
  354. package/dist/components/salla-user-settings.js +139 -1
  355. package/dist/components/salla-verify.js +303 -1
  356. package/dist/components/salla-wallet.js +114 -1
  357. package/dist/components/search.js +8 -1
  358. package/dist/components/shopping-bag.js +8 -1
  359. package/dist/components/special-discount.js +8 -1
  360. package/dist/components/star.js +8 -1
  361. package/dist/components/star2.js +8 -1
  362. package/dist/components/vanilla-picker.js +1034 -2
  363. package/dist/components/whatsapp2.js +8 -1
  364. package/dist/esm/{filepond-DlGaLh8N.js → filepond-Be7JObSq.js} +1 -1
  365. package/dist/esm/{filepond-plugin-file-poster-BTVFYcQx.js → filepond-plugin-file-poster-DF0NWKCQ.js} +2 -2
  366. package/dist/esm/{filepond-plugin-file-validate-size-DGryLmWv.js → filepond-plugin-file-validate-size-DJFlJHtE.js} +1 -1
  367. package/dist/esm/{filepond-plugin-file-validate-type-DxKfCD0V.js → filepond-plugin-file-validate-type-DykpLW1Z.js} +1 -1
  368. package/dist/esm/{filepond-plugin-image-edit-2W7pu9hn.js → filepond-plugin-image-edit-CyIHxrnW.js} +1 -1
  369. package/dist/esm/{filepond-plugin-image-exif-orientation-OQu-IvPH.js → filepond-plugin-image-exif-orientation-DbCOAhSu.js} +1 -1
  370. package/dist/esm/{filepond-plugin-image-preview-DEW_tSNR.js → filepond-plugin-image-preview-CGRGZcft.js} +1 -1
  371. package/dist/esm/{index-DYB20YqN.js → index-Cz6cYzxG.js} +547 -780
  372. package/dist/esm/{index-BDqMkCqE.js → index-_kPnZdm0.js} +1 -1
  373. package/dist/esm/loader.js +3 -4
  374. package/dist/esm/salla-accordion-body_2.entry.js +5 -5
  375. package/dist/esm/salla-accordion_6.entry.js +15 -19
  376. package/dist/esm/salla-add-product-button_4.entry.js +10 -12
  377. package/dist/esm/salla-advertisement.entry.js +3 -3
  378. package/dist/esm/salla-alert_2.entry.js +5 -5
  379. package/dist/esm/salla-app-install-alert.entry.js +3 -3
  380. package/dist/esm/salla-apps-icons.entry.js +3 -3
  381. package/dist/esm/salla-booking-field_7.entry.js +23 -25
  382. package/dist/esm/salla-bullet-delivery.entry.js +3 -3
  383. package/dist/esm/salla-cart-coupons.entry.js +3 -3
  384. package/dist/esm/salla-cart-item-offers_2.entry.js +5 -5
  385. package/dist/esm/salla-comment-form_8.entry.js +17 -17
  386. package/dist/esm/salla-conditional-offer.entry.js +3 -3
  387. package/dist/esm/salla-contacts.entry.js +3 -3
  388. package/dist/esm/salla-cookies-bar.entry.js +3 -3
  389. package/dist/esm/salla-count-down.entry.js +3 -3
  390. package/dist/esm/salla-custom-fields.entry.js +3 -3
  391. package/dist/esm/salla-delivery-promise.entry.js +1 -1
  392. package/dist/esm/salla-filters-widget.entry.js +3 -3
  393. package/dist/esm/salla-filters.entry.js +3 -3
  394. package/dist/esm/salla-fulfillment-methods.entry.js +1 -1
  395. package/dist/esm/salla-gifting.entry.js +3 -3
  396. package/dist/esm/salla-hook.entry.js +2 -5
  397. package/dist/esm/salla-infinite-scroll.entry.js +3 -3
  398. package/dist/esm/salla-installment.entry.js +3 -3
  399. package/dist/esm/salla-list-tile.entry.js +3 -3
  400. package/dist/esm/salla-localization-modal.entry.js +1 -1
  401. package/dist/esm/salla-login-modal.entry.js +3 -3
  402. package/dist/esm/salla-loyalty-prize-item.entry.js +3 -3
  403. package/dist/esm/salla-loyalty-program.entry.js +3 -3
  404. package/dist/esm/salla-loyalty.entry.js +3 -3
  405. package/dist/esm/salla-maintenance-alert.entry.js +3 -3
  406. package/dist/esm/salla-map.entry.js +3 -3
  407. package/dist/esm/salla-menu.entry.js +3 -3
  408. package/dist/esm/salla-metadata.entry.js +3 -3
  409. package/dist/esm/salla-multiple-bundle-product-cart_2.entry.js +5 -5
  410. package/dist/esm/salla-multiple-bundle-product-options-modal_2.entry.js +6 -8
  411. package/dist/esm/salla-multiple-bundle-product.entry.js +4 -6
  412. package/dist/esm/salla-notification-item.entry.js +3 -3
  413. package/dist/esm/salla-notifications.entry.js +3 -3
  414. package/dist/esm/salla-offer-modal.entry.js +3 -3
  415. package/dist/esm/salla-offer.entry.js +3 -3
  416. package/dist/esm/salla-order-details-multiple-bundle-product.entry.js +3 -3
  417. package/dist/esm/salla-order-details-options.entry.js +3 -3
  418. package/dist/esm/salla-order-details.entry.js +4 -6
  419. package/dist/esm/salla-order-edit-item.entry.js +3 -3
  420. package/dist/esm/salla-order-edit.entry.js +3 -3
  421. package/dist/esm/salla-order-summary.entry.js +3 -3
  422. package/dist/esm/salla-order-totals-card.entry.js +4 -6
  423. package/dist/esm/salla-orders.entry.js +3 -3
  424. package/dist/esm/salla-payments.entry.js +3 -3
  425. package/dist/esm/salla-placeholder.entry.js +3 -3
  426. package/dist/esm/salla-price-range.entry.js +3 -3
  427. package/dist/esm/salla-product-card.entry.js +3 -3
  428. package/dist/esm/salla-product-size-guide.entry.js +3 -3
  429. package/dist/esm/salla-products-list.entry.js +3 -3
  430. package/dist/esm/salla-products-slider.entry.js +3 -3
  431. package/dist/esm/salla-progress-bar.entry.js +3 -3
  432. package/dist/esm/salla-quick-order.entry.js +3 -3
  433. package/dist/esm/salla-rating-modal.entry.js +3 -3
  434. package/dist/esm/salla-scopes.entry.js +3 -3
  435. package/dist/esm/salla-search.entry.js +4 -6
  436. package/dist/esm/salla-skeleton.entry.js +3 -3
  437. package/dist/esm/salla-slider.entry.js +3 -3
  438. package/dist/esm/salla-social-share.entry.js +3 -3
  439. package/dist/esm/salla-social.entry.js +3 -3
  440. package/dist/esm/salla-tab-content_3.entry.js +7 -7
  441. package/dist/esm/salla-tiered-offer.entry.js +3 -3
  442. package/dist/esm/salla-tooltip.entry.js +3 -3
  443. package/dist/esm/salla-trust-badges.entry.js +3 -3
  444. package/dist/esm/salla-user-menu.entry.js +3 -3
  445. package/dist/esm/salla-user-profile.entry.js +3 -3
  446. package/dist/esm/salla-user-settings.entry.js +3 -3
  447. package/dist/esm/salla-verify.entry.js +3 -3
  448. package/dist/esm/salla-wallet.entry.js +3 -3
  449. package/dist/esm/twilight.js +4 -5
  450. package/dist/esm/{vanilla-picker-Dt9vZPZF.js → vanilla-picker-C_YV5LtA.js} +1 -1
  451. package/dist/twilight/{p-33779828.entry.js → p-0200cddd.entry.js} +1 -1
  452. package/dist/twilight/p-04dc0b71.entry.js +4 -0
  453. package/dist/twilight/{p-105b1dab.entry.js → p-0bac200e.entry.js} +1 -1
  454. package/dist/twilight/{p-ccfe5308.entry.js → p-0ef99df1.entry.js} +1 -1
  455. package/dist/twilight/{p-647b6d76.entry.js → p-1087f0dd.entry.js} +1 -1
  456. package/dist/twilight/{p-1875537e.entry.js → p-17dd8b68.entry.js} +1 -1
  457. package/dist/twilight/{p-aa7c5de0.entry.js → p-25a9bf1b.entry.js} +1 -1
  458. package/dist/twilight/{p-34b670fc.entry.js → p-2602927d.entry.js} +1 -1
  459. package/dist/twilight/p-268695ff.entry.js +4 -0
  460. package/dist/twilight/{p-aaa0c743.entry.js → p-34920aac.entry.js} +1 -1
  461. package/dist/twilight/{p-817b8ba5.entry.js → p-3656b48d.entry.js} +1 -1
  462. package/dist/twilight/{p-4932857d.entry.js → p-3857beb4.entry.js} +1 -1
  463. package/dist/twilight/{p-af3c74f4.entry.js → p-39c601e3.entry.js} +1 -1
  464. package/dist/twilight/{p-b598c0f7.entry.js → p-3c810881.entry.js} +1 -1
  465. package/dist/twilight/{p-d371d450.entry.js → p-3cf5c61f.entry.js} +1 -1
  466. package/dist/twilight/{p-3ccc532d.entry.js → p-413a7236.entry.js} +1 -1
  467. package/dist/twilight/{p-f176d41d.entry.js → p-42778349.entry.js} +1 -1
  468. package/dist/twilight/{p-b17d055d.entry.js → p-45e4f6f4.entry.js} +1 -1
  469. package/dist/twilight/{p-2abaa633.entry.js → p-4680956b.entry.js} +1 -1
  470. package/dist/twilight/{p-96a20515.entry.js → p-468b999f.entry.js} +1 -1
  471. package/dist/twilight/{p-df6853b5.entry.js → p-46d1823f.entry.js} +1 -1
  472. package/dist/twilight/{p-c87951a2.entry.js → p-49db497f.entry.js} +1 -1
  473. package/dist/twilight/{p-18bb0181.entry.js → p-4b033276.entry.js} +1 -1
  474. package/dist/twilight/{p-296d2dd0.entry.js → p-4f7bc9c3.entry.js} +1 -1
  475. package/dist/twilight/{p-4fa4547a.entry.js → p-543ee624.entry.js} +1 -1
  476. package/dist/twilight/{p-2fe01e44.entry.js → p-5957f774.entry.js} +1 -1
  477. package/dist/twilight/{p-96e78428.entry.js → p-5a4f0b99.entry.js} +1 -1
  478. package/dist/twilight/{p-87c0ca91.entry.js → p-5a8c0fd2.entry.js} +1 -1
  479. package/dist/twilight/{p-e28c0773.entry.js → p-5ab7a295.entry.js} +1 -1
  480. package/dist/twilight/{p-542d3277.entry.js → p-5e496aaa.entry.js} +1 -1
  481. package/dist/twilight/{p-c3ffb88a.entry.js → p-5f440956.entry.js} +1 -1
  482. package/dist/twilight/{p-94dbc1e9.entry.js → p-60fafcd9.entry.js} +1 -1
  483. package/dist/twilight/{p-1ef2602d.entry.js → p-708f02db.entry.js} +1 -1
  484. package/dist/twilight/{p-b64f3155.entry.js → p-7829ea8a.entry.js} +1 -1
  485. package/dist/twilight/{p-7093a427.entry.js → p-7d3e592a.entry.js} +1 -1
  486. package/dist/twilight/{p-96d03a28.entry.js → p-81876026.entry.js} +1 -1
  487. package/dist/twilight/{p-d9f5a8cd.entry.js → p-8306ef5e.entry.js} +1 -1
  488. package/dist/twilight/{p-d4a242f8.entry.js → p-8403cd93.entry.js} +1 -1
  489. package/dist/twilight/{p-7abddca8.entry.js → p-8474c4f6.entry.js} +1 -1
  490. package/dist/twilight/p-8552160a.entry.js +4 -0
  491. package/dist/twilight/p-8c9b0e2a.entry.js +4 -0
  492. package/dist/twilight/{p-2881bb33.entry.js → p-8f2dfc57.entry.js} +1 -1
  493. package/dist/twilight/{p-c091e2dc.entry.js → p-94b1a2ae.entry.js} +1 -1
  494. package/dist/twilight/{p-ede67a08.entry.js → p-95dad1af.entry.js} +1 -1
  495. package/dist/twilight/{p-eac718cd.entry.js → p-964b7db9.entry.js} +1 -1
  496. package/dist/twilight/{p-e3b8e0e1.entry.js → p-99735748.entry.js} +1 -1
  497. package/dist/twilight/{p-X6Yi3bYP.js → p-BZKDQg1s.js} +1 -1
  498. package/dist/twilight/{p-Cw3UBzjl.js → p-B_sN7OnY.js} +1 -1
  499. package/dist/twilight/{p-8r0S6BcZ.js → p-Bpi0aG1F.js} +1 -1
  500. package/dist/twilight/{p-BkClxrC4.js → p-CP8rFQ5n.js} +1 -1
  501. package/dist/twilight/{p-bNzv71Xl.js → p-CfmIbM8B.js} +1 -1
  502. package/dist/twilight/{p-bScl0xMh.js → p-CpO1SrBd.js} +1 -1
  503. package/dist/twilight/p-Cz6cYzxG.js +5 -0
  504. package/dist/twilight/p-Do4hSOGo.js +9 -0
  505. package/dist/twilight/{p-Ck4zxCil.js → p-JJmlh-ji.js} +1 -1
  506. package/dist/twilight/{p-dd2bd5dc.entry.js → p-a4aedcfe.entry.js} +1 -1
  507. package/dist/twilight/{p-06fa7327.entry.js → p-b0d01f9f.entry.js} +1 -1
  508. package/dist/twilight/p-b8404cfb.entry.js +4 -0
  509. package/dist/twilight/{p-108d8c8b.entry.js → p-b8e3e180.entry.js} +1 -1
  510. package/dist/twilight/{p-ad07f67a.entry.js → p-bd687cd0.entry.js} +1 -1
  511. package/dist/twilight/{p-44fa7521.entry.js → p-c0037fac.entry.js} +1 -1
  512. package/dist/twilight/{p-293c6cf3.entry.js → p-c121f8e4.entry.js} +1 -1
  513. package/dist/twilight/{p-a01f1992.entry.js → p-c29907df.entry.js} +1 -1
  514. package/dist/twilight/p-c39675ef.entry.js +4 -0
  515. package/dist/twilight/{p-bff4c7b3.entry.js → p-cb7a985e.entry.js} +1 -1
  516. package/dist/twilight/p-cbe620c4.entry.js +4 -0
  517. package/dist/twilight/{p-6f36541a.entry.js → p-d2fd79b4.entry.js} +1 -1
  518. package/dist/twilight/{p-d337c399.entry.js → p-d6cf0ffd.entry.js} +1 -1
  519. package/dist/twilight/{p-748df7e6.entry.js → p-d8f60f2f.entry.js} +1 -1
  520. package/dist/twilight/p-d99610f9.entry.js +4 -0
  521. package/dist/twilight/{p-e6bbf50d.entry.js → p-dc897bdd.entry.js} +1 -1
  522. package/dist/twilight/{p-f7999a6d.entry.js → p-dca46236.entry.js} +1 -1
  523. package/dist/twilight/{p-e94f217b.entry.js → p-e48853c9.entry.js} +1 -1
  524. package/dist/twilight/{p-09d39785.entry.js → p-e4fdb206.entry.js} +1 -1
  525. package/dist/twilight/p-ed913ae7.entry.js +4 -0
  526. package/dist/twilight/p-f067fcd6.entry.js +4 -0
  527. package/dist/twilight/{p-57ff1f25.entry.js → p-f2cd6975.entry.js} +1 -1
  528. package/dist/twilight/{p-ad041ab5.entry.js → p-f2ffbfbb.entry.js} +1 -1
  529. package/dist/twilight/{p-f5d15e71.entry.js → p-f3166e60.entry.js} +1 -1
  530. package/dist/twilight/{p-59ae82bd.entry.js → p-f8fcc8f4.entry.js} +1 -1
  531. package/dist/twilight/{p-c1fd45b1.entry.js → p-f9e52fd9.entry.js} +1 -1
  532. package/dist/twilight/p-fcddbfc3.entry.js +4 -0
  533. package/dist/twilight/{p-41c733c2.entry.js → p-fe7ac9bb.entry.js} +1 -1
  534. package/dist/twilight/{p-0add06f9.entry.js → p-ff14dca3.entry.js} +1 -1
  535. package/dist/twilight/{p-BZnoSB1s.js → p-mlFGjxcj.js} +1 -1
  536. package/dist/twilight/twilight.esm.js +1 -1
  537. package/dist/types/components.d.ts +177 -763
  538. package/dist/types/stencil-public-runtime.d.ts +11 -169
  539. package/package.json +5 -5
  540. package/dist/cjs/app-globals-oehrC7QI.js +0 -39
  541. package/dist/esm/app-globals-BFryt7-C.js +0 -37
  542. package/dist/twilight/p-1daeed6e.entry.js +0 -4
  543. package/dist/twilight/p-2ddb3fce.entry.js +0 -4
  544. package/dist/twilight/p-34968e31.entry.js +0 -4
  545. package/dist/twilight/p-665189b4.entry.js +0 -4
  546. package/dist/twilight/p-776c9d33.entry.js +0 -4
  547. package/dist/twilight/p-7b8313ef.entry.js +0 -4
  548. package/dist/twilight/p-7bd0ede5.entry.js +0 -4
  549. package/dist/twilight/p-8e8d9d7d.entry.js +0 -4
  550. package/dist/twilight/p-D1vqXXNX.js +0 -9
  551. package/dist/twilight/p-DYB20YqN.js +0 -5
  552. package/dist/twilight/p-Vl6qpttb.js +0 -4
  553. package/dist/twilight/p-af60e72a.entry.js +0 -4
  554. package/dist/twilight/p-e679884a.entry.js +0 -4
  555. package/dist/twilight/p-efab88c5.entry.js +0 -4
@@ -1,4 +1,965 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{transformTag as t,proxyCustomElement as i,HTMLElement as s,createEvent as o,h as a,Host as e}from"@stencil/core/internal/client";import{I as n}from"./check.js";import{C as l}from"./camera.js";import{d as r}from"./salla-booking-field2.js";import{d}from"./salla-button2.js";import{d as c}from"./salla-color-picker2.js";import{d as p}from"./salla-conditional-fields2.js";import{d as h}from"./salla-datetime-picker2.js";import{d as u}from"./salla-file-upload2.js";import{d as m}from"./salla-loading2.js";import{d as g}from"./salla-map2.js";import{d as f}from"./salla-modal2.js";import{d as b}from"./salla-progress-bar2.js";var v,y;!function(t){t.COLOR="color",t.DATE="date",t.DATETIME="datetime",t.DONATION="donation",t.IMAGE="image",t.MULTIPLE_OPTIONS="multiple-options",t.NUMBER="number",t.SINGLE_OPTION="single-option",t.DIGITAL_CARD_VALUE="digital-code-value",t.COUNTRY="country",t.SPLITTER="splitter",t.TEXT="text",t.TEXTAREA="textarea",t.THUMBNAIL="thumbnail",t.TIME="time",t.RADIO="radio",t.CHECKBOX="checkbox",t.MAP="map",t.FILE="file",t.COLOR_PICKER="color_picker",t.BOOKING="booking"}(v||(v={})),function(t){t.Sar="SAR"}(y||(y={}));const k=i(class extends s{constructor(t){if(super(),!1!==t&&this.__registerHost(),this.changed=o(this,"changed",7),this.fileTypes={pdf:"application/pdf",png:"image/png",jpg:"image/jpeg",word:"application/doc,application/ms-doc,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document",exl:"application/excel,application/vnd.ms-excel,application/x-excel,application/x-msexcel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",txt:"text/plain"},this.outOfStockText="",this.donationAmount=salla.lang.get("pages.products.donation_amount"),this.selectDonationAmount=salla.lang.getWithDefault("pages.products.select_donation_amount","تحديد مبلغ التبرع"),this.selectAmount=salla.lang.getWithDefault("pages.products.select_amount","اختر المبلغ"),this.isCustomDonation=!1,this.selectedOptions=[],this.canDisabled=!1,this.disableCardValue=!0,this.availableDigitalCardValues=[],this.userInitiatedValidation=!1,this.isCartMode=!1,this.outSkus=[],this.ignoreDefaultCardValue=!1,this.productId=salla.config.get("page.id"),this.handleDonationOptions=(t,i,s)=>{if("custom"===i&&"input"===s){const i=t.target;return salla.helpers.inputDigitsOnly(i),salla.event.emit("product-options::donation-changed",{id:this.productId,price:i.value}),void i.dispatchEvent(new window.Event("change",{bubbles:!0}))}const o="option"===s?String(t.target?.value??""):"";if("option"===s&&"custom"===i&&(t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation()),this.isCustomDonation="custom"===o,this.donationInput){if("custom"===o?(this.donationInput.value="",this.donationInput.focus()):this.donationInput.value=o,"custom"===i)return;salla.event.emit("product-options::donation-changed",{id:this.productId,price:o})}},this.hideLabel=t=>!(t.type!==v.DONATION||!t.donation||t.donation.can_donate),this.getExpireDonationMessage=t=>{if(!t.donation)return;const i=t.donation.target_amount<=t.donation.collected_amount;return a("div",{class:{"s-product-options-donation-message":!0,"s-product-options-donation-completed":i,"s-product-options-donation-expired":!i}},a("p",null,t.donation.target_message),a("span",{innerHTML:i?salla.money(t.donation.target_amount):""}))},salla.lang.onLoaded((()=>{this.outOfStockText=salla.lang.get("pages.products.out_of_stock"),this.donationAmount=salla.lang.get("pages.products.donation_amount"),this.selectDonationAmount=salla.lang.getWithDefault("pages.products.select_donation_amount","تحديد مبلغ التبرع"),this.selectAmount=salla.lang.getWithDefault("pages.products.select_amount","اختر المبلغ")})),this.options)try{return void this.setOptionsData(Array.isArray(this.options)?this.options:JSON.parse(this.options))}catch(t){salla.log("Bad json passed via options prop")}Array.isArray(this.optionsData)||(salla.log("Options is not an array[] ---\x3e ",this.optionsData),this.setOptionsData([])),this.productId&&!salla.url.is_page("cart")&&salla.api.product.getDetails(this.productId,["options"]).then((t=>this.setOptionsData(t.data.options)))}async setOptionsData(t){this.optionsData=t;const i=this;this.optionsData[0]?.details?.forEach((function(t){Object.entries(t.skus_availability||{}).filter((t=>!t[1])).map((t=>i.outSkus.push(Number(t[0]))))}))}async getSelectedOptionsData(){const t={},i=this.host.getElementSallaData(),s=void 0!==this.bundleContext?this.bundleContext:null;return i.forEach(((i,o)=>{if(s){if(o.startsWith("bundle[")&&o.includes("[options][")){const s=o.split("[options][")[1].replace("]","");t[s]=i}}else o.startsWith("options[")&&(t[o.replace("options[","").replace("]","")]=i)})),t}async reportValidity(){const t=this.host.querySelectorAll("[required]");let i=!0;for(let s=0;s<t.length;s++)"reportValidity"in t[s]&&!t[s].reportValidity()&&(i=!1);return i}async hasOutOfStockOption(){return this.selectedOptions.some((t=>t.is_out))||this.selectedSkus?.length&&this.selectedSkus?.every((t=>this.outSkus.includes(t)))}async getSelectedOptions(){return this.selectedOptions}async getOption(t){return this.optionsData.find((i=>i.id===t))}invalidHandler(t,i){const s=t.target.closest(".s-product-options-option");s.classList.contains("s-product-options-option-error")||s.classList.add("s-product-options-option-error"),!this.userInitiatedValidation&&!salla.helpers.isIOSDevice()||salla.url.is_page("cart")||this.host.querySelector(".s-product-options-option-error")===s&&this.scrollToElement(s)}scrollToElement(t){t&&t.scrollIntoView({behavior:"smooth",block:"center"})}changedHandler(t,i,s=!0){const o={event:t,option:i,detail:null,productId:this.productId};if(i.details){const s=i.details.find((i=>Number(i.id)===Number(t.target.value)));o.detail=s}"country"===i.type&&this.handleCountryOptionChange(t,o.detail);const a=t.target.closest(".s-product-options-option");(t.target.value||(i.type===v.FILE||i.type===v.IMAGE)&&"added"===t.type||i.type===v.MAP&&"selected"===t.type&&t.target.lat&&t.target.lng)&&setTimeout((()=>{a.classList.remove("s-product-options-option-error")}),200),i.type===v.DONATION&&salla.event.emit("product-options::donation-changed",{id:this.productId,price:t.target.value}),this.setSelectedSkus(),this.handleRequiredMultipleOptions(i);const e=this.selectedOptions.findIndex((t=>t.option_id===o.option.id));if(o.option.type===v.MULTIPLE_OPTIONS){const t=this.selectedOptions.findIndex((t=>t.option_id===o.option.id&&t?.id===o.detail?.id));t>-1?this.selectedOptions.splice(t,1):this.selectedOptions.push({...o.detail,option_id:o.option.id})}else o.detail&&0!==Object.keys(o.detail).length?e>-1?this.selectedOptions[e]={...o.detail,option_id:o.option.id}:this.selectedOptions.push({...o.detail,option_id:o.option.id}):e>-1&&this.selectedOptions.splice(e,1);this.optionsData=this.optionsData.map((t=>t.id===o.option.id?{...t,details:t.details.map((t=>({...t,is_selected:o.option.type===v.MULTIPLE_OPTIONS?this.selectedOptions.some((i=>i.id===t.id)):Number(t.id)===Number(o.detail?.id),value:o.detail?.value})))}:t)),s&&(this.changed.emit(o),salla.event.emit("product-options::change",o))}setSelectedSkus(){this.selectedSkus=this.selectedOptions.map((t=>Object.keys(t.skus_availability||{}))).reduce(((t,i)=>t.filter((t=>i.includes(t)))),[]).map((t=>Number(t)))}handleRequiredMultipleOptions(t){if(t.type!==v.MULTIPLE_OPTIONS||!t.required)return;const i=this.host.querySelector(`[data-option-id="${t.id}"]`),s=i.querySelectorAll("input:checked").length;i.querySelectorAll("input").forEach((t=>t.toggleAttribute("required",!s)))}getLatLng(t,i){return t?t.split(",")["lat"===i?0:1]:""}getDisplayForType(t){return this[`${t.type}Option`]?this[`${t.type}Option`](t):t.type===v.COLOR_PICKER?this.colorPickerOption(t):t.type===v.MULTIPLE_OPTIONS?this.multipleOptions(t):t.type===v.SINGLE_OPTION?this.singleOption(t):t.type===v.RADIO?this.radioOption(t):t.type===v.DIGITAL_CARD_VALUE?this.digitalCardValuesOption(t):t.type===v.COUNTRY?this.countryOption(t):t.type===v.BOOKING&&salla.url.is_page("cart")?a("salla-booking-field",{onInvalidInput:i=>this.invalidHandler(i,t),option:t,productId:t.value}):(salla.log(`Couldn't find options type(${t.type})😢`),"")}getOptionShownWhen(t){return t.visibility_condition?{"data-show-when":`options[${t.visibility_condition.option}] ${t.visibility_condition.operator} ${t.visibility_condition.value}`}:{}}getAvailableDigitalCardSKUs(t){const i=this.optionsData.find((({type:t})=>"digital-code-value"===t));if(!i)throw new Error("product-options:: No digital card options found");const s=Object.keys(t.skus_availability).filter((i=>!1===t.skus_availability[i]));this.availableDigitalCardValues=i.details.filter((t=>!Object.keys(t.skus_availability).filter((t=>s.includes(t))).length))}handleCountryOptionChange(t,i){t.stopImmediatePropagation(),this.ignoreDefaultCardValue=!0;const s=this.host.querySelector("input[data-code-value]:checked");if(s&&(s.checked=!1),!this.optionsData.find((({type:t})=>"digital-code-value"===t)))throw new Error("product-options:: No digital card options found");this.getAvailableDigitalCardSKUs(i)}getSelectedDigitalCardOptions(t){const i=t.details.find((t=>t.is_selected)),s=t.details.find((t=>!!t.is_default))||t.details[0];if(["digital-code-value","country"].includes(t.type))return i||s}async componentWillLoad(){if(salla.url.is_page("cart")&&(this.disableCardValue=!1,this.fillSelectedOptions()),this.config)try{this.optionConfig="string"==typeof this.config?JSON.parse(this.config):this.config}catch(t){console.error("Failed to parse JSON in config prop:",t)}if(this.optionsData.filter((({type:t})=>["country","digital-card-value"].includes(t))).length>0&&salla.url.is_page("cart")){const t=this.optionsData.find((t=>"country"===t.type)),i=t&&this.getSelectedDigitalCardOptions(t);i&&this.getAvailableDigitalCardSKUs(i)}return this.outOfStockText=salla.lang.get("pages.products.out_of_stock"),await salla.onReady(),this.canDisabled=!salla.config.get("store.settings.product.notify_options_availability")||salla.url.is_page("cart"),this.pasteHandler=this.handlePaste.bind(this),document.addEventListener("paste",this.pasteHandler),!salla.storage.get("cart.id")&&this.optionsData.some((t=>["file","image"].includes(t.type)))?salla.api.cart.getCurrentCartId(!1,"salla-product-options"):null}disconnectedCallback(){this.pasteHandler&&document.removeEventListener("paste",this.pasteHandler)}handlePaste(t){const i=t.target;if(!(Salla.helpers.isAppleDevice()&&(i instanceof HTMLInputElement||i instanceof HTMLTextAreaElement)&&i.classList.contains("s-form-control")&&this.host.contains(i)))return;t.preventDefault();const s=t.clipboardData?.getData("text")||"",o=i.selectionStart,a=i.selectionEnd,e=i.value.slice(0,o)+s+i.value.slice(a);i.value=e,i.setSelectionRange(o+s.length,o+s.length);try{i.dispatchEvent(new window.Event("change",{bubbles:!0}))}catch(t){Salla.log("Error on change")}}hideDigitalCardsOptions(t){return this.disableCardValue&&t.type===v.DIGITAL_CARD_VALUE&&!salla.url.is_page("cart")}render(){if(0!==this.optionsData?.length)return a(e,{class:"s-product-options-wrapper"},a("salla-conditional-fields",null,this.optionsData.map((t=>a("div",{key:t.id,class:"s-product-options-option-container"+(t.visibility_condition||this.hideDigitalCardsOptions(t)?" hidden":""),"data-option-id":t.id,...this.getOptionShownWhen(t)},"splitter"===t.name?this.splitterOption():a("div",{class:{"s-product-options-option":!0,"s-product-options-option-booking":t.type===v.BOOKING&&salla.url.is_page("cart")},"data-option-type":t.type,"data-option-required":`${t.required}`},a("label",{htmlFor:this.generateInputId(t.id),class:"s-product-options-option-label "+(this.hideLabel(t)?"s-product-options-option-label-hidden":"")},a("b",null,t.name,t.required&&a("span",null," * ")," "),a("small",null,t.placeholder)),a("div",{class:"s-product-options-option-content "+(this.hideLabel(t)||t.type===v.BOOKING&&salla.url.is_page("cart")?"s-product-options-option-content-full-width":"")},this.getDisplayForType(t))))))))}generateUniqueKey(t){const i=this.bundleContext;let s=this.uniqueKey?`${t}-${this.uniqueKey}`:t;if(i)try{const t="string"==typeof i?JSON.parse(i):i,{sectionId:o,productId:a}=t;s=`${s}-bundle-${o}-${a}`}catch(t){}return s}generateInputId(t){return this.generateUniqueKey(`option-${t}`)}generateInputName(t){const i=this.bundleContext,s=t.toString();if(i)try{const t="string"==typeof i?JSON.parse(i):i,{sectionId:o,productId:a}=t;return`bundle[${o}][${a}][options][${s}]`}catch(t){return`options[${s}]`}return`options[${s}]`}fillSelectedOptions(){this.selectedOptions=this.optionsData.reduce(((t,i)=>{const s=i.details.filter((t=>t.is_selected)).map((t=>({...t,option_id:i.id})));return t.concat(s)}),[])}async componentDidLoad(){if(!this.optionsData?.length)return;await Salla.hooks.registerComponent("salla-product-options",this);const t=this.optionsData.find((t=>t.type===v.DONATION))?.details?.find((t=>t.is_selected));if(t&&setTimeout((()=>{salla.event.emit("product-options::donation-changed",{id:this.productId,price:t.additional_price})}),1e3),!salla.url.is_page("cart")&&!this.isCartMode){const t=[v.SINGLE_OPTION,v.MULTIPLE_OPTIONS,v.COLOR,v.THUMBNAIL,v.DONATION,v.DIGITAL_CARD_VALUE,v.COUNTRY];this.optionsData.some((i=>t.includes(i.type)&&i.details?.some((t=>t.is_selected))))&&requestAnimationFrame((()=>{try{const t=this.host.closest("form");if(!t)return;const i=new FormData(t),s=i.get("id")||i.get("product_id");if(s&&String(s)!==String(this.productId))return;salla.product.getPrice(i)}catch(t){salla.log("Error updating price for pre-selected options:",t)}}))}}async enterCartMode(){this.isCartMode=!0,this.disableCardValue=!1,this.canDisabled=!0,this.fillSelectedOptions()}async enableUserInitiatedValidation(){this.userInitiatedValidation=!0}async validateAndScroll(){return await this.enableUserInitiatedValidation(),this.reportValidity()}donationOption(t,i){return a("div",{class:"s-product-options-donation-wrapper"},t.donation?.can_donate?[t.donation?a("div",{key:t.id,class:"s-product-options-donation-progress"},a("salla-progress-bar",{donation:t.donation})):"",t.details.length?[a("h4",{key:t.id},this.selectAmount),a("div",{key:t.id,class:"s-product-options-donation-options"},t.details.map(((i,s)=>a("div",{key:t.id,class:"s-product-options-donation-options-item"},a("input",{id:this.generateUniqueKey(`donation-option-${s}`),type:"radio",name:"donating_option",checked:i.is_selected,value:i.additional_price,onChange:s=>this.handleDonationOptions(s,i,"option",t)}),a("label",{htmlFor:this.generateUniqueKey(`donation-option-${s}`)},a("span",{innerHTML:salla.money(i.name)}))))),t.donation?.custom_amount_enabled?a("div",{class:"s-product-options-donation-options-item"},a("input",{id:this.generateUniqueKey("donation-option-custom"),type:"radio",name:"donating_option",value:"custom",onChange:i=>this.handleDonationOptions(i,"custom","option",t)}),a("label",{htmlFor:this.generateUniqueKey("donation-option-custom")},a("span",null," ",this.selectDonationAmount," "))):"")]:"",a("div",{key:t.id,class:{"s-product-options-donation-input-group":!0,shown:!t.details.length||t.details.length&&this.isCustomDonation}},a("input",{type:"text",id:"donating-amount",name:"donation_amount",class:"s-form-control",ref:t=>{this.donationInput=t},value:t.details.length&&t.details.some((t=>t.is_selected))?t.details.find((t=>t.is_selected)).additional_price:t.value,placeholder:t.placeholder,onInput:i=>this.handleDonationOptions(i,"custom","input",t),onBlur:i=>this.changedHandler(i,t),onInvalid:i=>this.invalidHandler(i,t)}),a("span",{class:"s-product-options-donation-amount-currency"},salla.config.currency(salla.config.get("user.currency_code")).symbol))]:this.getExpireDonationMessage(t))}fileUploader(t,i=null){return a("salla-file-upload",{...i||{},"payload-name":"file",value:t.value,"instant-upload":!0,name:this.generateInputName(t.id),required:!t.visibility_condition&&t.required,height:"120px",onAdded:i=>this.changedHandler(i,t),url:salla.cart.api.getUploadImageEndpoint(),"form-data":{cart_item_id:this.productId,product_id:this.productId},onInvalidInput:i=>this.invalidHandler(i,t),class:{"s-product-options-image-input":!0,required:t.required}},a("div",{class:"s-product-options-filepond-placeholder"},a("span",{class:"s-product-options-filepond-placeholder-icon",innerHTML:i.accept?.split(",").every((t=>t.includes("image")))?l:'\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>file-upload</title>\n<path d="M21.333 24c0.341 0 0.683-0.131 0.943-0.391 0.521-0.521 0.521-1.364 0-1.885l-5.333-5.333c-0.123-0.123-0.271-0.22-0.433-0.288-0.327-0.135-0.693-0.135-1.019 0-0.163 0.068-0.311 0.165-0.433 0.288l-5.333 5.333c-0.521 0.521-0.521 1.364 0 1.885s1.364 0.521 1.885 0l3.057-3.057v10.115c0 0.736 0.597 1.333 1.333 1.333s1.333-0.597 1.333-1.333v-10.115l3.057 3.057c0.26 0.26 0.601 0.391 0.943 0.391zM28.943 9.724l-9.333-9.333c-0.249-0.251-0.589-0.391-0.943-0.391h-12c-2.205 0-4 1.795-4 4v24c0 2.205 1.795 4 4 4h4c0.736 0 1.333-0.597 1.333-1.333s-0.597-1.333-1.333-1.333h-4c-0.735 0-1.333-0.599-1.333-1.333v-24c0-0.735 0.599-1.333 1.333-1.333h11.448l8.552 8.552v16.781c0 0.735-0.599 1.333-1.333 1.333h-4c-0.736 0-1.333 0.597-1.333 1.333s0.597 1.333 1.333 1.333h4c2.205 0 4-1.795 4-4v-17.333c0-0.353-0.14-0.693-0.391-0.943z"></path>\n</svg>\n'}),a("p",{class:"s-product-options-filepond-placeholder-text"},salla.lang.get("common.uploader.drag_and_drop")),a("span",{class:"filepond--label-action"},salla.lang.get("common.uploader.browse"))))}imageOption(t){return this.fileUploader(t,{accept:"image/png,image/jpeg,image/jpg,image/gif"})}fileOption(t){const i=t.details.map((t=>this.fileTypes[t.name])).filter(Boolean);return i?.length?this.fileUploader(t,{accept:i.join(",")}):"File types not selected."}numberOption(t){return a("input",{type:"text",value:t.value,class:"s-form-control",required:!t.visibility_condition&&t.required,id:this.generateInputId(t.id),name:this.generateInputName(t.id),placeholder:t.placeholder,onBlur:i=>this.changedHandler(i,t),onInvalid:i=>this.invalidHandler(i,t),onInput:t=>salla.helpers.inputDigitsOnly(t.target)})}splitterOption(){return a("div",{class:"s-product-options-splitter"})}textOption(t){return a("div",{class:"s-product-options-text"},a("input",{type:"text",value:t.value,maxLength:t?.length,class:"s-form-control",required:!t.visibility_condition&&t.required,id:this.generateInputId(t.id),name:this.generateInputName(t.id),placeholder:t.placeholder,onInvalid:i=>this.invalidHandler(i,t),onChange:i=>this.changedHandler(i,t)}))}textareaOption(t){return a("div",{class:"s-product-options-textarea"},a("div",{class:"mt-1"},a("textarea",{rows:4,value:t.value,maxLength:t?.length,class:"s-form-control",required:!t.visibility_condition&&t.required,id:this.generateInputId(t.id),name:this.generateInputName(t.id),placeholder:t.placeholder,onInvalid:i=>this.invalidHandler(i,t),onChange:i=>this.changedHandler(i,t)})))}mapOption(t){return a("salla-map",{zoom:15,lat:this.getLatLng(t.value,"lat"),lng:this.getLatLng(t.value,"lng"),name:this.generateInputName(t.id),searchable:!0,required:t.required,onInvalidInput:i=>this.invalidHandler(i,t),onSelected:i=>this.changedHandler(i,t)})}colorPickerOption(t){return a("salla-color-picker",{onSubmitted:i=>this.changedHandler(i,t),name:this.generateInputName(t.id),required:!t.visibility_condition&&t.required,onInvalidInput:i=>this.invalidHandler(i,t),color:t.value})}timeOption(t){return a("salla-datetime-picker",{noCalendar:!0,enableTime:!0,dateFormat:"h:i K",value:t.value,placeholder:t.name,required:!t.visibility_condition&&t.required,name:this.generateInputName(t.id),class:"s-product-options-time-element",onInvalidInput:i=>this.invalidHandler(i,t),onPicked:i=>this.changedHandler(i,t)})}dateOption(t){return a("div",{class:"s-product-options-date-element"},a("salla-datetime-picker",{value:t.value,placeholder:t.name,required:!t.visibility_condition&&t.required,minDate:new Date,name:this.generateInputName(t.id),onInvalidInput:i=>this.invalidHandler(i,t),onPicked:i=>this.changedHandler(i,t)}))}datetimeOption(t){return a("div",{class:"s-product-options-datetime-element"},a("salla-datetime-picker",{enableTime:!0,value:t.value,dateFormat:"Y-m-d G:i:K",placeholder:t.name,required:!t.visibility_condition&&t.required,name:this.generateInputName(t.id),maxDate:t.to_date_time,minDate:t.from_date_time,onInvalidInput:i=>this.invalidHandler(i,t),onPicked:i=>this.changedHandler(i,t)}))}getOptionDetailName(t,i=!0,s){let o;return s&&s===v.COLOR&&(o=t.name+(i&&this.isOptionDetailOut(t)&&!salla.url.is_page("cart")&&!this.hideOutLabel?` <br/> <p> ${this.outOfStockText} </p>`:"")+(t.additional_price?` <p> (${salla.money(t.additional_price,!1)}) </p>`:"")),o||(o=t.name+(i&&this.isOptionDetailOut(t)&&!salla.url.is_page("cart")&&!this.hideOutLabel?` - ${this.outOfStockText}`:"")+(t.additional_price?` (${salla.money(t.additional_price,!1)})`:"")),o.replace("<i class=sicon-sar></i>",salla.config.currency()?.symbol||"ر.س")}isOptionDetailOut(t){if(t.is_out||!t.skus_availability||!this.selectedSkus?.length)return t.is_out;const i=this.selectedOptions.filter((i=>i.id===t.id)).length;if(i&&1===this.selectedOptions.length)return!1;if(i){const i=this.selectedSkus.filter((t=>this.outSkus.includes(t)));return Object.keys(t.skus_availability).some((t=>i.includes(Number(t))))}return this.selectedOptions.some((i=>i.is_out&&i.option_id!==t.option_id))}renderInput(t,i,s,o,e,n){const l=this.generateUniqueKey(`${t}-${s.id}-${i.id}`),r=this.isOptionDetailOut(i);return a("label",{class:{"s-product-options-disabled":r}},a("input",{id:l,type:t,name:e,value:i.id,disabled:r,required:o,checked:i.is_selected,onInvalid:t=>this.invalidHandler(t,s),onChange:t=>this.changedHandler(t,s)}),a("div",{class:{"s-product-options-grid-mode-span":n,"s-product-options-disabled":r}},this.getOptionDetailName(i)))}renderOptionDetails(t,i,s,o=!1){const a=this.generateInputName(i.id),e="radio"===t?a:`${a}[]`;return i?.details.map((a=>this.renderInput(t,a,i,s,e,o)))}renderSelect(t){return a("div",null,a("select",{id:this.generateInputId(t.id),name:this.generateInputName(t.id),required:!t.visibility_condition&&t.required,class:"s-form-control",onInvalid:i=>this.invalidHandler(i,t),onChange:i=>this.changedHandler(i,t)},a("option",{value:""},t.placeholder),t?.details.map((t=>a("option",{key:t.id,value:t.id,disabled:this.canDisabled&&this.isOptionDetailOut(t),selected:t.is_selected},this.getOptionDetailName(t))))))}renderButtonStyle(t,i,s){return a("div",{class:"s-product-options-grid-mode"},this.renderOptionDetails(t,i,s,!0))}singleOption(t){return"button"===this.optionConfig?.["single-option"]?.type?this.renderButtonStyle("radio",t,!t.visibility_condition&&t.required):this.renderSelect(t)}multipleOptions(t){const i="button"===this.optionConfig?.["multiple-option"]?.type,s=t.required&&!t.details.some((t=>t.is_selected))&&!t.visibility_condition;return i?this.renderButtonStyle("checkbox",t,s):a("div",{class:{"s-product-options-multiple-options-wrapper":!0,required:t.required}},this.renderOptionDetails("checkbox",t,s))}radioOption(t){return this.singleOption(t)}colorOption(t){return a("fieldset",{class:"s-product-options-colors-wrapper"},t?.details.map((i=>a("div",{class:"s-product-options-colors-item",key:i.id},a("input",{type:"radio",value:i.id,required:!t.visibility_condition&&t.required,checked:i.is_selected,name:this.generateInputName(t.id),disabled:this.canDisabled&&this.isOptionDetailOut(i),id:this.generateUniqueKey(`color-${this.productId}-${t.id}-${i.id}`),onInvalid:i=>this.invalidHandler(i,t),onChange:i=>this.changedHandler(i,t)}),a("label",{htmlFor:this.generateUniqueKey(`color-${this.productId}-${t.id}-${i.id}`)},a("span",{style:{backgroundColor:i.color}}),a("div",{innerHTML:this.getOptionDetailName(i,!0,t.type)}))))))}thumbnailOption(t){return a("div",{class:"s-product-options-thumbnails-wrapper"},t.details.map((i=>a("div",{key:i.id},a("input",{type:"radio",value:i.id,"data-itemid":i.id,required:!t.visibility_condition&&t.required,checked:i.is_selected,name:this.generateInputName(t.id),"data-img-id":i.option_value,disabled:this.canDisabled&&this.isOptionDetailOut(i),id:this.generateUniqueKey(`option_${this.productId}-${t.id}_${i.id}`),onInvalid:i=>this.invalidHandler(i,t),onChange:i=>this.changedHandler(i,t)}),a("label",{htmlFor:this.generateUniqueKey(`option_${this.productId}-${t.id}_${i.id}`),"data-img-id":i.option_value,class:"go-to-slide"},a("img",{"data-src":i.image,src:i.image,title:i.name,alt:i.name}),a("span",{innerHTML:n,class:"s-product-options-thumbnails-icon"}),this.isOptionDetailOut(i)?[a("small",{key:i.id,class:"s-product-options-thumbnails-stock-badge"},this.outOfStockText),this.canDisabled?a("div",{key:i.id,class:"s-product-options-thumbnails-badge-overlay"}):""]:""),a("p",null,this.getOptionDetailName(i,!1)," ")))))}digitalCardValuesOption(t){return a("div",{class:"s-product-options-digital-card-wrapper"},this.availableDigitalCardValues.length>0?this.availableDigitalCardValues.map((i=>{const s=String(i.id);return a("label",{htmlFor:this.generateUniqueKey(s.toString()),key:s,class:"s-product-options-digital-card-option"},a("input",{type:"radio","data-code-value":!0,class:"s-form-control s-product-options-digital-card-input",value:i.id,name:this.generateInputName(t.id),id:this.generateUniqueKey(s.toString()),required:!t.visibility_condition&&t.required,onInvalid:i=>this.invalidHandler(i,t),...this.ignoreDefaultCardValue?{}:{defaultChecked:this.getSelectedDigitalCardOptions(t)?.id===i.id}}),a("span",null,i.name," ",salla.config?.currency()?.symbol))})):a("div",{class:"s-product-options-digital-card-out-of-stock"}))}countryOption(t){return a("div",{class:"s-product-options-digital-card-wrapper"},t.details.map((i=>a("label",{htmlFor:this.generateUniqueKey(i.id.toString()),key:i.id,class:{"s-product-options-digital-card-option":!0,"s-product-options-digital-card-option-stock-out":i.is_out}},a("input",{id:this.generateUniqueKey(i.id.toString()),type:"radio",class:"s-form-control s-product-options-digital-card-input",value:i.id,name:this.generateInputName(t.id),disabled:i.is_out,required:!t.visibility_condition&&t.required,onInvalid:i=>this.invalidHandler(i,t),onChange:i=>this.changedHandler(i,t),onClick:()=>{this.disableCardValue=!1},...salla.url.is_page("cart")?{defaultChecked:this.getSelectedDigitalCardOptions(t)?.id===i.id}:{}}),a("img",{loading:"lazy",alt:i.code,height:24,width:24,class:"s-product-options-country-flag",src:`https://cdn.assets.salla.network/prod/admin/cp/assets/flags/1x1/${String(i.code).toLocaleLowerCase()}.svg`,onError:t=>{t.currentTarget.onerror=null,t.currentTarget.src=salla.url.cdn("images/globe.svg")}}),a("span",null,i.name)))))}get host(){return this}static get style(){return""}},[0,"salla-product-options",{productId:[8,"product-id"],options:[1],hideOutLabel:[1,"hide-out-label"],uniqueKey:[1,"unique-key"],bundleContext:[1,"bundle-context"],config:[1],optionsData:[32],outOfStockText:[32],donationAmount:[32],selectDonationAmount:[32],selectAmount:[32],isCustomDonation:[32],selectedOptions:[32],canDisabled:[32],selectedSkus:[32],selectedOutSkus:[32],disableCardValue:[32],availableDigitalCardValues:[32],userInitiatedValidation:[32],isCartMode:[32],setOptionsData:[64],getSelectedOptionsData:[64],reportValidity:[64],hasOutOfStockOption:[64],getSelectedOptions:[64],getOption:[64],enterCartMode:[64],enableUserInitiatedValidation:[64],validateAndScroll:[64]}]);function O(){"undefined"!=typeof customElements&&["salla-product-options","salla-booking-field","salla-button","salla-color-picker","salla-conditional-fields","salla-datetime-picker","salla-file-upload","salla-loading","salla-map","salla-modal","salla-progress-bar"].forEach((i=>{switch(i){case"salla-product-options":customElements.get(t(i))||customElements.define(t(i),k);break;case"salla-booking-field":customElements.get(t(i))||r();break;case"salla-button":customElements.get(t(i))||d();break;case"salla-color-picker":customElements.get(t(i))||c();break;case"salla-conditional-fields":customElements.get(t(i))||p();break;case"salla-datetime-picker":customElements.get(t(i))||h();break;case"salla-file-upload":customElements.get(t(i))||u();break;case"salla-loading":customElements.get(t(i))||m();break;case"salla-map":customElements.get(t(i))||g();break;case"salla-modal":customElements.get(t(i))||f();break;case"salla-progress-bar":customElements.get(t(i))||b()}}))}O();export{k as S,O as d}
4
+ import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
5
+ import { I as IconVerified } from './check.js';
6
+ import { C as CameraIcon } from './camera.js';
7
+ import { d as defineCustomElement$a } from './salla-booking-field2.js';
8
+ import { d as defineCustomElement$9 } from './salla-button2.js';
9
+ import { d as defineCustomElement$8 } from './salla-color-picker2.js';
10
+ import { d as defineCustomElement$7 } from './salla-conditional-fields2.js';
11
+ import { d as defineCustomElement$6 } from './salla-datetime-picker2.js';
12
+ import { d as defineCustomElement$5 } from './salla-file-upload2.js';
13
+ import { d as defineCustomElement$4 } from './salla-loading2.js';
14
+ import { d as defineCustomElement$3 } from './salla-map2.js';
15
+ import { d as defineCustomElement$2 } from './salla-modal2.js';
16
+ import { d as defineCustomElement$1 } from './salla-progress-bar2.js';
17
+
18
+ var DisplayType;
19
+ (function (DisplayType) {
20
+ DisplayType["COLOR"] = "color";
21
+ DisplayType["DATE"] = "date";
22
+ DisplayType["DATETIME"] = "datetime";
23
+ DisplayType["DONATION"] = "donation";
24
+ DisplayType["IMAGE"] = "image";
25
+ DisplayType["MULTIPLE_OPTIONS"] = "multiple-options";
26
+ DisplayType["NUMBER"] = "number";
27
+ DisplayType["SINGLE_OPTION"] = "single-option";
28
+ DisplayType["DIGITAL_CARD_VALUE"] = "digital-code-value";
29
+ DisplayType["COUNTRY"] = "country";
30
+ DisplayType["SPLITTER"] = "splitter";
31
+ DisplayType["TEXT"] = "text";
32
+ DisplayType["TEXTAREA"] = "textarea";
33
+ DisplayType["THUMBNAIL"] = "thumbnail";
34
+ DisplayType["TIME"] = "time";
35
+ DisplayType["RADIO"] = "radio";
36
+ DisplayType["CHECKBOX"] = "checkbox";
37
+ DisplayType["MAP"] = "map";
38
+ DisplayType["FILE"] = "file";
39
+ DisplayType["COLOR_PICKER"] = "color_picker";
40
+ DisplayType["BOOKING"] = "booking";
41
+ })(DisplayType || (DisplayType = {}));
42
+ var Currency;
43
+ (function (Currency) {
44
+ Currency["Sar"] = "SAR";
45
+ })(Currency || (Currency = {}));
46
+
47
+ var FileIcon = `<!-- Generated by IcoMoon.io -->
48
+ <svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">
49
+ <title>file-upload</title>
50
+ <path d="M21.333 24c0.341 0 0.683-0.131 0.943-0.391 0.521-0.521 0.521-1.364 0-1.885l-5.333-5.333c-0.123-0.123-0.271-0.22-0.433-0.288-0.327-0.135-0.693-0.135-1.019 0-0.163 0.068-0.311 0.165-0.433 0.288l-5.333 5.333c-0.521 0.521-0.521 1.364 0 1.885s1.364 0.521 1.885 0l3.057-3.057v10.115c0 0.736 0.597 1.333 1.333 1.333s1.333-0.597 1.333-1.333v-10.115l3.057 3.057c0.26 0.26 0.601 0.391 0.943 0.391zM28.943 9.724l-9.333-9.333c-0.249-0.251-0.589-0.391-0.943-0.391h-12c-2.205 0-4 1.795-4 4v24c0 2.205 1.795 4 4 4h4c0.736 0 1.333-0.597 1.333-1.333s-0.597-1.333-1.333-1.333h-4c-0.735 0-1.333-0.599-1.333-1.333v-24c0-0.735 0.599-1.333 1.333-1.333h11.448l8.552 8.552v16.781c0 0.735-0.599 1.333-1.333 1.333h-4c-0.736 0-1.333 0.597-1.333 1.333s0.597 1.333 1.333 1.333h4c2.205 0 4-1.795 4-4v-17.333c0-0.353-0.14-0.693-0.391-0.943z"></path>
51
+ </svg>
52
+ `;
53
+
54
+ const sallaProductOptionsCss = "";
55
+
56
+ const SallaProductOptions = /*@__PURE__*/ proxyCustomElement(class SallaProductOptions extends HTMLElement {
57
+ constructor() {
58
+ super();
59
+ this.__registerHost();
60
+ this.changed = createEvent(this, "changed", 7);
61
+ this.fileTypes = {
62
+ pdf: 'application/pdf',
63
+ png: 'image/png',
64
+ jpg: 'image/jpeg',
65
+ word: 'application/doc,application/ms-doc,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document',
66
+ exl: 'application/excel,application/vnd.ms-excel,application/x-excel,application/x-msexcel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
67
+ txt: 'text/plain',
68
+ };
69
+ this.outOfStockText = "";
70
+ this.donationAmount = salla.lang.get('pages.products.donation_amount');
71
+ this.selectDonationAmount = salla.lang.getWithDefault('pages.products.select_donation_amount', 'تحديد مبلغ التبرع');
72
+ this.selectAmount = salla.lang.getWithDefault('pages.products.select_amount', 'اختر المبلغ');
73
+ this.isCustomDonation = false;
74
+ this.selectedOptions = [];
75
+ this.canDisabled = false;
76
+ this.disableCardValue = true;
77
+ this.availableDigitalCardValues = [];
78
+ this.userInitiatedValidation = false;
79
+ this.isCartMode = false;
80
+ this.outSkus = [];
81
+ /**
82
+ * Avoid selection of previous default or selected card value option
83
+ * when switching between digital card country options for the 1st time
84
+ */
85
+ this.ignoreDefaultCardValue = false;
86
+ /**
87
+ * The id of the product to which the options are going to be fetched for.
88
+ */
89
+ this.productId = salla.config.get('page.id');
90
+ this.handleDonationOptions = (event, detail, type, _option) => {
91
+ // Donating-amount input only: onInput updates price and dispatches native change for form price watcher.
92
+ if (detail === 'custom' && type === 'input') {
93
+ const inputTarget = event.target;
94
+ salla.helpers.inputDigitsOnly(inputTarget);
95
+ salla.event.emit('product-options::donation-changed', {
96
+ id: this.productId,
97
+ price: inputTarget.value
98
+ });
99
+ inputTarget.dispatchEvent(new window.Event('change', { bubbles: true }));
100
+ return;
101
+ }
102
+ // Tab (radio) change: get value from the radio that fired.
103
+ const value = type === 'option' ? String(event.target?.value ?? '') : '';
104
+ if (type === 'option' && detail === 'custom') {
105
+ // "Custom" tab: stop propagation so form does not see change until user types in donating-amount input.
106
+ event.preventDefault();
107
+ event.stopPropagation();
108
+ event.stopImmediatePropagation();
109
+ }
110
+ this.isCustomDonation = value === 'custom';
111
+ if (this.donationInput) {
112
+ if (value === 'custom') {
113
+ this.donationInput.value = '';
114
+ this.donationInput.focus();
115
+ }
116
+ else {
117
+ this.donationInput.value = value;
118
+ }
119
+ if (detail === 'custom') {
120
+ return;
121
+ }
122
+ salla.event.emit('product-options::donation-changed', {
123
+ id: this.productId,
124
+ price: value
125
+ });
126
+ }
127
+ };
128
+ this.hideLabel = (option) => {
129
+ if (option.type === DisplayType.DONATION && (option.donation && !option.donation.can_donate)) {
130
+ return true;
131
+ }
132
+ return false;
133
+ };
134
+ this.getExpireDonationMessage = (option) => {
135
+ if (!option.donation) {
136
+ return;
137
+ }
138
+ const completed = option.donation.target_amount <= option.donation.collected_amount;
139
+ return h("div", { class: { "s-product-options-donation-message": true, "s-product-options-donation-completed": completed, "s-product-options-donation-expired": !completed } }, h("p", null, option.donation.target_message), h("span", { innerHTML: completed ? salla.money(option.donation.target_amount) : '' }));
140
+ };
141
+ salla.lang.onLoaded(() => {
142
+ this.outOfStockText = salla.lang.get("pages.products.out_of_stock");
143
+ this.donationAmount = salla.lang.get('pages.products.donation_amount');
144
+ this.selectDonationAmount = salla.lang.getWithDefault('pages.products.select_donation_amount', 'تحديد مبلغ التبرع');
145
+ this.selectAmount = salla.lang.getWithDefault('pages.products.select_amount', 'اختر المبلغ');
146
+ });
147
+ if (this.options) {
148
+ try {
149
+ this.setOptionsData(Array.isArray(this.options) ? this.options : JSON.parse(this.options));
150
+ return;
151
+ }
152
+ catch (e) {
153
+ salla.log('Bad json passed via options prop');
154
+ }
155
+ }
156
+ if (!Array.isArray(this.optionsData)) {
157
+ salla.log('Options is not an array[] ---> ', this.optionsData);
158
+ this.setOptionsData([]);
159
+ }
160
+ if (this.productId && !salla.url.is_page('cart')) {
161
+ salla.api.product.getDetails(this.productId, ['options']).then(resp => this.setOptionsData(resp.data.options));
162
+ }
163
+ }
164
+ /**
165
+ * Sets the options data for the product
166
+ * @param optionsData - Array of product options
167
+ */
168
+ async setOptionsData(optionsData) {
169
+ this.optionsData = optionsData;
170
+ const that = this;
171
+ this.optionsData[0]?.details?.forEach(function (detail) {
172
+ Object.entries(detail.skus_availability || {})
173
+ .filter(sku => !sku[1])
174
+ .map(sku => that.outSkus.push(Number(sku[0])));
175
+ });
176
+ }
177
+ /**
178
+ * Get the id's of the selected options.
179
+ * */
180
+ async getSelectedOptionsData() {
181
+ const selectedOptions = {};
182
+ const formData = this.host.getElementSallaData();
183
+ // Check if bundleContext is defined as a prop on the component before accessing it
184
+ const contextData = (typeof this.bundleContext !== 'undefined') ? this.bundleContext : null;
185
+ formData.forEach((value, key) => {
186
+ if (contextData) {
187
+ // Handle bundle naming convention: bundle[sectionId][index][options][optionId]
188
+ if (key.startsWith('bundle[') && key.includes('[options][')) {
189
+ const optionId = key.split('[options][')[1].replace(']', '');
190
+ selectedOptions[optionId] = value;
191
+ }
192
+ }
193
+ else {
194
+ // Handle standard naming convention: options[optionId]
195
+ if (key.startsWith('options[')) {
196
+ selectedOptions[key.replace('options[', '').replace(']', '')] = value;
197
+ }
198
+ }
199
+ });
200
+ return selectedOptions;
201
+ }
202
+ /**
203
+ * Report options form validity.
204
+ * */
205
+ async reportValidity() {
206
+ const requiredElements = this.host.querySelectorAll('[required]');
207
+ let pass = true;
208
+ for (let i = 0; i < requiredElements.length; i++) {
209
+ //if there is only one invalid option, return false
210
+ if ('reportValidity' in requiredElements[i] && !requiredElements[i].reportValidity()) {
211
+ pass = false;
212
+ }
213
+ }
214
+ return pass;
215
+ }
216
+ /**
217
+ * Return true if there is any out of stock options are selected and vise versa.
218
+ * */
219
+ async hasOutOfStockOption() {
220
+ return this.selectedOptions.some(option => option.is_out) || (this.selectedSkus?.length && this.selectedSkus?.every(sku => this.outSkus.includes(sku)));
221
+ }
222
+ /**
223
+ * Get selected options.
224
+ * */
225
+ async getSelectedOptions() {
226
+ return this.selectedOptions;
227
+ }
228
+ /**
229
+ * Get a specific option by its id.
230
+ * */
231
+ async getOption(option_id) {
232
+ return this.optionsData.find(option => option.id === option_id);
233
+ }
234
+ // @ts-ignore
235
+ invalidHandler(event, option) {
236
+ const closestProductOption = event.target.closest('.s-product-options-option');
237
+ if (!closestProductOption.classList.contains('s-product-options-option-error')) {
238
+ closestProductOption.classList.add('s-product-options-option-error');
239
+ }
240
+ if ((this.userInitiatedValidation || salla.helpers.isIOSDevice()) && !salla.url.is_page('cart')) {
241
+ const firstInvalidElement = this.host.querySelector('.s-product-options-option-error');
242
+ if (firstInvalidElement === closestProductOption) {
243
+ this.scrollToElement(closestProductOption);
244
+ }
245
+ }
246
+ }
247
+ scrollToElement(element) {
248
+ if (!element)
249
+ return;
250
+ element.scrollIntoView({ behavior: 'smooth', block: 'center' });
251
+ }
252
+ changedHandler(event, option, fireChangeEvent = true) {
253
+ const data = {
254
+ event: event,
255
+ option: option,
256
+ detail: null,
257
+ productId: this.productId
258
+ };
259
+ if (option.details) {
260
+ const detail = option.details.find((detail) => {
261
+ return Number(detail.id) === Number(event.target.value);
262
+ });
263
+ data.detail = detail;
264
+ }
265
+ if (option.type === 'country') {
266
+ this.handleCountryOptionChange(event, data.detail);
267
+ }
268
+ const optionElement = event.target.closest('.s-product-options-option');
269
+ if (event.target.value ||
270
+ ((option.type === DisplayType.FILE || option.type === DisplayType.IMAGE) && event.type === 'added') ||
271
+ (option.type === DisplayType.MAP && event.type === 'selected' && (event.target.lat && event.target.lng))) {
272
+ setTimeout(() => {
273
+ optionElement.classList.remove('s-product-options-option-error');
274
+ }, 200);
275
+ }
276
+ if (option.type === DisplayType.DONATION) {
277
+ salla.event.emit('product-options::donation-changed', {
278
+ id: this.productId,
279
+ price: event.target.value
280
+ });
281
+ }
282
+ this.setSelectedSkus();
283
+ this.handleRequiredMultipleOptions(option);
284
+ const index = this.selectedOptions.findIndex(opt => opt.option_id === data.option.id);
285
+ if (data.option.type === DisplayType.MULTIPLE_OPTIONS) {
286
+ // Handle multiple selections
287
+ const detailIndex = this.selectedOptions.findIndex(opt => opt.option_id === data.option.id && opt?.id === data.detail?.id);
288
+ if (detailIndex > -1) {
289
+ // If the option is already selected, remove it (unselect)
290
+ this.selectedOptions.splice(detailIndex, 1);
291
+ }
292
+ else {
293
+ // If the option is not selected, add it to the selectedOptions array
294
+ this.selectedOptions.push({ ...data.detail, option_id: data.option.id });
295
+ }
296
+ }
297
+ else {
298
+ // Handle single selection
299
+ if (!data.detail || Object.keys(data.detail).length === 0) {
300
+ // If there is no value for the single-select, remove it from the selectedOptions array
301
+ if (index > -1) {
302
+ this.selectedOptions.splice(index, 1);
303
+ }
304
+ }
305
+ else {
306
+ // If a value exists, update or add the selection
307
+ if (index > -1) {
308
+ // Replace the existing selection with the new one
309
+ this.selectedOptions[index] = { ...data.detail, option_id: data.option.id };
310
+ }
311
+ else {
312
+ // If no selection exists for this input, add the new selection
313
+ this.selectedOptions.push({ ...data.detail, option_id: data.option.id });
314
+ }
315
+ }
316
+ }
317
+ // Update optionsData directly
318
+ this.optionsData = this.optionsData.map(opt => {
319
+ if (opt.id === data.option.id) {
320
+ return {
321
+ ...opt,
322
+ details: opt.details.map(detail => ({
323
+ ...detail,
324
+ is_selected: data.option.type === DisplayType.MULTIPLE_OPTIONS
325
+ ? this.selectedOptions.some(selected => selected.id === detail.id)
326
+ : Number(detail.id) === Number(data.detail?.id),
327
+ value: data.detail?.value
328
+ }))
329
+ };
330
+ }
331
+ return opt;
332
+ });
333
+ // Emit the event only if fireChangeEvent is true
334
+ if (fireChangeEvent) {
335
+ this.changed.emit(data);
336
+ salla.event.emit('product-options::change', data);
337
+ }
338
+ }
339
+ /**
340
+ * loop throw all selected details, then get common sku, if it's only one, means we selected all of them;
341
+ */
342
+ setSelectedSkus() {
343
+ this.selectedSkus = this.selectedOptions.map(detail => Object.keys(detail.skus_availability || {}))
344
+ .reduce((p, c) => p.filter(e => c.includes(e)), []) // Initialize accumulator as an empty array
345
+ .map(sku => Number(sku));
346
+ }
347
+ handleRequiredMultipleOptions(option) {
348
+ if (option.type !== DisplayType.MULTIPLE_OPTIONS || !option.required) {
349
+ return;
350
+ }
351
+ const optionContainer = this.host.querySelector(`[data-option-id="${option.id}"]`);
352
+ const hasChecked = optionContainer.querySelectorAll('input:checked').length;
353
+ optionContainer.querySelectorAll('input').forEach(input => input.toggleAttribute('required', !hasChecked));
354
+ }
355
+ getLatLng(value, type) {
356
+ return value
357
+ ? value.split(',')[type === 'lat' ? 0 : 1]
358
+ : '';
359
+ }
360
+ getDisplayForType(option) {
361
+ if (this[`${option.type}Option`]) {
362
+ return this[`${option.type}Option`](option);
363
+ }
364
+ if (option.type === DisplayType.COLOR_PICKER) {
365
+ return this.colorPickerOption(option);
366
+ }
367
+ if (option.type === DisplayType.MULTIPLE_OPTIONS) {
368
+ return this.multipleOptions(option);
369
+ }
370
+ if (option.type === DisplayType.SINGLE_OPTION) {
371
+ return this.singleOption(option);
372
+ }
373
+ // Handle radio type as single option for bundle products
374
+ if (option.type === DisplayType.RADIO) {
375
+ return this.radioOption(option);
376
+ }
377
+ if (option.type === DisplayType.DIGITAL_CARD_VALUE) {
378
+ return this.digitalCardValuesOption(option);
379
+ }
380
+ if (option.type === DisplayType.COUNTRY) {
381
+ return this.countryOption(option);
382
+ }
383
+ if (option.type === DisplayType.BOOKING && salla.url.is_page("cart")) {
384
+ return h("salla-booking-field", { onInvalidInput: (e) => this.invalidHandler(e, option), option: option, productId: option.value });
385
+ }
386
+ salla.log(`Couldn't find options type(${option.type})😢`);
387
+ return '';
388
+ }
389
+ getOptionShownWhen(option) {
390
+ return option.visibility_condition
391
+ ? { "data-show-when": `options[${option.visibility_condition.option}] ${option.visibility_condition.operator} ${option.visibility_condition.value}` }
392
+ : {};
393
+ }
394
+ getAvailableDigitalCardSKUs(detail) {
395
+ const digitalCardOption = this.optionsData.find(({ type }) => type === 'digital-code-value');
396
+ if (!digitalCardOption)
397
+ throw new Error('product-options:: No digital card options found');
398
+ const outofStockSKUs = Object.keys(detail.skus_availability).filter(key => detail.skus_availability[key] === false);
399
+ this.availableDigitalCardValues = digitalCardOption.details.filter((op) => {
400
+ return !Object.keys(op.skus_availability).filter(SKU_key => outofStockSKUs.includes(SKU_key)).length;
401
+ });
402
+ }
403
+ handleCountryOptionChange(event, detail) {
404
+ event.stopImmediatePropagation();
405
+ this.ignoreDefaultCardValue = true;
406
+ const currentCardValue = this.host.querySelector("input[data-code-value]:checked");
407
+ if (currentCardValue)
408
+ currentCardValue.checked = false;
409
+ const digitalCardOption = this.optionsData.find(({ type }) => type === 'digital-code-value');
410
+ if (!digitalCardOption)
411
+ throw new Error('product-options:: No digital card options found');
412
+ this.getAvailableDigitalCardSKUs(detail);
413
+ }
414
+ getSelectedDigitalCardOptions(option) {
415
+ const selectedOption = option.details.find(detail => detail.is_selected);
416
+ const defaultOption = option.details.find(detail => !!detail.is_default) || option.details[0]; /*option.details[0] only applys for counrty options*/
417
+ if (!['digital-code-value', 'country'].includes(option.type))
418
+ return;
419
+ return selectedOption || defaultOption;
420
+ }
421
+ //we need the cart Id for productOption Image
422
+ async componentWillLoad() {
423
+ if (salla.url.is_page("cart")) {
424
+ this.disableCardValue = false;
425
+ this.fillSelectedOptions();
426
+ }
427
+ if (this.config) {
428
+ try {
429
+ this.optionConfig = typeof this.config === 'string' ? JSON.parse(this.config) : this.config;
430
+ }
431
+ catch (error) {
432
+ console.error('Failed to parse JSON in config prop:', error);
433
+ }
434
+ }
435
+ const shouldSelectDefaultOption = this.optionsData.filter(({ type }) => ["country", "digital-card-value"].includes(type)).length > 0 && salla.url.is_page('cart');
436
+ if (shouldSelectDefaultOption) {
437
+ const countryOption = this.optionsData.find(option => option.type === 'country');
438
+ const defaultSelection = countryOption && this.getSelectedDigitalCardOptions(countryOption);
439
+ if (defaultSelection) {
440
+ this.getAvailableDigitalCardSKUs(defaultSelection);
441
+ }
442
+ }
443
+ this.outOfStockText = salla.lang.get('pages.products.out_of_stock');
444
+ await salla.onReady();
445
+ this.canDisabled = !salla.config.get('store.settings.product.notify_options_availability') || salla.url.is_page('cart');
446
+ this.pasteHandler = this.handlePaste.bind(this);
447
+ document.addEventListener("paste", this.pasteHandler);
448
+ const needsCartId = (!salla.storage.get('cart.id') && this.optionsData.some(option => ['file', 'image'].includes(option.type)));
449
+ return needsCartId ? salla.api.cart.getCurrentCartId(false, "salla-product-options") : null;
450
+ }
451
+ disconnectedCallback() {
452
+ if (this.pasteHandler) {
453
+ document.removeEventListener("paste", this.pasteHandler);
454
+ }
455
+ }
456
+ /**
457
+ * This is a workaround for a bug in iOS 26 Safari, when pasting English text to RTL inputs, it adds extra text!!
458
+ * To avoid any break changes, we will make it only work on these conditions:
459
+ * - content_copyright is on
460
+ * - Apple Pay is enabled (means it's iOS/safari)
461
+ * - Input is an input or textarea
462
+ * - Salla form control
463
+ * - Options array
464
+ */
465
+ handlePaste(event) {
466
+ const target = event.target;
467
+ if (!Salla.helpers.isAppleDevice()
468
+ || !(target instanceof HTMLInputElement || target instanceof HTMLTextAreaElement)
469
+ || !target.classList.contains('s-form-control')
470
+ || !this.host.contains(target)) {
471
+ return;
472
+ }
473
+ // Prevent default paste (to avoid Safari inserting extra content)
474
+ event.preventDefault();
475
+ // Read only the clipboard data
476
+ const text = event.clipboardData?.getData("text") || "";
477
+ // Insert it manually at cursor if you want
478
+ const start = target.selectionStart;
479
+ const end = target.selectionEnd;
480
+ const newValue = target.value.slice(0, start) + text + target.value.slice(end);
481
+ target.value = newValue;
482
+ // Reset cursor position
483
+ target.setSelectionRange(start + text.length, start + text.length);
484
+ try {
485
+ target.dispatchEvent(new window.Event('change', { bubbles: true }));
486
+ }
487
+ catch (error) {
488
+ Salla.log('Error on change');
489
+ }
490
+ }
491
+ hideDigitalCardsOptions(option) {
492
+ return (this.disableCardValue && option.type === DisplayType.DIGITAL_CARD_VALUE && !salla.url.is_page("cart"));
493
+ }
494
+ render() {
495
+ if (this.optionsData?.length === 0) {
496
+ return;
497
+ }
498
+ return (h(Host, { class: "s-product-options-wrapper" }, h("salla-conditional-fields", null, this.optionsData.map((option) => h("div", { key: option.id, class: `s-product-options-option-container${option.visibility_condition || this.hideDigitalCardsOptions(option) ? ' hidden' : ''}`, "data-option-id": option.id, ...this.getOptionShownWhen(option) }, option.name === 'splitter' ?
499
+ this.splitterOption()
500
+ : h("div", { class: { "s-product-options-option": true, "s-product-options-option-booking": option.type === DisplayType.BOOKING && salla.url.is_page("cart") }, "data-option-type": option.type, "data-option-required": `${option.required}` }, h("label", { htmlFor: this.generateInputId(option.id), class: `s-product-options-option-label ${this.hideLabel(option) ? 's-product-options-option-label-hidden' : ''}` }, h("b", null, option.name, option.required && h("span", null, " * "), " "), h("small", null, option.placeholder)), h("div", { class: `s-product-options-option-content ${this.hideLabel(option) || (option.type === DisplayType.BOOKING && salla.url.is_page("cart")) ? 's-product-options-option-content-full-width' : ''}` }, this.getDisplayForType(option))))))));
501
+ }
502
+ generateUniqueKey(defaultValue) {
503
+ const contextData = this.bundleContext;
504
+ let baseKey = this.uniqueKey ? `${defaultValue}-${this.uniqueKey}` : defaultValue;
505
+ if (contextData) {
506
+ try {
507
+ // Handle both string and object types
508
+ const context = typeof contextData === 'string'
509
+ ? JSON.parse(contextData)
510
+ : contextData;
511
+ const { sectionId, productId } = context;
512
+ baseKey = `${baseKey}-bundle-${sectionId}-${productId}`;
513
+ }
514
+ catch (e) {
515
+ // If parsing fails, just use the base key
516
+ }
517
+ }
518
+ return baseKey;
519
+ }
520
+ /**
521
+ * Generate a valid HTML id for option inputs.
522
+ * @param optionId - The option ID
523
+ * @returns The formatted id string
524
+ */
525
+ generateInputId(optionId) {
526
+ return this.generateUniqueKey(`option-${optionId}`);
527
+ }
528
+ /**
529
+ * Generate the correct input name based on bundle context
530
+ * @param optionId - The option ID
531
+ * @returns The formatted input name
532
+ */
533
+ generateInputName(optionId) {
534
+ const contextData = this.bundleContext;
535
+ const baseOptionId = optionId.toString();
536
+ if (contextData) {
537
+ try {
538
+ // Handle both string and object types
539
+ const context = typeof contextData === 'string'
540
+ ? JSON.parse(contextData)
541
+ : contextData;
542
+ const { sectionId, productId } = context;
543
+ return `bundle[${sectionId}][${productId}][options][${baseOptionId}]`;
544
+ }
545
+ catch (e) {
546
+ return `options[${baseOptionId}]`;
547
+ }
548
+ }
549
+ return `options[${baseOptionId}]`;
550
+ }
551
+ fillSelectedOptions() {
552
+ this.selectedOptions = this.optionsData.reduce((acc, opt) => {
553
+ const selectedDetails = opt.details.filter(detail => detail.is_selected);
554
+ const mappedDetails = selectedDetails.map(detail => ({
555
+ ...detail,
556
+ option_id: opt.id
557
+ }));
558
+ return acc.concat(mappedDetails);
559
+ }, []);
560
+ }
561
+ async componentDidLoad() {
562
+ if (!this.optionsData?.length) {
563
+ return;
564
+ }
565
+ // Register for hooks — theme can call enterCartMode() here
566
+ await Salla.hooks.registerComponent('salla-product-options', this);
567
+ // Handle donation options
568
+ const selectedDonationOption = this.optionsData.find(option => option.type === DisplayType.DONATION)?.details?.find(detail => detail.is_selected);
569
+ if (selectedDonationOption) {
570
+ setTimeout(() => {
571
+ salla.event.emit('product-options::donation-changed', {
572
+ id: this.productId,
573
+ price: selectedDonationOption.additional_price
574
+ });
575
+ }, 1000);
576
+ }
577
+ // Handle pre-selected options on product page
578
+ // Skip if in cart mode (enterCartMode called by hook) or on cart page
579
+ // Call salla.product.getPrice() directly to avoid triggering form validation which causes unwanted scroll
580
+ if (!salla.url.is_page("cart") && !this.isCartMode) {
581
+ const pricingOptionTypes = [
582
+ DisplayType.SINGLE_OPTION,
583
+ DisplayType.MULTIPLE_OPTIONS,
584
+ DisplayType.COLOR,
585
+ DisplayType.THUMBNAIL,
586
+ DisplayType.DONATION,
587
+ DisplayType.DIGITAL_CARD_VALUE,
588
+ DisplayType.COUNTRY
589
+ ];
590
+ const hasPreSelectedPricingOption = this.optionsData.some(option => pricingOptionTypes.includes(option.type) &&
591
+ option.details?.some(detail => detail.is_selected));
592
+ if (hasPreSelectedPricingOption) {
593
+ // Use requestAnimationFrame to ensure DOM is fully painted before accessing form
594
+ requestAnimationFrame(() => {
595
+ try {
596
+ const form = this.host.closest('form');
597
+ if (!form)
598
+ return;
599
+ // Validate form belongs to this product to avoid conflicts on complex pages
600
+ const formData = new FormData(form);
601
+ const formProductId = formData.get('id') || formData.get('product_id');
602
+ if (formProductId && String(formProductId) !== String(this.productId))
603
+ return;
604
+ salla.product.getPrice(formData);
605
+ }
606
+ catch (e) {
607
+ salla.log('Error updating price for pre-selected options:', e);
608
+ }
609
+ });
610
+ }
611
+ }
612
+ }
613
+ /**
614
+ * Switch the component to cart-item mode: fill selected options,
615
+ * enable disabled-out-of-stock, and skip product price updates.
616
+ * Used by themes when treating a product page as a cart item editor.
617
+ */
618
+ async enterCartMode() {
619
+ this.isCartMode = true;
620
+ this.disableCardValue = false;
621
+ this.canDisabled = true;
622
+ this.fillSelectedOptions();
623
+ }
624
+ /**
625
+ * Enable user-initiated validation mode so invalid fields will scroll into view
626
+ */
627
+ async enableUserInitiatedValidation() {
628
+ this.userInitiatedValidation = true;
629
+ }
630
+ /**
631
+ * Validate options and trigger scrolling to the first invalid option if any
632
+ */
633
+ async validateAndScroll() {
634
+ await this.enableUserInitiatedValidation();
635
+ return this.reportValidity();
636
+ }
637
+ //@ts-ignore
638
+ donationOption(option, product) {
639
+ return h("div", { class: "s-product-options-donation-wrapper" }, option.donation?.can_donate ? [
640
+ option.donation ?
641
+ h("div", { key: option.id, class: "s-product-options-donation-progress" }, h("salla-progress-bar", { donation: option.donation }))
642
+ : '',
643
+ option.details.length ?
644
+ [h("h4", { key: option.id }, this.selectAmount), h("div", { key: option.id, class: "s-product-options-donation-options" }, option.details.map((detail, i) => h("div", { key: option.id, class: "s-product-options-donation-options-item" }, h("input", { id: this.generateUniqueKey(`donation-option-${i}`), type: "radio", name: "donating_option", checked: detail.is_selected, value: detail.additional_price, onChange: e => this.handleDonationOptions(e, detail, 'option', option) }), h("label", { htmlFor: this.generateUniqueKey(`donation-option-${i}`) }, h("span", { innerHTML: salla.money(detail.name) })))), option.donation?.custom_amount_enabled ?
645
+ h("div", { class: "s-product-options-donation-options-item" }, h("input", { id: this.generateUniqueKey("donation-option-custom"), type: "radio", name: "donating_option", value: "custom", onChange: e => this.handleDonationOptions(e, 'custom', 'option', option) }), h("label", { htmlFor: this.generateUniqueKey("donation-option-custom") }, h("span", null, " ", this.selectDonationAmount, " ")))
646
+ : '')] : '',
647
+ h("div", { key: option.id, class: { "s-product-options-donation-input-group": true, "shown": !option.details.length || (option.details.length && this.isCustomDonation) } }, h("input", { type: "text", id: "donating-amount", name: "donation_amount", class: "s-form-control", ref: el => { this.donationInput = el; }, value: option.details.length
648
+ && option.details.some(detail => detail.is_selected)
649
+ ? option.details.find(detail => detail.is_selected).additional_price
650
+ : option.value,
651
+ // required
652
+ placeholder: option.placeholder, onInput: e => this.handleDonationOptions(e, 'custom', 'input', option), onBlur: e => this.changedHandler(e, option), onInvalid: (e) => this.invalidHandler(e, option) }), h("span", { class: "s-product-options-donation-amount-currency" }, salla.config.currency(salla.config.get('user.currency_code')).symbol))
653
+ ] :
654
+ this.getExpireDonationMessage(option));
655
+ }
656
+ fileUploader(option, additions = null) {
657
+ return h("salla-file-upload", { ...(additions || {}), "payload-name": "file", value: option.value, "instant-upload": true, name: this.generateInputName(option.id), required: !option.visibility_condition && option.required, height: "120px", onAdded: (e) => this.changedHandler(e, option), url: salla.cart.api.getUploadImageEndpoint(), "form-data": { cart_item_id: this.productId, product_id: this.productId }, onInvalidInput: (e) => this.invalidHandler(e, option), class: { "s-product-options-image-input": true, required: option.required } }, h("div", { class: "s-product-options-filepond-placeholder" }, h("span", { class: "s-product-options-filepond-placeholder-icon", innerHTML: additions.accept?.split(',').every(type => type.includes('image'))
658
+ ? CameraIcon
659
+ : FileIcon }), h("p", { class: "s-product-options-filepond-placeholder-text" }, salla.lang.get('common.uploader.drag_and_drop')), h("span", { class: "filepond--label-action" }, salla.lang.get('common.uploader.browse'))));
660
+ }
661
+ //@ts-ignore
662
+ imageOption(option) {
663
+ return this.fileUploader(option, { accept: 'image/png,image/jpeg,image/jpg,image/gif' });
664
+ }
665
+ //@ts-ignore
666
+ fileOption(option) {
667
+ const types = option.details.map(detail => this.fileTypes[detail.name]).filter(Boolean);
668
+ return types?.length
669
+ ? this.fileUploader(option, { accept: types.join(',') })
670
+ : 'File types not selected.';
671
+ }
672
+ // TODO: (ONLY FOR TESTING!) find a better way to make it testable, e.g. wrap it with a unique class like textOption
673
+ //@ts-ignore
674
+ numberOption(option) {
675
+ return h("input", { type: "text", value: option.value, class: "s-form-control", required: !option.visibility_condition && option.required, id: this.generateInputId(option.id), name: this.generateInputName(option.id), placeholder: option.placeholder, onBlur: e => this.changedHandler(e, option), onInvalid: (e) => this.invalidHandler(e, option), onInput: e => salla.helpers.inputDigitsOnly(e.target) });
676
+ }
677
+ //@ts-ignore
678
+ splitterOption() {
679
+ return h("div", { class: "s-product-options-splitter" });
680
+ }
681
+ //@ts-ignore
682
+ textOption(option) {
683
+ return h("div", { class: "s-product-options-text" }, h("input", { type: "text", value: option.value, maxLength: option?.length, class: 's-form-control', required: !option.visibility_condition && option.required, id: this.generateInputId(option.id), name: this.generateInputName(option.id), placeholder: option.placeholder, onInvalid: (e) => this.invalidHandler(e, option), onChange: e => this.changedHandler(e, option) }));
684
+ }
685
+ //@ts-ignore
686
+ textareaOption(option) {
687
+ //todo::remove mt-1 class, and if it's okay to remove the tag itself will be great
688
+ return h("div", { class: "s-product-options-textarea" }, h("div", { class: "mt-1" }, h("textarea", { rows: 4, value: option.value, maxLength: option?.length, class: "s-form-control", required: !option.visibility_condition && option.required, id: this.generateInputId(option.id), name: this.generateInputName(option.id), placeholder: option.placeholder, onInvalid: (e) => this.invalidHandler(e, option), onChange: (e) => this.changedHandler(e, option) })));
689
+ }
690
+ //@ts-ignore
691
+ mapOption(option) {
692
+ return h("salla-map", { zoom: 15, lat: this.getLatLng(option.value, 'lat'), lng: this.getLatLng(option.value, 'lng'), name: this.generateInputName(option.id), searchable: true, required: option.required, onInvalidInput: (e) => this.invalidHandler(e, option), onSelected: e => this.changedHandler(e, option) });
693
+ }
694
+ colorPickerOption(option) {
695
+ return h("salla-color-picker", { onSubmitted: e => this.changedHandler(e, option), name: this.generateInputName(option.id), required: !option.visibility_condition && option.required, onInvalidInput: (e) => this.invalidHandler(e, option), color: option.value });
696
+ }
697
+ /**
698
+ * ============= Date Time options =============
699
+ */
700
+ //@ts-ignore
701
+ timeOption(option) {
702
+ return h("salla-datetime-picker", { noCalendar: true, enableTime: true, dateFormat: "h:i K", value: option.value, placeholder: option.name, required: !option.visibility_condition && option.required, name: this.generateInputName(option.id), class: "s-product-options-time-element", onInvalidInput: (e) => this.invalidHandler(e, option), onPicked: e => this.changedHandler(e, option) });
703
+ }
704
+ //@ts-ignore
705
+ dateOption(option) {
706
+ //todo:: consider date-range @see https://github.com/SallaApp/theme-raed/blob/master/src/assets/js/partials/product-options.js#L8-L23
707
+ return h("div", { class: "s-product-options-date-element" }, h("salla-datetime-picker", { value: option.value, placeholder: option.name, required: !option.visibility_condition && option.required, minDate: new Date(), name: this.generateInputName(option.id), onInvalidInput: (e) => this.invalidHandler(e, option), onPicked: e => this.changedHandler(e, option) }));
708
+ }
709
+ //@ts-ignore
710
+ datetimeOption(option) {
711
+ //todo:: consider date-range @see https://github.com/SallaApp/theme-raed/blob/master/src/assets/js/partials/product-options.js#L8-L23
712
+ return h("div", { class: "s-product-options-datetime-element" }, h("salla-datetime-picker", { enableTime: true, value: option.value, dateFormat: "Y-m-d G:i:K", placeholder: option.name, required: !option.visibility_condition && option.required, name: this.generateInputName(option.id), maxDate: option.to_date_time, minDate: option.from_date_time, onInvalidInput: (e) => this.invalidHandler(e, option), onPicked: e => this.changedHandler(e, option) }));
713
+ }
714
+ /**
715
+ * ============= Advanced options =============
716
+ */
717
+ getOptionDetailName(detail, outOfStock = true, optionType) {
718
+ let detailName;
719
+ if (optionType && optionType === DisplayType.COLOR) {
720
+ detailName = detail.name
721
+ + ((outOfStock && this.isOptionDetailOut(detail) && !salla.url.is_page("cart")) && !this.hideOutLabel ? ` <br/> <p> ${this.outOfStockText} </p>` : '')
722
+ + (detail.additional_price ? ` <p> (${salla.money(detail.additional_price, false)}) </p>` : '');
723
+ }
724
+ if (!detailName) {
725
+ detailName = detail.name
726
+ + ((outOfStock && this.isOptionDetailOut(detail) && !salla.url.is_page("cart")) && !this.hideOutLabel ? ` - ${this.outOfStockText}` : '')
727
+ + (detail.additional_price ? ` (${salla.money(detail.additional_price, false)})` : '');
728
+ }
729
+ //Some merchants adding price to the names of the options,
730
+ //and because we are using this inside select option, we need to replace the html currency symbol with the store currency symbol
731
+ return detailName.replace('<i class=sicon-sar></i>', salla.config.currency()?.symbol || 'ر.س');
732
+ }
733
+ isOptionDetailOut(detail) {
734
+ if (detail.is_out || !detail.skus_availability || !this.selectedSkus?.length) {
735
+ return detail.is_out;
736
+ }
737
+ const isDetailSelected = this.selectedOptions.filter(option => option.id === detail.id).length;
738
+ //if the current options is the only selected option, so we are sure that it's not out, because there is no other options selected yet
739
+ if (isDetailSelected && this.selectedOptions.length === 1) {
740
+ return false;
741
+ }
742
+ //if current details has sku in the possible outSkus it's out for sure
743
+ if (isDetailSelected) {
744
+ //here we will get the possible outSkus for current selected options
745
+ const outSelectableSkus = this.selectedSkus.filter(sku => this.outSkus.includes(sku));
746
+ return Object.keys(detail.skus_availability).some(sku => outSelectableSkus.includes(Number(sku)));
747
+ }
748
+ return this.selectedOptions.some(option => option.is_out && option.option_id !== detail.option_id);
749
+ }
750
+ /**
751
+ * Renders a single input element (radio or checkbox) for an option detail.
752
+ * @param type - The type of input element ('radio' or 'checkbox').
753
+ * @param detail - The detail object representing an option detail.
754
+ * @param option - The parent option object containing the details.
755
+ * @param isRequired - Indicates if the input is required based on the option's rules.
756
+ * @param name - The name attribute for the input element.
757
+ * @returns HTMLElement - A labeled input element.
758
+ */
759
+ renderInput(type, detail, option, isRequired, name, buttonStyle) {
760
+ const id = this.generateUniqueKey(`${type}-${option.id}-${detail.id}`);
761
+ const isDisabled = this.isOptionDetailOut(detail);
762
+ return (h("label", { class: {
763
+ "s-product-options-disabled": isDisabled,
764
+ } }, h("input", { id: id, type: type, name: name, value: detail.id, disabled: isDisabled, required: isRequired, checked: detail.is_selected, onInvalid: (e) => this.invalidHandler(e, option), onChange: (e) => this.changedHandler(e, option) }), h("div", { class: { "s-product-options-grid-mode-span": buttonStyle, "s-product-options-disabled": isDisabled } }, this.getOptionDetailName(detail))));
765
+ }
766
+ /**
767
+ * Renders a collection of input elements for all details of an option.
768
+ * @param type - The type of input elements ('radio' or 'checkbox').
769
+ * @param option - The parent option object containing the details.
770
+ * @param isRequired - Indicates if the inputs are required based on the option's rules.
771
+ * @returns HTMLElement[] - An array of labeled input elements.
772
+ */
773
+ renderOptionDetails(type, option, isRequired, buttonStyle = false) {
774
+ const baseName = this.generateInputName(option.id);
775
+ const name = type === 'radio' ? baseName : `${baseName}[]`;
776
+ return option?.details.map((detail) => this.renderInput(type, detail, option, isRequired, name, buttonStyle));
777
+ }
778
+ /**
779
+ * Renders a dropdown (select) element for a single-option selection.
780
+ * @param option - The parent option object.
781
+ * @returns HTMLElement - A select dropdown element with all option details.
782
+ */
783
+ renderSelect(option) {
784
+ return (h("div", null, h("select", { id: this.generateInputId(option.id), name: this.generateInputName(option.id), required: !option.visibility_condition && option.required, class: "s-form-control", onInvalid: (e) => this.invalidHandler(e, option), onChange: (e) => this.changedHandler(e, option) }, h("option", { value: "" }, option.placeholder), option?.details.map((detail) => (h("option", { key: detail.id, value: detail.id, disabled: this.canDisabled && this.isOptionDetailOut(detail), selected: detail.is_selected }, this.getOptionDetailName(detail)))))));
785
+ }
786
+ /**
787
+ * Renders a grid-based layout for option inputs (radio or checkbox).
788
+ * @param type - The type of input elements ('radio' or 'checkbox').
789
+ * @param option - The parent option object containing the details.
790
+ * @param isRequired - Indicates if the inputs are required based on the option's rules.
791
+ * @returns HTMLElement - A grid-based container with input elements.
792
+ */
793
+ renderButtonStyle(type, option, isRequired) {
794
+ return (h("div", { class: "s-product-options-grid-mode" }, this.renderOptionDetails(type, option, isRequired, true)));
795
+ }
796
+ /**
797
+ * Renders a single-option selection, either as a grid or dropdown, based on configuration.
798
+ * @param option - The parent option object.
799
+ * @returns HTMLElement - The rendered single-option element.
800
+ */
801
+ singleOption(option) {
802
+ const buttonStyle = this.optionConfig?.['single-option']?.type === 'button';
803
+ const isRequired = !option.visibility_condition && option.required;
804
+ return buttonStyle
805
+ ? this.renderButtonStyle('radio', option, isRequired)
806
+ : this.renderSelect(option);
807
+ }
808
+ /**
809
+ * Renders a multiple-option selection, either as a grid or list, based on configuration.
810
+ * @param option - The parent option object.
811
+ * @returns HTMLElement - The rendered multiple-option element.
812
+ */
813
+ multipleOptions(option) {
814
+ const buttonStyle = this.optionConfig?.['multiple-option']?.type === 'button';
815
+ const isRequired = option.required &&
816
+ !option.details.some((detail) => detail.is_selected) &&
817
+ !option.visibility_condition;
818
+ return buttonStyle
819
+ ? this.renderButtonStyle('checkbox', option, isRequired)
820
+ : (h("div", { class: {
821
+ 's-product-options-multiple-options-wrapper': true,
822
+ required: option.required,
823
+ } }, this.renderOptionDetails('checkbox', option, isRequired)));
824
+ }
825
+ /**
826
+ * Renders a radio option selection (used for bundle products).
827
+ * This is essentially the same as single option but with explicit radio handling.
828
+ * @param option - The parent option object.
829
+ * @returns HTMLElement - The rendered radio option element.
830
+ */
831
+ radioOption(option) {
832
+ // Radio options behave the same as single options
833
+ return this.singleOption(option);
834
+ }
835
+ //@ts-ignore
836
+ colorOption(option) {
837
+ return (h("fieldset", { class: "s-product-options-colors-wrapper" }, option?.details.map((detail) => (h("div", { class: "s-product-options-colors-item", key: detail.id }, h("input", { type: "radio", value: detail.id, required: !option.visibility_condition && option.required, checked: detail.is_selected, name: this.generateInputName(option.id), disabled: this.canDisabled && this.isOptionDetailOut(detail), id: this.generateUniqueKey(`color-${this.productId}-${option.id}-${detail.id}`), onInvalid: (e) => this.invalidHandler(e, option), onChange: (e) => this.changedHandler(e, option) }), h("label", { htmlFor: this.generateUniqueKey(`color-${this.productId}-${option.id}-${detail.id}`) }, h("span", { style: { backgroundColor: detail.color } }), h("div", { innerHTML: this.getOptionDetailName(detail, true, option.type) })))))));
838
+ }
839
+ //@ts-ignore
840
+ thumbnailOption(option) {
841
+ return h("div", { class: "s-product-options-thumbnails-wrapper" }, option.details.map((detail) => {
842
+ return h("div", { key: detail.id }, h("input", { type: "radio", value: detail.id, "data-itemid": detail.id, required: !option.visibility_condition && option.required, checked: detail.is_selected, name: this.generateInputName(option.id), "data-img-id": detail.option_value, disabled: this.canDisabled && this.isOptionDetailOut(detail), id: this.generateUniqueKey(`option_${this.productId}-${option.id}_${detail.id}`), onInvalid: (e) => this.invalidHandler(e, option), onChange: (e) => this.changedHandler(e, option) }), h("label", { htmlFor: this.generateUniqueKey(`option_${this.productId}-${option.id}_${detail.id}`), "data-img-id": detail.option_value, class: "go-to-slide" }, h("img", { "data-src": detail.image, src: detail.image, title: detail.name, alt: detail.name }), h("span", { innerHTML: IconVerified, class: "s-product-options-thumbnails-icon" }), this.isOptionDetailOut(detail) ?
843
+ [
844
+ h("small", { key: detail.id, class: "s-product-options-thumbnails-stock-badge" }, this.outOfStockText),
845
+ this.canDisabled ? h("div", { key: detail.id, class: "s-product-options-thumbnails-badge-overlay" }) : '',
846
+ ]
847
+ : ''), h("p", null, this.getOptionDetailName(detail, false), " "));
848
+ }));
849
+ }
850
+ // Digital card options
851
+ digitalCardValuesOption(option) {
852
+ return h("div", { class: "s-product-options-digital-card-wrapper" }, this.availableDigitalCardValues.length > 0 ? this.availableDigitalCardValues.map((detail) => {
853
+ const id = String(detail.id);
854
+ return h("label", { htmlFor: this.generateUniqueKey(id.toString()), key: id, class: "s-product-options-digital-card-option" }, h("input", { type: "radio", "data-code-value": true, class: "s-form-control s-product-options-digital-card-input", value: detail.id, name: this.generateInputName(option.id), id: this.generateUniqueKey(id.toString()), required: !option.visibility_condition && option.required, onInvalid: (e) => this.invalidHandler(e, option), ...(!this.ignoreDefaultCardValue ? { defaultChecked: this.getSelectedDigitalCardOptions(option)?.id === detail.id } : {}) }), h("span", null, detail.name, " ", salla.config?.currency()?.symbol));
855
+ })
856
+ : h("div", { class: "s-product-options-digital-card-out-of-stock" }));
857
+ }
858
+ countryOption(option) {
859
+ return h("div", { class: "s-product-options-digital-card-wrapper" }, option.details.map((detail) => {
860
+ return h("label", { htmlFor: this.generateUniqueKey(detail.id.toString()), key: detail.id, class: { "s-product-options-digital-card-option": true, "s-product-options-digital-card-option-stock-out": detail.is_out } }, h("input", { id: this.generateUniqueKey(detail.id.toString()), type: "radio", class: "s-form-control s-product-options-digital-card-input", value: detail.id, name: this.generateInputName(option.id), disabled: detail.is_out, required: !option.visibility_condition && option.required, onInvalid: (e) => this.invalidHandler(e, option), onChange: e => this.changedHandler(e, option), onClick: () => { this.disableCardValue = false; }, ...(salla.url.is_page("cart") ? { defaultChecked: this.getSelectedDigitalCardOptions(option)?.id === detail.id } : {}) }), h("img", { loading: "lazy", alt: detail.code, height: 24, width: 24, class: "s-product-options-country-flag", src: `https://cdn.assets.salla.network/prod/admin/cp/assets/flags/1x1/${String(detail.code).toLocaleLowerCase()}.svg`, onError: e => {
861
+ e.currentTarget.onerror = null;
862
+ e.currentTarget.src =
863
+ salla.url.cdn('images/globe.svg');
864
+ } }), h("span", null, detail.name));
865
+ }));
866
+ }
867
+ get host() { return this; }
868
+ static get style() { return sallaProductOptionsCss; }
869
+ }, [0, "salla-product-options", {
870
+ "productId": [8, "product-id"],
871
+ "options": [1],
872
+ "hideOutLabel": [1, "hide-out-label"],
873
+ "uniqueKey": [1, "unique-key"],
874
+ "bundleContext": [1, "bundle-context"],
875
+ "config": [1],
876
+ "optionsData": [32],
877
+ "outOfStockText": [32],
878
+ "donationAmount": [32],
879
+ "selectDonationAmount": [32],
880
+ "selectAmount": [32],
881
+ "isCustomDonation": [32],
882
+ "selectedOptions": [32],
883
+ "canDisabled": [32],
884
+ "selectedSkus": [32],
885
+ "selectedOutSkus": [32],
886
+ "disableCardValue": [32],
887
+ "availableDigitalCardValues": [32],
888
+ "userInitiatedValidation": [32],
889
+ "isCartMode": [32],
890
+ "setOptionsData": [64],
891
+ "getSelectedOptionsData": [64],
892
+ "reportValidity": [64],
893
+ "hasOutOfStockOption": [64],
894
+ "getSelectedOptions": [64],
895
+ "getOption": [64],
896
+ "enterCartMode": [64],
897
+ "enableUserInitiatedValidation": [64],
898
+ "validateAndScroll": [64]
899
+ }]);
900
+ function defineCustomElement() {
901
+ if (typeof customElements === "undefined") {
902
+ return;
903
+ }
904
+ const components = ["salla-product-options", "salla-booking-field", "salla-button", "salla-color-picker", "salla-conditional-fields", "salla-datetime-picker", "salla-file-upload", "salla-loading", "salla-map", "salla-modal", "salla-progress-bar"];
905
+ components.forEach(tagName => { switch (tagName) {
906
+ case "salla-product-options":
907
+ if (!customElements.get(tagName)) {
908
+ customElements.define(tagName, SallaProductOptions);
909
+ }
910
+ break;
911
+ case "salla-booking-field":
912
+ if (!customElements.get(tagName)) {
913
+ defineCustomElement$a();
914
+ }
915
+ break;
916
+ case "salla-button":
917
+ if (!customElements.get(tagName)) {
918
+ defineCustomElement$9();
919
+ }
920
+ break;
921
+ case "salla-color-picker":
922
+ if (!customElements.get(tagName)) {
923
+ defineCustomElement$8();
924
+ }
925
+ break;
926
+ case "salla-conditional-fields":
927
+ if (!customElements.get(tagName)) {
928
+ defineCustomElement$7();
929
+ }
930
+ break;
931
+ case "salla-datetime-picker":
932
+ if (!customElements.get(tagName)) {
933
+ defineCustomElement$6();
934
+ }
935
+ break;
936
+ case "salla-file-upload":
937
+ if (!customElements.get(tagName)) {
938
+ defineCustomElement$5();
939
+ }
940
+ break;
941
+ case "salla-loading":
942
+ if (!customElements.get(tagName)) {
943
+ defineCustomElement$4();
944
+ }
945
+ break;
946
+ case "salla-map":
947
+ if (!customElements.get(tagName)) {
948
+ defineCustomElement$3();
949
+ }
950
+ break;
951
+ case "salla-modal":
952
+ if (!customElements.get(tagName)) {
953
+ defineCustomElement$2();
954
+ }
955
+ break;
956
+ case "salla-progress-bar":
957
+ if (!customElements.get(tagName)) {
958
+ defineCustomElement$1();
959
+ }
960
+ break;
961
+ } });
962
+ }
963
+ defineCustomElement();
964
+
965
+ export { SallaProductOptions as S, defineCustomElement as d };