ublo-lib 1.4.1 → 1.4.3

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.
@@ -3,6 +3,20 @@ import { useUbloContext } from "ublo/with-ublo";
3
3
  import { loadJS } from "../../common/utils/load-js";
4
4
  import * as Plausible from "../../common/components/plausible";
5
5
 
6
+ const closeAllDialogs = e => {
7
+ const cart = e.target.closest("[onclick^='openBoutiqueESF(']");
8
+ if (!cart) return;
9
+ const dialogs = document.querySelectorAll("dialog");
10
+
11
+ if (dialogs.length) {
12
+ Array.from(dialogs).forEach(d => d.close?.());
13
+ }
14
+ };
15
+
16
+ const setupDialogCleanup = () => {
17
+ document.addEventListener("click", closeAllDialogs);
18
+ };
19
+
6
20
  const setupConfig = (lang, breadcrumb, cart = [], multipleVillages, hasLangPrefix, channel) => {
7
21
  const pageEsf = multipleVillages ? breadcrumb?.next?.path : breadcrumb?.path;
8
22
  const langPrefix = hasLangPrefix ? `/${lang}` : "";
@@ -27,6 +41,7 @@ const useBookingLinks = (cart, multipleVillages, setupCallback, channel) => {
27
41
  const run = async () => {
28
42
  await loadJS("https://widget.vente-en-ligne-esf.com/boutique/boutique.js", "boutique-js");
29
43
  setupConfig(bookingLang, breadcrumb, cart, multipleVillages, hasLangPrefix, channel);
44
+ setupDialogCleanup();
30
45
  setupCallback?.();
31
46
  };
32
47
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ublo-lib",
3
- "version": "1.4.1",
3
+ "version": "1.4.3",
4
4
  "peerDependencies": {
5
5
  "dt-design-system": "^2.1.0",
6
6
  "next": "^12.0.0",