ublo-lib 1.24.4 → 1.25.1
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/es/common/components/admin-links/admin-links.js +95 -52
- package/es/common/components/admin-links/index.js +1 -1
- package/es/common/components/breadcrumb.js +78 -21
- package/es/common/components/cross-selling-editor/cross-selling-editor.js +52 -0
- package/es/common/components/cross-selling-editor/cross-selling-editor.module.css +6 -0
- package/es/common/components/cross-selling-editor/editor.js +98 -0
- package/es/common/components/cross-selling-editor/editor.module.css +23 -0
- package/es/common/components/cross-selling-editor/hooks/use-custom-offers.js +52 -0
- package/es/common/components/cross-selling-editor/hooks/use-tunnel-offers.js +35 -0
- package/es/common/components/cross-selling-editor/index.js +2 -0
- package/es/common/components/cross-selling-editor/override-trigger-form.js +156 -0
- package/es/common/components/cross-selling-editor/override-trigger-form.module.css +58 -0
- package/es/common/components/cross-selling-editor/override.js +124 -0
- package/es/common/components/cross-selling-editor/override.module.css +65 -0
- package/es/common/components/cross-selling-editor/overrides-list.js +111 -0
- package/es/common/components/cross-selling-editor/overrides-list.module.css +56 -0
- package/es/common/components/cross-selling-editor/rule.js +105 -0
- package/es/common/components/cross-selling-editor/rule.module.css +37 -0
- package/es/common/components/cross-selling-editor/rules.js +84 -0
- package/es/common/components/cross-selling-editor/rules.module.css +39 -0
- package/es/common/components/cross-selling-editor/services/api.js +36 -0
- package/es/common/components/cross-selling-editor/services/utils.js +199 -0
- package/es/common/components/cross-selling-editor/tester-tunnel-offer.js +53 -0
- package/es/common/components/cross-selling-editor/tester-tunnel-offer.module.css +18 -0
- package/es/common/components/cross-selling-editor/tester.js +188 -0
- package/es/common/components/cross-selling-editor/tester.module.css +106 -0
- package/es/common/components/cross-selling-editor/types.js +1 -0
- package/es/common/components/custom-contact-form/custom-contact-form.js +147 -75
- package/es/common/components/date-picker/calendar.js +1 -1
- package/es/common/components/gesco-contact-form/gesco-contact-form.js +240 -91
- package/es/common/components/gesco-contact-form/hooks/use-params.js +35 -20
- package/es/common/components/gesco-contact-form/index.js +1 -1
- package/es/common/components/gesco-contact-form/phone-code-select.js +76 -56
- package/es/common/components/gesco-contact-form/services/api.js +7 -8
- package/es/common/components/gesco-contact-form/services/form.js +39 -25
- package/es/common/components/gesco-contact-form/services/messages.js +68 -65
- package/es/common/components/gesco-contact-form/services/plausible.js +8 -10
- package/es/common/components/gesco-contact-form/types.js +1 -1
- package/es/common/components/instant-search/hooks/use-constant.js +8 -6
- package/es/common/components/instant-search/hooks/use-debounced-search.js +14 -5
- package/es/common/components/instant-search/hooks/use-search.js +10 -6
- package/es/common/components/instant-search/index.js +1 -1
- package/es/common/components/instant-search/input.js +75 -45
- package/es/common/components/instant-search/instant-search.js +124 -73
- package/es/common/components/instant-search/links.js +74 -23
- package/es/common/components/instant-search/no-product.js +81 -4
- package/es/common/components/instant-search/products.js +118 -31
- package/es/common/components/instant-search/results.js +121 -32
- package/es/common/components/instant-search/services/api.js +12 -10
- package/es/common/components/instant-search/services/messages.js +3 -3
- package/es/common/components/instant-search/services/utils.js +34 -34
- package/es/common/components/msem-preset-editor/components/facet-selector.js +39 -22
- package/es/common/components/msem-preset-editor/components/form.js +54 -5
- package/es/common/components/msem-preset-editor/components/stay-picker.js +72 -33
- package/es/common/components/msem-preset-editor/components/widget-list-item.js +130 -42
- package/es/common/components/msem-preset-editor/components/widget-list.js +54 -29
- package/es/common/components/msem-preset-editor/editor-dialog.js +68 -21
- package/es/common/components/msem-preset-editor/editors/elloha.js +102 -69
- package/es/common/components/msem-preset-editor/editors/index.js +6 -6
- package/es/common/components/msem-preset-editor/editors/lodgings.js +316 -184
- package/es/common/components/msem-preset-editor/editors/ski-passes.js +267 -180
- package/es/common/components/msem-preset-editor/editors/standard-products.js +84 -56
- package/es/common/components/msem-preset-editor/editors/vakario.js +239 -171
- package/es/common/components/msem-preset-editor/msem-preset-editor.js +215 -129
- package/es/common/components/msem-preset-editor/services/api.js +69 -42
- package/es/common/components/msem-preset-editor/services/offers.js +61 -35
- package/es/common/components/msem-preset-editor/services/preset.js +22 -14
- package/es/common/components/msem-preset-editor/services/url-params.js +24 -24
- package/es/common/components/msem-preset-linker/components/actions.js +52 -40
- package/es/common/components/msem-preset-linker/components/overlays.js +57 -41
- package/es/common/components/msem-preset-linker/components/resort-selector.js +21 -11
- package/es/common/components/msem-preset-linker/hooks/use-msem-presets.js +43 -31
- package/es/common/components/msem-preset-linker/index.js +1 -1
- package/es/common/components/msem-preset-linker/msem-preset-linker.js +71 -42
- package/es/common/components/msem-preset-linker/services/url-params.js +10 -13
- package/es/common/components/plausible/hooks/use-plausible.js +22 -18
- package/es/common/components/plausible/index.js +1 -1
- package/es/common/components/plausible/plausible.js +23 -14
- package/es/common/components/plausible/services/callback.js +164 -115
- package/es/common/components/plausible/services/load.js +4 -6
- package/es/common/components/plausible/services/send-goal.js +6 -3
- package/es/common/components/scroll-spy.js +56 -43
- package/es/common/components/scrolling-carousel/index.js +1 -1
- package/es/common/components/scrolling-carousel/scrolling-carousel.js +94 -55
- package/es/common/components/tabbed-zones.js +100 -47
- package/es/common/hooks/use-faq.js +37 -36
- package/es/common/hooks/use-in-view.js +74 -74
- package/es/common/hooks/use-scroll-direction.js +37 -32
- package/es/common/hooks/use-stay.js +16 -13
- package/es/common/hooks/use-sticky.js +35 -35
- package/es/common/hooks/use-tunnel.js +42 -30
- package/es/common/hooks/use-update-effect.js +9 -9
- package/es/common/hooks/use-window-sizes.js +27 -28
- package/es/common/utils/cms.js +15 -17
- package/es/common/utils/cookies.js +10 -11
- package/es/common/utils/copy.js +11 -11
- package/es/common/utils/dates.js +8 -10
- package/es/common/utils/elements.js +14 -15
- package/es/common/utils/events.js +4 -19
- package/es/common/utils/file-manager.js +12 -10
- package/es/common/utils/load-js.js +10 -11
- package/es/common/utils/msem-widget.js +30 -23
- package/es/common/utils/url-parameters.js +11 -7
- package/es/esf/components/magic-box/index.js +1 -1
- package/es/esf/components/magic-box/magic-box.js +164 -102
- package/es/esf/components/parcours-esf/index.js +1 -1
- package/es/esf/components/parcours-esf/parcours-esf.js +45 -30
- package/es/esf/components/period-picker/period-picker.js +5 -5
- package/es/lbm/components/lumiplan/api.js +35 -18
- package/es/lbm/components/lumiplan/domain.js +96 -20
- package/es/lbm/components/lumiplan/i18n/translations.js +24 -15
- package/es/lbm/components/lumiplan/index.js +1 -1
- package/es/lbm/components/lumiplan/lumiplan.js +130 -102
- package/es/lbm/components/lumiplan/opening.js +116 -38
- package/es/lbm/components/lumiplan/pois.js +270 -161
- package/es/lbm/components/lumiplan/resort-selector.js +58 -36
- package/es/lbm/components/lumiplan/road-condition.js +100 -19
- package/es/lbm/components/lumiplan/todays-tips.js +45 -16
- package/es/lbm/components/lumiplan/types.js +1 -1
- package/es/lbm/components/lumiplan/weather/avalanche-risk.js +33 -8
- package/es/lbm/components/lumiplan/weather/index.js +1 -1
- package/es/lbm/components/lumiplan/weather/snow-data.js +71 -5
- package/es/lbm/components/lumiplan/weather/weather-data.js +126 -7
- package/es/lbm/components/lumiplan/weather/weather-days.js +76 -48
- package/es/lbm/components/lumiplan/weather/weather-icon.js +23 -20
- package/es/lbm/components/lumiplan/weather/weather-zones.js +71 -42
- package/es/lbm/components/lumiplan/weather/weather.js +90 -28
- package/package.json +4 -10
- package/es/common/components/admin-links/admin-links.d.ts +0 -11
- package/es/common/components/admin-links/admin-links.d.ts.map +0 -1
- package/es/common/components/admin-links/index.d.ts +0 -3
- package/es/common/components/admin-links/index.d.ts.map +0 -1
- package/es/common/components/breadcrumb.d.ts +0 -16
- package/es/common/components/breadcrumb.d.ts.map +0 -1
- package/es/common/components/custom-contact-form/custom-contact-form.d.ts +0 -25
- package/es/common/components/custom-contact-form/custom-contact-form.d.ts.map +0 -1
- package/es/common/components/gesco-contact-form/gesco-contact-form.d.ts +0 -17
- package/es/common/components/gesco-contact-form/gesco-contact-form.d.ts.map +0 -1
- package/es/common/components/gesco-contact-form/hooks/use-params.d.ts +0 -15
- package/es/common/components/gesco-contact-form/hooks/use-params.d.ts.map +0 -1
- package/es/common/components/gesco-contact-form/index.d.ts +0 -3
- package/es/common/components/gesco-contact-form/index.d.ts.map +0 -1
- package/es/common/components/gesco-contact-form/phone-code-select.d.ts +0 -7
- package/es/common/components/gesco-contact-form/phone-code-select.d.ts.map +0 -1
- package/es/common/components/gesco-contact-form/services/api.d.ts +0 -30
- package/es/common/components/gesco-contact-form/services/api.d.ts.map +0 -1
- package/es/common/components/gesco-contact-form/services/form.d.ts +0 -31
- package/es/common/components/gesco-contact-form/services/form.d.ts.map +0 -1
- package/es/common/components/gesco-contact-form/services/messages.d.ts +0 -34
- package/es/common/components/gesco-contact-form/services/messages.d.ts.map +0 -1
- package/es/common/components/gesco-contact-form/services/plausible.d.ts +0 -3
- package/es/common/components/gesco-contact-form/services/plausible.d.ts.map +0 -1
- package/es/common/components/gesco-contact-form/types.d.ts +0 -34
- package/es/common/components/gesco-contact-form/types.d.ts.map +0 -1
- package/es/common/components/instant-search/hooks/use-constant.d.ts +0 -2
- package/es/common/components/instant-search/hooks/use-constant.d.ts.map +0 -1
- package/es/common/components/instant-search/hooks/use-debounced-search.d.ts +0 -7
- package/es/common/components/instant-search/hooks/use-debounced-search.d.ts.map +0 -1
- package/es/common/components/instant-search/hooks/use-search.d.ts +0 -16
- package/es/common/components/instant-search/hooks/use-search.d.ts.map +0 -1
- package/es/common/components/instant-search/index.d.ts +0 -3
- package/es/common/components/instant-search/index.d.ts.map +0 -1
- package/es/common/components/instant-search/input.d.ts +0 -15
- package/es/common/components/instant-search/input.d.ts.map +0 -1
- package/es/common/components/instant-search/instant-search.d.ts +0 -14
- package/es/common/components/instant-search/instant-search.d.ts.map +0 -1
- package/es/common/components/instant-search/links.d.ts +0 -12
- package/es/common/components/instant-search/links.d.ts.map +0 -1
- package/es/common/components/instant-search/no-product.d.ts +0 -6
- package/es/common/components/instant-search/no-product.d.ts.map +0 -1
- package/es/common/components/instant-search/products.d.ts +0 -14
- package/es/common/components/instant-search/products.d.ts.map +0 -1
- package/es/common/components/instant-search/results.d.ts +0 -76
- package/es/common/components/instant-search/results.d.ts.map +0 -1
- package/es/common/components/instant-search/services/api.d.ts +0 -2
- package/es/common/components/instant-search/services/api.d.ts.map +0 -1
- package/es/common/components/instant-search/services/messages.d.ts +0 -2
- package/es/common/components/instant-search/services/messages.d.ts.map +0 -1
- package/es/common/components/instant-search/services/utils.d.ts +0 -4
- package/es/common/components/instant-search/services/utils.d.ts.map +0 -1
- package/es/common/components/msem-preset-editor/components/facet-selector.d.ts +0 -6
- package/es/common/components/msem-preset-editor/components/facet-selector.d.ts.map +0 -1
- package/es/common/components/msem-preset-editor/components/form.d.ts +0 -8
- package/es/common/components/msem-preset-editor/components/form.d.ts.map +0 -1
- package/es/common/components/msem-preset-editor/components/stay-picker.d.ts +0 -14
- package/es/common/components/msem-preset-editor/components/stay-picker.d.ts.map +0 -1
- package/es/common/components/msem-preset-editor/components/widget-list-item.d.ts +0 -12
- package/es/common/components/msem-preset-editor/components/widget-list-item.d.ts.map +0 -1
- package/es/common/components/msem-preset-editor/components/widget-list.d.ts +0 -17
- package/es/common/components/msem-preset-editor/components/widget-list.d.ts.map +0 -1
- package/es/common/components/msem-preset-editor/editor-dialog.d.ts +0 -30
- package/es/common/components/msem-preset-editor/editor-dialog.d.ts.map +0 -1
- package/es/common/components/msem-preset-editor/editors/elloha.d.ts +0 -15
- package/es/common/components/msem-preset-editor/editors/elloha.d.ts.map +0 -1
- package/es/common/components/msem-preset-editor/editors/index.d.ts +0 -14
- package/es/common/components/msem-preset-editor/editors/index.d.ts.map +0 -1
- package/es/common/components/msem-preset-editor/editors/lodgings.d.ts +0 -17
- package/es/common/components/msem-preset-editor/editors/lodgings.d.ts.map +0 -1
- package/es/common/components/msem-preset-editor/editors/ski-passes.d.ts +0 -16
- package/es/common/components/msem-preset-editor/editors/ski-passes.d.ts.map +0 -1
- package/es/common/components/msem-preset-editor/editors/standard-products.d.ts +0 -16
- package/es/common/components/msem-preset-editor/editors/standard-products.d.ts.map +0 -1
- package/es/common/components/msem-preset-editor/editors/vakario.d.ts +0 -15
- package/es/common/components/msem-preset-editor/editors/vakario.d.ts.map +0 -1
- package/es/common/components/msem-preset-editor/msem-preset-editor.d.ts +0 -28
- package/es/common/components/msem-preset-editor/msem-preset-editor.d.ts.map +0 -1
- package/es/common/components/msem-preset-editor/services/api.d.ts +0 -15
- package/es/common/components/msem-preset-editor/services/api.d.ts.map +0 -1
- package/es/common/components/msem-preset-editor/services/offers.d.ts +0 -47
- package/es/common/components/msem-preset-editor/services/offers.d.ts.map +0 -1
- package/es/common/components/msem-preset-editor/services/preset.d.ts +0 -40
- package/es/common/components/msem-preset-editor/services/preset.d.ts.map +0 -1
- package/es/common/components/msem-preset-editor/services/url-params.d.ts +0 -3
- package/es/common/components/msem-preset-editor/services/url-params.d.ts.map +0 -1
- package/es/common/components/msem-preset-linker/components/actions.d.ts +0 -11
- package/es/common/components/msem-preset-linker/components/actions.d.ts.map +0 -1
- package/es/common/components/msem-preset-linker/components/overlays.d.ts +0 -8
- package/es/common/components/msem-preset-linker/components/overlays.d.ts.map +0 -1
- package/es/common/components/msem-preset-linker/components/resort-selector.d.ts +0 -6
- package/es/common/components/msem-preset-linker/components/resort-selector.d.ts.map +0 -1
- package/es/common/components/msem-preset-linker/hooks/use-msem-presets.d.ts +0 -4
- package/es/common/components/msem-preset-linker/hooks/use-msem-presets.d.ts.map +0 -1
- package/es/common/components/msem-preset-linker/index.d.ts +0 -3
- package/es/common/components/msem-preset-linker/index.d.ts.map +0 -1
- package/es/common/components/msem-preset-linker/msem-preset-linker.d.ts +0 -30
- package/es/common/components/msem-preset-linker/msem-preset-linker.d.ts.map +0 -1
- package/es/common/components/msem-preset-linker/services/url-params.d.ts +0 -2
- package/es/common/components/msem-preset-linker/services/url-params.d.ts.map +0 -1
- package/es/common/components/plausible/hooks/use-plausible.d.ts +0 -12
- package/es/common/components/plausible/hooks/use-plausible.d.ts.map +0 -1
- package/es/common/components/plausible/index.d.ts +0 -8
- package/es/common/components/plausible/index.d.ts.map +0 -1
- package/es/common/components/plausible/plausible.d.ts +0 -7
- package/es/common/components/plausible/plausible.d.ts.map +0 -1
- package/es/common/components/plausible/services/callback.d.ts +0 -24
- package/es/common/components/plausible/services/callback.d.ts.map +0 -1
- package/es/common/components/plausible/services/load.d.ts +0 -2
- package/es/common/components/plausible/services/load.d.ts.map +0 -1
- package/es/common/components/plausible/services/send-goal.d.ts +0 -7
- package/es/common/components/plausible/services/send-goal.d.ts.map +0 -1
- package/es/common/components/scroll-spy.d.ts +0 -14
- package/es/common/components/scroll-spy.d.ts.map +0 -1
- package/es/common/components/scrolling-carousel/index.d.ts +0 -3
- package/es/common/components/scrolling-carousel/index.d.ts.map +0 -1
- package/es/common/components/scrolling-carousel/scrolling-carousel.d.ts +0 -8
- package/es/common/components/scrolling-carousel/scrolling-carousel.d.ts.map +0 -1
- package/es/common/components/tabbed-zones.d.ts +0 -12
- package/es/common/components/tabbed-zones.d.ts.map +0 -1
- package/es/common/hooks/use-faq.d.ts +0 -3
- package/es/common/hooks/use-faq.d.ts.map +0 -1
- package/es/common/hooks/use-in-view.d.ts +0 -5
- package/es/common/hooks/use-in-view.d.ts.map +0 -1
- package/es/common/hooks/use-scroll-direction.d.ts +0 -11
- package/es/common/hooks/use-scroll-direction.d.ts.map +0 -1
- package/es/common/hooks/use-stay.d.ts +0 -4
- package/es/common/hooks/use-stay.d.ts.map +0 -1
- package/es/common/hooks/use-sticky.d.ts +0 -4
- package/es/common/hooks/use-sticky.d.ts.map +0 -1
- package/es/common/hooks/use-tunnel.d.ts +0 -8
- package/es/common/hooks/use-tunnel.d.ts.map +0 -1
- package/es/common/hooks/use-update-effect.d.ts +0 -2
- package/es/common/hooks/use-update-effect.d.ts.map +0 -1
- package/es/common/hooks/use-window-sizes.d.ts +0 -7
- package/es/common/hooks/use-window-sizes.d.ts.map +0 -1
- package/es/common/utils/cms.d.ts +0 -4
- package/es/common/utils/cms.d.ts.map +0 -1
- package/es/common/utils/cookies.d.ts +0 -2
- package/es/common/utils/cookies.d.ts.map +0 -1
- package/es/common/utils/copy.d.ts +0 -2
- package/es/common/utils/copy.d.ts.map +0 -1
- package/es/common/utils/dates.d.ts +0 -2
- package/es/common/utils/dates.d.ts.map +0 -1
- package/es/common/utils/elements.d.ts +0 -5
- package/es/common/utils/elements.d.ts.map +0 -1
- package/es/common/utils/events.d.ts +0 -4
- package/es/common/utils/events.d.ts.map +0 -1
- package/es/common/utils/file-manager.d.ts +0 -13
- package/es/common/utils/file-manager.d.ts.map +0 -1
- package/es/common/utils/load-js.d.ts +0 -3
- package/es/common/utils/load-js.d.ts.map +0 -1
- package/es/common/utils/msem-widget.d.ts +0 -16
- package/es/common/utils/msem-widget.d.ts.map +0 -1
- package/es/common/utils/url-parameters.d.ts +0 -2
- package/es/common/utils/url-parameters.d.ts.map +0 -1
- package/es/esf/components/magic-box/index.d.ts +0 -3
- package/es/esf/components/magic-box/index.d.ts.map +0 -1
- package/es/esf/components/magic-box/magic-box.d.ts +0 -22
- package/es/esf/components/magic-box/magic-box.d.ts.map +0 -1
- package/es/esf/components/parcours-esf/index.d.ts +0 -3
- package/es/esf/components/parcours-esf/index.d.ts.map +0 -1
- package/es/esf/components/parcours-esf/parcours-esf.d.ts +0 -14
- package/es/esf/components/parcours-esf/parcours-esf.d.ts.map +0 -1
- package/es/lbm/components/lumiplan/api.d.ts +0 -8
- package/es/lbm/components/lumiplan/api.d.ts.map +0 -1
- package/es/lbm/components/lumiplan/domain.d.ts +0 -8
- package/es/lbm/components/lumiplan/domain.d.ts.map +0 -1
- package/es/lbm/components/lumiplan/i18n/translations.d.ts +0 -7
- package/es/lbm/components/lumiplan/i18n/translations.d.ts.map +0 -1
- package/es/lbm/components/lumiplan/index.d.ts +0 -3
- package/es/lbm/components/lumiplan/index.d.ts.map +0 -1
- package/es/lbm/components/lumiplan/lumiplan.d.ts +0 -2
- package/es/lbm/components/lumiplan/lumiplan.d.ts.map +0 -1
- package/es/lbm/components/lumiplan/opening.d.ts +0 -9
- package/es/lbm/components/lumiplan/opening.d.ts.map +0 -1
- package/es/lbm/components/lumiplan/pois.d.ts +0 -8
- package/es/lbm/components/lumiplan/pois.d.ts.map +0 -1
- package/es/lbm/components/lumiplan/resort-selector.d.ts +0 -12
- package/es/lbm/components/lumiplan/resort-selector.d.ts.map +0 -1
- package/es/lbm/components/lumiplan/road-condition.d.ts +0 -8
- package/es/lbm/components/lumiplan/road-condition.d.ts.map +0 -1
- package/es/lbm/components/lumiplan/todays-tips.d.ts +0 -8
- package/es/lbm/components/lumiplan/todays-tips.d.ts.map +0 -1
- package/es/lbm/components/lumiplan/types.d.ts +0 -285
- package/es/lbm/components/lumiplan/types.d.ts.map +0 -1
- package/es/lbm/components/lumiplan/weather/avalanche-risk.d.ts +0 -4
- package/es/lbm/components/lumiplan/weather/avalanche-risk.d.ts.map +0 -1
- package/es/lbm/components/lumiplan/weather/index.d.ts +0 -3
- package/es/lbm/components/lumiplan/weather/index.d.ts.map +0 -1
- package/es/lbm/components/lumiplan/weather/snow-data.d.ts +0 -8
- package/es/lbm/components/lumiplan/weather/snow-data.d.ts.map +0 -1
- package/es/lbm/components/lumiplan/weather/weather-data.d.ts +0 -9
- package/es/lbm/components/lumiplan/weather/weather-data.d.ts.map +0 -1
- package/es/lbm/components/lumiplan/weather/weather-days.d.ts +0 -7
- package/es/lbm/components/lumiplan/weather/weather-days.d.ts.map +0 -1
- package/es/lbm/components/lumiplan/weather/weather-icon.d.ts +0 -23
- package/es/lbm/components/lumiplan/weather/weather-icon.d.ts.map +0 -1
- package/es/lbm/components/lumiplan/weather/weather-zones.d.ts +0 -6
- package/es/lbm/components/lumiplan/weather/weather-zones.d.ts.map +0 -1
- package/es/lbm/components/lumiplan/weather/weather.d.ts +0 -8
- package/es/lbm/components/lumiplan/weather/weather.d.ts.map +0 -1
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import Select from "dt-design-system/es/select";
|
|
3
|
+
import Popover from "dt-design-system/es/popover";
|
|
4
|
+
import Button from "dt-design-system/es/button";
|
|
5
|
+
import * as Icons from "dt-design-system/es/icons";
|
|
6
|
+
import Rule from "./rule";
|
|
7
|
+
import OverridesList from "./overrides-list";
|
|
8
|
+
import * as Utils from "./services/utils";
|
|
9
|
+
import styles from "./rules.module.css";
|
|
10
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
12
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
13
|
+
export default function Rules({
|
|
14
|
+
container,
|
|
15
|
+
config,
|
|
16
|
+
setConfig,
|
|
17
|
+
tunnelOffers
|
|
18
|
+
}) {
|
|
19
|
+
const [currentOffer, setCurrentOffer] = React.useState("");
|
|
20
|
+
const [currentOverride, setCurrentOverride] = React.useState(null);
|
|
21
|
+
const overrides = config[currentOffer]?.overrides || [];
|
|
22
|
+
const showOverrides = currentOffer && Utils.hasAllowedOverrides(currentOffer);
|
|
23
|
+
const sections = Array.from(container.querySelectorAll(".tunnel-offer"));
|
|
24
|
+
const uuids = sections.map(section => section.getAttribute("data-uuid"));
|
|
25
|
+
const updateCurrentOffer = newCurrentOffer => {
|
|
26
|
+
setCurrentOffer(newCurrentOffer);
|
|
27
|
+
setCurrentOverride(null);
|
|
28
|
+
};
|
|
29
|
+
const tunnelOptions = Object.keys(tunnelOffers).map(key => {
|
|
30
|
+
const label = tunnelOffers[key];
|
|
31
|
+
return {
|
|
32
|
+
value: key,
|
|
33
|
+
label
|
|
34
|
+
};
|
|
35
|
+
});
|
|
36
|
+
return _jsxs("div", {
|
|
37
|
+
className: styles.container,
|
|
38
|
+
children: [_jsxs("div", {
|
|
39
|
+
className: styles.title,
|
|
40
|
+
children: ["Configuration", _jsx(Popover, {
|
|
41
|
+
className: styles.popover,
|
|
42
|
+
trigger: _jsx(Button, {
|
|
43
|
+
variant: "transparent",
|
|
44
|
+
children: _jsx(Icons.Info, {})
|
|
45
|
+
}),
|
|
46
|
+
children: "La configuration vous permet de personnaliser l'ordre d'affichage des produits sugg\xE9r\xE9s dans le panier en fonction des produits pr\xE9sents dans le panier de l'utilisateur."
|
|
47
|
+
})]
|
|
48
|
+
}), _jsx("div", {
|
|
49
|
+
className: styles.explanation,
|
|
50
|
+
children: "Configurez les suggestions de produit en fonction du contenu du panier"
|
|
51
|
+
}), _jsx(Select, {
|
|
52
|
+
className: styles.select,
|
|
53
|
+
label: "Produit ajout\xE9 au panier",
|
|
54
|
+
placeholder: "S\xE9lectionnez un produit",
|
|
55
|
+
value: currentOffer,
|
|
56
|
+
options: tunnelOptions,
|
|
57
|
+
onValueChange: updateCurrentOffer
|
|
58
|
+
}), showOverrides && _jsx(OverridesList, {
|
|
59
|
+
currentOffer: currentOffer,
|
|
60
|
+
overrides: overrides,
|
|
61
|
+
currentOverride: currentOverride,
|
|
62
|
+
setCurrentOverride: setCurrentOverride,
|
|
63
|
+
config: config,
|
|
64
|
+
setConfig: setConfig
|
|
65
|
+
}), currentOffer && _jsxs(_Fragment, {
|
|
66
|
+
children: [_jsx("div", {
|
|
67
|
+
className: styles.subTitle,
|
|
68
|
+
children: "Priorisation par types de produit"
|
|
69
|
+
}), sections.map(section => {
|
|
70
|
+
const uuid = section.getAttribute("data-uuid");
|
|
71
|
+
const title = section.querySelector(".tunnel-offer__title").textContent;
|
|
72
|
+
return _jsx(Rule, {
|
|
73
|
+
uuid: uuid,
|
|
74
|
+
uuids: uuids,
|
|
75
|
+
title: title,
|
|
76
|
+
currentOffer: currentOffer,
|
|
77
|
+
currentOverride: currentOverride,
|
|
78
|
+
config: config,
|
|
79
|
+
setConfig: setConfig
|
|
80
|
+
}, title);
|
|
81
|
+
})]
|
|
82
|
+
})]
|
|
83
|
+
});
|
|
84
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
.container {
|
|
2
|
+
flex: 0 0 360px;
|
|
3
|
+
display: flex;
|
|
4
|
+
flex-direction: column;
|
|
5
|
+
margin: 0 auto;
|
|
6
|
+
padding: 16px 26px;
|
|
7
|
+
background-color: var(--ds-grey-000, #fff);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.title {
|
|
11
|
+
align-self: flex-start;
|
|
12
|
+
display: flex;
|
|
13
|
+
align-items: center;
|
|
14
|
+
gap: 3px;
|
|
15
|
+
font-weight: 700;
|
|
16
|
+
color: var(--ds-black, #262626);
|
|
17
|
+
border-radius: var(--ds-snackbar-radius, var(--ds-radius-200, 8px));
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.popover {
|
|
21
|
+
max-width: 220px;
|
|
22
|
+
color: var(--ds-grey-500, #7c7b7b);
|
|
23
|
+
font-size: var(--ds-label-font-size, 13px);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.explanation {
|
|
27
|
+
width: 100%;
|
|
28
|
+
margin-bottom: 16px;
|
|
29
|
+
font-size: 13px;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.select {
|
|
33
|
+
margin-bottom: 12px;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.subTitle {
|
|
37
|
+
color: var(--ds-grey-500, #7c7b7b);
|
|
38
|
+
font-size: var(--ds-label-font-size, 13px);
|
|
39
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import getConfig from "next/config";
|
|
2
|
+
import * as Fetcher from "../../../utils/fetcher";
|
|
3
|
+
const {
|
|
4
|
+
publicRuntimeConfig
|
|
5
|
+
} = getConfig();
|
|
6
|
+
const {
|
|
7
|
+
msemServicesUrl,
|
|
8
|
+
esfplusUrl,
|
|
9
|
+
channel,
|
|
10
|
+
resort
|
|
11
|
+
} = publicRuntimeConfig;
|
|
12
|
+
export async function fetchTunnelOffers(lang, facet) {
|
|
13
|
+
const endpoint = `${msemServicesUrl}/api/tunnel/offers/${channel}/${resort}`;
|
|
14
|
+
const result = await Fetcher.get(endpoint, {
|
|
15
|
+
lang,
|
|
16
|
+
facet
|
|
17
|
+
});
|
|
18
|
+
return result;
|
|
19
|
+
}
|
|
20
|
+
export async function fetchMseMCart(cartId, lang) {
|
|
21
|
+
const endpoint = `${esfplusUrl}/api/esfplus/cart`;
|
|
22
|
+
const id = JSON.parse(cartId);
|
|
23
|
+
const payload = {
|
|
24
|
+
cartId: id,
|
|
25
|
+
lang,
|
|
26
|
+
resort
|
|
27
|
+
};
|
|
28
|
+
const result = await Fetcher.post(endpoint, payload);
|
|
29
|
+
return result;
|
|
30
|
+
}
|
|
31
|
+
export async function fetchSkipassesFilters(merchant, catalog) {
|
|
32
|
+
const endpoint = `${msemServicesUrl}/api/ski-pass/${merchant}/filters`;
|
|
33
|
+
return Fetcher.post(endpoint, undefined, {
|
|
34
|
+
catalog
|
|
35
|
+
});
|
|
36
|
+
}
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
import * as API from "./api";
|
|
2
|
+
export const tunnelOffers = {
|
|
3
|
+
HOT: "Hébergement",
|
|
4
|
+
LIFT: "Forfait",
|
|
5
|
+
SKI_RENTAL: "Location de matériel",
|
|
6
|
+
ESF: "Cours de ski",
|
|
7
|
+
CONCIERGERIE: "Conciergerie",
|
|
8
|
+
STAND: "Autre produit"
|
|
9
|
+
};
|
|
10
|
+
export function getSortedOffers(container, cartContent, config) {
|
|
11
|
+
if (!container || !cartContent || !config) return [];
|
|
12
|
+
const sections = Array.from(container.querySelectorAll(".tunnel-offer"));
|
|
13
|
+
const offers = sections.map(section => {
|
|
14
|
+
const clonedSection = section.cloneNode(true);
|
|
15
|
+
const cmsUI = clonedSection.querySelector("cms-section-ui");
|
|
16
|
+
if (cmsUI) {
|
|
17
|
+
cmsUI.remove();
|
|
18
|
+
}
|
|
19
|
+
const contentEditable = Array.from(clonedSection.querySelectorAll("[contenteditable]"));
|
|
20
|
+
contentEditable.forEach(element => {
|
|
21
|
+
element.removeAttribute("contenteditable");
|
|
22
|
+
});
|
|
23
|
+
const title = clonedSection.querySelector(".tunnel-offer__title")?.textContent;
|
|
24
|
+
const uuid = section.getAttribute("data-uuid") || "";
|
|
25
|
+
const weight = Object.keys(config).reduce((acc, key) => {
|
|
26
|
+
const override = getActiveOverride(key, cartContent, config);
|
|
27
|
+
const currentWeight = override?.rules?.[uuid]?.weight || 0;
|
|
28
|
+
const inCart = cartContent.items[key] || 0;
|
|
29
|
+
return acc + currentWeight * inCart;
|
|
30
|
+
}, 0);
|
|
31
|
+
const isHidden = Object.keys(config).some(key => {
|
|
32
|
+
const override = getActiveOverride(key, cartContent, config);
|
|
33
|
+
const isHidden = override?.rules?.[uuid]?.hidden || false;
|
|
34
|
+
const inCart = cartContent.items[key] || 0;
|
|
35
|
+
return inCart ? isHidden : false;
|
|
36
|
+
});
|
|
37
|
+
return {
|
|
38
|
+
title,
|
|
39
|
+
weight,
|
|
40
|
+
elementHTML: clonedSection.outerHTML,
|
|
41
|
+
isHidden
|
|
42
|
+
};
|
|
43
|
+
});
|
|
44
|
+
const filteredOffers = offers.filter(offer => !offer.isHidden);
|
|
45
|
+
const sortedOffers = filteredOffers.sort((a, b) => b.weight - a.weight);
|
|
46
|
+
return sortedOffers;
|
|
47
|
+
}
|
|
48
|
+
export function getActiveOverride(key, cartContent, config) {
|
|
49
|
+
const {
|
|
50
|
+
items
|
|
51
|
+
} = cartContent;
|
|
52
|
+
const amountInCart = items[key];
|
|
53
|
+
const item = config[key];
|
|
54
|
+
if (!amountInCart) return item?.default;
|
|
55
|
+
const matchingOverrides = getMatchingOverrides(item, cartContent);
|
|
56
|
+
const activeOverride = matchingOverrides.length > 0 ? item?.overrides.find(o => o.id === matchingOverrides[0]) : item?.default || {};
|
|
57
|
+
return activeOverride;
|
|
58
|
+
}
|
|
59
|
+
function getMatchingOverrides(item, cartContent) {
|
|
60
|
+
if (!item) return [];
|
|
61
|
+
const {
|
|
62
|
+
overrides = []
|
|
63
|
+
} = item;
|
|
64
|
+
const matchs = overrides.reduce((acc, override) => {
|
|
65
|
+
const {
|
|
66
|
+
stay,
|
|
67
|
+
merchants,
|
|
68
|
+
skiPassDurations = []
|
|
69
|
+
} = cartContent;
|
|
70
|
+
const isStayMatching = checkStay(override, stay);
|
|
71
|
+
const isMerchantMatching = checkMerchants(override, merchants);
|
|
72
|
+
const isSkiPassDurationMatching = checkSkiPassDurations(override, skiPassDurations);
|
|
73
|
+
const isMatching = isStayMatching || isMerchantMatching || isSkiPassDurationMatching;
|
|
74
|
+
return isMatching ? [...acc, override.id] : acc;
|
|
75
|
+
}, []);
|
|
76
|
+
return matchs;
|
|
77
|
+
}
|
|
78
|
+
function checkStay(override, stay) {
|
|
79
|
+
const {
|
|
80
|
+
stayFrom,
|
|
81
|
+
stayTo,
|
|
82
|
+
stayDuration
|
|
83
|
+
} = override.triggers || {};
|
|
84
|
+
if (!stayFrom || !stayTo || !stay?.from || !stay?.to) return false;
|
|
85
|
+
const triggerStayFrom = new Date(stayFrom).getTime();
|
|
86
|
+
const triggerStayTo = new Date(stayTo).getTime();
|
|
87
|
+
const stayFromTime = new Date(stay?.from).getTime();
|
|
88
|
+
const stayToTime = new Date(stay?.to).getTime();
|
|
89
|
+
const stayIsBetweenTrigger = stayFromTime >= triggerStayFrom && stayToTime <= triggerStayTo;
|
|
90
|
+
const stayHasRightDuration = stay.duration && stayDuration && stayDuration !== 0 && stay?.duration > stayDuration;
|
|
91
|
+
return stayIsBetweenTrigger || stayHasRightDuration;
|
|
92
|
+
}
|
|
93
|
+
function checkMerchants(override, merchants) {
|
|
94
|
+
const {
|
|
95
|
+
merchant = ""
|
|
96
|
+
} = override.triggers || {};
|
|
97
|
+
const splittedMerchant = merchant.split(",").map(m => m.trim());
|
|
98
|
+
return merchants && splittedMerchant.some(m => merchants.includes(m));
|
|
99
|
+
}
|
|
100
|
+
function checkSkiPassDurations(override, skiPassDurations) {
|
|
101
|
+
if (!skiPassDurations) return false;
|
|
102
|
+
const maxDuration = Math.max(...skiPassDurations);
|
|
103
|
+
const {
|
|
104
|
+
skiPassDuration,
|
|
105
|
+
skiPassDurationOperator = ">="
|
|
106
|
+
} = override.triggers || {};
|
|
107
|
+
if (!skiPassDuration) return false;
|
|
108
|
+
switch (skiPassDurationOperator) {
|
|
109
|
+
case ">":
|
|
110
|
+
return maxDuration > skiPassDuration;
|
|
111
|
+
case ">=":
|
|
112
|
+
return maxDuration >= skiPassDuration;
|
|
113
|
+
case "<":
|
|
114
|
+
return maxDuration < skiPassDuration;
|
|
115
|
+
case "<=":
|
|
116
|
+
return maxDuration <= skiPassDuration;
|
|
117
|
+
case "=":
|
|
118
|
+
return maxDuration === skiPassDuration;
|
|
119
|
+
default:
|
|
120
|
+
return false;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
export const allowedOverrides = ["HOT", "LIFT", "SKI_RENTAL", "STAND"];
|
|
124
|
+
export function hasAllowedOverrides(kind) {
|
|
125
|
+
return allowedOverrides.includes(kind);
|
|
126
|
+
}
|
|
127
|
+
export function formatCartContent(cart) {
|
|
128
|
+
const {
|
|
129
|
+
orders
|
|
130
|
+
} = cart;
|
|
131
|
+
if (!orders) return {};
|
|
132
|
+
return Object.keys(orders).reduce((acc, key) => {
|
|
133
|
+
if (!Object.keys(tunnelOffers).includes(key)) return acc;
|
|
134
|
+
const order = orders?.[key];
|
|
135
|
+
const inscriptionsLength = order?.length || 0;
|
|
136
|
+
return {
|
|
137
|
+
...acc,
|
|
138
|
+
[key]: inscriptionsLength
|
|
139
|
+
};
|
|
140
|
+
}, {});
|
|
141
|
+
}
|
|
142
|
+
export function getMerchantsFromCart(cart) {
|
|
143
|
+
const {
|
|
144
|
+
orders
|
|
145
|
+
} = cart;
|
|
146
|
+
if (!orders) return [];
|
|
147
|
+
return Object.keys(orders).reduce((acc, key) => {
|
|
148
|
+
if (!Object.keys(tunnelOffers).includes(key)) return acc;
|
|
149
|
+
const order = orders[key];
|
|
150
|
+
const merchants = order.map(item => item.merchant);
|
|
151
|
+
return [...acc, ...merchants];
|
|
152
|
+
}, []);
|
|
153
|
+
}
|
|
154
|
+
export function getStayFromCart(cart) {
|
|
155
|
+
const {
|
|
156
|
+
stayFrom: from,
|
|
157
|
+
stayTo: to
|
|
158
|
+
} = cart;
|
|
159
|
+
if (!from || !to) return {};
|
|
160
|
+
const bareDuration = new Date(to).getTime() - new Date(from).getTime();
|
|
161
|
+
const duration = bareDuration / (1000 * 3600 * 24);
|
|
162
|
+
return {
|
|
163
|
+
from,
|
|
164
|
+
to,
|
|
165
|
+
duration
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
export async function getskiPassDurationFromCart(cart) {
|
|
169
|
+
const {
|
|
170
|
+
LIFT: items
|
|
171
|
+
} = cart.orders;
|
|
172
|
+
if (!items?.length) return [];
|
|
173
|
+
const {
|
|
174
|
+
merchant
|
|
175
|
+
} = items[0];
|
|
176
|
+
const skipassCatalogs = items[0].inscriptions.map(i => i.skipassCatalog);
|
|
177
|
+
const filters = await Promise.all(skipassCatalogs.map(catalog => API.fetchSkipassesFilters(merchant, catalog)));
|
|
178
|
+
const durations = filters.reduce((acc, filter) => {
|
|
179
|
+
const {
|
|
180
|
+
durations: durationsFilter
|
|
181
|
+
} = filter;
|
|
182
|
+
const durations = items.map(item => {
|
|
183
|
+
if (!item.inscriptions.length) return acc;
|
|
184
|
+
const label = item.inscriptions[0].duration;
|
|
185
|
+
const duration = durationsFilter.find(d => {
|
|
186
|
+
return d.code === label;
|
|
187
|
+
});
|
|
188
|
+
return duration;
|
|
189
|
+
});
|
|
190
|
+
return [...acc, ...durations];
|
|
191
|
+
}, []);
|
|
192
|
+
return durations.map(d => d.nbDays);
|
|
193
|
+
}
|
|
194
|
+
export const CONFIG_ID = "cross-selling-editor";
|
|
195
|
+
export function getConfig(container) {
|
|
196
|
+
const config = container?.querySelector(`#${CONFIG_ID}`);
|
|
197
|
+
const json = JSON.parse(config?.textContent || "{}");
|
|
198
|
+
return json;
|
|
199
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import NumberPicker from "dt-design-system/es/number-picker";
|
|
3
|
+
import Input from "dt-design-system/es/input";
|
|
4
|
+
import * as Utils from "./services/utils";
|
|
5
|
+
import styles from "./tester-tunnel-offer.module.css";
|
|
6
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
8
|
+
export default function TesterTunnelOffer({
|
|
9
|
+
kind,
|
|
10
|
+
value,
|
|
11
|
+
label,
|
|
12
|
+
cartOffers,
|
|
13
|
+
updateCartOffers,
|
|
14
|
+
refreshCartContent
|
|
15
|
+
}) {
|
|
16
|
+
const overrideAllowed = Utils.allowedOverrides.includes(kind);
|
|
17
|
+
const isSkiPasses = kind === "LIFT";
|
|
18
|
+
const itemValue = cartOffers[value] || 0;
|
|
19
|
+
const items = [...new Array(itemValue)];
|
|
20
|
+
return _jsxs("div", {
|
|
21
|
+
className: styles.item,
|
|
22
|
+
children: [_jsx(NumberPicker, {
|
|
23
|
+
label: label,
|
|
24
|
+
value: itemValue,
|
|
25
|
+
onChange: updateCartOffers(value),
|
|
26
|
+
min: 0,
|
|
27
|
+
max: 10
|
|
28
|
+
}), overrideAllowed && items.map((_, index) => {
|
|
29
|
+
const number = index + 1;
|
|
30
|
+
if (isSkiPasses) {
|
|
31
|
+
return _jsx(Input, {
|
|
32
|
+
type: "number",
|
|
33
|
+
className: styles.input,
|
|
34
|
+
"data-kind": "skiPassDuration",
|
|
35
|
+
label: `Durée du forfait n°${number}`,
|
|
36
|
+
placeholder: "En jour(s) (Optionnel)",
|
|
37
|
+
min: 0,
|
|
38
|
+
max: 40,
|
|
39
|
+
onChange: refreshCartContent,
|
|
40
|
+
compact: true
|
|
41
|
+
}, index);
|
|
42
|
+
}
|
|
43
|
+
return _jsx(Input, {
|
|
44
|
+
className: styles.input,
|
|
45
|
+
"data-kind": "merchant",
|
|
46
|
+
label: `Marchand n°${number}`,
|
|
47
|
+
placeholder: "Code (Optionnel)",
|
|
48
|
+
onChange: refreshCartContent,
|
|
49
|
+
compact: true
|
|
50
|
+
}, index);
|
|
51
|
+
})]
|
|
52
|
+
}, label);
|
|
53
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
.item {
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
gap: 6px;
|
|
5
|
+
padding: 10px;
|
|
6
|
+
background-color: var(--ds-grey-000, #fff);
|
|
7
|
+
border-radius: var(--ds-radius-100, 4px);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.input > label {
|
|
11
|
+
width: 100%;
|
|
12
|
+
flex-direction: row;
|
|
13
|
+
align-items: center;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.input > label > div {
|
|
17
|
+
flex: 1 1 auto;
|
|
18
|
+
}
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import Input from "dt-design-system/es/input";
|
|
3
|
+
import Popover from "dt-design-system/es/popover";
|
|
4
|
+
import Button from "dt-design-system/es/button";
|
|
5
|
+
import * as Icons from "dt-design-system/es/icons";
|
|
6
|
+
import styles from "./tester.module.css";
|
|
7
|
+
import * as Utils from "./services/utils";
|
|
8
|
+
import TesterTunnelOffer from "./tester-tunnel-offer";
|
|
9
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
12
|
+
export default function Tester({
|
|
13
|
+
container,
|
|
14
|
+
config,
|
|
15
|
+
tunnelOffers
|
|
16
|
+
}) {
|
|
17
|
+
const ref = React.useRef(null);
|
|
18
|
+
const [stayFrom, setStayFrom] = React.useState("");
|
|
19
|
+
const [stayTo, setStayTo] = React.useState("");
|
|
20
|
+
const [cartOffers, setCartOffers] = React.useState({});
|
|
21
|
+
const [merchants, setMerchants] = React.useState([]);
|
|
22
|
+
const [skiPassDurations, setSkiPassDurations] = React.useState([]);
|
|
23
|
+
const updateStayFrom = value => {
|
|
24
|
+
setStayFrom(value);
|
|
25
|
+
const stayToIsUndefined = !stayTo;
|
|
26
|
+
const stayToIsBefore = new Date(stayTo) && new Date(value) > new Date(stayTo);
|
|
27
|
+
if (stayToIsUndefined || stayToIsBefore) {
|
|
28
|
+
const addOneWeek = new Date(value);
|
|
29
|
+
addOneWeek.setDate(addOneWeek.getDate() + 7);
|
|
30
|
+
const newValue = addOneWeek.toISOString().split("T")[0];
|
|
31
|
+
setStayTo(newValue);
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
const updateStayTo = value => {
|
|
35
|
+
setStayTo(value);
|
|
36
|
+
const stayFromIsAfter = new Date(stayFrom) > new Date(value);
|
|
37
|
+
if (stayFromIsAfter) {
|
|
38
|
+
const removeOneWeek = new Date(value);
|
|
39
|
+
removeOneWeek.setDate(removeOneWeek.getDate() - 7);
|
|
40
|
+
const newValue = removeOneWeek.toISOString().split("T")[0];
|
|
41
|
+
setStayFrom(newValue);
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
const stay = Utils.getStayFromCart({
|
|
45
|
+
stayFrom,
|
|
46
|
+
stayTo
|
|
47
|
+
});
|
|
48
|
+
const cartContent = {
|
|
49
|
+
items: cartOffers,
|
|
50
|
+
stay,
|
|
51
|
+
merchants,
|
|
52
|
+
skiPassDurations
|
|
53
|
+
};
|
|
54
|
+
const sortedOffers = Utils.getSortedOffers(container, cartContent, config);
|
|
55
|
+
const activeOverrides = Object.keys(cartOffers).reduce((acc, key) => {
|
|
56
|
+
const name = Utils.tunnelOffers[key];
|
|
57
|
+
const override = Utils.getActiveOverride(key, cartContent, config);
|
|
58
|
+
const isDefault = !override?.name;
|
|
59
|
+
if (!override || isDefault) return acc;
|
|
60
|
+
return {
|
|
61
|
+
...acc,
|
|
62
|
+
[name]: [...(acc[name] || []), override.name]
|
|
63
|
+
};
|
|
64
|
+
}, {});
|
|
65
|
+
const activeOverridesKeys = Object.keys(activeOverrides);
|
|
66
|
+
const hasActiveOverride = activeOverridesKeys.length > 0;
|
|
67
|
+
const updateCartOffers = kind => value => {
|
|
68
|
+
setCartOffers(prev => ({
|
|
69
|
+
...prev,
|
|
70
|
+
[kind]: value
|
|
71
|
+
}));
|
|
72
|
+
};
|
|
73
|
+
const refreshCartContent = () => {
|
|
74
|
+
const container = ref.current;
|
|
75
|
+
if (container) {
|
|
76
|
+
const merchantInputs = Array.from(container.querySelectorAll("[data-kind=merchant]"));
|
|
77
|
+
const skiPassDurationInputs = Array.from(container.querySelectorAll("[data-kind=skiPassDuration]"));
|
|
78
|
+
const merchants = merchantInputs.map(input => input.value).filter(Boolean);
|
|
79
|
+
const skiPassDurations = skiPassDurationInputs.map(input => Number(input.value)).filter(Boolean);
|
|
80
|
+
setMerchants(merchants);
|
|
81
|
+
setSkiPassDurations(skiPassDurations);
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
const tunnelOptions = Object.keys(tunnelOffers).map(key => {
|
|
85
|
+
const label = tunnelOffers[key];
|
|
86
|
+
return {
|
|
87
|
+
key,
|
|
88
|
+
value: key,
|
|
89
|
+
label
|
|
90
|
+
};
|
|
91
|
+
});
|
|
92
|
+
return _jsx("div", {
|
|
93
|
+
className: styles.tester,
|
|
94
|
+
children: _jsxs("div", {
|
|
95
|
+
className: styles.content,
|
|
96
|
+
children: [_jsxs("div", {
|
|
97
|
+
className: styles.title,
|
|
98
|
+
children: ["Pr\xE9visualisation", _jsxs(Popover, {
|
|
99
|
+
className: styles.popover,
|
|
100
|
+
trigger: _jsx(Button, {
|
|
101
|
+
variant: "transparent",
|
|
102
|
+
children: _jsx(Icons.Info, {})
|
|
103
|
+
}),
|
|
104
|
+
children: ["Vous pouvez tester les r\xE8gles de suggestions en modifiant le contenu du panier ci-dessous.", _jsx("br", {}), "Les suggestions de produits s'afficheront dessous en temps r\xE9el."]
|
|
105
|
+
})]
|
|
106
|
+
}), _jsxs("div", {
|
|
107
|
+
className: styles.header,
|
|
108
|
+
children: [_jsx("div", {
|
|
109
|
+
className: styles.headerTitle,
|
|
110
|
+
children: "Simulez un contenu de panier"
|
|
111
|
+
}), _jsxs("div", {
|
|
112
|
+
className: styles.stay,
|
|
113
|
+
children: [_jsx(Input, {
|
|
114
|
+
className: styles.input,
|
|
115
|
+
type: "date",
|
|
116
|
+
label: "Date de d\xE9but de s\xE9jour",
|
|
117
|
+
value: stayFrom || "",
|
|
118
|
+
onValueChange: updateStayFrom,
|
|
119
|
+
compact: true
|
|
120
|
+
}), _jsx(Input, {
|
|
121
|
+
className: styles.input,
|
|
122
|
+
type: "date",
|
|
123
|
+
label: "Date de fin de s\xE9jour",
|
|
124
|
+
value: stayTo || "",
|
|
125
|
+
onValueChange: updateStayTo,
|
|
126
|
+
compact: true
|
|
127
|
+
})]
|
|
128
|
+
}), _jsx("div", {
|
|
129
|
+
ref: ref,
|
|
130
|
+
className: styles.tunnelOffers,
|
|
131
|
+
children: tunnelOptions.map(({
|
|
132
|
+
key,
|
|
133
|
+
value,
|
|
134
|
+
label
|
|
135
|
+
}) => {
|
|
136
|
+
return _jsx(TesterTunnelOffer, {
|
|
137
|
+
kind: key,
|
|
138
|
+
value: value,
|
|
139
|
+
label: label,
|
|
140
|
+
cartOffers: cartOffers,
|
|
141
|
+
updateCartOffers: updateCartOffers,
|
|
142
|
+
refreshCartContent: refreshCartContent
|
|
143
|
+
}, key.concat(label));
|
|
144
|
+
})
|
|
145
|
+
})]
|
|
146
|
+
}), _jsxs("div", {
|
|
147
|
+
className: styles.activeOverrides,
|
|
148
|
+
children: [_jsxs("span", {
|
|
149
|
+
className: styles.activeOverridesTitle,
|
|
150
|
+
children: ["Surcharge(s) active(s) :", " "]
|
|
151
|
+
}), hasActiveOverride ? activeOverridesKeys.map(key => {
|
|
152
|
+
const values = activeOverrides[key];
|
|
153
|
+
return _jsxs(_Fragment, {
|
|
154
|
+
children: [_jsxs("span", {
|
|
155
|
+
className: styles.activeOverride,
|
|
156
|
+
children: [key, " (", values.join(", "), ")"]
|
|
157
|
+
}, key), " "]
|
|
158
|
+
});
|
|
159
|
+
}) : _jsx("span", {
|
|
160
|
+
className: styles.noActiveOverride,
|
|
161
|
+
children: "Aucune"
|
|
162
|
+
})]
|
|
163
|
+
}), _jsx("div", {
|
|
164
|
+
className: styles.offers,
|
|
165
|
+
children: sortedOffers.map(({
|
|
166
|
+
title,
|
|
167
|
+
weight,
|
|
168
|
+
elementHTML
|
|
169
|
+
}) => {
|
|
170
|
+
return _jsxs("div", {
|
|
171
|
+
className: styles.offer,
|
|
172
|
+
children: [_jsx("div", {
|
|
173
|
+
className: styles.offerContent,
|
|
174
|
+
dangerouslySetInnerHTML: {
|
|
175
|
+
__html: elementHTML
|
|
176
|
+
}
|
|
177
|
+
}), _jsxs("div", {
|
|
178
|
+
className: styles.offerWeight,
|
|
179
|
+
children: ["Priorit\xE9 : ", _jsx("b", {
|
|
180
|
+
children: weight
|
|
181
|
+
})]
|
|
182
|
+
})]
|
|
183
|
+
}, title);
|
|
184
|
+
})
|
|
185
|
+
})]
|
|
186
|
+
})
|
|
187
|
+
});
|
|
188
|
+
}
|