@plitzi/sdk-elements 0.32.25 → 0.33.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.
Files changed (59) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/dist/Element/ElementContext.d.ts +7 -0
  3. package/dist/Element/helpers/isVisible.d.ts +1 -0
  4. package/dist/Element/helpers/isVisible.mjs +4 -0
  5. package/dist/Element/hocs/withElement.mjs +86 -78
  6. package/dist/Element/hooks/useInternalClassName.mjs +21 -20
  7. package/dist/Element/hooks/useInternalItems.mjs +1 -1
  8. package/dist/Element/hooks/useRscData.d.ts +4 -3
  9. package/dist/Element/hooks/useRscData.mjs +15 -10
  10. package/dist/dataSource/GlobalSources.d.ts +1 -2
  11. package/dist/dataSource/GlobalSources.mjs +46 -62
  12. package/dist/elements/advanced/BlockJsx/BlockJsx.mjs +1 -1
  13. package/dist/elements/basic/Link/Link.mjs +47 -41
  14. package/dist/elements/basic/RichText/RichText.d.ts +20 -0
  15. package/dist/elements/basic/RichText/RichText.mjs +30 -0
  16. package/dist/elements/basic/RichText/Settings.d.ts +7 -0
  17. package/dist/elements/basic/RichText/Settings.mjs +51 -0
  18. package/dist/elements/{provider/CollectionContainer → basic/RichText}/index.d.ts +6 -7
  19. package/dist/elements/{provider/CollectionContainer → basic/RichText}/index.mjs +12 -13
  20. package/dist/elements/basic/RichText/sanitizeHtml.d.ts +21 -0
  21. package/dist/elements/basic/RichText/sanitizeHtml.mjs +8 -0
  22. package/dist/elements/form/FormControl/index.mjs +1 -1
  23. package/dist/elements/index.d.ts +5 -3
  24. package/dist/elements/index.mjs +30 -28
  25. package/dist/elements/internal/Page/Page.mjs +28 -26
  26. package/dist/elements/provider/ApiContainer/ApiContainer.d.ts +28 -1
  27. package/dist/elements/provider/ApiContainer/ApiContainer.mjs +201 -86
  28. package/dist/elements/provider/ApiContainer/Settings.d.ts +15 -3
  29. package/dist/elements/provider/ApiContainer/Settings.mjs +209 -92
  30. package/dist/elements/provider/ApiContainer/components/FiltersInput/FiltersInput.d.ts +22 -0
  31. package/dist/elements/provider/ApiContainer/components/FiltersInput/FiltersInput.mjs +75 -0
  32. package/dist/elements/provider/ApiContainer/components/FiltersInput/index.d.ts +3 -0
  33. package/dist/elements/provider/ApiContainer/components/FiltersInput/index.mjs +5 -0
  34. package/dist/elements/provider/ApiContainer/hooks/useProviderPagination.d.ts +31 -0
  35. package/dist/elements/provider/ApiContainer/hooks/useProviderPagination.mjs +51 -0
  36. package/dist/elements/provider/ApiContainer/hooks/useProviderWrite.d.ts +26 -0
  37. package/dist/elements/provider/ApiContainer/hooks/useProviderWrite.mjs +27 -0
  38. package/dist/elements/provider/ApiContainer/index.d.ts +8 -0
  39. package/dist/elements/provider/ApiContainer/index.mjs +9 -1
  40. package/dist/elements/settings.mjs +32 -30
  41. package/dist/elements/structure/Pagination/Pagination.d.ts +41 -0
  42. package/dist/elements/structure/Pagination/Pagination.mjs +83 -0
  43. package/dist/elements/structure/Pagination/Settings.d.ts +12 -0
  44. package/dist/elements/structure/Pagination/Settings.mjs +85 -0
  45. package/dist/elements/structure/Pagination/buildPageWindow.d.ts +9 -0
  46. package/dist/elements/structure/Pagination/buildPageWindow.mjs +8 -0
  47. package/dist/elements/structure/Pagination/index.d.ts +67 -0
  48. package/dist/elements/structure/Pagination/index.mjs +59 -0
  49. package/dist/index.d.ts +130 -57
  50. package/dist/index.mjs +32 -30
  51. package/package.json +76 -32
  52. package/dist/elements/internal/Page/helpers/UserHelper.d.ts +0 -4
  53. package/dist/elements/provider/CollectionContainer/CollectionContainer.d.ts +0 -18
  54. package/dist/elements/provider/CollectionContainer/CollectionContainer.mjs +0 -69
  55. package/dist/elements/provider/CollectionContainer/CollectionContainer.stories-pending.d.ts +0 -1
  56. package/dist/elements/provider/CollectionContainer/Settings.d.ts +0 -10
  57. package/dist/elements/provider/CollectionContainer/Settings.mjs +0 -74
  58. package/dist/elements/provider/CollectionContainer/hooks/useCollectionContext.d.ts +0 -19
  59. package/dist/elements/provider/CollectionContainer/hooks/useCollectionContext.mjs +0 -71
