@plitzi/sdk-elements 0.31.2 → 0.32.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # @plitzi/sdk-elements
2
2
 
3
+ ## 0.32.0
4
+
5
+ ### Minor Changes
6
+
7
+ - v0.32.0
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies
12
+ - @plitzi/nexus@0.32.0
13
+ - @plitzi/sdk-auth@0.32.0
14
+ - @plitzi/sdk-dev-tools@0.32.0
15
+ - @plitzi/sdk-event-bridge@0.32.0
16
+ - @plitzi/sdk-interactions@0.32.0
17
+ - @plitzi/sdk-navigation@0.32.0
18
+ - @plitzi/sdk-schema@0.32.0
19
+ - @plitzi/sdk-shared@0.32.0
20
+
3
21
  ## 0.31.2
4
22
 
5
23
  ### Patch Changes
@@ -14,7 +32,6 @@
14
32
  - @plitzi/sdk-navigation@0.31.2
15
33
  - @plitzi/sdk-schema@0.31.2
16
34
  - @plitzi/sdk-shared@0.31.2
17
- - @plitzi/sdk-state@0.31.2
18
35
 
19
36
  ## 0.31.1
20
37
 
@@ -30,7 +47,6 @@
30
47
  - @plitzi/sdk-navigation@0.31.1
31
48
  - @plitzi/sdk-schema@0.31.1
32
49
  - @plitzi/sdk-shared@0.31.1
33
- - @plitzi/sdk-state@0.31.1
34
50
 
35
51
  ## 0.31.0
36
52
 
@@ -48,7 +64,6 @@
48
64
  - @plitzi/sdk-navigation@0.31.0
49
65
  - @plitzi/sdk-schema@0.31.0
50
66
  - @plitzi/sdk-shared@0.31.0
51
- - @plitzi/sdk-state@0.31.0
52
67
  - @plitzi/nexus@0.31.0
53
68
 
54
69
  ## 0.30.19
@@ -66,10 +66,7 @@ var g = ({ ref: g, children: _, tag: v = "div", className: y = "", interactionTr
66
66
  C,
67
67
  A,
68
68
  J
69
- ]), X = j || !!(I && Object.keys(I).length), { useStore: Z } = d(), [re] = Z("runtime.sources", {
70
- enabled: X,
71
- defaultValue: f
72
- }), Q = ee({});
69
+ ]), X = j || !!(I && Object.keys(I).length), { useStore: Z } = d(), [re = f] = Z("runtime.sources", { enabled: X }), Q = ee({});
73
70
  Q.current = re;
74
71
  let ie = o(() => ({ dataSource: Q.current }), [Q]), ae = c(() => ({
75
72
  ...e,
@@ -6,13 +6,13 @@ var n = ({ bindings: n, sources: r }) => {
6
6
  let e = new Set(r ?? []);
7
7
  for (let t of Object.values(n ?? {})) if (Array.isArray(t)) for (let { source: n } of t) n && e.add(n);
8
8
  return e.size > 0 && !e.has("variables") && e.add("variables"), [...e];
9
- }, [n, r]), a = e(() => i.map((e) => `runtime.sources.${e}`), [i]), { useStore: o } = t(), [s] = o(a);
9
+ }, [n, r]), { useStore: a } = t(), [o] = a(e(() => i.map((e) => `runtime.sources.${e}`), [i]));
10
10
  return e(() => {
11
11
  let e = {};
12
12
  return i.forEach((t, n) => {
13
- e[t] = s[n];
13
+ e[t] = o[n];
14
14
  }), e;
15
- }, [i, s]);
15
+ }, [i, o]);
16
16
  };
17
17
  //#endregion
18
18
  export { n as default };
@@ -59,7 +59,7 @@ declare const useElementInternal: ({ children, internalProps, previewMode, baseE
59
59
  style: Record<string, string> | undefined;
60
60
  id: string;
61
61
  plitziElementLayout?: import('@plitzi/sdk-shared').ElementLayout;
62
- }, "style" | "id" | "definition" | "attributes" | "rootId" | "plitziElementLayout" | "setElementState" | "elementState">;
62
+ }, "style" | "definition" | "id" | "attributes" | "rootId" | "plitziElementLayout" | "setElementState" | "elementState">;
63
63
  children: ReactNode;
