solid-intlayer 9.5.9-canary.0 → 9.5.10

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.
Files changed (51) hide show
  1. package/dist/cjs/IntlayerNode.cjs +1 -1
  2. package/dist/cjs/analytics/useAnalytics.cjs +1 -1
  3. package/dist/cjs/analytics/useConversion.cjs +1 -1
  4. package/dist/cjs/analytics/useExperiment.cjs +1 -1
  5. package/dist/cjs/client/IntlayerProvider.cjs +1 -1
  6. package/dist/cjs/client/getBrowserLocale.cjs +1 -1
  7. package/dist/cjs/client/t.cjs +1 -1
  8. package/dist/cjs/client/useDictionary.cjs +1 -1
  9. package/dist/cjs/client/useDictionaryDynamic.cjs +1 -1
  10. package/dist/cjs/client/useIntlayer.cjs +1 -1
  11. package/dist/cjs/client/useLocale.cjs +1 -1
  12. package/dist/cjs/client/useLocaleStorage.cjs +1 -1
  13. package/dist/cjs/client/useTraduction.cjs +1 -1
  14. package/dist/cjs/format/index.cjs +1 -1
  15. package/dist/cjs/format/useIntl.cjs +1 -1
  16. package/dist/cjs/html/HTMLProvider.cjs +1 -1
  17. package/dist/cjs/html/HTMLRenderer.cjs +1 -1
  18. package/dist/cjs/index.cjs +1 -1
  19. package/dist/cjs/markdown/MarkdownProvider.cjs +1 -1
  20. package/dist/cjs/markdown/MarkdownRenderer.cjs +1 -1
  21. package/dist/cjs/plugins.cjs +1 -1
  22. package/dist/cjs/proxyKeys.cjs +1 -1
  23. package/dist/esm/IntlayerNode.mjs +6 -20
  24. package/dist/esm/analytics/useAnalytics.mjs +9 -9
  25. package/dist/esm/analytics/useConversion.mjs +1 -1
  26. package/dist/esm/analytics/useExperiment.mjs +2 -2
  27. package/dist/esm/client/IntlayerProvider.mjs +23 -23
  28. package/dist/esm/client/getBrowserLocale.mjs +15 -15
  29. package/dist/esm/client/t.mjs +4 -4
  30. package/dist/esm/client/useDictionary.mjs +6 -6
  31. package/dist/esm/client/useDictionaryDynamic.mjs +9 -9
  32. package/dist/esm/client/useIntlayer.mjs +6 -6
  33. package/dist/esm/client/useLocale.mjs +1 -1
  34. package/dist/esm/client/useLocaleStorage.mjs +7 -7
  35. package/dist/esm/client/useTraduction.mjs +5 -5
  36. package/dist/esm/format/index.mjs +6 -6
  37. package/dist/esm/format/useIntl.mjs +1 -1
  38. package/dist/esm/html/HTMLProvider.mjs +5 -5
  39. package/dist/esm/html/HTMLRenderer.mjs +6 -6
  40. package/dist/esm/index.mjs +17 -16
  41. package/dist/esm/markdown/MarkdownProvider.mjs +16 -16
  42. package/dist/esm/markdown/MarkdownRenderer.mjs +11 -11
  43. package/dist/esm/plugins.mjs +109 -113
  44. package/dist/esm/proxyKeys.mjs +2 -5
  45. package/dist/{esm-DXg1m_y3.js → esm-CXlI80Tk.js} +1 -1
  46. package/dist/{esm-DZ1bEPA6.mjs → esm-CtrrRmRn.mjs} +2 -2
  47. package/dist/types/client/useContent.d.ts +1 -1
  48. package/dist/types/client/useLocaleStorage.d.ts +14 -4
  49. package/dist/types/index.d.ts +1 -1
  50. package/dist/types/proxyKeys.d.ts +3 -10
  51. package/package.json +9 -9
@@ -1,11 +1,11 @@
1
1
  import { IntlayerClientContext as e } from "./IntlayerProvider.mjs";
2
- import { internationalization as t } from "@intlayer/config/built";
3
- import { useContext as n } from "solid-js";
4
- import { getTranslation as r } from "@intlayer/core/interpreter";
2
+ import { getTranslation as t } from "@intlayer/core/interpreter";
3
+ import { internationalization as n } from "@intlayer/config/built";
4
+ import { useContext as r } from "solid-js";
5
5
  //#region src/client/useTraduction.ts
6
6
  var i = (i) => {
7
- let { locale: a } = n(e) ?? {};
8
- return r(i, a?.() ?? t.defaultLocale);
7
+ let { locale: a } = r(e) ?? {};
8
+ return t(i, a?.() ?? n.defaultLocale);
9
9
  };
10
10
  //#endregion
11
11
  export { i as useTranslation };
@@ -1,10 +1,10 @@
1
- import { useCurrency as e } from "./useCurrency.mjs";
1
+ import { usePercentage as e } from "./usePercentage.mjs";
2
2
  import { useUnit as t } from "./useUnit.mjs";
3
- import { useDate as n } from "./useDate.mjs";
4
- import { useCompact as r } from "./useCompact.mjs";
3
+ import { useCompact as n } from "./useCompact.mjs";
4
+ import { useNumber as r } from "./useNumber.mjs";
5
5
  import { useIntl as i } from "./useIntl.mjs";
6
6
  import { useList as a } from "./useList.mjs";
7
- import { useNumber as o } from "./useNumber.mjs";
8
- import { usePercentage as s } from "./usePercentage.mjs";
7
+ import { useCurrency as o } from "./useCurrency.mjs";
8
+ import { useDate as s } from "./useDate.mjs";
9
9
  import { useRelativeTime as c } from "./useRelativeTime.mjs";
10
- export { r as useCompact, e as useCurrency, n as useDate, i as useIntl, a as useList, o as useNumber, s as usePercentage, c as useRelativeTime, t as useUnit };
10
+ export { n as useCompact, o as useCurrency, s as useDate, i as useIntl, a as useList, r as useNumber, e as usePercentage, c as useRelativeTime, t as useUnit };
@@ -3,7 +3,7 @@ import { createMemo as t, useContext as n } from "solid-js";
3
3
  import { bindIntl as r } from "@intlayer/core/formatters";
4
4
  //#region src/format/useIntl.ts
