ublo-lib 1.25.17 → 1.25.19

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.
@@ -14,7 +14,8 @@ const Booking = ({
14
14
  channel,
15
15
  values,
16
16
  maxCPDuration,
17
- setCurrentStep
17
+ setCurrentStep,
18
+ msemWidgetHost
18
19
  }) => {
19
20
  const {
20
21
  lang,
@@ -59,7 +60,7 @@ const Booking = ({
59
60
  }, [cartPage, categoryCode]);
60
61
  React.useEffect(() => {
61
62
  const init = async () => {
62
- await loadWigetMseM();
63
+ await loadWigetMseM(msemWidgetHost);
63
64
  window.MseM?.onLoad(() => {
64
65
  const options = {
65
66
  resort,
@@ -85,7 +86,7 @@ const Booking = ({
85
86
  });
86
87
  };
87
88
  init();
88
- }, [cartUrl, categoryCode, channel, cmsMode, engagement, engagementPresets, goToCart, lang, resort, stay.from, stay.to]);
89
+ }, [cartUrl, categoryCode, channel, cmsMode, engagement, engagementPresets, goToCart, lang, msemWidgetHost, resort, stay.from, stay.to]);
89
90
  return _jsxs("div", {
90
91
  className: css.root,
91
92
  children: [_jsxs(Button, {
@@ -23,6 +23,9 @@ function MagicBox({
23
23
  maxDays = Infinity,
24
24
  allowedActivities,
25
25
  categories,
26
+ msemWidgetHost = "https://widget.msem.tech",
27
+ msemApiHost = "https://services.msem.tech/api/esf",
28
+ msemAdminHost = "https://admin.mon-sejour-en-montagne.com/api/gesco",
26
29
  children
27
30
  }) {
28
31
  const [filters, setFilters] = React.useState();
@@ -55,11 +58,12 @@ function MagicBox({
55
58
  to: stayTo
56
59
  } = stay;
57
60
  const [welcomeResult, paramsResult] = await Promise.all([API.fetchWelcome({
61
+ msemApiHost,
58
62
  lang,
59
63
  resort,
60
64
  stayFrom,
61
65
  stayTo
62
- }), API.fetchParams(lang, resort, merchant, channel, categories)]);
66
+ }), API.fetchParams(msemAdminHost, lang, resort, merchant, channel, categories)]);
63
67
  const {
64
68
  season: currentSeason,
65
69
  availableSeasons
@@ -69,6 +73,7 @@ function MagicBox({
69
73
  } = paramsResult;
70
74
  const season = currentSeason || availableSeasons[0] || "2022";
71
75
  const filtersResult = await API.fetchFilters({
76
+ msemApiHost,
72
77
  lang,
73
78
  resort,
74
79
  season,
@@ -120,7 +125,7 @@ function MagicBox({
120
125
  } : newFilters;
121
126
  setFilters(allFilters);
122
127
  }
123
- }, [allowedActivities, categories, channel, lang, maxDays, merchant, minDays, resort, stay]);
128
+ }, [allowedActivities, categories, channel, lang, maxDays, merchant, minDays, msemAdminHost, msemApiHost, resort, stay]);
124
129
  const initValues = React.useCallback(() => {
125
130
  if (!values) {
126
131
  const defaultValues = getDefaultValues(filters);
@@ -159,7 +164,8 @@ function MagicBox({
159
164
  channel: channel,
160
165
  values: values,
161
166
  maxCPDuration: maxCPDuration,
162
- setCurrentStep: setCurrentStep
167
+ setCurrentStep: setCurrentStep,
168
+ msemWidgetHost: msemWidgetHost
163
169
  })]
164
170
  })
165
171
  });
@@ -1,13 +1,12 @@
1
1
  import * as Fetcher from "../../../../common/utils/fetcher";
2
- const velApi = "https://services.msem.tech/api/esf";
3
- const msemAdminApi = "https://admin.mon-sejour-en-montagne.com/api/gesco";
4
2
  export function fetchWelcome({
3
+ msemApiHost,
5
4
  lang,
6
5
  resort,
7
6
  stayFrom,
8
7
  stayTo
9
8
  }) {
10
- return Fetcher.post(`${velApi}/welcome`, {
9
+ return Fetcher.post(`${msemApiHost}/welcome`, {
11
10
  resort,
12
11
  lang,
13
12
  stayFrom,
@@ -15,6 +14,7 @@ export function fetchWelcome({
15
14
  });
16
15
  }
17
16
  export async function fetchFilters({
17
+ msemApiHost,
18
18
  lang,
19
19
  resort,
20
20
  season,
@@ -23,7 +23,7 @@ export async function fetchFilters({
23
23
  kinds = ["CP"],
24
24
  engagement = true
25
25
  }) {
26
- return Fetcher.post(`${velApi}/filters`, {
26
+ return Fetcher.post(`${msemApiHost}/filters`, {
27
27
  lang,
28
28
  resort,
29
29
  season,
@@ -33,8 +33,8 @@ export async function fetchFilters({
33
33
  engagement
34
34
  });
35
35
  }
36
- export async function fetchParams(lang, resort, merchant, channel, categories) {
37
- const res = await fetch(`${msemAdminApi}/contact/parameters`, {
36
+ export async function fetchParams(msemAdminHost, lang, resort, merchant, channel, categories) {
37
+ const res = await fetch(`${msemAdminHost}/contact/parameters`, {
38
38
  method: "POST",
39
39
  headers: {
40
40
  "content-type": "application/json;charset=utf-8"
@@ -1,4 +1,4 @@
1
1
  import { loadJS } from "../../../../common/utils/load-js";
2
- export async function loadWigetMseM() {
3
- await loadJS("https://widget.msem.tech/static/js/widget-msem.js", "widget-msem");
2
+ export async function loadWigetMseM(msemWidgetHost) {
3
+ await loadJS(`${msemWidgetHost}/static/js/widget-msem.js`, "widget-msem");
4
4
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ublo-lib",
3
- "version": "1.25.17",
3
+ "version": "1.25.19",
4
4
  "peerDependencies": {
5
5
  "dt-design-system": "^3.8.3",
6
6
  "leaflet": "^1.9.1",