@plitzi/sdk-elements 0.36.0 → 0.36.2

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 (38) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/dist/Element/ElementParentContext.d.ts +13 -0
  3. package/dist/Element/ElementParentContext.mjs +6 -0
  4. package/dist/Element/LayoutBody.d.ts +21 -0
  5. package/dist/Element/LayoutBody.mjs +24 -0
  6. package/dist/Element/hocs/withElement.mjs +104 -87
  7. package/dist/Element/hooks/useElementInternal.mjs +24 -24
  8. package/dist/Element/hooks/useInternalItems.mjs +42 -39
  9. package/dist/Element/hooks/useLayoutChain.d.ts +10 -0
  10. package/dist/Element/hooks/useLayoutChain.mjs +20 -0
  11. package/dist/Element/hooks/useRootElementInteractions.mjs +45 -44
  12. package/dist/dataSource/GlobalSources.mjs +60 -59
  13. package/dist/dataSource/pathFields.d.ts +7 -0
  14. package/dist/dataSource/pathFields.mjs +8 -0
  15. package/dist/elements/advanced/Reference/Reference.mjs +93 -89
  16. package/dist/elements/advanced/Reference/declaration.d.ts +1 -1
  17. package/dist/elements/advanced/Reference/index.d.ts +1 -1
  18. package/dist/elements/declarations/index.d.ts +3 -1
  19. package/dist/elements/internal/LayoutContainer/LayoutContainer.d.ts +6 -0
  20. package/dist/elements/internal/LayoutContainer/LayoutContainer.mjs +31 -23
  21. package/dist/elements/internal/LayoutContainer/Settings.d.ts +4 -1
  22. package/dist/elements/internal/LayoutContainer/Settings.mjs +78 -64
  23. package/dist/elements/internal/LayoutContainer/declaration.d.ts +2 -0
  24. package/dist/elements/internal/LayoutContainer/index.d.ts +2 -0
  25. package/dist/elements/internal/LayoutPicker/LayoutPicker.d.ts +10 -0
  26. package/dist/elements/internal/LayoutPicker/LayoutPicker.mjs +35 -0
  27. package/dist/elements/internal/LayoutPicker/index.d.ts +3 -0
  28. package/dist/elements/internal/LayoutPicker/index.mjs +5 -0
  29. package/dist/elements/internal/Page/Page.mjs +49 -48
  30. package/dist/elements/internal/Page/Settings.mjs +101 -119
  31. package/dist/elements/provider/ApiContainer/ApiContainer.mjs +58 -66
  32. package/dist/elements/provider/ApiContainer/declaration.mjs +1 -1
  33. package/dist/elements/provider/ApiContainer/hooks/useApi.d.ts +8 -0
  34. package/dist/elements/provider/ApiContainer/hooks/useApi.mjs +52 -48
  35. package/dist/elements/structure/DialogContainer/DialogContainer.mjs +17 -25
  36. package/dist/elements/structure/ModalContainer/ModalContainer.mjs +15 -23
  37. package/dist/index.d.ts +3 -1
  38. package/package.json +38 -10
@@ -1,228 +1,210 @@
1
- import { useCallback as e, useMemo as t } from "react";
2
- import { useCommonStore as n } from "@plitzi/sdk-shared/store";
3
- import { get as r, pick as i } from "@plitzi/plitzi-ui/helpers";
4
- import { Fragment as a, jsx as o, jsxs as s } from "react/jsx-runtime";
5
- import { getPageFullPath as c } from "@plitzi/sdk-navigation/NavigationHelper";
6
- import l from "@plitzi/plitzi-ui/Alert";
7
- import u from "@plitzi/plitzi-ui/Checkbox";
8
- import d from "@plitzi/plitzi-ui/Input";
9
- import f from "@plitzi/plitzi-ui/TextArea";
10
- import p from "@plitzi/plitzi-ui/Select";
11
- import m from "@plitzi/plitzi-ui/Select2";
1
+ import e from "../LayoutPicker/index.mjs";
2
+ import { useCallback as t, useMemo as n } from "react";
3
+ import { useCommonStore as r } from "@plitzi/sdk-shared/store";
4
+ import { get as i, pick as a } from "@plitzi/plitzi-ui/helpers";
5
+ import { Fragment as o, jsx as s, jsxs as c } from "react/jsx-runtime";
6
+ import { getPageFullPath as l } from "@plitzi/sdk-navigation/NavigationHelper";
7
+ import u from "@plitzi/plitzi-ui/Alert";
8
+ import d from "@plitzi/plitzi-ui/Checkbox";
9
+ import f from "@plitzi/plitzi-ui/Input";
10
+ import p from "@plitzi/plitzi-ui/TextArea";
11
+ import m from "@plitzi/plitzi-ui/Select";
12
+ import h from "@plitzi/plitzi-ui/Select2";
12
13
  //#region src/elements/internal/Page/Settings.tsx
