@salla.sa/twilight-components 2.14.272 → 2.14.274

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 (247) hide show
  1. package/dist/cjs/{filepond-EG2Mf8a1.js → filepond-L1nMkdqn.js} +1 -1
  2. package/dist/cjs/{filepond-plugin-file-poster-DjNsnxTw.js → filepond-plugin-file-poster-BYZl5BE2.js} +1 -1
  3. package/dist/cjs/{filepond-plugin-file-validate-size-BlM1btNO.js → filepond-plugin-file-validate-size-DSrSXg4-.js} +1 -1
  4. package/dist/cjs/{filepond-plugin-file-validate-type-DhymSoh9.js → filepond-plugin-file-validate-type-CgnsyE2V.js} +1 -1
  5. package/dist/cjs/{filepond-plugin-image-edit-BQfvfpQ1.js → filepond-plugin-image-edit-lODj8ghv.js} +1 -1
  6. package/dist/cjs/{filepond-plugin-image-exif-orientation-DOi06s13.js → filepond-plugin-image-exif-orientation-uQ5EYlsy.js} +1 -1
  7. package/dist/cjs/{filepond-plugin-image-preview-Rfix7Xbt.js → filepond-plugin-image-preview-Cm1OgAvZ.js} +1 -1
  8. package/dist/cjs/{index-DS7mXxWq.js → index-BEeccvkl.js} +136 -26
  9. package/dist/cjs/{index-vIV5iX-W.js → index-D0NII6ks.js} +1 -1
  10. package/dist/cjs/loader.cjs.js +3 -4
  11. package/dist/cjs/{salla-add-product-button_51.cjs.entry.js → salla-accordion_62.cjs.entry.js} +2104 -120
  12. package/dist/cjs/salla-advertisement.cjs.entry.js +1 -1
  13. package/dist/cjs/salla-app-install-alert.cjs.entry.js +1 -1
  14. package/dist/cjs/salla-apps-icons.cjs.entry.js +1 -1
  15. package/dist/cjs/salla-cart-item-offers.cjs.entry.js +1 -1
  16. package/dist/cjs/salla-conditional-offer.cjs.entry.js +1 -1
  17. package/dist/cjs/salla-contacts.cjs.entry.js +1 -1
  18. package/dist/cjs/salla-filters-widget.cjs.entry.js +1 -1
  19. package/dist/cjs/salla-filters.cjs.entry.js +1 -1
  20. package/dist/cjs/salla-installment.cjs.entry.js +1 -1
  21. package/dist/cjs/salla-loyalty-prize-item.cjs.entry.js +1 -1
  22. package/dist/cjs/salla-loyalty-program.cjs.entry.js +1 -1
  23. package/dist/cjs/salla-metadata.cjs.entry.js +1 -1
  24. package/dist/cjs/salla-notification-item.cjs.entry.js +2 -2
  25. package/dist/cjs/salla-notifications.cjs.entry.js +1 -1
  26. package/dist/cjs/salla-offer.cjs.entry.js +1 -1
  27. package/dist/cjs/salla-order-details-multiple-bundle-product.cjs.entry.js +1 -1
  28. package/dist/cjs/{salla-accordion_4.cjs.entry.js → salla-order-details-options.cjs.entry.js} +1 -100
  29. package/dist/cjs/salla-order-details.cjs.entry.js +2 -2
  30. package/dist/cjs/salla-order-summary.cjs.entry.js +2 -2
  31. package/dist/cjs/salla-orders.cjs.entry.js +1 -1
  32. package/dist/cjs/salla-payments.cjs.entry.js +3 -3
  33. package/dist/cjs/salla-price-range.cjs.entry.js +3 -3
  34. package/dist/cjs/salla-review-card.cjs.entry.js +2 -2
  35. package/dist/cjs/salla-reviews-page.cjs.entry.js +2 -2
  36. package/dist/cjs/salla-reviews.cjs.entry.js +2 -2
  37. package/dist/cjs/salla-social.cjs.entry.js +2 -2
  38. package/dist/cjs/salla-tiered-offer.cjs.entry.js +1 -1
  39. package/dist/cjs/salla-tooltip.cjs.entry.js +2 -2
  40. package/dist/cjs/salla-verify.cjs.entry.js +1 -1
  41. package/dist/cjs/salla-wallet.cjs.entry.js +1 -1
  42. package/dist/cjs/twilight.cjs.js +3 -4
  43. package/dist/collection/collection-manifest.json +5 -0
  44. package/dist/collection/components/salla-accordion/salla-accordion-head.js +8 -2
  45. package/dist/collection/components/salla-comments/salla-comments.js +20 -1
  46. package/dist/collection/components/salla-conditional-fields/salla-conditional-fields.js +33 -5
  47. package/dist/collection/components/salla-multiple-bundle-product/components/salla-multiple-bundle-product-cart.css +0 -0
  48. package/dist/collection/components/salla-multiple-bundle-product/components/salla-multiple-bundle-product-cart.js +89 -0
  49. package/dist/collection/components/salla-multiple-bundle-product/components/salla-multiple-bundle-product-details.css +0 -0
  50. package/dist/collection/components/salla-multiple-bundle-product/components/salla-multiple-bundle-product-details.js +195 -0
  51. package/dist/collection/components/salla-multiple-bundle-product/components/salla-multiple-bundle-product-options-modal.css +3 -0
  52. package/dist/collection/components/salla-multiple-bundle-product/components/salla-multiple-bundle-product-options-modal.js +595 -0
  53. package/dist/collection/components/salla-multiple-bundle-product/components/salla-multiple-bundle-product-slider.css +0 -0
  54. package/dist/collection/components/salla-multiple-bundle-product/components/salla-multiple-bundle-product-slider.js +174 -0
  55. package/dist/collection/components/salla-multiple-bundle-product/interfaces.js +1 -0
  56. package/dist/collection/components/salla-multiple-bundle-product/salla-multiple-bundle-product.css +3 -0
  57. package/dist/collection/components/salla-multiple-bundle-product/salla-multiple-bundle-product.js +132 -0
  58. package/dist/collection/components/salla-notifications/salla-notification-item.js +1 -1
  59. package/dist/collection/components/salla-offer-modal/salla-offer-modal.js +1 -1
  60. package/dist/collection/components/salla-order-details/salla-order-details.js +1 -1
  61. package/dist/collection/components/salla-order-summary/salla-order-summary.js +1 -1
  62. package/dist/collection/components/salla-payments/salla-payments.js +2 -2
  63. package/dist/collection/components/salla-placeholder/salla-placeholder.js +1 -1
  64. package/dist/collection/components/salla-price-range/salla-price-range.js +2 -2
  65. package/dist/collection/components/salla-product-availability/salla-product-availability.js +1 -1
  66. package/dist/collection/components/salla-product-card/salla-product-card.js +5 -5
  67. package/dist/collection/components/salla-product-options/salla-product-options.js +105 -22
  68. package/dist/collection/components/salla-product-size-guide/salla-product-size-guide.js +2 -2
  69. package/dist/collection/components/salla-quantity-input/salla-quantity-input.js +1 -1
  70. package/dist/collection/components/salla-quick-buy/salla-quick-buy.js +1 -1
  71. package/dist/collection/components/salla-review-card/salla-review-card.js +1 -1
  72. package/dist/collection/components/salla-reviews/salla-reviews.js +1 -1
  73. package/dist/collection/components/salla-reviews-page/salla-reviews-page.js +1 -1
  74. package/dist/collection/components/salla-scopes/salla-scopes.js +1 -1
  75. package/dist/collection/components/salla-search/salla-search.js +3 -3
  76. package/dist/collection/components/salla-skeleton/salla-skeleton.js +1 -1
  77. package/dist/collection/components/salla-slider/salla-slider.js +2 -2
  78. package/dist/collection/components/salla-social/salla-social.js +1 -1
  79. package/dist/collection/components/salla-social-share/salla-social-share.js +1 -1
  80. package/dist/collection/components/salla-tabs/salla-tab-content.js +1 -1
  81. package/dist/collection/components/salla-tabs/salla-tab-header.js +1 -1
  82. package/dist/collection/components/salla-tabs/salla-tabs.js +1 -1
  83. package/dist/collection/components/salla-tel-input/salla-tel-input.js +1 -1
  84. package/dist/collection/components/salla-tooltip/salla-tooltip.js +1 -1
  85. package/dist/collection/components/salla-user-settings/salla-user-settings.js +1 -1
  86. package/dist/components/index.js +2 -2
  87. package/dist/components/salla-accordion-head2.js +2 -2
  88. package/dist/components/salla-comments.js +20 -1
  89. package/dist/components/salla-conditional-fields2.js +28 -6
  90. package/dist/components/salla-multiple-bundle-product-cart.d.ts +11 -0
  91. package/dist/components/salla-multiple-bundle-product-cart.js +9 -0
  92. package/dist/components/salla-multiple-bundle-product-cart2.js +153 -0
  93. package/dist/components/salla-multiple-bundle-product-details.d.ts +11 -0
  94. package/dist/components/salla-multiple-bundle-product-details.js +9 -0
  95. package/dist/components/salla-multiple-bundle-product-details2.js +283 -0
  96. package/dist/components/salla-multiple-bundle-product-options-modal.d.ts +11 -0
  97. package/dist/components/salla-multiple-bundle-product-options-modal.js +9 -0
  98. package/dist/components/salla-multiple-bundle-product-options-modal2.js +585 -0
  99. package/dist/components/salla-multiple-bundle-product-slider.d.ts +11 -0
  100. package/dist/components/salla-multiple-bundle-product-slider.js +9 -0
  101. package/dist/components/salla-multiple-bundle-product-slider2.js +81 -0
  102. package/dist/components/salla-multiple-bundle-product.d.ts +11 -0
  103. package/dist/components/salla-multiple-bundle-product.js +210 -0
  104. package/dist/components/salla-notification-item2.js +1 -1
  105. package/dist/components/salla-offer-modal.js +1 -1
  106. package/dist/components/salla-order-details.js +1 -1
  107. package/dist/components/salla-order-summary.js +1 -1
  108. package/dist/components/salla-payments.js +2 -2
  109. package/dist/components/salla-placeholder2.js +1 -1
  110. package/dist/components/salla-price-range2.js +2 -2
  111. package/dist/components/salla-product-availability2.js +1 -1
  112. package/dist/components/salla-product-card2.js +5 -5
  113. package/dist/components/salla-product-options.js +1 -810
  114. package/dist/{esm/salla-product-options.entry.js → components/salla-product-options2.js} +197 -30
  115. package/dist/components/salla-product-size-guide.js +2 -2
  116. package/dist/components/salla-quantity-input.js +1 -1
  117. package/dist/components/salla-quick-buy2.js +1 -1
  118. package/dist/components/salla-review-card2.js +1 -1
  119. package/dist/components/salla-reviews-page.js +1 -1
  120. package/dist/components/salla-reviews.js +1 -1
  121. package/dist/components/salla-scopes.js +1 -1
  122. package/dist/components/salla-search.js +3 -3
  123. package/dist/components/salla-skeleton2.js +1 -1
  124. package/dist/components/salla-slider2.js +2 -2
  125. package/dist/components/salla-social-share.js +1 -1
  126. package/dist/components/salla-social.js +1 -1
  127. package/dist/components/salla-tab-content2.js +1 -1
  128. package/dist/components/salla-tab-header2.js +1 -1
  129. package/dist/components/salla-tabs2.js +1 -1
  130. package/dist/components/salla-tel-input2.js +1 -1
  131. package/dist/components/salla-tooltip2.js +1 -1
  132. package/dist/components/salla-user-settings.js +1 -1
  133. package/dist/esm/{filepond-DbR8YXoW.js → filepond-JStnJXdo.js} +1 -1
  134. package/dist/esm/{filepond-plugin-file-poster-DEj3O3wZ.js → filepond-plugin-file-poster-13kSl6pa.js} +1 -1
  135. package/dist/esm/{filepond-plugin-file-validate-size-DYnIp5yF.js → filepond-plugin-file-validate-size-DGYz9wX6.js} +1 -1
  136. package/dist/esm/{filepond-plugin-file-validate-type-Cx_PD8SU.js → filepond-plugin-file-validate-type-7M_EeTPs.js} +1 -1
  137. package/dist/esm/{filepond-plugin-image-edit-BwmXRkmP.js → filepond-plugin-image-edit-C5N0Q0IF.js} +1 -1
  138. package/dist/esm/{filepond-plugin-image-exif-orientation-BtsMS4U-.js → filepond-plugin-image-exif-orientation-BvYJ1LVk.js} +1 -1
  139. package/dist/esm/{filepond-plugin-image-preview-DQ0c3hIt.js → filepond-plugin-image-preview-P4HnGsSt.js} +1 -1
  140. package/dist/esm/{index-D5PGwR59.js → index-Bdj1TBK9.js} +136 -26
  141. package/dist/esm/{index-xiIpq8fU.js → index-CqLymITv.js} +1 -1
  142. package/dist/esm/loader.js +3 -4
  143. package/dist/esm/{salla-add-product-button_51.entry.js → salla-accordion_62.entry.js} +2084 -111
  144. package/dist/esm/salla-advertisement.entry.js +1 -1
  145. package/dist/esm/salla-app-install-alert.entry.js +1 -1
  146. package/dist/esm/salla-apps-icons.entry.js +1 -1
  147. package/dist/esm/salla-cart-item-offers.entry.js +1 -1
  148. package/dist/esm/salla-conditional-offer.entry.js +1 -1
  149. package/dist/esm/salla-contacts.entry.js +1 -1
  150. package/dist/esm/salla-filters-widget.entry.js +1 -1
  151. package/dist/esm/salla-filters.entry.js +1 -1
  152. package/dist/esm/salla-installment.entry.js +1 -1
  153. package/dist/esm/salla-loyalty-prize-item.entry.js +1 -1
  154. package/dist/esm/salla-loyalty-program.entry.js +1 -1
  155. package/dist/esm/salla-metadata.entry.js +1 -1
  156. package/dist/esm/salla-notification-item.entry.js +2 -2
  157. package/dist/esm/salla-notifications.entry.js +1 -1
  158. package/dist/esm/salla-offer.entry.js +1 -1
  159. package/dist/esm/salla-order-details-multiple-bundle-product.entry.js +1 -1
  160. package/dist/esm/{salla-accordion_4.entry.js → salla-order-details-options.entry.js} +2 -98
  161. package/dist/esm/salla-order-details.entry.js +2 -2
  162. package/dist/esm/salla-order-summary.entry.js +2 -2
  163. package/dist/esm/salla-orders.entry.js +1 -1
  164. package/dist/esm/salla-payments.entry.js +3 -3
  165. package/dist/esm/salla-price-range.entry.js +3 -3
  166. package/dist/esm/salla-review-card.entry.js +2 -2
  167. package/dist/esm/salla-reviews-page.entry.js +2 -2
  168. package/dist/esm/salla-reviews.entry.js +2 -2
  169. package/dist/esm/salla-social.entry.js +2 -2
  170. package/dist/esm/salla-tiered-offer.entry.js +1 -1
  171. package/dist/esm/salla-tooltip.entry.js +2 -2
  172. package/dist/esm/salla-verify.entry.js +1 -1
  173. package/dist/esm/salla-wallet.entry.js +1 -1
  174. package/dist/esm/twilight.js +3 -4
  175. package/dist/twilight/{p-56fa3b9c.entry.js → p-0f8534fd.entry.js} +1 -1
  176. package/dist/twilight/{p-3f412ab2.entry.js → p-1be88437.entry.js} +1 -1
  177. package/dist/twilight/{p-10856491.entry.js → p-1d81f143.entry.js} +1 -1
  178. package/dist/twilight/{p-4611a11b.entry.js → p-282f4f69.entry.js} +1 -1
  179. package/dist/twilight/{p-9e3f55be.entry.js → p-34e10e96.entry.js} +1 -1
  180. package/dist/twilight/{p-c15928d5.entry.js → p-3a4137eb.entry.js} +1 -1
  181. package/dist/twilight/{p-0ffafdea.entry.js → p-456d49c3.entry.js} +1 -1
  182. package/dist/twilight/{p-a61e2b8e.entry.js → p-4d05539c.entry.js} +1 -1
  183. package/dist/twilight/{p-e3b0a71f.entry.js → p-550d2b59.entry.js} +1 -1
  184. package/dist/twilight/{p-de200512.entry.js → p-57629f65.entry.js} +1 -1
  185. package/dist/twilight/p-5971eca7.entry.js +4 -0
  186. package/dist/twilight/p-723d7b1b.entry.js +4 -0
  187. package/dist/twilight/{p-92848d53.entry.js → p-78e6e403.entry.js} +1 -1
  188. package/dist/twilight/{p-2613f6dc.entry.js → p-895bd462.entry.js} +1 -1
  189. package/dist/twilight/p-9760fa21.entry.js +4 -0
  190. package/dist/twilight/{p-C4wd-bXb.js → p-AhRhML1e.js} +1 -1
  191. package/dist/twilight/{p-Bvez5luh.js → p-BP3jjHyr.js} +1 -1
  192. package/dist/twilight/{p-D5PGwR59.js → p-Bdj1TBK9.js} +2 -2
  193. package/dist/twilight/{p-BsHa_73h.js → p-Btn8p1Mk.js} +1 -1
  194. package/dist/twilight/{p-D0ZZ4jO5.js → p-CDM6fsL2.js} +2 -2
  195. package/dist/twilight/{p-CH8-uKSN.js → p-Ccp_rmSW.js} +1 -1
  196. package/dist/twilight/{p-DV_VEuIe.js → p-D6-aDTP4.js} +1 -1
  197. package/dist/twilight/{p-D5p2t_CX.js → p-DD6CdbcU.js} +1 -1
  198. package/dist/twilight/{p-DEUne75O.js → p-DYhkBiMu.js} +1 -1
  199. package/dist/twilight/p-a1e9d695.entry.js +4 -0
  200. package/dist/twilight/{p-eaad31d1.entry.js → p-a5681537.entry.js} +1 -1
  201. package/dist/twilight/{p-e95284d7.entry.js → p-a8d01888.entry.js} +1 -1
  202. package/dist/twilight/p-b254a752.entry.js +4 -0
  203. package/dist/twilight/{p-eae51196.entry.js → p-bd7a0c4f.entry.js} +1 -1
  204. package/dist/twilight/{p-7df916fc.entry.js → p-bf90a8c8.entry.js} +1 -1
  205. package/dist/twilight/p-c293f9c1.entry.js +11 -0
  206. package/dist/twilight/{p-b94ebbd9.entry.js → p-c9ad0ad1.entry.js} +1 -1
  207. package/dist/twilight/p-cc93a79e.entry.js +4 -0
  208. package/dist/twilight/{p-2bf21126.entry.js → p-e825aae4.entry.js} +1 -1
  209. package/dist/twilight/{p-8ba8efe1.entry.js → p-e99645f0.entry.js} +1 -1
  210. package/dist/twilight/{p-f3c29342.entry.js → p-f232e683.entry.js} +1 -1
  211. package/dist/twilight/{p-65b1fcea.entry.js → p-f7784dda.entry.js} +1 -1
  212. package/dist/twilight/{p-280c1f64.entry.js → p-f85916d5.entry.js} +1 -1
  213. package/dist/twilight/{p-bcab2639.entry.js → p-f96be282.entry.js} +1 -1
  214. package/dist/twilight/{p-b40d5871.entry.js → p-faee9d58.entry.js} +1 -1
  215. package/dist/twilight/twilight.esm.js +1 -1
  216. package/dist/types/components/salla-accordion/salla-accordion-head.d.ts +6 -0
  217. package/dist/types/components/salla-conditional-fields/salla-conditional-fields.d.ts +2 -0
  218. package/dist/types/components/salla-multiple-bundle-product/components/salla-multiple-bundle-product-cart.d.ts +10 -0
  219. package/dist/types/components/salla-multiple-bundle-product/components/salla-multiple-bundle-product-details.d.ts +20 -0
  220. package/dist/types/components/salla-multiple-bundle-product/components/salla-multiple-bundle-product-options-modal.d.ts +46 -0
  221. package/dist/types/components/salla-multiple-bundle-product/components/salla-multiple-bundle-product-slider.d.ts +22 -0
  222. package/dist/types/components/salla-multiple-bundle-product/interfaces.d.ts +101 -0
  223. package/dist/types/components/salla-multiple-bundle-product/salla-multiple-bundle-product.d.ts +42 -0
  224. package/dist/types/components/salla-product-options/salla-product-options.d.ts +21 -1
  225. package/dist/types/components.d.ts +298 -2
  226. package/package.json +5 -5
  227. package/dist/cjs/app-globals-OVEmNa5W.js +0 -38
  228. package/dist/cjs/camera-DytepEoK.js +0 -13
  229. package/dist/cjs/minus-CCryh1qf.js +0 -21
  230. package/dist/cjs/salla-booking-field_2.cjs.entry.js +0 -280
  231. package/dist/cjs/salla-product-options.cjs.entry.js +0 -715
  232. package/dist/esm/app-globals-BKgAyoNJ.js +0 -36
  233. package/dist/esm/camera-C6jIkM-X.js +0 -11
  234. package/dist/esm/minus-DfeagqF1.js +0 -18
  235. package/dist/esm/salla-booking-field_2.entry.js +0 -277
  236. package/dist/twilight/p-19c38b4a.entry.js +0 -11
  237. package/dist/twilight/p-8272b58f.entry.js +0 -4
  238. package/dist/twilight/p-989fcbb4.entry.js +0 -4
  239. package/dist/twilight/p-9f47b72b.entry.js +0 -4
  240. package/dist/twilight/p-C6jIkM-X.js +0 -4
  241. package/dist/twilight/p-DfeagqF1.js +0 -4
  242. package/dist/twilight/p-KHt1Smzh.js +0 -4
  243. package/dist/twilight/p-b8d41065.entry.js +0 -4
  244. package/dist/twilight/p-dd9695d6.entry.js +0 -4
  245. package/dist/twilight/p-e2ebb686.entry.js +0 -4
  246. package/dist/twilight/p-e30f7c20.entry.js +0 -4
  247. package/dist/twilight/p-fcb3e719.entry.js +0 -4
