ublo-lib 1.31.3 → 1.31.5
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/hooks/use-tunnel.js +27 -18
- package/package.json +1 -1
|
@@ -14,9 +14,13 @@ const hasLangPrefix = langPrefix.links;
|
|
|
14
14
|
export default function useTunnel({
|
|
15
15
|
channel = "ESF",
|
|
16
16
|
multipleVillages,
|
|
17
|
-
integration
|
|
17
|
+
integration,
|
|
18
|
+
groundedTo = "#esfplus_container",
|
|
19
|
+
enableCustomOffers,
|
|
20
|
+
customOffers
|
|
18
21
|
} = {}) {
|
|
19
22
|
const {
|
|
23
|
+
cmsMode,
|
|
20
24
|
lang,
|
|
21
25
|
breadcrumb
|
|
22
26
|
} = useUbloContext();
|
|
@@ -26,25 +30,30 @@ export default function useTunnel({
|
|
|
26
30
|
const widgetLang = React.useMemo(() => lang === "fr" ? "fr" : "en", [lang]);
|
|
27
31
|
const esfUrl = React.useMemo(() => hasLangPrefix ? `/${lang.concat(esfPath)}` : esfPath, [esfPath, lang]);
|
|
28
32
|
React.useEffect(() => {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
window.MseM.
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
33
|
+
if (enableCustomOffers && cmsMode !== "editing" || !enableCustomOffers) {
|
|
34
|
+
const startTunnel = async () => {
|
|
35
|
+
await loadWidgetMseM(integration);
|
|
36
|
+
const categoryCode = window.sessionStorage.getItem("categoryCode") || undefined;
|
|
37
|
+
window.MseM.onLoad(() => {
|
|
38
|
+
window.MseM.tunnel({
|
|
39
|
+
channel,
|
|
40
|
+
resort,
|
|
41
|
+
groundedTo,
|
|
42
|
+
lang: widgetLang,
|
|
43
|
+
esfUrl,
|
|
44
|
+
customOffers,
|
|
45
|
+
analytics: Plausible.callback,
|
|
46
|
+
categoryCode
|
|
47
|
+
});
|
|
41
48
|
});
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
49
|
+
};
|
|
50
|
+
if (enableCustomOffers && customOffers !== undefined || !enableCustomOffers) {
|
|
51
|
+
startTunnel();
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}, [channel, cmsMode, customOffers, enableCustomOffers, esfUrl, groundedTo, integration, widgetLang]);
|
|
46
55
|
}
|
|
47
|
-
async function
|
|
56
|
+
async function loadWidgetMseM(integration) {
|
|
48
57
|
const source = integration ? "https://widget-integration.msem.tech/static/js/widget-msem.js" : "https://widget.msem.tech/static/js/widget-msem.js";
|
|
49
58
|
await loadJS(source, "widget-msem");
|
|
50
59
|
}
|