13
- var h = ({ id: h = "", seoEnabled: g = !1, enabled: _ = !0, name: v = "", folder: y = "", seoPageTitle: b = "Title", seoPageDescription: x = "Description", slug: S = "", layout: C = "", layoutContainer: w = "", accessLevel: T = "", unauthorizedBehaviour: E = "", unauthorizedPageRedirect: D = "", onUpdate: O }) => {
14
- let [[k, A, j]] = n([
14
+ var g = ({ id: g = "", seoEnabled: _ = !1, enabled: v = !0, name: y = "", folder: b = "", seoPageTitle: x = "Title", seoPageDescription: S = "Description", slug: C = "", layout: w = "", layoutContainer: T = "", accessLevel: E = "", unauthorizedBehaviour: D = "", unauthorizedPageRedirect: O = "", onUpdate: k }) => {
15
+ let [[A, j, M]] = r([
15
16
  "schema.flat",
16
17
  "schema.pages",
17
18
  "schema.pageFolders"
18
- ]), M = t(() => Object.values(k).filter((e) => r(e, "definition.type", "") === "layoutContainer"), [k]), N = t(() => C ? Object.values(k).filter((e) => r(e, "definition.type", "") === "container" && r(e, "definition.rootId", "") === C) : [], [k, C]), P = t(() => Object.values(i(k, A.filter((e) => e !== h))), [
19
- k,
20
- h,
21
- A
22
- ]), F = e((e) => (t) => O?.(e, t), [O]), I = e((e) => {
23
- O?.("name", e);
24
- let t = v.replaceAll(" ", "-").toLowerCase().replaceAll(/([^a-z0-9]+)/gi, "");
25
- (!S || S === t) && O?.("slug", e.replaceAll(" ", "-").toLowerCase().replaceAll(/([^a-z0-9-]+)/gi, ""));
19
+ ]), N = n(() => Object.values(a(A, j.filter((e) => e !== g))), [
20
+ A,
21
+ g,
22
+ j
23
+ ]), P = t((e) => (t) => k?.(e, t), [k]), F = t((e) => {
24
+ k?.("name", e);
25
+ let t = y.replaceAll(" ", "-").toLowerCase().replaceAll(/([^a-z0-9]+)/gi, "");
26
+ (!C || C === t) && k?.("slug", e.replaceAll(" ", "-").toLowerCase().replaceAll(/([^a-z0-9-]+)/gi, ""));
26
27
  }, [
27
- O,
28
- S,
29
- v
30
- ]), L = e((e) => {
28
+ k,
29
+ C,
30
+ y
31
+ ]), I = t((e) => {
31
32
  if (/^[a-zA-Z0-9:*/_-]+$/gim.test(e) || !e) {
32
33
  let t = e.replaceAll("//", "/");
33
- O?.("slug", t);
34
+ k?.("slug", t);
34
35
  }
35
- }, [O]), R = e((e) => {
36
- O?.("layout", e), O?.("layoutContainer", "");
37
- }, [O]), z = e((e) => {
38
- O?.("accessLevel", e), O?.("unauthorizedBehaviour", ""), O?.("unauthorizedPageRedirect", "");
39
- }, [O]), B = e((e) => O?.("seoEnabled", e.target.checked), [O]), V = e((e) => O?.("enabled", e.target.checked), [O]), H = e((e) => O?.("folder", e?.value ?? ""), [O]), U = t(() => [{
36
+ }, [k]), L = t((e) => {
37
+ k?.("accessLevel", e), k?.("unauthorizedBehaviour", ""), k?.("unauthorizedPageRedirect", "");
38
+ }, [k]), R = t((e) => k?.("seoEnabled", e.target.checked), [k]), z = t((e) => k?.("enabled", e.target.checked), [k]), B = t((e) => k?.("folder", e?.value ?? ""), [k]), V = n(() => [{
40
39
  value: "",
41
40
  label: "None"
42
- }, ...j.map(({ id: e, name: t }) => ({
41
+ }, ...M.map(({ id: e, name: t }) => ({
43
42
  value: e,
44
43
  label: t
45
- }))], [j]), W = t(() => c(k, j, h, !0), [
46
- k,
47
- j,
48
- h
44
+ }))], [M]), H = n(() => l(A, M, g, !0), [
45
+ A,
46
+ M,
47
+ g
49
48
  ]);
50
- return /* @__PURE__ */ s("div", {
49
+ return /* @__PURE__ */ c("div", {
51
50
  className: "flex flex-col gap-4 py-2",
52
51
  children: [
53
- !_ && /* @__PURE__ */ o(l, {
52
+ !v && /* @__PURE__ */ s(u, {
54
53
  intent: "info",
55
54
  size: "xs",
56
55
  solid: !1,
57
- children: /* @__PURE__ */ o("span", {
56
+ children: /* @__PURE__ */ s("span", {
58
57
  className: "text-xs",
59
58
  children: "When this option is disable, this page wont be accesible"
60
59
  })
61
60
  }),
62
- /* @__PURE__ */ o(u, {
61
+ /* @__PURE__ */ s(d, {
63
62
  label: " Page Enabled",
64
- checked: _,
65
- onChange: V,
63
+ checked: v,
64
+ onChange: z,
66
65
  size: "xs"
67
66
  }),
68
- /* @__PURE__ */ o(d, {
69
- value: v,
67
+ /* @__PURE__ */ s(f, {
68
+ value: y,
70
69
  label: "Page Name",
71
- onChange: I,
70
+ onChange: F,
72
71
  size: "xs"
73
72
  }),
74
- /* @__PURE__ */ o(l, {
73
+ /* @__PURE__ */ s(u, {
75
74
  intent: "info",
76
75
  size: "xs",
77
76
  solid: !1,
78
- children: /* @__PURE__ */ o("span", {
77
+ children: /* @__PURE__ */ s("span", {
79
78
  className: "text-xs",
80
79
  children: "Slug is a combination of letters, numbers and _ - : / *"
81
80
  })
82
81
  }),
83
- /* @__PURE__ */ s("div", {
82
+ /* @__PURE__ */ c("div", {
84
83
  className: "flex flex-col",
85
- children: [/* @__PURE__ */ o(d, {
86
- value: S,
87
- onChange: L,
84
+ children: [/* @__PURE__ */ s(f, {
85
+ value: C,
86
+ onChange: I,
88
87
  label: "Slug / Path",
89
88
  className: { inputContainer: "rounded-none rounded-tl rounded-tr" },
90
89
  size: "xs"
91
- }), /* @__PURE__ */ s("div", {
90
+ }), /* @__PURE__ */ c("div", {
92
91
  className: "truncate rounded-b border-x border-b border-gray-200 px-1 py-0.5 text-xs",
93
- title: W,
94
- children: ["Full Path: ", /* @__PURE__ */ o("span", {
92
+ title: H,
93
+ children: ["Full Path: ", /* @__PURE__ */ s("span", {
95
94
  className: "font-bold",
96
- children: W
95
+ children: H
97
96
  })]
98
97
  })]
99
98
  }),
100
- /* @__PURE__ */ o(m, {
99
+ /* @__PURE__ */ s(h, {
101
100
  label: "Folder",
102
- value: y,
103
- options: U,
101
+ value: b,
102
+ options: V,
104
103
  placeholder: "None",
105
- onChange: H,
104
+ onChange: B,
106
105
  size: "xs"
107
106
  }),
108
- /* @__PURE__ */ o(p, {
109
- value: C,
110
- placeholder: "None",
111
- label: "Layout",
112
- onChange: R,
113
- size: "xs",
114
- children: M.map(({ id: e, definition: { label: t } }) => /* @__PURE__ */ o("option", {
115
- value: e,
116
- children: t
117
- }, e))
118
- }),
119
- C && /* @__PURE__ */ o(p, {
120
- value: w,
121
- placeholder: "None",
122
- label: "Layout Container Body",
123
- onChange: F("layoutContainer"),
124
- size: "xs",
125
- children: N.map(({ id: e, definition: { label: t } }) => /* @__PURE__ */ o("option", {
126
- value: e,
127
- children: t
128
- }, e))
107
+ /* @__PURE__ */ s(e, {
108
+ layout: w,
109
+ layoutContainer: T,
110
+ onUpdate: k
129
111
  }),
130
- /* @__PURE__ */ s(p, {
131
- value: T,
112
+ /* @__PURE__ */ c(m, {
113
+ value: E,
132
114
  label: "Restrict Access",
133
- onChange: z,
115
+ onChange: L,
134
116
  placeholder: "None",
135
117
  size: "xs",
136
- children: [/* @__PURE__ */ o("option", {
118
+ children: [/* @__PURE__ */ s("option", {
137
119
  value: "public",
138
120
  children: "Public"
139
- }), /* @__PURE__ */ o("option", {
121
+ }), /* @__PURE__ */ s("option", {
140
122
  value: "authenticated",
141
123
  children: "Authenticated"
142
124
  })]
143
125
  }),
144
- T === "" && /* @__PURE__ */ o(l, {
126
+ E === "" && /* @__PURE__ */ s(u, {
145
127
  intent: "info",
146
128
  solid: !1,
147
129
  size: "xs",
148
- children: /* @__PURE__ */ o("span", {
130
+ children: /* @__PURE__ */ s("span", {
149
131
  className: "text-xs",
150
132
  children: "Anyone on the internet can access this page"
151
133
  })
152
134
  }),
153
- T === "public" && /* @__PURE__ */ o(l, {
135
+ E === "public" && /* @__PURE__ */ s(u, {
154
136
  intent: "info",
155
137
  solid: !1,
156
138
  size: "xs",
157
- children: /* @__PURE__ */ o("span", {
139
+ children: /* @__PURE__ */ s("span", {
158
140
  className: "text-xs",
159
141
  children: "Only Guest can access this page"
160
142
  })
161
143
  }),
162
- T !== "" && /* @__PURE__ */ o(p, {
144
+ E !== "" && /* @__PURE__ */ s(m, {
163
145
  label: "Unauthorized Behaviour",
164
- value: E,
165
- onChange: F("unauthorizedBehaviour"),
146
+ value: D,
147
+ onChange: P("unauthorizedBehaviour"),
166
148
  placeholder: "None",
167
149
  size: "xs",
168
- children: /* @__PURE__ */ o("option", {
150
+ children: /* @__PURE__ */ s("option", {
169
151
  value: "redirect",
170
152
  children: "Redirect"
171
153
  })
172
154
  }),
173
- E === "redirect" && /* @__PURE__ */ o(p, {
174
- value: D,
155
+ D === "redirect" && /* @__PURE__ */ s(m, {
156
+ value: O,
175
157
  label: "Redirect Page",
176
- onChange: F("unauthorizedPageRedirect"),
158
+ onChange: P("unauthorizedPageRedirect"),
177
159
  placeholder: "None",
178
160
  size: "xs",
179
- children: P.map((e) => /* @__PURE__ */ o("option", {
161
+ children: N.map((e) => /* @__PURE__ */ s("option", {
180
162
  value: e.id,
181
- children: r(e, "attributes.name")
163
+ children: i(e, "attributes.name")
182
164
  }, e.id))
183
165
  }),
184
- /* @__PURE__ */ o(u, {
166
+ /* @__PURE__ */ s(d, {
185
167
  label: " SEO Enabled",
186
- checked: g,
187
- onChange: B,
168
+ checked: _,
169
+ onChange: R,
188
170
  size: "xs"
189
171
  }),
190
- g && /* @__PURE__ */ s(a, { children: [
191
- /* @__PURE__ */ o(d, {
192
- value: b,
172
+ _ && /* @__PURE__ */ c(o, { children: [
173
+ /* @__PURE__ */ s(f, {
174
+ value: x,
193
175
  label: "SEO Title",
194
- onChange: F("seoPageTitle"),
176
+ onChange: P("seoPageTitle"),
195
177
  size: "xs"
196
178
  }),
197
- /* @__PURE__ */ o(f, {
179
+ /* @__PURE__ */ s(p, {
198
180
  label: "SEO Description",
199
- value: x,
200
- onChange: F("seoPageDescription"),
181
+ value: S,
182
+ onChange: P("seoPageDescription"),
201
183
  rows: 3,
202
184
  size: "xs"
203
185
  }),
204
- /* @__PURE__ */ s("div", {
186
+ /* @__PURE__ */ c("div", {
205
187
  className: "flex flex-col",
206
188
  children: [
207
- /* @__PURE__ */ o("p", {
189
+ /* @__PURE__ */ s("p", {
208
190
  className: "mb-4 text-xs",
209
191
  children: "Specify this page's title and description. You can see how they'll look in search engine results pages (SERPs) in the preview below."
210
192
  }),
211
- /* @__PURE__ */ o("label", { children: "Search Result Preview" }),
212
- /* @__PURE__ */ s("div", {
193
+ /* @__PURE__ */ s("label", { children: "Search Result Preview" }),
194
+ /* @__PURE__ */ c("div", {
213
195
  className: "rounded border border-gray-300 px-2 py-1",
214
196
  children: [
215
- /* @__PURE__ */ o("div", {
197
+ /* @__PURE__ */ s("div", {
216
198
  className: "mb-1 pt-1 text-xl text-[#1a0dab]",
217
- children: /* @__PURE__ */ o("label", { children: b })
199
+ children: /* @__PURE__ */ s("label", { children: x })
218
200
  }),
219
- /* @__PURE__ */ o("div", {
201
+ /* @__PURE__ */ s("div", {
220
202
  className: "text-sm text-[#006621]",
221
- children: /* @__PURE__ */ o("span", { children: "www.url.com" })
203
+ children: /* @__PURE__ */ s("span", { children: "www.url.com" })
222
204
  }),
223
- /* @__PURE__ */ o("div", {
205
+ /* @__PURE__ */ s("div", {
224
206
  className: "settings-seo__description mb-1 pt-1 text-sm",
225
- children: `${x.slice(0, 160)}...`
207
+ children: `${S.slice(0, 160)}...`
226
208
  })
227
209
  ]
228
210
  })
@@ -233,4 +215,4 @@ var h = ({ id: h = "", seoEnabled: g = !1, enabled: _ = !0, name: v = "", folder
233
215
  });
234
216
  };
235
217
  //#endregion
236
- export { h as default };
218
+ export { g as default };
@@ -1,61 +1,62 @@
1
1
  import e from "../../../Element/hocs/withElement.mjs";
2
- import t from "../../../Element/hooks/useElement.mjs";
3
- import n from "../../../Element/hooks/useRscData.mjs";
4
- import { RootElement as r } from "../../../Element/RootElement.mjs";
5
- import ee from "./declaration.mjs";
6
- import te from "./hooks/useApi.mjs";
7
- import ne from "./hooks/useProviderPagination.mjs";
8
- import re from "./hooks/useProviderWrite.mjs";
9
- import { use as ie, useCallback as i, useEffect as ae, useMemo as a } from "react";
10
- import oe from "@plitzi/sdk-shared/hooks/usePlitziServiceContext";
11
- import { useSdkStore as se } from "@plitzi/sdk-shared/store";
12
- import { StoreProvider as ce } from "@plitzi/nexus/react";
13
- import { emptyObject as o, getPathsFromObeject as le } from "@plitzi/sdk-shared/helpers/utils";
2
+ import ee from "../../../Element/hooks/useElement.mjs";
3
+ import te from "../../../Element/hooks/useRscData.mjs";
4
+ import { RootElement as t } from "../../../Element/RootElement.mjs";
5
+ import ne from "./declaration.mjs";
6
+ import re from "./hooks/useApi.mjs";
7
+ import ie from "./hooks/useProviderPagination.mjs";
8
+ import ae from "./hooks/useProviderWrite.mjs";
9
+ import oe from "../../../dataSource/pathFields.mjs";
10
+ import { use as se, useCallback as n, useEffect as ce, useMemo as r } from "react";
11
+ import le from "@plitzi/sdk-shared/hooks/usePlitziServiceContext";
12
+ import { useSdkStore as i } from "@plitzi/sdk-shared/store";
13
+ import { StoreProvider as a } from "@plitzi/nexus/react";
14
+ import { emptyObject as o } from "@plitzi/sdk-shared/helpers/utils";
14
15
  import { jsx as s } from "react/jsx-runtime";
15
16
  import { currentRscLocation as c } from "@plitzi/sdk-shared/server/rsc/refreshRsc";
16
17
  import l from "clsx";
17
18
  import u from "@plitzi/sdk-shared/dataSource/helpers/getSourceName";
18
- import d from "@plitzi/sdk-shared/dataSource/hooks/useRegisterSource";
19
- import { QueryBuilderEvaluator as ue } from "@plitzi/plitzi-ui/QueryBuilder";
19
+ import ue from "@plitzi/sdk-shared/dataSource/hooks/useRegisterSource";
20
+ import { QueryBuilderEvaluator as de } from "@plitzi/plitzi-ui/QueryBuilder";
20
21
  //#region src/elements/provider/ApiContainer/ApiContainer.tsx
21
- var f = ({ ref: e, className: f = "", children: p, query: m = "", method: h = "get", accessToken: g = "", when: _ = o, headers: v = o, mockData: y = "{}", subType: de = "", credentials: fe = "same-origin", singleRecord: b = !1, pagination: x = "none", pageParam: S = "page", renderWhileLoading: pe = !1, cache: me = !1, staleTime: he = 30, gcTime: ge = 300 }) => {
22
- let { id: C, visible: w, definition: { label: T = "Api Container", runtime: _e, items: ve } } = t(), E = _e === "server", { loaded: D, stale: O, location: k, elementData: A, refresh: j } = n(), M = u(ee.sourceType, C), { settings: { previewMode: N }, contexts: { InteractionsContext: P } } = oe(), { interactionsManager: F } = ie(P), [[I, L, ye]] = se([
22
+ var d = ({ ref: e, className: d = "", children: f, query: p = "", method: m = "get", accessToken: h = "", when: g = o, headers: _ = o, mockData: v = "{}", subType: y = "", credentials: fe = "same-origin", singleRecord: b = !1, pagination: x = "none", pageParam: pe = "page", renderWhileLoading: me = !1, cache: S = !1, staleTime: he = 30, gcTime: ge = 300 }) => {
23
+ let { id: C, visible: w, definition: { label: T = "Api Container", runtime: _e, items: ve } } = ee(), E = _e === "server", { loaded: D, stale: O, location: k, elementData: A, refresh: j } = te(), M = u(ne.sourceType, C), { settings: { previewMode: N }, contexts: { InteractionsContext: P } } = le(), { interactionsManager: F } = se(P), [[I, L, ye]] = i([
23
24
  "navigation.routeParams",
24
25
  "navigation.queryParams",
25
26
  "navigation.navigate"
26
- ]), be = a(() => g ? {
27
- ...v,
28
- Authorization: `Bearer ${g}`
29
- } : v, [v, g]), xe = a(() => E || !w ? !1 : !!(N && m && (_ === o || ue(_, {
27
+ ]), be = r(() => h ? {
28
+ ..._,
29
+ Authorization: `Bearer ${h}`
30
+ } : _, [_, h]), xe = r(() => E || !w ? !1 : !!(N && p && (g === o || de(g, {
30
31
  ...I,
31
32
  ...L
32
- })) || !N && (m || y && y !== "{}" && y !== o)), [
33
+ })) || !N && (p || v && v !== "{}" && v !== o)), [
33
34
  E,
34
35
  w,
35
36
  N,
36
- m,
37
- _,
37
+ p,
38
+ g,
38
39
  I,
39
40
  L,
40
- y
41
- ]), Se = a(() => [C], [C]), { isLoading: Ce, isFetching: we, data: R, refetch: z, isSuccess: B, isError: V } = te({
42
- url: m,
43
- method: h,
41
+ v
42
+ ]), Se = r(() => [C], [C]), { isLoading: Ce, isFetching: we, data: R, refetch: z, isSuccess: B, isError: V } = re({
43
+ url: p,
44
+ method: m,
44
45
  credentials: fe,
45
- mock: N ? void 0 : y,
46
+ mock: N ? void 0 : v,
46
47
  customHeaders: be,
47
48
  enabled: xe,
48
- cache: me,
49
+ cache: S,
49
50
  staleTime: he,
50
51
  gcTime: ge,
51
52
  tags: Se
52
- }), H = E && !!k && k !== c(), U = E && D && !H && A === null, W = a(() => {
53
+ }), H = E && !!k && k !== c(), U = E && D && !H && A === null, W = r(() => {
53
54
  if (!E) return R ?? o;
54
55
  if (A) return A;
55
56
  if (D) return o;
56
- if (typeof y != "string") return y;
57
+ if (typeof v != "string") return v;
57
58
  try {
58
- return JSON.parse(y || "{}");
59
+ return JSON.parse(v || "{}");
59
60
  } catch {
60
61
  return o;
61
62
  }
@@ -64,8 +65,8 @@ var f = ({ ref: e, className: f = "", children: p, query: m = "", method: h = "g
64
65
  R,
65
66
  A,
66
67
  D,
67
- y
68
- ]), G = E ? H : we, Te = E ? H : Ce, K = i(async () => {
68
+ v
69
+ ]), G = E ? H : we, Te = E ? H : Ce, K = n(async () => {
69
70
  if (!E) {
70
71
  z();
71
72
  return;
@@ -76,23 +77,23 @@ var f = ({ ref: e, className: f = "", children: p, query: m = "", method: h = "g
76
77
  z,
77
78
  j,
78
79
  C
79
- ]), q = W, Ee = a(() => Array.isArray(q.records) ? q.records : [], [q.records]), { records: J, isLoadingMore: Y, goToPage: X, loadMore: Z } = ne({
80
+ ]), q = W, Ee = r(() => Array.isArray(q.records) ? q.records : [], [q.records]), { records: J, isLoadingMore: Y, goToPage: X, loadMore: Z } = ie({
80
81
  elementId: C,
81
82
  mode: x,
82
- pageParam: S,
83
+ pageParam: pe,
83
84
  records: Ee,
84
85
  page: q.pageInfo?.page ?? 1,
85
86
  refresh: j,
86
87
  navigate: ye
87
88
  });
88
- ae(() => {
89
+ ce(() => {
89
90
  !G && C && (B ? F.interactionTrigger(C, "onApiSuccess", {
90
- url: m,
91
- method: h,
91
+ url: p,
92
+ method: m,
92
93
  ...W
93
94
  }) : V && F.interactionTrigger(C, "onApiError", {
94
- url: m,
95
- method: h,
95
+ url: p,
96
+ method: m,
96
97
  ...W
97
98
  }));
98
99
  }, [
@@ -102,10 +103,10 @@ var f = ({ ref: e, className: f = "", children: p, query: m = "", method: h = "g
102
103
  V,
103
104
  G,
104
105
  B,
105
- h,
106
- m
106
+ m,
107
+ p
107
108
  ]);
108
- let Q = a(() => ({
109
+ let Q = r(() => ({
109
110
  ...W,
110
111
  ...Array.isArray(q.records) ? { records: J } : o,
111
112
  isLoading: G || Y,
@@ -124,27 +125,18 @@ var f = ({ ref: e, className: f = "", children: p, query: m = "", method: h = "g
124
125
  U,
125
126
  E,
126
127
  O
127
- ]), De = i(() => le(Q).reduce((e, t) => {
128
- let n = t.split(".");
129
- return n.length > 1 ? [...e, {
130
- path: t,
131
- name: n.slice(n.length - 2).join(" ")
132
- }] : [...e, {
133
- path: t,
134
- name: n[n.length - 1]
135
- }];
136
- }, []), [Q]);
137
- d({
128
+ ]), De = n(() => oe(Q), [Q]);
129
+ ue({
138
130
  id: C,
139
131
  source: M,
140
132
  name: T || `API - ${C}`,
141
133
  fields: De
142
134
  });
143
- let { writeRecord: $ } = re({
135
+ let { writeRecord: $ } = ae({
144
136
  elementId: C,
145
137
  enabled: E,
146
138
  onDone: K
147
- }), Oe = a(() => {
139
+ }), Oe = r(() => {
148
140
  let e = {
149
141
  performQuery: {
150
142
  action: "performQuery",
@@ -201,7 +193,7 @@ var f = ({ ref: e, className: f = "", children: p, query: m = "", method: h = "g
201
193
  X,
202
194
  E,
203
195
  $
204
- ]), ke = a(() => ({
196
+ ]), ke = r(() => ({
205
197
  onApiError: {
206
198
  action: "onApiError",
207
199
  title: "On Api Error",
@@ -226,20 +218,20 @@ var f = ({ ref: e, className: f = "", children: p, query: m = "", method: h = "g
226
218
  data: ""
227
219
  }
228
220
  }
229
- }), []), Ae = a(() => M ? { runtime: { sources: { [M]: Q } } } : o, [Q, M]);
230
- return /* @__PURE__ */ s(r, {
221
+ }), []), Ae = r(() => M ? { runtime: { sources: { [M]: Q } } } : o, [Q, M]);
222
+ return /* @__PURE__ */ s(t, {
231
223
  ref: e,
232
- tag: !N && !ve?.length ? "div" : de,
233
- className: l("plitzi-component__api-container", f),
224
+ tag: !N && !ve?.length ? "div" : y,
225
+ className: l("plitzi-component__api-container", d),
234
226
  interactionTriggers: ke,
235
227
  interactionCallbacks: Oe,
236
- children: (!Te || pe) && /* @__PURE__ */ s(ce, {
228
+ children: (!Te || me) && /* @__PURE__ */ s(a, {
237
229
  inherit: "live",
238
230
  name: `Api:${C}`,
239
231
  value: Ae,
240
- children: p
232
+ children: f
241
233
  })
242
234
  });
243
- }, p = e(f);
235
+ }, f = e(d);
244
236
  //#endregion
245
- export { f as ApiContainer, p as default };
237
+ export { d as ApiContainer, f as default };
@@ -26,7 +26,7 @@ var t = e()({
26
26
  definition: {
27
27
  label: "Api Container",
28
28
  type: "apiContainer",
29
- description: "Fetches data from a backend HTTP API (its `query`/`method`/`credentials`) and exposes the response as a data source ITS DESCENDANTS bind to (source `apiContainer_<id>.data`; only elements inside it can consume it). This is how you get backend data into the frontend. Its `mockData` prop is builder-only sample data — the published runtime fetches the real `query`, so always set a real query for production. With `cache: true` a browser request is kept for `staleTime` seconds (default 30) and shared with every provider asking the same thing; it is off unless set. A flow refreshes it with `performQuery` or the global `invalidateQueries` step.",
29
+ description: "Fetches data from a backend HTTP API (its `query`/`method`/`credentials`) and exposes the response as a data source ITS DESCENDANTS bind to (source `apiContainer_<id>.data`; only elements inside it can consume it). This is how you get backend data into the frontend. Its `mockData` prop is builder-only sample data — the published runtime fetches the real `query`, so always set a real query for production. With `cache: true` a browser request is kept for `staleTime` seconds (default 30) and shared with every provider asking the same thing; it is off unless set. A flow refreshes it with `performQuery` or the global `invalidateQueries` step. Its `subType` (container tag) is empty by default, and then it renders NO element of its own: its children lay out directly in its parent, and any class, variant or style binding on it applies to nothing. To style the provider itself give it a tag (`subType: \"div\"`, `section`, …); otherwise style its parent or a child.",
30
30
  items: [],
31
31
  bindings: {},
32
32
  styleSelectors: { base: "" },
@@ -39,6 +39,14 @@ declare const useApi: ({ url, method, mock, customHeaders, enabled, credentials,
39
39
  isFetching: boolean;
40
40
  data: ApiResponse | undefined;
41
41
  refetch: () => void;
42
+ /**
43
+ * Whether THIS question has been answered — not whether an answer is on screen.
44
+ *
45
+ * The last answer is kept visible while the URL is unaskable, so nothing flickers; reporting it as this URL's
46
+ * success is a different claim and a wrong one. It fired `onApiSuccess` again on the way out of a page — the
47
+ * URL is one of the trigger's dependencies — and the flow behind it set the workspace id from a route param
48
+ * the page had already lost, which emptied it.
49
+ */
42
50
  isSuccess: boolean;
43
51
  isError: boolean;
44
52
  };