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.
@@ -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
- const startTunnel = async () => {
30
- await loadWigetMseM(integration);
31
- const categoryCode = window.sessionStorage.getItem("categoryCode") || undefined;
32
- window.MseM.onLoad(() => {
33
- window.MseM.tunnel({
34
- channel,
35
- resort,
36
- groundedTo: "#esfplus_container",
37
- lang: widgetLang,
38
- esfUrl,
39
- analytics: Plausible.callback,
40
- categoryCode
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
- startTunnel();
45
- }, [channel, esfUrl, integration, widgetLang]);
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 loadWigetMseM(integration) {
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
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ublo-lib",
3
- "version": "1.31.3",
3
+ "version": "1.31.5",
4
4
  "peerDependencies": {
5
5
  "dt-design-system": "^3.8.3",
6
6
  "leaflet": "^1.9.1",