@salla.sa/twilight-components 2.14.271 → 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.
- package/dist/cjs/{filepond-DZKo1pV9.js → filepond-B6LUaQ9F.js} +1 -1
- package/dist/cjs/{filepond-plugin-file-poster-Ddu0-eEg.js → filepond-plugin-file-poster-DlB67Vv3.js} +1 -1
- package/dist/cjs/{filepond-plugin-file-validate-size-B2VId_n-.js → filepond-plugin-file-validate-size-D7kuqaEC.js} +1 -1
- package/dist/cjs/{filepond-plugin-file-validate-type-lGUMFCde.js → filepond-plugin-file-validate-type-CliXp1Qt.js} +1 -1
- package/dist/cjs/{filepond-plugin-image-edit-BlEvC0bv.js → filepond-plugin-image-edit-BRIZbIyN.js} +1 -1
- package/dist/cjs/{filepond-plugin-image-exif-orientation-C9yPmasn.js → filepond-plugin-image-exif-orientation-bFbWHyQs.js} +1 -1
- package/dist/cjs/{filepond-plugin-image-preview-BPQ9o2YT.js → filepond-plugin-image-preview-24nxaVX6.js} +1 -1
- package/dist/cjs/{index-DpqjX7F3.js → index-BpUrZ_-D.js} +136 -26
- package/dist/cjs/{index-4c5cqxT-.js → index-xI-pRoDr.js} +1 -1
- package/dist/cjs/loader.cjs.js +3 -4
- package/dist/cjs/{salla-add-product-button_51.cjs.entry.js → salla-accordion_62.cjs.entry.js} +2104 -121
- package/dist/cjs/salla-advertisement.cjs.entry.js +1 -1
- package/dist/cjs/salla-app-install-alert.cjs.entry.js +1 -1
- package/dist/cjs/salla-apps-icons.cjs.entry.js +1 -1
- package/dist/cjs/salla-cart-item-offers.cjs.entry.js +1 -1
- package/dist/cjs/salla-conditional-offer.cjs.entry.js +1 -1
- package/dist/cjs/salla-contacts.cjs.entry.js +1 -1
- package/dist/cjs/salla-filters-widget.cjs.entry.js +1 -1
- package/dist/cjs/salla-filters.cjs.entry.js +1 -1
- package/dist/cjs/salla-installment.cjs.entry.js +1 -1
- package/dist/cjs/salla-loyalty-prize-item.cjs.entry.js +1 -1
- package/dist/cjs/salla-loyalty-program.cjs.entry.js +1 -1
- package/dist/cjs/salla-metadata.cjs.entry.js +1 -1
- package/dist/cjs/salla-notification-item.cjs.entry.js +2 -2
- package/dist/cjs/salla-notifications.cjs.entry.js +1 -1
- package/dist/cjs/salla-offer.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-details-multiple-bundle-product.cjs.entry.js +1 -1
- package/dist/cjs/{salla-accordion_4.cjs.entry.js → salla-order-details-options.cjs.entry.js} +1 -100
- package/dist/cjs/salla-order-details.cjs.entry.js +2 -2
- package/dist/cjs/salla-order-summary.cjs.entry.js +2 -2
- package/dist/cjs/salla-orders.cjs.entry.js +1 -1
- package/dist/cjs/salla-payments.cjs.entry.js +3 -3
- package/dist/cjs/salla-price-range.cjs.entry.js +3 -3
- package/dist/cjs/salla-review-card.cjs.entry.js +2 -2
- package/dist/cjs/salla-reviews-page.cjs.entry.js +2 -2
- package/dist/cjs/salla-reviews.cjs.entry.js +2 -2
- package/dist/cjs/salla-social.cjs.entry.js +2 -2
- package/dist/cjs/salla-tiered-offer.cjs.entry.js +1 -1
- package/dist/cjs/salla-tooltip.cjs.entry.js +2 -2
- package/dist/cjs/salla-verify.cjs.entry.js +1 -1
- package/dist/cjs/salla-wallet.cjs.entry.js +1 -1
- package/dist/cjs/twilight.cjs.js +3 -4
- package/dist/collection/collection-manifest.json +5 -0
- package/dist/collection/components/salla-accordion/salla-accordion-head.js +8 -2
- package/dist/collection/components/salla-comments/salla-comments.js +20 -1
- package/dist/collection/components/salla-conditional-fields/salla-conditional-fields.js +33 -5
- package/dist/collection/components/salla-login-modal/salla-login-modal.js +0 -1
- package/dist/collection/components/salla-multiple-bundle-product/components/salla-multiple-bundle-product-cart.css +0 -0
- package/dist/collection/components/salla-multiple-bundle-product/components/salla-multiple-bundle-product-cart.js +89 -0
- package/dist/collection/components/salla-multiple-bundle-product/components/salla-multiple-bundle-product-details.css +0 -0
- package/dist/collection/components/salla-multiple-bundle-product/components/salla-multiple-bundle-product-details.js +195 -0
- package/dist/collection/components/salla-multiple-bundle-product/components/salla-multiple-bundle-product-options-modal.css +3 -0
- package/dist/collection/components/salla-multiple-bundle-product/components/salla-multiple-bundle-product-options-modal.js +595 -0
- package/dist/collection/components/salla-multiple-bundle-product/components/salla-multiple-bundle-product-slider.css +0 -0
- package/dist/collection/components/salla-multiple-bundle-product/components/salla-multiple-bundle-product-slider.js +174 -0
- package/dist/collection/components/salla-multiple-bundle-product/interfaces.js +1 -0
- package/dist/collection/components/salla-multiple-bundle-product/salla-multiple-bundle-product.css +3 -0
- package/dist/collection/components/salla-multiple-bundle-product/salla-multiple-bundle-product.js +132 -0
- package/dist/collection/components/salla-notifications/salla-notification-item.js +1 -1
- package/dist/collection/components/salla-offer-modal/salla-offer-modal.js +1 -1
- package/dist/collection/components/salla-order-details/salla-order-details.js +1 -1
- package/dist/collection/components/salla-order-summary/salla-order-summary.js +1 -1
- package/dist/collection/components/salla-payments/salla-payments.js +2 -2
- package/dist/collection/components/salla-placeholder/salla-placeholder.js +1 -1
- package/dist/collection/components/salla-price-range/salla-price-range.js +2 -2
- package/dist/collection/components/salla-product-availability/salla-product-availability.js +1 -1
- package/dist/collection/components/salla-product-card/salla-product-card.js +5 -5
- package/dist/collection/components/salla-product-options/salla-product-options.js +105 -22
- package/dist/collection/components/salla-product-size-guide/salla-product-size-guide.js +2 -2
- package/dist/collection/components/salla-quantity-input/salla-quantity-input.js +1 -1
- package/dist/collection/components/salla-quick-buy/salla-quick-buy.js +1 -1
- package/dist/collection/components/salla-review-card/salla-review-card.js +1 -1
- package/dist/collection/components/salla-reviews/salla-reviews.js +1 -1
- package/dist/collection/components/salla-reviews-page/salla-reviews-page.js +1 -1
- package/dist/collection/components/salla-scopes/salla-scopes.js +1 -1
- package/dist/collection/components/salla-search/salla-search.js +3 -3
- package/dist/collection/components/salla-skeleton/salla-skeleton.js +1 -1
- package/dist/collection/components/salla-slider/salla-slider.js +2 -2
- package/dist/collection/components/salla-social/salla-social.js +1 -1
- package/dist/collection/components/salla-social-share/salla-social-share.js +1 -1
- package/dist/collection/components/salla-tabs/salla-tab-content.js +1 -1
- package/dist/collection/components/salla-tabs/salla-tab-header.js +1 -1
- package/dist/collection/components/salla-tabs/salla-tabs.js +1 -1
- package/dist/collection/components/salla-tel-input/salla-tel-input.js +1 -1
- package/dist/collection/components/salla-tooltip/salla-tooltip.js +1 -1
- package/dist/collection/components/salla-user-settings/salla-user-settings.js +1 -1
- package/dist/components/index.js +2 -2
- package/dist/components/salla-accordion-head2.js +2 -2
- package/dist/components/salla-comments.js +20 -1
- package/dist/components/salla-conditional-fields2.js +28 -6
- package/dist/components/salla-login-modal.js +0 -1
- package/dist/components/salla-multiple-bundle-product-cart.d.ts +11 -0
- package/dist/components/salla-multiple-bundle-product-cart.js +9 -0
- package/dist/components/salla-multiple-bundle-product-cart2.js +153 -0
- package/dist/components/salla-multiple-bundle-product-details.d.ts +11 -0
- package/dist/components/salla-multiple-bundle-product-details.js +9 -0
- package/dist/components/salla-multiple-bundle-product-details2.js +283 -0
- package/dist/components/salla-multiple-bundle-product-options-modal.d.ts +11 -0
- package/dist/components/salla-multiple-bundle-product-options-modal.js +9 -0
- package/dist/components/salla-multiple-bundle-product-options-modal2.js +585 -0
- package/dist/components/salla-multiple-bundle-product-slider.d.ts +11 -0
- package/dist/components/salla-multiple-bundle-product-slider.js +9 -0
- package/dist/components/salla-multiple-bundle-product-slider2.js +81 -0
- package/dist/components/salla-multiple-bundle-product.d.ts +11 -0
- package/dist/components/salla-multiple-bundle-product.js +210 -0
- package/dist/components/salla-notification-item2.js +1 -1
- package/dist/components/salla-offer-modal.js +1 -1
- package/dist/components/salla-order-details.js +1 -1
- package/dist/components/salla-order-summary.js +1 -1
- package/dist/components/salla-payments.js +2 -2
- package/dist/components/salla-placeholder2.js +1 -1
- package/dist/components/salla-price-range2.js +2 -2
- package/dist/components/salla-product-availability2.js +1 -1
- package/dist/components/salla-product-card2.js +5 -5
- package/dist/components/salla-product-options.js +1 -810
- package/dist/{esm/salla-product-options.entry.js → components/salla-product-options2.js} +197 -30
- package/dist/components/salla-product-size-guide.js +2 -2
- package/dist/components/salla-quantity-input.js +1 -1
- package/dist/components/salla-quick-buy2.js +1 -1
- package/dist/components/salla-review-card2.js +1 -1
- package/dist/components/salla-reviews-page.js +1 -1
- package/dist/components/salla-reviews.js +1 -1
- package/dist/components/salla-scopes.js +1 -1
- package/dist/components/salla-search.js +3 -3
- package/dist/components/salla-skeleton2.js +1 -1
- package/dist/components/salla-slider2.js +2 -2
- package/dist/components/salla-social-share.js +1 -1
- package/dist/components/salla-social.js +1 -1
- package/dist/components/salla-tab-content2.js +1 -1
- package/dist/components/salla-tab-header2.js +1 -1
- package/dist/components/salla-tabs2.js +1 -1
- package/dist/components/salla-tel-input2.js +1 -1
- package/dist/components/salla-tooltip2.js +1 -1
- package/dist/components/salla-user-settings.js +1 -1
- package/dist/esm/{filepond-DbqR2fSR.js → filepond-C8M-qAIs.js} +1 -1
- package/dist/esm/{filepond-plugin-file-poster-oSU_je8q.js → filepond-plugin-file-poster-UfHq-uvl.js} +1 -1
- package/dist/esm/{filepond-plugin-file-validate-size-DBNbjpCq.js → filepond-plugin-file-validate-size-DZ15xnJZ.js} +1 -1
- package/dist/esm/{filepond-plugin-file-validate-type-FNihY0D1.js → filepond-plugin-file-validate-type-CWR9opI0.js} +1 -1
- package/dist/esm/{filepond-plugin-image-edit-BvLwmvqS.js → filepond-plugin-image-edit-XbR1h-bg.js} +1 -1
- package/dist/esm/{filepond-plugin-image-exif-orientation-CzDuHCvL.js → filepond-plugin-image-exif-orientation-cSRDvvXQ.js} +1 -1
- package/dist/esm/{filepond-plugin-image-preview-OJew5tLP.js → filepond-plugin-image-preview-B-SvzNFg.js} +1 -1
- package/dist/esm/{index-DFnMPSip.js → index-Q_DltBmK.js} +1 -1
- package/dist/esm/{index-DXrQDmAN.js → index-gLeBNvS1.js} +136 -26
- package/dist/esm/loader.js +3 -4
- package/dist/esm/{salla-add-product-button_51.entry.js → salla-accordion_62.entry.js} +2084 -112
- package/dist/esm/salla-advertisement.entry.js +1 -1
- package/dist/esm/salla-app-install-alert.entry.js +1 -1
- package/dist/esm/salla-apps-icons.entry.js +1 -1
- package/dist/esm/salla-cart-item-offers.entry.js +1 -1
- package/dist/esm/salla-conditional-offer.entry.js +1 -1
- package/dist/esm/salla-contacts.entry.js +1 -1
- package/dist/esm/salla-filters-widget.entry.js +1 -1
- package/dist/esm/salla-filters.entry.js +1 -1
- package/dist/esm/salla-installment.entry.js +1 -1
- package/dist/esm/salla-loyalty-prize-item.entry.js +1 -1
- package/dist/esm/salla-loyalty-program.entry.js +1 -1
- package/dist/esm/salla-metadata.entry.js +1 -1
- package/dist/esm/salla-notification-item.entry.js +2 -2
- package/dist/esm/salla-notifications.entry.js +1 -1
- package/dist/esm/salla-offer.entry.js +1 -1
- package/dist/esm/salla-order-details-multiple-bundle-product.entry.js +1 -1
- package/dist/esm/{salla-accordion_4.entry.js → salla-order-details-options.entry.js} +2 -98
- package/dist/esm/salla-order-details.entry.js +2 -2
- package/dist/esm/salla-order-summary.entry.js +2 -2
- package/dist/esm/salla-orders.entry.js +1 -1
- package/dist/esm/salla-payments.entry.js +3 -3
- package/dist/esm/salla-price-range.entry.js +3 -3
- package/dist/esm/salla-review-card.entry.js +2 -2
- package/dist/esm/salla-reviews-page.entry.js +2 -2
- package/dist/esm/salla-reviews.entry.js +2 -2
- package/dist/esm/salla-social.entry.js +2 -2
- package/dist/esm/salla-tiered-offer.entry.js +1 -1
- package/dist/esm/salla-tooltip.entry.js +2 -2
- package/dist/esm/salla-verify.entry.js +1 -1
- package/dist/esm/salla-wallet.entry.js +1 -1
- package/dist/esm/twilight.js +3 -4
- package/dist/twilight/{p-11c1fc02.entry.js → p-00d8544c.entry.js} +1 -1
- package/dist/twilight/{p-c87e16b6.entry.js → p-06d126b6.entry.js} +1 -1
- package/dist/twilight/{p-adc5a167.entry.js → p-1cc68ef5.entry.js} +1 -1
- package/dist/twilight/{p-yWcVqMiP.js → p-1ekWkYOJ.js} +1 -1
- package/dist/twilight/p-21b37923.entry.js +4 -0
- package/dist/twilight/{p-c2f0f504.entry.js → p-263b9b06.entry.js} +1 -1
- package/dist/twilight/{p-c0450f72.entry.js → p-2787ff9f.entry.js} +1 -1
- package/dist/twilight/p-3c1484b9.entry.js +11 -0
- package/dist/twilight/{p-6ed0de44.entry.js → p-5057b400.entry.js} +1 -1
- package/dist/twilight/{p-5c67f412.entry.js → p-5278b873.entry.js} +1 -1
- package/dist/twilight/{p-1d1672e8.entry.js → p-56f7a2ba.entry.js} +1 -1
- package/dist/twilight/{p-5aa17da1.entry.js → p-697db5c6.entry.js} +1 -1
- package/dist/twilight/{p-81131b67.entry.js → p-73a8296a.entry.js} +1 -1
- package/dist/twilight/{p-93b26c0b.entry.js → p-7603a820.entry.js} +1 -1
- package/dist/twilight/{p-86f00281.entry.js → p-7c8d7ca3.entry.js} +1 -1
- package/dist/twilight/{p-62312d5b.entry.js → p-80a07063.entry.js} +1 -1
- package/dist/twilight/{p-e987bf56.entry.js → p-82c156ab.entry.js} +1 -1
- package/dist/twilight/{p-fed06a9f.entry.js → p-8380c411.entry.js} +1 -1
- package/dist/twilight/{p-906ec5e3.entry.js → p-946e5649.entry.js} +1 -1
- package/dist/twilight/{p-01b67a23.entry.js → p-9bcd9c87.entry.js} +1 -1
- package/dist/twilight/p-9c477fdf.entry.js +4 -0
- package/dist/twilight/{p-B3DRwtQ_.js → p-B-nQtFTN.js} +1 -1
- package/dist/twilight/{p-BeXdXg7Q.js → p-BI2zk2yo.js} +1 -1
- package/dist/twilight/{p-E9O3bnHS.js → p-BRD27esZ.js} +1 -1
- package/dist/twilight/{p-MbgAyDn3.js → p-CUYEEJ4c.js} +1 -1
- package/dist/twilight/{p-BvKpNEUI.js → p-DUvdNUoC.js} +1 -1
- package/dist/twilight/{p-C3joUrVg.js → p-DhR67rwu.js} +1 -1
- package/dist/twilight/p-a01dd6b7.entry.js +4 -0
- package/dist/twilight/{p-849be825.entry.js → p-a3e000ef.entry.js} +1 -1
- package/dist/twilight/{p-0e18add0.entry.js → p-a6c14a64.entry.js} +1 -1
- package/dist/twilight/p-b0b79820.entry.js +4 -0
- package/dist/twilight/{p-57e8c6b5.entry.js → p-b5581886.entry.js} +1 -1
- package/dist/twilight/p-b81437f4.entry.js +4 -0
- package/dist/twilight/{p-591043a2.entry.js → p-bf010154.entry.js} +1 -1
- package/dist/twilight/{p-d3022e35.entry.js → p-c0388251.entry.js} +1 -1
- package/dist/twilight/{p-a71a3922.entry.js → p-c9ab361e.entry.js} +1 -1
- package/dist/twilight/{p-d8e500cc.entry.js → p-ed85bc00.entry.js} +1 -1
- package/dist/twilight/p-f7863a58.entry.js +4 -0
- package/dist/twilight/{p-DXrQDmAN.js → p-gLeBNvS1.js} +2 -2
- package/dist/twilight/{p-BQuXdlAk.js → p-j4lbZMJ0.js} +1 -1
- package/dist/twilight/twilight.esm.js +1 -1
- package/dist/types/components/salla-accordion/salla-accordion-head.d.ts +6 -0
- package/dist/types/components/salla-conditional-fields/salla-conditional-fields.d.ts +2 -0
- package/dist/types/components/salla-multiple-bundle-product/components/salla-multiple-bundle-product-cart.d.ts +10 -0
- package/dist/types/components/salla-multiple-bundle-product/components/salla-multiple-bundle-product-details.d.ts +20 -0
- package/dist/types/components/salla-multiple-bundle-product/components/salla-multiple-bundle-product-options-modal.d.ts +46 -0
- package/dist/types/components/salla-multiple-bundle-product/components/salla-multiple-bundle-product-slider.d.ts +22 -0
- package/dist/types/components/salla-multiple-bundle-product/interfaces.d.ts +101 -0
- package/dist/types/components/salla-multiple-bundle-product/salla-multiple-bundle-product.d.ts +42 -0
- package/dist/types/components/salla-product-options/salla-product-options.d.ts +21 -1
- package/dist/types/components.d.ts +298 -2
- package/package.json +5 -5
- package/dist/cjs/app-globals-DfTgypwp.js +0 -38
- package/dist/cjs/camera-DytepEoK.js +0 -13
- package/dist/cjs/minus-CCryh1qf.js +0 -21
- package/dist/cjs/salla-booking-field_2.cjs.entry.js +0 -280
- package/dist/cjs/salla-product-options.cjs.entry.js +0 -715
- package/dist/esm/app-globals-i4_OI7UA.js +0 -36
- package/dist/esm/camera-C6jIkM-X.js +0 -11
- package/dist/esm/minus-DfeagqF1.js +0 -18
- package/dist/esm/salla-booking-field_2.entry.js +0 -277
- package/dist/twilight/p-137e1751.entry.js +0 -4
- package/dist/twilight/p-18cd5d66.entry.js +0 -4
- package/dist/twilight/p-36b30807.entry.js +0 -4
- package/dist/twilight/p-6159654b.entry.js +0 -4
- package/dist/twilight/p-9d9e5493.entry.js +0 -4
- package/dist/twilight/p-C6jIkM-X.js +0 -4
- package/dist/twilight/p-CqZlwzcH.js +0 -4
- package/dist/twilight/p-DfeagqF1.js +0 -4
- package/dist/twilight/p-affed6bd.entry.js +0 -11
- package/dist/twilight/p-cfbd199f.entry.js +0 -4
- package/dist/twilight/p-d060275b.entry.js +0 -4
- package/dist/twilight/p-e162d003.entry.js +0 -4
|
@@ -34,13 +34,13 @@ const SallaAccordionHead = /*@__PURE__*/ proxyCustomElement(class SallaAccordion
|
|
|
34
34
|
this.emitCollapsePanel();
|
|
35
35
|
}
|
|
36
36
|
render() {
|
|
37
|
-
return (h(Host, { key: '
|
|
37
|
+
return (h(Host, { key: '9d88d243306cdf451c20d7068fbb9f48807b22e9', "data-collapsed": this.collapsed.toString(), onClick: () => this.toggleCollapse(), class: "s-accordion-head-wrapper" }, h("div", { key: 'bad4c5a913ce1c4581b09c0b6d96fcbdb4236638', class: "s-accordion-head-wrapper-start" }, h("slot", { key: 'acb83cec8cbca5771a9f84e81c0b955c3edad731', name: "title" }), h("slot", { key: 'a4ad42ea6fad4f452c4c218a9ee02dca0adb4a67', name: "progress" }), h("slot", { key: '96ab95d413dc906ac299079f4008816f01881990', name: "html" })), (this.collapsible || this.host.querySelector('[slot="note"]')) && (h("div", { key: '8f9666a5038cd7b1ac6e357c6920ea26d31c5f03', class: "s-accordion-head-wrapper-end" }, h("slot", { key: '14895e8c1385e91c14f046c9ae38ce5e4a4c9a60', name: "note" }), this.collapsible && (h("button", { key: '97dc7fabbb207fcc8b68ebf0a86f6c8a980dca13', class: {
|
|
38
38
|
's-accordion-head-wrapper-toggle': true,
|
|
39
39
|
active: !this.collapsed,
|
|
40
40
|
}, onClick: e => {
|
|
41
41
|
e.stopPropagation();
|
|
42
42
|
this.toggleCollapse();
|
|
43
|
-
} }, h("span", { key: '
|
|
43
|
+
} }, h("span", { key: '3b24faf71dcd332663a354310b2ce09f7879eddc', class: "s-accordion-head-wrapper-toggle-icon", innerHTML: this.collapsed ? Add : Minus })))))));
|
|
44
44
|
}
|
|
45
45
|
get host() { return this; }
|
|
46
46
|
static get style() { return sallaAccordionHeadCss; }
|
|
@@ -221,7 +221,8 @@ const SallaComments$1 = /*@__PURE__*/ proxyCustomElement(class SallaComments ext
|
|
|
221
221
|
resp = await salla.api.request('reviews', { params }, 'get');
|
|
222
222
|
}
|
|
223
223
|
else {
|
|
224
|
-
|
|
224
|
+
// Ensure sort is passed for regular comments as well
|
|
225
|
+
resp = await salla.api.comment.getComments(this.type, this.itemId, 1, 5, this.sort);
|
|
225
226
|
}
|
|
226
227
|
if (!resp.data || !resp.data.length) {
|
|
227
228
|
this.showPlaceholder = false;
|
|
@@ -235,6 +236,24 @@ const SallaComments$1 = /*@__PURE__*/ proxyCustomElement(class SallaComments ext
|
|
|
235
236
|
this.pagination = resp.pagination;
|
|
236
237
|
this.total = resp.pagination.total;
|
|
237
238
|
this.nextPage = typeof resp.pagination.links === 'object' && !!resp.pagination.links.next ? resp.pagination.links.next : null;
|
|
239
|
+
// Preserve sort param in next page URL for infinite scroll
|
|
240
|
+
if (this.nextPage && this.sort) {
|
|
241
|
+
try {
|
|
242
|
+
const url = new URL(this.nextPage, window.location.origin);
|
|
243
|
+
if (!url.searchParams.get('sort')) {
|
|
244
|
+
url.searchParams.set('sort', this.sort);
|
|
245
|
+
this.nextPage = url.toString();
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
catch (_e) {
|
|
249
|
+
// fallback for relative next links
|
|
250
|
+
const hasQuery = this.nextPage.includes('?');
|
|
251
|
+
const hasSort = /[?&]sort=/.test(this.nextPage);
|
|
252
|
+
if (!hasSort) {
|
|
253
|
+
this.nextPage = this.nextPage + (hasQuery ? '&' : '?') + `sort=${this.sort}`;
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
}
|
|
238
257
|
setTimeout(() => {
|
|
239
258
|
for (const card of this.handleResponse(resp)) {
|
|
240
259
|
this.wrapper.append(card);
|
|
@@ -30,14 +30,32 @@ const SallaConditionalFields = /*@__PURE__*/ proxyCustomElement(class SallaCondi
|
|
|
30
30
|
}
|
|
31
31
|
changeHandler(event) {
|
|
32
32
|
salla.event.emit('salla-onditional-fields::change', event);
|
|
33
|
-
salla.log('Received the change event: ', event);
|
|
34
|
-
if (!event.target ||
|
|
35
|
-
|
|
33
|
+
salla.log('Received the change/input event: ', event);
|
|
34
|
+
if (!event.target ||
|
|
35
|
+
(!['SELECT', 'INPUT', 'TEXTAREA'].includes(event.target.tagName) &&
|
|
36
|
+
!['checkbox', 'radio', 'text'].includes(event.target.getAttribute('type')))) {
|
|
37
|
+
salla.log('Ignore the event because is not a supported input: ' + (event?.target?.tagName || 'N/A'));
|
|
36
38
|
return;
|
|
37
39
|
}
|
|
40
|
+
// For text inputs, debounce the handling to improve performance on mobile
|
|
41
|
+
const isTextInput = ['INPUT', 'TEXTAREA'].includes(event.target.tagName) &&
|
|
42
|
+
(!event.target.getAttribute('type') || event.target.getAttribute('type') === 'text');
|
|
43
|
+
if (isTextInput && event.type === 'input') {
|
|
44
|
+
clearTimeout(this.debounceTimeout);
|
|
45
|
+
this.debounceTimeout = setTimeout(() => {
|
|
46
|
+
this.processConditionalFields(event);
|
|
47
|
+
}, 300); // 300ms debounce for text inputs
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
// Process immediately for change events and non-text inputs
|
|
51
|
+
this.processConditionalFields(event);
|
|
52
|
+
}
|
|
53
|
+
processConditionalFields(event) {
|
|
38
54
|
let optionId = event.target.name.replace('[]', '');
|
|
39
55
|
let isMultiple = event.target.getAttribute('type') === 'checkbox';
|
|
40
56
|
let isRadio = event.target.getAttribute('type') === 'radio';
|
|
57
|
+
let isTextInput = ['INPUT', 'TEXTAREA'].includes(event.target.tagName) &&
|
|
58
|
+
(!event.target.getAttribute('type') || event.target.getAttribute('type') === 'text');
|
|
41
59
|
salla.log('Trying to find all elements with condition:', `[data-show-when^="${optionId}"]`);
|
|
42
60
|
this.host.querySelectorAll(`[data-show-when^="${optionId}"]`)
|
|
43
61
|
.forEach((field) => {
|
|
@@ -52,10 +70,14 @@ const SallaConditionalFields = /*@__PURE__*/ proxyCustomElement(class SallaCondi
|
|
|
52
70
|
// Handle radio inputs.
|
|
53
71
|
isSelected = event.target.checked && event.target.value === value;
|
|
54
72
|
}
|
|
73
|
+
else if (isTextInput) {
|
|
74
|
+
// Handle text inputs and textareas - check if value matches or is not empty for boolean conditions
|
|
75
|
+
isSelected = value === event.target.value || (value.toLowerCase() === 'true' && event.target.value.trim() !== '');
|
|
76
|
+
}
|
|
55
77
|
else {
|
|
56
78
|
isSelected = value === event.target.value;
|
|
57
79
|
}
|
|
58
|
-
salla.log('The input is ', isMultiple ? 'Multiple' : isRadio ? 'Radio' : 'Single', ' value:', isSelected);
|
|
80
|
+
salla.log('The input is ', isMultiple ? 'Multiple' : isRadio ? 'Radio' : isTextInput ? 'Text' : 'Single', ' value:', isSelected);
|
|
59
81
|
let showTheInput = (isEqual && isSelected) || (!isEqual && !isSelected);
|
|
60
82
|
if (showTheInput) {
|
|
61
83
|
field.classList.remove('hidden');
|
|
@@ -96,10 +118,10 @@ const SallaConditionalFields = /*@__PURE__*/ proxyCustomElement(class SallaCondi
|
|
|
96
118
|
});
|
|
97
119
|
}
|
|
98
120
|
render() {
|
|
99
|
-
return (h(Host, { key: '
|
|
121
|
+
return (h(Host, { key: 'b29d3a3e7e7af01540efbd2868cd302e91bba8a4' }, h("slot", { key: 'b6d6544834ea082ffcd20deef2da1206a47e98ba' })));
|
|
100
122
|
}
|
|
101
123
|
get host() { return this; }
|
|
102
|
-
}, [4, "salla-conditional-fields", undefined, [[0, "change", "changeHandler"]]]);
|
|
124
|
+
}, [4, "salla-conditional-fields", undefined, [[0, "change", "changeHandler"], [0, "input", "changeHandler"]]]);
|
|
103
125
|
function defineCustomElement() {
|
|
104
126
|
if (typeof customElements === "undefined") {
|
|
105
127
|
return;
|
|
@@ -230,7 +230,6 @@ const SallaLoginModal$1 = /*@__PURE__*/ proxyCustomElement(class SallaLoginModal
|
|
|
230
230
|
catch (error) {
|
|
231
231
|
Salla.log('Error on assign');
|
|
232
232
|
}
|
|
233
|
-
await Salla.cart.api.assign();
|
|
234
233
|
withCartReset && Salla.cart.reset();
|
|
235
234
|
!Salla.auth.api.isSessionless() && await Salla.auth.api.request('auth/jwt');
|
|
236
235
|
setTimeout(() => window.location.reload(), 100);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Components, JSX } from "../types/components";
|
|
2
|
+
|
|
3
|
+
interface SallaMultipleBundleProductCart extends Components.SallaMultipleBundleProductCart, HTMLElement {}
|
|
4
|
+
export const SallaMultipleBundleProductCart: {
|
|
5
|
+
prototype: SallaMultipleBundleProductCart;
|
|
6
|
+
new (): SallaMultipleBundleProductCart;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Used to define this component and all nested components recursively.
|
|
10
|
+
*/
|
|
11
|
+
export const defineCustomElement: () => void;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Crafted with ❤ by Salla
|
|
3
|
+
*/
|
|
4
|
+
import { S as SallaMultipleBundleProductCart$1, d as defineCustomElement$1 } from './salla-multiple-bundle-product-cart2.js';
|
|
5
|
+
|
|
6
|
+
const SallaMultipleBundleProductCart = SallaMultipleBundleProductCart$1;
|
|
7
|
+
const defineCustomElement = defineCustomElement$1;
|
|
8
|
+
|
|
9
|
+
export { SallaMultipleBundleProductCart, defineCustomElement };
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Crafted with ❤ by Salla
|
|
3
|
+
*/
|
|
4
|
+
import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
|
|
5
|
+
import { d as defineCustomElement$e } from './salla-accordion2.js';
|
|
6
|
+
import { d as defineCustomElement$d } from './salla-accordion-body2.js';
|
|
7
|
+
import { d as defineCustomElement$c } from './salla-accordion-head2.js';
|
|
8
|
+
import { d as defineCustomElement$b } from './salla-booking-field2.js';
|
|
9
|
+
import { d as defineCustomElement$a } from './salla-button2.js';
|
|
10
|
+
import { d as defineCustomElement$9 } from './salla-color-picker2.js';
|
|
11
|
+
import { d as defineCustomElement$8 } from './salla-conditional-fields2.js';
|
|
12
|
+
import { d as defineCustomElement$7 } from './salla-datetime-picker2.js';
|
|
13
|
+
import { d as defineCustomElement$6 } from './salla-file-upload2.js';
|
|
14
|
+
import { d as defineCustomElement$5 } from './salla-loading2.js';
|
|
15
|
+
import { d as defineCustomElement$4 } from './salla-map2.js';
|
|
16
|
+
import { d as defineCustomElement$3 } from './salla-modal2.js';
|
|
17
|
+
import { d as defineCustomElement$2 } from './salla-product-options2.js';
|
|
18
|
+
import { d as defineCustomElement$1 } from './salla-progress-bar2.js';
|
|
19
|
+
|
|
20
|
+
const sallaMultipleBundleProductCartCss = "";
|
|
21
|
+
|
|
22
|
+
const SallaMultipleBundleProductCart = /*@__PURE__*/ proxyCustomElement(class SallaMultipleBundleProductCart extends HTMLElement {
|
|
23
|
+
constructor() {
|
|
24
|
+
super();
|
|
25
|
+
this.__registerHost();
|
|
26
|
+
this.sections = [];
|
|
27
|
+
this.itemNumber = '';
|
|
28
|
+
}
|
|
29
|
+
deleteItem(sectionId, product) {
|
|
30
|
+
const form = this.host.closest('form');
|
|
31
|
+
if (form) {
|
|
32
|
+
const formId = form.getAttribute('id');
|
|
33
|
+
if (formId && typeof formId === 'string') {
|
|
34
|
+
const itemNumber = formId.match(/item-(\d+)/)?.[1];
|
|
35
|
+
this.itemNumber = itemNumber || '';
|
|
36
|
+
const selectedAccordion = this.host.querySelector(`#accordion-${product.id}`);
|
|
37
|
+
salla.cart
|
|
38
|
+
.deleteItem(`${this.itemNumber}?product_id=${product.id}§ion_id=${sectionId}`)
|
|
39
|
+
.then(() => selectedAccordion?.remove());
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
renderRemoveButton(sectionId, product, isText = false) {
|
|
44
|
+
return (h("salla-button", { type: "button", shape: isText ? 'btn' : 'icon', fill: isText ? 'outline' : 'solid', size: "small", color: "danger", "aria-label": "Remove from the cart", onClick: () => this.deleteItem(sectionId, product) }, isText ? salla.lang.get('common.elements.delete') : h("i", { class: "sicon-cancel" })));
|
|
45
|
+
}
|
|
46
|
+
renderAccordionHeader(sectionId, product) {
|
|
47
|
+
const hasOptions = product?.options && product?.options?.length > 0; // undefined or empty array
|
|
48
|
+
return (h("div", { slot: "html", class: "s-multiple-bundle-product-cart-header-wrapper" }, h("div", { class: `s-multiple-bundle-product-cart-header ${hasOptions ? '' : 's-multiple-bundle-product-cart-header-no-options'}` }, h("div", { class: "s-multiple-bundle-product-cart-header-content" }, h("a", { href: product?.url, class: "s-multiple-bundle-product-cart-header-image-wrapper" }, h("img", { src: product?.image?.url, alt: product?.image?.alt || product?.name, class: "s-multiple-bundle-product-cart-header-image" })), h("div", { class: "s-multiple-bundle-product-cart-header-content-details" }, h("h2", { class: "s-multiple-bundle-product-cart-header-content-details-title" }, h("a", { href: product?.url, class: "s-multiple-bundle-product-cart-header-content-details-title-link" }, product?.name)), h("div", { class: "s-multiple-bundle-product-cart-header-content-details-price" }, h("span", { class: "s-multiple-bundle-product-cart-header-content-details-price-regular" }, h("span", { innerHTML: product?.price ? salla.money(product?.price) : '' })), product?.sale_price > 0 && (h("span", { class: "s-multiple-bundle-product-cart-header-content-details-price-sale" }, h("span", { innerHTML: salla.money(product?.sale_price) })))), product?.quantity_in_group > 0 && product?.quantity !== 0 && (h("p", { class: "s-multiple-bundle-product-cart-header-content-details-quantity" }, h("span", null, salla.lang.get('pages.products.number_of_pieces')), h("span", null, product?.quantity_in_group))))), !hasOptions && (h("div", { class: "s-multiple-bundle-product-cart-header-remove-button" }, this.renderRemoveButton(sectionId, product, false))))));
|
|
49
|
+
}
|
|
50
|
+
render() {
|
|
51
|
+
return (h(Host, { key: 'b9542b8e0cc7705e6bbd9dc17db8284c11d27846', class: "s-multiple-bundle-product-wrapper" }, h("div", { key: '44bfe630604e8d45aa1218eebcdf026b47f9fd99', class: "s-multiple-bundle-product-wrapper-sections" }, this.sections.map((section, sectionIndex) => {
|
|
52
|
+
return section.products.map(product => {
|
|
53
|
+
const bundleContext = {
|
|
54
|
+
sectionId: section.id,
|
|
55
|
+
sectionIndex: sectionIndex,
|
|
56
|
+
productId: product.id,
|
|
57
|
+
};
|
|
58
|
+
return (h("salla-accordion", { key: product.id, collapsed: false, bordered: true, collapsible: product.options && product.options.length > 0 ? true : false, size: "sm", id: `accordion-${product.id}` }, h("salla-accordion-head", null, this.renderAccordionHeader(String(section.id), product)), product.options && product.options.length > 0 && (h("salla-accordion-body", null, h("salla-product-options", { options: JSON.stringify(product.options), key: `${product.id}-persistent`, "product-id": product.id, "bundle-context": JSON.stringify(bundleContext) }), h("div", { class: "s-multiple-bundle-product-cart-body-remove-button" }, this.renderRemoveButton(String(section.id), product, true))))));
|
|
59
|
+
});
|
|
60
|
+
}))));
|
|
61
|
+
}
|
|
62
|
+
get host() { return this; }
|
|
63
|
+
static get style() { return sallaMultipleBundleProductCartCss; }
|
|
64
|
+
}, [0, "salla-multiple-bundle-product-cart", {
|
|
65
|
+
"sections": [16],
|
|
66
|
+
"itemNumber": [32]
|
|
67
|
+
}]);
|
|
68
|
+
function defineCustomElement() {
|
|
69
|
+
if (typeof customElements === "undefined") {
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
const components = ["salla-multiple-bundle-product-cart", "salla-accordion", "salla-accordion-body", "salla-accordion-head", "salla-booking-field", "salla-button", "salla-color-picker", "salla-conditional-fields", "salla-datetime-picker", "salla-file-upload", "salla-loading", "salla-map", "salla-modal", "salla-product-options", "salla-progress-bar"];
|
|
73
|
+
components.forEach(tagName => { switch (tagName) {
|
|
74
|
+
case "salla-multiple-bundle-product-cart":
|
|
75
|
+
if (!customElements.get(tagName)) {
|
|
76
|
+
customElements.define(tagName, SallaMultipleBundleProductCart);
|
|
77
|
+
}
|
|
78
|
+
break;
|
|
79
|
+
case "salla-accordion":
|
|
80
|
+
if (!customElements.get(tagName)) {
|
|
81
|
+
defineCustomElement$e();
|
|
82
|
+
}
|
|
83
|
+
break;
|
|
84
|
+
case "salla-accordion-body":
|
|
85
|
+
if (!customElements.get(tagName)) {
|
|
86
|
+
defineCustomElement$d();
|
|
87
|
+
}
|
|
88
|
+
break;
|
|
89
|
+
case "salla-accordion-head":
|
|
90
|
+
if (!customElements.get(tagName)) {
|
|
91
|
+
defineCustomElement$c();
|
|
92
|
+
}
|
|
93
|
+
break;
|
|
94
|
+
case "salla-booking-field":
|
|
95
|
+
if (!customElements.get(tagName)) {
|
|
96
|
+
defineCustomElement$b();
|
|
97
|
+
}
|
|
98
|
+
break;
|
|
99
|
+
case "salla-button":
|
|
100
|
+
if (!customElements.get(tagName)) {
|
|
101
|
+
defineCustomElement$a();
|
|
102
|
+
}
|
|
103
|
+
break;
|
|
104
|
+
case "salla-color-picker":
|
|
105
|
+
if (!customElements.get(tagName)) {
|
|
106
|
+
defineCustomElement$9();
|
|
107
|
+
}
|
|
108
|
+
break;
|
|
109
|
+
case "salla-conditional-fields":
|
|
110
|
+
if (!customElements.get(tagName)) {
|
|
111
|
+
defineCustomElement$8();
|
|
112
|
+
}
|
|
113
|
+
break;
|
|
114
|
+
case "salla-datetime-picker":
|
|
115
|
+
if (!customElements.get(tagName)) {
|
|
116
|
+
defineCustomElement$7();
|
|
117
|
+
}
|
|
118
|
+
break;
|
|
119
|
+
case "salla-file-upload":
|
|
120
|
+
if (!customElements.get(tagName)) {
|
|
121
|
+
defineCustomElement$6();
|
|
122
|
+
}
|
|
123
|
+
break;
|
|
124
|
+
case "salla-loading":
|
|
125
|
+
if (!customElements.get(tagName)) {
|
|
126
|
+
defineCustomElement$5();
|
|
127
|
+
}
|
|
128
|
+
break;
|
|
129
|
+
case "salla-map":
|
|
130
|
+
if (!customElements.get(tagName)) {
|
|
131
|
+
defineCustomElement$4();
|
|
132
|
+
}
|
|
133
|
+
break;
|
|
134
|
+
case "salla-modal":
|
|
135
|
+
if (!customElements.get(tagName)) {
|
|
136
|
+
defineCustomElement$3();
|
|
137
|
+
}
|
|
138
|
+
break;
|
|
139
|
+
case "salla-product-options":
|
|
140
|
+
if (!customElements.get(tagName)) {
|
|
141
|
+
defineCustomElement$2();
|
|
142
|
+
}
|
|
143
|
+
break;
|
|
144
|
+
case "salla-progress-bar":
|
|
145
|
+
if (!customElements.get(tagName)) {
|
|
146
|
+
defineCustomElement$1();
|
|
147
|
+
}
|
|
148
|
+
break;
|
|
149
|
+
} });
|
|
150
|
+
}
|
|
151
|
+
defineCustomElement();
|
|
152
|
+
|
|
153
|
+
export { SallaMultipleBundleProductCart as S, defineCustomElement as d };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Components, JSX } from "../types/components";
|
|
2
|
+
|
|
3
|
+
interface SallaMultipleBundleProductDetails extends Components.SallaMultipleBundleProductDetails, HTMLElement {}
|
|
4
|
+
export const SallaMultipleBundleProductDetails: {
|
|
5
|
+
prototype: SallaMultipleBundleProductDetails;
|
|
6
|
+
new (): SallaMultipleBundleProductDetails;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Used to define this component and all nested components recursively.
|
|
10
|
+
*/
|
|
11
|
+
export const defineCustomElement: () => void;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Crafted with ❤ by Salla
|
|
3
|
+
*/
|
|
4
|
+
import { S as SallaMultipleBundleProductDetails$1, d as defineCustomElement$1 } from './salla-multiple-bundle-product-details2.js';
|
|
5
|
+
|
|
6
|
+
const SallaMultipleBundleProductDetails = SallaMultipleBundleProductDetails$1;
|
|
7
|
+
const defineCustomElement = defineCustomElement$1;
|
|
8
|
+
|
|
9
|
+
export { SallaMultipleBundleProductDetails, defineCustomElement };
|
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Crafted with ❤ by Salla
|
|
3
|
+
*/
|
|
4
|
+
import { proxyCustomElement, HTMLElement, h, Fragment, Host } from '@stencil/core/internal/client';
|
|
5
|
+
import { d as defineCustomElement$i } from './salla-accordion2.js';
|
|
6
|
+
import { d as defineCustomElement$h } from './salla-accordion-body2.js';
|
|
7
|
+
import { d as defineCustomElement$g } from './salla-accordion-head2.js';
|
|
8
|
+
import { d as defineCustomElement$f } from './salla-booking-field2.js';
|
|
9
|
+
import { d as defineCustomElement$e } from './salla-button2.js';
|
|
10
|
+
import { d as defineCustomElement$d } from './salla-color-picker2.js';
|
|
11
|
+
import { d as defineCustomElement$c } from './salla-conditional-fields2.js';
|
|
12
|
+
import { d as defineCustomElement$b } from './salla-datetime-picker2.js';
|
|
13
|
+
import { d as defineCustomElement$a } from './salla-file-upload2.js';
|
|
14
|
+
import { d as defineCustomElement$9 } from './salla-loading2.js';
|
|
15
|
+
import { d as defineCustomElement$8 } from './salla-map2.js';
|
|
16
|
+
import { d as defineCustomElement$7 } from './salla-modal2.js';
|
|
17
|
+
import { d as defineCustomElement$6 } from './salla-multiple-bundle-product-options-modal2.js';
|
|
18
|
+
import { d as defineCustomElement$5 } from './salla-multiple-bundle-product-slider2.js';
|
|
19
|
+
import { d as defineCustomElement$4 } from './salla-product-options2.js';
|
|
20
|
+
import { d as defineCustomElement$3 } from './salla-progress-bar2.js';
|
|
21
|
+
import { d as defineCustomElement$2 } from './salla-skeleton2.js';
|
|
22
|
+
import { d as defineCustomElement$1 } from './salla-slider2.js';
|
|
23
|
+
|
|
24
|
+
const sallaMultipleBundleProductDetailsCss = "";
|
|
25
|
+
|
|
26
|
+
const SallaMultipleBundleProductDetails = /*@__PURE__*/ proxyCustomElement(class SallaMultipleBundleProductDetails extends HTMLElement {
|
|
27
|
+
constructor() {
|
|
28
|
+
super();
|
|
29
|
+
this.__registerHost();
|
|
30
|
+
this.sections = [];
|
|
31
|
+
// store selected product IDs per section (can be string or number)
|
|
32
|
+
this.selectedProducts = {};
|
|
33
|
+
// Event handler reference for cleanup
|
|
34
|
+
this.productSelectedHandler = null;
|
|
35
|
+
// handle selecting a product (toggle)
|
|
36
|
+
this.onSelectProduct = (sectionId, product) => {
|
|
37
|
+
this.selectedProducts = {
|
|
38
|
+
...this.selectedProducts,
|
|
39
|
+
[sectionId]: new Set(this.selectedProducts[sectionId] || []),
|
|
40
|
+
};
|
|
41
|
+
const productId = product.id;
|
|
42
|
+
const wasSelected = this.selectedProducts[sectionId].has(productId);
|
|
43
|
+
if (wasSelected) {
|
|
44
|
+
// Product is being deselected
|
|
45
|
+
this.selectedProducts[sectionId].delete(productId);
|
|
46
|
+
// Clear form data and modal options for this product in this specific section
|
|
47
|
+
this.clearProductFormData(productId, sectionId);
|
|
48
|
+
this.clearProductModalOptions(productId);
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
// Product is being selected
|
|
52
|
+
this.selectedProducts[sectionId].add(productId);
|
|
53
|
+
}
|
|
54
|
+
// force re-render
|
|
55
|
+
this.selectedProducts = { ...this.selectedProducts };
|
|
56
|
+
// still dispatch event
|
|
57
|
+
salla.event.dispatch('on-bundle-product-selected', {
|
|
58
|
+
id: product.id,
|
|
59
|
+
name: product.name,
|
|
60
|
+
options: product.options,
|
|
61
|
+
wasSelected: wasSelected,
|
|
62
|
+
isSelected: !wasSelected,
|
|
63
|
+
});
|
|
64
|
+
};
|
|
65
|
+
// ensure product is selected (only add if not already selected)
|
|
66
|
+
this.ensureProductSelected = (sectionId, product) => {
|
|
67
|
+
this.selectedProducts = {
|
|
68
|
+
...this.selectedProducts,
|
|
69
|
+
[sectionId]: new Set(this.selectedProducts[sectionId] || []),
|
|
70
|
+
};
|
|
71
|
+
const productId = product.id;
|
|
72
|
+
// Only add if not already selected
|
|
73
|
+
if (!this.selectedProducts[sectionId].has(productId)) {
|
|
74
|
+
this.selectedProducts[sectionId].add(productId);
|
|
75
|
+
// force re-render
|
|
76
|
+
this.selectedProducts = { ...this.selectedProducts };
|
|
77
|
+
// dispatch event
|
|
78
|
+
salla.event.dispatch('on-bundle-product-selected', {
|
|
79
|
+
id: product.id,
|
|
80
|
+
name: product.name,
|
|
81
|
+
options: product.options,
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
// open product options modal
|
|
86
|
+
this.onSelectProductOptions = (product, sectionId) => {
|
|
87
|
+
// Find the section index from the sectionId
|
|
88
|
+
const sectionIndex = this.sections.findIndex(section => section.id == sectionId);
|
|
89
|
+
// Find the product index within the section
|
|
90
|
+
const section = this.sections.find(section => section.id == sectionId);
|
|
91
|
+
const productIndex = section?.products?.findIndex(p => p.id == product.id) ?? 0;
|
|
92
|
+
salla.event.dispatch('multiple-bundle-product-modal::open', {
|
|
93
|
+
product,
|
|
94
|
+
sectionId,
|
|
95
|
+
sectionIndex,
|
|
96
|
+
productIndex,
|
|
97
|
+
});
|
|
98
|
+
};
|
|
99
|
+
// Event handlers for bundle slider component
|
|
100
|
+
this.handleBundleSliderProductSelected = (event) => {
|
|
101
|
+
const { product, sectionId } = event.detail;
|
|
102
|
+
this.onSelectProduct(sectionId, product);
|
|
103
|
+
};
|
|
104
|
+
this.handleBundleSliderProductOptionsSelected = (event) => {
|
|
105
|
+
const { product, sectionId } = event.detail;
|
|
106
|
+
this.onSelectProductOptions(product, sectionId);
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
// Clear form data for a specific product in specific section
|
|
110
|
+
clearProductFormData(productId, sectionId) {
|
|
111
|
+
const form = this.host.closest('form');
|
|
112
|
+
if (sectionId) {
|
|
113
|
+
// Remove inputs for specific section/productIndex combination
|
|
114
|
+
const productInputPattern = `bundle[${sectionId}][`;
|
|
115
|
+
const inputsToRemove = Array.from(form.querySelectorAll('input')).filter((input) => input.getAttribute('data-product-id') === String(productId) &&
|
|
116
|
+
input.name &&
|
|
117
|
+
input.name.startsWith(productInputPattern));
|
|
118
|
+
inputsToRemove.forEach(input => input.remove());
|
|
119
|
+
}
|
|
120
|
+
else {
|
|
121
|
+
// Fallback: Remove all hidden inputs related to this product (legacy behavior)
|
|
122
|
+
const inputsToRemove = form.querySelectorAll(`[data-product-id="${productId}"]`);
|
|
123
|
+
inputsToRemove.forEach(input => input.remove());
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
// Clear modal options state for a specific product
|
|
127
|
+
clearProductModalOptions(productId) {
|
|
128
|
+
// Emit event to notify modal to reset its state for this product
|
|
129
|
+
salla.event.dispatch('multiple-bundle-product-modal::clear-options', {
|
|
130
|
+
productId,
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
renderAccordionHeader(section, selectedCount) {
|
|
134
|
+
return (h(Fragment, null, h("h2", { slot: "title" }, section?.name), section?.obligatory_products && (h("span", { slot: "note" }, salla.lang.get('pages.products.obligatory_products', {
|
|
135
|
+
count: section?.obligatory_products || 0,
|
|
136
|
+
}))), h("span", { slot: "progress" }, selectedCount, "/", section?.products?.length || 0)));
|
|
137
|
+
}
|
|
138
|
+
componentDidLoad() {
|
|
139
|
+
// Listen for product selected event from modal
|
|
140
|
+
const modal = this.host.querySelector('salla-multiple-bundle-product-options-modal');
|
|
141
|
+
if (modal) {
|
|
142
|
+
this.productSelectedHandler = (e) => {
|
|
143
|
+
const { productId, sectionId, product, fromModal } = e.detail;
|
|
144
|
+
if (fromModal) {
|
|
145
|
+
// When called from modal, only add to selection if not already selected
|
|
146
|
+
this.ensureProductSelected(sectionId, product || { id: productId });
|
|
147
|
+
}
|
|
148
|
+
else {
|
|
149
|
+
// Normal toggle behavior
|
|
150
|
+
this.onSelectProduct(sectionId, product || { id: productId });
|
|
151
|
+
}
|
|
152
|
+
};
|
|
153
|
+
modal.addEventListener('productSelected', this.productSelectedHandler);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
disconnectedCallback() {
|
|
157
|
+
// Clean up event listener to prevent memory leaks
|
|
158
|
+
if (this.productSelectedHandler) {
|
|
159
|
+
const modal = this.host.querySelector('salla-multiple-bundle-product-options-modal');
|
|
160
|
+
if (modal) {
|
|
161
|
+
modal.removeEventListener('productSelected', this.productSelectedHandler);
|
|
162
|
+
}
|
|
163
|
+
this.productSelectedHandler = null;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
render() {
|
|
167
|
+
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) => {
|
|
168
|
+
const selectedCount = this.selectedProducts[section.id]?.size || 0;
|
|
169
|
+
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 }))));
|
|
170
|
+
})), h("salla-multiple-bundle-product-options-modal", { key: '2d889aa72a36040f87cd791363f71600d86458e7' })));
|
|
171
|
+
}
|
|
172
|
+
get host() { return this; }
|
|
173
|
+
static get style() { return sallaMultipleBundleProductDetailsCss; }
|
|
174
|
+
}, [0, "salla-multiple-bundle-product-details", {
|
|
175
|
+
"sections": [16],
|
|
176
|
+
"selectedProducts": [32]
|
|
177
|
+
}]);
|
|
178
|
+
function defineCustomElement() {
|
|
179
|
+
if (typeof customElements === "undefined") {
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
182
|
+
const components = ["salla-multiple-bundle-product-details", "salla-accordion", "salla-accordion-body", "salla-accordion-head", "salla-booking-field", "salla-button", "salla-color-picker", "salla-conditional-fields", "salla-datetime-picker", "salla-file-upload", "salla-loading", "salla-map", "salla-modal", "salla-multiple-bundle-product-options-modal", "salla-multiple-bundle-product-slider", "salla-product-options", "salla-progress-bar", "salla-skeleton", "salla-slider"];
|
|
183
|
+
components.forEach(tagName => { switch (tagName) {
|
|
184
|
+
case "salla-multiple-bundle-product-details":
|
|
185
|
+
if (!customElements.get(tagName)) {
|
|
186
|
+
customElements.define(tagName, SallaMultipleBundleProductDetails);
|
|
187
|
+
}
|
|
188
|
+
break;
|
|
189
|
+
case "salla-accordion":
|
|
190
|
+
if (!customElements.get(tagName)) {
|
|
191
|
+
defineCustomElement$i();
|
|
192
|
+
}
|
|
193
|
+
break;
|
|
194
|
+
case "salla-accordion-body":
|
|
195
|
+
if (!customElements.get(tagName)) {
|
|
196
|
+
defineCustomElement$h();
|
|
197
|
+
}
|
|
198
|
+
break;
|
|
199
|
+
case "salla-accordion-head":
|
|
200
|
+
if (!customElements.get(tagName)) {
|
|
201
|
+
defineCustomElement$g();
|
|
202
|
+
}
|
|
203
|
+
break;
|
|
204
|
+
case "salla-booking-field":
|
|
205
|
+
if (!customElements.get(tagName)) {
|
|
206
|
+
defineCustomElement$f();
|
|
207
|
+
}
|
|
208
|
+
break;
|
|
209
|
+
case "salla-button":
|
|
210
|
+
if (!customElements.get(tagName)) {
|
|
211
|
+
defineCustomElement$e();
|
|
212
|
+
}
|
|
213
|
+
break;
|
|
214
|
+
case "salla-color-picker":
|
|
215
|
+
if (!customElements.get(tagName)) {
|
|
216
|
+
defineCustomElement$d();
|
|
217
|
+
}
|
|
218
|
+
break;
|
|
219
|
+
case "salla-conditional-fields":
|
|
220
|
+
if (!customElements.get(tagName)) {
|
|
221
|
+
defineCustomElement$c();
|
|
222
|
+
}
|
|
223
|
+
break;
|
|
224
|
+
case "salla-datetime-picker":
|
|
225
|
+
if (!customElements.get(tagName)) {
|
|
226
|
+
defineCustomElement$b();
|
|
227
|
+
}
|
|
228
|
+
break;
|
|
229
|
+
case "salla-file-upload":
|
|
230
|
+
if (!customElements.get(tagName)) {
|
|
231
|
+
defineCustomElement$a();
|
|
232
|
+
}
|
|
233
|
+
break;
|
|
234
|
+
case "salla-loading":
|
|
235
|
+
if (!customElements.get(tagName)) {
|
|
236
|
+
defineCustomElement$9();
|
|
237
|
+
}
|
|
238
|
+
break;
|
|
239
|
+
case "salla-map":
|
|
240
|
+
if (!customElements.get(tagName)) {
|
|
241
|
+
defineCustomElement$8();
|
|
242
|
+
}
|
|
243
|
+
break;
|
|
244
|
+
case "salla-modal":
|
|
245
|
+
if (!customElements.get(tagName)) {
|
|
246
|
+
defineCustomElement$7();
|
|
247
|
+
}
|
|
248
|
+
break;
|
|
249
|
+
case "salla-multiple-bundle-product-options-modal":
|
|
250
|
+
if (!customElements.get(tagName)) {
|
|
251
|
+
defineCustomElement$6();
|
|
252
|
+
}
|
|
253
|
+
break;
|
|
254
|
+
case "salla-multiple-bundle-product-slider":
|
|
255
|
+
if (!customElements.get(tagName)) {
|
|
256
|
+
defineCustomElement$5();
|
|
257
|
+
}
|
|
258
|
+
break;
|
|
259
|
+
case "salla-product-options":
|
|
260
|
+
if (!customElements.get(tagName)) {
|
|
261
|
+
defineCustomElement$4();
|
|
262
|
+
}
|
|
263
|
+
break;
|
|
264
|
+
case "salla-progress-bar":
|
|
265
|
+
if (!customElements.get(tagName)) {
|
|
266
|
+
defineCustomElement$3();
|
|
267
|
+
}
|
|
268
|
+
break;
|
|
269
|
+
case "salla-skeleton":
|
|
270
|
+
if (!customElements.get(tagName)) {
|
|
271
|
+
defineCustomElement$2();
|
|
272
|
+
}
|
|
273
|
+
break;
|
|
274
|
+
case "salla-slider":
|
|
275
|
+
if (!customElements.get(tagName)) {
|
|
276
|
+
defineCustomElement$1();
|
|
277
|
+
}
|
|
278
|
+
break;
|
|
279
|
+
} });
|
|
280
|
+
}
|
|
281
|
+
defineCustomElement();
|
|
282
|
+
|
|
283
|
+
export { SallaMultipleBundleProductDetails as S, defineCustomElement as d };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Components, JSX } from "../types/components";
|
|
2
|
+
|
|
3
|
+
interface SallaMultipleBundleProductOptionsModal extends Components.SallaMultipleBundleProductOptionsModal, HTMLElement {}
|
|
4
|
+
export const SallaMultipleBundleProductOptionsModal: {
|
|
5
|
+
prototype: SallaMultipleBundleProductOptionsModal;
|
|
6
|
+
new (): SallaMultipleBundleProductOptionsModal;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Used to define this component and all nested components recursively.
|
|
10
|
+
*/
|
|
11
|
+
export const defineCustomElement: () => void;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Crafted with ❤ by Salla
|
|
3
|
+
*/
|
|
4
|
+
import { S as SallaMultipleBundleProductOptionsModal$1, d as defineCustomElement$1 } from './salla-multiple-bundle-product-options-modal2.js';
|
|
5
|
+
|
|
6
|
+
const SallaMultipleBundleProductOptionsModal = SallaMultipleBundleProductOptionsModal$1;
|
|
7
|
+
const defineCustomElement = defineCustomElement$1;
|
|
8
|
+
|
|
9
|
+
export { SallaMultipleBundleProductOptionsModal, defineCustomElement };
|