64
64
  };
65
65
  export default useElementInternal;
@@ -6,61 +6,60 @@ import o from "@plitzi/sdk-shared/dataSource/hooks/useRegisterSource";
6
6
  import { QueryBuilderEvaluator as s } from "@plitzi/plitzi-ui/QueryBuilder";
7
7
  import c from "@plitzi/sdk-navigation/NavigationContext";
8
8
  import l from "@plitzi/sdk-auth/AuthContext";
9
- import u from "@plitzi/sdk-state/StateManagerContext";
10
9
  //#region src/dataSource/GlobalSources.tsx
11
- var d = ({ children: d, environment: f = "main" }) => {
12
- let { useStore: p, useStoreSync: m } = i(), { routeParams: h, queryParams: g, hostname: _, currentPageId: v } = e(c), [y] = p("schema.variables"), b = n(() => y ? y.reduce((e, t) => {
10
+ var u = ({ children: u, environment: d = "main" }) => {
11
+ let { useStore: f, useStoreSync: p } = i(), { routeParams: m, queryParams: h, hostname: g, currentPageId: _ } = e(c), [v] = f("schema.variables"), y = n(() => v ? v.reduce((e, t) => {
13
12
  let { name: n, value: r, subValues: i } = t;
14
13
  if (!Array.isArray(i) || i.length === 0) return {
15
14
  ...e,
16
15
  [n]: r
17
16
  };
18
17
  let a = {
19
- routeParams: h,
20
- queryParams: g,
21
- hostname: _,
22
- environment: f
18
+ routeParams: m,
19
+ queryParams: h,
20
+ hostname: g,
21
+ environment: d
23
22
  }, o = i.find((e) => s(e.when, a));
24
23
  return {
25
24
  ...e,
26
25
  [n]: o ? o.value : r
27
26
  };
28
27
  }, {}) : {}, [
29
- f,
30
- _,
28
+ d,
31
29
  g,
32
30
  h,
33
- y
31
+ m,
32
+ v
34
33
  ]);
35
34
  o({
36
35
  id: "global",
37
36
  source: "variables",
38
37
  name: "Variables",
39
- fields: t(() => a(b).map((e) => ({
38
+ fields: t(() => a(y).map((e) => ({
40
39
  path: e,
41
40
  name: `variables.${e}`
42
- })), [b])
43
- }), m("runtime.sources.variables", b);
44
- let x = n(() => ({
45
- routeParams: h,
46
- queryParams: g
47
- }), [h, g]);
41
+ })), [y])
42
+ }), p("runtime.sources.variables", y);
43
+ let b = n(() => ({
44
+ routeParams: m,
45
+ queryParams: h
46
+ }), [m, h]);
48
47
  o({
49
48
  id: "global",
50
49
  source: "navigation",
51
50
  name: "Navigation",
52
51
  fields: t(() => a({
53
- routeParams: h,
54
- queryParams: g
52
+ routeParams: m,
53
+ queryParams: h
55
54
  }).map((e) => ({
56
55
  path: e,
57
56
  name: `navigation.${e}`
58
- })), [h, g])
59
- }), m("runtime.sources.navigation", x);
60
- let { user: S, authenticated: C } = e(l), [w = "basic"] = p("schema.settings.userProvider"), T = n(() => {
61
- switch (w) {
57
+ })), [m, h])
58
+ }), p("runtime.sources.navigation", b);
59
+ let { user: x, authenticated: S } = e(l), [C = "basic"] = f("schema.settings.userProvider"), w = n(() => {
60
+ switch (C) {
62
61
  case "auth0": return {
63
- isAuthenticated: C,
62
+ isAuthenticated: S,
64
63
  user: {
65
64
  given_name: "",
66
65
  family_name: "",
@@ -72,64 +71,74 @@ var d = ({ children: d, environment: f = "main" }) => {
72
71
  email: "",
73
72
  email_verified: !1,
74
73
  sub: "",
75
- ...S
74
+ ...x
76
75
  }
77
76
  };
78
77
  case "basic": return {
79
- isAuthenticated: C,
80
- accessToken: S?.accessToken ?? "",
78
+ isAuthenticated: S,
79
+ accessToken: x?.accessToken ?? "",
81
80
  details: {
82
81
  username: "",
83
82
  email: "",
84
83
  roles: "",
85
84
  permissions: "",
86
85
  verified: "",
87
- ...S?.details ?? {}
86
+ ...x?.details ?? {}
88
87
  }
89
88
  };
90
89
  default: return {};
91
90
  }
92
91
  }, [
93
- w,
94
- S,
95
- C
92
+ C,
93
+ x,
94
+ S
96
95
  ]);
97
96
  o({
98
97
  id: "global",
99
98
  source: "auth",
100
99
  name: "Auth State",
101
- fields: t(() => a(T).map((e) => ({
100
+ fields: t(() => a(w).map((e) => ({
102
101
  path: e,
103
102
  name: `user.${e}`
103
+ })), [w])
104
+ }), p("runtime.sources.auth", w);
105
+ let [T] = f("runtime.state");
106
+ o({
107
+ id: "global",
108
+ source: "state",
109
+ name: "State",
110
+ fields: t(() => a(T).map((e) => ({
111
+ path: e,
112
+ name: `state.${e}`
104
113
  })), [T])
105
- }), m("runtime.sources.auth", T);
106
- let { state: E } = e(u), [D = {}] = p("pageDefinitions"), O = n(() => Object.values(D).map((e) => ({
114
+ }), p("runtime.sources.state", T);
115
+ let [E = {}] = f("pageDefinitions"), D = n(() => Object.values(E).map((e) => ({
107
116
  value: e.id,
108
117
  label: r(e, "attributes.name", e.id)
109
- })), [D]), k = n(() => ({
110
- ...E,
111
- currentPageId: v
112
- }), [E, v]);
118
+ })), [E]), O = n(() => ({
119
+ ...T,
120
+ currentPageId: _
121
+ }), [T, _]);
113
122
  return o({
114
123
  id: "global",
115
124
  source: "page",
116
125
  name: "Page",
117
126
  fields: t(() => {
118
- let e = a(E).map((e) => ({
127
+ let e = a(T).map((e) => ({
119
128
  path: e,
120
129
  name: `page.${e}`
121
- })), t = O.length > 0 ? {
130
+ })), t = D.length > 0 ? {
122
131
  path: "currentPageId",
123
132
  name: "Current Page",
124
133
  inputType: "select",
125
- values: O
134
+ values: D
126
135
  } : {
127
136
  path: "currentPageId",
128
137
  name: "Current Page"
129
138
  };
130
139
  return [...e, t];
131
- }, [E, O])
132
- }), m("runtime.sources.page", k), d;
140
+ }, [T, D])
141
+ }), p("runtime.sources.page", O), u;
133
142
  };
