@salla.sa/twilight-components 2.14.392 → 2.14.393

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 (568) hide show
  1. package/dist/cjs/app-globals-oehrC7QI.js +39 -0
  2. package/dist/cjs/{filepond-D-ur1GA-.js → filepond-D7RVR_w_.js} +10 -5
  3. package/dist/cjs/{filepond-plugin-file-poster-DigEeKId.js → filepond-plugin-file-poster-DTuZK2ot.js} +11 -7
  4. package/dist/cjs/{filepond-plugin-file-validate-size-R9el3Yro.js → filepond-plugin-file-validate-size-DHc6pF_j.js} +1 -1
  5. package/dist/cjs/filepond-plugin-file-validate-type-DnkcvJVc.js +271 -0
  6. package/dist/cjs/{filepond-plugin-image-edit-bhI8kqN_.js → filepond-plugin-image-edit-vrZ1s7kw.js} +1 -1
  7. package/dist/cjs/{filepond-plugin-image-exif-orientation-COXZUVRV.js → filepond-plugin-image-exif-orientation-Bn5JSzQK.js} +1 -1
  8. package/dist/cjs/{filepond-plugin-image-preview-COP8QJBf.js → filepond-plugin-image-preview-8qWUFe9n.js} +1 -1
  9. package/dist/cjs/{index-CGnPURjZ.js → index-C5VeFDQ0.js} +1966 -1344
  10. package/dist/cjs/{index-BILBEE9f.js → index-CwD81m7i.js} +1 -1
  11. package/dist/cjs/loader.cjs.js +4 -3
  12. package/dist/cjs/salla-accordion-body_2.cjs.entry.js +5 -5
  13. package/dist/cjs/salla-accordion_6.cjs.entry.js +19 -15
  14. package/dist/cjs/salla-add-product-button_4.cjs.entry.js +12 -10
  15. package/dist/cjs/salla-advertisement.cjs.entry.js +3 -3
  16. package/dist/cjs/salla-alert_2.cjs.entry.js +5 -5
  17. package/dist/cjs/salla-app-install-alert.cjs.entry.js +3 -3
  18. package/dist/cjs/salla-apps-icons.cjs.entry.js +3 -3
  19. package/dist/cjs/salla-booking-field_7.cjs.entry.js +25 -23
  20. package/dist/cjs/salla-bullet-delivery.cjs.entry.js +3 -3
  21. package/dist/cjs/salla-cart-coupons.cjs.entry.js +3 -3
  22. package/dist/cjs/salla-cart-item-offers_2.cjs.entry.js +5 -5
  23. package/dist/cjs/salla-comment-form_8.cjs.entry.js +17 -17
  24. package/dist/cjs/salla-conditional-offer.cjs.entry.js +3 -3
  25. package/dist/cjs/salla-contacts.cjs.entry.js +3 -3
  26. package/dist/cjs/salla-cookies-bar.cjs.entry.js +3 -3
  27. package/dist/cjs/salla-count-down.cjs.entry.js +35 -11
  28. package/dist/cjs/salla-custom-fields.cjs.entry.js +3 -3
  29. package/dist/cjs/salla-delivery-promise.cjs.entry.js +1 -1
  30. package/dist/cjs/salla-filters-widget.cjs.entry.js +3 -3
  31. package/dist/cjs/salla-filters.cjs.entry.js +3 -3
  32. package/dist/cjs/salla-fulfillment-methods.cjs.entry.js +1 -1
  33. package/dist/cjs/salla-gifting.cjs.entry.js +3 -3
  34. package/dist/cjs/salla-hook.cjs.entry.js +5 -2
  35. package/dist/cjs/salla-infinite-scroll.cjs.entry.js +3 -3
  36. package/dist/cjs/salla-installment.cjs.entry.js +3 -3
  37. package/dist/cjs/salla-list-tile.cjs.entry.js +3 -3
  38. package/dist/cjs/salla-localization-modal.cjs.entry.js +1 -1
  39. package/dist/cjs/salla-login-modal.cjs.entry.js +3 -3
  40. package/dist/cjs/salla-loyalty-prize-item.cjs.entry.js +3 -3
  41. package/dist/cjs/salla-loyalty-program.cjs.entry.js +3 -3
  42. package/dist/cjs/salla-loyalty.cjs.entry.js +3 -3
  43. package/dist/cjs/salla-maintenance-alert.cjs.entry.js +3 -3
  44. package/dist/cjs/salla-map.cjs.entry.js +3 -3
  45. package/dist/cjs/salla-menu.cjs.entry.js +3 -3
  46. package/dist/cjs/salla-metadata.cjs.entry.js +3 -3
  47. package/dist/cjs/salla-multiple-bundle-product-cart_2.cjs.entry.js +5 -5
  48. package/dist/cjs/salla-multiple-bundle-product-options-modal_2.cjs.entry.js +8 -6
  49. package/dist/cjs/salla-multiple-bundle-product.cjs.entry.js +6 -4
  50. package/dist/cjs/salla-notification-item.cjs.entry.js +3 -3
  51. package/dist/cjs/salla-notifications.cjs.entry.js +50 -5
  52. package/dist/cjs/salla-offer-modal.cjs.entry.js +3 -3
  53. package/dist/cjs/salla-offer.cjs.entry.js +3 -3
  54. package/dist/cjs/salla-order-details-multiple-bundle-product.cjs.entry.js +3 -3
  55. package/dist/cjs/salla-order-details-options.cjs.entry.js +3 -3
  56. package/dist/cjs/salla-order-details.cjs.entry.js +6 -4
  57. package/dist/cjs/salla-order-edit-item.cjs.entry.js +3 -3
  58. package/dist/cjs/salla-order-edit.cjs.entry.js +3 -3
  59. package/dist/cjs/salla-order-summary.cjs.entry.js +3 -3
  60. package/dist/cjs/salla-order-totals-card.cjs.entry.js +6 -4
  61. package/dist/cjs/salla-orders.cjs.entry.js +3 -3
  62. package/dist/cjs/salla-payments.cjs.entry.js +3 -3
  63. package/dist/cjs/salla-placeholder.cjs.entry.js +3 -3
  64. package/dist/cjs/salla-price-range.cjs.entry.js +3 -3
  65. package/dist/cjs/salla-product-card.cjs.entry.js +3 -3
  66. package/dist/cjs/salla-product-size-guide.cjs.entry.js +3 -3
  67. package/dist/cjs/salla-products-list.cjs.entry.js +3 -3
  68. package/dist/cjs/salla-products-slider.cjs.entry.js +3 -3
  69. package/dist/cjs/salla-progress-bar.cjs.entry.js +3 -3
  70. package/dist/cjs/salla-quick-order.cjs.entry.js +3 -3
  71. package/dist/cjs/salla-rating-modal.cjs.entry.js +3 -3
  72. package/dist/cjs/salla-scopes.cjs.entry.js +3 -3
  73. package/dist/cjs/salla-search.cjs.entry.js +6 -4
  74. package/dist/cjs/salla-skeleton.cjs.entry.js +3 -3
  75. package/dist/cjs/salla-slider.cjs.entry.js +20 -14
  76. package/dist/cjs/salla-social-share.cjs.entry.js +3 -3
  77. package/dist/cjs/salla-social.cjs.entry.js +3 -3
  78. package/dist/cjs/salla-tab-content_3.cjs.entry.js +7 -7
  79. package/dist/cjs/salla-tiered-offer.cjs.entry.js +3 -3
  80. package/dist/cjs/salla-tooltip.cjs.entry.js +3 -3
  81. package/dist/cjs/salla-trust-badges.cjs.entry.js +3 -3
  82. package/dist/cjs/salla-user-menu.cjs.entry.js +3 -3
  83. package/dist/cjs/salla-user-profile.cjs.entry.js +3 -3
  84. package/dist/cjs/salla-user-settings.cjs.entry.js +3 -3
  85. package/dist/cjs/salla-verify.cjs.entry.js +3 -3
  86. package/dist/cjs/salla-wallet.cjs.entry.js +3 -3
  87. package/dist/cjs/twilight.cjs.js +5 -4
  88. package/dist/cjs/{vanilla-picker-DI3TImGd.js → vanilla-picker-yKERbLpx.js} +1 -1
  89. package/dist/collection/collection-manifest.json +3 -2
  90. package/dist/collection/components/salla-accordion/salla-accordion-head.js +2 -2
  91. package/dist/collection/components/salla-accordion/salla-accordion.js +4 -4
  92. package/dist/collection/components/salla-add-product-button/salla-add-product-button.js +19 -19
  93. package/dist/collection/components/salla-alert/salla-alert.js +5 -5
  94. package/dist/collection/components/salla-apps-icons/salla-apps-icons.js +6 -6
  95. package/dist/collection/components/salla-booking-field/salla-booking-field.js +4 -4
  96. package/dist/collection/components/salla-bottom-alert/salla-bottom-alert.js +9 -9
  97. package/dist/collection/components/salla-bullet-delivery/salla-bullet-delivery.js +6 -3
  98. package/dist/collection/components/salla-button/salla-button.js +11 -11
  99. package/dist/collection/components/salla-cart-coupons/salla-cart-coupons.js +2 -1
  100. package/dist/collection/components/salla-cart-item-offers/salla-cart-item-offers.js +8 -8
  101. package/dist/collection/components/salla-cart-summary/salla-cart-summary.js +2 -2
  102. package/dist/collection/components/salla-color-picker/salla-color-picker.js +20 -14
  103. package/dist/collection/components/salla-comment-form/salla-comment-form.js +6 -6
  104. package/dist/collection/components/salla-comments/salla-comment-item.js +2 -3
  105. package/dist/collection/components/salla-comments/salla-comments.js +18 -17
  106. package/dist/collection/components/salla-contacts/salla-contacts.js +10 -10
  107. package/dist/collection/components/salla-count-down/salla-count-down.js +66 -42
  108. package/dist/collection/components/salla-custom-fields/salla-custom-fields.js +9 -7
  109. package/dist/collection/components/salla-datetime-picker/salla-datetime-picker.js +69 -65
  110. package/dist/collection/components/salla-drawer/salla-drawer.js +11 -11
  111. package/dist/collection/components/salla-file-upload/salla-file-upload.css +1 -1
  112. package/dist/collection/components/salla-file-upload/salla-file-upload.js +85 -84
  113. package/dist/collection/components/salla-filters/salla-filters.js +2 -2
  114. package/dist/collection/components/salla-filters-widget/salla-filters-widget.js +4 -5
  115. package/dist/collection/components/salla-gifting/salla-gifting.js +11 -11
  116. package/dist/collection/components/salla-hook/salla-hook.js +2 -2
  117. package/dist/collection/components/salla-infinite-scroll/salla-infinite-scroll.js +6 -6
  118. package/dist/collection/components/salla-installment/salla-installment.js +5 -5
  119. package/dist/collection/components/salla-list-tile/salla-list-tile.js +2 -2
  120. package/dist/collection/components/salla-loading/salla-loading.js +4 -4
  121. package/dist/collection/components/salla-localization-modal/salla-localization-modal.js +5 -5
  122. package/dist/collection/components/salla-login-modal/salla-login-modal.js +14 -14
  123. package/dist/collection/components/salla-loyalty/salla-loyalty-prize-item.js +4 -3
  124. package/dist/collection/components/salla-loyalty/salla-loyalty.js +13 -12
  125. package/dist/collection/components/salla-map/salla-map.js +14 -14
  126. package/dist/collection/components/salla-menu/salla-menu.js +10 -9
  127. package/dist/collection/components/salla-metadata/salla-metadata.js +3 -3
  128. package/dist/collection/components/salla-modal/salla-modal.js +11 -11
  129. package/dist/collection/components/salla-multiple-bundle-product/components/salla-multiple-bundle-product-cart.js +2 -2
  130. package/dist/collection/components/salla-multiple-bundle-product/components/salla-multiple-bundle-product-details.js +2 -2
  131. package/dist/collection/components/salla-multiple-bundle-product/components/salla-multiple-bundle-product-options-modal.js +4 -2
  132. package/dist/collection/components/salla-multiple-bundle-product/components/salla-multiple-bundle-product-slider.js +8 -7
  133. package/dist/collection/components/salla-multiple-bundle-product/salla-multiple-bundle-product.js +2 -2
  134. package/dist/collection/components/salla-notifications/salla-notification-item.js +2 -2
  135. package/dist/collection/components/salla-notifications/salla-notifications.js +50 -5
  136. package/dist/collection/components/salla-offer/salla-offer.js +1 -1
  137. package/dist/collection/components/salla-order-details/salla-order-details-multiple-bundle-product.js +5 -5
  138. package/dist/collection/components/salla-order-details/salla-order-details-options.js +6 -5
  139. package/dist/collection/components/salla-order-details/salla-order-details.js +4 -3
  140. package/dist/collection/components/salla-order-edit/salla-order-edit-item.js +4 -4
  141. package/dist/collection/components/salla-order-edit/salla-order-edit.js +4 -4
  142. package/dist/collection/components/salla-order-summary/salla-order-summary.js +2 -2
  143. package/dist/collection/components/salla-order-totals-card/salla-order-totals-card.js +4 -3
  144. package/dist/collection/components/salla-orders/salla-orders.js +4 -4
  145. package/dist/collection/components/salla-payments/salla-payments.js +0 -1
  146. package/dist/collection/components/salla-placeholder/salla-placeholder.js +3 -3
  147. package/dist/collection/components/salla-price-range/salla-price-range.js +8 -8
  148. package/dist/collection/components/salla-product-availability/salla-product-availability.js +6 -6
  149. package/dist/collection/components/salla-product-card/salla-product-card.js +18 -18
  150. package/dist/collection/components/salla-product-options/salla-product-options.js +15 -13
  151. package/dist/collection/components/salla-products-list/salla-products-list.js +20 -21
  152. package/dist/collection/components/salla-products-slider/salla-products-slider.js +22 -23
  153. package/dist/collection/components/salla-progress-bar/salla-progress-bar.js +21 -20
  154. package/dist/collection/components/salla-quantity-input/salla-quantity-input.js +2 -2
  155. package/dist/collection/components/salla-quick-buy/salla-quick-buy.js +16 -17
  156. package/dist/collection/components/salla-quick-order/salla-quick-order.js +11 -11
  157. package/dist/collection/components/salla-rating-modal/salla-rating-modal.js +2 -2
  158. package/dist/collection/components/salla-rating-stars/salla-rating-stars.js +8 -8
  159. package/dist/collection/components/salla-review-card/salla-review-card.js +3 -3
  160. package/dist/collection/components/salla-reviews/salla-reviews.js +16 -13
  161. package/dist/collection/components/salla-reviews-summary/salla-reviews-summary.js +2 -2
  162. package/dist/collection/components/salla-scopes/salla-scopes.js +2 -2
  163. package/dist/collection/components/salla-search/salla-search.js +6 -6
  164. package/dist/collection/components/salla-skeleton/salla-skeleton.js +3 -3
  165. package/dist/collection/components/salla-slider/salla-slider.css +9 -2
  166. package/dist/collection/components/salla-slider/salla-slider.js +25 -25
  167. package/dist/collection/components/salla-social-share/salla-social-share.js +3 -3
  168. package/dist/collection/components/salla-tabs/salla-tab-content.js +2 -2
  169. package/dist/collection/components/salla-tabs/salla-tab-header.js +5 -5
  170. package/dist/collection/components/salla-tabs/salla-tabs.js +2 -2
  171. package/dist/collection/components/salla-tel-input/salla-tel-input.js +9 -8
  172. package/dist/collection/components/salla-tooltip/salla-tooltip.js +5 -5
  173. package/dist/collection/components/salla-trust-badges/salla-trust-badges.js +1 -1
  174. package/dist/collection/components/salla-user-menu/salla-user-menu.js +5 -5
  175. package/dist/collection/components/salla-user-profile/salla-user-profile.js +1 -1
  176. package/dist/collection/components/salla-verify/salla-verify.js +4 -4
  177. package/dist/components/Helper.js +1 -432
  178. package/dist/components/_commonjsHelpers.js +1 -7
  179. package/dist/components/anime.es.js +1 -1310
  180. package/dist/components/arrow-left.js +1 -8
  181. package/dist/components/axios.js +2 -3908
  182. package/dist/components/bell-ring.js +1 -8
  183. package/dist/components/camera.js +1 -8
  184. package/dist/components/cancel.js +1 -8
  185. package/dist/components/cart.js +1 -8
  186. package/dist/components/check-circle2.js +1 -15
  187. package/dist/components/check.js +1 -8
  188. package/dist/components/facebook.js +1 -10
  189. package/dist/components/filepond-plugin-file-poster.js +3 -659
  190. package/dist/components/filepond-plugin-file-validate-size.js +2 -204
  191. package/dist/components/filepond-plugin-file-validate-type.js +3 -279
  192. package/dist/components/filepond-plugin-image-edit.js +2 -487
  193. package/dist/components/filepond-plugin-image-exif-orientation.js +2 -214
  194. package/dist/components/filepond-plugin-image-preview.js +2 -2237
  195. package/dist/components/filepond.js +3 -11282
  196. package/dist/components/gift.js +1 -8
  197. package/dist/components/image.js +1 -8
  198. package/dist/components/index.d.ts +2 -0
  199. package/dist/components/index.js +1 -8163
  200. package/dist/components/index2.js +1 -1709
  201. package/dist/components/index3.js +1 -2550
  202. package/dist/components/interfaces.js +1 -12
  203. package/dist/components/isObject.js +1 -292
  204. package/dist/components/keyboard_arrow_down.js +1 -8
  205. package/dist/components/keyboard_arrow_right.js +1 -15
  206. package/dist/components/location.js +1 -11
  207. package/dist/components/mail.js +1 -8
  208. package/dist/components/minus.js +1 -15
  209. package/dist/components/salla-accordion-body.js +1 -6
  210. package/dist/components/salla-accordion-body2.js +1 -30
  211. package/dist/components/salla-accordion-head.js +1 -6
  212. package/dist/components/salla-accordion-head2.js +1 -63
  213. package/dist/components/salla-accordion.js +1 -6
  214. package/dist/components/salla-accordion2.js +1 -68
  215. package/dist/components/salla-add-product-button.js +1 -6
  216. package/dist/components/salla-add-product-button2.js +1 -306
  217. package/dist/components/salla-advertisement.js +1 -155
  218. package/dist/components/salla-alert.js +1 -59
  219. package/dist/components/salla-app-install-alert.js +1 -91
  220. package/dist/components/salla-apps-icons.js +1 -63
  221. package/dist/components/salla-booking-field.js +1 -6
  222. package/dist/components/salla-booking-field2.js +1 -221
  223. package/dist/components/salla-bottom-alert.js +1 -214
  224. package/dist/components/salla-breadcrumb.js +1 -226
  225. package/dist/components/salla-bullet-delivery.js +1 -2114
  226. package/dist/components/salla-button.js +1 -6
  227. package/dist/components/salla-button2.js +1 -174
  228. package/dist/components/salla-cart-coupons.js +1 -284
  229. package/dist/components/salla-cart-item-offers.js +1 -143
  230. package/dist/components/salla-cart-summary.js +1 -136
  231. package/dist/components/salla-color-picker.js +1 -6
  232. package/dist/components/salla-color-picker2.js +1 -260
  233. package/dist/components/salla-comment-form.js +1 -6
  234. package/dist/components/salla-comment-form2.js +1 -64
  235. package/dist/components/salla-comment-item.js +1 -6
  236. package/dist/components/salla-comment-item2.js +1 -217
  237. package/dist/components/salla-comments.js +1 -395
  238. package/dist/components/salla-conditional-fields.js +1 -6
  239. package/dist/components/salla-conditional-fields2.js +1 -137
  240. package/dist/components/salla-conditional-offer.js +1 -194
  241. package/dist/components/salla-contacts.js +1 -125
  242. package/dist/components/salla-cookies-bar.js +1 -107
  243. package/dist/components/salla-count-down.js +1 -6
  244. package/dist/components/salla-count-down2.js +1 -247
  245. package/dist/components/salla-custom-fields.js +1 -175
  246. package/dist/components/salla-datetime-picker.js +1 -6
  247. package/dist/components/salla-datetime-picker2.js +1 -342
  248. package/dist/components/salla-delivery-promise.js +1 -263
  249. package/dist/components/salla-drawer.js +1 -6
  250. package/dist/components/salla-drawer2.js +1 -214
  251. package/dist/components/salla-file-upload.js +1 -6
  252. package/dist/components/salla-file-upload2.js +1 -583
  253. package/dist/components/salla-filters-widget.js +1 -6
  254. package/dist/components/salla-filters-widget2.js +1 -245
  255. package/dist/components/salla-filters.js +1 -253
  256. package/dist/components/salla-fulfillment-methods.js +1 -61
  257. package/dist/components/salla-gifting.js +1 -732
  258. package/dist/components/salla-hook.js +1 -47
  259. package/dist/components/salla-infinite-scroll.js +1 -112
  260. package/dist/components/salla-installment.js +1 -306
  261. package/dist/components/salla-list-tile.js +1 -6
  262. package/dist/components/salla-list-tile2.js +1 -47
  263. package/dist/components/salla-loading.js +1 -6
  264. package/dist/components/salla-loading2.js +1 -51
  265. package/dist/components/salla-localization-modal.js +1 -296
  266. package/dist/components/salla-login-modal.js +1 -6
  267. package/dist/components/salla-login-modal2.js +1 -359
  268. package/dist/components/salla-loyalty-prize-item.js +1 -39
  269. package/dist/components/salla-loyalty-program.js +1 -115
  270. package/dist/components/salla-loyalty.js +1 -304
  271. package/dist/components/salla-maintenance-alert.js +1 -57
  272. package/dist/components/salla-map.js +1 -6
  273. package/dist/components/salla-map2.js +1 -766
  274. package/dist/components/salla-menu.js +1 -165
  275. package/dist/components/salla-metadata.js +1 -97
  276. package/dist/components/salla-modal.js +1 -6
  277. package/dist/components/salla-modal2.js +1 -215
  278. package/dist/components/salla-multiple-bundle-product-cart.js +1 -6
  279. package/dist/components/salla-multiple-bundle-product-cart2.js +1 -151
  280. package/dist/components/salla-multiple-bundle-product-details.js +1 -6
  281. package/dist/components/salla-multiple-bundle-product-details2.js +1 -296
  282. package/dist/components/salla-multiple-bundle-product-options-modal.js +1 -6
  283. package/dist/components/salla-multiple-bundle-product-options-modal2.js +1 -598
  284. package/dist/components/salla-multiple-bundle-product-slider.js +1 -6
  285. package/dist/components/salla-multiple-bundle-product-slider2.js +1 -136
  286. package/dist/components/salla-multiple-bundle-product.js +1 -207
  287. package/dist/components/salla-notification-item.js +1 -6
  288. package/dist/components/salla-notification-item2.js +1 -32
  289. package/dist/components/salla-notifications.js +1 -145
  290. package/dist/components/salla-offer-modal.js +1 -328
  291. package/dist/components/salla-offer.js +1 -478
  292. package/dist/components/salla-order-details-multiple-bundle-product.js +1 -6
  293. package/dist/components/salla-order-details-multiple-bundle-product2.js +1 -122
  294. package/dist/components/salla-order-details-options.js +1 -6
  295. package/dist/components/salla-order-details-options2.js +1 -140
  296. package/dist/components/salla-order-details.js +1 -122
  297. package/dist/components/salla-order-edit-item.js +1 -6
  298. package/dist/components/salla-order-edit-item2.js +1 -181
  299. package/dist/components/salla-order-edit.js +1 -288
  300. package/dist/components/salla-order-summary.js +1 -132
  301. package/dist/components/salla-order-totals-card.js +1 -87
  302. package/dist/components/salla-orders.js +1 -271
  303. package/dist/components/salla-payments.js +1 -76
  304. package/dist/components/salla-placeholder.js +1 -6
  305. package/dist/components/salla-placeholder2.js +1 -66
  306. package/dist/components/salla-price-range.js +1 -6
  307. package/dist/components/salla-price-range2.js +1 -204
  308. package/dist/components/salla-product-availability.js +1 -6
  309. package/dist/components/salla-product-availability2.js +1 -206
  310. package/dist/components/salla-product-card.js +1 -6
  311. package/dist/components/salla-product-card2.js +1 -241
  312. package/dist/components/salla-product-options.js +1 -6
  313. package/dist/components/salla-product-options2.js +1 -962
  314. package/dist/components/salla-product-size-guide.js +1 -130
  315. package/dist/components/salla-products-list.js +1 -6
  316. package/dist/components/salla-products-list2.js +1 -812
  317. package/dist/components/salla-products-slider.js +1 -6
  318. package/dist/components/salla-products-slider2.js +1 -215
  319. package/dist/components/salla-progress-bar.js +1 -6
  320. package/dist/components/salla-progress-bar2.js +1 -94
  321. package/dist/components/salla-quantity-input.js +1 -6
  322. package/dist/components/salla-quantity-input2.js +1 -127
  323. package/dist/components/salla-quick-buy.js +1 -6
  324. package/dist/components/salla-quick-buy2.js +1 -1181
  325. package/dist/components/salla-quick-order.js +1 -299
  326. package/dist/components/salla-rating-modal.js +1 -530
  327. package/dist/components/salla-rating-stars.js +1 -6
  328. package/dist/components/salla-rating-stars2.js +1 -162
  329. package/dist/components/salla-review-card.js +1 -6
  330. package/dist/components/salla-review-card2.js +1 -198
  331. package/dist/components/salla-reviews-page.js +1 -726
  332. package/dist/components/salla-reviews-summary.js +1 -6
  333. package/dist/components/salla-reviews-summary2.js +1 -132
  334. package/dist/components/salla-reviews.js +1 -143
  335. package/dist/components/salla-scopes.js +1 -249
  336. package/dist/components/salla-search.js +1 -213
  337. package/dist/components/salla-skeleton.js +1 -6
  338. package/dist/components/salla-skeleton2.js +1 -50
  339. package/dist/components/salla-slider.js +1 -6
  340. package/dist/components/salla-slider2.js +1 -10483
  341. package/dist/components/salla-social-share.js +1 -194
  342. package/dist/components/salla-social.js +1 -89
  343. package/dist/components/salla-tab-content.js +1 -6
  344. package/dist/components/salla-tab-content2.js +1 -55
  345. package/dist/components/salla-tab-header.js +1 -6
  346. package/dist/components/salla-tab-header2.js +1 -85
  347. package/dist/components/salla-tabs.js +1 -6
  348. package/dist/components/salla-tabs2.js +1 -75
  349. package/dist/components/salla-tel-input.js +1 -6
  350. package/dist/components/salla-tel-input2.js +1 -168
  351. package/dist/components/salla-tiered-offer.js +1 -366
  352. package/dist/components/salla-tooltip.js +1 -6
  353. package/dist/components/salla-tooltip2.js +1 -57
  354. package/dist/components/salla-trust-badges.js +1 -90
  355. package/dist/components/salla-user-menu.js +1 -344
  356. package/dist/components/salla-user-profile.js +1 -203
  357. package/dist/components/salla-user-settings.js +1 -139
  358. package/dist/components/salla-verify.js +1 -303
  359. package/dist/components/salla-wallet.js +1 -114
  360. package/dist/components/search.js +1 -8
  361. package/dist/components/shopping-bag.js +1 -8
  362. package/dist/components/special-discount.js +1 -8
  363. package/dist/components/star.js +1 -8
  364. package/dist/components/star2.js +1 -8
  365. package/dist/components/vanilla-picker.js +2 -1034
  366. package/dist/components/whatsapp2.js +1 -8
  367. package/dist/esm/app-globals-BFryt7-C.js +37 -0
  368. package/dist/esm/{filepond-kTbl0kuh.js → filepond-DlGaLh8N.js} +10 -5
  369. package/dist/esm/{filepond-plugin-file-poster-CyywnjKv.js → filepond-plugin-file-poster-BTVFYcQx.js} +11 -7
  370. package/dist/esm/{filepond-plugin-file-validate-size-DgteZhje.js → filepond-plugin-file-validate-size-DGryLmWv.js} +1 -1
  371. package/dist/esm/filepond-plugin-file-validate-type-DxKfCD0V.js +269 -0
  372. package/dist/esm/{filepond-plugin-image-edit-pZ_mETE7.js → filepond-plugin-image-edit-2W7pu9hn.js} +1 -1
  373. package/dist/esm/{filepond-plugin-image-exif-orientation-CjKYl7HL.js → filepond-plugin-image-exif-orientation-OQu-IvPH.js} +1 -1
  374. package/dist/esm/{filepond-plugin-image-preview-BzJTl_2A.js → filepond-plugin-image-preview-DEW_tSNR.js} +1 -1
  375. package/dist/esm/{index-3Kis_Ivk.js → index-BDqMkCqE.js} +1 -1
  376. package/dist/esm/{index-C23tPnnH.js → index-DYB20YqN.js} +1966 -1344
  377. package/dist/esm/loader.js +4 -3
  378. package/dist/esm/salla-accordion-body_2.entry.js +5 -5
  379. package/dist/esm/salla-accordion_6.entry.js +19 -15
  380. package/dist/esm/salla-add-product-button_4.entry.js +12 -10
  381. package/dist/esm/salla-advertisement.entry.js +3 -3
  382. package/dist/esm/salla-alert_2.entry.js +5 -5
  383. package/dist/esm/salla-app-install-alert.entry.js +3 -3
  384. package/dist/esm/salla-apps-icons.entry.js +3 -3
  385. package/dist/esm/salla-booking-field_7.entry.js +25 -23
  386. package/dist/esm/salla-bullet-delivery.entry.js +3 -3
  387. package/dist/esm/salla-cart-coupons.entry.js +3 -3
  388. package/dist/esm/salla-cart-item-offers_2.entry.js +5 -5
  389. package/dist/esm/salla-comment-form_8.entry.js +17 -17
  390. package/dist/esm/salla-conditional-offer.entry.js +3 -3
  391. package/dist/esm/salla-contacts.entry.js +3 -3
  392. package/dist/esm/salla-cookies-bar.entry.js +3 -3
  393. package/dist/esm/salla-count-down.entry.js +35 -11
  394. package/dist/esm/salla-custom-fields.entry.js +3 -3
  395. package/dist/esm/salla-delivery-promise.entry.js +1 -1
  396. package/dist/esm/salla-filters-widget.entry.js +3 -3
  397. package/dist/esm/salla-filters.entry.js +3 -3
  398. package/dist/esm/salla-fulfillment-methods.entry.js +1 -1
  399. package/dist/esm/salla-gifting.entry.js +3 -3
  400. package/dist/esm/salla-hook.entry.js +5 -2
  401. package/dist/esm/salla-infinite-scroll.entry.js +3 -3
  402. package/dist/esm/salla-installment.entry.js +3 -3
  403. package/dist/esm/salla-list-tile.entry.js +3 -3
  404. package/dist/esm/salla-localization-modal.entry.js +1 -1
  405. package/dist/esm/salla-login-modal.entry.js +3 -3
  406. package/dist/esm/salla-loyalty-prize-item.entry.js +3 -3
  407. package/dist/esm/salla-loyalty-program.entry.js +3 -3
  408. package/dist/esm/salla-loyalty.entry.js +3 -3
  409. package/dist/esm/salla-maintenance-alert.entry.js +3 -3
  410. package/dist/esm/salla-map.entry.js +3 -3
  411. package/dist/esm/salla-menu.entry.js +3 -3
  412. package/dist/esm/salla-metadata.entry.js +3 -3
  413. package/dist/esm/salla-multiple-bundle-product-cart_2.entry.js +5 -5
  414. package/dist/esm/salla-multiple-bundle-product-options-modal_2.entry.js +8 -6
  415. package/dist/esm/salla-multiple-bundle-product.entry.js +6 -4
  416. package/dist/esm/salla-notification-item.entry.js +3 -3
  417. package/dist/esm/salla-notifications.entry.js +50 -5
  418. package/dist/esm/salla-offer-modal.entry.js +3 -3
  419. package/dist/esm/salla-offer.entry.js +3 -3
  420. package/dist/esm/salla-order-details-multiple-bundle-product.entry.js +3 -3
  421. package/dist/esm/salla-order-details-options.entry.js +3 -3
  422. package/dist/esm/salla-order-details.entry.js +6 -4
  423. package/dist/esm/salla-order-edit-item.entry.js +3 -3
  424. package/dist/esm/salla-order-edit.entry.js +3 -3
  425. package/dist/esm/salla-order-summary.entry.js +3 -3
  426. package/dist/esm/salla-order-totals-card.entry.js +6 -4
  427. package/dist/esm/salla-orders.entry.js +3 -3
  428. package/dist/esm/salla-payments.entry.js +3 -3
  429. package/dist/esm/salla-placeholder.entry.js +3 -3
  430. package/dist/esm/salla-price-range.entry.js +3 -3
  431. package/dist/esm/salla-product-card.entry.js +3 -3
  432. package/dist/esm/salla-product-size-guide.entry.js +3 -3
  433. package/dist/esm/salla-products-list.entry.js +3 -3
  434. package/dist/esm/salla-products-slider.entry.js +3 -3
  435. package/dist/esm/salla-progress-bar.entry.js +3 -3
  436. package/dist/esm/salla-quick-order.entry.js +3 -3
  437. package/dist/esm/salla-rating-modal.entry.js +3 -3
  438. package/dist/esm/salla-scopes.entry.js +3 -3
  439. package/dist/esm/salla-search.entry.js +6 -4
  440. package/dist/esm/salla-skeleton.entry.js +3 -3
  441. package/dist/esm/salla-slider.entry.js +20 -14
  442. package/dist/esm/salla-social-share.entry.js +3 -3
  443. package/dist/esm/salla-social.entry.js +3 -3
  444. package/dist/esm/salla-tab-content_3.entry.js +7 -7
  445. package/dist/esm/salla-tiered-offer.entry.js +3 -3
  446. package/dist/esm/salla-tooltip.entry.js +3 -3
  447. package/dist/esm/salla-trust-badges.entry.js +3 -3
  448. package/dist/esm/salla-user-menu.entry.js +3 -3
  449. package/dist/esm/salla-user-profile.entry.js +3 -3
  450. package/dist/esm/salla-user-settings.entry.js +3 -3
  451. package/dist/esm/salla-verify.entry.js +3 -3
  452. package/dist/esm/salla-wallet.entry.js +3 -3
  453. package/dist/esm/twilight.js +5 -4
  454. package/dist/esm/{vanilla-picker-CEy5x8Cf.js → vanilla-picker-Dt9vZPZF.js} +1 -1
  455. package/dist/twilight/{p-651fe6e4.entry.js → p-06fa7327.entry.js} +1 -1
  456. package/dist/twilight/{p-a50f7f70.entry.js → p-09d39785.entry.js} +1 -1
  457. package/dist/twilight/{p-744d6394.entry.js → p-0add06f9.entry.js} +1 -1
  458. package/dist/twilight/{p-f251e744.entry.js → p-105b1dab.entry.js} +1 -1
  459. package/dist/twilight/{p-407828e4.entry.js → p-108d8c8b.entry.js} +1 -1
  460. package/dist/twilight/{p-2a1871c2.entry.js → p-1875537e.entry.js} +1 -1
  461. package/dist/twilight/{p-ff6f769c.entry.js → p-18bb0181.entry.js} +1 -1
  462. package/dist/twilight/p-1daeed6e.entry.js +4 -0
  463. package/dist/twilight/{p-2aa48902.entry.js → p-1ef2602d.entry.js} +1 -1
  464. package/dist/twilight/{p-27f34c85.entry.js → p-2881bb33.entry.js} +1 -1
  465. package/dist/twilight/{p-c3d0c062.entry.js → p-293c6cf3.entry.js} +1 -1
  466. package/dist/twilight/{p-866b297b.entry.js → p-296d2dd0.entry.js} +1 -1
  467. package/dist/twilight/{p-3a5aaa20.entry.js → p-2abaa633.entry.js} +1 -1
  468. package/dist/twilight/p-2ddb3fce.entry.js +4 -0
  469. package/dist/twilight/{p-81f648a2.entry.js → p-2fe01e44.entry.js} +1 -1
  470. package/dist/twilight/p-33779828.entry.js +4 -0
  471. package/dist/twilight/p-34968e31.entry.js +4 -0
  472. package/dist/twilight/{p-3745a7d0.entry.js → p-34b670fc.entry.js} +1 -1
  473. package/dist/twilight/{p-9f23dd30.entry.js → p-3ccc532d.entry.js} +1 -1
  474. package/dist/twilight/{p-f2ee9ceb.entry.js → p-41c733c2.entry.js} +1 -1
  475. package/dist/twilight/{p-67fe5680.entry.js → p-44fa7521.entry.js} +1 -1
  476. package/dist/twilight/{p-b4f07395.entry.js → p-4932857d.entry.js} +1 -1
  477. package/dist/twilight/{p-81f6638f.entry.js → p-4fa4547a.entry.js} +1 -1
  478. package/dist/twilight/{p-ba4b672c.entry.js → p-542d3277.entry.js} +1 -1
  479. package/dist/twilight/{p-a00e249b.entry.js → p-57ff1f25.entry.js} +1 -1
  480. package/dist/twilight/{p-827edf95.entry.js → p-59ae82bd.entry.js} +1 -1
  481. package/dist/twilight/{p-82e3c734.entry.js → p-647b6d76.entry.js} +1 -1
  482. package/dist/twilight/p-665189b4.entry.js +4 -0
  483. package/dist/twilight/{p-b55da21d.entry.js → p-6f36541a.entry.js} +1 -1
  484. package/dist/twilight/{p-c8aa5377.entry.js → p-7093a427.entry.js} +1 -1
  485. package/dist/twilight/{p-f201122a.entry.js → p-748df7e6.entry.js} +1 -1
  486. package/dist/twilight/p-776c9d33.entry.js +4 -0
  487. package/dist/twilight/{p-ce9fee6d.entry.js → p-7abddca8.entry.js} +1 -1
  488. package/dist/twilight/p-7b8313ef.entry.js +4 -0
  489. package/dist/twilight/p-7bd0ede5.entry.js +4 -0
  490. package/dist/twilight/p-817b8ba5.entry.js +4 -0
  491. package/dist/twilight/{p-5ef1b170.entry.js → p-87c0ca91.entry.js} +1 -1
  492. package/dist/twilight/p-8e8d9d7d.entry.js +4 -0
  493. package/dist/twilight/{p-BHjlzmYy.js → p-8r0S6BcZ.js} +1 -1
  494. package/dist/twilight/{p-face0448.entry.js → p-94dbc1e9.entry.js} +1 -1
  495. package/dist/twilight/{p-4e00f827.entry.js → p-96a20515.entry.js} +1 -1
  496. package/dist/twilight/{p-81f76d49.entry.js → p-96d03a28.entry.js} +1 -1
  497. package/dist/twilight/{p-97df32eb.entry.js → p-96e78428.entry.js} +1 -1
  498. package/dist/twilight/{p-CU-HtXWh.js → p-BZnoSB1s.js} +1 -1
  499. package/dist/twilight/p-BkClxrC4.js +9 -0
  500. package/dist/twilight/p-Ck4zxCil.js +9 -0
  501. package/dist/twilight/{p-IoI86ovS.js → p-Cw3UBzjl.js} +1 -1
  502. package/dist/twilight/p-D1vqXXNX.js +9 -0
  503. package/dist/twilight/p-DYB20YqN.js +5 -0
  504. package/dist/twilight/p-Vl6qpttb.js +4 -0
  505. package/dist/twilight/{p-BgG5eq1x.js → p-X6Yi3bYP.js} +1 -1
  506. package/dist/twilight/{p-d022b6ec.entry.js → p-a01f1992.entry.js} +1 -1
  507. package/dist/twilight/{p-5d37cc33.entry.js → p-aa7c5de0.entry.js} +1 -1
  508. package/dist/twilight/{p-b6ded196.entry.js → p-aaa0c743.entry.js} +1 -1
  509. package/dist/twilight/{p-713590e2.entry.js → p-ad041ab5.entry.js} +1 -1
  510. package/dist/twilight/{p-d1dd1db6.entry.js → p-ad07f67a.entry.js} +1 -1
  511. package/dist/twilight/{p-f1f74b41.entry.js → p-af3c74f4.entry.js} +1 -1
  512. package/dist/twilight/p-af60e72a.entry.js +4 -0
  513. package/dist/twilight/{p-bdcf3926.entry.js → p-b17d055d.entry.js} +1 -1
  514. package/dist/twilight/{p-c68f3054.entry.js → p-b598c0f7.entry.js} +1 -1
  515. package/dist/twilight/{p-8c6db6d7.entry.js → p-b64f3155.entry.js} +1 -1
  516. package/dist/twilight/p-bNzv71Xl.js +9 -0
  517. package/dist/twilight/{p-BqCmPfAo.js → p-bScl0xMh.js} +2 -2
  518. package/dist/twilight/{p-344c1910.entry.js → p-bff4c7b3.entry.js} +1 -1
  519. package/dist/twilight/{p-1b1f9f71.entry.js → p-c091e2dc.entry.js} +1 -1
  520. package/dist/twilight/{p-775b42ec.entry.js → p-c1fd45b1.entry.js} +1 -1
  521. package/dist/twilight/{p-1c215c8c.entry.js → p-c3ffb88a.entry.js} +1 -1
  522. package/dist/twilight/{p-9deae4f4.entry.js → p-c87951a2.entry.js} +1 -1
  523. package/dist/twilight/{p-1899f283.entry.js → p-ccfe5308.entry.js} +1 -1
  524. package/dist/twilight/{p-98eb495e.entry.js → p-d337c399.entry.js} +1 -1
  525. package/dist/twilight/{p-7b717899.entry.js → p-d371d450.entry.js} +1 -1
  526. package/dist/twilight/{p-f8b6967f.entry.js → p-d4a242f8.entry.js} +1 -1
  527. package/dist/twilight/{p-194d87c6.entry.js → p-d9f5a8cd.entry.js} +1 -1
  528. package/dist/twilight/{p-ff9b33bb.entry.js → p-dd2bd5dc.entry.js} +1 -1
  529. package/dist/twilight/{p-e89812d8.entry.js → p-df6853b5.entry.js} +1 -1
  530. package/dist/twilight/{p-05663bb1.entry.js → p-e28c0773.entry.js} +1 -1
  531. package/dist/twilight/{p-a76b3dba.entry.js → p-e3b8e0e1.entry.js} +1 -1
  532. package/dist/twilight/p-e679884a.entry.js +4 -0
  533. package/dist/twilight/{p-11767786.entry.js → p-e6bbf50d.entry.js} +1 -1
  534. package/dist/twilight/{p-1ca75c99.entry.js → p-e94f217b.entry.js} +1 -1
  535. package/dist/twilight/{p-d81ad2c3.entry.js → p-eac718cd.entry.js} +1 -1
  536. package/dist/twilight/{p-85ceef78.entry.js → p-ede67a08.entry.js} +1 -1
  537. package/dist/twilight/p-efab88c5.entry.js +4 -0
  538. package/dist/twilight/{p-1dbaefb8.entry.js → p-f176d41d.entry.js} +1 -1
  539. package/dist/twilight/p-f5d15e71.entry.js +4 -0
  540. package/dist/twilight/{p-50621375.entry.js → p-f7999a6d.entry.js} +1 -1
  541. package/dist/twilight/twilight.esm.js +1 -1
  542. package/dist/types/components/salla-count-down/salla-count-down.d.ts +6 -0
  543. package/dist/types/components/salla-notifications/interfaces.d.ts +20 -0
  544. package/dist/types/components/salla-notifications/salla-notifications.d.ts +17 -0
  545. package/dist/types/components.d.ts +763 -177
  546. package/dist/types/stencil-public-runtime.d.ts +169 -11
  547. package/package.json +5 -5
  548. package/dist/cjs/filepond-plugin-file-validate-type-Dfy66STE.js +0 -287
  549. package/dist/esm/filepond-plugin-file-validate-type-BYs_scJr.js +0 -285
  550. package/dist/twilight/p-0652987b.entry.js +0 -4
  551. package/dist/twilight/p-14529fd6.entry.js +0 -4
  552. package/dist/twilight/p-1c8394db.entry.js +0 -4
  553. package/dist/twilight/p-346b55d6.entry.js +0 -4
  554. package/dist/twilight/p-3962c34c.entry.js +0 -4
  555. package/dist/twilight/p-4e9e3ab1.entry.js +0 -4
  556. package/dist/twilight/p-549f59ed.entry.js +0 -4
  557. package/dist/twilight/p-54f65187.entry.js +0 -4
  558. package/dist/twilight/p-726513f8.entry.js +0 -4
  559. package/dist/twilight/p-753464fd.entry.js +0 -4
  560. package/dist/twilight/p-AfW2b46_.js +0 -9
  561. package/dist/twilight/p-C23tPnnH.js +0 -5
  562. package/dist/twilight/p-CrYUKEsF.js +0 -9
  563. package/dist/twilight/p-HWjjIZ9_.js +0 -9
  564. package/dist/twilight/p-Ig1Tafsp.js +0 -9
  565. package/dist/twilight/p-c9001d7f.entry.js +0 -4
  566. package/dist/twilight/p-cf9573fd.entry.js +0 -4
  567. package/dist/twilight/p-e6124fab.entry.js +0 -4
  568. package/dist/twilight/p-eb5a8329.entry.js +0 -4
@@ -1,965 +1,4 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
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 };
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}