5
5
  var i = (i) => {
6
- let a = n(e) ?? {};
6
+ let a = n(e);
7
7
  return t(() => {
8
8
  let e = i ?? a.locale();
9
9
  return r(e);
@@ -1,12 +1,12 @@
1
- import { createContext as e, useContext as t } from "solid-js";
2
- import { createComponent as n } from "solid-js/web";
1
+ import { createComponent as e } from "solid-js/web";
2
+ import { createContext as t, useContext as n } from "solid-js";
3
3
  //#region src/html/HTMLProvider.tsx
4
- var r = e(), i = () => t(r), a = (e) => n(r.Provider, {
4
+ var r = t(), i = () => n(r), a = (t) => e(r.Provider, {
5
5
  get value() {
6
- return { components: e.components };
6
+ return { components: t.components };
7
7
  },
8
8
  get children() {
9
- return e.children;
9
+ return t.children;
10
10
  }
11
11
  });
12
12
  //#endregion
@@ -1,14 +1,14 @@
1
1
  import { useHTMLContext as e } from "./HTMLProvider.mjs";
2
- import { Dynamic as t, createComponent as n, mergeProps as r } from "solid-js/web";
3
- import { getHTML as i } from "@intlayer/core/interpreter";
2
+ import { getHTML as t } from "@intlayer/core/interpreter";
3
+ import { Dynamic as n, createComponent as r, mergeProps as i } from "solid-js/web";
4
4
  import { VOID_HTML_ELEMENTS as a } from "@intlayer/core/transpiler";
5
5
  //#region src/html/HTMLRenderer.tsx
6
6
  var o = (e, { components: o = {} } = {}) => {
7
- let s = Object.fromEntries(Object.entries(o).filter(([, e]) => e).map(([e, i]) => [e, (e) => n(t, r({ component: i }, e))])), c = new Proxy(s, { get(e, i) {
8
- if (typeof i == "string" && i in e) return e[i];
9
- if (typeof i == "string" && /^[a-z][a-z0-9]*$/.test(i)) return a.has(i) ? ({ children: e, ...a }) => n(t, r({ component: i }, a)) : (e) => n(t, r({ component: i }, e));
7
+ let s = Object.fromEntries(Object.entries(o).filter(([, e]) => e).map(([e, t]) => [e, (e) => r(n, i({ component: t }, e))])), c = new Proxy(s, { get(e, t) {
8
+ if (typeof t == "string" && t in e) return e[t];
9
+ if (typeof t == "string" && /^[a-z][a-z0-9]*$/.test(t)) return a.has(t) ? ({ children: e, ...a }) => r(n, i({ component: t }, a)) : (e) => r(n, i({ component: t }, e));
10
10
  } });
11
- return i(e, c);
11
+ return t(e, c);
12
12
  }, s = ({ components: t } = {}) => {
13
13
  let n = e();
14
14
  return (e) => o(e, { components: {
@@ -1,20 +1,21 @@
1
- import { getBrowserLocale as e } from "./client/getBrowserLocale.mjs";
2
- import { localeCookie as t, localeInStorage as n, setLocaleCookie as r, setLocaleInStorage as i, useLocaleCookie as a, useLocaleStorage as o } from "./client/useLocaleStorage.mjs";
3
- import { IntlayerClientContext as s, IntlayerProvider as c, IntlayerProviderContent as l, useIntlayerContext as u } from "./client/IntlayerProvider.mjs";
4
- import { t as d } from "./client/t.mjs";
5
- import { getDictionary as f } from "./getDictionary.mjs";
6
- import { useLoadDynamic as p } from "./client/useLoadDynamic.mjs";
7
- import { useDictionary as m } from "./client/useDictionary.mjs";
8
- import { useDictionaryAsync as h } from "./client/useDictionaryAsync.mjs";
9
- import { useDictionaryDynamic as g } from "./client/useDictionaryDynamic.mjs";
10
- import { getIntlayer as _ } from "./getIntlayer.mjs";
1
+ import { getDictionary as e } from "./getDictionary.mjs";
2
+ import { getIntlayer as t } from "./getIntlayer.mjs";
3
+ import { getBrowserLocale as n } from "./client/getBrowserLocale.mjs";
4
+ import { localeCookie as r, localeInStorage as i, setLocaleCookie as a, setLocaleInStorage as o, useLocaleCookie as s, useLocaleStorage as c } from "./client/useLocaleStorage.mjs";
5
+ import { IntlayerClientContext as l, IntlayerProvider as u, IntlayerProviderContent as d, useIntlayerContext as f } from "./client/IntlayerProvider.mjs";
6
+ import { t as p } from "./client/t.mjs";
7
+ import { useLoadDynamic as m } from "./client/useLoadDynamic.mjs";
8
+ import { useDictionary as h } from "./client/useDictionary.mjs";
9
+ import { useDictionaryAsync as g } from "./client/useDictionaryAsync.mjs";
10
+ import { useDictionaryDynamic as _ } from "./client/useDictionaryDynamic.mjs";
11
11
  import { useIntlayer as v } from "./client/useIntlayer.mjs";
12
12
  import { useLocale as y } from "./client/useLocale.mjs";
13
13
  import { useLocaleBase as b } from "./client/useLocaleBase.mjs";
14
- import { useRewriteURL as x } from "./client/useRewriteURL.mjs";
15
- import { useAnalytics as S } from "./analytics/useAnalytics.mjs";
16
- import { AnalyticsProvider as C } from "./analytics/AnalyticsProvider.mjs";
17
- import { useConversion as w } from "./analytics/useConversion.mjs";
18
- import { useExperiment as T } from "./analytics/useExperiment.mjs";
14
+ import { usePathname as x } from "./client/usePathname.mjs";
15
+ import { useRewriteURL as S } from "./client/useRewriteURL.mjs";
16
+ import { useAnalytics as C } from "./analytics/useAnalytics.mjs";
17
+ import { AnalyticsProvider as w } from "./analytics/AnalyticsProvider.mjs";
18
+ import { useConversion as T } from "./analytics/useConversion.mjs";
19
+ import { useExperiment as E } from "./analytics/useExperiment.mjs";
19
20
  import "./analytics/index.mjs";
20
- export { C as AnalyticsProvider, s as IntlayerClientContext, c as IntlayerProvider, l as IntlayerProviderContent, e as getBrowserLocale, f as getDictionary, _ as getIntlayer, t as localeCookie, n as localeInStorage, r as setLocaleCookie, i as setLocaleInStorage, d as t, S as useAnalytics, w as useConversion, m as useDictionary, h as useDictionaryAsync, g as useDictionaryDynamic, T as useExperiment, v as useIntlayer, u as useIntlayerContext, p as useLoadDynamic, y as useLocale, b as useLocaleBase, a as useLocaleCookie, o as useLocaleStorage, x as useRewriteURL };
21
+ export { w as AnalyticsProvider, l as IntlayerClientContext, u as IntlayerProvider, d as IntlayerProviderContent, n as getBrowserLocale, e as getDictionary, t as getIntlayer, r as localeCookie, i as localeInStorage, a as setLocaleCookie, o as setLocaleInStorage, p as t, C as useAnalytics, T as useConversion, h as useDictionary, g as useDictionaryAsync, _ as useDictionaryDynamic, E as useExperiment, v as useIntlayer, f as useIntlayerContext, m as useLoadDynamic, y as useLocale, b as useLocaleBase, s as useLocaleCookie, c as useLocaleStorage, x as usePathname, S as useRewriteURL };
@@ -1,35 +1,35 @@
1
1
  import { compileMarkdown as e } from "./compiler.mjs";
2
- import { createContext as t, useContext as n } from "solid-js";
3
- import { createComponent as r } from "solid-js/web";
2
+ import { createComponent as t } from "solid-js/web";
3
+ import { createContext as n, useContext as r } from "solid-js";
4
4
  //#region src/markdown/MarkdownProvider.tsx
5
- var i = t(), a = (t) => {
6
- let n = (n, r, i, a) => {
7
- if (t.renderMarkdown) return t.renderMarkdown(n, r, i, a);
5
+ var i = n(), a = (n) => {
6
+ let r = (t, r, i, a) => {
7
+ if (n.renderMarkdown) return n.renderMarkdown(t, r, i, a);
8
8
  let o = {
9
- forceBlock: r?.forceBlock ?? t.forceBlock,
10
- preserveFrontmatter: r?.preserveFrontmatter ?? t.preserveFrontmatter,
11
- tagfilter: r?.tagfilter ?? t.tagfilter,
12
- wrapper: a || t.wrapper,
9
+ forceBlock: r?.forceBlock ?? n.forceBlock,
10
+ preserveFrontmatter: r?.preserveFrontmatter ?? n.preserveFrontmatter,
11
+ tagfilter: r?.tagfilter ?? n.tagfilter,
12
+ wrapper: a || n.wrapper,
13
13
  components: {
14
- ...t.components,
14
+ ...n.components,
15
15
  ...i ?? {}
16
16
  }
17
17
  };
18
- return e(n, o);
18
+ return e(t, o);
19
19
  };
20
- return r(i.Provider, {
20
+ return t(i.Provider, {
21
21
  get value() {
22
22
  return {
23
- components: t.components,
24
- renderMarkdown: n
23
+ components: n.components,
24
+ renderMarkdown: r
25
25
  };
26
26
  },
27
27
  get children() {
28
- return t.children;
28
+ return n.children;
29
29
  }
30
30
  });
31
31
  }, o = () => {
32
- let e = n(i);
32
+ let e = r(i);
33
33
  if (!e) throw Error("useMarkdown must be used within a MarkdownProvider. To fix this error, wrap your component with <MarkdownProvider>.");
34
34
  return e;
35
35
  };
@@ -1,39 +1,39 @@
1
1
  import { compileMarkdown as e } from "./compiler.mjs";
2
2
  import { MarkdownContext as t, useMarkdown as n } from "./MarkdownProvider.mjs";
3
- import { Suspense as r, createMemo as i, createResource as a, useContext as o } from "solid-js";
4
- import { createComponent as s } from "solid-js/web";
5
- import { getContentNodeByKeyPath as c } from "@intlayer/core/dictionaryManipulator";
6
- import { getMarkdownMetadata as l } from "@intlayer/core/markdown";
3
+ import { createComponent as r } from "solid-js/web";
4
+ import { getMarkdownMetadata as i } from "@intlayer/core/markdown";
5
+ import { Suspense as a, createMemo as o, createResource as s, useContext as c } from "solid-js";
6
+ import { getContentNodeByKeyPath as l } from "@intlayer/core/dictionaryManipulator";
7
7
  //#region src/markdown/MarkdownRenderer.tsx
8
8
  var u = (t, n = {}) => e(t, n), d = (e = {}) => {
9
- let n = o(t);
9
+ let n = c(t);
10
10
  return (t) => n ? n.renderMarkdown(t, {
11
11
  forceBlock: e.forceBlock,
12
12
  preserveFrontmatter: e.preserveFrontmatter,
13
13
  tagfilter: e.tagfilter
14
14
  }, e.components, e.wrapper) : u(t, e);
15
15
  }, f = (e) => {
16
- let i = o(t), { renderMarkdown: c } = n(), [l] = a(() => [
16
+ let i = c(t), { renderMarkdown: o } = n(), [l] = s(() => [
17
17
  e.children,
18
18
  e.forceBlock,
19
19
  e.preserveFrontmatter,
20
20
  e.tagfilter,
21
21
  e.components,
22
22
  e.wrapper
23
- ], ([e, t, n, r, a, o]) => c(e, {
23
+ ], ([e, t, n, r, a, s]) => o(e, {
24
24
  forceBlock: t,
25
25
  preserveFrontmatter: n,
26
26
  tagfilter: r
27
27
  }, {
28
28
  ...i?.components ?? {},
29
29
  ...a ?? {}
30
- }, o));
31
- return s(r, { get children() {
30
+ }, s));
31
+ return r(a, { get children() {
32
32
  return l();
33
33
  } });
34
34
  }, p = (e) => {
35
- let t = i(() => l(e.children));
36
- return i(() => c(t(), e.metadataKeyPath))();
35
+ let t = o(() => i(e.children));
36
+ return o(() => l(t(), e.metadataKeyPath))();
37
37
  };
38
38
  //#endregion
39
39
  export { p as MarkdownMetadataRenderer, f as MarkdownRenderer, u as renderMarkdown, d as useMarkdownRenderer };
@@ -1,14 +1,14 @@
1
1
  import { reportExposure as e } from "./analytics/exposureSink.mjs";
2
2
  import { renderIntlayerNode as t } from "./IntlayerNode.mjs";
3
3
  import { renderSolidElement as n } from "./solidElement/renderSolidElement.mjs";
4
- import { editor as r, internationalization as i } from "@intlayer/config/built";
5
- import { Suspense as a, lazy as o } from "solid-js";
6
- import { createComponent as s, mergeProps as c } from "solid-js/web";
7
- import { bindInsertedValues as l, conditionPlugin as u, enumerationPlugin as d, fallbackPlugin as f, filePlugin as p, genderPlugin as m, isInterpolableWrapperNode as h, nestedPlugin as g, pluralPlugin as _, selectPlugin as v, splitInsertionTemplate as y, transformInterpolableNode as b, translationPlugin as x } from "@intlayer/core/interpreter";
8
- import { getMarkdownMetadata as S } from "@intlayer/core/markdown";
9
- import * as C from "@intlayer/types/nodeType";
4
+ import { bindInsertedValues as r, conditionPlugin as i, enumerationPlugin as a, fallbackPlugin as o, filePlugin as s, genderPlugin as c, isInterpolableWrapperNode as l, nestedPlugin as u, pluralPlugin as d, selectPlugin as f, splitInsertionTemplate as p, transformInterpolableNode as m, translationPlugin as h } from "@intlayer/core/interpreter";
5
+ import { createComponent as g, mergeProps as _ } from "solid-js/web";
6
+ import { editor as v, internationalization as y } from "@intlayer/config/built";
7
+ import { getMarkdownMetadata as b } from "@intlayer/core/markdown";
8
+ import * as x from "@intlayer/types/nodeType";
9
+ import { Suspense as S, lazy as C } from "solid-js";
10
10
  //#region src/plugins.tsx
11
- var w = process.env.INTLAYER_EDITOR_ENABLED === "false" ? null : o(() => import("./editor/ContentSelector.mjs").then((e) => ({ default: e.ContentSelector }))), T = process.env.INTLAYER_NODE_TYPE_MARKDOWN === "false" ? null : import("./markdown/MarkdownRenderer.mjs").then((e) => ({
11
+ var w = process.env.INTLAYER_EDITOR_ENABLED === "false" ? null : C(() => import("./editor/ContentSelector.mjs").then((e) => ({ default: e.ContentSelector }))), T = process.env.INTLAYER_NODE_TYPE_MARKDOWN === "false" ? null : import("./markdown/MarkdownRenderer.mjs").then((e) => ({
12
12
  MarkdownRenderer: e.MarkdownRenderer,
13
13
  MarkdownMetadataRenderer: e.MarkdownMetadataRenderer
14
14
  })), E = process.env.INTLAYER_NODE_TYPE_HTML === "false" ? null : import("./html/HTMLRenderer.mjs").then((e) => e.HTMLRenderer);
@@ -16,61 +16,69 @@ T?.catch(() => {}), E?.catch(() => {});
16
16
  var D = {
17
17
  id: "intlayer-node-plugin",
18
18
  canHandle: (e) => typeof e == "bigint" || typeof e == "string" || typeof e == "number",
19
- transform: (n, { plugins: i, ...o }) => (process.env.INTLAYER_ANALYTICS_ENABLED !== "false" && e({
20
- dictionaryKey: o.dictionaryKey,
21
- keyPath: o.keyPath,
22
- locale: o.locale,
23
- nodeType: "text"
24
- }), t({
25
- ...o,
26
- value: o.children,
27
- children: process.env.INTLAYER_EDITOR_ENABLED !== "false" && r.enabled ? s(a, {
28
- get fallback() {
29
- return o.children;
30
- },
31
- get children() {
32
- return s(w, c(o, { get children() {
33
- return o.children;
34
- } }));
35
- }
36
- }) : o.children
37
- }))
38
- }, O = process.env.INTLAYER_NODE_TYPE_SOLID_NODE === "false" ? f : {
19
+ transform: (n, r) => {
20
+ if (process.env.INTLAYER_ANALYTICS_ENABLED !== "false" && e({
21
+ dictionaryKey: r.dictionaryKey,
22
+ keyPath: r.keyPath,
23
+ locale: r.locale,
24
+ nodeType: "text"
25
+ }), process.env.INTLAYER_EDITOR_ENABLED !== "false" && v.enabled) {
26
+ let { plugins: e, ...n } = r;
27
+ return t({
28
+ value: n.children,
29
+ children: g(S, {
30
+ get fallback() {
31
+ return n.children;
32
+ },
33
+ get children() {
34
+ return g(w, _(n, { get children() {
35
+ return n.children;
36
+ } }));
37
+ }
38
+ })
39
+ });
40
+ }
41
+ return t({
42
+ value: r.children,
43
+ children: r.children
44
+ });
45
+ }
46
+ }, O = process.env.INTLAYER_NODE_TYPE_SOLID_NODE === "false" ? o : {
39
47
  id: "solid-node-plugin",
40
48
  canHandle: (e) => typeof e == "object" && e?.props !== void 0 || typeof Node < "u" && e instanceof Node,
41
- transform: (i, { plugins: o, ...l }) => (process.env.INTLAYER_ANALYTICS_ENABLED !== "false" && e({
42
- dictionaryKey: l.dictionaryKey,
43
- keyPath: l.keyPath,
44
- locale: l.locale,
49
+ transform: (r, { plugins: i, ...a }) => (process.env.INTLAYER_ANALYTICS_ENABLED !== "false" && e({
50
+ dictionaryKey: a.dictionaryKey,
51
+ keyPath: a.keyPath,
52
+ locale: a.locale,
45
53
  nodeType: "solid-node"
46
54
  }), t({
47
- ...l,
55
+ ...a,
48
56
  value: "[[solid-element]]",
49
- children: process.env.INTLAYER_EDITOR_ENABLED !== "false" && r.enabled ? s(a, {
57
+ children: process.env.INTLAYER_EDITOR_ENABLED !== "false" && v.enabled ? g(S, {
50
58
  get fallback() {
51
- return typeof Node < "u" && i instanceof Node ? i : n(i);
59
+ return typeof Node < "u" && r instanceof Node ? r : n(r);
52
60
  },
53
61
  get children() {
54
- return s(w, c(l, { get children() {
55
- return typeof Node < "u" && i instanceof Node ? i : n(i);
62
+ return g(w, _(a, { get children() {
63
+ return typeof Node < "u" && r instanceof Node ? r : n(r);
56
64
  } }));
57
65
  }
58
- }) : typeof Node < "u" && i instanceof Node ? i : n(i)
66
+ }) : typeof Node < "u" && r instanceof Node ? r : n(r)
59
67
  }))
60
68
  }, k = (e, t) => {
61
- let n = y(e, t);
69
+ let n = p(e, t);
62
70
  return n.isSimple, n.parts;
63
- }, A = process.env.INTLAYER_NODE_TYPE_INSERTION === "false" ? f : {
71
+ }, A = process.env.INTLAYER_NODE_TYPE_INSERTION === "false" ? o : {
64
72
  id: "insertion-plugin",
65
- canHandle: (e) => typeof e == "object" && e?.nodeType === C.INSERTION,
73
+ canHandle: (e) => typeof e == "object" && e?.nodeType === x.INSERTION,
66
74
  transform: (e, t, n) => {
67
- let r = [...t.keyPath, { type: C.INSERTION }], i = e[C.INSERTION];
75
+ let i = [...t.keyPath, { type: x.INSERTION }], a = e[x.INSERTION];
68
76
  return (e) => {
69
- let a = {
77
+ let o = {
70
78
  id: "insertion-string-plugin",
71
- canHandle: (e) => typeof e == "string" || h(e),
79
+ canHandle: (e) => typeof e == "string" || l(e),
72
80
  transform: (n, r, i) => {
73
- if (h(n)) return b(n, e, r, t.plugins, i);
81
+ if (l(n)) return m(n, e, r, t.plugins, i);
74
82
  let a = k(i(n, {
75
83
  ...r,
76
84
  children: n,
@@ -82,76 +90,71 @@ var D = {
82
90
  children: a
83
91
  });
84
92
  }
85
- }, o = n(i, {
93
+ }, s = n(a, {
86
94
  ...t,
87
- children: i,
88
- keyPath: r,
89
- plugins: [a, ...t.plugins ?? []]
95
+ children: a,
96
+ keyPath: i,
97
+ plugins: [o, ...t.plugins ?? []]
90
98
  });
91
- return l(i, o, e, !0);
99
+ return r(a, s, e, !0);
92
100
  };
93
101
  }
94
- }, j = o(() => T.then((e) => ({ default: e.MarkdownRenderer }))), M = o(() => T.then((e) => ({ default: e.MarkdownMetadataRenderer }))), N = process.env.INTLAYER_NODE_TYPE_MARKDOWN === "false" ? f : {
102
+ }, j = C(() => T.then((e) => ({ default: e.MarkdownRenderer }))), M = C(() => T.then((e) => ({ default: e.MarkdownMetadataRenderer }))), N = process.env.INTLAYER_NODE_TYPE_MARKDOWN === "false" ? o : {
95
103
  id: "markdown-string-plugin",
96
104
  canHandle: (e) => typeof e == "string",
97
- transform: (e, n, i) => {
98
- let { plugins: o, ...l } = n, u = i(S(e) ?? {}, {
105
+ transform: (e, n, r) => {
106
+ let { plugins: i, ...a } = n, o = r(b(e) ?? {}, {
99
107
  plugins: [{
100
108
  id: "markdown-metadata-plugin",
101
109
  canHandle: (e) => typeof e == "string" || typeof e == "number" || typeof e == "boolean" || !e,
102
- transform: (n, i) => t({
103
- ...i,
110
+ transform: (n, r) => t({
111
+ ...r,
104
112
  value: n,
105
- children: process.env.INTLAYER_EDITOR_ENABLED !== "false" && r.enabled ? s(a, { get children() {
106
- return s(w, c(l, { get children() {
107
- return s(M, c(l, {
113
+ children: process.env.INTLAYER_EDITOR_ENABLED !== "false" && v.enabled ? g(S, { get children() {
114
+ return g(w, _(a, { get children() {
115
+ return g(M, _(a, {
108
116
  get metadataKeyPath() {
109
- return i.keyPath;
117
+ return r.keyPath;
110
118
  },
111
119
  children: e
112
120
  }));
113
121
  } }));
114
- } }) : s(M, c(l, {
122
+ } }) : g(M, _(a, {
115
123
  get metadataKeyPath() {
116
- return i.keyPath;
124
+ return r.keyPath;
117
125
  },
118
126
  children: e
119
127
  }))
120
128
  })
121
129
  }],
122
- dictionaryKey: l.dictionaryKey,
130
+ dictionaryKey: a.dictionaryKey,
123
131
  keyPath: []
124
- }), d = (i) => t({
132
+ }), s = (r) => t({
125
133
  ...n,
126
134
  value: e,
127
- children: process.env.INTLAYER_EDITOR_ENABLED !== "false" && r.enabled ? s(a, { get children() {
128
- return s(w, c(l, { get children() {
129
- return s(j, c(l, {
130
- components: i,
135
+ children: process.env.INTLAYER_EDITOR_ENABLED !== "false" && v.enabled ? g(S, { get children() {
136
+ return g(w, _(a, { get children() {
137
+ return g(j, _(a, {
138
+ components: r,
131
139
  children: e
132
140
  }));
133
141
  } }));
134
- } }) : s(j, c(l, {
135
- components: i,
142
+ } }) : g(j, _(a, {
143
+ components: r,
136
144
  children: e
137
145
  })),
138
- additionalProps: { metadata: u }
139
- }), f = d();
140
- return new Proxy(f, { get(t, n, r) {
141
- if (n === "value") return e;
142
- if (n === Symbol.toPrimitive || n === "toString" || n === "valueOf") return () => e;
143
- if (typeof n == "string" && n !== "constructor") {
144
- let t = String.prototype[n];
145
- if (typeof t == "function") return t.bind(e);
146
+ additionalProps: {
147
+ metadata: o,
148
+ use: s
146
149
  }
147
- return n === "metadata" ? u : n === "use" ? (e) => d(e) : Reflect.get(t, n, r);
148
- } });
150
+ });
151
+ return s();
149
152
  }
150
- }, P = process.env.INTLAYER_NODE_TYPE_MARKDOWN === "false" ? f : {
153
+ }, P = process.env.INTLAYER_NODE_TYPE_MARKDOWN === "false" ? o : {
151
154
  id: "markdown-plugin",
152
- canHandle: (e) => typeof e == "object" && e?.nodeType === C.MARKDOWN,
155
+ canHandle: (e) => typeof e == "object" && e?.nodeType === x.MARKDOWN,
153
156
  transform: (e, t, n) => {
154
- let r = [...t.keyPath, { type: C.MARKDOWN }], i = e[C.MARKDOWN];
157
+ let r = [...t.keyPath, { type: x.MARKDOWN }], i = e[x.MARKDOWN];
155
158
  return n(i, {
156
159
  ...t,
157
160
  children: i,
@@ -159,53 +162,46 @@ var D = {
159
162
  plugins: [N, ...t.plugins ?? []]
160
163
  });
161
164
  }
162
- }, F = o(() => E.then((e) => ({ default: e }))), I = process.env.INTLAYER_NODE_TYPE_HTML === "false" ? f : {
165
+ }, F = C(() => E.then((e) => ({ default: e }))), I = process.env.INTLAYER_NODE_TYPE_HTML === "false" ? o : {
163
166
  id: "html-plugin",
164
- canHandle: (e) => typeof e == "object" && e?.nodeType === C.HTML,
167
+ canHandle: (e) => typeof e == "object" && e?.nodeType === x.HTML,
165
168
  transform: (e, n) => {
166
- let i = e[C.HTML], { plugins: o, children: l, ...u } = n, d = (e) => t({
167
- ...u,
168
- value: i,
169
- children: process.env.INTLAYER_EDITOR_ENABLED !== "false" && r.enabled ? s(a, { get children() {
170
- return s(w, c(u, { get children() {
171
- return s(F, c(u, {
172
- html: i,
169
+ let r = e[x.HTML], { plugins: i, children: a, ...o } = n, s = (e) => t({
170
+ ...o,
171
+ value: r,
172
+ children: process.env.INTLAYER_EDITOR_ENABLED !== "false" && v.enabled ? g(S, { get children() {
173
+ return g(w, _(o, { get children() {
174
+ return g(F, _(o, {
175
+ html: r,
173
176
  components: e
174
177
  }));
175
178
  } }));
176
- } }) : s(F, c(u, {
177
- html: i,
179
+ } }) : g(F, _(o, {
180
+ html: r,
178
181
  components: e
179
- }))
180
- }), f = [d()];
181
- return new Proxy(f, { get(e, t, n) {
182
- if (t === "value") return i;
183
- if (t === Symbol.toPrimitive || t === "toString" || t === "valueOf") return () => i;
184
- if (typeof t == "string" && t !== "constructor") {
185
- let e = String.prototype[t];
186
- if (typeof e == "function") return e.bind(i);
187
- }
188
- return t === "use" ? (e) => d(e) : Reflect.get(e, t, n);
189
- } });
182
+ })),
183
+ additionalProps: { use: s }
184
+ });
185
+ return s();
190
186
  }
191
187
  }, L = /* @__PURE__ */ new Map(), R = (e, t = !0) => {
192
- let n = `${e ?? i.defaultLocale}_${t}`;
188
+ let n = `${e ?? y.defaultLocale}_${t}`;
193
189
  if (L.has(n)) return L.get(n);
194
190
  let r = [
195
- x(e ?? i.defaultLocale, t ? i.defaultLocale : void 0),
196
- d,
197
- _(e ?? i.defaultLocale),
198
- u,
199
- g(e ?? i.defaultLocale),
200
- p,
201
- m,
202
- v,
203
191
  D,
192
+ h(e ?? y.defaultLocale, t ? y.defaultLocale : void 0),
193
+ a,
194
+ d(e ?? y.defaultLocale),
195
+ i,
196
+ u(e ?? y.defaultLocale),
197
+ s,
198
+ c,
199
+ f,
204
200
  O,
205
201
  A,
206
202
  P,
207
203
  I
208
- ];
204
+ ].filter((e) => e !== o);
209
205
  return L.set(n, r), r;
210
206
  };
211
207
  //#endregion
@@ -1,12 +1,9 @@
1
1
  //#region src/proxyKeys.ts
2
2
  var e = {
3
- constructor: "constructor",
4
- length: "length",
5
- slice: "slice",
6
3
  promiseThen: "then",
7
4
  toString: "toString",
8
5
  valueOf: "valueOf",
9
6
  value: "value"
10
- }, t = (e) => typeof e == "string" && /^\d+$/.test(e);
7
+ };
11
8
  //#endregion
12
- export { e as PROXY_RESERVED_KEYS, t as isArrayIndexProperty };
9
+ export { e as PROXY_RESERVED_KEYS };
@@ -1 +1 @@
1
- const e=require("./isEnabled-CuTKz0YA.js");let t=require("@intlayer/config/built");var n=e=>{let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return t>>>0},r=(e,t,r,i)=>{if(r.length===0)throw Error(`assignVariant requires at least one variant`);if(r.length===1)return r[0];let a=n(`${e}:${t}`)/4294967296;if(!i||i.length!==r.length){let e=Math.floor(a*r.length);return r[Math.min(e,r.length-1)]}let o=i.reduce((e,t)=>e+t,0);if(o<=0)return r[Math.floor(a*r.length)];let s=0,c=a*o;for(let e=0;e<r.length;e++)if(s+=i[e],c<s)return r[e];return r[r.length-1]},i=``,a=e=>[e.url,e.dictionaryKey,e.keyPath,e.locale,e.experimentKey??``,e.variant??``].join(i),o=({max:e})=>{let t=[],n=new Map,r=()=>t.length+n.size,i=()=>{for(;r()>e&&n.size>0;){let e=n.keys().next().value;n.delete(e)}r()>e&&(t=t.slice(r()-e))};return{push:e=>{if(e.type===`content_exposure`){let t=a(e),r=n.get(t);r?(r.count=(r.count??1)+(e.count??1),r.t=e.t):n.set(t,{...e,count:e.count??1})}else t.push(e);return i(),r()},drain:()=>{let e=[...t,...n.values()];return t=[],n.clear(),e},size:r}},s=(e,t)=>t>=1?!0:t<=0?!1:n(e)/4294967295<t,c=`__intlayer_analytics_sid__`,l=()=>{let e=typeof globalThis<`u`?globalThis.crypto:void 0;return e?.randomUUID?e.randomUUID():`${Date.now().toString(36)}-${Math.random().toString(36).slice(2,10)}`},u=()=>{if(typeof window>`u`||!window.sessionStorage)return l();try{let e=window.sessionStorage.getItem(c);if(e)return e;let t=l();return window.sessionStorage.setItem(c,t),t}catch{return l()}},d=(e,t,{useBeacon:n=!1,token:r}={})=>{try{let i=JSON.stringify(t);return n&&typeof navigator<`u`&&typeof navigator.sendBeacon==`function`?navigator.sendBeacon(e,i):typeof fetch==`function`&&(fetch(e,{method:`POST`,headers:{"Content-Type":`application/json`,...r?{Authorization:`Bearer ${r}`}:{}},body:i,keepalive:!0,credentials:`omit`,mode:`cors`}).catch(()=>{}),!0)}catch{return!1}},f=e=>{if(typeof window>`u`)return;let t=window.requestIdleCallback;if(typeof t==`function`){t(()=>e());return}setTimeout(e,1)},p=`__intlayer_public_token__`,m=6e4,h=()=>{try{let e=window.sessionStorage?.getItem(p);if(!e)return null;let t=JSON.parse(e);return typeof t?.token!=`string`||typeof t?.expiresAt!=`number`?null:t}catch{return null}},g=e=>{try{window.sessionStorage?.setItem(p,JSON.stringify(e))}catch{}},_=({backendURL:e,clientId:t})=>{let n=`${e.replace(/\/$/,``)}/api/public/token`,r=null,i=null,a=e=>e!==null&&e.expiresAt-m>Date.now(),o=()=>{if(a(r))return r.token;if(typeof window<`u`){let e=h();if(a(e))return r=e,e.token}},s=async()=>{try{let e=await fetch(n,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({clientId:t}),credentials:`omit`,mode:`cors`});if(!e.ok)return;let i=await e.json(),a=i?.data?.token,o=i?.data?.expiresIn??0;if(!a||o<=0)return;r={token:a,expiresAt:Date.now()+o*1e3},typeof window<`u`&&g(r)}catch{}finally{i=null}};return{getToken:o,prime:()=>{t&&typeof fetch==`function`&&(o()||(i||=s()))}}},v=`intlayer-analytics/1`,y=()=>typeof window>`u`||!window.location?``:window.location.pathname,b=()=>{if(!(typeof document>`u`||!document.referrer))try{return new URL(document.referrer).host}catch{return}},x=t=>{let n=u(),i=e.r(),a=!i&&s(n,t.sampleRate),c=o({max:t.maxBufferSize}),l=`${t.backendURL.replace(/\/$/,``)}/api/analytics/events`,p=_({backendURL:t.backendURL,clientId:t.clientId}),m=``,h=null,g=!1,x=null,S=null,C=new Set,w=(e=!1)=>{let r=c.drain(),i=p.getToken();for(let a=0;a<r.length;a+=200)d(l,{token:i,clientId:i?void 0:t.clientId,sessionId:n,sdkVersion:v,events:r.slice(a,a+200)},{useBeacon:e,token:i})},T=e=>{c.push(e)>=t.maxBufferSize&&w()},E=e=>{m=e},D=(e={})=>{if(!a)return;let t=e.url??y(),n=e.reason??`initial`;(n!==`route_change`||t!==S)&&(S=t,C=new Set,T({type:`page_view`,t:Date.now(),url:t,locale:e.locale??m,ref:e.ref??b(),vw:e.vw??(typeof window<`u`?window.innerWidth:void 0),vh:e.vh??(typeof window<`u`?window.innerHeight:void 0),reason:n}))},O=e=>{if(!a)return;let t=e.locale??m,n=[e.dictionaryKey,e.keyPath,t,e.experimentKey??``,e.variant??``].join(``);C.has(n)||(C.add(n),T({...e,type:`content_exposure`,t:Date.now(),url:y(),locale:t}))},k=e=>{i||(T({...e,type:`conversion`,t:Date.now(),url:y(),locale:e.locale??m}),w())},A=(e,t,i)=>r(n,e,t,i),j=()=>{if(typeof window>`u`)return;let e=()=>{document.visibilityState===`hidden`&&w(!0)},t=()=>w(!0),n=()=>D({reason:`route_change`});document.addEventListener(`visibilitychange`,e),window.addEventListener(`pagehide`,t,{capture:!0}),window.addEventListener(`popstate`,n);let r=window.history,i=r.pushState,a=function(...e){let t=i.apply(this,e);return D({reason:`route_change`}),t};r.pushState=a,x=()=>{document.removeEventListener(`visibilitychange`,e),window.removeEventListener(`pagehide`,t,{capture:!0}),window.removeEventListener(`popstate`,n),r.pushState===a&&(r.pushState=i)}};return{setLocale:E,trackPageView:D,trackContentExposure:O,trackConversion:k,getVariant:A,flush:w,start:()=>{g||i||(g=!0,p.prime(),h=setInterval(w,t.flushInterval),h?.unref?.(),f(j))},stop:()=>{g&&(g=!1,h&&=(clearInterval(h),null),x?.(),x=null,w(!0))}}},S=`__intlayer_analytics_client__`,C=`__intlayer_analytics_ref_count__`,w=()=>typeof window>`u`?null:window[S]??null,T=e=>{typeof window>`u`||(window[S]=e)},E=()=>{if(typeof window>`u`)return 0;let e=window;return e[C]=(e[C]??0)+1,e[C]},D=()=>{if(typeof window>`u`)return 0;let e=window;return e[C]=Math.max(0,(e[C]??0)-1),e[C]},O=()=>{E();let e=w();if(e)return e;let n=x({backendURL:t.editor?.backendURL??``,clientId:t.editor?.clientId,flushInterval:t.analytics?.flushInterval??2e4,maxBufferSize:500,sampleRate:t.analytics?.sampleRate??1});return T(n),n.start(),n},k=()=>{D()>0||(w()?.stop(),T(null))},A=e=>e.map(e=>e.key===void 0?`*`:String(e.key)).join(`.`),j=e=>({dictionaryKey:e.dictionaryKey,keyPath:A(e.keyPath),locale:e.locale,nodeType:e.nodeType,experimentKey:e.experimentKey,variant:e.variant});exports.buildContentExposure=j,exports.getGlobalAnalyticsClient=w,exports.initAnalyticsClient=O,exports.stopAnalyticsClient=k;
1
+ const e=require("./isEnabled-CuTKz0YA.js");let t=require("@intlayer/config/built");var n=e=>{let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return t>>>0},r=(e,t,r,i)=>{if(r.length===0)throw Error(`assignVariant requires at least one variant`);if(r.length===1)return r[0];let a=n(`${e}:${t}`)/4294967296;if(!i||i.length!==r.length){let e=Math.floor(a*r.length);return r[Math.min(e,r.length-1)]}let o=i.reduce((e,t)=>e+t,0);if(o<=0)return r[Math.floor(a*r.length)];let s=0,c=a*o;for(let e=0;e<r.length;e++)if(s+=i[e],c<s)return r[e];return r[r.length-1]},i=``,a=e=>[e.url,e.dictionaryKey,e.keyPath,e.locale,e.experimentKey??``,e.variant??``].join(i),o=({max:e})=>{let t=[],n=new Map,r=()=>t.length+n.size,i=()=>{for(;r()>e&&n.size>0;){let e=n.keys().next().value;n.delete(e)}r()>e&&(t=t.slice(r()-e))};return{push:e=>{if(e.type===`content_exposure`){let t=a(e),r=n.get(t);r?(r.count=(r.count??1)+(e.count??1),r.t=e.t):n.set(t,{...e,count:e.count??1})}else t.push(e);return i(),r()},drain:()=>{let e=[...t,...n.values()];return t=[],n.clear(),e},size:r}},s=(e,t)=>t>=1?!0:t<=0?!1:n(e)/4294967295<t,c=`__intlayer_analytics_sid__`,l=()=>{let e=typeof globalThis<`u`?globalThis.crypto:void 0;return e?.randomUUID?e.randomUUID():`${Date.now().toString(36)}-${Math.random().toString(36).slice(2,10)}`},u=()=>{if(typeof window>`u`||!window.sessionStorage)return l();try{let e=window.sessionStorage.getItem(c);if(e)return e;let t=l();return window.sessionStorage.setItem(c,t),t}catch{return l()}},d=(e,t,{useBeacon:n=!1,token:r}={})=>{try{let i=JSON.stringify(t);return n&&typeof navigator<`u`&&typeof navigator.sendBeacon==`function`?navigator.sendBeacon(e,i):typeof fetch==`function`&&(fetch(e,{method:`POST`,headers:{"Content-Type":`application/json`,...r?{Authorization:`Bearer ${r}`}:{}},body:i,keepalive:!0,credentials:`omit`,mode:`cors`}).catch(()=>{}),!0)}catch{return!1}},f=e=>{if(typeof window>`u`)return;let t=window.requestIdleCallback;if(typeof t==`function`){t(()=>e());return}setTimeout(e,1)},p=`__intlayer_public_token__`,m=6e4,h=()=>{try{let e=window.sessionStorage?.getItem(p);if(!e)return null;let t=JSON.parse(e);return typeof t?.token!=`string`||typeof t?.expiresAt!=`number`?null:t}catch{return null}},g=e=>{try{window.sessionStorage?.setItem(p,JSON.stringify(e))}catch{}},_=({backendURL:e,clientId:t})=>{let n=`${e.replace(/\/$/,``)}/api/public/token`,r=null,i=null,a=e=>e!==null&&e.expiresAt-m>Date.now(),o=()=>{if(a(r))return r.token;if(typeof window<`u`){let e=h();if(a(e))return r=e,e.token}},s=async()=>{try{let e=await fetch(n,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({clientId:t}),credentials:`omit`,mode:`cors`});if(!e.ok)return;let i=await e.json(),a=i?.data?.token,o=i?.data?.expiresIn??0;if(!a||o<=0)return;r={token:a,expiresAt:Date.now()+o*1e3},typeof window<`u`&&g(r)}catch{}finally{i=null}};return{getToken:o,prime:()=>{t&&typeof fetch==`function`&&(o()||(i||=s()))}}},v=`intlayer-analytics/1`,y=()=>typeof window>`u`||!window.location?``:window.location.pathname,b=()=>{if(typeof document<`u`&&document.referrer)try{return new URL(document.referrer).host}catch{return}},x=t=>{let n=u(),i=e.r(),a=!i&&s(n,t.sampleRate),c=o({max:t.maxBufferSize}),l=`${t.backendURL.replace(/\/$/,``)}/api/analytics/events`,p=_({backendURL:t.backendURL,clientId:t.clientId}),m=``,h=null,g=!1,x=null,S=null,C=new Set,w=(e=!1)=>{let r=c.drain(),i=p.getToken();for(let a=0;a<r.length;a+=200)d(l,{token:i,clientId:i?void 0:t.clientId,sessionId:n,sdkVersion:v,events:r.slice(a,a+200)},{useBeacon:e,token:i})},T=e=>{c.push(e)>=t.maxBufferSize&&w()},E=e=>{m=e},D=(e={})=>{if(!a)return;let t=e.url??y(),n=e.reason??`initial`;(n!==`route_change`||t!==S)&&(S=t,C=new Set,T({type:`page_view`,t:Date.now(),url:t,locale:e.locale??m,ref:e.ref??b(),vw:e.vw??(typeof window<`u`?window.innerWidth:void 0),vh:e.vh??(typeof window<`u`?window.innerHeight:void 0),reason:n}))},O=e=>{if(!a)return;let t=e.locale??m,n=[e.dictionaryKey,e.keyPath,t,e.experimentKey??``,e.variant??``].join(``);C.has(n)||(C.add(n),T({...e,type:`content_exposure`,t:Date.now(),url:y(),locale:t}))},k=e=>{i||(T({...e,type:`conversion`,t:Date.now(),url:y(),locale:e.locale??m}),w())},A=(e,t,i)=>r(n,e,t,i),j=()=>{if(typeof window>`u`)return;let e=()=>{document.visibilityState===`hidden`&&w(!0)},t=()=>w(!0),n=()=>D({reason:`route_change`});document.addEventListener(`visibilitychange`,e),window.addEventListener(`pagehide`,t,{capture:!0}),window.addEventListener(`popstate`,n);let r=window.history,i=r.pushState,a=function(...e){let t=i.apply(this,e);return D({reason:`route_change`}),t};r.pushState=a,x=()=>{document.removeEventListener(`visibilitychange`,e),window.removeEventListener(`pagehide`,t,{capture:!0}),window.removeEventListener(`popstate`,n),r.pushState===a&&(r.pushState=i)}};return{setLocale:E,trackPageView:D,trackContentExposure:O,trackConversion:k,getVariant:A,flush:w,start:()=>{g||i||(g=!0,p.prime(),h=setInterval(w,t.flushInterval),h?.unref?.(),f(j))},stop:()=>{g&&(g=!1,h&&=(clearInterval(h),null),x?.(),x=null,w(!0))}}},S=`__intlayer_analytics_client__`,C=`__intlayer_analytics_ref_count__`,w=()=>typeof window>`u`?null:window[S]??null,T=e=>{typeof window<`u`&&(window[S]=e)},E=()=>{if(typeof window>`u`)return 0;let e=window;return e[C]=(e[C]??0)+1,e[C]},D=()=>{if(typeof window>`u`)return 0;let e=window;return e[C]=Math.max(0,(e[C]??0)-1),e[C]},O=()=>{E();let e=w();if(e)return e;let n=x({backendURL:t.editor?.backendURL??``,clientId:t.editor?.clientId,flushInterval:t.analytics?.flushInterval??2e4,maxBufferSize:500,sampleRate:t.analytics?.sampleRate??1});return T(n),n.start(),n},k=()=>{D()>0||(w()?.stop(),T(null))},A=e=>e.map(e=>e.key===void 0?`*`:String(e.key)).join(`.`),j=e=>({dictionaryKey:e.dictionaryKey,keyPath:A(e.keyPath),locale:e.locale,nodeType:e.nodeType,experimentKey:e.experimentKey,variant:e.variant});exports.buildContentExposure=j,exports.getGlobalAnalyticsClient=w,exports.initAnalyticsClient=O,exports.stopAnalyticsClient=k;
@@ -135,7 +135,7 @@ var r = (e) => {
135
135
  }
136
136
  };
137
137
  }, y = "intlayer-analytics/1", b = () => typeof window > "u" || !window.location ? "" : window.location.pathname, x = () => {
138
- if (!(typeof document > "u" || !document.referrer)) try {
138
+ if (typeof document < "u" && document.referrer) try {
139
139
  return new URL(document.referrer).host;
140
140
  } catch {
141
141
  return;
@@ -226,7 +226,7 @@ var r = (e) => {
226
226
  }
227
227
  };
228
228
  }, C = "__intlayer_analytics_client__", w = "__intlayer_analytics_ref_count__", T = () => typeof window > "u" ? null : window[C] ?? null, E = (e) => {
229
- typeof window > "u" || (window[C] = e);
229
+ typeof window < "u" && (window[C] = e);
230
230
  }, D = () => {
231
231
  if (typeof window > "u") return 0;
232
232
  let e = window;
@@ -3,7 +3,7 @@ import { StrictModeLocaleMap } from '@intlayer/types/module_augmentation';
3
3
  * On the client side, hook to get the translation content based on the locale
4
4
  */
5
5
  export declare const useContent: <Content>(languageContent: StrictModeLocaleMap<Content>) => {
6
- locale: import('intlayer').Locale;
6
+ locale: import('@intlayer/types').Locale;
7
7
  content: Content;
8
8
  t: <Content_1 = string>(languageContent: StrictModeLocaleMap<Content_1>) => Content_1;
9
9
  };