@@ -1,816 +1,7 @@
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$b } from './salla-booking-field2.js';
8
- import { d as defineCustomElement$a } from './salla-button2.js';
9
- import { d as defineCustomElement$9 } from './salla-color-picker2.js';
10
- import { d as defineCustomElement$8 } from './salla-conditional-fields2.js';
11
- import { d as defineCustomElement$7 } from './salla-datetime-picker2.js';
12
- import { d as defineCustomElement$6 } from './salla-file-upload2.js';
13
- import { d as defineCustomElement$5 } from './salla-loading2.js';
14
- import { d as defineCustomElement$4 } from './salla-map2.js';
15
- import { d as defineCustomElement$3 } from './salla-modal2.js';
16
- import { d as defineCustomElement$2 } 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$1 = /*@__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.disableCardValue = true;
76
- this.availableDigitalCardValues = [];
77
- this.userInitiatedValidation = false;
78
- this.outSkus = [];
79
- /**
80
- * Avoid selection of previous default or selected card value option
81
- * when switching between digital card country options for the 1st time
82
- */
83
- this.ignoreDefaultCardValue = false;
84
- /**
85
- * The id of the product to which the options are going to be fetched for.
86
- */
87
- this.productId = salla.config.get('page.id');
88
- this.handleDonationOptions = (event, detail, type) => {
89
- if (detail === 'custom' && type === 'input') {
90
- salla.helpers.inputDigitsOnly(event.target);
91
- salla.event.emit('product-options::donation-changed', {
92
- id: this.productId,
93
- price: event.target.value
94
- });
95
- return;
96
- }
97
- event.preventDefault();
98
- event.stopPropagation();
99
- this.isCustomDonation = event.target.value === 'custom';
100
- if (this.donationInput) {
101
- if (event.target.value === 'custom') {
102
- this.donationInput.value = '';
103
- this.donationInput.focus();
104
- }
105
- else {
106
- this.donationInput.value = event.target.value;
107
- }
108
- if (detail === 'custom') {
109
- return;
110
- }
111
- salla.event.emit('product-options::donation-changed', {
112
- id: this.productId,
113
- price: event.target.value
114
- });
115
- }
116
- };
117
- this.hideLabel = (option) => {
118
- if (option.type === DisplayType.DONATION && (option.donation && !option.donation.can_donate)) {
119
- return true;
120
- }
121
- return false;
122
- };
123
- this.getExpireDonationMessage = (option) => {
124
- if (!option.donation) {
125
- return;
126
- }
127
- const completed = option.donation.target_amount <= option.donation.collected_amount;
128
- 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) : '' }));
129
- };
130
- this.canDisabled = !salla.config.get('store.settings.product.notify_options_availability') || salla.url.is_page('cart');
131
- salla.lang.onLoaded(() => {
132
- this.outOfStockText = salla.lang.get("pages.products.out_of_stock");
133
- this.donationAmount = salla.lang.get('pages.products.donation_amount');
134
- this.selectDonationAmount = salla.lang.getWithDefault('pages.products.select_donation_amount', 'تحديد مبلغ التبرع');
135
- this.selectAmount = salla.lang.getWithDefault('pages.products.select_amount', 'اختر المبلغ');
136
- });
137
- if (this.options) {
138
- try {
139
- this.setOptionsData(Array.isArray(this.options) ? this.options : JSON.parse(this.options));
140
- return;
141
- }
142
- catch (e) {
143
- salla.log('Bad json passed via options prop');
144
- }
145
- }
146
- if (!Array.isArray(this.optionsData)) {
147
- salla.log('Options is not an array[] ---> ', this.optionsData);
148
- this.setOptionsData([]);
149
- }
150
- if (this.productId && !salla.url.is_page('cart')) {
151
- salla.api.product.getDetails(this.productId, ['options']).then(resp => this.setOptionsData(resp.data.options));
152
- }
153
- }
154
- /**
155
- * Sets the options data for the product
156
- * @param optionsData - Array of product options
157
- */
158
- async setOptionsData(optionsData) {
159
- this.optionsData = optionsData;
160
- const that = this;
161
- this.optionsData[0]?.details?.forEach(function (detail) {
162
- Object.entries(detail.skus_availability || {})
163
- .filter(sku => !sku[1])
164
- .map(sku => that.outSkus.push(Number(sku[0])));
165
- });
166
- }
167
- /**
168
- * Get the id's of the selected options.
169
- * */
170
- async getSelectedOptionsData() {
171
- const selectedOptions = {};
172
- const formData = this.host.getElementSallaData();
173
- formData.forEach((value, key) => {
174
- if (key.startsWith('options[')) {
175
- (selectedOptions[key.replace('options[', '').replace(']', '')] = value);
176
- }
177
- });
178
- return selectedOptions;
179
- }
180
- /**
181
- * Report options form validity.
182
- * */
183
- async reportValidity() {
184
- const requiredElements = this.host.querySelectorAll('[required]');
185
- let pass = true;
186
- for (let i = 0; i < requiredElements.length; i++) {
187
- //if there is only one invalid option, return false
188
- if ('reportValidity' in requiredElements[i] && !requiredElements[i].reportValidity()) {
189
- pass = false;
190
- }
191
- }
192
- return pass;
193
- }
194
- /**
195
- * Return true if there is any out of stock options are selected and vise versa.
196
- * */
197
- async hasOutOfStockOption() {
198
- return this.selectedOptions.some(option => option.is_out) || (this.selectedSkus?.length && this.selectedSkus?.every(sku => this.outSkus.includes(sku)));
199
- }
200
- /**
201
- * Get selected options.
202
- * */
203
- async getSelectedOptions() {
204
- return this.selectedOptions;
205
- }
206
- /**
207
- * Get a specific option by its id.
208
- * */
209
- async getOption(option_id) {
210
- return this.optionsData.find(option => option.id === option_id);
211
- }
212
- // @ts-ignore
213
- invalidHandler(event, option) {
214
- const closestProductOption = event.target.closest('.s-product-options-option');
215
- if (!closestProductOption.classList.contains('s-product-options-option-error')) {
216
- closestProductOption.classList.add('s-product-options-option-error');
217
- }
218
- if (this.userInitiatedValidation && !salla.url.is_page('cart')) {
219
- const firstInvalidElement = this.host.querySelector('.s-product-options-option-error');
220
- if (firstInvalidElement === closestProductOption) {
221
- this.scrollToElement(closestProductOption);
222
- }
223
- }
224
- }
225
- scrollToElement(element) {
226
- if (element) {
227
- element.scrollIntoView({ behavior: 'smooth', block: 'center' });
228
- }
229
- }
230
- changedHandler(event, option, fireChangeEvent = true) {
231
- const data = {
232
- event: event,
233
- option: option,
234
- detail: null,
235
- productId: this.productId
236
- };
237
- if (option.details) {
238
- const detail = option.details.find((detail) => {
239
- return Number(detail.id) === Number(event.target.value);
240
- });
241
- data.detail = detail;
242
- }
243
- if (option.type === 'country') {
244
- this.handleCountryOptionChange(event, data.detail);
245
- }
246
- const optionElement = event.target.closest('.s-product-options-option');
247
- if (event.target.value ||
248
- ((option.type === DisplayType.FILE || option.type === DisplayType.IMAGE) && event.type === 'added') ||
249
- (option.type === DisplayType.MAP && event.type === 'selected' && (event.target.lat && event.target.lng))) {
250
- setTimeout(() => {
251
- optionElement.classList.remove('s-product-options-option-error');
252
- }, 200);
253
- }
254
- if (option.type === DisplayType.DONATION) {
255
- salla.event.emit('product-options::donation-changed', {
256
- id: this.productId,
257
- price: event.target.value
258
- });
259
- }
260
- this.setSelectedSkus();
261
- this.handleRequiredMultipleOptions(option);
262
- const index = this.selectedOptions.findIndex(opt => opt.option_id === data.option.id);
263
- if (data.option.type === DisplayType.MULTIPLE_OPTIONS) {
264
- // Handle multiple selections
265
- const detailIndex = this.selectedOptions.findIndex(opt => opt.option_id === data.option.id && opt?.id === data.detail?.id);
266
- if (detailIndex > -1) {
267
- // If the option is already selected, remove it (unselect)
268
- this.selectedOptions.splice(detailIndex, 1);
269
- }
270
- else {
271
- // If the option is not selected, add it to the selectedOptions array
272
- this.selectedOptions.push({ ...data.detail, option_id: data.option.id });
273
- }
274
- }
275
- else {
276
- // Handle single selection
277
- if (!data.detail || Object.keys(data.detail).length === 0) {
278
- // If there is no value for the single-select, remove it from the selectedOptions array
279
- if (index > -1) {
280
- this.selectedOptions.splice(index, 1);
281
- }
282
- }
283
- else {
284
- // If a value exists, update or add the selection
285
- if (index > -1) {
286
- // Replace the existing selection with the new one
287
- this.selectedOptions[index] = { ...data.detail, option_id: data.option.id };
288
- }
289
- else {
290
- // If no selection exists for this input, add the new selection
291
- this.selectedOptions.push({ ...data.detail, option_id: data.option.id });
292
- }
293
- }
294
- }
295
- // Update optionsData directly
296
- this.optionsData = this.optionsData.map(opt => {
297
- if (opt.id === data.option.id) {
298
- return {
299
- ...opt,
300
- details: opt.details.map(detail => ({
301
- ...detail,
302
- is_selected: data.option.type === DisplayType.MULTIPLE_OPTIONS
303
- ? this.selectedOptions.some(selected => selected.id === detail.id)
304
- : Number(detail.id) === Number(data.detail?.id),
305
- value: data.detail?.value
306
- }))
307
- };
308
- }
309
- return opt;
310
- });
311
- // Emit the event only if fireChangeEvent is true
312
- if (fireChangeEvent) {
313
- this.changed.emit(data);
314
- salla.event.emit('product-options::change', data);
315
- }
316
- }
317
- /**
318
- * loop throw all selected details, then get common sku, if it's only one, means we selected all of them;
319
- */
320
- setSelectedSkus() {
321
- this.selectedSkus = this.selectedOptions.map(detail => Object.keys(detail.skus_availability || {}))
322
- .reduce((p, c) => p.filter(e => c.includes(e)), []) // Initialize accumulator as an empty array
323
- .map(sku => Number(sku));
324
- }
325
- handleRequiredMultipleOptions(option) {
326
- if (option.type !== DisplayType.MULTIPLE_OPTIONS || !option.required) {
327
- return;
328
- }
329
- const optionContainer = this.host.querySelector(`[data-option-id="${option.id}"]`);
330
- const hasChecked = optionContainer.querySelectorAll('input:checked').length;
331
- optionContainer.querySelectorAll('input').forEach(input => input.toggleAttribute('required', !hasChecked));
332
- }
333
- getLatLng(value, type) {
334
- return value
335
- ? value.split(',')[type === 'lat' ? 0 : 1]
336
- : '';
337
- }
338
- getDisplayForType(option) {
339
- if (this[`${option.type}Option`]) {
340
- return this[`${option.type}Option`](option);
341
- }
342
- if (option.type === DisplayType.COLOR_PICKER) {
343
- return this.colorPickerOption(option);
344
- }
345
- if (option.type === DisplayType.MULTIPLE_OPTIONS) {
346
- return this.multipleOptions(option);
347
- }
348
- if (option.type === DisplayType.SINGLE_OPTION) {
349
- return this.singleOption(option);
350
- }
351
- if (option.type === DisplayType.DIGITAL_CARD_VALUE) {
352
- return this.digitalCardValuesOption(option);
353
- }
354
- if (option.type === DisplayType.COUNTRY) {
355
- return this.countryOption(option);
356
- }
357
- if (option.type === DisplayType.BOOKING && salla.url.is_page("cart")) {
358
- return h("salla-booking-field", { onInvalidInput: (e) => this.invalidHandler(e, option), option: option, productId: option.value });
359
- }
360
- salla.log(`Couldn't find options type(${option.type})😢`);
361
- return '';
362
- }
363
- getOptionShownWhen(option) {
364
- return option.visibility_condition
365
- ? { "data-show-when": `options[${option.visibility_condition.option}] ${option.visibility_condition.operator} ${option.visibility_condition.value}` }
366
- : {};
367
- }
368
- getAvailableDigitalCardSKUs(detail) {
369
- const digitalCardOption = this.optionsData.find(({ type }) => type === 'digital-code-value');
370
- if (!digitalCardOption)
371
- throw new Error('product-options:: No digital card options found');
372
- const outofStockSKUs = Object.keys(detail.skus_availability).filter(key => detail.skus_availability[key] === false);
373
- this.availableDigitalCardValues = digitalCardOption.details.filter((op) => {
374
- return !Object.keys(op.skus_availability).filter(SKU_key => outofStockSKUs.includes(SKU_key)).length;
375
- });
376
- }
377
- handleCountryOptionChange(event, detail) {
378
- event.stopImmediatePropagation();
379
- this.ignoreDefaultCardValue = true;
380
- const currentCardValue = this.host.querySelector("input[data-code-value]:checked");
381
- if (currentCardValue)
382
- currentCardValue.checked = false;
383
- const digitalCardOption = this.optionsData.find(({ type }) => type === 'digital-code-value');
384
- if (!digitalCardOption)
385
- throw new Error('product-options:: No digital card options found');
386
- this.getAvailableDigitalCardSKUs(detail);
387
- }
388
- getSelectedDigitalCardOptions(option) {
389
- const selectedOption = option.details.find(detail => detail.is_selected);
390
- const defaultOption = option.details.find(detail => !!detail.is_default) || option.details[0]; /*option.details[0] only applys for counrty options*/
391
- if (!['digital-code-value', 'country'].includes(option.type))
392
- return;
393
- return selectedOption || defaultOption;
394
- }
395
- //we need the cart Id for productOption Image
396
- async componentWillLoad() {
397
- if (salla.url.is_page("cart")) {
398
- this.disableCardValue = false;
399
- this.fillSelectedOptions();
400
- }
401
- if (this.config) {
402
- try {
403
- this.optionConfig = typeof this.config === 'string' ? JSON.parse(this.config) : this.config;
404
- }
405
- catch (error) {
406
- console.error('Failed to parse JSON in config prop:', error);
407
- }
408
- }
409
- const shouldSelectDefaultOption = this.optionsData.filter(({ type }) => ["country", "digital-card-value"].includes(type)).length > 0 && salla.url.is_page('cart');
410
- if (shouldSelectDefaultOption) {
411
- const countryOption = this.optionsData.find(option => option.type === 'country');
412
- const defaultSelection = countryOption && this.getSelectedDigitalCardOptions(countryOption);
413
- if (defaultSelection) {
414
- this.getAvailableDigitalCardSKUs(defaultSelection);
415
- }
416
- }
417
- this.outOfStockText = salla.lang.get('pages.products.out_of_stock');
418
- await salla.onReady();
419
- document.addEventListener("paste", this.handlePaste.bind(this));
420
- const needsCartId = (!salla.storage.get('cart.id') && this.optionsData.some(option => ['file', 'image'].includes(option.type)));
421
- return needsCartId ? salla.api.cart.getCurrentCartId(false, "salla-product-options") : null;
422
- }
423
- /**
424
- * This is a workaround for a bug in iOS 26 Safari, when pasting English text to RTL inputs, it adds extra text!!
425
- * To avoid any break changes, we will make it only work on these conditions:
426
- * - content_copyright is on
427
- * - Apple Pay is enabled (means it's iOS/safari)
428
- * - Input is an input or textarea
429
- * - Salla form control
430
- * - Options array
431
- */
432
- handlePaste(event) {
433
- const target = event.target;
434
- if (!Salla.config.get('store.settings.content_copyright')
435
- || !Salla.helpers.hasApplePay()
436
- || !(target instanceof HTMLInputElement || target instanceof HTMLTextAreaElement)
437
- || !target.classList.contains('s-form-control')
438
- || !target.name.startsWith('options[')) {
439
- return;
440
- }
441
- // Prevent default paste (to avoid Safari inserting extra content)
442
- event.preventDefault();
443
- // Read only the clipboard data
444
- const text = event.clipboardData?.getData("text") || "";
445
- // Insert it manually at cursor if you want
446
- const start = target.selectionStart;
447
- const end = target.selectionEnd;
448
- const newValue = target.value.slice(0, start) + text + target.value.slice(end);
449
- target.value = newValue;
450
- // Reset cursor position
451
- target.setSelectionRange(start + text.length, start + text.length);
452
- }
453
- hideDigitalCardsOptions(option) {
454
- return (this.disableCardValue && option.type === DisplayType.DIGITAL_CARD_VALUE && !salla.url.is_page("cart"));
455
- }
456
- render() {
457
- if (this.optionsData?.length === 0) {
458
- return;
459
- }
460
- 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' ?
461
- this.splitterOption()
462
- : 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: `options[${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))))))));
463
- }
464
- generateUniqueKey(defaultValue) {
465
- return this.uniqueKey ? `${defaultValue}-${this.uniqueKey}` : defaultValue;
466
- }
467
- fillSelectedOptions() {
468
- this.selectedOptions = this.optionsData.reduce((acc, opt) => {
469
- const selectedDetails = opt.details.filter(detail => detail.is_selected);
470
- const mappedDetails = selectedDetails.map(detail => ({
471
- ...detail,
472
- option_id: opt.id
473
- }));
474
- return acc.concat(mappedDetails);
475
- }, []);
476
- }
477
- componentDidLoad() {
478
- if (this.optionsData?.length === 0 && !this.optionsData.some(option => option.type === DisplayType.DONATION)) {
479
- return;
480
- }
481
- const selectedDonationOption = this.optionsData.find(option => option.type === DisplayType.DONATION)?.details.find(detail => detail.is_selected);
482
- if (!selectedDonationOption) {
483
- return;
484
- }
485
- setTimeout(() => {
486
- salla.event.emit('product-options::donation-changed', {
487
- id: this.productId,
488
- price: selectedDonationOption.additional_price
489
- });
490
- }, 1000);
491
- }
492
- /**
493
- * Enable user-initiated validation mode so invalid fields will scroll into view
494
- */
495
- async enableUserInitiatedValidation() {
496
- this.userInitiatedValidation = true;
497
- }
498
- /**
499
- * Validate options and trigger scrolling to the first invalid option if any
500
- */
501
- async validateAndScroll() {
502
- await this.enableUserInitiatedValidation();
503
- return this.reportValidity();
504
- }
505
- //@ts-ignore
506
- donationOption(option, product) {
507
- return h("div", { class: "s-product-options-donation-wrapper" }, option.donation?.can_donate ? [
508
- option.donation ?
509
- h("div", { key: option.id, class: "s-product-options-donation-progress" }, h("salla-progress-bar", { donation: option.donation }))
510
- : '',
511
- option.details.length ?
512
- [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') }), h("label", { htmlFor: this.generateUniqueKey(`donation-option-${i}`) }, h("span", { innerHTML: salla.money(detail.name) })))), option.donation?.custom_amount_enabled ?
513
- 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') }), h("label", { htmlFor: this.generateUniqueKey("donation-option-custom") }, h("span", null, " ", this.selectDonationAmount, " ")))
514
- : '')] : '',
515
- 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
516
- && option.details.some(detail => detail.is_selected)
517
- ? option.details.find(detail => detail.is_selected).additional_price
518
- : option.value,
519
- // required
520
- placeholder: option.placeholder, onInput: e => this.handleDonationOptions(e, 'custom', 'input'), 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))
521
- ] :
522
- this.getExpireDonationMessage(option));
523
- }
524
- fileUploader(option, additions = null) {
525
- return h("salla-file-upload", { ...(additions || {}), "payload-name": "file", value: option.value, "instant-upload": true, name: `options[${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'))
526
- ? CameraIcon
527
- : 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'))));
528
- }
529
- //@ts-ignore
530
- imageOption(option) {
531
- return this.fileUploader(option, { accept: 'image/png,image/jpeg,image/jpg,image/gif' });
532
- }
533
- //@ts-ignore
534
- fileOption(option) {
535
- const types = option.details.map(detail => this.fileTypes[detail.name]).filter(Boolean);
536
- return types?.length
537
- ? this.fileUploader(option, { accept: types.join(',') })
538
- : 'File types not selected.';
539
- }
540
- // TODO: (ONLY FOR TESTING!) find a better way to make it testable, e.g. wrap it with a unique class like textOption
541
- //@ts-ignore
542
- numberOption(option) {
543
- return h("input", { type: "text", value: option.value, class: "s-form-control", required: !option.visibility_condition && option.required, name: `options[${option.id}]`, placeholder: option.placeholder, onBlur: e => this.changedHandler(e, option), onInvalid: (e) => this.invalidHandler(e, option), onInput: e => salla.helpers.inputDigitsOnly(e.target) });
544
- }
545
- //@ts-ignore
546
- splitterOption() {
547
- return h("div", { class: "s-product-options-splitter" });
548
- }
549
- //@ts-ignore
550
- textOption(option) {
551
- 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, name: `options[${option.id}]`, placeholder: option.placeholder, onInvalid: (e) => this.invalidHandler(e, option), onChange: e => this.changedHandler(e, option) }));
552
- }
553
- //@ts-ignore
554
- textareaOption(option) {
555
- //todo::remove mt-1 class, and if it's okay to remove the tag itself will be great
556
- 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: `options[${option.id}]`, name: `options[${option.id}]`, placeholder: option.placeholder, onInvalid: (e) => this.invalidHandler(e, option), onChange: (e) => this.changedHandler(e, option) })));
557
- }
558
- //@ts-ignore
559
- mapOption(option) {
560
- return h("salla-map", { zoom: 15, lat: this.getLatLng(option.value, 'lat'), lng: this.getLatLng(option.value, 'lng'), name: `options[${option.id}]`, searchable: true, required: option.required, onInvalidInput: (e) => this.invalidHandler(e, option), onSelected: e => this.changedHandler(e, option) });
561
- }
562
- colorPickerOption(option) {
563
- return h("salla-color-picker", { onSubmitted: e => this.changedHandler(e, option), name: `options[${option.id}]`, required: !option.visibility_condition && option.required, onInvalidInput: (e) => this.invalidHandler(e, option), color: option.value });
564
- }
565
- /**
566
- * ============= Date Time options =============
567
- */
568
- //@ts-ignore
569
- timeOption(option) {
570
- 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: `options[${option.id}]`, class: "s-product-options-time-element", onInvalidInput: (e) => this.invalidHandler(e, option), onPicked: e => this.changedHandler(e, option) });
571
- }
572
- //@ts-ignore
573
- dateOption(option) {
574
- //todo:: consider date-range @see https://github.com/SallaApp/theme-raed/blob/master/src/assets/js/partials/product-options.js#L8-L23
575
- 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: `options[${option.id}]`, onInvalidInput: (e) => this.invalidHandler(e, option), onPicked: e => this.changedHandler(e, option) }));
576
- }
577
- //@ts-ignore
578
- datetimeOption(option) {
579
- //todo:: consider date-range @see https://github.com/SallaApp/theme-raed/blob/master/src/assets/js/partials/product-options.js#L8-L23
580
- 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: `options[${option.id}]`, maxDate: option.to_date_time, minDate: option.from_date_time, onInvalidInput: (e) => this.invalidHandler(e, option), onPicked: e => this.changedHandler(e, option) }));
581
- }
582
- /**
583
- * ============= Advanced options =============
584
- */
585
- getOptionDetailName(detail, outOfStock = true, optionType) {
586
- let detailName;
587
- if (optionType && optionType === DisplayType.COLOR) {
588
- detailName = detail.name
589
- + ((outOfStock && this.isOptionDetailOut(detail) && !salla.url.is_page("cart")) && !this.hideOutLabel ? ` <br/> <p> ${this.outOfStockText} </p>` : '')
590
- + (detail.additional_price ? ` <p> (${salla.money(detail.additional_price, false)}) </p>` : '');
591
- }
592
- if (!detailName) {
593
- detailName = detail.name
594
- + ((outOfStock && this.isOptionDetailOut(detail) && !salla.url.is_page("cart")) && !this.hideOutLabel ? ` - ${this.outOfStockText}` : '')
595
- + (detail.additional_price ? ` (${salla.money(detail.additional_price, false)})` : '');
596
- }
597
- //Some merchants adding price to the names of the options,
598
- //and because we are using this inside select option, we need to replace the html currency symbol with the store currency symbol
599
- return detailName.replace('<i class=sicon-sar></i>', salla.config.currency()?.symbol || 'ر.س');
600
- }
601
- isOptionDetailOut(detail) {
602
- if (detail.is_out || !detail.skus_availability || !this.selectedSkus?.length) {
603
- return detail.is_out;
604
- }
605
- const isDetailSelected = this.selectedOptions.filter(option => option.id === detail.id).length;
606
- //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
607
- if (isDetailSelected && this.selectedOptions.length === 1) {
608
- return false;
609
- }
610
- //if current details has sku in the possible outSkus it's out for sure
611
- if (isDetailSelected) {
612
- //here we will get the possible outSkus for current selected options
613
- const outSelectableSkus = this.selectedSkus.filter(sku => this.outSkus.includes(sku));
614
- return Object.keys(detail.skus_availability).some(sku => outSelectableSkus.includes(Number(sku)));
615
- }
616
- return this.selectedOptions.some(option => option.is_out && option.option_id !== detail.option_id);
617
- }
618
- /**
619
- * Renders a single input element (radio or checkbox) for an option detail.
620
- * @param type - The type of input element ('radio' or 'checkbox').
621
- * @param detail - The detail object representing an option detail.
622
- * @param option - The parent option object containing the details.
623
- * @param isRequired - Indicates if the input is required based on the option's rules.
624
- * @param name - The name attribute for the input element.
625
- * @returns HTMLElement - A labeled input element.
626
- */
627
- renderInput(type, detail, option, isRequired, name, buttonStyle) {
628
- const id = this.generateUniqueKey(`${type}-${option.id}-${detail.id}`);
629
- const isDisabled = this.isOptionDetailOut(detail);
630
- return (h("label", { class: {
631
- "s-product-options-disabled": isDisabled,
632
- } }, 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))));
633
- }
634
- /**
635
- * Renders a collection of input elements for all details of an option.
636
- * @param type - The type of input elements ('radio' or 'checkbox').
637
- * @param option - The parent option object containing the details.
638
- * @param isRequired - Indicates if the inputs are required based on the option's rules.
639
- * @returns HTMLElement[] - An array of labeled input elements.
640
- */
641
- renderOptionDetails(type, option, isRequired, buttonStyle = false) {
642
- const name = type === 'radio' ? `options[${option.id}]` : `options[${option.id}][]`;
643
- return option?.details.map((detail) => this.renderInput(type, detail, option, isRequired, name, buttonStyle));
644
- }
645
- /**
646
- * Renders a dropdown (select) element for a single-option selection.
647
- * @param option - The parent option object.
648
- * @returns HTMLElement - A select dropdown element with all option details.
649
- */
650
- renderSelect(option) {
651
- return (h("div", null, h("select", { name: `options[${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)))))));
652
- }
653
- /**
654
- * Renders a grid-based layout for option inputs (radio or checkbox).
655
- * @param type - The type of input elements ('radio' or 'checkbox').
656
- * @param option - The parent option object containing the details.
657
- * @param isRequired - Indicates if the inputs are required based on the option's rules.
658
- * @returns HTMLElement - A grid-based container with input elements.
659
- */
660
- renderButtonStyle(type, option, isRequired) {
661
- return (h("div", { class: "s-product-options-grid-mode" }, this.renderOptionDetails(type, option, isRequired, true)));
662
- }
663
- /**
664
- * Renders a single-option selection, either as a grid or dropdown, based on configuration.
665
- * @param option - The parent option object.
666
- * @returns HTMLElement - The rendered single-option element.
667
- */
668
- singleOption(option) {
669
- const buttonStyle = this.optionConfig?.['single-option']?.type === 'button';
670
- const isRequired = !option.visibility_condition && option.required;
671
- return buttonStyle
672
- ? this.renderButtonStyle('radio', option, isRequired)
673
- : this.renderSelect(option);
674
- }
675
- /**
676
- * Renders a multiple-option selection, either as a grid or list, based on configuration.
677
- * @param option - The parent option object.
678
- * @returns HTMLElement - The rendered multiple-option element.
679
- */
680
- multipleOptions(option) {
681
- const buttonStyle = this.optionConfig?.['multiple-option']?.type === 'button';
682
- const isRequired = option.required &&
683
- !option.details.some((detail) => detail.is_selected) &&
684
- !option.visibility_condition;
685
- return buttonStyle
686
- ? this.renderButtonStyle('checkbox', option, isRequired)
687
- : (h("div", { class: {
688
- 's-product-options-multiple-options-wrapper': true,
689
- required: option.required,
690
- } }, this.renderOptionDetails('checkbox', option, isRequired)));
691
- }
692
- //@ts-ignore
693
- colorOption(option) {
694
- 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: `options[${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) })))))));
695
- }
696
- //@ts-ignore
697
- thumbnailOption(option) {
698
- return h("div", { class: "s-product-options-thumbnails-wrapper" }, option.details.map((detail) => {
699
- 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: `options[${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) ?
700
- [
701
- h("small", { key: detail.id, class: "s-product-options-thumbnails-stock-badge" }, this.outOfStockText),
702
- this.canDisabled ? h("div", { key: detail.id, class: "s-product-options-thumbnails-badge-overlay" }) : '',
703
- ]
704
- : ''), h("p", null, this.getOptionDetailName(detail, false), " "));
705
- }));
706
- }
707
- // Digital card options
708
- digitalCardValuesOption(option) {
709
- return h("div", { class: "s-product-options-digital-card-wrapper" }, this.availableDigitalCardValues.length > 0 ? this.availableDigitalCardValues.map((detail) => {
710
- const id = String(detail.id);
711
- 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: `options[${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));
712
- })
713
- : h("div", { class: "s-product-options-digital-card-out-of-stock" }));
714
- }
715
- countryOption(option) {
716
- return h("div", { class: "s-product-options-digital-card-wrapper" }, option.details.map((detail) => {
717
- 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: `options[${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` }), h("span", null, detail.name));
718
- }));
719
- }
720
- get host() { return this; }
721
- static get style() { return sallaProductOptionsCss; }
722
- }, [0, "salla-product-options", {
723
- "productId": [2, "product-id"],
724
- "options": [1],
725
- "hideOutLabel": [1, "hide-out-label"],
726
- "uniqueKey": [1, "unique-key"],
727
- "config": [1],
728
- "optionsData": [32],
729
- "outOfStockText": [32],
730
- "donationAmount": [32],
731
- "selectDonationAmount": [32],
732
- "selectAmount": [32],
733
- "isCustomDonation": [32],
734
- "selectedOptions": [32],
735
- "canDisabled": [32],
736
- "selectedSkus": [32],
737
- "selectedOutSkus": [32],
738
- "disableCardValue": [32],
739
- "availableDigitalCardValues": [32],
740
- "userInitiatedValidation": [32],
741
- "setOptionsData": [64],
742
- "getSelectedOptionsData": [64],
743
- "reportValidity": [64],
744
- "hasOutOfStockOption": [64],
745
- "getSelectedOptions": [64],
746
- "getOption": [64],
747
- "enableUserInitiatedValidation": [64],
748
- "validateAndScroll": [64]
749
- }]);
750
- function defineCustomElement$1() {
751
- if (typeof customElements === "undefined") {
752
- return;
753
- }
754
- 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"];
755
- components.forEach(tagName => { switch (tagName) {
756
- case "salla-product-options":
757
- if (!customElements.get(tagName)) {
758
- customElements.define(tagName, SallaProductOptions$1);
759
- }
760
- break;
761
- case "salla-booking-field":
762
- if (!customElements.get(tagName)) {
763
- defineCustomElement$b();
764
- }
765
- break;
766
- case "salla-button":
767
- if (!customElements.get(tagName)) {
768
- defineCustomElement$a();
769
- }
770
- break;
771
- case "salla-color-picker":
772
- if (!customElements.get(tagName)) {
773
- defineCustomElement$9();
774
- }
775
- break;
776
- case "salla-conditional-fields":
777
- if (!customElements.get(tagName)) {
778
- defineCustomElement$8();
779
- }
780
- break;
781
- case "salla-datetime-picker":
782
- if (!customElements.get(tagName)) {
783
- defineCustomElement$7();
784
- }
785
- break;
786
- case "salla-file-upload":
787
- if (!customElements.get(tagName)) {
788
- defineCustomElement$6();
789
- }
790
- break;
791
- case "salla-loading":
792
- if (!customElements.get(tagName)) {
793
- defineCustomElement$5();
794
- }
795
- break;
796
- case "salla-map":
797
- if (!customElements.get(tagName)) {
798
- defineCustomElement$4();
799
- }
800
- break;
801
- case "salla-modal":
802
- if (!customElements.get(tagName)) {
803
- defineCustomElement$3();
804
- }
805
- break;
806
- case "salla-progress-bar":
807
- if (!customElements.get(tagName)) {
808
- defineCustomElement$2();
809
- }
810
- break;
811
- } });
812
- }
813
- defineCustomElement$1();
4
+ import { S as SallaProductOptions$1, d as defineCustomElement$1 } from './salla-product-options2.js';
814
5
 
815
6
  const SallaProductOptions = SallaProductOptions$1;
816
7
  const defineCustomElement = defineCustomElement$1;