package/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # @plitzi/sdk-elements
2
2
 
3
+ ## 0.33.0
4
+
5
+ ### Minor Changes
6
+
7
+ - v0.33.0
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies
12
+ - @plitzi/sdk-auth@0.33.0
13
+ - @plitzi/sdk-dev-tools@0.33.0
14
+ - @plitzi/sdk-event-bridge@0.33.0
15
+ - @plitzi/sdk-interactions@0.33.0
16
+ - @plitzi/sdk-navigation@0.33.0
17
+ - @plitzi/sdk-schema@0.33.0
18
+ - @plitzi/sdk-shared@0.33.0
19
+
3
20
  ## 0.32.25
4
21
 
5
22
  ### Patch Changes
@@ -4,6 +4,13 @@ export type ElementContextValue<T extends 'skipHOC' | 'full' = 'full'> = {
4
4
  id: string;
5
5
  idRef?: string;
6
6
  rootId?: string;
7
+ /**
8
+ * Whether this element is on screen: its own `visibility` state AND every ancestor's, chained through this context.
9
+ * A hidden element still renders its subtree (it is hidden in CSS, not unmounted), so anything that DOES something
10
+ * rather than just paint — fetching, polling, submitting — reads this instead of its own state to stay inert while
11
+ * the branch it lives in is hidden.
12
+ */
13
+ visible: boolean;
7
14
  } & (T extends 'skipHOC' ? {
8
15
  plitziJsxSkipHOC: true;
9
16
  } : {
@@ -0,0 +1 @@
1
+ export declare const isVisible: (visibility: unknown) => boolean;
@@ -0,0 +1,4 @@
1
+ //#region src/Element/helpers/isVisible.ts
2
+ var e = (e) => e !== !1 && e !== "false";
3
+ //#endregion
4
+ export { e as isVisible };
@@ -1,60 +1,68 @@
1
1
  import e from "../ElementContext.mjs";
2
- import { omitKeys as t } from "../helpers/omitKeys.mjs";
3
- import n from "../hooks/useElementInternal.mjs";
4
- import r from "@plitzi/plitzi-ui/ErrorBoundary";
5
- import { Profiler as i, use as a, useMemo as o, useRef as s } from "react";
6
- import c from "@plitzi/sdk-event-bridge/hooks/useEventBridge";
7
- import l from "@plitzi/sdk-shared/hooks/usePlitziServiceContext";
8
- import { useCommonStore as u } from "@plitzi/sdk-shared/store";
9
- import { diffProps as d, tracingCollector as f } from "@plitzi/sdk-shared/store/tracing";
10
- import { jsx as p } from "react/jsx-runtime";
2
+ import { isVisible as t } from "../helpers/isVisible.mjs";
3
+ import { omitKeys as n } from "../helpers/omitKeys.mjs";
4
+ import r from "../hooks/useElementInternal.mjs";
5
+ import i from "@plitzi/plitzi-ui/ErrorBoundary";
6
+ import { Profiler as a, use as o, useMemo as s, useRef as c } from "react";
7
+ import l from "@plitzi/sdk-event-bridge/hooks/useEventBridge";
8
+ import u from "@plitzi/sdk-shared/hooks/usePlitziServiceContext";
9
+ import { useCommonStore as d } from "@plitzi/sdk-shared/store";
10
+ import { diffProps as f, tracingCollector as p } from "@plitzi/sdk-shared/store/tracing";
11
+ import { jsx as m } from "react/jsx-runtime";
11
12
  //#region src/Element/hocs/withElement.tsx
12
- var m = (m) => {
13
- let h = m.displayName || m.name, g = (h) => {
14
- let g = s(void 0), _ = s(void 0), { id: v, rootId: y } = h.internalProps, b = o(() => ({
15
- id: v,
16
- rootId: y,
13
+ var h = (h) => {
14
+ let g = h.displayName || h.name, _ = (g) => {
15
+ let _ = c(void 0), v = c(void 0), { id: y, rootId: b } = g.internalProps, x = o(e), S = x?.visible ?? !0, C = s(() => ({
16
+ id: y,
17
+ rootId: b,
18
+ visible: S,
17
19
  plitziJsxSkipHOC: !0
18
- }), [v, y]);
19
- if (h.plitziJsxSkipHOC) return /* @__PURE__ */ p(e, {
20
- value: b,
21
- children: /* @__PURE__ */ p(m, { ...h })
20
+ }), [
21
+ y,
22
+ b,
23
+ S
24
+ ]);
25
+ if (g.plitziJsxSkipHOC) return /* @__PURE__ */ m(e, {
26
+ value: C,
27
+ children: /* @__PURE__ */ m(h, { ...g })
22
28
  });
23
- let x = a(e), { settings: { previewMode: S, debugMode: C }, root: { baseElementId: w } } = l(), [T] = u(`schema.flat.${v}`);
24
- if (!T) throw Error(`Element ${v} not found, Page ${w}`);
25
- let { internalProps: E, customProps: D, children: O } = n({
26
- element: T,
27
- internalProps: h.internalProps,
28
- children: h.children,
29
- previewMode: S
30
- }), { attributes: k, definition: A, style: j, plitziElementLayout: M, elementState: N, setElementState: P } = E, F = o(() => ({ [`${v}_setState`]: P }), [v, P]);
31
- c("element", F);
32
- let I = T.idRef, L = o(() => ({
33
- id: v,
34
- idRef: I,
35
- rootId: y,
36
- attributes: k,
37
- definition: A,
38
- plitziElementLayout: M,
39
- style: j,
40
- elementState: N,
41
- setElementState: P
29
+ let { settings: { previewMode: w, debugMode: T }, root: { baseElementId: E } } = u(), [D] = d(`schema.flat.${y}`);
30
+ if (!D) throw Error(`Element ${y} not found, Page ${E}`);
31
+ let { internalProps: O, customProps: k, children: A } = r({
32
+ element: D,
33
+ internalProps: g.internalProps,
34
+ children: g.children,
35
+ previewMode: w
36
+ }), { attributes: j, definition: M, style: N, plitziElementLayout: P, elementState: F, setElementState: I } = O, L = s(() => ({ [`${y}_setState`]: I }), [y, I]);
37
+ l("element", L);
38
+ let R = D.idRef, z = S && t(F.visibility), B = s(() => ({
39
+ id: y,
40
+ idRef: R,
41
+ rootId: b,
42
+ visible: z,
43
+ attributes: j,
44
+ definition: M,
45
+ plitziElementLayout: P,
46
+ style: N,
47
+ elementState: F,
48
+ setElementState: I
42
49
  }), [
43
- k,
44
- A,
45
- N,
46
- v,
47
- I,
50
+ j,
48
51
  M,
52
+ F,
49
53
  y,
50
- j,
51
- P
52
- ]), R = o(() => {
54
+ R,
55
+ P,
56
+ b,
57
+ N,
58
+ I,
59
+ z
60
+ ]), V = s(() => {
53
61
  let e = {
54
- ...E.attributes,
55
- ...h.extraProps,
56
- ...D,
57
- ...t(h, [
62
+ ...O.attributes,
63
+ ...g.extraProps,
64
+ ...k,
65
+ ...n(g, [
58
66
  "plitziJsxSkipHOC",
59
67
  "internalProps",
60
68
  "className",
@@ -62,34 +70,34 @@ var m = (m) => {
62
70
  "extraProps"
63
71
  ])
64
72
  };
65
- return O && (e = {
73
+ return A && (e = {
66
74
  ...e,
67
- children: O
68
- }), /* @__PURE__ */ p(r, { children: /* @__PURE__ */ p(m, {
75
+ children: A
76
+ }), /* @__PURE__ */ m(i, { children: /* @__PURE__ */ m(h, {
69
77
  ...e,
70
- ref: g
78
+ ref: _
71
79
  }) });
72
80
  }, [
73
- E.attributes,
74
- h,
75
- D,
76
- O
77
- ]), z = /* @__PURE__ */ p(e, {
78
- value: L,
79
- children: R
81
+ O.attributes,
82
+ g,
83
+ k,
84
+ A
85
+ ]), H = /* @__PURE__ */ m(e, {
86
+ value: B,
87
+ children: V
80
88
  });
81
- if (C) {
82
- f.linkParent(v, x?.id);
89
+ if (T) {
90
+ p.linkParent(y, x?.id);
83
91
  let e = {
84
- attributes: k,
85
- definition: A,
86
- style: j,
87
- elementState: N,
88
- plitziElementLayout: M,
89
- children: O,
90
- ...D,
91
- ...h.extraProps,
92
- ...t(h, [
92
+ attributes: j,
93
+ definition: M,
94
+ style: N,
95
+ elementState: F,
96
+ plitziElementLayout: P,
97
+ children: A,
98
+ ...k,
99
+ ...g.extraProps,
100
+ ...n(g, [
93
101
  "plitziJsxSkipHOC",
94
102
  "internalProps",
95
103
  "className",
@@ -97,15 +105,15 @@ var m = (m) => {
97
105
  "extraProps"
98
106
  ])
99
107
  };
100
- return f.recordProps(v, d(_.current, e)), _.current = e, /* @__PURE__ */ p(i, {
101
- id: v,
102
- onRender: f.onRender,
103
- children: z
108
+ return p.recordProps(y, f(v.current, e)), v.current = e, /* @__PURE__ */ m(a, {
109
+ id: y,
110
+ onRender: p.onRender,
111
+ children: H
104
112
  });
105
113
  }
106
- return z;
114
+ return H;
107
115
  };
108
- return g.displayName = `withElement(${h})`, g;
116
+ return _.displayName = `withElement(${g})`, _;
109
117
  };
110
118
  //#endregion
111
- export { m as default };
119
+ export { h as default };
@@ -1,26 +1,27 @@
1
- import { useMemo as e } from "react";
2
- import t from "clsx";
1
+ import { isVisible as e } from "../helpers/isVisible.mjs";
2
+ import { useMemo as t } from "react";
3
+ import n from "clsx";
3
4
  //#region src/Element/hooks/useInternalClassName.ts
4
- var n = ({ id: n, className: r, previewMode: i, baseElementId: a, plitziElementLayout: o, definition: s, elementState: c }) => {
5
- let { items: l } = s, u = c.visibility;
6
- return e(() => t(r, {
7
- "plitzi-component--hidden": u === !1 || u === "false",
8
- "plitzi-component": !i && !o,
9
- "plitzi-component--layout": !i && !!o,
10
- with__container: !i && !!l,
11
- "container--empty": !i && !!l && l.length === 0 && !o,
12
- "container--base-element": !i && !!l && a === n,
13
- "plitzi-component--layout-body": o && n === o.containerId
14
- }, s.styleSelectors.base), [
15
- r,
16
- u,
5
+ var r = ({ id: r, className: i, previewMode: a, baseElementId: o, plitziElementLayout: s, definition: c, elementState: l }) => {
6
+ let { items: u } = c, d = e(l.visibility);
7
+ return t(() => n(i, {
8
+ "plitzi-component--hidden": !d,
9
+ "plitzi-component": !a && !s,
10
+ "plitzi-component--layout": !a && !!s,
11
+ with__container: !a && !!u,
12
+ "container--empty": !a && !!u && u.length === 0 && !s,
13
+ "container--base-element": !a && !!u && o === r,
14
+ "plitzi-component--layout-body": s && r === s.containerId
15
+ }, c.styleSelectors.base), [
17
16
  i,
18
- o,
19
- l,
17
+ d,
20
18
  a,
21
- n,
22
- s.styleSelectors.base
19
+ s,
20
+ u,
21
+ o,
22
+ r,
23
+ c.styleSelectors.base
23
24
  ]);
24
25
  };
25
26
  //#endregion
26
- export { n as default };
27
+ export { r as default };
@@ -8,7 +8,7 @@ import u from "@plitzi/sdk-shared/elements/ComponentContext";
8
8
  import { jsx as d } from "react/jsx-runtime";
9
9
  //#region src/Element/hooks/useInternalItems.tsx
10
10
  var f = typeof window > "u", p = () => () => {}, m = () => !0, h = () => !1, g = ({ id: g, definition: _, plitziElementLayout: v, children: y, previewMode: b }) => {
11
- let [[x, S]] = s(["schema.flat", "schema.rsc.enabled"], { mode: "mount" }), { components: C } = r(u), { contexts: { PluginsContext: w } } = l(), { plugins: T } = r(w), { items: E } = _, D = v || y || E?.length, O = a(v), k = a(0);
11
+ let [[x, S]] = s(["schema.flat", "rsc.enabled"], { mode: "mount" }), { components: C } = r(u), { contexts: { PluginsContext: w } } = l(), { plugins: T } = r(w), { items: E } = _, D = v || y || E?.length, O = a(v), k = a(0);
12
12
  O.current !== v && (O.current = v, k.current += 1);
13
13
  let A = k.current, j = o(p, m, h);
14
14
  return i(() => {
@@ -1,8 +1,9 @@
1
1
  declare const useRscData: <T>() => {
2
2
  enabled: boolean;
3
- serverData: Record<string, unknown> | undefined;
4
- elementData: T | null;
3
+ /** Whether a payload has arrived at all — the builder and client-only renders never see one. */
4
+ loaded: boolean;
5
+ elementData: NonNullable<T> | null;
5
6
  isServerElement: boolean;
6
- refresh: ((ids?: string[]) => Promise<void>) | undefined;
7
+ refresh: (ids?: string[], params?: Record<string, string>) => Promise<void>;
7
8
  };
8
9
  export default useRscData;
@@ -1,16 +1,21 @@
1
1
  import e from "./useElement.mjs";
2
- import { use as t } from "react";
3
- import n from "@plitzi/sdk-shared/server/rsc/RscContext";
2
+ import { useCommonStore as t } from "@plitzi/sdk-shared/store";
3
+ import { rscDataPath as n } from "@plitzi/sdk-shared/server/rsc/refreshRsc";
4
+ import r from "@plitzi/sdk-shared/server/rsc/useRscRefresh";
4
5
  //#region src/Element/hooks/useRscData.ts
5
- var r = () => {
6
- let { enabled: r, serverData: i, refresh: a } = t(n), { id: o } = e();
6
+ var i = () => {
7
+ let { id: i } = e(), [[a = !1, o = !1, s]] = t([
8
+ "rsc.enabled",
9
+ "rsc.loaded",
10
+ n(i)
11
+ ]), c = r();
7
12
  return {
8
- enabled: r,
9
- serverData: i,
10
- elementData: i?.[o] ?? null,
11
- isServerElement: !!i && o in i,
12
- refresh: a
13
+ enabled: a,
14
+ loaded: o,
15
+ elementData: s ?? null,
16
+ isServerElement: s !== void 0,
17
+ refresh: c
13
18
  };
14
19
  };
15
20
  //#endregion
16
- export { r as default };
21
+ export { i as default };
@@ -1,7 +1,6 @@
1
1
  import { ReactNode } from 'react';
2
2
  export type GlobalSourcesProps = {
3
3
  children: ReactNode;
4
- environment?: string;
5
4
  };
6
- declare const GlobalSources: ({ children, environment }: GlobalSourcesProps) => ReactNode;
5
+ declare const GlobalSources: ({ children }: GlobalSourcesProps) => ReactNode;
7
6
  export default GlobalSources;
@@ -1,40 +1,45 @@
1
1
  import { use as e, useCallback as t, useMemo as n } from "react";
2
- import { useCommonStore as r, useCommonStoreSync as i } from "@plitzi/sdk-shared/store";
3
- import { get as a } from "@plitzi/plitzi-ui/helpers";
4
- import { getPathsFromObeject as o } from "@plitzi/sdk-shared/helpers/utils";
5
- import s from "@plitzi/sdk-shared/dataSource/hooks/useRegisterSource";
6
- import { QueryBuilderEvaluator as c } from "@plitzi/plitzi-ui/QueryBuilder";
7
- import l from "@plitzi/sdk-navigation/NavigationContext";
2
+ import { useCommonStore as r, useCommonStoreSync as i, useRenderSettings as a } from "@plitzi/sdk-shared/store";
3
+ import { get as o } from "@plitzi/plitzi-ui/helpers";
4
+ import { getPathsFromObeject as s } from "@plitzi/sdk-shared/helpers/utils";
5
+ import c from "@plitzi/sdk-shared/dataSource/hooks/useRegisterSource";
6
+ import { QueryBuilderEvaluator as l } from "@plitzi/plitzi-ui/QueryBuilder";
8
7
  import u from "@plitzi/sdk-auth/AuthContext";
9
8
  //#region src/dataSource/GlobalSources.tsx
10
- var d = ({ children: d, environment: f = "main" }) => {
11
- let { routeParams: p, queryParams: m, hostname: h, currentPageId: g } = e(l), [_] = r("schema.variables"), v = n(() => _ ? _.reduce((e, t) => {
9
+ var d = ({ children: d }) => {
10
+ let { environment: f } = a(), [[p, m, h, g, _]] = r([
11
+ "schema.variables",
12
+ "navigation.routeParams",
13
+ "navigation.queryParams",
14
+ "navigation.hostname",
15
+ "navigation.currentPageId"
16
+ ]), v = n(() => p ? p.reduce((e, t) => {
12
17
  let { name: n, value: r, subValues: i } = t;
13
18
  if (!Array.isArray(i) || i.length === 0) return {
14
19
  ...e,
15
20
  [n]: r
16
21
  };
17
22
  let a = {
18
- routeParams: p,
19
- queryParams: m,
20
- hostname: h,
23
+ routeParams: m,
24
+ queryParams: h,
25
+ hostname: g,
21
26
  environment: f
22
- }, o = i.find((e) => c(e.when, a));
27
+ }, o = i.find((e) => l(e.when, a));
23
28
  return {
24
29
  ...e,
25
30
  [n]: o ? o.value : r
26
31
  };
27
32
  }, {}) : {}, [
28
33
  f,
34
+ g,
29
35
  h,
30
36
  m,
31
- p,
32
- _
33
- ]), y = t(() => o(v).map((e) => ({
37
+ p
38
+ ]), y = t(() => s(v).map((e) => ({
34
39
  path: e,
35
40
  name: `variables.${e}`
36
41
  })), [v]);
37
- s({
42
+ c({
38
43
  id: "global",
39
44
  source: "variables",
40
45
  name: "Variables",
@@ -42,19 +47,19 @@ var d = ({ children: d, environment: f = "main" }) => {
42
47
  }), i("runtime.sources.variables", v);
43
48
  let [b = {}] = r("pageDefinitions"), x = n(() => Object.values(b).map((e) => ({
44
49
  value: e.id,
45
- label: a(e, "attributes.name", e.id)
50
+ label: o(e, "attributes.name", e.id)
46
51
  })), [b]), S = n(() => ({
47
- routeParams: p,
48
- queryParams: m,
49
- currentPageId: g
52
+ routeParams: m,
53
+ queryParams: h,
54
+ currentPageId: _
50
55
  }), [
51
- p,
52
56
  m,
53
- g
57
+ h,
58
+ _
54
59
  ]), C = t(() => {
55
- let e = o({
56
- routeParams: p,
57
- queryParams: m
60
+ let e = s({
61
+ routeParams: m,
62
+ queryParams: h
58
63
  }).map((e) => ({
59
64
  path: e,
60
65
  name: `navigation.${e}`
@@ -69,67 +74,46 @@ var d = ({ children: d, environment: f = "main" }) => {
69
74
  };
70
75
  return [...e, t];
71
76
  }, [
72
- p,
73
77
  m,
78
+ h,
74
79
  x
75
80
  ]);
76
- s({
81
+ c({
77
82
  id: "global",
78
83
  source: "navigation",
79
84
  name: "Navigation",
80
85
  fields: C
81
86
  }), i("runtime.sources.navigation", S);
82
- let { user: w, authenticated: T } = e(u), [E = "basic"] = r("schema.settings.userProvider"), D = n(() => {
83
- switch (E) {
84
- case "auth0": return {
85
- isAuthenticated: T,
86
- user: {
87
- given_name: "",
88
- family_name: "",
89
- nickname: "",
90
- name: "",
91
- picture: "",
92
- locale: "",
93
- updated_at: "",
94
- email: "",
95
- email_verified: !1,
96
- sub: "",
97
- ...w
98
- }
99
- };
100
- case "basic": return {
101
- isAuthenticated: T,
102
- accessToken: w?.accessToken ?? "",
103
- details: {
104
- username: "",
105
- email: "",
106
- roles: "",
107
- permissions: "",
108
- verified: "",
109
- ...w?.details ?? {}
110
- }
111
- };
112
- default: return {};
87
+ let { user: w, authenticated: T } = e(u), [E = "basic"] = r("schema.settings.userProvider"), D = n(() => E === "" ? {} : {
88
+ isAuthenticated: T,
89
+ accessToken: w?.accessToken ?? "",
90
+ details: {
91
+ username: "",
92
+ email: "",
93
+ roles: "",
94
+ permissions: "",
95
+ verified: "",
96
+ ...w?.details ?? {}
113
97
  }
114
98
  }, [
115
99
  E,
116
100
  w,
117
101
  T
118
- ]), O = t(() => o(D).map((e) => ({
102
+ ]), O = t(() => s(D).map((e) => ({
119
103
  path: e,
120
104
  name: `user.${e}`
121
105
  })), [D]);
122
- s({
106
+ c({
123
107
  id: "global",
124
108
  source: "auth",
125
109
  name: "Auth State",
126
110
  fields: O
127
111
  }), i("runtime.sources.auth", D);
128
- let [k] = r("runtime.state"), A = t(() => o(k).map((e) => ({
112
+ let [k] = r("runtime.state"), A = t(() => s(k).map((e) => ({
129
113
  path: e,
130
114
  name: `state.${e}`
131
115
  })), [k]);
132
- return s({
116
+ return c({
133
117
  id: "global",
134
118
  source: "state",
135
119
  name: "State",
@@ -4,7 +4,7 @@ import n from "../../../Element/hocs/withElement.mjs";
4
4
  import { useCallback as r, useEffect as i, useMemo as a, useState as o } from "react";
5
5
  import { jsx as s, jsxs as c } from "react/jsx-runtime";
6
6
  import l from "clsx";
7
- import { omit as u } from "@plitzi/plitzi-ui";
7
+ import { omit as u } from "@plitzi/plitzi-ui/helpers/lodash";
8
8
  //#region src/elements/advanced/BlockJsx/BlockJsx.tsx
9
9
  var d = ({ ref: n, className: d = "", props: f = "{}", contentCache: p = "", ...m }) => {
10
10
  let { id: h, rootId: g, plitziElementLayout: _ } = e(), [v, y] = o(), [b, x] = o(), S = a(() => ({
@@ -1,66 +1,72 @@
1
1
  import e from "../../../Element/hooks/useElement.mjs";
2
2
  import { RootElement as t } from "../../../Element/RootElement.mjs";
3
3
  import n from "../../../Element/hocs/withElement.mjs";
4
- import { use as r, useMemo as i } from "react";
5
- import a from "@plitzi/sdk-shared/hooks/usePlitziServiceContext";
6
- import { useCommonStore as o } from "@plitzi/sdk-shared/store";
7
- import { processTwig as s } from "@plitzi/sdk-shared/helpers/twigWrapper";
8
- import { jsx as c } from "react/jsx-runtime";
9
- import l from "clsx";
10
- import { getPageFullPath as u } from "@plitzi/sdk-navigation/NavigationHelper";
4
+ import { useMemo as r } from "react";
5
+ import i from "@plitzi/sdk-shared/hooks/usePlitziServiceContext";
6
+ import { useSdkStore as a } from "@plitzi/sdk-shared/store";
7
+ import { processTwig as o } from "@plitzi/sdk-shared/helpers/twigWrapper";
8
+ import { jsx as s } from "react/jsx-runtime";
9
+ import c from "clsx";
10
+ import { getPageFullPath as l } from "@plitzi/sdk-navigation/NavigationHelper";
11
11
  //#region src/elements/basic/Link/Link.tsx
12
- var d = ({ ref: n, children: d, className: f = "", href: p = "#", target: m = "self", mode: h = "page" }) => {
13
- let { style: g } = e(), { settings: { previewMode: _ }, contexts: { NavigationContext: v } } = a(), { navigate: y, routeParams: b, queryParams: x } = r(v), [[S, C]] = o(["pageDefinitions", "schema.pageFolders"]), w = i(() => {
14
- if (h === "external") return p;
15
- let e = `/${p}`.replaceAll(/[/]+/gim, "/");
16
- if (h === "internal") {
12
+ var u = ({ ref: n, children: u, className: d = "", href: f = "#", target: p = "self", mode: m = "page" }) => {
13
+ let { style: h } = e(), { settings: { previewMode: g } } = i(), [[_, v, y, b, x]] = a([
14
+ "pageDefinitions",
15
+ "schema.pageFolders",
16
+ "navigation.routeParams",
17
+ "navigation.queryParams",
18
+ "navigation.navigate"
19
+ ]), S = r(() => {
20
+ if (m === "external") return f;
21
+ let e = `/${f}`.replaceAll(/[/]+/gim, "/");
22
+ if (m === "internal") {
17
23
  try {
18
- let t = s(e, {
19
- ...x,
20
- ...b
24
+ let t = o(e, {
25
+ ...b,
26
+ ...y
21
27
  }, !0);
22
28
  return typeof t == "string" ? t : e;
23
29
  } catch {}
24
30
  return e;
25
31
  }
26
- return u(S, C, p, !0);
32
+ return l(_, v, f, !0);
27
33
  }, [
28
- h,
29
- p,
30
- S,
31
- C,
32
- x,
33
- b
34
- ]), T = (e) => {
35
- _ && (e.stopPropagation(), (h === "page" || h === "internal") && (e.preventDefault(), y(w)));
36
- }, E = i(() => {
34
+ m,
35
+ f,
36
+ _,
37
+ v,
38
+ b,
39
+ y
40
+ ]), C = (e) => {
41
+ g && (e.stopPropagation(), (m === "page" || m === "internal") && (e.preventDefault(), x(S)));
42
+ }, w = r(() => {
37
43
  let e = {
38
44
  ref: n,
39
- style: g,
40
- target: `_${m}`,
41
- className: l("plitzi-component__link", f)
45
+ style: h,
46
+ target: `_${p}`,
47
+ className: c("plitzi-component__link", d)
42
48
  };
43
- return _ ? {
49
+ return g ? {
44
50
  ...e,
45
- href: w
51
+ href: S
46
52
  } : {
47
53
  ...e,
48
- "href-disabled": w
54
+ "href-disabled": S
49
55
  };
50
56
  }, [
51
57
  n,
58
+ h,
59
+ p,
60
+ d,
52
61
  g,
53
- m,
54
- f,
55
- _,
56
- w
62
+ S
57
63
  ]);
58
- return /* @__PURE__ */ c(t, {
64
+ return /* @__PURE__ */ s(t, {
59
65
  tag: "a",
60
- ...E,
61
- onClick: T,
62
- children: d
66
+ ...w,
67
+ onClick: C,
68
+ children: u
63
69
  });
64
- }, f = n(d);
70
+ }, d = n(u);
65
71
  //#endregion
66
- export { d as Link, f as default };
72
+ export { u as Link, d as default };