ublo-lib 1.4.0 → 1.4.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.
@@ -13,6 +13,7 @@ const Booking = ({
13
13
  cartUrl,
14
14
  channel,
15
15
  values,
16
+ maxCPDuration,
16
17
  setCurrentStep
17
18
  }) => {
18
19
  const {
@@ -28,6 +29,18 @@ const Booking = ({
28
29
  setCurrentStep(0);
29
30
  };
30
31
 
32
+ const engagement = !maxCPDuration || parseInt(values.durations) > maxCPDuration;
33
+ const engagementPresets = React.useMemo(() => {
34
+ const activity = engagement ? values.activities : [values.activities];
35
+ return {
36
+ activity,
37
+ day: parseInt(values.days),
38
+ duration: parseInt(values.durations),
39
+ language: values.languages,
40
+ person: parseInt(values.nbPersons),
41
+ startDate: values.startDates
42
+ };
43
+ }, [engagement, values?.activities, values?.days, values?.durations, values?.languages, values?.nbPersons, values?.startDates]);
31
44
  React.useEffect(() => {
32
45
  const init = async () => {
33
46
  await loadWigetMseM();
@@ -39,36 +52,31 @@ const Booking = ({
39
52
  preview: !!cmsMode || preview,
40
53
  cartUrl,
41
54
  fullWidth: true,
42
- groundedTo: "#msem-cp",
55
+ groundedTo: "#msem-magic-box",
43
56
  show: ["vel"]
44
57
  };
45
58
  const presets = {
46
59
  kind: "CP",
47
- engagement: true,
48
- activity: values.activities,
49
- day: parseInt(values.days),
50
- duration: parseInt(values.durations),
51
- language: values.languages,
52
- person: parseInt(values.nbPersons),
53
- startDate: values.startDates,
60
+ engagement,
54
61
  stay: {
55
62
  from: stay.from,
56
63
  to: stay.to
57
- }
64
+ },
65
+ ...engagementPresets
58
66
  };
59
67
  window.MseM.esf(options, presets);
60
68
  });
61
69
  };
62
70
 
63
71
  init();
64
- }, [cartUrl, cmsMode, lang, resort, stay?.from, stay?.to, values?.activities, values?.days, values?.durations, values?.languages, values?.nbPersons, values?.startDates]);
72
+ }, [cartUrl, channel, cmsMode, engagement, engagementPresets, lang, resort, stay?.from, stay?.to]);
65
73
  return _jsxs("div", {
66
74
  className: css.root,
67
75
  children: [_jsxs(Button, {
68
76
  onClick: goBack,
69
77
  children: [_jsx(Icons.ArrowLeft, {}), message(lang, "go-back")]
70
78
  }), _jsx("div", {
71
- id: "msem-cp"
79
+ id: "msem-magic-box"
72
80
  })]
73
81
  });
74
82
  };
@@ -18,6 +18,7 @@ const MagicBox = ({
18
18
  channel = "ESF",
19
19
  className,
20
20
  alignContent,
21
+ maxCPDuration,
21
22
  children
22
23
  }) => {
23
24
  const [filters, setFilters] = React.useState();
@@ -110,6 +111,7 @@ const MagicBox = ({
110
111
  cartUrl: cartUrl,
111
112
  channel: channel,
112
113
  values: values,
114
+ maxCPDuration: maxCPDuration,
113
115
  setCurrentStep: setCurrentStep
114
116
  })]
115
117
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ublo-lib",
3
- "version": "1.4.0",
3
+ "version": "1.4.1",
4
4
  "peerDependencies": {
5
5
  "dt-design-system": "^2.1.0",
6
6
  "next": "^12.0.0",