@logora/debate 0.4.101 → 0.4.102
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.
|
@@ -1,42 +1,86 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useEffect as
|
|
3
|
-
import
|
|
4
|
-
const
|
|
5
|
-
id:
|
|
6
|
-
adPath:
|
|
7
|
-
sizes:
|
|
8
|
-
targeting:
|
|
9
|
-
enableDidomi:
|
|
1
|
+
import { jsx as g } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as w, useEffect as R } from "react";
|
|
3
|
+
import v from "./AdUnit.module.scss.js";
|
|
4
|
+
const E = 3e4, x = ({
|
|
5
|
+
id: c,
|
|
6
|
+
adPath: a,
|
|
7
|
+
sizes: L = [],
|
|
8
|
+
targeting: N,
|
|
9
|
+
enableDidomi: I = !1,
|
|
10
|
+
refresh: f = !1,
|
|
11
|
+
refreshInterval: m = E
|
|
10
12
|
}) => {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
13
|
+
const r = `div-gpt-ad-${c}`, o = w(null), s = w(null), p = w(!1), h = w(null);
|
|
14
|
+
return R(() => {
|
|
15
|
+
if (typeof window > "u" || !c || !a)
|
|
16
|
+
return;
|
|
17
|
+
const t = window.googletag || (window.googletag = { cmd: [] });
|
|
18
|
+
let b = !1;
|
|
19
|
+
return t.cmd.push(() => {
|
|
20
|
+
if (b)
|
|
21
|
+
return;
|
|
22
|
+
const n = t.pubads(), l = n.getSlots().filter((e) => e.getSlotElementId() === r);
|
|
23
|
+
l.length > 0 && t.destroySlots(l);
|
|
24
|
+
const i = t.defineSlot(a, L, r);
|
|
25
|
+
if (i) {
|
|
26
|
+
i.setTargeting("origine", ["logora"]);
|
|
27
|
+
for (const [e, u] of Object.entries(N || {}))
|
|
28
|
+
i.setTargeting(e, u);
|
|
29
|
+
i.setConfig({ collapseDiv: "ON_NO_FILL" }), i.addService(n), o.current = i, t.display(r), n.isInitialLoadDisabled() && n.refresh([i]);
|
|
30
|
+
}
|
|
31
|
+
}), () => {
|
|
32
|
+
b = !0;
|
|
33
|
+
const n = o.current;
|
|
34
|
+
o.current = null, !(typeof window > "u" || !window.googletag || !n) && window.googletag.cmd.push(() => {
|
|
35
|
+
window.googletag.destroySlots([n]);
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
}, [c, a]), R(() => {
|
|
39
|
+
const t = h.current, n = t !== null && t.divId === r && f === !0 && (t.refresh !== !0 || t.refreshInterval !== m);
|
|
40
|
+
if (h.current = { refresh: f, refreshInterval: m, divId: r }, typeof window > "u" || f !== !0 || !c || !a)
|
|
41
|
+
return;
|
|
42
|
+
const l = window.googletag || (window.googletag = { cmd: [] }), i = Math.max(m, E);
|
|
43
|
+
let e = !1, u = null;
|
|
44
|
+
const T = () => {
|
|
45
|
+
const d = o.current;
|
|
46
|
+
e || !d || l.cmd.push(() => {
|
|
47
|
+
e || l.pubads().refresh([d]);
|
|
48
|
+
});
|
|
49
|
+
}, y = () => {
|
|
50
|
+
e || s.current || (s.current = setTimeout(() => {
|
|
51
|
+
if (s.current = null, !(e || !o.current)) {
|
|
52
|
+
if (document.visibilityState !== "visible") {
|
|
53
|
+
p.current = !0;
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
T();
|
|
57
|
+
}
|
|
58
|
+
}, i));
|
|
59
|
+
}, S = () => {
|
|
60
|
+
document.visibilityState === "visible" && p.current && !e && (p.current = !1, y());
|
|
61
|
+
};
|
|
62
|
+
return l.cmd.push(() => {
|
|
63
|
+
e || !o.current || (u = (d) => {
|
|
64
|
+
d.slot !== o.current || s.current || y();
|
|
65
|
+
}, l.pubads().addEventListener("impressionViewable", u), n && document.visibilityState === "visible" && y());
|
|
66
|
+
}), document.addEventListener("visibilitychange", S), () => {
|
|
67
|
+
e = !0, s.current && (clearTimeout(s.current), s.current = null), p.current = !1;
|
|
68
|
+
const d = u;
|
|
69
|
+
u = null, document.removeEventListener("visibilitychange", S), !(typeof window > "u" || !window.googletag || !d) && window.googletag.cmd.push(() => {
|
|
70
|
+
window.googletag.pubads().removeEventListener("impressionViewable", d);
|
|
71
|
+
});
|
|
72
|
+
};
|
|
73
|
+
}, [f, m, r]), !c || !a ? null : I === !0 ? /* @__PURE__ */ g(
|
|
31
74
|
"script",
|
|
32
75
|
{
|
|
33
76
|
type: "didomi/html",
|
|
34
77
|
"data-vendor": "didomi:google",
|
|
35
78
|
"data-purposes": "cookies",
|
|
36
|
-
children: /* @__PURE__ */
|
|
79
|
+
children: /* @__PURE__ */ g("div", { className: v.adContainer, children: /* @__PURE__ */ g("div", { className: v.adUnit, id: r }) })
|
|
37
80
|
}
|
|
38
|
-
) : /* @__PURE__ */
|
|
81
|
+
) : /* @__PURE__ */ g("div", { className: v.adContainer, children: /* @__PURE__ */ g("div", { className: v.adUnit, id: r }) });
|
|
39
82
|
};
|
|
40
83
|
export {
|
|
41
|
-
|
|
84
|
+
x as AdUnit,
|
|
85
|
+
E as MIN_REFRESH_INTERVAL
|
|
42
86
|
};
|
|
@@ -1,22 +1,30 @@
|
|
|
1
|
-
import { useEffect as
|
|
2
|
-
const
|
|
3
|
-
if (
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
1
|
+
import { useLayoutEffect as r, useEffect as n } from "react";
|
|
2
|
+
const s = "https://securepubads.g.doubleclick.net/tag/js/gpt.js", i = () => {
|
|
3
|
+
if (typeof window > "u" || typeof document > "u" || window.googletag && window.googletag.apiReady)
|
|
4
|
+
return !0;
|
|
5
|
+
const t = document.querySelectorAll("script[src]");
|
|
6
|
+
for (const e of t)
|
|
7
|
+
if (/\/gpt\.js(\?|$)/.test(e.src))
|
|
8
|
+
return !0;
|
|
9
|
+
return !1;
|
|
10
|
+
}, u = (t = !1) => {
|
|
11
|
+
if (i())
|
|
12
|
+
return !1;
|
|
13
|
+
const e = document.createElement("script");
|
|
14
|
+
return e.src = s, e.async = !0, t === !0 && (e.type = "didomi/javascript", e.setAttribute("data-vendor-raw", "didomi:google"), e.setAttribute("data-purposes", "cookies")), document.body.appendChild(e), !0;
|
|
15
|
+
};
|
|
16
|
+
let o = !1;
|
|
17
|
+
const c = () => {
|
|
18
|
+
if (typeof window > "u" || o)
|
|
19
|
+
return;
|
|
20
|
+
const t = window.googletag || (window.googletag = { cmd: [] });
|
|
21
|
+
o = !0, t.cmd.push(() => {
|
|
22
|
+
t.enableServices();
|
|
23
|
+
});
|
|
24
|
+
}, d = typeof window < "u" ? r : n, a = (t = !0, e = !1) => (d(() => {
|
|
25
|
+
t !== !0 || typeof window > "u" || u(e) && c();
|
|
19
26
|
}, []), null);
|
|
20
27
|
export {
|
|
21
|
-
|
|
28
|
+
s as GPT_SRC,
|
|
29
|
+
a as useGoogleAdManager
|
|
22
30
|
};
|
|
@@ -1,29 +1,33 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import
|
|
3
|
-
import { AdUnit as
|
|
4
|
-
const
|
|
1
|
+
import { jsxs as i, Fragment as a, jsx as j } from "react/jsx-runtime";
|
|
2
|
+
import A from "react";
|
|
3
|
+
import { AdUnit as $ } from "../ad_unit/AdUnit.js";
|
|
4
|
+
const x = ({
|
|
5
5
|
id: r,
|
|
6
6
|
adPath: o,
|
|
7
|
-
targeting:
|
|
8
|
-
sizes:
|
|
7
|
+
targeting: e,
|
|
8
|
+
sizes: m,
|
|
9
9
|
index: t,
|
|
10
|
-
frequency:
|
|
11
|
-
enableDidomi:
|
|
10
|
+
frequency: s = 3,
|
|
11
|
+
enableDidomi: f = !1,
|
|
12
|
+
refresh: l = !1,
|
|
13
|
+
refreshInterval: n,
|
|
12
14
|
children: c,
|
|
13
|
-
...
|
|
14
|
-
}) => /* @__PURE__ */
|
|
15
|
-
|
|
16
|
-
r && o && (t + 1) %
|
|
17
|
-
|
|
15
|
+
...p
|
|
16
|
+
}) => /* @__PURE__ */ i(a, { children: [
|
|
17
|
+
A.cloneElement(c, p),
|
|
18
|
+
r && o && (t + 1) % s === 1 && /* @__PURE__ */ j(
|
|
19
|
+
$,
|
|
18
20
|
{
|
|
19
21
|
id: t ? `${r}-${t}` : r,
|
|
20
22
|
adPath: o,
|
|
21
|
-
targeting:
|
|
22
|
-
sizes:
|
|
23
|
-
enableDidomi:
|
|
23
|
+
targeting: e,
|
|
24
|
+
sizes: m,
|
|
25
|
+
enableDidomi: f,
|
|
26
|
+
refresh: l,
|
|
27
|
+
refreshInterval: n
|
|
24
28
|
}
|
|
25
29
|
)
|
|
26
30
|
] });
|
|
27
31
|
export {
|
|
28
|
-
|
|
32
|
+
x as WithAd
|
|
29
33
|
};
|