134
143
  //#endregion
135
- export { d as default };
144
+ export { u as default };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plitzi/sdk-elements",
3
- "version": "0.31.2",
3
+ "version": "0.32.0",
4
4
  "license": "AGPL-3.0",
5
5
  "files": [
6
6
  "dist"
@@ -788,16 +788,15 @@
788
788
  "type": "module",
789
789
  "sideEffects": false,
790
790
  "dependencies": {
791
- "@plitzi/nexus": "0.31.2",
791
+ "@plitzi/nexus": "0.32.0",
792
792
  "@plitzi/plitzi-ui": "^1.6.9",
793
- "@plitzi/sdk-auth": "0.31.2",
794
- "@plitzi/sdk-dev-tools": "0.31.2",
795
- "@plitzi/sdk-event-bridge": "0.31.2",
796
- "@plitzi/sdk-interactions": "0.31.2",
797
- "@plitzi/sdk-navigation": "0.31.2",
798
- "@plitzi/sdk-schema": "0.31.2",
799
- "@plitzi/sdk-shared": "0.31.2",
800
- "@plitzi/sdk-state": "0.31.2",
793
+ "@plitzi/sdk-auth": "0.32.0",
794
+ "@plitzi/sdk-dev-tools": "0.32.0",
795
+ "@plitzi/sdk-event-bridge": "0.32.0",
796
+ "@plitzi/sdk-interactions": "0.32.0",
797
+ "@plitzi/sdk-navigation": "0.32.0",
798
+ "@plitzi/sdk-schema": "0.32.0",
799
+ "@plitzi/sdk-shared": "0.32.0",
801
800
  "clsx": "^2.1.1",
802
801
  "immer": "^11.1.8"
803
802
  },