@salla.sa/twilight-components 2.14.272 → 2.14.273

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-B6LUaQ9F.js} +1 -1
  2. package/dist/cjs/{filepond-plugin-file-poster-DjNsnxTw.js → filepond-plugin-file-poster-DlB67Vv3.js} +1 -1
  3. package/dist/cjs/{filepond-plugin-file-validate-size-BlM1btNO.js → filepond-plugin-file-validate-size-D7kuqaEC.js} +1 -1
  4. package/dist/cjs/{filepond-plugin-file-validate-type-DhymSoh9.js → filepond-plugin-file-validate-type-CliXp1Qt.js} +1 -1
  5. package/dist/cjs/{filepond-plugin-image-edit-BQfvfpQ1.js → filepond-plugin-image-edit-BRIZbIyN.js} +1 -1
  6. package/dist/cjs/{filepond-plugin-image-exif-orientation-DOi06s13.js → filepond-plugin-image-exif-orientation-bFbWHyQs.js} +1 -1
  7. package/dist/cjs/{filepond-plugin-image-preview-Rfix7Xbt.js → filepond-plugin-image-preview-24nxaVX6.js} +1 -1
  8. package/dist/cjs/{index-DS7mXxWq.js → index-BpUrZ_-D.js} +136 -26
  9. package/dist/cjs/{index-vIV5iX-W.js → index-xI-pRoDr.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-C8M-qAIs.js} +1 -1
  134. package/dist/esm/{filepond-plugin-file-poster-DEj3O3wZ.js → filepond-plugin-file-poster-UfHq-uvl.js} +1 -1
  135. package/dist/esm/{filepond-plugin-file-validate-size-DYnIp5yF.js → filepond-plugin-file-validate-size-DZ15xnJZ.js} +1 -1
  136. package/dist/esm/{filepond-plugin-file-validate-type-Cx_PD8SU.js → filepond-plugin-file-validate-type-CWR9opI0.js} +1 -1
  137. package/dist/esm/{filepond-plugin-image-edit-BwmXRkmP.js → filepond-plugin-image-edit-XbR1h-bg.js} +1 -1
  138. package/dist/esm/{filepond-plugin-image-exif-orientation-BtsMS4U-.js → filepond-plugin-image-exif-orientation-cSRDvvXQ.js} +1 -1
  139. package/dist/esm/{filepond-plugin-image-preview-DQ0c3hIt.js → filepond-plugin-image-preview-B-SvzNFg.js} +1 -1
  140. package/dist/esm/{index-xiIpq8fU.js → index-Q_DltBmK.js} +1 -1
  141. package/dist/esm/{index-D5PGwR59.js → index-gLeBNvS1.js} +136 -26
  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-4611a11b.entry.js → p-00d8544c.entry.js} +1 -1
  176. package/dist/twilight/{p-b40d5871.entry.js → p-06d126b6.entry.js} +1 -1
  177. package/dist/twilight/{p-2bf21126.entry.js → p-1cc68ef5.entry.js} +1 -1
  178. package/dist/twilight/{p-BsHa_73h.js → p-1ekWkYOJ.js} +1 -1
  179. package/dist/twilight/p-21b37923.entry.js +4 -0
  180. package/dist/twilight/{p-bcab2639.entry.js → p-263b9b06.entry.js} +1 -1
  181. package/dist/twilight/{p-8ba8efe1.entry.js → p-2787ff9f.entry.js} +1 -1
  182. package/dist/twilight/p-3c1484b9.entry.js +11 -0
  183. package/dist/twilight/{p-c15928d5.entry.js → p-5057b400.entry.js} +1 -1
  184. package/dist/twilight/{p-280c1f64.entry.js → p-5278b873.entry.js} +1 -1
  185. package/dist/twilight/{p-e3b0a71f.entry.js → p-56f7a2ba.entry.js} +1 -1
  186. package/dist/twilight/{p-65b1fcea.entry.js → p-697db5c6.entry.js} +1 -1
  187. package/dist/twilight/{p-b94ebbd9.entry.js → p-73a8296a.entry.js} +1 -1
  188. package/dist/twilight/{p-eae51196.entry.js → p-7603a820.entry.js} +1 -1
  189. package/dist/twilight/{p-56fa3b9c.entry.js → p-7c8d7ca3.entry.js} +1 -1
  190. package/dist/twilight/{p-e95284d7.entry.js → p-80a07063.entry.js} +1 -1
  191. package/dist/twilight/{p-eaad31d1.entry.js → p-82c156ab.entry.js} +1 -1
  192. package/dist/twilight/{p-7df916fc.entry.js → p-8380c411.entry.js} +1 -1
  193. package/dist/twilight/{p-a61e2b8e.entry.js → p-946e5649.entry.js} +1 -1
  194. package/dist/twilight/{p-f3c29342.entry.js → p-9bcd9c87.entry.js} +1 -1
  195. package/dist/twilight/p-9c477fdf.entry.js +4 -0
  196. package/dist/twilight/{p-DV_VEuIe.js → p-B-nQtFTN.js} +1 -1
  197. package/dist/twilight/{p-DEUne75O.js → p-BI2zk2yo.js} +1 -1
  198. package/dist/twilight/{p-C4wd-bXb.js → p-BRD27esZ.js} +1 -1
  199. package/dist/twilight/{p-Bvez5luh.js → p-CUYEEJ4c.js} +1 -1
  200. package/dist/twilight/{p-CH8-uKSN.js → p-DUvdNUoC.js} +1 -1
  201. package/dist/twilight/{p-D0ZZ4jO5.js → p-DhR67rwu.js} +1 -1
  202. package/dist/twilight/p-a01dd6b7.entry.js +4 -0
  203. package/dist/twilight/{p-9e3f55be.entry.js → p-a3e000ef.entry.js} +1 -1
  204. package/dist/twilight/{p-3f412ab2.entry.js → p-a6c14a64.entry.js} +1 -1
  205. package/dist/twilight/p-b0b79820.entry.js +4 -0
  206. package/dist/twilight/{p-10856491.entry.js → p-b5581886.entry.js} +1 -1
  207. package/dist/twilight/p-b81437f4.entry.js +4 -0
  208. package/dist/twilight/{p-de200512.entry.js → p-bf010154.entry.js} +1 -1
  209. package/dist/twilight/{p-0ffafdea.entry.js → p-c0388251.entry.js} +1 -1
  210. package/dist/twilight/{p-2613f6dc.entry.js → p-c9ab361e.entry.js} +1 -1
  211. package/dist/twilight/{p-92848d53.entry.js → p-ed85bc00.entry.js} +1 -1
  212. package/dist/twilight/p-f7863a58.entry.js +4 -0
  213. package/dist/twilight/{p-D5PGwR59.js → p-gLeBNvS1.js} +2 -2
  214. package/dist/twilight/{p-D5p2t_CX.js → p-j4lbZMJ0.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
@@ -0,0 +1,195 @@
1
+ /*!
2
+ * Crafted with ❤ by Salla
3
+ */
4
+ import { Host, h, Fragment } from "@stencil/core";
5
+ export class SallaMultipleBundleProductDetails {
6
+ constructor() {
7
+ this.sections = [];
8
+ // store selected product IDs per section (can be string or number)
9
+ this.selectedProducts = {};
10
+ // Event handler reference for cleanup
11
+ this.productSelectedHandler = null;
12
+ // handle selecting a product (toggle)
13
+ this.onSelectProduct = (sectionId, product) => {
14
+ this.selectedProducts = {
15
+ ...this.selectedProducts,
16
+ [sectionId]: new Set(this.selectedProducts[sectionId] || []),
17
+ };
18
+ const productId = product.id;
19
+ const wasSelected = this.selectedProducts[sectionId].has(productId);
20
+ if (wasSelected) {
21
+ // Product is being deselected
22
+ this.selectedProducts[sectionId].delete(productId);
23
+ // Clear form data and modal options for this product in this specific section
24
+ this.clearProductFormData(productId, sectionId);
25
+ this.clearProductModalOptions(productId);
26
+ }
27
+ else {
28
+ // Product is being selected
29
+ this.selectedProducts[sectionId].add(productId);
30
+ }
31
+ // force re-render
32
+ this.selectedProducts = { ...this.selectedProducts };
33
+ // still dispatch event
34
+ salla.event.dispatch('on-bundle-product-selected', {
35
+ id: product.id,
36
+ name: product.name,
37
+ options: product.options,
38
+ wasSelected: wasSelected,
39
+ isSelected: !wasSelected,
40
+ });
41
+ };
42
+ // ensure product is selected (only add if not already selected)
43
+ this.ensureProductSelected = (sectionId, product) => {
44
+ this.selectedProducts = {
45
+ ...this.selectedProducts,
46
+ [sectionId]: new Set(this.selectedProducts[sectionId] || []),
47
+ };
48
+ const productId = product.id;
49
+ // Only add if not already selected
50
+ if (!this.selectedProducts[sectionId].has(productId)) {
51
+ this.selectedProducts[sectionId].add(productId);
52
+ // force re-render
53
+ this.selectedProducts = { ...this.selectedProducts };
54
+ // dispatch event
55
+ salla.event.dispatch('on-bundle-product-selected', {
56
+ id: product.id,
57
+ name: product.name,
58
+ options: product.options,
59
+ });
60
+ }
61
+ };
62
+ // open product options modal
63
+ this.onSelectProductOptions = (product, sectionId) => {
64
+ // Find the section index from the sectionId
65
+ const sectionIndex = this.sections.findIndex(section => section.id == sectionId);
66
+ // Find the product index within the section
67
+ const section = this.sections.find(section => section.id == sectionId);
68
+ const productIndex = section?.products?.findIndex(p => p.id == product.id) ?? 0;
69
+ salla.event.dispatch('multiple-bundle-product-modal::open', {
70
+ product,
71
+ sectionId,
72
+ sectionIndex,
73
+ productIndex,
74
+ });
75
+ };
76
+ // Event handlers for bundle slider component
77
+ this.handleBundleSliderProductSelected = (event) => {
78
+ const { product, sectionId } = event.detail;
79
+ this.onSelectProduct(sectionId, product);
80
+ };
81
+ this.handleBundleSliderProductOptionsSelected = (event) => {
82
+ const { product, sectionId } = event.detail;
83
+ this.onSelectProductOptions(product, sectionId);
84
+ };
85
+ }
86
+ // Clear form data for a specific product in specific section
87
+ clearProductFormData(productId, sectionId) {
88
+ const form = this.host.closest('form');
89
+ if (sectionId) {
90
+ // Remove inputs for specific section/productIndex combination
91
+ const productInputPattern = `bundle[${sectionId}][`;
92
+ const inputsToRemove = Array.from(form.querySelectorAll('input')).filter((input) => input.getAttribute('data-product-id') === String(productId) &&
93
+ input.name &&
94
+ input.name.startsWith(productInputPattern));
95
+ inputsToRemove.forEach(input => input.remove());
96
+ }
97
+ else {
98
+ // Fallback: Remove all hidden inputs related to this product (legacy behavior)
99
+ const inputsToRemove = form.querySelectorAll(`[data-product-id="${productId}"]`);
100
+ inputsToRemove.forEach(input => input.remove());
101
+ }
102
+ }
103
+ // Clear modal options state for a specific product
104
+ clearProductModalOptions(productId) {
105
+ // Emit event to notify modal to reset its state for this product
106
+ salla.event.dispatch('multiple-bundle-product-modal::clear-options', {
107
+ productId,
108
+ });
109
+ }
110
+ renderAccordionHeader(section, selectedCount) {
111
+ return (h(Fragment, null, h("h2", { slot: "title" }, section?.name), section?.obligatory_products && (h("span", { slot: "note" }, salla.lang.get('pages.products.obligatory_products', {
112
+ count: section?.obligatory_products || 0,
113
+ }))), h("span", { slot: "progress" }, selectedCount, "/", section?.products?.length || 0)));
114
+ }
115
+ componentDidLoad() {
116
+ // Listen for product selected event from modal
117
+ const modal = this.host.querySelector('salla-multiple-bundle-product-options-modal');
118
+ if (modal) {
119
+ this.productSelectedHandler = (e) => {
120
+ const { productId, sectionId, product, fromModal } = e.detail;
121
+ if (fromModal) {
122
+ // When called from modal, only add to selection if not already selected
123
+ this.ensureProductSelected(sectionId, product || { id: productId });
124
+ }
125
+ else {
126
+ // Normal toggle behavior
127
+ this.onSelectProduct(sectionId, product || { id: productId });
128
+ }
129
+ };
130
+ modal.addEventListener('productSelected', this.productSelectedHandler);
131
+ }
132
+ }
133
+ disconnectedCallback() {
134
+ // Clean up event listener to prevent memory leaks
135
+ if (this.productSelectedHandler) {
136
+ const modal = this.host.querySelector('salla-multiple-bundle-product-options-modal');
137
+ if (modal) {
138
+ modal.removeEventListener('productSelected', this.productSelectedHandler);
139
+ }
140
+ this.productSelectedHandler = null;
141
+ }
142
+ }
143
+ render() {
144
+ return (h(Host, { key: '0a24e2c3ee4bdff3891334a49318a7cfeb668d54', class: "s-multiple-bundle-product-wrapper" }, h("div", { key: '713f1b101aed42cabacd17d662aad49520b89f4b', class: "s-multiple-bundle-product-wrapper-sections" }, this.sections.map((section, index) => {
145
+ const selectedCount = this.selectedProducts[section.id]?.size || 0;
146
+ return (h("salla-accordion", { key: section.id, collapsed: index === 1 ? true : false }, h("salla-accordion-head", null, this.renderAccordionHeader(section, selectedCount)), h("salla-accordion-body", null, h("salla-multiple-bundle-product-slider", { section: section, sectionIndex: index, selectedProducts: this.selectedProducts, onProductSelected: this.handleBundleSliderProductSelected, onProductOptionsSelected: this.handleBundleSliderProductOptionsSelected }))));
147
+ })), h("salla-multiple-bundle-product-options-modal", { key: '2d889aa72a36040f87cd791363f71600d86458e7' })));
148
+ }
149
+ static get is() { return "salla-multiple-bundle-product-details"; }
150
+ static get originalStyleUrls() {
151
+ return {
152
+ "$": ["salla-multiple-bundle-product-details.scss"]
153
+ };
154
+ }
155
+ static get styleUrls() {
156
+ return {
157
+ "$": ["salla-multiple-bundle-product-details.css"]
158
+ };
159
+ }
160
+ static get properties() {
161
+ return {
162
+ "sections": {
163
+ "type": "unknown",
164
+ "attribute": "sections",
165
+ "mutable": false,
166
+ "complexType": {
167
+ "original": "BundleSection[]",
168
+ "resolved": "BundleSection[]",
169
+ "references": {
170
+ "BundleSection": {
171
+ "location": "import",
172
+ "path": "../interfaces",
173
+ "id": "src/components/salla-multiple-bundle-product/interfaces.ts::BundleSection"
174
+ }
175
+ }
176
+ },
177
+ "required": false,
178
+ "optional": false,
179
+ "docs": {
180
+ "tags": [],
181
+ "text": ""
182
+ },
183
+ "getter": false,
184
+ "setter": false,
185
+ "defaultValue": "[]"
186
+ }
187
+ };
188
+ }
189
+ static get states() {
190
+ return {
191
+ "selectedProducts": {}
192
+ };
193
+ }
194
+ static get elementRef() { return "host"; }
195
+ }