ublo-lib 1.28.0 → 1.29.0

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.
@@ -0,0 +1,31 @@
1
+ import * as React from "react";
2
+ import { useUbloContext } from "ublo/with-ublo";
3
+ import * as Plausible from "../components/plausible";
4
+ import { loadJS } from "../utils/load-js";
5
+ export default function useAccount({
6
+ channel = "ESF",
7
+ integration
8
+ }) {
9
+ const {
10
+ lang
11
+ } = useUbloContext();
12
+ const widgetLang = React.useMemo(() => lang === "fr" ? "fr" : "en", [lang]);
13
+ React.useEffect(() => {
14
+ const startTunnel = async () => {
15
+ await loadWigetMseM(integration);
16
+ window.MseM.onLoad(() => {
17
+ window.MseM.customerAccount({
18
+ lang: widgetLang,
19
+ channel,
20
+ groundedTo: "#msem-account",
21
+ analytics: Plausible.callback
22
+ });
23
+ });
24
+ };
25
+ startTunnel();
26
+ }, [channel, integration, widgetLang]);
27
+ }
28
+ async function loadWigetMseM(integration) {
29
+ const source = integration ? "https://widget-integration.msem.tech/static/js/widget-msem.js" : "https://widget.msem.tech/static/js/widget-msem.js";
30
+ await loadJS(source, "widget-msem");
31
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ublo-lib",
3
- "version": "1.28.0",
3
+ "version": "1.29.0",
4
4
  "peerDependencies": {
5
5
  "dt-design-system": "^3.8.3",
6
6
  "leaflet": "^1.9.1",